From f157f0bd3132cee7d5021c5987c1784f639400c2 Mon Sep 17 00:00:00 2001 From: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com> Date: Mon, 7 Apr 2025 19:51:18 +0800 Subject: [PATCH] Add KPM-compatible functions to support UID checking and exclusion logic --- kernel/kpm/compact.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/kernel/kpm/compact.c b/kernel/kpm/compact.c index e25a7a53..01f00e80 100644 --- a/kernel/kpm/compact.c +++ b/kernel/kpm/compact.c @@ -26,9 +26,29 @@ #include #include "kpm.h" #include "compact.h" +#include "../allowlist.h" unsigned long sukisu_compact_find_symbol(const char* name); +// ====================================================================== +// 兼容函数 for KPM + +static +int sukisu_is_su_allow_uid(uid_t uid) { + return ksu_is_allow_uid(uid) ? 1 : 0; +} + +static +int sukisu_get_ap_mod_exclude(uid_t uid) { + // Not supported + return 0; +} + +static +int sukisu_is_uid_should_umount(uid_t uid) { + return ksu_uid_should_umount(uid) ? 1 : 0; +} + // ====================================================================== struct CompactAddressSymbol { @@ -39,7 +59,10 @@ struct CompactAddressSymbol { static struct CompactAddressSymbol address_symbol [] = { { "kallsyms_lookup_name", &kallsyms_lookup_name }, { "compact_find_symbol", &sukisu_compact_find_symbol }, - { "is_run_in_sukisu_ultra", (void*)1 } + { "is_run_in_sukisu_ultra", (void*)1 }, + { "is_su_allow_uid", &sukisu_is_su_allow_uid }, + { "get_ap_mod_exclude", &sukisu_get_ap_mod_exclude }, + { "is_uid_should_umount", &sukisu_is_uid_should_umount } }; unsigned long sukisu_compact_find_symbol(const char* name) {