On Sat, Sep 12, 2015 at 7:48 PM, Greg Stark <stark at mit.edu> wrote:> I get that even if I put -fPIE in CFLAGS.Er, yeah. Even a trivial test case doesn't work: $ cat foo.c int main(int argc, char *argv[], char *envp[]) { return 1; } $ clang -o foo -fsanitize=memory -fPIE -pie foo.c $ sysctl kernel.randomize_va_space kernel.randomize_va_space = 2 $ ./foo FATAL: Code 0x55873d194390 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'. ==25950==Process memory map follows: 0x55873d177000-0x55873d216000 /tmp/foo 0x55873d415000-0x55873d419000 /tmp/foo 0x55873d419000-0x55873f88c000 0x7f276d5cf000-0x7f276d921000 0x7f276d921000-0x7f276dac0000 /lib/x86_64-linux-gnu/libc-2.19.so 0x7f276dac0000-0x7f276dcc0000 /lib/x86_64-linux-gnu/libc-2.19.so 0x7f276dcc0000-0x7f276dcc4000 /lib/x86_64-linux-gnu/libc-2.19.so 0x7f276dcc4000-0x7f276dcc6000 /lib/x86_64-linux-gnu/libc-2.19.so 0x7f276dcc6000-0x7f276dcca000 0x7f276dcca000-0x7f276dce0000 /lib/x86_64-linux-gnu/libgcc_s.so.1 0x7f276dce0000-0x7f276dedf000 /lib/x86_64-linux-gnu/libgcc_s.so.1 0x7f276dedf000-0x7f276dee0000 /lib/x86_64-linux-gnu/libgcc_s.so.1 0x7f276dee0000-0x7f276dee3000 /lib/x86_64-linux-gnu/libdl-2.19.so 0x7f276dee3000-0x7f276e0e2000 /lib/x86_64-linux-gnu/libdl-2.19.so 0x7f276e0e2000-0x7f276e0e3000 /lib/x86_64-linux-gnu/libdl-2.19.so 0x7f276e0e3000-0x7f276e0e4000 /lib/x86_64-linux-gnu/libdl-2.19.so 0x7f276e0e4000-0x7f276e1e4000 /lib/x86_64-linux-gnu/libm-2.19.so 0x7f276e1e4000-0x7f276e3e3000 /lib/x86_64-linux-gnu/libm-2.19.so 0x7f276e3e3000-0x7f276e3e4000 /lib/x86_64-linux-gnu/libm-2.19.so 0x7f276e3e4000-0x7f276e3e5000 /lib/x86_64-linux-gnu/libm-2.19.so 0x7f276e3e5000-0x7f276e3ec000 /lib/x86_64-linux-gnu/librt-2.19.so 0x7f276e3ec000-0x7f276e5eb000 /lib/x86_64-linux-gnu/librt-2.19.so 0x7f276e5eb000-0x7f276e5ec000 /lib/x86_64-linux-gnu/librt-2.19.so 0x7f276e5ec000-0x7f276e5ed000 /lib/x86_64-linux-gnu/librt-2.19.so 0x7f276e5ed000-0x7f276e605000 /lib/x86_64-linux-gnu/libpthread-2.19.so 0x7f276e605000-0x7f276e804000 /lib/x86_64-linux-gnu/libpthread-2.19.so 0x7f276e804000-0x7f276e805000 /lib/x86_64-linux-gnu/libpthread-2.19.so 0x7f276e805000-0x7f276e806000 /lib/x86_64-linux-gnu/libpthread-2.19.so 0x7f276e806000-0x7f276e80a000 0x7f276e80a000-0x7f276e82a000 /lib/x86_64-linux-gnu/ld-2.19.so 0x7f276ea03000-0x7f276ea08000 0x7f276ea1e000-0x7f276ea2a000 0x7f276ea2a000-0x7f276ea2b000 /lib/x86_64-linux-gnu/ld-2.19.so 0x7f276ea2b000-0x7f276ea2c000 /lib/x86_64-linux-gnu/ld-2.19.so 0x7f276ea2c000-0x7f276ea2d000 0x7ffd99d31000-0x7ffd99d52000 [stack] 0x7ffd99d73000-0x7ffd99d75000 [vvar] 0x7ffd99d75000-0x7ffd99d77000 [vdso] 0xffffffffff600000-0xffffffffff601000 [vsyscall] ==25950==End of process memory map. -- greg
Kostya Serebryany via llvm-dev
2015-Sep-12 21:46 UTC
[llvm-dev] Some feedback on Libfuzzer
On Sat, Sep 12, 2015 at 2:01 PM, Greg Stark <stark at mit.edu> wrote:> On Sat, Sep 12, 2015 at 7:48 PM, Greg Stark <stark at mit.edu> wrote: > > I get that even if I put -fPIE in CFLAGS. > > Er, yeah. Even a trivial test case doesn't work: > >What's the version of Linux and Clang?> $ cat foo.c > int main(int argc, char *argv[], char *envp[]) { > return 1; > } > > $ clang -o foo -fsanitize=memory -fPIE -pie foo.c > > $ sysctl kernel.randomize_va_space > kernel.randomize_va_space = 2 > > $ ./foo > FATAL: Code 0x55873d194390 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'. > ==25950==Process memory map follows: > 0x55873d177000-0x55873d216000 /tmp/foo > 0x55873d415000-0x55873d419000 /tmp/foo > 0x55873d419000-0x55873f88c000 > 0x7f276d5cf000-0x7f276d921000 > 0x7f276d921000-0x7f276dac0000 /lib/x86_64-linux-gnu/libc-2.19.so > 0x7f276dac0000-0x7f276dcc0000 /lib/x86_64-linux-gnu/libc-2.19.so > 0x7f276dcc0000-0x7f276dcc4000 /lib/x86_64-linux-gnu/libc-2.19.so > 0x7f276dcc4000-0x7f276dcc6000 /lib/x86_64-linux-gnu/libc-2.19.so > 0x7f276dcc6000-0x7f276dcca000 > 0x7f276dcca000-0x7f276dce0000 /lib/x86_64-linux-gnu/libgcc_s.so.1 > 0x7f276dce0000-0x7f276dedf000 /lib/x86_64-linux-gnu/libgcc_s.so.1 > 0x7f276dedf000-0x7f276dee0000 /lib/x86_64-linux-gnu/libgcc_s.so.1 > 0x7f276dee0000-0x7f276dee3000 /lib/x86_64-linux-gnu/libdl-2.19.so > 0x7f276dee3000-0x7f276e0e2000 /lib/x86_64-linux-gnu/libdl-2.19.so > 0x7f276e0e2000-0x7f276e0e3000 /lib/x86_64-linux-gnu/libdl-2.19.so > 0x7f276e0e3000-0x7f276e0e4000 /lib/x86_64-linux-gnu/libdl-2.19.so > 0x7f276e0e4000-0x7f276e1e4000 /lib/x86_64-linux-gnu/libm-2.19.so > 0x7f276e1e4000-0x7f276e3e3000 /lib/x86_64-linux-gnu/libm-2.19.so > 0x7f276e3e3000-0x7f276e3e4000 /lib/x86_64-linux-gnu/libm-2.19.so > 0x7f276e3e4000-0x7f276e3e5000 /lib/x86_64-linux-gnu/libm-2.19.so > 0x7f276e3e5000-0x7f276e3ec000 /lib/x86_64-linux-gnu/librt-2.19.so > 0x7f276e3ec000-0x7f276e5eb000 /lib/x86_64-linux-gnu/librt-2.19.so > 0x7f276e5eb000-0x7f276e5ec000 /lib/x86_64-linux-gnu/librt-2.19.so > 0x7f276e5ec000-0x7f276e5ed000 /lib/x86_64-linux-gnu/librt-2.19.so > 0x7f276e5ed000-0x7f276e605000 /lib/x86_64-linux-gnu/libpthread-2.19.so > 0x7f276e605000-0x7f276e804000 /lib/x86_64-linux-gnu/libpthread-2.19.so > 0x7f276e804000-0x7f276e805000 /lib/x86_64-linux-gnu/libpthread-2.19.so > 0x7f276e805000-0x7f276e806000 /lib/x86_64-linux-gnu/libpthread-2.19.so > 0x7f276e806000-0x7f276e80a000 > 0x7f276e80a000-0x7f276e82a000 /lib/x86_64-linux-gnu/ld-2.19.so > 0x7f276ea03000-0x7f276ea08000 > 0x7f276ea1e000-0x7f276ea2a000 > 0x7f276ea2a000-0x7f276ea2b000 /lib/x86_64-linux-gnu/ld-2.19.so > 0x7f276ea2b000-0x7f276ea2c000 /lib/x86_64-linux-gnu/ld-2.19.so > 0x7f276ea2c000-0x7f276ea2d000 > 0x7ffd99d31000-0x7ffd99d52000 [stack] > 0x7ffd99d73000-0x7ffd99d75000 [vvar] > 0x7ffd99d75000-0x7ffd99d77000 [vdso] > 0xffffffffff600000-0xffffffffff601000 [vsyscall] > ==25950==End of process memory map. > > > -- > greg >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150912/26e12fce/attachment.html>
On Sat, Sep 12, 2015 at 10:46 PM, Kostya Serebryany <kcc at google.com> wrote:> What's the version of Linux and Clang?Checked out a few days ago. It looks like r246697. I suppose I could try updating and rebuilding. $ uname -a Linux pixel 4.2.0-trunk-amd64 #1 SMP Debian 4.2-1~exp1 (2015-08-31) x86_64 GNU/Linux -- greg