RE: [PATCH RFC][try 2] IA64 signal : remove redundant code in setup_sigcontext()

From: Luck, Tony
Date: Tue Dec 18 2007 - 18:29:33 EST


>> This patch removes some redundant code in the function setup_sigcontext().
>>
>> The registers ar.ccv,b7,r14,ar.csd,ar.ssd,r2-r3 and r16-r31 are not restored
>> in restore_sigcontext() when (flags & IA64_SC_FLAG_IN_SYSCALL) is true.
>> So we don't need to zero those variables in setup_sigcontext().
>
> Erm, couldn't those registers contain information the process shouldn't
> see?

No, this looks safe. setup_sigcontext() is stashing things out on the
user stack to be used by restore_sigcontext() should the application want
to return from the signal handler. But restore_sigcontext isn't actually
in charge of putting values into machine registers, it just does the copy
back from user space to the place where the asm code will restore registers
on the way back to userland. In this instance "restored" means "set back to
the state they had before the signal happened". If they aren't "restored"
they'll have scratch values ... but those scratch values will have come
from the application (while it was executing the signal handler). Not
leaked from the kernel or from some other application.

-Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/