egl: Fix _eglPointerIsDereferencable w/o mincore()
authorAlexander van der Grinten <alexander.vandergrinten@gmail.com>
Sun, 15 Dec 2019 10:25:37 +0000 (11:25 +0100)
committerEric Engestrom <eric@engestrom.ch>
Wed, 22 Jan 2020 12:55:05 +0000 (12:55 +0000)
commit047162d99ced85115b8e9010f196b8d1ee405be2
treef12177e62a563df506d936985cf6f63954787751
parent39e7492d33c89ee7049d5bc07267d131cc6a1ff9
egl: Fix _eglPointerIsDereferencable w/o mincore()

On platforms without mincore(), _eglPointerIsDereferencable()
currently just checks whether p != NULL. This is not sufficient:
In the Wayland platform code (i.e., in get_wl_surface_proxy()),
_eglPointerIsDereferencable() is called on the version field
of `struct wl_egl_window` which is 3 on current versions of
Wayland. This causes a segfault when trying to dereference p.

Fix this behavior by assuming that the first page of the
process is never dereferencable.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3103>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3103>
src/egl/main/eglglobals.c