Bug#897178: mozjs52: more fixes for ia64
On 05/01/2018 11:33 PM, Jeremy Bicha wrote: On Tue, May 1, 2018 at 5:07 PM, John Paul Adrian Glaubitzwrote: Meh, can't just someone go ahead and apply all this, please? Could you go ahead and prepare a merge proposal like you suggested on https://bugs.debian.org/887494 ? The ia64 changes need to be reworked first. It turns out that ia64 behaves differently for mmap() calls which is absolutely not what I would have expected. It seems that Jason's patch works better. Adrian -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer - glaub...@debian.org `. `' Freie Universitaet Berlin - glaub...@physik.fu-berlin.de `-GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Bug#897178: mozjs52: more fixes for ia64
On Tue, May 1, 2018 at 5:07 PM, John Paul Adrian Glaubitzwrote: > Meh, can't just someone go ahead and apply all this, please? Could you go ahead and prepare a merge proposal like you suggested on https://bugs.debian.org/887494 ? Thanks, Jeremy Bicha
Bug#897178: mozjs52: more fixes for ia64
On 05/01/2018 11:05 PM, James Clarke wrote: >> I have updated the sparc64 support patch to include "defined(__ia64__)" where >> it's still missing which seems to fix the problem for me. Attaching the >> updated sparc64 patch. > > You're still dropping the __aarch64__ from the first patch :) Meh, can't just someone go ahead and apply all this, please? -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer - glaub...@debian.org `. `' Freie Universitaet Berlin - glaub...@physik.fu-berlin.de `-GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Bug#897178: mozjs52: more fixes for ia64
> On 1 May 2018, at 20:31, John Paul Adrian Glaubitz >wrote: > > On 04/29/2018 03:16 PM, Jason Duerstock wrote: >> Attached please find patches to let mozjs52 build on ia64, and (mostly) pass >> the test suite. >> ia64 currently requires -G0 for linking, but crashes if the current >> *MAINT_APPEND strings are >> used. Also, the memory allocation fails because the address space >> randomizer does not >> take into account ia64 memory allocation. > > I don't think this is the right approach. > > Rather, you need to make sure the allocator gets limited in its use of higher > address space ranges like we are doing on sparc64 and arm64. > > I have updated the sparc64 support patch to include "defined(__ia64__)" where > it's still missing which seems to fix the problem for me. Attaching the > updated sparc64 patch. You're still dropping the __aarch64__ from the first patch :) James
Bug#897178: mozjs52: more fixes for ia64
On 04/29/2018 03:16 PM, Jason Duerstock wrote: Attached please find patches to let mozjs52 build on ia64, and (mostly) pass the test suite. ia64 currently requires -G0 for linking, but crashes if the current *MAINT_APPEND strings are used. Also, the memory allocation fails because the address space randomizer does not take into account ia64 memory allocation. I don't think this is the right approach. Rather, you need to make sure the allocator gets limited in its use of higher address space ranges like we are doing on sparc64 and arm64. I have updated the sparc64 support patch to include "defined(__ia64__)" where it's still missing which seems to fix the problem for me. Attaching the updated sparc64 patch. Adrian -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer - glaub...@debian.org `. `' Freie Universitaet Berlin - glaub...@physik.fu-berlin.de `-GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913 Description: Add support for sparc64 Author: John Paul Adrian GlaubitzForwarded: https://bugzilla.mozilla.org/show_bug.cgi?id=1275204 Last-Update: 2017-06-18 Index: firefox-esr-52.2.0esr/js/src/gc/Memory.cpp === --- firefox-esr-52.2.0esr.orig/js/src/gc/Memory.cpp +++ firefox-esr-52.2.0esr/js/src/gc/Memory.cpp @@ -501,7 +501,7 @@ static inline void* MapMemoryAt(void* desired, size_t length, int prot = PROT_READ | PROT_WRITE, int flags = MAP_PRIVATE | MAP_ANON, int fd = -1, off_t offset = 0) { -#if defined(__ia64__) || (defined(__sparc64__) && defined(__NetBSD__)) || defined(__aarch64__) +#if defined(__ia64__) || (defined(__sparc__) && defined(__arch64__) && (defined(__NetBSD__) || defined(__linux__))) MOZ_ASSERT((0x8000ULL & (uintptr_t(desired) + length - 1)) == 0); #endif void* region = mmap(desired, length, prot, flags, fd, offset); @@ -524,7 +524,7 @@ static inline void* MapMemory(size_t length, int prot = PROT_READ | PROT_WRITE, int flags = MAP_PRIVATE | MAP_ANON, int fd = -1, off_t offset = 0) { -#if defined(__ia64__) || (defined(__sparc64__) && defined(__NetBSD__)) +#if defined(__ia64__) || (defined(__sparc__) && defined(__arch64__) && defined(__NetBSD__)) /* * The JS engine assumes that all allocated pointers have their high 17 bits clear, * which ia64's mmap doesn't support directly. However, we can emulate it by passing @@ -551,7 +551,7 @@ MapMemory(size_t length, int prot = PROT return nullptr; } return region; -#elif defined(__aarch64__) +#elif defined(__aarch64__) || (defined(__sparc__) && defined(__arch64__) && defined(__linux__)) || defined(__ia64__) /* * There might be similar virtual address issue on arm64 which depends on * hardware and kernel configurations. But the work around is slightly Index: firefox-esr-52.2.0esr/js/src/jsapi-tests/testGCAllocator.cpp === --- firefox-esr-52.2.0esr.orig/js/src/jsapi-tests/testGCAllocator.cpp +++ firefox-esr-52.2.0esr/js/src/jsapi-tests/testGCAllocator.cpp @@ -312,7 +312,7 @@ void unmapPages(void* p, size_t size) { void* mapMemoryAt(void* desired, size_t length) { -#if defined(__ia64__) || (defined(__sparc64__) && defined(__NetBSD__)) || defined(__aarch64__) +#if defined(__ia64__) || (defined(__sparc__) && defined(__arch64__) && (defined(__NetBSD__) || defined(__linux__))) MOZ_RELEASE_ASSERT(0x8000ULL & (uintptr_t(desired) + length - 1) == 0); #endif void* region = mmap(desired, length, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); @@ -334,7 +334,7 @@ mapMemory(size_t length) int fd = -1; off_t offset = 0; // The test code must be aligned with the implementation in gc/Memory.cpp. -#if defined(__ia64__) || (defined(__sparc64__) && defined(__NetBSD__)) +#if defined(__ia64__) || (defined(__sparc__) && defined(__arch64__) && defined(__NetBSD__)) void* region = mmap((void*)0x0700, length, prot, flags, fd, offset); if (region == MAP_FAILED) return nullptr; @@ -344,7 +344,7 @@ mapMemory(size_t length) return nullptr; } return region; -#elif defined(__aarch64__) +#elif defined(__aarch64__) || (defined(__sparc__) && defined(__arch64__) && defined(__linux__)) || defined(__ia64__) const uintptr_t start = UINT64_C(0x0700); const uintptr_t end = UINT64_C(0x8000); const uintptr_t step = js::gc::ChunkSize; Index: firefox-esr-52.2.0esr/memory/jemalloc/src/include/jemalloc/internal/mb.h === --- firefox-esr-52.2.0esr.orig/memory/jemalloc/src/include/jemalloc/internal/mb.h +++ firefox-esr-52.2.0esr/memory/jemalloc/src/include/jemalloc/internal/mb.h @@ -76,7 +76,7 @@ mb_write(void) : "memory" /* Clobbers. */ ); } -#elif defined(__sparc64__) +#elif defined(__sparc__) &&
Bug#897178: mozjs52: more fixes for ia64
Source: mozjs52 Severity: normal Tags: patch User: debian-i...@lists.debian.org Usertags: ia64 Dear Maintainer, Attached please find patches to let mozjs52 build on ia64, and (mostly) pass the test suite. ia64 currently requires -G0 for linking, but crashes if the current *MAINT_APPEND strings are used. Also, the memory allocation fails because the address space randomizer does not take into account ia64 memory allocation. -- System Information: Debian Release: buster/sid APT prefers unreleased APT policy: (500, 'unreleased'), (500, 'unstable') Architecture: ia64 Kernel: Linux 3.14-0.bpo.2-mckinley (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) --- debian/test.sh.orig 2018-04-29 08:55:47.958055376 -0400 +++ debian/test.sh 2018-04-29 08:59:29.181143034 -0400 @@ -28,6 +28,9 @@ (s390x|ppc64) echo "Ignoring test failure, https://bugs.debian.org/878286; ;; + (ia64) + echo "Ignoring test failure, https://bugs.debian.org/897117; + ;; (*) echo "Test failure is considered serious, causing FTBFS" exit 1 --- debian/rules.orig 2018-04-29 09:00:41.632848488 -0400 +++ debian/rules2018-04-29 09:02:53.504307305 -0400 @@ -17,8 +17,15 @@ SRCDIR = $(CURDIR)/js/src CONFIGURE_FLAGS = -DEB_CFLAGS_MAINT_APPEND += -fno-schedule-insns2 -fno-lifetime-dse -fno-delete-null-pointer-checks -DEB_CXXFLAGS_MAINT_APPEND += -fno-schedule-insns2 -fno-lifetime-dse -fno-delete-null-pointer-checks +# ia64 currently has toolchain issues, so relax the link optimization +# -fno-schedule-insns2 breaks gcc on ia64, so leave it enabled +ifneq (,$(findstring $(DEB_BUILD_ARCH),ia64)) + DEB_CFLAGS_MAINT_APPEND += -G0 + DEB_CXXFLAGS_MAINT_APPEND += -G0 +else + DEB_CFLAGS_MAINT_APPEND += -fno-schedule-insns2 -fno-lifetime-dse -fno-delete-null-pointer-checks + DEB_CXXFLAGS_MAINT_APPEND += -fno-schedule-insns2 -fno-lifetime-dse -fno-delete-null-pointer-checks +endif ifneq (,$(findstring $(DEB_BUILD_ARCH),armel armhf)) DEB_CFLAGS_MAINT_APPEND += -fno-schedule-insns DEB_CXXFLAGS_MAINT_APPEND += -fno-schedule-insns --- mozjs52-52.3.1/js/src/jit/ProcessExecutableMemory.cpp 2017-08-08 06:25:50.0 -0400 +++ mozjs52.fixed/js/src/jit/ProcessExecutableMemory.cpp2018-04-27 09:30:47.390494330 -0400 @@ -290,8 +290,13 @@ void* randomAddr = ComputeRandomAllocationAddress(); void* p = MozTaggedAnonymousMmap(randomAddr, bytes, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0, "js-executable-memory"); -if (p == MAP_FAILED) -return nullptr; +if (p == MAP_FAILED) { +// the comment above appears to be incorrect, so retry without the hint +p = MozTaggedAnonymousMmap(NULL, bytes, PROT_NONE, MAP_PRIVATE | MAP_ANON, + -1, 0, "js-executable-memory"); +if (p == MAP_FAILED) +return nullptr; +} return p; }