Skip to content

egl: Fix garbage gbm_surf reads in dri2_create_drawable

Kenneth Graunke requested to merge kwg/mesa:egl-fix into master

Commit 2282ec0a refactored drawable creation into a new dri2_create_drawable helper function. The platform_drm.c code passed in dri2_surf->gbm_surf as the loaderPrivate rather than the usual dri2_surf.

To try and handle this, the patch checked if dri2_surf->gbm_surf was non-NULL, and if so, presumed that we're using the DRM platform and actually wanted to use it. Unfortunately, most places simply malloc the dri2_egl_surface, rather than calloc. So platform_x11 for example left the dri2_surf->gbm_surf as a garbage pointer. This happens to be non-NULL, and so we pass a garbage pointer to createNewDrawable and SIGBUS or SIGSEGV when trying to dereference it.

Fixes crashes with i915_dri.so when running dEQP-GLES2.

Merge request reports