From: Keir Fraser Subject: Re: [semi-urgent Xen CS question] Re: git commit 9fd67b4ed0714ab718f1f9bd14c344af336a6df7 (x86-64: Give vvars their own page) breaks Xen PV guests (64-bit). Date: Tue, 26 Jul 2011 23:20:41 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Andrew Lutomirski Cc: Jeremy Fitzhardinge , xen-devel@lists.xensource.com, Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org On 26/07/2011 22:40, "Andrew Lutomirski" wrote: > If we go into the iret patch (via auditing, for example), then the > FIXUP_TOP_OF_STACK macro does movq $__USER_CS,CS+\offset(%rsp), which > (unless it's buggy) writes __USER_CS into the appropriate spot. > > So I don't see what part of the entry path needs patching. You'll get Xen's flat CS values loaded if Xen uses SYSRET to return to guest context. This will happen on return to guest userspace if the guest kernel calls the iret hypercall specifying the VGCF_in_syscall flag. And that would typically happen when returning to userspace after a syscall. So I guess the typical user process will quickly end up using the Xen code selector rather than Linux's own. -- Keir