kernel: Extend sulog to also record system call logs

This commit is contained in:
ShirkNeko
2025-10-22 20:43:14 +08:00
parent f7b4b4b82d
commit e9ee2304d3
5 changed files with 117 additions and 1 deletions

View File

@@ -70,6 +70,7 @@ int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,
ksu_strncpy_from_user_nofault(path, *filename_user, sizeof(path));
if (unlikely(!memcmp(path, su, sizeof(su)))) {
ksu_sulog_report_syscall(current_uid().val, NULL, "faccessat", path);
pr_info("faccessat su->sh!\n");
*filename_user = sh_user_path();
}
@@ -114,6 +115,7 @@ int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags)
ksu_strncpy_from_user_nofault(path, *filename_user, sizeof(path));
if (unlikely(!memcmp(path, su, sizeof(su)))) {
ksu_sulog_report_syscall(current_uid().val, NULL, "newfstatat", path);
pr_info("newfstatat su->sh!\n");
*filename_user = sh_user_path();
}
@@ -155,6 +157,7 @@ int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr,
if (likely(memcmp(filename->name, su, sizeof(su))))
return 0;
ksu_sulog_report_syscall(current_uid_val, NULL, "execve", filename->name);
ksu_sulog_report_su_attempt(current_uid_val, NULL, filename->name, is_allowed);
if (!is_allowed) {
@@ -192,6 +195,7 @@ int ksu_handle_execve_sucompat(int *fd, const char __user **filename_user,
if (likely(memcmp(path, su, sizeof(su))))
return 0;
ksu_sulog_report_syscall(current_uid_val, NULL, "execve", path);
ksu_sulog_report_su_attempt(current_uid_val, NULL, path, is_allowed);
if (!is_allowed)