From owner-svn-src-stable@freebsd.org Sun Feb 9 19:20:21 2020 Return-Path: Delivered-To: svn-src-stable@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 80CC123F9A6; Sun, 9 Feb 2020 19:20:21 +0000 (UTC) (envelope-from kevans@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) server-signature RSA-PSS (4096 bits) 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 48FzQF2rbHz4RGg; Sun, 9 Feb 2020 19:20:21 +0000 (UTC) (envelope-from kevans@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 5D10AAFCA; Sun, 9 Feb 2020 19:20:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 019JKLTT066794; Sun, 9 Feb 2020 19:20:21 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 019JKL73066793; Sun, 9 Feb 2020 19:20:21 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202002091920.019JKL73066793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 9 Feb 2020 19:20:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357704 - stable/12/usr.bin/wc X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/usr.bin/wc X-SVN-Commit-Revision: 357704 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Feb 2020 19:20:21 -0000 Author: kevans Date: Sun Feb 9 19:20:20 2020 New Revision: 357704 URL: https://svnweb.freebsd.org/changeset/base/357704 Log: MFC r357572: wc(1): account for possibility of file == NULL file could reasonably be NULL here if we we're using stdin. Albeit less likely in normal usage, one could actually hit either of these warnings on stdin. Modified: stable/12/usr.bin/wc/wc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/wc/wc.c ============================================================================== --- stable/12/usr.bin/wc/wc.c Sun Feb 9 18:53:53 2020 (r357703) +++ stable/12/usr.bin/wc/wc.c Sun Feb 9 19:20:20 2020 (r357704) @@ -218,7 +218,7 @@ cnt(const char *file) */ if (doline == 0 && dolongline == 0) { if (fstat(fd, &sb)) { - xo_warn("%s: fstat", file); + xo_warn("%s: fstat", file != NULL ? file : "stdin"); (void)close(fd); return (1); } @@ -239,7 +239,7 @@ cnt(const char *file) */ while ((len = read(fd, buf, MAXBSIZE))) { if (len == -1) { - xo_warn("%s: read", file); + xo_warn("%s: read", file != NULL ? file : "stdin"); (void)close(fd); return (1); } From owner-svn-src-stable@freebsd.org Sun Feb 9 22:15:38 2020 Return-Path: Delivered-To: svn-src-stable@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 CC75F244595; Sun, 9 Feb 2020 22:15:38 +0000 (UTC) (envelope-from kevans@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) server-signature RSA-PSS (4096 bits) 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 48G3JV5MVJz4cGb; Sun, 9 Feb 2020 22:15:38 +0000 (UTC) (envelope-from kevans@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 9A293D369; Sun, 9 Feb 2020 22:15:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 019MFcJn074732; Sun, 9 Feb 2020 22:15:38 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 019MFZIX074717; Sun, 9 Feb 2020 22:15:35 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202002092215.019MFZIX074717@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 9 Feb 2020 22:15:35 +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: r357706 - in stable: 11/contrib/netbsd-tests/lib/libc/c063 11/lib/libc/sys 11/lib/libc/tests/c063 11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 11/sys/fs/devfs 11/sys/fs/fuse 11/sys... X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/contrib/netbsd-tests/lib/libc/c063 11/lib/libc/sys 11/lib/libc/tests/c063 11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 11/sys/fs/devfs 11/sys/fs/fuse 11/sys/fs/nfsclient 11/sys/fs/s... X-SVN-Commit-Revision: 357706 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Feb 2020 22:15:38 -0000 Author: kevans Date: Sun Feb 9 22:15:35 2020 New Revision: 357706 URL: https://svnweb.freebsd.org/changeset/base/357706 Log: MFC O_SEARCH: r357412, r357461, r357580, r357584, r357636, r357671, r357688 r357412: Provide O_SEARCH O_SEARCH is defined by POSIX [0] to open a directory for searching, skipping permissions checks on the directory itself after the initial open(). This is close to the semantics we've historically applied for O_EXEC on a directory, which is UB according to POSIX. Conveniently, O_SEARCH on a file is also explicitly undefined behavior according to POSIX, so O_EXEC would be a fine choice. The spec goes on to state that O_SEARCH and O_EXEC need not be distinct values, but they're not defined to be the same value. This was pointed out as an incompatibility with other systems that had made its way into libarchive, which had assumed that O_EXEC was an alias for O_SEARCH. This defines compatibility O_SEARCH/FSEARCH (equivalent to O_EXEC and FEXEC respectively) and expands our UB for O_EXEC on a directory. O_EXEC on a directory is checked in vn_open_vnode already, so for completeness we add a NOEXECCHECK when O_SEARCH has been specified on the top-level fd and do not re-check that when descending in namei. [0] https://pubs.opengroup.org/onlinepubs/9699919799/ r357461: namei: preserve errors from fget_cap_locked Most notably, we want to make sure we don't clobber any capabilities-related errors. This is a regression from r357412 (O_SEARCH) that was picked up by the capsicum tests. r357580: O_SEARCH test: drop O_SEARCH|O_RDWR local diff In FreeBSD's O_SEARCH implementation, O_SEARCH in conjunction with O_RDWR or O_WRONLY is explicitly rejected. In this case, O_RDWR was not necessary anyways as the file will get created with or without it. This was submitted upstream as misc/54940 and committed in rev 1.8 of the file. r357584: Record-only MFV of r357583: netbsd-tests: import upstreamed changes The changes in question originated in FreeBSD/head; no further action is required. r357636: MFV r357635: imnport v1.9 of the O_SEARCH tests The RCSID data was wrong, so this is effectively a record-only merge with correction of said data. No further changes should be needed in this area, as we've now upstreamed our local changes to this specific test. r357671: O_SEARCH test: mark revokex an expected fail on NFS The revokex test does not work when the scratch directory is created on NFS. Given the nature of NFS, it likely can never work without looking like a security hole since O_SEARCH would rely on the server knowing that the directory did have +x at the time of open and that it's OK for it to have been revoked based on POSIX specification for O_SEARCH. This does mean that O_SEARCH is only partially functional on NFS in general, but I suspect the execute bit getting revoked in the process is likely not common. r357688: MFV r357687: Import NFS fix for O_SEARCH tests The version that ended upstream was ultimately slightly different than the version committed here; notably, statvfs() is used but it's redefined appropriately to statfs() on FreeBSD since we don't provide the fstypename for the former interface. Modified: stable/11/contrib/netbsd-tests/lib/libc/c063/t_o_search.c stable/11/lib/libc/sys/open.2 stable/11/lib/libc/tests/c063/Makefile stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/11/sys/fs/devfs/devfs_vnops.c stable/11/sys/fs/fuse/fuse_vnops.c stable/11/sys/fs/nfsclient/nfs_clvnops.c stable/11/sys/fs/smbfs/smbfs_vnops.c stable/11/sys/fs/tmpfs/tmpfs_vnops.c stable/11/sys/kern/vfs_cache.c stable/11/sys/kern/vfs_lookup.c stable/11/sys/kern/vfs_subr.c stable/11/sys/sys/fcntl.h stable/11/sys/sys/namei.h stable/11/sys/sys/vnode.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/netbsd-tests/lib/libc/c063/t_o_search.c stable/12/lib/libc/sys/open.2 stable/12/lib/libc/tests/c063/Makefile stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/12/sys/fs/devfs/devfs_vnops.c stable/12/sys/fs/fuse/fuse_vnops.c stable/12/sys/fs/nfsclient/nfs_clvnops.c stable/12/sys/fs/smbfs/smbfs_vnops.c stable/12/sys/fs/tmpfs/tmpfs_vnops.c stable/12/sys/kern/vfs_cache.c stable/12/sys/kern/vfs_lookup.c stable/12/sys/kern/vfs_subr.c stable/12/sys/sys/fcntl.h stable/12/sys/sys/namei.h stable/12/sys/sys/vnode.h Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/c063/t_o_search.c ============================================================================== --- stable/11/contrib/netbsd-tests/lib/libc/c063/t_o_search.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/11/contrib/netbsd-tests/lib/libc/c063/t_o_search.c Sun Feb 9 22:15:35 2020 (r357706) @@ -1,4 +1,4 @@ -/* $NetBSD: t_o_search.c,v 1.5 2017/01/10 22:25:01 christos Exp $ */ +/* $NetBSD: t_o_search.c,v 1.10 2020/02/08 19:58:36 kamil Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -29,13 +29,16 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_o_search.c,v 1.5 2017/01/10 22:25:01 christos Exp $"); +__RCSID("$NetBSD: t_o_search.c,v 1.10 2020/02/08 19:58:36 kamil Exp $"); #include -#include +#include +#include +#include #include +#include #include #include #include @@ -50,10 +53,15 @@ __RCSID("$NetBSD: t_o_search.c,v 1.5 2017/01/10 22:25: * until a decision is reached about the semantics of O_SEARCH and a * non-broken implementation is available. */ -#if (O_MASK & O_SEARCH) != 0 +#if defined(__FreeBSD__) || (O_MASK & O_SEARCH) != 0 #define USE_O_SEARCH #endif +#ifdef __FreeBSD__ +#define statvfs statfs +#define fstatvfs fstatfs +#endif + #define DIR "dir" #define FILE "dir/o_search" #define BASEFILE "o_search" @@ -257,12 +265,82 @@ ATF_TC_BODY(o_search_notdir, tc) int fd; ATF_REQUIRE(mkdir(DIR, 0755) == 0); - ATF_REQUIRE((dfd = open(FILE, O_CREAT|O_RDWR|O_SEARCH, 0644)) != -1); + ATF_REQUIRE((dfd = open(FILE, O_CREAT|O_SEARCH, 0644)) != -1); ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) == -1); ATF_REQUIRE(errno == ENOTDIR); ATF_REQUIRE(close(dfd) == 0); } +#ifdef USE_O_SEARCH +ATF_TC(o_search_nord); +ATF_TC_HEAD(o_search_nord, tc) +{ + atf_tc_set_md_var(tc, "descr", "See that openat succeeds with no read permission"); + atf_tc_set_md_var(tc, "require.user", "unprivileged"); +} +ATF_TC_BODY(o_search_nord, tc) +{ + int dfd, fd; + + ATF_REQUIRE(mkdir(DIR, 0755) == 0); + ATF_REQUIRE((fd = open(FILE, O_CREAT|O_RDWR, 0644)) != -1); + ATF_REQUIRE(close(fd) == 0); + + ATF_REQUIRE(chmod(DIR, 0100) == 0); + ATF_REQUIRE((dfd = open(DIR, O_SEARCH, 0)) != -1); + + ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) != -1); + + ATF_REQUIRE(close(dfd) == 0); +} + +ATF_TC(o_search_getdents); +ATF_TC_HEAD(o_search_getdents, tc) +{ + atf_tc_set_md_var(tc, "descr", "See that O_SEARCH forbids getdents"); +} +ATF_TC_BODY(o_search_getdents, tc) +{ + char buf[1024]; + int dfd; + + ATF_REQUIRE(mkdir(DIR, 0755) == 0); + ATF_REQUIRE((dfd = open(DIR, O_SEARCH, 0)) != -1); + ATF_REQUIRE(getdents(dfd, buf, sizeof(buf)) < 0); + ATF_REQUIRE(close(dfd) == 0); +} + +ATF_TC(o_search_revokex); +ATF_TC_HEAD(o_search_revokex, tc) +{ + atf_tc_set_md_var(tc, "descr", "See that *at behaves after chmod -x"); + atf_tc_set_md_var(tc, "require.user", "unprivileged"); +} +ATF_TC_BODY(o_search_revokex, tc) +{ + struct statvfs vst; + struct stat sb; + int dfd, fd; + + ATF_REQUIRE(mkdir(DIR, 0755) == 0); + ATF_REQUIRE((fd = open(FILE, O_CREAT|O_RDWR, 0644)) != -1); + ATF_REQUIRE(close(fd) == 0); + + ATF_REQUIRE((dfd = open(DIR, O_SEARCH, 0)) != -1); + + /* Drop permissions. The kernel must still not check the exec bit. */ + ATF_REQUIRE(chmod(DIR, 0000) == 0); + + fstatvfs(dfd, &vst); + if (strcmp(vst.f_fstypename, "nfs") == 0) + atf_tc_expect_fail("NFS protocol cannot observe O_SEARCH semantics"); + + ATF_REQUIRE(fstatat(dfd, BASEFILE, &sb, 0) == 0); + + ATF_REQUIRE(close(dfd) == 0); +} +#endif /* USE_O_SEARCH */ + ATF_TP_ADD_TCS(tp) { @@ -277,6 +355,11 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, o_search_unpriv_flag2); #endif ATF_TP_ADD_TC(tp, o_search_notdir); +#ifdef USE_O_SEARCH + ATF_TP_ADD_TC(tp, o_search_nord); + ATF_TP_ADD_TC(tp, o_search_getdents); + ATF_TP_ADD_TC(tp, o_search_revokex); +#endif return atf_no_error(); } Modified: stable/11/lib/libc/sys/open.2 ============================================================================== --- stable/11/lib/libc/sys/open.2 Sun Feb 9 22:05:41 2020 (r357705) +++ stable/11/lib/libc/sys/open.2 Sun Feb 9 22:15:35 2020 (r357706) @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd September 17, 2019 +.Dd February 9, 2020 .Dt OPEN 2 .Os .Sh NAME @@ -126,6 +126,7 @@ O_RDONLY open for reading only O_WRONLY open for writing only O_RDWR open for reading and writing O_EXEC open for execute only +O_SEARCH open for search only, an alias for O_EXEC O_NONBLOCK do not block on open O_APPEND append on each write O_CREAT create file if it does not exist @@ -266,6 +267,19 @@ means is implementation specific. The run-time linker (rtld) uses this flag to ensure shared objects have been verified before operating on them. .Pp +When +.Fa fd +is opened with +.Dv O_SEARCH , +execute permissions are checked at open time. +The +.Fa fd +may not be used for any read operations like +.Xr getdirentries 2 . +The primary use for this descriptor will be as the lookup descriptor for the +.Fn *at +family of functions. +.Pp If successful, .Fn open returns a non-negative integer, termed a file descriptor. @@ -458,9 +472,12 @@ An attempt was made to open a descriptor with an illeg of .Dv O_RDONLY , .Dv O_WRONLY , -.Dv O_RDWR +or +.Dv O_RDWR , and -.Dv O_EXEC . +.Dv O_EXEC +or +.Dv O_SEARCH . .It Bq Er EBADF The .Fa path Modified: stable/11/lib/libc/tests/c063/Makefile ============================================================================== --- stable/11/lib/libc/tests/c063/Makefile Sun Feb 9 22:05:41 2020 (r357705) +++ stable/11/lib/libc/tests/c063/Makefile Sun Feb 9 22:15:35 2020 (r357706) @@ -1,7 +1,5 @@ # $FreeBSD$ -#TODO: t_o_search - NETBSD_ATF_TESTS_C= faccessat_test NETBSD_ATF_TESTS_C+= fchmodat_test NETBSD_ATF_TESTS_C+= fchownat_test @@ -11,6 +9,7 @@ NETBSD_ATF_TESTS_C+= linkat_test NETBSD_ATF_TESTS_C+= mkdirat_test NETBSD_ATF_TESTS_C+= mkfifoat_test NETBSD_ATF_TESTS_C+= mknodat_test +NETBSD_ATF_TESTS_C+= o_search_test NETBSD_ATF_TESTS_C+= openat_test NETBSD_ATF_TESTS_C+= readlinkat_test NETBSD_ATF_TESTS_C+= renameat_test Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Feb 9 22:15:35 2020 (r357706) @@ -1598,10 +1598,14 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, stru * Check accessibility of directory. */ if (!cached) { - error = zfs_zaccess(zdp, ACE_EXECUTE, 0, B_FALSE, cr); - if (error != 0) { - ZFS_EXIT(zfsvfs); - return (error); + if ((cnp->cn_flags & NOEXECCHECK) != 0) { + cnp->cn_flags &= ~NOEXECCHECK; + } else { + error = zfs_zaccess(zdp, ACE_EXECUTE, 0, B_FALSE, cr); + if (error != 0) { + ZFS_EXIT(zfsvfs); + return (error); + } } } Modified: stable/11/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/11/sys/fs/devfs/devfs_vnops.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/11/sys/fs/devfs/devfs_vnops.c Sun Feb 9 22:15:35 2020 (r357706) @@ -902,8 +902,8 @@ devfs_lookupx(struct vop_lookup_args *ap, int *dm_unlo if ((flags & ISDOTDOT) && (dvp->v_vflag & VV_ROOT)) return (EIO); - error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td); - if (error) + error = vn_dir_check_exec(dvp, cnp); + if (error != 0) return (error); if (cnp->cn_namelen == 1 && *pname == '.') { Modified: stable/11/sys/fs/fuse/fuse_vnops.c ============================================================================== --- stable/11/sys/fs/fuse/fuse_vnops.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/11/sys/fs/fuse/fuse_vnops.c Sun Feb 9 22:15:35 2020 (r357706) @@ -699,7 +699,10 @@ fuse_vnop_lookup(struct vop_lookup_args *ap) bzero(&facp, sizeof(facp)); if (vnode_isvroot(dvp)) { /* early permission check hack */ - if ((err = fuse_internal_access(dvp, VEXEC, &facp, td, cred))) { + if ((cnp->cn_flags & NOEXECCHECK) != 0) { + cnp->cn_flags &= ~NOEXECCHECK; + } else if ((err = fuse_internal_access(dvp, VEXEC, &facp, td, + cred))) { return err; } } Modified: stable/11/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clvnops.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/11/sys/fs/nfsclient/nfs_clvnops.c Sun Feb 9 22:15:35 2020 (r357706) @@ -1049,7 +1049,8 @@ nfs_lookup(struct vop_lookup_args *ap) } mtx_unlock(&np->n_mtx); - if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td)) != 0) + error = vn_dir_check_exec(dvp, cnp); + if (error != 0) return (error); error = cache_lookup(dvp, vpp, cnp, &nctime, &ncticks); if (error > 0 && error != ENOENT) Modified: stable/11/sys/fs/smbfs/smbfs_vnops.c ============================================================================== --- stable/11/sys/fs/smbfs/smbfs_vnops.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/11/sys/fs/smbfs/smbfs_vnops.c Sun Feb 9 22:15:35 2020 (r357706) @@ -1196,7 +1196,8 @@ smbfs_lookup(ap) islastcn = flags & ISLASTCN; if (islastcn && (mp->mnt_flag & MNT_RDONLY) && (nameiop != LOOKUP)) return EROFS; - if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td)) != 0) + error = vn_dir_check_exec(dvp, cnp); + if (error != 0) return error; smp = VFSTOSMBFS(mp); dnp = VTOSMB(dvp); Modified: stable/11/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vnops.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/11/sys/fs/tmpfs/tmpfs_vnops.c Sun Feb 9 22:15:35 2020 (r357706) @@ -84,7 +84,7 @@ tmpfs_lookup1(struct vnode *dvp, struct vnode **vpp, s *vpp = NULLVP; /* Check accessibility of requested node as a first step. */ - error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, cnp->cn_thread); + error = vn_dir_check_exec(dvp, cnp); if (error != 0) goto out; Modified: stable/11/sys/kern/vfs_cache.c ============================================================================== --- stable/11/sys/kern/vfs_cache.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/11/sys/kern/vfs_cache.c Sun Feb 9 22:15:35 2020 (r357706) @@ -2096,9 +2096,7 @@ vfs_cache_lookup(struct vop_lookup_args *ap) int error; struct vnode **vpp = ap->a_vpp; struct componentname *cnp = ap->a_cnp; - struct ucred *cred = cnp->cn_cred; int flags = cnp->cn_flags; - struct thread *td = cnp->cn_thread; *vpp = NULL; dvp = ap->a_dvp; @@ -2110,8 +2108,8 @@ vfs_cache_lookup(struct vop_lookup_args *ap) (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) return (EROFS); - error = VOP_ACCESS(dvp, VEXEC, cred, td); - if (error) + error = vn_dir_check_exec(dvp, cnp); + if (error != 0) return (error); error = cache_lookup(dvp, vpp, cnp, NULL, NULL); Modified: stable/11/sys/kern/vfs_lookup.c ============================================================================== --- stable/11/sys/kern/vfs_lookup.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/11/sys/kern/vfs_lookup.c Sun Feb 9 22:15:35 2020 (r357706) @@ -288,6 +288,7 @@ namei(struct nameidata *ndp) struct vnode *dp; /* the directory we are searching */ struct iovec aiov; /* uio for reading symbolic links */ struct componentname *cnp; + struct file *dfp; struct thread *td; struct proc *p; cap_rights_t rights; @@ -408,10 +409,29 @@ namei(struct nameidata *ndp) AUDIT_ARG_ATFD1(ndp->ni_dirfd); if (cnp->cn_flags & AUDITVNODE2) AUDIT_ARG_ATFD2(ndp->ni_dirfd); - error = fgetvp_rights(td, ndp->ni_dirfd, - &rights, &ndp->ni_filecaps, &dp); - if (error == EINVAL) + /* + * Effectively inlined fgetvp_rights, because we need to + * inspect the file as well as grabbing the vnode. + */ + error = fget_cap_locked(fdp, ndp->ni_dirfd, &rights, + &dfp, &ndp->ni_filecaps); + if (error != 0) { + /* + * Preserve the error; it should either be EBADF + * or capability-related, both of which can be + * safely returned to the caller. + */ + } else if (dfp->f_ops == &badfileops) { + error = EBADF; + } else if (dfp->f_vnode == NULL) { error = ENOTDIR; + } else { + dp = dfp->f_vnode; + vrefact(dp); + + if ((dfp->f_flag & FSEARCH) != 0) + cnp->cn_flags |= NOEXECCHECK; + } #ifdef CAPABILITIES /* * If file descriptor doesn't have all rights, Modified: stable/11/sys/kern/vfs_subr.c ============================================================================== --- stable/11/sys/kern/vfs_subr.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/11/sys/kern/vfs_subr.c Sun Feb 9 22:15:35 2020 (r357706) @@ -5485,3 +5485,15 @@ __mnt_vnode_markerfree_active(struct vnode **mvp, stru mtx_unlock(&vnode_free_list_mtx); mnt_vnode_markerfree_active(mvp, mp); } + +int +vn_dir_check_exec(struct vnode *vp, struct componentname *cnp) +{ + + if ((cnp->cn_flags & NOEXECCHECK) != 0) { + cnp->cn_flags &= ~NOEXECCHECK; + return (0); + } + + return (VOP_ACCESS(vp, VEXEC, cnp->cn_cred, cnp->cn_thread)); +} Modified: stable/11/sys/sys/fcntl.h ============================================================================== --- stable/11/sys/sys/fcntl.h Sun Feb 9 22:05:41 2020 (r357705) +++ stable/11/sys/sys/fcntl.h Sun Feb 9 22:15:35 2020 (r357706) @@ -117,9 +117,11 @@ typedef __pid_t pid_t; #if __POSIX_VISIBLE >= 200809 #define O_DIRECTORY 0x00020000 /* Fail if not directory */ #define O_EXEC 0x00040000 /* Open for execute only */ +#define O_SEARCH O_EXEC #endif #ifdef _KERNEL #define FEXEC O_EXEC +#define FSEARCH O_SEARCH #endif #if __POSIX_VISIBLE >= 200809 Modified: stable/11/sys/sys/namei.h ============================================================================== --- stable/11/sys/sys/namei.h Sun Feb 9 22:05:41 2020 (r357705) +++ stable/11/sys/sys/namei.h Sun Feb 9 22:15:35 2020 (r357706) @@ -153,7 +153,8 @@ struct nameidata { #define AUDITVNODE2 0x08000000 /* audit the looked up vnode information */ #define TRAILINGSLASH 0x10000000 /* path ended in a slash */ #define NOCAPCHECK 0x20000000 /* do not perform capability checks */ -#define PARAMASK 0x3ffffe00 /* mask of parameter descriptors */ +#define NOEXECCHECK 0x40000000 /* do not perform exec check on dir */ +#define PARAMASK 0x7ffffe00 /* mask of parameter descriptors */ /* * Flags in ni_lcf, valid for the duration of the namei call. Modified: stable/11/sys/sys/vnode.h ============================================================================== --- stable/11/sys/sys/vnode.h Sun Feb 9 22:05:41 2020 (r357705) +++ stable/11/sys/sys/vnode.h Sun Feb 9 22:15:35 2020 (r357706) @@ -898,6 +898,8 @@ int vn_chmod(struct file *fp, mode_t mode, struct ucre int vn_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred, struct thread *td); +int vn_dir_check_exec(struct vnode *vp, struct componentname *cnp); + #endif /* _KERNEL */ #endif /* !_SYS_VNODE_H_ */ From owner-svn-src-stable@freebsd.org Sun Feb 9 22:15:41 2020 Return-Path: Delivered-To: svn-src-stable@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 E26712445B4; Sun, 9 Feb 2020 22:15:41 +0000 (UTC) (envelope-from kevans@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) server-signature RSA-PSS (4096 bits) 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 48G3JY6TCMz4cGj; Sun, 9 Feb 2020 22:15:41 +0000 (UTC) (envelope-from kevans@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 D91BDD36A; Sun, 9 Feb 2020 22:15:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 019MFfq9074752; Sun, 9 Feb 2020 22:15:41 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 019MFc5q074738; Sun, 9 Feb 2020 22:15:38 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202002092215.019MFc5q074738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 9 Feb 2020 22:15:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357706 - in stable: 11/contrib/netbsd-tests/lib/libc/c063 11/lib/libc/sys 11/lib/libc/tests/c063 11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 11/sys/fs/devfs 11/sys/fs/fuse 11/sys... X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/contrib/netbsd-tests/lib/libc/c063 11/lib/libc/sys 11/lib/libc/tests/c063 11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 11/sys/fs/devfs 11/sys/fs/fuse 11/sys/fs/nfsclient 11/sys/fs/s... X-SVN-Commit-Revision: 357706 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Feb 2020 22:15:42 -0000 Author: kevans Date: Sun Feb 9 22:15:35 2020 New Revision: 357706 URL: https://svnweb.freebsd.org/changeset/base/357706 Log: MFC O_SEARCH: r357412, r357461, r357580, r357584, r357636, r357671, r357688 r357412: Provide O_SEARCH O_SEARCH is defined by POSIX [0] to open a directory for searching, skipping permissions checks on the directory itself after the initial open(). This is close to the semantics we've historically applied for O_EXEC on a directory, which is UB according to POSIX. Conveniently, O_SEARCH on a file is also explicitly undefined behavior according to POSIX, so O_EXEC would be a fine choice. The spec goes on to state that O_SEARCH and O_EXEC need not be distinct values, but they're not defined to be the same value. This was pointed out as an incompatibility with other systems that had made its way into libarchive, which had assumed that O_EXEC was an alias for O_SEARCH. This defines compatibility O_SEARCH/FSEARCH (equivalent to O_EXEC and FEXEC respectively) and expands our UB for O_EXEC on a directory. O_EXEC on a directory is checked in vn_open_vnode already, so for completeness we add a NOEXECCHECK when O_SEARCH has been specified on the top-level fd and do not re-check that when descending in namei. [0] https://pubs.opengroup.org/onlinepubs/9699919799/ r357461: namei: preserve errors from fget_cap_locked Most notably, we want to make sure we don't clobber any capabilities-related errors. This is a regression from r357412 (O_SEARCH) that was picked up by the capsicum tests. r357580: O_SEARCH test: drop O_SEARCH|O_RDWR local diff In FreeBSD's O_SEARCH implementation, O_SEARCH in conjunction with O_RDWR or O_WRONLY is explicitly rejected. In this case, O_RDWR was not necessary anyways as the file will get created with or without it. This was submitted upstream as misc/54940 and committed in rev 1.8 of the file. r357584: Record-only MFV of r357583: netbsd-tests: import upstreamed changes The changes in question originated in FreeBSD/head; no further action is required. r357636: MFV r357635: imnport v1.9 of the O_SEARCH tests The RCSID data was wrong, so this is effectively a record-only merge with correction of said data. No further changes should be needed in this area, as we've now upstreamed our local changes to this specific test. r357671: O_SEARCH test: mark revokex an expected fail on NFS The revokex test does not work when the scratch directory is created on NFS. Given the nature of NFS, it likely can never work without looking like a security hole since O_SEARCH would rely on the server knowing that the directory did have +x at the time of open and that it's OK for it to have been revoked based on POSIX specification for O_SEARCH. This does mean that O_SEARCH is only partially functional on NFS in general, but I suspect the execute bit getting revoked in the process is likely not common. r357688: MFV r357687: Import NFS fix for O_SEARCH tests The version that ended upstream was ultimately slightly different than the version committed here; notably, statvfs() is used but it's redefined appropriately to statfs() on FreeBSD since we don't provide the fstypename for the former interface. Modified: stable/12/contrib/netbsd-tests/lib/libc/c063/t_o_search.c stable/12/lib/libc/sys/open.2 stable/12/lib/libc/tests/c063/Makefile stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/12/sys/fs/devfs/devfs_vnops.c stable/12/sys/fs/fuse/fuse_vnops.c stable/12/sys/fs/nfsclient/nfs_clvnops.c stable/12/sys/fs/smbfs/smbfs_vnops.c stable/12/sys/fs/tmpfs/tmpfs_vnops.c stable/12/sys/kern/vfs_cache.c stable/12/sys/kern/vfs_lookup.c stable/12/sys/kern/vfs_subr.c stable/12/sys/sys/fcntl.h stable/12/sys/sys/namei.h stable/12/sys/sys/vnode.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/netbsd-tests/lib/libc/c063/t_o_search.c stable/11/lib/libc/sys/open.2 stable/11/lib/libc/tests/c063/Makefile stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/11/sys/fs/devfs/devfs_vnops.c stable/11/sys/fs/fuse/fuse_vnops.c stable/11/sys/fs/nfsclient/nfs_clvnops.c stable/11/sys/fs/smbfs/smbfs_vnops.c stable/11/sys/fs/tmpfs/tmpfs_vnops.c stable/11/sys/kern/vfs_cache.c stable/11/sys/kern/vfs_lookup.c stable/11/sys/kern/vfs_subr.c stable/11/sys/sys/fcntl.h stable/11/sys/sys/namei.h stable/11/sys/sys/vnode.h Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/netbsd-tests/lib/libc/c063/t_o_search.c ============================================================================== --- stable/12/contrib/netbsd-tests/lib/libc/c063/t_o_search.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/12/contrib/netbsd-tests/lib/libc/c063/t_o_search.c Sun Feb 9 22:15:35 2020 (r357706) @@ -1,4 +1,4 @@ -/* $NetBSD: t_o_search.c,v 1.5 2017/01/10 22:25:01 christos Exp $ */ +/* $NetBSD: t_o_search.c,v 1.10 2020/02/08 19:58:36 kamil Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -29,13 +29,16 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_o_search.c,v 1.5 2017/01/10 22:25:01 christos Exp $"); +__RCSID("$NetBSD: t_o_search.c,v 1.10 2020/02/08 19:58:36 kamil Exp $"); #include -#include +#include +#include +#include #include +#include #include #include #include @@ -50,10 +53,15 @@ __RCSID("$NetBSD: t_o_search.c,v 1.5 2017/01/10 22:25: * until a decision is reached about the semantics of O_SEARCH and a * non-broken implementation is available. */ -#if (O_MASK & O_SEARCH) != 0 +#if defined(__FreeBSD__) || (O_MASK & O_SEARCH) != 0 #define USE_O_SEARCH #endif +#ifdef __FreeBSD__ +#define statvfs statfs +#define fstatvfs fstatfs +#endif + #define DIR "dir" #define FILE "dir/o_search" #define BASEFILE "o_search" @@ -257,12 +265,82 @@ ATF_TC_BODY(o_search_notdir, tc) int fd; ATF_REQUIRE(mkdir(DIR, 0755) == 0); - ATF_REQUIRE((dfd = open(FILE, O_CREAT|O_RDWR|O_SEARCH, 0644)) != -1); + ATF_REQUIRE((dfd = open(FILE, O_CREAT|O_SEARCH, 0644)) != -1); ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) == -1); ATF_REQUIRE(errno == ENOTDIR); ATF_REQUIRE(close(dfd) == 0); } +#ifdef USE_O_SEARCH +ATF_TC(o_search_nord); +ATF_TC_HEAD(o_search_nord, tc) +{ + atf_tc_set_md_var(tc, "descr", "See that openat succeeds with no read permission"); + atf_tc_set_md_var(tc, "require.user", "unprivileged"); +} +ATF_TC_BODY(o_search_nord, tc) +{ + int dfd, fd; + + ATF_REQUIRE(mkdir(DIR, 0755) == 0); + ATF_REQUIRE((fd = open(FILE, O_CREAT|O_RDWR, 0644)) != -1); + ATF_REQUIRE(close(fd) == 0); + + ATF_REQUIRE(chmod(DIR, 0100) == 0); + ATF_REQUIRE((dfd = open(DIR, O_SEARCH, 0)) != -1); + + ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) != -1); + + ATF_REQUIRE(close(dfd) == 0); +} + +ATF_TC(o_search_getdents); +ATF_TC_HEAD(o_search_getdents, tc) +{ + atf_tc_set_md_var(tc, "descr", "See that O_SEARCH forbids getdents"); +} +ATF_TC_BODY(o_search_getdents, tc) +{ + char buf[1024]; + int dfd; + + ATF_REQUIRE(mkdir(DIR, 0755) == 0); + ATF_REQUIRE((dfd = open(DIR, O_SEARCH, 0)) != -1); + ATF_REQUIRE(getdents(dfd, buf, sizeof(buf)) < 0); + ATF_REQUIRE(close(dfd) == 0); +} + +ATF_TC(o_search_revokex); +ATF_TC_HEAD(o_search_revokex, tc) +{ + atf_tc_set_md_var(tc, "descr", "See that *at behaves after chmod -x"); + atf_tc_set_md_var(tc, "require.user", "unprivileged"); +} +ATF_TC_BODY(o_search_revokex, tc) +{ + struct statvfs vst; + struct stat sb; + int dfd, fd; + + ATF_REQUIRE(mkdir(DIR, 0755) == 0); + ATF_REQUIRE((fd = open(FILE, O_CREAT|O_RDWR, 0644)) != -1); + ATF_REQUIRE(close(fd) == 0); + + ATF_REQUIRE((dfd = open(DIR, O_SEARCH, 0)) != -1); + + /* Drop permissions. The kernel must still not check the exec bit. */ + ATF_REQUIRE(chmod(DIR, 0000) == 0); + + fstatvfs(dfd, &vst); + if (strcmp(vst.f_fstypename, "nfs") == 0) + atf_tc_expect_fail("NFS protocol cannot observe O_SEARCH semantics"); + + ATF_REQUIRE(fstatat(dfd, BASEFILE, &sb, 0) == 0); + + ATF_REQUIRE(close(dfd) == 0); +} +#endif /* USE_O_SEARCH */ + ATF_TP_ADD_TCS(tp) { @@ -277,6 +355,11 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, o_search_unpriv_flag2); #endif ATF_TP_ADD_TC(tp, o_search_notdir); +#ifdef USE_O_SEARCH + ATF_TP_ADD_TC(tp, o_search_nord); + ATF_TP_ADD_TC(tp, o_search_getdents); + ATF_TP_ADD_TC(tp, o_search_revokex); +#endif return atf_no_error(); } Modified: stable/12/lib/libc/sys/open.2 ============================================================================== --- stable/12/lib/libc/sys/open.2 Sun Feb 9 22:05:41 2020 (r357705) +++ stable/12/lib/libc/sys/open.2 Sun Feb 9 22:15:35 2020 (r357706) @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd September 17, 2019 +.Dd February 9, 2020 .Dt OPEN 2 .Os .Sh NAME @@ -126,6 +126,7 @@ O_RDONLY open for reading only O_WRONLY open for writing only O_RDWR open for reading and writing O_EXEC open for execute only +O_SEARCH open for search only, an alias for O_EXEC O_NONBLOCK do not block on open O_APPEND append on each write O_CREAT create file if it does not exist @@ -266,6 +267,19 @@ means is implementation specific. The run-time linker (rtld) uses this flag to ensure shared objects have been verified before operating on them. .Pp +When +.Fa fd +is opened with +.Dv O_SEARCH , +execute permissions are checked at open time. +The +.Fa fd +may not be used for any read operations like +.Xr getdirentries 2 . +The primary use for this descriptor will be as the lookup descriptor for the +.Fn *at +family of functions. +.Pp If successful, .Fn open returns a non-negative integer, termed a file descriptor. @@ -458,9 +472,12 @@ An attempt was made to open a descriptor with an illeg of .Dv O_RDONLY , .Dv O_WRONLY , -.Dv O_RDWR +or +.Dv O_RDWR , and -.Dv O_EXEC . +.Dv O_EXEC +or +.Dv O_SEARCH . .It Bq Er EBADF The .Fa path Modified: stable/12/lib/libc/tests/c063/Makefile ============================================================================== --- stable/12/lib/libc/tests/c063/Makefile Sun Feb 9 22:05:41 2020 (r357705) +++ stable/12/lib/libc/tests/c063/Makefile Sun Feb 9 22:15:35 2020 (r357706) @@ -1,7 +1,5 @@ # $FreeBSD$ -#TODO: t_o_search - NETBSD_ATF_TESTS_C= faccessat_test NETBSD_ATF_TESTS_C+= fchmodat_test NETBSD_ATF_TESTS_C+= fchownat_test @@ -11,6 +9,7 @@ NETBSD_ATF_TESTS_C+= linkat_test NETBSD_ATF_TESTS_C+= mkdirat_test NETBSD_ATF_TESTS_C+= mkfifoat_test NETBSD_ATF_TESTS_C+= mknodat_test +NETBSD_ATF_TESTS_C+= o_search_test NETBSD_ATF_TESTS_C+= openat_test NETBSD_ATF_TESTS_C+= readlinkat_test NETBSD_ATF_TESTS_C+= renameat_test Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Feb 9 22:15:35 2020 (r357706) @@ -1593,10 +1593,14 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, stru * Check accessibility of directory. */ if (!cached) { - error = zfs_zaccess(zdp, ACE_EXECUTE, 0, B_FALSE, cr); - if (error != 0) { - ZFS_EXIT(zfsvfs); - return (error); + if ((cnp->cn_flags & NOEXECCHECK) != 0) { + cnp->cn_flags &= ~NOEXECCHECK; + } else { + error = zfs_zaccess(zdp, ACE_EXECUTE, 0, B_FALSE, cr); + if (error != 0) { + ZFS_EXIT(zfsvfs); + return (error); + } } } Modified: stable/12/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/12/sys/fs/devfs/devfs_vnops.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/12/sys/fs/devfs/devfs_vnops.c Sun Feb 9 22:15:35 2020 (r357706) @@ -919,8 +919,8 @@ devfs_lookupx(struct vop_lookup_args *ap, int *dm_unlo if ((flags & ISDOTDOT) && (dvp->v_vflag & VV_ROOT)) return (EIO); - error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td); - if (error) + error = vn_dir_check_exec(dvp, cnp); + if (error != 0) return (error); if (cnp->cn_namelen == 1 && *pname == '.') { Modified: stable/12/sys/fs/fuse/fuse_vnops.c ============================================================================== --- stable/12/sys/fs/fuse/fuse_vnops.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/12/sys/fs/fuse/fuse_vnops.c Sun Feb 9 22:15:35 2020 (r357706) @@ -1005,7 +1005,9 @@ fuse_vnop_lookup(struct vop_lookup_args *ap) if (islastcn && vfs_isrdonly(mp) && (nameiop != LOOKUP)) return EROFS; - if ((err = fuse_internal_access(dvp, VEXEC, td, cred))) + if ((cnp->cn_flags & NOEXECCHECK) != 0) + cnp->cn_flags &= ~NOEXECCHECK; + else if ((err = fuse_internal_access(dvp, VEXEC, td, cred))) return err; if (flags & ISDOTDOT) { Modified: stable/12/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/12/sys/fs/nfsclient/nfs_clvnops.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/12/sys/fs/nfsclient/nfs_clvnops.c Sun Feb 9 22:15:35 2020 (r357706) @@ -1148,7 +1148,8 @@ nfs_lookup(struct vop_lookup_args *ap) } NFSUNLOCKNODE(np); - if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td)) != 0) + error = vn_dir_check_exec(dvp, cnp); + if (error != 0) return (error); error = cache_lookup(dvp, vpp, cnp, &nctime, &ncticks); if (error > 0 && error != ENOENT) Modified: stable/12/sys/fs/smbfs/smbfs_vnops.c ============================================================================== --- stable/12/sys/fs/smbfs/smbfs_vnops.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/12/sys/fs/smbfs/smbfs_vnops.c Sun Feb 9 22:15:35 2020 (r357706) @@ -1198,7 +1198,8 @@ smbfs_lookup(ap) islastcn = flags & ISLASTCN; if (islastcn && (mp->mnt_flag & MNT_RDONLY) && (nameiop != LOOKUP)) return EROFS; - if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td)) != 0) + error = vn_dir_check_exec(dvp, cnp); + if (error != 0) return error; smp = VFSTOSMBFS(mp); dnp = VTOSMB(dvp); Modified: stable/12/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/12/sys/fs/tmpfs/tmpfs_vnops.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/12/sys/fs/tmpfs/tmpfs_vnops.c Sun Feb 9 22:15:35 2020 (r357706) @@ -90,7 +90,7 @@ tmpfs_lookup1(struct vnode *dvp, struct vnode **vpp, s *vpp = NULLVP; /* Check accessibility of requested node as a first step. */ - error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, cnp->cn_thread); + error = vn_dir_check_exec(dvp, cnp); if (error != 0) goto out; Modified: stable/12/sys/kern/vfs_cache.c ============================================================================== --- stable/12/sys/kern/vfs_cache.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/12/sys/kern/vfs_cache.c Sun Feb 9 22:15:35 2020 (r357706) @@ -2105,9 +2105,7 @@ vfs_cache_lookup(struct vop_lookup_args *ap) int error; struct vnode **vpp = ap->a_vpp; struct componentname *cnp = ap->a_cnp; - struct ucred *cred = cnp->cn_cred; int flags = cnp->cn_flags; - struct thread *td = cnp->cn_thread; *vpp = NULL; dvp = ap->a_dvp; @@ -2119,8 +2117,8 @@ vfs_cache_lookup(struct vop_lookup_args *ap) (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) return (EROFS); - error = VOP_ACCESS(dvp, VEXEC, cred, td); - if (error) + error = vn_dir_check_exec(dvp, cnp); + if (error != 0) return (error); error = cache_lookup(dvp, vpp, cnp, NULL, NULL); Modified: stable/12/sys/kern/vfs_lookup.c ============================================================================== --- stable/12/sys/kern/vfs_lookup.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/12/sys/kern/vfs_lookup.c Sun Feb 9 22:15:35 2020 (r357706) @@ -286,6 +286,7 @@ namei(struct nameidata *ndp) struct vnode *dp; /* the directory we are searching */ struct iovec aiov; /* uio for reading symbolic links */ struct componentname *cnp; + struct file *dfp; struct thread *td; struct proc *p; cap_rights_t rights; @@ -405,10 +406,29 @@ namei(struct nameidata *ndp) AUDIT_ARG_ATFD1(ndp->ni_dirfd); if (cnp->cn_flags & AUDITVNODE2) AUDIT_ARG_ATFD2(ndp->ni_dirfd); - error = fgetvp_rights(td, ndp->ni_dirfd, - &rights, &ndp->ni_filecaps, &dp); - if (error == EINVAL) + /* + * Effectively inlined fgetvp_rights, because we need to + * inspect the file as well as grabbing the vnode. + */ + error = fget_cap_locked(fdp, ndp->ni_dirfd, &rights, + &dfp, &ndp->ni_filecaps); + if (error != 0) { + /* + * Preserve the error; it should either be EBADF + * or capability-related, both of which can be + * safely returned to the caller. + */ + } else if (dfp->f_ops == &badfileops) { + error = EBADF; + } else if (dfp->f_vnode == NULL) { error = ENOTDIR; + } else { + dp = dfp->f_vnode; + vrefact(dp); + + if ((dfp->f_flag & FSEARCH) != 0) + cnp->cn_flags |= NOEXECCHECK; + } #ifdef CAPABILITIES /* * If file descriptor doesn't have all rights, Modified: stable/12/sys/kern/vfs_subr.c ============================================================================== --- stable/12/sys/kern/vfs_subr.c Sun Feb 9 22:05:41 2020 (r357705) +++ stable/12/sys/kern/vfs_subr.c Sun Feb 9 22:15:35 2020 (r357706) @@ -5705,3 +5705,15 @@ __mnt_vnode_markerfree_active(struct vnode **mvp, stru mtx_unlock(&mp->mnt_listmtx); mnt_vnode_markerfree_active(mvp, mp); } + +int +vn_dir_check_exec(struct vnode *vp, struct componentname *cnp) +{ + + if ((cnp->cn_flags & NOEXECCHECK) != 0) { + cnp->cn_flags &= ~NOEXECCHECK; + return (0); + } + + return (VOP_ACCESS(vp, VEXEC, cnp->cn_cred, cnp->cn_thread)); +} Modified: stable/12/sys/sys/fcntl.h ============================================================================== --- stable/12/sys/sys/fcntl.h Sun Feb 9 22:05:41 2020 (r357705) +++ stable/12/sys/sys/fcntl.h Sun Feb 9 22:15:35 2020 (r357706) @@ -119,9 +119,11 @@ typedef __pid_t pid_t; #if __POSIX_VISIBLE >= 200809 #define O_DIRECTORY 0x00020000 /* Fail if not directory */ #define O_EXEC 0x00040000 /* Open for execute only */ +#define O_SEARCH O_EXEC #endif #ifdef _KERNEL #define FEXEC O_EXEC +#define FSEARCH O_SEARCH #endif #if __POSIX_VISIBLE >= 200809 Modified: stable/12/sys/sys/namei.h ============================================================================== --- stable/12/sys/sys/namei.h Sun Feb 9 22:05:41 2020 (r357705) +++ stable/12/sys/sys/namei.h Sun Feb 9 22:15:35 2020 (r357706) @@ -159,7 +159,8 @@ struct nameidata { #define AUDITVNODE2 0x08000000 /* audit the looked up vnode information */ #define TRAILINGSLASH 0x10000000 /* path ended in a slash */ #define NOCAPCHECK 0x20000000 /* do not perform capability checks */ -#define PARAMASK 0x3ffffe00 /* mask of parameter descriptors */ +#define NOEXECCHECK 0x40000000 /* do not perform exec check on dir */ +#define PARAMASK 0x7ffffe00 /* mask of parameter descriptors */ /* * Namei results flags Modified: stable/12/sys/sys/vnode.h ============================================================================== --- stable/12/sys/sys/vnode.h Sun Feb 9 22:05:41 2020 (r357705) +++ stable/12/sys/sys/vnode.h Sun Feb 9 22:15:35 2020 (r357706) @@ -921,6 +921,8 @@ int vn_chown(struct file *fp, uid_t uid, gid_t gid, st void vn_fsid(struct vnode *vp, struct vattr *va); +int vn_dir_check_exec(struct vnode *vp, struct componentname *cnp); + #endif /* _KERNEL */ #endif /* !_SYS_VNODE_H_ */ From owner-svn-src-stable@freebsd.org Mon Feb 10 17:02:38 2020 Return-Path: Delivered-To: svn-src-stable@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 456B623EA73; Mon, 10 Feb 2020 17:02:38 +0000 (UTC) (envelope-from gjb@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) server-signature RSA-PSS (4096 bits) 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 48GXJt1Brrz3DlR; Mon, 10 Feb 2020 17:02:38 +0000 (UTC) (envelope-from gjb@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 1C048224BB; Mon, 10 Feb 2020 17:02:38 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01AH2bI9053781; Mon, 10 Feb 2020 17:02:37 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01AH2bxM053780; Mon, 10 Feb 2020 17:02:37 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <202002101702.01AH2bxM053780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 10 Feb 2020 17:02:37 +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: r357733 - stable/11/release/doc/share/xml X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/doc/share/xml X-SVN-Commit-Revision: 357733 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Feb 2020 17:02:38 -0000 Author: gjb Date: Mon Feb 10 17:02:37 2020 New Revision: 357733 URL: https://svnweb.freebsd.org/changeset/base/357733 Log: Fix a typo. Sponsored by: Rubicon Communications, LLC (netgate.com) Modified: stable/11/release/doc/share/xml/security.xml Modified: stable/11/release/doc/share/xml/security.xml ============================================================================== --- stable/11/release/doc/share/xml/security.xml Mon Feb 10 16:15:34 2020 (r357732) +++ stable/11/release/doc/share/xml/security.xml Mon Feb 10 17:02:37 2020 (r357733) @@ -137,7 +137,7 @@ FreeBSD-SA-20:03.thrmisc 28 January 2020 - Kennel stack data disclosure + Kernel stack data disclosure From owner-svn-src-stable@freebsd.org Tue Feb 11 03:37:43 2020 Return-Path: Delivered-To: svn-src-stable@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 1C3BB24CB2B; Tue, 11 Feb 2020 03:37:43 +0000 (UTC) (envelope-from markj@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) server-signature RSA-PSS (4096 bits) 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 48GpPf6nt8z4QRY; Tue, 11 Feb 2020 03:37:42 +0000 (UTC) (envelope-from markj@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 E45C41AD4; Tue, 11 Feb 2020 03:37:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01B3bgPX036210; Tue, 11 Feb 2020 03:37:42 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01B3bgVi036209; Tue, 11 Feb 2020 03:37:42 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202002110337.01B3bgVi036209@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 11 Feb 2020 03:37:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357748 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 357748 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Feb 2020 03:37:43 -0000 Author: markj Date: Tue Feb 11 03:37:42 2020 New Revision: 357748 URL: https://svnweb.freebsd.org/changeset/base/357748 Log: MFC r357525: Correct the malloc tag used when freeing the temporary semop(2) buffer. Modified: stable/12/sys/kern/sysv_sem.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/sysv_sem.c ============================================================================== --- stable/12/sys/kern/sysv_sem.c Tue Feb 11 00:43:58 2020 (r357747) +++ stable/12/sys/kern/sysv_sem.c Tue Feb 11 03:37:42 2020 (r357748) @@ -1142,7 +1142,7 @@ sys_semop(struct thread *td, struct semop_args *uap) DPRINTF(("error = %d from copyin(%p, %p, %d)\n", error, uap->sops, sops, nsops * sizeof(sops[0]))); if (sops != small_sops) - free(sops, M_SEM); + free(sops, M_TEMP); return (error); } @@ -1393,7 +1393,7 @@ done: done2: mtx_unlock(sema_mtxp); if (sops != small_sops) - free(sops, M_SEM); + free(sops, M_TEMP); return (error); } From owner-svn-src-stable@freebsd.org Tue Feb 11 05:11:28 2020 Return-Path: Delivered-To: svn-src-stable@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 E322F24E587; Tue, 11 Feb 2020 05:11:28 +0000 (UTC) (envelope-from markj@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) server-signature RSA-PSS (4096 bits) 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 48GrTr5f5Sz4VFy; Tue, 11 Feb 2020 05:11:28 +0000 (UTC) (envelope-from markj@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 BD0012D1A; Tue, 11 Feb 2020 05:11:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01B5BSSs091017; Tue, 11 Feb 2020 05:11:28 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01B5BSVP091015; Tue, 11 Feb 2020 05:11:28 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202002110511.01B5BSVP091015@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 11 Feb 2020 05:11:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357751 - stable/12/contrib/elftoolchain/libelftc X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/contrib/elftoolchain/libelftc X-SVN-Commit-Revision: 357751 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Feb 2020 05:11:29 -0000 Author: markj Date: Tue Feb 11 05:11:27 2020 New Revision: 357751 URL: https://svnweb.freebsd.org/changeset/base/357751 Log: MFC r357535, r357536: libelftc: Fix memory leaks in the C++ demanglers. Modified: stable/12/contrib/elftoolchain/libelftc/libelftc_dem_arm.c stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/elftoolchain/libelftc/libelftc_dem_arm.c ============================================================================== --- stable/12/contrib/elftoolchain/libelftc/libelftc_dem_arm.c Tue Feb 11 04:05:45 2020 (r357750) +++ stable/12/contrib/elftoolchain/libelftc/libelftc_dem_arm.c Tue Feb 11 05:11:27 2020 (r357751) @@ -203,11 +203,13 @@ cpp_demangle_ARM(const char *org) break; if ((arg = vector_str_substr(&d.vec, arg_begin, d.vec.size - 1, - &arg_len)) == NULL) + &arg_len)) == NULL) goto clean; - if (vector_str_push(&d.arg, arg, arg_len) == false) + if (vector_str_push(&d.arg, arg, arg_len) == false) { + free(arg); goto clean; + } free(arg); @@ -301,12 +303,11 @@ init_demangle_data(struct demangle_data *d) d->type = ENCODE_FUNC; - if (vector_str_init(&d->vec) == false) + if (!vector_str_init(&d->vec)) return (false); - if (vector_str_init(&d->arg) == false) { + if (!vector_str_init(&d->arg)) { vector_str_dest(&d->vec); - return (false); } @@ -956,7 +957,7 @@ read_op_user(struct demangle_data *d) goto clean; if (VEC_PUSH_STR(&d->vec, "::operator ") == false) - return (false); + goto clean; if (vector_str_push(&d->vec, to_str, to_len) == false) goto clean; Modified: stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c ============================================================================== --- stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c Tue Feb 11 04:05:45 2020 (r357750) +++ stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c Tue Feb 11 05:11:27 2020 (r357751) @@ -216,11 +216,13 @@ cpp_demangle_gnu2(const char *org) break; if ((arg = vector_str_substr(&d.vec, arg_begin, d.vec.size - 1, - &arg_len)) == NULL) + &arg_len)) == NULL) goto clean; - if (vector_str_push(&d.arg, arg, arg_len) == false) + if (vector_str_push(&d.arg, arg, arg_len) == false) { + free(arg); goto clean; + } free(arg); @@ -387,12 +389,11 @@ init_demangle_data(struct demangle_data *d) d->type = ENCODE_FUNC; - if (vector_str_init(&d->vec) == false) + if (!vector_str_init(&d->vec)) return (false); - if (vector_str_init(&d->arg) == false) { + if (!vector_str_init(&d->arg)) { vector_str_dest(&d->vec); - return (false); } Modified: stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c ============================================================================== --- stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c Tue Feb 11 04:05:45 2020 (r357750) +++ stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c Tue Feb 11 05:11:27 2020 (r357751) @@ -1659,7 +1659,8 @@ cpp_demangle_read_local_name(struct cpp_demangle_data if (*(++ddata->cur) == '\0') return (0); - vector_str_init(&local_name); + if (!vector_str_init(&local_name)) + return (0); ddata->cur_output = &local_name; if (!cpp_demangle_read_encoding(ddata)) { @@ -3953,7 +3954,7 @@ vector_type_qualifier_init(struct vector_type_qualifie assert(v->q_container != NULL); - if (vector_str_init(&v->ext_name) == false) { + if (!vector_str_init(&v->ext_name)) { free(v->q_container); return (0); } From owner-svn-src-stable@freebsd.org Tue Feb 11 05:11:53 2020 Return-Path: Delivered-To: svn-src-stable@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 1AF7924E60C; Tue, 11 Feb 2020 05:11:53 +0000 (UTC) (envelope-from markj@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) server-signature RSA-PSS (4096 bits) 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 48GrVJ6vr2z4VWF; Tue, 11 Feb 2020 05:11:52 +0000 (UTC) (envelope-from markj@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 CE8302D41; Tue, 11 Feb 2020 05:11:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01B5Bq1l091081; Tue, 11 Feb 2020 05:11:52 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01B5Bqk7091080; Tue, 11 Feb 2020 05:11:52 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202002110511.01B5Bqk7091080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 11 Feb 2020 05:11:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357752 - stable/12/contrib/elftoolchain/size X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/contrib/elftoolchain/size X-SVN-Commit-Revision: 357752 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Feb 2020 05:11:53 -0000 Author: markj Date: Tue Feb 11 05:11:52 2020 New Revision: 357752 URL: https://svnweb.freebsd.org/changeset/base/357752 Log: MFC r357539: size: Avoid returning a stack pointer from xlatetom(). Modified: stable/12/contrib/elftoolchain/size/size.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/elftoolchain/size/size.c ============================================================================== --- stable/12/contrib/elftoolchain/size/size.c Tue Feb 11 05:11:27 2020 (r357751) +++ stable/12/contrib/elftoolchain/size/size.c Tue Feb 11 05:11:52 2020 (r357752) @@ -211,7 +211,7 @@ main(int argc, char **argv) return (rc); } -static Elf_Data * +static int xlatetom(Elf *elf, GElf_Ehdr *elfhdr, void *_src, void *_dst, Elf_Type type, size_t size) { @@ -224,7 +224,8 @@ xlatetom(Elf *elf, GElf_Ehdr *elfhdr, void *_src, void dst.d_buf = _dst; dst.d_version = elfhdr->e_version; dst.d_size = size; - return (gelf_xlatetom(elf, &dst, &src, elfhdr->e_ident[EI_DATA])); + return (gelf_xlatetom(elf, &dst, &src, elfhdr->e_ident[EI_DATA]) != + NULL ? 0 : 1); } #define NOTE_OFFSET_32(nhdr, namesz, offset) \ @@ -285,12 +286,12 @@ handle_core_note(Elf *elf, GElf_Ehdr *elfhdr, GElf_Phd while (data != NULL && offset + sizeof(Elf32_Nhdr) < segment_end) { nhdr = (Elf32_Nhdr *)(uintptr_t)((char*)data + offset); memset(&nhdr_l, 0, sizeof(Elf32_Nhdr)); - if (!xlatetom(elf, elfhdr, &nhdr->n_type, &nhdr_l.n_type, - ELF_T_WORD, sizeof(Elf32_Word)) || - !xlatetom(elf, elfhdr, &nhdr->n_descsz, &nhdr_l.n_descsz, - ELF_T_WORD, sizeof(Elf32_Word)) || - !xlatetom(elf, elfhdr, &nhdr->n_namesz, &nhdr_l.n_namesz, - ELF_T_WORD, sizeof(Elf32_Word))) + if (xlatetom(elf, elfhdr, &nhdr->n_type, &nhdr_l.n_type, + ELF_T_WORD, sizeof(Elf32_Word)) != 0 || + xlatetom(elf, elfhdr, &nhdr->n_descsz, &nhdr_l.n_descsz, + ELF_T_WORD, sizeof(Elf32_Word)) != 0 || + xlatetom(elf, elfhdr, &nhdr->n_namesz, &nhdr_l.n_namesz, + ELF_T_WORD, sizeof(Elf32_Word)) != 0) break; if (offset + sizeof(Elf32_Nhdr) + @@ -327,10 +328,10 @@ handle_core_note(Elf *elf, GElf_Ehdr *elfhdr, GElf_Phd pid = PID64(nhdr, nhdr_l.n_namesz, 40); } - xlatetom(elf, elfhdr, &raw_size, &raw_size, - ELF_T_WORD, sizeof(uint64_t)); - xlatetom(elf, elfhdr, &pid, &pid, ELF_T_WORD, - sizeof(pid_t)); + (void)xlatetom(elf, elfhdr, &raw_size, + &raw_size, ELF_T_WORD, sizeof(uint64_t)); + (void)xlatetom(elf, elfhdr, &pid, &pid, + ELF_T_WORD, sizeof(pid_t)); } if (raw_size != 0 && style == STYLE_SYSV) { From owner-svn-src-stable@freebsd.org Tue Feb 11 05:13:36 2020 Return-Path: Delivered-To: svn-src-stable@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 8680124E745; Tue, 11 Feb 2020 05:13:36 +0000 (UTC) (envelope-from markj@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) server-signature RSA-PSS (4096 bits) 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 48GrXJ2yTwz4Vhx; Tue, 11 Feb 2020 05:13:36 +0000 (UTC) (envelope-from markj@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 60E792D85; Tue, 11 Feb 2020 05:13:36 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01B5Da9J095851; Tue, 11 Feb 2020 05:13:36 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01B5DarV095850; Tue, 11 Feb 2020 05:13:36 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202002110513.01B5DarV095850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 11 Feb 2020 05:13:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357753 - stable/12/contrib/elftoolchain/readelf X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/contrib/elftoolchain/readelf X-SVN-Commit-Revision: 357753 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Feb 2020 05:13:36 -0000 Author: markj Date: Tue Feb 11 05:13:35 2020 New Revision: 357753 URL: https://svnweb.freebsd.org/changeset/base/357753 Log: MFC r357542: readelf: Don't leak memory when dwarf_get_fde_info_for_all_regs() fails. Modified: stable/12/contrib/elftoolchain/readelf/readelf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/elftoolchain/readelf/readelf.c ============================================================================== --- stable/12/contrib/elftoolchain/readelf/readelf.c Tue Feb 11 05:11:52 2020 (r357752) +++ stable/12/contrib/elftoolchain/readelf/readelf.c Tue Feb 11 05:13:35 2020 (r357753) @@ -5871,6 +5871,7 @@ dump_dwarf_frame_regtable(struct readelf *re, Dwarf_Fd for (; cur_pc < end_pc; cur_pc++) { if (dwarf_get_fde_info_for_all_regs(fde, cur_pc, &rt, &row_pc, &de) != DW_DLV_OK) { + free(vec); warnx("dwarf_get_fde_info_for_all_regs failed: %s\n", dwarf_errmsg(de)); return (-1); From owner-svn-src-stable@freebsd.org Tue Feb 11 05:14:37 2020 Return-Path: Delivered-To: svn-src-stable@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 A2AED24E7B4; Tue, 11 Feb 2020 05:14:37 +0000 (UTC) (envelope-from markj@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) server-signature RSA-PSS (4096 bits) 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 48GrYT3d9kz4Vq0; Tue, 11 Feb 2020 05:14:37 +0000 (UTC) (envelope-from markj@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 779EF2D86; Tue, 11 Feb 2020 05:14:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01B5EbvQ095949; Tue, 11 Feb 2020 05:14:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01B5EaSt095945; Tue, 11 Feb 2020 05:14:36 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202002110514.01B5EaSt095945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 11 Feb 2020 05:14:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357754 - stable/12/contrib/elftoolchain/libdwarf X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/contrib/elftoolchain/libdwarf X-SVN-Commit-Revision: 357754 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Feb 2020 05:14:37 -0000 Author: markj Date: Tue Feb 11 05:14:36 2020 New Revision: 357754 URL: https://svnweb.freebsd.org/changeset/base/357754 Log: MFC r357531, r357532, r357533, r357534: libdwarf: Coverity fixups. Modified: stable/12/contrib/elftoolchain/libdwarf/dwarf_pro_attr.c stable/12/contrib/elftoolchain/libdwarf/dwarf_pro_expr.c stable/12/contrib/elftoolchain/libdwarf/libdwarf_abbrev.c stable/12/contrib/elftoolchain/libdwarf/libdwarf_frame.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/elftoolchain/libdwarf/dwarf_pro_attr.c ============================================================================== --- stable/12/contrib/elftoolchain/libdwarf/dwarf_pro_attr.c Tue Feb 11 05:13:35 2020 (r357753) +++ stable/12/contrib/elftoolchain/libdwarf/dwarf_pro_attr.c Tue Feb 11 05:14:36 2020 (r357754) @@ -46,8 +46,10 @@ dwarf_add_AT_location_expr(Dwarf_P_Debug dbg, Dwarf_P_ at->at_attrib = attr; at->at_expr = loc_expr; - if (_dwarf_expr_into_block(loc_expr, error) != DW_DLE_NONE) + if (_dwarf_expr_into_block(loc_expr, error) != DW_DLE_NONE) { + free(at); return (DW_DLV_BADADDR); + } at->u[0].u64 = loc_expr->pe_length; at->u[1].u8p = loc_expr->pe_block; if (loc_expr->pe_length <= UCHAR_MAX) Modified: stable/12/contrib/elftoolchain/libdwarf/dwarf_pro_expr.c ============================================================================== --- stable/12/contrib/elftoolchain/libdwarf/dwarf_pro_expr.c Tue Feb 11 05:13:35 2020 (r357753) +++ stable/12/contrib/elftoolchain/libdwarf/dwarf_pro_expr.c Tue Feb 11 05:14:36 2020 (r357754) @@ -36,10 +36,10 @@ _dwarf_add_expr(Dwarf_P_Expr expr, Dwarf_Small opcode, Dwarf_Debug dbg; int len; - dbg = expr != NULL ? expr->pe_dbg : NULL; + dbg = expr->pe_dbg; - if (_dwarf_loc_expr_add_atom(expr->pe_dbg, NULL, NULL, opcode, val1, - val2, &len, error) != DW_DLE_NONE) + if (_dwarf_loc_expr_add_atom(dbg, NULL, NULL, opcode, val1, val2, &len, + error) != DW_DLE_NONE) return (NULL); assert(len > 0); @@ -67,7 +67,7 @@ _dwarf_expr_into_block(Dwarf_P_Expr expr, Dwarf_Error Dwarf_Debug dbg; int len, pos, ret; - dbg = expr != NULL ? expr->pe_dbg : NULL; + dbg = expr->pe_dbg; if (expr->pe_block != NULL) { free(expr->pe_block); @@ -88,7 +88,7 @@ _dwarf_expr_into_block(Dwarf_P_Expr expr, Dwarf_Error pos = 0; STAILQ_FOREACH(ee, &expr->pe_eelist, ee_next) { assert((Dwarf_Unsigned) pos < expr->pe_length); - ret = _dwarf_loc_expr_add_atom(expr->pe_dbg, + ret = _dwarf_loc_expr_add_atom(dbg, &expr->pe_block[pos], &expr->pe_block[expr->pe_length], ee->ee_loc.lr_atom, ee->ee_loc.lr_number, ee->ee_loc.lr_number2, &len, error); Modified: stable/12/contrib/elftoolchain/libdwarf/libdwarf_abbrev.c ============================================================================== --- stable/12/contrib/elftoolchain/libdwarf/libdwarf_abbrev.c Tue Feb 11 05:13:35 2020 (r357753) +++ stable/12/contrib/elftoolchain/libdwarf/libdwarf_abbrev.c Tue Feb 11 05:14:36 2020 (r357754) @@ -59,9 +59,7 @@ _dwarf_abbrev_add(Dwarf_CU cu, uint64_t entry, uint64_ HASH_ADD(ab_hh, cu->cu_abbrev_hash, ab_entry, sizeof(ab->ab_entry), ab); - if (abp != NULL) - *abp = ab; - + *abp = ab; return (DW_DLE_NONE); } Modified: stable/12/contrib/elftoolchain/libdwarf/libdwarf_frame.c ============================================================================== --- stable/12/contrib/elftoolchain/libdwarf/libdwarf_frame.c Tue Feb 11 05:13:35 2020 (r357753) +++ stable/12/contrib/elftoolchain/libdwarf/libdwarf_frame.c Tue Feb 11 05:14:36 2020 (r357754) @@ -468,9 +468,9 @@ _dwarf_frame_section_init(Dwarf_Debug dbg, Dwarf_Frame if (length > ds->ds_size - offset || (length == 0 && !eh_frame)) { - DWARF_SET_ERROR(dbg, error, - DW_DLE_DEBUG_FRAME_LENGTH_BAD); - return (DW_DLE_DEBUG_FRAME_LENGTH_BAD); + ret = DW_DLE_DEBUG_FRAME_LENGTH_BAD; + DWARF_SET_ERROR(dbg, error, ret); + goto fail_cleanup; } /* Check terminator for .eh_frame */ From owner-svn-src-stable@freebsd.org Tue Feb 11 05:15:36 2020 Return-Path: Delivered-To: svn-src-stable@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 575BA24E847; Tue, 11 Feb 2020 05:15:36 +0000 (UTC) (envelope-from markj@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) server-signature RSA-PSS (4096 bits) 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 48GrZc1gv1z4VxG; Tue, 11 Feb 2020 05:15:36 +0000 (UTC) (envelope-from markj@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 34F6C2D88; Tue, 11 Feb 2020 05:15:36 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01B5FaEi096054; Tue, 11 Feb 2020 05:15:36 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01B5FZYg096052; Tue, 11 Feb 2020 05:15:35 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202002110515.01B5FZYg096052@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 11 Feb 2020 05:15:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357755 - stable/12/contrib/elftoolchain/elfcopy X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/contrib/elftoolchain/elfcopy X-SVN-Commit-Revision: 357755 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Feb 2020 05:15:36 -0000 Author: markj Date: Tue Feb 11 05:15:35 2020 New Revision: 357755 URL: https://svnweb.freebsd.org/changeset/base/357755 Log: MFC r357537, r357538: elfcopy: Coverity fixups. Modified: stable/12/contrib/elftoolchain/elfcopy/main.c stable/12/contrib/elftoolchain/elfcopy/sections.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/elftoolchain/elfcopy/main.c ============================================================================== --- stable/12/contrib/elftoolchain/elfcopy/main.c Tue Feb 11 05:14:36 2020 (r357754) +++ stable/12/contrib/elftoolchain/elfcopy/main.c Tue Feb 11 05:15:35 2020 (r357755) @@ -587,15 +587,19 @@ copy_from_tempfile(const char *src, const char *dst, i if ((tmpfd = open(dst, O_CREAT | O_TRUNC | O_WRONLY, 0755)) < 0) return (-1); - if (elftc_copyfile(infd, tmpfd) < 0) + if (elftc_copyfile(infd, tmpfd) < 0) { + (void) close(tmpfd); return (-1); + } /* * Remove the temporary file from the file system * namespace, and close its file descriptor. */ - if (unlink(src) < 0) + if (unlink(src) < 0) { + (void) close(tmpfd); return (-1); + } (void) close(infd); Modified: stable/12/contrib/elftoolchain/elfcopy/sections.c ============================================================================== --- stable/12/contrib/elftoolchain/elfcopy/sections.c Tue Feb 11 05:14:36 2020 (r357754) +++ stable/12/contrib/elftoolchain/elfcopy/sections.c Tue Feb 11 05:15:35 2020 (r357755) @@ -1092,7 +1092,7 @@ read_section(struct section *s, size_t *size) if (b == NULL) b = malloc(id->d_size); else - b = malloc(sz + id->d_size); + b = realloc(b, sz + id->d_size); if (b == NULL) err(EXIT_FAILURE, "malloc or realloc failed"); From owner-svn-src-stable@freebsd.org Tue Feb 11 12:06:00 2020 Return-Path: Delivered-To: svn-src-stable@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 810812329A1; Tue, 11 Feb 2020 12:06:00 +0000 (UTC) (envelope-from kib@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) server-signature RSA-PSS (4096 bits) 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 48H1h82Tfkz3Qgc; Tue, 11 Feb 2020 12:06:00 +0000 (UTC) (envelope-from kib@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 3B8317CA6; Tue, 11 Feb 2020 12:06:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01BC60Yp042904; Tue, 11 Feb 2020 12:06:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01BC60Wo042903; Tue, 11 Feb 2020 12:06:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202002111206.01BC60Wo042903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 11 Feb 2020 12:06:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357758 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 357758 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Feb 2020 12:06:00 -0000 Author: kib Date: Tue Feb 11 12:05:59 2020 New Revision: 357758 URL: https://svnweb.freebsd.org/changeset/base/357758 Log: MFC r357678: Correct the function name in the comment. Modified: stable/12/sys/kern/kern_thread.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_thread.c ============================================================================== --- stable/12/sys/kern/kern_thread.c Tue Feb 11 07:02:48 2020 (r357757) +++ stable/12/sys/kern/kern_thread.c Tue Feb 11 12:05:59 2020 (r357758) @@ -1055,7 +1055,7 @@ thread_suspend_check(int return_instead) * Typically, when retrying due to casueword(9) failure (rv == 1), we * should handle the stop requests there, with exception of cases when * the thread owns a kernel resource, for instance busied the umtx - * key, or when functions return immediately if casueword_check_susp() + * key, or when functions return immediately if thread_check_susp() * returned non-zero. On the other hand, retrying the whole lock * operation, we better not stop there but delegate the handling to * ast. From owner-svn-src-stable@freebsd.org Tue Feb 11 12:13:21 2020 Return-Path: Delivered-To: svn-src-stable@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 D6946232F0D; Tue, 11 Feb 2020 12:13:21 +0000 (UTC) (envelope-from kib@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) server-signature RSA-PSS (4096 bits) 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 48H1rd5Pxxz3RGl; Tue, 11 Feb 2020 12:13:21 +0000 (UTC) (envelope-from kib@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 B51187EF8; Tue, 11 Feb 2020 12:13:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01BCDLWH048980; Tue, 11 Feb 2020 12:13:21 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01BCDLW9048979; Tue, 11 Feb 2020 12:13:21 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202002111213.01BCDLW9048979@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 11 Feb 2020 12:13:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357759 - stable/12/sys/fs/tmpfs X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/fs/tmpfs X-SVN-Commit-Revision: 357759 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Feb 2020 12:13:21 -0000 Author: kib Date: Tue Feb 11 12:13:21 2020 New Revision: 357759 URL: https://svnweb.freebsd.org/changeset/base/357759 Log: MFC r357511: tmpfs_mount update: simplify, cache the value of VFS_TO_TMPFS() calculation. Modified: stable/12/sys/fs/tmpfs/tmpfs_vfsops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/12/sys/fs/tmpfs/tmpfs_vfsops.c Tue Feb 11 12:05:59 2020 (r357758) +++ stable/12/sys/fs/tmpfs/tmpfs_vfsops.c Tue Feb 11 12:13:21 2020 (r357759) @@ -344,6 +344,7 @@ tmpfs_mount(struct mount *mp) /* Only support update mounts for certain options. */ if (vfs_filteropt(mp->mnt_optnew, tmpfs_updateopts) != 0) return (EOPNOTSUPP); + tmp = VFS_TO_TMPFS(mp); if (vfs_getopt_size(mp->mnt_optnew, "size", &size_max) == 0) { /* * On-the-fly resizing is not supported (yet). We still @@ -352,17 +353,17 @@ tmpfs_mount(struct mount *mp) * parameter, say trying to change rw to ro or vice * versa, would cause vfs_filteropt() to bail. */ - if (size_max != VFS_TO_TMPFS(mp)->tm_size_max) + if (size_max != tmp->tm_size_max) return (EOPNOTSUPP); } if (vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) && - !(VFS_TO_TMPFS(mp)->tm_ronly)) { + !tmp->tm_ronly) { /* RW -> RO */ return (tmpfs_rw_to_ro(mp)); } else if (!vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) && - VFS_TO_TMPFS(mp)->tm_ronly) { + tmp->tm_ronly) { /* RO -> RW */ - VFS_TO_TMPFS(mp)->tm_ronly = 0; + tmp->tm_ronly = 0; MNT_ILOCK(mp); mp->mnt_flag &= ~MNT_RDONLY; MNT_IUNLOCK(mp); From owner-svn-src-stable@freebsd.org Tue Feb 11 12:14:23 2020 Return-Path: Delivered-To: svn-src-stable@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 AB031232FBB; Tue, 11 Feb 2020 12:14:23 +0000 (UTC) (envelope-from kib@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) server-signature RSA-PSS (4096 bits) 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 48H1sq442Qz3wcS; Tue, 11 Feb 2020 12:14:23 +0000 (UTC) (envelope-from kib@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 86C827EFA; Tue, 11 Feb 2020 12:14:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01BCENvD049081; Tue, 11 Feb 2020 12:14:23 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01BCENqm049079; Tue, 11 Feb 2020 12:14:23 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202002111214.01BCENqm049079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 11 Feb 2020 12:14:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357760 - in stable/12/sys: cddl/compat/opensolaris/kern compat/cloudabi X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys: cddl/compat/opensolaris/kern compat/cloudabi X-SVN-Commit-Revision: 357760 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Feb 2020 12:14:23 -0000 Author: kib Date: Tue Feb 11 12:14:22 2020 New Revision: 357760 URL: https://svnweb.freebsd.org/changeset/base/357760 Log: MFC r357512: Add sys/systm.h to several places that use vm headers. Modified: stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c stable/12/sys/compat/cloudabi/cloudabi_vdso.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c ============================================================================== --- stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c Tue Feb 11 12:13:21 2020 (r357759) +++ stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c Tue Feb 11 12:14:22 2020 (r357760) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include Modified: stable/12/sys/compat/cloudabi/cloudabi_vdso.c ============================================================================== --- stable/12/sys/compat/cloudabi/cloudabi_vdso.c Tue Feb 11 12:13:21 2020 (r357759) +++ stable/12/sys/compat/cloudabi/cloudabi_vdso.c Tue Feb 11 12:14:22 2020 (r357760) @@ -26,7 +26,8 @@ #include __FBSDID("$FreeBSD$"); -#include +#include +#include #include #include #include From owner-svn-src-stable@freebsd.org Wed Feb 12 02:04:04 2020 Return-Path: Delivered-To: svn-src-stable@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 370542499A3; Wed, 12 Feb 2020 02:04:04 +0000 (UTC) (envelope-from kevans@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) server-signature RSA-PSS (4096 bits) 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 48HNH80ZtKz3Cqq; Wed, 12 Feb 2020 02:04:04 +0000 (UTC) (envelope-from kevans@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 0E8D519C20; Wed, 12 Feb 2020 02:04:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01C243w1054371; Wed, 12 Feb 2020 02:04:03 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01C243gn054369; Wed, 12 Feb 2020 02:04:03 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202002120204.01C243gn054369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 12 Feb 2020 02:04:03 +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: r357789 - in stable: 11/etc 11/lib/libutil 12/lib/libutil 12/usr.bin/login X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/etc 11/lib/libutil 12/lib/libutil 12/usr.bin/login X-SVN-Commit-Revision: 357789 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Feb 2020 02:04:04 -0000 Author: kevans Date: Wed Feb 12 02:04:03 2020 New Revision: 357789 URL: https://svnweb.freebsd.org/changeset/base/357789 Log: MFC r357560, r357707: login.conf(5) mail capability r357560: login.conf(5): split MAIL env var out into a "mail" capability This allows it to be easily suppressed in, e.g., the "daemon" class where it will not be properly expanded. This is a part of D21481. Submitted by: Andrew Gierth r357707: login.conf(5): update commented-out standard, too MAIL now has a mail capability, instead, as of r357560. Modified: stable/11/etc/login.conf stable/11/lib/libutil/login.conf.5 stable/11/lib/libutil/login_class.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/lib/libutil/login.conf.5 stable/12/lib/libutil/login_class.c stable/12/usr.bin/login/login.conf Directory Properties: stable/12/ (props changed) Modified: stable/11/etc/login.conf ============================================================================== --- stable/11/etc/login.conf Wed Feb 12 00:58:17 2020 (r357788) +++ stable/11/etc/login.conf Wed Feb 12 02:04:03 2020 (r357789) @@ -26,7 +26,8 @@ default:\ :passwd_format=sha512:\ :copyright=/etc/COPYRIGHT:\ :welcome=/etc/motd:\ - :setenv=MAIL=/var/mail/$,BLOCKSIZE=K:\ + :setenv=BLOCKSIZE=K:\ + :mail=/var/mail/$:\ :path=/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin ~/bin:\ :nologin=/var/run/nologin:\ :cputime=unlimited:\ @@ -61,6 +62,7 @@ xuser:\ staff:\ :tc=default: daemon:\ + :mail@:\ :memorylocked=128M:\ :tc=default: news:\ @@ -121,7 +123,8 @@ russian|Russian Users Accounts:\ #standard:\ # :copyright=/etc/COPYRIGHT:\ # :welcome=/etc/motd:\ -# :setenv=MAIL=/var/mail/$,BLOCKSIZE=K:\ +# :setenv=BLOCKSIZE=K:\ +# :mail=/var/mail/$:\ # :path=~/bin /bin /usr/bin /usr/local/bin:\ # :manpath=/usr/share/man /usr/local/man:\ # :nologin=/var/run/nologin:\ Modified: stable/11/lib/libutil/login.conf.5 ============================================================================== --- stable/11/lib/libutil/login.conf.5 Wed Feb 12 00:58:17 2020 (r357788) +++ stable/11/lib/libutil/login.conf.5 Wed Feb 12 02:04:03 2020 (r357789) @@ -19,7 +19,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 8, 2011 +.Dd January 19, 2020 .Dt LOGIN.CONF 5 .Os .Sh NAME @@ -237,6 +237,7 @@ for details. .It "label string Default MAC policy; see" .Xr maclabel 7 . .It "lang string Set $LANG environment variable to the specified value." +.It "mail string Set $MAIL environment variable to the specified value." .It "manpath path Default search path for manpages." .It "nocheckmail bool false Display mail status at login." .It "nologin file If the file exists it will be displayed and" Modified: stable/11/lib/libutil/login_class.c ============================================================================== --- stable/11/lib/libutil/login_class.c Wed Feb 12 00:58:17 2020 (r357788) +++ stable/11/lib/libutil/login_class.c Wed Feb 12 02:04:03 2020 (r357789) @@ -132,6 +132,7 @@ static struct login_vars { }, envars[] = { { "lang", "LANG", NULL, 1}, { "charset", "MM_CHARSET", NULL, 1}, + { "mail", "MAIL", NULL, 1}, { "timezone", "TZ", NULL, 1}, { "term", "TERM", NULL, 0}, { NULL, NULL, NULL, 0} From owner-svn-src-stable@freebsd.org Wed Feb 12 02:04:04 2020 Return-Path: Delivered-To: svn-src-stable@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 E82722499B0; Wed, 12 Feb 2020 02:04:04 +0000 (UTC) (envelope-from kevans@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) server-signature RSA-PSS (4096 bits) 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 48HNH85t92z3Cqr; Wed, 12 Feb 2020 02:04:04 +0000 (UTC) (envelope-from kevans@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 C4D3119C21; Wed, 12 Feb 2020 02:04:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01C244p8054379; Wed, 12 Feb 2020 02:04:04 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01C244nZ054377; Wed, 12 Feb 2020 02:04:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202002120204.01C244nZ054377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 12 Feb 2020 02:04:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357789 - in stable: 11/etc 11/lib/libutil 12/lib/libutil 12/usr.bin/login X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/etc 11/lib/libutil 12/lib/libutil 12/usr.bin/login X-SVN-Commit-Revision: 357789 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Feb 2020 02:04:05 -0000 Author: kevans Date: Wed Feb 12 02:04:03 2020 New Revision: 357789 URL: https://svnweb.freebsd.org/changeset/base/357789 Log: MFC r357560, r357707: login.conf(5) mail capability r357560: login.conf(5): split MAIL env var out into a "mail" capability This allows it to be easily suppressed in, e.g., the "daemon" class where it will not be properly expanded. This is a part of D21481. Submitted by: Andrew Gierth r357707: login.conf(5): update commented-out standard, too MAIL now has a mail capability, instead, as of r357560. Modified: stable/12/lib/libutil/login.conf.5 stable/12/lib/libutil/login_class.c stable/12/usr.bin/login/login.conf Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/etc/login.conf stable/11/lib/libutil/login.conf.5 stable/11/lib/libutil/login_class.c Directory Properties: stable/11/ (props changed) Modified: stable/12/lib/libutil/login.conf.5 ============================================================================== --- stable/12/lib/libutil/login.conf.5 Wed Feb 12 00:58:17 2020 (r357788) +++ stable/12/lib/libutil/login.conf.5 Wed Feb 12 02:04:03 2020 (r357789) @@ -19,7 +19,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 8, 2011 +.Dd January 19, 2020 .Dt LOGIN.CONF 5 .Os .Sh NAME @@ -237,6 +237,7 @@ for details. .It "label string Default MAC policy; see" .Xr maclabel 7 . .It "lang string Set $LANG environment variable to the specified value." +.It "mail string Set $MAIL environment variable to the specified value." .It "manpath path Default search path for manpages." .It "nocheckmail bool false Display mail status at login." .It "nologin file If the file exists it will be displayed and" Modified: stable/12/lib/libutil/login_class.c ============================================================================== --- stable/12/lib/libutil/login_class.c Wed Feb 12 00:58:17 2020 (r357788) +++ stable/12/lib/libutil/login_class.c Wed Feb 12 02:04:03 2020 (r357789) @@ -132,6 +132,7 @@ static struct login_vars { }, envars[] = { { "lang", "LANG", NULL, 1}, { "charset", "MM_CHARSET", NULL, 1}, + { "mail", "MAIL", NULL, 1}, { "timezone", "TZ", NULL, 1}, { "term", "TERM", NULL, 0}, { NULL, NULL, NULL, 0} Modified: stable/12/usr.bin/login/login.conf ============================================================================== --- stable/12/usr.bin/login/login.conf Wed Feb 12 00:58:17 2020 (r357788) +++ stable/12/usr.bin/login/login.conf Wed Feb 12 02:04:03 2020 (r357789) @@ -26,7 +26,8 @@ default:\ :passwd_format=sha512:\ :copyright=/etc/COPYRIGHT:\ :welcome=/etc/motd:\ - :setenv=MAIL=/var/mail/$,BLOCKSIZE=K:\ + :setenv=BLOCKSIZE=K:\ + :mail=/var/mail/$:\ :path=/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin ~/bin:\ :nologin=/var/run/nologin:\ :cputime=unlimited:\ @@ -61,6 +62,7 @@ xuser:\ staff:\ :tc=default: daemon:\ + :mail@:\ :memorylocked=128M:\ :tc=default: news:\ @@ -121,7 +123,8 @@ russian|Russian Users Accounts:\ #standard:\ # :copyright=/etc/COPYRIGHT:\ # :welcome=/etc/motd:\ -# :setenv=MAIL=/var/mail/$,BLOCKSIZE=K:\ +# :setenv=BLOCKSIZE=K:\ +# :mail=/var/mail/$:\ # :path=~/bin /bin /usr/bin /usr/local/bin:\ # :manpath=/usr/share/man /usr/local/man:\ # :nologin=/var/run/nologin:\ From owner-svn-src-stable@freebsd.org Wed Feb 12 02:07:38 2020 Return-Path: Delivered-To: svn-src-stable@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 25F49249AA0; Wed, 12 Feb 2020 02:07:38 +0000 (UTC) (envelope-from kevans@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) server-signature RSA-PSS (4096 bits) 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 48HNMG08Hnz3D94; Wed, 12 Feb 2020 02:07:38 +0000 (UTC) (envelope-from kevans@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 EFE6519C24; Wed, 12 Feb 2020 02:07:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01C27baf054633; Wed, 12 Feb 2020 02:07:37 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01C27bZM054631; Wed, 12 Feb 2020 02:07:37 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202002120207.01C27bZM054631@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 12 Feb 2020 02:07:37 +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: r357790 - in stable: 11/usr.bin/env 12/usr.bin/env X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/usr.bin/env 12/usr.bin/env X-SVN-Commit-Revision: 357790 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Feb 2020 02:07:38 -0000 Author: kevans Date: Wed Feb 12 02:07:37 2020 New Revision: 357790 URL: https://svnweb.freebsd.org/changeset/base/357790 Log: MFC r354450: Add -0 option to ENV(1) With the -0 option added to ENV(1), some ports will no longer require genv from sysutils/coreutils. Modified: stable/11/usr.bin/env/env.1 stable/11/usr.bin/env/env.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/usr.bin/env/env.1 stable/12/usr.bin/env/env.c Directory Properties: stable/12/ (props changed) Modified: stable/11/usr.bin/env/env.1 ============================================================================== --- stable/11/usr.bin/env/env.1 Wed Feb 12 02:04:03 2020 (r357789) +++ stable/11/usr.bin/env/env.1 Wed Feb 12 02:07:37 2020 (r357790) @@ -31,7 +31,7 @@ .\" From FreeBSD: src/usr.bin/printenv/printenv.1,v 1.17 2002/11/26 17:33:35 ru Exp .\" $FreeBSD$ .\" -.Dd April 17, 2008 +.Dd November 7, 2019 .Dt ENV 1 .Os .Sh NAME @@ -39,7 +39,7 @@ .Nd set environment and execute command, or print environment .Sh SYNOPSIS .Nm -.Op Fl iv +.Op Fl 0iv .Op Fl P Ar altpath .Op Fl S Ar string .Op Fl u Ar name @@ -64,6 +64,8 @@ is executed. .Pp The options are as follows: .Bl -tag -width indent +.It Fl 0 +End each output line with NUL, not newline. .It Fl i Execute the .Ar utility @@ -130,8 +132,15 @@ If no .Ar utility is specified, .Nm -prints out the names and values -of the variables in the environment, with one name/value pair per line. +prints out the names and values of the variables in the environment. +Each name/value pair is separated by a new line unless +.Fl 0 +is specified, in which case name/value pairs are separated by NUL. +Both +.Fl 0 +and +.Ar utility +may not be specified together. .\" .Ss Details of Fl S \&Ss (split-string) processing The processing of the Modified: stable/11/usr.bin/env/env.c ============================================================================== --- stable/11/usr.bin/env/env.c Wed Feb 12 02:04:03 2020 (r357789) +++ stable/11/usr.bin/env/env.c Wed Feb 12 02:07:37 2020 (r357790) @@ -57,22 +57,33 @@ int env_verbosity; static void usage(void); +/* + * Exit codes. + */ +#define EXIT_CANCELED 125 /* Internal error prior to exec attempt. */ +#define EXIT_CANNOT_INVOKE 126 /* Program located, but not usable. */ +#define EXIT_ENOENT 127 /* Could not find program to exec. */ + int main(int argc, char **argv) { - char *altpath, **ep, *p, **parg; + char *altpath, **ep, *p, **parg, term; char *cleanenv[1]; int ch, want_clear; int rtrn; altpath = NULL; want_clear = 0; - while ((ch = getopt(argc, argv, "-iP:S:u:v")) != -1) + term = '\n'; + while ((ch = getopt(argc, argv, "-0iP:S:u:v")) != -1) switch(ch) { case '-': case 'i': want_clear = 1; break; + case '0': + term = '\0'; + break; case 'P': altpath = strdup(optarg); break; @@ -116,6 +127,8 @@ main(int argc, char **argv) err(EXIT_FAILURE, "setenv %s", *argv); } if (*argv) { + if (term == '\0') + errx(EXIT_CANCELED, "cannot specify command with -0"); if (altpath) search_paths(altpath, argv); if (env_verbosity) { @@ -127,10 +140,11 @@ main(int argc, char **argv) sleep(1); } execvp(*argv, argv); - err(errno == ENOENT ? 127 : 126, "%s", *argv); + err(errno == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE, + "%s", *argv); } for (ep = environ; *ep; ep++) - (void)printf("%s\n", *ep); + (void)printf("%s%c", *ep, term); exit(0); } @@ -138,7 +152,7 @@ static void usage(void) { (void)fprintf(stderr, - "usage: env [-iv] [-P utilpath] [-S string] [-u name]\n" + "usage: env [-0iv] [-P utilpath] [-S string] [-u name]\n" " [name=value ...] [utility [argument ...]]\n"); exit(1); } From owner-svn-src-stable@freebsd.org Wed Feb 12 02:07:38 2020 Return-Path: Delivered-To: svn-src-stable@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 9BB26249AB0; Wed, 12 Feb 2020 02:07:38 +0000 (UTC) (envelope-from kevans@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) server-signature RSA-PSS (4096 bits) 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 48HNMG3cLcz3D95; Wed, 12 Feb 2020 02:07:38 +0000 (UTC) (envelope-from kevans@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 7737419C25; Wed, 12 Feb 2020 02:07:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01C27csu054640; Wed, 12 Feb 2020 02:07:38 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01C27cqE054638; Wed, 12 Feb 2020 02:07:38 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202002120207.01C27cqE054638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 12 Feb 2020 02:07:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357790 - in stable: 11/usr.bin/env 12/usr.bin/env X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/usr.bin/env 12/usr.bin/env X-SVN-Commit-Revision: 357790 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Feb 2020 02:07:38 -0000 Author: kevans Date: Wed Feb 12 02:07:37 2020 New Revision: 357790 URL: https://svnweb.freebsd.org/changeset/base/357790 Log: MFC r354450: Add -0 option to ENV(1) With the -0 option added to ENV(1), some ports will no longer require genv from sysutils/coreutils. Modified: stable/12/usr.bin/env/env.1 stable/12/usr.bin/env/env.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/usr.bin/env/env.1 stable/11/usr.bin/env/env.c Directory Properties: stable/11/ (props changed) Modified: stable/12/usr.bin/env/env.1 ============================================================================== --- stable/12/usr.bin/env/env.1 Wed Feb 12 02:04:03 2020 (r357789) +++ stable/12/usr.bin/env/env.1 Wed Feb 12 02:07:37 2020 (r357790) @@ -31,7 +31,7 @@ .\" From FreeBSD: src/usr.bin/printenv/printenv.1,v 1.17 2002/11/26 17:33:35 ru Exp .\" $FreeBSD$ .\" -.Dd April 17, 2008 +.Dd November 7, 2019 .Dt ENV 1 .Os .Sh NAME @@ -39,7 +39,7 @@ .Nd set environment and execute command, or print environment .Sh SYNOPSIS .Nm -.Op Fl iv +.Op Fl 0iv .Op Fl P Ar altpath .Op Fl S Ar string .Op Fl u Ar name @@ -64,6 +64,8 @@ is executed. .Pp The options are as follows: .Bl -tag -width indent +.It Fl 0 +End each output line with NUL, not newline. .It Fl i Execute the .Ar utility @@ -130,8 +132,15 @@ If no .Ar utility is specified, .Nm -prints out the names and values -of the variables in the environment, with one name/value pair per line. +prints out the names and values of the variables in the environment. +Each name/value pair is separated by a new line unless +.Fl 0 +is specified, in which case name/value pairs are separated by NUL. +Both +.Fl 0 +and +.Ar utility +may not be specified together. .\" .Ss Details of Fl S \&Ss (split-string) processing The processing of the Modified: stable/12/usr.bin/env/env.c ============================================================================== --- stable/12/usr.bin/env/env.c Wed Feb 12 02:04:03 2020 (r357789) +++ stable/12/usr.bin/env/env.c Wed Feb 12 02:07:37 2020 (r357790) @@ -59,22 +59,33 @@ int env_verbosity; static void usage(void); +/* + * Exit codes. + */ +#define EXIT_CANCELED 125 /* Internal error prior to exec attempt. */ +#define EXIT_CANNOT_INVOKE 126 /* Program located, but not usable. */ +#define EXIT_ENOENT 127 /* Could not find program to exec. */ + int main(int argc, char **argv) { - char *altpath, **ep, *p, **parg; + char *altpath, **ep, *p, **parg, term; char *cleanenv[1]; int ch, want_clear; int rtrn; altpath = NULL; want_clear = 0; - while ((ch = getopt(argc, argv, "-iP:S:u:v")) != -1) + term = '\n'; + while ((ch = getopt(argc, argv, "-0iP:S:u:v")) != -1) switch(ch) { case '-': case 'i': want_clear = 1; break; + case '0': + term = '\0'; + break; case 'P': altpath = strdup(optarg); break; @@ -118,6 +129,8 @@ main(int argc, char **argv) err(EXIT_FAILURE, "setenv %s", *argv); } if (*argv) { + if (term == '\0') + errx(EXIT_CANCELED, "cannot specify command with -0"); if (altpath) search_paths(altpath, argv); if (env_verbosity) { @@ -129,10 +142,11 @@ main(int argc, char **argv) sleep(1); } execvp(*argv, argv); - err(errno == ENOENT ? 127 : 126, "%s", *argv); + err(errno == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE, + "%s", *argv); } for (ep = environ; *ep; ep++) - (void)printf("%s\n", *ep); + (void)printf("%s%c", *ep, term); exit(0); } @@ -140,7 +154,7 @@ static void usage(void) { (void)fprintf(stderr, - "usage: env [-iv] [-P utilpath] [-S string] [-u name]\n" + "usage: env [-0iv] [-P utilpath] [-S string] [-u name]\n" " [name=value ...] [utility [argument ...]]\n"); exit(1); } From owner-svn-src-stable@freebsd.org Wed Feb 12 02:09:13 2020 Return-Path: Delivered-To: svn-src-stable@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 68B11249B8F; Wed, 12 Feb 2020 02:09:13 +0000 (UTC) (envelope-from kevans@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) server-signature RSA-PSS (4096 bits) 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 48HNP526pfz3DQR; Wed, 12 Feb 2020 02:09:13 +0000 (UTC) (envelope-from kevans@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 43F2A19C26; Wed, 12 Feb 2020 02:09:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01C29DvN054778; Wed, 12 Feb 2020 02:09:13 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01C29CVJ054775; Wed, 12 Feb 2020 02:09:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202002120209.01C29CVJ054775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 12 Feb 2020 02:09: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: r357791 - in stable: 11/usr.bin/env 12/usr.bin/env X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/usr.bin/env 12/usr.bin/env X-SVN-Commit-Revision: 357791 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Feb 2020 02:09:13 -0000 Author: kevans Date: Wed Feb 12 02:09:12 2020 New Revision: 357791 URL: https://svnweb.freebsd.org/changeset/base/357791 Log: MFC r357563: env(1): grow -L user/class and -U user/class options This allows one to set the environment of the specified user either from login.conf alone (-L) or both login.conf and ~/.login_conf if present (-U). This is a supporting feature to allow service(8) to pull in the environment of the "daemon" class before invoking the rc script. Modified: stable/11/usr.bin/env/Makefile stable/11/usr.bin/env/env.1 stable/11/usr.bin/env/env.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/usr.bin/env/Makefile stable/12/usr.bin/env/env.1 stable/12/usr.bin/env/env.c Directory Properties: stable/12/ (props changed) Modified: stable/11/usr.bin/env/Makefile ============================================================================== --- stable/11/usr.bin/env/Makefile Wed Feb 12 02:07:37 2020 (r357790) +++ stable/11/usr.bin/env/Makefile Wed Feb 12 02:09:12 2020 (r357791) @@ -4,4 +4,6 @@ PROG= env SRCS= env.c envopts.c +LIBADD= util + .include Modified: stable/11/usr.bin/env/env.1 ============================================================================== --- stable/11/usr.bin/env/env.1 Wed Feb 12 02:07:37 2020 (r357790) +++ stable/11/usr.bin/env/env.1 Wed Feb 12 02:09:12 2020 (r357791) @@ -31,7 +31,7 @@ .\" From FreeBSD: src/usr.bin/printenv/printenv.1,v 1.17 2002/11/26 17:33:35 ru Exp .\" $FreeBSD$ .\" -.Dd November 7, 2019 +.Dd January 19, 2020 .Dt ENV 1 .Os .Sh NAME @@ -40,6 +40,7 @@ .Sh SYNOPSIS .Nm .Op Fl 0iv +.Op Fl L Ns | Ns Fl U Ar user Ns Op / Ns Ar class .Op Fl P Ar altpath .Op Fl S Ar string .Op Fl u Ar name @@ -76,6 +77,28 @@ The environment inherited by .Nm is ignored completely. +.\" -L | -U +.It Fl L | Fl U Ar user Ns Op / Ns Ar class +Add the environment variable definitions from +.Xr login.conf 5 +for the specified user and login class to the environment, after +processing any +.Fl i +or +.Fl u +options, but before processing any +.Ar name Ns = Ns Ar value +options. +If +.Fl L +is used, only the system-wide +.Pa /etc/login.conf.db +file is read; if +.Fl U +is used, then the specified user's +.Pa ~/.login_conf +is read as well. +The user may be specified by name or by uid. .\" -P .It Fl P Ar altpath Search the set of directories as specified by @@ -450,6 +473,7 @@ option as a synonym for .Xr printenv 1 , .Xr sh 1 , .Xr execvp 3 , +.Xr login.conf 5 , .Xr environ 7 .Sh STANDARDS The @@ -457,7 +481,7 @@ The utility conforms to .St -p1003.1-2001 . The -.Fl P , S , u +.Fl 0 , L , P , S , U , u and .Fl v options are non-standard extensions supported by @@ -474,6 +498,12 @@ and .Fl v options were added in .Fx 6.0 . +The +.Fl 0 , L +and +.Fl U +options were added in +.Fx 13.0 . .Sh BUGS The .Nm Modified: stable/11/usr.bin/env/env.c ============================================================================== --- stable/11/usr.bin/env/env.c Wed Feb 12 02:07:37 2020 (r357790) +++ stable/11/usr.bin/env/env.c Wed Feb 12 02:09:12 2020 (r357791) @@ -42,11 +42,16 @@ static char sccsid[] = "@(#)env.c 8.3 (Berkeley) 4/2/9 #include __FBSDID("$FreeBSD$"); +#include + #include #include +#include +#include +#include #include -#include #include +#include #include #include "envopts.h" @@ -69,13 +74,23 @@ main(int argc, char **argv) { char *altpath, **ep, *p, **parg, term; char *cleanenv[1]; + char *login_class, *login_name; + struct passwd *pw; + login_cap_t *lc; + bool login_as_user; + uid_t uid; int ch, want_clear; int rtrn; altpath = NULL; + login_class = NULL; + login_name = NULL; + pw = NULL; + lc = NULL; + login_as_user = false; want_clear = 0; term = '\n'; - while ((ch = getopt(argc, argv, "-0iP:S:u:v")) != -1) + while ((ch = getopt(argc, argv, "-0iL:P:S:U:u:v")) != -1) switch(ch) { case '-': case 'i': @@ -84,6 +99,12 @@ main(int argc, char **argv) case '0': term = '\0'; break; + case 'U': + login_as_user = true; + /* FALLTHROUGH */ + case 'L': + login_name = optarg; + break; case 'P': altpath = strdup(optarg); break; @@ -117,6 +138,48 @@ main(int argc, char **argv) if (env_verbosity) fprintf(stderr, "#env clearing environ\n"); } + if (login_name != NULL) { + login_class = strchr(login_name, '/'); + if (login_class) + *login_class++ = '\0'; + pw = getpwnam(login_name); + if (pw == NULL) { + char *endp = NULL; + errno = 0; + uid = strtoul(login_name, &endp, 10); + if (errno == 0 && *endp == '\0') + pw = getpwuid(uid); + } + if (pw == NULL) + errx(EXIT_FAILURE, "no such user: %s", login_name); + if (login_class != NULL) { + lc = login_getclass(login_class); + if (lc == NULL) + errx(EXIT_FAILURE, "no such login class: %s", + login_class); + } else { + lc = login_getpwclass(pw); + if (lc == NULL) + errx(EXIT_FAILURE, "login_getpwclass failed"); + } + + /* + * This is not done with setusercontext() because that will + * try and use ~/.login_conf even when we don't want it to. + */ + setclassenvironment(lc, pw, 1); + setclassenvironment(lc, pw, 0); + if (login_as_user) { + login_close(lc); + if ((lc = login_getuserclass(pw)) != NULL) { + setclassenvironment(lc, pw, 1); + setclassenvironment(lc, pw, 0); + } + } + endpwent(); + if (lc != NULL) + login_close(lc); + } for (argv += optind; *argv && (p = strchr(*argv, '=')); ++argv) { if (env_verbosity) fprintf(stderr, "#env setenv:\t%s\n", *argv); @@ -152,7 +215,7 @@ static void usage(void) { (void)fprintf(stderr, - "usage: env [-0iv] [-P utilpath] [-S string] [-u name]\n" + "usage: env [-0iv] [-L|-U user[/class]] [-P utilpath] [-S string] [-u name]\n" " [name=value ...] [utility [argument ...]]\n"); exit(1); } From owner-svn-src-stable@freebsd.org Wed Feb 12 02:09:14 2020 Return-Path: Delivered-To: svn-src-stable@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 34155249B95; Wed, 12 Feb 2020 02:09:14 +0000 (UTC) (envelope-from kevans@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) server-signature RSA-PSS (4096 bits) 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 48HNP60bkYz3DQS; Wed, 12 Feb 2020 02:09:14 +0000 (UTC) (envelope-from kevans@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 0E8D119C27; Wed, 12 Feb 2020 02:09:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01C29DeV054787; Wed, 12 Feb 2020 02:09:13 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01C29Drr054783; Wed, 12 Feb 2020 02:09:13 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202002120209.01C29Drr054783@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 12 Feb 2020 02:09:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357791 - in stable: 11/usr.bin/env 12/usr.bin/env X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/usr.bin/env 12/usr.bin/env X-SVN-Commit-Revision: 357791 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Feb 2020 02:09:14 -0000 Author: kevans Date: Wed Feb 12 02:09:12 2020 New Revision: 357791 URL: https://svnweb.freebsd.org/changeset/base/357791 Log: MFC r357563: env(1): grow -L user/class and -U user/class options This allows one to set the environment of the specified user either from login.conf alone (-L) or both login.conf and ~/.login_conf if present (-U). This is a supporting feature to allow service(8) to pull in the environment of the "daemon" class before invoking the rc script. Modified: stable/12/usr.bin/env/Makefile stable/12/usr.bin/env/env.1 stable/12/usr.bin/env/env.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/usr.bin/env/Makefile stable/11/usr.bin/env/env.1 stable/11/usr.bin/env/env.c Directory Properties: stable/11/ (props changed) Modified: stable/12/usr.bin/env/Makefile ============================================================================== --- stable/12/usr.bin/env/Makefile Wed Feb 12 02:07:37 2020 (r357790) +++ stable/12/usr.bin/env/Makefile Wed Feb 12 02:09:12 2020 (r357791) @@ -4,4 +4,6 @@ PROG= env SRCS= env.c envopts.c +LIBADD= util + .include Modified: stable/12/usr.bin/env/env.1 ============================================================================== --- stable/12/usr.bin/env/env.1 Wed Feb 12 02:07:37 2020 (r357790) +++ stable/12/usr.bin/env/env.1 Wed Feb 12 02:09:12 2020 (r357791) @@ -31,7 +31,7 @@ .\" From FreeBSD: src/usr.bin/printenv/printenv.1,v 1.17 2002/11/26 17:33:35 ru Exp .\" $FreeBSD$ .\" -.Dd November 7, 2019 +.Dd January 19, 2020 .Dt ENV 1 .Os .Sh NAME @@ -40,6 +40,7 @@ .Sh SYNOPSIS .Nm .Op Fl 0iv +.Op Fl L Ns | Ns Fl U Ar user Ns Op / Ns Ar class .Op Fl P Ar altpath .Op Fl S Ar string .Op Fl u Ar name @@ -76,6 +77,28 @@ The environment inherited by .Nm is ignored completely. +.\" -L | -U +.It Fl L | Fl U Ar user Ns Op / Ns Ar class +Add the environment variable definitions from +.Xr login.conf 5 +for the specified user and login class to the environment, after +processing any +.Fl i +or +.Fl u +options, but before processing any +.Ar name Ns = Ns Ar value +options. +If +.Fl L +is used, only the system-wide +.Pa /etc/login.conf.db +file is read; if +.Fl U +is used, then the specified user's +.Pa ~/.login_conf +is read as well. +The user may be specified by name or by uid. .\" -P .It Fl P Ar altpath Search the set of directories as specified by @@ -450,6 +473,7 @@ option as a synonym for .Xr printenv 1 , .Xr sh 1 , .Xr execvp 3 , +.Xr login.conf 5 , .Xr environ 7 .Sh STANDARDS The @@ -457,7 +481,7 @@ The utility conforms to .St -p1003.1-2001 . The -.Fl P , S , u +.Fl 0 , L , P , S , U , u and .Fl v options are non-standard extensions supported by @@ -474,6 +498,12 @@ and .Fl v options were added in .Fx 6.0 . +The +.Fl 0 , L +and +.Fl U +options were added in +.Fx 13.0 . .Sh BUGS The .Nm Modified: stable/12/usr.bin/env/env.c ============================================================================== --- stable/12/usr.bin/env/env.c Wed Feb 12 02:07:37 2020 (r357790) +++ stable/12/usr.bin/env/env.c Wed Feb 12 02:09:12 2020 (r357791) @@ -44,11 +44,16 @@ static char sccsid[] = "@(#)env.c 8.3 (Berkeley) 4/2/9 #include __FBSDID("$FreeBSD$"); +#include + #include #include +#include +#include +#include #include -#include #include +#include #include #include "envopts.h" @@ -71,13 +76,23 @@ main(int argc, char **argv) { char *altpath, **ep, *p, **parg, term; char *cleanenv[1]; + char *login_class, *login_name; + struct passwd *pw; + login_cap_t *lc; + bool login_as_user; + uid_t uid; int ch, want_clear; int rtrn; altpath = NULL; + login_class = NULL; + login_name = NULL; + pw = NULL; + lc = NULL; + login_as_user = false; want_clear = 0; term = '\n'; - while ((ch = getopt(argc, argv, "-0iP:S:u:v")) != -1) + while ((ch = getopt(argc, argv, "-0iL:P:S:U:u:v")) != -1) switch(ch) { case '-': case 'i': @@ -86,6 +101,12 @@ main(int argc, char **argv) case '0': term = '\0'; break; + case 'U': + login_as_user = true; + /* FALLTHROUGH */ + case 'L': + login_name = optarg; + break; case 'P': altpath = strdup(optarg); break; @@ -119,6 +140,48 @@ main(int argc, char **argv) if (env_verbosity) fprintf(stderr, "#env clearing environ\n"); } + if (login_name != NULL) { + login_class = strchr(login_name, '/'); + if (login_class) + *login_class++ = '\0'; + pw = getpwnam(login_name); + if (pw == NULL) { + char *endp = NULL; + errno = 0; + uid = strtoul(login_name, &endp, 10); + if (errno == 0 && *endp == '\0') + pw = getpwuid(uid); + } + if (pw == NULL) + errx(EXIT_FAILURE, "no such user: %s", login_name); + if (login_class != NULL) { + lc = login_getclass(login_class); + if (lc == NULL) + errx(EXIT_FAILURE, "no such login class: %s", + login_class); + } else { + lc = login_getpwclass(pw); + if (lc == NULL) + errx(EXIT_FAILURE, "login_getpwclass failed"); + } + + /* + * This is not done with setusercontext() because that will + * try and use ~/.login_conf even when we don't want it to. + */ + setclassenvironment(lc, pw, 1); + setclassenvironment(lc, pw, 0); + if (login_as_user) { + login_close(lc); + if ((lc = login_getuserclass(pw)) != NULL) { + setclassenvironment(lc, pw, 1); + setclassenvironment(lc, pw, 0); + } + } + endpwent(); + if (lc != NULL) + login_close(lc); + } for (argv += optind; *argv && (p = strchr(*argv, '=')); ++argv) { if (env_verbosity) fprintf(stderr, "#env setenv:\t%s\n", *argv); @@ -154,7 +217,7 @@ static void usage(void) { (void)fprintf(stderr, - "usage: env [-0iv] [-P utilpath] [-S string] [-u name]\n" + "usage: env [-0iv] [-L|-U user[/class]] [-P utilpath] [-S string] [-u name]\n" " [name=value ...] [utility [argument ...]]\n"); exit(1); } From owner-svn-src-stable@freebsd.org Wed Feb 12 02:17:21 2020 Return-Path: Delivered-To: svn-src-stable@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 739D4249E28; Wed, 12 Feb 2020 02:17:21 +0000 (UTC) (envelope-from kevans@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) server-signature RSA-PSS (4096 bits) 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 48HNZT2R5cz3DwN; Wed, 12 Feb 2020 02:17:21 +0000 (UTC) (envelope-from kevans@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 4EBBA19DEA; Wed, 12 Feb 2020 02:17:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01C2HLud061009; Wed, 12 Feb 2020 02:17:21 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01C2HLg8061008; Wed, 12 Feb 2020 02:17:21 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202002120217.01C2HLg8061008@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 12 Feb 2020 02:17:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357792 - in stable: 11/sys/geom/eli 12/sys/geom/eli X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/geom/eli 12/sys/geom/eli X-SVN-Commit-Revision: 357792 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Feb 2020 02:17:21 -0000 Author: kevans Date: Wed Feb 12 02:17:20 2020 New Revision: 357792 URL: https://svnweb.freebsd.org/changeset/base/357792 Log: MFC r357665: geli taste: allow GELIBOOT tagged providers as well Currently the installer will tag geliboot partitions with both BOOT and GELIBOOT; the former allows the kernel to taste it at boot, while the latter is what loaders keys off of. However, it seems reasonable to assume that if a provider's been tagged with GELIBOOT that the kernel should also take that as a hint to taste/attach at boot. This would allow us to stop tagging GELIBOOT partitions with BOOT in bsdinstall, but I'm not sure that there's a compelling reason to do so any time soon. Modified: stable/12/sys/geom/eli/g_eli.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/geom/eli/g_eli.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/geom/eli/g_eli.c ============================================================================== --- stable/12/sys/geom/eli/g_eli.c Wed Feb 12 02:09:12 2020 (r357791) +++ stable/12/sys/geom/eli/g_eli.c Wed Feb 12 02:17:20 2020 (r357792) @@ -1081,7 +1081,8 @@ g_eli_taste(struct g_class *mp, struct g_provider *pp, if (md.md_provsize != pp->mediasize) return (NULL); /* Should we attach it on boot? */ - if (!(md.md_flags & G_ELI_FLAG_BOOT)) + if (!(md.md_flags & G_ELI_FLAG_BOOT) && + !(md.md_flags & G_ELI_FLAG_GELIBOOT)) return (NULL); if (md.md_keys == 0x00) { G_ELI_DEBUG(0, "No valid keys on %s.", pp->name); From owner-svn-src-stable@freebsd.org Wed Feb 12 02:17:21 2020 Return-Path: Delivered-To: svn-src-stable@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 180E6249E24; Wed, 12 Feb 2020 02:17:21 +0000 (UTC) (envelope-from kevans@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) server-signature RSA-PSS (4096 bits) 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 48HNZS6kqCz3DwM; Wed, 12 Feb 2020 02:17:20 +0000 (UTC) (envelope-from kevans@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 DDBB219DE7; Wed, 12 Feb 2020 02:17:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01C2HKgq061003; Wed, 12 Feb 2020 02:17:20 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01C2HKYw061002; Wed, 12 Feb 2020 02:17:20 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202002120217.01C2HKYw061002@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 12 Feb 2020 02:17:20 +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: r357792 - in stable: 11/sys/geom/eli 12/sys/geom/eli X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/geom/eli 12/sys/geom/eli X-SVN-Commit-Revision: 357792 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Feb 2020 02:17:21 -0000 Author: kevans Date: Wed Feb 12 02:17:20 2020 New Revision: 357792 URL: https://svnweb.freebsd.org/changeset/base/357792 Log: MFC r357665: geli taste: allow GELIBOOT tagged providers as well Currently the installer will tag geliboot partitions with both BOOT and GELIBOOT; the former allows the kernel to taste it at boot, while the latter is what loaders keys off of. However, it seems reasonable to assume that if a provider's been tagged with GELIBOOT that the kernel should also take that as a hint to taste/attach at boot. This would allow us to stop tagging GELIBOOT partitions with BOOT in bsdinstall, but I'm not sure that there's a compelling reason to do so any time soon. Modified: stable/11/sys/geom/eli/g_eli.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/geom/eli/g_eli.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/geom/eli/g_eli.c ============================================================================== --- stable/11/sys/geom/eli/g_eli.c Wed Feb 12 02:09:12 2020 (r357791) +++ stable/11/sys/geom/eli/g_eli.c Wed Feb 12 02:17:20 2020 (r357792) @@ -1080,7 +1080,8 @@ g_eli_taste(struct g_class *mp, struct g_provider *pp, if (md.md_provsize != pp->mediasize) return (NULL); /* Should we attach it on boot? */ - if (!(md.md_flags & G_ELI_FLAG_BOOT)) + if (!(md.md_flags & G_ELI_FLAG_BOOT) && + !(md.md_flags & G_ELI_FLAG_GELIBOOT)) return (NULL); if (md.md_keys == 0x00) { G_ELI_DEBUG(0, "No valid keys on %s.", pp->name); From owner-svn-src-stable@freebsd.org Wed Feb 12 14:50:14 2020 Return-Path: Delivered-To: svn-src-stable@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 4929B239CFB; Wed, 12 Feb 2020 14:50:14 +0000 (UTC) (envelope-from gjb@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) server-signature RSA-PSS (4096 bits) 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 48HjHB1CRBz4TXS; Wed, 12 Feb 2020 14:50:14 +0000 (UTC) (envelope-from gjb@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 065F822D00; Wed, 12 Feb 2020 14:50:14 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01CEoDAj012200; Wed, 12 Feb 2020 14:50:13 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01CEoDiW012198; Wed, 12 Feb 2020 14:50:13 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <202002121450.01CEoDiW012198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 12 Feb 2020 14:50:13 +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: r357822 - stable/11/sys/netpfil/pf X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/sys/netpfil/pf X-SVN-Commit-Revision: 357822 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Feb 2020 14:50:14 -0000 Author: gjb Date: Wed Feb 12 14:50:13 2020 New Revision: 357822 URL: https://svnweb.freebsd.org/changeset/base/357822 Log: MFC r332404 (kp): pf: limit ioctl to a reasonable and tuneable number of elements pf ioctls frequently take a variable number of elements as argument. This can potentially allow users to request very large allocations. These will fail, but even a failing M_NOWAIT might tie up resources and result in concurrent M_WAITOK allocations entering vm_wait and inducing reclamation of caches. Limit these ioctls to what should be a reasonable value, but allow users to tune it should they need to. Sponsored by: Rubicon Communications, LLC (netgate.com) Modified: stable/11/sys/netpfil/pf/pf.c stable/11/sys/netpfil/pf/pf_ioctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netpfil/pf/pf.c ============================================================================== --- stable/11/sys/netpfil/pf/pf.c Wed Feb 12 14:06:02 2020 (r357821) +++ stable/11/sys/netpfil/pf/pf.c Wed Feb 12 14:50:13 2020 (r357822) @@ -363,11 +363,14 @@ u_long pf_hashmask; u_long pf_srchashmask; static u_long pf_hashsize; static u_long pf_srchashsize; +u_long pf_ioctl_maxcount = 65535; SYSCTL_ULONG(_net_pf, OID_AUTO, states_hashsize, CTLFLAG_RDTUN, &pf_hashsize, 0, "Size of pf(4) states hashtable"); SYSCTL_ULONG(_net_pf, OID_AUTO, source_nodes_hashsize, CTLFLAG_RDTUN, &pf_srchashsize, 0, "Size of pf(4) source nodes hashtable"); +SYSCTL_ULONG(_net_pf, OID_AUTO, request_maxcount, CTLFLAG_RDTUN, + &pf_ioctl_maxcount, 0, "Maximum number of tables, addresses, ... in a single ioctl() call"); VNET_DEFINE(void *, pf_swi_cookie); Modified: stable/11/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- stable/11/sys/netpfil/pf/pf_ioctl.c Wed Feb 12 14:06:02 2020 (r357821) +++ stable/11/sys/netpfil/pf/pf_ioctl.c Wed Feb 12 14:50:13 2020 (r357822) @@ -86,8 +86,6 @@ __FBSDID("$FreeBSD$"); #include #endif -#define PF_TABLES_MAX_REQUEST 65535 /* Maximum tables per request. */ - static struct pf_pool *pf_get_pool(char *, u_int32_t, u_int8_t, u_int32_t, u_int8_t, u_int8_t, u_int8_t); @@ -215,6 +213,8 @@ pfsync_detach_ifnet_t *pfsync_detach_ifnet_ptr; /* pflog */ pflog_packet_t *pflog_packet_ptr = NULL; +extern u_long pf_ioctl_maxcount; + static void pfattach_vnet(void) { @@ -2528,7 +2528,8 @@ DIOCCHANGEADDR_error: break; } - if (io->pfrio_size < 0 || io->pfrio_size > PF_TABLES_MAX_REQUEST) { + if (io->pfrio_size < 0 || io->pfrio_size > pf_ioctl_maxcount || + WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_table))) { error = ENOMEM; break; } @@ -2559,7 +2560,8 @@ DIOCCHANGEADDR_error: break; } - if (io->pfrio_size < 0 || io->pfrio_size > PF_TABLES_MAX_REQUEST) { + if (io->pfrio_size < 0 || io->pfrio_size > pf_ioctl_maxcount || + WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_table))) { error = ENOMEM; break; } @@ -2732,6 +2734,7 @@ DIOCCHANGEADDR_error: break; } if (io->pfrio_size < 0 || + io->pfrio_size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_addr))) { error = EINVAL; break; @@ -2769,6 +2772,7 @@ DIOCCHANGEADDR_error: break; } if (io->pfrio_size < 0 || + io->pfrio_size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_addr))) { error = EINVAL; break; @@ -2810,7 +2814,8 @@ DIOCCHANGEADDR_error: break; } count = max(io->pfrio_size, io->pfrio_size2); - if (WOULD_OVERFLOW(count, sizeof(struct pfr_addr))) { + if (count > pf_ioctl_maxcount || + WOULD_OVERFLOW(count, sizeof(struct pfr_addr))) { error = EINVAL; break; } @@ -2848,6 +2853,7 @@ DIOCCHANGEADDR_error: break; } if (io->pfrio_size < 0 || + io->pfrio_size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_addr))) { error = EINVAL; break; @@ -2879,6 +2885,7 @@ DIOCCHANGEADDR_error: break; } if (io->pfrio_size < 0 || + io->pfrio_size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_astats))) { error = EINVAL; break; @@ -2910,6 +2917,7 @@ DIOCCHANGEADDR_error: break; } if (io->pfrio_size < 0 || + io->pfrio_size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_addr))) { error = EINVAL; break; @@ -2947,6 +2955,7 @@ DIOCCHANGEADDR_error: break; } if (io->pfrio_size < 0 || + io->pfrio_size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_addr))) { error = EINVAL; break; @@ -2984,6 +2993,7 @@ DIOCCHANGEADDR_error: break; } if (io->pfrio_size < 0 || + io->pfrio_size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_addr))) { error = EINVAL; break; @@ -3036,6 +3046,7 @@ DIOCCHANGEADDR_error: break; } if (io->size < 0 || + io->size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->size, sizeof(struct pfioc_trans_e))) { error = EINVAL; break; @@ -3112,6 +3123,7 @@ DIOCCHANGEADDR_error: break; } if (io->size < 0 || + io->size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->size, sizeof(struct pfioc_trans_e))) { error = EINVAL; break; @@ -3189,6 +3201,7 @@ DIOCCHANGEADDR_error: } if (io->size < 0 || + io->size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->size, sizeof(struct pfioc_trans_e))) { error = EINVAL; break; @@ -3407,6 +3420,7 @@ DIOCCHANGEADDR_error: } if (io->pfiio_size < 0 || + io->pfiio_size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->pfiio_size, sizeof(struct pfi_kif))) { error = EINVAL; break; From owner-svn-src-stable@freebsd.org Wed Feb 12 15:46:34 2020 Return-Path: Delivered-To: svn-src-stable@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 36E5423B7F6; Wed, 12 Feb 2020 15:46:34 +0000 (UTC) (envelope-from markj@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) server-signature RSA-PSS (4096 bits) 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 48HkXB0WBLz4Xh5; Wed, 12 Feb 2020 15:46:34 +0000 (UTC) (envelope-from markj@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 0CBD5238DC; Wed, 12 Feb 2020 15:46:34 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01CFkXB9048619; Wed, 12 Feb 2020 15:46:33 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01CFkXfb048618; Wed, 12 Feb 2020 15:46:33 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202002121546.01CFkXfb048618@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 12 Feb 2020 15:46:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357824 - stable/12/sys/amd64/amd64 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/amd64/amd64 X-SVN-Commit-Revision: 357824 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Feb 2020 15:46:34 -0000 Author: markj Date: Wed Feb 12 15:46:33 2020 New Revision: 357824 URL: https://svnweb.freebsd.org/changeset/base/357824 Log: MFC r357573: Fix map locking in the CLEAR_PKRU sysarch(2) handler. Modified: stable/12/sys/amd64/amd64/sys_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/sys_machdep.c ============================================================================== --- stable/12/sys/amd64/amd64/sys_machdep.c Wed Feb 12 15:26:56 2020 (r357823) +++ stable/12/sys/amd64/amd64/sys_machdep.c Wed Feb 12 15:46:33 2020 (r357824) @@ -380,7 +380,7 @@ sysarch(struct thread *td, struct sysarch_args *uap) error = pmap_pkru_clear(PCPU_GET(curpmap), (vm_offset_t)a64pkru.addr, (vm_offset_t)a64pkru.addr + a64pkru.len); - vm_map_unlock(map); + vm_map_unlock_read(map); break; default: From owner-svn-src-stable@freebsd.org Wed Feb 12 15:51:29 2020 Return-Path: Delivered-To: svn-src-stable@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 B7AC923BAED; Wed, 12 Feb 2020 15:51:29 +0000 (UTC) (envelope-from markj@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) server-signature RSA-PSS (4096 bits) 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 48Hkds4Wc8z4Y66; Wed, 12 Feb 2020 15:51:29 +0000 (UTC) (envelope-from markj@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 9672D23986; Wed, 12 Feb 2020 15:51:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01CFpTxR051721; Wed, 12 Feb 2020 15:51:29 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01CFpTZR051720; Wed, 12 Feb 2020 15:51:29 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202002121551.01CFpTZR051720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 12 Feb 2020 15:51:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357825 - stable/12/lib/libc/net X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/lib/libc/net X-SVN-Commit-Revision: 357825 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Feb 2020 15:51:29 -0000 Author: markj Date: Wed Feb 12 15:51:29 2020 New Revision: 357825 URL: https://svnweb.freebsd.org/changeset/base/357825 Log: MFC r357575: Improve validation of the sockaddr length in iruserok_sa(). PR: 243747 Modified: stable/12/lib/libc/net/rcmd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/net/rcmd.c ============================================================================== --- stable/12/lib/libc/net/rcmd.c Wed Feb 12 15:46:33 2020 (r357824) +++ stable/12/lib/libc/net/rcmd.c Wed Feb 12 15:51:29 2020 (r357825) @@ -438,8 +438,8 @@ iruserok_sa(const void *ra, int rlen, int superuser, c struct sockaddr_storage ss; /* avoid alignment issue */ - if (rlen > sizeof(ss)) - return(-1); + if (rlen <= 0 || rlen > sizeof(ss)) + return (-1); memcpy(&ss, ra, rlen); raddr = (struct sockaddr *)&ss; From owner-svn-src-stable@freebsd.org Wed Feb 12 18:40:29 2020 Return-Path: Delivered-To: svn-src-stable@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 C13FA23FD5F; Wed, 12 Feb 2020 18:40:29 +0000 (UTC) (envelope-from brooks@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) server-signature RSA-PSS (4096 bits) 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 48HpNs4nhyz3HbR; Wed, 12 Feb 2020 18:40:29 +0000 (UTC) (envelope-from brooks@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 9B75F25B4E; Wed, 12 Feb 2020 18:40:29 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01CIeTm4051561; Wed, 12 Feb 2020 18:40:29 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01CIeTRE051560; Wed, 12 Feb 2020 18:40:29 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <202002121840.01CIeTRE051560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 12 Feb 2020 18:40:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357836 - stable/12/lib/libc/gen X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/lib/libc/gen X-SVN-Commit-Revision: 357836 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Feb 2020 18:40:29 -0000 Author: brooks Date: Wed Feb 12 18:40:29 2020 New Revision: 357836 URL: https://svnweb.freebsd.org/changeset/base/357836 Log: MFC r356942: Correct a misleading indent. This dates to before the beginning of our repo and was found by clang 10. Sponsored by: DARPA Modified: stable/12/lib/libc/gen/ualarm.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/gen/ualarm.c ============================================================================== --- stable/12/lib/libc/gen/ualarm.c Wed Feb 12 18:11:07 2020 (r357835) +++ stable/12/lib/libc/gen/ualarm.c Wed Feb 12 18:40:29 2020 (r357836) @@ -56,6 +56,5 @@ ualarm(useconds_t usecs, useconds_t reload) if (setitimer(ITIMER_REAL, &new, &old) == 0) return (old.it_value.tv_sec * USPS + old.it_value.tv_usec); - /* else */ - return (-1); + return (-1); } From owner-svn-src-stable@freebsd.org Wed Feb 12 18:48:40 2020 Return-Path: Delivered-To: svn-src-stable@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 8BFA3240201; Wed, 12 Feb 2020 18:48:40 +0000 (UTC) (envelope-from brooks@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) server-signature RSA-PSS (4096 bits) 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 48HpZJ2rNTz3JFF; Wed, 12 Feb 2020 18:48:40 +0000 (UTC) (envelope-from brooks@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 584DF25D30; Wed, 12 Feb 2020 18:48:40 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01CImesW057235; Wed, 12 Feb 2020 18:48:40 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01CIme51057234; Wed, 12 Feb 2020 18:48:40 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <202002121848.01CIme51057234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 12 Feb 2020 18:48:40 +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: r357837 - stable/11/lib/libc/gen X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/11/lib/libc/gen X-SVN-Commit-Revision: 357837 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Feb 2020 18:48:40 -0000 Author: brooks Date: Wed Feb 12 18:48:39 2020 New Revision: 357837 URL: https://svnweb.freebsd.org/changeset/base/357837 Log: MFC r356942: Correct a misleading indent. This dates to before the beginning of our repo and was found by clang 10. Sponsored by: DARPA Modified: stable/11/lib/libc/gen/ualarm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/ualarm.c ============================================================================== --- stable/11/lib/libc/gen/ualarm.c Wed Feb 12 18:40:29 2020 (r357836) +++ stable/11/lib/libc/gen/ualarm.c Wed Feb 12 18:48:39 2020 (r357837) @@ -56,6 +56,5 @@ ualarm(useconds_t usecs, useconds_t reload) if (setitimer(ITIMER_REAL, &new, &old) == 0) return (old.it_value.tv_sec * USPS + old.it_value.tv_usec); - /* else */ - return (-1); + return (-1); } From owner-svn-src-stable@freebsd.org Thu Feb 13 03:11:39 2020 Return-Path: Delivered-To: svn-src-stable@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 BDAC324B6B6; Thu, 13 Feb 2020 03:11:39 +0000 (UTC) (envelope-from kevans@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) server-signature RSA-PSS (4096 bits) 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 48J1kg4fh4z4Ng3; Thu, 13 Feb 2020 03:11:39 +0000 (UTC) (envelope-from kevans@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 9A24041D0; Thu, 13 Feb 2020 03:11:39 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01D3BdtK068162; Thu, 13 Feb 2020 03:11:39 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01D3BdpA068161; Thu, 13 Feb 2020 03:11:39 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202002130311.01D3BdpA068161@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 13 Feb 2020 03:11:39 +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: r357851 - stable/11/lib/libc/stdio X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/lib/libc/stdio X-SVN-Commit-Revision: 357851 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Feb 2020 03:11:39 -0000 Author: kevans Date: Thu Feb 13 03:11:39 2020 New Revision: 357851 URL: https://svnweb.freebsd.org/changeset/base/357851 Log: MFC r327181: fsync(3): correctly document return values In r268924 the behavior of fflush was changed to return success on read only streams. Document this. Modified: stable/11/lib/libc/stdio/fflush.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/stdio/fflush.3 ============================================================================== --- stable/11/lib/libc/stdio/fflush.3 Thu Feb 13 01:42:13 2020 (r357850) +++ stable/11/lib/libc/stdio/fflush.3 Thu Feb 13 03:11:39 2020 (r357851) @@ -32,7 +32,7 @@ .\" @(#)fflush.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd December 25, 2017 .Dt FFLUSH 3 .Os .Sh NAME @@ -87,9 +87,7 @@ is set to indicate the error. The .Fa stream argument -is not an open stream, or, in the case of -.Fn fflush , -not a stream open for writing. +is not an open stream. .El .Pp The function @@ -97,7 +95,12 @@ The function may also fail and set .Va errno for any of the errors specified for the routine -.Xr write 2 . +.Xr write 2 , +except that in case of +.Fa stream +being a read-only descriptor, +.Fn fflush +returns 0. .Sh SEE ALSO .Xr write 2 , .Xr fclose 3 , From owner-svn-src-stable@freebsd.org Thu Feb 13 03:13:32 2020 Return-Path: Delivered-To: svn-src-stable@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 541C724B770; Thu, 13 Feb 2020 03:13:32 +0000 (UTC) (envelope-from kevans@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) server-signature RSA-PSS (4096 bits) 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 48J1mr1bBzz4Ns0; Thu, 13 Feb 2020 03:13:32 +0000 (UTC) (envelope-from kevans@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 31AF04235; Thu, 13 Feb 2020 03:13:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01D3DWg3070586; Thu, 13 Feb 2020 03:13:32 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01D3DTYC070573; Thu, 13 Feb 2020 03:13:29 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202002130313.01D3DTYC070573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 13 Feb 2020 03:13:29 +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: r357852 - in stable: 11/include 11/lib/libc/stdio 12/include 12/lib/libc/stdio X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/include 11/lib/libc/stdio 12/include 12/lib/libc/stdio X-SVN-Commit-Revision: 357852 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Feb 2020 03:13:32 -0000 Author: kevans Date: Thu Feb 13 03:13:29 2020 New Revision: 357852 URL: https://svnweb.freebsd.org/changeset/base/357852 Log: MFC r357284, r357419: stdio unlocked r357284: stdio: provide _unlocked variants of fflush, fputc, fputs, fread, fwrite fflush_unlocked is currently desired in ports by sysutils/metalog, and redefined as the locked fflush. fputc_unlocked, fputs_unlocked, fread_unlocked, and fwrite_unlocked are currently desired in ports by devel/elfutils, and redefined as the locked fputs, fread, and fwrite respectively. r357419: libc: provide fputc_unlocked Among the same justification as the other stdio _unlocked; in addition to an inline version in , we must provide a function in libc as well for the functionality. This fixes the lang/gcc* builds, which want to use the symbol from libc. Modified: stable/11/include/stdio.h stable/11/lib/libc/stdio/Makefile.inc stable/11/lib/libc/stdio/Symbol.map stable/11/lib/libc/stdio/fflush.3 stable/11/lib/libc/stdio/fflush.c stable/11/lib/libc/stdio/fputc.c stable/11/lib/libc/stdio/fputs.3 stable/11/lib/libc/stdio/fputs.c stable/11/lib/libc/stdio/fread.3 stable/11/lib/libc/stdio/fread.c stable/11/lib/libc/stdio/fwrite.c stable/11/lib/libc/stdio/putc.3 Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/include/stdio.h stable/12/lib/libc/stdio/Makefile.inc stable/12/lib/libc/stdio/Symbol.map stable/12/lib/libc/stdio/fflush.3 stable/12/lib/libc/stdio/fflush.c stable/12/lib/libc/stdio/fputc.c stable/12/lib/libc/stdio/fputs.3 stable/12/lib/libc/stdio/fputs.c stable/12/lib/libc/stdio/fread.3 stable/12/lib/libc/stdio/fread.c stable/12/lib/libc/stdio/fwrite.c stable/12/lib/libc/stdio/putc.3 Directory Properties: stable/12/ (props changed) Modified: stable/11/include/stdio.h ============================================================================== --- stable/11/include/stdio.h Thu Feb 13 03:11:39 2020 (r357851) +++ stable/11/include/stdio.h Thu Feb 13 03:13:29 2020 (r357852) @@ -345,7 +345,13 @@ int putchar_unlocked(int); void clearerr_unlocked(FILE *); int feof_unlocked(FILE *); int ferror_unlocked(FILE *); +int fflush_unlocked(FILE *); int fileno_unlocked(FILE *); +int fputc_unlocked(int, FILE *); +int fputs_unlocked(const char * __restrict, FILE * __restrict); +size_t fread_unlocked(void * __restrict, size_t, size_t, FILE * __restrict); +size_t fwrite_unlocked(const void * __restrict, size_t, size_t, + FILE * __restrict); #endif #if __POSIX_VISIBLE >= 200112 @@ -541,10 +547,11 @@ extern int __isthreaded; * See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12 * B.8.2.7 for the rationale behind the *_unlocked() macros. */ +#define clearerr_unlocked(p) __sclearerr(p) #define feof_unlocked(p) __sfeof(p) #define ferror_unlocked(p) __sferror(p) -#define clearerr_unlocked(p) __sclearerr(p) #define fileno_unlocked(p) __sfileno(p) +#define fputc_unlocked(s, p) __sputc(s, p) #endif #if __POSIX_VISIBLE >= 199506 #define getc_unlocked(fp) __sgetc(fp) Modified: stable/11/lib/libc/stdio/Makefile.inc ============================================================================== --- stable/11/lib/libc/stdio/Makefile.inc Thu Feb 13 03:11:39 2020 (r357851) +++ stable/11/lib/libc/stdio/Makefile.inc Thu Feb 13 03:13:29 2020 (r357852) @@ -48,13 +48,17 @@ MLINKS+=ferror.3 ferror_unlocked.3 \ ferror.3 clearerr.3 ferror.3 clearerr_unlocked.3 \ ferror.3 feof.3 ferror.3 feof_unlocked.3 \ ferror.3 fileno.3 ferror.3 fileno_unlocked.3 -MLINKS+=fflush.3 fpurge.3 +MLINKS+=fflush.3 fflush_unlocked.3 \ + fflush.3 fpurge.3 MLINKS+=fgets.3 gets.3 MLINKS+=fgets.3 gets_s.3 MLINKS+=flockfile.3 ftrylockfile.3 flockfile.3 funlockfile.3 MLINKS+=fopen.3 fdopen.3 fopen.3 freopen.3 fopen.3 fmemopen.3 -MLINKS+=fputs.3 puts.3 -MLINKS+=fread.3 fwrite.3 +MLINKS+=fputs.3 fputs_unlocked.3 \ + fputs.3 puts.3 +MLINKS+=fread.3 fread_unlocked.3 \ + fread.3 fwrite.3 \ + fread.3 fwrite_unlocked.3 MLINKS+=fseek.3 fgetpos.3 fseek.3 fseeko.3 fseek.3 fsetpos.3 fseek.3 ftell.3 \ fseek.3 ftello.3 fseek.3 rewind.3 MLINKS+=funopen.3 fropen.3 funopen.3 fwopen.3 Modified: stable/11/lib/libc/stdio/Symbol.map ============================================================================== --- stable/11/lib/libc/stdio/Symbol.map Thu Feb 13 03:11:39 2020 (r357851) +++ stable/11/lib/libc/stdio/Symbol.map Thu Feb 13 03:13:29 2020 (r357852) @@ -171,6 +171,14 @@ FBSD_1.5 { gets_s; }; +FBSD_1.6 { + fflush_unlocked; + fputc_unlocked; + fputs_unlocked; + fread_unlocked; + fwrite_unlocked; +}; + FBSDprivate_1.0 { _flockfile; _flockfile_debug_stub; Modified: stable/11/lib/libc/stdio/fflush.3 ============================================================================== --- stable/11/lib/libc/stdio/fflush.3 Thu Feb 13 03:11:39 2020 (r357851) +++ stable/11/lib/libc/stdio/fflush.3 Thu Feb 13 03:13:29 2020 (r357852) @@ -32,11 +32,12 @@ .\" @(#)fflush.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd December 25, 2017 +.Dd January 23, 2020 .Dt FFLUSH 3 .Os .Sh NAME .Nm fflush , +.Nm fflush_unlocked , .Nm fpurge .Nd flush a stream .Sh LIBRARY @@ -46,6 +47,8 @@ .Ft int .Fn fflush "FILE *stream" .Ft int +.Fn fflush_unlocked "FILE *stream" +.Ft int .Fn fpurge "FILE *stream" .Sh DESCRIPTION The function @@ -63,6 +66,16 @@ argument is flushes .Em all open output streams. +.Pp +The +.Fn fflush_unlocked +function is equivalent to +.Fn fflush , +except that the caller is responsible for locking the stream with +.Xr flockfile 3 +before calling it. +This function may be used to avoid the overhead of locking the stream and to +prevent races when multiple threads are operating on the same stream. .Pp The function .Fn fpurge Modified: stable/11/lib/libc/stdio/fflush.c ============================================================================== --- stable/11/lib/libc/stdio/fflush.c Thu Feb 13 03:11:39 2020 (r357851) +++ stable/11/lib/libc/stdio/fflush.c Thu Feb 13 03:13:29 2020 (r357852) @@ -98,6 +98,8 @@ __fflush(FILE *fp) return (retval); } +__weak_reference(__fflush, fflush_unlocked); + int __sflush(FILE *fp) { Modified: stable/11/lib/libc/stdio/fputc.c ============================================================================== --- stable/11/lib/libc/stdio/fputc.c Thu Feb 13 03:11:39 2020 (r357851) +++ stable/11/lib/libc/stdio/fputc.c Thu Feb 13 03:13:29 2020 (r357852) @@ -42,14 +42,24 @@ __FBSDID("$FreeBSD$"); #include "local.h" #include "libc_private.h" +#undef fputc_unlocked + int +fputc_unlocked(int c, FILE *fp) +{ + + /* Orientation set by __sputc() when buffer is full. */ + /* ORIENT(fp, -1); */ + return (__sputc(c, fp)); +} + +int fputc(int c, FILE *fp) { int retval; + FLOCKFILE_CANCELSAFE(fp); - /* Orientation set by __sputc() when buffer is full. */ - /* ORIENT(fp, -1); */ - retval = __sputc(c, fp); + retval = fputc_unlocked(c, fp); FUNLOCKFILE_CANCELSAFE(); return (retval); } Modified: stable/11/lib/libc/stdio/fputs.3 ============================================================================== --- stable/11/lib/libc/stdio/fputs.3 Thu Feb 13 03:11:39 2020 (r357851) +++ stable/11/lib/libc/stdio/fputs.3 Thu Feb 13 03:13:29 2020 (r357852) @@ -32,11 +32,12 @@ .\" @(#)fputs.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd January 23, 2020 .Dt FPUTS 3 .Os .Sh NAME .Nm fputs , +.Nm fputs_unlocked , .Nm puts .Nd output a line to a stream .Sh LIBRARY @@ -46,6 +47,8 @@ .Ft int .Fn fputs "const char *str" "FILE *stream" .Ft int +.Fn fputs_unlocked "const char *str" "FILE *stream" +.Ft int .Fn puts "const char *str" .Sh DESCRIPTION The function @@ -57,6 +60,16 @@ to the stream pointed to by .\" The terminating .\" .Dv NUL .\" character is not written. +.Pp +The +.Fn fputs_unlocked +function is equivalent to +.Fn fputs , +except that the caller is responsible for locking the stream with +.Xr flockfile 3 +before calling it. +This function may be used to avoid the overhead of locking the stream and to +prevent races when multiple threads are operating on the same stream. .Pp The function .Fn puts Modified: stable/11/lib/libc/stdio/fputs.c ============================================================================== --- stable/11/lib/libc/stdio/fputs.c Thu Feb 13 03:11:39 2020 (r357851) +++ stable/11/lib/libc/stdio/fputs.c Thu Feb 13 03:13:29 2020 (r357852) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); * Write the given string to the given file. */ int -fputs(const char * __restrict s, FILE * __restrict fp) +fputs_unlocked(const char * __restrict s, FILE * __restrict fp) { int retval; struct __suio uio; @@ -59,11 +59,20 @@ fputs(const char * __restrict s, FILE * __restrict fp) uio.uio_resid = iov.iov_len = strlen(s); uio.uio_iov = &iov; uio.uio_iovcnt = 1; - FLOCKFILE_CANCELSAFE(fp); ORIENT(fp, -1); retval = __sfvwrite(fp, &uio); - FUNLOCKFILE_CANCELSAFE(); if (retval == 0) return (iov.iov_len > INT_MAX ? INT_MAX : iov.iov_len); + return (retval); +} + +int +fputs(const char * __restrict s, FILE * __restrict fp) +{ + int retval; + + FLOCKFILE_CANCELSAFE(fp); + retval = fputs_unlocked(s, fp); + FUNLOCKFILE_CANCELSAFE(); return (retval); } Modified: stable/11/lib/libc/stdio/fread.3 ============================================================================== --- stable/11/lib/libc/stdio/fread.3 Thu Feb 13 03:11:39 2020 (r357851) +++ stable/11/lib/libc/stdio/fread.3 Thu Feb 13 03:13:29 2020 (r357852) @@ -32,12 +32,14 @@ .\" @(#)fread.3 8.2 (Berkeley) 3/8/94 .\" $FreeBSD$ .\" -.Dd March 8, 1994 +.Dd January 23, 2020 .Dt FREAD 3 .Os .Sh NAME .Nm fread , -.Nm fwrite +.Nm fread_unlocked , +.Nm fwrite , +.Nm fwrite_unlocked .Nd binary stream input/output .Sh LIBRARY .Lb libc @@ -46,7 +48,11 @@ .Ft size_t .Fn fread "void * restrict ptr" "size_t size" "size_t nmemb" "FILE * restrict stream" .Ft size_t +.Fn fread_unlocked "void * restrict ptr" "size_t size" "size_t nmemb" "FILE * restrict stream" +.Ft size_t .Fn fwrite "const void * restrict ptr" "size_t size" "size_t nmemb" "FILE * restrict stream" +.Ft size_t +.Fn fwrite_unlocked "const void * restrict ptr" "size_t size" "size_t nmemb" "FILE * restrict stream" .Sh DESCRIPTION The function .Fn fread @@ -69,6 +75,21 @@ bytes long, to the stream pointed to by .Fa stream , obtaining them from the location given by .Fa ptr . +.Pp +The +.Fn fread_unlocked +and +.Fn fwrite_unlocked +functions are equivalent to +.Fn fread +and +.Fn fwrite +respectively, except that the caller is responsible for locking the stream +with +.Xr flockfile 3 +before calling them. +These functions may be used to avoid the overhead of locking the stream +and to prevent races when multiple threads are operating on the same stream. .Sh RETURN VALUES The functions .Fn fread Modified: stable/11/lib/libc/stdio/fread.c ============================================================================== --- stable/11/lib/libc/stdio/fread.c Thu Feb 13 03:11:39 2020 (r357851) +++ stable/11/lib/libc/stdio/fread.c Thu Feb 13 03:13:29 2020 (r357852) @@ -113,3 +113,5 @@ __fread(void * __restrict buf, size_t size, size_t cou fp->_p += resid; return (count); } + +__weak_reference(__fread, fread_unlocked); Modified: stable/11/lib/libc/stdio/fwrite.c ============================================================================== --- stable/11/lib/libc/stdio/fwrite.c Thu Feb 13 03:11:39 2020 (r357851) +++ stable/11/lib/libc/stdio/fwrite.c Thu Feb 13 03:13:29 2020 (r357852) @@ -50,7 +50,8 @@ __FBSDID("$FreeBSD$"); * Return the number of whole objects written. */ size_t -fwrite(const void * __restrict buf, size_t size, size_t count, FILE * __restrict fp) +fwrite_unlocked(const void * __restrict buf, size_t size, size_t count, + FILE * __restrict fp) { size_t n; struct __suio uio; @@ -82,7 +83,6 @@ fwrite(const void * __restrict buf, size_t size, size_ uio.uio_iov = &iov; uio.uio_iovcnt = 1; - FLOCKFILE_CANCELSAFE(fp); ORIENT(fp, -1); /* * The usual case is success (__sfvwrite returns 0); @@ -91,6 +91,17 @@ fwrite(const void * __restrict buf, size_t size, size_ */ if (__sfvwrite(fp, &uio) != 0) count = (n - uio.uio_resid) / size; - FUNLOCKFILE_CANCELSAFE(); return (count); +} + +size_t +fwrite(const void * __restrict buf, size_t size, size_t count, + FILE * __restrict fp) +{ + size_t n; + + FLOCKFILE_CANCELSAFE(fp); + n = fwrite_unlocked(buf, size, count, fp); + FUNLOCKFILE_CANCELSAFE(); + return (n); } Modified: stable/11/lib/libc/stdio/putc.3 ============================================================================== --- stable/11/lib/libc/stdio/putc.3 Thu Feb 13 03:11:39 2020 (r357851) +++ stable/11/lib/libc/stdio/putc.3 Thu Feb 13 03:13:29 2020 (r357852) @@ -32,11 +32,12 @@ .\" @(#)putc.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd January 10, 2003 +.Dd January 23, 2020 .Dt PUTC 3 .Os .Sh NAME .Nm fputc , +.Nm fputc_unlocked , .Nm putc , .Nm putc_unlocked , .Nm putchar , @@ -50,6 +51,8 @@ .Ft int .Fn fputc "int c" "FILE *stream" .Ft int +.Fn fputc_unlocked "int c" "FILE *stream" +.Ft int .Fn putc "int c" "FILE *stream" .Ft int .Fn putc_unlocked "int c" "FILE *stream" @@ -97,11 +100,13 @@ to the named output .Fa stream . .Pp The -.Fn putc_unlocked +.Fn fputc_unlocked , +.Fn putc_unlocked , and .Fn putchar_unlocked functions are equivalent to -.Fn putc +.Fn fputc , +.Fn putc , and .Fn putchar respectively, From owner-svn-src-stable@freebsd.org Thu Feb 13 03:13:35 2020 Return-Path: Delivered-To: svn-src-stable@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 4A98424B7A2; Thu, 13 Feb 2020 03:13:35 +0000 (UTC) (envelope-from kevans@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) server-signature RSA-PSS (4096 bits) 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 48J1mt65Hzz4NtM; Thu, 13 Feb 2020 03:13:34 +0000 (UTC) (envelope-from kevans@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 B1BBB4236; Thu, 13 Feb 2020 03:13:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01D3DYPc070605; Thu, 13 Feb 2020 03:13:34 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01D3DWs7070594; Thu, 13 Feb 2020 03:13:32 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202002130313.01D3DWs7070594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 13 Feb 2020 03:13:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357852 - in stable: 11/include 11/lib/libc/stdio 12/include 12/lib/libc/stdio X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/include 11/lib/libc/stdio 12/include 12/lib/libc/stdio X-SVN-Commit-Revision: 357852 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Feb 2020 03:13:35 -0000 Author: kevans Date: Thu Feb 13 03:13:29 2020 New Revision: 357852 URL: https://svnweb.freebsd.org/changeset/base/357852 Log: MFC r357284, r357419: stdio unlocked r357284: stdio: provide _unlocked variants of fflush, fputc, fputs, fread, fwrite fflush_unlocked is currently desired in ports by sysutils/metalog, and redefined as the locked fflush. fputc_unlocked, fputs_unlocked, fread_unlocked, and fwrite_unlocked are currently desired in ports by devel/elfutils, and redefined as the locked fputs, fread, and fwrite respectively. r357419: libc: provide fputc_unlocked Among the same justification as the other stdio _unlocked; in addition to an inline version in , we must provide a function in libc as well for the functionality. This fixes the lang/gcc* builds, which want to use the symbol from libc. Modified: stable/12/include/stdio.h stable/12/lib/libc/stdio/Makefile.inc stable/12/lib/libc/stdio/Symbol.map stable/12/lib/libc/stdio/fflush.3 stable/12/lib/libc/stdio/fflush.c stable/12/lib/libc/stdio/fputc.c stable/12/lib/libc/stdio/fputs.3 stable/12/lib/libc/stdio/fputs.c stable/12/lib/libc/stdio/fread.3 stable/12/lib/libc/stdio/fread.c stable/12/lib/libc/stdio/fwrite.c stable/12/lib/libc/stdio/putc.3 Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/include/stdio.h stable/11/lib/libc/stdio/Makefile.inc stable/11/lib/libc/stdio/Symbol.map stable/11/lib/libc/stdio/fflush.3 stable/11/lib/libc/stdio/fflush.c stable/11/lib/libc/stdio/fputc.c stable/11/lib/libc/stdio/fputs.3 stable/11/lib/libc/stdio/fputs.c stable/11/lib/libc/stdio/fread.3 stable/11/lib/libc/stdio/fread.c stable/11/lib/libc/stdio/fwrite.c stable/11/lib/libc/stdio/putc.3 Directory Properties: stable/11/ (props changed) Modified: stable/12/include/stdio.h ============================================================================== --- stable/12/include/stdio.h Thu Feb 13 03:11:39 2020 (r357851) +++ stable/12/include/stdio.h Thu Feb 13 03:13:29 2020 (r357852) @@ -347,7 +347,13 @@ int putchar_unlocked(int); void clearerr_unlocked(FILE *); int feof_unlocked(FILE *); int ferror_unlocked(FILE *); +int fflush_unlocked(FILE *); int fileno_unlocked(FILE *); +int fputc_unlocked(int, FILE *); +int fputs_unlocked(const char * __restrict, FILE * __restrict); +size_t fread_unlocked(void * __restrict, size_t, size_t, FILE * __restrict); +size_t fwrite_unlocked(const void * __restrict, size_t, size_t, + FILE * __restrict); #endif #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500 @@ -508,10 +514,11 @@ extern int __isthreaded; * See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12 * B.8.2.7 for the rationale behind the *_unlocked() macros. */ +#define clearerr_unlocked(p) __sclearerr(p) #define feof_unlocked(p) __sfeof(p) #define ferror_unlocked(p) __sferror(p) -#define clearerr_unlocked(p) __sclearerr(p) #define fileno_unlocked(p) __sfileno(p) +#define fputc_unlocked(s, p) __sputc(s, p) #endif #if __POSIX_VISIBLE >= 199506 #define getc_unlocked(fp) __sgetc(fp) Modified: stable/12/lib/libc/stdio/Makefile.inc ============================================================================== --- stable/12/lib/libc/stdio/Makefile.inc Thu Feb 13 03:11:39 2020 (r357851) +++ stable/12/lib/libc/stdio/Makefile.inc Thu Feb 13 03:13:29 2020 (r357852) @@ -48,13 +48,17 @@ MLINKS+=ferror.3 ferror_unlocked.3 \ ferror.3 clearerr.3 ferror.3 clearerr_unlocked.3 \ ferror.3 feof.3 ferror.3 feof_unlocked.3 \ ferror.3 fileno.3 ferror.3 fileno_unlocked.3 -MLINKS+=fflush.3 fpurge.3 +MLINKS+=fflush.3 fflush_unlocked.3 \ + fflush.3 fpurge.3 MLINKS+=fgets.3 gets.3 MLINKS+=fgets.3 gets_s.3 MLINKS+=flockfile.3 ftrylockfile.3 flockfile.3 funlockfile.3 MLINKS+=fopen.3 fdopen.3 fopen.3 freopen.3 fopen.3 fmemopen.3 -MLINKS+=fputs.3 puts.3 -MLINKS+=fread.3 fwrite.3 +MLINKS+=fputs.3 fputs_unlocked.3 \ + fputs.3 puts.3 +MLINKS+=fread.3 fread_unlocked.3 \ + fread.3 fwrite.3 \ + fread.3 fwrite_unlocked.3 MLINKS+=fseek.3 fgetpos.3 fseek.3 fseeko.3 fseek.3 fsetpos.3 fseek.3 ftell.3 \ fseek.3 ftello.3 fseek.3 rewind.3 MLINKS+=funopen.3 fropen.3 funopen.3 fwopen.3 Modified: stable/12/lib/libc/stdio/Symbol.map ============================================================================== --- stable/12/lib/libc/stdio/Symbol.map Thu Feb 13 03:11:39 2020 (r357851) +++ stable/12/lib/libc/stdio/Symbol.map Thu Feb 13 03:13:29 2020 (r357852) @@ -171,6 +171,14 @@ FBSD_1.5 { gets_s; }; +FBSD_1.6 { + fflush_unlocked; + fputc_unlocked; + fputs_unlocked; + fread_unlocked; + fwrite_unlocked; +}; + FBSDprivate_1.0 { _flockfile; _flockfile_debug_stub; Modified: stable/12/lib/libc/stdio/fflush.3 ============================================================================== --- stable/12/lib/libc/stdio/fflush.3 Thu Feb 13 03:11:39 2020 (r357851) +++ stable/12/lib/libc/stdio/fflush.3 Thu Feb 13 03:13:29 2020 (r357852) @@ -32,11 +32,12 @@ .\" @(#)fflush.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd December 25, 2017 +.Dd January 23, 2020 .Dt FFLUSH 3 .Os .Sh NAME .Nm fflush , +.Nm fflush_unlocked , .Nm fpurge .Nd flush a stream .Sh LIBRARY @@ -46,6 +47,8 @@ .Ft int .Fn fflush "FILE *stream" .Ft int +.Fn fflush_unlocked "FILE *stream" +.Ft int .Fn fpurge "FILE *stream" .Sh DESCRIPTION The function @@ -63,6 +66,16 @@ argument is flushes .Em all open output streams. +.Pp +The +.Fn fflush_unlocked +function is equivalent to +.Fn fflush , +except that the caller is responsible for locking the stream with +.Xr flockfile 3 +before calling it. +This function may be used to avoid the overhead of locking the stream and to +prevent races when multiple threads are operating on the same stream. .Pp The function .Fn fpurge Modified: stable/12/lib/libc/stdio/fflush.c ============================================================================== --- stable/12/lib/libc/stdio/fflush.c Thu Feb 13 03:11:39 2020 (r357851) +++ stable/12/lib/libc/stdio/fflush.c Thu Feb 13 03:13:29 2020 (r357852) @@ -100,6 +100,8 @@ __fflush(FILE *fp) return (retval); } +__weak_reference(__fflush, fflush_unlocked); + int __sflush(FILE *fp) { Modified: stable/12/lib/libc/stdio/fputc.c ============================================================================== --- stable/12/lib/libc/stdio/fputc.c Thu Feb 13 03:11:39 2020 (r357851) +++ stable/12/lib/libc/stdio/fputc.c Thu Feb 13 03:13:29 2020 (r357852) @@ -44,14 +44,24 @@ __FBSDID("$FreeBSD$"); #include "local.h" #include "libc_private.h" +#undef fputc_unlocked + int +fputc_unlocked(int c, FILE *fp) +{ + + /* Orientation set by __sputc() when buffer is full. */ + /* ORIENT(fp, -1); */ + return (__sputc(c, fp)); +} + +int fputc(int c, FILE *fp) { int retval; + FLOCKFILE_CANCELSAFE(fp); - /* Orientation set by __sputc() when buffer is full. */ - /* ORIENT(fp, -1); */ - retval = __sputc(c, fp); + retval = fputc_unlocked(c, fp); FUNLOCKFILE_CANCELSAFE(); return (retval); } Modified: stable/12/lib/libc/stdio/fputs.3 ============================================================================== --- stable/12/lib/libc/stdio/fputs.3 Thu Feb 13 03:11:39 2020 (r357851) +++ stable/12/lib/libc/stdio/fputs.3 Thu Feb 13 03:13:29 2020 (r357852) @@ -32,11 +32,12 @@ .\" @(#)fputs.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd January 23, 2020 .Dt FPUTS 3 .Os .Sh NAME .Nm fputs , +.Nm fputs_unlocked , .Nm puts .Nd output a line to a stream .Sh LIBRARY @@ -46,6 +47,8 @@ .Ft int .Fn fputs "const char *str" "FILE *stream" .Ft int +.Fn fputs_unlocked "const char *str" "FILE *stream" +.Ft int .Fn puts "const char *str" .Sh DESCRIPTION The function @@ -57,6 +60,16 @@ to the stream pointed to by .\" The terminating .\" .Dv NUL .\" character is not written. +.Pp +The +.Fn fputs_unlocked +function is equivalent to +.Fn fputs , +except that the caller is responsible for locking the stream with +.Xr flockfile 3 +before calling it. +This function may be used to avoid the overhead of locking the stream and to +prevent races when multiple threads are operating on the same stream. .Pp The function .Fn puts Modified: stable/12/lib/libc/stdio/fputs.c ============================================================================== --- stable/12/lib/libc/stdio/fputs.c Thu Feb 13 03:11:39 2020 (r357851) +++ stable/12/lib/libc/stdio/fputs.c Thu Feb 13 03:13:29 2020 (r357852) @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); * Write the given string to the given file. */ int -fputs(const char * __restrict s, FILE * __restrict fp) +fputs_unlocked(const char * __restrict s, FILE * __restrict fp) { int retval; struct __suio uio; @@ -61,11 +61,20 @@ fputs(const char * __restrict s, FILE * __restrict fp) uio.uio_resid = iov.iov_len = strlen(s); uio.uio_iov = &iov; uio.uio_iovcnt = 1; - FLOCKFILE_CANCELSAFE(fp); ORIENT(fp, -1); retval = __sfvwrite(fp, &uio); - FUNLOCKFILE_CANCELSAFE(); if (retval == 0) return (iov.iov_len > INT_MAX ? INT_MAX : iov.iov_len); + return (retval); +} + +int +fputs(const char * __restrict s, FILE * __restrict fp) +{ + int retval; + + FLOCKFILE_CANCELSAFE(fp); + retval = fputs_unlocked(s, fp); + FUNLOCKFILE_CANCELSAFE(); return (retval); } Modified: stable/12/lib/libc/stdio/fread.3 ============================================================================== --- stable/12/lib/libc/stdio/fread.3 Thu Feb 13 03:11:39 2020 (r357851) +++ stable/12/lib/libc/stdio/fread.3 Thu Feb 13 03:13:29 2020 (r357852) @@ -32,12 +32,14 @@ .\" @(#)fread.3 8.2 (Berkeley) 3/8/94 .\" $FreeBSD$ .\" -.Dd March 8, 1994 +.Dd January 23, 2020 .Dt FREAD 3 .Os .Sh NAME .Nm fread , -.Nm fwrite +.Nm fread_unlocked , +.Nm fwrite , +.Nm fwrite_unlocked .Nd binary stream input/output .Sh LIBRARY .Lb libc @@ -46,7 +48,11 @@ .Ft size_t .Fn fread "void * restrict ptr" "size_t size" "size_t nmemb" "FILE * restrict stream" .Ft size_t +.Fn fread_unlocked "void * restrict ptr" "size_t size" "size_t nmemb" "FILE * restrict stream" +.Ft size_t .Fn fwrite "const void * restrict ptr" "size_t size" "size_t nmemb" "FILE * restrict stream" +.Ft size_t +.Fn fwrite_unlocked "const void * restrict ptr" "size_t size" "size_t nmemb" "FILE * restrict stream" .Sh DESCRIPTION The function .Fn fread @@ -69,6 +75,21 @@ bytes long, to the stream pointed to by .Fa stream , obtaining them from the location given by .Fa ptr . +.Pp +The +.Fn fread_unlocked +and +.Fn fwrite_unlocked +functions are equivalent to +.Fn fread +and +.Fn fwrite +respectively, except that the caller is responsible for locking the stream +with +.Xr flockfile 3 +before calling them. +These functions may be used to avoid the overhead of locking the stream +and to prevent races when multiple threads are operating on the same stream. .Sh RETURN VALUES The functions .Fn fread Modified: stable/12/lib/libc/stdio/fread.c ============================================================================== --- stable/12/lib/libc/stdio/fread.c Thu Feb 13 03:11:39 2020 (r357851) +++ stable/12/lib/libc/stdio/fread.c Thu Feb 13 03:13:29 2020 (r357852) @@ -115,3 +115,5 @@ __fread(void * __restrict buf, size_t size, size_t cou fp->_p += resid; return (count); } + +__weak_reference(__fread, fread_unlocked); Modified: stable/12/lib/libc/stdio/fwrite.c ============================================================================== --- stable/12/lib/libc/stdio/fwrite.c Thu Feb 13 03:11:39 2020 (r357851) +++ stable/12/lib/libc/stdio/fwrite.c Thu Feb 13 03:13:29 2020 (r357852) @@ -52,7 +52,8 @@ __FBSDID("$FreeBSD$"); * Return the number of whole objects written. */ size_t -fwrite(const void * __restrict buf, size_t size, size_t count, FILE * __restrict fp) +fwrite_unlocked(const void * __restrict buf, size_t size, size_t count, + FILE * __restrict fp) { size_t n; struct __suio uio; @@ -84,7 +85,6 @@ fwrite(const void * __restrict buf, size_t size, size_ uio.uio_iov = &iov; uio.uio_iovcnt = 1; - FLOCKFILE_CANCELSAFE(fp); ORIENT(fp, -1); /* * The usual case is success (__sfvwrite returns 0); @@ -93,6 +93,17 @@ fwrite(const void * __restrict buf, size_t size, size_ */ if (__sfvwrite(fp, &uio) != 0) count = (n - uio.uio_resid) / size; - FUNLOCKFILE_CANCELSAFE(); return (count); +} + +size_t +fwrite(const void * __restrict buf, size_t size, size_t count, + FILE * __restrict fp) +{ + size_t n; + + FLOCKFILE_CANCELSAFE(fp); + n = fwrite_unlocked(buf, size, count, fp); + FUNLOCKFILE_CANCELSAFE(); + return (n); } Modified: stable/12/lib/libc/stdio/putc.3 ============================================================================== --- stable/12/lib/libc/stdio/putc.3 Thu Feb 13 03:11:39 2020 (r357851) +++ stable/12/lib/libc/stdio/putc.3 Thu Feb 13 03:13:29 2020 (r357852) @@ -32,11 +32,12 @@ .\" @(#)putc.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd January 10, 2003 +.Dd January 23, 2020 .Dt PUTC 3 .Os .Sh NAME .Nm fputc , +.Nm fputc_unlocked , .Nm putc , .Nm putc_unlocked , .Nm putchar , @@ -50,6 +51,8 @@ .Ft int .Fn fputc "int c" "FILE *stream" .Ft int +.Fn fputc_unlocked "int c" "FILE *stream" +.Ft int .Fn putc "int c" "FILE *stream" .Ft int .Fn putc_unlocked "int c" "FILE *stream" @@ -97,11 +100,13 @@ to the named output .Fa stream . .Pp The -.Fn putc_unlocked +.Fn fputc_unlocked , +.Fn putc_unlocked , and .Fn putchar_unlocked functions are equivalent to -.Fn putc +.Fn fputc , +.Fn putc , and .Fn putchar respectively, From owner-svn-src-stable@freebsd.org Thu Feb 13 18:26:08 2020 Return-Path: Delivered-To: svn-src-stable@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 B360D1CFA2A; Thu, 13 Feb 2020 18:26:08 +0000 (UTC) (envelope-from asomers@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) server-signature RSA-PSS (4096 bits) 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 48JQ1r48mKz4Jln; Thu, 13 Feb 2020 18:26:08 +0000 (UTC) (envelope-from asomers@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 89E46EEA7; Thu, 13 Feb 2020 18:26:08 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01DIQ8b4015920; Thu, 13 Feb 2020 18:26:08 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01DIQ8jS015918; Thu, 13 Feb 2020 18:26:08 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <202002131826.01DIQ8jS015918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 13 Feb 2020 18:26:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357863 - stable/12/lib/geom/eli X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/lib/geom/eli X-SVN-Commit-Revision: 357863 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Feb 2020 18:26:08 -0000 Author: asomers Date: Thu Feb 13 18:26:07 2020 New Revision: 357863 URL: https://svnweb.freebsd.org/changeset/base/357863 Log: MFC r354234: geli: raise WARNS to 6 Sponsored by: Axcient Modified: stable/12/lib/geom/eli/Makefile stable/12/lib/geom/eli/geom_eli.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/geom/eli/Makefile ============================================================================== --- stable/12/lib/geom/eli/Makefile Thu Feb 13 16:17:05 2020 (r357862) +++ stable/12/lib/geom/eli/Makefile Thu Feb 13 18:26:07 2020 (r357863) @@ -13,8 +13,6 @@ SRCS+= sha512c.c LIBADD= md crypto -WARNS?= 3 - CFLAGS+=-I${SRCTOP}/sys .include Modified: stable/12/lib/geom/eli/geom_eli.c ============================================================================== --- stable/12/lib/geom/eli/geom_eli.c Thu Feb 13 16:17:05 2020 (r357862) +++ stable/12/lib/geom/eli/geom_eli.c Thu Feb 13 18:26:07 2020 (r357863) @@ -700,7 +700,7 @@ eli_init(struct gctl_req *req) unsigned char key[G_ELI_USERKEYLEN]; char backfile[MAXPATHLEN]; const char *str, *prov; - unsigned int secsize, version; + unsigned int secsize, eli_version; off_t mediasize; intmax_t val; int error, i, nargs, nparams, param; @@ -717,16 +717,16 @@ eli_init(struct gctl_req *req) strlcpy(md.md_magic, G_ELI_MAGIC, sizeof(md.md_magic)); val = gctl_get_intmax(req, "mdversion"); if (val == -1) { - version = G_ELI_VERSION; + eli_version = G_ELI_VERSION; } else if (val < 0 || val > G_ELI_VERSION) { gctl_error(req, "Invalid version specified should be between %u and %u.", G_ELI_VERSION_00, G_ELI_VERSION); return; } else { - version = val; + eli_version = val; } - md.md_version = version; + md.md_version = eli_version; md.md_flags = 0; if (gctl_get_int(req, "boot")) md.md_flags |= G_ELI_FLAG_BOOT; @@ -739,7 +739,7 @@ eli_init(struct gctl_req *req) md.md_ealgo = CRYPTO_ALGORITHM_MIN - 1; str = gctl_get_ascii(req, "aalgo"); if (*str != '\0') { - if (version < G_ELI_VERSION_01) { + if (eli_version < G_ELI_VERSION_01) { gctl_error(req, "Data authentication is supported starting from version %u.", G_ELI_VERSION_01); @@ -771,7 +771,7 @@ eli_init(struct gctl_req *req) md.md_ealgo > CRYPTO_ALGORITHM_MAX) { str = gctl_get_ascii(req, "ealgo"); if (*str == '\0') { - if (version < G_ELI_VERSION_05) + if (eli_version < G_ELI_VERSION_05) str = "aes-cbc"; else str = GELI_ENC_ALGO; @@ -783,14 +783,14 @@ eli_init(struct gctl_req *req) return; } if (md.md_ealgo == CRYPTO_CAMELLIA_CBC && - version < G_ELI_VERSION_04) { + eli_version < G_ELI_VERSION_04) { gctl_error(req, "Camellia-CBC algorithm is supported starting from version %u.", G_ELI_VERSION_04); return; } if (md.md_ealgo == CRYPTO_AES_XTS && - version < G_ELI_VERSION_05) { + eli_version < G_ELI_VERSION_05) { gctl_error(req, "AES-XTS algorithm is supported starting from version %u.", G_ELI_VERSION_05); @@ -1870,7 +1870,7 @@ eli_version(struct gctl_req *req) { struct g_eli_metadata md; const char *name; - unsigned int version; + unsigned int eli_version; int error, i, nargs; nargs = gctl_get_int(req, "nargs"); @@ -1900,8 +1900,8 @@ eli_version(struct gctl_req *req) gctl_error(req, "Not fully done."); continue; } - version = le32dec(&md.md_version); - printf("%s: %u\n", name, version); + eli_version = le32dec(&md.md_version); + printf("%s: %u\n", name, eli_version); } } From owner-svn-src-stable@freebsd.org Thu Feb 13 20:32:06 2020 Return-Path: Delivered-To: svn-src-stable@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 95F2F23435E; Thu, 13 Feb 2020 20:32:06 +0000 (UTC) (envelope-from asomers@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) server-signature RSA-PSS (4096 bits) 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 48JSqB3Xlcz4Wfj; Thu, 13 Feb 2020 20:32:06 +0000 (UTC) (envelope-from asomers@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 74CC118667; Thu, 13 Feb 2020 20:32:06 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01DKW6Hn098590; Thu, 13 Feb 2020 20:32:06 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01DKW5mh098044; Thu, 13 Feb 2020 20:32:05 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <202002132032.01DKW5mh098044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 13 Feb 2020 20:32:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357876 - in stable/12: etc/mtree sys/geom sys/geom/multipath tests/sys/geom/class tests/sys/geom/class/multipath X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/12: etc/mtree sys/geom sys/geom/multipath tests/sys/geom/class tests/sys/geom/class/multipath X-SVN-Commit-Revision: 357876 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Feb 2020 20:32:06 -0000 Author: asomers Date: Thu Feb 13 20:32:05 2020 New Revision: 357876 URL: https://svnweb.freebsd.org/changeset/base/357876 Log: MFC r355431: gmultipath: add ATF tests Add ATF tests for most gmultipath operations. Add some dtrace probes too, primarily for configuration changes that happen in response to provider errors. PR: 178473 Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D22235 Added: stable/12/tests/sys/geom/class/multipath/ - copied from r355431, head/tests/sys/geom/class/multipath/ Modified: stable/12/etc/mtree/BSD.tests.dist stable/12/sys/geom/geom_subr.c stable/12/sys/geom/multipath/g_multipath.c stable/12/tests/sys/geom/class/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/etc/mtree/BSD.tests.dist ============================================================================== --- stable/12/etc/mtree/BSD.tests.dist Thu Feb 13 20:23:55 2020 (r357875) +++ stable/12/etc/mtree/BSD.tests.dist Thu Feb 13 20:32:05 2020 (r357876) @@ -744,6 +744,8 @@ .. mirror .. + multipath + .. nop .. part Modified: stable/12/sys/geom/geom_subr.c ============================================================================== --- stable/12/sys/geom/geom_subr.c Thu Feb 13 20:23:55 2020 (r357875) +++ stable/12/sys/geom/geom_subr.c Thu Feb 13 20:32:05 2020 (r357876) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -64,6 +65,8 @@ __FBSDID("$FreeBSD$"); #ifdef KDB #include #endif + +SDT_PROVIDER_DEFINE(geom); struct class_list_head g_classes = LIST_HEAD_INITIALIZER(g_classes); static struct g_tailq_head geoms = TAILQ_HEAD_INITIALIZER(geoms); Modified: stable/12/sys/geom/multipath/g_multipath.c ============================================================================== --- stable/12/sys/geom/multipath/g_multipath.c Thu Feb 13 20:23:55 2020 (r357875) +++ stable/12/sys/geom/multipath/g_multipath.c Thu Feb 13 20:32:05 2020 (r357876) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -61,6 +62,14 @@ static u_int g_multipath_exclusive = 1; SYSCTL_UINT(_kern_geom_multipath, OID_AUTO, exclusive, CTLFLAG_RW, &g_multipath_exclusive, 0, "Exclusively open providers"); +SDT_PROVIDER_DECLARE(geom); +SDT_PROBE_DEFINE2(geom, multipath, config, restore, "char*", "char*"); +SDT_PROBE_DEFINE2(geom, multipath, config, remove, "char*", "char*"); +SDT_PROBE_DEFINE2(geom, multipath, config, disconnect, "char*", "char*"); +SDT_PROBE_DEFINE3(geom, multipath, config, fail, "char*", "char*", "int"); +SDT_PROBE_DEFINE2(geom, multipath, config, taste, "char*", "char*"); +SDT_PROBE_DEFINE2(geom, multipath, io, restart, "struct bio*", "struct bio*"); + static enum { GKT_NIL, GKT_RUN, @@ -146,6 +155,8 @@ g_multipath_fault(struct g_consumer *cp, int cause) printf("GEOM_MULTIPATH: " "all paths in %s were marked FAIL, restore %s\n", sc->sc_name, lcp->provider->name); + SDT_PROBE2(geom, multipath, config, restore, + sc->sc_name, lcp->provider->name); lcp->index &= ~MP_FAIL; } } @@ -217,6 +228,8 @@ g_mpd(void *arg, int flags __unused) if (cp->provider) { printf("GEOM_MULTIPATH: %s removed from %s\n", cp->provider->name, gp->name); + SDT_PROBE2(geom, multipath, config, remove, + gp->name, cp->provider->name); g_detach(cp); } g_destroy_consumer(cp); @@ -234,6 +247,8 @@ g_multipath_orphan(struct g_consumer *cp) g_topology_assert(); printf("GEOM_MULTIPATH: %s in %s was disconnected\n", cp->provider->name, cp->geom->name); + SDT_PROBE2(geom, multipath, config, disconnect, + cp->geom->name, cp->provider->name); sc = cp->geom->softc; cnt = (uintptr_t *)&cp->private; mtx_lock(&sc->sc_mtx); @@ -411,6 +426,8 @@ g_multipath_done_error(struct bio *bp) if ((cp->index & MP_FAIL) == 0) { printf("GEOM_MULTIPATH: Error %d, %s in %s marked FAIL\n", bp->bio_error, pp->name, sc->sc_name); + SDT_PROBE3(geom, multipath, config, fail, + sc->sc_name, pp->name, bp->bio_error); g_multipath_fault(cp, MP_FAIL); } (*cnt)--; @@ -426,6 +443,7 @@ g_multipath_done_error(struct bio *bp) */ if (pbp->bio_children < (uintptr_t)pbp->bio_driver1) { pbp->bio_inbed++; + SDT_PROBE2(geom, multipath, io, restart, bp, pbp); g_destroy_bio(bp); g_multipath_start(pbp); } else { @@ -831,6 +849,7 @@ g_multipath_taste(struct g_class *mp, struct g_provide return (NULL); if (g_multipath_debug) printf("MULTIPATH: %s/%s\n", md.md_name, md.md_uuid); + SDT_PROBE2(geom, multipath, config, taste, md.md_name, md.md_uuid); /* * Let's check if such a device already is present. We check against @@ -1230,8 +1249,12 @@ g_multipath_ctl_fail(struct gctl_req *req, struct g_cl name, sc->sc_name, fail ? "FAIL" : "OK"); if (fail) { g_multipath_fault(cp, MP_FAIL); + SDT_PROBE3(geom, multipath, config, fail, + sc->sc_name, cp->provider->name, 0); } else { cp->index &= ~MP_FAIL; + SDT_PROBE2(geom, multipath, config, restore, + sc->sc_name, cp->provider->name); } } } @@ -1277,6 +1300,8 @@ g_multipath_ctl_remove(struct gctl_req *req, struct g_ found = 1; printf("GEOM_MULTIPATH: removing %s from %s\n", cp->provider->name, cp->geom->name); + SDT_PROBE2(geom, multipath, config, remove, + cp->geom->name, cp->provider->name); sc->sc_ndisks--; g_multipath_fault(cp, MP_LOST); cnt = (uintptr_t *)&cp->private; Modified: stable/12/tests/sys/geom/class/Makefile ============================================================================== --- stable/12/tests/sys/geom/class/Makefile Thu Feb 13 20:23:55 2020 (r357875) +++ stable/12/tests/sys/geom/class/Makefile Thu Feb 13 20:32:05 2020 (r357876) @@ -8,6 +8,7 @@ TESTS_SUBDIRS+= concat TESTS_SUBDIRS+= eli TESTS_SUBDIRS+= gate TESTS_SUBDIRS+= mirror +TESTS_SUBDIRS+= multipath TESTS_SUBDIRS+= nop TESTS_SUBDIRS+= part TESTS_SUBDIRS+= raid3 From owner-svn-src-stable@freebsd.org Thu Feb 13 20:40:37 2020 Return-Path: Delivered-To: svn-src-stable@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 6FD1D23484F; Thu, 13 Feb 2020 20:40:37 +0000 (UTC) (envelope-from asomers@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) server-signature RSA-PSS (4096 bits) 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 48JT112QtBz4X9h; Thu, 13 Feb 2020 20:40:37 +0000 (UTC) (envelope-from asomers@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 34F72187E0; Thu, 13 Feb 2020 20:40:37 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01DKebEZ002360; Thu, 13 Feb 2020 20:40:37 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01DKebTn002359; Thu, 13 Feb 2020 20:40:37 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <202002132040.01DKebTn002359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 13 Feb 2020 20:40:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357877 - stable/12/sys/cam/scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/sys/cam/scsi X-SVN-Commit-Revision: 357877 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Feb 2020 20:40:37 -0000 Author: asomers Date: Thu Feb 13 20:40:36 2020 New Revision: 357877 URL: https://svnweb.freebsd.org/changeset/base/357877 Log: MFC r355430: ses: sanitize illegal strings in SES element descriptors The SES4r3 standard requires that element descriptors may only contain ASCII characters in the range 0x20 to 0x7e. Some SuperMicro expanders violate that rule. This patch adds a sanity check to ses(4). Descriptors in violation will be replaced by "". This patch fixes "sesutil --libxo xml" on such systems. Previously it would generate non-well-formed XML output. PR: 241929 Reviewed by: allanjude Sponsored by: Axcient Modified: stable/12/sys/cam/scsi/scsi_enc_ses.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_enc_ses.c Thu Feb 13 20:32:05 2020 (r357876) +++ stable/12/sys/cam/scsi/scsi_enc_ses.c Thu Feb 13 20:40:36 2020 (r357877) @@ -110,7 +110,7 @@ typedef struct ses_addl_status { typedef struct ses_element { uint8_t eip; /* eip bit is set */ uint16_t descr_len; /* length of the descriptor */ - char *descr; /* descriptor for this object */ + const char *descr; /* descriptor for this object */ struct ses_addl_status addl; /* additional status info */ } ses_element_t; @@ -1977,6 +1977,35 @@ ses_publish_cache(enc_softc_t *enc, struct enc_fsm_sta return (0); } +/* + * \brief Sanitize an element descriptor + * + * The SES4r3 standard, sections 3.1.2 and 6.1.10, specifies that element + * descriptors may only contain ASCII characters in the range 0x20 to 0x7e. + * But some vendors violate that rule. Ensure that we only expose compliant + * descriptors to userland. + * + * \param desc SES element descriptor as reported by the hardware + * \param len Length of desc in bytes, not necessarily including + * trailing NUL. It will be modified if desc is invalid. + */ +static const char* +ses_sanitize_elm_desc(const char *desc, uint16_t *len) +{ + const char *invalid = ""; + int i; + + for (i = 0; i < *len; i++) { + if (desc[i] < 0x20 || desc[i] > 0x7e) { + *len = strlen(invalid); + return (invalid); + } else if (desc[i] == 0) { + break; + } + } + return (desc); +} + /** * \brief Parse the descriptors for each object. * @@ -2061,7 +2090,8 @@ ses_process_elm_descs(enc_softc_t *enc, struct enc_fsm if (length > 0) { elmpriv = element->elm_private; elmpriv->descr_len = length; - elmpriv->descr = &buf[offset]; + elmpriv->descr = ses_sanitize_elm_desc(&buf[offset], + &elmpriv->descr_len); } /* skip over the descriptor itself */ From owner-svn-src-stable@freebsd.org Thu Feb 13 20:41:21 2020 Return-Path: Delivered-To: svn-src-stable@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 55C4223490E; Thu, 13 Feb 2020 20:41:21 +0000 (UTC) (envelope-from asomers@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) server-signature RSA-PSS (4096 bits) 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 48JT1s1hQsz4XLW; Thu, 13 Feb 2020 20:41:21 +0000 (UTC) (envelope-from asomers@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 3543F1892A; Thu, 13 Feb 2020 20:41:21 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01DKfLbZ004668; Thu, 13 Feb 2020 20:41:21 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01DKfKhC004665; Thu, 13 Feb 2020 20:41:20 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <202002132041.01DKfKhC004665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 13 Feb 2020 20:41:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357878 - stable/12/lib/libc/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/lib/libc/sys X-SVN-Commit-Revision: 357878 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Feb 2020 20:41:21 -0000 Author: asomers Date: Thu Feb 13 20:41:20 2020 New Revision: 357878 URL: https://svnweb.freebsd.org/changeset/base/357878 Log: MFC r355488-r355489 r355488: lio_listio(2): add a HISTORY section r355489: clock_gettime(2): add a HISTORY section Modified: stable/12/lib/libc/sys/clock_gettime.2 stable/12/lib/libc/sys/lio_listio.2 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/sys/clock_gettime.2 ============================================================================== --- stable/12/lib/libc/sys/clock_gettime.2 Thu Feb 13 20:40:36 2020 (r357877) +++ stable/12/lib/libc/sys/clock_gettime.2 Thu Feb 13 20:41:20 2020 (r357878) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 20, 2017 +.Dd December 7, 2019 .Dt CLOCK_GETTIME 2 .Os .Sh NAME @@ -174,3 +174,11 @@ The clock IDs .Fa CLOCK_UPTIME_PRECISE , .Fa CLOCK_SECOND are FreeBSD extensions to the POSIX interface. +.Sh HISTORY +The +.Fn clock_gettime , +.Fn clock_settime , +and +.Fn clock_getres +system calls first appeared in +.Fx 3.0 . Modified: stable/12/lib/libc/sys/lio_listio.2 ============================================================================== --- stable/12/lib/libc/sys/lio_listio.2 Thu Feb 13 20:40:36 2020 (r357877) +++ stable/12/lib/libc/sys/lio_listio.2 Thu Feb 13 20:41:20 2020 (r357878) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Oct 23, 2017 +.Dd Dec 7, 2019 .Dt LIO_LISTIO 2 .Os .Sh NAME @@ -216,3 +216,8 @@ The .Fn lio_listio function is expected to conform to .St -p1003.1-2001 . +.Sh HISTORY +The +.Fn lio_listio +system call first appeared in +.Fx 3.0 . From owner-svn-src-stable@freebsd.org Thu Feb 13 20:45:32 2020 Return-Path: Delivered-To: svn-src-stable@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 EF1CE234C8C; Thu, 13 Feb 2020 20:45:32 +0000 (UTC) (envelope-from asomers@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) server-signature RSA-PSS (4096 bits) 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 48JT6h62WYz4Xrb; Thu, 13 Feb 2020 20:45:32 +0000 (UTC) (envelope-from asomers@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 CA99C189A9; Thu, 13 Feb 2020 20:45:32 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01DKjW0n005825; Thu, 13 Feb 2020 20:45:32 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01DKjWML005824; Thu, 13 Feb 2020 20:45:32 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <202002132045.01DKjWML005824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 13 Feb 2020 20:45:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357879 - stable/12/usr.sbin/extattr X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/usr.sbin/extattr X-SVN-Commit-Revision: 357879 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Feb 2020 20:45:33 -0000 Author: asomers Date: Thu Feb 13 20:45:32 2020 New Revision: 357879 URL: https://svnweb.freebsd.org/changeset/base/357879 Log: MFC r356809: setextattr: Increase stdin buffer size to 4096 Extended attribute values can potentially be quite large. One test for ZFS is supposed to set a 200MB xattr. However, the buffer size for reading values from stdin with setextattr -i is so small that the test times out waiting for tiny chunks of data to be buffered and appended to an sbuf. Increasing the buffer size should help alleviate some of the burden of reallocating larger sbufs when writing large extended attributes. Submitted by: Ryan Moeller Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D23211 Modified: stable/12/usr.sbin/extattr/rmextattr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/extattr/rmextattr.c ============================================================================== --- stable/12/usr.sbin/extattr/rmextattr.c Thu Feb 13 20:41:20 2020 (r357878) +++ stable/12/usr.sbin/extattr/rmextattr.c Thu Feb 13 20:45:32 2020 (r357879) @@ -104,7 +104,7 @@ mkbuf(char **buf, int *oldlen, int newlen) int main(int argc, char *argv[]) { -#define STDIN_BUF_SZ 1024 +#define STDIN_BUF_SZ 4096 char stdin_data[STDIN_BUF_SZ]; char *p; From owner-svn-src-stable@freebsd.org Thu Feb 13 20:46:06 2020 Return-Path: Delivered-To: svn-src-stable@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 70942234DD8; Thu, 13 Feb 2020 20:46:06 +0000 (UTC) (envelope-from asomers@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) server-signature RSA-PSS (4096 bits) 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 48JT7L2H11z4Y3g; Thu, 13 Feb 2020 20:46:06 +0000 (UTC) (envelope-from asomers@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 495F5189B0; Thu, 13 Feb 2020 20:46:06 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01DKk642005908; Thu, 13 Feb 2020 20:46:06 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01DKk6KO005907; Thu, 13 Feb 2020 20:46:06 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <202002132046.01DKk6KO005907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 13 Feb 2020 20:46:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357880 - stable/12/tests/sys/geom/class/eli X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/tests/sys/geom/class/eli X-SVN-Commit-Revision: 357880 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Feb 2020 20:46:06 -0000 Author: asomers Date: Thu Feb 13 20:46:05 2020 New Revision: 357880 URL: https://svnweb.freebsd.org/changeset/base/357880 Log: MFC r357211: geli: add a test case for attaching multiple providers with 1 command Reviewed by: cem Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D23400 Modified: stable/12/tests/sys/geom/class/eli/attach_test.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/geom/class/eli/attach_test.sh ============================================================================== --- stable/12/tests/sys/geom/class/eli/attach_test.sh Thu Feb 13 20:45:32 2020 (r357879) +++ stable/12/tests/sys/geom/class/eli/attach_test.sh Thu Feb 13 20:46:05 2020 (r357880) @@ -68,6 +68,36 @@ attach_r_cleanup() geli_test_cleanup } +atf_test_case attach_multiple cleanup +attach_multiple_head() +{ + atf_set "descr" "geli attach can attach multiple providers" + atf_set "require.user" "root" +} +attach_multiple_body() +{ + geli_test_setup + + sectors=100 + md0=$(attach_md -t malloc -s `expr $sectors + 1`) + md1=$(attach_md -t malloc -s `expr $sectors + 1`) + md2=$(attach_md -t malloc -s `expr $sectors + 1`) + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + + atf_check geli init -B none -P -K keyfile ${md0} + atf_check geli init -B none -P -K keyfile ${md1} + atf_check geli init -B none -P -K keyfile ${md2} + atf_check geli attach -p -k keyfile ${md0} ${md1} ${md2} + # verify that it did create all 3 geli devices + atf_check -s exit:0 test -c /dev/${md0}.eli + atf_check -s exit:0 test -c /dev/${md1}.eli + atf_check -s exit:0 test -c /dev/${md2}.eli +} +attach_multiple_cleanup() +{ + geli_test_cleanup +} + atf_test_case nokey cleanup nokey_head() { @@ -95,5 +125,6 @@ atf_init_test_cases() { atf_add_test_case attach_d atf_add_test_case attach_r + atf_add_test_case attach_multiple atf_add_test_case nokey } From owner-svn-src-stable@freebsd.org Thu Feb 13 20:49:46 2020 Return-Path: Delivered-To: svn-src-stable@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 3EA3623504B; Thu, 13 Feb 2020 20:49:46 +0000 (UTC) (envelope-from asomers@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) server-signature RSA-PSS (4096 bits) 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 48JTCZ11LWz4YJN; Thu, 13 Feb 2020 20:49:46 +0000 (UTC) (envelope-from asomers@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 044B1189B6; Thu, 13 Feb 2020 20:49:46 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01DKnj2K006126; Thu, 13 Feb 2020 20:49:45 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01DKnjWs006125; Thu, 13 Feb 2020 20:49:45 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <202002132049.01DKnjWs006125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 13 Feb 2020 20:49:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357881 - stable/12/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 357881 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Feb 2020 20:49:46 -0000 Author: asomers Date: Thu Feb 13 20:49:45 2020 New Revision: 357881 URL: https://svnweb.freebsd.org/changeset/base/357881 Log: MFC r357235: Speed up "zpool import" in the presence of many zvols By default, zpools may not be backed by zvols (that can be changed with the "vfs.zfs.vol.recursive" sysctl). When that sysctl is set to 0, the kernel does not attempt to read zvols when looking for vdevs. But the zpool command still does. This change brings the zpool command into line with the kernel's behavior. It speeds "zpool import" when an already imported pool has many zvols, or a zvol with many snapshots. PR: 241083 Reported by: Martin Birgmeier Reviewed by: mav, Ryan Moeller Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D22077 Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Thu Feb 13 20:46:05 2020 (r357880) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Thu Feb 13 20:49:45 2020 (r357881) @@ -1244,12 +1244,20 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importarg avl_tree_t slice_cache; rdsk_node_t *slice; void *cookie; + boolean_t skip_zvols = B_FALSE; + int value; + size_t size = sizeof(value); if (dirs == 0) { dirs = 1; dir = &default_dir; } + if (sysctlbyname("vfs.zfs.vol.recursive", &value, &size, NULL, 0) == 0 + && value == 0) { + skip_zvols = B_TRUE; + } + /* * Go through and read the label configuration information from every * possible device, organizing the information according to pool GUID @@ -1314,6 +1322,10 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importarg } LIST_FOREACH(mp, &mesh.lg_class, lg_class) { + if (skip_zvols && + strcmp(mp->lg_name, "ZFS::ZVOL") == 0) { + continue; + } LIST_FOREACH(gp, &mp->lg_geom, lg_geom) { LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { slice = zfs_alloc(hdl, sizeof (rdsk_node_t)); From owner-svn-src-stable@freebsd.org Fri Feb 14 02:27:01 2020 Return-Path: Delivered-To: svn-src-stable@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 9B6AB23D794; Fri, 14 Feb 2020 02:27:01 +0000 (UTC) (envelope-from kevans@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) server-signature RSA-PSS (4096 bits) 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 48Jchj3cCgz3QmT; Fri, 14 Feb 2020 02:27:01 +0000 (UTC) (envelope-from kevans@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 771971C9AA; Fri, 14 Feb 2020 02:27:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01E2R10T010855; Fri, 14 Feb 2020 02:27:01 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01E2R1ai010854; Fri, 14 Feb 2020 02:27:01 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202002140227.01E2R1ai010854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 14 Feb 2020 02:27:01 +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: r357900 - in stable: 11/etc/periodic/daily 12/usr.sbin/periodic/etc/daily X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/etc/periodic/daily 12/usr.sbin/periodic/etc/daily X-SVN-Commit-Revision: 357900 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Feb 2020 02:27:01 -0000 Author: kevans Date: Fri Feb 14 02:27:01 2020 New Revision: 357900 URL: https://svnweb.freebsd.org/changeset/base/357900 Log: MFC r357756: backup-passwd: mask out all passwords in the diff The previous expression borked if a username had a plus or hyphen in it. This is needlessly restrictive- at leSt a hyphen in the middle is valid. Instead of playing this game, let's just assume the username can't contain a colon and mask out the second field. Modified: stable/11/etc/periodic/daily/200.backup-passwd Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/usr.sbin/periodic/etc/daily/200.backup-passwd Directory Properties: stable/12/ (props changed) Modified: stable/11/etc/periodic/daily/200.backup-passwd ============================================================================== --- stable/11/etc/periodic/daily/200.backup-passwd Fri Feb 14 02:22:08 2020 (r357899) +++ stable/11/etc/periodic/daily/200.backup-passwd Fri Feb 14 02:27:01 2020 (r357900) @@ -42,7 +42,7 @@ case "$daily_backup_passwd_enable" in [ $rc -lt 1 ] && rc=1 echo "$host passwd diffs:" diff -uI '^#' $bak/master.passwd.bak /etc/master.passwd |\ - sed 's/^\([-+ ][^-+:]*\):[^:]*:/\1:(password):/' + sed 's/^\([-+ ][^:]*\):[^:]*:/\1:(password):/' mv $bak/master.passwd.bak $bak/master.passwd.bak2 cp -p /etc/master.passwd $bak/master.passwd.bak || rc=3 fi From owner-svn-src-stable@freebsd.org Fri Feb 14 02:27:01 2020 Return-Path: Delivered-To: svn-src-stable@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 ED82323D7A3; Fri, 14 Feb 2020 02:27:01 +0000 (UTC) (envelope-from kevans@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) server-signature RSA-PSS (4096 bits) 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 48Jchj63Jrz3QmV; Fri, 14 Feb 2020 02:27:01 +0000 (UTC) (envelope-from kevans@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 CB0161C9AB; Fri, 14 Feb 2020 02:27:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01E2R1lf010861; Fri, 14 Feb 2020 02:27:01 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01E2R1Df010860; Fri, 14 Feb 2020 02:27:01 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202002140227.01E2R1Df010860@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 14 Feb 2020 02:27:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357900 - in stable: 11/etc/periodic/daily 12/usr.sbin/periodic/etc/daily X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/etc/periodic/daily 12/usr.sbin/periodic/etc/daily X-SVN-Commit-Revision: 357900 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Feb 2020 02:27:02 -0000 Author: kevans Date: Fri Feb 14 02:27:01 2020 New Revision: 357900 URL: https://svnweb.freebsd.org/changeset/base/357900 Log: MFC r357756: backup-passwd: mask out all passwords in the diff The previous expression borked if a username had a plus or hyphen in it. This is needlessly restrictive- at leSt a hyphen in the middle is valid. Instead of playing this game, let's just assume the username can't contain a colon and mask out the second field. Modified: stable/12/usr.sbin/periodic/etc/daily/200.backup-passwd Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/etc/periodic/daily/200.backup-passwd Directory Properties: stable/11/ (props changed) Modified: stable/12/usr.sbin/periodic/etc/daily/200.backup-passwd ============================================================================== --- stable/12/usr.sbin/periodic/etc/daily/200.backup-passwd Fri Feb 14 02:22:08 2020 (r357899) +++ stable/12/usr.sbin/periodic/etc/daily/200.backup-passwd Fri Feb 14 02:27:01 2020 (r357900) @@ -42,7 +42,7 @@ case "$daily_backup_passwd_enable" in [ $rc -lt 1 ] && rc=1 echo "$host passwd diffs:" diff -uI '^#' $bak/master.passwd.bak /etc/master.passwd |\ - sed 's/^\([-+ ][^-+:]*\):[^:]*:/\1:(password):/' + sed 's/^\([-+ ][^:]*\):[^:]*:/\1:(password):/' mv $bak/master.passwd.bak $bak/master.passwd.bak2 cp -p /etc/master.passwd $bak/master.passwd.bak || rc=3 fi From owner-svn-src-stable@freebsd.org Fri Feb 14 02:31:20 2020 Return-Path: Delivered-To: svn-src-stable@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 C5ED423D953; Fri, 14 Feb 2020 02:31:20 +0000 (UTC) (envelope-from cperciva@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) server-signature RSA-PSS (4096 bits) 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 48Jcnh4dNbz3RBx; Fri, 14 Feb 2020 02:31:20 +0000 (UTC) (envelope-from cperciva@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 9A3C51CAFC; Fri, 14 Feb 2020 02:31:20 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01E2VKTV013400; Fri, 14 Feb 2020 02:31:20 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01E2VKIB013399; Fri, 14 Feb 2020 02:31:20 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <202002140231.01E2VKIB013399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Fri, 14 Feb 2020 02:31:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357901 - stable/12/release/tools X-SVN-Group: stable-12 X-SVN-Commit-Author: cperciva X-SVN-Commit-Paths: stable/12/release/tools X-SVN-Commit-Revision: 357901 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Feb 2020 02:31:20 -0000 Author: cperciva Date: Fri Feb 14 02:31:20 2020 New Revision: 357901 URL: https://svnweb.freebsd.org/changeset/base/357901 Log: MFC r353022: Switch EC2 AMIs from using the dual-dhclient script to using the new dual-dhclient-daemon daemon. This makes it possible to stop/restart the dhclients. Modified: stable/12/release/tools/ec2.conf Directory Properties: stable/12/ (props changed) Modified: stable/12/release/tools/ec2.conf ============================================================================== --- stable/12/release/tools/ec2.conf Fri Feb 14 02:27:01 2020 (r357900) +++ stable/12/release/tools/ec2.conf Fri Feb 14 02:31:20 2020 (r357901) @@ -6,7 +6,7 @@ # Packages to install into the image we're creating. This is a deliberately # minimalist set, providing only the packages necessary to bootstrap further # package installation as specified via EC2 user-data. -export VM_EXTRA_PACKAGES="ec2-scripts firstboot-freebsd-update firstboot-pkgs dual-dhclient" +export VM_EXTRA_PACKAGES="ec2-scripts firstboot-freebsd-update firstboot-pkgs dual-dhclient-daemon" # Include the amazon-ssm-agent package in amd64 images, since some users want # to be able to use it on systems which are not connected to the Internet. From owner-svn-src-stable@freebsd.org Fri Feb 14 13:10:53 2020 Return-Path: Delivered-To: svn-src-stable@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 19DEF2343F4; Fri, 14 Feb 2020 13:10:53 +0000 (UTC) (envelope-from kib@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) server-signature RSA-PSS (4096 bits) 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 48Jtzc5HGhz4ZBG; Fri, 14 Feb 2020 13:10:52 +0000 (UTC) (envelope-from kib@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 B0AF923FFF; Fri, 14 Feb 2020 13:10:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01EDAqPq096501; Fri, 14 Feb 2020 13:10:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01EDAqpG096500; Fri, 14 Feb 2020 13:10:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202002141310.01EDAqpG096500@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 14 Feb 2020 13:10:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357913 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 357913 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Feb 2020 13:10:53 -0000 Author: kib Date: Fri Feb 14 13:10:52 2020 New Revision: 357913 URL: https://svnweb.freebsd.org/changeset/base/357913 Log: MFC r357668: linux futex_put(): do not touch futex after dropping our reference. Modified: stable/12/sys/compat/linux/linux_futex.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_futex.c ============================================================================== --- stable/12/sys/compat/linux/linux_futex.c Fri Feb 14 13:09:41 2020 (r357912) +++ stable/12/sys/compat/linux/linux_futex.c Fri Feb 14 13:10:52 2020 (r357913) @@ -332,9 +332,9 @@ futex_put(struct futex *f, struct waiting_proc *wp) f->f_key.shared); LINUX_CTR3(sys_futex, "futex_put uaddr %p ref %d shared %d", f->f_uaddr, f->f_refcount, f->f_key.shared); - FUTEXES_UNLOCK; if (FUTEX_LOCKED(f)) futex_unlock(f); + FUTEXES_UNLOCK; LIN_SDT_PROBE0(futex, futex_put, return); } From owner-svn-src-stable@freebsd.org Fri Feb 14 13:22:38 2020 Return-Path: Delivered-To: svn-src-stable@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 A9778234A3E; Fri, 14 Feb 2020 13:22:38 +0000 (UTC) (envelope-from kib@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) server-signature RSA-PSS (4096 bits) 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 48JvFB3zgbz4b89; Fri, 14 Feb 2020 13:22:38 +0000 (UTC) (envelope-from kib@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 83E792435C; Fri, 14 Feb 2020 13:22:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01EDMcIt007206; Fri, 14 Feb 2020 13:22:38 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01EDMcnE007205; Fri, 14 Feb 2020 13:22:38 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202002141322.01EDMcnE007205@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 14 Feb 2020 13:22:38 +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: r357915 - stable/11/sys/compat/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/compat/linux X-SVN-Commit-Revision: 357915 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Feb 2020 13:22:38 -0000 Author: kib Date: Fri Feb 14 13:22:38 2020 New Revision: 357915 URL: https://svnweb.freebsd.org/changeset/base/357915 Log: MFC r357668: linux futex_put(): do not touch futex after dropping our reference. Modified: stable/11/sys/compat/linux/linux_futex.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_futex.c ============================================================================== --- stable/11/sys/compat/linux/linux_futex.c Fri Feb 14 13:14:19 2020 (r357914) +++ stable/11/sys/compat/linux/linux_futex.c Fri Feb 14 13:22:38 2020 (r357915) @@ -338,9 +338,9 @@ futex_put(struct futex *f, struct waiting_proc *wp) f->f_key.shared); LINUX_CTR3(sys_futex, "futex_put uaddr %p ref %d shared %d", f->f_uaddr, f->f_refcount, f->f_key.shared); - FUTEXES_UNLOCK; if (FUTEX_LOCKED(f)) futex_unlock(f); + FUTEXES_UNLOCK; LIN_SDT_PROBE0(futex, futex_put, return); } From owner-svn-src-stable@freebsd.org Fri Feb 14 13:25:38 2020 Return-Path: Delivered-To: svn-src-stable@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 2926A234B1A; Fri, 14 Feb 2020 13:25:38 +0000 (UTC) (envelope-from kib@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) server-signature RSA-PSS (4096 bits) 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 48JvJf0Hxyz4bHL; Fri, 14 Feb 2020 13:25:38 +0000 (UTC) (envelope-from kib@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 054F524362; Fri, 14 Feb 2020 13:25:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01EDPbS5007396; Fri, 14 Feb 2020 13:25:37 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01EDPbRv007395; Fri, 14 Feb 2020 13:25:37 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202002141325.01EDPbRv007395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 14 Feb 2020 13:25:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357916 - stable/12/sys/dev/acpica X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/dev/acpica X-SVN-Commit-Revision: 357916 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Feb 2020 13:25:38 -0000 Author: kib Date: Fri Feb 14 13:25:37 2020 New Revision: 357916 URL: https://svnweb.freebsd.org/changeset/base/357916 Log: MFC r357669: acpi_hpet: Add Hygon Dhyana support. Modified: stable/12/sys/dev/acpica/acpi_hpet.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/acpica/acpi_hpet.c ============================================================================== --- stable/12/sys/dev/acpica/acpi_hpet.c Fri Feb 14 13:22:38 2020 (r357915) +++ stable/12/sys/dev/acpica/acpi_hpet.c Fri Feb 14 13:25:37 2020 (r357916) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #define HPET_VENDID_AMD 0x4353 #define HPET_VENDID_AMD2 0x1022 +#define HPET_VENDID_HYGON 0x1d94 #define HPET_VENDID_INTEL 0x8086 #define HPET_VENDID_NVIDIA 0x10de #define HPET_VENDID_SW 0x1166 @@ -604,7 +605,8 @@ hpet_attach(device_t dev) * properly, that makes it very unreliable - it freezes after any * interrupt loss. Avoid legacy IRQs for AMD. */ - if (vendor == HPET_VENDID_AMD || vendor == HPET_VENDID_AMD2) + if (vendor == HPET_VENDID_AMD || vendor == HPET_VENDID_AMD2 || + vendor == HPET_VENDID_HYGON) sc->allowed_irqs = 0x00000000; /* * NVidia MCP5x chipsets have number of unexplained interrupt From owner-svn-src-stable@freebsd.org Fri Feb 14 13:26:46 2020 Return-Path: Delivered-To: svn-src-stable@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 7FF8A234BC9; Fri, 14 Feb 2020 13:26:46 +0000 (UTC) (envelope-from kib@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) server-signature RSA-PSS (4096 bits) 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 48JvKy2prsz4bPj; Fri, 14 Feb 2020 13:26:46 +0000 (UTC) (envelope-from kib@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 5B40324364; Fri, 14 Feb 2020 13:26:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01EDQkVm007503; Fri, 14 Feb 2020 13:26:46 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01EDQjqG007498; Fri, 14 Feb 2020 13:26:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202002141326.01EDQjqG007498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 14 Feb 2020 13:26:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357917 - in stable/12: lib/libpmc lib/libpmc/pmu-events/arch/x86 sys/dev/hwpmc X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12: lib/libpmc lib/libpmc/pmu-events/arch/x86 sys/dev/hwpmc X-SVN-Commit-Revision: 357917 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Feb 2020 13:26:46 -0000 Author: kib Date: Fri Feb 14 13:26:45 2020 New Revision: 357917 URL: https://svnweb.freebsd.org/changeset/base/357917 Log: MFC r357670: pmc: Add Hygon Dhyana support. Modified: stable/12/lib/libpmc/libpmc_pmu_util.c stable/12/lib/libpmc/pmu-events/arch/x86/mapfile.csv stable/12/sys/dev/hwpmc/hwpmc_amd.c stable/12/sys/dev/hwpmc/hwpmc_x86.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libpmc/libpmc_pmu_util.c ============================================================================== --- stable/12/lib/libpmc/libpmc_pmu_util.c Fri Feb 14 13:25:37 2020 (r357916) +++ stable/12/lib/libpmc/libpmc_pmu_util.c Fri Feb 14 13:26:45 2020 (r357917) @@ -103,7 +103,8 @@ pmu_events_mfr(void) free(buf); return (PMU_INVALID); } - if (strcasestr(buf, "AuthenticAMD") != NULL) + if (strcasestr(buf, "AuthenticAMD") != NULL || + strcasestr(buf, "HygonGenuine") != NULL) mfr = PMU_AMD; else if (strcasestr(buf, "GenuineIntel") != NULL) mfr = PMU_INTEL; Modified: stable/12/lib/libpmc/pmu-events/arch/x86/mapfile.csv ============================================================================== --- stable/12/lib/libpmc/pmu-events/arch/x86/mapfile.csv Fri Feb 14 13:25:37 2020 (r357916) +++ stable/12/lib/libpmc/pmu-events/arch/x86/mapfile.csv Fri Feb 14 13:26:45 2020 (r357917) @@ -41,3 +41,4 @@ AuthenticAMD-23-02,v1,amdfam17h,core AuthenticAMD-23-03,v1,amdfam17h,core AuthenticAMD-23-04,v1,amdfam17h,core AuthenticAMD-23-05,v1,amdfam17h,core +HygonGenuine-24-00,v1,amdfam17h,core Modified: stable/12/sys/dev/hwpmc/hwpmc_amd.c ============================================================================== --- stable/12/sys/dev/hwpmc/hwpmc_amd.c Fri Feb 14 13:25:37 2020 (r357916) +++ stable/12/sys/dev/hwpmc/hwpmc_amd.c Fri Feb 14 13:26:45 2020 (r357917) @@ -1045,6 +1045,9 @@ pmc_amd_initialize(void) if (CPUID_TO_FAMILY(cpu_id) == 0x17) snprintf(pmc_cpuid, sizeof(pmc_cpuid), "AuthenticAMD-%d-%02X", CPUID_TO_FAMILY(cpu_id), model); + if (CPUID_TO_FAMILY(cpu_id) == 0x18) + snprintf(pmc_cpuid, sizeof(pmc_cpuid), "HygonGenuine-%d-%02X", + CPUID_TO_FAMILY(cpu_id), model); switch (cpu_id & 0xF00) { #if defined(__i386__) Modified: stable/12/sys/dev/hwpmc/hwpmc_x86.c ============================================================================== --- stable/12/sys/dev/hwpmc/hwpmc_x86.c Fri Feb 14 13:25:37 2020 (r357916) +++ stable/12/sys/dev/hwpmc/hwpmc_x86.c Fri Feb 14 13:26:45 2020 (r357917) @@ -248,7 +248,8 @@ pmc_md_initialize() struct pmc_mdep *md; /* determine the CPU kind */ - if (cpu_vendor_id == CPU_VENDOR_AMD) + if (cpu_vendor_id == CPU_VENDOR_AMD || + cpu_vendor_id == CPU_VENDOR_HYGON) md = pmc_amd_initialize(); else if (cpu_vendor_id == CPU_VENDOR_INTEL) md = pmc_intel_initialize(); @@ -271,7 +272,8 @@ pmc_md_finalize(struct pmc_mdep *md) { lapic_disable_pmc(); - if (cpu_vendor_id == CPU_VENDOR_AMD) + if (cpu_vendor_id == CPU_VENDOR_AMD || + cpu_vendor_id == CPU_VENDOR_HYGON) pmc_amd_finalize(md); else if (cpu_vendor_id == CPU_VENDOR_INTEL) pmc_intel_finalize(md); From owner-svn-src-stable@freebsd.org Sat Feb 15 00:48:45 2020 Return-Path: Delivered-To: svn-src-stable@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 58A932489AE; Sat, 15 Feb 2020 00:48:45 +0000 (UTC) (envelope-from kib@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) server-signature RSA-PSS (4096 bits) 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 48KBSs1hhhz4WZs; Sat, 15 Feb 2020 00:48:45 +0000 (UTC) (envelope-from kib@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 355E648A5; Sat, 15 Feb 2020 00:48:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01F0mjOo022091; Sat, 15 Feb 2020 00:48:45 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01F0mjXF022090; Sat, 15 Feb 2020 00:48:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202002150048.01F0mjXF022090@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 15 Feb 2020 00:48:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357949 - stable/12/libexec/rtld-elf X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/libexec/rtld-elf X-SVN-Commit-Revision: 357949 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Feb 2020 00:48:45 -0000 Author: kib Date: Sat Feb 15 00:48:44 2020 New Revision: 357949 URL: https://svnweb.freebsd.org/changeset/base/357949 Log: MFC r357813: Fix indent. Modified: stable/12/libexec/rtld-elf/rtld.c Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rtld-elf/rtld.c ============================================================================== --- stable/12/libexec/rtld-elf/rtld.c Fri Feb 14 23:27:45 2020 (r357948) +++ stable/12/libexec/rtld-elf/rtld.c Sat Feb 15 00:48:44 2020 (r357949) @@ -5580,26 +5580,30 @@ parse_args(char* argv[], int argc, bool *use_pathp, in print_usage(argv[0]); _exit(0); } else if (opt == 'f') { - /* - * -f XX can be used to specify a descriptor for the - * binary named at the command line (i.e., the later - * argument will specify the process name but the - * descriptor is what will actually be executed) - */ - if (j != arglen - 1) { - /* -f must be the last option in, e.g., -abcf */ - _rtld_error("Invalid options: %s", arg); - rtld_die(); - } - i++; - fd = parse_integer(argv[i]); - if (fd == -1) { - _rtld_error("Invalid file descriptor: '%s'", - argv[i]); - rtld_die(); - } - *fdp = fd; - break; + /* + * -f XX can be used to specify a + * descriptor for the binary named at + * the command line (i.e., the later + * argument will specify the process + * name but the descriptor is what + * will actually be executed). + * + * -f must be the last option in, e.g., -abcf. + */ + if (j != arglen - 1) { + _rtld_error("Invalid options: %s", arg); + rtld_die(); + } + i++; + fd = parse_integer(argv[i]); + if (fd == -1) { + _rtld_error( + "Invalid file descriptor: '%s'", + argv[i]); + rtld_die(); + } + *fdp = fd; + break; } else if (opt == 'p') { *use_pathp = true; } else { From owner-svn-src-stable@freebsd.org Sat Feb 15 11:42:14 2020 Return-Path: Delivered-To: svn-src-stable@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 321AF257EB4; Sat, 15 Feb 2020 11:42:14 +0000 (UTC) (envelope-from vmaffione@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) server-signature RSA-PSS (4096 bits) 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 48KSyt0Bygz48fB; Sat, 15 Feb 2020 11:42:14 +0000 (UTC) (envelope-from vmaffione@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 01E36C4B4; Sat, 15 Feb 2020 11:42:14 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01FBgDID016982; Sat, 15 Feb 2020 11:42:13 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01FBgDoX016980; Sat, 15 Feb 2020 11:42:13 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <202002151142.01FBgDoX016980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Sat, 15 Feb 2020 11:42:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357960 - in stable/12: share/man/man4 sys/dev/netmap X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/netmap X-SVN-Commit-Revision: 357960 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Feb 2020 11:42:14 -0000 Author: vmaffione Date: Sat Feb 15 11:42:13 2020 New Revision: 357960 URL: https://svnweb.freebsd.org/changeset/base/357960 Log: MFC r357663 netmap: improve netmap(4) and vale(4) man pages Clean up obsolete sysctl descriptions and add missing ones. PR: 243838 Reviewed by: bcr Differential Revision: https://reviews.freebsd.org/D23546 Modified: stable/12/share/man/man4/netmap.4 stable/12/share/man/man4/vale.4 stable/12/sys/dev/netmap/netmap_kern.h Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/netmap.4 ============================================================================== --- stable/12/share/man/man4/netmap.4 Sat Feb 15 03:47:25 2020 (r357959) +++ stable/12/share/man/man4/netmap.4 Sat Feb 15 11:42:13 2020 (r357960) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 26, 2019 +.Dd February 6, 2020 .Dt NETMAP 4 .Os .Sh NAME @@ -694,7 +694,7 @@ or are called with a write event (POLLOUT/wfdset) or a full ring. .Pp When registering a virtual interface that is dynamically created to a -.Xr vale 4 +.Nm VALE switch, we can specify the desired number of rings (1 by default, and currently up to 16) on it using nr_tx_rings and nr_rx_rings fields. .It Dv NIOCTXSYNC @@ -861,8 +861,10 @@ The sysctl variable .Va dev.netmap.admode globally controls how netmap mode is implemented. .Sh SYSCTL VARIABLES AND MODULE PARAMETERS -Some aspect of the operation of +Some aspects of the operation of .Nm +and +.Nm VALE are controlled through sysctl variables on .Fx .Em ( dev.netmap.* ) @@ -883,15 +885,14 @@ Number of rings used for emulated netmap mode Ring size used for emulated netmap mode .It Va dev.netmap.generic_mit: 100000 Controls interrupt moderation for emulated mode -.It Va dev.netmap.mmap_unreg: 0 .It Va dev.netmap.fwd: 0 Forces NS_FORWARD mode -.It Va dev.netmap.flags: 0 .It Va dev.netmap.txsync_retry: 2 +Number of txsync loops in the +.Nm VALE +flush function .It Va dev.netmap.no_pendintr: 1 Forces recovery of transmit buffers on system calls -.It Va dev.netmap.mitigate: 1 -Propagates interrupt mitigation to user processes .It Va dev.netmap.no_timestamp: 0 Disables the update of the timestamp in the netmap ring .It Va dev.netmap.verbose: 0 @@ -914,6 +915,18 @@ as it impacts the total amount of memory used by netma .It Va dev.netmap.if_curr_num: 0 .It Va dev.netmap.if_curr_size: 0 Actual values in use. +.It Va dev.netmap.priv_buf_num: 4098 +.It Va dev.netmap.priv_buf_size: 2048 +.It Va dev.netmap.priv_ring_num: 4 +.It Va dev.netmap.priv_ring_size: 20480 +.It Va dev.netmap.priv_if_num: 2 +.It Va dev.netmap.priv_if_size: 1024 +Sizes and number of objects (netmap_if, netmap_ring, buffers) +for private memory regions. +A separate memory region is used for each +.Nm VALE +port and each pair of +.Nm netmap pipes . .It Va dev.netmap.bridge_batch: 1024 Batch size used when moving packets across a .Nm VALE Modified: stable/12/share/man/man4/vale.4 ============================================================================== --- stable/12/share/man/man4/vale.4 Sat Feb 15 03:47:25 2020 (r357959) +++ stable/12/share/man/man4/vale.4 Sat Feb 15 11:42:13 2020 (r357960) @@ -28,7 +28,7 @@ .\" $FreeBSD$ .\" $Id: $ .\" -.Dd Jan 9, 2019 +.Dd February 6, 2020 .Dt VALE 4 .Os .Sh NAME @@ -77,21 +77,13 @@ See for details on the API. .Ss LIMITS .Nm -currently supports up to 4 switches, 16 ports per switch, with -1024 buffers per port. -These hard limits will be -changed to sysctl variables in future releases. +currently supports up to 8 switches, with 254 ports per switch. .Sh SYSCTL VARIABLES +See +.Xr netmap 4 +for a list of sysctl variables that affect .Nm -uses the following sysctl variables to control operation: -.Bl -tag -width dev.netmap.verbose -.It dev.netmap.bridge_batch -The maximum number of packets processed internally -in each iteration. -Defaults to 1024, use lower values to trade latency -with throughput. -.It dev.netmap.verbose -Set to non-zero values to enable in-kernel diagnostics. +bridges. .El .Sh EXAMPLES Create one switch, with a traffic generator connected to one Modified: stable/12/sys/dev/netmap/netmap_kern.h ============================================================================== --- stable/12/sys/dev/netmap/netmap_kern.h Sat Feb 15 03:47:25 2020 (r357959) +++ stable/12/sys/dev/netmap/netmap_kern.h Sat Feb 15 11:42:13 2020 (r357960) @@ -1591,7 +1591,6 @@ int netmap_adapter_put(struct netmap_adapter *na); #define NETMAP_BUF_BASE(_na) ((_na)->na_lut.lut[0].vaddr) #define NETMAP_BUF_SIZE(_na) ((_na)->na_lut.objsize) extern int netmap_no_pendintr; -extern int netmap_mitigate; extern int netmap_verbose; #ifdef CONFIG_NETMAP_DEBUG extern int netmap_debug; /* for debugging */ @@ -1613,7 +1612,6 @@ enum { /* debug flags }; extern int netmap_txsync_retry; -extern int netmap_flags; extern int netmap_generic_hwcsum; extern int netmap_generic_mit; extern int netmap_generic_ringsize; From owner-svn-src-stable@freebsd.org Sat Feb 15 12:05:12 2020 Return-Path: Delivered-To: svn-src-stable@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 B3C62239164; Sat, 15 Feb 2020 12:05:12 +0000 (UTC) (envelope-from vmaffione@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) server-signature RSA-PSS (4096 bits) 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 48KTTN4NFFz4B4Z; Sat, 15 Feb 2020 12:05:12 +0000 (UTC) (envelope-from vmaffione@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 90FCFC89C; Sat, 15 Feb 2020 12:05:12 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01FC5CaT028911; Sat, 15 Feb 2020 12:05:12 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01FC5C9H028908; Sat, 15 Feb 2020 12:05:12 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <202002151205.01FC5C9H028908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Sat, 15 Feb 2020 12:05: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: r357961 - in stable/11: share/man/man4 sys/dev/netmap X-SVN-Group: stable-11 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/dev/netmap X-SVN-Commit-Revision: 357961 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Feb 2020 12:05:12 -0000 Author: vmaffione Date: Sat Feb 15 12:05:11 2020 New Revision: 357961 URL: https://svnweb.freebsd.org/changeset/base/357961 Log: MFC r357663 netmap: improve netmap(4) and vale(4) man pages Clean up obsolete sysctl descriptions and add missing ones. PR: 243838 Reviewed by: bcr Differential Revision: https://reviews.freebsd.org/D23546 Modified: stable/11/share/man/man4/netmap.4 stable/11/share/man/man4/vale.4 stable/11/sys/dev/netmap/netmap_kern.h Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/netmap.4 ============================================================================== --- stable/11/share/man/man4/netmap.4 Sat Feb 15 11:42:13 2020 (r357960) +++ stable/11/share/man/man4/netmap.4 Sat Feb 15 12:05:11 2020 (r357961) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 20, 2018 +.Dd February 6, 2020 .Dt NETMAP 4 .Os .Sh NAME @@ -694,7 +694,7 @@ or are called with a write event (POLLOUT/wfdset) or a full ring. .Pp When registering a virtual interface that is dynamically created to a -.Xr vale 4 +.Nm VALE switch, we can specify the desired number of rings (1 by default, and currently up to 16) on it using nr_tx_rings and nr_rx_rings fields. .It Dv NIOCTXSYNC @@ -861,8 +861,10 @@ The sysctl variable .Va dev.netmap.admode globally controls how netmap mode is implemented. .Sh SYSCTL VARIABLES AND MODULE PARAMETERS -Some aspect of the operation of +Some aspects of the operation of .Nm +and +.Nm VALE are controlled through sysctl variables on .Fx .Em ( dev.netmap.* ) @@ -883,15 +885,14 @@ Number of rings used for emulated netmap mode Ring size used for emulated netmap mode .It Va dev.netmap.generic_mit: 100000 Controls interrupt moderation for emulated mode -.It Va dev.netmap.mmap_unreg: 0 .It Va dev.netmap.fwd: 0 Forces NS_FORWARD mode -.It Va dev.netmap.flags: 0 .It Va dev.netmap.txsync_retry: 2 +Number of txsync loops in the +.Nm VALE +flush function .It Va dev.netmap.no_pendintr: 1 Forces recovery of transmit buffers on system calls -.It Va dev.netmap.mitigate: 1 -Propagates interrupt mitigation to user processes .It Va dev.netmap.no_timestamp: 0 Disables the update of the timestamp in the netmap ring .It Va dev.netmap.verbose: 0 @@ -914,6 +915,18 @@ as it impacts the total amount of memory used by netma .It Va dev.netmap.if_curr_num: 0 .It Va dev.netmap.if_curr_size: 0 Actual values in use. +.It Va dev.netmap.priv_buf_num: 4098 +.It Va dev.netmap.priv_buf_size: 2048 +.It Va dev.netmap.priv_ring_num: 4 +.It Va dev.netmap.priv_ring_size: 20480 +.It Va dev.netmap.priv_if_num: 2 +.It Va dev.netmap.priv_if_size: 1024 +Sizes and number of objects (netmap_if, netmap_ring, buffers) +for private memory regions. +A separate memory region is used for each +.Nm VALE +port and each pair of +.Nm netmap pipes . .It Va dev.netmap.bridge_batch: 1024 Batch size used when moving packets across a .Nm VALE Modified: stable/11/share/man/man4/vale.4 ============================================================================== --- stable/11/share/man/man4/vale.4 Sat Feb 15 11:42:13 2020 (r357960) +++ stable/11/share/man/man4/vale.4 Sat Feb 15 12:05:11 2020 (r357961) @@ -28,7 +28,7 @@ .\" $FreeBSD$ .\" $Id: $ .\" -.Dd Jan 9, 2019 +.Dd February 6, 2020 .Dt VALE 4 .Os .Sh NAME @@ -77,21 +77,13 @@ See for details on the API. .Ss LIMITS .Nm -currently supports up to 4 switches, 16 ports per switch, with -1024 buffers per port. -These hard limits will be -changed to sysctl variables in future releases. +currently supports up to 8 switches, with 254 ports per switch. .Sh SYSCTL VARIABLES +See +.Xr netmap 4 +for a list of sysctl variables that affect .Nm -uses the following sysctl variables to control operation: -.Bl -tag -width dev.netmap.verbose -.It dev.netmap.bridge_batch -The maximum number of packets processed internally -in each iteration. -Defaults to 1024, use lower values to trade latency -with throughput. -.It dev.netmap.verbose -Set to non-zero values to enable in-kernel diagnostics. +bridges. .El .Sh EXAMPLES Create one switch, with a traffic generator connected to one Modified: stable/11/sys/dev/netmap/netmap_kern.h ============================================================================== --- stable/11/sys/dev/netmap/netmap_kern.h Sat Feb 15 11:42:13 2020 (r357960) +++ stable/11/sys/dev/netmap/netmap_kern.h Sat Feb 15 12:05:11 2020 (r357961) @@ -1611,7 +1611,6 @@ enum { /* debug flags }; extern int netmap_txsync_retry; -extern int netmap_flags; extern int netmap_generic_hwcsum; extern int netmap_generic_mit; extern int netmap_generic_ringsize;