[webkit-changes] [WebKit/WebKit] 9ec2b5: [WK2][macOS] Update sandbox profile caching to not...
Chris Dumez
noreply at github.com
Thu Jul 6 13:38:23 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 9ec2b57dca82a9fafbfd7bf42f243d3e41cfbe1d
https://github.com/WebKit/WebKit/commit/9ec2b57dca82a9fafbfd7bf42f243d3e41cfbe1d
Author: Chris Dumez <cdumez at apple.com>
Date: 2023-07-06 (Thu, 06 Jul 2023)
Changed paths:
M Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm
Log Message:
-----------
[WK2][macOS] Update sandbox profile caching to not require file locking
https://bugs.webkit.org/show_bug.cgi?id=258940
rdar://111383802
Reviewed by Ben Nham, Per Arne Vollan and Brent Fulgham.
As a process launch optimization on macOS, we cache the compiled sandbox
profile to disk and reuse this cached profile for follow-up process
launches.
The logic was relying to using file locking to avoid reading partially
written sandbox profiles, which would lead to issues if the process
suspends while in the middle of doing this work.
To avoid locking, we now write the compiled sandbox profile to a
temporary path which includes the current process's PID, before moving
it to the final destination (using rename()). Because rename() is atomic,
this should achieve what we want without file locking.
* Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm:
(WebKit::writeSandboxDataToCacheFile):
(WebKit::tryApplyCachedSandbox):
Canonical link: https://commits.webkit.org/265823@main
More information about the webkit-changes
mailing list