* [failures] zboot-fix-stack-protector-in-compressed-boot-phase.patch removed from -mm tree
@ 2018-03-08 23:10 akpm
0 siblings, 0 replies; 2+ messages in thread
From: akpm @ 2018-03-08 23:10 UTC (permalink / raw)
To: akpm, chenhc, dalias, james.hogan, linux, mm-commits, ralf,
stable, ysato
The patch titled
Subject: zboot: fix stack protector in compressed boot phase
has been removed from the -mm tree. Its filename was
zboot-fix-stack-protector-in-compressed-boot-phase.patch
This patch was dropped because it had testing failures
------------------------------------------------------
From: Huacai Chen <chenhc@lemote.com>
Subject: zboot: fix stack protector in compressed boot phase
Calling __stack_chk_guard_setup() in decompress_kernel() is too late
because stack checking always fails for decompress_kernel() itself. So
remove __stack_chk_guard_setup() and initialize __stack_chk_guard at
compile time.
Original code comes from ARM but also used for MIPS and SH, so fix them
together. Without this fix, compressed booting of these archs will fail
because stack checking is enabled by default (>=4.16).
Link: http://lkml.kernel.org/r/1520230721-1839-1-git-send-email-chenhc@lemote.com
Signed-off-by: Huacai Chen <chenhc@lemote.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <james.hogan@mips.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
arch/arm/boot/compressed/misc.c | 9 +--------
arch/mips/boot/compressed/decompress.c | 9 +--------
arch/sh/boot/compressed/misc.c | 9 +--------
3 files changed, 3 insertions(+), 24 deletions(-)
diff -puN arch/arm/boot/compressed/misc.c~zboot-fix-stack-protector-in-compressed-boot-phase arch/arm/boot/compressed/misc.c
--- a/arch/arm/boot/compressed/misc.c~zboot-fix-stack-protector-in-compressed-boot-phase
+++ a/arch/arm/boot/compressed/misc.c
@@ -128,12 +128,7 @@ asmlinkage void __div0(void)
error("Attempting division by 0!");
}
-unsigned long __stack_chk_guard;
-
-void __stack_chk_guard_setup(void)
-{
- __stack_chk_guard = 0x000a0dff;
-}
+unsigned long __stack_chk_guard = 0x000a0dff;
void __stack_chk_fail(void)
{
@@ -150,8 +145,6 @@ decompress_kernel(unsigned long output_s
{
int ret;
- __stack_chk_guard_setup();
-
output_data = (unsigned char *)output_start;
free_mem_ptr = free_mem_ptr_p;
free_mem_end_ptr = free_mem_ptr_end_p;
diff -puN arch/mips/boot/compressed/decompress.c~zboot-fix-stack-protector-in-compressed-boot-phase arch/mips/boot/compressed/decompress.c
--- a/arch/mips/boot/compressed/decompress.c~zboot-fix-stack-protector-in-compressed-boot-phase
+++ a/arch/mips/boot/compressed/decompress.c
@@ -76,12 +76,7 @@ void error(char *x)
#include "../../../../lib/decompress_unxz.c"
#endif
-unsigned long __stack_chk_guard;
-
-void __stack_chk_guard_setup(void)
-{
- __stack_chk_guard = 0x000a0dff;
-}
+unsigned long __stack_chk_guard = 0x000a0dff;
void __stack_chk_fail(void)
{
@@ -92,8 +87,6 @@ void decompress_kernel(unsigned long boo
{
unsigned long zimage_start, zimage_size;
- __stack_chk_guard_setup();
-
zimage_start = (unsigned long)(&__image_begin);
zimage_size = (unsigned long)(&__image_end) -
(unsigned long)(&__image_begin);
diff -puN arch/sh/boot/compressed/misc.c~zboot-fix-stack-protector-in-compressed-boot-phase arch/sh/boot/compressed/misc.c
--- a/arch/sh/boot/compressed/misc.c~zboot-fix-stack-protector-in-compressed-boot-phase
+++ a/arch/sh/boot/compressed/misc.c
@@ -104,12 +104,7 @@ static void error(char *x)
while(1); /* Halt */
}
-unsigned long __stack_chk_guard;
-
-void __stack_chk_guard_setup(void)
-{
- __stack_chk_guard = 0x000a0dff;
-}
+unsigned long __stack_chk_guard = 0x000a0dff;
void __stack_chk_fail(void)
{
@@ -130,8 +125,6 @@ void decompress_kernel(void)
{
unsigned long output_addr;
- __stack_chk_guard_setup();
-
#ifdef CONFIG_SUPERH64
output_addr = (CONFIG_MEMORY_START + 0x2000);
#else
_
Patches currently in -mm which might be from chenhc@lemote.com are
^ permalink raw reply [flat|nested] 2+ messages in thread
* [failures] zboot-fix-stack-protector-in-compressed-boot-phase.patch removed from -mm tree
@ 2018-03-23 19:15 akpm
0 siblings, 0 replies; 2+ messages in thread
From: akpm @ 2018-03-23 19:15 UTC (permalink / raw)
To: chenhc, dalias, james.hogan, linux, mm-commits, ralf, stable,
ysato
The patch titled
Subject: zboot: fix stack protector in compressed boot phase
has been removed from the -mm tree. Its filename was
zboot-fix-stack-protector-in-compressed-boot-phase.patch
This patch was dropped because it had testing failures
------------------------------------------------------
From: Huacai Chen <chenhc@lemote.com>
Subject: zboot: fix stack protector in compressed boot phase
Calling __stack_chk_guard_setup() in decompress_kernel() is too late, so
stack checking always fails for decompress_kernel() itself. So remove
__stack_chk_guard_setup() and initialize __stack_chk_guard before we call
decompress_kernel().
Original code comes from ARM but also used for MIPS and SH, so fix them
together. If without this fix, compressed booting of these archs will
fail because stack checking is enabled by default (>=4.16).
Link: http://lkml.kernel.org/r/1521186916-13745-1-git-send-email-chenhc@lemote.com
Signed-off-by: Huacai Chen <chenhc@lemote.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <james.hogan@mips.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
arch/arm/boot/compressed/head.S | 4 ++++
arch/arm/boot/compressed/misc.c | 7 -------
arch/mips/boot/compressed/decompress.c | 7 -------
arch/mips/boot/compressed/head.S | 4 ++++
arch/sh/boot/compressed/head_32.S | 8 ++++++++
arch/sh/boot/compressed/head_64.S | 4 ++++
arch/sh/boot/compressed/misc.c | 7 -------
7 files changed, 20 insertions(+), 21 deletions(-)
diff -puN arch/arm/boot/compressed/head.S~zboot-fix-stack-protector-in-compressed-boot-phase arch/arm/boot/compressed/head.S
--- a/arch/arm/boot/compressed/head.S~zboot-fix-stack-protector-in-compressed-boot-phase
+++ a/arch/arm/boot/compressed/head.S
@@ -547,6 +547,10 @@ not_relocated: mov r0, #0
bic r4, r4, #1
blne cache_on
+ ldr r0, =__stack_chk_guard
+ ldr r1, =0x000a0dff
+ str r1, [r0]
+
/*
* The C runtime environment should now be setup sufficiently.
* Set up some pointers, and start decompressing.
diff -puN arch/arm/boot/compressed/misc.c~zboot-fix-stack-protector-in-compressed-boot-phase arch/arm/boot/compressed/misc.c
--- a/arch/arm/boot/compressed/misc.c~zboot-fix-stack-protector-in-compressed-boot-phase
+++ a/arch/arm/boot/compressed/misc.c
@@ -130,11 +130,6 @@ asmlinkage void __div0(void)
unsigned long __stack_chk_guard;
-void __stack_chk_guard_setup(void)
-{
- __stack_chk_guard = 0x000a0dff;
-}
-
void __stack_chk_fail(void)
{
error("stack-protector: Kernel stack is corrupted\n");
@@ -150,8 +145,6 @@ decompress_kernel(unsigned long output_s
{
int ret;
- __stack_chk_guard_setup();
-
output_data = (unsigned char *)output_start;
free_mem_ptr = free_mem_ptr_p;
free_mem_end_ptr = free_mem_ptr_end_p;
diff -puN arch/mips/boot/compressed/decompress.c~zboot-fix-stack-protector-in-compressed-boot-phase arch/mips/boot/compressed/decompress.c
--- a/arch/mips/boot/compressed/decompress.c~zboot-fix-stack-protector-in-compressed-boot-phase
+++ a/arch/mips/boot/compressed/decompress.c
@@ -78,11 +78,6 @@ void error(char *x)
unsigned long __stack_chk_guard;
-void __stack_chk_guard_setup(void)
-{
- __stack_chk_guard = 0x000a0dff;
-}
-
void __stack_chk_fail(void)
{
error("stack-protector: Kernel stack is corrupted\n");
@@ -92,8 +87,6 @@ void decompress_kernel(unsigned long boo
{
unsigned long zimage_start, zimage_size;
- __stack_chk_guard_setup();
-
zimage_start = (unsigned long)(&__image_begin);
zimage_size = (unsigned long)(&__image_end) -
(unsigned long)(&__image_begin);
diff -puN arch/mips/boot/compressed/head.S~zboot-fix-stack-protector-in-compressed-boot-phase arch/mips/boot/compressed/head.S
--- a/arch/mips/boot/compressed/head.S~zboot-fix-stack-protector-in-compressed-boot-phase
+++ a/arch/mips/boot/compressed/head.S
@@ -32,6 +32,10 @@ start:
bne a2, a0, 1b
addiu a0, a0, 4
+ PTR_LA a0, __stack_chk_guard
+ PTR_LI a1, 0x000a0dff
+ sw a1, 0(a0)
+
PTR_LA a0, (.heap) /* heap address */
PTR_LA sp, (.stack + 8192) /* stack address */
diff -puN arch/sh/boot/compressed/head_32.S~zboot-fix-stack-protector-in-compressed-boot-phase arch/sh/boot/compressed/head_32.S
--- a/arch/sh/boot/compressed/head_32.S~zboot-fix-stack-protector-in-compressed-boot-phase
+++ a/arch/sh/boot/compressed/head_32.S
@@ -76,6 +76,10 @@ l1:
mov.l init_stack_addr, r0
mov.l @r0, r15
+ mov.l __stack_chk_guard_addr, r0
+ mov.l __stack_chk_guard_val, r1
+ mov.l r1, @r0
+
/* Decompress the kernel */
mov.l decompress_kernel_addr, r0
jsr @r0
@@ -97,6 +101,10 @@ kexec_magic:
.long 0x400000F0 /* magic used by kexec to parse zImage format */
init_stack_addr:
.long stack_start
+__stack_chk_guard_val:
+ .long 0x000A0DFF
+__stack_chk_guard_addr:
+ .long __stack_chk_guard
decompress_kernel_addr:
.long decompress_kernel
kernel_start_addr:
diff -puN arch/sh/boot/compressed/head_64.S~zboot-fix-stack-protector-in-compressed-boot-phase arch/sh/boot/compressed/head_64.S
--- a/arch/sh/boot/compressed/head_64.S~zboot-fix-stack-protector-in-compressed-boot-phase
+++ a/arch/sh/boot/compressed/head_64.S
@@ -132,6 +132,10 @@ startup:
addi r22, 4, r22
bne r22, r23, tr1
+ movi datalabel __stack_chk_guard, r0
+ movi 0x000a0dff, r1
+ st.l r0, 0, r1
+
/*
* Decompress the kernel.
*/
diff -puN arch/sh/boot/compressed/misc.c~zboot-fix-stack-protector-in-compressed-boot-phase arch/sh/boot/compressed/misc.c
--- a/arch/sh/boot/compressed/misc.c~zboot-fix-stack-protector-in-compressed-boot-phase
+++ a/arch/sh/boot/compressed/misc.c
@@ -106,11 +106,6 @@ static void error(char *x)
unsigned long __stack_chk_guard;
-void __stack_chk_guard_setup(void)
-{
- __stack_chk_guard = 0x000a0dff;
-}
-
void __stack_chk_fail(void)
{
error("stack-protector: Kernel stack is corrupted\n");
@@ -130,8 +125,6 @@ void decompress_kernel(void)
{
unsigned long output_addr;
- __stack_chk_guard_setup();
-
#ifdef CONFIG_SUPERH64
output_addr = (CONFIG_MEMORY_START + 0x2000);
#else
_
Patches currently in -mm which might be from chenhc@lemote.com are
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-23 19:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-23 19:15 [failures] zboot-fix-stack-protector-in-compressed-boot-phase.patch removed from -mm tree akpm
-- strict thread matches above, loose matches on Subject: below --
2018-03-08 23:10 akpm
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).