Crash in libegl-mesa0 (eglReleaseThread)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mesa |
Unknown
|
Unknown
|
|||
mesa (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Focal |
New
|
Undecided
|
Timo Aaltonen | ||
Impish |
New
|
Undecided
|
Timo Aaltonen |
Bug Description
Crash in libegl-mesa0 (in eglReleaseThread API), please find the backtrace:
#0 0x0000fffff7c86ac4 in __GI___
#1 0x0000fffff4a7d110 in mtx_lock (mtx=0x8) at ../include/
#2 eglReleaseThread () at ../src/
#3 0x0000fffff6c115b8 in eglReleaseThread () at /lib/aarch64-
#4 0x0000fffff7fdac00 in () at /lib/ld-
#5 0x0000fffff7b4284c in __run_exit_handlers
(status=0, listp=0xfffff7c
#6 0x0000fffff7b429dc in __GI_exit (status=<optimized out>) at exit.c:139
#7 0x0000fffff7b2d094 in __libc_start_main (main=
0xaaaaaaaa3530 <main>, argc=13, argv=0xffffffff
at ../csu/
#8 0x0000aaaaaaaa4014 in _start ()
It crashes at: https:/
Actually nvidia's EGL backend is being loaded by glvnd in this case. But the eglReleaseThread() implementation of glvnd calls the eglReleaseThread() API of all the vendors, that's how it end-up calling the eglReleaseThread() API of Mesa backend. Refer: https:/
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
apt-cache policy libegl-mesa0
libegl-mesa0:
Installed: 21.0.3-
Candidate: 21.0.3-
Version table:
*** 21.0.3-
500 http://
100 /var/lib/
20.
500 http://
Changed in mesa (Ubuntu Focal): | |
assignee: | nobody → Timo Aaltonen (tjaalton) |
Changed in mesa (Ubuntu Impish): | |
assignee: | nobody → Timo Aaltonen (tjaalton) |
The crash happens only when calling eglReleaseThread() from destructor of the process. Please find the attached simple app which can be used to repro the issue.
With valgrind, I see there is some invalid memory access during the eglReleaseThread() call. Find the logs below:
==5059== Invalid read of size 8 aarch64- linux-gnu/ libEGL. so.1.1. 0) egl_sample/ egl_sample) aarch64- linux-gnu/ valgrind/ vgpreload_ memcheck- arm64-linux. so) adInfo (eglcurrent.c:134)
==5059== at 0x70480EC: eglReleaseThread (eglapi.c:1706)
==5059== by 0x48825B7: eglReleaseThread (in /usr/lib/
==5059== by 0x1089FB: deinit (in /home/ubuntu/
==5059== by 0x400EBFF: _dl_fini (dl-fini.c:138)
==5059== by 0x48DC84B: __run_exit_handlers (exit.c:108)
==5059== by 0x48DC9DB: exit (exit.c:139)
==5059== by 0x48C7093: (below main) (libc-start.c:342)
==5059== Address 0x4c6f8c8 is 8 bytes inside a block of size 48 free'd
==5059== at 0x484AF20: free (in /usr/lib/
==5059== by 0x7051FE3: _eglDestroyThre
==5059== by 0x7051FE3: _eglFiniTSD (eglcurrent.c:76)
==5059== by 0x70539CF: _eglAtExit (eglglobals.c:112)
==5059== by 0x48DC84B: __run_exit_handlers (exit.c:108)
==5059== by 0x48DC9DB: exit (exit.c:139)
==5059== by 0x48C7093: (below main) (libc-start.c:342)
So eglReleaseThread() in this case, tries to access the _EGLThreadInfo memory already freed by _eglFiniTSD() ? But it is expected that a new instance of _EGLThreadInfo has to be created when eglReleaseThread() is called from the app in this case.