summaryrefslogtreecommitdiff
path: root/src/sys/ptrace
diff options
context:
space:
mode:
authorAlan Somers <asomers@gmail.com>2022-01-22 14:46:07 -0700
committerAlan Somers <asomers@gmail.com>2022-01-22 14:48:48 -0700
commit91049bc03be6a15f10f898fee89ad03a05bb886d (patch)
tree439023e92fdad8e9238029de4e1749f4bffd6143 /src/sys/ptrace
parent475da53d562293553934d0e579e91f2bf3be30f7 (diff)
downloadnix-91049bc03be6a15f10f898fee89ad03a05bb886d.zip
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.
Diffstat (limited to 'src/sys/ptrace')
-rw-r--r--src/sys/ptrace/bsd.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sys/ptrace/bsd.rs b/src/sys/ptrace/bsd.rs
index ac7d8312..c4cc7403 100644
--- a/src/sys/ptrace/bsd.rs
+++ b/src/sys/ptrace/bsd.rs
@@ -167,6 +167,9 @@ pub fn step<T: Into<Option<Signal>>>(pid: Pid, sig: T) -> Result<()> {
}
/// Reads a word from a processes memory at the given address
+// Technically, ptrace doesn't dereference the pointer. It passes it directly
+// to the kernel.
+#[allow(clippy::not_unsafe_ptr_arg_deref)]
pub fn read(pid: Pid, addr: AddressType) -> Result<c_int> {
unsafe {
// Traditionally there was a difference between reading data or
@@ -176,6 +179,9 @@ pub fn read(pid: Pid, addr: AddressType) -> Result<c_int> {
}
/// Writes a word into the processes memory at the given address
+// Technically, ptrace doesn't dereference the pointer. It passes it directly
+// to the kernel.
+#[allow(clippy::not_unsafe_ptr_arg_deref)]
pub fn write(pid: Pid, addr: AddressType, data: c_int) -> Result<()> {
unsafe { ptrace_other(Request::PT_WRITE_D, pid, addr, data).map(drop) }
}