[PATCH] D61070: [libFuzzer] Enable on i386

Jonathan Metzman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 29 09:09:07 PDT 2019


metzman added inline comments.


================
Comment at: compiler-rt/lib/fuzzer/CMakeLists.txt:128
+      set(EMULATION_ARGUMENT "")
+    endif()
     set(cxx_${arch}_merge_dir "${CMAKE_CURRENT_BINARY_DIR}/cxx_${arch}_merge.dir")
----------------
morehouse wrote:
> Why is this argument necessary?
Without it we get this error: `/usr/bin/ld: Relocatable linking with relocations from format elf32-i386 (/home/user/llvm-build/lib/clang/9.0.0/lib/linux/libclang_rt.fuzzer-i386.a(FuzzerCrossOver.cpp.o)) to format elf64-x86-64 (fuzzer.o) is not supported`

Interestingly, this has been a problem with libFuzzer before, see [[ https://forum.xda-developers.com/android/software-hacking/llvm-clang-dragontc-future-t3318386/page34 | here ]].


================
Comment at: compiler-rt/test/fuzzer/dataflow.test:2
 # Tests the data flow tracer.
-REQUIRES: linux
-UNSUPPORTED: aarch64
+REQUIRES: linux, x86_64
 
----------------
morehouse wrote:
> Any idea why this fails on x86?
Dataflow afaik only supports x86_64 Linux.


================
Comment at: compiler-rt/test/fuzzer/fork.test:15
+# access-violation is the error thrown on Windows. Address will be smaller on i386.
+CRASH: {{SEGV|access-violation}} on unknown address {{0x000000000000|0x00000000}}
 RUN: %cpp_compiler %S/ShallowOOMDeepCrash.cpp -o %t-ShallowOOMDeepCrash
----------------
kcc wrote:
> no need for a regex, just remove extra zeroes. 
Done.


================
Comment at: compiler-rt/test/fuzzer/lit.cfg:28
 
-# LeakSanitizer is not supported on OSX or Windows right now.
+# LeakSanitizer is not supported on OSX, Windows, or i386 right now.
 if (sys.platform.startswith('darwin') or
----------------
kcc wrote:
> That's not true: 
> 
> % clang++ -m32  -fsanitize=address ~/misc-c/leak.cc  && ./a.out 
> 
> =================================================================
> ==132478==ERROR: LeakSanitizer: detected memory leaks
> 
> Direct leak of 4 byte(s) in 1 object(s) allocated from:
>     #0 0x810cf89 in operator new(unsigned int) /usr/local/google/home/kcc/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:105:3
>     #1 0x8063e01 in __cxx_global_var_init (/usr/local/google/home/kcc/llvm-build/a.out+0x8063e01)
>     #2 0x8063e68 in _GLOBAL__sub_I_leak.cc (/usr/local/google/home/kcc/llvm-build/a.out+0x8063e68)
>     #3 0x810f63a in __libc_csu_init (/usr/local/google/home/kcc/llvm-build/a.out+0x810f63a)
> 
> SUMMARY: AddressSanitizer: 4 byte(s) leaked in 1 allocation(s).
> 
My bad, stale comment.


================
Comment at: compiler-rt/test/fuzzer/only-some-bytes.test:2
 # Tests the data flow tracer.
-REQUIRES: linux
-UNSUPPORTED: aarch64
+REQUIRES: linux, x86_64
 
----------------
morehouse wrote:
> Any idea why this doesn't work for x86?
Dataflow afaik only supports x86_64 Linux.


================
Comment at: compiler-rt/test/fuzzer/trace-malloc-threaded.test:4
 // FIXME: Disabled on Windows because of a crash (possibly related to above).
-UNSUPPORTED: darwin, aarch64, windows
+UNSUPPORTED: darwin, aarch64, windows, i386
 
----------------
morehouse wrote:
> Any idea why this doesn't work for x86?
Got it working, it's because most of the i386 addresses begin with 0xf instead of 0x[0-9]


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61070/new/

https://reviews.llvm.org/D61070





More information about the llvm-commits mailing list