execution from unionfs issue

Scott Long scottl at samsco.org
Tue Jun 6 01:14:09 UTC 2006


Bastiaan Welmers wrote:
> 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.
> 

The copy is created in the upper so that the access time can be updated.
This is intentional.  The permission that the upper copy is created with
is obviously wrong though.  I would have thought that the copy node
would have the same attributes and access properties of original node.
Do try the new-and-improved unionfs patches that the sibling post
refered to.  If it still doesn't work, then I imagine that GOTO-san
would be happy to help fix it.

Scott


More information about the freebsd-fs mailing list