This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Duplicate events for 32-bit compatible syscall probes


On 04/25/2013 08:18 AM, David Smith wrote:
> On 04/25/2013 08:12 AM, David Smith wrote:
>> On 04/24/2013 04:47 AM, Aryeh Weinreb wrote:
>>> Hi,
>>>
>>> While using some syscall.mq_* probes on 32bit on x86_64 I am getting
>>> duplicate events.
>>>
>>> Looking into ipc/compat_mq.c it seems that the compat_sys_mq calls are
>>> just wrappers for the sys_mq ones.
>>> Although, sometimes the compat calls can return EFAULT without calling
>>> the non-compat versions.
>>>
>>> It would be nice to only get one event for each system call without
>>> missing any calls.
>>>
>>> I am using an RHEL 6 build of systemtap version 1.8.
>>
>> If you just want to trace the "real" 64-bit syscalls, I'd do something
>> like the following to reject the 32-bit-on-64-bit syscalls. Note that
>> this is untested, but should work.
>>
>> =====
>> function is_compat_task:long () %{
>>     STAP_RETVALUE = _stp_is_compat_task();
>> %}
>>
>> probe syscall.mq_getsetattr
>> {
>> 	if { is_compat_task() } next;
>> 	# ... your real code here
>> }
>> =====
>>
> 
> And of course as soon as I send this I realize it won't work. That will
> most likely reject all 32-on-64 processes.
> 
> I'll keep thinking here.
> 

OK, here's a solution that I actually tested with syscall.open.
Basically if the function name we're probing has 'compat_' in it, skip it.

====
probe syscall.open
{
  if (isinstr(ppfunc(), "compat_")) {
    next
  }
  # ... your real code here
}
        ====

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]