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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100825180601.GA2116@merkur.ravnborg.org>
Date:	Wed, 25 Aug 2010 20:06:01 +0200
From:	Sam Ravnborg <sam@...nborg.org>
To:	Michael Holzheu <holzheu@...ux.vnet.ibm.com>
Cc:	tabbott@...lice.com, vda.linux@...glemail.com, mmarek@...e.cz,
	hpa@...ux.intel.com, akpm@...ux-foundation.org,
	linux-kernel@...r.kernel.org, heiko.carstens@...ibm.com,
	brueckner@...ux.vnet.ibm.com, schwidefsky@...ibm.com
Subject: Re: [PATCH] Fix initramfs size calculation

On Wed, Aug 25, 2010 at 05:57:12PM +0200, Michael Holzheu wrote:
> The size of a built-in initramfs is calculated in init/initramfs.c by 
> "__initramfs_end - __initramfs_start".  Those symbols are defined in the
> linker script include/asm-generic/vmlinux.lds.h:
> 
> #define INIT_RAM_FS                                                     \
>         . = ALIGN(PAGE_SIZE);                                           \
>         VMLINUX_SYMBOL(__initramfs_start) = .;                          \
>         *(.init.ramfs)                                                  \
>         VMLINUX_SYMBOL(__initramfs_end) = .;
> 
> If the initramfs file has an odd number of bytes, the "__initramfs_end"
> symbol points to an odd address, for example, the symbols in the System.map
> might look like:
> 
>     0000000000572000 T __initramfs_start
>     00000000005bcd05 T __initramfs_end	  <-- odd address
> 
> At least on s390 this is a problem:

Another way to fix this could be to align . to an even
address like this:
> #define INIT_RAM_FS                                                     \
>         . = ALIGN(PAGE_SIZE);                                           \
>         VMLINUX_SYMBOL(__initramfs_start) = .;                          \
>         *(.init.ramfs)                                                  \
          . = ALIGN(32);                                                  \
>         VMLINUX_SYMBOL(__initramfs_end) = .;
> 

32 was selected as this is what we will introduce as the default
alignment in linker scripts anyway.

This I guess is a problem we have had some time and a minimal fix is
easier to have backported by the stable team.

> The patch also restructures the "usr/initramfs_data.xxx.S" files to use a
> common macro that includes the (compressed) initramfs file and calculates
> the __initramfs_size.
I like this anyway. Could you do this as a separate patch?

	Sam
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