From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: [PATCH] xen/x86: Introduce early_invalid_op() handler. Date: Mon, 09 Sep 2013 07:37:03 -0700 Message-ID: References: <522DF7B302000078000F1942@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VJ2al-0006xD-3n for xen-devel@lists.xenproject.org; Mon, 09 Sep 2013 14:37:27 +0000 Received: by mail-pd0-f175.google.com with SMTP id q10so6267648pdj.34 for ; Mon, 09 Sep 2013 07:37:09 -0700 (PDT) In-Reply-To: <522DF7B302000078000F1942@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 , Andrew Cooper Cc: xen-devel List-Id: xen-devel@lists.xenproject.org On 09/09/2013 07:30, "Jan Beulich" wrote: >>>> On 09.09.13 at 16:17, Andrew Cooper wrote: >> +void __init __attribute__((noreturn)) >> +do_early_invalid_op(struct cpu_user_regs *regs) >> +{ >> + if ( *(u16 *)regs->eip == 0x0b0f ) > > Without even a range check on regs->eip? I don't think we want to > needlessly risk #PF or #GP here... > >> + printk("Early ud2 at %p - BUG/WARN/ASSERT perhaps?\n", >> _p(regs->eip)); >> + else >> + printk("Unidentified early #UD at %p\n", _p(regs->eip)); >> + > > You probably also meant to at least print the same raw stack > dump that do_early_page_fault() produces? I suggest less cleverness in this printk and indeed dump regs and error code. More useful, potentially. Also then the handler will not be UD-specific and could be called for all early exceptions (except those with a more specific handler such as #PG). All that would be needed in asm is a per-exception push/mov and jmp to common asm which does the SAVE_ALL stuff and jmp to C. -- Keir > Jan > >> + for ( ; ; ) >> + halt(); >> +} > >