Skip to content

Commit

Permalink
Clarify ASan KI in the changelogs.
Browse files Browse the repository at this point in the history
Test: None
Bug: android/ndk#988
Change-Id: I9047240acedb677a3c44c93992cf6283a6475369
  • Loading branch information
DanAlbert committed Jul 10, 2019
1 parent c78e43c commit 545a773
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 21 deletions.
22 changes: 15 additions & 7 deletions docs/changelogs/Changelog-r19.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,26 @@ Known Issues
`-march=armv7-a` when building for 32-bit ARM with the non-integrated
assembler, or use the integrated assembler. ndk-build and CMake already
contain these workarounds.
* [Issue 988]: Exception handling with libc++_shared when using ASan via
wrap.sh can crash. To workaround this issue, ensure that your application's
libc++_shared.so is in `LD_PRELOAD` in your `wrap.sh` as in the following
example:
* [Issue 988]: Exception handling when using ASan via wrap.sh can crash. To
workaround this issue when using libc++_shared, ensure that your
application's libc++_shared.so is in `LD_PRELOAD` in your `wrap.sh` as in the
following example:

```bash
#!/system/bin/sh
HERE="$(cd "$(dirname "$0")" && pwd)"
export ASAN_OPTIONS=log_to_syslog=false,allow_user_segv_handler=1
export LD_PRELOAD="$HERE/libclang_rt.asan-aarch64-android.so $HERE/libc++_shared.so"
exec "$@"
```
ASAN_LIB=$(ls $HERE/libclang_rt.asan-*-android.so)
if [ -f "$HERE/libc++_shared.so" ]; then
# Workaround for /~https://github.com/android-ndk/ndk/issues/988.
export LD_PRELOAD="$ASAN_LIB $HERE/libc++_shared.so"
else
export LD_PRELOAD="$ASAN_LIB"
fi
"$@"
```

There is no known workaround for libc++_static.

Note that because this is a platform bug rather than an NDK bug this
workaround will be necessary for this use case to work on all devices until
Expand Down
29 changes: 22 additions & 7 deletions docs/changelogs/Changelog-r20.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,33 @@ For Android Studio issues, follow the docs on the [Android Studio site].
`-march=armv7-a` when building for 32-bit ARM with the non-integrated
assembler, or use the integrated assembler. ndk-build and CMake already
contain these workarounds.
* [Issue 988]: Exception handling with libc++_shared when using ASan via
wrap.sh can crash. To workaround this issue, ensure that your application's
libc++_shared.so is in `LD_PRELOAD` in your `wrap.sh` as in the following
example:
* [Issue 906]: Clang does not pass `-march=armv7-a` to the assembler when using
`-fno-integrated-as`. This results in the assembler generating ARMv5
instructions. Note that by default Clang uses the integrated assembler which
does not have this problem. To workaround this issue, explicitly use
`-march=armv7-a` when building for 32-bit ARM with the non-integrated
assembler, or use the integrated assembler. ndk-build and CMake already
contain these workarounds.
* [Issue 988]: Exception handling when using ASan via wrap.sh can crash. To
workaround this issue when using libc++_shared, ensure that your
application's libc++_shared.so is in `LD_PRELOAD` in your `wrap.sh` as in the
following example:

```bash
#!/system/bin/sh
HERE="$(cd "$(dirname "$0")" && pwd)"
export ASAN_OPTIONS=log_to_syslog=false,allow_user_segv_handler=1
export LD_PRELOAD="$HERE/libclang_rt.asan-aarch64-android.so $HERE/libc++_shared.so"
exec "$@"
```
ASAN_LIB=$(ls $HERE/libclang_rt.asan-*-android.so)
if [ -f "$HERE/libc++_shared.so" ]; then
# Workaround for /~https://github.com/android-ndk/ndk/issues/988.
export LD_PRELOAD="$ASAN_LIB $HERE/libc++_shared.so"
else
export LD_PRELOAD="$ASAN_LIB"
fi
"$@"
```

There is no known workaround for libc++_static.

Note that because this is a platform bug rather than an NDK bug this
workaround will be necessary for this use case to work on all devices until
Expand Down
29 changes: 22 additions & 7 deletions docs/changelogs/Changelog-r21.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,33 @@ For Android Studio issues, follow the docs on the [Android Studio site].
`-march=armv7-a` when building for 32-bit ARM with the non-integrated
assembler, or use the integrated assembler. ndk-build and CMake already
contain these workarounds.
* [Issue 988]: Exception handling with libc++_shared when using ASan via
wrap.sh can crash. To workaround this issue, ensure that your application's
libc++_shared.so is in `LD_PRELOAD` in your `wrap.sh` as in the following
example:
* [Issue 906]: Clang does not pass `-march=armv7-a` to the assembler when using
`-fno-integrated-as`. This results in the assembler generating ARMv5
instructions. Note that by default Clang uses the integrated assembler which
does not have this problem. To workaround this issue, explicitly use
`-march=armv7-a` when building for 32-bit ARM with the non-integrated
assembler, or use the integrated assembler. ndk-build and CMake already
contain these workarounds.
* [Issue 988]: Exception handling when using ASan via wrap.sh can crash. To
workaround this issue when using libc++_shared, ensure that your
application's libc++_shared.so is in `LD_PRELOAD` in your `wrap.sh` as in the
following example:

```bash
#!/system/bin/sh
HERE="$(cd "$(dirname "$0")" && pwd)"
export ASAN_OPTIONS=log_to_syslog=false,allow_user_segv_handler=1
export LD_PRELOAD="$HERE/libclang_rt.asan-aarch64-android.so $HERE/libc++_shared.so"
exec "$@"
```
ASAN_LIB=$(ls $HERE/libclang_rt.asan-*-android.so)
if [ -f "$HERE/libc++_shared.so" ]; then
# Workaround for /~https://github.com/android-ndk/ndk/issues/988.
export LD_PRELOAD="$ASAN_LIB $HERE/libc++_shared.so"
else
export LD_PRELOAD="$ASAN_LIB"
fi
"$@"
```

There is no known workaround for libc++_static.

Note that because this is a platform bug rather than an NDK bug this
workaround will be necessary for this use case to work on all devices until
Expand Down

0 comments on commit 545a773

Please sign in to comment.