-
Notifications
You must be signed in to change notification settings - Fork 20
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
UBSAN may produce unusable traces #108
Comments
Are the paths relative to the working directory at run time or build time? If the latter, |
This seems like a bug in GCC. Because GCC and Clang behave differently in this case: $ clang -fsanitize=undefined -g -O0 ../symb/test.c
$ UBSAN_OPTIONS=print_stacktrace=1 ./a.out
../symb/test.c:5:12: runtime error: index 4 out of bounds for type 'int[4]'
#0 0x42b35c in main /home/lukas/tmp/bin/../symb/test.c:5:12
#1 0x7f7c4021cb49 in __libc_start_call_main (/lib64/libc.so.6+0x27b49) (BuildId: 245240a31888ad5c11bbc55b18e02d87388f59a9)
#2 0x7f7c4021cc0a in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x27c0a) (BuildId: 245240a31888ad5c11bbc55b18e02d87388f59a9)
#3 0x4033a4 in _start (/home/lukas/tmp/bin/a.out+0x4033a4) (BuildId: 52afc251f68713a934cde4df480a3d091e9fc3f4)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../symb/test.c:5:12 in
$ cc -fsanitize=undefined -g ../symb/test.c
$ UBSAN_OPTIONS=print_stacktrace=1 ./a.out
../symb/test.c:5:13: runtime error: index 4 out of bounds for type 'int [4]'
#0 0x40114c in main ../symb/test.c:5
#1 0x7fab70c49b49 in __libc_start_call_main (/lib64/libc.so.6+0x27b49) (BuildId: 245240a31888ad5c11bbc55b18e02d87388f59a9)
#2 0x7fab70c49c0a in __libc_start_main_alias_2 (/lib64/libc.so.6+0x27c0a) (BuildId: 245240a31888ad5c11bbc55b18e02d87388f59a9)
#3 0x401074 in _start (/home/lukas/tmp/bin/a.out+0x401074) (BuildId: d38972f553a09517259535880b4025e8ef8a6f79)
../symb/test.c:5:13: runtime error: load of address 0x7ffe0400e5b0 with insufficient space for an object of type 'int'
0x7ffe0400e5b0: note: pointer points here
fe 7f 00 00 50 e6 00 04 fe 7f 00 00 4a 9b c4 70 ab 7f 00 00 e8 82 df 70 ab 7f 00 00 d8 e6 00 04
^
#0 0x401161 in main ../symb/test.c:5
#1 0x7fab70c49b49 in __libc_start_call_main (/lib64/libc.so.6+0x27b49) (BuildId: 245240a31888ad5c11bbc55b18e02d87388f59a9)
#2 0x7fab70c49c0a in __libc_start_main_alias_2 (/lib64/libc.so.6+0x27c0a) (BuildId: 245240a31888ad5c11bbc55b18e02d87388f59a9)
#3 0x401074 in _start (/home/lukas/tmp/bin/a.out+0x401074) (BuildId: d38972f553a09517259535880b4025e8ef8a6f79) |
Idea for an temporary solution: Allow all UBSAN reports unconditionally. While the traces might be incomplete, such warning still informs us that some built and executed program contained an error with very high probability. |
If I understand it correctly, the problem is that |
Even though csutils/csdiff#130 improves the situation, UBSAN does not guarantee that the path in the first entry of the backtrace will be absolute. E.g. the following report from
coreutils
will be silenced:We can use
csexec
to track the working directory and UBSAN logs from the given process and fix them afterwards. The log files end with the PID of the sanitized process, so it should be quite easy to track it because each child will have its owncsexec
execution.The text was updated successfully, but these errors were encountered: