Bug 5434 - Error processing (missing) nfsservctl syscall
Summary: Error processing (missing) nfsservctl syscall
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: tapsets (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-30 09:16 UTC by Julio M. Merino Vidal
Modified: 2009-10-15 23:06 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Julio M. Merino Vidal 2007-11-30 09:16:43 UTC
When running the following sample command shown in systemtap's web site:

# stap -vv -c df -e 'probe syscall.* { if (target()==pid()) log(name." ".argstr) }'

I get to the following error:

[...]
probe sys_vmsplice@fs/splice.c:1475 kernel pc=0xc0000000000ddb74
probe sys_wait4@kernel/exit.c:1732 kernel pc=0xc0000000000514b0
probe sys_waitid@kernel/exit.c:1698 kernel pc=0xc0000000000514f0
probe sys_write@fs/read_write.c:376 kernel pc=0xc0000000000b5990
probe sys_writev@fs/read_write.c:686 kernel pc=0xc0000000000b53f8
probe compat_sys_writev@fs/compat.c:1165 kernel pc=0xc0000000000f14e0
semantic error: unable to find local 'arg' near pc 0xc0000000000efb84
(alternatives: cmd notused notused2): identifier '$arg' at
/usr/local/share/systemtap/tapset/syscalls2.stp:66:56
Pass 2: analyzed script: 339 probe(s), 1007 function(s), 14 embed(s), 1
global(s) in 67440usr/680sys/70669real ms.
Pass 2: analysis failed.  Try again with more '-v' (verbose) options.

This is on a PlayStation 3 running Fedora 8, systemtap's sources from the git
repository (as of yesterday) and this kernel:

Linux ps3k.gso.ac.upc.edu 2.6.24-rc3 #2 SMP Fri Nov 30 09:51:06 CET 2007 ppc64
ppc64 ppc64 GNU/Linux

It was built by me and it does NOT have CONFIG_NFSD set in it.  If I set this
option in the kernel's configuration, the above command works correctly.
Comment 1 David Smith 2007-12-05 18:36:41 UTC
You must not have CONFIG_COMPAT set either, since the definition of
syscall.nfsservctl looks like:

  probe syscall.nfsservctl =                                                      
                kernel.function("sys_nfsservctl") ?,                            
                kernel.function("compat_sys_nfsservctl") ?                      
  {                                                                               
        name = "nfsservctl"                                                     
        cmd = $cmd                                                              
        argp_uaddr = $arg                                                       
        resp_uaddr = $res                                                       
        argstr = sprintf("%s, %p, %p", _nfsctl_cmd_str($cmd), $arg, $res)       
  }

I'm unsure how we could solve this, since we don't have access to the CONFIG_*
defines at the probe level.  We could grab the value of either CONFIG_NFSD or
CONFIG_COMPAT in an embedded C function, but that doesn't help much.
Comment 2 Mark Wielaard 2008-11-02 17:03:43 UTC
Got another report about this.
The problem comes from this part in fs/compat.c:
#if defined(CONFIG_NFSD) || defined(CONFIG_NFSD_MODULE)
[...]
asmlinkage long compat_sys_nfsservctl(int cmd,
                                struct compat_nfsctl_arg __user *arg,
                                union compat_nfsctl_res __user *res)
{
[...]
}
#else /* !NFSD */
long asmlinkage compat_sys_nfsservctl(int cmd, void *notused, void *notused2)
{
        return sys_ni_syscall();
}
#endif

So compat_sys_nfsservctl() has differently named arguments depending on whether
or not NFSD is configured in. I also don't know a nice solution for this. But it
breaks simple things like:
stap -e 'probe syscall.* {printf("%s(%s)\n", probefunc(), argstr)}' -c 'echo'

semantic error: unable to find local 'arg' near pc 0xffffffff802cce2f
(alternatives: cmd notused notused2): identifier '$arg' at
/usr/local/share/systemtap/tapset/syscalls2.stp:66:56
        source:         argstr = sprintf("%s, %p, %p", _nfsctl_cmd_str($cmd),
$arg, $res)
Comment 3 Przemysław Pawełczyk 2009-10-15 23:06:22 UTC
(In reply to comment #1)
... 
> I'm unsure how we could solve this, since we don't have access to the CONFIG_*
> defines at the probe level.  We could grab the value of either CONFIG_NFSD or
> CONFIG_COMPAT in an embedded C function, but that doesn't help much.

We have access to the CONFIG_* since Frank's commit:
561079c PR10702: preprocessor conditional for kernel CONFIG_foo

So it was really easy to fix this. Commit:
b452838 PR5434: Fix syscall.nfsservctl.