Bug 509713 - getdents() reports /proc/1/task/1/ as DT_UNKNOWN.
Summary: getdents() reports /proc/1/task/1/ as DT_UNKNOWN.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel
Version: 5.3
Hardware: i386
OS: Linux
low
medium
Target Milestone: ---
: ---
Assignee: Danny Feng
QA Contact: Red Hat Kernel QE team
URL:
Whiteboard:
Depends On:
Blocks: 526775 533192
TreeView+ depends on / blocked
 
Reported: 2009-07-05 13:29 UTC by Tetsuo Handa
Modified: 2010-03-30 07:41 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-03-30 07:41:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
posted patch (564 bytes, patch)
2009-07-17 08:13 UTC, Danny Feng
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2010:0178 0 normal SHIPPED_LIVE Important: Red Hat Enterprise Linux 5.5 kernel security and bug fix update 2010-03-29 12:18:21 UTC

Description Tetsuo Handa 2009-07-05 13:29:19 UTC
Description of problem:

I noticed that kernel 2.6.18-128.1.16.el5 reports file type of /proc/1/task/1/
as DT_UNKNOWN, while vanilla kernel 2.6.31-rc2 reports it as DT_DIR.

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


How reproducible:
Always

Steps to Reproduce:
1. Build the test program and run as root user.

----- Start of test program -----
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dirent.h>

static char path[8192] = "/proc/1";

static void scan_dir(void)
{
        struct dirent **namelist;
        int n = scandir(path, &namelist, 0, 0);
        int len;
        int i;
        if (n < 0)
                return;
        len = strlen(path);
        for (i = 0; i < n; i++) {
                const unsigned char type = namelist[i]->d_type;
		const char *name = namelist[i]->d_name;
                snprintf(path + len, sizeof(path) - len - 1, "/%s", name);
                if (type == DT_DIR &&strcmp(name, ".") && strcmp(name, ".."))
			scan_dir();
		else if (type == DT_REG)
			printf("FILE: %s\n", path);
                else if (type == DT_UNKNOWN)
                        printf("Unknown type: %s\n", path);
                free((void *) namelist[i]);
        }
        free((void *) namelist);
}

int main(int argc, char *argv[])
{
	scan_dir();
	return 0;
}
----- End of test program -----
  
Actual results:
----- Test result on 2.6.18-128.1.16.el5 -----
Unknown type: /proc/1/task/1
FILE: /proc/1/environ
FILE: /proc/1/auxv
FILE: /proc/1/status
FILE: /proc/1/cmdline
FILE: /proc/1/stat
FILE: /proc/1/statm
FILE: /proc/1/maps
FILE: /proc/1/mem
FILE: /proc/1/mounts
FILE: /proc/1/mountstats
FILE: /proc/1/smaps
FILE: /proc/1/attr/current
FILE: /proc/1/attr/prev
FILE: /proc/1/attr/exec
FILE: /proc/1/attr/fscreate
FILE: /proc/1/attr/keycreate
FILE: /proc/1/attr/sockcreate
FILE: /proc/1/wchan
FILE: /proc/1/schedstat
FILE: /proc/1/cpuset
FILE: /proc/1/oom_score
FILE: /proc/1/oom_adj
FILE: /proc/1/loginuid
FILE: /proc/1/limits
FILE: /proc/1/coredump_filter

