pkgsrc-WIP-changes archive

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

webkit-gtk: Treat NetBSD same of Linux for OSAllocator



Module Name:	pkgsrc-wip
Committed By:	Leonardo Taccari <leot%NetBSD.org@localhost>
Pushed By:	leot
Date:		Sun May 29 15:17:44 2022 +0200
Changeset:	ff9a693358530e83165fb64f4a442e4db21c4980

Modified Files:
	webkit-gtk/distinfo
Added Files:
	webkit-gtk/patches/patch-Source_WTF_wtf_posix_OSAllocatorPOSIX.cpp
Removed Files:
	webkit-gtk/TODO

Log Message:
webkit-gtk: Treat NetBSD same of Linux for OSAllocator

Avoid a SIGSEGV regression introduced via:

 <https://bugs.webkit.org/show_bug.cgi?id=236460>

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=ff9a693358530e83165fb64f4a442e4db21c4980

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 webkit-gtk/TODO                                    | 38 ---------------
 webkit-gtk/distinfo                                |  1 +
 ...patch-Source_WTF_wtf_posix_OSAllocatorPOSIX.cpp | 55 ++++++++++++++++++++++
 3 files changed, 56 insertions(+), 38 deletions(-)

diffs:
diff --git a/webkit-gtk/TODO b/webkit-gtk/TODO
deleted file mode 100644
index b6ad0d6df4..0000000000
--- a/webkit-gtk/TODO
+++ /dev/null
@@ -1,38 +0,0 @@
-Actually crashes as follows, minimal reproducer via `jsc':
-
-$ /usr/pkg/libexec/webkit2gtk-4.0/jsc
-Segmentation fault (core dumped)
-
-...and, if compiled with CFLAGS=-g, and just running jsc inside the work
-directory:
-
-$ env LD_LIBRARY_PATH=./lib gdb -core jsc.core bin/jsc
-[...]
-Reading symbols from bin/jsc...
-[New process 6829]
-[New process 29521]
-Core was generated by `jsc'.
-Program terminated with signal SIGSEGV, Segmentation fault.
-#0  JSC::MarkedBlock::Footer::Footer (handle=..., vm=..., this=0x7aadc0007ed0) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/heap/MarkedBlock.cpp:97
-97      MarkedBlock::Footer::Footer(VM& vm, Handle& handle)
-[Current thread is 1 (process 6829)]
-(gdb) bt
-#0  JSC::MarkedBlock::Footer::Footer (handle=..., vm=..., this=0x7aadc0007ed0) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/heap/MarkedBlock.cpp:97
-#1  JSC::MarkedBlock::MarkedBlock (handle=..., vm=..., this=0x7aadc0004000) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/heap/MarkedBlock.cpp:87
-#2  JSC::MarkedBlock::Handle::Handle (this=0x7aae178d0000, heap=..., alignedMemoryAllocator=0x7aae178ec9b0, blockSpace=0x7aadc0004000) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/heap/MarkedBlock.cpp:66
-#3  0x00007aae1ed8590b in JSC::MarkedBlock::tryCreate (heap=..., alignedMemoryAllocator=0x7aae178ec9b0) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/heap/MarkedBlock.cpp:59
-#4  0x00007aae1ed5842a in JSC::BlockDirectory::tryAllocateBlock (this=0x7aae17608560, heap=...) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/heap/BlockDirectory.cpp:117
-#5  0x00007aae1ed8221e in JSC::LocalAllocator::allocateSlowCase (this=this@entry=0x7aae176099d0, heap=..., deferralContext=deferralContext@entry=0x0, failureMode=failureMode@entry=JSC::AllocationFailureMode::Assert) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/heap/LocalAllocator.cpp:145
-#6  0x00007aae1f873acc in JSC::LocalAllocator::allocate(JSC::Heap&, JSC::GCDeferralContext*, JSC::AllocationFailureMode)::{lambda()#1}::operator()() const (__closure=<optimized out>) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/heap/LocalAllocatorInlines.h:41
-#7  JSC::FreeList::allocate<JSC::LocalAllocator::allocate(JSC::Heap&, JSC::GCDeferralContext*, JSC::AllocationFailureMode)::{lambda()#1}>(JSC::LocalAllocator::allocate(JSC::Heap&, JSC::GCDeferralContext*, JSC::AllocationFailureMode)::{lambda()#1} const&) (slowPath=..., this=0x7aae176099e8) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/heap/FreeListInlines.h:46
-#8  JSC::LocalAllocator::allocate (failureMode=JSC::AllocationFailureMode::Assert, deferralContext=0x0, heap=..., this=0x7aae176099d0) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/heap/LocalAllocatorInlines.h:38
-#9  JSC::Allocator::allocate (mode=JSC::AllocationFailureMode::Assert, context=0x0, heap=..., this=<synthetic pointer>) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/heap/AllocatorInlines.h:35
-#10 JSC::GCClient::IsoSubspace::allocate (failureMode=JSC::AllocationFailureMode::Assert, deferralContext=0x0, size=size@entry=112, vm=..., this=0x7aae176099d0) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/heap/IsoSubspaceInlines.h:36
-#11 JSC::tryAllocateCellHelper<JSC::Structure> (failureMode=JSC::AllocationFailureMode::Assert, deferralContext=0x0, size=size@entry=112, heap=...) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/runtime/JSCellInlines.h:181
-#12 JSC::allocateCell<JSC::Structure> (vm=..., size=size@entry=112) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/runtime/JSCellInlines.h:195
-#13 0x00007aae1f1bc32e in JSC::Structure::createStructure (vm=...) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/runtime/StructureInlines.h:72
-#14 JSC::VM::VM (this=0x7aae17600000, vmType=<optimized out>, heapType=<optimized out>, runLoop=<optimized out>, success=0x0) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/runtime/VM.cpp:254
-#15 0x00007aae1f1bece4 in JSC::VM::create (heapType=heapType@entry=JSC::HeapType::Large, runLoop=runLoop@entry=0x0) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/runtime/VM.cpp:520
-#16 0x000000008d4190e6 in runJSC<jscmain(int, char**)::<lambda(JSC::VM&, GlobalObject*, bool&)> >(const struct {...} &, bool, const CommandLine &) (func=..., isWorker=false, options=...) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/jsc.cpp:3607
-#17 0x000000008d41aafb in jscmain (argc=argc@entry=1, argv=argv@entry=0x7f7fffa92d98) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/jsc.cpp:3794
-#18 0x000000008d41bbf1 in main (argc=1, argv=0x7f7fffa92d98) at /tmp/pkgsrc/wip/webkit-gtk/work/webkitgtk-2.36.1/Source/JavaScriptCore/jsc.cpp:3020
diff --git a/webkit-gtk/distinfo b/webkit-gtk/distinfo
index 23cef02d73..3bb14e4ac5 100644
--- a/webkit-gtk/distinfo
+++ b/webkit-gtk/distinfo
@@ -21,6 +21,7 @@ SHA1 (patch-Source_WTF_wtf_PlatformHave.h) = 56cec19c923ccb6539f2d321abafa1e1677
 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_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 --git a/webkit-gtk/patches/patch-Source_WTF_wtf_posix_OSAllocatorPOSIX.cpp b/webkit-gtk/patches/patch-Source_WTF_wtf_posix_OSAllocatorPOSIX.cpp
new file mode 100644
index 0000000000..a2c0512917
--- /dev/null
+++ b/webkit-gtk/patches/patch-Source_WTF_wtf_posix_OSAllocatorPOSIX.cpp
@@ -0,0 +1,55 @@
+$NetBSD$
+
+For NetBSD use the same code paths of OS(LINUX) (there isn't anything
+that NetBSD does not support).
+
+This avoid a regression introduced by:
+
+ 2022-02-10  Keith Miller  <keith_miller%apple.com@localhost>
+ 
+ tryReserveUncommittedAligned should explicitly take the alignment requested
+ https://bugs.webkit.org/show_bug.cgi?id=236460
+ 
+ Reviewed by Yusuke Suzuki.
+ 
+ When reducing the size of VA space reserved for Structures, we
+ didn't take care to ensure the alignment matched the required
+ alignment for our bit mask. To fix this we need to pass the
+ original alignment to the allocator as a new parameter.
+ 
+ * 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)
+     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();


Home | Main Index | Thread Index | Old Index