From owner-svn-src-stable-11@freebsd.org Fri Jun 19 11:45:13 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BD18348669; Fri, 19 Jun 2020 11:45:13 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49pH6c6X07z3yCg; Fri, 19 Jun 2020 11:45:12 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BCB001A8AC; Fri, 19 Jun 2020 11:45:12 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05JBjCFu009865; Fri, 19 Jun 2020 11:45:12 GMT (envelope-from freqlabs@FreeBSD.org) Received: (from freqlabs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05JBjCEQ009817; Fri, 19 Jun 2020 11:45:12 GMT (envelope-from freqlabs@FreeBSD.org) Message-Id: <202006191145.05JBjCEQ009817@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: freqlabs set sender to freqlabs@FreeBSD.org using -f From: Ryan Moeller Date: Fri, 19 Jun 2020 11:45:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r362375 - in stable: 11/sys/kern 12/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: freqlabs X-SVN-Commit-Paths: in stable: 11/sys/kern 12/sys/kern X-SVN-Commit-Revision: 362375 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2020 11:45:13 -0000 Author: freqlabs Date: Fri Jun 19 11:45:12 2020 New Revision: 362375 URL: https://svnweb.freebsd.org/changeset/base/362375 Log: MFC r362252: Apply default security flavor in vfs_export Reported by: npn Reviewed by: rmacklem Approved by: mav (mentor) Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D25300 Modified: stable/11/sys/kern/vfs_export.c stable/11/sys/kern/vfs_mount.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/kern/vfs_export.c stable/12/sys/kern/vfs_mount.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/kern/vfs_export.c ============================================================================== --- stable/11/sys/kern/vfs_export.c Fri Jun 19 11:32:42 2020 (r362374) +++ stable/11/sys/kern/vfs_export.c Fri Jun 19 11:45:12 2020 (r362375) @@ -59,6 +59,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + static MALLOC_DEFINE(M_NETADDR, "export_host", "Export host address structure"); static struct radix_node_head *vfs_create_addrlist_af( @@ -303,7 +306,7 @@ vfs_export(struct mount *mp, struct export_args *argp) return (EINVAL); if ((argp->ex_flags & MNT_EXPORTED) != 0 && - (argp->ex_numsecflavors <= 0 + (argp->ex_numsecflavors < 0 || argp->ex_numsecflavors >= MAXSECFLAVORS)) return (EINVAL); @@ -340,6 +343,10 @@ vfs_export(struct mount *mp, struct export_args *argp) MNT_ILOCK(mp); mp->mnt_flag |= MNT_EXPUBLIC; MNT_IUNLOCK(mp); + } + if (argp->ex_numsecflavors == 0) { + argp->ex_numsecflavors = 1; + argp->ex_secflavors[0] = AUTH_SYS; } if ((error = vfs_hang_addrlist(mp, nep, argp))) goto out; Modified: stable/11/sys/kern/vfs_mount.c ============================================================================== --- stable/11/sys/kern/vfs_mount.c Fri Jun 19 11:32:42 2020 (r362374) +++ stable/11/sys/kern/vfs_mount.c Fri Jun 19 11:45:12 2020 (r362375) @@ -65,9 +65,6 @@ __FBSDID("$FreeBSD$"); #include -#include -#include - #include #include @@ -2056,18 +2053,13 @@ kernel_vmount(int flags, ...) * Convert the old export args format into new export args. * * The old export args struct does not have security flavors. Otherwise, the - * structs are identical. The default security flavor 'sys' is applied when - * the given args export the filesystem. + * structs are identical. The default security flavor 'sys' is applied by + * vfs_export when .ex_numsecflavors is 0. */ void vfs_oexport_conv(const struct oexport_args *oexp, struct export_args *exp) { bcopy(oexp, exp, sizeof(*oexp)); - if (exp->ex_flags & MNT_EXPORTED) { - exp->ex_numsecflavors = 1; - exp->ex_secflavors[0] = AUTH_SYS; - } else { - exp->ex_numsecflavors = 0; - } + exp->ex_numsecflavors = 0; }