The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] bug: Let report_but_entry() provide the correct bugaddr
@ 2025-12-08 20:06 Heiko Carstens
  2025-12-08 20:27 ` Peter Zijlstra
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Heiko Carstens @ 2025-12-08 20:06 UTC (permalink / raw)
  To: Peter Zijlstra, Josh Poimboeuf, Ingo Molnar; +Cc: linux-kernel

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()")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
---
 lib/bug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bug.c b/lib/bug.c
index edd9041f89f3..c6f691f3d42d 100644
--- a/lib/bug.c
+++ b/lib/bug.c
@@ -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;
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] bug: Let report_but_entry() provide the correct bugaddr
  2025-12-08 20:06 [PATCH] bug: Let report_but_entry() provide the correct bugaddr Heiko Carstens
@ 2025-12-08 20:27 ` Peter Zijlstra
  2025-12-09  9:17 ` [tip: core/urgent] " tip-bot2 for Heiko Carstens
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2025-12-08 20:27 UTC (permalink / raw)
  To: Heiko Carstens; +Cc: Josh Poimboeuf, Ingo Molnar, linux-kernel

On Mon, Dec 08, 2025 at 09:06:58PM +0100, Heiko Carstens wrote:
> 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
>                                           ^^^^^^^^^^^^^

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

Thanks!

> Fixes: 7d2c27a0ec5e ("bug: Add report_bug_entry()")
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> ---
>  lib/bug.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/bug.c b/lib/bug.c
> index edd9041f89f3..c6f691f3d42d 100644
> --- a/lib/bug.c
> +++ b/lib/bug.c
> @@ -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;
> -- 
> 2.51.0
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip: core/urgent] bug: Let report_but_entry() provide the correct bugaddr
  2025-12-08 20:06 [PATCH] bug: Let report_but_entry() provide the correct bugaddr Heiko Carstens
  2025-12-08 20:27 ` Peter Zijlstra
@ 2025-12-09  9:17 ` tip-bot2 for Heiko Carstens
  2025-12-12  9:10 ` tip-bot2 for Heiko Carstens
  2025-12-12  9:29 ` [tip: core/urgent] bug: Let report_bug_entry() " tip-bot2 for Heiko Carstens
  3 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Heiko Carstens @ 2025-12-09  9:17 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Heiko Carstens, Peter Zijlstra (Intel), x86, linux-kernel

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 <hca@linux.ibm.com>
AuthorDate:    Mon, 08 Dec 2025 21:06:58 +01:00
Committer:     Peter Zijlstra <peterz@infradead.org>
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
                                          ^^^^^^^^^^^^^

Fixes: 7d2c27a0ec5e ("bug: Add report_bug_entry()")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251208200658.3431511-1-hca@linux.ibm.com
---
 lib/bug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bug.c b/lib/bug.c
index edd9041..c6f691f 100644
--- a/lib/bug.c
+++ b/lib/bug.c
@@ -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;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [tip: core/urgent] bug: Let report_but_entry() provide the correct bugaddr
  2025-12-08 20:06 [PATCH] bug: Let report_but_entry() provide the correct bugaddr Heiko Carstens
  2025-12-08 20:27 ` Peter Zijlstra
  2025-12-09  9:17 ` [tip: core/urgent] " tip-bot2 for Heiko Carstens
@ 2025-12-12  9:10 ` tip-bot2 for Heiko Carstens
  2025-12-12  9:29 ` [tip: core/urgent] bug: Let report_bug_entry() " tip-bot2 for Heiko Carstens
  3 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Heiko Carstens @ 2025-12-12  9:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Heiko Carstens, Peter Zijlstra (Intel), Ingo Molnar, x86,
	linux-kernel

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 <hca@linux.ibm.com>
AuthorDate:    Mon, 08 Dec 2025 21:06:58 +01:00
Committer:     Ingo Molnar <mingo@kernel.org>
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
                                            ^^^^^^^^^^^^^

Fixes: 7d2c27a0ec5e ("bug: Add report_bug_entry()")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://patch.msgid.link/20251208200658.3431511-1-hca@linux.ibm.com
---
 lib/bug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bug.c b/lib/bug.c
index edd9041..c6f691f 100644
--- a/lib/bug.c
+++ b/lib/bug.c
@@ -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;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [tip: core/urgent] bug: Let report_bug_entry() provide the correct bugaddr
  2025-12-08 20:06 [PATCH] bug: Let report_but_entry() provide the correct bugaddr Heiko Carstens
                   ` (2 preceding siblings ...)
  2025-12-12  9:10 ` tip-bot2 for Heiko Carstens
@ 2025-12-12  9:29 ` tip-bot2 for Heiko Carstens
  3 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Heiko Carstens @ 2025-12-12  9:29 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Heiko Carstens, Peter Zijlstra (Intel), Ingo Molnar, x86,
	linux-kernel

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 <hca@linux.ibm.com>
AuthorDate:    Mon, 08 Dec 2025 21:06:58 +01:00
Committer:     Ingo Molnar <mingo@kernel.org>
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
                                            ^^^^^^^^^^^^^

Fixes: 7d2c27a0ec5e ("bug: Add report_bug_entry()")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://patch.msgid.link/20251208200658.3431511-1-hca@linux.ibm.com
---
 lib/bug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bug.c b/lib/bug.c
index edd9041..c6f691f 100644
--- a/lib/bug.c
+++ b/lib/bug.c
@@ -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;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-12-12  9:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-08 20:06 [PATCH] bug: Let report_but_entry() provide the correct bugaddr Heiko Carstens
2025-12-08 20:27 ` Peter Zijlstra
2025-12-09  9:17 ` [tip: core/urgent] " tip-bot2 for Heiko Carstens
2025-12-12  9:10 ` tip-bot2 for Heiko Carstens
2025-12-12  9:29 ` [tip: core/urgent] bug: Let report_bug_entry() " tip-bot2 for Heiko Carstens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox