Verify that the elf matches the expected arch.

To avoid a case where a malicious app might try and trick the system to
create an elf and register object that mismatches, always verify that they
are the same arch.

Test: Ran unit tests.
Change-Id: I66978e9e02f8e4f396856912e7019528ead4838e
diff --git a/libunwindstack/Elf.cpp b/libunwindstack/Elf.cpp
index 60ef796..4d72ead 100644
--- a/libunwindstack/Elf.cpp
+++ b/libunwindstack/Elf.cpp
@@ -88,6 +88,11 @@
   }
 }
 
+void Elf::Invalidate() {
+  interface_.reset(nullptr);
+  valid_ = false;
+}
+
 bool Elf::GetSoname(std::string* name) {
   std::lock_guard<std::mutex> guard(lock_);
   return valid_ && interface_->GetSoname(name);