Commit e1e630f
authored
Fix syscall_info (#2653)
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.
Co-authored-by: Cédric Barreteau <[email protected]>1 parent caeaf33 commit e1e630f
File tree
3 files changed
+41
-1
lines changed- changelog
- examples
- src/sys/ptrace
3 files changed
+41
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
504 | 504 | | |
505 | 505 | | |
506 | 506 | | |
507 | | - | |
| 507 | + | |
508 | 508 | | |
509 | 509 | | |
510 | 510 | | |
| |||
0 commit comments