public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: Justin Forbes <jmforbes@linuxtx.org>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Dave Jones <davej@redhat.com>,
	Chuck Wolber <chuckw@quantumlinux.com>,
	Chris Wedgwood <reviews@ml.cw.f00f.org>,
	Michael Krufky <mkrufky@linuxtv.org>,
	Chuck Ebbert <cebbert@redhat.com>,
	Domenico Andreoli <cavokz@gmail.com>, Willy Tarreau <w@1wt.eu>,
	Rodrigo Rubira Branco <rbranco@la.checkpoint.com>,
	Jake Edge <jake@lwn.net>, Eugene Teo <eteo@redhat.com>,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, Marcelo Tosatti <mtosatti@redhat.com>,
	Avi Kivity <avi@qumranet.com>
Subject: [patch 31/60] KVM: task switch: segment base is linear address
Date: Mon, 18 Aug 2008 11:44:31 -0700	[thread overview]
Message-ID: <20080818184431.GF29394@suse.de> (raw)
In-Reply-To: <20080818184035.GA29394@suse.de>

[-- Attachment #1: kvm-task-switch-segment-base-is-linear-address.patch --]
[-- Type: text/plain, Size: 2106 bytes --]

2.6.26-stable review patch.  If anyone has any objections, please let us know.

------------------

From: Marcelo Tosatti <mtosatti@redhat.com>

(cherry picked from commit 98899aa0e0bf5de05850082be0eb837058c09ea5)

The segment base is always a linear address, so translate before
accessing guest memory.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 arch/x86/kvm/x86.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3207,6 +3207,7 @@ static void get_segment_descritptor_dtab
 static int load_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
 					 struct desc_struct *seg_desc)
 {
+	gpa_t gpa;
 	struct descriptor_table dtable;
 	u16 index = selector >> 3;
 
@@ -3216,13 +3217,16 @@ static int load_guest_segment_descriptor
 		kvm_queue_exception_e(vcpu, GP_VECTOR, selector & 0xfffc);
 		return 1;
 	}
