How tiann/kernelsu works
KernelSU is an Android kernel-based root solution, with an Android manager and a companion userspace daemon. The main flow is a manager or privileged app requesting root or configuration through the shared ioctl interface; kernel dispatch applies access policy and performs the requested operation. The repository also documents metamodules and app profiles, and includes boot/init integration, SELinux controls, and a superuser log. Edges reflect README statements or relationships named in sampled files; unsampled feature wiring is left unverified.
Main entry points: dispatch.c Supercall dispatch · init.c Kernel init · main.rs Daemon entry · ksud_integration.c Boot integration
Components 19
Kernel runtime
- Kernel init
kernel/core/init.c - Syscall hooks
kernel/hook/syscall_hook_manager.c - Supercall dispatch
kernel/supercall/dispatch.c - Root policy
kernel/policy/allowlist.c - Boot integration
kernel/runtime/ksud_integration.c - Kernel API
uapi/supercall.h
Userspace daemon
- Daemon CLI
userspace/ksud/src/cli.rs - Daemon entry
userspace/ksud/src/main.rs
Android manager
- Manager app
manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt - Native bridge
manager/app/src/main/cpp/jni.cc - Manager service
manager/app/src/main/java/me/weishu/kernelsu/ui/KsuService.kt - Web interface
manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebUIScreen.kt
Root capabilities
- Metamodules
userspace/ksud/src/metamodule.rs - Module system
userspace/ksud/src/module.rs - App profiles
kernel/policy/app_profile.c - SELinux controls
kernel/selinux/sepolicy.c - SELinux hiding
kernel/feature/selinux_hide.c - Superuser log
kernel/sulog/event.c
Other components
- Android user
Connections 18
- Android user → Manager app: manages root
- Manager app → Native bridge: uses bridge
- Native bridge → Kernel API: requests operations
- Daemon entry → Daemon CLI: dispatches
userspace/ksud/src/main.rs - Daemon CLI → Kernel API: issues commands
- Kernel init → Syscall hooks: initializes
kernel/core/init.c - Kernel init → Supercall dispatch: initializes
kernel/core/init.c - Supercall dispatch → Root policy: checks policy
kernel/supercall/dispatch.c - Supercall dispatch → App profiles: handles profiles
kernel/supercall/dispatch.c - Supercall dispatch → SELinux controls: sets policy
kernel/supercall/dispatch.c - Supercall dispatch → Superuser log: installs log fd
kernel/supercall/dispatch.c - Kernel init → SELinux controls: references controls
kernel/core/init.c - Kernel init → Boot integration: initializes
kernel/core/init.c - Boot integration → SELinux hiding: uses feature
kernel/runtime/ksud_integration.c - Daemon entry → Metamodules: includes subsystem
userspace/ksud/src/main.rs - Daemon entry → Module system: includes subsystem
userspace/ksud/src/main.rs - Android user → Manager service: uses root service
- Android user → Web interface: opens interface