Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors KernelSU’s sucompat flow in the kernel (centralizing syscall handling and switching su execution to an execveat-based path), while aligning ksud’s userspace install/restorecon labeling to use the KernelSU SELinux file context.
Changes:
- Userspace: relabel
/data/adb/ksudtou:object_r:ksu_file:s0during install and restorecon. - Kernel: refactor
sucompathooks so handlers perform the original syscall invocation internally (and implementsu -> ksudredirection usingexecveatwithAT_EMPTY_PATH). - Kernel: introduce a
ksu_close_fdhelper header and adopt it in a couple of call sites to simplify kernel-version conditionals.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| userspace/ksud/src/utils.rs | Updates install-time SELinux relabeling for ksud to use the KernelSU file context. |
| userspace/ksud/src/restorecon.rs | Renames/updates the SELinux context constant used when labeling the daemon path. |
| kernel/supercall/supercall.c | Switches fd-close logic to use the new ksu_close_fd helper. |
| kernel/policy/app_profile.c | Simplifies capability setup by mirroring the profile’s effective caps directly. |
| kernel/infra/su_mount_ns.c | Switches fd-close logic to use the new ksu_close_fd helper. |
| kernel/include/util.h | Adds a helper intended to abstract fd closing across kernel versions. |
| kernel/hook/syscall_event_bridge.c | Routes newfstatat/faccessat through the new sucompat handler entry points. |
| kernel/feature/sucompat.h | Updates exported handler APIs to accept (orig_nr, pt_regs*) style entry points. |
| kernel/feature/sucompat.c | Implements the refactored sucompat logic, including su -> ksud redirection via execveat. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3 tasks
backslashxx
added a commit
to backslashxx/KernelSU
that referenced
this pull request
Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
supath toksud./data/adb/ksudto exist in caller's root, so chrooted process won't be affected unexpectedly.