Skip to content

Commit 7ac8aba

Browse files
committed
Add comments
1 parent c68fb33 commit 7ac8aba

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/sys/ptrace.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,15 @@ pub fn peekuser(pid: Pid, reg: Register) -> Result<Word> {
204204
}
205205
}
206206

207-
/// Makes the `PTRACE_PEEKUSER` request to ptrace
207+
/// Makes the `PTRACE_POKEUSER` request to ptrace
208+
///
209+
/// When incorrectly used, may change the registers to bad values,
210+
/// causing e.g. memory being corrupted by a syscall, thus is marked unsafe
208211
pub unsafe fn pokeuser(pid: Pid, reg: Register, val: Word) -> Result<()> {
209212
let reg_arg = (reg as u64) as *mut c_void;
210213
ptrace(ptrace::PTRACE_POKEUSER, pid, reg_arg, val as *mut c_void).map(|_| ()) // ignore the useless return value
211214
}
212215

213-
214216
/// Sets the process as traceable with `PTRACE_TRACEME`
215217
pub fn traceme() -> Result<()> {
216218
unsafe {

0 commit comments

Comments
 (0)