Once an instruction crosses a page boundary, the size read from the second page disregards the common case that part of the operand resides on the first page. As a result, fetch of long insturctions may fail, and thereby cause the decoding to fail as well.
Unified · Split
| @@ -778,8 +778,10 @@ static int __do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt, int op_size) · 777 unmodified lines | |||
| 778 | static __always_inline int do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt, | 778 | static __always_inline int do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt, |
| 779 | unsigned size) | 779 | unsigned size) |
| 780 | { | 780 | { |
| 781 | if (unlikely(ctxt->fetch.end - ctxt->fetch.ptr < size)) | 781 | unsigned done_size = ctxt->fetch.end - ctxt->fetch.ptr; |
| 782 | return __do_insn_fetch_bytes(ctxt, size); | 782 | |
| 783 | if (unlikely(done_size < size)) | ||
| 784 | return __do_insn_fetch_bytes(ctxt, size - done_size); | ||
| 783 | else | 785 | else |
| 784 | return X86EMUL_CONTINUE; | 786 | return X86EMUL_CONTINUE; |
| 785 | } | 787 | } |