summaryrefslogtreecommitdiffstats
path: root/runtime/task_finder.c
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-09-03 19:52:44 -0400
committerDave Brolley <brolley@redhat.com>2009-09-03 19:52:44 -0400
commit8402bcf68e5321b3459cbbbd27d5111bb184922e (patch)
tree68bc58e872e3fc963ff2f4f77eb6ca10769304c5 /runtime/task_finder.c
parentd0822e28934cd0387c2af4349cf52c52c368c55a (diff)
downloadsystemtap-steved-8402bcf68e5321b3459cbbbd27d5111bb184922e.tar.gz
systemtap-steved-8402bcf68e5321b3459cbbbd27d5111bb184922e.tar.xz
systemtap-steved-8402bcf68e5321b3459cbbbd27d5111bb184922e.zip
Use task_euid when STAPCONF_TASK_UID is not defined.
Diffstat (limited to 'runtime/task_finder.c')
-rw-r--r--runtime/task_finder.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/runtime/task_finder.c b/runtime/task_finder.c
index fb6dc20d..1a9a738a 100644
--- a/runtime/task_finder.c
+++ b/runtime/task_finder.c
@@ -19,7 +19,9 @@ static void stap_stop_task_finder(void) { }
#include <linux/list.h>
#include <linux/binfmts.h>
#include <linux/mount.h>
-
+#ifndef STAPCONF_TASK_UID
+#include <linux/cred.h>
+#endif
#include "syscall.h"
#include "utrace_compatibility.h"
#include "task_finder_map.c"
@@ -730,7 +732,13 @@ __stp_utrace_attach_match_filename(struct task_struct *tsk,
size_t filelen;
struct list_head *tgt_node;
struct stap_task_finder_target *tgt;
+ uid_t tsk_euid;
+#ifdef STAPCONF_TASK_UID
+ tsk_euid = tsk->euid;
+#else
+ tsk_euid = task_euid(tsk);
+#endif
filelen = strlen(filename);
list_for_each(tgt_node, &__stp_task_finder_list) {
int rc;
@@ -755,7 +763,7 @@ __stp_utrace_attach_match_filename(struct task_struct *tsk,
#ifndef STP_PRIVILEGED
/* Make sure unprivileged users only probe their own threads. */
- if (_stp_uid != tsk->euid) {
+ if (_stp_uid != tsk_euid) {
if (tgt->pid != 0) {
_stp_warn("Process %d does not belong to unprivileged user %d",
tsk->pid, _stp_uid);
@@ -1347,6 +1355,7 @@ stap_start_task_finder(void)
int rc = 0;
struct task_struct *grp, *tsk;
char *mmpath_buf;
+ uid_t tsk_euid;
debug_task_finder_report();
mmpath_buf = _stp_kmalloc(PATH_MAX);
@@ -1407,6 +1416,11 @@ stap_start_task_finder(void)
}
/* Check the thread's exe's path/pid against our list. */
+#ifdef STAPCONF_TASK_UID
+ tsk_euid = tsk->euid;
+#else
+ tsk_euid = task_euid(tsk);
+#endif
mmpathlen = strlen(mmpath);
list_for_each(tgt_node, &__stp_task_finder_list) {
struct stap_task_finder_target *tgt;
@@ -1428,7 +1442,7 @@ stap_start_task_finder(void)
#ifndef STP_PRIVILEGED
/* Make sure unprivileged users only probe their own threads. */
- if (_stp_uid != tsk->euid) {
+ if (_stp_uid != tsk_euid) {
if (tgt->pid != 0) {
_stp_warn("Process %d does not belong to unprivileged user %d",
tsk->pid, _stp_uid);