summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure46
-rw-r--r--configure.ac3
-rw-r--r--run-stap.in6
-rw-r--r--run-stapio.in10
-rwxr-xr-xrun-staprun.sh6
5 files changed, 67 insertions, 4 deletions
diff --git a/configure b/configure
index a63b6557..58406bee 100755
--- a/configure
+++ b/configure
@@ -667,6 +667,7 @@ sqlite3_LIBS
PIECXXFLAGS
PIECFLAGS
PIELDFLAGS
+PERL
RANLIB
ANSI2KNR
U
@@ -5971,6 +5972,47 @@ fi
+# Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PERL+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ case $PERL in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PERL=$ac_cv_path_PERL
+if test -n "$PERL"; then
+ { $as_echo "$as_me:$LINENO: result: $PERL" >&5
+$as_echo "$PERL" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
# Check whether --enable-perfmon was given.
if test "${enable_perfmon+set}" = set; then
enableval=$enable_perfmon;
@@ -8082,6 +8124,8 @@ subdirs="$subdirs testsuite"
ac_config_files="$ac_config_files run-stap"
+ac_config_files="$ac_config_files run-stapio"
+
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@@ -8783,6 +8827,7 @@ do
"man/stapprobes.udp.3stap") CONFIG_FILES="$CONFIG_FILES man/stapprobes.udp.3stap" ;;
"initscript/systemtap") CONFIG_FILES="$CONFIG_FILES initscript/systemtap" ;;
"run-stap") CONFIG_FILES="$CONFIG_FILES run-stap" ;;
+ "run-stapio") CONFIG_FILES="$CONFIG_FILES run-stapio" ;;
*) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
@@ -9562,6 +9607,7 @@ $as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
done
;;
"run-stap":F) chmod +x run-stap ;;
+ "run-stapio":F) chmod +x run-stapio ;;
esac
done # for ac_tag
diff --git a/configure.ac b/configure.ac
index eab206a2..5e15539e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,6 +25,8 @@ AC_PROG_MAKE_SET
AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS)
+AC_PATH_PROG(PERL, perl)
+
dnl Handle the perfmon option.
AC_ARG_ENABLE([perfmon],
AS_HELP_STRING([--enable-perfmon@<:@=DIRECTORY@:>@],
@@ -359,6 +361,7 @@ AC_CONFIG_HEADERS([config.h:config.in])
AC_CONFIG_FILES(Makefile doc/Makefile doc/SystemTap_Tapset_Reference/Makefile stap.1 stapprobes.3stap stapfuncs.3stap stapvars.3stap stapex.3stap staprun.8 stap-server.8 man/stapprobes.iosched.3stap man/stapprobes.netdev.3stap man/stapprobes.nfs.3stap man/stapprobes.nfsd.3stap man/stapprobes.pagefault.3stap man/stapprobes.process.3stap man/stapprobes.rpc.3stap man/stapprobes.scsi.3stap man/stapprobes.signal.3stap man/stapprobes.socket.3stap man/stapprobes.tcp.3stap man/stapprobes.udp.3stap initscript/systemtap)
AC_CONFIG_SUBDIRS(testsuite)
AC_CONFIG_FILES([run-stap], [chmod +x run-stap])
+AC_CONFIG_FILES([run-stapio], [chmod +x run-stapio])
AC_OUTPUT
if test "${prefix}" = "/usr/local"; then
diff --git a/run-stap.in b/run-stap.in
index dfb53ab2..f8ee9287 100644
--- a/run-stap.in
+++ b/run-stap.in
@@ -19,10 +19,8 @@ esac
# Set all the variables to find the source and build trees.
SYSTEMTAP_TAPSET="${srcdir}/tapset"
SYSTEMTAP_RUNTIME="${srcdir}/runtime"
-SYSTEMTAP_STAPIO="${builddir}/stapio"
-SYSTEMTAP_STAPRUN="sudo 'SYSTEMTAP_STAPIO=$SYSTEMTAP_STAPIO' \
- 'SYSTEMTAP_STAPRUN=${builddir}/staprun' \
- ${builddir}/staprun"
+SYSTEMTAP_STAPRUN="builddir='$builddir' ${srcdir}/run-staprun.sh"
+SYSTEMTAP_STAPIO="${srcdir}/run-stapio"
export SYSTEMTAP_TAPSET SYSTEMTAP_RUNTIME SYSTEMTAP_STAPRUN SYSTEMTAP_STAPIO
# If there were private elfutils libs built, use them.
diff --git a/run-stapio.in b/run-stapio.in
new file mode 100644
index 00000000..554c2d33
--- /dev/null
+++ b/run-stapio.in
@@ -0,0 +1,10 @@
+#!@PERL@ -w
+
+# Reset real IDs to those we had before running sudo in run-staprun.sh.
+# This gives stapio the IDs it expects from a setuid exec.
+$< = $ENV{'SUDO_UID'};
+$( = $ENV{'SUDO_GID'};
+
+exec { "$ENV{'builddir'}/stapio" } ('stapio', @ARGV);
+
+exit;
diff --git a/run-staprun.sh b/run-staprun.sh
new file mode 100755
index 00000000..688dfa78
--- /dev/null
+++ b/run-staprun.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+exec sudo env builddir="${builddir}" \
+ SYSTEMTAP_STAPIO="${builddir}/run-stapio" \
+ SYSTEMTAP_STAPRUN="$0" \
+ "${builddir}/staprun" ${1+"$@"}