From c12faf0128515ab8ae1c754464764ee4c31a551b Mon Sep 17 00:00:00 2001 From: Peter Oberparleiter Date: Fri, 10 Oct 2025 11:32:52 +0200 Subject: [PATCH] zdev/dracut: Prevent loading of unused kernel modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Vineeth Vijayan Signed-off-by: Peter Oberparleiter Signed-off-by: Jan Höppner --- zdev/dracut/95zdev/retain-zdev.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zdev/dracut/95zdev/retain-zdev.sh b/zdev/dracut/95zdev/retain-zdev.sh index 8d13d00f..e8c6a161 100644 --- a/zdev/dracut/95zdev/retain-zdev.sh +++ b/zdev/dracut/95zdev/retain-zdev.sh @@ -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