mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matteo Croce <mcroce@redhat.com>
To: x86@kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: [PATCH] x86/traps: print faulty addresses on stack overflow
Date: Mon,  1 Apr 2019 02:03:27 +0200	[thread overview]
Message-ID: <20190401000327.26742-1-mcroce@redhat.com> (raw)

Since commit ad67b74d2469d9b8 ("printk: hash addresses printed with %p"),
when a stack overflow happens "____ptrval____" is printed instead of the
real addresses:

    BUG: stack guard page was hit at (____ptrval____) (stack is (____ptrval____)..(____ptrval____))

Even if leaking kernel layout information is usually a bad thing, probably
the system needs to be rebooted anyway past this point, so force the
address print as the obfuscation makes the error message useless.

Signed-off-by: Matteo Croce <mcroce@redhat.com>
---
 arch/x86/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index d26f9e9c3d83..0d3695334dfd 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -301,7 +301,7 @@ __visible void __noreturn handle_stack_overflow(const char *message,
 						struct pt_regs *regs,
 						unsigned long fault_address)
 {
-	printk(KERN_EMERG "BUG: stack guard page was hit at %p (stack is %p..%p)\n",
+	printk(KERN_EMERG "BUG: stack guard page was hit at %px (stack is %px..%px)\n",
 		 (void *)fault_address, current->stack,
 		 (char *)current->stack + THREAD_SIZE - 1);
 	die(message, regs, 0);
-- 
2.20.1


                 reply	other threads:[~2019-04-01  0:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190401000327.26742-1-mcroce@redhat.com \
    --to=mcroce@redhat.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®