From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCH] x86-64: don't allow non-canonical addresses to be set for any callback Date: Wed, 13 Jun 2012 11:51:20 +0100 Message-ID: <4FD870A8.6030606@cantab.net> References: <4FD881530200007800089ACB@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4FD881530200007800089ACB@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: xen-devel List-Id: xen-devel@lists.xenproject.org On 13/06/12 11:02, Jan Beulich wrote: > Rather than deferring the detection of these to the point where they > get actually used (the fix for XSA-7, 25480:76eaf5966c05, causing a #GP > to be raised by IRET, which invokes the guest's [fragile] fail-safe > callback), don't even allow such to be set. > > Signed-off-by: Jan Beulich > > --- a/xen/arch/x86/domain.c > +++ b/xen/arch/x86/domain.c > @@ -736,6 +736,14 @@ int arch_set_info_guest( > { > if ( !compat ) > { > +#ifdef __x86_64__ > + if ( !is_canonical_address(c.nat->user_regs.eip) || > + !is_canonical_address(c.nat->event_callback_eip) || > + !is_canonical_address(c.nat->syscall_callback_eip) || > + !is_canonical_address(c.nat->failsafe_callback_eip) ) > + return -EINVAL; > +#endif > + Would it be better to have #ifndef __x86_64__ # define is_canonical_address(a) 1 #endif somewhere? David