Repository navigation
fix(libkernel): give FillStatfs the noexec flag so statfs builds on macOS - #17767
Conversation
…acOS FillStatfs read the macOS MNT_NOEXEC flag through fstatfs on a descriptor it does not receive, so libkernel no longer compiled on macOS. The callers now work out the flag, through fstatfs for a descriptor and statfs for a path on macOS, and from ST_NOEXEC elsewhere, and pass it in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.
AI-assisted: yes. |
milescoviello
left a comment
There was a problem hiding this comment.
Read 496ee893aa.
- Linux:
FillStatfsnow takesnoexec, and both callers compute it as(host.f_flag & ST_NOEXEC) != 0from thestatvfsthey already have. That is exactly whatFillStatfsdid onmain, so nothing changes there. - macOS:
NativeFstatfsgoes back tofstatfs(descriptor)as before #9161, andNativeStatfsusesstatfs(path)for the path case, whichmainnever setKERNEL_MNT_NOEXECfor. The rest of the flag and size filling is unchanged and shared.
AI-assisted: yes (Claude Code)
|
macOS is the platform this fixes, and it had no macOS run yet. Verified on Apple M4 (Mac mini), macOS 27.0.1 (26A434), Apple clang 21.0.0, x86-64 Release under Rosetta 2,
Nothing else I ran regressed. The Windows run above covers the platform that did not need this fix; this covers the one that did. |
What
libkernelno longer compiles on macOS onmain:#9161 split the shared part of
NativeFstatfsintoFillStatfs, whichNativeStatfsnow also uses for a path. The macOS branch that setsKERNEL_MNT_NOEXECfromfstatfs(descriptor)ended up insideFillStatfs, which only receives thestatvfsresult.FillStatfsnow takes the flag, and each caller works it out:NativeFstatfson macOS:fstatfson the descriptor, as before feat(libkernel_sys): implement statfs symlinkat and futimesat #9161.NativeStatfson macOS:statfson the path, so the path form also reportsnoexecmounts.ST_NOEXECfrom thestatvfsresult, as before.Windows has its own
NativeStatfsandNativeFstatfs, which do not useFillStatfs.Tested
macOS 27.3, Apple M5 Pro, Apple clang, x86-64 Release under Rosetta 2. Tree:
mainb673b14c39with this change and #16591, #17425 and #17532, which macOS still needs to build. Between that commit andmainffe575754a, nothing inStdio.cppchanged, and the broken line is still there.ninja -k 0 libsfails onStdio.cpp:716(above). The other failures are the ones fix(prx): build the macOS libraries on current main #16591 and fix(libSceLibcInternal): clamp the string count as size_t on macOS #17532 fix.libs(407 libraries, NID patching included) andrelinkerbuild.ctest -R 'statfs|fstatfs|statvfs|kernel_sys_paths': 12 of 12 pass (guest_kernel_sys_paths_statfsand its patched form,guest_fstatfs,guest_statvfs,guest_fstatvfs,guest_fstatvfs_conversionand the other path tests).KERNEL_MNT_NOEXEC, so the flag itself is covered only by reading the code.ST_NOEXECtest as before.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 (attach them to this PR)🤖 Generated with Claude Code