chromium tries to implement random mmap on its own. Allowing mmap
to pick its own random location will likely fix aarch64 and i386
issues.

This diff has not completed a build on aarch64 yet, but it has
passed the part of the build where it fails with ENOMEM.
I'm passing this along early to get wider testing help.

Index: Makefile
===================================================================
RCS file: /cvs/ports/www/chromium/Makefile,v
retrieving revision 1.550
diff -u -p -u -r1.550 Makefile
--- Makefile    26 Feb 2021 18:20:36 -0000      1.550
+++ Makefile    9 Mar 2021 02:58:22 -0000
@@ -1,8 +1,5 @@
 # $OpenBSD: Makefile,v 1.550 2021/02/26 18:20:36 naddy Exp $
 
-# /usr/local/bin/chrome[60]: /usr/local/chrome/chrome: Cannot allocate memory
-BROKEN-i386=   runtime fails, cannot execve the built binary, immediate ENOMEM 
even with high limits
-
 .include <bsd.port.arch.mk>
 
 USE_WXNEEDED=          Yes
@@ -16,6 +13,7 @@ DPB_PROPERTIES=               lonesome
 COMMENT=               Chromium browser
 
 V=                     88.0.4324.190
+REVISION=              0
 
 DISTNAME=              chromium-${V}
 
Index: patches/patch-v8_src_base_platform_platform-posix_cc
===================================================================
RCS file: 
/cvs/ports/www/chromium/patches/patch-v8_src_base_platform_platform-posix_cc,v
retrieving revision 1.29
diff -u -p -u -r1.29 patch-v8_src_base_platform_platform-posix_cc
--- patches/patch-v8_src_base_platform_platform-posix_cc        20 Jan 2021 
07:28:12 -0000      1.29
+++ patches/patch-v8_src_base_platform_platform-posix_cc        9 Mar 2021 
02:58:22 -0000
@@ -3,7 +3,31 @@ $OpenBSD: patch-v8_src_base_platform_pla
 Index: v8/src/base/platform/platform-posix.cc
 --- v8/src/base/platform/platform-posix.cc.orig
 +++ v8/src/base/platform/platform-posix.cc
-@@ -464,7 +464,7 @@ bool OS::DiscardSystemPages(void* address, size_t size
+@@ -266,8 +266,15 @@ void OS::SetRandomMmapSeed(int64_t seed) {
+   }
+ }
+ 
++#if V8_OS_OPENBSD
++// Allow OpenBSD's mmap to select a random address on OpenBSD
+ // static
+ void* OS::GetRandomMmapAddr() {
++  return nullptr;
++}
++#else
++// static
++void* OS::GetRandomMmapAddr() {
+   uintptr_t raw_addr;
+   {
+     MutexGuard guard(rng_mutex.Pointer());
+@@ -350,6 +357,7 @@ void* OS::GetRandomMmapAddr() {
+ #endif
+   return reinterpret_cast<void*>(raw_addr);
+ }
++#endif
+ 
+ // TODO(bbudge) Move Cygwin and Fuchsia stuff into platform-specific files.
+ #if !V8_OS_CYGWIN && !V8_OS_FUCHSIA
+@@ -464,7 +472,7 @@ bool OS::DiscardSystemPages(void* address, size_t size
  
  // static
  bool OS::HasLazyCommits() {
@@ -12,7 +36,7 @@ Index: v8/src/base/platform/platform-pos
    return true;
  #else
    // TODO(bbudge) Return true for all POSIX platforms.
-@@ -1000,7 +1000,7 @@ void Thread::SetThreadLocal(LocalStorageKey key, void*
+@@ -1000,7 +1008,7 @@ void Thread::SetThreadLocal(LocalStorageKey key, void*
  // keep this version in POSIX as most Linux-compatible derivatives will
  // support it. MacOS and FreeBSD are different here.
  #if !defined(V8_OS_FREEBSD) && !defined(V8_OS_MACOSX) && !defined(_AIX) && \

Reply via email to