diff options
author | Arjan van de Ven <arjan@infradead.org> | 2009-09-26 14:33:01 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-09-26 16:25:41 +0200 |
commit | 9f0cf4adb6aa0bfccf675c938124e68f7f06349d (patch) | |
tree | 2045a8fa0b207a8adb288eb144c593db7d1f2f0b /arch/x86/kernel/x8664_ksyms_64.c | |
parent | 704daf55c7297e727021063cb5d8ba1c55b84426 (diff) |
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>
Diffstat (limited to 'arch/x86/kernel/x8664_ksyms_64.c')
-rw-r--r-- | arch/x86/kernel/x8664_ksyms_64.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kernel/x8664_ksyms_64.c b/arch/x86/kernel/x8664_ksyms_64.c index 3909e3ba5ce..a0cdd8cc1d6 100644 --- a/arch/x86/kernel/x8664_ksyms_64.c +++ b/arch/x86/kernel/x8664_ksyms_64.c @@ -30,7 +30,7 @@ EXPORT_SYMBOL(__put_user_8); EXPORT_SYMBOL(copy_user_generic); EXPORT_SYMBOL(__copy_user_nocache); -EXPORT_SYMBOL(copy_from_user); +EXPORT_SYMBOL(_copy_from_user); EXPORT_SYMBOL(copy_to_user); EXPORT_SYMBOL(__copy_from_user_inatomic); |