Skip to contentSkip to conversation

kvm: x86: Fix DPL write back of segment registers

PATCH Applied Jan Kiszka 2 participants 2 messages Dec 27, 2010 KVM

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 kvm: x86: Fix DPL write back of segment registers

From: Jan Kiszka <[email protected]>

The DPL is stored in the flags and not in the selector. In fact, the RPL may differ from the DPL at some point in time, and so we were corrupting the guest state so far.

---
 target-i386/kvm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
target-i386/kvm.c +1 -1
index 218812a..b3d7c54 100644
@@ -602,7 +602,7 @@ static void set_seg(struct kvm_segment *lhs, const SegmentCache *rhs)
     lhs->limit = rhs->limit;
     lhs->type = (flags >> DESC_TYPE_SHIFT) & 15;
     lhs->present = (flags & DESC_P_MASK) != 0;
-    lhs->dpl = rhs->selector & 3;
+    lhs->dpl = (flags >> DESC_DPL_SHIFT) & 3;
     lhs->db = (flags >> DESC_B_SHIFT) & 1;
     lhs->s = (flags & DESC_S_MASK) != 0;
     lhs->l = (flags >> DESC_L_SHIFT) & 1;
Signature · 1 line
1.7.1
Applied
#1 lore raw
Quoted 6 lines · Jan Kiszka

From: Jan Kiszka<[email protected]>

The DPL is stored in the flags and not in the selector. In fact, the RPL may differ from the DPL at some point in time, and so we were corrupting the guest state so far.

Applied to uq/master; thanks.

Signature · 1 line
error compiling committee.c: too many arguments to function