Bug 585843 - lsof does not spot files open by a thread which does not share its father's fd table
Summary: lsof does not spot files open by a thread which does not share its father's f...
Alias: None
Product: Fedora
Classification: Fedora
Component: lsof
Version: 14
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Peter Schiffer
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2010-04-26 08:30 UTC by Jerome Marchand
Modified: 2012-05-24 13:24 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2012-05-24 13:24:56 UTC
Type: ---

Attachments (Terms of Use)
Reproducer (842 bytes, text/x-csrc)
2010-04-26 08:30 UTC, Jerome Marchand
no flags Details
Reproducer (fixed) (843 bytes, text/x-csrc)
2012-04-25 16:47 UTC, Jerome Marchand
no flags Details

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

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:

Steps to Reproduce:
1. ./clonenofd&
2. lsof -c clonenofd |grep /tmp
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:

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?



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

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.



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.

Note You need to log in before you can comment on or make changes to this bug.