kernel: revert init stage for x86_64 temporarily

This commit is contained in:
tiann
2023-05-11 17:20:55 +08:00
parent 2b01a1c395
commit 72ee14e6be

View File

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