From 331edd21f3c4f79fb71456d5550d75657b34b80f Mon Sep 17 00:00:00 2001 From: guanglei Date: Wed, 30 Aug 2006 08:58:41 +0000 Subject: [PATCH] document signal tapsets into stapprobes.5.in some changes to arguments and comments of signal tapset --- ChangeLog | 4 + stapprobes.5.in | 424 +++++++++++++++++++++++++++++++++++++++++ tapset/ChangeLog | 5 + tapset/LKET/signal.stp | 3 +- tapset/signal.stp | 87 +++++---- 5 files changed, 482 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 660dc07a1..aa6bd4292 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-08-30 Li Guanglei + + * stapprobes.5.in: document signal.* + 2006-08-28 David Smith * translate.cxx: Added inclusion of session.h. diff --git a/stapprobes.5.in b/stapprobes.5.in index 552c53827..38314f8b8 100644 --- a/stapprobes.5.in +++ b/stapprobes.5.in @@ -732,6 +732,430 @@ Fires when returning from udp.disconnect .I ret error code (0: no error) +.SS SIGNAL + +This family of probe points is used to probe signal activities. +It contains the following probe points: + +.P +.TP +.B signal.send + +Fires when a signal is sent to a process + +.B Arguments: + +.I sig + signal number + +.I sig_name + a string representation of the signal + +.I sig_pid + pid of the signal recipient process + +.I pid_name + name of the signal recipient process + +.I si_code + indicates the signal type + +.I task + a task handle to the signal recipient + +.I sinfo + the address of siginfo struct + +.I shared + indicates whether this signal is shared by the thread group + +.I send2queue + indicates whether this signal is sent to an existing sigqueue + +.I name + name of the function used to send out this signal + +.P +.TP +.B signal.send.return + +Fires when return from sending a signal + +.B Arguments: + +.I retstr + the return value + + Return values for "__group_send_sig_info" and "specific_send_sig_info" + +.RS +.RS +- return 0 if the signal is sucessfully sent to a process, +which means the following: + +<1> the signal is ignored by receiving process + +<2> this is a non-RT signal and we already have one queued + +<3> the signal is successfully added into the sigqueue of receiving process + +- return -EAGAIN if the sigqueue is overflow the signal was RT and sent +by user using something other than kill() +.RE + + Return values for ""send_group_sigqueue" + +.RS +- return 0 if the signal is either sucessfully added into the +sigqueue of receiving process or a SI_TIMER entry is already +queued so just increment the overrun count + +- return 1 if this signal is ignored by receiving process +.RE + + Return values for "send_sigqueue" + +.RS +- return 0 if the signal is either sucessfully added into the +sigqueue of receiving process or a SI_TIMER entry is already +queued so just increment the overrun count + +- return 1 if this signal is ignored by receiving process + +- return -1 if the task is marked exiting, so posix_timer_event +can redirect it to the group leader +.RE + +.I shared + indicates whether this signal is shared by the thread group + +.I send2queue + indicates whether this signal is sent to an existing sigqueue + +.I name + name of the function used to send out this signal + + +.RE +.RE +.P +.TP +.B signal.checkperm + +Fires when check permissions for sending the signal + +.B Arguments: + +.I sig + the number of the signal + +.I sig_name + a string representation of the signal + +.I sig_pid + pid of the signal recipient process + +.I pid_name + name of the signal recipient process + +.I si_code + indicates the signal type + +.I task + a task handle to the signal recipient + +.I sinfo + the address of siginfo struct + +.I name + name of the probe point, is set to "signal.checkperm" + +.P +.TP +.B signal.checkperm.return + +Fires when return from permissions check for sending a signal + +.B Arguments: + +.I retstr + the return value + +.I name + name of the probe point, is set to "signal.checkperm" + +.P +.TP +.B signal.wakeup + +Fires when wake up the process for new active signals + +.B Arguments: + +.I sig_pid + pid of the process to be woke up + +.I pid_name + name of the process to be woke up + +.I resume + indicate whether to wake up a task in STOPPED or TRACED state + +.I state_mask + a string representation indicate the mask of task states +that can be woken. Possible values are +(TASK_INTERRUPTIBLE|TASK_STOPPED|TASK_TRACED) and +TASK_INTERRUPTIBLE. + +.P +.TP +.B signal.check_ignored + +Fires when check whether the signal is ignored or not + +.B Arguments: + +.I sig_pid + pid of the signal recipient process + +.I pid_name + name of the signal recipient process + +.I sig + the signal to be checked + +.I sig_name + name of the signal + +.P +.TP +.B signal.check_ignored.return + +Fires when return from signal.check_ignored + +.B Arguments: + +.I retstr + return value. 0 indicate the current signal isn't ignored. + +.P +.TP +.B signal.force_segv + +Forces SIGSEGV when there are some issues while handling +signals for the process + +.B Arguments: + +.I sig_pid + pid of the signal recipient process + +.I pid_name + name of the signal recipient process + +.I sig + the signal being handled + +.I sig_name + name of this signal + +.P +.TP +.B signal.force_segv.return + +Fires when return from signal.force_segv + +.B Arguments: + +.I retstr + return value. Always return 0 + +.P +.TP +.B signal.send_sig_queue + +Fires when queue a signal to a process + +.B Arguments: + +.I sig + the signal to be queued + +.I sig_name + name of this signal + +.I sig_pid + pid of the process to which the signal is queued + +.I pid_name + name of the process to which the signal is queued + +.I sigqueue_addr + address of the signal queue + +.P +.TP +.B signal.send_sig_queue.return + +Fires when return from signal.send_sig_queue + +.B Arguments: + +.I retstr + return value + +.P +.TP +.B signal.pending + +Fires when examine the set of signals that are +pending for delivery to the calling thread + +.B Arguments: + +.I sigset_add + address of user space sigset_t + +.I sigset_size + sigset size + +.P +.TP +.B signal.pending.return + +Fires when return from signal.pending + +.B Arguments: + +.I retstr + return value + +.P +.TP +.B signal.handle + +Fires when invoking the signal handler + +.B Arguments: + +.I sig + signal number + +.I sig_name + signal name + +.I sinfo + address of siginfo struct + +.I sig_code + the si_code of siginfo + +.I ka_addr + Address of the k_sigaction struct associated with the signal + +.I oldset_addr + Address of a bit mask array of blocked signals + +.I sig_mode + indicates whether the signal is a User Mode or Kernel mode Signal + +.P +.TP +.B signal.handle.return + +Fires when return from signal.handle + +.B Arguments: + +.I retstr + return value of handle_signal() + +.P +.TP +.B signal.do_action + +Fires by calling thread to examine and change a signal action + +.B Arguments: + +.I sig + signal number + +.I sigact_addr + address of the new sigaction struct associated with the signal + +.I oldsigact_addr + address of a previous sigaction struct associated with the signal + +.I sa_handler + the new handler of the signal + +.I sa_mask + the new mask of the signal + +.P +.TP +.B signal.do_action.return + +Fires when return from signal.do_action + +.B Arguments: + +.I retstr + return value of do_sigaction() + +.P +.TP +.B signal.procmask + +Fires by calling thread to examine and change blocked signals + +.B Arguments: + +.I how + indicates how to change the blocked signals. + Possible values are: + SIG_BLOCK=0 for blocking signals + SIG_UNBLOCK=1 for unblocking signals + SIG_SETMASK=2 for setting the signal mask + +.I sigset_addr + address of sigset_t to be set + +.I oldsigset_addr + address of the old sigset_t + +.I sigset + the actual sigset to be set + +.P +.TP +.B signal.procmask.return + +Fires when return from signal.procmask + +.B Arguments: + +.I retstr + return value of sigprocmask() + +.P +.TP +.B signal.flush + +Fires when flush all pending signals for a task + +.B Arguments: + +.I task + the task handler of the process + +.I sig_pid + pid of the task + +.I pid_name + name of the task + .SH EXAMPLES .PP Here are some example probe points, defining the associated events. diff --git a/tapset/ChangeLog b/tapset/ChangeLog index 05b1ff333..b34c71f7d 100644 --- a/tapset/ChangeLog +++ b/tapset/ChangeLog @@ -1,3 +1,8 @@ +2006-08-30 Li Guanglei + + * signal.stp: some changes to arguments and comments + of signal tapset + 2006-08-25 Li Guanglei From Li Xuepeng: diff --git a/tapset/LKET/signal.stp b/tapset/LKET/signal.stp index b475473c2..2584aacdb 100755 --- a/tapset/LKET/signal.stp +++ b/tapset/LKET/signal.stp @@ -189,7 +189,7 @@ probe addevent.signal.pending.entry probe _addevent.signal.pending.entry = signal.pending { - log_signal_pending(uspace_add, sset_size) + log_signal_pending(sigset_add, sigset_size) } function log_signal_pending(sigset_addr:long, setsize:long) @@ -255,6 +255,7 @@ probe signal.handle.return = kernel.function("handle_signal").return retstr = returnstr(1) } */ + /* Fires when examing and change a signal action */ probe addevent.signal.do_action.entry += _addevent.signal.do_action.entry diff --git a/tapset/signal.stp b/tapset/signal.stp index 1e568ae51..5b0429914 100644 --- a/tapset/signal.stp +++ b/tapset/signal.stp @@ -25,8 +25,14 @@ * Arguments: * sig - the number of the signal * sig_name - a string representation of the signal + * sig_pid - pid of the signal recipient process + * pid_name - name of the signal recipient process + * si_code - indicates the signal type. * task - a task handle to the signal recipient + * sinfo - the address of siginfo struct. * shared - indicates whether this signal is shared by the thread group + * send2queue- indicates whether this signal is sent to an existing sigqueue + * name - name of the function used to send out this signal */ probe signal.send = _signal.send.* { @@ -183,16 +189,23 @@ probe signal.checkperm.return = kernel.function("check_kill_permission").return * * Wake up the process for new active signals. * + * Argument: + * sig_pid: pid of the process to be woke up + * pid_name: name of the process to be woke up + * resume: indicate whether to wake up a task in STOPPED or + TRACED state + * state_mask: a string representation indicates the mask + * of task states that can be woken */ probe signal.wakeup = kernel.function("signal_wake_up") { sig_pid = $t->pid pid_name = kernel_string($t->comm) - state = $resume - if (state == 0) { - sig_state = "TASK_INTERRUPTIBLE" + resume = $resume + if (resume == 0) { + state_mask = "TASK_INTERRUPTIBLE" } else { - sig_state = "TASK_INTERRUPTIBLE | TASK_STOPPED | TASK_TRACED" + state_mask = "TASK_INTERRUPTIBLE | TASK_STOPPED | TASK_TRACED" } } @@ -206,7 +219,7 @@ probe signal.check_ignored = kernel.function("sig_ignored") { sig_pid = $t->pid pid_name = kernel_string($t->comm) - sig_info = $sig + sig = $sig sig_name = _signal_name($sig) } @@ -245,7 +258,7 @@ probe signal.force_segv = kernel.function("force_sigsegv") { sig_pid = $p->pid pid_name = kernel_string($p->comm) - sig_info = $sig + sig = $sig sig_name = _signal_name($sig) } @@ -310,13 +323,11 @@ probe signal.send_sig_queue = kernel.function("send_sigqueue"), kernel.function("send_group_sigqueue") { - sig_info = $sig + sig = $sig sig_name = _signal_name($sig) sig_pid = $p->pid pid_name = kernel_string($p->comm) - user_id = $q->uid - nos_process = $q->processes - nos_pending_sig = $q->sigpending + sigqueue_addr = $q } probe signal.send_sig_queue.return = @@ -336,8 +347,8 @@ probe signal.send_sig_queue.return = */ probe signal.pending = kernel.function("do_sigpending") { - uspace_add=$set - sset_size=$sigsetsize + sigset_add=$set + sigset_size=$sigsetsize } probe signal.pending.return = kernel.function("do_sigpending").return @@ -354,9 +365,9 @@ probe signal.pending.return = kernel.function("do_sigpending").return * sigset_t *oldset, struct pt_regs * regs) * Argument :- * sig : Signal number - * info : address of siginfo table. - * ka : Address of the k_sigaction table associated with the signal - * oldset : Address of a bit mask array of blocked signals + * sinfo : address of siginfo table. + * ka_addr : Address of the k_sigaction table associated with the signal + * oldset_addr : Address of a bit mask array of blocked signals * regs : Address in the Kernel Mode stack area * */ @@ -365,17 +376,17 @@ probe signal.handle = kernel.function("handle_signal")?, { sig = $sig sig_name = _signal_name($sig) - sinfo_addr = $info + sinfo = $info sig_code = $info->si_code - sig_stack_add=$ka - bitmask_add=$oldset - kernmode_stack_add=$regs + ka_addr = $ka + oldset_addr =$oldset + regs = $regs // Check whether the signal is a User Mode or Kernel mode Signal. - if (sinfo_addr == 0 && sig_code <= 0) + if (sinfo == 0 && sig_code <= 0) sig_mode = "User Mode Signal" - else if (sinfo_addr >= 1) + else if (sinfo >= 1) sig_mode = "Kernel Mode Signal" } @@ -387,21 +398,20 @@ probe signal.handle.return = kernel.function("handle_signal").return /* probe signal.do_action * - * Called by sys_sigaction() to copy the new new_ka table into the entry at the sig-1 position. + * Fires by calling thread to examine and change a signal action * * int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact) * * Argument :- * sig : Signal number - * act : Address of the sigaction table associated with the signal - * oact : Address of a previous sigaction table - * + * sigact_addr : address of the new sigaction struct associated with the signal + * oldsigact_addr : address of a previous sigaction struct associated with the signal */ probe signal.do_action = kernel.function("do_sigaction") { sig = $sig - sigact_table=$act - psigact_table=$oact + sigact_addr = $act + oldsigact_addr = $oact if(sigact_table != 0) { sa_handler = $act->sa->sa_handler @@ -417,29 +427,26 @@ probe signal.do_action.return = kernel.function("do_sigaction").return /* probe signal.procmask * - * Allows processes to modify the set of blocked signals. + * Fires by calling thread to examine and change blocked signals * * int sigprocmask(int how, sigset_t *set, sigset_t *oldset) * * Argument :- - * how : Flag having one of the values (SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK) - * set : Address of the process address space to a bit array. - * oldset : Address of the process address space where the previous bit mask must be stored. + * how : indicates how to change the blocked signals. Possible + * values are SIG_BLOCK=0 for blocking signals, SIG_UNBLOCK=1 + * for unblocking signals, and SIG_SETMASK=2 for setting + * the signal mask + * sigset_addr : address of sigset_t to be set + * oldsigset_addr : address of the old sigset_t + * sigset : the actual sigset to be set * */ probe signal.procmask = kernel.function("sigprocmask") { - stemp=$how + how=$how sigset_addr = $set - sigoset_addr = $oldset - + oldsigset_addr = $oldset sigset = get_sigset($set) - if (stemp == 0) - sig_how ="SIG_BLOCK" - else if (stemp == 1) - sig_how="SIG_UNBLOCK" - else if (stemp == 2) - sig_how="SIG_SETMASK" } function get_sigset:long(sigset:long) %{ /* pure */ -- 2.43.5