diff options
author | Nick Kledzik <kledzik@apple.com> | 2010-03-31 19:52:01 +0000 |
---|---|---|
committer | Nick Kledzik <kledzik@apple.com> | 2010-03-31 19:52:01 +0000 |
commit | e7d0a5c76ca8dfd6277099b89f8bf65cfdab8842 (patch) | |
tree | e978996d5944fc7a23f0f1fe8aa47962d8b76200 | |
parent | d3d22631ca0b314f0564a9bcfe96dd2d6ca85fa6 (diff) |
<rdar://problem/7813254> check enable_execute_stack implementation
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@100036 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/enable_execute_stack.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/enable_execute_stack.c b/lib/enable_execute_stack.c index b349d2f31..193e7dbc2 100644 --- a/lib/enable_execute_stack.c +++ b/lib/enable_execute_stack.c @@ -21,6 +21,11 @@ #include <unistd.h> #endif /* __APPLE__ */ +#if __LP64__ + #define TRAMPOLINE_SIZE 48 +#else + #define TRAMPOLINE_SIZE 40 +#endif /* * The compiler generates calls to __enable_execute_stack() when creating @@ -45,7 +50,7 @@ void __enable_execute_stack(void* addr) const uintptr_t pageAlignMask = ~(pageSize-1); uintptr_t p = (uintptr_t)addr; unsigned char* startPage = (unsigned char*)(p & pageAlignMask); - unsigned char* endPage = (unsigned char*)((p+48+pageSize) & pageAlignMask); + unsigned char* endPage = (unsigned char*)((p+TRAMPOLINE_SIZE+pageSize) & pageAlignMask); size_t length = endPage - startPage; (void) mprotect((void *)startPage, length, PROT_READ | PROT_WRITE | PROT_EXEC); } |