lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m1haw33q35.fsf@fess.ebiederm.org>
Date:	Sun, 29 Apr 2012 01:22:06 -0700
From:	ebiederm@...ssion.com (Eric W. Biederman)
To:	Sasha Levin <levinsasha928@...il.com>
Cc:	viro@...iv.linux.org.uk, rostedt@...dmis.org, fweisbec@...il.com,
	mingo@...hat.com, a.p.zijlstra@...llo.nl, paulus@...ba.org,
	acme@...stprotocols.net, james.l.morris@...cle.com,
	akpm@...ux-foundation.org, tglx@...utronix.de,
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org, linux-security-module@...r.kernel.org
Subject: Re: [PATCH 01/14] sysctl: provide callback for write into ctl_table entry

Sasha Levin <levinsasha928@...il.com> writes:

> Provide a callback that will be called when writing to a ctl_table
> entry after the user input has been validated.
>
> This will simplify user input checks since now it will be possible to
> remove them out of the proc_handler.

Ick No.

You are simplifying things by taking updates out of locks, and
introducing races.

Your naming of the callback "callback" is much too generic.

I think the current function call mechanism of sysctl can be improved
but I don't think you have come up with the right combination of things.

Eric


> Signed-off-by: Sasha Levin <levinsasha928@...il.com>
> ---
>  fs/proc/proc_sysctl.c  |    4 ++++
>  include/linux/sysctl.h |    1 +
>  2 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
> index 21d836f..190db28 100644
> --- a/fs/proc/proc_sysctl.c
> +++ b/fs/proc/proc_sysctl.c
> @@ -507,6 +507,10 @@ static ssize_t proc_sys_call_handler(struct file *filp, void __user *buf,
>  	error = table->proc_handler(table, write, buf, &res, ppos);
>  	if (!error)
>  		error = res;
> +
> +	if (!error && write && table->callback)
> +		error = table->callback();
> +
>  out:
>  	sysctl_head_finish(head);
>  
> diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
> index c34b4c8..27c14cf 100644
> --- a/include/linux/sysctl.h
> +++ b/include/linux/sysctl.h
> @@ -1022,6 +1022,7 @@ struct ctl_table
>  	struct ctl_table_poll *poll;
>  	void *extra1;
>  	void *extra2;
> +	int (*callback)(void);		/* Called when entry is written to */
>  };
>  
>  struct ctl_node {
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