ART: Add boot/app image checksums.
And check app oat files against the boot image checksum
instead of checking the oat checksum. The oat checksums are
included in image checksum calculations and the primary
image checksum calculation includes the checksums of the
secondary images.
Also remove the obsolete "patch delta" to keep the size
of the ImageHeader 8-byte aligned, remove the key-value
store from secondary oat files and move the oat checksum
update code from oat.cc to the oat_writer.cc.
Test: m test-art-host-gtest
Test: testrunner.py --host
Test: Pixel 2 XL boots.
Test: m test-art-target-gtest
Change-Id: If74f5f18479c44ede0503bf1911ddb9ff8f3c4f8
diff --git a/runtime/image.cc b/runtime/image.cc
index 59ac283..f4c3fea 100644
--- a/runtime/image.cc
+++ b/runtime/image.cc
@@ -26,7 +26,7 @@
namespace art {
const uint8_t ImageHeader::kImageMagic[] = { 'a', 'r', 't', '\n' };
-const uint8_t ImageHeader::kImageVersion[] = { '0', '6', '7', '\0' }; // Added CRC32 intrinsic
+const uint8_t ImageHeader::kImageVersion[] = { '0', '6', '8', '\0' }; // Image checksums.
ImageHeader::ImageHeader(uint32_t image_begin,
uint32_t image_size,
@@ -46,6 +46,7 @@
size_t data_size)
: image_begin_(image_begin),
image_size_(image_size),
+ image_checksum_(0u),
oat_checksum_(oat_checksum),
oat_file_begin_(oat_file_begin),
oat_data_begin_(oat_data_begin),
@@ -55,7 +56,6 @@
boot_image_size_(boot_image_size),
boot_oat_begin_(boot_oat_begin),
boot_oat_size_(boot_oat_size),
- patch_delta_(0),
image_roots_(image_roots),
pointer_size_(pointer_size),
storage_mode_(storage_mode),
@@ -79,7 +79,6 @@
oat_data_begin_ += delta;
oat_data_end_ += delta;
oat_file_end_ += delta;
- patch_delta_ += delta;
RelocateImageObjects(delta);
RelocateImageMethods(delta);
}
@@ -115,9 +114,6 @@
if (oat_file_begin_ >= oat_data_begin_) {
return false;
}
- if (!IsAligned<kPageSize>(patch_delta_)) {
- return false;
- }
return true;
}