From: Keir Fraser Subject: Re: 64-bit failsafe callback Date: Mon, 27 Mar 2006 23:50:21 +0100 Message-ID: References: <44286DF702000078000145F7@emea1-mh.id2.novell.com> <18578761481544ce81be10936c337105@cl.cam.ac.uk> Mime-Version: 1.0 (Apple Message framework v623) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <18578761481544ce81be10936c337105@cl.cam.ac.uk> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel@lists.xensource.com, Jan Beulich List-Id: xen-devel@lists.xenproject.org On 27 Mar 2006, at 23:36, Keir Fraser wrote: >> We're, while porting the kernel code back to SLES9, running into a >> case where the >> failsafe callback gets entered. Looking at that code we don't seem to >> be able to >> understand how it is actually expected to work. That code, out of >> load_segments, >> stores the selectors (including one or more that failed) into the >> (extended) frame >> for the kernel to pick them up. The kernel code, however, simply >> re-does the load >> of these selectors - how can that be expected to work any better than >> in the >> hypervisor? Further, the kernel blindly loads fs and gs, without >> caring to destroy >> their base addresses and, even more importantly, its own ability to >> access the PDA. > > Xen allows the kernel to do something smarter if it wants, but the > correct thing in Linux is to simply zero invalid selectors, so that's > what the failsafe callback handler does. The reload into %gs is indeed > bogus -- it should instead > HYPERVISOR_set_segment_base(SEGBASE_GS_USER_SEL, gs). Actually, I think that segment reload portion of the failsafe handler can be got rid of entirely since Xen will already zero an unloadable segment register, plus Xen has all the logic right to make sure that base addresses are preserved. So, as you say, the Linux attempt to load those segment registers really can do no good. :-) I'll fix that in -unstable. Thanks, Keir