From 745c17fa5a7a75865d7bb74189bd7154c4fd1df2 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 01 2017 03:29:48 +0000 Subject: import mozjs24-24.2.0-7.el7 --- diff --git a/SOURCES/mozjs24-48-bit-VA-fix.patch b/SOURCES/mozjs24-48-bit-VA-fix.patch new file mode 100644 index 0000000..3da8ddd --- /dev/null +++ b/SOURCES/mozjs24-48-bit-VA-fix.patch @@ -0,0 +1,57 @@ +From c3ef56fa3239d9133be922059300a6fd2e7c1435 Mon Sep 17 00:00:00 2001 +From: Zheng Xu +Date: Wed, 17 Aug 2016 11:59:15 +0800 +Subject: [PATCH] Bug 1143022 - Manually mmap on arm64 to ensure high 17 bits are clear. r=ehoogeveen + +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 +--- + +diff --git a/js/src/gc/Memory.cpp b/js/src/gc/Memory.cpp +index 153ccb4..b2d1311 100644 +--- a/js/src/gc/Memory.cpp ++++ b/js/src/gc/Memory.cpp +@@ -339,6 +339,41 @@ + 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)(0x0000070000000000UL); ++ const uintptr_t end = (uintptr_t)(0x0000800000000000UL); ++ 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 diff --git a/SPECS/mozjs24.spec b/SPECS/mozjs24.spec index e64cc19..c87f7d6 100644 --- a/SPECS/mozjs24.spec +++ b/SPECS/mozjs24.spec @@ -1,7 +1,7 @@ Summary: JavaScript interpreter and libraries Name: mozjs24 Version: 24.2.0 -Release: 6%{?dist} +Release: 7%{?dist} License: MPLv2.0 Group: Development/Languages URL: http://www.mozilla.org/js/ @@ -13,6 +13,7 @@ BuildRequires: /usr/bin/python Patch0: js17-build-fixes.patch Patch1: mozjs24-0001-Add-AArch64-support.patch +Patch2: mozjs24-48-bit-VA-fix.patch %description JavaScript is the Netscape-developed object scripting language used in millions @@ -37,6 +38,7 @@ rm js/src/editline -rf rm js/src/ctypes/libffi -rf %patch0 -p1 %patch1 -p1 +%patch2 -p1 chmod a+x configure %build @@ -97,6 +99,9 @@ rm -f %{buildroot}%{_bindir}/js24-config %{_includedir}/mozjs-24 %changelog +* Tue Mar 28 2017 Yaakov Selkowitz - 24.2.0-7 +- Fix crash with 48-bit VA on aarch64 (#1340183) + * Wed May 27 2015 Martin Stransky 24.2.0-6 - Added generic 64/32 bit check