[PATCH] [Compiler-rt][Sanitizer][MSan][i386] Adding support for i386
Evgeniy Stepanov
eugenis at google.com
Fri Feb 27 00:45:00 PST 2015
0x555 is where a PIE binary is mapped when ASLR is disabled (1/3rd of
the address space). No idea why that happens with lit.
On Fri, Feb 27, 2015 at 8:53 AM, Mohit Bhakkad <mohit.bhakkad at gmail.com> wrote:
> Update:
>
> - Thanks @eugenis, issue with i386 support is resolved.
>
>
>
> - Right now, while testing msan32 using lit, most of the tests are failing with:
>
>
>
> FATAL: Code 0x5556aec0 is out of application range. Non-PIE build?
> FATAL: MemorySanitizer can not mmap the shadow memory.
> FATAL: Make sure to compile with -fPIE and to link with -pie.
> FATAL: Disabling ASLR is known to cause this error.
> FATAL: If running under GDB, try 'set disable-randomization off'.
> ==23092==Process memory map follows:
> 0x55555000-0x555ed000 /home/mohit/compiler-rt_build/test/msan/Output/strlen_of_shadow.cc.tmp
> 0x555ed000-0x555ee000 /home/mohit/compiler-rt_build/test/msan/Output/strlen_of_shadow.cc.tmp
> 0x555ee000-0x555f1000 /home/mohit/compiler-rt_build/test/msan/Output/strlen_of_shadow.cc.tmp
> 0x555f1000-0x56648000
> 0x56648000-0x56668000 /lib/i386-linux-gnu/ld-2.19.so
> 0x56668000-0x56669000 /lib/i386-linux-gnu/ld-2.19.so
> 0x56669000-0x5666a000 /lib/i386-linux-gnu/ld-2.19.so
> 0x5666a000-0x5666b000 [vdso]
> 0x5666b000-0x56672000
> 0x5668c000-0x56768000 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.19
> 0x56768000-0x56769000 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.19
> 0x56769000-0x5676d000 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.19
> 0x5676d000-0x5676e000 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.19
> 0x5676e000-0x56775000
> 0x56775000-0x567b9000 /lib/i386-linux-gnu/libm-2.19.so
> 0x567b9000-0x567ba000 /lib/i386-linux-gnu/libm-2.19.so
> 0x567ba000-0x567bb000 /lib/i386-linux-gnu/libm-2.19.so
> 0x567bb000-0x567bc000
> 0x567bc000-0x567d4000 /lib/i386-linux-gnu/libpthread-2.19.so
> 0x567d4000-0x567d5000 /lib/i386-linux-gnu/libpthread-2.19.so
> 0x567d5000-0x567d6000 /lib/i386-linux-gnu/libpthread-2.19.so
> 0x567d6000-0x567d8000
> 0x567d8000-0x567df000 /lib/i386-linux-gnu/librt-2.19.so
> 0x567df000-0x567e0000 /lib/i386-linux-gnu/librt-2.19.so
> 0x567e0000-0x567e1000 /lib/i386-linux-gnu/librt-2.19.so
> 0x567e1000-0x567e4000 /lib/i386-linux-gnu/libdl-2.19.so
> 0x567e4000-0x567e5000 /lib/i386-linux-gnu/libdl-2.19.so
> 0x567e5000-0x567e6000 /lib/i386-linux-gnu/libdl-2.19.so
> 0x567e6000-0x56802000 /lib/i386-linux-gnu/libgcc_s.so.1
> 0x56802000-0x56803000 /lib/i386-linux-gnu/libgcc_s.so.1
> 0x56803000-0x569ac000 /lib/i386-linux-gnu/libc-2.19.so
> 0x569ac000-0x569ae000 /lib/i386-linux-gnu/libc-2.19.so
> 0x569ae000-0x569af000 /lib/i386-linux-gnu/libc-2.19.so
> 0x569af000-0x56b5f000
> 0xffac2000-0xffae3000 [stack]
> ==23092==End of process memory map.
>
> but when I run tests individually, almost all tests are giving expected o/p:
> for eg:(see that I have used exact options that of in lit suite)
>
> mohit at mohit:~$ /home/mohit/LLVM_x86/install/bin/clang --driver-mode=g++ -fsanitize=memory -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m32 -fsanitize-memory-track-origins=2 -O3 /home/mohit/compiler-rt/test/msan/chained_origin.cc
> mohit at mohit:~$ ./a.out
> ==23140== WARNING: MemorySanitizer: use-of-uninitialized-value
> #0 0xf77b17dd in main /home/mohit/compiler-rt/test/msan/chained_origin.cc:47:3
> #1 0xf73e6a82 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x19a82)
> #2 0xf774be95 in _start (/home/mohit/a.out+0x14e95)
>
> Uninitialized value was stored to memory at
> #0 0xf77b1722 in fn_h() /home/mohit/compiler-rt/test/msan/chained_origin.cc:35:5
> #1 0xf77b17a2 in main /home/mohit/compiler-rt/test/msan/chained_origin.cc:46:3
> #2 0xf73e6a82 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x19a82)
>
> Uninitialized value was stored to memory at
> #0 0xf77b1692 in fn_g(int) /home/mohit/compiler-rt/test/msan/chained_origin.cc:25:5
> #1 0xf77b16bb in fn_f(int) /home/mohit/compiler-rt/test/msan/chained_origin.cc:30:3
> #2 0xf77b179d in main /home/mohit/compiler-rt/test/msan/chained_origin.cc:45:3
> #3 0xf73e6a82 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x19a82)
>
> Uninitialized value was created by an allocation of 'z' in the stack frame of function 'main'
> #0 0xf77b1730 in main /home/mohit/compiler-rt/test/msan/chained_origin.cc:38
>
> SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/mohit/compiler-rt/test/msan/chained_origin.cc:47 main
> Exiting
>
> I am pretty sure about the correctness of address ranges in this patch. It looks like it is failing some check, investigating it now.
>
> **tl;dr: most of the test cases are passing individually, but with lit test suite, almost all are failing due to conflict in addresses.**
>
>
> REPOSITORY
> rL LLVM
>
> http://reviews.llvm.org/D6433
>
> EMAIL PREFERENCES
> http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
More information about the llvm-commits
mailing list