Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information