NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/53850: mount(2) with MNT_UNION | MNT_UPDATE will lead to panic



The following reply was made to PR kern/53850; it has been noted by GNATS.

From: mlelstv%serpens.de@localhost (Michael van Elst)
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/53850: mount(2) with MNT_UNION | MNT_UPDATE will lead to panic
Date: Fri, 11 Jan 2019 06:07:01 -0000 (UTC)

 n54%gmx.com@localhost (Kamil Rytarowski) writes:
 
 > >  On Thu, Jan 10, 2019 at 03:45:00AM +0000, n54%gmx.com@localhost wrote:
 > >   > Updating a mounted partition to MNT_UNION will lead to a panic.
 
 > >  I kinda think MNT_UPDATE ought not to be allowed to turn MNT_UNION on
 > >  and off, but if it otherwise works...
 
 
 MNT_UNION is just a flag that makes the mount interpreted differently.
 I don't think there is something intrinsic that it must not be set.
 
 The problem here is that MNT_UNION is enabled for the root which is
 not mounted on some existing vnode, thus mnt_coveredvnode is VPNULL.
 
 In this case MNT_UNION doesn't make sense anyway, there is no lower
 filesystem that could be visible through the root mount.
 
 So either:
 - make checks for MNT_UNION aware of VPNULL and ignore the flag,
   there are 3 cases that do this.
 
 Or:
 - don't allow an update to set MNT_UNION if there is no covered
   filesystem.
 
 So maybe:
 
 --- vfs_syscalls.c      9 Jan 2018 03:31:13 -0000       1.518
 +++ vfs_syscalls.c      11 Jan 2019 06:05:13 -0000
 @@ -278,6 +278,15 @@ mount_update(struct lwp *l, struct vnode
                 goto out;
         }
  
 +       /*
 +        * Enabling MNT_UNION requires a covered mountpoint and
 +        * must not happen on the root mount.
 +        */
 +       if ((flags & MNT_UNION) != 0 && mp->mnt_vnodecovered == VPNULL) {
 +               error = EOPNOTSUPP;
 +               goto out;
 +       }
 +
         error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_MOUNT,
             KAUTH_REQ_SYSTEM_MOUNT_UPDATE, mp, KAUTH_ARG(flags), data);
         if (error)
 
 -- 
 -- 
                                 Michael van Elst
 Internet: mlelstv%serpens.de@localhost
                                 "A potential Snark may lurk in every tree."
 


Home | Main Index | Thread Index | Old Index