lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131211154626.GX16823@kw.sim.vm.gnt>
Date:	Wed, 11 Dec 2013 16:46:26 +0100
From:	Simon Guinot <simon.guinot@...uanux.org>
To:	P J P <ppandit@...hat.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [Patch] Read CONFIG_RD_ variables for initramfs compression

On Thu, Oct 31, 2013 at 12:35:05PM +0530, P J P wrote:
>   Hello Andrew,
> 
> +-- On Wed, 30 Oct 2013, Andrew Morton wrote --+
> | Isn't there some convenient way of testing for the presence of an 
> | executable in $PATH?
> | 
> | The shell-builtin `which' seems to dtrt:
> 
>   True. Please see an updated patch attached herein.
> 
> Thank you.
> --
> Prasad J Pandit / Red Hat Security Response Team

> From 352781fd2846c54e92ae0c37dd972dc5fcdfb695 Mon Sep 17 00:00:00 2001
> From: P J P <prasad@...hat.com>
> Date: Thu, 31 Oct 2013 12:03:00 +0530
> Subject: Read CONFIG_RD_ variables for initramfs compression
> 
> When expert configuration option(CONFIG_EXPERT) is enabled,
> menuconfig offers a choice of compression algorithm to compress
> initial ramfs image; This choice is stored into CONFIG_RD_*
> variables. But usr/Makefile uses earlier INITRAMFS_COMPRESSION_*
> macros to build initial ramfs file. Since none of them is defined,
> resulting 'initramfs_data.cpio' file remains un-compressed.
> 
> This patch updates the Makefile to use CONFIG_RD_* variables and
> adds support for LZ4 compression algorithm. Also updates the
> 'gen_initramfs_list.sh' script to check whether a selected
> compression command is accessible or not. And fall-back to default
> gzip(1) compression when it is not.
> 
> Signed-off-by: P J P <prasad@...hat.com>

Hi P J P,

IIUC this patch, the INITRAMFS_COMPRESSION_* options are now
ignored/useless. Don't you think we should remove them from the
usr/Kconfig file ?

Actually, I think this patch makes the initramfs compression
configuration quite confusing. Consider the following configuration
for a 3.13-rc3 kernel:

CONFIG_RD_GZIP=y
CONFIG_RD_LZMA=y
CONFIG_INITRAMFS_COMPRESSION_LZMA=y

This now produces a gzipped initramfs_data.cpio against a lzma one
previously. 

Regards,

Simon

> 
> diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
> index b482f16..ef47409 100644
> --- a/scripts/gen_initramfs_list.sh
> +++ b/scripts/gen_initramfs_list.sh
> @@ -240,12 +240,24 @@ case "$arg" in
>  		output_file="$1"
>  		cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)"
>  		output=${cpio_list}
> -		echo "$output_file" | grep -q "\.gz$" && compr="gzip -n -9 -f"
> -		echo "$output_file" | grep -q "\.bz2$" && compr="bzip2 -9 -f"
> -		echo "$output_file" | grep -q "\.lzma$" && compr="lzma -9 -f"
> -		echo "$output_file" | grep -q "\.xz$" && \
> -				compr="xz --check=crc32 --lzma2=dict=1MiB"
> -		echo "$output_file" | grep -q "\.lzo$" && compr="lzop -9 -f"
> +		echo "$output_file" | grep -q "\.gz$" \
> +                && [ -x "`which gzip 2> /dev/null`" ] \
> +                && compr="gzip -n -9 -f"
> +		echo "$output_file" | grep -q "\.bz2$" \
> +                && [ -x "`which bzip2 2> /dev/null`" ] \
> +                && compr="bzip2 -9 -f"
> +		echo "$output_file" | grep -q "\.lzma$" \
> +                && [ -x "`which lzma 2> /dev/null`" ] \
> +                && compr="lzma -9 -f"
> +		echo "$output_file" | grep -q "\.xz$" \
> +                && [ -x "`which xz 2> /dev/null`" ] \
> +                && compr="xz --check=crc32 --lzma2=dict=1MiB"
> +		echo "$output_file" | grep -q "\.lzo$" \
> +                && [ -x "`which lzop 2> /dev/null`" ] \
> +                && compr="lzop -9 -f"
> +		echo "$output_file" | grep -q "\.lz4$" \
> +                && [ -x "`which lz4 2> /dev/null`" ] \
> +                && compr="lz4 -9 -f"
>  		echo "$output_file" | grep -q "\.cpio$" && compr="cat"
>  		shift
>  		;;
> diff --git a/usr/Makefile b/usr/Makefile
> index 029ffe6..e767f01 100644
> --- a/usr/Makefile
> +++ b/usr/Makefile
> @@ -6,20 +6,23 @@ klibcdirs:;
>  PHONY += klibcdirs
>  
>  
> -# Gzip
> -suffix_$(CONFIG_INITRAMFS_COMPRESSION_GZIP)   = .gz
> -
>  # Bzip2
> -suffix_$(CONFIG_INITRAMFS_COMPRESSION_BZIP2)  = .bz2
> +suffix_$(CONFIG_RD_BZIP2)  = .bz2
>  
>  # Lzma
> -suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZMA)   = .lzma
> +suffix_$(CONFIG_RD_LZMA)   = .lzma
>  
>  # XZ
> -suffix_$(CONFIG_INITRAMFS_COMPRESSION_XZ)     = .xz
> +suffix_$(CONFIG_RD_XZ)     = .xz
>  
>  # Lzo
> -suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZO)   = .lzo
> +suffix_$(CONFIG_RD_LZO)    = .lzo
> +
> +# Lz4
> +suffix_$(CONFIG_RD_LZ4)    = .lz4
> +
> +# Gzip
> +suffix_$(CONFIG_RD_GZIP)   = .gz
>  
>  AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/initramfs_data.cpio$(suffix_y)"
>  
> @@ -53,7 +56,10 @@ endif
>  quiet_cmd_initfs = GEN     $@
>        cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input)
>  
> -targets := initramfs_data.cpio.gz initramfs_data.cpio.bz2 initramfs_data.cpio.lzma initramfs_data.cpio.xz initramfs_data.cpio.lzo initramfs_data.cpio
> +targets := initramfs_data.cpio.gz initramfs_data.cpio.bz2 \
> +	initramfs_data.cpio.lzma initramfs_data.cpio.xz \
> +	initramfs_data.cpio.lzo initramfs_data.cpio.lz4 \
> +	initramfs_data.cpio
>  # do not try to update files included in initramfs
>  $(deps_initramfs): ;
>  
> @@ -66,4 +72,3 @@ $(deps_initramfs): klibcdirs
>  $(obj)/initramfs_data.cpio$(suffix_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs
>  	$(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.d
>  	$(call if_changed,initfs)
> -
> -- 
> 1.8.3.1
> 


Download attachment "signature.asc" of type "application/pgp-signature" (199 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