Repository navigation
Use unsigned long instead of int for PTRACE_GETEVENTMSG. - #2883
Conversation
|
I just found now the few c++ tests would get currently also compiled with asan, |
c678f14 to
a474afc
Compare
|
I guessed that using asan build options just for rr would be the way to go, and pushed a new version of the first patch. |
This. |
|
We would also need to be able to run rr with the ASAN library dynamically linked, but NOT pass that library name through to rr's spawned children. |
| status = WaitStatus(raw_status); | ||
| unsigned long tmp_status = raw_status; | ||
| if (ptrace_if_alive(PTRACE_GETEVENTMSG, nullptr, &tmp_status)) { | ||
| status = WaitStatus(tmp_status); |
There was a problem hiding this comment.
This looks good, but call it long_status.
|
In this PR let's just fix the memory corruption. Applying ASAN to rr should be a separate PR. Thanks! |
a474afc to
c5a1889
Compare
|
Thanks for reviewing, I have pushed a new version with the cmake change removed and the variable renamed. |
| */ | ||
| if (ptrace_if_alive(PTRACE_GETEVENTMSG, nullptr, &raw_status)) { | ||
| status = WaitStatus(raw_status); | ||
| unsigned long long_status = raw_status; |
There was a problem hiding this comment.
Assigning it to raw_status is not necessary, right?
There was a problem hiding this comment.
From the man page PTRACE_GETEVENTMSG seems to be just writing to data,
so yes, this assignment seems unnecessary. I will remove it.
"int raw_status" is just 4 bytes, but PTRACE_GETEVENTMSG writes "unsigned long" with 8 bytes at x86_64. Visible in replay of accept test with asan enabled rr build.
c5a1889 to
28a8835
Compare
|
Thanks for merging. |
"int raw_status" is just 4 bytes, but PTRACE_GETEVENTMSG writes
"unsigned long" with 8 bytes at x86_64.
Visible in replay of accept test.
Included is also a patch to add a cmake option to build rr with address sanitizer.
Should that be a separate PR, or is such a option even desired?