mesa/mesa-7.0-selinux-awareness.patch
Dave Airlie b7db2fa2de - update to Mesa 7.0.2 final
- mesa-7.0.2-rx00-vertprog-num-temps-off-by-one.patch - fixes for
    maniadrive
- mesa-7.0.2-t_vp_build-use-less-temps.patch - fixes for maniadrive
2008-01-01 05:46:09 +00:00

72 lines
2.0 KiB
Diff

diff -up Mesa-7.0/src/mesa/main/execmem.c.jx Mesa-7.0/src/mesa/main/execmem.c
--- Mesa-7.0/src/mesa/main/execmem.c.jx 2007-06-21 18:10:54.000000000 -0400
+++ Mesa-7.0/src/mesa/main/execmem.c 2007-07-23 16:02:30.000000000 -0400
@@ -46,6 +46,7 @@
#include <unistd.h>
#include <sys/mman.h>
#include "mm.h"
+#include <selinux/selinux.h>
#define EXEC_HEAP_SIZE (10*1024*1024)
@@ -55,9 +56,16 @@ static struct mem_block *exec_heap = NUL
static unsigned char *exec_mem = NULL;
-static void
+static int
init_heap(void)
{
+
+ if (is_selinux_enabled()) {
+ if (!security_get_boolean_active("allow_execmem") ||
+ !security_get_boolean_pending("allow_execmem"))
+ return 0;
+ }
+
if (!exec_heap)
exec_heap = mmInit( 0, EXEC_HEAP_SIZE );
@@ -65,6 +73,8 @@ init_heap(void)
exec_mem = (unsigned char *) mmap(0, EXEC_HEAP_SIZE,
PROT_EXEC | PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+
+ return (exec_mem != NULL);
}
@@ -76,7 +86,8 @@ _mesa_exec_malloc(GLuint size)
_glthread_LOCK_MUTEX(exec_mutex);
- init_heap();
+ if (!init_heap())
+ goto bail;
if (exec_heap) {
size = (size + 31) & ~31;
@@ -87,7 +98,8 @@ _mesa_exec_malloc(GLuint size)
addr = exec_mem + block->ofs;
else
_mesa_printf("_mesa_exec_malloc failed\n");
-
+
+bail:
_glthread_UNLOCK_MUTEX(exec_mutex);
return addr;
diff -up Mesa-7.0/configs/linux-dri.jx Mesa-7.0/configs/linux-dri
--- Mesa-7.0/configs/linux-dri.jx 2007-07-23 15:59:07.000000000 -0400
+++ Mesa-7.0/configs/linux-dri 2007-07-23 17:37:36.000000000 -0400
@@ -39,7 +39,8 @@ EXTRA_LIB_PATH =
LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
LIBDRM_LIB = `pkg-config --libs libdrm`
-DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
+DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB) \
+ -lselinux
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
-lm -lpthread -ldl \
$(LIBDRM_LIB)