Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian Kernel (http://www.linux-archive.org/debian-kernel/)
-   -   Bug#636495: initramfs-tools: installs optimized libraries into the initramfs (http://www.linux-archive.org/debian-kernel/560160-bug-636495-initramfs-tools-installs-optimized-libraries-into-initramfs.html)

Sven Joachim 08-03-2011 12:16 PM

Bug#636495: initramfs-tools: installs optimized libraries into the initramfs
 
Package: initramfs-tools
Version: 0.99
Severity: important

My initramfs contains a libc6 that is optimized for i686:

,----
| $ lsinitramfs /boot/initrd.img-$(uname -r) | grep libc.so.6
| lib/i386-linux-gnu/i686/cmov/libc.so.6
`----

No big deal for me, but wheezy/sid systems with a pre-686 processor will
likely have a totally broken initramfs if libc6-i686 gets installed
accidentally.

This happens because the code in copy_exec() that finds the path to the
unoptimized library assumes that these libraries reside directly in
{/usr,}/lib and does not handle the multiarch path case.


-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable'), (101, 'experimental')
Architecture: i386 (x86_64)

Kernel: Linux 3.0.0-nouveau (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages initramfs-tools depends on:
ii cpio 2.11-7 GNU cpio -- a program to manage ar
ii findutils 4.4.2-1+b1 utilities for finding files--find,
ii klibc-utils 1.5.24-1 small utilities built with klibc f
ii module-init-tools 3.16-1 tools for managing Linux kernel mo
ii udev 172-1 /dev/ and hotplug management daemo

Versions of packages initramfs-tools recommends:
ii busybox 1:1.18.5-1 Tiny utilities for small and embed

Versions of packages initramfs-tools suggests:
ii bash-completion 1:1.3-1 programmable completion for the ba

-- no debconf information



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 8739hilmgi.fsf@turtle.gmx.de">http://lists.debian.org/8739hilmgi.fsf@turtle.gmx.de

Sven Joachim 08-03-2011 02:41 PM

Bug#636495: initramfs-tools: installs optimized libraries into the initramfs
 
severity 636495 normal
thanks

On 2011-08-03 14:16 +0200, Sven Joachim wrote:

> Package: initramfs-tools
> Version: 0.99
> Severity: important
>
> My initramfs contains a libc6 that is optimized for i686:
>
> ,----
> | $ lsinitramfs /boot/initrd.img-$(uname -r) | grep libc.so.6
> | lib/i386-linux-gnu/i686/cmov/libc.so.6
> `----
>
> No big deal for me, but wheezy/sid systems with a pre-686 processor will
> likely have a totally broken initramfs if libc6-i686 gets installed
> accidentally.

Thinking about it again, this is probably not going to happen since ldd
will print the path of the unoptimized library if the optimized one does
not work on the current processor. So there is only a problem if the
initramfs is generated on a more capable machine and then transferred.

Cheers,
Sven




--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87vcuek15d.fsf@turtle.gmx.de">http://lists.debian.org/87vcuek15d.fsf@turtle.gmx.de

Sven Joachim 08-05-2011 11:24 AM

Bug#636495: initramfs-tools: installs optimized libraries into the initramfs
 
On 2011-08-03 14:16 +0200, Sven Joachim wrote:

> My initramfs contains a libc6 that is optimized for i686:
>
> ,----
> | $ lsinitramfs /boot/initrd.img-$(uname -r) | grep libc.so.6
> | lib/i386-linux-gnu/i686/cmov/libc.so.6
> `----
>
> No big deal for me, but wheezy/sid systems with a pre-686 processor will
> likely have a totally broken initramfs if libc6-i686 gets installed
> accidentally.
>
> This happens because the code in copy_exec() that finds the path to the
> unoptimized library assumes that these libraries reside directly in
> {/usr,}/lib and does not handle the multiarch path case.

Attached is a patch against git master that works for me:

,----
| % lsinitramfs /boot/initrd.img-$(uname -r) | grep libc.so.6
| lib/i386-linux-gnu/libc.so.6
`----

Cheers,
Sven

>From 4548e964f26e7ed11ddf02c5e81bed4f43e8b5b0 Mon Sep 17 00:00:00 2001
From: Sven Joachim <svenjoac@gmx.de>
Date: Fri, 5 Aug 2011 13:18:49 +0200
Subject: [PATCH] copy_exec: Handle optimized libraries under multiarch paths

In a multiarch world, libraries are not directly installed under
{/usr,}/lib, but one directory below. Adjust the search accordingly.

Closes: #636495
---
hook-functions | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hook-functions b/hook-functions
index 41db112..dda441a 100644
--- a/hook-functions
+++ b/hook-functions
@@ -130,7 +130,7 @@ copy_exec() {
# Try to use non-optimised libraries where possible.
# We assume that all HWCAP libraries will be in tls,
# sse2, vfp or neon.
- nonoptlib=$(echo "${x}" | sed -e 's#/lib/(tls|i686|sse2|neon|vfp).*/(lib.*)#/lib/2#')
+ nonoptlib=$(echo "${x}" | sed -e 's#/lib/([^/]*/)?(tls|i686|sse2|neon|vfp).*/(lib.*)#/lib/13#')

if [ -e "${nonoptlib}" ]; then
x="${nonoptlib}"
--
1.7.5.4

Michael Prokop 11-23-2011 10:51 AM

Bug#636495: initramfs-tools: installs optimized libraries into the initramfs
 
* Sven Joachim [Fre Aug 05, 2011 at 01:24:46 +0200]:
> On 2011-08-03 14:16 +0200, Sven Joachim wrote:

> > My initramfs contains a libc6 that is optimized for i686:

[...]

> Attached is a patch against git master that works for me:

Thanks, Sven!

I've scheduled the patch for review and inclusion in
branch mika/optimized_lib_under_multiarch

regards,
-mika-


All times are GMT. The time now is 10:32 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.