Re: pt_regs leak into userspace (was Re: [PATCH v3 20/71] ARC: Signal handling)

From: Jonas Bonn
Date: Mon Feb 11 2013 - 05:53:59 EST

On 11 February 2013 11:28, James Hogan <james.hogan@xxxxxxxxxx> wrote:
> On 11/02/13 10:13, Vineet Gupta wrote:
>> On Monday 11 February 2013 03:06 PM, Jonas Bonn wrote:
>>> On 11 February 2013 08:26, Vineet Gupta <Vineet.Gupta1@xxxxxxxxxxxx> wrote:
>>>> The only downside of this patch is that userspace signal stack grows in size,
>>>> since signal frame only cares about scratch regs (pt_regs), but has to accommodate
>>>> unused placeholder for callee regs too by virtue of using user_regs_struct.
>>> Is this really true? Don't setcontext and friends require that _all_
>>> the registers be part of sigcontext?
>> But for an ABI - callee saved regs will anyhow be saved/restored even in
>> setcontext case ! So collecting it for that purpose seems useless, or am I missing
>> something here.
> I think Jonas' point was that signals are asynchronous, i.e. you could
> get interrupted by a signal at virtually any time during the program's
> execution.

No, I agree that the callee-saved regs don't need to be saved across a
signal handler invocation. It's really just the setcontext case that
wants to be able to swap out the callee-saved regs.

And now that I think about it some more, I think this is done
incorrectly in the openrisc arch, too, as the fast-path for
rt_sigreturn probably only restores the call-clobbered regs.
sigreturn probably needs to be special-cased to _always_ restore all
the regs on its way back to userspace. Not for the "signal" case, but
for the "setcontext" case; but these two are pretty-much

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at