Subject: Re: _simple_lock kernel panic while listing some procfs files
To: Antti Kantee , Nicolas Joly <njoly@pasteur.fr>
From: Nicolas Joly <njoly@pasteur.fr>
List: current-users
Date: 02/18/2007 02:00:42
On Fri, Feb 16, 2007 at 11:41:52PM +0200, Antti Kantee wrote:
> On Fri Feb 16 2007 at 19:53:32 +0000, Andrew Doran wrote:
> > On Fri, Feb 16, 2007 at 05:58:35PM +0100, Nicolas Joly wrote:
> > 
> > > I just updated my -current NetBSD/amd64 a few minutes ago ... And
> > > quickly hit a problem. I'm getting a kernel panic while trying to list
> > > some files in /proc with this simple command :
> > > 
> > > njoly@lanfeust [~]> sudo mount_procfs /proc /proc 
> > > njoly@lanfeust [~]> ls /proc/*/file
> > > [..PANIC..]
> > 
> > I can reproduce the crash. I believe that there may still be issues with
> > Linux applications and /proc, also. I'll be looking into this tomorrow and
> > will update the list with more as I have it.
> 
> This wasn't a newlock2 problem, but a problem with ktrace lwp.  I have
> no idea why it was discovered only now.  Maybe it was earlier shadowed
> by something, but at least I could repeat it on a pre-newlock2 kernel.
> 
> Nicolas:
> Can you try procfs_vnops.c rev. 1.148 and see if there are any more
> problems.  The logic between node validity for non-linux mounts and
> linux mounts was quite strange.

I noticed a problem with linux mounts, some linux specific files can
be seen with readdir(2)/getdents(2), but not accessed directly with
access(2)/stat(2) :

njoly@cixy [linux/proc]> mount -vv | grep proc
procfs on /usr/pkg/emul/linux/proc type procfs (read-only, local, fsid: 0x1b01/0x1ae1b, reads: sync 0 async 0, writes: sync 0 async 0, [procfs: version=1, flags=0x1<linuxcompat>])

njoly@cixy [linux/proc]> pwd
/usr/pkg/emul/linux/proc
njoly@cixy [linux/proc]> ls 
0       1087    1144    1299    171     4       505     669     765     848     984     mounts
1       11      12      13      2       406     52      698     79      882     cpuinfo self
10      110     1214    14      225     490     6       7       8       9       curproc uptime
1083    1115    1247    162     233     5       631     725     821     914     devices
1084    1118    1267    165     3       502     663     730     84      96      meminfo
njoly@cixy [linux/proc]> ls cpuinfo
ls: cpuinfo: No such file or directory
njoly@cixy [linux/proc]> ls -l >/dev/null
ls: cpuinfo: No such file or directory
ls: devices: No such file or directory
ls: meminfo: No such file or directory
ls: mounts: No such file or directory
ls: uptime: No such file or directory

[...]
  1392      1 ls       CALL  __lstat30(0x8055d4c,0x8055d58)
  1392      1 ls       NAMI  "meminfo"
  1392      1 ls       RET   __lstat30 -1 errno 2 No such file or directory
  1392      1 ls       CALL  __lstat30(0x8055e4c,0x8055e58)
  1392      1 ls       NAMI  "cpuinfo"
  1392      1 ls       RET   __lstat30 -1 errno 2 No such file or directory
  1392      1 ls       CALL  __lstat30(0x8055f4c,0x8055f54)
  1392      1 ls       NAMI  "uptime"
  1392      1 ls       RET   __lstat30 -1 errno 2 No such file or directory
[...]

njoly@cixy [linux/proc]> ident /netbsd | grep procfs
     $NetBSD: procfs_cmdline.c,v 1.26 2007/02/17 22:31:44 pavel Exp $
     $NetBSD: procfs_ctl.c,v 1.39 2007/02/09 21:55:36 ad Exp $
     $NetBSD: procfs_fd.c,v 1.11 2007/02/09 21:55:36 ad Exp $
     $NetBSD: procfs_fpregs.c,v 1.17 2006/11/16 01:33:38 christos Exp $
     $NetBSD: procfs_linux.c,v 1.32 2007/02/09 21:55:36 ad Exp $
     $NetBSD: procfs_map.c,v 1.29 2007/02/17 22:31:44 pavel Exp $
     $NetBSD: procfs_mem.c,v 1.37 2006/11/16 01:33:38 christos Exp $
     $NetBSD: procfs_note.c,v 1.15 2006/11/16 01:33:38 christos Exp $
     $NetBSD: procfs_regs.c,v 1.23 2006/11/16 01:33:38 christos Exp $
     $NetBSD: procfs_status.c,v 1.31 2007/02/17 22:31:44 pavel Exp $
     $NetBSD: procfs_subr.c,v 1.77 2007/02/17 22:31:44 pavel Exp $
     $NetBSD: procfs_vfsops.c,v 1.70 2007/02/09 21:55:36 ad Exp $
     $NetBSD: procfs_vnops.c,v 1.149 2007/02/17 22:31:44 pavel Exp $
     $NetBSD: procfs_machdep.c,v 1.25 2006/11/16 01:32:38 christos Exp $

Thanks.

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.