Commit Graph

44 Commits

Author SHA1 Message Date
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
Ylarod
dcbc014039 fix: mark tif (#2871) 2025-11-06 14:37:47 +08:00
ShirkNeko
2075d2867e kernel: Migrating KPM to ioctl 2025-11-04 00:54:38 +08:00
ShirkNeko
e41fa8ef62 Revert renaming symbols in KernelSU driver
- In order to reduce the extra patch code and increase the rate of hunk succeed, we do not rename the symbols in KernelSU drvier but instead do it all in kernel/kallsym.c

- Make susfs_starts_with() global as it maybe useful in future

Co-authored-by: simonpunk <simonpunk2016@gmail.com>
2025-08-25 19:29:14 +08:00
Prslc
da89b00d06 kernel(kpm): Fix typo in printk logs (#311)
Signed-off-by: Prslc <prslc113@gmail.com>
2025-08-10 17:59:45 +08:00
sidex15
ba71b410db kernel: kpm: add compatibility for kernel 4.14 and lower (#76)
`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)
2025-05-15 23:05:03 +08:00
ShirkNeko
d77ee31bce Add support for KERNEL_VERSION_4_10 in super_access.c and move variable declarations in for loops outside the loop to improve code readability 2025-04-25 19:12:53 +08:00
ShirkNeko
140ebd196f Add support for kernel version 6.12, update conditional compilation definitions in super_access.c 2025-04-15 16:13:16 +08:00
liankong
b7b739824e 添加super_access对task_struct的支持 2025-04-13 14:23:53 +08:00
ShirkNeko
e2f89709d1 Remove macro definitions in super_access.c for kernel version 4.14 to simplify structural definitions 2025-04-12 19:31:39 +08:00
ShirkNeko
546929da55 Remove conditional compilation for kernel version 4.14 in super_access.c to simplify kprobe structure definition 2025-04-12 19:30:55 +08:00
ShirkNeko
97aaea7d86 Remove macro definitions for kernel versions 5.0 and 5.10 in super_access.c, and adjust conditional compilation to support kernel versions 4.14 and 5.15. 2025-04-12 19:07:33 +08:00
ShirkNeko
2cbe1b9e9a Update kernel version macro definitions to add support for kernel version 5.0 and adjust conditional compilation for newer versions 2025-04-12 19:02:52 +08:00
ShirkNeko
51a0357f0f 在 super_access.c 中添加对内核版本 6.6 和 5.15 的宏定义,并调整条件编译以适应新的内核版本 2025-04-12 16:23:27 +08:00
ShirkNeko
44d85cfdd7 在 super_access.c 中添加对内核版本 4.14 的宏定义,并根据内核版本条件编译相关成员 2025-04-12 16:16:06 +08:00
ShirkNeko
662d5494b2 更新内核版本宏定义为 6.1,并相应调整条件编译的成员定义 2025-04-12 16:12:28 +08:00
ShirkNeko
10e05689e5 在 super_access.c 中添加对 linux/version.h 的引用,并根据内核版本条件定义相关成员 2025-04-12 16:09:48 +08:00
ShirkNeko
fd0066cdf6 更改 sukisu_is_current_uid_manager 函数以使用 ksu_is_manager 代替 is_manager 2025-04-12 15:28:38 +08:00
ShirkNeko
84b215f989 移除 super_access.c 中不必要的 break_handler 成员定义 2025-04-12 15:20:44 +08:00
ShirkNeko
4e950183e3 移除 super_access.c 中不必要的 linux/nsproxy.h 头文件引用 2025-04-12 15:19:29 +08:00
ShirkNeko
95d3eac98e 在 super_access.c 中添加对 fs/mount.h 的引用 2025-04-12 15:15:56 +08:00
ShirkNeko
61eb7203c4 在 super_access.c 中添加对 linux/nsproxy.h 的引用 2025-04-12 15:02:44 +08:00
ShirkNeko
a96367a177 Remove unnecessary header file fs/mount.h and use linux/mount.h instead. 2025-04-12 14:53:00 +08:00
ShirkNeko
80a9ec1498 更新 Makefile,将 super_access.c 更改为 super_access.o 2025-04-12 14:43:55 +08:00
liankong
b002bcd38a Add super_access.c and super_access.h files to define the functions related to dynamically accessing structures. 2025-04-12 13:57:59 +08:00
ShirkNeko
bae61b03c5 Add dynamic structure metadata support to enhance readability and maintainability of kernel modules 2025-04-11 17:33:47 +08:00
ShirkNeko
4bc272f543 删除 KPM 模块加载器源文件 2025-04-07 20:56:04 +08:00
ShirkNeko
07a59692d1 Add a KPM module loader to support traversing directories and loading .kpm files. 2025-04-07 20:41:15 +08:00
ShirkNeko
f157f0bd31 Add KPM-compatible functions to support UID checking and exclusion logic 2025-04-07 19:51:18 +08:00
ShirkNeko
f17e106464 移除 KPM 模块中函数的可见性修饰符,简化代码结构 2025-04-01 12:38:06 +08:00
ShirkNeko
aa7fd2fe2b 移除 compact.c 中对 sukisu_compact_find_symbol 函数的可见性修饰符,简化代码结构 2025-04-01 12:26:15 +08:00
ShirkNeko
78b662c360 更新 KPM 模块中的 copy_to_user 调用,增加对内核版本的条件编译支持,优化错误处理逻辑 2025-04-01 12:24:04 +08:00
ShirkNeko
f13de4f0d4 优化 KPM 模块中 copy_to_user 调用的错误处理,简化代码结构 2025-04-01 12:19:06 +08:00
ShirkNeko
88a84b71b7 修复 KPM 模块中 copy_to_user 调用的错误处理,确保在复制失败时记录错误信息 2025-04-01 12:04:40 +08:00
ShirkNeko
dc8b89adde 移除 compact.c 中对 copy_to_user 函数的外部声明,简化代码结构 2025-04-01 11:43:22 +08:00
ShirkNeko
0445d9b968 在 compact.c 中添加对 copy_to_user 函数的外部声明,并调整编译选项以优化性能 2025-04-01 11:32:40 +08:00
ShirkNeko
039083c971 移除 copy_to_user 函数的实现,简化代码结构 2025-04-01 11:27:54 +08:00
ShirkNeko
48227de1c8 更新 KPM 模块,调整函数节区标记以优化内存布局,并添加用户数据复制功能 2025-04-01 11:14:54 +08:00
ShirkNeko
0fecd7628b 更新 Makefile,移除 LTO 类型不匹配警告的编译选项 2025-04-01 10:56:57 +08:00
ShirkNeko
f8e456dfcf 更新 KPM 模块,添加函数节区标记以优化内存布局,并在 Makefile 中调整编译选项以消除类型不匹配警告 2025-04-01 10:35:02 +08:00
ShirkNeko
9b9d72f200 更新 KPM 模块,添加错误处理以确保用户数据复制成功 2025-03-31 20:39:40 +08:00
ShirkNeko
6c4b73a38e 更新 KPM 模块,调整函数参数以支持额外的用户结果返回 2025-03-31 20:10:32 +08:00
ShirkNeko
cdf5e7b869 更新 KPM 模块,增加对 compact.o 的支持,并调整控制代码定义 2025-03-31 19:36:45 +08:00
ShirkNeko
743ddce9f7 添加 KPM 模块支持,包括 KPM 配置选项、核心功能实现及相关头文件 2025-03-30 02:54:23 +08:00