Commit Graph

417 Commits

Author SHA1 Message Date
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
Wang Han
bc09a64b1b Fix missing unlock on error path 2025-11-08 20:29:25 +08:00
weishu
8523b380b9 kernel: fix save allowlist 2025-11-08 20:29:12 +08:00
ShirkNeko
e4d7c292d6 kernel: remove unused kernel_compat
Co-authored-by: weishu <twsxtd@gmail.com>
2025-11-08 20:28:58 +08:00
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
0b118e19b3 kernel: remove workqueue for allowlist
Co-authored-by: weishu <twsxtd@gmail.com>
2025-11-08 20:18:56 +08:00
ShirkNeko
9c0da2caeb 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 20:17:37 +08:00
technotic
ba56c81bd0 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:13:04 +08:00
AlexLiuDev233
30316047d6 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:10:26 +08:00
TwinbornPlate75
4f7042ca44 kernel: Fix compilation for non-gki kernels (#547)
* kernel: Fix compilation for non-gki kernels

* kernel: Check if selinux_state exists rather than depends on version code
2025-11-08 18:07:09 +08:00
AlexLiuDev233
8ff469d00e 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:50:17 +08:00
ShirkNeko
2e16ba7ac7 cleanup 2025-11-08 12:21:08 +08:00
Ylarod
584fb3b213 fix build 2025-11-08 12:20:33 +08:00
Ylarod
a20c40f580 rename to proxy_file 2025-11-08 12:20:20 +08:00
ShirkNeko
af4d023777 kernel: remove devpts hook 2025-11-08 12:12:58 +08:00
ShirkNeko
90b99615aa Continue add 2025-11-08 01:36:51 +08:00
Wang Han
1ad4a745ad Use force_sig(SIGKILL) to kill process 2025-11-08 01:35:46 +08:00
Shadichy
f39d4f0f38 kernel: Refactor selinux/selinux.c (#2881)
Signed-off-by: shadichy <shadichy@blisslabs.org>
Co-authored-by: Wang Han <416810799@qq.com>
2025-11-08 01:35:37 +08:00
TwinbornPlate75
c24ed3b5c4 kernel: Fix compilation for non-gki kernels (#543) 2025-11-08 01:19:11 +08:00
ShirkNeko
74f24bafed Switch kretprobe to heap
Co-authored-by: Ylarod <me@ylarod.cn>
2025-11-07 19:03:05 +08:00
5ec1cff
c876d60e53 feature: add devpts fd wrapper (#21)
This feature is intended to resolve devpts problem.
2025-11-07 18:49:32 +08:00
ShirkNeko
3662c92854 Compilation fix 2025-11-06 23:39:22 +08:00
Ylarod
6a44e85d2e revert: still using workqueue for allowlist 2025-11-06 23:39:13 +08:00
Ylarod
384d2f7dcd fix: enhanced security register 2025-11-06 23:39:01 +08:00
ShirkNeko
8330bb335a kill pgrp in enhanced security 2025-11-06 23:38:36 +08:00
Ylarod
315fbb464c kill pgrp in enhanced security 2025-11-06 23:38:12 +08:00
Ylarod
bcf2a7632c add mutex for sucompat mark 2025-11-06 23:37:56 +08:00
ShirkNeko
d416a0add7 fix: sucompat (#2874)
Co-authored-by: Ylarod <me@ylarod.cn>
2025-11-06 23:37:05 +08:00
ShirkNeko
c1ecb8f3b9 kernel: clean code 2025-11-06 15:24:33 +08:00
ShirkNeko
e8ecb9a33b kernel: Resolving compilation issues once more 2025-11-06 15:18:39 +08:00
ShirkNeko
3382574aad kernel: Resolve compilation issues 2025-11-06 14:50:46 +08:00
ShirkNeko
54e1e3dda3 kernel: clean headers
Co-authored-by: weishu <twsxtd@gmail.com>
2025-11-06 14:46:24 +08:00
ShirkNeko
5a1ff92d0a fix 2025-11-06 14:45:42 +08:00
weishu
a30b932969 kernel: Set the tracepoint flag in a tracepoint manner 2025-11-06 14:44:32 +08:00
Ylarod
752ec03694 feature: add enhanced security (#2873) 2025-11-06 14:44:20 +08:00
weishu
64045b5386 kernel: remove unused workqueue 2025-11-06 14:41:39 +08:00
Ylarod
a81da2c586 fix sepolicy patch hint (#2872) 2025-11-06 14:39:54 +08:00
Ylarod
dcbc014039 fix: mark tif (#2871) 2025-11-06 14:37:47 +08:00
ShirkNeko
71353a70d4 kernel: use sys_enter tracepoint for sucompat (#533)
* use sys_enter tracepoint for sucompat

* update sucompat rules

* clean tif mark

* mark tif after load allow list

* clear all tif first, then mark target

* Fix shell su

* allow when escape

* fix bugs

* kernel: Resolve logical inconsistencies

---------

Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: weishu <twsxtd@gmail.com>
2025-11-06 14:34:45 +08:00
ShirkNeko
ee9c20f62a kernel: Migrate manual_su to ioctl 2025-11-06 03:01:31 +08:00
ShirkNeko
77fbfb7796 kernel: Resolved permission verification issue 2025-11-05 19:08:01 +08:00
ShirkNeko
3a8e114201 kernel: Fix compilation 2025-11-05 17:15:18 +08:00