Set program exit code in keep-going mode if asan reports errors.
We already have this for msan and hwasan, make the behavior of asan consistent with msan and hwasan.
Details
- Reviewers
vitalybuka eugenis kstoimenov MaskRay
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
compiler-rt/lib/asan/asan_rtl.cpp | ||
---|---|---|
77 | move below asan_init_is_running |
What is tsan behavior?
And ubsan?
This sounds strange to me.
Intended usecase is to run but log errors.
But In multi-process environment failing process at the end will likely fails all parents.
So I'd rather reconsider behavior of msan and hwasan,
For tsan, tsan defaults halt_on_error to false and tsan implements this in _exit interceptor.
- https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp#L803
- https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp#L2499
For ubsan, I didn't find where ubsan set exitcode explicitly.
Actually, asan and msan also have its _exit interceptor, https://reviews.llvm.org/rGfdfb2ade8fd158b4df33b1d677e1de4737582324
- in asan _exit interceptor, exitcode is set only when leaks are detected.
- in msan _exit interceptor, exitcode is always set to 0.
- and hwasan doesn't implement _exit interceptor.
Maybe we should remove current InstallAtExitHandler in asan/msan/hwasan and unify them to set exitcode in _exit interceptor.
My understand the usecase of keep-going mode is to run once and find bugs as much as possible.
We need a way to check if any bug is detected without manually greping the log, so I think rely on exitcode is reasonable.
Move this before asan_init_is_running to be consistant with msan/hwasan.