From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [PATCH RFC] x86/traps: Make the main trap handlers safe for use early during Xen boot Date: Wed, 14 May 2014 08:00:55 +0100 Message-ID: <537330C70200007800011FEE@mail.emea.novell.com> References: <1399992685-14452-1-git-send-email-andrew.cooper3@citrix.com> <537255BC0200007800011D03@mail.emea.novell.com> <53724492.2090106@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <53724492.2090106@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: TimDeegan , Keir Fraser , Xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 13.05.14 at 18:13, wrote: > On 13/05/14 16:26, Jan Beulich wrote: >>>>> On 13.05.14 at 16:51, wrote: >>> --- a/xen/arch/x86/traps.c >>> +++ b/xen/arch/x86/traps.c >>> @@ -561,7 +561,8 @@ static void do_trap(struct cpu_user_regs *regs, int use_error_code) >>> } >>> >>> if ( ((trapnr == TRAP_copro_error) || (trapnr == TRAP_simd_error)) && >>> - has_hvm_container_vcpu(curr) && curr->arch.hvm_vcpu.fpu_exception_callback ) >>> + system_state == SYS_STATE_active && has_hvm_container_vcpu(curr) && >> This seems too specific a check - I think this ought to be "system_state >= >> SYS_STATE_active". > > I considered that, but the valid values greater than active are suspend > and resume, which absolutely shouldn't be running x86_emulate > codepaths. I don't think it is safe to assume that any future values > greater than active will be safe contexts for this. I can see your point, but my perspective is different: All you really want to guard against here is de-referencing a non yet properly set current. And that would be achieved with the range check, not the equality one. Jan