Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix conflict with code sanitizers (UBSAN, ASAN) #7

Open
GBuella opened this issue May 11, 2017 · 2 comments
Open

Fix conflict with code sanitizers (UBSAN, ASAN) #7

GBuella opened this issue May 11, 2017 · 2 comments
Labels

Comments

@GBuella
Copy link
Contributor

GBuella commented May 11, 2017

  • 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.
@GBuella GBuella added the tests label May 11, 2017
GBuella added a commit to GBuella/syscall_intercept that referenced this issue May 21, 2017
Ref: pmem#7

While executing ASAN builds, some unexpected syscalls are observed. These
can not be predicted, so this patch attempts to filter them out.
Also, the return value of the function named hook in test/hook_test_preload.c
is changed to 7 from 99. This also helps with ASAN builds: ASAN reads
the buffers passed write syscalls, after they return. Due to this, an ASAN
error was triggered every time it tried to read dummy_data buffer's contents,
which has fewer than 99 bytes.
@GBuella
Copy link
Contributor Author

GBuella commented May 23, 2017

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

@GBuella
Copy link
Contributor Author

GBuella commented Jun 27, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant