Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 15b0198087a9f0274fc73c1736e7a4678d6ea412
https://github.com/WebKit/WebKit/commit/15b0198087a9f0274fc73c1736e7a4678d6ea412
Author: Simon Pena <[email protected]>
Date: 2026-05-05 (Tue, 05 May 2026)
Changed paths:
M Source/WTF/wtf/FileSystem.cpp
M Source/WTF/wtf/PlatformHave.h
Log Message:
-----------
[Linux] Handle ENOSPC on NetworkProcess cache mmap writes
https://bugs.webkit.org/show_bug.cgi?id=313815
Reviewed by Adrian Perez de Castro.
If the filesystem runs out of space when the NetworkProcess is writing
into its cache, BlobStorage::add will get SIGBUS when memcpy'ing into a
MAP_SHARED mapping.
By using fallocate immediately after ftruncate, we attempt to reserve
the blocks needed. This allows us to handle ENOSPC, returning an empty
MappedFileData, something already handled by skipping caching the entry.
If EOPNOTSUPP is received, we keep the existing behaviour and progress
-- which might or might not lead to a later SIGBUS.
Doing this exposed a latent leak in createMappedFileData, where files
would survive early returns on error scenarios. A scope guard now
ensures that files are unlinked in error scenarios, which ensures that
the corresponding read paths avoid reading from leftover orphan files.
A new HAVE(FALLOCATE) has been added, defined only in Linux. Darwin or
other systems would probably want their own analogous operation.
Tested manually by creating a small tmpfs, then pointing --profile-dir to
it and navigating. Before the fix, this would consistently trigger a
SIGBUS. After the fix, this logs an error mmapping but continues
unaffected.
* Source/WTF/wtf/FileSystem.cpp:
(WTF::FileSystemImpl::createMappedFileData):
* Source/WTF/wtf/PlatformHave.h:
Canonical link: https://commits.webkit.org/312611@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications