-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up Signals and remove hardened fallback
https://bugs.webkit.org/show_bug.cgi?id=271766 rdar://125256111 Reviewed by Justin Michaud. This change does a couple of things: 1) Refactor the signal handler API after https://commits.webkit.org/276579@main which had mach exception users pass the mask of exceptions they would ever want to handle at initialization time (before they register their handler). Instead the new signal handler API registers our handlers with the kernel at finalization time. At which point we have a list of every exception handler added. 2) Remove the finalizeSignalHandlers function and finalize signal handlers when WTF::Config finalizes. 3) Remove disableSignalHandling function as it never really worked (signals could still get registered before we called disable) and we mostly rely on the sandbox to block signals in lockdown mode. 3) Rename SignalHandlers::InitState entries to better reflect the new design and use it for all configurations not just mach ports. 4) Remove the fallback we added to https://commits.webkit.org/276579@main as a stopgap for internal folks running on old sandboxes. 5) Remove `isX86BinaryRunningOnARM()` check since that didn't seem to work anyway. We'll probably have to remove signal handling under Rosetta as I couldn't get it to work. 6) Save the secret key for our hardened handler in Signals.cpp before finalization and only let API users see it via presignReturnPCForHandler so they can't accidentally save it somewhere an attacker could see later. We also carefully zero it at finalization time after passing it to the kernel via `task_register_hardened_exception_handler`. 7) Move disabledFreezingForTesting to WTF::Config since that's the config that actually does the freezing not JSC::Config. This allows WTF::Config to control finalizing signal handlers. 8) Remove some cases from com.apple.WebKit.WebContent.sb.in to simplify the profile slightly. We don't need to guard the `(require-not (webcontent-process-launched))` check on `ENABLE(BLOCK_SET_EXCEPTION_PORTS)` because we have `webcontent-process-launched` anywhere we `HAVE(HARDENED_MACH_EXCEPTIONS)` anyway. * Source/JavaScriptCore/jsc.cpp: (main): (CommandLine::parseArguments): * Source/JavaScriptCore/runtime/InitializeThreading.cpp: (JSC::initialize): * Source/JavaScriptCore/runtime/JSCConfig.cpp: (JSC::Config::disableFreezingForTesting): Deleted. * Source/JavaScriptCore/runtime/JSCConfig.h: (JSC::Config::disableFreezingForTesting): (JSC::Config::finalize): (JSC::Config::permanentlyFreeze): Deleted. * Source/JavaScriptCore/runtime/VM.cpp: (JSC::VM::VM): * Source/JavaScriptCore/runtime/VMEntryScope.cpp: (JSC::VMEntryScope::setUpSlow): * Source/JavaScriptCore/runtime/VMTraps.cpp: * Source/JavaScriptCore/tools/JSDollarVM.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION_WITH_ATTRIBUTES): * Source/JavaScriptCore/wasm/WasmFaultSignalHandler.cpp: (JSC::Wasm::trapHandler): (JSC::Wasm::activateSignalingMemory): (JSC::Wasm::prepareSignalingMemory): (JSC::Wasm::MachExceptionSigningKey::MachExceptionSigningKey): Deleted. * Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h: * Source/WTF/wtf/PlatformRegisters.cpp: (WTF::threadStatePCInternal): * Source/WTF/wtf/Threading.cpp: (WTF::initialize): * Source/WTF/wtf/WTFConfig.cpp: (WTF::Config::initialize): (WTF::Config::finalize): (WTF::Config::permanentlyFreeze): (WTF::Config::disableFreezingForTesting): * Source/WTF/wtf/WTFConfig.h: * Source/WTF/wtf/threads/Signals.cpp: (WTF::SignalHandlers::add): (WTF::SignalHandlers::presignReturnPCForHandler): (WTF::initMachExceptionHandlerThread): (WTF::toMachMask): (WTF::setExceptionPorts): (WTF::activeThreads): (WTF::registerThreadForMachExceptionHandling): (WTF::activateSignalHandlersFor): (WTF::addSignalHandler): (WTF::disableSignalHandling): (WTF::jscSignalHandler): (WTF::SignalHandlers::initialize): (WTF::SignalHandlers::finalize): (WTF::finalizeSignalHandlers): Deleted. * Source/WTF/wtf/threads/Signals.h: (WTF::toMachMask): Deleted. (WTF::initializeSignalHandling): Deleted. (WTF::disableSignalHandling): Deleted. * Source/WTF/wtf/win/SignalsWin.cpp: (WTF::SignalHandlers::add): (WTF::addSignalHandler): (WTF::activateSignalHandlersFor): (WTF::SignalHandlers::initialize): (WTF::SignalHandlers::finalize): (WTF::finalizeSignalHandlers): Deleted. * Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in: Canonical link: https://commits.webkit.org/277136@main
- Loading branch information
Showing
20 changed files
with
232 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.