All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/boot: Correctly deeclare error() as noreturn
@ 2017-05-06  4:51 Kees Cook
  2017-05-07  9:04 ` [tip:x86/urgent] x86/boot: Declare " tip-bot for Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Kees Cook @ 2017-05-06  4:51 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: H. Peter Anvin, Thomas Gleixner, x86, linux-kernel, Daniel Micay

The compressed boot function error() is used to halt execution, but it
wasn't marked with "noreturn". This fixes that in preparation for
supporting kernel FORTIFY_SOURCE, which uses the noreturn annotation
on panic, and calls error(). GCC would warn about a noreturn function
calling a non-noreturn function:

arch/x86/boot/compressed/misc.c: In function ‘fortify_panic’:
arch/x86/boot/compressed/misc.c:416:1: warning: ‘noreturn’ function does return
 }
 ^

Cc: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 arch/x86/boot/compressed/error.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/boot/compressed/error.h b/arch/x86/boot/compressed/error.h
index 2e59dac07f9e..d732e608e3af 100644
--- a/arch/x86/boot/compressed/error.h
+++ b/arch/x86/boot/compressed/error.h
@@ -1,7 +1,9 @@
 #ifndef BOOT_COMPRESSED_ERROR_H
 #define BOOT_COMPRESSED_ERROR_H
 
+#include <linux/compiler.h>
+
 void warn(char *m);
-void error(char *m);
+void error(char *m) __noreturn;
 
 #endif /* BOOT_COMPRESSED_ERROR_H */
-- 
2.7.4


-- 
Kees Cook
Pixel Security

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

* [tip:x86/urgent] x86/boot: Declare error() as noreturn
  2017-05-06  4:51 [PATCH] x86/boot: Correctly deeclare error() as noreturn Kees Cook
@ 2017-05-07  9:04 ` tip-bot for Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Kees Cook @ 2017-05-07  9:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, danielmicay, hpa, keescook, tglx, torvalds, peterz, mingo

Commit-ID:  60854a12d281e2fa25662fa32ac8022bbff17432
Gitweb:     http://git.kernel.org/tip/60854a12d281e2fa25662fa32ac8022bbff17432
Author:     Kees Cook <keescook@chromium.org>
AuthorDate: Fri, 5 May 2017 21:51:16 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sun, 7 May 2017 10:59:05 +0200

x86/boot: Declare error() as noreturn

The compressed boot function error() is used to halt execution, but it
wasn't marked with "noreturn". This fixes that in preparation for
supporting kernel FORTIFY_SOURCE, which uses the noreturn annotation
on panic, and calls error(). GCC would warn about a noreturn function
calling a non-noreturn function:

  arch/x86/boot/compressed/misc.c: In function ‘fortify_panic’:
  arch/x86/boot/compressed/misc.c:416:1: warning: ‘noreturn’ function does return
   }
 ^

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Daniel Micay <danielmicay@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Link: http://lkml.kernel.org/r/20170506045116.GA2879@beast
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/boot/compressed/error.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/boot/compressed/error.h b/arch/x86/boot/compressed/error.h
index 2e59dac..d732e60 100644
--- a/arch/x86/boot/compressed/error.h
+++ b/arch/x86/boot/compressed/error.h
@@ -1,7 +1,9 @@
 #ifndef BOOT_COMPRESSED_ERROR_H
 #define BOOT_COMPRESSED_ERROR_H
 
+#include <linux/compiler.h>
+
 void warn(char *m);
-void error(char *m);
+void error(char *m) __noreturn;
 
 #endif /* BOOT_COMPRESSED_ERROR_H */

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

end of thread, other threads:[~2017-05-07 22:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-06  4:51 [PATCH] x86/boot: Correctly deeclare error() as noreturn Kees Cook
2017-05-07  9:04 ` [tip:x86/urgent] x86/boot: Declare " tip-bot for Kees Cook

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.