From 6ecd877049008c5abe9c6720ea8fc64732f47eb5 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Wed, 16 Sep 2009 22:32:28 -0400 Subject: PR10650: markup some unprivileged-safe tapset functions Add /* unprivileged */ to a variety of tapset embedded-c functions, together with uid-assertion-checking code as needed. This is only an initial set, and may need to grow or shrink after further testing. Prototyped-By: Dave Brolley * runtime/runtime.h (is_myproc, assert_is_myproc): New macros. * runtime/addr-map.c (lookup_bad_addr): Reject if !is_myproc in unprivileged mode. * runtime/print.c (_stp_print_kernel_info): Add unprivileged mode info. * tapset/DEVGUIDE: Document /* pure */ and /* unprivileged */. * tapset/*.stp: Add /* unprivileged */ here and there, in questionable cases along with an assert_is_myproc(). --- tapset/ucontext-unwind.stp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tapset/ucontext-unwind.stp') diff --git a/tapset/ucontext-unwind.stp b/tapset/ucontext-unwind.stp index df275d4b..e1a8ade3 100644 --- a/tapset/ucontext-unwind.stp +++ b/tapset/ucontext-unwind.stp @@ -24,7 +24,8 @@ * Equivalent to print_ustack(ubacktrace()), * except that deeper stack nesting may be supported. Return nothing. */ -function print_ubacktrace () %{ +function print_ubacktrace () %{ /* unprivileged */ + assert_is_myproc(); if (CONTEXT->regs) { _stp_stack_print(CONTEXT->regs, 1, CONTEXT->pi, MAXTRACE, current); @@ -41,7 +42,8 @@ function print_ubacktrace () %{ * string length. Returns empty string when current probe point cannot * determine user backtrace. */ -function ubacktrace:string () %{ /* pure */ +function ubacktrace:string () %{ /* pure */ /* unprivileged */ + assert_is_myproc(); if (CONTEXT->regs) _stp_stack_snprint (THIS->__retvalue, MAXSTRINGLEN, CONTEXT->regs, 0, CONTEXT->pi, MAXTRACE, -- cgit