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: <20160614131906.4a5a9db55946735fbd57c4f5@linux-foundation.org>
Date:	Tue, 14 Jun 2016 13:19:06 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Heinrich Schuchardt <xypron.glpk@....de>
Cc:	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Kees Cook <keescook@...omium.org>,
	Don Zickus <dzickus@...hat.com>,
	Al Viro <viro@...iv.linux.org.uk>,
	Dave Young <dyoung@...hat.com>,
	Hugh Dickins <hughd@...gle.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Daniel Cashman <dcashman@...gle.com>, Willy Tarreau <w@....eu>,
	Alexei Starovoitov <ast@...mgrid.com>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Ilya Dryomov <idryomov@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] kernel/sysctl.c: avoid overflow

On Sat, 11 Jun 2016 03:33:08 +0200 Heinrich Schuchardt <xypron.glpk@....de> wrote:

> An undetected overflow may occur in do_proc_dointvec_minmax_conv_param.
> 
> ...
>
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -2313,7 +2313,17 @@ static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
>  {
>  	struct do_proc_dointvec_minmax_conv_param *param = data;
>  	if (write) {
> -		int val = *negp ? -*lvalp : *lvalp;
> +		int val;
> +
> +		if (*negp) {
> +			if (*lvalp > (unsigned long) INT_MAX + 1)
> +				return -EINVAL;
> +			val = -*lvalp;
> +		} else {
> +			if (*lvalp > (unsigned long) INT_MAX)
> +				return -EINVAL;
> +			val = *lvalp;
> +		}
>  		if ((param->min && *param->min > val) ||
>  		    (param->max && *param->max < val))
>  			return -EINVAL;

hm.

What happens if someone does

	echo -1 > /proc/foo

expecting to get 0xffffffff?  That's a reasonable shorthand, and if we
change that to spit out EINVAL then people's stuff may break.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