[patch V3 26/51] signal: Prevent user space from setting si_sys_private

From: Thomas Gleixner
Date: Mon Jun 10 2024 - 12:47:28 EST


Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
kernel/signal.c | 8 ++++++++
1 file changed, 8 insertions(+)

--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3350,6 +3350,14 @@ int copy_siginfo_to_user(siginfo_t __use
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];