summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Smith <dsmith@redhat.com>2009-12-07 15:17:58 -0600
committerDavid Smith <dsmith@redhat.com>2009-12-07 15:17:58 -0600
commitb2ea60606801aa9bf243f22318ac4bd8a25094fe (patch)
tree013ef6344464cb92802e651758f74ad7045d2ef0
parent9983df163a0b1743de5777f940b9d6a827142476 (diff)
downloadsystemtap-steved-b2ea60606801aa9bf243f22318ac4bd8a25094fe.tar.gz
systemtap-steved-b2ea60606801aa9bf243f22318ac4bd8a25094fe.tar.xz
systemtap-steved-b2ea60606801aa9bf243f22318ac4bd8a25094fe.zip
PR 10641 fixed by checking module name in unprivileged mode.
* main.cxx (checkOptions): If in unprivileged mode, make sure module name starts with 'stap_'. * testsuite/parseko/cmdline05.stp: New testcase. * testsuite/parseok/cmdline03.stp: New testcase.
-rw-r--r--main.cxx5
-rwxr-xr-xtestsuite/parseko/cmdline05.stp6
-rwxr-xr-xtestsuite/parseok/cmdline03.stp6
3 files changed, 17 insertions, 0 deletions
diff --git a/main.cxx b/main.cxx
index 71c70df8..69d7fa77 100644
--- a/main.cxx
+++ b/main.cxx
@@ -429,6 +429,11 @@ checkOptions (systemtap_session &s)
cerr << "You can't specify -g and --unprivileged together." << endl;
optionsConflict = true;
}
+ if (s.module_name.compare(0, 5, "stap_") != 0)
+ {
+ cerr << "In unprivileged mode, the module name must start with 'stap_'." << endl;
+ optionsConflict = true;
+ }
}
if (!s.kernel_symtab_path.empty())
diff --git a/testsuite/parseko/cmdline05.stp b/testsuite/parseko/cmdline05.stp
new file mode 100755
index 00000000..f8c437ea
--- /dev/null
+++ b/testsuite/parseko/cmdline05.stp
@@ -0,0 +1,6 @@
+#! /bin/sh
+
+# Make sure unprivileged ('--unprivileged') option isn't accepted when
+# a module name not starting with 'stap_' is used.
+
+stap --unprivileged -m 'nfs' -p1 -e 'probe begin { exit() }'
diff --git a/testsuite/parseok/cmdline03.stp b/testsuite/parseok/cmdline03.stp
new file mode 100755
index 00000000..d0ba5bbf
--- /dev/null
+++ b/testsuite/parseok/cmdline03.stp
@@ -0,0 +1,6 @@
+#! /bin/sh
+
+# Make sure unprivileged ('--unprivileged') option is accepted when a
+# module name starting with 'stap_' is used.
+
+stap --unprivileged -m 'stap_foo' -p1 -e 'probe begin { exit() }'