diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2009-01-06 19:32:24 -0500 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2009-01-06 19:32:24 -0500 |
commit | 406d830652cc659fe420dcf5b54398ea22310750 (patch) | |
tree | a390485d59c124025ccae2895f247dc0ece8babd /tapset/task.stp | |
parent | ec77429d7f3b6e5bc6bb8a93beb8dac6c6dd99b1 (diff) | |
download | systemtap-steved-406d830652cc659fe420dcf5b54398ea22310750.tar.gz systemtap-steved-406d830652cc659fe420dcf5b54398ea22310750.tar.xz systemtap-steved-406d830652cc659fe420dcf5b54398ea22310750.zip |
PR9699: tapset changes for STAPCONF_TASK_UID for *uid()/*gid() calls
Diffstat (limited to 'tapset/task.stp')
-rw-r--r-- | tapset/task.stp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tapset/task.stp b/tapset/task.stp index 9215e83f..684cef93 100644 --- a/tapset/task.stp +++ b/tapset/task.stp @@ -12,6 +12,9 @@ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25) #include <linux/fdtable.h> #endif +#ifndef STAPCONF_TASK_UID +#include <linux/cred.h> +#endif %} // Return the task_struct representing the current process @@ -74,7 +77,18 @@ function task_tid:long (task:long) %{ /* pure */ // Return the group id of the given task function task_gid:long (task:long) %{ /* pure */ struct task_struct *t = (struct task_struct *)(long)THIS->task; +#ifdef STAPCONF_TASK_UID THIS->__retvalue = kread(&(t->gid)); +#else + /* XXX: We can't easily kread this rcu-protected field. */ + /* XXX: no task_gid() in 2.6.28 */ + struct cred *cred; + rcu_read_lock(); + cred = get_task_cred (t); + rcu_read_unlock(); + THIS->__retvalue = cred->gid; +#endif + CATCH_DEREF_FAULT(); %} @@ -82,7 +96,17 @@ function task_gid:long (task:long) %{ /* pure */ // Return the effective group id of the given task function task_egid:long (task:long) %{ /* pure */ struct task_struct *t = (struct task_struct *)(long)THIS->task; +#ifdef STAPCONF_TASK_UID THIS->__retvalue = kread(&(t->egid)); +#else + /* XXX: We can't easily kread this rcu-protected field. */ + /* XXX: no task_egid() in 2.6.28 */ + struct cred *cred; + rcu_read_lock(); + cred = get_task_cred (t); + rcu_read_unlock(); + THIS->__retvalue = cred->egid; +#endif CATCH_DEREF_FAULT(); %} @@ -90,7 +114,13 @@ function task_egid:long (task:long) %{ /* pure */ // Return the user id of the given task function task_uid:long (task:long) %{ /* pure */ struct task_struct *t = (struct task_struct *)(long)THIS->task; +#ifdef STAPCONF_TASK_UID THIS->__retvalue = kread(&(t->uid)); +#else + /* XXX: We can't easily kread this rcu-protected field. */ + THIS->__retvalue = task_uid (t); +#endif + CATCH_DEREF_FAULT(); %} @@ -98,7 +128,12 @@ function task_uid:long (task:long) %{ /* pure */ // Return the effective user id of the given task function task_euid:long (task:long) %{ /* pure */ struct task_struct *t = (struct task_struct *)(long)THIS->task; +#ifdef STAPCONF_TASK_UID THIS->__retvalue = kread(&(t->euid)); +#else + /* XXX: We can't easily kread this rcu-protected field. */ + THIS->__retvalue = task_euid (t); +#endif CATCH_DEREF_FAULT(); %} |