[RFC PATCH] ptrace: add PTRACE_GET_SYSCALL_INFO request

Oleg Nesterov oleg at redhat.com
Thu Nov 8 09:16:38 UTC 2018


On 11/07, Elvira Khabirova wrote:
>
> On Wed, 7 Nov 2018 17:44:44 +0100
> Oleg Nesterov <oleg at redhat.com> wrote:
>
> > To me PT_IN_SYSCALL_STOP makes no real sense, but I won't argue.
> >
> > At least I'd ask to not abuse task->ptrace. ptrace_report_syscall() can clear
> > ->ptrace_message on exit if we really want PTRACE_GET_SYSCALL_INFO to fail after
> > that.
>
> I really would not like to rely on ->ptrace_message remaining empty;
> this looks too fragile.

Well. I do not understand why this is fragile. And certainly this is not more
fragile than

	current->ptrace |= PT_IN_SYSCALL_STOP;
	trace_notify();
	current->ptrace &= ~PT_IN_SYSCALL_STOP;

simply because both ->ptrace updates are technically wrong. The tracee can race
with the exiting tracer which clears ->ptrace.

But even if this was correct. This patch manipulates ->ptrace_message anyway,
I do not understand why should we abuse ->ptrace too just to for the sanity
check in PTRACE_GET_SYSCALL_INFO.

Oleg.



More information about the Strace-devel mailing list