execution from unionfs issue

Bastiaan Welmers bastiaanpu at welmers.net
Mon Jun 5 20:34:41 UTC 2006


Hi,

I was wondering the following behavior from a unionfs mounted tree was
normal or a bug:

When mounting a tree on a directory as lower layer and I execute a
binary from the lower layer, it will create a non-executable copy of the
binary file on the upper layer:

# mkdir /tmp/bin

# mount -t unionfs -o -b /bin /tmp/bin

# cd /tmp/bin

# ./ls -l
....
-r-xr-xr-x  1 root  wheel   24232 30 mei 04:06 ls

# ./ls -l
./ls: Permission denied

# /bin/ls -l
....
-rw-r--r--  1 root  wheel  24232  5 jun 22:23 ls

# cd /

# umount /tmp/bin

# ls -l /tmp/bin
-rw-r--r--  1 root  wheel  24232  5 jun 22:23 ls

using -b or not (inversing upper/lower layer or not) does not matter,
without -b same problem (when mounting /tmp/bin on /bin this time).

It look likes when executing files it will try to open it read-write or
something (for updating access time?) and unionfs creates a new
(non-executable) copy on the upper layer. 
I don't know this is desirable behavior or not in general, to me it
isn't at least. (I use it to provide basic userland for jails) I found
the "noatime" mount option helps to resolve the problem, but I can't find
this in any documentation.

I'm using FreeBSD 6.1-RELEASE i386 GENERIC.

/Bastiaan


More information about the freebsd-fs mailing list