All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] bug: make __warn unconditionally defined
@ 2022-04-26  3:20 Stephen Zhang
  2022-04-26 10:35 ` [tip: x86/urgent] bug: Have __warn() prototype defined unconditionally tip-bot2 for Shida Zhang
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Zhang @ 2022-04-26  3:20 UTC (permalink / raw)
  To: arnd, tglx, mingo, bp, dave.hansen, x86
  Cc: hpa, peterz, laijs, lihuafei1, fenghua.yu, chang.seok.bae,
	zhangshida, starzhangzsd, linux-arch, linux-kernel

From: Shida Zhang <zhangshida@kylinos.cn>

__warn() was defined when CONFIG_BUG gets defined originally, but
it was used unconditonally by traps.c. So the idea is to have the
__warn unconditional.

Signed-off-by: Shida Zhang <zhangshida@kylinos.cn>
---
 Changelog in v1 -> v2:
 - To have the __warn() unconditional instead.

 include/asm-generic/bug.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index edb0e2a602a8..ba1f860af38b 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -21,6 +21,12 @@
 #include <linux/panic.h>
 #include <linux/printk.h>
 
+struct warn_args;
+struct pt_regs;
+
+void __warn(const char *file, int line, void *caller, unsigned taint,
+	    struct pt_regs *regs, struct warn_args *args);
+
 #ifdef CONFIG_BUG
 
 #ifdef CONFIG_GENERIC_BUG
@@ -110,11 +116,6 @@ extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
 #endif
 
 /* used internally by panic.c */
-struct warn_args;
-struct pt_regs;
-
-void __warn(const char *file, int line, void *caller, unsigned taint,
-	    struct pt_regs *regs, struct warn_args *args);
 
 #ifndef WARN_ON
 #define WARN_ON(condition) ({						\
-- 
2.30.2


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

* [tip: x86/urgent] bug: Have __warn() prototype defined unconditionally
  2022-04-26  3:20 [PATCH v2] bug: make __warn unconditionally defined Stephen Zhang
@ 2022-04-26 10:35 ` tip-bot2 for Shida Zhang
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Shida Zhang @ 2022-04-26 10:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Peter Zijlstra (Intel), Shida Zhang, Borislav Petkov, x86, linux-kernel

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

Commit-ID:     1fa568e26f001e951b634d62ef3accdc80a87c7b
Gitweb:        https://git.kernel.org/tip/1fa568e26f001e951b634d62ef3accdc80a87c7b
Author:        Shida Zhang <zhangshida@kylinos.cn>
AuthorDate:    Tue, 26 Apr 2022 11:20:07 +08:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Tue, 26 Apr 2022 10:59:57 +02:00

bug: Have __warn() prototype defined unconditionally

The __warn() prototype is declared in CONFIG_BUG scope but the function
definition in panic.c is unconditional. The IBT enablement started using
it unconditionally but a CONFIG_X86_KERNEL_IBT=y, CONFIG_BUG=n .config
will trigger a

  arch/x86/kernel/traps.c: In function ‘__exc_control_protection’:
  arch/x86/kernel/traps.c:249:17: error: implicit declaration of function \
  	  ‘__warn’; did you mean ‘pr_warn’? [-Werror=implicit-function-declaration]

Pull up the declarations so that they're unconditionally visible too.

  [ bp: Rewrite commit message. ]

Fixes: 991625f3dd2c ("x86/ibt: Add IBT feature, MSR and #CP handling")
Suggested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Shida Zhang <zhangshida@kylinos.cn>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20220426032007.510245-1-starzhangzsd@gmail.com
---
 include/asm-generic/bug.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index edb0e2a..ba1f860 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -21,6 +21,12 @@
 #include <linux/panic.h>
 #include <linux/printk.h>
 
+struct warn_args;
+struct pt_regs;
+
+void __warn(const char *file, int line, void *caller, unsigned taint,
+	    struct pt_regs *regs, struct warn_args *args);
+
 #ifdef CONFIG_BUG
 
 #ifdef CONFIG_GENERIC_BUG
@@ -110,11 +116,6 @@ extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
 #endif
 
 /* used internally by panic.c */
-struct warn_args;
-struct pt_regs;
-
-void __warn(const char *file, int line, void *caller, unsigned taint,
-	    struct pt_regs *regs, struct warn_args *args);
 
 #ifndef WARN_ON
 #define WARN_ON(condition) ({						\

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

end of thread, other threads:[~2022-04-26 10:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26  3:20 [PATCH v2] bug: make __warn unconditionally defined Stephen Zhang
2022-04-26 10:35 ` [tip: x86/urgent] bug: Have __warn() prototype defined unconditionally tip-bot2 for Shida Zhang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.