This repository has been archived by the owner on Jan 28, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
emulate: Abort decoding if opcode is unsupported
When decoding an instruction with an unsupported opcode (indicated by the INSN_NOTIMPL flag), em_decode_insn() does not fail, which can lead to a disaster in em_emulate_insn(), e.g. calling an invalid handler function (soft_handler == NULL) and causing a host kernel panic (#93). 1. In em_decode_insn(), check if the opcode is unsupported, i.e. the INSN_NOTIMPL flag is set or there is no emulation handler. If so, return a fatal error, raise a vCPU panic, and log the raw bytes of the instruction. 2. Before decoding a new instruction, reset the emulation context, so the old context is not accidentally referred to. 3. Add unit tests for two unsupported opcode cases. This requires refactoring EmulatorTest::run() first. Signed-off-by: Yu Ning <yu.ning@intel.com>
- Loading branch information
1 parent
a4b1abd
commit 4033099
Showing
3 changed files
with
85 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters