ShirkNeko
c4d8c49e5c
kernel/manager/ksud: Add switch functionality to sulog
...
Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com >
2025-11-16 16:53:55 +08:00
ShirkNeko
8442ebcb7a
kernel: Optimise multi manager scanning logic
2025-11-16 15:35:26 +08:00
Wang Han
25fbc22f66
kernel: Replace kmalloc() usages with kzalloc() ( #2939 )
...
This ensures we won't use uninitialized pointers for task work.
2025-11-16 15:24:49 +08:00
ShirkNeko
a4a9df3a25
kernel: fmt
2025-11-16 14:29:10 +08:00
5ec1cff
db6a59ec4e
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 19:54:16 +08:00
ShirkNeko
46846dce91
kernel: Utilise the existing try_umount to avoid repackaging
2025-11-15 19:29:12 +08:00
5ec1cff
04ca981e4d
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:27:48 +08:00
Wang Han
01ac06c3fd
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:54:19 +08:00
ShirkNeko
7e7713ee4a
kernel/sulog: Optimise the sulog log format
2025-11-14 12:55:57 +08:00
ShirkNeko
7afcdb3059
kernel: Optimise sulog to prevent deadlocks caused by global lock contexts.
2025-11-14 12:29:55 +08:00
ShirkNeko
5df821ed41
kernel: Resolved potential deadlock issues arising from operations not being performed within locks.
2025-11-14 11:55:06 +08:00
5ec1cff
9f869090d2
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-13 20:09:32 +08:00
ShirkNeko
bb8b991110
kernel: restart enable sulog for LKM
2025-11-13 17:46:08 +08:00
ShirkNeko
10548f9243
kernel: fix build
2025-11-13 17:06:27 +08:00
weishu
96d33e62bb
kernel: fix zygote mark on first boot ( #2924 )
2025-11-13 16:31:26 +08:00
ShirkNeko
7be8c15b85
kernel: Remove redundant ksu_handle_inode_permission hooks, calling only for manual_su
2025-11-13 15:02:20 +08:00
5ec1cff
095385f814
kernel: fix wrong show_fdinfo impl
...
Signed-off-by: Wang Han <416810799@qq.com >
2025-11-12 13:25:20 +08:00
ShirkNeko
7e595e1730
kernel: Public ksu_handle_sys_reboot
...
- clean code
2025-11-11 16:49:09 +08:00
Wang Han
ded31c2043
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:26:37 +08:00
ShirkNeko
8f49898155
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:10:36 +08:00
ShirkNeko
fd3a22360a
kernel: Clean code build
2025-11-09 23:18:48 +08:00
Wang Han
ef36a36e9a
kernel: Don't save allowlist on module exit
...
This is not needed and may trigger UAF as work is async.
2025-11-09 23:14:13 +08:00
ShirkNeko
cda7e4c6c0
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:20:30 +08:00
ShirkNeko
0b63cc445c
kernel: Expose the ksu_handle_sys_read hook
2025-11-09 18:11:30 +08:00
ShirkNeko
2433ced81a
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 17:00:43 +08:00
ShirkNeko
1f04f13e44
kernel: Remove redundant checks
2025-11-09 16:41:54 +08:00
ShirkNeko
184467c691
kernel: Undo some changes
2025-11-09 16:09:59 +08:00
ShirkNeko
05ed1a3714
fix build
2025-11-09 14:17:27 +08:00
ShirkNeko
163531fcd2
kernel: Simplify state management logic
2025-11-09 14:07:40 +08:00
ShirkNeko
049956aaa9
Fixes only hook in LKM mode __NR_newfstatat ,__NR_faccessat ,__NR_execve system calls
2025-11-09 12:16:23 +08:00
ShirkNeko
6530d06710
kernel: clean build
2025-11-09 04:12:11 +08:00
ShirkNeko
88135d8363
Attempt to refactor and migrate inode_permission, bprm_check_security, and task_alloc entirely to syscall_hook_manager
2025-11-09 02:52:46 +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
weishu
46b9f5fb4b
kernel: fix put_task if alloc failed.
2025-11-08 21:44:04 +08:00
ShirkNeko
413e9ab8a9
kernel: Resolved compatibility issues with su when using manual hooks
2025-11-08 20:52:29 +08:00
ShirkNeko
7479c0b81b
kernel: Fix build
2025-11-08 19:54:20 +08:00
ShirkNeko
0381d12be2
kernel: Resolve implicit declaration conflicts
2025-11-08 19:47:03 +08:00
Wang Han
4425c88d5a
Fix missing unlock on error path
2025-11-08 19:41:11 +08:00
weishu
7828c5c107
kernel: fix save allowlist
2025-11-08 19:40:16 +08:00
ShirkNeko
76046c84cd
kernel: remove unused kernel_compat
...
Co-authored-by: weishu <twsxtd@gmail.com >
2025-11-08 19:39:41 +08:00
weishu
623dd15cbf
kernel: Use real_parent to avoid interference from ptrace.
2025-11-08 19:30:55 +08:00
ShirkNeko
ab13ed5c16
kernel: remove unused wrapper for
...
Co-authored-by: weishu <twsxtd@gmail.com >
2025-11-08 19:30:44 +08:00
weishu
e171ca15cb
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 19:28:25 +08:00
ShirkNeko
4fc369a059
kernel: remove workqueue for allowlist
...
Co-authored-by: weishu <twsxtd@gmail.com >
2025-11-08 19:18:20 +08:00
ShirkNeko
18ad2afadb
Reworking fdwrapper
...
Co-authored-by: 5ec1cff <ewtqyqyewtqyqy@gmail.com >
Co-authored-by: 5ec1cff <56485584+5ec1cff@users.noreply.github.com >
Co-authored-by: Ylarod <me@ylarod.cn >
2025-11-08 19:03:14 +08:00
technotic
1b5b235bd9
add include for crc32.h in sulog.h (for dedup_calc_hash) ( #548 )
...
Co-authored-by: technotic <pixie@technotic.us >
Co-authored-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com >
2025-11-08 18:12:38 +08:00
AlexLiuDev233
fdf5e7104e
refactor: kpm: memory management migrate to sukisu side ( #539 )
...
* refactor: kpm: memory management migrate to sukisu side
* fix: build warning in some gki2 device
fix stack frame size warning (maybe) in gki2 device, specialy in ShirkNeko's device
* chore: use pr_info instead of printk
* feat: check the validity of pointers sent from user space
Sometimes, ksud or other root processes might request a kpm ioctl,
but data incorrectly, such as invalid pointer,
which cause the kernel to crash.
If the request is made by ksud at boot time, the situation is even worse,
as it can cause the system to enter the boot loop.
Therefore, I believe we need to check pointer integrity in kernel space to fix this problem.
---------
Co-authored-by: Saksham <typeflu@gmail.com >
Co-authored-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com >
2025-11-08 18:11:29 +08:00
AlexLiuDev233
704f7cba32
kernel: core_hook: disable seccomp in 5.10.2- for allowed uids ( #545 )
...
* kernel: core_hook: disable seccomp in 5.10.2- for allowed uids
we dont have those new fancy things upstream has
lets just do original thing where we disable seccomp
* Update kernel/core_hook.c
* fmt
---------
Co-authored-by: backslashxx <118538522+backslashxx@users.noreply.github.com >
Co-authored-by: Saksham <saksham.mac@icloud.com >
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
2025-11-08 12:46:25 +08:00
ShirkNeko
d37a78ea2d
fix build & cleanup
2025-11-08 11:48:35 +08:00
Ylarod
6c9bf69718
fix build
2025-11-08 11:37:07 +08:00