Conversation
9076df2 to
499f154
Compare
|
Hello @SteveLauC, this is my first contribution here, I'm not sure who to ask for a review. Would you mind having a look? Thanks! |
|
@asomers instead maybe? Feel free to redirect me to someone else! |
|
Sorry for bumping this again, but could you please take a look @asomers? |
asomers
left a comment
There was a problem hiding this comment.
Approved. Also, since you wrote such a nice example program, you might consider adding it to Nix's examples directory.
40ecada to
c5b44c7
Compare
According to the man page: > The addr argument contains the size of the buffer pointed to by the > data argument (i.e., sizeof(struct ptrace_syscall_info)). We were setting the data argument, so this syscall was returning garbage. This is easily reproduced and verified by looking at the `op` value, which should range from 0 to 3. The PR associated with this commit contains a sample program to demonstrate this. The fix is done in the `ptrace_get_data` helper to avoid duplicating its implementation just for `syscall_info`. Of all the other callers, all but one are documented as ignoring `addr`. The other one (`PTRACE_GETREGS`) is documented as ignoring `addr` _except on SPARC systems_, on which `addr` and `data` are reversed. However, this is already not respected by `nix`, so this changes is not disruptive in this regard. There should be no performance concerns as we are replacing one constant with another.
c5b44c7 to
7f6a8de
Compare
|
I've rebased the branch and added the example. Sorry for the mess, it took me a while to figure out the right If everything looks fine to you, could you merge this after approving it again? I couldn't merge the branch even after you had approved it. Thanks! |
What does this PR do
It fixes
ptrace::syscall_info, which is currently broken (at least on Linux 6.12.31).See the commit message for more details.
Reproduction
The following program panics when built against
masterand behaves correctly (i.e. it does not panic and prints valid syscall info) when built against this branch:Checklist:
CONTRIBUTING.md