init_gsi: run SPL prop spoofing on late-init instead of post-fs

This fixes a potential race between starting init_gsi and vold / vdc /
keystore / keymaster... which could cause havoc if the TEE
implementation is stringent on SPL.
This commit is contained in:
Peter Cai 2022-05-30 15:59:47 -04:00
parent fa8948b1aa
commit aec3bfb881
2 changed files with 11 additions and 3 deletions

View file

@ -58,8 +58,13 @@ void handle_device_model_props() {
override_ro_prop("ro", "", "build.version.real_security_patch", spl_orig);
}
int main() {
handle_device_model_props();
Quirks::Run();
int main(int argc, char **argv) {
if (argc >= 2 && strcmp(argv[1], "--late-init") == 0) {
// Reset SPL / device model related props during late init
// so that they are set before keystore / vold is started.
handle_device_model_props();
} else {
Quirks::Run();
}
return 0;
}

View file

@ -1,2 +1,5 @@
on late-init
exec u:r:init_gsi:s0 root -- /system_ext/bin/init_gsi --late-init
on post-fs
exec u:r:init_gsi:s0 root -- /system_ext/bin/init_gsi