Closed ramosian-glider closed 9 years ago
Reported by ramosian.glider
on 2012-10-29 11:44:11
Reported by ramosian.glider
on 2012-10-29 11:50:21
For clarity:
$ svn diff ../tools/clang/lib/Driver/ToolChains.cpp
Index: ../tools/clang/lib/Driver/ToolChains.cpp
===================================================================
--- ../tools/clang/lib/Driver/ToolChains.cpp (revision 166764)
+++ ../tools/clang/lib/Driver/ToolChains.cpp (working copy)
@@ -366,10 +366,10 @@
if (Args.hasArg(options::OPT_dynamiclib) ||
Args.hasArg(options::OPT_bundle)) return;
if (isTargetIPhoneOS()) {
- getDriver().Diag(diag::err_drv_clang_unsupported_per_platform)
- << "-faddress-sanitizer";
+ AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.asan_osx_dynamic.dylib");
} else {
- AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.asan_osx.a");
+ AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.asan_osx_dynamic.dylib");
+ //AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.asan_osx.a");
// The ASAN runtime library requires C++ and CoreFoundation.
AddCXXStdlibLibArgs(Args, CmdArgs);
==============================================
$ Release+Asserts/bin/clang -faddress-sanitizer t.c -o t
$ ASAN_OPTIONS=verbosity=1 ./t
==55249== Parsed ASAN_OPTIONS: verbosity=1
==55249== exec()-ing the program with
==55249== DYLD_INSERT_LIBRARIES=/Users/glider/src/asan/llvm/build/Release+Asserts/lib/clang/3.2/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
==55249== to enable ASan wrappers.
==55249== Set ASAN_OPTIONS=allow_reexec=0 to disable this.
==55249== Parsed ASAN_OPTIONS: verbosity=1
|| `[0x200000000000, 0x7fffffffffff]` || HighMem ||
|| `[0x140000000000, 0x1fffffffffff]` || HighShadow ||
|| `[0x120000000000, 0x13ffffffffff]` || ShadowGap ||
|| `[0x100000000000, 0x11ffffffffff]` || LowShadow ||
|| `[0x000000000000, 0x0fffffffffff]` || LowMem ||
MemToShadow(shadow): 0x120000000000 0x123fffffffff 0x128000000000 0x13ffffffffff
red_zone=64
malloc_context_size=30
SHADOW_SCALE: 3
SHADOW_GRANULARITY: 8
SHADOW_OFFSET: 100000000000
==55249== Installed the sigaction for signal 11
==55249== Installed the sigaction for signal 10
==55249== T0: stack [0x7fff5a4a5000,0x7fff5aca5000) size 0x800000; local=0x7fff5aca40c0
==55249== AddressSanitizer Init done
tmp: 0x7fff5aca4740
tmp: '#line 6'
after strlen call
strlen(tmp): 4
And even with the explicit DYLD_INSERT_LIBRARIES:
$ DYLD_INSERT_LIBRARIES=/Users/glider/src/asan/llvm/build/Release+Asserts/lib/clang/3.2/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
./t
tmp: 0x7fff567997a0
tmp: '#line 6'
after strlen call
strlen(tmp): 4
Reported by ramosian.glider
on 2012-10-29 16:53:04
It turns out there's been a temporary file v.cc, which contained the incorrect implementation
of strlen.
It has got linked with the runtime, because it resided in the same directory as other
ASan files.
Reported by ramosian.glider
on 2012-11-29 13:43:19
Invalid
OMG
Reported by konstantin.s.serebryany
on 2012-11-29 13:46:45
Adding Project:AddressSanitizer as part of GitHub migration.
Reported by ramosian.glider
on 2015-07-30 09:13:40
Originally reported on Google Code with ID 124
Reported by
ramosian.glider
on 2012-10-26 11:58:48