* [PATCH] signal: initialize k_sigaction in sys_signal()
@ 2026-11-23 9:13 Henry Martin
2026-11-23 11:56 ` Oleg Nesterov
0 siblings, 1 reply; 2+ messages in thread
From: Henry Martin @ 2026-11-23 9:13 UTC (permalink / raw)
To: Oleg Nesterov, Andrew Morton, Christian Brauner
Cc: linux-kernel, Henry Martin, stable
sys_signal() builds a struct k_sigaction on the stack and only sets
sa_handler, sa_flags and sa_mask. sa_restorer (and, on sparc,
ka_restorer) keep whatever the previous syscall left at the same stack
slot, and do_sigaction() stores the whole struct into
sighand->action[sig - 1].
A 32-bit process can read sa_restorer back through compat
rt_sigaction(oact), which always copies it to userspace. The leaked low
32 bits are stale kernel stack content, in practice a kernel text return
address, so the two syscalls reveal the KASLR slide.
Zero-initialize the whole struct so the fix also covers architectures
that keep the restorer in ka_restorer.
This issue was discovered by Tencent CodeBuddy Security.
Cc: stable@vger.kernel.org
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
---
kernel/signal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/signal.c b/kernel/signal.c
index dd770e68faee..460dd4d1d548 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -4894,7 +4894,7 @@ SYSCALL_DEFINE1(ssetmask, int, newmask)
*/
SYSCALL_DEFINE2(signal, int, sig, __sighandler_t, handler)
{
- struct k_sigaction new_sa, old_sa;
+ struct k_sigaction new_sa = { }, old_sa;
int ret;
new_sa.sa.sa_handler = handler;
--
2.53.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] signal: initialize k_sigaction in sys_signal()
2026-11-23 9:13 [PATCH] signal: initialize k_sigaction in sys_signal() Henry Martin
@ 2026-11-23 11:56 ` Oleg Nesterov
0 siblings, 0 replies; 2+ messages in thread
From: Oleg Nesterov @ 2026-11-23 11:56 UTC (permalink / raw)
To: Henry Martin; +Cc: Andrew Morton, Christian Brauner, linux-kernel, stable
On 11/23, Henry Martin wrote:
>
> Zero-initialize the whole struct so the fix also covers architectures
> that keep the restorer in ka_restorer.
...
> SYSCALL_DEFINE2(signal, int, sig, __sighandler_t, handler)
> {
> - struct k_sigaction new_sa, old_sa;
> + struct k_sigaction new_sa = { }, old_sa;
> int ret;
Acked-by: Oleg Nesterov <oleg@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-23 11:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23 9:13 [PATCH] signal: initialize k_sigaction in sys_signal() Henry Martin
2026-11-23 11:56 ` Oleg Nesterov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®