[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGXu5j+gntXQQdC4aOiH9mOTv5rEqXqbQ1rt2XN_BkWznLR=7A@mail.gmail.com>
Date: Tue, 24 Jun 2014 16:55:00 -0700
From: Kees Cook <keescook@...omium.org>
To: Ben Chan <benchan@...omium.org>
Cc: Ralf Baechle <ralf@...ux-mips.org>, linux-mips@...ux-mips.org,
LKML <linux-kernel@...r.kernel.org>,
Olof Johansson <olofj@...omium.org>
Subject: Re: [PATCH] MIPS: ZBOOT: implement stack protector in compressed boot phase
On Tue, Jun 24, 2014 at 4:00 PM, Ben Chan <benchan@...omium.org> wrote:
> This patch implements the stack protector code in MIPS compressed boot
> phase based on the same code added to arm in commit
> 8779657d29c0ebcc0c94ede4df2f497baf1b563f "stackprotector: Introduce
> CONFIG_CC_STACKPROTECTOR_STRONG" by Kees Cook <keescook@...omium.org>
>
> Signed-off-by: Ben Chan <benchan@...omium.org>
> Cc: Kees Cook <keescook@...omium.org>
> Cc: Olof Johansson <olofj@...omium.org>
> ---
> arch/mips/boot/compressed/decompress.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
> index c00c4dd..b49c7ad 100644
> --- a/arch/mips/boot/compressed/decompress.c
> +++ b/arch/mips/boot/compressed/decompress.c
> @@ -67,10 +67,24 @@ 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;
> +}
> +
> +void __stack_chk_fail(void)
> +{
> + error("stack-protector: Kernel stack is corrupted\n");
> +}
> +
> void decompress_kernel(unsigned long boot_heap_start)
> {
> 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);
> --
> 2.0.0.526.g5318336
Yup, that looks correct to me. As in the ARM case, gathering entropy
for the canary here is overkill, so this is sufficient to build and
provide basic canary support in the decompression phase of boot.
Reviewed-by: Kees Cook <keescook@...omium.org>
Thanks!
-Kees
--
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists