Skip to content

feat: add late-load mode support#3258

Merged
tiann merged 19 commits intomainfrom
late-load
Mar 11, 2026
Merged

feat: add late-load mode support#3258
tiann merged 19 commits intomainfrom
late-load

Conversation

@tiann
Copy link
Owner

@tiann tiann commented Mar 8, 2026

No description provided.

@Ylarod Ylarod changed the title Late load mode feat: add late-load mode support Mar 11, 2026
@Ylarod Ylarod changed the title feat: add late-load mode support feat(kernel & ksud): add late-load mode support Mar 11, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a “late-load” mode so KernelSU can be loaded and initialized after Android has fully booted (primarily for LKM workflows), and documents how modules/scripts behave in that mode.

Changes:

  • Add ksud late-load command to load kernelsu.ko from embedded assets (by KMI) and run late-load + normal module stages.
  • Extend kernel/userspace signaling for late-load via get_info().flags (0x4) and expose it to scripts via KSU_LATE_LOAD=1.
  • Document late-load behavior and script ordering across multiple website locales.

Reviewed changes

Copilot reviewed 26 out of 28 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
website/docs/guide/module.md Adds late-load mode documentation (EN).
website/docs/zh_CN/guide/module.md Adds late-load mode documentation (zh_CN).
website/docs/zh_TW/guide/module.md Adds late-load mode documentation (zh_TW).
website/docs/vi_VN/guide/module.md Adds late-load mode documentation (vi_VN).
website/docs/ru_RU/guide/module.md Adds late-load mode documentation (ru_RU).
website/docs/pt_BR/guide/module.md Adds late-load mode documentation (pt_BR).
website/docs/ja_JP/guide/module.md Adds late-load mode documentation (ja_JP).
website/docs/id_ID/guide/module.md Adds late-load mode documentation (id_ID).
userspace/ksuinit/src/main.rs Removes unused loader module reference from ksuinit binary.
userspace/ksuinit/src/lib.rs Refactors module loading to accept in-memory bytes + adds KernelSU presence detection helpers.
userspace/ksuinit/src/init.rs Switches init-time module loading to use the new in-memory loader API.
userspace/ksuinit/Cargo.toml Dependency comment cleanup (no functional change).
userspace/ksuinit/Cargo.lock Updates locked libc version for ksuinit.
userspace/ksud/src/module.rs Adds KSU_LATE_LOAD=1 env injection when kernel reports late-load mode.
userspace/ksud/src/main.rs Registers new late_load module.
userspace/ksud/src/late_load.rs Implements ksud late-load command flow (load ko + run stages).
userspace/ksud/src/ksucalls.rs Adds is_late_load() flag accessor.
userspace/ksud/src/init_event.rs Makes run_stage public for reuse by late-load command.
userspace/ksud/src/cli.rs Adds LateLoad subcommand wiring.
userspace/ksud/src/assets.rs Adds get_asset_data() for in-memory asset access; refactors copy helper.
userspace/ksud/Cargo.toml Adds path dependency on ksuinit crate.
userspace/ksud/Cargo.lock Locks new transitive deps (via ksuinit) and rustix version split.
kernel/supercalls.h Documents late-load bit in get_info flags.
kernel/supercalls.c Exposes late-load flag and skips boot events when late-loaded.
kernel/selinux/rules.c Resets AVC cache after applying KernelSU rules (important for late-load).
kernel/ksud.c Disables kernel safe-mode detection when late-loaded.
kernel/ksu.h Exposes ksu_late_loaded as a global.
kernel/ksu.c Detects late-load based on PID for MODULE builds; adjusts init/exit flow accordingly.

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

@tiann tiann changed the title feat(kernel & ksud): add late-load mode support feat: add late-load mode support Mar 11, 2026
@tiann tiann merged commit f0615d3 into main Mar 11, 2026
20 checks passed
@tiann tiann deleted the late-load branch March 11, 2026 05:06
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request Mar 11, 2026
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request Mar 11, 2026
AlexLiuDev233 added a commit to ReSukiSU/ReSukiSU that referenced this pull request Mar 11, 2026
[cherry-picked from upstream commit tiann/KernelSU@f0615d3]

Co-authored-by: AlexLiuDev233 <wzylin11@outlook.com>
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
Signed-off-by: AlexLiuDev233 <wzylin11@outlook.com>
AlexLiuDev233 added a commit to ReSukiSU/ReSukiSU that referenced this pull request Mar 11, 2026
[cherry-picked from upstream commit tiann/KernelSU@f0615d3]

Co-authored-by: AlexLiuDev233 <wzylin11@outlook.com>
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
Signed-off-by: AlexLiuDev233 <wzylin11@outlook.com>
5ec1cff pushed a commit to 5ec1cff/KernelSU that referenced this pull request Mar 11, 2026
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
5ec1cff pushed a commit to 5ec1cff/KernelSU that referenced this pull request Mar 11, 2026
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
Anatdx pushed a commit to Anatdx/YukiSU that referenced this pull request Mar 11, 2026
[cherry-picked from upstream commit tiann/KernelSU@f0615d3]

Co-authored-by: AlexLiuDev233 <wzylin11@outlook.com>
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
Signed-off-by: AlexLiuDev233 <wzylin11@outlook.com>
(cherry picked from commit b14bd99d86710d4b2e62367bd0158657509a161b)
pershoot pushed a commit to pershoot/KernelSU-Next that referenced this pull request Mar 14, 2026
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
pershoot pushed a commit to pershoot/KernelSU-Next that referenced this pull request Mar 14, 2026
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Mar 14, 2026
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Mar 15, 2026
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
Flopster101 added a commit to FlopKernel-Series/flop_s5e8825_kernel that referenced this pull request Mar 15, 2026
033b60b5ce9f kernel: Fix RLIMIT_NPROC leak on root escape (#3286)
08d92684ab35 manager: trying fix ksud not release
daf724ef201b manager: unify Haze effect and refactor theme initialization
9deec27c577e manager: simplify kernel version requirements and cleanup UI
05387a745167 manager: bump MINIMAL_SUPPORTED_KERNEL to 34634
b338b1a69172 manager: enable ABI splits only for release builds
5c29099fa848 manager: enable ABI splits in manager app (#108)
ed234d64178d ci: try adjust build options (#107)
7c761877409d manager: update prebuilt susfs binary
8b046a529d97 manager: Add soft reboot (tiann/KernelSU#3272)
436d3330c6ff kernel, ksud, manager: jailbreak by Magica (tiann/KernelSU#3268)
1dc3f9c9cc4f kernel,CI(ddk): Enable multi manager support
adecabe77beb kernel: comment grammar fix (#101)
f1bfd0c27554 manager: sync translation from Crowdin (#26)
529c226a6a18 issue_template: add kernel version & hook type fields with auto-labeling (#98)
5a09074f0642 manager: fix padding issue
d5eead33aa7e kernel: enforcing selinux at late-load mode
ffa2be86d44a userspace: make cargofmt happy
5b9fee7ee7bd kernel: make clang format happy
b14bd99d8671 kernel, ksud, manager: add late-load mode support (tiann/KernelSU#3258)
96dc5fea947d kernel: use ksu_hook_init/ksu_hook_exit define for hooks init/exit
bc016ab8a966 kernel: refine stackprotector workaround (tiann/KernelSU#3264)
852483cc268f kernel: use an more clearly name for apk_sign_keys
5a22f75f0d0c kernel: add support for kowsu
5c9e92108aba kernel: deprecate set android_data_root_path/sdcard_root_path susfs cmd
301e21406493 kernel: update susfs kconfig descriptions
fca8d7e3d1a9 kernel: fix susfs_run_sus_path_loop() not executing when kernel umount is disabled
f593e7bc1f2b kernel: Only check CONFIG_STACKPROTECTOR_PER_TASK on arm64 (tiann/KernelSU#3263)
946524b3cb96 docs: add new icon assets and update README references (#95)
2f014aeadf8e build(deps): bump libc from 0.2.182 to 0.2.183 in /userspace/ksud in the crates group (#94)
2c10f6a63780 build(deps): bump libc from 0.2.182 to 0.2.183 in /userspace/ksuinit in the crates group (#93)
5c2497958910 kernel: ifdef MODULE for __stack_chk_guard
f110040091c2 kernel: add missing attribute
adbf01625215 manager: prevent duplicate push and rapid pop in Navigator
3bca52630fa4 manager: Implement new About and Open Source License screens
b7134ca4c616 ksud: Correctly fix command's args
2fcb4587a5e8 kernel: Provide own stackprotector symbol if necessary
ee7e986d35ce ksud: removed rustfmt rules
a4bdaf117b2e manager: fix Anykernel3 external install failed
b09dea678d02 manager: Refactor SearchAppBar and improve scroll behavior
f4d81094c3ea manager: Fix scale animation direction for right-edge predictive back gestures
8355009fbe00 build(deps): bump the maven group across 1 directory with 9 updates (#90)
d32e9e8bf558 ksud & ksuinit: fix wrong GetInfoCmd struct (tiann/KernelSU#3256)
b48f40e03886 manager: Refactor custom background handling and predictive back transitions
83cd225ab3c9 manager: fix custom background not shown
6675346ea3b0 build(deps): bump quote from 1.0.44 to 1.0.45 in /userspace/ksuinit in the crates group (#87)
cac73d730b18 build(deps): bump the crates group in /userspace/ksud with 2 updates (#89)
ae3cb5366275 manager: Refactor navigation to Navigation3 and implement predictive back animation
ce7ba3bf9a8e chore(deps): bump deps
47167aa71e1d build(deps): bump the crates group in /userspace/ksud with 2 updates (#86)
bcee1d69fa18 build(deps): bump the actions group with 2 updates (#84)
1fc451141fca Revert "kernel: drop bitmap, always search manager when packages.list change"
ff9ac08c60b6 kernel: Use ksu cred to save allowlist (tiann/KernelSU#3243)
d8fd9e81c258 kernel: drop bitmap, always search manager when packages.list change
738e51932c67 workflow: use ndk for clippy
32bc4c166ec4 issus_template: add manager relevant label

git-subtree-dir: drivers/sukisu
git-subtree-split: 033b60b5ce9fcc75a60f92de16c1eb596eacef49
pershoot pushed a commit to pershoot/KernelSU-Next that referenced this pull request Mar 15, 2026
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Mar 15, 2026
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
Flopster101 added a commit to FlopKernel-Series/flop_trinket-mi_kernel that referenced this pull request Mar 15, 2026
941ad6e1f407 ksud: magica: Set uid in forked process (tiann/KernelSU#3296)
50c75d0f94e3 manager: use reflection to reset and initialize MainShell in KsuCli
7c867bbd05c0 manager: fix wrongly metamodule warning
243c36552b97 ksud: allow metamodule is disbale
8743600c2dea script(ksubot.py): fix "<>" format error
eeaae63ca326 ksud: magica: use minify adb_client (tiann#3292)
2578cc296e54 ci: Migrate to python-telegram-bot & message handling improvements (#109)
6817076f5c62 manager: implement unofficial manager warning
033b60b5ce9f kernel: Fix RLIMIT_NPROC leak on root escape (#3286)
08d92684ab35 manager: trying fix ksud not release
daf724ef201b manager: unify Haze effect and refactor theme initialization
9deec27c577e manager: simplify kernel version requirements and cleanup UI
05387a745167 manager: bump MINIMAL_SUPPORTED_KERNEL to 34634
b338b1a69172 manager: enable ABI splits only for release builds
5c29099fa848 manager: enable ABI splits in manager app (#108)
ed234d64178d ci: try adjust build options (#107)
7c761877409d manager: update prebuilt susfs binary
8b046a529d97 manager: Add soft reboot (tiann/KernelSU#3272)
436d3330c6ff kernel, ksud, manager: jailbreak by Magica (tiann/KernelSU#3268)
1dc3f9c9cc4f kernel,CI(ddk): Enable multi manager support
adecabe77beb kernel: comment grammar fix (#101)
f1bfd0c27554 manager: sync translation from Crowdin (#26)
529c226a6a18 issue_template: add kernel version & hook type fields with auto-labeling (#98)
5a09074f0642 manager: fix padding issue
d5eead33aa7e kernel: enforcing selinux at late-load mode
ffa2be86d44a userspace: make cargofmt happy
5b9fee7ee7bd kernel: make clang format happy
b14bd99d8671 kernel, ksud, manager: add late-load mode support (tiann/KernelSU#3258)
96dc5fea947d kernel: use ksu_hook_init/ksu_hook_exit define for hooks init/exit
bc016ab8a966 kernel: refine stackprotector workaround (tiann/KernelSU#3264)
852483cc268f kernel: use an more clearly name for apk_sign_keys
5a22f75f0d0c kernel: add support for kowsu
5c9e92108aba kernel: deprecate set android_data_root_path/sdcard_root_path susfs cmd
301e21406493 kernel: update susfs kconfig descriptions
fca8d7e3d1a9 kernel: fix susfs_run_sus_path_loop() not executing when kernel umount is disabled
f593e7bc1f2b kernel: Only check CONFIG_STACKPROTECTOR_PER_TASK on arm64 (tiann/KernelSU#3263)
946524b3cb96 docs: add new icon assets and update README references (#95)
2f014aeadf8e build(deps): bump libc from 0.2.182 to 0.2.183 in /userspace/ksud in the crates group (#94)
2c10f6a63780 build(deps): bump libc from 0.2.182 to 0.2.183 in /userspace/ksuinit in the crates group (#93)
5c2497958910 kernel: ifdef MODULE for __stack_chk_guard
f110040091c2 kernel: add missing attribute
adbf01625215 manager: prevent duplicate push and rapid pop in Navigator
3bca52630fa4 manager: Implement new About and Open Source License screens
b7134ca4c616 ksud: Correctly fix command's args
2fcb4587a5e8 kernel: Provide own stackprotector symbol if necessary
ee7e986d35ce ksud: removed rustfmt rules
a4bdaf117b2e manager: fix Anykernel3 external install failed
b09dea678d02 manager: Refactor SearchAppBar and improve scroll behavior
f4d81094c3ea manager: Fix scale animation direction for right-edge predictive back gestures
8355009fbe00 build(deps): bump the maven group across 1 directory with 9 updates (#90)
d32e9e8bf558 ksud & ksuinit: fix wrong GetInfoCmd struct (tiann/KernelSU#3256)
b48f40e03886 manager: Refactor custom background handling and predictive back transitions
83cd225ab3c9 manager: fix custom background not shown
6675346ea3b0 build(deps): bump quote from 1.0.44 to 1.0.45 in /userspace/ksuinit in the crates group (#87)
cac73d730b18 build(deps): bump the crates group in /userspace/ksud with 2 updates (#89)
ae3cb5366275 manager: Refactor navigation to Navigation3 and implement predictive back animation
ce7ba3bf9a8e chore(deps): bump deps
47167aa71e1d build(deps): bump the crates group in /userspace/ksud with 2 updates (#86)
bcee1d69fa18 build(deps): bump the actions group with 2 updates (#84)
1fc451141fca Revert "kernel: drop bitmap, always search manager when packages.list change"
ff9ac08c60b6 kernel: Use ksu cred to save allowlist (tiann/KernelSU#3243)
d8fd9e81c258 kernel: drop bitmap, always search manager when packages.list change
738e51932c67 workflow: use ndk for clippy
32bc4c166ec4 issus_template: add manager relevant label

git-subtree-dir: drivers/sukisu
git-subtree-split: 941ad6e1f407e27fee7edc66d8076bff273c4ec9
rifsxd pushed a commit to KernelSU-Next/KernelSU-Next that referenced this pull request Mar 15, 2026
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
TheMysticle pushed a commit to crdroidandroid/android_kernel_xiaomi_sm8550 that referenced this pull request Mar 20, 2026
Co-Authored-By: Ylarod <me@ylarod.cn>
Co-Authored-By: Wang Han <416810799@qq.com>
bcrtvkcs pushed a commit to bcrtvkcs/KernelSU-Next that referenced this pull request Mar 23, 2026
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
bcrtvkcs pushed a commit to bcrtvkcs/KernelSU-Next that referenced this pull request Mar 23, 2026
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
ziomek3120 pushed a commit to ziomek3120/android_kernel_oneplus_sm8750 that referenced this pull request Mar 23, 2026
Co-Authored-By: Ylarod <me@ylarod.cn>
Co-Authored-By: Wang Han <416810799@qq.com>
maxsteeel pushed a commit to maxsteeel/KernelSU-Next that referenced this pull request Mar 24, 2026
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
maxsteeel pushed a commit to KernelSU-Next/KernelSU-Next that referenced this pull request Mar 24, 2026
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
gavdoc38 added a commit to gavdoc38/KernelSU-Next that referenced this pull request Mar 24, 2026
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
fukazzz pushed a commit to fukazzz/KernelSU-Next that referenced this pull request Mar 24, 2026
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
fukazzz pushed a commit to fukazzz/KernelSU-Next that referenced this pull request Mar 24, 2026
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
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.

4 participants