Commit Graph

482 Commits

Author SHA1 Message Date
ShirkNeko
120a8ad00d fix build 2025-11-23 23:53:03 +08:00
ShirkNeko
a821b7d299 kernel: Implementing editable, removable mount points 2025-11-23 23:33:09 +08:00
ShirkNeko
85bb10341a Deprecated ADD_TRY_UMOUNT in favor of official kernel_umount; Synced with the latest commit of official KernelSU main repo
- Since official KSU has exposed kernel_umount API and provided meta module for handling mount operations, susfs can finally handover try_umount and auto add_try_umount to KSU and its meta module

- Synced with upstream, see e1e58ed737

Co-authored-by: simonpunk <simonpunk2016@gmail.com>
2025-11-23 23:21:26 +08:00
ShirkNeko
659a6a7e00 fix 2025-11-23 21:17:26 +08:00
Wang Han
09a56a98b7 kernel: Unmount all isolated process which forks from zygote
Kernel has few information about which isolated process belongs to which
application, so there is actually no good choice if we don't implement a
userspace daemon. One choice is to access cmdline memory from kernel,
but cmdline is __user, and it is likely to trigger detections. Before we
have more good ideas, use this.
2025-11-23 19:47:40 +08:00
ShirkNeko
455b725248 Deprecated AUTO_ADD_TRY_UMOUNT_FOR_BIND_MOUNT, the leftover add_sus_mount cli and umount_for_zygote_system_process
Reason:
 - AUTO_ADD_TRY_UMOUNT_FOR_BIND_MOUNT is also causing a bit more performance overheads and still it cannot catch all the sus mounts in all situations. Actually it can easily be done in boot-completed.sh, and it should be more accurate, see module templates for more details.

- Official KernelSU also allows ksud to add custom path to try_umount list as well, users can use their own way to add only the desired sus mounts to try_umount list, but remember to disable susfs ADD_TRY_UMOUNT in kernel if users want to use the official one.

- There are less use cases for umount_for_zygote_system_process, and sometimes enabling this may cause bootloop with some modules enabled, instead user can use busybox nsenter to umount the sus mounts for specific process later by themmselves.

Co-authored-by: simonpunk <simonpunk2016@gmail.com>
2025-11-22 22:17:45 +08:00
LeafStative
05758a975b kernel: fix build (#609)
Co-authored-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
2025-11-20 17:07:33 +08:00
ShirkNeko
3ac63edd18 kernel & KernelSU: Deprecated add_try_umount cli, AUTO_ADD_SUS_KSU_DEFAULT_MOUNT and AUTO_ADD_SUS_BIND_MOUNT
Reason:
 - add_try_umount, AUTO_ADD_SUS_KSU_DEFAULT_MOUNT and AUTO_ADD_SUS_BIND_MOUNT are only used to flag the sus_mount bit on target inode, but actually none of the hooks are checking for this bit, so this is why these features should be no longer needed, and we only need to check for sus mnt_id to determine if it is a sus mount. Plus it takes more CPU cycle to check for the path and set the sus_mount flag during boot time

 Co-authored-by: simonpunk <simonpunk2016@gmail.com>
2025-11-20 17:05:53 +08:00
YangQi0408
9856539f1f kernel: fix build (#603) 2025-11-19 12:54:11 +08:00
ShirkNeko
957999ba09 kernel: fix build
Co-authored-by: Faris <rissu.ntk@gmail.com>
2025-11-18 23:17:40 +08:00
ShirkNeko
7fc075679e kernel: Remove duplicate disable_seccomp_for_task 2025-11-18 22:53:08 +08:00
ShirkNeko
118fcf507a kernel: fmt 2025-11-18 21:39:31 +08:00
brokestar233
aa51ef5c24 kernel: kpm: add compatibility for kernel 6.11 and later (#599)
`cb_mutex` has been removed since this commit(https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/include/linux/netlink.h?h=v6.11&id=5fbf57a937f418fe204f9dbb7735e91984f4ee6a) in 6.11. For compatibility reasons, `cb_mutex` should not be used in 6.11 and later versions.

Signed-off-by: brokestar233 <3765589194@qq.com>
2025-11-18 21:33:02 +08:00
ShirkNeko
e79b702fd6 Synchronise some modifications
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: 5ec1cff <56485584+5ec1cff@users.noreply.github.com>
Co-authored-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
Co-authored-by: u9521 <63995396+u9521@users.noreply.github.com>
Co-authored-by: Wang Han <416810799@qq.com>
Co-authored-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
Co-authored-by: Faris <rissu.ntk@gmail.com>
2025-11-18 21:27:22 +08:00
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