Repository navigation
feat(libkernel): map regular files with mmap on Linux - #5053
Conversation
b33341a to
3f12dce
Compare
|
Tested on Linux x86-64 (Ubuntu 24.04 in a Colima VM with Rosetta on Apple M4, GCC 13.3), this PR (
AI-assisted: yes (Claude Code). |
|
Linux title check (Ubuntu 24.04, GCC 13, Release, headless), head 3f12dce on its base: |
|
Thanks @simonbronk and @babyhuey for the runs. Dusklight (PPSA99305) going from On the overlap with #5186: it's docs-only and adjacent. #5186 edits the |
3f12dce to
6b8ddfb
Compare
|
Checked on the PR merged onto current main: |
|
Thanks @adriadam10 for checking it, including the revert of |
What
On Linux,
mmapmaps only shared memory descriptors (shm_open) and fails withEOPNOTSUPPfor every other descriptor, including regular files. SQLite in WAL mode maps its-shmindex file withmmap(MAP_SHARED), so that failure becomesdisk I/O error: Dusklight (PPSA99305) logsFailed to set pragmas: disk I/O errorandSQLite DB init failedfor its GPU cache and pipeline cache at every start and runs without them. With strace, the guest'smmapof the 32 KiB-shmfile stops at the descriptor check after theF_DUPFD_CLOEXEC/F_GETFLvalidation; no hostmmapis attempted.mmapaccepts a regular file's descriptor (hostfstatreportsS_ISREG) besides shared memory descriptors, with the existing access checks (EACCESfor a shared writable mapping of a read-only descriptor) and the existingDoMapFileBackedpath, shared or private.guest_memorymaps a two-page file shared (reads both pages, a write reaches the file), private (a write stays in the mapping), at a page offset, and through a read-only descriptor (shared writable fails withEACCES, read-only works); a pipe still fails withEOPNOTSUPP.mmap(2), shadPS4'sMemoryManager::MapFilefor regular files), that console behaviour is not measured, that other descriptor kinds still fail, and that Windows maps no files.Tested
Linux (Bazzite 44 host, Fedora 44 distrobox, GCC 16.2.1, Ninja, Release,
-DBUILD_TESTING=ON), based onmainbb9a4d8a:libs, and fullctest: 1017 pass, 8 skip, 1 fail. The failure isagc_driver_tessellation(SEGFAULT), which fails the same way on unchangedmainon this machine.guest_memoryagainst unchangedmain'sPosixMemory.cppfails at the shared mapping of the regular file, and passes with the change.--trap-sdk-syscall-stubs; it needs the posix_spawn exports of feat(libSceLibcInternal): implement posix_spawn actions #3651 to load, so that PR was merged locally for the title run only): before the change the log has the twodisk I/O errorfailures above; with it,SQLite cache init succeeded,dawn_cache.db-walandpipeline_cache.db-walare written, and nodisk I/Oline remains. Without a disc image the title stays at its menu, as expected.tools/check_conventions.py --base upstream/main,git diff --checkandtools/pr_overlap.py(no overlap) pass. Windows and macOS were not run; this change does not touch their paths.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository