public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fortify: Avoid panic() in favor of BUG()
@ 2017-06-26 23:51 Kees Cook
  2017-06-27 15:52 ` kbuild test robot
  0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2017-06-26 23:51 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Jonathan Corbet, Mika Westerberg, Bjorn Helgaas,
	Mauro Carvalho Chehab, Heikki Krogerus, Daniel Micay,
	linux-kernel

Since detection of a given fortify failure is sufficient to stop the
memory corruption from happening, it doesn't make sense to unconditionally
bring down the entire system. Instead, use BUG() which will stop the bad
thread of kernel execution (and only optionally panic the system).

Cc: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 lib/string.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/string.c b/lib/string.c
index a6ee1955a701..ebbb99c775bd 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -981,6 +981,7 @@ EXPORT_SYMBOL(strreplace);
 
 void fortify_panic(const char *name)
 {
-	panic("detected buffer overflow in %s", name);
+	pr_emerg("detected buffer overflow in %s\n", name);
+	BUG();
 }
 EXPORT_SYMBOL(fortify_panic);
-- 
2.7.4


-- 
Kees Cook
Pixel Security

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

end of thread, other threads:[~2017-06-27 19:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-26 23:51 [PATCH] fortify: Avoid panic() in favor of BUG() Kees Cook
2017-06-27 15:52 ` kbuild test robot
2017-06-27 19:16   ` Kees Cook

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