From: Oleg Nesterov <oleg@redhat.com>
To: Bradley Morgan <include@grrlz.net>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Christian Brauner <brauner@kernel.org>,
Thomas Gleixner <tglx@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] signal: factor out the kernel reserved si_code check
Date: Thu, 6 Aug 2026 19:18:31 +0200 [thread overview]
Message-ID: <anTB5xhiFjvqlPSH@redhat.com> (raw)
In-Reply-To: <20260806133013.4341-1-include@grrlz.net>
On 08/06, Bradley Morgan wrote:
>
> The check that prevents userspace from sending siginfo with si_code
> values reserved to the kernel is duplicated across do_rt_sigqueueinfo(),
> do_rt_tgsigqueueinfo() and do_pidfd_send_signal(). Move the check
> into a helper so the rule lives in one place.
> +/*
> + * Not even root can pretend to send SI_FROMKERNEL() signals.
> + * Nor can they impersonate kill()/tgkill(), which have si_pid/uid
> + */
> +static bool si_code_reserved_to_kernel(int si_code)
> +{
> + return si_code >= 0 || si_code == SI_TKILL;
> +}
OK, Acked-by: Oleg Nesterov <oleg@redhat.com>
But can't resist... We already have SI_FROMUSER() and SI_FROMKERNEL()
both take the pointer to siginfo as an argument.
Now we also have si_code_reserved_to_kernel() which falls into the same
category, but it aceepts .si_code and the names don't match...
OK, nevermind. I can't suggest a better name. Even if we change the
new helper to take "kernel_siginfo_t *info" to match SI_FROMXXX macros.
Oleg.
prev parent reply other threads:[~2026-08-06 17:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 13:30 [PATCH v2] signal: factor out the kernel reserved si_code check Bradley Morgan
2026-08-06 17:18 ` Oleg Nesterov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=anTB5xhiFjvqlPSH@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=include@grrlz.net \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox