zdev/dracut: Prevent loading of unused kernel modules

zdev provides dracut logic for configuring devices early during boot via
kernel command line parameters rd.dasd and rd.zfcp. A copy of resulting
configuration directives is made available to the booted Linux using
chzdev's export function.

The use of command line option --all in this export step results in
chzdev loading all kernel modules required by supported types, even if
no device of that type exists on the booted system, or if no zdev kernel
parameter was specified.

Loading unused kernel modules during boot increases memory usage,
prolongs boot time, and expands the kernel's attack surface
unnecessarily.

Fix this by replacing command line option --all with --configured to
instruct chzdev to export only data for devices with a persistent
configuration, while not loading any kernel modules.

Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Reviewed-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Peter Oberparleiter
2025-10-10 11:32:52 +02:00
committed by Jan Höppner
parent a3d50487ed
commit c12faf0128

View File

@@ -9,7 +9,7 @@
# Copy zdev persistent config from initrd to root-fs.
#
chzdev --export /run/zdev.initrd.config --all --type --persistent --quiet
chzdev --export /run/zdev.initrd.config --configured --type --persistent --quiet
# Apart from debugging purposes, this is useful for distro installers,
# which can import the early config into their own environment early