mirror of
https://github.com/openbsd/xenocara.git
synced 2025-12-12 20:29:12 +00:00
Disable the code that allocates W|X memory. There is fallback code that
gets used if allocating W|X memory fails, which is probably a bit slower. However, that is much better than commit a W^X violation which currently gets you killed. ok jca@
This commit is contained in:
@@ -69,6 +69,16 @@ static struct mem_block *exec_heap = NULL;
|
|||||||
static unsigned char *exec_mem = NULL;
|
static unsigned char *exec_mem = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
|
||||||
|
static int
|
||||||
|
init_heap(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
static int
|
static int
|
||||||
init_heap(void)
|
init_heap(void)
|
||||||
{
|
{
|
||||||
@@ -83,6 +93,8 @@ init_heap(void)
|
|||||||
return (exec_mem != MAP_FAILED);
|
return (exec_mem != MAP_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void *
|
void *
|
||||||
rtasm_exec_malloc(size_t size)
|
rtasm_exec_malloc(size_t size)
|
||||||
|
|||||||
@@ -45,8 +45,15 @@ static unsigned int head = 0;
|
|||||||
|
|
||||||
static unsigned char *exec_mem = (unsigned char *)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 <unistd.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|||||||
@@ -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
|
* Allocate a large block of memory which can hold code then dole it out
|
||||||
|
|||||||
Reference in New Issue
Block a user