linux-hardening.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] seccomp: Constify sysctl subhelpers
@ 2024-05-08 17:13 Kees Cook
  2024-05-08 17:58 ` Thomas Weißschuh
  2024-05-08 19:24 ` Luis Chamberlain
  0 siblings, 2 replies; 3+ messages in thread
From: Kees Cook @ 2024-05-08 17:13 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Kees Cook, Joel Granados, Luis Chamberlain, Andy Lutomirski,
	Will Drewry, linux-kernel, linux-hardening

The read_actions_logged() and write_actions_logged() helpers called by the
sysctl proc handler seccomp_actions_logged_handler() are already expecting
their sysctl table argument to be read-only. Actually mark the argument
as const in preparation[1] for global constification of the sysctl tables.

Suggested-by: "Thomas Weißschuh" <linux@weissschuh.net>
Link: https://lore.kernel.org/lkml/20240423-sysctl-const-handler-v3-11-e0beccb836e2@weissschuh.net/ [1]
Signed-off-by: Kees Cook <keescook@chromium.org>
---
Cc: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: Joel Granados <j.granados@samsung.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Will Drewry <wad@chromium.org>
---
 kernel/seccomp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/seccomp.c b/kernel/seccomp.c
index aca7b437882e..f70e031e06a8 100644
--- a/kernel/seccomp.c
+++ b/kernel/seccomp.c
@@ -2334,7 +2334,7 @@ static bool seccomp_actions_logged_from_names(u32 *actions_logged, char *names)
 	return true;
 }
 
-static int read_actions_logged(struct ctl_table *ro_table, void *buffer,
+static int read_actions_logged(const struct ctl_table *ro_table, void *buffer,
 			       size_t *lenp, loff_t *ppos)
 {
 	char names[sizeof(seccomp_actions_avail)];
@@ -2352,7 +2352,7 @@ static int read_actions_logged(struct ctl_table *ro_table, void *buffer,
 	return proc_dostring(&table, 0, buffer, lenp, ppos);
 }
 
-static int write_actions_logged(struct ctl_table *ro_table, void *buffer,
+static int write_actions_logged(const struct ctl_table *ro_table, void *buffer,
 				size_t *lenp, loff_t *ppos, u32 *actions_logged)
 {
 	char names[sizeof(seccomp_actions_avail)];
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] seccomp: Constify sysctl subhelpers
  2024-05-08 17:13 [PATCH] seccomp: Constify sysctl subhelpers Kees Cook
@ 2024-05-08 17:58 ` Thomas Weißschuh
  2024-05-08 19:24 ` Luis Chamberlain
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Weißschuh @ 2024-05-08 17:58 UTC (permalink / raw)
  To: Kees Cook
  Cc: Joel Granados, Luis Chamberlain, Andy Lutomirski, Will Drewry,
	linux-kernel, linux-hardening

On 2024-05-08 10:13:41+0000, Kees Cook wrote:
> The read_actions_logged() and write_actions_logged() helpers called by the
> sysctl proc handler seccomp_actions_logged_handler() are already expecting
> their sysctl table argument to be read-only. Actually mark the argument
> as const in preparation[1] for global constification of the sysctl tables.
> 
> Suggested-by: "Thomas Weißschuh" <linux@weissschuh.net>
> Link: https://lore.kernel.org/lkml/20240423-sysctl-const-handler-v3-11-e0beccb836e2@weissschuh.net/ [1]
> Signed-off-by: Kees Cook <keescook@chromium.org>

Thanks!

Reviewed-by: "Thomas Weißschuh" <linux@weissschuh.net>

> ---
> Cc: "Thomas Weißschuh" <linux@weissschuh.net>
> Cc: Joel Granados <j.granados@samsung.com>
> Cc: Luis Chamberlain <mcgrof@kernel.org>
> Cc: Andy Lutomirski <luto@amacapital.net>
> Cc: Will Drewry <wad@chromium.org>
> ---
>  kernel/seccomp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index aca7b437882e..f70e031e06a8 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -2334,7 +2334,7 @@ static bool seccomp_actions_logged_from_names(u32 *actions_logged, char *names)
>  	return true;
>  }
>  
> -static int read_actions_logged(struct ctl_table *ro_table, void *buffer,
> +static int read_actions_logged(const struct ctl_table *ro_table, void *buffer,
>  			       size_t *lenp, loff_t *ppos)
>  {
>  	char names[sizeof(seccomp_actions_avail)];
> @@ -2352,7 +2352,7 @@ static int read_actions_logged(struct ctl_table *ro_table, void *buffer,
>  	return proc_dostring(&table, 0, buffer, lenp, ppos);
>  }
>  
> -static int write_actions_logged(struct ctl_table *ro_table, void *buffer,
> +static int write_actions_logged(const struct ctl_table *ro_table, void *buffer,
>  				size_t *lenp, loff_t *ppos, u32 *actions_logged)
>  {
>  	char names[sizeof(seccomp_actions_avail)];
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] seccomp: Constify sysctl subhelpers
  2024-05-08 17:13 [PATCH] seccomp: Constify sysctl subhelpers Kees Cook
  2024-05-08 17:58 ` Thomas Weißschuh
@ 2024-05-08 19:24 ` Luis Chamberlain
  1 sibling, 0 replies; 3+ messages in thread
From: Luis Chamberlain @ 2024-05-08 19:24 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Weißschuh, Joel Granados, Andy Lutomirski,
	Will Drewry, linux-kernel, linux-hardening

On Wed, May 08, 2024 at 10:13:41AM -0700, Kees Cook wrote:
> The read_actions_logged() and write_actions_logged() helpers called by the
> sysctl proc handler seccomp_actions_logged_handler() are already expecting
> their sysctl table argument to be read-only. Actually mark the argument
> as const in preparation[1] for global constification of the sysctl tables.
> 
> Suggested-by: "Thomas Weißschuh" <linux@weissschuh.net>
> Link: https://lore.kernel.org/lkml/20240423-sysctl-const-handler-v3-11-e0beccb836e2@weissschuh.net/ [1]
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>

  Luis

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-08 19:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-08 17:13 [PATCH] seccomp: Constify sysctl subhelpers Kees Cook
2024-05-08 17:58 ` Thomas Weißschuh
2024-05-08 19:24 ` Luis Chamberlain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).