android_kernel_xiaomi_sdm845/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 x86: convert compressed loader to use __HEAD and HEAD_TEXT macros. 2009-09-18 10:21:49 -07:00
configs tracing: Rename FTRACE_SYSCALLS for tracepoints 2009-08-26 00:17:35 +02:00
crypto Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-09-14 07:57:32 -07:00
ia32 perf: Do the big rename: Performance Counters -> Performance Events 2009-09-21 14:28:04 +02:00
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 Merge branch 'kvm-updates/2.6.32' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2009-09-14 17:43:43 -07:00
lguest lguest: move panic notifier registration to its expected place. 2009-09-23 22:26:44 +09:30
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 Merge branch 'core/percpu' into percpu-cpumask-x86-for-linus-2 2009-03-27 17:28:43 +01:00
mm Merge branch 'linus' into x86/urgent 2009-09-24 12:59:18 +02:00
oprofile perf: Do the big rename: Performance Counters -> Performance Events 2009-09-21 14:28:04 +02:00
pci Merge branch 'sfi-base' into release 2009-09-19 00:37:13 -04:00
power x86: Remove final bits of CONFIG_X86_OLD_MCE 2009-09-18 08:31:23 +02:00
vdso time: Introduce CLOCK_REALTIME_COARSE 2009-08-21 21:43:46 +02:00
video
xen Merge branch 'bugfix' of git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen into x86/urgent 2009-09-23 14:35:10 +02:00
Kbuild x86: standardize Kbuild rules 2009-04-16 18:09:02 +02:00
Kconfig Merge git://git.infradead.org/iommu-2.6 2009-09-23 10:06:10 -07:00
Kconfig.cpu x86: add specific support for Intel Atom architecture 2009-08-23 11:20:02 +02:00
Kconfig.debug kmemcheck: make kconfig accessible for other architectures 2009-06-15 15:49:17 +02:00
Makefile Merge branch 'x86-kbuild-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-09-14 07:59:07 -07:00
Makefile_32.cpu x86: add specific support for Intel Atom architecture 2009-08-23 11:20:02 +02:00