Repository navigation
Closed
Labels
bug 🐞Something isn't workinghal/vulkanRuntime Vulkan GPU HAL backendplatform/android 🤖Android-specific build, execution, benchmarking, and deployment
Description
On Samsung S20 with Mali GPUs running build QP1A.190711.020.G980FXXU3ATG4 (adb shell getprop ro.build.display.id), Android fortify discovered an issue:
FORTIFY: pthread_mutex_lock called on a destroyed mutex (0x7c490ca4f0)
This can be reproduced by lots of tests, for example,
ctest --output-on-failure -R "vulkan_success" Crash dump:
********** Crash dump: **********
Build fingerprint: 'samsung/x1sxx/x1s:10/QP1A.190711.020/G980FXXU3ATG4:user/release-keys'
Abort message: 'FORTIFY: pthread_mutex_lock called on a destroyed mutex (0x7f37eb74f0)'
#00 0x0000000000083134 /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: 8506c6089129511bb62873663f6b4533)
#01 0x00000000000e3eb4 /apex/com.android.runtime/lib64/bionic/libc.so (__fortify_fatal(char const*, ...)+116) (BuildId: 8506c6089129511bb62873663f6b4533)
#02 0x00000000000e35a4 /apex/com.android.runtime/lib64/bionic/libc.so (HandleUsingDestroyedMutex(pthread_mutex_t*, char const*)+52) (BuildId: 8506c6089129511bb62873663f6b4533)
#03 0x00000000000e3404 /apex/com.android.runtime/lib64/bionic/libc.so (pthread_mutex_lock+164) (BuildId: 8506c6089129511bb62873663f6b4533)
#04 0x000000000254c150 /vendor/lib64/egl/libGLES_mali.so (BuildId: facf542cb434ba7e8f2c4509706135c8)
#05 0x000000000254aff4 /vendor/lib64/egl/libGLES_mali.so (BuildId: facf542cb434ba7e8f2c4509706135c8)
#06 0x0000000000cf538c /vendor/lib64/egl/libGLES_mali.so (BuildId: facf542cb434ba7e8f2c4509706135c8)
#07 0x00000000000e56e0 /apex/com.android.runtime/lib64/bionic/libc.so (__cxa_finalize+212) (BuildId: 8506c6089129511bb62873663f6b4533)
#08 0x0000000000051074 /apex/com.android.runtime/bin/linker64 (__dl__ZN6soinfo16call_destructorsEv+404) (BuildId: 2c4ecc7055fa0de22e6e642dc9e65e57)
#09 0x000000000003bb94 /apex/com.android.runtime/bin/linker64 (__dl__ZL13soinfo_unloadP6soinfo+1060) (BuildId: 2c4ecc7055fa0de22e6e642dc9e65e57)
#10 0x000000000003d50c /apex/com.android.runtime/bin/linker64 (__dl__Z10do_dlclosePv+120) (BuildId: 2c4ecc7055fa0de22e6e642dc9e65e57)
#11 0x000000000003839c /apex/com.android.runtime/bin/linker64 (__loader_dlclose+32) (BuildId: 2c4ecc7055fa0de22e6e642dc9e65e57)
#12 0x000000000000108c /apex/com.android.runtime/lib64/bionic/libdl.so (dlclose+8) (BuildId: ee5a54c32874d345e4d2f02a4cbace8a)
#13 0x00000000003e5fe8 /data/local/tmp/iree/modules/check/test/check_vulkan-spirv_vulkan_success.mlir/iree-check-module
iree::DynamicLibraryPosix::~DynamicLibraryPosix()
??:0:0
#14 0x00000000003e6038 /data/local/tmp/iree/modules/check/test/check_vulkan-spirv_vulkan_success.mlir/iree-check-module
iree::DynamicLibraryPosix::~DynamicLibraryPosix()
??:0:0
It seems an error occurs inside libGLES_mali.so when we try to dlclose it.
Metadata
Metadata
Assignees
Labels
bug 🐞Something isn't workinghal/vulkanRuntime Vulkan GPU HAL backendplatform/android 🤖Android-specific build, execution, benchmarking, and deployment
Activity
antiagainst commentedon Aug 8, 2020
I feel this is gonna to be a nasty bug to figure out. The stack trace involves the GPU driver in the middle so that obscures stuff. It sort of resembles #2659, where we also see failures raising from the GPU driver. Another thing that is common between these two cases is that they are both monolithic drivers. The Mali driver is essentially for both OpenGL, OpenCL, and Vulkan. NVIDIA's GPU driver is containing both OpenGL and Vulkan.. In #2659, we can see functions like
eglReleaseThreadgotten involved in the stack trace, buteglReleaseThreadis for OpenGL. The error here happens in__cxa_finalize, which is deinitializing the shared libary itself. I'm wondering whether it's also OpenGL global state stuff getting involved here too..antiagainst commentedon Aug 8, 2020
Trying to get a simpler test case to repro this. Reducing
success.mlir, actually only keeping theaddfunction suffices to trigger it:https://github.com/google/iree/blob/4a445bb4045ee3b29a61de8d8893d9b13359d395/iree/modules/check/test/success.mlir#L56-L62
What's more interesting is that commenting out the
check.expect_eqline then it will pass.antiagainst commentedon Aug 8, 2020
A temporary workaround we can have for this is to not
dlcloseon Android.. It's a bit ugly, but it avoids us to pull Mali GPUs off the CI completely. Really don't want to accumulate other regressions due to that. :( Shared libraries are managed by OS and refcounted anyway; it's unlikely that the GPU .so will be unloaded from the memory completely given there are many users. And we are closing the library almost at program exiting time.hanhanW commentedon Aug 12, 2020
I can't reproduce this on my Samsung S10. Android build
QP1A.190711.020.G973FXXS7CTG1@antiagainst Sorry that I don't remember, should I upgrade the Android to the latest version? I remember that there is an issue there?
antiagainst commentedon Aug 12, 2020
Yes you'll need to update to
QP1A.190711.020.G980FXXU3ATG4(with July 1, 2020 security patch). But BEFORE doing that, please copy/vendor/lib64/egl/libGLES_mali.soto your desktop/laptop for backup so that later you can use it under/data/local/tmpto bypass the issue if needed.hanhanW commentedon Aug 12, 2020
Hmm, my Samsung S10 thinks that it's already upgraded to the latest. It's also the July 1, 2020 security patch. It seems that this bug is not reproducible on Samsung S10?
I also replace the
libvulkan.sowith/vendor/lib64/hw/vulkan.*.so, and it's still passing.antiagainst commentedon Aug 12, 2020
Thanks Hanhan. This might be a Mali G77 (which is what S20 has) specific issue then. :(
antiagainst commentedon Aug 12, 2020
libGLES_mali.sofrom S20 atQP1A.190711.020.G980FXXU1ATCTworks. Given this only shows up on Mali G77 with a specific Android build, I'll de-prioritize this and copy an older driver to temporary workaround and make sure we don't accumulate other regressions.antiagainst commentedon Oct 26, 2020
I'm not seeing this issue anymore with the most recent build. Closing this.