andreafioraldi / qasan

QASan is a custom QEMU 3.1.1 that detects memory errors in the guest using AddressSanitizer.
https://andreafioraldi.github.io/assets/qasan-secdev20.pdf
Other
338 stars 35 forks source link

Build error on Ubuntu 16.04 #10

Open stevenagy opened 4 years ago

stevenagy commented 4 years ago

Andrea,

I'm trying to get QASAN installed on an Ubuntu 16.04 VM with clang, but while running ./build.py --cc clang --cxx clang++, I'm encountering the following error:

clang-8  -fPIC -shared -I ../include libqasan.c hooks.c malloc.c string.c uninstrument.c patch.c -o libqasan.so -ldl -pthread
patch.c:210:12: error: use of undeclared identifier 'explicit_bzero'; did you mean 'p_explicit_bzero'?
  HOTPATCH(explicit_bzero)
           ^~~~~~~~~~~~~~
           p_explicit_bzero
patch.c:194:59: note: expanded from macro 'HOTPATCH'
  if (p_## fn) __libqasan_patch_jump(p_## fn, (uint8_t*)&(fn)); \
                                                          ^
patch.c:210:3: note: 'p_explicit_bzero' declared here
  HOTPATCH(explicit_bzero)
  ^
patch.c:193:12: note: expanded from macro 'HOTPATCH'
  uint8_t* p_## fn = (uint8_t*)dlsym(libc, # fn); \
           ^
<scratch space>:62:1: note: expanded from here
p_explicit_bzero
^
1 error generated.
Makefile:9: recipe for target 'all' failed
make: *** [all] Error 1
Traceback (most recent call last):
  File "./build.py", line 226, in <module>
    % (os.path.join(dir_path, "libqasan"), cross_cc, libqasan_cflags)) == 0 )
AssertionError

Any ideas?

andreafioraldi commented 4 years ago

Seems that your libc is too old. Try to simply remove HOTPATCH(explicit_bzero) from libqasan/patch.c. This is weird btw, I have to insert an preprocessor check on the libc version.

stevenagy commented 4 years ago

That worked, thanks!