x86: Turn the copy_from_user check into an (optional) compile time warning
authorArjan van de Ven <arjan@infradead.org>
Wed, 30 Sep 2009 11:05:23 +0000 (13:05 +0200)
committerIngo Molnar <mingo@elte.hu>
Thu, 1 Oct 2009 09:31:04 +0000 (11:31 +0200)
commit4a3127693001c61a21d1ce680db6340623f52e93
tree380f5f64098926e8b3f64785580cfdac1b8b3b96
parentff60fab71bb3b4fdbf8caf57ff3739ffd0887396
x86: Turn the copy_from_user check into an (optional) compile time warning

A previous patch added the buffer size check to copy_from_user().

One of the things learned from analyzing the result of the previous
patch is that in general, gcc is really good at proving that the
code contains sufficient security checks to not need to do a
runtime check. But that for those cases where gcc could not prove
this, there was a relatively high percentage of real security
issues.

This patch turns the case of "gcc cannot prove" into a compile time
warning, as long as a sufficiently new gcc is in use that supports
this. The objective is that these warnings will trigger developers
checking new cases out before a security hole enters a linux kernel
release.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: James Morris <jmorris@namei.org>
Cc: Jan Beulich <jbeulich@novell.com>
LKML-Reference: <20090930130523.348ae6c4@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/include/asm/uaccess_32.h
arch/x86/lib/usercopy_32.c
include/linux/compiler-gcc4.h
include/linux/compiler.h