[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240927084817.014903652@linutronix.de>
Date: Fri, 27 Sep 2024 10:48:41 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Anna-Maria Behnsen <anna-maria@...utronix.de>,
Frederic Weisbecker <frederic@...nel.org>,
John Stultz <jstultz@...gle.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>,
Stephen Boyd <sboyd@...nel.org>,
Eric Biederman <ebiederm@...ssion.com>,
Oleg Nesterov <oleg@...hat.com>
Subject: [patch v4 02/27] signal: Prevent user space from setting
si_sys_private
From: Thomas Gleixner <tglx@...utronix.de>
The si_sys_private member of siginfo is used to handle posix-timer rearming
from the signal delivery path. Prevent user space from setting it as that
creates inconsistent state.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
---
kernel/signal.c | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/kernel/signal.c b/kernel/signal.c
index a83ea99f9389..7706cd304785 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3354,6 +3354,14 @@ int copy_siginfo_to_user(siginfo_t __user *to, const kernel_siginfo_t *from)
static int post_copy_siginfo_from_user(kernel_siginfo_t *info,
const siginfo_t __user *from)
{
+ /*
+ * Clear the si_sys_private field for timer signals as that's the
+ * indicator for rearming a posix timer. User space submitted
+ * signals are not allowed to inject that.
+ */
+ if (info->si_code == SI_TIMER)
+ info->si_sys_private = 0;
+
if (unlikely(!known_siginfo_layout(info->si_signo, info->si_code))) {
char __user *expansion = si_expansion(from);
char buf[SI_EXPANSION_SIZE];
Powered by blists - more mailing lists