diff --git a/src/codegen/codegen_x86.c b/src/codegen/codegen_x86.c index f0b5169d4..b4ba9bc9f 100644 --- a/src/codegen/codegen_x86.c +++ b/src/codegen/codegen_x86.c @@ -1173,17 +1173,10 @@ static uint32_t gen_MEM_CHECK_WRITE_L() void codegen_init() { -#ifdef __unix__ - void *start; - size_t len; - long pagesize = sysconf(_SC_PAGESIZE); - long pagemask = ~(pagesize - 1); -#endif - #ifdef _WIN32 codeblock = VirtualAlloc(NULL, (BLOCK_SIZE+1) * sizeof(codeblock_t), MEM_COMMIT, PAGE_EXECUTE_READWRITE); #elif defined __unix__ - codeblock = mmap(NULL, (BLOCK_SIZE+1) * sizeof(codeblock_t), PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, 0, 0); + codeblock = mmap(NULL, (BLOCK_SIZE+1) * sizeof(codeblock_t), PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE, 0, 0); #else codeblock = malloc((BLOCK_SIZE+1) * sizeof(codeblock_t)); #endif @@ -1192,16 +1185,6 @@ void codegen_init() memset(codeblock, 0, (BLOCK_SIZE+1) * sizeof(codeblock_t)); memset(codeblock_hash, 0, HASH_SIZE * sizeof(codeblock_t *)); -#ifdef __unix__ - start = (void *)((long)codeblock & pagemask); - len = (((BLOCK_SIZE+1) * sizeof(codeblock_t)) + pagesize) & pagemask; - if (mprotect(start, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0) - { - perror("mprotect"); - exit(-1); - } -#endif - block_current = BLOCK_SIZE; block_pos = 0; mem_abrt_rout = (uint32_t)&codeblock[block_current].data[block_pos];