ptrace(PTRACE_SYSCALL) and data field
the ptrace(2) page doesnt say anything about the data field (ignored or otherwise). it seems to be ignored, but i didnt trace the kernel exhaustively. the examples found via google shows that it's ignored. strace usage seems odd (it passes in an irrelevant pointer), which would indicate it's ignored as well ...
-mike
A message that is not in the archive (sent off-list or not yet received): 200903172346.32372.vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org
Hi Mike,
(Roland may be able to help out here.)
Quoted 5 lines · Mike Frysinger
the ptrace(2) page doesnt say anything about the data field (ignored or otherwise). it seems to be ignored, but i didnt trace the kernel exhaustively. the examples found via google shows that it's ignored. strace usage seems odd (it passes in an irrelevant pointer), which would indicate it's ignored as well ...
It's true that this looks like a defect in the man page. But I'm not sure what the fix is.
In the kernel source file kernel/ptrace.c, function ptrace_resume() we have the line
child->exit_code = data;
which seems to be executed by the PRACE_SYSCALL code path. That implies that data is treated as a signal number (like PTRACE_CONT).
That seems consistent with the following in the strace.c source file of strace(1):
if (ptrace(PTRACE_SYSCALL, pid, (char *) 1,
WSTOPSIG(status)) < 0) {
perror("trace: ptrace(PTRACE_SYSCALL, ...)");
cleanup();
return -1;
}Did I misunderstand something? Your thoughts?
Cheers,
Michael
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): cfd18e0f0903291500s42eb323nd0d9ab8c1f7c4dbc-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
All of the "resuming" ptracer requests treat the data argument the same. Those are PTRACE_CONT, PTRACE_SYSCALL, PTRACE_*STEP, PTRACE_SYSEMU*. The data argument is either 0 or a signal number.
The addr argument is ignored by all these.
Roland
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20090329223508.4521DFC2A8-nL1rrgvulkc2UH6IwYuUx0EOCMrvLtNR@public.gmane.org
Quoted 4 lines · Roland McGrath
All of the "resuming" ptracer requests treat the data argument the same. Those are
PTRACE_CONT,PTRACE_SYSCALL, PTRACE_*STEP, PTRACE_SYSEMU*. The data argument is either 0 or a signal number.
The addr argument is ignored by all these.
Thanks for jumping in Roland.
So, for PTRACE_SYSCALL, the sameantics are like PTRACE_CONT, that is, it is interpreted as a signal to be sent to the child. Right?
Cheers,
Michael
Signature · 9 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): cfd18e0f0903291547s75749b01icbf99b6eab335cce-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 10 lines · Roland McGrath
Quoted 4 lines
All of the "resuming" ptracer requests treat the data argument the same. Those are
PTRACE_CONT,PTRACE_SYSCALL, PTRACE_*STEP, PTRACE_SYSEMU*. The data argument is either 0 or a signal number.
The addr argument is ignored by all these.Thanks for jumping in Roland.
So, for
PTRACE_SYSCALL, the sameantics are likePTRACE_CONT, that is, it is interpreted as a signal to be sent to the child. Right?
For all those requests, yes.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20090329233402.9C695FC2A8-nL1rrgvulkc2UH6IwYuUx0EOCMrvLtNR@public.gmane.org
Quoted 6 lines · Roland McGrath
Quoted 6 lines · Roland McGrath
Quoted 4 lines
All of the "resuming" ptracer requests treat the data argument the same. Those are
PTRACE_CONT,PTRACE_SYSCALL, PTRACE_*STEP, PTRACE_SYSEMU*. The data argument is either 0 or a signal number.
The addr argument is ignored by all these.
Quoted 6 lines
Quoted 4 lines
Thanks for jumping in Roland.
So, for
PTRACE_SYSCALL, the sameantics are likePTRACE_CONT, that is, it is interpreted as a signal to be sent to the child. Right?For all those requests, yes.
Thanks for the confirmation, Roland.
Cheers,
Michael
Signature · 9 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 6 lines · Roland McGrath
Quoted 6 lines · Roland McGrath
Quoted 4 lines
All of the "resuming" ptracer requests treat the data argument the same. Those are
PTRACE_CONT,PTRACE_SYSCALL, PTRACE_*STEP, PTRACE_SYSEMU*. The data argument is either 0 or a signal number.
The addr argument is ignored by all these.
Quoted 6 lines
Quoted 4 lines
Thanks for jumping in Roland.
So, for
PTRACE_SYSCALL, the sameantics are likePTRACE_CONT, that is, it is interpreted as a signal to be sent to the child. Right?For all those requests, yes.
Hmmm. The existing man page includes this text:
PTRACE_SYSEMU, PTRACE_SYSEMU_SINGLESTEP (since Linux 2.6.14)
...
(addr and data are ignored; ...
which according to what you've said (and also according to my reading of the source), is wrong. Correct?
Cheers,
Michael
Signature · 9 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): cfd18e0f0903291654uea58687x5fb16d0b794e69cf-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 8 lines
Hmmm. The existing man page includes this text:
PTRACE_SYSEMU,PTRACE_SYSEMU_SINGLESTEP(since Linux 2.6.14)
...
(addr and data are ignored; ...which according to what you've said (and also according to my reading of the source), is wrong. Correct?
Yes, those also treat the signal argument like PTRACE_CONT et al.
Thanks,
Roland
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20090330000712.C0B54FC2A8-nL1rrgvulkc2UH6IwYuUx0EOCMrvLtNR@public.gmane.org
Quoted 10 lines · Roland McGrath
Quoted 8 lines
Hmmm. The existing man page includes this text:
PTRACE_SYSEMU,
PTRACE_SYSEMU_SINGLESTEP(since Linux 2.6.14)
...
(addr and data are ignored; ...which according to what you've said (and also according to my reading of the source), is wrong. Correct?
Yes, those also treat the signal argument like
PTRACE_CONTet al.
Thanks!
Signature · 9 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 6 lines · Mike Frysinger
the ptrace(2) page doesnt say anything about the data field (ignored or otherwise). it seems to be ignored, but i didnt trace the kernel exhaustively. the examples found via google shows that it's ignored. strace usage seems odd (it passes in an irrelevant pointer), which would indicate it's ignored as well ...
-mike
Mike,
For man-pages-3.20, I've upated the PTRACE_SYSCALL documentation to note that 'data' is used as for PTRACE_CONT. I've also added similar text to PTRAC_SYSEMU*.
Cheers,
Michael
Signature · 9 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html