[PATCH 128] introduce suppress_sigtrap() to prevent unwanted send_sigtrap()

Oleg Nesterov oleg at redhat.com
Thu Nov 5 10:56:50 UTC 2009


On 11/04, Roland McGrath wrote:
>
> All of this is just to work around the x86-specific case
> of the step state on return from tracehook_report_syscall_exit() producing
> (or not producing) the synthetic single-step SIGTRAP.

Yes.

> I think the sequence of changes we'll want for this is something like:

Oh. Just can't understand what do you mean.

> 1. (upstream) add arch hook(s) for single-step SIGTRAP siginfo_t + arch
>    fields (i.e. x86's thread.error_code + thread.trap_no).

OK. say, arch_fill_sigtrap_info(siginfo_t *info, ...).

> 2. (upstream) change tracehook_report_syscall_exit() to use force_sig_info
>    instead of ptrace_notify,

force_sig_info() instead of ptrace_notify() ?

So, the tracee doesn't stop in tracehook_report_syscall_exit() path
but sends the arch_fill_sigtrap_info()'ed signal to itself ?

> use that arch hook

"that" means arch_fill_sigtrap_info() above?

>    -> powerpc et al PTRACE_SINGLESTEP-over-syscall goes from
>    ptrace-swallows-signal to normal signal case
> 3. (upstream) implement that arch hook for at least powerpc
>    -> synthetic SIGTRAP gets si_* as a real step would, rather than 0
> 4. (upstream) implement that arch hook for x86

again, "that arch hook" means arch_fill_sigtrap_info() ?

> 5. (upstream) change x86 syscall_trace_leave to pass flag
>    tracehook_report_syscall_exit(), not call send_sigtrap()

you mean, pass TIF_SINGLESTEP flag to tracehook_report_syscall_exit()
and do not call send_sigtrap() ?

>    -> x86 PTRACE_SINGLESTEP from syscall-exit stop no longer fake-traps
>       without another insn, but takes a true step trap after next insn

But. 2. above suggests to use force_sig_info() ? Perhaps, this should
depend on TIF_SINGLESTEP flag passed to tracehook_report_syscall_exit() ?

In any case, "but takes a true step trap after next insn" means the
serious user-visible change?

>    -> compatible with powerpc et al behavior, makes more sense

What was the point of send_sigtrap() then?


Roland, I am all confused. Could you please explain what should
syscall_trace_leave(TIF_SINGLESTEP) do, at least on x86 machine?

What it should do if TIF_SINGLESTEP is set, but TIF_SYSCALL_TRACE
is not? In this case tracehook_report_syscall_exit() is not called.

Perhaps you can explain this with some pseudo code?

Oleg.




More information about the utrace-devel mailing list