Upstream have not yet taken action but tagging the issue/pr for broader
notice. SRU in order not to block oem projects.

** Description changed:

+ [SRU Justificaiton]
+ 
+ [ Impact ]
+ 
+ Linux kernel modules may declare firmware blobs to be installed along
+ with the module itself to ensure driver functions, and the paths may
+ contains wildcards to be expanded by other tools.
+ 
+ ```
+ $ find /lib/modules/$(uname -r) -name \*.ko.zst -exec bash -c "m=\$(basename 
"{}"); m=\${m%%.*}; modinfo \$m|grep '^firmware:.*\*'" \;
+ firmware: brcm/brcmbt4388*.ptb
+ firmware: brcm/brcmbt4388*.bin
+ firmware: brcm/brcmbt4387*.ptb
+ firmware: brcm/brcmbt4387*.bin
+ firmware: brcm/brcmbt4378*.ptb
+ firmware: brcm/brcmbt4378*.bin
+ firmware: brcm/brcmbt4377*.ptb
+ firmware: brcm/brcmbt4377*.bin
+ firmware: intel/ish/ish_*.bin
+ firmware: ath11k/WCN6855/hw2.1/*
+ firmware: ath11k/WCN6855/hw2.0/*
+ firmware: ath11k/QCN9074/hw1.0/*
+ firmware: ath11k/QCA6390/hw2.0/*
+ firmware: brcm/brcmfmac*-sdio.*.bin
+ firmware: brcm/brcmfmac*-sdio.*.txt
+ firmware: brcm/brcmfmac*-pcie.*.txcap_blob
+ firmware: brcm/brcmfmac*-pcie.*.clm_blob
+ firmware: brcm/brcmfmac*-pcie.*.bin
+ firmware: brcm/brcmfmac*-pcie.*.txt
+ firmware: brcm/brcmfmac*-pcie.txt
+ ```
+ 
+ dracut is the tool that helps building initramfs at this moment, and
+ it's implementation for resolving compressed firmware blobs (and
+ therefore a different filename suffix) doesn't really handle it
+ (wildcard in the middle) correctly. This causes wildcard firmwares, even
+ needed by the system, may not be packed into initramfs as expected.
+ 
+ Usually this is not a big deal, and we have been switching to xz/zst for
+ a while. However, in Intel ISH driver, it declares:
+ 
+ ```
+ firmware:       intel/ish/ish_*.bin
+ firmware:       intel/ish/ish_lnlm.bin
+ ```
+ 
+ It tries to resolve the best match of a vendor/model specific
+ configuration by DMI info, and since the ones matched with that wildcard
+ filename will never be installed into initramfs, leaving only the
+ generic blob available and always available at driver loading, it will
+ use the generic firmware unconditionally and break sensor functions for
+ a few platforms.
+ 
+ The fix tries to rewrite the resolution in dracut a bit, so that it will
+ match and copy compressed blobs as well.
+ 
+ [ Test Plan ]
+ 
+ 1. touch `/lib/firmware/intel/ish/ish_foo.bin.zst`
+ 2. `update-initramefs -v -u -k $(uname -r)`, and check if above file was 
added.
+ 
+ [ Where problems could occur ]
+ 
+  * This fix will then add brcm, ish firmware blobs into initramfs if
+ necessary for the running platform as they should have been. Would
+ slightly increase initramfs size if affected.
+ 
+ [ Other Info ]
+ 
+ * First found for dracut >= 060, used by Ubuntu Noble, and extent to
+ Jammy/Oracular/Plucky as well.
+ 
+ * Upstream bug and pull request in review: https://github.com/dracut-
+ ng/dracut-ng/issues/1150
+ 
+ ========== original bug report ==========
+ 
  [Describe the bug]
  
  Take kernel module intel-ish-ipc for example, it has two firmware
  declarations:
  
  ```
  $ modinfo intel-ish-ipc | grep ^firmware
  firmware: intel/ish/ish_*.bin
  firmware: intel/ish/ish_lnlm.bin
  ```
  
  And with additional custom ISH firmware installed from [bug
  2094768](https://bugs.launchpad.net/bugs/2094768), update-initramefs
  gives:
  
  ```
  $ update-initramefs -v -u -k $(uname -r)
  ...
  dracut-install: Missing firmware intel/ish/ish_*.bin for kernel module 
intel_ish_ipc
  dracut-install: mkdir '/var/tmp/mkinitramfs_9uk7FI/lib/firmware/intel/ish'
  dracut-install: cp 
'/lib/firmware/intel/ish/ish_lnlm_39ceeaf8_58.7724.2.bin.zst' 
'/var/tmp/mkinitramfs_9uk7FI/lib/firmware/intel/ish/ish_lnlm_39ceeaf8_58.7724.2.bin.zst'
  dracut-install: ln -s 'ish_lnlm_39ceeaf8_58.7724.2.bin.zst' 
'/var/tmp/mkinitramfs_9uk7FI/lib/firmware/intel/ish/ish_lnlm.bin.zst'
  ...
  ```
  
  In source code for `/usr/lib/dracut/dracut-install`, that is, source
  package dracut, file `src/install/dracut-install.c`, function
  `install_firmware`, it tries to invoke `glob()` with full path expanded
  from "intel/ish/ish_*.bin", but while all the binaries were compressed,
  this matches no file and none of the custom ISH firmware blobs will be
  installed.
  
  [Distribution used]
  
  Ubuntu
  
  [Dracut version]
  
  This was first found in Ubuntu/Noble, which has 060, but from the git
  history and the differences, this should be reproducible with all
  versions of dracut.
  
  [Init system]
  
  Systemd.
  
  [To Reproduce]
  
  1. touch `/lib/firmware/intel/ish/ish_foo.bin.zst`
  2. `update-initramefs -v -u -k $(uname -r)`, and check if above file was 
added.
  
  [Expected behavior]
  
  Any file under `/lib/firmware/intel/ish` matches `intel/ish/ish_*.bin`,
  compressed (.zst, .xz) or uncompressed (.bin), should be added into the
  newly created initramefs.
  
  [Additional context]
  
  Upstream bug: https://github.com/dracut-ng/dracut-ng/issues/1150

** Changed in: dracut (Ubuntu Jammy)
       Status: In Progress => Triaged

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2095518

Title:
  dracut-install does not install compressed wildcard blobs

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dracut/+bug/2095518/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to