This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
run-stap vs -c
- From: Roland McGrath <roland at redhat dot com>
- To: systemtap at sources dot redhat dot com
- Date: Wed, 1 Apr 2009 14:38:12 -0700 (PDT)
- Subject: run-stap vs -c
I tried this hack:
diff --git a/run-stap.in b/run-stap.in
index dfb53ab..0000000 100644
--- a/run-stap.in
+++ b/run-stap.in
@@ -19,9 +19,11 @@ 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_STAPIO="${srcdir}/run-stapio.sh"
SYSTEMTAP_STAPRUN="sudo 'SYSTEMTAP_STAPIO=$SYSTEMTAP_STAPIO' \
'SYSTEMTAP_STAPRUN=${builddir}/staprun' \
+ 'STAP_REAL_STAPIO=${builddir}/stapio' \
+ 'STAP_REAL_USER=`whoami`' \
${builddir}/staprun"
export SYSTEMTAP_TAPSET SYSTEMTAP_RUNTIME SYSTEMTAP_STAPRUN SYSTEMTAP_STAPIO
diff --git a/run-stapio.sh b/run-stapio.sh
new file mode 100755
index ...3a08203 100755
--- /dev/null
+++ b/run-stapio.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -x
+
+# XXX arg quoting
+exec /sbin/runuser -m -c "$STAP_REAL_STAPIO $*" ${STAP_REAL_USER}
But I lose like this:
$ ./run-stap -e 'probe begin { printf("hello world\n") }' -c id
+ exec /sbin/runuser -m -c '/home/roland/build/systemtap/stapio -c id /tmp/stap2EnM0v/stap_a05c4a56c320f1c36b5d8495d10ed9db_635.ko' roland
ERROR: Couldn't open control channel '/sys/kernel/debug/systemtap/stap_a05c4a56c320f1c36b5d8495d10ed9db_635/.cmd': Permission denied
Failed to initialize control channel.
Pass 5: run failed. Try again with another '--vp 00001' option.
[Exit 1]
$
That left me trying to figure out how it is that stapio is normally allowed
to do this open.
Thanks,
Roland