Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 392950 Details for
Bug 525494
dev-python/cffi: PaX denied RWX mmap of <anonymous mapping> in allocator for the ffi trampoline
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Add check for Emutramp
cffi_proc_exec.patch (text/plain), 1.93 KB, created by
Magnus Granberg
on 2015-01-02 12:37:15 UTC
(
hide
)
Description:
Add check for Emutramp
Filename:
MIME Type:
Creator:
Magnus Granberg
Created:
2015-01-02 12:37:15 UTC
Size:
1.93 KB
patch
obsolete
>--- a/c/malloc_closure.h 2014-04-30 11:16:17.000000000 +0200 >+++ b/c/malloc_closure.h 2014-12-31 22:27:45.269814143 +0100 >@@ -14,6 +14,43 @@ > # endif > #endif > >+/* On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. */ >+#ifndef MS_WIN32 >+#include <stdlib.h> >+ >+static int emutramp_enabled = -1; >+ >+static int >+emutramp_enabled_check (void) >+{ >+ char *buf = NULL; >+ size_t len = 0; >+ FILE *f; >+ int ret; >+ f = fopen ("/proc/self/status", "r"); >+ if (f == NULL) >+ return 0; >+ ret = 0; >+ >+ while (getline (&buf, &len, f) != -1) >+ if (!strncmp (buf, "PaX:", 4)) >+ { >+ char emutramp; >+ if (sscanf (buf, "%*s %*c%c", &emutramp) == 1) >+ ret = (emutramp == 'E'); >+ break; >+ } >+ free (buf); >+ fclose (f); >+ return ret; >+} >+ >+#define is_emutramp_enabled() (emutramp_enabled >= 0 ? emutramp_enabled \ >+ : (emutramp_enabled = emutramp_enabled_check ())) >+#else >+#define is_emutramp_enabled() 0 >+#endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */ >+ > /* 'allocate_num_pages' is dynamically adjusted starting from one > page. It grows by a factor of PAGE_ALLOCATION_GROWTH_RATE. This is > meant to handle both the common case of not needing a lot of pages, >@@ -77,7 +114,15 @@ static void more_core(void) > if (item == NULL) > return; > #else >- item = (union mmaped_block *)mmap(NULL, >+ if (is_emutramp_enabled ()) >+ item = (union mmaped_block *)mmap(NULL, >+ allocate_num_pages * _pagesize, >+ PROT_READ | PROT_WRITE | ~PROT_EXEC, >+ MAP_PRIVATE | MAP_ANONYMOUS, >+ -1, >+ 0); >+ else >+ item = (union mmaped_block *)mmap(NULL, > allocate_num_pages * _pagesize, > PROT_READ | PROT_WRITE | PROT_EXEC, > MAP_PRIVATE | MAP_ANONYMOUS,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 525494
:
386734
|
392796
|
392950
|
393062