linux-kernel-test/arch/x86
Arjan van de Ven 9f0cf4adb6 x86: Use __builtin_object_size() to validate the buffer size for copy_from_user()
gcc (4.x) supports the __builtin_object_size() builtin, which
reports the size of an object that a pointer point to, when known
at compile time. If the buffer size is not known at compile time, a
constant -1 is returned.

This patch uses this feature to add a sanity check to
copy_from_user(); if the target buffer is known to be smaller than
the copy size, the copy is aborted and a WARNing is emitted in
memory debug mode.

These extra checks compile away when the object size is not known,
or if both the buffer size and the copy length are constants.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
LKML-Reference: <20090926143301.2c396b94@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-09-26 16:25:41 +02:00
..
boot
configs
crypto
ia32
include/asm x86: Use __builtin_object_size() to validate the buffer size for copy_from_user() 2009-09-26 16:25:41 +02:00
kernel x86: Use __builtin_object_size() to validate the buffer size for copy_from_user() 2009-09-26 16:25:41 +02:00
kvm
lguest
lib x86: Use __builtin_object_size() to validate the buffer size for copy_from_user() 2009-09-26 16:25:41 +02:00
math-emu
mm
oprofile
pci
power
vdso
video
xen
Kbuild
Kconfig
Kconfig.cpu
Kconfig.debug
Makefile
Makefile_32.cpu