From d2ed7ee19b6e6fd994607a21523966345ab792b7 Mon Sep 17 00:00:00 2001 From: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com> Date: Mon, 28 Jul 2025 17:54:53 +0800 Subject: [PATCH] KernelSU: Fix SUS_SU bootloops on some device because of improper sizeof(su) in sucompat.c - There must be a reason for doing [sizeof(su) + 1 ] wthin the syscall handlers in the original sucompat.c but I dont know why, but it does fix the bootloop for some devices. - I will be shocked if sizeof(su) produces different result on different kernel, since it works on pixel8 and no bootloops whatsoever. Co-authored-by: simonpunk --- kernel/sucompat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/sucompat.c b/kernel/sucompat.c index ab359a77..df204589 100644 --- a/kernel/sucompat.c +++ b/kernel/sucompat.c @@ -72,7 +72,7 @@ int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode, #endif #ifdef CONFIG_KSU_SUSFS_SUS_SU - char path[sizeof(su)] = {0}; + char path[sizeof(su) + 1] = {0}; #else char path[sizeof(su) + 1]; memset(path, 0, sizeof(path)); @@ -126,7 +126,7 @@ int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags) } #ifdef CONFIG_KSU_SUSFS_SUS_SU - char path[sizeof(su)] = {0}; + char path[sizeof(su) + 1] = {0}; #else char path[sizeof(su) + 1]; memset(path, 0, sizeof(path)); @@ -199,7 +199,7 @@ int ksu_handle_execve_sucompat(int *fd, const char __user **filename_user, { //const char su[] = SU_PATH; #ifdef CONFIG_KSU_SUSFS_SUS_SU - char path[sizeof(su)] = {0}; + char path[sizeof(su) + 1] = {0}; #else char path[sizeof(su) + 1]; #endif