Bug 1171823

Summary: dereferencing pointer to incomplete type struct knfsd_fh
Product: Red Hat Enterprise Linux 7 Reporter: Martin Cermak <mcermak>
Component: systemtapAssignee: Frank Ch. Eigler <fche>
Status: CLOSED ERRATA QA Contact: Martin Cermak <mcermak>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.2CC: dsmith, lberk, mcermak, mjw
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: systemtap-2.6-8.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1172775 (view as bug list) Environment:
Last Closed: 2015-03-05 08:23:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1172775    

Description Martin Cermak 2014-12-08 16:52:48 UTC
With systemtap-2.6-7.el7 and kernel-3.10.0-206.el7 I see following issue:

# stap -v -c 'ls /tmp/some-nfs-mounted-dir' -e 'probe nfsd.open{print(fh)}'
Pass 1: parsed user script and 114 library script(s) using 218252virt/35588res/3020shr/33140data kb, in 150usr/20sys/163real ms.
Pass  2: analyzed script: 3 probe(s), 4 function(s), 7 embed(s), 1 global(s)  using 342580virt/161080res/4156shr/157468data kb, in  1720usr/380sys/2110real ms.
Pass  3: translated to C into  "/tmp/stapOF3Ipl/stap_4c24a6feff91c0788091460de2197891_5006_src.c" using  342580virt/161380res/4456shr/157468data kb, in 200usr/60sys/254real ms.
/tmp/stapOF3Ipl/stap_4c24a6feff91c0788091460de2197891_5006_src.c: In function ‘function___svc_fh’:
/tmp/stapOF3Ipl/stap_4c24a6feff91c0788091460de2197891_5006_src.c:240:28: error: dereferencing pointer to incomplete type
  struct knfsd_fh *fh = &fhp->fh_handle;
                            ^
make[2]: *** [/tmp/stapOF3Ipl/stap_4c24a6feff91c0788091460de2197891_5006_src.o] Error 1
make[1]: *** [_module_/tmp/stapOF3Ipl] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compiled C into "stap_4c24a6feff91c0788091460de2197891_5006.ko" in 650usr/270sys/843real ms.
Pass 4: compilation failed.  [man error::pass4]

----------------

<@fche> so the problem appears to be that struct svc_fh's declaration moved from  include/linux/nfsd/nfsfh.h to  
              fs/nfsd/nfsfh.h
<@fche> the latter is not accessible to stap's embedded-c code

Comment 1 David Smith 2014-12-08 20:05:56 UTC
Fixed upstream in commit f739850:

<https://sourceware.org/git/gitweb.cgi?p=systemtap.git;a=commitdiff;h=f73985072571f93684e7742733d8d06b477b02bf;hp=eb7d25eccd83ccda7f24e4281e4d3044395f56c6>

This commit should easily backport.

Comment 2 David Smith 2014-12-08 22:20:10 UTC
Upstream commit 957812a simplifies the previous fix and should be backported as well:

<https://sourceware.org/git/gitweb.cgi?p=systemtap.git;a=patch;h=957812abcb03ad5eb2b544c7fff111b967deb211>

Comment 3 Martin Cermak 2014-12-10 09:50:49 UTC
Using upstream 957812a bits, this looks fixed except on powerpc (using kernel-3.10.0-215.el7.ppc64):

=======
semantic error: not accessible at this address (pc: 0x191bc) [man error::dwarf]: identifier '$fhp' at /usr/share/systemtap/tapset/linux/nfsd.stp:1093:16
        dieoffset: 0x5376b from /usr/lib/debug/lib/modules/3.10.0-215.el7.ppc64/kernel/fs/nfsd/nfsd.ko.debug
        function: nfsd_open at fs/nfsd/vfs.c:822 inlined by nfsd_get_tmp_read_open at fs/nfsd/vfs.c:1129
        alternative locations: [0x191d4,0x191db], [0x191db,0x19264], [0x19264,0x19430], [0x19430,0x19480], [0x19480,0x19484], [0x19484,0x194d0], [0x194d0,0x1952c], [0x1952c,0x1953c], [0x1953c,0x19564]
        source:         fh = __svc_fh($fhp)
                                      ^
=======

Comment 5 Frank Ch. Eigler 2014-12-10 16:19:07 UTC
This last part seems like a pretty standard gcc debuginfo limitation issue,
set aside for later analysis.

Comment 9 errata-xmlrpc 2015-03-05 08:23:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHEA-2015-0373.html