Commit Graph

458 Commits

Author SHA1 Message Date
ShirkNeko
722980e221 KernelSU: Fixed some susfs features mistakenly being set to default n in Kconfig
Co-authored-by: simonpunk <simonpunk2016@gmail.com>
2025-11-18 00:27:38 +08:00
YangQi0408
fb539fae57 kernel: Fix compatibility with nongki kernels (#594) 2025-11-18 00:25:48 +08:00
ShirkNeko
c4faf57ca9 fix build 2025-11-17 21:09:13 +08:00
TwinbornPlate75
9d5c6ab3fd kernel: Fix compilation for non-gki kernels (#593) 2025-11-17 20:10:06 +08:00
Jiu
55ddeb63fb Susfs main (#592)
* Update rules.c

* Update selinux.c

* Rename susfs_set_kernel_sid to susfs_set_priv_app_sid
2025-11-17 18:06:02 +08:00
ShirkNeko
d7e998eaf2 kernel/manager/ksud: Add switch functionality to sulog
Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
2025-11-16 17:19:13 +08:00
ShirkNeko
5667d8bdde kernel: Optimise multi manager scanning logic 2025-11-16 15:39:00 +08:00
Wang Han
0d251a2655 kernel: Replace kmalloc() usages with kzalloc() (#2939)
This ensures we won't use uninitialized pointers for task work.
2025-11-16 15:38:48 +08:00
ShirkNeko
e2bcec1ee2 kernel: Add sulog records for susfs 2025-11-16 14:50:04 +08:00
ShirkNeko
be63a062ad kernel: Resolving the issue of unavailable functionality 2025-11-16 14:25:43 +08:00
ShirkNeko
8802ea0aee kernel: Add support for SUSFS inline hook configuration 2025-11-16 14:00:29 +08:00
ShirkNeko
7f94204191 KernelSU: Fixed wrong TRY_UMOUNT #ifdef guard
Co-authored-by: simonpunk <simonpunk2016@gmail.com>
2025-11-16 13:13:38 +08:00
5ec1cff
c61d6fb665 kernel: file_wrapper: copy mode of original inode
Bionic uses fstat to determine whether an fd is a tty and set proper
buffering flags, so we also need to set the wrapper file's inode mode to
the original inode mode.

see:
https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/upstream-openbsd/lib/libc/stdio/makebuf.c;l=61-95;drc=9a4b68e20d617b2cb3355071521f16e8c3d538df
2025-11-15 20:14:17 +08:00
5ec1cff
70f722e614 kernel: no need to remark process on post-fs-data and boot-completed
- Remark on post-fs-data may unmark zygote unexpectedly, and there is no
necessity to remark on these stages, so simply remove them.
2025-11-15 17:30:52 +08:00
ShirkNeko
011a740217 kernel: Add legacy compatibility fallback 2025-11-15 11:05:50 +08:00
Wang Han
0c9ebb9bad kernel: Prune allowlist only after boot completed
For unknown reason, packages.list is not reliable during boot for oplus
devices, so we have to disable pruning and re-run pruning after boot.
2025-11-15 10:56:10 +08:00
ShirkNeko
4c04508267 kernel: Apply the susfs patch
Co-authored-by: simonpunk <simonpunk2016@gmail.com>
Co-authored-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
2025-11-14 18:36:04 +08:00
ShirkNeko
4920877dd8 kernel/sulog: Optimise the sulog log format 2025-11-14 13:04:37 +08:00
ShirkNeko
30c627395a kernel: Optimise sulog to prevent deadlocks caused by global lock contexts. 2025-11-14 13:04:28 +08:00
ShirkNeko
d3461a6421 kernel: Resolved potential deadlock issues arising from operations not being performed within locks. 2025-11-14 13:04:02 +08:00
5ec1cff
9203006028 kernel: refine syscall_hook_manager
- Don't unmark process when setuid if syscall tracepoint is in use
- Remark process when app profile updated
- Ensure zygote is marked on first boot
2025-11-14 13:03:46 +08:00
ShirkNeko
490cc39180 kernel: fix build 2025-11-14 13:02:49 +08:00
weishu
1d1a8f98b3 kernel: fix zygote mark on first boot (#2924) 2025-11-14 13:02:40 +08:00
ShirkNeko
cb344d8546 kernel: Remove redundant ksu_handle_inode_permission hooks, calling only for manual_su 2025-11-14 13:02:24 +08:00
5ec1cff
722fd6c756 kernel: fix wrong show_fdinfo impl
Signed-off-by: Wang Han <416810799@qq.com>
2025-11-12 13:26:06 +08:00
ShirkNeko
d65fcada04 kernel: clean code 2025-11-11 16:41:06 +08:00
Wang Han
d2db8b4291 kernel: Fix task flag marking for root and shell UID
Signed-off-by: Wang Han <416810799@qq.com>
Co-authored-by: 5ec1cff <56485584+5ec1cff@users.noreply.github.com>
2025-11-11 16:33:38 +08:00
ShirkNeko
1b2e7dee97 kernel: Use task work to install fd
There are many fd related functions that can sleep, so we have no choice
but move operations to task work. Also close fd when copy_to_user fails.

Co-authored-by: Wang Han <416810799@qq.com>
2025-11-11 01:13:13 +08:00
ShirkNeko
66f37c7310 Revert "kernel: Apply the SUSFS patch"
This reverts commit ad0f3f6025.
2025-11-09 21:39:04 +08:00
ShirkNeko
3a0f9b4e2c Clean up kernel code (#2898)
1) Fix memory leak of callback head in allowlist.c
2) Remove duplicated logic and incorrect log in kernel_umount.c
3) Prevent sleep in kprobe context in ksud.c
4) Remove useless is_unsupported_uid, use euid for security enhance,
   add FIXME in setuid_hook.c
5) Remove useless fd argument for execve hook, fix incorrent pointer
   usage in syscall_hook_manager.c and sucompat.c
6) Use correct errno in supercalls.c

