Re: [PATCH 25/42] x86, boot: print compression suffix in decompress stage

From: Kees Cook
Date: Tue Jul 07 2015 - 19:14:00 EST


On Tue, Jul 7, 2015 at 1:20 PM, Yinghai Lu <yinghai@xxxxxxxxxx> wrote:
> Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>
> ---
> arch/x86/boot/compressed/misc.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
> index a428c03..9266f78 100644
> --- a/arch/x86/boot/compressed/misc.c
> +++ b/arch/x86/boot/compressed/misc.c
> @@ -120,26 +120,32 @@ static int lines, cols;
>
> #ifdef CONFIG_KERNEL_GZIP
> #include "../../../../lib/decompress_inflate.c"
> +static char *suffix_str = "gz";
> #endif
>
> #ifdef CONFIG_KERNEL_BZIP2
> #include "../../../../lib/decompress_bunzip2.c"
> +static char *suffix_str = "bz2";
> #endif
>
> #ifdef CONFIG_KERNEL_LZMA
> #include "../../../../lib/decompress_unlzma.c"
> +static char *suffix_str = "lzma";
> #endif
>
> #ifdef CONFIG_KERNEL_XZ
> #include "../../../../lib/decompress_unxz.c"
> +static char *suffix_str = "xz";
> #endif
>
> #ifdef CONFIG_KERNEL_LZO
> #include "../../../../lib/decompress_unlzo.c"
> +static char *suffix_str = "lzo";
> #endif
>
> #ifdef CONFIG_KERNEL_LZ4
> #include "../../../../lib/decompress_unlz4.c"
> +static char *suffix_str = "lz4";
> #endif

I like the idea!

>
> static void scroll(void)
> @@ -486,6 +492,8 @@ asmlinkage __visible void *decompress_kernel(void *rmode, memptr heap,
> (unsigned long)input_data,
> (unsigned long)input_data + input_len - 1);
> debug_putstr("\nDecompressing Linux... ");
> + debug_putstr(suffix_str);
> + debug_putstr("... ");

I wouldn't repeat the "...". Maybe remove "..." from the Decompressing putstr?

-Kees

> decompress(input_data, input_len, NULL, NULL, output, NULL, error);
> parse_elf(output);
> handle_relocations(output, output_len, virt_offset);
> --
> 1.8.4.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/



--
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/