File kdump-full-path-to-dracut.patch of Package kdump

From: Petr Tesarik <ptesarik@suse.com>
Subject: Use full path to dracut as argument to bash
References: bsc#989972, bsc#990200, CVE-2016-5759
Patch-mainline: v0.8.16
Git-commit: f4339dd3fd5cf8f7ec1fe2b48368deb2d9f4618a

If dracut is a file in the current directory, bash does not search PATH.
This may fail (e.g. if "dracut" is a directory) or even execute an
unintended executable.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
 init/mkdumprd |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/init/mkdumprd
+++ b/init/mkdumprd
@@ -23,6 +23,7 @@ KERNELVERSION=
 FORCE=0
 QUIET=0
 MKINITRD_EXTRA_PARAMS=
+DRACUT=/usr/bin/dracut
 
 #
 # Prints usage.                                                              {{{
@@ -143,7 +144,7 @@ function run_dracut()
 
     DRACUT_ARGS="$DRACUT_ARGS --add 'kdump' $INITRD $KERNELVERSION"
     echo "Regenerating kdump initrd ..." >&2
-    eval "bash -$- dracut $DRACUT_ARGS"
+    eval "bash -$- $DRACUT $DRACUT_ARGS"
 }                                                                          # }}}
 
 
@@ -229,7 +230,7 @@ if (( ! $FORCE )) ; then
     fi
 fi
 
-if type dracut >/dev/null 2>&1 ; then
+if [ -e $DRACUT ] ; then
     run_dracut
     ret=$?
 else
openSUSE Build Service is sponsored by