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 <evcsinsuan@gmail.com>
This commit is contained in:
Edrick Sinsuan
2025-07-12 19:26:10 -04:00
committed by GitHub
parent 1baedd89b7
commit c6b60a24e8

View File

@@ -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;