syscall_intercept
syscall_intercept copied to clipboard
Fix conflict with code sanitizers (UBSAN, ASAN)
- Use UBSAN and ASAN when it is possible. The way UBSAN, ASAN do code instrumentation seems to be conflicting with syscall_intercept's syscall hooking. They insert syscall instructions to places other than libc. Looking for all syscalls, and patching all of them outside libc as well probably fixes the conflict.
Related:
It looks like collecting coverage data using gcc's --coverage
flag also involves unexpected syscalls.
The result is a failing test:
23/28 Test #23: hook ...................................***Failed 0.27 sec
Executing: LD_PRELOAD=/syscall_intercept/build/test/libhook_test_preload.so
/syscall_intercept/build/test/hook_test None .log.hook
thinhook_test: /syscall_intercept/test/hook_test_preload.c:75: hook: Assertion `0' failed.
CMake Error at /syscall_intercept/test/check_log.cmake:61 (message):
Test failed: Child aborted
Collecting coverage information was broken for a while (.gcda
files ended up being corrupt, due to some tests altering some write syscalls), but #27 allows some more spurious syscalls in the tests which use the intercept_sys_write.so test library. The other tests must be checked (hooking, logging, fork, etc...) as well. Apparently coverage info is collected for all files since #27, but I'm not sure if it really is collected in all tests -- what we see is that the .gcda
files are at least no corrupted.