From: "Jan Beulich" Subject: Re: [Patch v3 1/4] x86/stack: Refactor show_trace() Date: Wed, 20 Nov 2013 09:43:55 +0000 Message-ID: <528C926B0200007800104ED8@nat28.tlf.novell.com> References: <1384803264-1093-1-git-send-email-andrew.cooper3@citrix.com> <1384803264-1093-2-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Vj4KE-0000LE-F3 for xen-devel@lists.xenproject.org; Wed, 20 Nov 2013 09:43:58 +0000 In-Reply-To: <1384803264-1093-2-git-send-email-andrew.cooper3@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: xen-devel , Keir Fraser , Tim Deegan List-Id: xen-devel@lists.xenproject.org > +++ b/xen/arch/x86/traps.c > @@ -195,12 +195,14 @@ static void show_guest_stack(struct vcpu *v, struct cpu_user_regs *regs) > > #if !defined(CONFIG_FRAME_POINTER) > > -static void show_trace(struct cpu_user_regs *regs) > +/* > + * Stack trace from pointers found in stack, unaided by frame pointers. For > + * caller convenience, this has the same prototype as its alternative, and > + * simply ignores the base pointer parameter. > + */ > +static void __show_trace(unsigned long sp, unsigned long __maybe_unused bp) A single leading underscore only please. > - /* > - * If RIP is not pointing into hypervisor code then someone may have > - * called into oblivion. Peek to see if they left a return address at > - * top of stack. > - */ > - addr = is_active_kernel_text(regs->eip) || > - !is_active_kernel_text(*ESP_BEFORE_EXCEPTION(regs)) ? Please note the pointer deref here. > +static void show_trace(const struct cpu_user_regs *regs) > +{ > + unsigned long sp = regs->rsp; > + > + printk("Xen call trace:\n"); > + > + /* > + * If RIP looks sensible, or the top of the stack doesn't, print RIP at > + * the top of the stack trace. > + */ > + if ( is_active_kernel_text(regs->rip) || > + !is_active_kernel_text(regs->rsp) ) Which is gone here. In this shape, I don't see what the purpose of the check is. > + printk(" [<%p>] %pS\n", _p(regs->eip), _p(regs->eip)); > + /* > + * else RIP looks bad but the top of the stack looks good. Perhaps we "Else" Jan