summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBradley Morgan <include@grrlz.net>2026-06-22 20:25:08 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-09-07 17:18:24 +0200
commit03c8761e75d1619906bb503686f9cc1dfc6a67f4 (patch)
treed40b28bc6b9d3cb3bd9958ef4390c91cfb2a13d4
parent71f7da08709fcc349da1f8e7aacbcb048eeabdad (diff)
downloadlinux-03c8761e75d1619906bb503686f9cc1dfc6a67f4.tar.gz
linux-03c8761e75d1619906bb503686f9cc1dfc6a67f4.zip
signal: avoid shared siginfo namespace rewrites
commit d19cdc167e696714509e87d3f7ae765b6e164589 upstream. send_signal_locked() rewrites sender ids for the target namespace. Group sends reuse the same siginfo, so one recipient can affect the next. Copy the siginfo before changing it. Link: https://lore.kernel.org/86a8857d58d43ee26a8b365b837fd24830343494.1782159692.git.include@grrlz.net Fixes: 7a0cf094944e ("signal: Correct namespace fixups of si_pid and si_uid") Signed-off-by: Bradley Morgan <include@grrlz.net> Acked-by: Oleg Nesterov <oleg@redhat.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Adrian Huang <adrianhuang0701@gmail.com> Cc: Aleksandr Nogikh <nogikh@google.com> Cc: Christian Brauner <brauner@kernel.org> Cc: Marco Elver <elver@google.com> Cc: "Masami Hiramatsu (Google)" <mhiramat@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--kernel/signal.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index e6e812f8b80f..a11c3c9afd2b 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1214,6 +1214,7 @@ static inline bool has_si_pid_and_uid(struct kernel_siginfo *info)
int send_signal_locked(int sig, struct kernel_siginfo *info,
struct task_struct *t, enum pid_type type)
{
+ struct kernel_siginfo rewritten;
/* Should SIGKILL or SIGSTOP be received by a pid namespace init? */
bool force = false;
@@ -1227,6 +1228,9 @@ int send_signal_locked(int sig, struct kernel_siginfo *info,
/* SIGKILL and SIGSTOP is special or has ids */
struct user_namespace *t_user_ns;
+ rewritten = *info;
+ info = &rewritten;
+
rcu_read_lock();
t_user_ns = task_cred_xxx(t, user_ns);
if (current_user_ns() != t_user_ns) {