-
-
Notifications
You must be signed in to change notification settings - Fork 175
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
[#inc-517] Add basic crashing test with asan (HW Asan, GWP-ASan) #962
Comments
Testing Address SanitizersThis comment acts as a "what-we-already-tried" benchmark to work from, which can guide our next steps in resolving this issue. During the investigation of #974 I had a look into the following 3 ASAN types: ASan(Android Docs) To run ASan on an emulated Pixel 9 Pro (running Android 14.0 Default Android System Image, so we have Root access) I added the following to the sample app (found here): target_compile_options(ndk-sample PRIVATE -fsanitize=address -fno-omit-frame-pointer)
target_link_options(ndk-sample PRIVATE -fsanitize=address)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address") And these to externalNativeBuild {
cmake {
arguments.add(0, "-DANDROID_STL=c++_shared")
arguments.add(0, "-DSENTRY_NATIVE_SRC=$sentryNativeSrc")
arguments.add("-DCMAKE_VERBOSE_MAKEFILE=ON")
abiFilters.addAll(listOf("x86_64", "arm64-v8a"))
abiFilters.forEach { abi ->
println("ABI=$abi")
if (abi == "arm64-v8a" || abi == "x86_64") {
arguments.add(0, "-DANDROID_SANITIZE=address")
}
}
}
} After which I needed to copy When running the following snippet, we get ASan output: char *ptr_f = (char *)malloc(10);
free(ptr_f);
*ptr_f = 'A'; ASan output
GWP-ASan(Android Docs) Enabling this for an app can be done by adding this to the <application android:gwpAsanMode="always">
...
</application> HW-ASan(Android Docs) |
🛑 Blocked by
The text was updated successfully, but these errors were encountered: