> From: j...@wxcvbn.org (Jeremie Courreges-Anglas) > Date: Mon, 27 Jun 2016 23:40:35 +0200 > > Mark Kettenis <mark.kette...@xs4all.nl> writes: > > > As reported by several people, mesa contains code that violates W^X. > > As a result glxgears aborts when using the swrast driver. The diff > > below disables the offending code. The code seems to deal the absence > > of W|X memory just fine. There is a fallback path that is also used > > on SELinux systems. > > > > Note that the existing code would have worked just fine if mmap > > returned MAP_FAILED for W^X violations instead of terminating the > > program. Not entirely sure what the long-term plans are. > > [...] > > > The #ifdef excludes the definition of _mesa_exec_malloc and > _mesa_exec_free. > > xlock:/usr/X11R6/lib/modules/dri/i915_dri.so: undefined symbol > '_mesa_exec_malloc' > xlock:/usr/X11R6/lib/modules/dri/i915_dri.so: undefined symbol > '_mesa_exec_free' > libGL error: unable to load driver: i915_dri.so > libGL error: driver pointer missing > libGL error: failed to load driver: i915
New diff that should fix this. Index: src/gallium/auxiliary/rtasm/rtasm_execmem.c =================================================================== RCS file: /cvs/xenocara/lib/mesa/src/gallium/auxiliary/rtasm/rtasm_execmem.c,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 rtasm_execmem.c --- src/gallium/auxiliary/rtasm/rtasm_execmem.c 22 Nov 2015 02:43:24 -0000 1.1.1.1 +++ src/gallium/auxiliary/rtasm/rtasm_execmem.c 4 Jul 2016 21:38:46 -0000 @@ -69,6 +69,16 @@ static struct mem_block *exec_heap = NUL static unsigned char *exec_mem = NULL; +#ifdef __OpenBSD__ + +static int +init_heap(void) +{ + return 0; +} + +#else + static int init_heap(void) { @@ -82,6 +92,8 @@ init_heap(void) return (exec_mem != MAP_FAILED); } + +#endif void * Index: src/mapi/u_execmem.c =================================================================== RCS file: /cvs/xenocara/lib/mesa/src/mapi/u_execmem.c,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 u_execmem.c --- src/mapi/u_execmem.c 22 Nov 2015 02:45:44 -0000 1.1.1.1 +++ src/mapi/u_execmem.c 4 Jul 2016 21:38:48 -0000 @@ -45,8 +45,15 @@ static unsigned int head = 0; static unsigned char *exec_mem = (unsigned char *)0; +#if defined(__OpenBSD__) -#if defined(__linux__) || defined(__OpenBSD__) || defined(_NetBSD__) || defined(__sun) || defined(__HAIKU__) +static int +init_map(void) +{ + return 0; +} + +#elif defined(__linux__) || defined(_NetBSD__) || defined(__sun) || defined(__HAIKU__) #include <unistd.h> #include <sys/mman.h> Index: src/mesa/main/execmem.c =================================================================== RCS file: /cvs/xenocara/lib/mesa/src/mesa/main/execmem.c,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 execmem.c --- src/mesa/main/execmem.c 22 Nov 2015 02:39:37 -0000 1.1.1.1 +++ src/mesa/main/execmem.c 4 Jul 2016 21:38:48 -0000 @@ -36,7 +36,20 @@ -#if defined(__linux__) || defined(__OpenBSD__) || defined(_NetBSD__) || defined(__sun) || defined(__HAIKU__) +#if defined(__OpenBSD__) + +void * +_mesa_exec_malloc(GLuint size) +{ + return NULL; +} + +void +_mesa_exec_free(void *addr) +{ +} + +#elif defined(__linux__) || defined(_NetBSD__) || defined(__sun) || defined(__HAIKU__) /* * Allocate a large block of memory which can hold code then dole it out