[873] in NetBSD-Development
union file system botches permissions on copy-up files
daemon@ATHENA.MIT.EDU (jtk@kolvir.blrc.ma.us)
Mon Jul 10 19:56:58 1995
Date: Mon, 10 Jul 1995 19:55:57 -0400
To: gnats-bugs@NetBSD.ORG
Cc: jtk@kolvir.blrc.ma.us, netbsd-dev@MIT.EDU
From: jtk@kolvir.blrc.ma.us
Reply-To: jtk@kolvir.blrc.ma.us
>Submitter-Id: net
>Originator: John T Kohl
>Organization:
NetBSD Kernel Hackers `R` Us
>Confidential: no
>Synopsis: the union FS doesn't get permissions on copied-up files
>Severity: serious
>Priority: medium
>Category: kern
>Class: sw-bug
>Release: -current, 5 July 1995
>Environment:
System: NetBSD lola-granola 1.0A NetBSD 1.0A (LOLA) #57: Sun Jun 11 23:51:12 EDT 1995 mycroft@lola-granola:/afs/sipb.mit.edu/project/netbsd/dev/current-source/src/sys/arch/i386/compile/LOLA i386
>Description:
When you do something that induces a copyup of a file in the union file
system, the union_copyup() routine does not set the mode bits/etc of the
file to match the copied-up file. In particular, it never copies up
execute bits.
>How-To-Repeat:
Mount with the union FS. Induce a copyup on a file with execute bits
set. Look at the upper and lower perms, and notice they don't match:
% ls -l upper-level lower-level
lower-level:
total 16
-rwxr-xr-x 1 jtkohl wheel 16384 Jul 10 19:53 man
upper-level:
% mount -t union upper-level lower-level
% mount |grep union
<above>:/u1/var/tmp/upper-level on /u1/var/tmp/lower-level type union (local, nodev, nosuid)
% cd lower-level
% ls -l
total 16
-rwxr-xr-x 1 jtkohl wheel 16384 Jul 10 19:53 man
% cat /etc/motd >>man
% ls -l
total 17
-rw-r--r-- 1 jtkohl wheel 16457 Jul 10 19:54 man
>Fix:
There should probably be some variety of VOP_SETATTR() call inside
union_copyup(). Since the upper layer must support whiteouts, that
means (for now) it's always 4.4BSD FFS and it's quite easy to set any
attributes required. The hard part (which I haven't thought about yet)
is exactly which attributes should be copied, and which should be set
explicitly based on the user's identity and the mounting user's
identity.