Expected results:
Something like below output.
----- Test result on 2.6.31-rc2 -----
FILE: /proc/1/task/1/environ
FILE: /proc/1/task/1/auxv
FILE: /proc/1/task/1/status
FILE: /proc/1/task/1/personality
FILE: /proc/1/task/1/limits
FILE: /proc/1/task/1/sched
FILE: /proc/1/task/1/syscall
FILE: /proc/1/task/1/cmdline
FILE: /proc/1/task/1/stat
FILE: /proc/1/task/1/statm
FILE: /proc/1/task/1/maps
FILE: /proc/1/task/1/mem
FILE: /proc/1/task/1/mounts
FILE: /proc/1/task/1/mountinfo
FILE: /proc/1/task/1/clear_refs
FILE: /proc/1/task/1/smaps
FILE: /proc/1/task/1/pagemap
FILE: /proc/1/task/1/wchan
FILE: /proc/1/task/1/stack
FILE: /proc/1/task/1/schedstat
FILE: /proc/1/task/1/latency
FILE: /proc/1/task/1/oom_score
FILE: /proc/1/task/1/oom_adj
FILE: /proc/1/task/1/loginuid
FILE: /proc/1/task/1/sessionid
FILE: /proc/1/task/1/make-it-fail
FILE: /proc/1/fdinfo/10
FILE: /proc/1/net/ip6_flowlabel
FILE: /proc/1/net/rt6_stats
FILE: /proc/1/net/ipv6_route
FILE: /proc/1/net/if_inet6
FILE: /proc/1/net/dev_snmp6/eth0
FILE: /proc/1/net/dev_snmp6/lo
FILE: /proc/1/net/snmp6
FILE: /proc/1/net/sockstat6
FILE: /proc/1/net/udplite6
FILE: /proc/1/net/raw6
FILE: /proc/1/net/mcfilter6
FILE: /proc/1/net/igmp6
FILE: /proc/1/net/anycast6
FILE: /proc/1/net/tcp6
FILE: /proc/1/net/udp6
FILE: /proc/1/net/packet
FILE: /proc/1/net/unix
FILE: /proc/1/net/snmp
FILE: /proc/1/net/netstat
FILE: /proc/1/net/sockstat
FILE: /proc/1/net/udp
FILE: /proc/1/net/tcp
FILE: /proc/1/net/raw
FILE: /proc/1/net/ip_mr_cache
FILE: /proc/1/net/ip_mr_vif
FILE: /proc/1/net/udplite
FILE: /proc/1/net/mcfilter
FILE: /proc/1/net/igmp
FILE: /proc/1/net/rt_cache
FILE: /proc/1/net/route
FILE: /proc/1/net/arp
FILE: /proc/1/net/dev_mcast
FILE: /proc/1/net/ptype
FILE: /proc/1/net/softnet_stat
FILE: /proc/1/net/dev
FILE: /proc/1/net/protocols
FILE: /proc/1/net/netlink
FILE: /proc/1/net/stat/ndisc_cache
FILE: /proc/1/net/stat/rt_cache
FILE: /proc/1/net/stat/arp_cache
FILE: /proc/1/environ
FILE: /proc/1/auxv
FILE: /proc/1/status
FILE: /proc/1/personality
FILE: /proc/1/limits
FILE: /proc/1/sched
FILE: /proc/1/syscall
FILE: /proc/1/cmdline
FILE: /proc/1/stat
FILE: /proc/1/statm
FILE: /proc/1/maps
FILE: /proc/1/mem
FILE: /proc/1/mounts
FILE: /proc/1/mountinfo
FILE: /proc/1/mountstats
FILE: /proc/1/clear_refs
FILE: /proc/1/smaps
FILE: /proc/1/pagemap
FILE: /proc/1/wchan
FILE: /proc/1/stack
FILE: /proc/1/schedstat
FILE: /proc/1/latency
FILE: /proc/1/oom_score
FILE: /proc/1/oom_adj
FILE: /proc/1/loginuid
FILE: /proc/1/sessionid
FILE: /proc/1/make-it-fail
FILE: /proc/1/coredump_filter

Additional info:
I'm using CentOS5.3 , but this problem should be reproducible on RHEL5.3 .
Please test on RHEL5.3 .

Comment 1 Tetsuo Handa 2009-07-08 07:06:23 UTC
I tested vanilla kernels.
It seems that 2.6.18.8 has this bug, 2.6.19.7 and later do not have this bug.
I think a patch for this bug could be found between 2.6.18 and 2.6.19 .

Comment 3 Danny Feng 2009-07-17 08:13:13 UTC
Created attachment 354113 [details]
posted patch

Comment 4 Tetsuo Handa 2009-07-17 08:28:09 UTC
(In reply to comment #3)
> Created an attachment (id=354113) [details]
> posted patch  

That patch solved this bug.
Thank you.

Comment 5 RHEL Program Management 2009-09-25 17:37:15 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 6 Don Zickus 2009-10-06 19:38:18 UTC
in kernel-2.6.18-168.el5
You can download this test kernel from http://people.redhat.com/dzickus/el5

Please do NOT transition this bugzilla state to VERIFIED until our QE team
has sent specific instructions indicating when to do so.  However feel free
to provide a comment indicating that this fix has been verified.

Comment 10 errata-xmlrpc 2010-03-30 07:41:23 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2010-0178.html


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