Skip to contentSkip to conversation

bug: Let report_but_entry() provide the correct bugaddr

PATCH Applied Heiko Carstens 3 participants 5 messages Dec 8, 2025 – Dec 12, 2025 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bug: Let report_but_entry() provide the correct bugaddr

report_bug_entry() always provides zero for bugaddr but could easily extract the correct address from the provided bug_entry. Just do that to have proper warning messages.

E.g. adding an artificial

void foo(void) { WARN_ONCE(1, "bar"); }

function generates this warning message:

WARNING: arch/s390/kernel/setup.c:1017 at 0x0, CPU#0: swapper/0/0
                                          ^^^

With the correct bug address this changes to:

WARNING: arch/s390/kernel/setup.c:1017 at foo+0x1c/0x40, CPU#0: swapper/0/0
                                          ^^^^^^^^^^^^^
Fixes 7d2c27a0ec5e ("bug: Add report_bug_entry()")
---
 lib/bug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bug.c +1 -1
index edd9041f89f3..c6f691f3d42d 100644
@@ -262,7 +262,7 @@ enum bug_trap_type report_bug_entry(struct bug_entry *bug, struct pt_regs *regs)
 	bool rcu = false;
 
 	rcu = warn_rcu_enter();
-	ret = __report_bug(bug, 0, regs);
+	ret = __report_bug(bug, bug_addr(bug), regs);
 	warn_rcu_exit(rcu);
 
 	return ret;
Signature · 1 line
2.51.0
#1 lore raw
Quoted 8 lines · Heiko Carstens

report_bug_entry() always provides zero for bugaddr but could easily extract the correct address from the provided bug_entry. Just do that to have proper warning messages.

E.g. adding an artificial

void foo(void) { WARN_ONCE(1, "bar"); }

Quoted 7 lines

function generates this warning message:

WARNING: arch/s390/kernel/setup.c:1017 at 0x0, CPU#0: swapper/0/0
                                          ^^^

With the correct bug address this changes to:

WARNING: arch/s390/kernel/setup.c:1017 at foo+0x1c/0x40, CPU#0: swapper/0/0
                                          ^^^^^^^^^^^^^

Indeed. I'll stick this with that W=1 build thing.

Thanks!

Quoted 22 lines
Fixes 7d2c27a0ec5e ("bug: Add report_bug_entry()")
---
 lib/bug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bug.c +1 -1
index edd9041f89f3..c6f691f3d42d 100644
@@ -262,7 +262,7 @@ enum bug_trap_type report_bug_entry(struct bug_entry *bug, struct pt_regs *regs)
 	bool rcu = false;
 
 	rcu = warn_rcu_enter();
-	ret = __report_bug(bug, 0, regs);
+	ret = __report_bug(bug, bug_addr(bug), regs);
 	warn_rcu_exit(rcu);
 
 	return ret;
Signature · 1 line
2.51.0
merge bot Applied
#2 lore raw
In reply to Heiko Carstens
The following commit has been merged into the core/urgent branch of tip:

The following commit has been merged into the core/urgent branch of tip:

Commit-ID:     477fa55e3de7c40ba47f10c837c6a32e300893a1
Gitweb:        https://git.kernel.org/tip/477fa55e3de7c40ba47f10c837c6a32e300893a1
Author:        Heiko Carstens <[email protected]>
AuthorDate:    Mon, 08 Dec 2025 21:06:58 +01:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Tue, 09 Dec 2025 10:14:46 +01:00

bug: Let report_but_entry() provide the correct bugaddr

report_bug_entry() always provides zero for bugaddr but could easily extract the correct address from the provided bug_entry. Just do that to have proper warning messages.

E.g. adding an artificial

void foo(void) { WARN_ONCE(1, "bar"); }

function generates this warning message:

WARNING: arch/s390/kernel/setup.c:1017 at 0x0, CPU#0: swapper/0/0
                                          ^^^

With the correct bug address this changes to:

WARNING: arch/s390/kernel/setup.c:1017 at foo+0x1c/0x40, CPU#0: swapper/0/0
                                          ^^^^^^^^^^^^^
