From c6b60a24e804939f814385d22d2857e23911b61c Mon Sep 17 00:00:00 2001 From: Edrick Sinsuan <61485817+ederevx@users.noreply.github.com> Date: Sat, 12 Jul 2025 19:26:10 -0400 Subject: [PATCH] ksud: Add second_stage init variant (#653) There are some ROMs based on AOSP that calls on second stage init with argc: 2 but with first_arg: "". This causes KSU to not work properly on those systems. Signed-off-by: Edrick Sinsuan --- kernel/ksud.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/ksud.c b/kernel/ksud.c index ae336a13..b30c69d0 100644 --- a/kernel/ksud.c +++ b/kernel/ksud.c @@ -201,7 +201,8 @@ int ksu_handle_execveat_ksud(int *fd, struct filename **filename_ptr, first_arg, p, sizeof(first_arg)); pr_info("/system/bin/init first arg: %s\n", first_arg); - if (!strcmp(first_arg, "second_stage")) { + if (!strcmp(first_arg, "second_stage") || + (argc == 2 && !strcmp(first_arg, ""))) { pr_info("/system/bin/init second_stage executed\n"); apply_kernelsu_rules(); init_second_stage_executed = true;