Merge ~xnox/ubuntu/+source/initramfs-tools:libgcc_s into ubuntu/+source/initramfs-tools:ubuntu/devel

Proposed by Dimitri John Ledkov
Status: Needs review
Proposed branch: ~xnox/ubuntu/+source/initramfs-tools:libgcc_s
Merge into: ubuntu/+source/initramfs-tools:ubuntu/devel
Diff against target: 92 lines (+29/-9)
5 files modified
debian/changelog (+20/-0)
debian/initramfs-tools-bin.install (+1/-0)
hook-functions (+0/-7)
mkinitramfs (+3/-0)
src/Makefile (+5/-2)
Reviewer Review Type Date Requested Status
Canonical Foundations Team Pending
git-ubuntu developers Pending
Review via email: mp+385243@code.launchpad.net

Commit message

Reliable libgcc_s inclusion

To post a comment you must log in.
Revision history for this message
Steve Langasek (vorlon) wrote :

Can you get agreement on this upstream in Debian first?

Unmerged commits

179c6fc... by Dimitri John Ledkov

Properly fixup copying libgcc_s library into the initrd. LP: #1880853 Implemented differently from "[f2ac13e] hook-functions: copy_exec: Copy libgcc_s.so.1 along with libpthread.so.* (Closes: #950254)". To avoid circular shared library dependencies between compiler and libc, libpthreads chooses to dlopen libgcc_s, instead of linking against it. However, we have no way to parse/know what it needs. And even when we hardcode to include libgcc_s1, we don't have a way to know which libgcc_s1 is needed on a given system and from which path to include it. But there is a hook-function to copy a binary and all of its shared library dependencies. Thus create a stub empty executable, with shared linking against pthreads and gcc_s1 and always include it in the initrd. This way at initrd creation time, ldd is used to correctly resolve these shared library dependencies and correctly copy them into the initrd. This removes hardcoding paths as to where these libraries must be copied from on the host.

598dcc8... by Dimitri John Ledkov

0.137ubuntu9 (patches unapplied)

Imported using git-ubuntu import.

b9c21a2... by Dimitri John Ledkov

0.137ubuntu8 (patches unapplied)

Imported using git-ubuntu import.

a9299e3... by Dimitri John Ledkov

0.137ubuntu7 (patches unapplied)

Imported using git-ubuntu import.

76f57d4... by Gianfranco Costamagna

0.137ubuntu6 (patches unapplied)

Imported using git-ubuntu import.

359f422... by Dimitri John Ledkov

0.137ubuntu5 (patches unapplied)

Imported using git-ubuntu import.

bac1590... by Gianfranco Costamagna

0.137ubuntu4 (patches unapplied)

Imported using git-ubuntu import.

ebec39e... by Gianfranco Costamagna

0.137ubuntu3 (patches unapplied)

Imported using git-ubuntu import.

7f599b3... by Ben Hutchings

Import patches-unapplied version 0.137 to debian/sid

Imported using git-ubuntu import.

Changelog parent: 57216af3f25f1f18f09f915d1c3e5799772d1a63

