* refactor: replace throne tracker with ksud token
* use snprintf
* refactor: new supercall impl
- Import the sukisu command
* disable seccomp for supercall users
* kernel: fmt clear
* kernel: Enable macro protection for sulog
- Only enabled on kernel versions greater than 5.10.245
* kernel: Refactor kprobe hooks and implement LSM hooks for improved security handling
* debug mode
* kernel: Add functionality to generate and validate authentication tokens for cmd_su
* kernel: Simplified manual SU command processing for code
* kernel: replace renameat hook with fsnotify
* Revert "refactor: replace throne tracker with ksud token"
This reverts commit aa2cbbf9cd.
* kernel: fix compile
* kernel: fix compile below 6.0
* Fix compile err; Add become_manager
* kernel: install fd for manager automaticlly
- extend to import the corresponding command
* manager: new supercall impl
* temp changes for ksud
* ksud: fix compile
* fix wrong opcode
* kernel: fix compile
* kernel: Fixed hook type and KPM status retrieval errors
* kernel: Fixed potential null pointer issue with current->mm in kernel version 5.10
When calling get_full_comm() within system call hooks, current->mm may be null (prctl). A fallback mechanism for current->comm must be added beforehand to prevent null pointer dereferences when accessing mm->arg_start/arg_end.
Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
* ksud: fix cargo check
* manager: Fixed an issue where the KSUD release and user-mode scanning switch failed to function correctly.
- kernel: fix spin lock mutual
kernel: Fixed potential null pointer issue with current->mm in kernel version 5.10
When calling get_full_comm() within system call hooks, current->mm may be null (prctl). A fallback mechanism for current->comm must be added beforehand to prevent null pointer dereferences when accessing mm->arg_start/arg_end.
kernel: try introduce like susfs's method to fix prctl delay
* seccomp: allow reboot
* use u32
* update clang-format
* 4 spaces save the world
* ksud: Fix build on macOS
* manager: bump minimal supported kernel.
- When get_hook_type is empty, display “Unknown”.
* Fix ksud build (#2841)
* try fix ksud
* fix for macos
* remove any
* Fix ksud build, take 3
* try fix allowlist
* bring lsm hook back
* fix: a lot again
* Fix ksud build, take 4 (#2846)
Remove init_driver_fd function for non-linux/android targets
* manager: Return to the native method via KSUd installation
* Merge with susfs-mian format
---------
Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: weishu <twsxtd@gmail.com>
Co-authored-by: AlexLiuDev233 <wzylin11@outlook.com>
Co-authored-by: Wang Han <416810799@qq.com>
70 lines
2.7 KiB
C
70 lines
2.7 KiB
C
#include "ksu_trace.h"
|
|
|
|
|
|
// extern kernelsu functions
|
|
extern bool ksu_vfs_read_hook __read_mostly;
|
|
extern bool ksu_input_hook __read_mostly;
|
|
extern int ksu_handle_execveat(int *fd, struct filename **filename_ptr, void *argv, void *envp, int *flags);
|
|
extern int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode, int *flags);
|
|
extern int ksu_handle_sys_read(unsigned int fd, char __user **buf_ptr, size_t *count_ptr);
|
|
extern int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags);
|
|
extern int ksu_handle_input_handle_event(unsigned int *type, unsigned int *code, int *value);
|
|
// end kernelsu functions
|
|
|
|
|
|
// tracepoint callback functions
|
|
void ksu_trace_execveat_hook_callback(void *data, int *fd, struct filename **filename_ptr,
|
|
void *argv, void *envp, int *flags)
|
|
{
|
|
ksu_handle_execveat(fd, filename_ptr, argv, envp, flags);
|
|
}
|
|
|
|
void ksu_trace_faccessat_hook_callback(void *data, int *dfd, const char __user **filename_user,
|
|
int *mode, int *flags)
|
|
{
|
|
ksu_handle_faccessat(dfd, filename_user, mode, flags);
|
|
}
|
|
|
|
void ksu_trace_sys_read_hook_callback(void *data, unsigned int fd, char __user **buf_ptr,
|
|
size_t *count_ptr)
|
|
{
|
|
if (unlikely(ksu_vfs_read_hook))
|
|
ksu_handle_sys_read(fd, buf_ptr, count_ptr);
|
|
}
|
|
|
|
void ksu_trace_stat_hook_callback(void *data, int *dfd, const char __user **filename_user,
|
|
int *flags)
|
|
{
|
|
ksu_handle_stat(dfd, filename_user, flags);
|
|
}
|
|
|
|
void ksu_trace_input_hook_callback(void *data, unsigned int *type, unsigned int *code,
|
|
int *value)
|
|
{
|
|
if (unlikely(ksu_input_hook))
|
|
ksu_handle_input_handle_event(type, code, value);
|
|
}
|
|
|
|
// end tracepoint callback functions
|
|
|
|
|
|
// register tracepoint callback functions
|
|
void ksu_trace_register(void)
|
|
{
|
|
register_trace_ksu_trace_execveat_hook(ksu_trace_execveat_hook_callback, NULL);
|
|
register_trace_ksu_trace_faccessat_hook(ksu_trace_faccessat_hook_callback, NULL);
|
|
register_trace_ksu_trace_sys_read_hook(ksu_trace_sys_read_hook_callback, NULL);
|
|
register_trace_ksu_trace_stat_hook(ksu_trace_stat_hook_callback, NULL);
|
|
register_trace_ksu_trace_input_hook(ksu_trace_input_hook_callback, NULL);
|
|
}
|
|
|
|
// unregister tracepoint callback functions
|
|
void ksu_trace_unregister(void)
|
|
{
|
|
unregister_trace_ksu_trace_execveat_hook(ksu_trace_execveat_hook_callback, NULL);
|
|
unregister_trace_ksu_trace_faccessat_hook(ksu_trace_faccessat_hook_callback, NULL);
|
|
unregister_trace_ksu_trace_sys_read_hook(ksu_trace_sys_read_hook_callback, NULL);
|
|
unregister_trace_ksu_trace_stat_hook(ksu_trace_stat_hook_callback, NULL);
|
|
unregister_trace_ksu_trace_input_hook(ksu_trace_input_hook_callback, NULL);
|
|
}
|