diff options
| author | Nick Kralevich <nnk@google.com> | 2010-04-26 08:55:41 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-04-26 08:55:41 -0700 |
| commit | 8e274f34768870eebc14a4044dbf0dc0e69f9f81 (patch) | |
| tree | db51cbc5acaedaef82675256a9f426e172893ce1 /libacc/acc.cpp | |
| parent | ecf835e291a974ad29fa9cbc3c401911c273b98f (diff) | |
| parent | 093ba2599137453d015e04896a2971f3e9c0a251 (diff) | |
| download | system_core-8e274f34768870eebc14a4044dbf0dc0e69f9f81.tar.gz system_core-8e274f34768870eebc14a4044dbf0dc0e69f9f81.tar.bz2 system_core-8e274f34768870eebc14a4044dbf0dc0e69f9f81.zip | |
Merge "make libacc run with execute stack protections enabled." into kraken
Diffstat (limited to 'libacc/acc.cpp')
| -rw-r--r-- | libacc/acc.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libacc/acc.cpp b/libacc/acc.cpp index 8f33b0bd..73d2cdd8 100644 --- a/libacc/acc.cpp +++ b/libacc/acc.cpp @@ -23,10 +23,7 @@ #include <cutils/hashmap.h> -#if defined(__i386__) #include <sys/mman.h> -#endif - #if defined(__arm__) #define DEFAULT_ARM_CODEGEN @@ -230,7 +227,7 @@ class Compiler : public ErrorSink { void release() { if (pProgramBase != 0) { - free(pProgramBase); + munmap(pProgramBase, mSize); pProgramBase = 0; } } @@ -263,7 +260,9 @@ class Compiler : public ErrorSink { virtual void init(int size) { release(); mSize = size; - pProgramBase = (char*) calloc(1, size); + pProgramBase = (char*) mmap(NULL, size, + PROT_EXEC | PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); ind = pProgramBase; } |
