summaryrefslogtreecommitdiffstats
path: root/tapset/string.stp
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2009-09-16 22:32:28 -0400
committerFrank Ch. Eigler <fche@elastic.org>2009-09-16 22:37:24 -0400
commit6ecd877049008c5abe9c6720ea8fc64732f47eb5 (patch)
tree407a536c1271b8e5757899e461c481e599266d67 /tapset/string.stp
parent6846cfc8a5cdb24fccb19037b27a180d2300ee09 (diff)
downloadsystemtap-steved-6ecd877049008c5abe9c6720ea8fc64732f47eb5.tar.gz
systemtap-steved-6ecd877049008c5abe9c6720ea8fc64732f47eb5.tar.xz
systemtap-steved-6ecd877049008c5abe9c6720ea8fc64732f47eb5.zip
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 <brolley@redhat.com> * 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().
Diffstat (limited to 'tapset/string.stp')
-rw-r--r--tapset/string.stp20
1 files changed, 10 insertions, 10 deletions
diff --git a/tapset/string.stp b/tapset/string.stp
index 4b0a2a0d..92750b6b 100644
--- a/tapset/string.stp
+++ b/tapset/string.stp
@@ -8,7 +8,7 @@
* @param s string
* @return Returns the length of the string.
*/
-function strlen:long(s:string) %{ /* pure */
+function strlen:long(s:string) %{ /* pure */ /* unprivileged */
THIS->__retvalue = strlen(THIS->s);
%}
@@ -19,7 +19,7 @@ function strlen:long(s:string) %{ /* pure */
* @param length Length of string to return.
* @return Returns the substring.
*/
-function substr:string(str:string,start:long, length:long) %{ /* pure */
+function substr:string(str:string,start:long, length:long) %{ /* pure */ /* unprivileged */
int length = THIS->length >= MAXSTRINGLEN ? MAXSTRINGLEN : THIS->length + 1;
if (THIS->start >= 0 && length > 0 && THIS->start < strlen(THIS->str))
strlcpy(THIS->__retvalue, THIS->str + THIS->start, length);
@@ -31,7 +31,7 @@ function substr:string(str:string,start:long, length:long) %{ /* pure */
* @param pos the given position. 0 = start of the string
* @return Returns the char in given position of string.
*/
-function stringat:long(str:string, pos:long) %{ /* pure */
+function stringat:long(str:string, pos:long) %{ /* pure */ /* unprivileged */
if (THIS->pos >= 0 && THIS->pos < strlen(THIS->str))
THIS->__retvalue = THIS->str[THIS->pos];
else
@@ -44,7 +44,7 @@ function stringat:long(str:string, pos:long) %{ /* pure */
* @param s2 string
* @return Returns 1 if s2 is in s1. Otherwise 0.
*/
-function isinstr:long(s1:string,s2:string) %{ /* pure */
+function isinstr:long(s1:string,s2:string) %{ /* pure */ /* unprivileged */
if (strstr(THIS->s1,THIS->s2) != NULL)
THIS->__retvalue = 1;
else
@@ -58,13 +58,13 @@ function isinstr:long(s1:string,s2:string) %{ /* pure */
* replaced by the corresponding escape sequence in the returned
* string.
*/
-function text_str:string(input:string)
-%{ /* pure */
+function text_str:string(input:string)
+%{ /* pure */ /* unprivileged */
_stp_text_str(THIS->__retvalue, THIS->input, 0, 0, 0);
%}
function text_strn:string(input:string, len:long, quoted:long)
-%{ /* pure */
+%{ /* pure */ /* unprivileged */
_stp_text_str(THIS->__retvalue, THIS->input, THIS->len, THIS->quoted, 0);
%}
@@ -77,7 +77,7 @@ function text_strn:string(input:string, len:long, quoted:long)
* delim Token delimiter. Set of characters that delimit the tokens.
*/
function tokenize:string(input:string, delim:string)
-%{ /* pure */
+%{ /* unprivileged */
static char str[MAXSTRINGLEN];
static char *str_start;
static char *str_end;
@@ -106,7 +106,7 @@ function tokenize:string(input:string, delim:string)
* @return Returns the parent string with substrings replaced. Else returns parent string.
*/
function str_replace:string (prnt_str:string, srch_str:string, rplc_str:string)
-%{
+%{ /* pure */ /* unprivileged */
char *ptr = THIS->prnt_str;
char *ptr_base = THIS->prnt_str;
int strlen_srch_str = strlen(THIS->srch_str);
@@ -135,7 +135,7 @@ function str_replace:string (prnt_str:string, srch_str:string, rplc_str:string)
* base The base to use
*/
function strtol:long(str:string, base:long)
-%{ /* pure */
+%{ /* pure */ /* unprivileged */
THIS->__retvalue = simple_strtol(THIS->str, NULL, THIS->base);
%}