49e6a8
From fc87cf0e7e9790fb7c02ee54a73dd474ffa6fa38 Mon Sep 17 00:00:00 2001
49e6a8
From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@redhat.com>
49e6a8
Date: Thu, 7 Jun 2018 15:42:12 +0200
49e6a8
Subject: [PATCH] Harden dracut against BASH_ENV environment variable
49e6a8
MIME-Version: 1.0
49e6a8
Content-Type: text/plain; charset=UTF-8
49e6a8
Content-Transfer-Encoding: 8bit
49e6a8
49e6a8
When dracut silently produces a broken initramfs, then the system will
49e6a8
likely not boot and this can be very problematic. Typical use case is
49e6a8
after the kernel has been updated.
49e6a8
49e6a8
It appears that dracut is not protected against the BASH_ENV variable,
49e6a8
causing various scripts called by dracut to possibly fail or provide
49e6a8
wrong output (e.g. "ldd" is one of these).
49e6a8
Having a broken output for "ldd" makes the generated initramfs be not
49e6a8
usable, typically because vital binaries will be missing (e.g.
49e6a8
"awk", "udevadm", ...).
49e6a8
49e6a8
Note: because the shebang line cannot contain more than one argument,
49e6a8
the '--norc' option had to be removed. IMHO, it was useless anyway.
49e6a8
49e6a8
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
49e6a8
49e6a8
Cherry-picked from: c1c78f8a91921fe87f5672cdbdf9791f569fc8ac
49e6a8
Resolves: #1588483
49e6a8
---
49e6a8
 dracut.sh | 2 ++
49e6a8
 1 file changed, 2 insertions(+)
49e6a8
49e6a8
diff --git a/dracut.sh b/dracut.sh
49e6a8
index 52835872..27489528 100755
49e6a8
--- a/dracut.sh
49e6a8
+++ b/dracut.sh
49e6a8
@@ -23,6 +23,8 @@
49e6a8
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
49e6a8
 #
49e6a8
 
49e6a8
+unset BASH_ENV
49e6a8
+
49e6a8
 # store for logging
49e6a8
 dracut_args=( "$@" )
49e6a8