linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bug: Fix "cut here" for WARN_ON for __WARN_TAINT architectures
@ 2019-06-24 15:48 Drew Davenport
  2019-06-24 15:58 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Drew Davenport @ 2019-06-24 15:48 UTC (permalink / raw)
  To: akpm; +Cc: keescook, linux-kernel, Drew Davenport, stable

For architectures using __WARN_TAINT, the WARN_ON macro did not
print out the "cut here" string. The other WARN_XXX macros would
print "cut here" inside __warn_printk, which is not called for
WARN_ON since it doesn't have a message to print.

Fixes: a7bed27af194 ("bug: fix "cut here" location for __WARN_TAINT architectures")
Cc: stable@vger.kernel.org

Signed-off-by: Drew Davenport <ddavenport@chromium.org>
---
 include/asm-generic/bug.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index c21ff2712803..79feb1a3081b 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -94,8 +94,10 @@ extern void warn_slowpath_null(const char *file, const int line);
 	warn_slowpath_fmt_taint(__FILE__, __LINE__, taint, arg)
 #else
 extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
-#define __WARN()		__WARN_TAINT(TAINT_WARN)
-#define __WARN_printf(arg...)	do { __warn_printk(arg); __WARN(); } while (0)
+#define __WARN() do { \
+	printk(KERN_WARNING CUT_HERE); __WARN_TAINT(TAINT_WARN); \
+} while (0)
+#define __WARN_printf(arg...)	__WARN_printf_taint(TAINT_WARN, arg)
 #define __WARN_printf_taint(taint, arg...)				\
 	do { __warn_printk(arg); __WARN_TAINT(taint); } while (0)
 #endif
-- 
2.20.1


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

* Re: [PATCH] bug: Fix "cut here" for WARN_ON for __WARN_TAINT architectures
  2019-06-24 15:48 [PATCH] bug: Fix "cut here" for WARN_ON for __WARN_TAINT architectures Drew Davenport
@ 2019-06-24 15:58 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2019-06-24 15:58 UTC (permalink / raw)
  To: Drew Davenport, akpm; +Cc: linux-kernel, stable

On Mon, Jun 24, 2019 at 09:48:31AM -0600, Drew Davenport wrote:
> For architectures using __WARN_TAINT, the WARN_ON macro did not
> print out the "cut here" string. The other WARN_XXX macros would
> print "cut here" inside __warn_printk, which is not called for
> WARN_ON since it doesn't have a message to print.
> 
> Fixes: a7bed27af194 ("bug: fix "cut here" location for __WARN_TAINT architectures")
> Cc: stable@vger.kernel.org
> Signed-off-by: Drew Davenport <ddavenport@chromium.org>

Whoops, yes; thanks for catching this!

Acked-and-Tested-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  include/asm-generic/bug.h | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
> index c21ff2712803..79feb1a3081b 100644
> --- a/include/asm-generic/bug.h
> +++ b/include/asm-generic/bug.h
> @@ -94,8 +94,10 @@ extern void warn_slowpath_null(const char *file, const int line);
>  	warn_slowpath_fmt_taint(__FILE__, __LINE__, taint, arg)
>  #else
>  extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
> -#define __WARN()		__WARN_TAINT(TAINT_WARN)
> -#define __WARN_printf(arg...)	do { __warn_printk(arg); __WARN(); } while (0)
> +#define __WARN() do { \
> +	printk(KERN_WARNING CUT_HERE); __WARN_TAINT(TAINT_WARN); \
> +} while (0)
> +#define __WARN_printf(arg...)	__WARN_printf_taint(TAINT_WARN, arg)
>  #define __WARN_printf_taint(taint, arg...)				\
>  	do { __warn_printk(arg); __WARN_TAINT(taint); } while (0)
>  #endif
> -- 
> 2.20.1
> 

-- 
Kees Cook

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

end of thread, other threads:[~2019-06-24 15:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-24 15:48 [PATCH] bug: Fix "cut here" for WARN_ON for __WARN_TAINT architectures Drew Davenport
2019-06-24 15:58 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).