Commit Graph

64 Commits

Author SHA1 Message Date
backslashxx
029ae8d389 kernel: expose umount list to ioctl interface (#2950)
This idea is borrowed from simonpunk's susfs4ksu.
What we see here is that, yeah well, lets just have userspace send us
what it
wants unmounted, this is better than hardcoding everything.

This also solves that issue where MNT_DETACH fails, as long as we send
unmountables in proper order.

A small anti-duplicate mechanism is also added.

While in-kernel umount is a bit worse than zygisk-provider-based ones,
this can still
serve as a healthy alternative.

---------

- Remove duplicate checks

Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
Co-authored-by: weishu <twsxtd@gmail.com>
Co-authored-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
2025-11-18 12:36:42 +08:00
weishu
94fa1e360a ksud: Add cli interface for nuke_ext4_sysfs 2025-11-18 12:15:49 +08:00
生于生时 亡于亡刻
92a483d222 ksud: Optimise ksud (#576)
* opt: Optimize printing for result isn't successful
- print chain && backtrace to stderr

Signed-off-by: Tools-app <localhost.hutao@gmail.com>

* ci(ksud): add CARGO_TERM_COLOR for build

Signed-off-by: Tools-app <localhost.hutao@gmail.com>

* fix(ksud): fix uninstall package name is `me.weishu.kernelsu`

Signed-off-by: Tools-app <localhost.hutao@gmail.com>

* fix(ksud): Reverted to a private function for get_kernel_version

Signed-off-by: Tools-app <localhost.hutao@gmail.com>

* chore: format code for magic_mount.rs

Signed-off-by: Tools-app <localhost.hutao@gmail.com>

* fix: fix rustfmt

Signed-off-by: Tools-app <localhost.hutao@gmail.com>

* feat: Move the statement to the correct place && remove allow dead_code

Signed-off-by: Tools-app <localhost.hutao@gmail.com>

---------

Signed-off-by: Tools-app <localhost.hutao@gmail.com>
2025-11-15 18:25:17 +08:00
ShirkNeko
5ce6c210c4 manager: install: add choose partition support
manager: fix KsuCli cmd

userspace: reuse choose_boot_device

- manager: simplify find boot image

Co-authored-by: weishu <twsxtd@gmail.com>
Co-authored-by: YuKongA <70465933+YuKongA@users.noreply.github.com>
Co-authored-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
2025-11-11 15:16:11 +08:00
ShirkNeko
548258f922 kernel: Rewrite the kernel source code (#554)
* clean unused header

* on_module_mounted in ksud.c

* refact: use app_profile

* unified hook manager

* add zygote to hook target

* move reboot hook to supercall.c

* refactor: kernel_umount setuid_hook

* update mark rules, add init mark tracker

* remove reboot from check_syscall_fastpath

* update setuid_hook, remove uneeded sucompat enable

* log freely

* kernel: Migrate kprobe hook configuration items

* kernel: fix build

* cli: add ksud debug mark

* Fix rustfmt warning

---------

Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: Wang Han <416810799@qq.com>
Co-authored-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
2025-11-09 01:14:26 +08:00
ShirkNeko
03a164ebb7 kernel: By default, MNT_DETACH is used as the value for the mount point. 2025-11-07 13:37:09 +08:00
ShirkNeko
4769065cfc ksud: Implementing editable, removable mount points 2025-11-07 13:15:07 +08:00
Ylarod
7ece40bb2c ksud: add managed_feature 2025-11-03 11:47:39 +08:00
ShirkNeko
47bcc956a3 fix lot (#518)
* refact: use feature subsystem

* use 64bit feature

* fix

* add fixme

* add feature max to get_info

* use 32bit feature id

* allow root to get/set feature

* more clean perm_check functions

* fix

* add feature command to ksud

kernel: do not expose perm checker

* fix security_task_fix_setuid_handler_pre

* add android16-6.12 ci

* manager: add kernel_umount switch

Co-authored-by: YuKongA <70465933+YuKongA@users.noreply.github.com>

* manager: Reinstate the LKM selection function

* kernel: add name and print command value

- Optimise sulog log display

Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>

* fix

* ksud: clippy

---------

Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: YuKongA <70465933+YuKongA@users.noreply.github.com>
Co-authored-by: weishu <twsxtd@gmail.com>
2025-11-02 20:01:24 +08:00
生于生时 亡于亡刻
0a804ba170 feat: Optimize some codes (ksud) (#465)
* chore: make cargo clippy happy

Signed-off-by: Tools-app <localhost.hutao@gmail.com>

* chore: Optimize import
-  Format as a standard import

Signed-off-by: Tools-app <localhost.hutao@gmail.com>

---------

Signed-off-by: Tools-app <localhost.hutao@gmail.com>
2025-10-12 15:48:24 +08:00
ShirkNeko
044b4a2f9c manager: Simplify kpm management by migrating to the ksud side. 2025-10-06 20:53:18 +08:00
5ec1cff
a041b90891 ksud: make clippy happy (#2683)
e1be06240d/clippy_lints/src/format_args.rs (L168)
2025-08-10 17:59:12 +08:00
5ec1cff
ec383ed661 allow restore uninstalled module 2025-03-09 00:05:23 +08:00
5ec1cff
43563b654a log: make verbose logging optional 2025-03-08 23:55:24 +08:00
5ec1cff
a5edae9fac implement magic mount 2025-03-08 23:55:20 +08:00
Wang Han
38027c9793 Don't unshare after entering global namespace (#2373)
Global namespace is usually used to publicly apply mounts so calling
unshare after entering root namespace is not desired bahavior. This also
keeps -M option same as Magisk.
2025-01-24 11:22:24 +08:00
铃柒柒
aefb1aaed2 manager: Add action.sh for user to manually trigger modules' functionality from manager (#2156)
Commits:
- manager: Add `action.sh` for user to manually trigger modules'
functionality from manager
- manager: Optimize ModuleItem
- manager: uninstall button: TextButton -> FilledTonalButton
- Optimize `run_action` function

Commit Author & Thank:
- @lightsummer233
- @lingqiqi5211
- [APatch](https://github.com/bmax121/APatch)

Demo Show:

![image](https://github.com/user-attachments/assets/a5778a86-fa60-485f-ac49-2b581711f60e)

---------

Co-authored-by: Light summer <93428659+lightsummer233@users.noreply.github.com>
2024-10-27 10:07:13 +01:00
weishu
a3df721b84 Revert "su: allocate new pty (#1693)"
This reverts commit 935dc18faa.
2024-05-08 21:18:55 +08:00
5ec1cff
935dc18faa su: allocate new pty (#1693) 2024-05-07 19:02:59 +08:00
fsxitutu
839fc0534e Add magiskboot to kernelsu working directory (#1684)
Add the magiskboot binary to the /data/adb/ksu/bin directory so that
scripts/programs can call magiskboot to patch the boot/init_boot image.

---------

Co-authored-by: weishu <twsxtd@gmail.com>
2024-05-01 09:48:59 +08:00
weishu
3aac979caa ksud: skip removing module if no modules exist, also add uninstall mangaer, reboot 2024-04-23 15:32:15 +08:00
weishu
0697db618e ksud: Add uninstall 2024-04-22 20:41:53 +08:00
weishu
6ea2438425 ksud: Fix clippy 2024-04-12 10:36:34 +08:00
weishu
3010ed89c0 ksud: Add boot restore 2024-04-12 00:47:29 +08:00
weishu
ef92c32729 ksud: add boot-info cli 2024-03-23 10:46:16 +08:00
weishu
9759a779cd embed LKM to ksud (#1472) 2024-03-18 23:12:46 +08:00
Ylarod
7568d55be1 Build KernelSU as LKM (#1254)
Co-authored-by: weishu <twsxtd@gmail.com>
2024-03-15 18:53:24 +08:00
weishu
fe7ec370d4 ksud: fmt & tidy 2024-03-11 14:01:21 +08:00
weishu
b670db2d22 ksud: fix punch hole 2024-02-25 20:21:17 +08:00
weishu
0c52f24612 ksud: remove link manager 2024-02-23 18:08:53 +08:00
weishu
cbc04ff6df ksud: support global mnt for debug su 2024-02-23 18:04:00 +08:00
weishu
9c4d20c0f2 ksud: remove http serve mode 2024-02-22 16:26:14 +08:00
weishu
355b55a01d ksud: use bind mount to serve module webui 2024-02-22 16:26:14 +08:00
weishu
cbd184421c ksud: Add support for module webui 2024-02-20 16:39:05 +08:00
weishu
e0e7058d14 ksud: reclaim sparse space when install/uninstall modules. close #1367 2024-02-19 15:29:03 +08:00
weishu
e0802b0d15 ksud: check image before shrink 2024-02-19 12:31:35 +08:00
weishu
7cb5fb47e1 ksud: Add command to shrink image 2024-01-30 13:23:49 +08:00
weishu
d43b40572d ksud: clippy 2024-01-30 12:59:24 +08:00
weishu
cce423a2f6 ksud: Add cli for fast copy sparse file 2024-01-30 12:56:59 +08:00
weishu
653225bb5b ksud: Add support for boot patch 2024-01-15 20:17:10 +08:00
Nullptr
b82fc971dd Remove ksud path to make xi and vvb happy (#1251)
Not creating new historical legacy
2024-01-05 17:28:06 +08:00
Nullptr
52f5727875 Fix temp dir on Android 10 or below (#1250)
Co-authored-by: Ylarod <me@ylarod.cn>
2024-01-05 14:41:33 +08:00
weishu
fd03626362 ksud: make cargo fmt happy 2023-10-21 13:21:33 +08:00
weishu
9b294682b0 manager: support App Profile template 2023-10-21 13:19:59 +08:00
weishu
a22959beae kernel: harden the signature check (#1027) 2023-10-11 02:53:11 -05:00
weishu
2bb73a2a92 ksud: support root profile's sepolicy 2023-07-01 16:34:43 +08:00
weishu
90407986be ksud: remove unused command 2023-07-01 15:31:53 +08:00
5ec1cff
c058cb8848 ksud: refactor module mount (#384) 2023-04-14 22:30:34 +08:00
tiann
3c6560ade9 ksud: format anyhow error 2023-04-12 13:21:13 +08:00
tiann
48e76f9096 ksud: refine su and make it compitable with MagiskSU
Supported features:

1.  --mount-master, -M, -mm which would make the command run in global mount namespace.
2. - user to switch a specific user's shell.
3. -v, -V to print version code and name.

fix #330 #306 #305 #32
2023-04-04 13:50:48 +08:00