fix(relinker): name --trap-sdk-syscall-stubs when a refused syscall is an SDK stub #9549

Merged
DavidSamir merged 3 commits from upstream-pr/9549 into main 2026-11-09 22:09:03 +00:00
DavidSamir commented 2026-10-22 01:39:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-22T01:39:35Z.


What

A converted title that carries the ps5-payload-dev SDK syscall stubs is refused with Forbidden syscall instruction at code offset 0x..., and nothing in the message says that --trap-sdk-syscall-stubs converts it. The scanner already has the matchers for the sequences that option traps, so when the refused instruction is one of them the message now ends with ; it is a ps5-payload-dev SDK syscall stub, which --trap-sdk-syscall-stubs replaces with UD2. Any other syscall keeps the message it had, so a real syscall never suggests the flag.

Titles whose refusal now names the flag (catalog, Linux relinker, --to-intel, no trap option):

  • PPSA99061 Spot5: Forbidden syscall instruction at code offset 0xdeb8f7; it is a ps5-payload-dev SDK syscall stub, ...
  • PPSA99186 ForgeNX: ... at code offset 0x214385a: syscall number 9; it is a ps5-payload-dev SDK syscall stub, ...
  • the trap list of the catalog sweep: PPSA99004 (0x1108bf7), PPSA99203 (0x10a2d37), PPSA99360 (0x1699f07) and PPSA99288 (0x24a67ba) show the hint in the same way; the other titles of that list are not re-run here.

Spot5 and ForgeNX convert and run for 60 s once --trap-sdk-syscall-stubs is given (Linux, same harness as the other sweeps): first frame, no stderr.

The change is in SyscallScanner.cpp: the SDK-stub test that decided whether to trap is evaluated once into sdkStub and used for both the trap and the hint. Nothing else in the conversion changes.

