On 07/07/2017 12:45 PM, Florian Weimer wrote:
On 07/07/2017 12:22 PM, Stefan Liebler wrote:
+ /* Ptrace request 12 is done with zero data argument:
+ -If the kernel has support for PTRACE_SINGLEBLOCK (then the kernel
+ header asm/ptrace.h defines this macro), the ptrace call is not
allowed
+ to fail and has to continue the tracee until next taken branch.
+
+ -If the kernel (<3.15) has no support for PTRACE_SINGLEBLOCK, the
+ ptrace call has to fail with EIO. Then I continue the tracee with
+ PTRACE_CONT.
+
+ -If the request 12 is interpreted as PTRACE_GETREGS, it will
fail too.
+ It fails with EFAULT on intel / power as data argument is NULL.
+ According to the man-page: "Unfortunately, under Linux, different
+ variations of this fault will return EIO or EFAULT more or less
+ arbitrarily".
+ But if request 12 is interpreted as PTRACE_GETREGS, the first
ptrace
+ call will touch the buffer which is detected by this test. */
I think the comment is still a bit off. I think it is only necessary to
retain the second two lines, the other things is already implied by the
short comments in the code below.
okay. I removed the other lines.
(I have not tested whether this actually works. I assume you have
checked a couple of userspace/kernel permutations.)
Yes. I've run the test on several machines.
Thanks,
Florian
If this is okay, I'll commit it on Monday.