From: spender@grsecurity.net (Brad Spengler)
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Possible invalid emulation of rex.W-prefixed far jump
Date: Mon, 1 Mar 2010 19:29:20 -0500 [thread overview]
Message-ID: <20100302002919.GA29610@grsecurity.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 1345 bytes --]
Hi all,
I'm writing to report a possible bug in the qemu emulation of
rex.W-prefixed far jumps. It affects far jumps of this type with both
rip-relative and absolute addresses.
The yasm syntax for these instructions:
jmp far qword [addr]
jmp far qword [addr wrt rip]
and the resulting disassembly:
8: 48 ff 2c 25 00 00 00 00 rex.W ljmpq *0x0 c: R_X86_64_32 .text+0x17
10: 48 ff 2d 00 00 00 00 rex.W ljmpq *0x0(%rip) # 0x17
qemu triggers a gpf with error 0xfffc (presumably this is 0xffff masked
to 0xfffc by the & on new_cs from
target-i386/op_helper.c:helper_ljmp_protected())
It's suspected that qemu is treating the far address as 16:32 instead of
16:64 as it should, since the far address as laid out in memory is:
12 34 56 78 ff ff ff ff 10 00
The far address is intended to be a Linux kernel address, so the upper
32bits are 0xffffffff.
If qemu is treating the 16:64 layout as 16:32, you can see why new_cs
would have the value of 0xffff. The code only fails on qemu -- it works
as expected on real systems.
I'm not familiar with your code-base so I have no patch for the issue,
but I thought I'd fire off a mail as I imagine it's a simple
oversight and easy fix for someone familiar with the code.
Thanks for your help, and please keep me on CC for replies
-Brad
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next reply other threads:[~2010-03-02 0:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-02 0:29 Brad Spengler [this message]
2010-03-03 17:34 ` [Qemu-devel] Possible invalid emulation of rex.W-prefixed far jump malc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100302002919.GA29610@grsecurity.net \
--to=spender@grsecurity.net \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.