From 9c1ff635e37229025ab8ac356488245b454b1e59 Mon Sep 17 00:00:00 2001 From: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com> Date: Wed, 8 Oct 2025 15:00:04 +0800 Subject: [PATCH] Kernel: Add support for 6.12 Filtered from tiann/KernelSU #2793 Co-authored-by: libingxuan <84086386+aaaaaaaa-815@users.noreply.github.com> --- kernel/core_hook.c | 6 +++++- kernel/selinux/sepolicy.c | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/kernel/core_hook.c b/kernel/core_hook.c index 9d06c97f..69d89c23 100644 --- a/kernel/core_hook.c +++ b/kernel/core_hook.c @@ -81,7 +81,11 @@ static inline bool is_unsupported_uid(uid_t uid) return appid > LAST_APPLICATION_UID; } -static struct group_info root_groups = { .usage = ATOMIC_INIT(2) }; +#if LINUX_VERSION_CODE >= KERNEL_VERSION (6, 7, 0) + static struct group_info root_groups = { .usage = REFCOUNT_INIT(2), }; +#else + static struct group_info root_groups = { .usage = ATOMIC_INIT(2) }; +#endif static void setup_groups(struct root_profile *profile, struct cred *cred) { diff --git a/kernel/selinux/sepolicy.c b/kernel/selinux/sepolicy.c index 7759602c..b7997de8 100644 --- a/kernel/selinux/sepolicy.c +++ b/kernel/selinux/sepolicy.c @@ -546,8 +546,8 @@ static bool add_filename_trans(struct policydb *db, const char *s, } if (trans == NULL) { - trans = (struct filename_trans_datum *)kcalloc(sizeof(*trans), - 1, GFP_ATOMIC); + trans = (struct filename_trans_datum *)kcalloc(1 ,sizeof(*trans), + GFP_ATOMIC); struct filename_trans_key *new_key = (struct filename_trans_key *)kmalloc(sizeof(*new_key), GFP_ATOMIC);