Skip to contentSkip to conversation

x86/traps: Print unhashed pointers on stack overflow

PATCH Applied Ryosuke Yasuoka 2 participants 3 messages Dec 24, 2025 – Jan 14 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/traps: Print unhashed pointers on stack overflow

When a stack overflow occurs, the kernel prints hashed fault address and the stack range using %p. The actual addresses are required for debugging and hashed pointers provide no useful information in this context.

Use %px to print the unhashed, raw addresses.

---
 arch/x86/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/traps.c +1 -1
index bcf1dedc1d00..5a6a772e0a6c 100644
@@ -549,7 +549,7 @@ __visible void __noreturn handle_stack_overflow(struct pt_regs *regs,
 {
 	const char *name = stack_type_name(info->type);
 
-	printk(KERN_EMERG "BUG: %s stack guard page was hit at %p (stack is %p..%p)\n",
+	printk(KERN_EMERG "BUG: %s stack guard page was hit at %px (stack is %px..%px)\n",
 	       name, (void *)fault_address, info->begin, info->end);
 
 	die("stack guard page", regs, 0);

base-commit: b927546677c876e26eba308550207c2ddf812a43

Signature · 1 line
2.52.0
#1 lore raw
Quoted 26 lines · Ryosuke Yasuoka

When a stack overflow occurs, the kernel prints hashed fault address and the stack range using %p. The actual addresses are required for debugging and hashed pointers provide no useful information in this context.

Use %px to print the unhashed, raw addresses.

---
 arch/x86/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/traps.c +1 -1
index bcf1dedc1d00..5a6a772e0a6c 100644
@@ -549,7 +549,7 @@ __visible void __noreturn handle_stack_overflow(struct pt_regs *regs,
 {
 	const char *name = stack_type_name(info->type);
 
-	printk(KERN_EMERG "BUG: %s stack guard page was hit at %p (stack is %p..%p)\n",
+	printk(KERN_EMERG "BUG: %s stack guard page was hit at %px (stack is %px..%px)\n",
 	       name, (void *)fault_address, info->begin, info->end);
 
 	die("stack guard page", regs, 0);
Quoted 4 lines

base-commit: b927546677c876e26eba308550207c2ddf812a43

Signature · 1 line
2.52.0

Hi all,

It's just a gentle ping on this patch.

Please let me know if there are any changes required. Any feedbacks are welcome.

Thank you
Ryosuke

#2 lore raw
In reply to Ryosuke Yasuoka
The following commit has been merged into the x86/misc branch of tip:

The following commit has been merged into the x86/misc branch of tip:

Commit-ID:     6b32c93560cb194e10279bd3be3c1d0fa30df3e7
Gitweb:        https://git.kernel.org/tip/6b32c93560cb194e10279bd3be3c1d0fa30df3e7
Author:        Ryosuke Yasuoka <[email protected]>
AuthorDate:    Wed, 24 Dec 2025 16:07:32 +09:00
Committer:     Borislav Petkov (AMD) <[email protected]>
CommitterDate: Wed, 14 Jan 2026 16:31:53 +01:00

x86/traps: Print unhashed pointers on stack overflow

When a stack overflow occurs, the kernel prints hashed fault address and the stack range using %p. The actual addresses are required for debugging and hashed pointers provide no useful information in this context.

Use %px to print the unhashed, raw addresses.

---
 arch/x86/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/traps.c +1 -1
index bcf1ded..5a6a772 100644
@@ -549,7 +549,7 @@ __visible void __noreturn handle_stack_overflow(struct pt_regs *regs,
 {
 	const char *name = stack_type_name(info->type);
 
-	printk(KERN_EMERG "BUG: %s stack guard page was hit at %p (stack is %p..%p)\n",
+	printk(KERN_EMERG "BUG: %s stack guard page was hit at %px (stack is %px..%px)\n",
 	       name, (void *)fault_address, info->begin, info->end);
 
 	die("stack guard page", regs, 0);