sparc: use %s for unaligned panic
PATCH 1/1 sparc: use %s for unaligned panic
Since unaligned_panic() takes a literal string, make sure it can never accidentally be used as a format string.
--- arch/sparc/kernel/unaligned_32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/kernel/unaligned_32.c +1 -1
@@ -162,7 +162,7 @@ unsigned long safe_compute_effective_address(struct pt_regs *regs,/* This is just to make gcc think panic does return... */ static void unaligned_panic (char *str) { -panic (str); +panic ("%s" , str); }/* una_asm.S */
Signature · 6 lines
1.7.9.5 -- Kees Cook Chrome OS Security
Quoted 13 lines · Kees Cook
Since
unaligned_panic()takes a literal string, make sure it can never accidentally be used as a format string.Signed-off-by Kees Cook <[email protected]>--- arch/sparc/kernel/unaligned_32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/sparc/kernel/unaligned_32.c +0
-0
arch/sparc/kernel/unaligned_32.c unsigned long safe_compute_effective_address(struct pt_regs *regs, · line 168
Quoted 8 lines
arch/sparc/kernel/unaligned_32.c +1
-1@@ -162,7 +162,7 @@ unsigned long safe_compute_effective_address(struct pt_regs *regs,/* This is just to make gcc think panic does return... */ static void unaligned_panic (char *str) { -panic (str); +panic ("%s" , str); }/* una_asm.S */
Another "fix" would be to align with sparc64 and call die_if_kernel()
Sam
David Miller
maintainerFrom: Sam Ravnborg <[email protected]>
Date: Sat, 15 Mar 2014 09:07:09 +0100
Quoted 21 lines · Kees Cook
Quoted 20 lines
Since
unaligned_panic()takes a literal string, make sure it can never accidentally be used as a format string.Signed-off-by Kees Cook <[email protected]>--- arch/sparc/kernel/unaligned_32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/sparc/kernel/unaligned_32.c +1
-1@@ -162,7 +162,7 @@ unsigned long safe_compute_effective_address(struct pt_regs *regs,/* This is just to make gcc think panic does return... */ static void unaligned_panic (char *str) { -panic (str); +panic ("%s" , str); }
Quoted 3 lines
arch/sparc/kernel/unaligned_32.c unsigned long safe_compute_effective_address(struct pt_regs *regs, · line 168
Quoted 1 line
arch/sparc/kernel/unaligned_32.c +0
-0/* una_asm.S */ Another "fix" would be to align with sparc64 and call
die_if_kernel()
Furthermore, this is a silly change because there are only two call sites, they are both in this file, and they clearly do not pass format strings embedded in the string.