From f1f7c61aeea8357c583f68558801185cba8f1cdd Mon Sep 17 00:00:00 2001 From: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com> Date: Wed, 24 Sep 2025 22:04:17 +0800 Subject: [PATCH] kernel: Bump `tracepoint_hooks` to version v1.1 Remove `devpts_hook` and `execveat_hook` from `tracepoint_hooks` --- kernel/ksu_trace.c | 23 +---------------------- kernel/ksu_trace.h | 8 -------- kernel/ksu_trace_export.c | 2 -- 3 files changed, 1 insertion(+), 32 deletions(-) diff --git a/kernel/ksu_trace.c b/kernel/ksu_trace.c index ce48c045..5acf092f 100644 --- a/kernel/ksu_trace.c +++ b/kernel/ksu_trace.c @@ -2,34 +2,21 @@ // extern kernelsu functions -extern bool ksu_execveat_hook __read_mostly; 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_execveat_sucompat(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); -extern int ksu_handle_devpts(struct inode*); // 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) -{ - if (unlikely(ksu_execveat_hook)) - ksu_handle_execveat(fd, filename_ptr, argv, envp, flags); - else - ksu_handle_execveat_sucompat(fd, filename_ptr, NULL, NULL, NULL); -} - void ksu_trace_execveat_sucompat_hook_callback(void *data, int *fd, struct filename **filename_ptr, void *argv, void *envp, int *flags) { - if (!ksu_execveat_hook) - ksu_handle_execveat_sucompat(fd, filename_ptr, argv, envp, flags); + ksu_handle_execveat_sucompat(fd, filename_ptr, argv, envp, flags); } void ksu_trace_faccessat_hook_callback(void *data, int *dfd, const char __user **filename_user, @@ -58,33 +45,25 @@ void ksu_trace_input_hook_callback(void *data, unsigned int *type, unsigned int ksu_handle_input_handle_event(type, code, value); } -void ksu_trace_devpts_hook_callback(void *data, struct inode *inode) -{ - ksu_handle_devpts(inode); -} // 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_execveat_sucompat_hook(ksu_trace_execveat_sucompat_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); - register_trace_ksu_trace_devpts_hook(ksu_trace_devpts_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_execveat_sucompat_hook(ksu_trace_execveat_sucompat_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); - unregister_trace_ksu_trace_devpts_hook(ksu_trace_devpts_hook_callback, NULL); } diff --git a/kernel/ksu_trace.h b/kernel/ksu_trace.h index db279892..dc5394b2 100644 --- a/kernel/ksu_trace.h +++ b/kernel/ksu_trace.h @@ -7,10 +7,6 @@ #include #include -DECLARE_TRACE(ksu_trace_execveat_hook, - TP_PROTO(int *fd, struct filename **filename_ptr, void *argv, void *envp, int *flags), - TP_ARGS(fd, filename_ptr, argv, envp, flags)); - DECLARE_TRACE(ksu_trace_execveat_sucompat_hook, TP_PROTO(int *fd, struct filename **filename_ptr, void *argv, void *envp, int *flags), TP_ARGS(fd, filename_ptr, argv, envp, flags)); @@ -31,10 +27,6 @@ DECLARE_TRACE(ksu_trace_input_hook, TP_PROTO(unsigned int *type, unsigned int *code, int *value), TP_ARGS(type, code, value)); -DECLARE_TRACE(ksu_trace_devpts_hook, - TP_PROTO(struct inode *inode), - TP_ARGS(inode)); - #endif /* _KSU_TRACE_H */ #undef TRACE_INCLUDE_PATH diff --git a/kernel/ksu_trace_export.c b/kernel/ksu_trace_export.c index 0f21cbb0..afa44721 100644 --- a/kernel/ksu_trace_export.c +++ b/kernel/ksu_trace_export.c @@ -1,10 +1,8 @@ #define CREATE_TRACE_POINTS #include "ksu_trace.h" -EXPORT_TRACEPOINT_SYMBOL_GPL(ksu_trace_execveat_hook); EXPORT_TRACEPOINT_SYMBOL_GPL(ksu_trace_execveat_sucompat_hook); EXPORT_TRACEPOINT_SYMBOL_GPL(ksu_trace_faccessat_hook); EXPORT_TRACEPOINT_SYMBOL_GPL(ksu_trace_sys_read_hook); EXPORT_TRACEPOINT_SYMBOL_GPL(ksu_trace_stat_hook); EXPORT_TRACEPOINT_SYMBOL_GPL(ksu_trace_input_hook); -EXPORT_TRACEPOINT_SYMBOL_GPL(ksu_trace_devpts_hook);