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] [day] [month] [year] [list]
Date:	Mon, 8 Jun 2015 15:41:15 -0700
From:	Kees Cook <keescook@...omium.org>
To:	Heinrich Schuchardt <xypron.glpk@....de>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Michal Nazarewicz <mina86@...a86.com>,
	Ingo Molnar <mingo@...nel.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Joe Perches <joe@...ches.com>, Josh Hunt <johunt@...mai.com>,
	Rasmus Villemoes <linux@...musvillemoes.dk>,
	Rusty Russell <rusty@...tcorp.com.au>,
	Daniel Walter <dwalter@...gle.com>,
	David Rientjes <rientjes@...gle.com>,
	"David S. Miller" <davem@...emloft.net>,
	Johannes Weiner <hannes@...xchg.org>,
	Aaron Tomlin <atomlin@...hat.com>,
	Prarit Bhargava <prarit@...hat.com>,
	Eric B Munson <emunson@...mai.com>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	Sam Ravnborg <sam@...nborg.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/3] sysctl: detect overflows when converting to int

On Wed, Apr 1, 2015 at 10:31 AM, Heinrich Schuchardt <xypron.glpk@....de> wrote:
> On 01.04.2015 00:45, Andrew Morton wrote:
>> On Sun, 29 Mar 2015 21:28:29 +0200 Heinrich Schuchardt <xypron.glpk@....de> wrote:
>>
>>> When converting unsigned long to int overflows may occur.
>>> These currently are not detected when writing to the sysctl
>>> file system.
>>>
>>> E.g. on a system where int has 32 bits and long has 64 bits
>>>   echo 0x800001234 > /proc/sys/kernel/threads-max
>>> has the same effect as
>>>   echo 0x1234 > /proc/sys/kernel/threads-max
>>>
>>> The patch adds the missing check in do_proc_dointvec_conv.
>>>
>>> With the patch an overflow will result in an error EINVAL when
>>> writing to the the sysctl file system.
>>
>> hm, why fix this?  There's a small risk of breaking
>> accidentally-working userspace, but I expect we can live with that.
>>
>> But how big a problem is this, really?  This behaviour is quite
>> expected, after all.
>>
>
> The typical user of a Linux system has never read the Kernel code and
> possibly has limited programming experience.
> Furthermore in Documentation/sysctl/kernel.txt there is no hint that
> only 32-bit integers can be used.
> So why should this typical user expect that on a 64-bit system
> +3000000000 is considered a negative number?
>
> Now that we know this is a bug why shouldn't we fix it?

I think this is worth fixing. It is, from a certain perspective,
"unexpected behavior". At the very least we could tie it to the
sysctl_writes_strict flag? Anything depending on an overflow to get
"correct" results seems extremely unlikely to me.

-Kees

-- 
Kees Cook
Chrome OS Security
--
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