Tested

  • syscall_scanner (Linux; SyscallScannerTests.cpp, registered on Linux only): the numbered and the generic SDK stubs are refused with the hint, and the seven bare syscall shapes of the existing tests (unsigned constant, register, int 0x80, sysenter, sysret, clobbered, prefixed) are refused without it. The existing prefix and syscall number N checks are unchanged and pass.
  • Negative control: with SyscallScanner.cpp from before the change and the same test, syscall_scanner fails with Relinker did not name --trap-sdk-syscall-stubs for the numbered SDK stub. With the change it passes.
  • Linux (Ubuntu 24.04 in WSL2, GCC, Release): syscall_scanner, syscall_number, sdk_mman_syscall, conversion_diagnostics, executable_segments and sce_code_gaps pass, 6 of 6.
  • Windows 11 (WinLibs GCC 15.2.0, Release): the Windows-registered tests among those pass, 6 of 6 (syscall_scanner itself is not registered on Windows).
  • python tools/check_conventions.py --base origin/main passes.
  • Merge check with git merge-tree: clean against main. #8729 renames IsSdkMmanSyscallStub to IsSdkInlineSyscallStub and edits the trap condition, so it conflicts with this change on that line; whichever merges second only needs the function name in const bool sdkStub = ... brought up to date.
  • python tools/pr_overlap.py --branch fix/relinker-name-trap-flag (the version from #9539, which merges only the pull requests that share files with the branch; 1 min 18 s): #8729 conflicts on SyscallScanner.cpp L293-294, the trap condition this change turns into sdkStub, and #8042 could not be compared because it conflicts with main itself. Nothing else overlaps.

Not run on macOS.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: #10479
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4960790037 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9549). Originally posted by [DavidSamir](https://github.com/DavidSamir) on 2026-10-22T01:39:35Z. --- ### What A converted title that carries the ps5-payload-dev SDK syscall stubs is refused with `Forbidden syscall instruction at code offset 0x...`, and nothing in the message says that `--trap-sdk-syscall-stubs` converts it. The scanner already has the matchers for the sequences that option traps, so when the refused instruction is one of them the message now ends with `; it is a ps5-payload-dev SDK syscall stub, which --trap-sdk-syscall-stubs replaces with UD2`. Any other syscall keeps the message it had, so a real syscall never suggests the flag. Titles whose refusal now names the flag (catalog, Linux relinker, `--to-intel`, no trap option): - PPSA99061 Spot5: `Forbidden syscall instruction at code offset 0xdeb8f7; it is a ps5-payload-dev SDK syscall stub, ...` - PPSA99186 ForgeNX: `... at code offset 0x214385a: syscall number 9; it is a ps5-payload-dev SDK syscall stub, ...` - the trap list of the catalog sweep: PPSA99004 (`0x1108bf7`), PPSA99203 (`0x10a2d37`), PPSA99360 (`0x1699f07`) and PPSA99288 (`0x24a67ba`) show the hint in the same way; the other titles of that list are not re-run here. Spot5 and ForgeNX convert and run for 60 s once `--trap-sdk-syscall-stubs` is given (Linux, same harness as the other sweeps): first frame, no stderr. The change is in `SyscallScanner.cpp`: the SDK-stub test that decided whether to trap is evaluated once into `sdkStub` and used for both the trap and the hint. Nothing else in the conversion changes. ### Tested - `syscall_scanner` (Linux; `SyscallScannerTests.cpp`, registered on Linux only): the numbered and the generic SDK stubs are refused with the hint, and the seven bare syscall shapes of the existing tests (unsigned constant, register, `int 0x80`, `sysenter`, `sysret`, clobbered, prefixed) are refused without it. The existing prefix and `syscall number N` checks are unchanged and pass. - **Negative control:** with `SyscallScanner.cpp` from before the change and the same test, `syscall_scanner` fails with `Relinker did not name --trap-sdk-syscall-stubs for the numbered SDK stub`. With the change it passes. - Linux (Ubuntu 24.04 in WSL2, GCC, Release): `syscall_scanner`, `syscall_number`, `sdk_mman_syscall`, `conversion_diagnostics`, `executable_segments` and `sce_code_gaps` pass, 6 of 6. - Windows 11 (WinLibs GCC 15.2.0, Release): the Windows-registered tests among those pass, 6 of 6 (`syscall_scanner` itself is not registered on Windows). - `python tools/check_conventions.py --base origin/main` passes. - Merge check with `git merge-tree`: clean against `main`. #8729 renames `IsSdkMmanSyscallStub` to `IsSdkInlineSyscallStub` and edits the trap condition, so it conflicts with this change on that line; whichever merges second only needs the function name in `const bool sdkStub = ...` brought up to date. - `python tools/pr_overlap.py --branch fix/relinker-name-trap-flag` (the version from #9539, which merges only the pull requests that share files with the branch; 1 min 18 s): #8729 conflicts on `SyscallScanner.cpp` L293-294, the trap condition this change turns into `sdkStub`, and #8042 could not be compared because it conflicts with `main` itself. Nothing else overlaps. Not run on macOS. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #10479 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-22 01:46:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T01:46:05Z.

Review: CHANGES_REQUESTED


The message change and negative-control coverage are narrowly scoped and the PR is based on current main. I manually inspected the two reported overlap candidates. #8042 changes only the scanner construction/resynchronization option earlier in SyscallScanner.cpp; it is separate from this PR’s SDK-stub classification and message hunk, so I found no ordering requirement there.

#8729 does change the same trap-condition line and renames IsSdkMmanSyscallStub to IsSdkInlineSyscallStub. This branch still calls the old name. If #8729 lands first, this PR will need that call updated; the checklist currently says Depends on: none, and I found no landing-order agreement in the PR discussion. Please coordinate with @hyvvs on which change lands first, update the Depends on entry to reflect that agreement, then rebase/recheck the combined line. The current hosted relinker matrix is still running on Windows; Ubuntu, macOS x86_64/arm64 and ASAN have passed so far, while platform product-build jobs are skipped.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5608326383 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9549#pullrequestreview-5608326383). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T01:46:05Z. **Review:** CHANGES_REQUESTED --- The message change and negative-control coverage are narrowly scoped and the PR is based on current main. I manually inspected the two reported overlap candidates. #8042 changes only the scanner construction/resynchronization option earlier in `SyscallScanner.cpp`; it is separate from this PR’s SDK-stub classification and message hunk, so I found no ordering requirement there. #8729 does change the same trap-condition line and renames `IsSdkMmanSyscallStub` to `IsSdkInlineSyscallStub`. This branch still calls the old name. If #8729 lands first, this PR will need that call updated; the checklist currently says `Depends on: none`, and I found no landing-order agreement in the PR discussion. Please coordinate with @hyvvs on which change lands first, update the `Depends on` entry to reflect that agreement, then rebase/recheck the combined line. The current hosted relinker matrix is still running on Windows; Ubuntu, macOS x86_64/arm64 and ASAN have passed so far, while platform product-build jobs are skipped.
MarcZX10 commented 2026-10-22 01:53:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T01:53:43Z.

Review: CHANGES_REQUESTED


Thanks for adding the same-line overlap explanation and recording that the second branch needs a small adaptation. The live overlap check still reports #8729 on the exact syscall predicate line. This branch continues to call IsSdkMmanSyscallStub, while #8729 renames it to IsSdkInlineSyscallStub; the checklist still says Depends on: none, and I do not see an agreed landing order in the discussion.

Please coordinate the order with #8729's author, record the required predecessor on Depends on if one must land first, then rebase/update the helper call and rerun the relinker matrix. The hosted Ubuntu, both macOS architectures and ASAN jobs pass; the hosted Windows relinker job is still running. Product Linux/Windows jobs are skipped. The PR's reported Linux and Windows focused tests are author-reported; I did not run local tests.

The #8042 shared-file result remains a non-blocker: its scanner-construction change is separate from this classification/message hunk. This request is limited to the unresolved #8729 same-line integration rule.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5608371619 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9549#pullrequestreview-5608371619). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T01:53:43Z. **Review:** CHANGES_REQUESTED --- Thanks for adding the same-line overlap explanation and recording that the second branch needs a small adaptation. The live overlap check still reports #8729 on the exact syscall predicate line. This branch continues to call `IsSdkMmanSyscallStub`, while #8729 renames it to `IsSdkInlineSyscallStub`; the checklist still says `Depends on: none`, and I do not see an agreed landing order in the discussion. Please coordinate the order with #8729's author, record the required predecessor on `Depends on` if one must land first, then rebase/update the helper call and rerun the relinker matrix. The hosted Ubuntu, both macOS architectures and ASAN jobs pass; the hosted Windows relinker job is still running. Product Linux/Windows jobs are skipped. The PR's reported Linux and Windows focused tests are author-reported; I did not run local tests. The #8042 shared-file result remains a non-blocker: its scanner-construction change is separate from this classification/message hunk. This request is limited to the unresolved #8729 same-line integration rule.
MarcZX10 commented 2026-10-22 01:53:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T01:53:44Z.


The latest update keeps the accurate same-line overlap description, but the code still calls the old helper and the checklist still says Depends on: none. Please agree the order with #8729’s author, record any required predecessor, then update the helper call after the agreed integration and rerun the matrix. The Windows relinker job has now passed along with Ubuntu, macOS x86_64/arm64 and ASAN; product builds are skipped.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6330783054 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9549#issuecomment-6330783054). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T01:53:44Z. --- The latest update keeps the accurate same-line overlap description, but the code still calls the old helper and the checklist still says `Depends on: none`. Please agree the order with #8729’s author, record any required predecessor, then update the helper call after the agreed integration and rerun the matrix. The Windows relinker job has now passed along with Ubuntu, macOS x86_64/arm64 and ASAN; product builds are skipped.
DavidSamir commented 2026-10-22 02:18:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-22T02:18:50Z.


@MarcZX10 thanks. I have asked @hyvvs on #8729 about the order. Their PR is a draft that its author is holding for a decision on nmount and unmount, so I proposed that this one lands first and that #8729 updates the helper name inside const bool sdkStub = ... when it is rebased, which is one word. Until they answer, Depends on: none stays, since this PR does not need #8729.

If they would rather land first, I will rebase this branch onto #8729, call IsSdkInlineSyscallStub, and change Depends on to #8729. I will update this PR as soon as the order is agreed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6331101725 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9549#issuecomment-6331101725). Originally posted by [DavidSamir](https://github.com/DavidSamir) on 2026-10-22T02:18:50Z. --- @MarcZX10 thanks. I have asked @hyvvs on #8729 about the order. Their PR is a draft that its author is holding for a decision on `nmount` and `unmount`, so I proposed that this one lands first and that #8729 updates the helper name inside `const bool sdkStub = ...` when it is rebased, which is one word. Until they answer, `Depends on: none` stays, since this PR does not need #8729. If they would rather land first, I will rebase this branch onto #8729, call `IsSdkInlineSyscallStub`, and change `Depends on` to #8729. I will update this PR as soon as the order is agreed.
MarcZX10 commented 2026-10-22 11:29:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T11:29:14Z.


The #8729 ordering is now settled: its author agrees this PR lands first, then #8729 rebases and adapts the helper call. Depends on: none is correct for this branch. I also built the PR snapshot with the repository relinker-only configuration in /dev/shm and ran ctest -R ^syscall_scanner$: 1/1 passed. git diff --check, current-main conventions and merge-tree pass. One remaining requirement is freshness: the branch is 2 ahead/116 behind current upstream/main 4777caca34 (merge base 94fbb8cea). No intervening main commit changes the scanner paths, but CONTRIBUTING still requires the branch to stay current. Please update and rerun the relinker matrix/focused tests on the resulting head. Hosted Ubuntu, Windows, both macOS architectures and ASAN relinker jobs pass; product builds are skipped.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6339642505 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9549#issuecomment-6339642505). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T11:29:14Z. --- The #8729 ordering is now settled: its author agrees this PR lands first, then #8729 rebases and adapts the helper call. `Depends on: none` is correct for this branch. I also built the PR snapshot with the repository relinker-only configuration in `/dev/shm` and ran `ctest -R ^syscall_scanner$`: 1/1 passed. `git diff --check`, current-main conventions and merge-tree pass. One remaining requirement is freshness: the branch is 2 ahead/116 behind current upstream/main 4777caca34 (merge base 94fbb8cea). No intervening main commit changes the scanner paths, but CONTRIBUTING still requires the branch to stay current. Please update and rerun the relinker matrix/focused tests on the resulting head. Hosted Ubuntu, Windows, both macOS architectures and ASAN relinker jobs pass; product builds are skipped.
MarcZX10 commented 2026-10-22 11:29:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T11:29:15Z.

Review: DISMISSED


The scanner message and negative-control test look sound. I built the PR snapshot with ANYPS5_RELINKER_ONLY=ON, built the relinker and scanner test target, and ran ctest -R ^syscall_scanner$: 1/1 passed. The #8729 author has now agreed this PR lands first, so the prior overlap blocker is resolved and Depends on: none is accurate. I am retaining changes requested only because this branch is 2 ahead/116 behind current upstream/main 4777caca34 (merge base 94fbb8cea). Please update to current main and rerun the focused tests and relinker matrix. Conventions, diff-check and merge-tree pass on the current head; hosted product jobs are skipped.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5613447593 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9549#pullrequestreview-5613447593). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T11:29:15Z. **Review:** DISMISSED --- The scanner message and negative-control test look sound. I built the PR snapshot with `ANYPS5_RELINKER_ONLY=ON`, built the relinker and scanner test target, and ran `ctest -R ^syscall_scanner$`: 1/1 passed. The #8729 author has now agreed this PR lands first, so the prior overlap blocker is resolved and `Depends on: none` is accurate. I am retaining changes requested only because this branch is 2 ahead/116 behind current upstream/main 4777caca34 (merge base 94fbb8cea). Please update to current main and rerun the focused tests and relinker matrix. Conventions, diff-check and merge-tree pass on the current head; hosted product jobs are skipped.
adriadam10 commented 2026-10-26 09:23:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-26T09:23:21Z.

Review: CHANGES_REQUESTED


MarcZX10's CHANGES_REQUESTED (2026-10-22, on this head) is still open, and the queue will not merge past it:

  • Merge order: #10479 is proposed first, this PR second and #10792 third (MarcZX10, 2026-10-25; #10792's author agreed and lists both predecessors). plexerPK proposed this PR first on 2026-10-24. Please confirm one order with the #10479 author. If #10479 goes first, set Depends on: #10479; if this PR goes first, say so in the thread so the other two lists match. The code needs no change either way: whichever lands later adapts the sdkStub expression.
  • Freshness: the branch is 3939 commits behind main. Rebase it and rerun syscall_scanner and the relinker matrix; the scanner paths themselves have no intervening change.

The change itself (sdkStub hoisting, hint text, RequireHint failing without the change) is fine; once the order is recorded and the branch is current this is a merge.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5649808073 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9549#pullrequestreview-5649808073). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-26T09:23:21Z. **Review:** CHANGES_REQUESTED --- MarcZX10's CHANGES_REQUESTED (2026-10-22, on this head) is still open, and the queue will not merge past it: - Merge order: #10479 is proposed first, this PR second and #10792 third (MarcZX10, 2026-10-25; #10792's author agreed and lists both predecessors). plexerPK proposed this PR first on 2026-10-24. Please confirm one order with the #10479 author. If #10479 goes first, set `Depends on: #10479`; if this PR goes first, say so in the thread so the other two lists match. The code needs no change either way: whichever lands later adapts the `sdkStub` expression. - Freshness: the branch is 3939 commits behind `main`. Rebase it and rerun `syscall_scanner` and the relinker matrix; the scanner paths themselves have no intervening change. The change itself (`sdkStub` hoisting, hint text, `RequireHint` failing without the change) is fine; once the order is recorded and the branch is current this is a merge.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!9549
No description provided.