Subject: Re: procfs_readdir partially broken with linux compat flag
To: Chavdar Ivanov <ci4ic4@gmail.com>
From: Nicolas Joly <njoly@pasteur.fr>
List: current-users
Date: 12/04/2006 20:48:52
On Mon, Dec 04, 2006 at 07:13:32PM +0000, Chavdar Ivanov wrote:
> On 12/4/06, Nicolas Joly <njoly@pasteur.fr> wrote:
> >
> >Hi,
> >
> >I, and some others, recently noticed that procfs with compat linux
> >flag enabled do not show linux specific files anymore during root
> >directory listing.
> >
> >njoly@lanfeust [~]> mount -vv | grep proc
> >procfs on /usr/pkg/emul/linux/proc type procfs (local, fsid: 
> >0x1b02/0x1ae1b, reads: sync 0 async 0, writes: sync 0 async 0, [procfs: 
> >version=1, flags=0x1<linuxcompat>])
> >
> >njoly@lanfeust [~]> ls -l /usr/pkg/emul/linux/proc | grep cpuinfo
> >njoly@lanfeust [~]> ls -l /usr/pkg/emul/linux/proc/cpuinfo
> >-r--r--r--  1 root  wheel  0 Dec  4 17:08 /usr/pkg/emul/linux/proc/cpuinfo
> 
> However:
> 
> lisa# uname -a
> NetBSD lisa 4.99.5 NetBSD 4.99.5 (LISA.MPACPI) #4: Sun Dec  3 12:40:46
> GMT 2006  root@lisa:/usr/obj/sys/arch/i386/compile/LISA.MPACPI i386
> lisa# cat /usr/pkg/emul/linux/proc/cpuinfo
> processor       : 0
> vendor_id       : GenuineIntel
[...]
> cpuid level     : 10
> wp              : yes
> flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
> mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm 31
> 
> so it's only the ls which does not work.

Yes. This file existed, but was never reported by `procfs_readdir()'
... and only programs using that function, such as ls, show the
problem.

This problem fixed (thanks christos), i do hit another one ... Your
example does not work for non-root users anymore, where it used to be.

njoly@lanfeust [~]> ls -l /emul/linux/proc | grep cpuinfo
-r--r--r--  1 root     wheel      0 Dec  4 20:30 cpuinfo
njoly@lanfeust [~]> cat /emul/linux/proc/cpuinfo 
cat: /emul/linux/proc/cpuinfo: Operation not permitted

[...]
   815      1 cat      CALL  read(3,0x504000,0x10000)
   815      1 cat      RET   read -1 errno 1 Operation not permitted
[...]

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.