aboutsummaryrefslogtreecommitdiffstats
path: root/testing/xulrunner/ff9-aslr-fix.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-01-12 10:51:17 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-01-12 10:51:17 +0000
commitc486c7dbd24b851b6318f5faade75d906a6c601e (patch)
tree345f0ca94931f0576dc16a990db8d2be51e04b0b /testing/xulrunner/ff9-aslr-fix.patch
parent21fd8d2969f81d0062b118dfb0d43eb9e4c9b732 (diff)
downloadaports-c486c7dbd24b851b6318f5faade75d906a6c601e.tar.bz2
aports-c486c7dbd24b851b6318f5faade75d906a6c601e.tar.xz
testing/xulrunner: test the ff9 randmap fix
Diffstat (limited to 'testing/xulrunner/ff9-aslr-fix.patch')
-rw-r--r--testing/xulrunner/ff9-aslr-fix.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/testing/xulrunner/ff9-aslr-fix.patch b/testing/xulrunner/ff9-aslr-fix.patch
new file mode 100644
index 0000000000..4e4297d0ed
--- /dev/null
+++ b/testing/xulrunner/ff9-aslr-fix.patch
@@ -0,0 +1,40 @@
+--- ./js/src/jsgcchunk.cpp 2011-12-22 17:13:21.000000000 +0000
++++ ./js/src/jsgcchunk.cpp 2011-12-22 17:18:31.000000000 +0000
+@@ -213,7 +213,7 @@
+ #elif defined(XP_UNIX)
+
+ /* Required on Solaris 10. Might improve performance elsewhere. */
+-# if defined(SOLARIS) && defined(MAP_ALIGN)
++# if (defined(SOLARIS) && defined(MAP_ALIGN)) || defined(MOZ_MEMORY_LINUX)
+ # define JS_GC_HAS_MAP_ALIGN
+
+ static void *
+--- ./js/src/jsgcchunk.cpp 2011-12-22 17:55:24.000000000 +0000
++++ ./js/src/jsgcchunk.cpp 2011-12-22 18:02:24.000000000 +0000
+@@ -226,12 +226,24 @@
+ #ifdef SOLARIS
+ void *p = mmap((caddr_t) alignment, size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_NOSYNC | MAP_ALIGN | MAP_ANON, -1, 0);
++ if (p == MAP_FAILED)
++ return NULL;
+ #else
+- void *p = mmap((void *) alignment, size, PROT_READ | PROT_WRITE,
+- MAP_PRIVATE | MAP_NOSYNC | MAP_ALIGN | MAP_ANON, -1, 0);
+-#endif
++ void *p = mmap(NULL, size + alignment, PROT_READ | PROT_WRITE,
++ MAP_PRIVATE | MAP_NOSYNC | MAP_ANON, -1, 0);
+ if (p == MAP_FAILED)
+ return NULL;
++ uintptr_t aligned_ret;
++ size_t extra_size;
++
++ aligned_ret = (uintptr_t)p + alignment - 1;
++ aligned_ret &= ~(alignment - 1);
++ extra_size = aligned_ret - (uintptr_t)p;
++ munmap(p, extra_size);
++ munmap(p + extra_size + size, alignment - extra_size);
++ p = (void *)aligned_ret;
++#endif
++
+ return p;
+ }