Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PTRACE_GETREGSET and PTRACE_SETREGSET basic implementation on aarch64 #1695

Closed
wants to merge 2 commits into from

Conversation

irgstg
Copy link

@irgstg irgstg commented Apr 10, 2022

As I mentioned in #1419 (comment) 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 ptrace calls to receive and modify data via iovec: ptrace_get_iovec_data and ptrace_set_iovec_data.
  • Two pub functions that supports modify and read of tracee's registers: ptrace_getregset and ptrace_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.

@irgstg irgstg force-pushed the aarch64_regsets branch 9 times, most recently from b50cfae to 13c361a Compare April 12, 2022 15:03
@tiann
Copy link

tiann commented Aug 5, 2022

any updates?

@irgstg irgstg force-pushed the aarch64_regsets branch 2 times, most recently from 8f513e0 to 5f58d00 Compare August 20, 2022 23:21
@irgstg
Copy link
Author

irgstg commented Oct 3, 2022

any updates?

Seems like I did my job?

@2096779623
Copy link

2096779623 commented Nov 5, 2022

Can someone review this PR?

@dolby360
Copy link

I'm also waiting for this PR to merge.

@SteveLauC
Copy link
Member

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.

@SteveLauC
Copy link
Member

I tend to merge #2044 as it:

  1. Allows users to specify the register set
  2. Has riscv64 supported 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:<

@SteveLauC SteveLauC closed this Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants