Package: release.debian.org Severity: normal Tags: jessie User: release.debian....@packages.debian.org Usertags: pu
changelog | 8 + patches/manually-mmap-on-arm64-to-ensure-high-17-bits-are-clear.patch | 65 ++++++++++ patches/series | 1 3 files changed, 74 insertions(+) diff -Nru mozjs24-24.2.0/debian/changelog mozjs24-24.2.0/debian/changelog --- mozjs24-24.2.0/debian/changelog 2014-05-03 00:26:07.000000000 +0300 +++ mozjs24-24.2.0/debian/changelog 2017-05-17 23:33:12.000000000 +0300 @@ -1,3 +1,11 @@ +mozjs24 (24.2.0-2+deb8u1) jessie; urgency=medium + + * Non-maintainer upload. + * Manually mmap on arm64 to ensure high 17 bits are clear, + thanks to Zheng Xu for the patch. (Closes: #839050) + + -- Adrian Bunk <b...@debian.org> Wed, 17 May 2017 23:23:33 +0300 + mozjs24 (24.2.0-2) unstable; urgency=low * Make shlibs fix unconditional of Operating System (closes: #746705). diff -Nru mozjs24-24.2.0/debian/patches/manually-mmap-on-arm64-to-ensure-high-17-bits-are-clear.patch mozjs24-24.2.0/debian/patches/manually-mmap-on-arm64-to-ensure-high-17-bits-are-clear.patch --- mozjs24-24.2.0/debian/patches/manually-mmap-on-arm64-to-ensure-high-17-bits-are-clear.patch 1970-01-01 02:00:00.000000000 +0200 +++ mozjs24-24.2.0/debian/patches/manually-mmap-on-arm64-to-ensure-high-17-bits-are-clear.patch 2017-05-17 23:23:17.000000000 +0300 @@ -0,0 +1,65 @@ +From: Zheng Xu <zheng...@linaro.org> +Date: Fri, 2 Sep 2016 15:03:30 +0800 +Subject: [PATCH] Bug 1143022 - Manually mmap on arm64 to ensure high 17 bits + are clear. r=ehoogeveen +Origin: https://hg.mozilla.org/integration/mozilla-inbound/rev/dfaafbaaa291 +Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1143022 +Bug-Debian: https://bugs.debian.org/839050 + +There might be 48-bit VA on arm64 depending on kernel configuration. +Manually mmap heap memory to align with the assumption made by JS engine. + +Change-Id: Ic5d2b2fe4b758b3c87cc0688348af7e71a991146 +--- + js/src/gc/Memory.cpp | 35 +++++++++++++++++++++++++++++++++++ + 1 file changed, 35 insertions(+) + +diff --git a/js/src/gc/Memory.cpp b/js/src/gc/Memory.cpp +index 153ccb4..42aee6c 100644 +--- a/js/src/gc/Memory.cpp ++++ b/js/src/gc/Memory.cpp +@@ -339,6 +339,41 @@ MapMemory(size_t length, int prot, int flags, int fd, off_t offset) + return MAP_FAILED; + } + return region; ++#elif defined(__aarch64__) ++ /* ++ * There might be similar virtual address issue on arm64 which depends on ++ * hardware and kernel configurations. But the work around is slightly ++ * different due to the different mmap behavior. ++ * ++ * TODO: Merge with the above code block if this implementation works for ++ * ia64 and sparc64. ++ */ ++ const uintptr_t start = (uintptr_t)0x0000070000000000; ++ const uintptr_t end = (uintptr_t)0x0000800000000000; ++ const uintptr_t step = ChunkSize; ++ /* ++ * Optimization options if there are too many retries in practice: ++ * 1. Examine /proc/self/maps to find an available address. This file is ++ * not always available, however. In addition, even if we examine ++ * /proc/self/maps, we may still need to retry several times due to ++ * racing with other threads. ++ * 2. Use a global/static variable with lock to track the addresses we have ++ * allocated or tried. ++ */ ++ uintptr_t hint; ++ void* region = MAP_FAILED; ++ for (hint = start; region == MAP_FAILED && hint + length <= end; hint += step) { ++ region = mmap((void*)hint, length, prot, flags, fd, offset); ++ if (region != MAP_FAILED) { ++ if ((uintptr_t(region) + (length - 1)) & 0xffff800000000000) { ++ if (munmap(region, length)) { ++ MOZ_ASSERT(errno == ENOMEM); ++ } ++ region = MAP_FAILED; ++ } ++ } ++ } ++ return region == MAP_FAILED ? nullptr : region; + #else + return mmap(NULL, length, prot, flags, fd, offset); + #endif +-- +1.9.1 + diff -Nru mozjs24-24.2.0/debian/patches/series mozjs24-24.2.0/debian/patches/series --- mozjs24-24.2.0/debian/patches/series 2014-05-02 23:26:45.000000000 +0300 +++ mozjs24-24.2.0/debian/patches/series 2017-05-17 23:23:29.000000000 +0300 @@ -1,2 +1,3 @@ fix-soname.patch aarch64-support.patch +manually-mmap-on-arm64-to-ensure-high-17-bits-are-clear.patch