[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <m1d3o2ce1z.fsf@fess.ebiederm.org>
Date: Wed, 12 Jan 2011 07:55:04 -0800
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Lucian Adrian Grijincu <lucian.grijincu@...il.com>
Cc: linux-kernel <linux-kernel@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
Octavian Purdila <opurdila@...acom.com>,
WANG Cong <amwang@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Ingo Molnar <mingo@...e.hu>,
Dave Young <hidave.darkstar@...il.com>,
Don Zickus <dzickus@...hat.com>,
Vlad Dogaru <ddvlad@...edu.org>
Subject: Re: [PATCH] sysctl: ctl_table->parent is only used for sysctl checks
Lucian Adrian Grijincu <lucian.grijincu@...il.com> writes:
See selinux_sysctl_get_sid.
> Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@...il.com>
> ---
> include/linux/sysctl.h | 2 ++
> kernel/sysctl.c | 7 +++++--
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
> index 7bb5cb6..026681f 100644
> --- a/include/linux/sysctl.h
> +++ b/include/linux/sysctl.h
> @@ -1018,7 +1018,9 @@ struct ctl_table
> int maxlen;
> mode_t mode;
> struct ctl_table *child;
> +#ifdef CONFIG_SYSCTL_SYSCALL_CHECK
> struct ctl_table *parent; /* Automatically set */
> +#endif
> proc_handler *proc_handler; /* Callback for text formatting */
> void *extra1;
> void *extra2;
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index ae5cbb1..c5bade1 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -1706,6 +1706,7 @@ int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op)
> return test_perm(mode, op);
> }
>
> +#ifdef CONFIG_SYSCTL_SYSCALL_CHECK
> static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
> {
> for (; table->procname; table++) {
> @@ -1714,11 +1715,13 @@ static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
> sysctl_set_parent(table, table->child);
> }
> }
> +#endif
> +
>
> static __init int sysctl_init(void)
> {
> - sysctl_set_parent(NULL, root_table);
> #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
> + sysctl_set_parent(NULL, root_table);
> sysctl_check_table(current->nsproxy, root_table);
> #endif
> return 0;
> @@ -1875,9 +1878,9 @@ struct ctl_table_header *__register_sysctl_paths(
> header->used = 0;
> header->unregistering = NULL;
> header->root = root;
> - sysctl_set_parent(NULL, header->ctl_table);
> header->count = 1;
> #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
> + sysctl_set_parent(NULL, header->ctl_table);
> if (sysctl_check_table(namespaces, header->ctl_table)) {
> kfree(header);
> return NULL;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists