pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/www/webkit-gtk webkit-gtk: Hopefully fix all MAP_ALIGN...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d0a1de4b8c2f
branches:  trunk
changeset: 380188:d0a1de4b8c2f
user:      leot <leot%pkgsrc.org@localhost>
date:      Mon May 30 20:40:55 2022 +0000

description:
webkit-gtk: Hopefully fix all MAP_ALIGNED platforms

Instead of reusing Linux code path for NetBSD fix the MAP_ALIGNED
problematic codepath by setting the protections.

This should hopefully fix other MAP_ALIGNED platforms, not just NetBSD.

Remove XXX comment now that the problem is understood (mmap protection
was set via MAP_NONE and never adjusted in the MAP_ALIGNED platforms).

PKGREVISION++

diffstat:

 www/webkit-gtk/Makefile                                                |   3 +-
 www/webkit-gtk/distinfo                                                |   4 +-
 www/webkit-gtk/patches/patch-Source_WTF_wtf_posix_OSAllocatorPOSIX.cpp |  54 +++------
 3 files changed, 25 insertions(+), 36 deletions(-)

diffs (100 lines):

diff -r 975ddd505e1d -r d0a1de4b8c2f www/webkit-gtk/Makefile
--- a/www/webkit-gtk/Makefile   Mon May 30 20:09:02 2022 +0000
+++ b/www/webkit-gtk/Makefile   Mon May 30 20:40:55 2022 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.226 2022/05/29 17:47:15 leot Exp $
+# $NetBSD: Makefile,v 1.227 2022/05/30 20:40:55 leot Exp $
 
 DISTNAME=      webkitgtk-2.36.3
 PKGNAME=       ${DISTNAME:S/webkitgtk/webkit-gtk/}
+PKGREVISION=   1
 CATEGORIES=    www
 MASTER_SITES=  https://www.webkitgtk.org/releases/
 EXTRACT_SUFX=  .tar.xz
diff -r 975ddd505e1d -r d0a1de4b8c2f www/webkit-gtk/distinfo
--- a/www/webkit-gtk/distinfo   Mon May 30 20:09:02 2022 +0000
+++ b/www/webkit-gtk/distinfo   Mon May 30 20:40:55 2022 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.163 2022/05/29 17:47:15 leot Exp $
+$NetBSD: distinfo,v 1.164 2022/05/30 20:40:55 leot Exp $
 
 BLAKE2s (webkitgtk-2.36.3.tar.xz) = c0536c4edcb59ed28edcdaf309267d6c3c1e49e5eaae85b39fb29b49722977ad
 SHA512 (webkitgtk-2.36.3.tar.xz) = dfd02e22a58d0080d9bf6c7dd2a710bb9d8698ff8a4226653629294b74cc981a3e35d4d93eed5ebad35c81b339ec8b96755ad0b36c0238da151b359e07bcb692
@@ -21,7 +21,7 @@
 SHA1 (patch-Source_WTF_wtf_PlatformOS.h) = 80aa6ff20f10407d447fdb41606d4bb4989351aa
 SHA1 (patch-Source_WTF_wtf_PlatformUse.h) = 595486b48e7d89378208c0a209a121ef136415e6
 SHA1 (patch-Source_WTF_wtf_StackBounds.cpp) = 22a71daac8443f079ad8bcc7285cfd7319c972b3
-SHA1 (patch-Source_WTF_wtf_posix_OSAllocatorPOSIX.cpp) = 73b3facb6912411a5767b05b7d7eebdbc9416ebf
+SHA1 (patch-Source_WTF_wtf_posix_OSAllocatorPOSIX.cpp) = e3a5176efd45d12d52505b469a6fcb3de5c429f2
 SHA1 (patch-Source_WebCore_Scripts_check-xcfilelists.sh) = b292baf2494bcd459d9af91386263123046c6615
 SHA1 (patch-Source_WebCore_Scripts_generate-unified-sources.sh) = 9b323aa1fa8e6e5599ac0a7ae08fbbed4348c70e
 SHA1 (patch-Source_WebCore_crypto_algorithms_CryptoAlgorithmAES__GCM.cpp) = 03337c5eec54d6974dfea1766b14cb2c1b9f7750
