nix
nix copied to clipboard
PTRACE_GETREGSET and PTRACE_SETREGSET basic implementation on aarch64
As I mentioned in https://github.com/nix-rust/nix/issues/1419#issuecomment-1094251694 I had this code implemented in a personal project of mine.
As some of you might know, to read and modify tracee's registers with ptrace on aarch64, one need to do so by calling ptrace via iovec. (man ptrace under PTRACE_GETREGSET)
This current PR supports aarch64 linux and android and includes:
- Two generic
ptracecalls to receive and modify data viaiovec:ptrace_get_iovec_dataandptrace_set_iovec_data. - Two pub functions that supports modify and read of tracee's registers:
ptrace_getregsetandptrace_setregset - Test function,
test_ptrace_regsets, that receives tracee's registers, modify one of them, and validate if the modification completed successfully.
I might will modify some minor changes.
I want to get you're special attention about this line from man ptrace:
On return, the kernel modifies iov.len to indicate the actual number of bytes returned.
In my original implemented I didn't add anything to validate that, and I'm not aware what'd this repo's conventions dictate in such occasion, so leave a comment and I will edit the code as necessery.
Please let me know if I forgot or missed something.
any updates?
any updates?
Seems like I did my job?
Can someone review this PR?
I'm also waiting for this PR to merge.
Hi, plan to take a look at this PR this weekend, sorry for being so late, and I am not sure if we can have @irgstg back as it has been 2 years, if not, I will file a PR to supersede this one.
I tend to merge #2044 as it:
- Allows users to specify the register set
- Has
riscv64supported as well
@irgstg, thanks for your work and this detailed description, it helps a lot! And I am sorry that I will close this PR:<