Re: m68k, signals and single-stepping

Geert Uytterhoeven
2010-09-30T06:07:06Z

Hi Al,

On Thu, Sep 30, 2010 at 07:58, Al Viro <viro@zeniv.linux.org.uk> wrote:
>        I've been trying to sort out what's going on with TIF_DELAYED_TRACE,
> but unfortunately neither User's Manual for 68040 nor Programmer's Reference
> Manual for 68k family cover tracing exceptions in enough details ;-/
>
>        a) regs.SR.T1 is cleared if you have created a sigframe; in
> addition, SIGTRAP is sent to yourself.
>        b) if you leave a syscall and see TIF_DELAYED_TRACE set, you
> do the same thing, signals or no signals.
>        c) if you leave an exception *and* no signal handlers are triggered,
> you leave T1 alone.
>        d) if you step into a tracing exception, you get SIGTRAP again,
> with si_code set to TRAP_TRACE (instead of SI_KERNEL); si_addr is set
> (unlike the previous cases).
>        e) TIF_DELAYED_TRACE is set when you ask for singlestepping;
> the same thing sets SR.T1.
>        f) PTRACE_POKEUSR can't change tracing bits in SR; neither can
> sigreturn.
>        g) if UM is clear on anything, it's that for TRAP the tracing
> exception is handled before entering the trap itself.
>
> So what's that SIGTRAP on exit from syscall in single-stepping mode for?
> I can understand doing that when we've set a signal handler up, but...
>
> There'd been some changes of behaviour in cset with rather uninformative
> commit message
>    [PATCH] M68k update (part 42)
>    M68k task and thread updates
> and AFAICS until that point we had the same "send SIGTRAP and clear T1" on
> ret_from_exception, no matter what had led there.  Was that a bugfix or
> just an unintended change?
>
> BTW, there's a bunch of signal races in m68k, mostly parallel to similar
> crap I'd been fixing lately on other targets; I have fixes, but I'd rather
> understand what's going on with tracing in there before touching the
> more subtle ones...

Sorry, I don't know. I try to stay away from the signal code as much
as possible.

Perhaps Andreas knows?

Anyway, thanks for looking into this!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds