Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6d5322b005e5142df554852db841c860ca447b71
https://github.com/WebKit/WebKit/commit/6d5322b005e5142df554852db841c860ca447b71
Author: Marcus Plutowski <[email protected]>
Date: 2026-02-16 (Mon, 16 Feb 2026)
Changed paths:
M Source/WTF/WTF.xcodeproj/project.pbxproj
M Source/WTF/wtf/AutomaticThread.cpp
M Source/WTF/wtf/CMakeLists.txt
M Source/WTF/wtf/SequesteredAutomaticThread.cpp
M Source/WTF/wtf/StackAllocation.h
M Source/WTF/wtf/StackBounds.h
A Source/WTF/wtf/StackSwitch.cpp
A Source/WTF/wtf/StackSwitch.h
M Source/WTF/wtf/Threading.cpp
M Source/WTF/wtf/Threading.h
M Source/WTF/wtf/posix/ThreadingPOSIX.cpp
M Source/WTF/wtf/win/ThreadingWin.cpp
Log Message:
-----------
[WTF] Switch to SequesteredStack via new DeferredStack mechanism
https://bugs.webkit.org/show_bug.cgi?id=307825
rdar://170333133
Reviewed by Mark Lam.
It is desirable to be able to create threads whose backing stack-memory
is guarded by special memory protections. However, as we are doing this
wholly in userspace, the OS does not know to expect anything different
about the stack we pass to pthread_attr_setstack: this means that a call
to pthread_create using such a stack will necessarily fail, as the OS
does not engage the proper memory-access permissions prior to setting up
the new thread's stack.
So, what we instead want to do is be able to start a WTF::Thread with
one stack (provided by the OS, without special memory protections), then
'teleport' to the new protected stack via a trampoline.
What this patch does is add a new Kind to StackAllocationSpecification
which provides both a size (for the native OS stack -- we want this to
be small, as it's not going to be used for very much) and an allocation
(for the 'deferred' stack that will be switched to during
initialization). It then makes SequesteredAutomaticThreads use this
mechanism for their protected stack.
In a subsequent patch, we will add the code to protect the special stack
and engage the proper memory protections prior to calling the
trampoline.
Canonical link: https://commits.webkit.org/307676@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications