Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Don't allow MNT_UNION on the root, there is no cove...



details:   https://anonhg.NetBSD.org/src/rev/7e69bf284be1
branches:  trunk
changeset: 449019:7e69bf284be1
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Tue Feb 19 06:55:28 2019 +0000

description:
Don't allow MNT_UNION on the root, there is no covered filesystem.

Fixes PR 53850

diffstat:

 sys/kern/vfs_syscalls.c |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 602f08c32c8e -r 7e69bf284be1 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Tue Feb 19 05:47:08 2019 +0000
+++ b/sys/kern/vfs_syscalls.c   Tue Feb 19 06:55:28 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.c,v 1.524 2019/02/05 13:50:10 kamil Exp $ */
+/*     $NetBSD: vfs_syscalls.c,v 1.525 2019/02/19 06:55:28 mlelstv Exp $       */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.524 2019/02/05 13:50:10 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.525 2019/02/19 06:55:28 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -278,6 +278,15 @@
                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 == NULLVP) {
+               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)



Home | Main Index | Thread Index | Old Index