linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] sysctl: detect overflows when setting integers
@ 2015-03-29 19:28 Heinrich Schuchardt
  2015-03-29 19:28 ` [PATCH 1/3] lib/kstrtox.c: functions returning end of string Heinrich Schuchardt
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Heinrich Schuchardt @ 2015-03-29 19:28 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Michal Nazarewicz, Ingo Molnar, Steven Rostedt, Peter Zijlstra,
	Joe Perches, Josh Hunt, Rasmus Villemoes, Rusty Russell,
	Daniel Walter, David Rientjes, Kees Cook, David S. Miller,
	Johannes Weiner, Aaron Tomlin, Prarit Bhargava, Eric B Munson,
	Paul E. McKenney, Sam Ravnborg, linux-kernel,
	Heinrich Schuchardt

This patch series addresses undetected overflows when writing to the
sysctl file system.

E.g.
echo 0x800001234 > /proc/sys/kernel/threads-max
has the same effect as
echo 0x1234 > /proc/sys/kernel/threads-max

The first type of overflow occurs when converting from string to unsigned long.
The second type of overflow occurs when converting from unsigned long to int.

The first patch provide new functions kstrtoul_e and kstrtoull_e that can be
used to replace deprecated simple_strtoul and simple_strtoull.

The second patch replaces a call to simple_strtoul by kstrtoul_e. This is
necessary to detect overflows when converting from string to unsigned long.

The third patch adds checks when converting form unsigned long to int.

Heinrich Schuchardt (3):
  lib/kstrtox.c: functions returning end of string
  sysctl: detect overflows in proc_get_long
  sysctl: detect overflows when converting to int

 include/linux/kernel.h |  4 +++
 kernel/sysctl.c        | 13 +++++++--
 lib/kstrtox.c          | 71 +++++++++++++++++++++++++++++++++++++++++++++++---
 3 files changed, 83 insertions(+), 5 deletions(-)

-- 
2.1.4


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-06-08 22:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-29 19:28 [PATCH 0/3] sysctl: detect overflows when setting integers Heinrich Schuchardt
2015-03-29 19:28 ` [PATCH 1/3] lib/kstrtox.c: functions returning end of string Heinrich Schuchardt
2015-03-29 19:28 ` [PATCH 2/3] sysctl: detect overflows in proc_get_long Heinrich Schuchardt
2015-03-29 19:28 ` [PATCH 3/3] sysctl: detect overflows when converting to int Heinrich Schuchardt
2015-03-31 17:12   ` Fwd: " Heinrich Schuchardt
2015-03-31 22:45   ` Andrew Morton
2015-04-01 17:31     ` Heinrich Schuchardt
2015-06-08 22:41       ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).