From 08fc1be97f792cedc147e383e73af735627511ab Mon Sep 17 00:00:00 2001 From: Rissu <90097027+rsuntk@users.noreply.github.com> Date: Mon, 24 Mar 2025 02:57:54 +0700 Subject: [PATCH] kernel: suggest user to enable CONFIG_KSU_ALLOWLIST_WORKAROUND if -ENOKEY It's better to give some suggestion regarding allowlist workaround, so its easier to know incase allowlist bug happened. -ENOKEY or "No required key found" error is the most common issue on certain devices, and most peoples has proved that by enabling kernelsu's init_keyring, can fix this issue. Rissu's note: Yet, if you still get allowlist bug, even after enabling this workaround, please report it and provide logs. --- kernel/allowlist.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/allowlist.c b/kernel/allowlist.c index 8010305a..c0b16c18 100644 --- a/kernel/allowlist.c +++ b/kernel/allowlist.c @@ -8,6 +8,7 @@ #include #include #include +#include #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) #include #endif @@ -367,7 +368,13 @@ static void do_save_allow_list(struct work_struct *work) struct file *fp = ksu_filp_open_compat(KERNEL_SU_ALLOWLIST, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (IS_ERR(fp)) { - pr_err("save_allow_list create file failed: %ld\n", PTR_ERR(fp)); + if ((PTR_ERR(fp) == -ENOKEY) && !IS_ENABLED(CONFIG_KSU_ALLOWLIST_WORKAROUND)) { + pr_info("filp_open: required key not found! (-ENOKEY)\n"); + pr_info("Try enable CONFIG_KSU_ALLOWLIST_WORKAROUND in your kernel.\n"); + pr_info("If you still encountered issue with allowlist, please report it.\n"); + return; + } else + pr_err("save_allow_list create file failed: %ld\n", PTR_ERR(fp)); return; }