All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <kees@kernel.org>
To: "Ricardo B. Marliere" <ricardo@marliere.net>
Cc: "Paul Moore" <paul@paul-moore.com>,
	"James Morris" <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Ricardo B. Marliere" <rbm@suse.com>,
	"Thomas Weißschuh" <linux@weissschuh.net>
Subject: Re: [PATCH 2/2] LoadPin: Make sysctl table const
Date: Mon, 10 Feb 2025 16:38:32 -0800	[thread overview]
Message-ID: <202502101638.BE56669918@keescook> (raw)
In-Reply-To: <20250123-sysctl-kees-v1-2-533359e74d66@suse.com>

On Thu, Jan 23, 2025 at 04:33:35PM -0300, Ricardo B. Marliere wrote:
> Since commit 7abc9b53bd51 ("sysctl: allow registration of const struct
> ctl_table"), the sysctl registration API allows for struct ctl_table to be
> in read-only memory. Move loadpin_sysctl_table to be declared at build
> time, instead of having to be dynamically allocated at boot time.
> 
> Cc: Thomas Weißschuh <linux@weissschuh.net>
> Suggested-by: Thomas Weißschuh <linux@weissschuh.net>
> Signed-off-by: Ricardo B. Marliere <rbm@suse.com>
> ---
>  security/loadpin/loadpin.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/security/loadpin/loadpin.c b/security/loadpin/loadpin.c
> index 68252452b66cb913638abbca2adea26219e77d37..e2d664b7602629c08c86d6d02158a4e9dd189b1a 100644
> --- a/security/loadpin/loadpin.c
> +++ b/security/loadpin/loadpin.c
> @@ -53,7 +53,7 @@ static bool deny_reading_verity_digests;
>  #endif
>  
>  #ifdef CONFIG_SYSCTL
> -static struct ctl_table loadpin_sysctl_table[] = {
> +static const struct ctl_table loadpin_sysctl_table[] = {
>  	{
>  		.procname       = "enforce",
>  		.data           = &enforce,

This can't be done since the table is modified during set_sysctl().

-Kees

-- 
Kees Cook

  parent reply	other threads:[~2025-02-11  0:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-23 19:33 [PATCH 0/2] security: Constify sysctl tables Ricardo B. Marliere
2025-01-23 19:33 ` [PATCH 1/2] yama: Make sysctl table const Ricardo B. Marliere
2025-01-23 23:20   ` Kees Cook
2025-02-11  0:37   ` Kees Cook
2025-01-23 19:33 ` [PATCH 2/2] LoadPin: " Ricardo B. Marliere
2025-01-23 23:20   ` Kees Cook
2025-02-02 11:10   ` kernel test robot
2025-02-11  0:38   ` Kees Cook [this message]
2025-02-14 15:54   ` kernel test robot
2025-01-23 23:21 ` [PATCH 0/2] security: Constify sysctl tables Kees Cook
2025-01-24  1:02   ` Paul Moore

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=202502101638.BE56669918@keescook \
    --to=kees@kernel.org \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=paul@paul-moore.com \
    --cc=rbm@suse.com \
    --cc=ricardo@marliere.net \
    --cc=serge@hallyn.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.