Repository navigation
Conversation
|
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 |
|
Ty for reviewing! Agreed that including 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 The relinker-only Windows build and focused regression tests passed locally. A hosted Windows CI build hasn't been run yet. |
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
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.
|
|
New exact-payload data was added to #8624 after this PR opened: recognizing only the |
|
I've updated the PR description to remove the closing reference to #8624 and clarify that this change only handles I'll keep the PR as a draft pending the maintainers' decision on whether to expand the supported wrappers. |
|
I am reviewing #9549. Its trap-condition change edits the line where this PR renames |
|
@hyvvs, a coordination question on landing order, as @MarcZX10 asked on #9549. #9549 turns the trap condition you rename in ( You have kept this PR as a draft pending a decision on |
|
@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 Happy to proceed with this |
|
Just checking whether maintainers have a direction on extending The conversion measurements and remaining limitations are documented in #8624. I'm happy to implement the full family with the additional tests and documentation if that's the preferred direction. Since this is my first contribution and the repository limits me to one open PR, I'd also appreciate knowing if this approach isn't something maintainers want to accept. In that case, I'll close the draft and focus on another contribution. Thanks! |
|
Closing this draft to free my first-contributor PR slot while the filesystem syscall trap scope remains undecided. The implementation, exact-match tests and measurements are preserved in the branch and in #8624. No runtime filesystem behavior is claimed; this can be revisited if maintainers later approve the opt-in scope. Thanks to everyone who provided measurements and feedback. |
|
Since the maintainers' question is only about scope, here is the implementation so it is ready to apply if they extend the opt-in - no second PR from me. Measured on relinker-only builds: recognising +static constexpr std::array<std::uint8_t, 46> SDK_MOUNT_INLINE{
+ 0x55, 0x48, 0x89, 0xE5, 0x41, 0x56, 0x53, 0x48, 0x63, 0xD2, 0x31, 0xDB,
+ 0xB8, 0x00, 0x00, 0x00, 0x00, 0x49, 0x89, 0xCA, 0x45, 0x31, 0xC0, 0x45, 0x31, 0xC9,
+ 0x0F, 0x05, 0x0F, 0x93, 0xC1, 0x49, 0x89, 0xC6, 0x49, 0xF7, 0xDE, 0x84, 0xC9,
+ 0x4C, 0x0F, 0x45, 0xF0, 0x4D, 0x85, 0xF6,
+};
+
+static constexpr std::array<std::uint8_t, 48> SDK_NMOUNT_INLINE{
+ 0x55, 0x48, 0x89, 0xE5, 0x41, 0x56, 0x53, 0x89, 0xF6, 0x48, 0x63, 0xD2, 0x31, 0xDB,
+ 0xB8, 0x00, 0x00, 0x00, 0x00, 0x45, 0x31, 0xD2, 0x45, 0x31, 0xC0, 0x45, 0x31, 0xC9,
+ 0x0F, 0x05, 0x0F, 0x93, 0xC1, 0x49, 0x89, 0xC6, 0x49, 0xF7, 0xDE, 0x84, 0xC9,
+ 0x4C, 0x0F, 0x45, 0xF0, 0x4D, 0x85, 0xF6,
+};
+
+static constexpr std::array<std::uint8_t, 48> SDK_UNMOUNT_INLINE{
+ 0x55, 0x48, 0x89, 0xE5, 0x41, 0x56, 0x53, 0x48, 0x63, 0xF6, 0x31, 0xDB,
+ 0xB8, 0x00, 0x00, 0x00, 0x00, 0x31, 0xD2, 0x45, 0x31, 0xD2, 0x45, 0x31, 0xC0, 0x45, 0x31, 0xC9,
+ 0x0F, 0x05, 0x0F, 0x93, 0xC1, 0x49, 0x89, 0xC6, 0x49, 0xF7, 0xDE, 0x84, 0xC9,
+ 0x4C, 0x0F, 0x45, 0xF0, 0x4D, 0x85, 0xF6,
+};
-static bool MatchesSdkInlineStub(..., FileByteOffset codeOffset) {
+static bool MatchesSdkInlineStub(..., FileByteOffset codeOffset, std::size_t maskOffset = TSize, std::size_t maskLength = 0) {
if (syscallOffset < beforeSyscall || syscallOffset > limit) return false;
const auto start = syscallOffset - beforeSyscall;
- if (pattern.size() > limit - start || !std::equal(...)) return false;
+ if (pattern.size() > limit - start) return false;
+ for (std::size_t i = 0; i < pattern.size(); ++i) {
+ if (i >= maskOffset && i < maskOffset + maskLength) continue;
+ if (code[start + i] != pattern[i]) return false;
+ }
return recent.Contains(codeOffset + start);
}and the three call sites (the mount masks + || MatchesSdkInlineStub(code, syscallOffset, limit, SDK_MOUNT_INLINE, 26, recent, codeOffset, 13, 4)
+ || MatchesSdkInlineStub(code, syscallOffset, limit, SDK_NMOUNT_INLINE, 28, recent, codeOffset, 15, 4)
+ || MatchesSdkInlineStub(code, syscallOffset, limit, SDK_UNMOUNT_INLINE, 28, recent, codeOffset, 13, 4);Fixtures: Nothing else changes: the decoded-instruction-boundary check, the full-sequence requirement, the AI-assisted: yes |
Recognize the inlined __syscall6 wrappers of ps5-payload-dev SDK libc/mount.c (mount, nmount, unmount) under --trap-sdk-syscall-stubs, with the four-byte syscall number immediate masked so an SDK build that renumbers the call still matches. The three wrappers differ in argument preparation, so each sequence is matched separately. Observed in ftpsrv v0.21.1 (0x709a, 0x70ec, 0x713c) and websrv v0.35 (0xae6a, 0xaebc, 0xaf0c). Related: issue boykopovar#8624, open draft PR boykopovar#8729 covers mount only.
Recognize the inlined __syscall6 wrappers of ps5-payload-dev SDK libc/mount.c (mount, nmount, unmount) under --trap-sdk-syscall-stubs, with the four-byte syscall number immediate masked so an SDK build that renumbers the call still matches. The three wrappers differ in argument preparation, so each sequence is matched separately. Observed in ftpsrv v0.21.1 (0x709a, 0x70ec, 0x713c) and websrv v0.35 (0xae6a, 0xaebc, 0xaf0c). Related: issue boykopovar#8624, open draft PR boykopovar#8729 covers mount only.
Recognize the inlined __syscall6 wrappers of ps5-payload-dev SDK libc/mount.c (mount, nmount, unmount) under --trap-sdk-syscall-stubs, with the four-byte syscall number immediate masked so an SDK build that renumbers the call still matches. The three wrappers differ in argument preparation, so each sequence is matched separately. Observed in ftpsrv v0.21.1 (0x709a, 0x70ec, 0x713c) and websrv v0.35 (0xae6a, 0xaebc, 0xaf0c). Related: issue boykopovar#8624, open draft PR boykopovar#8729 covers mount only.
Recognize the inlined __syscall6 wrappers of ps5-payload-dev SDK libc/mount.c (mount, nmount, unmount) under --trap-sdk-syscall-stubs, with the four-byte syscall number immediate masked so an SDK build that renumbers the call still matches. The three wrappers differ in argument preparation, so each sequence is matched separately. Observed in ftpsrv v0.21.1 (0x709a, 0x70ec, 0x713c) and websrv v0.35 (0xae6a, 0xaebc, 0xaf0c). Related: issue boykopovar#8624, open draft PR boykopovar#8729 covers mount only.
Recognize the inlined __syscall6 wrappers of ps5-payload-dev SDK libc/mount.c (mount, nmount, unmount) under --trap-sdk-syscall-stubs, with the four-byte syscall number immediate masked so an SDK build that renumbers the call still matches. The three wrappers differ in argument preparation, so each sequence is matched separately. Observed in ftpsrv v0.21.1 (0x709a, 0x70ec, 0x713c) and websrv v0.35 (0xae6a, 0xaebc, 0xaf0c). Related: issue boykopovar#8624, open draft PR boykopovar#8729 covers mount only.
Recognize the inlined __syscall6 wrappers of ps5-payload-dev SDK libc/mount.c (mount, nmount, unmount) under --trap-sdk-syscall-stubs, with the four-byte syscall number immediate masked so an SDK build that renumbers the call still matches. The three wrappers differ in argument preparation, so each sequence is matched separately. Observed in ftpsrv v0.21.1 (0x709a, 0x70ec, 0x713c) and websrv v0.35 (0xae6a, 0xaebc, 0xaf0c). Related: issue boykopovar#8624, open draft PR boykopovar#8729 covers mount only.
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)