From: "Jan Beulich" Subject: [PATCH] x86: fix emulation of indirect far calls and jumps Date: Tue, 19 Nov 2013 14:49:45 +0000 Message-ID: <528B889902000078001048D3@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part52618699.1__=" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Vimch-0004Aa-9k for xen-devel@lists.xenproject.org; Tue, 19 Nov 2013 14:49:51 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: anthony.perard@citrix.com, Keir Fraser List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part52618699.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Commit 86781624 ("x86_emulate: PUSH must read source operand just once") corrected the operands of those of the operations of opcode extension group 5 that only read memory from SrcMem to DstMem, but failed to also switch the use of "dst" here to "src". Reported-by: Anthony Perard Signed-off-by: Jan Beulich Tested-by: Anthony Perard --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -3571,7 +3571,6 @@ x86_emulate( _regs.eip =3D src.val; src.val =3D dst.val; goto push; - break; case 4: /* jmp (near) */ _regs.eip =3D src.val; dst.type =3D OP_NONE; @@ -3580,9 +3579,9 @@ x86_emulate( case 5: /* jmp (far, absolute indirect) */ { unsigned long sel; =20 - generate_exception_if(dst.type !=3D OP_MEM, EXC_UD, -1); + generate_exception_if(src.type !=3D OP_MEM, EXC_UD, -1); =20 - if ( (rc =3D read_ulong(dst.mem.seg, dst.mem.off+dst.bytes, + if ( (rc =3D read_ulong(src.mem.seg, src.mem.off + op_bytes, &sel, 2, ctxt, ops)) ) goto done; =20 @@ -3600,7 +3599,7 @@ x86_emulate( =20 if ( (rc =3D load_seg(x86_seg_cs, sel, ctxt, ops)) !=3D 0 ) goto done; - _regs.eip =3D dst.val; + _regs.eip =3D src.val; =20 dst.type =3D OP_NONE; break; --=__Part52618699.1__= Content-Type: text/plain; name="x86-emul-far-call.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-emul-far-call.patch" x86: fix emulation of indirect far calls and jumps=0A=0ACommit 86781624 = ("x86_emulate: PUSH must read source operand=0Ajust once") corrected = the operands of those of the operations of opcode=0Aextension group 5 that = only read memory from SrcMem to DstMem, but=0Afailed to also switch the = use of "dst" here to "src".=0A=0AReported-by: Anthony Perard =0ASigned-off-by: Jan Beulich =0ATested-by:= Anthony Perard =0A=0A--- a/xen/arch/x86/x86_emu= late/x86_emulate.c=0A+++ b/xen/arch/x86/x86_emulate/x86_emulate.c=0A@@ = -3571,7 +3571,6 @@ x86_emulate(=0A _regs.eip =3D src.val;=0A = src.val =3D dst.val;=0A goto push;=0A- = break;=0A case 4: /* jmp (near) */=0A _regs.eip =3D = src.val;=0A dst.type =3D OP_NONE;=0A@@ -3580,9 +3579,9 @@ = x86_emulate(=0A case 5: /* jmp (far, absolute indirect) */ {=0A = unsigned long sel;=0A =0A- generate_exception_if(dst.ty= pe !=3D OP_MEM, EXC_UD, -1);=0A+ generate_exception_if(src.type = !=3D OP_MEM, EXC_UD, -1);=0A =0A- if ( (rc =3D read_ulong(dst.me= m.seg, dst.mem.off+dst.bytes,=0A+ if ( (rc =3D read_ulong(src.me= m.seg, src.mem.off + op_bytes,=0A &sel, = 2, ctxt, ops)) )=0A goto done;=0A =0A@@ -3600,7 +3599,7 @@ = x86_emulate(=0A =0A if ( (rc =3D load_seg(x86_seg_cs, sel, = ctxt, ops)) !=3D 0 )=0A goto done;=0A- = _regs.eip =3D dst.val;=0A+ _regs.eip =3D src.val;=0A =0A = dst.type =3D OP_NONE;=0A break;=0A --=__Part52618699.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part52618699.1__=--