Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
453 views
in Technique[技术] by (71.8m points)

valgrind, gcc 6.2.0 and "-fsanitize=address"

Recently, when compiling with '-fsanitize=address' I am getting an execution exception when running an application with valgrind namely

"ASan runtime does not come first in initial library list"

I am a little clueless what valgrind actually does. The command 'ldd file.exe' delivers

    linux-gate.so.1 =>  (0xb7755000)
    libasan.so.3 => /usr/lib/i386-linux-gnu/libasan.so.3 (0xb7199000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb6fdf000)
    libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb6fd8000)
    librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb6fcf000)
    libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb6fb2000)
    libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb6f5c000)
    /lib/ld-linux.so.2 (0x80092000)
    libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb6f3e000)

Any hints?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You won't be able to run sanitized code under Valgrind. Even if you get past the problem with preloading libasan, you'll run into conflicting address space requirements (i.e. upon start Valgrind reserves region of memory which is also required by Asan shadow memory) and this can't be worked around as both addresses are hard-coded in Valgrind and libasan. Similar issues exist for Asan and Tsan or Asan and Msan (i.e. they can't be enabled simultaneously). It's unlikely to be fixed as sanitizers are highly specialized to achieve their impressive performance numbers.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...