-	return kvm_read_guest(vcpu->kvm, dtable.base + index * 8, seg_desc, 8);
+	gpa = vcpu->arch.mmu.gva_to_gpa(vcpu, dtable.base);
+	gpa += index * 8;
+	return kvm_read_guest(vcpu->kvm, gpa, seg_desc, 8);
 }
 
 /* allowed just for 8 bytes segments */
 static int save_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
 					 struct desc_struct *seg_desc)
 {
+	gpa_t gpa;
 	struct descriptor_table dtable;
 	u16 index = selector >> 3;
 
@@ -3230,7 +3234,9 @@ static int save_guest_segment_descriptor
 
 	if (dtable.limit < index * 8 + 7)
 		return 1;
-	return kvm_write_guest(vcpu->kvm, dtable.base + index * 8, seg_desc, 8);
+	gpa = vcpu->arch.mmu.gva_to_gpa(vcpu, dtable.base);
+	gpa += index * 8;
+	return kvm_write_guest(vcpu->kvm, gpa, seg_desc, 8);
 }
 
 static u32 get_tss_base_addr(struct kvm_vcpu *vcpu,
@@ -3242,7 +3248,7 @@ static u32 get_tss_base_addr(struct kvm_
 	base_addr |= (seg_desc->base1 << 16);
 	base_addr |= (seg_desc->base2 << 24);
 
-	return base_addr;
+	return vcpu->arch.mmu.gva_to_gpa(vcpu, base_addr);
 }
 
 static int load_tss_segment32(struct kvm_vcpu *vcpu,

-- 

  parent reply	other threads:[~2008-08-18 18:58 UTC|newest]

Thread overview: 113+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080818191012.663450219@mini.kroah.org>
     [not found] ` <20080818183230.966310219@mini.kroah.org>
2008-08-18 18:40   ` [patch 00/60] 2.6.26-stable review Greg KH
2008-08-18 18:41     ` [patch 01/60] mlock() fix return values Greg KH
2008-08-18 18:41     ` [patch 02/60] SCSI: ses: fix VPD inquiry overrun Greg KH
2008-08-18 18:41     ` [patch 03/60] SCSI: scsi_transport_spi: fix oops in revalidate Greg KH
2008-08-18 18:41     ` [patch 04/60] SCSI: block: Fix miscalculation of sg_io timeout in CDROM_SEND_PACKET handler Greg KH
2008-08-18 18:41     ` [patch 05/60] SCSI: hptiop: add more PCI device IDs Greg KH
2008-08-18 18:41     ` [patch 06/60] vt8623fb: fix kernel oops Greg KH
2008-08-18 18:41     ` [patch 07/60] relay: fix "full buffer with exactly full last subbuffer" accounting problem Greg KH
2008-08-18 18:41     ` [patch 08/60] ide-cd: fix endianity for the error message in cdrom_read_capacity Greg KH
2008-08-18 18:41     ` [patch 09/60] posix-timers: do_schedule_next_timer: fix the setting of ->si_overrun Greg KH
2008-08-18 18:41     ` [patch 10/60] posix-timers: fix posix_timer_event() vs dequeue_signal() race Greg KH
2008-08-18 18:42     ` [patch 11/60] radeonfb: fix accel engine hangs Greg KH
2008-08-18 18:42     ` [patch 12/60] matrox maven: fix a broken error path Greg KH
2008-08-18 18:42     ` [patch 13/60] USB: pl2023: Remove USB id (4348:5523) handled by ch341 Greg KH
2008-08-18 18:42     ` [patch 14/60] USB: fix interface unregistration logic Greg KH
2008-08-18 18:42     ` [patch 15/60] usb-storage: unusual_devs entries for iRiver T10 and Datafab CF+SM reader Greg KH
2008-08-18 18:43     ` [patch 16/60] USB: usb-storage: quirk around v1.11 firmware on Nikon D4 Greg KH
2008-08-18 18:43     ` [patch 17/60] usb-serial: dont release unregistered minors Greg KH
2008-08-18 18:43     ` [patch 18/60] USB: ftdi_sio: add support for Luminance Stellaris Evaluation/Development Kits Greg KH
2008-08-18 18:43     ` [patch 19/60] USB: ftdi_sio: Add USB Product Id for ELV HS485 Greg KH
2008-08-18 18:43     ` [patch 20/60] ipvs: Fix possible deadlock in estimator code Greg KH
2008-08-19  0:31       ` Simon Horman
2008-08-18 18:43     ` [patch 21/60] acer-wmi: Fix wireless and bluetooth on early AMW0 v2 laptops Greg KH
2008-08-18 18:43     ` [patch 22/60] CIFS: mount of IPC$ breaks with iget patch Greg KH
2008-08-18 18:43     ` [patch 23/60] CIFS: if get root inode fails during mount, cleanup tree connection Greg KH
2008-08-18 18:43     ` [patch 24/60] dccp: change L/R must have at least one byte in the dccpsf_val field Greg KH
2008-08-18 18:43     ` [patch 25/60] syncookies: Make sure ECN is disabled Greg KH
2008-08-18 18:43     ` [patch 26/60] random32: seeding improvement Greg KH
2008-08-18 18:43     ` [patch 27/60] ipv6: Fix ip6_xmit to send fragments if ipfragok is true Greg KH
2008-08-18 18:44     ` [patch 28/60] sparc64: FUTEX_OP_ANDN fix Greg KH
2008-08-18 18:44     ` [patch 29/60] sparc64: Fix global reg snapshotting on self-cpu Greg KH
2008-08-18 18:44     ` [patch 30/60] sparc64: Do not clobber %g7 in setcontext() trap Greg KH
2008-08-18 18:44     ` Greg KH [this message]
2008-08-18 18:44     ` [patch 32/60] KVM: task switch: use seg regs provided by subarch instead of reading from GDT Greg KH
2008-08-18 18:44     ` [patch 33/60] KVM: Avoid instruction emulation when event delivery is pending Greg KH
2008-08-18 18:44     ` [patch 34/60] KVM: task switch: translate guest segment limit to virt-extension byte granular field Greg KH
2008-08-18 18:44     ` [patch 35/60] KVM: ia64: Fix irq disabling leak in error handling code Greg KH
2008-08-18 18:44     ` [patch 36/60] r8169: avoid thrashing PCI conf space above RTL_GIGA_MAC_VER_06 Greg KH
2008-08-18 18:44     ` [patch 37/60] ALSA: asoc: restrict sample rate and size in Freescale MPC8610 sound drivers Greg KH
2008-08-18 18:44     ` [patch 38/60] i2c: Fix NULL pointer dereference in i2c_new_probed_device Greg KH
2008-08-18 18:44     ` [patch 39/60] i2c: Let users select algorithm drivers manually again Greg KH
2008-08-18 18:44     ` [patch 40/60] ALSA: ASoC: fix SNDCTL_DSP_SYNC support in Freescale 8610 sound drivers Greg KH
2008-08-18 18:44     ` [patch 41/60] x86: amd opteron TOM2 mask val fix Greg KH
2008-08-18 18:45     ` [patch 42/60] ide: it821x in pass-through mode segfaults in 2.6.26-stable Greg KH
2008-08-18 18:45     ` [patch 43/60] CIFS: Fix compiler warning on 64-bit Greg KH
2008-08-18 18:45     ` [patch 44/60] radeon: misc corrections Greg KH
2008-08-18 18:45     ` [patch 45/60] cs5520: add enablebits checking Greg KH
2008-08-18 18:45     ` [patch 46/60] rtl8187: Fix lockups due to concurrent access to config routine Greg KH
2008-08-18 18:45     ` [patch 47/60] sparc64: Fix end-of-stack checking in save_stack_trace() Greg KH
2008-08-18 18:45     ` [patch 48/60] sparc64: Fix recursion in stack overflow detection handling Greg KH
2008-08-18 18:45     ` [patch 49/60] sparc64: Make global reg dumping even more useful Greg KH
2008-08-18 18:45     ` [patch 50/60] sparc64: Implement IRQ stacks Greg KH
2008-08-18 18:45     ` [patch 51/60] sparc64: Handle stack trace attempts before irqstacks are setup Greg KH
2008-08-18 18:45     ` [patch 52/60] x86: fix spin_is_contended() Greg KH
2008-08-18 18:45     ` [patch 53/60] x86: fix setup code crashes on my old 486 box Greg KH
2008-08-18 19:17       ` H. Peter Anvin
2008-08-18 18:45     ` [patch 54/60] qla2xxx: Add dev_loss_tmo_callbk/terminate_rport_io callback support Greg KH
2008-08-18 18:45     ` [patch 55/60] qla2xxx: Set an rports dev_loss_tmo value in a consistent manner Greg KH
2008-08-18 18:45     ` [patch 56/60] usb-storage: revert DMA-alignment change for Wireless USB Greg KH
2008-08-18 18:45     ` [patch 57/60] usb-storage: automatically recognize bad residues Greg KH
2008-08-18 18:45     ` [patch 58/60] CIFS: properly account for new user= field in SPNEGO upcall string allocation Greg KH
2008-08-18 18:45     ` [patch 59/60] PCI: Limit VPD length for Broadcom 5708S Greg KH
2008-08-18 18:45     ` [patch 60/60] crypto: padlock - fix VIA PadLock instruction usage with irq_ts_save/restore() Greg KH
2008-08-18 19:18 ` [patch 00/49] 2.6.25-stable review Greg KH
2008-08-18 19:19   ` [patch 01/49] USB: usb-storage: quirk around v1.11 firmware on Nikon D4 Greg KH
2008-08-18 19:19   ` [patch 02/49] usb-storage: unusual_devs entries for iRiver T10 and Datafab CF+SM reader Greg KH
2008-08-18 19:19   ` [patch 03/49] usb-serial: dont release unregistered minors Greg KH
2008-08-18 19:19   ` [patch 04/49] USB: pl2023: Remove USB id (4348:5523) handled by ch341 Greg KH
2008-08-18 19:19   ` [patch 05/49] USB: ftdi_sio: Add USB Product Id for ELV HS485 Greg KH
2008-08-18 19:19   ` [patch 06/49] USB: ftdi_sio: add support for Luminance Stellaris Evaluation/Development Kits Greg KH
2008-08-18 19:19   ` [patch 07/49] SCSI: ses: fix VPD inquiry overrun Greg KH
2008-08-18 19:19   ` [patch 08/49] SCSI: scsi_transport_spi: fix oops in revalidate Greg KH
2008-08-18 19:19   ` [patch 09/49] SCSI: hptiop: add more PCI device IDs Greg KH
2008-08-18 19:19   ` [patch 10/49] SCSI: block: Fix miscalculation of sg_io timeout in CDROM_SEND_PACKET handler Greg KH
2008-08-18 19:19   ` [patch 11/49] relay: fix "full buffer with exactly full last subbuffer" accounting problem Greg KH
2008-08-18 19:19   ` [patch 12/49] radeonfb: fix accel engine hangs Greg KH
2008-08-18 19:19   ` [patch 13/49] posix-timers: fix posix_timer_event() vs dequeue_signal() race Greg KH
2008-08-18 19:19   ` [patch 14/49] posix-timers: do_schedule_next_timer: fix the setting of ->si_overrun Greg KH
2008-08-18 19:19   ` [patch 15/49] mlock() fix return values Greg KH
2008-08-18 19:19   ` [patch 16/49] matrox maven: fix a broken error path Greg KH
2008-08-18 19:19   ` [patch 17/49] ipvs: Fix possible deadlock in estimator code Greg KH
2008-08-18 19:19   ` [patch 18/49] ide-cd: fix endianity for the error message in cdrom_read_capacity Greg KH
2008-08-18 19:19   ` [patch 19/49] CIFS: mount of IPC$ breaks with iget patch Greg KH
2008-08-18 19:20   ` [patch 20/49] CIFS: if get root inode fails during mount, cleanup tree connection Greg KH
2008-08-18 19:20   ` [patch 21/49] acer-wmi: Fix wireless and bluetooth on early AMW0 v2 laptops Greg KH
2008-08-18 19:20   ` [patch 22/49] dccp: change L/R must have at least one byte in the dccpsf_val field Greg KH
2008-08-18 19:20   ` [patch 23/49] random32: seeding improvement Greg KH
2008-08-18 19:20   ` [patch 24/49] ipv6: Fix ip6_xmit to send fragments if ipfragok is true Greg KH
2008-08-18 19:20   ` [patch 25/49] sparc64: FUTEX_OP_ANDN fix Greg KH
2008-08-18 19:20   ` [patch 26/49] sparc64: Do not clobber %g7 in setcontext() trap Greg KH
2008-08-18 19:20   ` [patch 27/49] uml: fix build when SLOB is enabled Greg KH
2008-08-18 19:20   ` [patch 28/49] uml: fix bad NTP interaction with clock Greg KH
2008-08-18 19:20   ` [patch 29/49] uml: physical memory shouldnt include initial stack Greg KH
2008-08-18 19:20   ` [patch 30/49] uml: track and make up lost ticks Greg KH
2008-08-18 19:20   ` [patch 31/49] uml: missed kmalloc() in pcap_user.c Greg KH
2008-08-18 19:20   ` [patch 32/49] uml: deal with host time going backwards Greg KH
2008-08-18 19:20   ` [patch 33/49] uml: deal with inaccessible address space start Greg KH
2008-08-18 19:20   ` [patch 34/49] uml: missing export of csum_partial() on uml/amd64 Greg KH
2008-08-18 19:20   ` [patch 35/49] uml: memcpy export needs to follow host declaration Greg KH
2008-08-18 19:20   ` [patch 36/49] uml: stub needs to tolerate SIGWINCH Greg KH
2008-08-18 19:20   ` [patch 37/49] uml: work around broken host PTRACE_SYSEMU Greg KH
2008-08-18 19:20   ` [patch 38/49] uml: fix gcc ICEs and unresolved externs Greg KH
2008-08-18 19:20   ` [patch 39/49] uml: Fix boot crash Greg KH
2008-08-18 19:20   ` [patch 40/49] uml: PATH_MAX needs limits.h Greg KH
2008-08-18 19:20   ` [patch 41/49] radeon: misc corrections Greg KH
2008-08-18 19:20   ` [patch 42/49] r8169: avoid thrashing PCI conf space above RTL_GIGA_MAC_VER_06 Greg KH
2008-08-18 19:20   ` [patch 43/49] netfilter: nf_nat_snmp_basic: fix a range check in NAT for SNMP Greg KH
2008-08-18 19:20   ` [patch 44/49] i2c: Fix NULL pointer dereference in i2c_new_probed_device Greg KH
2008-08-18 19:20   ` [patch 45/49] CIFS: Fix compiler warning on 64-bit Greg KH
2008-08-18 19:21   ` [patch 46/49] x86: fix spin_is_contended() Greg KH
2008-08-18 19:21   ` [patch 47/49] x86: fix setup code crashes on my old 486 box Greg KH
2008-08-18 19:21   ` [patch 48/49] qla2xxx: Add dev_loss_tmo_callbk/terminate_rport_io callback support Greg KH
2008-08-18 19:21   ` [patch 49/49] qla2xxx: Set an rports dev_loss_tmo value in a consistent manner Greg KH

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=20080818184431.GF29394@suse.de \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=avi@qumranet.com \
    --cc=cavokz@gmail.com \
    --cc=cebbert@redhat.com \
    --cc=chuckw@quantumlinux.com \
    --cc=davej@redhat.com \
    --cc=eteo@redhat.com \
    --cc=jake@lwn.net \
    --cc=jmforbes@linuxtx.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkrufky@linuxtv.org \
    --cc=mtosatti@redhat.com \
    --cc=rbranco@la.checkpoint.com \
    --cc=rdunlap@xenotime.net \
    --cc=reviews@ml.cw.f00f.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=w@1wt.eu \
    --cc=zwane@arm.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox