[Mono-dev] Mono requires /proc to be mounted

Alex Shulgin alexander.shulgin at yessoftware.com
Fri Sep 25 07:23:41 EDT 2009


Jonathan Pryor wrote:
> On Thu, 2009-09-24 at 12:55 -0400, Ryan Bair wrote:
>> Chroots commonly have bind mounts to /proc and /dev.  ie mount -o
>> bind /proc /path/to/chroot/proc
>>
>> I'm not sure if Mono on Linux depends on proc being there or not, but
>> there is one really easy way to find out.
> 
> And the answer is...it depends.  OS X doesn't have /proc, so (1) Mono
> itself will run w/o /proc, but...  (2) some parts of the class library
> will NOT work.  For example, Process.GetProcesses() will generate a
> NullReferenceException, because EnumProcesses() requires /proc (see
> mono/io-layer/processes.c).
> 
> So it depends entirely on which parts of the class library you're using.

I'm on Linux.

The question is: is it worth trying to disable startup check on 
availability of /proc and see what happens next?

I'm concerned on security so allowing full /proc in chroot is not very 
pleasant for me.

I see these usage cases of /proc in mono:

1. /proc/self/maps is used by libgc/os_dep.c to find writable data segments.

=> I can try to set GC_DONT_GC, since my app is meant to run for a few 
seconds and exit.

2. /proc/self/exe is used in mono/metadata/assembly.c to set root dirs.

=> I use bundled assemblies, so this one can be possibly ignored.

3. /proc/cpuinfo is used in libgc/pthread_support.c to determine the 
number of processors.

=> This one can be easily fooled with cat /proc/cpuinfo 
 >/path/to/chroot/proc/cpuinfo.

So I think I'll give it a try. :)

--
Regards,
Alex



More information about the Mono-devel-list mailing list