Member session missing in signal_struct for 2.6.30-rc5

Wenji Huang wenji.huang@oracle.com
Fri May 15 05:17:00 GMT 2009


Josh Stone wrote:
> On 05/13/2009 10:43 PM, Wenji Huang wrote:
>> Hi,
>>
>> The commit in kernel
>>
>> signals: check_kill_permission: check session under tasklist_lock
>> author	Oleg Nesterov <oleg@tv-sign.ru>
>> 	Wed, 30 Apr 2008 07:53:01 +0000 (00:53 -0700)
>> committer	Linus Torvalds <torvalds@linux-foundation.org>
>> 	Wed, 30 Apr 2008 15:29:37 +0000 (08:29 -0700)
>> commit	2e2ba22ea4fd4bb85f0fa37c521066db6775cbef
>>
>> removed member session from signal_struct. This results in
>> compilation error for sid() on latest kernel.
>>
>> I haven't found the replacement for the member or alike function.
>> Guess need to make it available under %kernel_v or other solution
>> if someone had.
> 
> Right -- I pointed this out to Malte Nuhn last week.  I think the best
> we can do is something like:
> 
>   task_session_nr_ns(current, &init_pid_ns)
> 
> I don't have a running 2.6.30 -- can you try this out?
> 
Yes, The test confirmed that task_session_nr_ns is a good choice.
But it only exists on 2.6.24+ kernel. The following patch maybe keeps
better compatibility.

diff --git a/tapset/context.stp b/tapset/context.stp
index 5d855f8..b64d77c 100644
--- a/tapset/context.stp
+++ b/tapset/context.stp
@@ -70,9 +70,13 @@ function ppid:long () %{ /* pure */
   * leader. Session ID is stored in the signal_struct since Kernel 2.6.0.
   */
  function sid:long () %{ /* pure */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
         struct signal_struct *ss = kread( &(current->signal) );
         THIS->__retvalue = kread ( &(ss->session) );
         CATCH_DEREF_FAULT();
+#else
+       THIS->__retvalue = task_session_nr_ns(current, &init_pid_ns);
+#endif
  %}

  /**

Regards,
Wenji



More information about the Systemtap mailing list