diff options
author | Dave Brolley <brolley@redhat.com> | 2009-09-17 20:36:24 -0400 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2009-09-17 20:36:24 -0400 |
commit | 762684a57fa5420cc122b475f592545e8eeb29cd (patch) | |
tree | c1b55657f1aff31e7298d76852bbe8522a84db13 /runtime/runtime.h | |
parent | 8afee8bbf045e858dae186d40653293c99dbbcdd (diff) | |
parent | 6bde4f381475cea055352d8ad5f60bb2f24de21d (diff) | |
download | systemtap-steved-762684a57fa5420cc122b475f592545e8eeb29cd.tar.gz systemtap-steved-762684a57fa5420cc122b475f592545e8eeb29cd.tar.xz systemtap-steved-762684a57fa5420cc122b475f592545e8eeb29cd.zip |
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
Diffstat (limited to 'runtime/runtime.h')
-rw-r--r-- | runtime/runtime.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/runtime/runtime.h b/runtime/runtime.h index 064ded7b..7087d435 100644 --- a/runtime/runtime.h +++ b/runtime/runtime.h @@ -54,6 +54,32 @@ static void _stp_warn (const char *fmt, ...) __attribute__ ((format (printf, 1, static void _stp_exit(void); + + +/* unprivileged user support */ + +#ifdef STAPCONF_TASK_UID +#define STP_CURRENT_EUID (current->euid) +#else +#define STP_CURRENT_EUID (task_euid(current)) +#endif + +#define is_myproc() (STP_CURRENT_EUID == _stp_uid) + +#ifndef STP_PRIVILEGED +#define assert_is_myproc() do { \ + if (! is_myproc()) { \ + snprintf (CONTEXT->error_buffer, MAXSTRINGLEN, "semi-privileged tapset function called without is_myproc checking for pid %d (euid %d)", \ + current->tgid, STP_CURRENT_EUID); \ + CONTEXT->last_error = CONTEXT->error_buffer; \ + goto out; \ + } } while (0) +#else +#define assert_is_myproc() do {} while (0) +#endif + + + #include "debug.h" /* atomic globals */ @@ -106,6 +132,8 @@ static struct #endif #include "addr-map.c" + + /* Support functions for int64_t module parameters. */ static int param_set_int64_t(const char *val, struct kernel_param *kp) { |