Blob Blame History Raw
From 65dc00af707a48948d08dd4fec97ecb22459dd0c Mon Sep 17 00:00:00 2001
From: Jonathan Lebon <jlebon@redhat.com>
Date: Wed, 26 Mar 2014 13:56:20 -0400
Subject: [PATCH] initscript: skip dracut stap module by default

We previously always enabled the dracut stap module as long as there
were scripts to include. This can lead to issues since the params.conf
file may be obsolete/not in sync e.g. during a kernel update. We now
make the module an opt-in feature, and make the initscript explicit
specify its inclusion.
---
 initscript/99stap/module-setup.sh.in | 10 +++++++---
 initscript/systemtap.in              |  6 ++----
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/initscript/99stap/module-setup.sh.in b/initscript/99stap/module-setup.sh.in
index 4f4583d..7b2b401 100644
--- a/initscript/99stap/module-setup.sh.in
+++ b/initscript/99stap/module-setup.sh.in
@@ -5,10 +5,14 @@
 
 # Return 0 --> install stap module
 # Return 1 --> skip stap module
+# Return 255 --> install stap module only if explicitly requested
 check() {
-   # Install it if we have early-boot scripts
-   [ "$ONBOOT_SCRIPTS" ] && return 0
-   return 1
+   # Do not include stap module if there are no scripts to include
+   [ "$ONBOOT_SCRIPTS" ] || return 1
+   # We're disabled by default: the initscript explicitly uses dracut's
+   # '--add stap' when creating the initramfs. Otherwise, we might be
+   # mistakenly included during e.g. kernel updates.
+   return 255
 }
 
 # We don't depend on anything
diff --git a/initscript/systemtap.in b/initscript/systemtap.in
index 075226e..ab882e9 100755
--- a/initscript/systemtap.in
+++ b/initscript/systemtap.in
@@ -859,10 +859,8 @@ onboot () {
     do_failure "Failed to make temporary file in $dir"
     return 1
   fi
-  # Create the initramfs image. We could have combined this with the
-  # new-kernel-pkg call below using --dracut, but then we would have
-  # lost error-checking and our backing up facilities.
-  out=$($DRACUT --force $TMPINITRAMFS $KRELEASE 2>&1)
+  # Create the initramfs image with stap module enabled.
+  out=$($DRACUT --add stap --force $TMPINITRAMFS $KRELEASE 2>&1)
   # dracut will report success even if some modules (e.g. stap) failed
   # to install some files, so we need to be a bit more involved in
   # checking for errors
-- 
1.8.3.1