kernel, ksud, manager: implement uapi version check#3455
Open
AlexLiuDev233 wants to merge 8 commits intotiann:mainfrom
Open
kernel, ksud, manager: implement uapi version check#3455AlexLiuDev233 wants to merge 8 commits intotiann:mainfrom
AlexLiuDev233 wants to merge 8 commits intotiann:mainfrom
Conversation
We always have an problem: We should keep forward compatibility in uapi, or users may face problem e.g: new sepolicy api (tiann@b98c05e) new allowlist api (tiann@9f68f23) They all resulted in varying degrees of functional impairment and severely impacted the user experience. For example new sepolicy api cause some modules looks "working", but actually not, them sepolicy.rule haven't be loaded. new allowlist api cause manager show "0 SuperUsers" That's cause by userspace version mismatch with kernel version This pull request implement an uapi check, when userspace see uapi version mismatch with kernel's uapi version ksud will stop handle post_fs_data, services, boot_completed and more manager will show "incompatible kernel" warning card This gives users a clear indication: they messed up, either using an older version of the manager with the new kernel or trying to make the new manager work with an older kernel. To prevent users from sending invalid bug reports to the module developer/us due to their own issues. Signed-off-by: AlexLiuDev233 <wzylin11@outlook.com>
Signed-off-by: AlexLiuDev233 <wzylin11@outlook.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a kernel↔userspace UAPI compatibility check so ksud can skip init stages when the kernel/userspace UAPI versions don’t match, and the manager can surface an incompatibility warning to reduce confusing partial-breakage scenarios.
Changes:
- Extend GET_INFO UAPI to include
uapi_versionand expose it in kernel,ksud,ksuinit, and manager JNI. - Gate
ksudinit stages (post-fs-data,services,boot_completed,soft_reboot) on UAPI match. - Update manager UI strings and warning-card logic to prompt kernel/manager upgrades.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| userspace/ksuinit/src/lib.rs | Extends GET_INFO struct to include uapi_version. |
| userspace/ksud/src/ksucalls.rs | Adds uapi_version field and mismatch helper. |
| userspace/ksud/src/init_event.rs | Skips init stages when UAPI mismatch is detected; adds error logging. |
| uapi/supercall.h | Defines KERNEL_SU_UAPI_VERSION and adds uapi_version to ksu_get_info_cmd. |
| manager/app/src/main/res/values/strings.xml | Adds “require manager version” warning string. |
| manager/app/src/main/res/values-zh-rCN/strings.xml | Adds Chinese translation for the new warning string. |
| manager/app/src/main/java/me/weishu/kernelsu/ui/screen/home/HomeMiuix.kt | Adjusts warning card selection logic for kernel/manager incompatibility messaging. |
| manager/app/src/main/java/me/weishu/kernelsu/ui/screen/home/HomeMaterial.kt | Adjusts warning card selection logic for kernel/manager incompatibility messaging. |
| manager/app/src/main/java/me/weishu/kernelsu/Natives.kt | Adds checkUAPIMismatch() and uses it in requireNewKernel(). |
| manager/app/src/main/cpp/ksu.h | Declares native helper to detect UAPI mismatch. |
| manager/app/src/main/cpp/ksu.cc | Implements UAPI mismatch check via GET_INFO uapi_version. |
| manager/app/src/main/cpp/jni.cc | Exposes checkUAPIMismatch() via JNI. |
| kernel/supercall/dispatch.c | Populates GET_INFO uapi_version. |
| kernel/build-all.sh | Adjusts build invocation and working directory behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: AlexLiuDev233 <wzylin11@outlook.com>
Contributor
|
you can split flags if you want to keep struct size / backwards compat to flags first, api second, as android ARM64 is little endian you can also carve it differently, but we need bitfields, but im not sure how other languages will handle this. |
backslashxx
added a commit
to backslashxx/ksu_toolkit
that referenced
this pull request
May 8, 2026
|
Nice l |
…eak ABI stable for ksu_get_info_cmd Signed-off-by: AlexLiuDev233 <wzylin11@outlook.com>
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.
We always have an problem:
We should keep forward compatibility in uapi, or users may face problem
e.g:
new sepolicy api (b98c05e)
new allowlist api (9f68f23)
They all resulted in varying degrees of functional impairment and severely impacted the user experience.
For example
new sepolicy api cause some modules looks "working", but actually not, them sepolicy.rule haven't be loaded.
new allowlist api cause manager show "0 SuperUsers"
That's cause by userspace version mismatch with kernel version
This pull request implement an uapi check, when userspace see uapi version mismatch with kernel's uapi version
ksud will stop handle post_fs_data, services, boot_completed and more
manager will show "incompatible kernel" warning card
This gives users a clear indication: they messed up,
either using an older version of the manager with the new kernel
or trying to make the new manager work with an older kernel.
To prevent users from sending invalid bug reports to the module developer/us due to their own issues.