[llvm-commits] [compiler-rt] r157472 - in /compiler-rt/trunk/lib/asan: asan_allocator.cc asan_internal.h asan_rtl.cc
Alexander Potapenko
glider at google.com
Fri May 25 08:20:13 PDT 2012
Author: glider
Date: Fri May 25 10:20:13 2012
New Revision: 157472
URL: http://llvm.org/viewvc/llvm-project?rev=157472&view=rev
Log:
Introduce the check_malloc_usable_size flag (on by default).
When the flag is set to zero, we do not check for errors in malloc_usable_size.
This may be useful to work around a bug in Nvidia drivers prior to 295.*
Modified:
compiler-rt/trunk/lib/asan/asan_allocator.cc
compiler-rt/trunk/lib/asan/asan_internal.h
compiler-rt/trunk/lib/asan/asan_rtl.cc
Modified: compiler-rt/trunk/lib/asan/asan_allocator.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator.cc?rev=157472&r1=157471&r2=157472&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_allocator.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_allocator.cc Fri May 25 10:20:13 2012
@@ -865,7 +865,7 @@
CHECK(stack);
if (ptr == NULL) return 0;
size_t usable_size = malloc_info.AllocationSize((uintptr_t)ptr);
- if (usable_size == 0) {
+ if (FLAG_check_malloc_usable_size && (usable_size == 0)) {
Report("ERROR: AddressSanitizer attempting to call malloc_usable_size() "
"for pointer which is not owned: %p\n", ptr);
stack->PrintStack();
Modified: compiler-rt/trunk/lib/asan/asan_internal.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_internal.h?rev=157472&r1=157471&r2=157472&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_internal.h (original)
+++ compiler-rt/trunk/lib/asan/asan_internal.h Fri May 25 10:20:13 2012
@@ -259,6 +259,7 @@
extern int FLAG_sleep_before_dying;
extern bool FLAG_handle_segv;
extern bool FLAG_use_sigaltstack;
+extern bool FLAG_check_malloc_usable_size;
extern int asan_inited;
// Used to avoid infinite recursion in __asan_init().
Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=157472&r1=157471&r2=157472&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Fri May 25 10:20:13 2012
@@ -51,6 +51,7 @@
int FLAG_sleep_before_dying;
bool FLAG_unmap_shadow_on_exit;
bool FLAG_disable_core;
+bool FLAG_check_malloc_usable_size;
// -------------------------- Globals --------------------- {{{1
int asan_inited;
@@ -469,6 +470,10 @@
// it makes little sense to dump 16T+ core.
FLAG_disable_core = IntFlagValue(options, "disable_core=", __WORDSIZE == 64);
+ // Allow the users to work around the bug in Nvidia drivers prior to 295.*.
+ FLAG_check_malloc_usable_size =
+ IntFlagValue(options, "check_malloc_usable_size=", 1);
+
FLAG_quarantine_size = IntFlagValue(options, "quarantine_size=",
(ASAN_LOW_MEMORY) ? 1UL << 24 : 1UL << 28);
More information about the llvm-commits
mailing list