Bug 585843

Summary: lsof does not spot files open by a thread which does not share its father's fd table
Product: [Fedora] Fedora Reporter: Jerome Marchand <jmarchan>
Component: lsofAssignee: Peter Schiffer <pschiffe>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 14CC: kzak
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-05-24 13:24:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Reproducer
none
Reproducer (fixed) none

Description Jerome Marchand 2010-04-26 08:30:09 UTC
Created attachment 409106 [details]
Reproducer

Description of problem:
lsof does not spot files open by a thread which does not share its father's fd table.

Version-Release number of selected component (if applicable):


How reproducible:
Always.

Steps to Reproduce:
1. ./clonenofd&
2. lsof -c clonenofd |grep /tmp
3.
  
Actual results:
No opened file in /tmp/ directory is displayed by lsof.

Expected results:
It should displays a line like the following:
clonenofd 4985 root    3u   REG  253,0        0 144152 /tmp/foo.QPKwSV

Additional info:
There is a bug in kernel that make /proc/<pid>/task/<tid>/fdinfo/ gives the link to open files, like  /proc/<pid>/task/<tid>/fd/. You may have to wait for that to be solved in order to be able to show offsets correctly. I've posted a patch against that recently.

Comment 1 Bug Zapper 2010-07-30 11:28:20 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 14 development cycle.
Changing version to '14'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 2 Fedora Admin XMLRPC Client 2011-07-11 13:14:20 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 3 Peter Schiffer 2012-04-25 16:05:30 UTC
Hi Jerome,

I am not able to compile your reproducer on F17 because of the following error:

$ gcc clonenofd.c -o clonenofd
clonenofd.c: In function ‘main’:
clonenofd.c:41:17: error: ‘CLONE_THREAD’ undeclared (first use in this function)
clonenofd.c:41:17: note: each undeclared identifier is reported only once for each function it appears in
clonenofd.c:41:32: error: ‘CLONE_SIGHAND’ undeclared (first use in this function)
clonenofd.c:41:48: error: ‘CLONE_VM’ undeclared (first use in this function)


Please, do you know how to fix it?


Thanks,

peter

Comment 4 Jerome Marchand 2012-04-25 16:47:13 UTC
Created attachment 580218 [details]
Reproducer (fixed)

_GNU_SOURCE should be defined before including the first header. This version of the reproducer corrects that.

Comment 5 Peter Schiffer 2012-05-24 10:24:37 UTC
Jerome,

I've just find out, that if you want to list tasks of processes, you have to use -K option:

$ lsof -aK -c clonenofd | grep /tmp
clonenofd 23065 23066 schiffer    3u   REG    8,3        0 1705804 /tmp/foo.x6fJhf


Please, confirm that this is what you need.


Thanks,

peter

Comment 6 Jerome Marchand 2012-05-24 13:17:47 UTC
Yes this is correct. This -K option has been added to lsof 4.84.

Comment 7 Peter Schiffer 2012-05-24 13:24:56 UTC
Thanks. Since lsof 4.84 is available in F15, I am closing this as NEXTRELEASE.