summaryrefslogtreecommitdiffstats
path: root/tapset/context.stp
diff options
context:
space:
mode:
Diffstat (limited to 'tapset/context.stp')
-rw-r--r--tapset/context.stp79
1 files changed, 39 insertions, 40 deletions
diff --git a/tapset/context.stp b/tapset/context.stp
index 92c325ce..226e3ee5 100644
--- a/tapset/context.stp
+++ b/tapset/context.stp
@@ -7,8 +7,8 @@
// Public License (GPL); either version 2, or (at your option) any
// later version.
// <tapsetdescription>
-// Context functions provide additional information about where an event occurred. These functions can
-//provide information such as a backtrace to where the event occured and the current register values for the
+// Context functions provide additional information about where an event occurred. These functions can
+//provide information such as a backtrace to where the event occurred and the current register values for the
//processor.
// </tapsetdescription>
@@ -34,28 +34,28 @@ function print_regs () %{
/**
* sfunction execname - Returns the execname of a target process (or group of processes).
*/
-function execname:string () %{ /* pure */
+function execname:string () %{ /* pure */ /* unprivileged */
strlcpy (THIS->__retvalue, current->comm, MAXSTRINGLEN);
%}
/**
* sfunction pid - Returns the ID of a target process.
*/
-function pid:long () %{ /* pure */
+function pid:long () %{ /* pure */ /* unprivileged */
THIS->__retvalue = current->tgid;
%}
/**
* sfunction tid - Returns the thread ID of a target process.
*/
-function tid:long () %{ /* pure */
+function tid:long () %{ /* pure */ /* unprivileged */
THIS->__retvalue = current->pid;
%}
/**
* sfunction ppid - Returns the process ID of a target process's parent process.
*/
-function ppid:long () %{ /* pure */
+function ppid:long () %{ /* pure */ /* unprivileged */
#if defined(STAPCONF_REAL_PARENT)
THIS->__retvalue = current->real_parent->tgid;
#else
@@ -66,7 +66,7 @@ function ppid:long () %{ /* pure */
/**
* sfunction pgrp - Returns the process group ID of the current process.
*/
-function pgrp:long () %{ /* pure */
+function pgrp:long () %{ /* pure */ /* unprivileged */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
struct signal_struct *ss = kread( &(current->signal) );
THIS->__retvalue = kread ( &(ss->pgrp) );
@@ -78,11 +78,11 @@ function pgrp:long () %{ /* pure */
/**
* sfunction sid - Returns the session ID of the current process.
- *
+ *
* The session ID of a process is the process group ID of the session
* leader. Session ID is stored in the signal_struct since Kernel 2.6.0.
*/
-function sid:long () %{ /* pure */
+function sid:long () %{ /* pure */ /* unprivileged */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
struct signal_struct *ss = kread( &(current->signal) );
THIS->__retvalue = kread ( &(ss->session) );
@@ -95,7 +95,7 @@ function sid:long () %{ /* pure */
/**
* sfunction pexecname - Returns the execname of a target process's parent process.
*/
-function pexecname:string () %{ /* pure */
+function pexecname:string () %{ /* pure */ /* unprivileged */
#if defined(STAPCONF_REAL_PARENT)
strlcpy (THIS->__retvalue, current->real_parent->comm, MAXSTRINGLEN);
#else
@@ -106,61 +106,59 @@ function pexecname:string () %{ /* pure */
/**
* sfunction gid - Returns the group ID of a target process.
*/
-function gid:long () %{ /* pure */
+function gid:long () %{ /* pure */ /* unprivileged */
#ifdef STAPCONF_TASK_UID
- THIS->__retvalue = current->gid;
+ THIS->__retvalue = current->gid;
#else
- THIS->__retvalue = current_gid();
+ THIS->__retvalue = current_gid();
#endif
%}
/**
* sfunction egid - Returns the effective gid of a target process.
*/
-function egid:long () %{ /* pure */
+function egid:long () %{ /* pure */ /* unprivileged */
#ifdef STAPCONF_TASK_UID
- THIS->__retvalue = current->egid;
+ THIS->__retvalue = current->egid;
#else
- THIS->__retvalue = current_egid();
+ THIS->__retvalue = current_egid();
#endif
%}
/**
* sfunction uid - Returns the user ID of a target process.
*/
-function uid:long () %{ /* pure */
+function uid:long () %{ /* pure */ /* unprivileged */
#ifdef STAPCONF_TASK_UID
- THIS->__retvalue = current->uid;
+ THIS->__retvalue = current->uid;
#else
- THIS->__retvalue = current_uid();
+ THIS->__retvalue = current_uid();
#endif
%}
/**
* sfunction euid - Return the effective uid of a target process.
*/
-function euid:long () %{ /* pure */
+function euid:long () %{ /* pure */ /* unprivileged */
#ifdef STAPCONF_TASK_UID
- THIS->__retvalue = current->euid;
+ THIS->__retvalue = current->euid;
#else
- THIS->__retvalue = current_euid();
+ THIS->__retvalue = current_euid();
#endif
%}
+
/**
- * sfunction is_myproc - Determines if the current probe point has occurred in
- * the user's own process.
+ * sfunction is_myproc - Determines if the current probe point has occurred in the user's own process.
*
* Return 1 if the current probe point has occurred in the user's own process.
*/
function is_myproc:long () %{ /* pure */ /* unprivileged */
-#ifdef STAPCONF_TASK_UID
- THIS->__retvalue = (current->euid == _stp_uid);
-#else
- THIS->__retvalue = (task_euid(current) == _stp_uid);
-#endif
+ THIS->__retvalue = is_myproc();
%}
+
+
// cpuid() is not documented
function cpuid:long () %{ /* pure */
THIS->__retvalue = smp_processor_id();
@@ -169,7 +167,7 @@ function cpuid:long () %{ /* pure */
/**
* sfunction cpu - Returns the current cpu number.
*/
-function cpu:long () %{ /* pure */
+function cpu:long () %{ /* pure */ /* unprivileged */
THIS->__retvalue = smp_processor_id();
%}
@@ -177,9 +175,9 @@ function cpu:long () %{ /* pure */
* sfunction pp - Return the probe point associated with the currently running probe handler,
* including alias and wildcard expansion effects
* Context:
- * The current probe point.
+ * The current probe point.
*/
-function pp:string () %{ /* pure */
+function pp:string () %{ /* pure */ /* unprivileged */
strlcpy (THIS->__retvalue, CONTEXT->probe_point, MAXSTRINGLEN);
%}
@@ -191,7 +189,7 @@ function pp:string () %{ /* pure */
* For example, <command>registers_valid()</command> returns 0
* when called from a begin or end probe.
*/
-function registers_valid:long () %{ /* pure */
+function registers_valid:long () %{ /* pure */ /* unprivileged */
THIS->__retvalue = (CONTEXT->regs != NULL);
%}
@@ -200,7 +198,7 @@ function registers_valid:long () %{ /* pure */
*
* Return 1 if the probe point occurred in user-mode.
*/
-function user_mode:long () %{ /* pure */ /* currently a user-mode address? */
+function user_mode:long () %{ /* pure */ /* unprivileged */
if (CONTEXT->regs) {
#if defined(__i386__) || defined(__x86_64__)
THIS->__retvalue = (uint64_t) user_mode_vm (CONTEXT->regs);
@@ -221,14 +219,14 @@ function user_mode:long () %{ /* pure */ /* currently a user-mode address? */
function is_return:long () %{ /* pure */
if (CONTEXT->pi)
THIS->__retvalue = 1;
- else
- THIS->__retvalue = 0;
+ else
+ THIS->__retvalue = 0;
%}
/**
* sfunction target - Return the process ID of the target process.
*/
-function target:long () %{ /* pure */
+function target:long () %{ /* pure */ /* unprivileged */
THIS->__retvalue = _stp_target;
%}
@@ -239,7 +237,7 @@ function target:long () %{ /* pure */
/// <remark>FIXME: need description.</remark>
/// </para>
///</formalpara>
-function module_name:string () %{ /* pure */
+function module_name:string () %{ /* pure */ /* unprivileged */
strlcpy(THIS->__retvalue, THIS_MODULE->name, MAXSTRINGLEN);
%}
@@ -285,14 +283,15 @@ function stack_unused:long () %{ /* pure */
* sfunction uaddr - User space address of current running task. EXPERIMENTAL.
*
* Description: Returns the address in userspace that the current
- * task was at when the probe occured. When the current running task
+ * task was at when the probe occurred. When the current running task
* isn't a user space thread, or the address cannot be found, zero
* is returned. Can be used to see where the current task is combined
* with usymname() or symdata(). Often the task will be in the VDSO
* where it entered the kernel. FIXME - need VDSO tracking support #10080.
*/
-function uaddr:long () %{ /* pure */
+function uaddr:long () %{ /* pure */ /* unprivileged */
int64_t addr = 0;
+ assert_is_myproc();
if (current->mm)
{
struct pt_regs *uregs;