diff -r 975ddd505e1d -r d0a1de4b8c2f www/webkit-gtk/patches/patch-Source_WTF_wtf_posix_OSAllocatorPOSIX.cpp
--- a/www/webkit-gtk/patches/patch-Source_WTF_wtf_posix_OSAllocatorPOSIX.cpp    Mon May 30 20:09:02 2022 +0000
+++ b/www/webkit-gtk/patches/patch-Source_WTF_wtf_posix_OSAllocatorPOSIX.cpp    Mon May 30 20:40:55 2022 +0000
@@ -1,7 +1,7 @@
-$NetBSD: patch-Source_WTF_wtf_posix_OSAllocatorPOSIX.cpp,v 1.1 2022/05/29 17:47:15 leot Exp $
+$NetBSD: patch-Source_WTF_wtf_posix_OSAllocatorPOSIX.cpp,v 1.2 2022/05/30 20:40:55 leot Exp $
 
-For NetBSD use the same code paths of OS(LINUX) (there isn't anything
-that NetBSD does not support).
+Set protections for tryReserveUncommittedAligned() on platforms
+that have MAP_ALIGNED.
 
 This avoid a regression introduced by:
 
@@ -20,36 +20,24 @@
  * heap/StructureAlignedMemoryAllocator.cpp:
    (JSC::StructureMemoryManager::StructureMemoryManager):
 
-Where probably the PROT_* are not readjusted.
-
-XXX: This is a wild-guess that should be double-checked!
-
 --- Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp.orig     2022-02-23 11:41:47.560819000 +0000
 +++ Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp
-@@ -115,7 +115,7 @@ void* OSAllocator::tryReserveAndCommit(s
- 
- void* OSAllocator::tryReserveUncommitted(size_t bytes, Usage usage, bool writable, bool executable, bool jitCageEnabled, bool includesGuardPages)
- {
--#if OS(LINUX)
-+#if OS(LINUX) || OS(NETBSD)
+@@ -183,11 +183,15 @@ void* OSAllocator::tryReserveUncommitted
+ #define MAP_NORESERVE 0
+ #endif
      UNUSED_PARAM(usage);
-     UNUSED_PARAM(writable);
-     UNUSED_PARAM(executable);
-@@ -225,7 +225,7 @@ void* OSAllocator::reserveAndCommit(size
- 
- void OSAllocator::commit(void* address, size_t bytes, bool writable, bool executable)
- {
--#if OS(LINUX)
-+#if OS(LINUX) || OS(NETBSD)
-     int protection = PROT_READ;
-     if (writable)
-         protection |= PROT_WRITE;
-@@ -249,7 +249,7 @@ void OSAllocator::commit(void* address, 
- 
- void OSAllocator::decommit(void* address, size_t bytes)
- {
--#if OS(LINUX)
-+#if OS(LINUX) || OS(NETBSD)
-     madvise(address, bytes, MADV_DONTNEED);
-     if (mprotect(address, bytes, PROT_NONE))
-         CRASH();
+-    UNUSED_PARAM(writable);
+-    UNUSED_PARAM(executable);
+     UNUSED_PARAM(jitCageEnabled);
+     UNUSED_PARAM(includesGuardPages);
+-    void* result = mmap(0, bytes, PROT_NONE, MAP_NORESERVE | MAP_PRIVATE | MAP_ANON | MAP_ALIGNED(getLSBSet(alignment)), -1, 0);
++    int protection = PROT_READ;
++    if (writable)
++        protection |= PROT_WRITE;
++    if (executable)
++        protection |= PROT_EXEC;
++
++    void* result = mmap(0, bytes, protection, MAP_NORESERVE | MAP_PRIVATE | MAP_ANON | MAP_ALIGNED(getLSBSet(alignment)), -1, 0);
+     if (result == MAP_FAILED)
+         return nullptr;
+     if (result)



Home | Main Index | Thread Index | Old Index