New changelog entries:
  [ Ben Hutchings ]
  * [1b28d25] Document copy_exec as usable for shared libraries
  * [f2ac13e] hook-functions: copy_exec: Copy libgcc_s.so.1 along with
    libpthread.so.* (Closes: #950254)
  * [d96228a] hook-functions: copy_exec: Correct verbose log message for
    symlinks
  * [dd5fb36] hook-functions: Factor out device class walking into a function
  * [14a00af] hook-functions: Don't add backlight modules if we have generic
    fb device (Closes: #955347)
  * [f6133e1] Fix new shellcheck warnings around unquoted parameter expansion
    (Closes: #958851)
  [ AP ]
  * [857042c] hook-functions: Search for firmware under /lib/firmware/updates
    (Closes: #956663)

57216af... by Ben Hutchings

Import patches-unapplied version 0.136 to debian/sid

Imported using git-ubuntu import.

Changelog parent: 42dd22db1f2197e9dee4ef8c3e4131cc696951db

New changelog entries:
  [ Mathieu Malaterre ]
  * [90bd459] Update to new name for kernel module therm_pm72
  [ Alper Nebi Yasak ]
  * [ded7214] hook-functions: Handle dw_mmc-rockchip hidden dependency on
    rockchip-io-domain
  * [da85190] hook-functions: Include modules for Chromebook Plus display
  [ Ben Hutchings ]
  * [afd2668] debian/tests/control: Mark shellcheck test as superficial
  * [9d8b690] mkinitramfs: Remove workaround for old udev versions
  * [2b55aca] mkinitramfs: Remove special case for Arm OABI ports
  * [a9e5169] mkinitramfs: Remove armhf dynamic linker hack
  * [b19b6f3] debian/rules: Suppress execution of dh_installinitramfs
  * [8330bcd] mkinitramfs: Use cp -p option for ld.so.conf* instead of -aZ
  * [15fd713] initramfs-tools(7): Change example to use copy_exec instead of cp
  * [c2d589e] Revert "mkinitramfs: check if initramfs has a shell"
  * [835d584] mkinitramfs: Copy modules.builtin.bin into initramfs
    (Closes: #948257)
  * [0012977] init: Remove special case for kernel parameter resume=UUID=...
  * [897ab77] update-initramfs: Make "-c -k all" options useful again
    (Closes: #926401)
  * [d6c6eec] init: Mount /dev with "exec" option if v86d is present
    (Closes: #940171)
  * [a9e73b5] hook-functions: Drop ext4dev from filesystem module list
  * [41d9ceb] mkinitramfs: Enable multihreaded xz compression (Closes: #942144)
  [ Alexander Volkov ]
  * [e34affa] Don't require build dependency on shellcheck when nocheck profile
    is enabled
  [ Johannes 'josch' Schauer ]
  * [e2ad678] hook-functions: preloaded libraries should not end up in the
    initramfs (Closes: #944929)
  [ Debian Janitor ]
  * [a1e17fc] Bump debhelper from old 9 to 12.
  * [4d86d1a] Set debhelper-compat version in Build-Depends.
  [ Romain Perier ]
  * [4df27e2] hook-functions: Add f2fs as base in auto_add_modules
  [ Christian Göttsche ]
  * [0db5752] Do not copy SELinux context in mkinitramfs (Closes: #948365)
  [ Topi Miettinen ]
  * [55afeec] Tighten permissions for /run/initramfs

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index cfc177f..56c17a6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,23 @@
1initramfs-tools (0.137ubuntu10) groovy; urgency=medium
2
3 * Properly fixup copying libgcc_s library into the initrd. LP: #1880853
4 Implemented differently from "[f2ac13e] hook-functions: copy_exec:
5 Copy libgcc_s.so.1 along with libpthread.so.* (Closes: #950254)". To
6 avoid circular shared library dependencies between compiler and libc,
7 libpthreads chooses to dlopen libgcc_s, instead of linking against
8 it. However, we have no way to parse/know what it needs. And even when
9 we hardcode to include libgcc_s1, we don't have a way to know which
10 libgcc_s1 is needed on a given system and from which path to include
11 it. But there is a hook-function to copy a binary and all of its
12 shared library dependencies. Thus create a stub empty executable, with
13 shared linking against pthreads and gcc_s1 and always include it in
14 the initrd. This way at initrd creation time, ldd is used to correctly
15 resolve these shared library dependencies and correctly copy them into
16 the initrd. This removes hardcoding paths as to where these libraries
17 must be copied from on the host.
18
19 -- Dimitri John Ledkov <xnox@ubuntu.com> Fri, 05 Jun 2020 13:38:11 +0100
20
1initramfs-tools (0.137ubuntu9) groovy; urgency=medium21initramfs-tools (0.137ubuntu9) groovy; urgency=medium
222
3 * Document add_mountroot_fail_hook correctly.23 * Document add_mountroot_fail_hook correctly.
diff --git a/debian/initramfs-tools-bin.install b/debian/initramfs-tools-bin.install
index 9d63a93..bdc60f7 100644
--- a/debian/initramfs-tools-bin.install
+++ b/debian/initramfs-tools-bin.install
@@ -1,2 +1,3 @@
1src/wait-for-root usr/lib/initramfs-tools/bin1src/wait-for-root usr/lib/initramfs-tools/bin
2src/rzscontrol usr/lib/initramfs-tools/bin2src/rzscontrol usr/lib/initramfs-tools/bin
3src/gcc_s1-stub usr/lib/initramfs-tools/bin
diff --git a/hook-functions b/hook-functions
index d80fe32..0517140 100644
--- a/hook-functions
+++ b/hook-functions
@@ -213,13 +213,6 @@ copy_exec() {
213 x="${nonoptlib}"213 x="${nonoptlib}"
214 fi214 fi
215215
216 # Handle common dlopen() dependency (Debian bug #950254)
217 case "${x}" in
218 */libpthread.so.*)
219 copy_exec "${x%/*}/libgcc_s.so.1" || copy_exec "${x%/*}/../libgcc_s.so.1" || return
220 ;;
221 esac
222
223 copy_file binary "${x}" || {216 copy_file binary "${x}" || {
224 ret=$?217 ret=$?
225 [ ${ret} = 1 ] || return $((ret - 1))218 [ ${ret} = 1 ] || return $((ret - 1))
diff --git a/mkinitramfs b/mkinitramfs
index 637f1d6..2883a27 100644
--- a/mkinitramfs
+++ b/mkinitramfs
@@ -360,6 +360,9 @@ fi
360touch "${DESTDIR}/etc/fstab"360touch "${DESTDIR}/etc/fstab"
361ln -s /proc/mounts "${DESTDIR}/etc/mtab"361ln -s /proc/mounts "${DESTDIR}/etc/mtab"
362362
363# Install libc6, pthreads, and dlopened gcc_s.so.1 (Debian bug #950254)
364copy_exec /usr/lib/initrmafs-tools/bin/gcc_s1-stub /usr/lib/initrmafs-tools/bin/gcc_s1-stub
365
363# install wait-for-root binary.366# install wait-for-root binary.
364copy_exec /usr/lib/initramfs-tools/bin/wait-for-root /sbin367copy_exec /usr/lib/initramfs-tools/bin/wait-for-root /sbin
365368
diff --git a/src/Makefile b/src/Makefile
index c7ac39e..6210775 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -8,7 +8,7 @@ LDFLAGS =
88
99
10.PHONY: all10.PHONY: all
11all: wait-for-root rzscontrol11all: wait-for-root rzscontrol gcc_s1-stub
1212
13wait-for-root: wait-for-root.o13wait-for-root: wait-for-root.o
14 $(CC) $(LDFLAGS) -o $@ $< $(UDEV_LIBS)14 $(CC) $(LDFLAGS) -o $@ $< $(UDEV_LIBS)
@@ -16,6 +16,9 @@ wait-for-root: wait-for-root.o
16rzscontrol: rzscontrol.o16rzscontrol: rzscontrol.o
17 $(CC) $(LDFLAGS) -o $@ $<17 $(CC) $(LDFLAGS) -o $@ $<
1818
19gcc_s1-stub:
20 gcc -Wl,--no-as-needed -shared -pthread -l:libgcc_s.so.1 -o $@
21
19.PHONY: clean22.PHONY: clean
20clean:23clean:
21 rm -f wait-for-root.o wait-for-root rzscontrol.o rzscontrol core *~24 rm -f wait-for-root.o wait-for-root rzscontrol.o rzscontrol gcc_s1-stub core *~

Subscribers

People subscribed via source and target branches