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 <simonpunk2016@gmail.com>
This commit is contained in:
ShirkNeko
2025-07-28 17:54:53 +08:00
parent 9ff53ce683
commit d2ed7ee19b

View File

@@ -72,7 +72,7 @@ int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,
#endif #endif
#ifdef CONFIG_KSU_SUSFS_SUS_SU #ifdef CONFIG_KSU_SUSFS_SUS_SU
char path[sizeof(su)] = {0}; char path[sizeof(su) + 1] = {0};
#else #else
char path[sizeof(su) + 1]; char path[sizeof(su) + 1];
memset(path, 0, sizeof(path)); 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 #ifdef CONFIG_KSU_SUSFS_SUS_SU
char path[sizeof(su)] = {0}; char path[sizeof(su) + 1] = {0};
#else #else
char path[sizeof(su) + 1]; char path[sizeof(su) + 1];
memset(path, 0, sizeof(path)); 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; //const char su[] = SU_PATH;
#ifdef CONFIG_KSU_SUSFS_SUS_SU #ifdef CONFIG_KSU_SUSFS_SUS_SU
char path[sizeof(su)] = {0}; char path[sizeof(su) + 1] = {0};
#else #else
char path[sizeof(su) + 1]; char path[sizeof(su) + 1];
#endif #endif