summaryrefslogtreecommitdiffstats
path: root/tapset/task.stp
diff options
context:
space:
mode:
authorjistone <jistone>2007-02-07 02:54:30 +0000
committerjistone <jistone>2007-02-07 02:54:30 +0000
commitb8772cce090adb3d27cdd8b49d236662b526424e (patch)
treef216b71b2bea50d0bd95c9d22956a07e0b6fa49c /tapset/task.stp
parent3b4136ca14c78881c50e8c36fa35fa574edaabb4 (diff)
downloadsystemtap-steved-b8772cce090adb3d27cdd8b49d236662b526424e.tar.gz
systemtap-steved-b8772cce090adb3d27cdd8b49d236662b526424e.tar.xz
systemtap-steved-b8772cce090adb3d27cdd8b49d236662b526424e.zip
2007-02-06 Josh Stone <joshua.i.stone@intel.com>
* aux_syscalls.stp, inet_sock.stp, ioblock.stp, ioscheduler.stp, nfs.stp, nfs_proc.stp, nfsd.stp, rpc.stp, scsi.stp, signal.stp, socket.stp, task.stp, tcp.stp, vfs.stp: Protect pointer dereferences with kread wherever possible. Some places still have hazards, as marked with FIXMEs. * errno.stp (returnstr): Don't use return in tapset C functions. * aux_syscalls.stp (__uget_timex_m): Ditto. * nfsd.stp (__get_fh): Ditto. * nfs.stp, vfs.stp (<many functions>): Ditto. * string.stp (substr): Ditto. Also make sure start index is valid. * syscalls.stp (syscall.execve): Change __string to kernel_string. LKET/ * nfs.stp, nfs_proc.stp, nfsd.stp, process.stp, tskdispatch.stp: Protect pointer dereferences with kread wherever possible. Some places still have hazards, as marked with FIXMEs. * aio.stp (log_io_getevents): Don't use return in tapset C functions. * timestamp.stp (set_timing_method): Ditto. * utils.stp (filter_by_pid): Ditto.
Diffstat (limited to 'tapset/task.stp')
-rw-r--r--tapset/task.stp87
1 files changed, 24 insertions, 63 deletions
diff --git a/tapset/task.stp b/tapset/task.stp
index cbf61f3a..2f183838 100644
--- a/tapset/task.stp
+++ b/tapset/task.stp
@@ -16,11 +16,8 @@ function task_current:long () %{ /* pure */
// Return the parent task_struct of the given task
function task_parent:long (task:long) %{ /* pure */
struct task_struct *t = (struct task_struct *)(long)THIS->task;
- THIS->__retvalue = deref(sizeof(t->parent), &(t->parent));
- if (0) {
-deref_fault:
- CONTEXT->last_error = "pointer dereference fault";
- }
+ THIS->__retvalue = (long)kread(&(t->parent));
+ CATCH_DEREF_FAULT();
%}
@@ -34,11 +31,8 @@ deref_fault:
// EXIT_DEAD 32
function task_state:long (task:long) %{ /* pure */
struct task_struct *t = (struct task_struct *)(long)THIS->task;
- THIS->__retvalue = deref(sizeof(t->state), &(t->state));
- if (0) {
-deref_fault:
- CONTEXT->last_error = "pointer dereference fault";
- }
+ THIS->__retvalue = kread(&(t->state));
+ CATCH_DEREF_FAULT();
%}
@@ -46,111 +40,78 @@ deref_fault:
function task_execname:string (task:long) %{ /* pure */
struct task_struct *t = (struct task_struct *)(long)THIS->task;
deref_string(THIS->__retvalue, t->comm, MAXSTRINGLEN);
- if (0) {
-deref_fault:
- CONTEXT->last_error = "pointer dereference fault";
- }
+ CATCH_DEREF_FAULT();
%}
// Return the process id of the given task
function task_pid:long (task:long) %{ /* pure */
struct task_struct *t = (struct task_struct *)(long)THIS->task;
- THIS->__retvalue = deref(sizeof(t->tgid), &(t->tgid));
- if (0) {
-deref_fault:
- CONTEXT->last_error = "pointer dereference fault";
- }
+ THIS->__retvalue = kread(&(t->tgid));
+ CATCH_DEREF_FAULT();
%}
// Return the thread id of the given task
function task_tid:long (task:long) %{ /* pure */
struct task_struct *t = (struct task_struct *)(long)THIS->task;
- THIS->__retvalue = deref(sizeof(t->pid), &(t->pid));
- if (0) {
-deref_fault:
- CONTEXT->last_error = "pointer dereference fault";
- }
+ THIS->__retvalue = kread(&(t->pid));
+ CATCH_DEREF_FAULT();
%}
// 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;
- THIS->__retvalue = deref(sizeof(t->gid), &(t->gid));
- if (0) {
-deref_fault:
- CONTEXT->last_error = "pointer dereference fault";
- }
+ THIS->__retvalue = kread(&(t->gid));
+ CATCH_DEREF_FAULT();
%}
// 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;
- THIS->__retvalue = deref(sizeof(t->egid), &(t->egid));
- if (0) {
-deref_fault:
- CONTEXT->last_error = "pointer dereference fault";
- }
+ THIS->__retvalue = kread(&(t->egid));
+ CATCH_DEREF_FAULT();
%}
// 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;
- THIS->__retvalue = deref(sizeof(t->uid), &(t->uid));
- if (0) {
-deref_fault:
- CONTEXT->last_error = "pointer dereference fault";
- }
+ THIS->__retvalue = kread(&(t->uid));
+ CATCH_DEREF_FAULT();
%}
// 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;
- THIS->__retvalue = deref(sizeof(t->euid), &(t->euid));
- if (0) {
-deref_fault:
- CONTEXT->last_error = "pointer dereference fault";
- }
+ THIS->__retvalue = kread(&(t->euid));
+ CATCH_DEREF_FAULT();
%}
// Return the priority value of the given task
function task_prio:long (task:long) %{ /* pure */
struct task_struct *t = (struct task_struct *)(long)THIS->task;
- int prio = deref(sizeof(t->prio), &(t->prio));
- THIS->__retvalue = prio - MAX_RT_PRIO;
- if (0) {
-deref_fault:
- CONTEXT->last_error = "pointer dereference fault";
- }
+ THIS->__retvalue = kread(&(t->prio)) - MAX_RT_PRIO;
+ CATCH_DEREF_FAULT();
%}
// Return the nice value of the given task
function task_nice:long (task:long) %{ /* pure */
struct task_struct *t = (struct task_struct *)(long)THIS->task;
- int static_prio = deref(sizeof(t->static_prio), &(t->static_prio));
- THIS->__retvalue = static_prio - MAX_RT_PRIO - 20;
- if (0) {
-deref_fault:
- CONTEXT->last_error = "pointer dereference fault";
- }
+ THIS->__retvalue = kread(&(t->static_prio)) - MAX_RT_PRIO - 20;
+ CATCH_DEREF_FAULT();
%}
// Return the scheduled cpu for the given task
function task_cpu:long (task:long) %{ /* pure */
struct task_struct *t = (struct task_struct *)(long)THIS->task;
- struct thread_info *ti =
- (struct thread_info *)deref(sizeof(t->thread_info), &(t->thread_info));
- THIS->__retvalue = deref(sizeof(ti->cpu), &(ti->cpu));
- if (0) {
-deref_fault:
- CONTEXT->last_error = "pointer dereference fault";
- }
+ struct thread_info *ti = kread(&(t->thread_info));
+ THIS->__retvalue = kread(&(ti->cpu));
+ CATCH_DEREF_FAULT();
%}