summaryrefslogtreecommitdiffstats
path: root/main/xulrunner
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2011-05-03 04:15:51 -0500
committerWilliam Pitcock <nenolod@dereferenced.org>2011-05-03 04:17:19 -0500
commit721152a5a1169992f27df9806f608fda87d773f0 (patch)
tree1d717d4907f04f746c7f8bb1344d30dd97ee2a7d /main/xulrunner
parenta36b43b74c011c0ed21e31ac074887521ac0129c (diff)
downloadaports-721152a5a1169992f27df9806f608fda87d773f0.tar.bz2
aports-721152a5a1169992f27df9806f608fda87d773f0.tar.xz
main/xulrunner: fix jemalloc under recent PaX kernel profiles (mozilla.org 470217)
Diffstat (limited to 'main/xulrunner')
-rw-r--r--main/xulrunner/APKBUILD4
-rw-r--r--main/xulrunner/xulrunner-jemalloc-aslr.patch54
2 files changed, 57 insertions, 1 deletions
diff --git a/main/xulrunner/APKBUILD b/main/xulrunner/APKBUILD
index 29f864a55..4c64b5a8e 100644
--- a/main/xulrunner/APKBUILD
+++ b/main/xulrunner/APKBUILD
@@ -3,7 +3,7 @@
pkgname=xulrunner
pkgver=2.0.1
_ffoxver=4.0.1
-pkgrel=0
+pkgrel=1
pkgdesc="runtime environment for xul-based applications"
url="http://developer.mozilla.org/en/XULRunner"
arch="all"
@@ -50,6 +50,7 @@ source="http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${_ffoxver}
fix-xulrunner-launcher.patch
mozilla-pkgconfig.patch
+ xulrunner-jemalloc-aslr.patch
xulrunner-mozalloc.patch
xulrunner-version.patch
@@ -106,6 +107,7 @@ md5sums="9abda7d23151e97913c8555a64c13f34 firefox-4.0.1.source.tar.bz2
de64a11f40bb6e8800ba799d1b2b8d85 mozconfig
86d33a17286131d9ef4cdfb35ee56f1f fix-xulrunner-launcher.patch
02c23dc4ebd88e445533314716331818 mozilla-pkgconfig.patch
+30053b8b5811cc0676bfe7d7d7ffaa4a xulrunner-jemalloc-aslr.patch
d38ecbb7bb31032d3e1ced8939e26abd xulrunner-mozalloc.patch
371303c5bdc4fa0d955d14521b93b69d xulrunner-version.patch
b187440207e773e9be606594d2c99216 mozjs-c99math.patch
diff --git a/main/xulrunner/xulrunner-jemalloc-aslr.patch b/main/xulrunner/xulrunner-jemalloc-aslr.patch
new file mode 100644
index 000000000..4a1579649
--- /dev/null
+++ b/main/xulrunner/xulrunner-jemalloc-aslr.patch
@@ -0,0 +1,54 @@
+diff -r 9259fdc3570c memory/jemalloc/jemalloc.c
+--- a/memory/jemalloc/jemalloc.c Wed Jan 27 16:20:05 2010 -0800
++++ b/memory/jemalloc/jemalloc.c Wed Jan 27 23:03:56 2010 -0600
+@@ -373,7 +373,7 @@
+ static const bool __isthreaded = true;
+ #endif
+
+-#if defined(MOZ_MEMORY_SOLARIS) && defined(MAP_ALIGN) && !defined(JEMALLOC_NEVER_USES_MAP_ALIGN)
++#if defined(MOZ_MEMORY_SOLARIS) || defined(MOZ_MEMORY_LINUX) || defined(MOZ_MEMORY_BSD)
+ #define JEMALLOC_USES_MAP_ALIGN /* Required on Solaris 10. Might improve performance elsewhere. */
+ #endif
+
+@@ -2178,20 +2178,31 @@
+ * We don't use MAP_FIXED here, because it can cause the *replacement*
+ * of existing mappings, and we only want to create new mappings.
+ */
+-#ifdef MALLOC_PAGEFILE
+- if (pfd != -1) {
+- ret = mmap((void *)alignment, size, PROT_READ | PROT_WRITE, MAP_PRIVATE |
+- MAP_NOSYNC | MAP_ALIGN, pfd, 0);
+- } else
+-#endif
+- {
+- ret = mmap((void *)alignment, size, PROT_READ | PROT_WRITE, MAP_PRIVATE |
+- MAP_NOSYNC | MAP_ALIGN | MAP_ANON, -1, 0);
+- }
++ ret = mmap(NULL, size + alignment, PROT_READ | PROT_WRITE, MAP_PRIVATE |
++ MAP_NOSYNC| MAP_ANON, -1, 0);
+ assert(ret != NULL);
+
+ if (ret == MAP_FAILED)
+ ret = NULL;
++ else {
++ uintptr_t aligned_ret;
++ size_t extra_size;
++
++ aligned_ret = (uintptr_t)ret + alignment - 1;
++ aligned_ret &= ~(alignment - 1);
++ extra_size = aligned_ret - (uintptr_t)ret;
++ munmap(ret, extra_size);
++ munmap(ret + extra_size + size, alignment - extra_size);
++ ret = (void *)aligned_ret;
++#ifdef MALLOC_PAGEFILE
++ if (pfd != -1) {
++ ret = mmap(ret, size, PROT_READ | PROT_WRITE, MAP_PRIVATE |
++ MAP_NOSYNC | MAP_FIXED, pfd, 0);
++ }
++ if (ret == MAP_FAILED)
++ ret = NULL;
++#endif
++ }
+ return (ret);
+ }
+ #endif