fix(libkernel): fail fchmod on a pipe with EINVAL like FreeBSD #9502
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9502"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by GitamarT045T3R on 2026-10-21T23:33:38Z.
What
fchmodandsceKernelFchmodon either end of a pipe failed withENOENTon Windows, where the pipe has no path. On Linux they changed the pipe's mode. FreeBSD 11'spipe_chmodsends an unnamed pipe toinvfo_chmod, which returnsEINVAL. Both calls now returnEINVAL(SCE_KERNEL_ERROR_EINVAL) for a pipe, as they already do for a socket. The check uses the existingIsPipeDescriptor. The guest has nomkfifo, so every pipe it holds is unnamed.Tested
Windows 10 Pro 22H2 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Ninja, Release, on
main0c6a5bd59:guest_filesystemnow checks both calls on both ends of a pipe, next to the existingfsyncandfdatasyncchecks there. It fails withmain'sStdio.cppand passes with this change.python tools/check_conventions.py --base origin/mainpasses.IsPipeDescriptorusesfstatandS_ISFIFO.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)Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-22T00:03:44Z.
Review: COMMENTED
Linux run of the current change, since the description only lists Windows ("Not built or run on Linux or macOS").
Machine: Linux x86_64, i7-8700 (6 cores / 12 threads), Ubuntu 26.04, GCC 15.2, Release,
BUILD_TESTING=ON. Head9f05f4777merged ontomaina6dcea927(the merge touches onlyStdio.cppandGuestFilesystem.cpp).guest_filesystempasses with the change.libkernel/File/src/Stdio.cpptomainand keeping the test abortsguest_filesystem. The only added assertions are the two new pipe checks, and on Linuxmain'sfchmod/sceKernelFchmodon a pipe end return 0 (they change the pipe's mode throughfchmod/S_ISFIFO) instead ofEINVAL/0x80020016, so the test covers the change on this host as well.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T01:29:45Z.
Review: CHANGES_REQUESTED
I reviewed the one-line guard and the added assertions. The cited FreeBSD source routes pipe
chmodthroughpipe_chmodto the invalid-operation handler, and the existing Linux run independently confirms that hostfchmodwould otherwise succeed on these pipe endpoints. The new test covers bothfchmodandsceKernelFchmodfor the tested pipe end; hosted eligibility, conventions, intake, labels and report checks pass. Product and relinker jobs were skipped by the workflow, and I did not run a local build.The required overlap scan reports an exact shared
sceKernelFchmodregion with open #8520. I inspected that patch: it adds a virtual-directory error guard immediately before the existing socket guard in the same function, so both changes need to be retained and composed. Please coordinate with #8520’s author on merge order and record the agreed order in the checklist (Depends on: #8520if this must follow it, otherwisenoneafter confirming the rebase will compose). The presentDepends on: nonedoes not document the flagged overlap.Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-22T04:11:55Z.
Linux data point for
9f05f47775: WSL2 Ubuntu 24.04 (virtualised kernel, not bare-metal), GCC 13.3.0, Release,BUILD_TESTING=ON, PR head alone (not merged ontomain; its merge-base is0c6a5bd59).ctest -R '^guest_filesystem$'passes 3 of 3.libkernel/File/src/Stdio.cpprestored to the merge-base (the PR's tests kept): fails (Subprocess aborted).Not tested: macOS, Windows, a title run.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T04:25:20Z.
Review: DISMISSED
The pipe behavior and regression assertions are well supported by the FreeBSD path and the reported Linux/WSL red-green runs. The open overlap with #8520 remains unresolved: its virtual-directory guard and this pipe guard both modify
sceKernelFchmod, and the checklist still saysDepends on: nonewithout recording an author-agreed order. In addition, this branch is based on0c6a5bd593, while upstream main is nowab347d144d. Please coordinate with #8520’s author, document the order/dependency, rebase onto current main, recheck shared hunks including #6044’s test-file changes, and rerun the focused filesystem test and conventions check on the rebased result. Hosted product jobs are skipped. I did not run local tests.Imported from boykopovar/AnyPS5. Originally posted by GitamarT045T3R on 2026-10-22T08:10:33Z.
Rebased onto
maind6eafa54d(7350b1cfc). The pipe check is now its own line afterFile::RefuseArchivedFile, and the socket line is left as it was. A pipe is never an archived file, so the order changes nothing, and two unchanged lines now separate it from #8520's new first line insceKernelFchmod.git merge-treeof this head with #8520 is clean inStdio.cpp. Its only conflict isDirectoryDescriptor.cpp, which #8520 already has withmain. With #6044 it is clean in both files this PR touches.guest_filesystempasses on Windows, andcheck_conventionspasses.Landing order with #8520 (@qpavyros): neither depends on the other, and either order merges without conflict in these lines. With both in,
fchmodon a virtual directory answersEISDIRand on a pipeEINVAL. SoDepends onstays none.Imported from boykopovar/AnyPS5. Originally posted by GitamarT045T3R on 2026-10-22T12:15:44Z.
Rebased onto current
main(89f99c2f5) and moved the pipe check one line up, between the socket check andFile::RefuseArchivedFile. #7299 (@qpavyros) inserts its Windows shared-memory branch right afterRefuseArchivedFile, at the same place this check was.git merge-treeof this head is now clean against #7299. Against #8520 it is clean inStdio.cpp, and #8520's one conflict isDirectoryDescriptor.cpp, which it already has withmain. A pipe is neither a socket, an archived file nor shared memory, so the order changes nothing.guest_filesystempasses on Windows, andcheck_conventionspasses.Depends onstays none.