Commit Graph

23 Commits

Author SHA1 Message Date
weishu
c307bf5614 kernel: remove ksu_compat_{open,read,write} because we're in the right context now
Co-authored-by: weishu <twsxtd@gmail.com>
2025-11-08 20:22:06 +08:00
ShirkNeko
afc8b53ca6 new supercall impl (#511)
* refactor: replace throne tracker with ksud token

* use snprintf

* refactor: new supercall impl

- Import the sukisu command

* disable seccomp for supercall users

* kernel: fmt clear

* kernel: Enable macro protection for sulog

- Only enabled on kernel versions greater than 5.10.245

* kernel: Refactor kprobe hooks and implement LSM hooks for improved security handling

* debug mode

* kernel: Add functionality to generate and validate authentication tokens for cmd_su

* kernel: Simplified manual SU command processing for code

* kernel: replace renameat hook with fsnotify

* Revert "refactor: replace throne tracker with ksud token"

This reverts commit aa2cbbf.

* kernel: fix compile

* kernel: fix compile below 6.0

* Fix compile err; Add become_manager

* kernel: install fd for manager automaticlly

- extend to import the corresponding command

* manager: new supercall impl

* temp changes for ksud

* ksud: fix compile

* fix wrong opcode

* kernel: fix compile

* kernel: Fixed hook type and KPM status retrieval errors

* kernel: Fixed potential null pointer issue with current->mm in kernel version 5.10

When calling get_full_comm() within system call hooks, current->mm may be null (prctl). A fallback mechanism for current->comm must be added beforehand to prevent null pointer dereferences when accessing mm->arg_start/arg_end.

Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>

* ksud: fix cargo check

* manager: Fixed an issue where the KSUD release and user-mode scanning switch failed to function correctly.

- kernel: fix spin lock mutual

kernel: Fixed potential null pointer issue with current->mm in kernel version 5.10

When calling get_full_comm() within system call hooks, current->mm may be null (prctl). A fallback mechanism for current->comm must be added beforehand to prevent null pointer dereferences when accessing mm->arg_start/arg_end.

kernel: try introduce like susfs's method to fix prctl delay

* seccomp: allow reboot

* use u32

* update clang-format

* 4 spaces save the world

* ksud: Fix build on macOS

* manager: bump minimal supported kernel.

- When get_hook_type is empty, display “Unknown”.

* Fix ksud build (#2841)

* try fix ksud

* fix for macos

* remove any

* Fix ksud build, take 3

* try fix allowlist

* bring lsm hook back

* fix: a lot again

* Fix ksud build, take 4 (#2846)

Remove init_driver_fd function for non-linux/android targets

* manager: Return to the native method via KSUd installation

* Merge with susfs-mian format

---------

Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: weishu <twsxtd@gmail.com>
Co-authored-by: AlexLiuDev233 <wzylin11@outlook.com>
Co-authored-by: Wang Han <416810799@qq.com>
2025-11-02 01:11:38 +08:00
rsuntk
ad0fb7d89f kernel: make apk_sign_key as a typedef instead
Style preference.

Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
2025-10-07 16:52:35 +08:00
ShirkNeko
41f7921993 Revert "kernel: throne_tracker: offload to kthread tiann #2632"
This reverts commit 8364d6d4a4.
2025-09-24 16:26:27 +08:00
ShirkNeko
8364d6d4a4 kernel: throne_tracker: offload to kthread tiann #2632
Run throne_tracker() in kthread instead of blocking the caller.
Prevents full lockup during installation and removing the manager.

By default, first run remains synchronous for compatibility purposes
(FDE, FBEv1, FBEv2)

Features:
- looks and waits for manager UID in /data/system/packages.list
- run track_throne() in a kthread after the first synchronous run
- prevent duplicate thread creation with a single-instance check
- spinlock-on-d_lock based polling adressing possible race conditions.

Race conditions adressed
- single instance kthread lock, smp_mb()
- track_throne_function, packages.list, spinlock-on-d_lock based polling
- is_manager_apk, apk, spinlock-on-d_lock based polling

This is a squash of:
https://github.com/tiann/KernelSU/pull/2632

Original skeleton based on:
`kernelsu: move throne_tracker() to kthread`
`kernelsu: check locking before accessing files and dirs during searching manager`
`kernelsu: look for manager UID in /data/system/packages.list, not /data/system/packages.list.tmp`
0b05e927...8783badd

Co-Authored-By: backslashxx <118538522+backslashxx@users.noreply.github.com>
Co-Authored-By: Yaroslav Zviezda <10716792+acroreiser@users.noreply.github.com>
Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
2025-09-24 01:50:05 +08:00
ShirkNeko
fc5cd9e9ed kernel: Reworking Dynamic Manager Index Configuration 2025-09-06 15:06:10 +08:00
ShirkNeko
e81989302f kernel: Remove the ksu_ prefix from the dynamic manager signature. 2025-08-25 20:17:55 +08:00
ShirkNeko
e41fa8ef62 Revert renaming symbols in KernelSU driver
- In order to reduce the extra patch code and increase the rate of hunk succeed, we do not rename the symbols in KernelSU drvier but instead do it all in kernel/kallsym.c

- Make susfs_starts_with() global as it maybe useful in future

Co-authored-by: simonpunk <simonpunk2016@gmail.com>
2025-08-25 19:29:14 +08:00
ShirkNeko
444aefd5d5 kernel: Modified dynamic signature All files have been renamed to the correct names: Dynamic Manager 2025-08-24 11:08:09 +08:00
backslashxx
8bc11247fe kernel: apk_sign: fix return check for ksu_sha256
upstream used IS_ERR to check for negative return and that is int,
so correct it.

This is one headache for old compilers.

Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
2025-08-21 13:06:56 +08:00
ShirkNeko
cf152f368d kernel: refactor APK signature verification functions for clarity and efficiency 2025-08-17 23:12:28 +08:00
ShirkNeko
9ff53ce683 kermel: Refactoring and separating dynamic signature-related structures and functions and implement hot-signature updates 2025-08-03 22:46:00 +08:00
ShirkNeko
0b03cd9faf kernel: simplified signature verification 2025-07-09 12:07:41 +08:00
ShirkNeko
b8f9a448f2 kernel: Add the ability to get active managers for multi-manager APKs 2025-07-06 00:25:42 +08:00
ShirkNeko
f7dcc82be5 kernel: add multi-manager support 2025-07-05 21:27:04 +08:00
ShirkNeko
f5c236c925 Add dynamic signature support 2025-07-05 15:59:58 +08:00
ShirkNeko
8e192aaead kernel: add support for multi KernelSU manager in Kconfig 2025-06-27 00:10:19 +08:00
ShirkNeko
682fdf0afe Prioritize sukisu recognition.
Simplified manual hooks
2025-05-10 14:38:45 +08:00
ShirkNeko
3082a9c90b Remove the SukiSU signature checking function and update the related signature verification logic. 2025-04-11 01:25:31 +08:00
ShirkNeko
3685058b29 Add SukiSU signature checking function and adjust the related constant definition. 2025-04-10 00:43:34 +08:00
ShirkNeko
2c7920275f Add more signatures 2025-03-21 00:30:50 +08:00
Pzqqt
50e1e7da20 kernel: Refactor manager apk check method
- When we have multiple apk sign keys available, just add to `apk_sign_keys`.
- Check all apk sign keys in one open file without opening the file repeatedly.
2025-03-21 00:29:55 +08:00
樱檩殇雪
ad064fea9e add susfs-dev branch files 2025-03-17 02:48:59 +08:00