fix(libkernel): fail open with O_CREAT and O_EXCL on a Windows symbolic link #9496
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9496"
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 Gruzzberry on 2026-10-21T23:22:38Z.
What
On Windows,
openwithO_CREAT|O_EXCLon a symbolic link whose target is missing succeeded and created the target. FreeBSD 11.4'svn_open_credonly addsFOLLOWwhenO_EXCLis not set, so the lookup finds the link itself and the call fails withEEXISTwhatever the link points to, as POSIX requires forO_CREAT|O_EXCLon a symbolic link.OpenNativenow failsO_CREAT|O_EXCLwithEEXISTbefore the host open when the last component is a reparse point. Any reparse point is an existing name, so the answer does not depend on its kind. A link to an existing file already failed withEEXISTand still does;O_CREATwithoutO_EXCLstill creates the target through a dangling link, as FreeBSD does. Linux already fails in the hostopenand is unchanged.Tested
Windows 11 (10.0.26200), WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
-DBUILD_TESTING=ON, onmaind6eafa54d0(rebased), Developer Mode on so links can be created.guest_filesystem: new checks with a dangling link:openwithO_CREAT|O_EXCL|O_WRONLYfails withEEXIST,sceKernelOpenreturns0x80020011, and no target appears;O_CREAT|O_WRONLYthen creates the target through the link;O_CREAT|O_EXCLfails withEEXISTagain. The link and target are removed afterwards; without link permission the checks are skipped with a message. Onmainthe test fails at the first new check (the open returns a descriptor); with this PR it passes.maind6eafa54d0and onmainwith #9442, #9469, #9474, #9487 and #9496 merged together, same machine: 1890 tests each, identical results (1869 passed, 18 skipped; on both, the 3agc_driver_sample_order*tests fail andagc_driver_image_array_window_past_layer_limitis not built, as its 64 KiBalignasis rejected by this MinGW toolchain).python tools/check_conventions.py --base upstream/main: passes.std::filesystem::create_symlink), a console, a title run.Overlaps
tools/pr_overlap.py --branchon the rebased head lists no direct overlap. Of the 9 pull requests it could not compare, #7201 adds a macOS-onlyO_CREATcheck after theO_NOFOLLOWblock, below this one, and #7530 and #9095 match only in a debt entry; none changes theO_CREAT|O_EXCLcheck.GuestFilesystem.cpptotests/files/; if it lands first, the new cases move with the file in the rebase.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); no silent stubs added.mdfiles or images added to the repositoryAI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T23:27:15Z.
Review: APPROVED
Reviewed the Windows reparse-point handling and the cross-platform regression cases. The check recognizes the link itself before the exclusive create can follow a dangling link to its target;
O_CREATwithoutO_EXCLremains covered as a separate case. Theguest_filesystemtests verify both the errno and guest error mapping, ensure no target is created on failure, and clean up the link and target. The PR checks for conventions, intake, eligibility, labels and report pass; hosted product build jobs are skipped.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T02:09:14Z.
Review: APPROVED
Rechecked the current head and overlap state. The Windows reparse-point check runs before exclusive create can follow a dangling link; ordinary
O_CREATthrough that link remains covered. Regression checks verify POSIX and SCE errors, target non-creation, later ordinary creation, and cleanup. The author reports a Windows red/green run and a broader suite; hosted eligibility, conventions, intake, labels and report pass, while product/relinker jobs are skipped. The #5021/#6936/#7201 manual shared-file warnings were not found as concrete overlaps in the reviewed diff. I did not run local tests.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T04:26:20Z.
Review: DISMISSED
The Windows reparse-point check and regression cases are well targeted: they verify
EEXISTthrough both POSIX and SCE entry points, confirm the dangling target is not created, then cover ordinaryO_CREATthrough the link and cleanup. The earlier manual overlap review also found the #5021/#6936/#7201 warnings were distinct. However, the tests and branch are based ona6dcea9279; upstream main is nowab347d144d. Please rebase onto current main, rerun the focusedguest_filesystemregression and conventions check, and refresh the overlap scan/manual uncomparable-file review. Hosted product jobs are skipped; I did not run local tests.Imported from boykopovar/AnyPS5. Originally posted by Gruzzberry on 2026-10-22T06:49:05Z.
Rebased onto
maind6eafa54d0.guest_filesystempasses on the new head, the new checks fail on thatmainwithout the change, andcheck_conventions.pypasses. Full suite onmaind6eafa54d0and onmainwith #9442, #9469, #9474, #9487 and #9496 merged together: 1890 tests each, identical results. The overlap scan of the rebased head and a manual check of the pull requests it could not compare are in the description under Overlaps.Imported from boykopovar/AnyPS5. Originally posted by Gruzzberry on 2026-10-22T11:41:03Z.
Holding this as a draft, following the direction on #5239: the open queue is above 700 and no named title needs this change on current
main. I will only mark it ready again with a current-main title ID, its Game bring-up discussion and the log line where it stops on this, or once the queue is below 700. Thanks for the reviews so far; the requested fixes are being made on the branch in the meantime.