fix(relinker): trap inline SDK mount syscall #8729
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8729"
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 hyvvs on 2026-10-20T22:37:37Z.
What
Recognize the exact
SYS_mountinline syscall sequence observed in public ps5-payload-dev ftpsrv v0.21.1 and websrv v0.35 payloads when--trap-sdk-syscall-stubsis explicitly enabled (issue #8624).The scanner keeps its decoded-instruction-boundary and full-sequence checks. The trapped syscall is still replaced with
UD2; this does not implementmountor claim that either payload can execute successfully. This patch recognizes only the inlineSYS_mountsequence. As reported in #8624,ftpsrv-ps5andwebsrv-ps5also containnmountandunmountwrappers; the mount-only change still fails conversion atnmount(ftpsrv:0x70ec; websrv:0xaebc). These remaining wrappers need a separate design decision and implementation if the option is broadened.Extend the existing SDK inline-syscall fixture and near-match mutation checks, and record the remaining functional gap in the relinker technical debt.
This is a design proposal for maintainer review: #8624 explicitly leaves open whether
SYS_mountbelongs in the opt-in trap list. No unrelated syscall patterns are accepted.Tested
0x123413.cmake --build build-relinker --parallel 6: passed.ctest --test-dir build-relinker --output-on-failure -j 4 -R '^(sdk_mman_syscall|relinker_conversion|cli_args|elf_reader_bounds|call_site_index)$': 5/5 passed.sdk_mman_syscall_tests: 1,285 near-match rejections passed.python tools/check_conventions.py --base upstream/main: passed.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 MarcZX10 on 2026-10-20T22:38:42Z.
The exact-byte matcher and fixture look deliberately scoped: it requires the decoded sequence start, checks the full sequence within the code-section bound, and retains the near-match mutations. One design point before approval: #8624 leaves
SYS_mountinclusion as an explicit contract decision, while the current option documentation describes trapping mmap/mprotect and rejecting other syscall instructions. If maintainers decide to broaden the opt-in, please update that user-facing description as part of the change; otherwise the implementation exceeds the documented scope. I only reviewed the patch and reported Windows test matrix here; the automatic checks are policy checks, with no hosted build job.Imported from boykopovar/AnyPS5. Originally posted by hyvvs on 2026-10-20T22:49:17Z.
Ty for reviewing!
Agreed that including
SYS_mountshould be a maintainer decision,I'll keep the PR as a draft pending that decision. If maintainers agree with the extension, I'll update the user-facing option description to include
SYS_mountand clarify that it is trapped rather than implemented.The relinker-only Windows build and focused regression tests passed locally. A hosted Windows CI build hasn't been run yet.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T23:15:20Z.
New exact-payload data was added to #8624 after this PR opened: recognizing only the
mountwrapper still stopsftpsrvatnmount(0x70ec) andwebsrvatnmount(0xaebc); both also contain inlineunmountwrappers. The three-wrapper change converts both payloads, while the mount-only version does not. Your body correctly says this PR does not claim successful execution, butFixes #8624would still close an issue whose reported conversion gap remains. Could you change that relation to a non-closing reference and state that this adds one recognized wrapper whilenmount/unmountremain blockers (or coordinate with the measured three-wrapper follow-up if maintainers approve broadening the option)?Imported from boykopovar/AnyPS5. Originally posted by hyvvs on 2026-10-20T23:25:41Z.
I've updated the PR description to remove the closing reference to #8624 and clarify that this change only handles
SYS_mount, whilenmountandunmountremain blockers.I'll keep the PR as a draft pending the maintainers' decision on whether to expand the supported wrappers.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T01:46:06Z.
I am reviewing #9549. Its trap-condition change edits the line where this PR renames
IsSdkMmanSyscallStubtoIsSdkInlineSyscallStub, so the two changes need an agreed landing order and a refreshedDepends onentry if one must land first. Could you coordinate with @DavidSamir on the integration order? #9549 currently calls the old name and would need that symbol updated if this PR merges first.Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-22T02:18:48Z.
@hyvvs, a coordination question on landing order, as @MarcZX10 asked on #9549. #9549 turns the trap condition you rename in (
IsSdkMmanSyscallStubtoIsSdkInlineSyscallStub,SyscallScanner.cppL293-294) intoconst bool sdkStub = ..., so whichever of the two merges second needs that one helper name updated; there is no other overlap.You have kept this PR as a draft pending a decision on
nmountandunmount, so I propose #9549 lands first and your PR updates the call insidesdkStubwhen it is rebased (one word). #9549 does not need yours, so it keepsDepends on: none. If you would rather land first, say so here and I will rebase #9549 onto yours and list #8729 underDepends on.Imported from boykopovar/AnyPS5. Originally posted by hyvvs on 2026-10-22T02:37:55Z.
@DavidSamir @MarcZX10 Thanks for flagging the overlap.
I agree that #9549 should land first, since #8729 is still a draft pending the maintainer decision on the mount/nmount/unmount syscall wrappers.
Once #9549 merges, I'll rebase #8729 onto the updated main, preserve the new
sdkStubdiagnostic behavior, update the helper call toIsSdkInlineSyscallStub, and rerun the relevant tests and checks.Happy to proceed with this
Pull request closed