Re: signal delivery, was Re: reliable reproducer

Andreas Schwab
2023-04-25T11:25:25Z

On Apr 25 2023, Finn Thain wrote:

> It turns out that doing so (patch below) does make the problem go away.
> Was the exception frame getting clobbered?
>
> diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
> index b9f6908a31bc..94104699f5a8 100644
> --- a/arch/m68k/kernel/signal.c
> +++ b/arch/m68k/kernel/signal.c
> @@ -862,7 +862,7 @@ get_sigframe(struct ksignal *ksig, size_t frame_size)
> {
> unsigned long usp = sigsp(rdusp(), ksig);
>
> - return (void __user *)((usp - frame_size) & -8UL);
> + return (void __user *)((usp - 256 - frame_size) & -8UL);

Probably the issue is that a bus error exception should never start
signal delivery when returning to user space. On the 030 returning from
a bus error resumes the execution of the faulting insn (unlike the
040/060 which restart it), and the saved USP may have the original value
from before the insn started (modified registers may not be updated
until the insn is complete or just before the final bus cycle). Signal
delivery should only ever happen at insn boundaries.

--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."