-
Notifications
You must be signed in to change notification settings - Fork 273
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
[FR] UBSAN print_stacktrace=1 #954
Comments
Could you reproduce it with a standalone binary? Works fine for me with ndk r19. |
Is the problem maybe that the trace only goes to stderr and not logcat? |
exactly @DanAlbert logcat contains only SUMARY and last line of stack where the error was finaly went into action. |
What device? Probably more interesting, what OS version? I could have sworn we switched the common sanitizer logging over to syslog ages ago (L or M). syslog as of about that time should print to logcat. |
I tried asan/ubsan on it works for me only on emulator i686 with android 9.0 goggle apis and i686 build i tried also emualtor x86_64 with 64 build but it fails to run with Shadow memory range interleaves with an existing memory mapping. ASan cannot proceed correctly. ABORTING. As i read it is known error and i cannot do anything , just have to wait for new kernel .. |
My wrap.sh (i build with cmake/gradle)
|
@DanAlbert You mentioned "syslog as of about that time should print to logcat." cat /opt/android-ndk-r20/wrap.sh/asan.x86.sh
|
I use ASAN & UBSAN only for java android app with native library |
the @eugenis --- do you remember the reason for this? should we just delete this from both places, since it seems like it's not useful for the typical [app] developer. (i guess that option only really makes sense if you're running a gtest directly?) |
log_to_syslog=false is because wrap.sh gets a logwrapper around it. Without
that every line will be written twice.
…On Wed, Apr 10, 2019 at 11:47 AM Elliott Hughes ***@***.***> wrote:
the log_to_syslog=false is in the canonical docs too:
https://github.com/google/sanitizers/wiki/AddressSanitizerOnAndroid
@eugenis <https://github.com/eugenis> --- do you remember the reason for
this? should we just delete this from both places, since it seems like it's
not useful for the typical [app] developer. (i guess that option only
really makes sense if you're running a gtest directly?)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#954 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAZuSgs3DtCLlV__Db3KbonQDXE6LJOrks5vfjHWgaJpZM4chCNq>
.
|
Maybe the problem with logcat stack trace is that it is to long to push it at once, and get croped to single line.
adb logcat -g |
I didn't realize that logwrapper was used by default with wrap.sh, but the code agrees with you. I can't speak to why this doesn't work on LineageOS, but given that it does work on Android I think this is something you'll need to take up with LineageOS. |
No w8. |
I think i know why it doesn't work.
Concluding |
what version of Studio are you using? |
the Studio folks tell me i got the docs wrong... apparently although it will show up as "libs.x86" under resources, it should actually be resources/libs/x86 on disk. here's my suggested corrected text for the docs:
can you confirm that if you create libs/x86 rather than libs.x86 (etc) that it works? |
Thats was the point on filesystem this must be located the differences in logcat
wrap.sh
Do You maybe know how to disable escape color codes ?
|
does
instead of
fix the tag? @eugenis should be able to answer the question about the escape sequences... |
It's in https://github.com/google/sanitizers/wiki/SanitizerCommonFlags,
color = (always|never|auto).
"auto" means only if isatty(stderr)==true. I don't understand why wrap.sh's
stderr would be a tty device.
…On Mon, Apr 15, 2019 at 1:08 PM Elliott Hughes ***@***.***> wrote:
does
LD_PRELOAD="$HERE/libclang_rt.asan-i686-android.so" exec "$@"
instead of
LD_PRELOAD="$HERE/libclang_rt.asan-i686-android.so" "$@"
fix the tag?
@eugenis <https://github.com/eugenis> should be able to answer the
question about the escape sequences...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#954 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAZuSh53QNIGZIIqPkFark2QSZHVwl6-ks5vhNxMgaJpZM4chCNq>
.
|
the exec doesn't change tag from wrap.sh however its not a problem for me. To be more precise for futre readers the wrap.sh must look like below with exec in new line LD_PRELOAD="$HERE/libclang_rt.asan-i686-android.so"
exec "$@" Thank You very much @enh @eugenis @DanAlbert for help. My final wrap.sh for future readers #!/system/bin/sh
HERE="$(cd "$(dirname "$0")" && pwd)"
export ASAN_OPTIONS=log_to_syslog=false,allow_user_segv_handler=1,detect_stack_use_after_return=1,check_initialization_order=true,quarantine_size_mb=64,color=never
export UBSAN_OPTIONS=print_stacktrace=1,log_to_syslog=false,color=never
export LD_PRELOAD="$HERE/libclang_rt.asan-i686-android.so"
exec "$@" |
From my point of view we can close this FR |
I'll leave it open so we remember to fix the docs |
and toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/8.0.7/bin/asan_device_setup
|
I'm not sure there's much value in keeping |
From a an app developer who prepares tools for team. wrap.sh scripts are problematic as they cannot be a static resources. wrap.sh wouldn't be so problematic if wrap.sh could be palced inside direcotory of native libs , but with gradle it cannot, gradle ignores everything except.so I'm afraid (paranoic) with wrap.sh and dynamic soruce tree modification from gradle cofnig that with some error in gradle config of app public release build will contain wrap.sh when no one will remember in team about wrap.sh and do some change .. |
Fair enough. I suppose at least until gradle makes this less of a PITA there's value in keeping it around. @eugenis: do you want to make the |
Do you mind sending me a patch?
…On Wed, Apr 17, 2019 at 12:42 PM Dan Albert ***@***.***> wrote:
Fair enough. I suppose at least until gradle makes this less of a PITA
there's value in keeping it around.
@eugenis <https://github.com/eugenis>: do you want to make the
asan_device_setup fixes, or should I send you a patch?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#954 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAZuShtK6oxRnJ9X3JBp2RYuX1JpbrTPks5vh3ktgaJpZM4chCNq>
.
|
The |
seems like the original submitter was using x86 and x86-64? no hwasan for them :-( (but this is a pretty niche script that most people can't run, and we haven't heard anyone else notice it was broken, so probably not worth much effort.) |
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
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.
NDK tested r20 beta 1 platform i686
The text was updated successfully, but these errors were encountered: