Skip to content

Commit 91049bc

Browse files
committed
Suppress clippy::not_unsafe_ptr_arg_deref warnings in ptrace on BSD
Technically these functions don't violate Rust's safety rules, because libc::ptrace doesn't dereference those pointer args. Instead, it passes them directly to the kernel.
1 parent 475da53 commit 91049bc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/sys/ptrace/bsd.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ pub fn step<T: Into<Option<Signal>>>(pid: Pid, sig: T) -> Result<()> {
167167
}
168168

169169
/// Reads a word from a processes memory at the given address
170+
// Technically, ptrace doesn't dereference the pointer. It passes it directly
171+
// to the kernel.
172+
#[allow(clippy::not_unsafe_ptr_arg_deref)]
170173
pub fn read(pid: Pid, addr: AddressType) -> Result<c_int> {
171174
unsafe {
172175
// Traditionally there was a difference between reading data or
@@ -176,6 +179,9 @@ pub fn read(pid: Pid, addr: AddressType) -> Result<c_int> {
176179
}
177180

178181
/// Writes a word into the processes memory at the given address
182+
// Technically, ptrace doesn't dereference the pointer. It passes it directly
183+
// to the kernel.
184+
#[allow(clippy::not_unsafe_ptr_arg_deref)]
179185
pub fn write(pid: Pid, addr: AddressType, data: c_int) -> Result<()> {
180186
unsafe { ptrace_other(Request::PT_WRITE_D, pid, addr, data).map(drop) }
181187
}

0 commit comments

Comments
 (0)