From mboxrd@z Thu Jan 1 00:00:00 1970 Reply-To: kernel-hardening@lists.openwall.com Date: Sat, 27 Apr 2013 00:13:01 +0200 From: Borislav Petkov Message-ID: <20130426221301.GA26059@pd.tnic> References: <1367003005-5560-7-git-send-email-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1367003005-5560-7-git-send-email-keescook@chromium.org> Subject: [kernel-hardening] Re: [PATCH 6/6] x86: kaslr: report kernel offset on panic To: Kees Cook Cc: linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , x86@kernel.org, Jarkko Sakkinen , Matthew Garrett , Matt Fleming , Eric Northup , Dan Rosenberg , Julien Tinnes , Will Drewry List-ID: On Fri, Apr 26, 2013 at 12:03:25PM -0700, Kees Cook wrote: > When the system panics, include the kernel offset in the report to assist > in debugging. > > Signed-off-by: Kees Cook > --- > arch/x86/kernel/setup.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c > index fae9134..95a33b1 100644 > --- a/arch/x86/kernel/setup.c > +++ b/arch/x86/kernel/setup.c > @@ -830,6 +830,18 @@ static void __init trim_low_memory_range(void) > } > > /* > + * Dump out kernel offset information on panic. > + */ > +static int > +dump_kernel_offset(struct notifier_block *self, unsigned long v, void *p) > +{ > + pr_emerg("Kernel Offset: 0x%lx\n", > + (unsigned long)&_text - __START_KERNEL); So what's wrong with subtracting the offset from the function addresses on the stack so that traces can show the addresses as they are in vmlinux, completely agnostic of any randomization? -- Regards/Gruss, Boris. Sent from a fat crate under my desk. Formatting is fine. -- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755994Ab3DZWNK (ORCPT ); Fri, 26 Apr 2013 18:13:10 -0400 Received: from mail.skyhub.de ([78.46.96.112]:46993 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751239Ab3DZWNJ (ORCPT ); Fri, 26 Apr 2013 18:13:09 -0400 Date: Sat, 27 Apr 2013 00:13:01 +0200 From: Borislav Petkov To: Kees Cook Cc: linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , x86@kernel.org, Jarkko Sakkinen , Matthew Garrett , Matt Fleming , Eric Northup , Dan Rosenberg , Julien Tinnes , Will Drewry Subject: Re: [PATCH 6/6] x86: kaslr: report kernel offset on panic Message-ID: <20130426221301.GA26059@pd.tnic> References: <1367003005-5560-7-git-send-email-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1367003005-5560-7-git-send-email-keescook@chromium.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 26, 2013 at 12:03:25PM -0700, Kees Cook wrote: > When the system panics, include the kernel offset in the report to assist > in debugging. > > Signed-off-by: Kees Cook > --- > arch/x86/kernel/setup.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c > index fae9134..95a33b1 100644 > --- a/arch/x86/kernel/setup.c > +++ b/arch/x86/kernel/setup.c > @@ -830,6 +830,18 @@ static void __init trim_low_memory_range(void) > } > > /* > + * Dump out kernel offset information on panic. > + */ > +static int > +dump_kernel_offset(struct notifier_block *self, unsigned long v, void *p) > +{ > + pr_emerg("Kernel Offset: 0x%lx\n", > + (unsigned long)&_text - __START_KERNEL); So what's wrong with subtracting the offset from the function addresses on the stack so that traces can show the addresses as they are in vmlinux, completely agnostic of any randomization? -- Regards/Gruss, Boris. Sent from a fat crate under my desk. Formatting is fine. --