Commit Graph

699 Commits

Author SHA1 Message Date
ShirkNeko
b0cc0e6f6d kernel: Update CMD_GET_FULL_VERSION to a new constant value 2025-07-03 00:08:54 +08:00
ShirkNeko
1fd13d9d8d docs: Updated documentation to introduce SuSFS Configuration Manager and introduction of advanced features 2025-06-30 16:57:56 +08:00
YC酱luyancib
c49a66d1af Update Kconfig (#224)
make sure kpm config requrement was enabled
2025-06-28 10:19:53 +05:30
古塵
4532bab230 kernel: refactor CMD_GET_FULL_VERSION to safely initialize version string (#220)
Use strscpy()/strlcpy() to populate the version buffer in CMD_GET_FULL_VERSION
instead of relying on uninitialized memory. This ensures the returned string
is null-terminated and avoids exposing garbage data to user space.

Signed-off-by: schqiushui <orochi9999@gmail.com>
2025-06-27 10:42:38 +08:00
ShirkNeko
2c2698f6bc kernel: Rewrite kernle version code management
Co-authored-by: lamadaemon <i@lama.icu>
Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
2025-06-24 23:16:16 +08:00
Prslc
6e35b88041 Kernel: use main branch commit count for consistent versioning (#209) 2025-06-23 18:59:30 +08:00
Rifat Azad
00ffa86705 kernel/Makefile: check kernelsu driver version from online git repo first, if fails then check local .git and if that also fails then use hardcoded fallback 2025-06-21 17:09:16 +08:00
rsuntk
483a39c7ac kernel: core_hook: fix refcount leaks on try_umount (#2635)
Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
Co-authored-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
2025-06-19 18:28:21 +08:00
backslashxx
9f407a94e3 kernel: throne_tracker: avoid cross-fs traversal using s_magic check (#2633)
Skip directories that does NOT have the same magic as /data/app.
This is to avoid scanning incfs and any other stacked filesystems.

While this is way dumber, it's way cheaper.
no kern_path(), no missable path_put(), no ref handling.

This supercedes
`throne_tracker: avoid cross fs access
(https://github.com/tiann/KernelSU/pull/2626)`
- upstream
0b6998b474

Signed-off-by: backslashxx
<118538522+backslashxx@users.noreply.github.com>
2025-06-13 02:38:02 +08:00
ShirkNeko
99726a2c4e [skip ci] docs: Updated README file to reflect instructions for the susfs-main branch
kernel: Added sukisu_set_manager_uid function to set the management UID
2025-06-13 02:36:50 +08:00
ShirkNeko
f3675e7f6e Revert "throne_tracker: avoid cross fs access 2025-06-11 18:55:25 +08:00
Wang Han
1bac30930f Switch to prepare_creds/commit_creds
Update API as per kernel doc recommends, also fix setup_groups refcount
leak while at it.
2025-06-10 23:39:08 +08:00
5ec1cff
d58ec6952c throne_tracker: avoid cross fs access 2025-06-03 00:03:16 +08:00
ShirkNeko
8f4c58c4c3 [skip ci]: kernel: simplify KPM enabled check in ksu_handle_prctl 2025-05-24 15:25:54 +08:00
rsuntk
7e88e9648f kernel: guard nuke_ext4_sysfs
Rather than using depends on / select,
i just prefer this way, although, yes, it is
an ifdef hell.

Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
2025-05-24 15:05:44 +08:00
ShirkNeko
d619f5fafc Refactoring KPM support to check KPM status using CMD_ENABLE_KPM 2025-05-24 03:28:28 +08:00
ShirkNeko
9924809bdb [skip ci]: Update the GitHub repository links in the documentation to ensure that they point to the correct SukiSU-Ultra repositories 2025-05-20 12:48:06 +08:00
ShirkNeko
ebc16583fb [skip ci]:kernel: kpm: add compatibility for kernel 4.14 and lower (#76)
manger: Fix and simplify back gesture

`thread_pid` is not defined in kernel 4.14 and lower, leading to compilation issue.
To fix this, use `pids[PIDTYPE_PID].pid` for kernel versions 4.14 and lower.
Else use `thread_pid` for kernel versions 4.19 and higher.

Reference: 107717913b/tracee/tracee.bpf.c (L354)

Co-authored-by: sidex15 <24408329+sidex15@users.noreply.github.com>
Co-authored-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
2025-05-19 21:30:13 +08:00
ShirkNeko
28aa34c0b6 Updating the KPM configuration
- We don't know if KPM can run on arm32-bit devices, so to avoid some problems, add a dependency on 64-bit architectures

Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
2025-05-17 22:22:13 +08:00
backslashxx
842a8aa45a kernel/selinux: fix pointer mismatch with 32-bit ksud on 64-bit kernels
Since KernelSU Manager can now be built for 32-bit, theres this problematic
setup where userspace is 32-bit (armeabi-v7a) and kernel is 64bit (aarch64).

On 64-bit kernels with CONFIG_COMPAT=y, 32-bit userspace passes 32-bit pointers.
These values are interpreted as 64-bit pointers without proper casting and that
results in invalid or near-null memory access.

This patch adds proper compat-mode handling with the ff changes:
- introduce a dedicated struct (`sepol_compat_data`) using u32 fields
- use `compat_ptr()` to safely convert 32-bit user pointers to kernel pointers
- adding a runtime `ksu_is_compat` flag to dynamically select between struct layouts

This prevents a near-null pointer dereference when handling SELinux
policy updates from 32-bit ksud in a 64-bit kernel.

Truth table:

kernel 32 + ksud 32, struct is u32, no compat_ptr
kernel 64 + ksud 32, struct is u32, yes compat_ptr
kernel 64 + ksud 64, struct is u64, no compat_ptr

Preprocessor check

64BIT=y COMPAT=y: define both structs, select dynamically
64BIT=y COMPAT=n: struct u64
64BIT=n: struct u32

Tested-by: ...
Tested-by: ...
Tested-by: ...
Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
2025-05-15 17:39:41 +08:00
backslashxx
d17843479c kernel/throne_tracker: we just uninstalled the manager, stop looking for it
When the manager UID disappears from packages.list, we correctly
invalidate it — good. But, in the very next breath, we start scanning
/data/app hoping to find it again?

This event is just unnecessary I/O, exactly when we should be doing less.
Apparently this causes hangups and stuckups which is REALLY noticeable
on Ultra-Legacy devices.

Skip the scan — we’ll catch the reinstall next time packages.list updates.

Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
2025-05-15 17:39:41 +08:00
backslashxx
0d70cc8e58 kernel: sucompat: sucompat toggle support for non-kp (tiann#2506)
This is done like how vfs_read_hook, input_hook and execve_hook is disabled.
While this is not exactly the same thing, this CAN achieve the same results.
The complete disabling of all KernelSU hooks.

While this is likely unneeded, It keeps feature parity to non-kprobe builds.

adapted from upstream:
	kernel: Allow to re-enable sucompat - 4593ae81c7

Rejected: https://github.com/tiann/KernelSU/pull/2506

Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
2025-05-15 17:39:41 +08:00
ShirkNeko
acf2e1a5ec Update KSU_GIT_VERSION to use the master branch count and change the KernelSU manager name to SukiSU 2025-04-21 17:33:29 +08:00
ShirkNeko
33dd0ca16b Add check for GKI version and KERNEL_TYPE setting 2025-04-19 21:44:41 +08:00
liankong
1944a49fd8 添加super_access对task_struct的支持 2025-04-13 14:41:06 +08:00
ShirkNeko
06324def38 更新super_access.c to remove redundant macro definitions and optimize conditional compilation; use resource strings instead of hard-coded text in MoreSettings.kt; add theme color string resource in strings.xml 2025-04-13 01:33:40 +08:00
ShirkNeko
70259a5ec5 清理super_access.c中的多余空行 2025-04-12 17:00:14 +08:00
ShirkNeko
a63057c594 Merge branch 'dev' into main 2025-04-12 16:55:20 +08:00
ShirkNeko
48d5270611 Add super_access function to support dynamic access to structures and members 2025-04-12 16:52:13 +08:00
ShirkNeko
712d0f3342 更新super_access.c以支持不同内核版本的结构体成员定义 2025-04-12 16:29:13 +08:00
ShirkNeko
d6084aeca1 在super_access.c中添加对linux/version.h的引用,并定义KERNEL_VERSION_6_6宏,以支持不同内核版本的条件编译 2025-04-12 16:09:13 +08:00
ShirkNeko
562b9624d7 移除对linux/nsproxy.h的引用,并添加对../fs/mount.h的引用 2025-04-12 15:49:00 +08:00
ShirkNeko
a68d5e8bbe 在super_access.c中添加对linux/nsproxy.h的引用 2025-04-12 15:02:22 +08:00
ShirkNeko
d45aa8197e Remove unnecessary header file fs/mount.h and use linux/mount.h instead. 2025-04-12 14:54:10 +08:00
ShirkNeko
314d3ef97a 更新Makefile以使用super_access.o替代super_access.c 2025-04-12 14:44:50 +08:00
liankong
e3750ccd51 完善super_access 2025-04-12 10:35:08 +08:00
liankong
a712efe9d8 添加super_access机制 2025-04-12 00:34:37 +08:00
liankong
569183efe9 添加super_access机制 2025-04-11 15:19:18 +08:00
liankong
f0febf13f2 增加了两个必要的兼容函数,以确保能够运行Peekaboo.KPM 2025-04-07 19:43:06 +08:00
liankong
e9d0526e1b 1 2025-04-01 12:28:59 +08:00
liankong
8055aed507 Merge branch 'dev' of https://github.com/ShirkNeko/SukiSU-Ultra into dev 2025-03-31 20:28:31 +08:00
liankong
e7cef05c6a 修复 2025-03-31 20:28:26 +08:00
ShirkNeko
313746b578 Merge branch 'dev' of https://github.com/ShirkNeko/SukiSU-Ultra into dev 2025-03-31 20:27:40 +08:00
ShirkNeko
a7c557222c 修复Makefile中KPM状态信息的重复输出 2025-03-31 20:27:28 +08:00
liankong
9c902fb264 2 2025-03-31 20:24:56 +08:00
liankong
079f74d960 更改返回值处理方式 2025-03-31 19:47:22 +08:00
liankong
00d7de5276 1 2025-03-31 19:07:07 +08:00
liankong
3e928365de 1 2025-03-31 18:51:20 +08:00
liankong
47ba174fb1 尝试支持clang关闭优化 2025-03-31 18:31:21 +08:00
liankong
9446296daa 尝试禁用对壳函数的优化 2025-03-31 18:19:55 +08:00