mesa/src/egl/main
Maniraj D 796c9ab3fd egl: set TSD as NULL after deinit
When eglReleaseThread() is called from application's
destructor (API with __attribute__((destructor))),
it crashes due to invalid memory access.

In this case, _egl_TLS is freed in the flow of
_eglAtExit() as below but _egl_TLS is not set to NULL.

    _eglDestroyThreadInfo
        _eglFiniTSD
            _eglAtExit
                _run_exit_handlers
                    exit

Later when the eglReleaseThread is called from
application's destructor, it ends-up accessing
the freed _egl_TLS pointer.

    eglReleaseThread -> in libEGL_mesa
        eglReleaseThread -> in libEGL(glvnd)
            destructor() -> App's destructor

To resolve the invalid access, setting the _egl_TLS
pointer as NULL after freeing it.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Cc: mesa-stable

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5466
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13302>
2021-10-15 06:22:13 +00:00
..
50_mesa.json meson: Make the glvnd vendor name configurable 2020-12-03 22:36:27 +00:00
egl.def egl: Update Windows .def to include missing exports 2021-09-16 17:38:58 +00:00
eglapi.c egl: implement EGL_EXT_present_opaque on wayland 2021-10-12 21:40:54 +00:00
eglarray.c
eglarray.h
eglconfig.c egl: drop unused _EGLDriver from _eglGetConfigs()/_eglChooseConfig()/_eglGetConfigAttrib() 2020-08-16 13:49:18 +00:00
eglconfig.h egl: drop unused _EGLDriver from _eglGetConfigs()/_eglChooseConfig()/_eglGetConfigAttrib() 2020-08-16 13:49:18 +00:00
eglcontext.c egl: support no error attribute set to false with ES 1.1 2021-04-09 08:02:21 +03:00
eglcontext.h egl: drop unused _EGLDriver & _EGLDisplay from _eglQueryContext() 2020-08-16 13:49:18 +00:00
eglcurrent.c egl: set TSD as NULL after deinit 2021-10-15 06:22:13 +00:00
eglcurrent.h egl: simplify _eglDebugReport* API 2017-09-19 19:07:16 +01:00
egldefines.h egl: remove unused include 2019-01-11 14:37:47 +00:00
egldevice.c egl: add support for EGL_EXT_device_drm_render_node 2021-07-22 17:12:35 +00:00
egldevice.h egl: add support for EGL_EXT_device_drm_render_node 2021-07-22 17:12:35 +00:00
egldispatchstubs.c Add copyright comments to the GLVND-related files. 2021-10-13 05:34:27 +00:00
egldispatchstubs.h Add copyright comments to the GLVND-related files. 2021-10-13 05:34:27 +00:00
egldisplay.c egl: Detect Windows platform using GDI 2021-09-15 20:17:31 +00:00
egldisplay.h egl: implement EGL_EXT_present_opaque on wayland 2021-10-12 21:40:54 +00:00
egldriver.h egl: document which driver hooks are only required by extensions 2020-08-27 23:06:55 +02:00
eglentrypoint.h Revert "egl: implement new functions from EGL_EXT_image_flush_external" 2019-11-14 07:46:04 +02:00
eglglobals.c meson, egl: Support building for the Windows platform 2021-09-15 20:17:31 +00:00
eglglobals.h egl: simplify client/platform extension handling 2020-04-21 22:20:24 +00:00
eglglvnd.c Add copyright comments to the GLVND-related files. 2021-10-13 05:34:27 +00:00
eglimage.c egl: fix EGL_EXT_protected_content/surface mixup 2020-12-17 10:05:42 +01:00
eglimage.h egl: handle EGL_PROTECTED_CONTENT_EXT for eglImage 2020-11-02 10:15:47 +01:00
egllog.c meson, egl: Support building for the Windows platform 2021-09-15 20:17:31 +00:00
egllog.h egl: remove no longer needed logger infra 2017-05-08 15:33:54 +01:00
eglsurface.c egl: implement EGL_EXT_present_opaque on wayland 2021-10-12 21:40:54 +00:00
eglsurface.h egl: implement EGL_EXT_present_opaque on wayland 2021-10-12 21:40:54 +00:00
eglsync.c egl: replace _EGLDriver with _EGLDisplay->Driver in _eglGetSyncAttrib() 2020-08-16 13:49:18 +00:00
eglsync.h egl: replace _EGLDriver with _EGLDisplay->Driver in _eglGetSyncAttrib() 2020-08-16 13:49:18 +00:00
egltypedefs.h egl: inline _EGLAPI into _EGLDriver 2020-07-21 00:59:43 +00:00