fskeyring & userspace reboot: support CE keys

During userspace reboot /data might be unmounted & remounted, meaning
that CE keys stored in fs-level keyring will be lost. In order to be
able to restore them, when installing new key to fs-level keyring, it's
also added to session-level keyring with type "fscrypt-provisioning".

Then when init_user0 is called during userspace reboot, vold will try to
load CE keys from the session-level keyring back into fs-level keyring
for all the users that were unlocked before the reboot.

If for any user vold fails to install the key, init_user0 will fail and
fallback to hard reboot will be triggered.

Test: set a pin pattern
Test: adb shell setprop sys.init.userdata_remount.force_umount 1
Test: adb shell svc power reboot userspace
Test: atest CtsUserspaceRebootHostSideTestCases
Bug: 143970043
Change-Id: I37603dc136c7ededc7b0381e4d730cb0ffd912b4
Merged-In: I37603dc136c7ededc7b0381e4d730cb0ffd912b4
(cherry picked from commit 1ee35cf002de9f6aaa6f33e67d882cdbbaa35cc2)
diff --git a/fscrypt_uapi.h b/fscrypt_uapi.h
index 08592e0..3cda96e 100644
--- a/fscrypt_uapi.h
+++ b/fscrypt_uapi.h
@@ -9,11 +9,19 @@
 struct sys_fscrypt_add_key_arg {
     struct fscrypt_key_specifier key_spec;
     __u32 raw_size;
-    __u32 __reserved[8];
+    __u32 key_id;
+    __u32 __reserved[7];
     __u32 flags;
     __u8 raw[];
 };
 
+struct sys_fscrypt_provisioning_key_payload {
+    __u32 type;
+    __u32 __reserved;
+    __u8 raw[];
+};
+
 #define fscrypt_add_key_arg sys_fscrypt_add_key_arg
+#define fscrypt_provisioning_key_payload sys_fscrypt_provisioning_key_payload
 
 #endif  //_UAPI_LINUX_FSCRYPT_VOLD_H