dracutdevs / dracut

dracut the event driven initramfs infrastructure
https://github.com/dracutdevs/dracut/wiki
GNU General Public License v2.0
606 stars 400 forks source link

dracut does not add all required libraries if `/etc/ld.so.preload` contains a missing library #2241

Open aafeijoo-suse opened 1 year ago

aafeijoo-suse commented 1 year ago

Describe the bug If /etc/ld.so.preload contains a missing library, dracut does not add all the required libraries to the initrd.

Distribution used openSUSE Tumbleweed

Dracut version dracut 059+suse.360.g2e0ed5f7-1.1

Init system systemd

To Reproduce

# echo "/usr/lib64/libfoo.so" > /etc/ld.so.preload
# dracut -f

Additional context This issue is similar to the one fixed by #2193:

# ldd /usr/lib64/libfido2.so.1.12.0 
ERROR: ld.so: object '/usr/lib64/libfoo.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib64/libfoo.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
    linux-vdso.so.1 (0x00007ffe9c1fc000)
    libcbor.so.0.10 => /lib64/libcbor.so.0.10 (0x00007faab19bd000)
    libcrypto.so.3 => /lib64/libcrypto.so.3 (0x00007faab1400000)
    libudev.so.1 => /lib64/libudev.so.1 (0x00007faab198f000)
    libhidapi-hidraw.so.0 => /lib64/libhidapi-hidraw.so.0 (0x00007faab1986000)
    libz.so.1 => /lib64/libz.so.1 (0x00007faab196c000)
    libc.so.6 => /lib64/libc.so.6 (0x00007faab1205000)
    /lib64/ld-linux-x86-64.so.2 (0x00007faab1a16000)
ERROR: ld.so: object '/usr/lib64/libfoo.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.

https://github.com/dracutdevs/dracut/blob/1ddcb137ea2a4d79491ff94f1f7802dcaa7ac381/src/install/dracut-install.c#L605-L606

If we replace that break with a continue, dracut-install continues parsing the ldd output and the missing libraries are included to the initrd.

This code was added in https://github.com/dracutdevs/dracut/commit/4916dfc2, is there any reason why dracut should not continue parsing the ldd output?

CC: @dtardon

LaszloGombos commented 1 year ago

I think we should review all break cases and consider continue one-by-one in that function.

dtardon commented 1 year ago

If we replace that break with a continue, dracut-install continues parsing the ldd output and the missing libraries are included to the initrd.

This code was added in 4916dfc2, is there any reason why dracut should not continue parsing the ldd output?

AFAIR there isn't any. I'm pretty sure I just copied the preceding check.

aafeijoo-suse commented 1 year ago

I think we should review all break cases and consider continue one-by-one in that function.

We haven't had a complaint for years and now we receive 2 similar bug reports (#2190 upstream and this one at SUSE) in a month, good timing :)

AFAIR there isn't any. I'm pretty sure I just copied the preceding check.

Ok, thanks for your feedback. I'll test it a little more before submitting a PR.

aafeijoo-suse commented 1 year ago

This is not a regression, it was reported for dracut-044, our oldest supported version.