search for: map_stack

Displaying 1 result from an estimated 1 matches for "map_stack".

Did you mean: vmap_stack
2014 Nov 03
8
[LLVMdev] [PATCH] Protection against stack-based memory corruption errors using SafeStack
...ic inline void *unsafe_stack_alloc(size_t size, size_t guard) { + void *addr = +#if defined(__linux__) + (void*) syscall(SYS_mmap, +#else + mmap( +#endif + NULL, size + guard, PROT_WRITE | PROT_READ, + MAP_PRIVATE | MAP_ANON +#if defined(__linux__) + | MAP_STACK | MAP_GROWSDOWN +#endif + , -1, 0); + mprotect(addr, guard, PROT_NONE); + return (char*) addr + guard; +} + +static inline void unsafe_stack_setup(void *start, size_t size, size_t guard) { + void* stack_ptr = (char*) start + size; + assert((((size_t)stack_ptr) & (STACK_ALIGN-1)...