[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <s6eugs6crrncqrqqt7bwt7khmjfuwyhqunsmwuts4wcv4bog33@4gxywv7lrxda>
Date: Fri, 19 Dec 2025 11:55:07 +0100
From: Joel Granados <joel.granados@...nel.org>
To: Kees Cook <kees@...nel.org>
Cc: Paul Moore <paul@...l-moore.com>, James Morris <jmorris@...ei.org>,
"Serge E. Hallyn" <serge@...lyn.com>, linux-security-module@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] loadpin: Implement custom proc_handler for enforce
Sent out a V2
On Tue, Dec 16, 2025 at 12:37:29AM -0800, Kees Cook wrote:
> On Mon, Dec 15, 2025 at 04:43:48PM +0100, Joel Granados wrote:
> > The new proc_handler_loadpin returns -EINVAL when is_loadpin_writable is
> > false and the kernel var (enforce) is being written. Move
> > loadpin_sysctl_table to .rodata (by const qualifying it) as there is no
> > need to change the value of the extra1 entry.
> >
> > Signed-off-by: Joel Granados <joel.granados@...nel.org>
> > ---
> > Const qualifying ctl tables is part of the hardening effort in the linux
> > kernel.
>
> Ah yes, thanks for getting through these "weird" cases! :)
>
> > ---
> > security/loadpin/loadpin.c | 21 ++++++++++++++++-----
> > 1 file changed, 16 insertions(+), 5 deletions(-)
> >
> > diff --git a/security/loadpin/loadpin.c b/security/loadpin/loadpin.c
> > index 273ffbd6defe1324d6688dec5f9fe6c9401283ed..f049c81b82a78265b6ae358bb2a814265cec9f16 100644
> > --- a/security/loadpin/loadpin.c
> > +++ b/security/loadpin/loadpin.c
> > @@ -53,18 +53,29 @@ static bool deny_reading_verity_digests;
> > #endif
> >
> > #ifdef CONFIG_SYSCTL
> > -static struct ctl_table loadpin_sysctl_table[] = {
> > +static bool is_loadpin_writable;
>
> I would rather that load_root_writable were declared external to
> loadpin_check(), and then we could remove set_sysctl() entirely, instead
> using load_root_writable as the thing to check in proc_handler_loadpin().
>
> And also rename load_root_writable to "loadpin_root_writable", just to
> make it a bit more clear.
>
> -Kees
>
> --
> Kees Cook
--
Joel Granados
Download attachment "signature.asc" of type "application/pgp-signature" (660 bytes)
Powered by blists - more mailing lists