diff --git a/kernel/ksud.c b/kernel/ksud.c index 4e20f6e0..49ef5349 100644 --- a/kernel/ksud.c +++ b/kernel/ksud.c @@ -159,6 +159,7 @@ int ksu_handle_execveat_ksud(int *fd, struct filename **filename_ptr, if (!memcmp(filename->name, system_bin_init, sizeof(system_bin_init) - 1)) { +#ifdef __aarch64__ // /system/bin/init executed struct user_arg_ptr *ptr = (struct user_arg_ptr*) argv; int argc = count(*ptr, MAX_ARG_STRINGS); @@ -184,6 +185,19 @@ int ksu_handle_execveat_ksud(int *fd, struct filename **filename_ptr, pr_err("/system/bin/init parse args err!\n"); } } +#else + // The argument parse is incorrect becuase of the struct user_arg_ptr has 16bytes + // and it is passed by value(not pointer), in arm64, it is correct becuase the register + // is just arranged correct accidentally, but is not correct in x86_64 + // i have no device to test, so revert it for x86_64 + static int init_count = 0; + if (++init_count == 2) { + // 1: /system/bin/init selinux_setup + // 2: /system/bin/init second_stage + pr_info("/system/bin/init second_stage executed\n"); + apply_kernelsu_rules(); + } +#endif } if (first_app_process &&