Skip to content

kernel: add syscall dispatcher patching for x64#3562

Merged
5ec1cff merged 4 commits into
mainfrom
x64patch
Jul 11, 2026
Merged

kernel: add syscall dispatcher patching for x64#3562
5ec1cff merged 4 commits into
mainfrom
x64patch

Conversation

@5ec1cff

@5ec1cff 5ec1cff commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator
  • Patch syscall dispatcher on x64 to make tracepoint syscall redirection work
  • Update documentation of x86_64 support and add translation by copilot

@5ec1cff

5ec1cff commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

@hmtheboy154 Would you mind testing this?

@hmtheboy154

Copy link
Copy Markdown
Contributor

@hmtheboy154 Would you mind testing this?

will do. But I haven't setup LKM yet. This can still applied on GKI mode right ?

@5ec1cff

5ec1cff commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

will do. But I haven't setup LKM yet. This can still applied on GKI mode right ?

Yes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces an optional x86_64-only mechanism to dynamically patch the hardened syscall dispatcher at runtime, aiming to keep KernelSU’s syscall hook working without requiring a kernel source patch (useful for LKM mode).

Changes:

  • Add a new Kconfig option to enable dynamic patching of the x86_64 syscall dispatcher.
  • Add a build flag for the option and implement runtime patching/restoration of x64_sys_call (and do_syscall_64 on older kernels).
  • Relax an x86_64 init-time CPU feature check when the dynamic patching mode is enabled.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
kernel/Kconfig Adds a new configuration option for x86_64 syscall-dispatcher patching.
kernel/Kbuild Adds conditional compile flags for the new option.
kernel/hook/x86_64/syscall_hook.c Implements patching/restoration logic for the x86_64 syscall dispatcher paths.
kernel/hook/patch_memory.h Adjusts x86_64 includes used by the patching/hook code.
kernel/core/init.c Skips the x86_64 INDIRECT_SAFE gate when dispatcher patching is enabled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread kernel/Kconfig Outdated
Comment thread kernel/Kbuild Outdated
Comment thread kernel/hook/x86_64/syscall_hook.c Outdated
Comment thread kernel/hook/x86_64/syscall_hook.c
Comment thread kernel/hook/x86_64/syscall_hook.c
Comment thread kernel/hook/x86_64/syscall_hook.c Outdated
Comment thread kernel/hook/x86_64/syscall_hook.c
@5ec1cff 5ec1cff changed the title kernel: add x64_sys_call patching kernel: add syscall dispatcher patching for x64 Jul 11, 2026
@5ec1cff 5ec1cff merged commit dbff91c into main Jul 11, 2026
19 checks passed
@5ec1cff 5ec1cff deleted the x64patch branch July 11, 2026 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants