[FR] UBSAN print_stacktrace=1
- Dominant language
- No language data
- Stars
- 2.3k
- Forks
- 310
- PR merge metrics
- No merged PRs in 30d
Description
ubsan has a feature originaly to print stack trace of UB.
however on android port this seems to not work print_stacktrace=1 to ASAN and UBSAN but this doesn't seem to produce a stack trace like on linux in logcat
I added to wrap.sh
```export ASAN_OPTIONS=log_to_syslog=false,allow_user_segv_handler=1,detect_stack_use_after_return=1,print_stacktrace=1
export UBSAN_OPTIONS=print_stacktrace=1
```
This sometimes is required to fix a bug for example when UB is detected in libc++ but source of ub happens much earlier in code calls.
Example of useles information without stack trace.
```android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/algorithm:1636:21: runtime error: implicit conversion from type 'char' of value -61 (8-bit, signed) to type 'unsigned char' changed the value to 195 (8-bit, unsigned)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /opt/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/algorithm:1636:21
```
NDK tested r20 beta 1 platform i686
Contributor guide
Research direction
Start with the Android port's wrap.sh and reproduce the issue using the shown ASAN_OPTIONS and UBSAN_OPTIONS on NDK r20 beta 1 for i686. Compare the sanitizer output in logcat with the Linux behavior, including the libc++ algorithm diagnostic. Done means UBSAN or ASAN reports a usable stack trace in logcat when print_stacktrace=1 is enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, cpp
- Domain
- devtools, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100