ART: Add integrity check
Add access-flags setter DCHECK code similar to the getter. For now,
check that the verification-attempted flag is not removed.
Bug: 115834172
Test: m test-art-host
Change-Id: Ia1027126b2ff1a2a2e3c26f674a5f8dc8d2f0c0a
diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc
index 83d76a9..8eff21c 100644
--- a/runtime/mirror/class.cc
+++ b/runtime/mirror/class.cc
@@ -1461,5 +1461,12 @@
template void Class::GetAccessFlagsDCheck<kVerifyWrites>();
template void Class::GetAccessFlagsDCheck<kVerifyAll>();
+void Class::SetAccessFlagsDCheck(uint32_t new_access_flags) {
+ uint32_t old_access_flags = GetField32<kVerifyNone>(AccessFlagsOffset());
+ // kAccVerificationAttempted is retained.
+ CHECK((old_access_flags & kAccVerificationAttempted) == 0 ||
+ (new_access_flags & kAccVerificationAttempted) != 0);
+}
+
} // namespace mirror
} // namespace art