Commit Graph

468 Commits

Author SHA1 Message Date
ShirkNeko
07e7d129a0 kernel: Use a better wrapper compatible with ksu_umount_mnt 2025-11-18 20:23:31 +08:00
ShirkNeko
b686c81be4 kernel: fix build 2025-11-18 16:10:59 +08:00
ShirkNeko
59141b2e05 kernel & KernelSU: Synced with upstream; Original add_try_umount will be used if susfs TRY_UMOUNT is disabled during compile time
Co-authored-by: simonpunk <simonpunk2016@gmail.com>
2025-11-18 15:47:03 +08:00
backslashxx
02c3f70ab5 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 15:36:51 +08:00
Wang Han
44eed59c46 kernel/ksud: Fix KSU_IOCTL_NUKE_EXT4_SYSFS definition 2025-11-18 15:28:39 +08:00
weishu
bc7266111c kernel: Add nuke_ext4_sysfs interface 2025-11-18 15:28:15 +08:00
ShirkNeko
f1909411c0 kernel: Fixed compilor error when SUS_MOUNT is disabled
Co-authored-by: simonpunk <simonpunk2016@gmail.com>
2025-11-18 15:26:45 +08:00
小 小w
724c7517f5 Susfs main (#597)
* Update file_wrapper.c (#595)

* Remove wrong compatibility code from susfs-main (#596)

Nongki compatibility code should be committed to nongki branch, rather than susfs-main branch.

---------

Co-authored-by: kAiF <askthekaif@proton.me>
Co-authored-by: cctv18 <85936817+cctv18@users.noreply.github.com>
2025-11-18 11:16:41 +08:00
小 小w
0d421b7db1 Update file_wrapper.c 2025-11-18 11:16:16 +08:00
小 小w
0b35c9ae1d fix Implement ksu_wrapper_dedupe_file_range function
Added a new function for deduplicating file ranges.
2025-11-18 10:26:30 +08:00
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