public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug tapsets/15961] New: nd_syscall.exp failure on i686
@ 2013-09-16 21:30 dsmith at redhat dot com
  2013-10-17 14:27 ` [Bug tapsets/15961] " dsmith at redhat dot com
  2013-10-17 21:25 ` dsmith at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: dsmith at redhat dot com @ 2013-09-16 21:30 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=15961

            Bug ID: 15961
           Summary: nd_syscall.exp failure on i686
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tapsets
          Assignee: systemtap at sourceware dot org
          Reporter: dsmith at redhat dot com

The nd_syscall.exp testcase gets a failure on i686 RHEL6
(2.6.32-358.18.1.el6.i686) in the 'trunc' test:

  FAIL: 32-bit trunc nd_syscall

This failure is because systemtap is getting the wrong value for the 'length'
convenience variable from the nd_syscall.truncate probe. Here's the source for
nd_syscall.truncate:

====
probe nd_syscall.truncate = kprobe.function("sys_truncate") ?,
                            kprobe.function("sys_truncate64") ?
{
    name = "truncate"
    // path_uaddr = $path
    // path = user_string($path)
    // length = $length
    // argstr = sprintf("%s, %d", user_string_quoted($path), $length)
    asmlinkage()
    path_uaddr = pointer_arg(1)
    path = user_string_quoted(path_uaddr)
    if (symname(addr()) == "sys_truncate")
        length = ulong_arg(2)
    else
        length = longlong_arg(2)
    argstr = sprintf("%s, %d", user_string_quoted(path_uaddr), length)
}
====

The problem here was that a probe on "sys_truncate" was installed, but
'symname(addr())' failed, so that the wrong value was grabbed for 'length'.

'symname(addr())' shouldn't have failed, but that's a lot of work to do just to
figure out which function is being called. A call to 'ppfunc()' might be better
or breaking down the probe a bit more like the following (untested):

====
probe nd_syscall.truncate = __nd_syscall.truncate ?, __nd_syscall.truncate64 ?
{
    name = "truncate"
    // path_uaddr = $path
    // path = user_string($path)
    // length = $length
    // argstr = sprintf("%s, %d", user_string_quoted($path), $length)
    asmlinkage()
    path_uaddr = pointer_arg(1)
    path = user_string_quoted(path_uaddr)
    argstr = sprintf("%s, %d", user_string_quoted(path_uaddr), length)
}
probe __nd_syscall.truncate = kprobe.function("sys_truncate")
{
    asmlinkage()
    length = ulong_arg(2)
}
probe __nd_syscall.truncate64 = kprobe.function("sys_truncate64")
{
    asmlinkage()
    length = longlong_arg(2)
}
====

Note that there are 3 other similar uses of 'symname(addr())' in the nd_syscall
tapset files.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tapsets/15961] nd_syscall.exp failure on i686
  2013-09-16 21:30 [Bug tapsets/15961] New: nd_syscall.exp failure on i686 dsmith at redhat dot com
@ 2013-10-17 14:27 ` dsmith at redhat dot com
  2013-10-17 21:25 ` dsmith at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: dsmith at redhat dot com @ 2013-10-17 14:27 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=15961

--- Comment #1 from David Smith <dsmith at redhat dot com> ---
I'm seeing a similar failure elsewhere (RHEL5 on s390x), that is a bit more
intermittent. The failure is in the 64-bit mmap nd_syscall test.

A mmap call that was supposed to match the following regexp:

===
mmap: mmap[2]* \([x0-9a-fA-F]+, 1030, PROT_READ, MAP_SHARED, [\-0-9]+,
[x0-9a-fA-F]+\) = [x0-9a-fA-F]+
====

came out like this:

====
mmap: mmap (0x0, 0, PROT_NON, MAP_PRIVATE, 0, 1) = 0x20000004000
====

I couldn't figure out how it was so wrong until I looked at the nd_syscall.mmap
probe alias source:

====
probe nd_syscall.mmap = kprobe.function("old_mmap") ?,
                        kprobe.function("old32_mmap") ?,
                        kprobe.function("SyS_s390_old_mmap") ?
{
    asmlinkage()
    if ((symname(addr()) == "old_mmap") || (symname(addr()) ==
"SyS_s390_old_mmap"))
        argstr = get_mmap_args(pointer_arg(1))
    else
        argstr = get_32mmap_args(pointer_arg(1))
}
====

If 'symname(addr())' fails, the probe defaults to using the 32-bit function,
which interpreted the 64-bit data as 32-bit data.

The following seems to fix the problem:

====
probe nd_syscall.mmap = __nd_syscall.mmap, __nd_syscall.mmap32
{
    name = "mmap"
}
probe __nd_syscall.mmap = kprobe.function("old_mmap") ?,
              kprobe.function("SyS_s390_old_mmap") ?
{
    asmlinkage()
    argstr = get_mmap_args(pointer_arg(1))
}
probe __nd_syscall.mmap32 = kprobe.function("old32_mmap") ?
{
    asmlinkage()
    argstr = get_32mmap_args(pointer_arg(1))
}
====

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tapsets/15961] nd_syscall.exp failure on i686
  2013-09-16 21:30 [Bug tapsets/15961] New: nd_syscall.exp failure on i686 dsmith at redhat dot com
  2013-10-17 14:27 ` [Bug tapsets/15961] " dsmith at redhat dot com
@ 2013-10-17 21:25 ` dsmith at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: dsmith at redhat dot com @ 2013-10-17 21:25 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=15961

David Smith <dsmith at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from David Smith <dsmith at redhat dot com> ---
Fixed in commit 93fb14d. All 'symname(addr())' references in the
syscall/nd_syscall tapsets were either converted to use ppfunc() or broken down
into sub-probes.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-10-17 21:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-16 21:30 [Bug tapsets/15961] New: nd_syscall.exp failure on i686 dsmith at redhat dot com
2013-10-17 14:27 ` [Bug tapsets/15961] " dsmith at redhat dot com
2013-10-17 21:25 ` dsmith at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).