---
 lib/bug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bug.c +1 -1
index edd9041..c6f691f 100644
@@ -262,7 +262,7 @@ enum bug_trap_type report_bug_entry(struct bug_entry *bug, struct pt_regs *regs)
 	bool rcu = false;
 
 	rcu = warn_rcu_enter();
-	ret = __report_bug(bug, 0, regs);
+	ret = __report_bug(bug, bug_addr(bug), regs);
 	warn_rcu_exit(rcu);
 
 	return ret;
merge bot Applied
#3 lore raw
In reply to Heiko Carstens
The following commit has been merged into the core/urgent branch of tip:

The following commit has been merged into the core/urgent branch of tip:

Commit-ID:     6e83b79a2e7374821109705c001aa04c0b36b07f
Gitweb:        https://git.kernel.org/tip/6e83b79a2e7374821109705c001aa04c0b36b07f
Author:        Heiko Carstens <[email protected]>
AuthorDate:    Mon, 08 Dec 2025 21:06:58 +01:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Fri, 12 Dec 2025 10:05:55 +01:00

bug: Let report_but_entry() provide the correct bugaddr

report_bug_entry() always provides zero for bugaddr but could easily extract the correct address from the provided bug_entry. Just do that to have proper warning messages.

E.g. adding an artificial:

void foo(void) { WARN_ONCE(1, "bar"); }

function generates this warning message:

  WARNING: arch/s390/kernel/setup.c:1017 at 0x0, CPU#0: swapper/0/0
                                            ^^^

With the correct bug address this changes to:

  WARNING: arch/s390/kernel/setup.c:1017 at foo+0x1c/0x40, CPU#0: swapper/0/0
                                            ^^^^^^^^^^^^^
---
 lib/bug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bug.c +1 -1
index edd9041..c6f691f 100644
@@ -262,7 +262,7 @@ enum bug_trap_type report_bug_entry(struct bug_entry *bug, struct pt_regs *regs)
 	bool rcu = false;
 
 	rcu = warn_rcu_enter();
-	ret = __report_bug(bug, 0, regs);
+	ret = __report_bug(bug, bug_addr(bug), regs);
 	warn_rcu_exit(rcu);
 
 	return ret;
merge bot Applied
#4 lore raw

[tip: core/urgent] bug: Let report_bug_entry() provide the correct bugaddr

In reply to Heiko Carstens
The following commit has been merged into the core/urgent branch of tip:

The following commit has been merged into the core/urgent branch of tip:

Commit-ID:     b5e51ef787660bffe9cd059e7abe32f3b1667a98
Gitweb:        https://git.kernel.org/tip/b5e51ef787660bffe9cd059e7abe32f3b1667a98
Author:        Heiko Carstens <[email protected]>
AuthorDate:    Mon, 08 Dec 2025 21:06:58 +01:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Fri, 12 Dec 2025 10:26:13 +01:00

bug: Let report_bug_entry() provide the correct bugaddr

report_bug_entry() always provides zero for bugaddr but could easily extract the correct address from the provided bug_entry. Just do that to have proper warning messages.

E.g. adding an artificial:

void foo(void) { WARN_ONCE(1, "bar"); }

function generates this warning message:

  WARNING: arch/s390/kernel/setup.c:1017 at 0x0, CPU#0: swapper/0/0
                                            ^^^

With the correct bug address this changes to:

  WARNING: arch/s390/kernel/setup.c:1017 at foo+0x1c/0x40, CPU#0: swapper/0/0
                                            ^^^^^^^^^^^^^
---
 lib/bug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bug.c +1 -1
index edd9041..c6f691f 100644
@@ -262,7 +262,7 @@ enum bug_trap_type report_bug_entry(struct bug_entry *bug, struct pt_regs *regs)
 	bool rcu = false;
 
 	rcu = warn_rcu_enter();
-	ret = __report_bug(bug, 0, regs);
+	ret = __report_bug(bug, bug_addr(bug), regs);
 	warn_rcu_exit(rcu);
 
 	return ret;