pvmfw: Support com.android.virt.page_size
Replace the assumption that guests run with 4KiB page tables by adding
support for a new VBMeta descriptor property describing the size in use.
When absent, default to the previous assumption of 4KiB.
Set the property for the Micrdroid kernels with 16KiB PAGE_SIZE.
Add test coverage & document this in the README.
Bug: 339779843
Bug: 339782511
Test: atest libpvmfw_avb.integration_test
Change-Id: Ib3c2b87fd507046578cc95d892d01fa9b04bc5c7
diff --git a/guest/pvmfw/avb/Android.bp b/guest/pvmfw/avb/Android.bp
index 10c7841..0294322 100644
--- a/guest/pvmfw/avb/Android.bp
+++ b/guest/pvmfw/avb/Android.bp
@@ -37,6 +37,14 @@
":test_image_with_one_hashdesc",
":test_image_with_non_initrd_hashdesc",
":test_image_with_initrd_and_non_initrd_desc",
+ ":test_image_with_invalid_page_size",
+ ":test_image_with_negative_page_size",
+ ":test_image_with_overflow_page_size",
+ ":test_image_with_0k_page_size",
+ ":test_image_with_1k_page_size",
+ ":test_image_with_4k_page_size",
+ ":test_image_with_9k_page_size",
+ ":test_image_with_16k_page_size",
":test_image_with_service_vm_prop",
":test_image_with_unknown_vm_type_prop",
":test_image_with_duplicated_capability",
@@ -115,6 +123,118 @@
}
avb_add_hash_footer {
+ name: "test_image_with_invalid_page_size",
+ src: ":unsigned_test_image",
+ partition_name: "boot",
+ private_key: ":pvmfw_sign_key",
+ salt: "2134",
+ props: [
+ {
+ name: "com.android.virt.page_size",
+ value: "invalid",
+ },
+ ],
+}
+
+avb_add_hash_footer {
+ name: "test_image_with_negative_page_size",
+ src: ":unsigned_test_image",
+ partition_name: "boot",
+ private_key: ":pvmfw_sign_key",
+ salt: "2134",
+ props: [
+ {
+ name: "com.android.virt.page_size",
+ value: "-16",
+ },
+ ],
+}
+
+avb_add_hash_footer {
+ name: "test_image_with_overflow_page_size",
+ src: ":unsigned_test_image",
+ partition_name: "boot",
+ private_key: ":pvmfw_sign_key",
+ salt: "2134",
+ props: [
+ {
+ name: "com.android.virt.page_size",
+ value: "18014398509481983",
+ },
+ ],
+}
+
+avb_add_hash_footer {
+ name: "test_image_with_0k_page_size",
+ src: ":unsigned_test_image",
+ partition_name: "boot",
+ private_key: ":pvmfw_sign_key",
+ salt: "2134",
+ props: [
+ {
+ name: "com.android.virt.page_size",
+ value: "0",
+ },
+ ],
+}
+
+avb_add_hash_footer {
+ name: "test_image_with_1k_page_size",
+ src: ":unsigned_test_image",
+ partition_name: "boot",
+ private_key: ":pvmfw_sign_key",
+ salt: "2134",
+ props: [
+ {
+ name: "com.android.virt.page_size",
+ value: "1",
+ },
+ ],
+}
+
+avb_add_hash_footer {
+ name: "test_image_with_4k_page_size",
+ src: ":unsigned_test_image",
+ partition_name: "boot",
+ private_key: ":pvmfw_sign_key",
+ salt: "2134",
+ props: [
+ {
+ name: "com.android.virt.page_size",
+ value: "4",
+ },
+ ],
+}
+
+avb_add_hash_footer {
+ name: "test_image_with_9k_page_size",
+ src: ":unsigned_test_image",
+ partition_name: "boot",
+ private_key: ":pvmfw_sign_key",
+ salt: "2134",
+ props: [
+ {
+ name: "com.android.virt.page_size",
+ value: "9",
+ },
+ ],
+}
+
+avb_add_hash_footer {
+ name: "test_image_with_16k_page_size",
+ src: ":unsigned_test_image",
+ partition_name: "boot",
+ private_key: ":pvmfw_sign_key",
+ salt: "2134",
+ props: [
+ {
+ name: "com.android.virt.page_size",
+ value: "16",
+ },
+ ],
+}
+
+avb_add_hash_footer {
name: "test_image_with_service_vm_prop",
src: ":unsigned_test_image",
partition_name: "boot",