Have patchoat --verify verify symlinks
patchoat --verify now verifies that the vdex and oat symlinks in
/data/dalvik-cache point to the correct vdex and oat files in /system/.
This is to protect attacks that would change the symlink targets.
Refactoring of patchoat code was done too.
Bug: 66697305
Test: make test-art-host-gtest-patchoat_test
Test: remove a symlink and ensure patchoat verification fails
Test: modify a symlink and ensure patchoat verification fails
Change-Id: I18e8f9f6363cf18ad8fa879aeb4d8c7badf679a7
diff --git a/patchoat/patchoat.h b/patchoat/patchoat.h
index ba59d57..feba523 100644
--- a/patchoat/patchoat.h
+++ b/patchoat/patchoat.h
@@ -91,10 +91,9 @@
// Was the .oat image at oat_in made with --compile-pic ?
static MaybePic IsOatPic(const ElfFile* oat_in);
- // Attempt to replace the file with a symlink
- // Returns false if it fails
- static bool ReplaceOatFileWithSymlink(const std::string& input_oat_filename,
- const std::string& output_oat_filename);
+ static bool CreateVdexAndOatSymlinks(const std::string& input_image_filename,
+ const std::string& output_image_filename);
+
void VisitObject(mirror::Object* obj)
REQUIRES_SHARED(Locks::mutator_lock_);