[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALmYWFucv6-9yfS=gamwSsqjgxSKZS0nvVjj_QfBmsLmQD5XOQ@mail.gmail.com>
Date: Thu, 2 Mar 2023 15:13:54 -0800
From: Jeff Xu <jeffxu@...gle.com>
To: Luis Chamberlain <mcgrof@...nel.org>
Cc: ebiederm@...ssion.com, keescook@...omium.org, yzaikin@...gle.com,
john.johansen@...onical.com, paul@...l-moore.com,
jmorris@...ei.org, serge@...lyn.com, luto@...capital.net,
wad@...omium.org, dverkamp@...omium.org, paulmck@...nel.org,
baihaowen@...zu.com, frederic@...nel.org, ebiggers@...nel.org,
tytso@....edu, guoren@...nel.org, j.granados@...sung.com,
zhangpeng362@...wei.com, tangmeng@...ontech.com,
willy@...radead.org, nixiaoming@...wei.com, sujiaxun@...ontech.com,
patches@...ts.linux.dev, linux-fsdevel@...r.kernel.org,
apparmor@...ts.ubuntu.com, linux-security-module@...r.kernel.org,
linux-csky@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 08/11] kernel: pid_namespace: simplify sysctls with register_sysctl()
On Thu, Mar 2, 2023 at 12:28 PM Luis Chamberlain <mcgrof@...nel.org> wrote:
>
> register_sysctl_paths() is only required if your child (directories)
> have entries and pid_namespace does not. So use register_sysctl_init()
> instead where we don't care about the return value and use
> register_sysctl() where we do.
>
> Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
> ---
> kernel/pid_namespace.c | 3 +--
> kernel/pid_sysctl.h | 3 +--
> 2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
> index 46e0d5a3f91f..b43eee07b00c 100644
> --- a/kernel/pid_namespace.c
> +++ b/kernel/pid_namespace.c
> @@ -314,7 +314,6 @@ static struct ctl_table pid_ns_ctl_table[] = {
> },
> { }
> };
> -static struct ctl_path kern_path[] = { { .procname = "kernel", }, { } };
> #endif /* CONFIG_CHECKPOINT_RESTORE */
>
> int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd)
> @@ -473,7 +472,7 @@ static __init int pid_namespaces_init(void)
> pid_ns_cachep = KMEM_CACHE(pid_namespace, SLAB_PANIC | SLAB_ACCOUNT);
>
> #ifdef CONFIG_CHECKPOINT_RESTORE
> - register_sysctl_paths(kern_path, pid_ns_ctl_table);
> + register_sysctl_init("kernel", pid_ns_ctl_table);
> #endif
>
> register_pid_ns_sysctl_table_vm();
> diff --git a/kernel/pid_sysctl.h b/kernel/pid_sysctl.h
> index e22d072e1e24..d67a4d45bb42 100644
> --- a/kernel/pid_sysctl.h
> +++ b/kernel/pid_sysctl.h
> @@ -46,10 +46,9 @@ static struct ctl_table pid_ns_ctl_table_vm[] = {
> },
> { }
> };
> -static struct ctl_path vm_path[] = { { .procname = "vm", }, { } };
> static inline void register_pid_ns_sysctl_table_vm(void)
> {
> - register_sysctl_paths(vm_path, pid_ns_ctl_table_vm);
> + register_sysctl("vm", pid_ns_ctl_table_vm);
> }
> #else
> static inline void initialize_memfd_noexec_scope(struct pid_namespace *ns) {}
> --
> 2.39.1
>
Acked-by: Jeff Xu <jeffxu@...gle.com>
Powered by blists - more mailing lists