[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202512160028.8F11A5D19@keescook>
Date: Tue, 16 Dec 2025 00:37:29 -0800
From: Kees Cook <kees@...nel.org>
To: Joel Granados <joel.granados@...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
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
Powered by blists - more mailing lists