---------

Co-authored-by: Ylarod <me@ylarod.cn>
2025-11-09 19:23:22 +08:00
ShirkNeko
ad0f3f6025 kernel: Apply the SUSFS patch 2025-11-09 18:32:16 +08:00
ShirkNeko
a2caa9432f fix 2025-11-09 18:10:25 +08:00
ShirkNeko
92e9f4068a kernel: Rollback disable_seccomp
Co-authored-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
Co-authored-by: Faris <rissu.ntk@gmail.com>
2025-11-09 18:04:49 +08:00
ShirkNeko
ae104ed4a4 kernel: Remove redundant checks 2025-11-09 18:04:32 +08:00
ShirkNeko
1c86944142 kernel: Undo some changes 2025-11-09 16:30:29 +08:00
ShirkNeko
a0ceda008d fix build 2025-11-09 14:14:51 +08:00
ShirkNeko
f670151f20 kernel: Simplify state management logic 2025-11-09 14:06:25 +08:00
ShirkNeko
3e5f69cdf8 kernel: Fix compilation for non-gki kernels
Co-authored-by: TwinbornPlate75 <3342733415@qq.com>
2025-11-09 13:35:42 +08:00
ShirkNeko
a525048d1f kernel: Remove susfs patch 2025-11-09 12:48:51 +08:00
ShirkNeko
c400952b47 clear build 2025-11-09 12:30:52 +08:00
ShirkNeko
f6a0fab2ef Fixes only hook in LKM mode __NR_newfstatat ,__NR_faccessat ,__NR_execve system calls 2025-11-09 12:18:00 +08:00
ShirkNeko
86cd05e206 Attempt to refactor and migrate inode_permission, bprm_check_security, and task_alloc entirely to syscall_hook_manager
kernel: fix build
2025-11-09 04:35:29 +08:00
ShirkNeko
af4b502631 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 03:49:11 +08:00
weishu
678c00cad9 kernel: fix put_task if alloc failed. 2025-11-08 21:44:24 +08:00
AlexLiuDev233
22661c1838 fix: fix 5.0- users can't build (#551)
my mistake, forget old kernel's access_ok has 3 params,
so i switch to ksu_access_ok
2025-11-08 21:33:21 +08:00
ShirkNeko
2f1b967813 kernel: fix build 2025-11-08 20:54:07 +08:00
ShirkNeko
d8db1b6c43 kernel: Resolved compatibility issues with su when using manual hooks 2025-11-08 20:53:37 +08:00
ShirkNeko
3137fc4ee0 kernel: fix build 2025-11-08 20:47:37 +08:00
ShirkNeko
8c849518fb kernel: fix build 2025-11-08 20:45:29 +08:00
ShirkNeko
05179ee119 kernel: Resolve implicit declaration conflicts 2025-11-08 20:29:59 +08:00