diff options
author | Andreas Gampe <agampe@google.com> | 2014-06-12 22:51:22 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-06-12 21:07:49 +0000 |
commit | 092ce603c8bc9188d63eb8e9defc321017a098f3 (patch) | |
tree | 26e7dd0404009b623d215259c51b80e4fc612302 /runtime | |
parent | 1f968319c95136cafe8e5a813ef822f0a8963b98 (diff) | |
parent | e2256621883f321513a6397ca82a271c64d7c393 (diff) | |
download | art-092ce603c8bc9188d63eb8e9defc321017a098f3.tar.gz art-092ce603c8bc9188d63eb8e9defc321017a098f3.tar.bz2 art-092ce603c8bc9188d63eb8e9defc321017a098f3.zip |
Merge "ART: Do not allow quickened dex codes in compiler mode."
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/verifier/method_verifier.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index e5dcbb0ac4..9d1f6f4de1 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -1334,6 +1334,31 @@ bool MethodVerifier::CodeFlowVerifyMethod() { insn_flags_[insn_idx].ClearChanged(); } + // When we're in compiler mode, do not accept quickened instructions. + // We explicitly iterate over *all* instructions to check code that may be unreachable and + // missed by the loop above. + if (Runtime::Current() != nullptr && Runtime::Current()->IsCompiler()) { + uint32_t insn_idx = 0; + for (; insn_idx < insns_size; insn_idx += insn_flags_[insn_idx].GetLengthInCodeUnits()) { + const Instruction* inst = Instruction::At(insns + insn_idx); + switch (inst->Opcode()) { + case Instruction::IGET_QUICK: + case Instruction::IGET_WIDE_QUICK: + case Instruction::IGET_OBJECT_QUICK: + case Instruction::IPUT_QUICK: + case Instruction::IPUT_WIDE_QUICK: + case Instruction::IPUT_OBJECT_QUICK: + case Instruction::INVOKE_VIRTUAL_QUICK: + case Instruction::INVOKE_VIRTUAL_RANGE_QUICK: + Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "Quickened instructions not allowed. "; + return false; + + default: + break; + } + } + } + if (gDebugVerify) { /* * Scan for dead code. There's nothing "evil" about dead code |