From owner-dev-commits-src-branches@freebsd.org Mon May 17 00:16:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 6ADF863713A; Mon, 17 May 2021 00:16:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fk07D2b6mz4t9f; Mon, 17 May 2021 00:16:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 328702216E; Mon, 17 May 2021 00:16:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14H0Guso072172; Mon, 17 May 2021 00:16:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14H0Gurv072171; Mon, 17 May 2021 00:16:56 GMT (envelope-from git) Date: Mon, 17 May 2021 00:16:56 GMT Message-Id: <202105170016.14H0Gurv072171@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: 501b4fb50e80 - stable/13 - Make fsck_ffs more persistent in creating a lost+found directory. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 501b4fb50e80d9f34ec85f79a4e438d66f9a00e4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 00:16:56 -0000 The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=501b4fb50e80d9f34ec85f79a4e438d66f9a00e4 commit 501b4fb50e80d9f34ec85f79a4e438d66f9a00e4 Author: Kirk McKusick AuthorDate: 2021-04-26 23:47:27 +0000 Commit: Kirk McKusick CommitDate: 2021-05-17 00:18:31 +0000 Make fsck_ffs more persistent in creating a lost+found directory. (cherry picked from commit 84a0e3f95700733695115fb2a9d84d6666efe5d9) Sponsored by: Netflix --- sbin/fsck_ffs/dir.c | 2 ++ sbin/fsck_ffs/fsutil.c | 6 ++++-- sbin/fsck_ffs/inode.c | 19 +++++++++++++------ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c index e88d1650ce5a..e806f113ff16 100644 --- a/sbin/fsck_ffs/dir.c +++ b/sbin/fsck_ffs/dir.c @@ -801,6 +801,8 @@ allocdir(ino_t parent, ino_t request, int mode) struct dirtemplate *dirp; ino = allocino(request, IFDIR|mode); + if (ino == 0) + return (0); dirp = &dirhead; dirp->dot_ino = ino; dirp->dotdot_ino = parent; diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c index ca19f6726af5..276d543dedc6 100644 --- a/sbin/fsck_ffs/fsutil.c +++ b/sbin/fsck_ffs/fsutil.c @@ -1048,8 +1048,10 @@ allocblk(long frags) cg = dtog(&sblock, i + j); cgbp = cglookup(cg); cgp = cgbp->b_un.b_cg; - if (!check_cgmagic(cg, cgbp, 0)) - return (0); + if (!check_cgmagic(cg, cgbp, 0)) { + i = (cg + 1) * sblock.fs_fpg - sblock.fs_frag; + continue; + } baseblk = dtogd(&sblock, i + j); for (k = 0; k < frags; k++) { setbmap(i + j + k); diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c index 020a69dd72f8..d4e5723f559f 100644 --- a/sbin/fsck_ffs/inode.c +++ b/sbin/fsck_ffs/inode.c @@ -902,22 +902,29 @@ allocino(ino_t request, int type) union dinode *dp; struct bufarea *cgbp; struct cg *cgp; - int cg; + int cg, anyino; - if (request == 0) + anyino = 0; + if (request == 0) { request = UFS_ROOTINO; - else if (inoinfo(request)->ino_state != USTATE) + anyino = 1; + } else if (inoinfo(request)->ino_state != USTATE) return (0); +retry: for (ino = request; ino < maxino; ino++) if (inoinfo(ino)->ino_state == USTATE) break; - if (ino == maxino) + if (ino >= maxino) return (0); cg = ino_to_cg(&sblock, ino); cgbp = cglookup(cg); cgp = cgbp->b_un.b_cg; - if (!check_cgmagic(cg, cgbp, 0)) - return (0); + if (!check_cgmagic(cg, cgbp, 0)) { + if (anyino == 0) + return (0); + request = (cg + 1) * sblock.fs_ipg; + goto retry; + } setbit(cg_inosused(cgp), ino % sblock.fs_ipg); cgp->cg_cs.cs_nifree--; switch (type & IFMT) { From owner-dev-commits-src-branches@freebsd.org Mon May 17 00:32:02 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 E4277637708; Mon, 17 May 2021 00:32:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fk0Sf5y0Vz3CLm; Mon, 17 May 2021 00:32:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B538F2290C; Mon, 17 May 2021 00:32:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14H0W25s097716; Mon, 17 May 2021 00:32:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14H0W24e097715; Mon, 17 May 2021 00:32:02 GMT (envelope-from git) Date: Mon, 17 May 2021 00:32:02 GMT Message-Id: <202105170032.14H0W24e097715@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: 8f28af0a445f - stable/12 - Make fsck_ffs more persistent in creating a lost+found directory. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 8f28af0a445f32852d9c7de8bdcf890c2d27b86e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 00:32:03 -0000 The branch stable/12 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=8f28af0a445f32852d9c7de8bdcf890c2d27b86e commit 8f28af0a445f32852d9c7de8bdcf890c2d27b86e Author: Kirk McKusick AuthorDate: 2021-04-26 23:47:27 +0000 Commit: Kirk McKusick CommitDate: 2021-05-17 00:35:22 +0000 Make fsck_ffs more persistent in creating a lost+found directory. (cherry picked from commit 84a0e3f95700733695115fb2a9d84d6666efe5d9) Sponsored by: Netflix --- sbin/fsck_ffs/dir.c | 2 ++ sbin/fsck_ffs/fsutil.c | 6 ++++-- sbin/fsck_ffs/inode.c | 19 +++++++++++++------ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c index 25ff6aa30018..09a561984c1b 100644 --- a/sbin/fsck_ffs/dir.c +++ b/sbin/fsck_ffs/dir.c @@ -696,6 +696,8 @@ allocdir(ino_t parent, ino_t request, int mode) struct dirtemplate *dirp; ino = allocino(request, IFDIR|mode); + if (ino == 0) + return (0); dirp = &dirhead; dirp->dot_ino = ino; dirp->dotdot_ino = parent; diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c index 91be4234ae48..84c4437d3312 100644 --- a/sbin/fsck_ffs/fsutil.c +++ b/sbin/fsck_ffs/fsutil.c @@ -770,8 +770,10 @@ allocblk(long frags) cg = dtog(&sblock, i + j); cgbp = cglookup(cg); cgp = cgbp->b_un.b_cg; - if (!check_cgmagic(cg, cgbp)) - return (0); + if (!check_cgmagic(cg, cgbp)) { + i = (cg + 1) * sblock.fs_fpg - sblock.fs_frag; + continue; + } baseblk = dtogd(&sblock, i + j); for (k = 0; k < frags; k++) { setbmap(i + j + k); diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c index b88a2646ff04..bfc0c5e25240 100644 --- a/sbin/fsck_ffs/inode.c +++ b/sbin/fsck_ffs/inode.c @@ -668,22 +668,29 @@ allocino(ino_t request, int type) union dinode *dp; struct bufarea *cgbp; struct cg *cgp; - int cg; + int cg, anyino; - if (request == 0) + anyino = 0; + if (request == 0) { request = UFS_ROOTINO; - else if (inoinfo(request)->ino_state != USTATE) + anyino = 1; + } else if (inoinfo(request)->ino_state != USTATE) return (0); +retry: for (ino = request; ino < maxino; ino++) if (inoinfo(ino)->ino_state == USTATE) break; - if (ino == maxino) + if (ino >= maxino) return (0); cg = ino_to_cg(&sblock, ino); cgbp = cglookup(cg); cgp = cgbp->b_un.b_cg; - if (!check_cgmagic(cg, cgbp)) - return (0); + if (!check_cgmagic(cg, cgbp)) { + if (anyino == 0) + return (0); + request = (cg + 1) * sblock.fs_ipg; + goto retry; + } setbit(cg_inosused(cgp), ino % sblock.fs_ipg); cgp->cg_cs.cs_nifree--; switch (type & IFMT) { From owner-dev-commits-src-branches@freebsd.org Mon May 17 00:38:22 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 63C04637809; Mon, 17 May 2021 00:38:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fk0by2BB6z3CxF; Mon, 17 May 2021 00:38:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D7192298C; Mon, 17 May 2021 00:38:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14H0cMj7098284; Mon, 17 May 2021 00:38:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14H0cMJd098283; Mon, 17 May 2021 00:38:22 GMT (envelope-from git) Date: Mon, 17 May 2021 00:38:22 GMT Message-Id: <202105170038.14H0cMJd098283@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: 2e762b02521c - stable/13 - Clean up fsck_ffs error message output. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2e762b02521c8d189f568ddf14cda025e40bb1ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 00:38:22 -0000 The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=2e762b02521c8d189f568ddf14cda025e40bb1ef commit 2e762b02521c8d189f568ddf14cda025e40bb1ef Author: Kirk McKusick AuthorDate: 2021-04-27 01:42:48 +0000 Commit: Kirk McKusick CommitDate: 2021-05-17 00:41:11 +0000 Clean up fsck_ffs error message output. (cherry picked from commit 689724cb23c2acf58091c80f27de4823d7cd87ca) Sponsored by: Netflix --- sbin/fsck_ffs/fsutil.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c index 276d543dedc6..b13ba4c54bde 100644 --- a/sbin/fsck_ffs/fsutil.c +++ b/sbin/fsck_ffs/fsutil.c @@ -948,6 +948,7 @@ check_cgmagic(int cg, struct bufarea *cgbp, int request_rebuild) { struct cg *cgp = cgbp->b_un.b_cg; uint32_t cghash, calchash; + static int prevfailcg = -1; /* * Extended cylinder group checks. @@ -973,9 +974,14 @@ check_cgmagic(int cg, struct bufarea *cgbp, int request_rebuild) cgp->cg_initediblk <= sblock.fs_ipg))) { return (1); } + if (prevfailcg == cg) + return (0); + prevfailcg = cg; pfatal("CYLINDER GROUP %d: INTEGRITY CHECK FAILED", cg); - if (!request_rebuild) + if (!request_rebuild) { + printf("\n"); return (0); + } if (!reply("REBUILD CYLINDER GROUP")) { printf("YOU WILL NEED TO RERUN FSCK.\n"); rerun = 1; From owner-dev-commits-src-branches@freebsd.org Mon May 17 02:23:19 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 8C5E46392A2; Mon, 17 May 2021 02:23:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fk2x33HnCz3hVx; Mon, 17 May 2021 02:23:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 592BD23F95; Mon, 17 May 2021 02:23:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14H2NJ5Y044179; Mon, 17 May 2021 02:23:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14H2NJP4044178; Mon, 17 May 2021 02:23:19 GMT (envelope-from git) Date: Mon, 17 May 2021 02:23:19 GMT Message-Id: <202105170223.14H2NJP4044178@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: c9361f2fb0fb - stable/13 - ixgbe: Restore AIM support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c9361f2fb0fb76521c7354ffe73d57d72172a661 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 02:23:19 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c9361f2fb0fb76521c7354ffe73d57d72172a661 commit c9361f2fb0fb76521c7354ffe73d57d72172a661 Author: Sai Rajesh Tallamraju AuthorDate: 2021-05-03 17:45:00 +0000 Commit: Mark Johnston CommitDate: 2021-05-17 02:21:10 +0000 ixgbe: Restore AIM support AIM (adaptive interrupt moderation) was part of BSD11 driver. Upon IFLIB migration, AIM feature got lost. Re-introducing AIM back into IFLIB based IXGBE driver. One caveat is that in BSD11 driver, a queue comprises both Rx and Tx ring. Starting from BSD12, Rx and Tx have their own queues and rings. Also, IRQ is now only configured for Rx side. So, when AIM is re-enabled, we should now consider only Rx stats for configuring EITR register in contrast to BSD11 where Rx and Tx stats were considered to manipulate EITR register. Reviewed by: gallatin, markj Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D27344 (cherry picked from commit 64881da478071431a2d9e62613997a5772c56cdf) --- sys/dev/ixgbe/if_ix.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++ sys/dev/ixgbe/ixgbe.h | 1 + 2 files changed, 74 insertions(+) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 77ef118493a2..43c9d9c72b9a 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -347,6 +347,16 @@ static int ixgbe_enable_rss = 1; SYSCTL_INT(_hw_ix, OID_AUTO, enable_rss, CTLFLAG_RDTUN, &ixgbe_enable_rss, 0, "Enable Receive-Side Scaling (RSS)"); +/* + * AIM: Adaptive Interrupt Moderation + * which means that the interrupt rate + * is varied over time based on the + * traffic for that interrupt vector + */ +static int ixgbe_enable_aim = FALSE; +SYSCTL_INT(_hw_ix, OID_AUTO, enable_aim, CTLFLAG_RWTUN, &ixgbe_enable_aim, 0, + "Enable adaptive interrupt moderation"); + #if 0 /* Keep running tab on them for sanity check */ static int ixgbe_total_ports; @@ -2100,6 +2110,60 @@ fail: return (error); } /* ixgbe_if_msix_intr_assign */ +static inline void +ixgbe_perform_aim(struct adapter *adapter, struct ix_rx_queue *que) +{ + uint32_t newitr = 0; + struct rx_ring *rxr = &que->rxr; + + /* + * Do Adaptive Interrupt Moderation: + * - Write out last calculated setting + * - Calculate based on average size over + * the last interval. + */ + if (que->eitr_setting) { + IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITR(que->msix), + que->eitr_setting); + } + + que->eitr_setting = 0; + /* Idle, do nothing */ + if (rxr->bytes == 0) { + return; + } + + if ((rxr->bytes) && (rxr->packets)) { + newitr = (rxr->bytes / rxr->packets); + } + + newitr += 24; /* account for hardware frame, crc */ + /* set an upper boundary */ + newitr = min(newitr, 3000); + + /* Be nice to the mid range */ + if ((newitr > 300) && (newitr < 1200)) { + newitr = (newitr / 3); + } else { + newitr = (newitr / 2); + } + + if (adapter->hw.mac.type == ixgbe_mac_82598EB) { + newitr |= newitr << 16; + } else { + newitr |= IXGBE_EITR_CNT_WDIS; + } + + /* save for next interrupt */ + que->eitr_setting = newitr; + + /* Reset state */ + rxr->bytes = 0; + rxr->packets = 0; + + return; +} + /********************************************************************* * ixgbe_msix_que - MSI-X Queue Interrupt Service routine **********************************************************************/ @@ -2117,6 +2181,11 @@ ixgbe_msix_que(void *arg) ixgbe_disable_queue(adapter, que->msix); ++que->irqs; + /* Check for AIM */ + if (adapter->enable_aim) { + ixgbe_perform_aim(adapter, que); + } + return (FILTER_SCHEDULE_THREAD); } /* ixgbe_msix_que */ @@ -2575,6 +2644,10 @@ ixgbe_add_device_sysctls(if_ctx_t ctx) adapter, 0, ixgbe_sysctl_advertise, "I", IXGBE_SYSCTL_DESC_ADV_SPEED); + adapter->enable_aim = ixgbe_enable_aim; + SYSCTL_ADD_INT(ctx_list, child, OID_AUTO, "enable_aim", CTLFLAG_RW, + &adapter->enable_aim, 0, "Interrupt Moderation"); + #ifdef IXGBE_DEBUG /* testing sysctls (for all devices) */ SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "power_state", diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h index 30dd1d5368fb..31d5cc41c066 100644 --- a/sys/dev/ixgbe/ixgbe.h +++ b/sys/dev/ixgbe/ixgbe.h @@ -408,6 +408,7 @@ struct adapter { /* Info about the interface */ int advertise; /* link speeds */ + int enable_aim; /* adaptive interrupt moderation */ bool link_active; u16 num_segs; u32 link_speed; From owner-dev-commits-src-branches@freebsd.org Mon May 17 05:00:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 958E663BF71; Mon, 17 May 2021 05:00:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fk6QF3nN0z4X5f; Mon, 17 May 2021 05:00:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6AA7725978; Mon, 17 May 2021 05:00:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14H50L0E053503; Mon, 17 May 2021 05:00:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14H50LtD053502; Mon, 17 May 2021 05:00:21 GMT (envelope-from git) Date: Mon, 17 May 2021 05:00:21 GMT Message-Id: <202105170500.14H50LtD053502@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: cad6b1e358b4 - stable/12 - Clean up fsck_ffs error message output. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: cad6b1e358b448e114d87607278cb7860ef661d1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 05:00:21 -0000 The branch stable/12 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=cad6b1e358b448e114d87607278cb7860ef661d1 commit cad6b1e358b448e114d87607278cb7860ef661d1 Author: Kirk McKusick AuthorDate: 2021-04-27 01:42:48 +0000 Commit: Kirk McKusick CommitDate: 2021-05-17 05:03:32 +0000 Clean up fsck_ffs error message output. (cherry picked from commit 689724cb23c2acf58091c80f27de4823d7cd87ca) Sponsored by: Netflix --- sbin/fsck_ffs/fsutil.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c index 84c4437d3312..df2e62d583c2 100644 --- a/sbin/fsck_ffs/fsutil.c +++ b/sbin/fsck_ffs/fsutil.c @@ -682,6 +682,7 @@ int check_cgmagic(int cg, struct bufarea *cgbp) { struct cg *cgp = cgbp->b_un.b_cg; + static int prevfailcg = -1; /* * Extended cylinder group checks. @@ -697,6 +698,9 @@ check_cgmagic(int cg, struct bufarea *cgbp) cgp->cg_initediblk <= sblock.fs_ipg))) { return (1); } + if (prevfailcg == cg) + return (0); + prevfailcg = cg; pfatal("CYLINDER GROUP %d: BAD MAGIC NUMBER", cg); if (!reply("REBUILD CYLINDER GROUP")) { printf("YOU WILL NEED TO RERUN FSCK.\n"); From owner-dev-commits-src-branches@freebsd.org Mon May 17 06:05:35 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 EAAF263D580; Mon, 17 May 2021 06:05:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fk7sW6613z4gXp; Mon, 17 May 2021 06:05:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5EA4268D8; Mon, 17 May 2021 06:05:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14H65ZQi038559; Mon, 17 May 2021 06:05:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14H65Z54038558; Mon, 17 May 2021 06:05:35 GMT (envelope-from git) Date: Mon, 17 May 2021 06:05:35 GMT Message-Id: <202105170605.14H65Z54038558@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: daa020139f1f - stable/13 - Clean up copyright messages. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: daa020139f1fe081eccb520c494dd2e5434aeaab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 06:05:36 -0000 The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=daa020139f1fe081eccb520c494dd2e5434aeaab commit daa020139f1fe081eccb520c494dd2e5434aeaab Author: Kirk McKusick AuthorDate: 2021-05-11 06:01:58 +0000 Commit: Kirk McKusick CommitDate: 2021-05-17 06:09:42 +0000 Clean up copyright messages. (cherry picked from commit 9e16b9530aab5e1c4efee2a8fe2feaf33340c764) --- usr.bin/systat/sysput.c | 9 ++++----- usr.bin/systat/zarc.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/usr.bin/systat/sysput.c b/usr.bin/systat/sysput.c index 10401cee772a..e089c5c2ff55 100644 --- a/usr.bin/systat/sysput.c +++ b/usr.bin/systat/sysput.c @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2019, 2020 Yoshihiro Ota * * Redistribution and use in source and binary forms, with or without @@ -9,14 +11,11 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) diff --git a/usr.bin/systat/zarc.c b/usr.bin/systat/zarc.c index bb6aada8581c..41efe136779d 100644 --- a/usr.bin/systat/zarc.c +++ b/usr.bin/systat/zarc.c @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 - 2017, 2019 Yoshihiro Ota * * Redistribution and use in source and binary forms, with or without @@ -9,14 +11,11 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) From owner-dev-commits-src-branches@freebsd.org Mon May 17 06:07:08 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 49D5763D1E3; Mon, 17 May 2021 06:07:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fk7vJ1C5Kz4gSG; Mon, 17 May 2021 06:07:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07B3D26C45; Mon, 17 May 2021 06:07:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14H677bm038767; Mon, 17 May 2021 06:07:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14H677Hc038766; Mon, 17 May 2021 06:07:07 GMT (envelope-from git) Date: Mon, 17 May 2021 06:07:07 GMT Message-Id: <202105170607.14H677Hc038766@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: a7e6401ac7cc - stable/12 - Clean up copyright messages. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a7e6401ac7cc8acfbabab9aad8f6acb743d4d156 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 06:07:08 -0000 The branch stable/12 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=a7e6401ac7cc8acfbabab9aad8f6acb743d4d156 commit a7e6401ac7cc8acfbabab9aad8f6acb743d4d156 Author: Kirk McKusick AuthorDate: 2021-05-11 06:01:58 +0000 Commit: Kirk McKusick CommitDate: 2021-05-17 06:10:38 +0000 Clean up copyright messages. (cherry picked from commit 9e16b9530aab5e1c4efee2a8fe2feaf33340c764) --- usr.bin/systat/sysput.c | 9 ++++----- usr.bin/systat/zarc.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/usr.bin/systat/sysput.c b/usr.bin/systat/sysput.c index 10401cee772a..e089c5c2ff55 100644 --- a/usr.bin/systat/sysput.c +++ b/usr.bin/systat/sysput.c @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2019, 2020 Yoshihiro Ota * * Redistribution and use in source and binary forms, with or without @@ -9,14 +11,11 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) diff --git a/usr.bin/systat/zarc.c b/usr.bin/systat/zarc.c index bb6aada8581c..41efe136779d 100644 --- a/usr.bin/systat/zarc.c +++ b/usr.bin/systat/zarc.c @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 - 2017, 2019 Yoshihiro Ota * * Redistribution and use in source and binary forms, with or without @@ -9,14 +11,11 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) From owner-dev-commits-src-branches@freebsd.org Mon May 17 06:10:10 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 58D4E63D454; Mon, 17 May 2021 06:10:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fk7yp25gjz4h5T; Mon, 17 May 2021 06:10:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2FF8426BE1; Mon, 17 May 2021 06:10:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14H6AAXC042265; Mon, 17 May 2021 06:10:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14H6AAX5042262; Mon, 17 May 2021 06:10:10 GMT (envelope-from git) Date: Mon, 17 May 2021 06:10:10 GMT Message-Id: <202105170610.14H6AAX5042262@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: e0f2b8aaf1ed - stable/13 - service/ipfw: Silence warning on restart MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e0f2b8aaf1ed210c571b8a75749d072570eac88c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 06:10:10 -0000 The branch stable/13 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=e0f2b8aaf1ed210c571b8a75749d072570eac88c commit e0f2b8aaf1ed210c571b8a75749d072570eac88c Author: Lutz Donnerhacke AuthorDate: 2021-05-02 20:47:04 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-17 06:08:41 +0000 service/ipfw: Silence warning on restart Once the ipfw0 interface has been created, ifconfig(8) create will throw a warning: "ifconfig: create: bad value" when trying to create it again. PR: 241013 Submitted by: Jose Luis Duran Approved by: kp Differential Revision: https://reviews.freebsd.org/D30083 (cherry picked from commit 5c4fe2ac81a5e05062266d684fb53b9faefd0d38) --- libexec/rc/rc.d/ipfw | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libexec/rc/rc.d/ipfw b/libexec/rc/rc.d/ipfw index ece0a93ba6f4..fd1c97671d70 100755 --- a/libexec/rc/rc.d/ipfw +++ b/libexec/rc/rc.d/ipfw @@ -74,8 +74,14 @@ ipfw_start() ${SYSCTL} net.inet.ip.fw.verbose=1 >/dev/null fi if checkyesno firewall_logif; then - ifconfig ipfw0 create - echo 'Firewall logging pseudo-interface (ipfw0) created.' + if ! ifconfig ipfw0 >/dev/null 2>&1; then + ifconfig ipfw0 create + echo 'Firewall logging pseudo-interface (ipfw0)' \ + 'created.' + else + echo 'Firewall logging pseudo-interface (ipfw0)' \ + 'already created.' + fi fi } From owner-dev-commits-src-branches@freebsd.org Mon May 17 06:12:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 A998963D6CF; Mon, 17 May 2021 06:12:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fk81s4Hd9z4h6v; Mon, 17 May 2021 06:12:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7BD7A26FFA; Mon, 17 May 2021 06:12:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14H6CnY1051482; Mon, 17 May 2021 06:12:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14H6Cn1d051481; Mon, 17 May 2021 06:12:49 GMT (envelope-from git) Date: Mon, 17 May 2021 06:12:49 GMT Message-Id: <202105170612.14H6Cn1d051481@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 9ad87c22530d - stable/12 - service/ipfw: Silence warning on restart MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 9ad87c22530d0244e04132b9eae2cb4524e23f2b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 06:12:49 -0000 The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=9ad87c22530d0244e04132b9eae2cb4524e23f2b commit 9ad87c22530d0244e04132b9eae2cb4524e23f2b Author: Lutz Donnerhacke AuthorDate: 2021-05-02 20:47:04 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-17 06:12:11 +0000 service/ipfw: Silence warning on restart Once the ipfw0 interface has been created, ifconfig(8) create will throw a warning: "ifconfig: create: bad value" when trying to create it again. PR: 241013 Submitted by: Jose Luis Duran Approved by: kp Differential Revision: https://reviews.freebsd.org/D30083 (cherry picked from commit 5c4fe2ac81a5e05062266d684fb53b9faefd0d38) --- libexec/rc/rc.d/ipfw | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libexec/rc/rc.d/ipfw b/libexec/rc/rc.d/ipfw index ced473a5aac4..50d95543023d 100755 --- a/libexec/rc/rc.d/ipfw +++ b/libexec/rc/rc.d/ipfw @@ -74,8 +74,14 @@ ipfw_start() ${SYSCTL} net.inet.ip.fw.verbose=1 >/dev/null fi if checkyesno firewall_logif; then - ifconfig ipfw0 create - echo 'Firewall logging pseudo-interface (ipfw0) created.' + if ! ifconfig ipfw0 >/dev/null 2>&1; then + ifconfig ipfw0 create + echo 'Firewall logging pseudo-interface (ipfw0)' \ + 'created.' + else + echo 'Firewall logging pseudo-interface (ipfw0)' \ + 'already created.' + fi fi } From owner-dev-commits-src-branches@freebsd.org Mon May 17 06:17:19 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 B1EBA63D97B; Mon, 17 May 2021 06:17:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fk8734gZ3z4hyc; Mon, 17 May 2021 06:17:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 84FFB26C70; Mon, 17 May 2021 06:17:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14H6HJZI051906; Mon, 17 May 2021 06:17:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14H6HJHn051905; Mon, 17 May 2021 06:17:19 GMT (envelope-from git) Date: Mon, 17 May 2021 06:17:19 GMT Message-Id: <202105170617.14H6HJHn051905@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 370c8a1f784c - stable/11 - service/ipfw: Silence warning on restart MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 370c8a1f784c62d0cf28aa1202a0575add1b3559 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 06:17:19 -0000 The branch stable/11 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=370c8a1f784c62d0cf28aa1202a0575add1b3559 commit 370c8a1f784c62d0cf28aa1202a0575add1b3559 Author: Lutz Donnerhacke AuthorDate: 2021-05-02 20:47:04 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-17 06:16:45 +0000 service/ipfw: Silence warning on restart Once the ipfw0 interface has been created, ifconfig(8) create will throw a warning: "ifconfig: create: bad value" when trying to create it again. PR: 241013 Submitted by: Jose Luis Duran Approved by: kp Differential Revision: https://reviews.freebsd.org/D30083 (cherry picked from commit 5c4fe2ac81a5e05062266d684fb53b9faefd0d38) --- etc/rc.d/ipfw | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/etc/rc.d/ipfw b/etc/rc.d/ipfw index ef85e3d88d13..b93d16026fe4 100755 --- a/etc/rc.d/ipfw +++ b/etc/rc.d/ipfw @@ -74,8 +74,14 @@ ipfw_start() ${SYSCTL} net.inet.ip.fw.verbose=1 >/dev/null fi if checkyesno firewall_logif; then - ifconfig ipfw0 create - echo 'Firewall logging pseudo-interface (ipfw0) created.' + if ! ifconfig ipfw0 >/dev/null 2>&1; then + ifconfig ipfw0 create + echo 'Firewall logging pseudo-interface (ipfw0)' \ + 'created.' + else + echo 'Firewall logging pseudo-interface (ipfw0)' \ + 'already created.' + fi fi } From owner-dev-commits-src-branches@freebsd.org Mon May 17 10:00:35 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 17E60642B19; Mon, 17 May 2021 10:00:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FkF4g0DSgz3lQW; Mon, 17 May 2021 10:00:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E3EB11CC5; Mon, 17 May 2021 10:00:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14HA0Ykg053224; Mon, 17 May 2021 10:00:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14HA0Y3b053223; Mon, 17 May 2021 10:00:34 GMT (envelope-from git) Date: Mon, 17 May 2021 10:00:34 GMT Message-Id: <202105171000.14HA0Y3b053223@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Tai-hwa Liang Subject: git: 5e4388126aac - stable/11 - arp(8): fixing the deletion failure of IEEE1394 associated addresses MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avatar X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 5e4388126aac3c3065a8c64518130eeba856409d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 10:00:35 -0000 The branch stable/11 has been updated by avatar: URL: https://cgit.FreeBSD.org/src/commit/?id=5e4388126aac3c3065a8c64518130eeba856409d commit 5e4388126aac3c3065a8c64518130eeba856409d Author: Tai-hwa Liang AuthorDate: 2021-04-12 06:27:03 +0000 Commit: Tai-hwa Liang CommitDate: 2021-05-17 09:23:00 +0000 arp(8): fixing the deletion failure of IEEE1394 associated addresses Without this, 'arp -d ${IEEE1394_ADDRESS}' gives the following error: arp: delete: cannot locate 10.0.0.71 Reviewed by: glebius MFC after: 2 weeks (cherry picked from commit a0d6d0d0b9aba6d4c025b2f2807e7c4b4c4b2415) --- usr.sbin/arp/arp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c index 4ef0258c5a33..aaf747e49b14 100644 --- a/usr.sbin/arp/arp.c +++ b/usr.sbin/arp/arp.c @@ -298,6 +298,7 @@ valid_type(int type) switch (type) { case IFT_ETHER: case IFT_FDDI: + case IFT_IEEE1394: case IFT_INFINIBAND: case IFT_ISO88023: case IFT_ISO88024: From owner-dev-commits-src-branches@freebsd.org Mon May 17 10:00:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 3491C64277E; Mon, 17 May 2021 10:00:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FkF4h0wbXz3lLV; Mon, 17 May 2021 10:00:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 089A218DE; Mon, 17 May 2021 10:00:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14HA0Z87053245; Mon, 17 May 2021 10:00:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14HA0ZKN053244; Mon, 17 May 2021 10:00:35 GMT (envelope-from git) Date: Mon, 17 May 2021 10:00:35 GMT Message-Id: <202105171000.14HA0ZKN053244@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Tai-hwa Liang Subject: git: 33f31648b93e - stable/11 - if_firewire: fixing panic upon packet reception for VNET build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avatar X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 33f31648b93e37aa746c5cde68c61b66564f1759 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 10:00:36 -0000 The branch stable/11 has been updated by avatar: URL: https://cgit.FreeBSD.org/src/commit/?id=33f31648b93e37aa746c5cde68c61b66564f1759 commit 33f31648b93e37aa746c5cde68c61b66564f1759 Author: Tai-hwa Liang AuthorDate: 2021-04-10 15:32:27 +0000 Commit: Tai-hwa Liang CommitDate: 2021-05-17 09:23:00 +0000 if_firewire: fixing panic upon packet reception for VNET build netisr_dispatch_src() needs valid VNET pointer or firewire_input() will panic when receiving a packet. Reviewed by: glebius MFC after: 2 weeks (cherry picked from commit d9b61e7153c64b141436b4d9619b166c6d35a0a6) --- sys/net/if_fwsubr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/net/if_fwsubr.c b/sys/net/if_fwsubr.c index f0f6de598f8d..d091d6518060 100644 --- a/sys/net/if_fwsubr.c +++ b/sys/net/if_fwsubr.c @@ -632,7 +632,9 @@ firewire_input(struct ifnet *ifp, struct mbuf *m, uint16_t src) } M_SETFIB(m, ifp->if_fib); + CURVNET_SET_QUIET(ifp->if_vnet); netisr_dispatch(isr, m); + CURVNET_RESTORE(); } int From owner-dev-commits-src-branches@freebsd.org Mon May 17 13:32:52 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 0FE136483CD; Mon, 17 May 2021 13:32:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FkKnc009Sz4tJM; Mon, 17 May 2021 13:32:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCC1A4AE0; Mon, 17 May 2021 13:32:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14HDWpuZ036643; Mon, 17 May 2021 13:32:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14HDWpxt036642; Mon, 17 May 2021 13:32:51 GMT (envelope-from git) Date: Mon, 17 May 2021 13:32:51 GMT Message-Id: <202105171332.14HDWpxt036642@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 6e0f20556126 - stable/12 - in6_mcast: Return EADDRINUSE when we've already joined the group MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6e0f20556126ffb6396c6f3934b93bfff6fb06eb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 13:32:52 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6e0f20556126ffb6396c6f3934b93bfff6fb06eb commit 6e0f20556126ffb6396c6f3934b93bfff6fb06eb Author: Kristof Provost AuthorDate: 2021-05-04 17:23:15 +0000 Commit: Kristof Provost CommitDate: 2021-05-17 07:51:16 +0000 in6_mcast: Return EADDRINUSE when we've already joined the group Distinguish between truly invalid requests and those that fail because we've already joined the group. Both cases fail, but differentiating them allows userspace to make more informed decisions about what the error means. For example. radvd tries to join the all-routers group on every SIGHUP. This fails, because it's already joined it, but this failure should be ignored (rather than treated as a sign that the interface's multicast is broken). This puts us in line with OpenBSD, NetBSD and Linux. Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30111 (cherry picked from commit 2ef5d803e3847f56771c107d9517ec560cf318c9) --- sys/netinet6/in6_mcast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c index 96390335aea8..bd202e76c6b6 100644 --- a/sys/netinet6/in6_mcast.c +++ b/sys/netinet6/in6_mcast.c @@ -2027,7 +2027,7 @@ in6p_join_group(struct inpcb *inp, struct sockopt *sopt) * state at t1, because allocation of a filter * is atomic with allocation of a membership. */ - error = EINVAL; + error = EADDRINUSE; goto out_in6p_locked; } } From owner-dev-commits-src-branches@freebsd.org Mon May 17 13:33:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 EFD4664853D; Mon, 17 May 2021 13:33:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FkKnn6XY3z4tQB; Mon, 17 May 2021 13:33:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C87E04D5E; Mon, 17 May 2021 13:33:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14HDX1gm036778; Mon, 17 May 2021 13:33:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14HDX1JP036777; Mon, 17 May 2021 13:33:01 GMT (envelope-from git) Date: Mon, 17 May 2021 13:33:01 GMT Message-Id: <202105171333.14HDX1JP036777@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 3eebc6234b00 - stable/13 - in6_mcast: Return EADDRINUSE when we've already joined the group MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3eebc6234b007e467d58f570e560c08385dd2319 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 13:33:02 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3eebc6234b007e467d58f570e560c08385dd2319 commit 3eebc6234b007e467d58f570e560c08385dd2319 Author: Kristof Provost AuthorDate: 2021-05-04 17:23:15 +0000 Commit: Kristof Provost CommitDate: 2021-05-17 07:50:26 +0000 in6_mcast: Return EADDRINUSE when we've already joined the group Distinguish between truly invalid requests and those that fail because we've already joined the group. Both cases fail, but differentiating them allows userspace to make more informed decisions about what the error means. For example. radvd tries to join the all-routers group on every SIGHUP. This fails, because it's already joined it, but this failure should be ignored (rather than treated as a sign that the interface's multicast is broken). This puts us in line with OpenBSD, NetBSD and Linux. Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30111 (cherry picked from commit 2ef5d803e3847f56771c107d9517ec560cf318c9) --- sys/netinet6/in6_mcast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c index 9b04c87d22a0..0744a1178fc7 100644 --- a/sys/netinet6/in6_mcast.c +++ b/sys/netinet6/in6_mcast.c @@ -2030,7 +2030,7 @@ in6p_join_group(struct inpcb *inp, struct sockopt *sopt) * state at t1, because allocation of a filter * is atomic with allocation of a membership. */ - error = EINVAL; + error = EADDRINUSE; goto out_in6p_locked; } } From owner-dev-commits-src-branches@freebsd.org Mon May 17 17:49:03 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 C429064EC0A; Mon, 17 May 2021 17:49:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FkRTC5C2Hz4l62; Mon, 17 May 2021 17:49:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A8931098A; Mon, 17 May 2021 17:49:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14HHn3tl076433; Mon, 17 May 2021 17:49:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14HHn3mU076432; Mon, 17 May 2021 17:49:03 GMT (envelope-from git) Date: Mon, 17 May 2021 17:49:03 GMT Message-Id: <202105171749.14HHn3mU076432@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 1e066db6cdad - stable/13 - Add missing sockaddr length and family validation to various protocols MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1e066db6cdad4f3d4934bad487db68d3a7872727 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 17:49:03 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1e066db6cdad4f3d4934bad487db68d3a7872727 commit 1e066db6cdad4f3d4934bad487db68d3a7872727 Author: Mark Johnston AuthorDate: 2021-05-03 16:51:04 +0000 Commit: Mark Johnston CommitDate: 2021-05-17 17:43:07 +0000 Add missing sockaddr length and family validation to various protocols Several protocol methods take a sockaddr as input. In some cases the sockaddr lengths were not being validated, or were validated after some out-of-bounds accesses could occur. Add requisite checking to various protocol entry points, and convert some existing checks to assertions where appropriate. Reported by: syzkaller+KASAN Reviewed by: tuexen, melifaro Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29519 (cherry picked from commit f161d294b92732df6254a89f393ab24999e122bf) --- sys/dev/hyperv/hvsock/hv_sock.c | 9 ++++++++ sys/netgraph/ng_socket.c | 19 ++++++++++++---- sys/netinet/in_pcb.c | 28 +++++++++++------------ sys/netinet/ip_divert.c | 21 ++++++++++++++--- sys/netinet/raw_ip.c | 14 ++++++++++-- sys/netinet/sctp_usrreq.c | 24 +++++++++----------- sys/netinet/tcp_usrreq.c | 31 ++++++++++++++++---------- sys/netinet/udp_usrreq.c | 28 ++++++++++++++++++++++- sys/netinet6/in6_pcb.c | 25 +++++++++------------ sys/netinet6/raw_ip6.c | 6 +++++ sys/netinet6/sctp6_usrreq.c | 21 +++++++++++++++++ sys/netinet6/send.c | 8 +++++++ sys/netinet6/udp6_usrreq.c | 12 +++++++++- sys/netipsec/keysock.c | 2 +- sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c | 23 +++++++++++++++---- 15 files changed, 202 insertions(+), 69 deletions(-) diff --git a/sys/dev/hyperv/hvsock/hv_sock.c b/sys/dev/hyperv/hvsock/hv_sock.c index d212c2d8c2de..bcc237271465 100644 --- a/sys/dev/hyperv/hvsock/hv_sock.c +++ b/sys/dev/hyperv/hvsock/hv_sock.c @@ -300,6 +300,7 @@ hvs_addr_set(struct sockaddr_hvs *addr, unsigned int port) { memset(addr, 0, sizeof(*addr)); addr->sa_family = AF_HYPERV; + addr->sa_len = sizeof(*addr); addr->hvs_port = port; } @@ -430,6 +431,12 @@ hvs_trans_bind(struct socket *so, struct sockaddr *addr, struct thread *td) __func__, sa->sa_family); return (EAFNOSUPPORT); } + if (sa->sa_len != sizeof(*sa)) { + HVSOCK_DBG(HVSOCK_DBG_ERR, + "%s: Not supported, sa_len is %u\n", + __func__, sa->sa_len); + return (EINVAL); + } HVSOCK_DBG(HVSOCK_DBG_VERBOSE, "%s: binding port = 0x%x\n", __func__, sa->hvs_port); @@ -521,6 +528,8 @@ hvs_trans_connect(struct socket *so, struct sockaddr *nam, struct thread *td) return (EINVAL); if (raddr->sa_family != AF_HYPERV) return (EAFNOSUPPORT); + if (raddr->sa_len != sizeof(*raddr)) + return (EINVAL); mtx_lock(&hvs_trans_socks_mtx); if (so->so_state & diff --git a/sys/netgraph/ng_socket.c b/sys/netgraph/ng_socket.c index 865e9dd7948f..1c67099a4dc4 100644 --- a/sys/netgraph/ng_socket.c +++ b/sys/netgraph/ng_socket.c @@ -240,11 +240,16 @@ ngc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, goto release; } + if (sap->sg_len > NG_NODESIZ + offsetof(struct sockaddr_ng, sg_data)) { + error = EINVAL; + goto release; + } + /* * Allocate an expendable buffer for the path, chop off * the sockaddr header, and make sure it's NUL terminated. */ - len = sap->sg_len - 2; + len = sap->sg_len - offsetof(struct sockaddr_ng, sg_data); path = malloc(len + 1, M_NETGRAPH_PATH, M_WAITOK); bcopy(sap->sg_data, path, len); path[len] = '\0'; @@ -422,10 +427,16 @@ ngd_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, goto release; } - if (sap == NULL) + if (sap == NULL) { len = 0; /* Make compiler happy. */ - else - len = sap->sg_len - 2; + } else { + if (sap->sg_len > NG_NODESIZ + + offsetof(struct sockaddr_ng, sg_data)) { + error = EINVAL; + goto release; + } + len = sap->sg_len - offsetof(struct sockaddr_ng, sg_data); + } /* * If the user used any of these ways to not specify an address diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 59695ee3715d..857119e8213b 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -647,6 +647,10 @@ in_pcbbind(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred) { int anonport, error; + KASSERT(nam == NULL || nam->sa_family == AF_INET, + ("%s: invalid address family for %p", __func__, nam)); + KASSERT(nam == NULL || nam->sa_len == sizeof(struct sockaddr_in), + ("%s: invalid address length for %p", __func__, nam)); INP_WLOCK_ASSERT(inp); INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); @@ -933,16 +937,11 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *nam, in_addr_t *laddrp, return (error); } else { sin = (struct sockaddr_in *)nam; - if (nam->sa_len != sizeof (*sin)) - return (EINVAL); -#ifdef notdef - /* - * We should check the family, but old programs - * incorrectly fail to initialize it. - */ - if (sin->sin_family != AF_INET) - return (EAFNOSUPPORT); -#endif + KASSERT(sin->sin_family == AF_INET, + ("%s: invalid family for address %p", __func__, sin)); + KASSERT(sin->sin_len == sizeof(*sin), + ("%s: invalid length for address %p", __func__, sin)); + error = prison_local_ip4(cred, &sin->sin_addr); if (error) return (error); @@ -1365,6 +1364,11 @@ in_pcbconnect_setup(struct inpcb *inp, struct sockaddr *nam, u_short lport, fport; int error; + KASSERT(sin->sin_family == AF_INET, + ("%s: invalid address family for %p", __func__, sin)); + KASSERT(sin->sin_len == sizeof(*sin), + ("%s: invalid address length for %p", __func__, sin)); + /* * Because a global state change doesn't actually occur here, a read * lock is sufficient. @@ -1375,10 +1379,6 @@ in_pcbconnect_setup(struct inpcb *inp, struct sockaddr *nam, if (oinpp != NULL) *oinpp = NULL; - if (nam->sa_len != sizeof (*sin)) - return (EINVAL); - if (sin->sin_family != AF_INET) - return (EAFNOSUPPORT); if (sin->sin_port == 0) return (EADDRNOTAVAIL); laddr.s_addr = *laddrp; diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 31b28656ece7..f83a42cb36c9 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -327,6 +327,22 @@ div_output(struct socket *so, struct mbuf *m, struct sockaddr_in *sin, struct ipfw_rule_ref *dt; int error, family; + if (control) { + m_freem(control); /* XXX */ + control = NULL; + } + + if (sin != NULL) { + if (sin->sin_family != AF_INET) { + m_freem(m); + return (EAFNOSUPPORT); + } + if (sin->sin_len != sizeof(*sin)) { + m_freem(m); + return (EINVAL); + } + } + /* * An mbuf may hasn't come from userland, but we pretend * that it has. @@ -335,9 +351,6 @@ div_output(struct socket *so, struct mbuf *m, struct sockaddr_in *sin, m->m_nextpkt = NULL; M_SETFIB(m, so->so_fibnum); - if (control) - m_freem(control); /* XXX */ - mtag = m_tag_locate(m, MTAG_IPFW_RULE, 0, NULL); if (mtag == NULL) { /* this should be normal */ @@ -629,6 +642,8 @@ div_bind(struct socket *so, struct sockaddr *nam, struct thread *td) */ if (nam->sa_family != AF_INET) return EAFNOSUPPORT; + if (nam->sa_len != sizeof(struct sockaddr_in)) + return EINVAL; ((struct sockaddr_in *)nam)->sin_addr.s_addr = INADDR_ANY; INP_INFO_WLOCK(&V_divcbinfo); INP_WLOCK(inp); diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index c9def015343c..89ab6a6bbdad 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -996,6 +996,8 @@ rip_bind(struct socket *so, struct sockaddr *nam, struct thread *td) struct inpcb *inp; int error; + if (nam->sa_family != AF_INET) + return (EAFNOSUPPORT); if (nam->sa_len != sizeof(*addr)) return (EINVAL); @@ -1070,6 +1072,7 @@ rip_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, { struct inpcb *inp; u_long dst; + int error; inp = sotoinpcb(so); KASSERT(inp != NULL, ("rip_send: inp == NULL")); @@ -1084,9 +1087,16 @@ rip_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, } dst = inp->inp_faddr.s_addr; /* Unlocked read. */ } else { - if (nam == NULL) { + error = 0; + if (nam == NULL) + error = ENOTCONN; + else if (nam->sa_family != AF_INET) + error = EAFNOSUPPORT; + else if (nam->sa_len != sizeof(struct sockaddr_in)) + error = EINVAL; + if (error != 0) { m_freem(m); - return (ENOTCONN); + return (error); } dst = ((struct sockaddr_in *)nam)->sin_addr.s_addr; } diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 049368c91b56..fb3e398c2878 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -598,29 +598,27 @@ sctp_sendm(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, ((inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) || (inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE))) { goto connected_type; - } else if (addr == NULL) { + } + + error = 0; + if (addr == NULL) { SCTP_LTRACE_ERR_RET_PKT(m, inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EDESTADDRREQ); error = EDESTADDRREQ; - sctp_m_freem(m); - if (control) { - sctp_m_freem(control); - control = NULL; - } - return (error); + } else if (addr->sa_family != AF_INET) { + SCTP_LTRACE_ERR_RET_PKT(m, inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EAFNOSUPPORT); + error = EAFNOSUPPORT; + } else if (addr->sa_len != sizeof(struct sockaddr_in)) { + SCTP_LTRACE_ERR_RET_PKT(m, inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; } -#ifdef INET6 - if (addr->sa_family != AF_INET) { - /* must be a v4 address! */ - SCTP_LTRACE_ERR_RET_PKT(m, inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EDESTADDRREQ); + if (error != 0) { sctp_m_freem(m); if (control) { sctp_m_freem(control); control = NULL; } - error = EDESTADDRREQ; return (error); } -#endif /* INET6 */ connected_type: /* now what about control */ if (control) { diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 31b580bfafcc..8c2a4c85d4d2 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -321,14 +321,16 @@ tcp_usr_bind(struct socket *so, struct sockaddr *nam, struct thread *td) struct sockaddr_in *sinp; sinp = (struct sockaddr_in *)nam; - if (nam->sa_len != sizeof (*sinp)) + if (nam->sa_family != AF_INET) + return (EAFNOSUPPORT); + if (nam->sa_len != sizeof(*sinp)) return (EINVAL); + /* * Must check for multicast addresses and disallow binding * to them. */ - if (sinp->sin_family == AF_INET && - IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) + if (IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) return (EAFNOSUPPORT); TCPDEBUG0; @@ -364,14 +366,16 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, struct thread *td) u_char vflagsav; sin6 = (struct sockaddr_in6 *)nam; - if (nam->sa_len != sizeof (*sin6)) + if (nam->sa_family != AF_INET6) + return (EAFNOSUPPORT); + if (nam->sa_len != sizeof(*sin6)) return (EINVAL); + /* * Must check for multicast addresses and disallow binding * to them. */ - if (sin6->sin6_family == AF_INET6 && - IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) + if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) return (EAFNOSUPPORT); TCPDEBUG0; @@ -542,16 +546,17 @@ tcp_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td) struct sockaddr_in *sinp; sinp = (struct sockaddr_in *)nam; + if (nam->sa_family != AF_INET) + return (EAFNOSUPPORT); if (nam->sa_len != sizeof (*sinp)) return (EINVAL); + /* * Must disallow TCP ``connections'' to multicast addresses. */ - if (sinp->sin_family == AF_INET - && IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) + if (IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) return (EAFNOSUPPORT); - if ((sinp->sin_family == AF_INET) && - (ntohl(sinp->sin_addr.s_addr) == INADDR_BROADCAST)) + if (ntohl(sinp->sin_addr.s_addr) == INADDR_BROADCAST) return (EACCES); if ((error = prison_remote_ip4(td->td_ucred, &sinp->sin_addr)) != 0) return (error); @@ -606,13 +611,15 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td) TCPDEBUG0; sin6 = (struct sockaddr_in6 *)nam; + if (nam->sa_family != AF_INET6) + return (EAFNOSUPPORT); if (nam->sa_len != sizeof (*sin6)) return (EINVAL); + /* * Must disallow TCP ``connections'' to multicast addresses. */ - if (sin6->sin6_family == AF_INET6 - && IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) + if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) return (EAFNOSUPPORT); inp = sotoinpcb(so); diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index c2ad9381850e..16ae0a89bb15 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1626,6 +1626,12 @@ udp_bind(struct socket *so, struct sockaddr *nam, struct thread *td) pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); inp = sotoinpcb(so); KASSERT(inp != NULL, ("udp_bind: inp == NULL")); + + if (nam->sa_family != AF_INET) + return (EAFNOSUPPORT); + if (nam->sa_len != sizeof(struct sockaddr_in)) + return (EINVAL); + INP_WLOCK(inp); INP_HASH_WLOCK(pcbinfo); error = in_pcbbind(inp, nam, td->td_ucred); @@ -1666,12 +1672,18 @@ udp_connect(struct socket *so, struct sockaddr *nam, struct thread *td) pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); inp = sotoinpcb(so); KASSERT(inp != NULL, ("udp_connect: inp == NULL")); + + sin = (struct sockaddr_in *)nam; + if (sin->sin_family != AF_INET) + return (EAFNOSUPPORT); + if (sin->sin_len != sizeof(*sin)) + return (EINVAL); + INP_WLOCK(inp); if (inp->inp_faddr.s_addr != INADDR_ANY) { INP_WUNLOCK(inp); return (EISCONN); } - sin = (struct sockaddr_in *)nam; error = prison_remote_ip4(td->td_ucred, &sin->sin_addr); if (error != 0) { INP_WUNLOCK(inp); @@ -1741,9 +1753,23 @@ udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, struct mbuf *control, struct thread *td) { struct inpcb *inp; + int error; inp = sotoinpcb(so); KASSERT(inp != NULL, ("udp_send: inp == NULL")); + + if (addr != NULL) { + error = 0; + if (addr->sa_family != AF_INET) + error = EAFNOSUPPORT; + else if (addr->sa_len != sizeof(struct sockaddr_in)) + error = EINVAL; + if (__predict_false(error != 0)) { + m_freem(control); + m_freem(m); + return (error); + } + } return (udp_output(inp, m, addr, control, td, flags)); } #endif /* INET */ diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 5fce9fcafa33..1c36b4386030 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -146,13 +146,10 @@ in6_pcbbind(struct inpcb *inp, struct sockaddr *nam, return (error); } else { sin6 = (struct sockaddr_in6 *)nam; - if (nam->sa_len != sizeof(*sin6)) - return (EINVAL); - /* - * family check. - */ - if (nam->sa_family != AF_INET6) - return (EAFNOSUPPORT); + KASSERT(sin6->sin6_family == AF_INET6, + ("%s: invalid address family for %p", __func__, sin6)); + KASSERT(sin6->sin6_len == sizeof(*sin6), + ("%s: invalid address length for %p", __func__, sin6)); if ((error = sa6_embedscope(sin6, V_ip6_use_defzone)) != 0) return(error); @@ -345,10 +342,9 @@ in6_pcbbind(struct inpcb *inp, struct sockaddr *nam, * have forced minor changes in every protocol). */ static int -in6_pcbladdr(struct inpcb *inp, struct sockaddr *nam, +in6_pcbladdr(struct inpcb *inp, struct sockaddr_in6 *sin6, struct in6_addr *plocal_addr6) { - struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam; int error = 0; int scope_ambiguous = 0; struct in6_addr in6a; @@ -357,10 +353,6 @@ in6_pcbladdr(struct inpcb *inp, struct sockaddr *nam, INP_WLOCK_ASSERT(inp); INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); /* XXXRW: why? */ - if (nam->sa_len != sizeof (*sin6)) - return (EINVAL); - if (sin6->sin6_family != AF_INET6) - return (EAFNOSUPPORT); if (sin6->sin6_port == 0) return (EADDRNOTAVAIL); @@ -421,6 +413,11 @@ in6_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr *nam, struct sockaddr_in6 laddr6; int error; + KASSERT(sin6->sin6_family == AF_INET6, + ("%s: invalid address family for %p", __func__, sin6)); + KASSERT(sin6->sin6_len == sizeof(*sin6), + ("%s: invalid address length for %p", __func__, sin6)); + bzero(&laddr6, sizeof(laddr6)); laddr6.sin6_family = AF_INET6; @@ -442,7 +439,7 @@ in6_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr *nam, * Call inner routine, to assign local interface address. * in6_pcbladdr() may automatically fill in sin6_scope_id. */ - if ((error = in6_pcbladdr(inp, nam, &laddr6.sin6_addr)) != 0) + if ((error = in6_pcbladdr(inp, sin6, &laddr6.sin6_addr)) != 0) return (error); if (in6_pcblookup_hash_locked(pcbinfo, &sin6->sin6_addr, diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 8d71c40455a1..3d2af6e5c9e6 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -760,6 +760,8 @@ rip6_bind(struct socket *so, struct sockaddr *nam, struct thread *td) inp = sotoinpcb(so); KASSERT(inp != NULL, ("rip6_bind: inp == NULL")); + if (nam->sa_family != AF_INET6) + return (EAFNOSUPPORT); if (nam->sa_len != sizeof(*addr)) return (EINVAL); if ((error = prison_check_ip6(td->td_ucred, &addr->sin6_addr)) != 0) @@ -891,6 +893,10 @@ rip6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, m_freem(m); return (ENOTCONN); } + if (nam->sa_family != AF_INET6) { + m_freem(m); + return (EAFNOSUPPORT); + } if (nam->sa_len != sizeof(struct sockaddr_in6)) { m_freem(m); return (EINVAL); diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c index fcf15e4f81bf..1030fe1bbb68 100644 --- a/sys/netinet6/sctp6_usrreq.c +++ b/sys/netinet6/sctp6_usrreq.c @@ -709,6 +709,27 @@ sctp6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EDESTADDRREQ); return (EDESTADDRREQ); } + switch (addr->sa_family) { +#ifdef INET + case AF_INET: + if (addr->sa_len != sizeof(struct sockaddr_in)) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); + return (EINVAL); + } + break; +#endif +#ifdef INET6 + case AF_INET6: + if (addr->sa_len != sizeof(struct sockaddr_in6)) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); + return (EINVAL); + } + break; +#endif + default: + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); + return (EINVAL); + } #ifdef INET sin6 = (struct sockaddr_in6 *)addr; if (SCTP_IPV6_V6ONLY(inp)) { diff --git a/sys/netinet6/send.c b/sys/netinet6/send.c index 642529cc6beb..816f4d2b6541 100644 --- a/sys/netinet6/send.c +++ b/sys/netinet6/send.c @@ -233,6 +233,14 @@ send_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, __func__, so, V_send_so)); sendsrc = (struct sockaddr_send *)nam; + if (sendsrc->send_family != AF_INET6) { + error = EAFNOSUPPORT; + goto err; + } + if (sendsrc->send_len != sizeof(*sendsrc)) { + error = EINVAL; + goto err; + } ifp = ifnet_byindex_ref(sendsrc->send_ifidx); if (ifp == NULL) { error = ENETUNREACH; diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 3a001fea077d..7c573d095d77 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -1091,6 +1091,11 @@ udp6_bind(struct socket *so, struct sockaddr *nam, struct thread *td) inp = sotoinpcb(so); KASSERT(inp != NULL, ("udp6_bind: inp == NULL")); + if (nam->sa_family != AF_INET6) + return (EAFNOSUPPORT); + if (nam->sa_len != sizeof(struct sockaddr_in6)) + return (EINVAL); + INP_WLOCK(inp); INP_HASH_WLOCK(pcbinfo); vflagsav = inp->inp_vflag; @@ -1176,9 +1181,14 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); inp = sotoinpcb(so); - sin6 = (struct sockaddr_in6 *)nam; KASSERT(inp != NULL, ("udp6_connect: inp == NULL")); + sin6 = (struct sockaddr_in6 *)nam; + if (sin6->sin6_family != AF_INET6) + return (EAFNOSUPPORT); + if (sin6->sin6_len != sizeof(*sin6)) + return (EINVAL); + /* * XXXRW: Need to clarify locking of v4/v6 flags. */ diff --git a/sys/netipsec/keysock.c b/sys/netipsec/keysock.c index 49efa0a3c510..317eb53289cf 100644 --- a/sys/netipsec/keysock.c +++ b/sys/netipsec/keysock.c @@ -322,7 +322,7 @@ key_attach(struct socket *so, int proto, struct thread *td) static int key_bind(struct socket *so, struct sockaddr *nam, struct thread *td) { - return EINVAL; + return EINVAL; } /* diff --git a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c index e7ae4e03365e..a38bdfcbed59 100644 --- a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c +++ b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c @@ -519,9 +519,9 @@ sdp_bind(struct socket *so, struct sockaddr *nam, struct thread *td) struct sockaddr_in *sin; sin = (struct sockaddr_in *)nam; - if (nam->sa_len != sizeof (*sin)) - return (EINVAL); if (sin->sin_family != AF_INET) + return (EAFNOSUPPORT); + if (nam->sa_len != sizeof(*sin)) return (EINVAL); if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) return (EAFNOSUPPORT); @@ -617,10 +617,10 @@ sdp_connect(struct socket *so, struct sockaddr *nam, struct thread *td) struct sockaddr_in *sin; sin = (struct sockaddr_in *)nam; - if (nam->sa_len != sizeof (*sin)) + if (nam->sa_len != sizeof(*sin)) return (EINVAL); if (sin->sin_family != AF_INET) - return (EINVAL); + return (EAFNOSUPPORT); if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) return (EAFNOSUPPORT); if ((error = prison_remote_ip4(td->td_ucred, &sin->sin_addr)) != 0) @@ -932,6 +932,21 @@ sdp_send(struct socket *so, int flags, struct mbuf *m, int error; int cnt; + if (nam != NULL) { + if (nam->sa_family != AF_INET) { + if (control) + m_freem(control); + m_freem(m); + return (EAFNOSUPPORT); + } + if (nam->sa_len != sizeof(struct sockaddr_in)) { + if (control) + m_freem(control); + m_freem(m); + return (EINVAL); + } + } + error = 0; ssk = sdp_sk(so); KASSERT(m->m_flags & M_PKTHDR, From owner-dev-commits-src-branches@freebsd.org Tue May 18 01:27:43 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 6A2C46390BE; Tue, 18 May 2021 01:27:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FkdfR2NwYz3Nf3; Tue, 18 May 2021 01:27:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 369A516772; Tue, 18 May 2021 01:27:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14I1RhrI087779; Tue, 18 May 2021 01:27:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14I1Rhle087778; Tue, 18 May 2021 01:27:43 GMT (envelope-from git) Date: Tue, 18 May 2021 01:27:43 GMT Message-Id: <202105180127.14I1Rhle087778@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 002ebe67a8a5 - stable/13 - nfscl: fix typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 002ebe67a8a5f624ea2279eb283c83941d324659 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 01:27:43 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=002ebe67a8a5f624ea2279eb283c83941d324659 commit 002ebe67a8a5f624ea2279eb283c83941d324659 Author: Rick Macklem AuthorDate: 2021-05-04 01:29:27 +0000 Commit: Rick Macklem CommitDate: 2021-05-18 01:24:44 +0000 nfscl: fix typo in a comment (cherry picked from commit 0755df1eeee838e5b114c61886d6462507290977) --- sys/fs/nfsclient/nfs_clrpcops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index db0b6ab1f5e8..43050e15050a 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -1229,7 +1229,7 @@ nfsrpc_getattr(vnode_t vp, struct ucred *cred, NFSPROC_T *p, } /* - * nfs getattr call with non-vnode arguemnts. + * nfs getattr call with non-vnode arguments. */ int nfsrpc_getattrnovp(struct nfsmount *nmp, u_int8_t *fhp, int fhlen, int syscred, From owner-dev-commits-src-branches@freebsd.org Tue May 18 01:36:20 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 1D8DC63950F; Tue, 18 May 2021 01:36:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FkdrN0LQVz3QX2; Tue, 18 May 2021 01:36:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E8F041656D; Tue, 18 May 2021 01:36:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14I1aJhg000769; Tue, 18 May 2021 01:36:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14I1aJFB000768; Tue, 18 May 2021 01:36:19 GMT (envelope-from git) Date: Tue, 18 May 2021 01:36:19 GMT Message-Id: <202105180136.14I1aJFB000768@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 036d385a8330 - stable/12 - nfscl: fix typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 036d385a83301b791b964445b213cfaafc74a6e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 01:36:20 -0000 The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=036d385a83301b791b964445b213cfaafc74a6e6 commit 036d385a83301b791b964445b213cfaafc74a6e6 Author: Rick Macklem AuthorDate: 2021-05-04 01:29:27 +0000 Commit: Rick Macklem CommitDate: 2021-05-18 01:33:19 +0000 nfscl: fix typo in a comment (cherry picked from commit 0755df1eeee838e5b114c61886d6462507290977) --- sys/fs/nfsclient/nfs_clrpcops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 0666a4a9dac2..3ff23a8b147b 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -1151,7 +1151,7 @@ nfsrpc_getattr(vnode_t vp, struct ucred *cred, NFSPROC_T *p, } /* - * nfs getattr call with non-vnode arguemnts. + * nfs getattr call with non-vnode arguments. */ int nfsrpc_getattrnovp(struct nfsmount *nmp, u_int8_t *fhp, int fhlen, int syscred, From owner-dev-commits-src-branches@freebsd.org Tue May 18 06:04:16 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 DAF006404F5; Tue, 18 May 2021 06:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FklnX5wFqz3D2j; Tue, 18 May 2021 06:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B39E91A2D3; Tue, 18 May 2021 06:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14I64G41059080; Tue, 18 May 2021 06:04:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14I64Gb8059079; Tue, 18 May 2021 06:04:16 GMT (envelope-from git) Date: Tue, 18 May 2021 06:04:16 GMT Message-Id: <202105180604.14I64Gb8059079@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 692c271beb8a - stable/13 - vfs: fix vnode use count leak in O_EMPTY_PATH support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 692c271beb8a14a5a142faf4a1d3f8832347b041 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 06:04:16 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=692c271beb8a14a5a142faf4a1d3f8832347b041 commit 692c271beb8a14a5a142faf4a1d3f8832347b041 Author: Mateusz Guzik AuthorDate: 2021-05-13 09:23:03 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-18 06:04:00 +0000 vfs: fix vnode use count leak in O_EMPTY_PATH support The vnode returned by namei_setup is already referenced. Reported by: pho (cherry picked from commit cef8a95acbae0c3043d95028d8ebb24d959a82a0) --- sys/kern/vfs_lookup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 3050275c1b6f..5336bf87ec68 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -495,8 +495,10 @@ namei_emptypath(struct nameidata *ndp) goto errout; } + /* + * Usecount on dp already provided by namei_setup. + */ ndp->ni_vp = dp; - vref(dp); namei_cleanup_cnp(cnp); pwd_drop(pwd); ndp->ni_resflags |= NIRES_EMPTYPATH; From owner-dev-commits-src-branches@freebsd.org Tue May 18 06:11:14 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 172076409AF; Tue, 18 May 2021 06:11:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FklxZ0CpLz3Dps; Tue, 18 May 2021 06:11:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4D351A558; Tue, 18 May 2021 06:11:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14I6BDOS067990; Tue, 18 May 2021 06:11:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14I6BDMp067989; Tue, 18 May 2021 06:11:13 GMT (envelope-from git) Date: Tue, 18 May 2021 06:11:13 GMT Message-Id: <202105180611.14I6BDMp067989@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 7200fdb9da3a - stable/13 - sbin/ipfw: Fix parsing error in table based forward MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7200fdb9da3ac04ef8e577c947969a0ba8d69128 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 06:11:14 -0000 The branch stable/13 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=7200fdb9da3ac04ef8e577c947969a0ba8d69128 commit 7200fdb9da3ac04ef8e577c947969a0ba8d69128 Author: Lutz Donnerhacke AuthorDate: 2021-05-07 18:59:34 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-18 06:10:00 +0000 sbin/ipfw: Fix parsing error in table based forward The argument parser does not recognise the optional port for an "tablearg" argument. Fix simplifies the code by make the internal representation expicit for the parser. Includes the fix from D30208. PR: 252744 Reported by: Approved by: nc Tested by: Differential Revision: https://reviews.freebsd.org/D30164 (cherry picked from commit 6cb13813caa09305046e0cecad8bba3ae2287b0d) (cherry picked from commit f6f297871d469daf808f78faead8f950a2c81e36) --- sbin/ipfw/ipfw2.c | 88 +++++++++++++++++++++++++++---------------------------- 1 file changed, 43 insertions(+), 45 deletions(-) diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index c17fbbca7dfa..fb1d9a4a180b 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -4021,57 +4021,55 @@ chkarg: NEED1("missing forward address[:port]"); - if (_substrcmp(*av, "tablearg") == 0) { - family = PF_INET; - ((struct sockaddr_in*)&result)->sin_addr.s_addr = - INADDR_ANY; - } else { - /* - * Are we an bracket-enclosed IPv6 address? - */ - if (strchr(*av, '[')) - (*av)++; + if (strncmp(*av, "tablearg", 8) == 0 && + ((*av)[8] == '\0' || (*av)[8] == ',' || (*av)[8] == ':')) + memcpy(++(*av), "0.0.0.0", 7); - /* - * locate the address-port separator (':' or ',') - */ - s = strchr(*av, ','); - if (s == NULL) { - s = strchr(*av, ']'); - /* Prevent erroneous parsing on brackets. */ - if (s != NULL) - *(s++) = '\0'; - else - s = *av; - - /* Distinguish between IPv4:port and IPv6 cases. */ - s = strchr(s, ':'); - if (s && strchr(s+1, ':')) - s = NULL; /* no port */ - } + /* + * Are we an bracket-enclosed IPv6 address? + */ + if (strchr(*av, '[')) + (*av)++; - if (s != NULL) { - /* Terminate host portion and set s to start of port. */ + /* + * locate the address-port separator (':' or ',') + */ + s = strchr(*av, ','); + if (s == NULL) { + s = strchr(*av, ']'); + /* Prevent erroneous parsing on brackets. */ + if (s != NULL) *(s++) = '\0'; - i = strtoport(s, &end, 0 /* base */, 0 /* proto */); - if (s == end) - errx(EX_DATAERR, - "illegal forwarding port ``%s''", s); - port_number = (u_short)i; - } + else + s = *av; - /* - * Resolve the host name or address to a family and a - * network representation of the address. - */ - if (getaddrinfo(*av, NULL, NULL, &res)) - errx(EX_DATAERR, NULL); - /* Just use the first host in the answer. */ - family = res->ai_family; - memcpy(&result, res->ai_addr, res->ai_addrlen); - freeaddrinfo(res); + /* Distinguish between IPv4:port and IPv6 cases. */ + s = strchr(s, ':'); + if (s && strchr(s+1, ':')) + s = NULL; /* no port */ } + if (s != NULL) { + /* Terminate host portion and set s to start of port. */ + *(s++) = '\0'; + i = strtoport(s, &end, 0 /* base */, 0 /* proto */); + if (s == end) + errx(EX_DATAERR, + "illegal forwarding port ``%s''", s); + port_number = (u_short)i; + } + + /* + * Resolve the host name or address to a family and a + * network representation of the address. + */ + if (getaddrinfo(*av, NULL, NULL, &res)) + errx(EX_DATAERR, NULL); + /* Just use the first host in the answer. */ + family = res->ai_family; + memcpy(&result, res->ai_addr, res->ai_addrlen); + freeaddrinfo(res); + if (family == PF_INET) { ipfw_insn_sa *p = (ipfw_insn_sa *)action; From owner-dev-commits-src-branches@freebsd.org Tue May 18 06:15:29 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 54A3D640E92; Tue, 18 May 2021 06:15:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fkm2T20Tfz3FyR; Tue, 18 May 2021 06:15:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D9DF1A34E; Tue, 18 May 2021 06:15:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14I6FTLd072415; Tue, 18 May 2021 06:15:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14I6FTUT072414; Tue, 18 May 2021 06:15:29 GMT (envelope-from git) Date: Tue, 18 May 2021 06:15:29 GMT Message-Id: <202105180615.14I6FTUT072414@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 8addaaa5fb86 - stable/12 - sbin/ipfw: Fix parsing error in table based forward MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 8addaaa5fb864190882dfcf1a1ad3d7af802dd35 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 06:15:29 -0000 The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=8addaaa5fb864190882dfcf1a1ad3d7af802dd35 commit 8addaaa5fb864190882dfcf1a1ad3d7af802dd35 Author: Lutz Donnerhacke AuthorDate: 2021-05-07 18:59:34 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-18 06:14:25 +0000 sbin/ipfw: Fix parsing error in table based forward The argument parser does not recognise the optional port for an "tablearg" argument. Fix simplifies the code by make the internal representation expicit for the parser. Includes the fix from D30208. PR: 252744 Reported by: Approved by: nc Tested by: Differential Revision: https://reviews.freebsd.org/D30164 (cherry picked from commit 6cb13813caa09305046e0cecad8bba3ae2287b0d) (cherry picked from commit f6f297871d469daf808f78faead8f950a2c81e36) --- sbin/ipfw/ipfw2.c | 88 +++++++++++++++++++++++++++---------------------------- 1 file changed, 43 insertions(+), 45 deletions(-) diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index efb29403b6c9..8f06563d61a8 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -4021,57 +4021,55 @@ chkarg: NEED1("missing forward address[:port]"); - if (_substrcmp(*av, "tablearg") == 0) { - family = PF_INET; - ((struct sockaddr_in*)&result)->sin_addr.s_addr = - INADDR_ANY; - } else { - /* - * Are we an bracket-enclosed IPv6 address? - */ - if (strchr(*av, '[')) - (*av)++; + if (strncmp(*av, "tablearg", 8) == 0 && + ((*av)[8] == '\0' || (*av)[8] == ',' || (*av)[8] == ':')) + memcpy(++(*av), "0.0.0.0", 7); - /* - * locate the address-port separator (':' or ',') - */ - s = strchr(*av, ','); - if (s == NULL) { - s = strchr(*av, ']'); - /* Prevent erroneous parsing on brackets. */ - if (s != NULL) - *(s++) = '\0'; - else - s = *av; - - /* Distinguish between IPv4:port and IPv6 cases. */ - s = strchr(s, ':'); - if (s && strchr(s+1, ':')) - s = NULL; /* no port */ - } + /* + * Are we an bracket-enclosed IPv6 address? + */ + if (strchr(*av, '[')) + (*av)++; - if (s != NULL) { - /* Terminate host portion and set s to start of port. */ + /* + * locate the address-port separator (':' or ',') + */ + s = strchr(*av, ','); + if (s == NULL) { + s = strchr(*av, ']'); + /* Prevent erroneous parsing on brackets. */ + if (s != NULL) *(s++) = '\0'; - i = strtoport(s, &end, 0 /* base */, 0 /* proto */); - if (s == end) - errx(EX_DATAERR, - "illegal forwarding port ``%s''", s); - port_number = (u_short)i; - } + else + s = *av; - /* - * Resolve the host name or address to a family and a - * network representation of the address. - */ - if (getaddrinfo(*av, NULL, NULL, &res)) - errx(EX_DATAERR, NULL); - /* Just use the first host in the answer. */ - family = res->ai_family; - memcpy(&result, res->ai_addr, res->ai_addrlen); - freeaddrinfo(res); + /* Distinguish between IPv4:port and IPv6 cases. */ + s = strchr(s, ':'); + if (s && strchr(s+1, ':')) + s = NULL; /* no port */ } + if (s != NULL) { + /* Terminate host portion and set s to start of port. */ + *(s++) = '\0'; + i = strtoport(s, &end, 0 /* base */, 0 /* proto */); + if (s == end) + errx(EX_DATAERR, + "illegal forwarding port ``%s''", s); + port_number = (u_short)i; + } + + /* + * Resolve the host name or address to a family and a + * network representation of the address. + */ + if (getaddrinfo(*av, NULL, NULL, &res)) + errx(EX_DATAERR, NULL); + /* Just use the first host in the answer. */ + family = res->ai_family; + memcpy(&result, res->ai_addr, res->ai_addrlen); + freeaddrinfo(res); + if (family == PF_INET) { ipfw_insn_sa *p = (ipfw_insn_sa *)action; From owner-dev-commits-src-branches@freebsd.org Tue May 18 07:47:12 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 397E0643243; Tue, 18 May 2021 07:47:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fkp4J11F2z3p2g; Tue, 18 May 2021 07:47:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B0D71BA98; Tue, 18 May 2021 07:47:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14I7lBKT091930; Tue, 18 May 2021 07:47:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14I7lBXA091929; Tue, 18 May 2021 07:47:11 GMT (envelope-from git) Date: Tue, 18 May 2021 07:47:11 GMT Message-Id: <202105180747.14I7lBXA091929@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 135a6b5652f2 - stable/13 - e1000: disable hw.em.sbp debug setting MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 135a6b5652f24f9979ad4a74d45943887f78e898 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 07:47:12 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=135a6b5652f24f9979ad4a74d45943887f78e898 commit 135a6b5652f24f9979ad4a74d45943887f78e898 Author: Kevin Bowling AuthorDate: 2021-04-15 16:48:41 +0000 Commit: Kevin Bowling CommitDate: 2021-05-18 07:42:59 +0000 e1000: disable hw.em.sbp debug setting This is a debugging tunable that shouldn't have retained this setting after the initial iflib conversion of the driver PR: 248934 Reported by: Franco Fichtner Reviewed by: markj MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D29768 (cherry picked from commit 548d8a131d536d5f8e0818ff8cff7ffd63dbedfe) --- sys/dev/e1000/if_em.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 27f498cd3d46..584fd29f6125 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -509,7 +509,7 @@ SYSCTL_INT(_hw_em, OID_AUTO, smart_pwr_down, CTLFLAG_RDTUN, &em_smart_pwr_down, 0, "Set to true to leave smart power down enabled on newer adapters"); /* Controls whether promiscuous also shows bad packets */ -static int em_debug_sbp = TRUE; +static int em_debug_sbp = FALSE; SYSCTL_INT(_hw_em, OID_AUTO, sbp, CTLFLAG_RDTUN, &em_debug_sbp, 0, "Show bad packets in promiscuous mode"); From owner-dev-commits-src-branches@freebsd.org Tue May 18 07:47:13 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 7CF6A643245; Tue, 18 May 2021 07:47:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fkp4K2HR3z3p0V; Tue, 18 May 2021 07:47:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D4DB1B8B2; Tue, 18 May 2021 07:47:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14I7lDPV091951; Tue, 18 May 2021 07:47:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14I7lDCa091950; Tue, 18 May 2021 07:47:13 GMT (envelope-from git) Date: Tue, 18 May 2021 07:47:13 GMT Message-Id: <202105180747.14I7lDCa091950@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: a7e6edc7d70f - stable/13 - e1000: fix em_mac_min and 82547 packet buffer MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a7e6edc7d70fbe5d82faeda0bc6ae37550c2080f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 07:47:13 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a7e6edc7d70fbe5d82faeda0bc6ae37550c2080f commit a7e6edc7d70fbe5d82faeda0bc6ae37550c2080f Author: Kevin Bowling AuthorDate: 2021-04-15 16:58:36 +0000 Commit: Kevin Bowling CommitDate: 2021-05-18 07:45:49 +0000 e1000: fix em_mac_min and 82547 packet buffer The boundary differentiating "lem" vs "em" class devices was wrong after the iflib conversion of lem(4). The Packet Buffer size for 82547 class chips was not set correctly after the iflib conversion of lem(4). These changes restore functionality on an 82547 for the submitter. PR: 236119 Reported by: Jeff Gibbons Reviewed by: markj MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D29766 (cherry picked from commit bb1b375fa7487ee5c3843121a0621ac8379c18e6) --- sys/dev/e1000/if_em.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 584fd29f6125..35cedc6dd5c7 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -31,7 +31,7 @@ #include #include -#define em_mac_min e1000_82547 +#define em_mac_min e1000_82571 #define igb_mac_min e1000_82575 /********************************************************************* @@ -2502,13 +2502,22 @@ em_reset(if_ctx_t ctx) * the remainder is used for the transmit buffer. */ switch (hw->mac.type) { - /* Total Packet Buffer on these is 48K */ + /* 82547: Total Packet Buffer is 40K */ + case e1000_82547: + case e1000_82547_rev_2: + if (hw->mac.max_frame_size > 8192) + pba = E1000_PBA_22K; /* 22K for Rx, 18K for Tx */ + else + pba = E1000_PBA_30K; /* 30K for Rx, 10K for Tx */ + break; + /* 82571/82572/80003es2lan: Total Packet Buffer is 48K */ case e1000_82571: case e1000_82572: case e1000_80003es2lan: pba = E1000_PBA_32K; /* 32K for Rx, 16K for Tx */ break; - case e1000_82573: /* 82573: Total Packet Buffer is 32K */ + /* 82573: Total Packet Buffer is 32K */ + case e1000_82573: pba = E1000_PBA_12K; /* 12K for Rx, 20K for Tx */ break; case e1000_82574: @@ -2556,7 +2565,8 @@ em_reset(if_ctx_t ctx) pba = E1000_PBA_34K; break; default: - if (adapter->hw.mac.max_frame_size > 8192) + /* Remaining devices assumed to have a Packet Buffer of 64K. */ + if (hw->mac.max_frame_size > 8192) pba = E1000_PBA_40K; /* 40K for Rx, 24K for Tx */ else pba = E1000_PBA_48K; /* 48K for Rx, 16K for Tx */ From owner-dev-commits-src-branches@freebsd.org Tue May 18 07:49:10 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 88A4C6436A3; Tue, 18 May 2021 07:49:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fkp6Z3Rt9z3nrb; Tue, 18 May 2021 07:49:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5EDCB1B9C6; Tue, 18 May 2021 07:49:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14I7nA2K092223; Tue, 18 May 2021 07:49:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14I7nAVL092222; Tue, 18 May 2021 07:49:10 GMT (envelope-from git) Date: Tue, 18 May 2021 07:49:10 GMT Message-Id: <202105180749.14I7nAVL092222@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 94c02a765cb7 - stable/12 - e1000: disable hw.em.sbp debug setting MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 94c02a765cb7f68c80844acb5898be90dc4069c5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 07:49:10 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=94c02a765cb7f68c80844acb5898be90dc4069c5 commit 94c02a765cb7f68c80844acb5898be90dc4069c5 Author: Kevin Bowling AuthorDate: 2021-04-15 16:48:41 +0000 Commit: Kevin Bowling CommitDate: 2021-05-18 07:48:04 +0000 e1000: disable hw.em.sbp debug setting This is a debugging tunable that shouldn't have retained this setting after the initial iflib conversion of the driver PR: 248934 Reported by: Franco Fichtner Reviewed by: markj MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D29768 (cherry picked from commit 548d8a131d536d5f8e0818ff8cff7ffd63dbedfe) --- sys/dev/e1000/if_em.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 32c07f05dec8..2c13f7750af2 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -508,7 +508,7 @@ SYSCTL_INT(_hw_em, OID_AUTO, smart_pwr_down, CTLFLAG_RDTUN, &em_smart_pwr_down, 0, "Set to true to leave smart power down enabled on newer adapters"); /* Controls whether promiscuous also shows bad packets */ -static int em_debug_sbp = TRUE; +static int em_debug_sbp = FALSE; SYSCTL_INT(_hw_em, OID_AUTO, sbp, CTLFLAG_RDTUN, &em_debug_sbp, 0, "Show bad packets in promiscuous mode"); From owner-dev-commits-src-branches@freebsd.org Tue May 18 07:49:11 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 C2CD964361C; Tue, 18 May 2021 07:49:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fkp6b4bGfz3p5y; Tue, 18 May 2021 07:49:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 80A9C1BA27; Tue, 18 May 2021 07:49:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14I7nBTo092244; Tue, 18 May 2021 07:49:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14I7nBI1092243; Tue, 18 May 2021 07:49:11 GMT (envelope-from git) Date: Tue, 18 May 2021 07:49:11 GMT Message-Id: <202105180749.14I7nBI1092243@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 1a132077c2cb - stable/12 - e1000: fix em_mac_min and 82547 packet buffer MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1a132077c2cb500410079f9120c3f676d15f7931 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 07:49:12 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=1a132077c2cb500410079f9120c3f676d15f7931 commit 1a132077c2cb500410079f9120c3f676d15f7931 Author: Kevin Bowling AuthorDate: 2021-04-15 16:58:36 +0000 Commit: Kevin Bowling CommitDate: 2021-05-18 07:48:49 +0000 e1000: fix em_mac_min and 82547 packet buffer The boundary differentiating "lem" vs "em" class devices was wrong after the iflib conversion of lem(4). The Packet Buffer size for 82547 class chips was not set correctly after the iflib conversion of lem(4). These changes restore functionality on an 82547 for the submitter. PR: 236119 Reported by: Jeff Gibbons Reviewed by: markj MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D29766 (cherry picked from commit bb1b375fa7487ee5c3843121a0621ac8379c18e6) --- sys/dev/e1000/if_em.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 2c13f7750af2..ce60b1f5d437 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -31,7 +31,7 @@ #include #include -#define em_mac_min e1000_82547 +#define em_mac_min e1000_82571 #define igb_mac_min e1000_82575 /********************************************************************* @@ -2492,13 +2492,22 @@ em_reset(if_ctx_t ctx) * the remainder is used for the transmit buffer. */ switch (hw->mac.type) { - /* Total Packet Buffer on these is 48K */ + /* 82547: Total Packet Buffer is 40K */ + case e1000_82547: + case e1000_82547_rev_2: + if (hw->mac.max_frame_size > 8192) + pba = E1000_PBA_22K; /* 22K for Rx, 18K for Tx */ + else + pba = E1000_PBA_30K; /* 30K for Rx, 10K for Tx */ + break; + /* 82571/82572/80003es2lan: Total Packet Buffer is 48K */ case e1000_82571: case e1000_82572: case e1000_80003es2lan: pba = E1000_PBA_32K; /* 32K for Rx, 16K for Tx */ break; - case e1000_82573: /* 82573: Total Packet Buffer is 32K */ + /* 82573: Total Packet Buffer is 32K */ + case e1000_82573: pba = E1000_PBA_12K; /* 12K for Rx, 20K for Tx */ break; case e1000_82574: @@ -2546,7 +2555,8 @@ em_reset(if_ctx_t ctx) pba = E1000_PBA_34K; break; default: - if (adapter->hw.mac.max_frame_size > 8192) + /* Remaining devices assumed to have a Packet Buffer of 64K. */ + if (hw->mac.max_frame_size > 8192) pba = E1000_PBA_40K; /* 40K for Rx, 24K for Tx */ else pba = E1000_PBA_48K; /* 48K for Rx, 16K for Tx */ From owner-dev-commits-src-branches@freebsd.org Tue May 18 12:18:42 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 9693264B5A6; Tue, 18 May 2021 12:18:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fkw5Z3rNyz3PgQ; Tue, 18 May 2021 12:18:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C6BF1F247; Tue, 18 May 2021 12:18:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14ICIg5K051687; Tue, 18 May 2021 12:18:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14ICIg3F051686; Tue, 18 May 2021 12:18:42 GMT (envelope-from git) Date: Tue, 18 May 2021 12:18:42 GMT Message-Id: <202105181218.14ICIg3F051686@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: dbfd8660a96d - stable/12 - bridgestp: validate timer values in config BPDU MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: dbfd8660a96df693b66e9f13c70ca4302d2bfa84 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 12:18:42 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=dbfd8660a96df693b66e9f13c70ca4302d2bfa84 commit dbfd8660a96df693b66e9f13c70ca4302d2bfa84 Author: Jonah Caplan AuthorDate: 2021-04-15 09:28:42 +0000 Commit: Kristof Provost CommitDate: 2021-05-18 12:17:46 +0000 bridgestp: validate timer values in config BPDU IEEE Std 802.1D-2004 Section 17.14 defines permitted ranges for timers. Incoming BPDU messages should be checked against the permitted ranges. The rest of 17.14 appears to be enforced already. PR: 254924 Reviewed by: kp, donner Differential Revision: https://reviews.freebsd.org/D29782 (cherry picked from commit 0e4025bffa2bab3461b72b40d0b1468722ff76e6) --- sys/net/bridgestp.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c index 4be8e2f20819..9528cd92646a 100644 --- a/sys/net/bridgestp.c +++ b/sys/net/bridgestp.c @@ -594,6 +594,23 @@ bstp_received_bpdu(struct bstp_state *bs, struct bstp_port *bp, return; } + /* range checks */ + if (cu->cu_message_age >= cu->cu_max_age) { + return; + } + if (cu->cu_max_age < BSTP_MIN_MAX_AGE || + cu->cu_max_age > BSTP_MAX_MAX_AGE) { + return; + } + if (cu->cu_forward_delay < BSTP_MIN_FORWARD_DELAY || + cu->cu_forward_delay > BSTP_MAX_FORWARD_DELAY) { + return; + } + if (cu->cu_hello_time < BSTP_MIN_HELLO_TIME || + cu->cu_hello_time > BSTP_MAX_HELLO_TIME) { + return; + } + type = bstp_pdu_rcvtype(bp, cu); switch (type) { From owner-dev-commits-src-branches@freebsd.org Tue May 18 12:18:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 818D664B4BE; Tue, 18 May 2021 12:18:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fkw5Y3H5sz3Pk4; Tue, 18 May 2021 12:18:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 552061F245; Tue, 18 May 2021 12:18:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14ICIfKL051578; Tue, 18 May 2021 12:18:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14ICIfpQ051577; Tue, 18 May 2021 12:18:41 GMT (envelope-from git) Date: Tue, 18 May 2021 12:18:41 GMT Message-Id: <202105181218.14ICIfpQ051577@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: b9c3e4ada45f - stable/12 - netinet6 tests: Fix Python warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b9c3e4ada45faa8f3908a44dcbe87942affb0360 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 12:18:41 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b9c3e4ada45faa8f3908a44dcbe87942affb0360 commit b9c3e4ada45faa8f3908a44dcbe87942affb0360 Author: Kristof Provost AuthorDate: 2021-05-11 13:47:45 +0000 Commit: Kristof Provost CommitDate: 2021-05-18 12:17:46 +0000 netinet6 tests: Fix Python warning Python 3.8 warns about line 112: 'SyntaxWarning: "is" with a literal. Did you mean "=="?' Use '==' as Python suggests. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 80430c15caac0c10832455f868fa01c912996982) --- tests/sys/netinet6/frag6/frag6_16.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sys/netinet6/frag6/frag6_16.py b/tests/sys/netinet6/frag6/frag6_16.py index c38f5da4dea9..42ac8e2b4675 100644 --- a/tests/sys/netinet6/frag6/frag6_16.py +++ b/tests/sys/netinet6/frag6/frag6_16.py @@ -109,7 +109,7 @@ def main(): foffset=(int)(1288/8) mbit=1 for i in range(1,30): - if i is 29: + if i == 29: mbit=0 ip6f0n = sp.Ether() / \ sp.IPv6(src=args.src[0], dst=args.to[0]) / \ From owner-dev-commits-src-branches@freebsd.org Tue May 18 12:18:42 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 0001F64B61D; Tue, 18 May 2021 12:18:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fkw5Y6b8bz3Pcr; Tue, 18 May 2021 12:18:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA73F1F246; Tue, 18 May 2021 12:18:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14ICIfiR051666; Tue, 18 May 2021 12:18:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14ICIf2l051665; Tue, 18 May 2021 12:18:41 GMT (envelope-from git) Date: Tue, 18 May 2021 12:18:41 GMT Message-Id: <202105181218.14ICIf2l051665@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 38ad0faf9762 - stable/13 - netinet6 tests: Fix Python warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 38ad0faf9762554c330fcc9212fe06953fde6456 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 12:18:42 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=38ad0faf9762554c330fcc9212fe06953fde6456 commit 38ad0faf9762554c330fcc9212fe06953fde6456 Author: Kristof Provost AuthorDate: 2021-05-11 13:47:45 +0000 Commit: Kristof Provost CommitDate: 2021-05-18 10:00:38 +0000 netinet6 tests: Fix Python warning Python 3.8 warns about line 112: 'SyntaxWarning: "is" with a literal. Did you mean "=="?' Use '==' as Python suggests. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 80430c15caac0c10832455f868fa01c912996982) --- tests/sys/netinet6/frag6/frag6_16.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sys/netinet6/frag6/frag6_16.py b/tests/sys/netinet6/frag6/frag6_16.py index c38f5da4dea9..42ac8e2b4675 100644 --- a/tests/sys/netinet6/frag6/frag6_16.py +++ b/tests/sys/netinet6/frag6/frag6_16.py @@ -109,7 +109,7 @@ def main(): foffset=(int)(1288/8) mbit=1 for i in range(1,30): - if i is 29: + if i == 29: mbit=0 ip6f0n = sp.Ether() / \ sp.IPv6(src=args.src[0], dst=args.to[0]) / \ From owner-dev-commits-src-branches@freebsd.org Tue May 18 12:18:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 9DFDF64B515; Tue, 18 May 2021 12:18:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fkw5c1mN0z3Pys; Tue, 18 May 2021 12:18:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1344E1F248; Tue, 18 May 2021 12:18:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14ICIhqV051750; Tue, 18 May 2021 12:18:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14ICIhcA051749; Tue, 18 May 2021 12:18:43 GMT (envelope-from git) Date: Tue, 18 May 2021 12:18:43 GMT Message-Id: <202105181218.14ICIhcA051749@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: ad27abda399a - stable/13 - bridge tests: Test STP config BPDU validation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ad27abda399a103276a04c0a17f966c861a4e836 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 12:18:45 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ad27abda399a103276a04c0a17f966c861a4e836 commit ad27abda399a103276a04c0a17f966c861a4e836 Author: Kristof Provost AuthorDate: 2021-04-15 12:55:00 +0000 Commit: Kristof Provost CommitDate: 2021-05-18 10:00:38 +0000 bridge tests: Test STP config BPDU validation PR: 254924 Reviewed by: donner Differential Revision: https://reviews.freebsd.org/D29783 (cherry picked from commit 4ae3a97e127cea14277b904af31483af7e6e2891) --- tests/sys/net/Makefile | 7 ++- tests/sys/net/if_bridge_test.sh | 45 ++++++++++++++++ tests/sys/net/stp.py | 112 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+), 1 deletion(-) diff --git a/tests/sys/net/Makefile b/tests/sys/net/Makefile index 3941a502a3a6..40b3a5e5fff6 100644 --- a/tests/sys/net/Makefile +++ b/tests/sys/net/Makefile @@ -1,6 +1,6 @@ # $FreeBSD$ -.include +PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/net BINDIR= ${TESTSDIR} @@ -20,6 +20,11 @@ TESTS_SUBDIRS+= routing # locked. TEST_METADATA+= is_exclusive=true +${PACKAGE}FILES+= \ + stp.py + +${PACKAGE}FILESMODE_stp.py= 0555 + MAN= PROGS+= randsleep diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index 1f10fe325a2c..4703efed46b8 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -408,6 +408,50 @@ inherit_mac_cleanup() vnet_cleanup } +atf_test_case "stp_validation" "cleanup" +stp_validation_head() +{ + atf_set descr 'Check STP validation' + atf_set require.user root + atf_set require.progs scapy +} + +stp_validation_body() +{ + vnet_init + + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + bridge=$(vnet_mkbridge) + + ifconfig ${bridge} up + ifconfig ${bridge} addm ${epair_one}a addm ${epair_two}a + ifconfig ${bridge} stp ${epair_one}a stp ${epair_two}a + + ifconfig ${epair_one}a up + ifconfig ${epair_one}b up + ifconfig ${epair_two}a up + ifconfig ${epair_two}b up + + # Wait until the interfaces are no longer discarding + while ifconfig ${bridge} | grep 'state discarding' >/dev/null + do + sleep 1 + done + + # Now inject invalid STP BPDUs on epair_one and see if they're repeated + # on epair_two + atf_check -s exit:0 \ + $(atf_get_srcdir)/stp.py \ + --sendif ${epair_one}b \ + --recvif ${epair_two}b +} + +stp_validation_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" @@ -418,4 +462,5 @@ atf_init_test_cases() atf_add_test_case "inherit_mac" atf_add_test_case "delete_with_members" atf_add_test_case "mac_conflict" + atf_add_test_case "stp_validation" } diff --git a/tests/sys/net/stp.py b/tests/sys/net/stp.py new file mode 100644 index 000000000000..4c4c0af4c728 --- /dev/null +++ b/tests/sys/net/stp.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2021 Kristof Provost +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +import argparse +import scapy.all as sp +import sys +import os +curdir = os.path.dirname(os.path.realpath(__file__)) +netpfil_common = curdir + "/../netpfil/common" +sys.path.append(netpfil_common) +from sniffer import Sniffer + +def check_stp(args, packet): + stp = packet.getlayer(sp.STP) + if stp is None: + return False + + if stp.rootmac != "00:0c:29:01:01:01": + return False + + # Ensure we don't get confused by valid STP packets generated by if_bridge + if (stp.maxage >= 6 and stp.maxage <= 40) and \ + (stp.hellotime >= 1 and stp.hellotime <= 2) and \ + (stp.fwddelay >= 4 and stp.fwddelay <= 30): + return False + + print("This packet should have been dropped") + print(packet.show()) + return True + +def invalid_stp(send_if): + llc = sp.Ether(src="00:0c:29:0b:91:0a", dst="01:80:C2:00:00:00") \ + / sp.LLC() + + # Bad maxage + stp = llc / sp.STP(proto=0, rootid=32768, rootmac="00:0c:29:01:01:01", \ + bridgeid=32768, bridgemac="00:0c:29:01:01:01", \ + portid=0x8007, maxage=41, hellotime=2, fwddelay=30) + sp.sendp(stp, iface=send_if, verbose=False) + stp = llc / sp.STP(proto=0, rootid=32768, rootmac="00:0c:29:01:01:01", \ + bridgeid=32768, bridgemac="00:0c:29:01:01:01", \ + portid=0x8007, maxage=5, hellotime=2, fwddelay=30) + sp.sendp(stp, iface=send_if, verbose=False) + + # Bad hellotime + stp = llc / sp.STP(proto=0, rootid=32768, rootmac="00:0c:29:01:01:01", \ + bridgeid=32768, bridgemac="00:0c:29:01:01:01", \ + portid=0x8007, maxage=40, hellotime=3, fwddelay=30) + sp.sendp(stp, iface=send_if, verbose=False) + stp = llc / sp.STP(proto=0, rootid=32768, rootmac="00:0c:29:01:01:01", \ + bridgeid=32768, bridgemac="00:0c:29:01:01:01", \ + portid=0x8007, maxage=40, hellotime=1, fwddelay=30) + sp.sendp(stp, iface=send_if, verbose=False) + + # Bad fwddelay + stp = llc / sp.STP(proto=0, rootid=32768, rootmac="00:0c:29:01:01:01", \ + bridgeid=32768, bridgemac="00:0c:29:01:01:01", \ + portid=0x8007, maxage=40, hellotime=2, fwddelay=31) + sp.sendp(stp, iface=send_if, verbose=False) + stp = llc / sp.STP(proto=0, rootid=32768, rootmac="00:0c:29:01:01:01", \ + bridgeid=32768, bridgemac="00:0c:29:01:01:01", \ + portid=0x8007, maxage=40, hellotime=2, fwddelay=3) + sp.sendp(stp, iface=send_if, verbose=False) + +def main(): + parser = argparse.ArgumentParser("stp.py", + description="STP test tool") + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet(s) will be sent') + parser.add_argument('--recvif', nargs=1, + help='The interface on which to expect the ICMP echo request') + + args = parser.parse_args() + + sniffer = Sniffer(args, check_stp) + + invalid_stp(args.sendif[0]) + + sniffer.join() + + # The 'correct' packet is a corrupt STP packet, so it shouldn't turn up. + if sniffer.foundCorrectPacket: + sys.exit(1) + +if __name__ == '__main__': + main() From owner-dev-commits-src-branches@freebsd.org Tue May 18 12:18:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 10DA664B68A; Tue, 18 May 2021 12:18:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fkw5b6CKbz3Ppp; Tue, 18 May 2021 12:18:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8EE621F03B; Tue, 18 May 2021 12:18:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14ICIh5k051729; Tue, 18 May 2021 12:18:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14ICIhkY051728; Tue, 18 May 2021 12:18:43 GMT (envelope-from git) Date: Tue, 18 May 2021 12:18:43 GMT Message-Id: <202105181218.14ICIhkY051728@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: e8889c723a81 - stable/12 - bridge tests: Test STP config BPDU validation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e8889c723a816c1407c5de7cc812dcd5fce42c34 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 12:18:44 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e8889c723a816c1407c5de7cc812dcd5fce42c34 commit e8889c723a816c1407c5de7cc812dcd5fce42c34 Author: Kristof Provost AuthorDate: 2021-04-15 12:55:00 +0000 Commit: Kristof Provost CommitDate: 2021-05-18 12:17:47 +0000 bridge tests: Test STP config BPDU validation PR: 254924 Reviewed by: donner Differential Revision: https://reviews.freebsd.org/D29783 (cherry picked from commit 4ae3a97e127cea14277b904af31483af7e6e2891) --- tests/sys/net/Makefile | 7 ++- tests/sys/net/if_bridge_test.sh | 45 ++++++++++++++++ tests/sys/net/stp.py | 112 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+), 1 deletion(-) diff --git a/tests/sys/net/Makefile b/tests/sys/net/Makefile index bbb1d1337b2f..77c3c833a186 100644 --- a/tests/sys/net/Makefile +++ b/tests/sys/net/Makefile @@ -1,6 +1,6 @@ # $FreeBSD$ -.include +PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/net BINDIR= ${TESTSDIR} @@ -16,6 +16,11 @@ ATF_TESTS_SH+= if_tun_test # locked. TEST_METADATA+= is_exclusive=true +${PACKAGE}FILES+= \ + stp.py + +${PACKAGE}FILESMODE_stp.py= 0555 + MAN= PROGS+= randsleep diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index 1f10fe325a2c..4703efed46b8 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -408,6 +408,50 @@ inherit_mac_cleanup() vnet_cleanup } +atf_test_case "stp_validation" "cleanup" +stp_validation_head() +{ + atf_set descr 'Check STP validation' + atf_set require.user root + atf_set require.progs scapy +} + +stp_validation_body() +{ + vnet_init + + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + bridge=$(vnet_mkbridge) + + ifconfig ${bridge} up + ifconfig ${bridge} addm ${epair_one}a addm ${epair_two}a + ifconfig ${bridge} stp ${epair_one}a stp ${epair_two}a + + ifconfig ${epair_one}a up + ifconfig ${epair_one}b up + ifconfig ${epair_two}a up + ifconfig ${epair_two}b up + + # Wait until the interfaces are no longer discarding + while ifconfig ${bridge} | grep 'state discarding' >/dev/null + do + sleep 1 + done + + # Now inject invalid STP BPDUs on epair_one and see if they're repeated + # on epair_two + atf_check -s exit:0 \ + $(atf_get_srcdir)/stp.py \ + --sendif ${epair_one}b \ + --recvif ${epair_two}b +} + +stp_validation_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" @@ -418,4 +462,5 @@ atf_init_test_cases() atf_add_test_case "inherit_mac" atf_add_test_case "delete_with_members" atf_add_test_case "mac_conflict" + atf_add_test_case "stp_validation" } diff --git a/tests/sys/net/stp.py b/tests/sys/net/stp.py new file mode 100644 index 000000000000..4c4c0af4c728 --- /dev/null +++ b/tests/sys/net/stp.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2021 Kristof Provost +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +import argparse +import scapy.all as sp +import sys +import os +curdir = os.path.dirname(os.path.realpath(__file__)) +netpfil_common = curdir + "/../netpfil/common" +sys.path.append(netpfil_common) +from sniffer import Sniffer + +def check_stp(args, packet): + stp = packet.getlayer(sp.STP) + if stp is None: + return False + + if stp.rootmac != "00:0c:29:01:01:01": + return False + + # Ensure we don't get confused by valid STP packets generated by if_bridge + if (stp.maxage >= 6 and stp.maxage <= 40) and \ + (stp.hellotime >= 1 and stp.hellotime <= 2) and \ + (stp.fwddelay >= 4 and stp.fwddelay <= 30): + return False + + print("This packet should have been dropped") + print(packet.show()) + return True + +def invalid_stp(send_if): + llc = sp.Ether(src="00:0c:29:0b:91:0a", dst="01:80:C2:00:00:00") \ + / sp.LLC() + + # Bad maxage + stp = llc / sp.STP(proto=0, rootid=32768, rootmac="00:0c:29:01:01:01", \ + bridgeid=32768, bridgemac="00:0c:29:01:01:01", \ + portid=0x8007, maxage=41, hellotime=2, fwddelay=30) + sp.sendp(stp, iface=send_if, verbose=False) + stp = llc / sp.STP(proto=0, rootid=32768, rootmac="00:0c:29:01:01:01", \ + bridgeid=32768, bridgemac="00:0c:29:01:01:01", \ + portid=0x8007, maxage=5, hellotime=2, fwddelay=30) + sp.sendp(stp, iface=send_if, verbose=False) + + # Bad hellotime + stp = llc / sp.STP(proto=0, rootid=32768, rootmac="00:0c:29:01:01:01", \ + bridgeid=32768, bridgemac="00:0c:29:01:01:01", \ + portid=0x8007, maxage=40, hellotime=3, fwddelay=30) + sp.sendp(stp, iface=send_if, verbose=False) + stp = llc / sp.STP(proto=0, rootid=32768, rootmac="00:0c:29:01:01:01", \ + bridgeid=32768, bridgemac="00:0c:29:01:01:01", \ + portid=0x8007, maxage=40, hellotime=1, fwddelay=30) + sp.sendp(stp, iface=send_if, verbose=False) + + # Bad fwddelay + stp = llc / sp.STP(proto=0, rootid=32768, rootmac="00:0c:29:01:01:01", \ + bridgeid=32768, bridgemac="00:0c:29:01:01:01", \ + portid=0x8007, maxage=40, hellotime=2, fwddelay=31) + sp.sendp(stp, iface=send_if, verbose=False) + stp = llc / sp.STP(proto=0, rootid=32768, rootmac="00:0c:29:01:01:01", \ + bridgeid=32768, bridgemac="00:0c:29:01:01:01", \ + portid=0x8007, maxage=40, hellotime=2, fwddelay=3) + sp.sendp(stp, iface=send_if, verbose=False) + +def main(): + parser = argparse.ArgumentParser("stp.py", + description="STP test tool") + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet(s) will be sent') + parser.add_argument('--recvif', nargs=1, + help='The interface on which to expect the ICMP echo request') + + args = parser.parse_args() + + sniffer = Sniffer(args, check_stp) + + invalid_stp(args.sendif[0]) + + sniffer.join() + + # The 'correct' packet is a corrupt STP packet, so it shouldn't turn up. + if sniffer.foundCorrectPacket: + sys.exit(1) + +if __name__ == '__main__': + main() From owner-dev-commits-src-branches@freebsd.org Tue May 18 12:18:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 6973D64B628; Tue, 18 May 2021 12:18:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fkw5c6Xzcz3Pxt; Tue, 18 May 2021 12:18:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A852D1F31F; Tue, 18 May 2021 12:18:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14ICIiAK051771; Tue, 18 May 2021 12:18:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14ICIi5j051770; Tue, 18 May 2021 12:18:44 GMT (envelope-from git) Date: Tue, 18 May 2021 12:18:44 GMT Message-Id: <202105181218.14ICIi5j051770@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: fa8dd3566e32 - stable/12 - tests: Only log critical errors from scapy MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: fa8dd3566e3280aaa62bb5564ce8a3b600b65597 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 12:18:45 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fa8dd3566e3280aaa62bb5564ce8a3b600b65597 commit fa8dd3566e3280aaa62bb5564ce8a3b600b65597 Author: Kristof Provost AuthorDate: 2021-05-12 17:13:40 +0000 Commit: Kristof Provost CommitDate: 2021-05-18 12:17:47 +0000 tests: Only log critical errors from scapy Since 2.4.5 scapy started issuing warnings about a few different configurations during our tests. These are harmless, but they generate stderr output, which upsets atf_check. Configure scapy to only log critical errors (and thus not warnings) to fix these tests. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit a26e895f3d803cc1f4ee1c2b33c61330998808b9) --- tests/sys/net/stp.py | 2 ++ tests/sys/netinet6/exthdr.py | 2 ++ tests/sys/netinet6/frag6/frag6_01.py | 2 ++ tests/sys/netinet6/frag6/frag6_02.py | 2 ++ tests/sys/netinet6/frag6/frag6_03.py | 2 ++ tests/sys/netinet6/frag6/frag6_04.py | 2 ++ tests/sys/netinet6/frag6/frag6_05.py | 2 ++ tests/sys/netinet6/frag6/frag6_06.py | 2 ++ tests/sys/netinet6/frag6/frag6_07.py | 2 ++ tests/sys/netinet6/frag6/frag6_08.py | 2 ++ tests/sys/netinet6/frag6/frag6_09.py | 2 ++ tests/sys/netinet6/frag6/frag6_10.py | 2 ++ tests/sys/netinet6/frag6/frag6_11.py | 2 ++ tests/sys/netinet6/frag6/frag6_12.py | 2 ++ tests/sys/netinet6/frag6/frag6_13.py | 2 ++ tests/sys/netinet6/frag6/frag6_14.py | 2 ++ tests/sys/netinet6/frag6/frag6_15.py | 2 ++ tests/sys/netinet6/frag6/frag6_16.py | 2 ++ tests/sys/netinet6/frag6/frag6_17.py | 2 ++ tests/sys/netinet6/frag6/frag6_18.py | 2 ++ tests/sys/netinet6/frag6/frag6_19.py | 2 ++ tests/sys/netinet6/frag6/frag6_20.py | 2 ++ tests/sys/netinet6/frag6/sniffer.py | 2 ++ tests/sys/netinet6/mld.py | 2 ++ tests/sys/netinet6/scapyi386.py | 2 ++ tests/sys/netpfil/common/pft_ping.py | 2 ++ tests/sys/netpfil/pf/CVE-2019-5597.py | 2 ++ tests/sys/netpfil/pf/CVE-2019-5598.py | 2 ++ 28 files changed, 56 insertions(+) diff --git a/tests/sys/net/stp.py b/tests/sys/net/stp.py index 4c4c0af4c728..3e7d011efdd1 100644 --- a/tests/sys/net/stp.py +++ b/tests/sys/net/stp.py @@ -27,6 +27,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import sys import os diff --git a/tests/sys/netinet6/exthdr.py b/tests/sys/netinet6/exthdr.py index 7c09f44c5b58..52739a9cfa11 100644 --- a/tests/sys/netinet6/exthdr.py +++ b/tests/sys/netinet6/exthdr.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_01.py b/tests/sys/netinet6/frag6/frag6_01.py index 5a6b327337c6..efa99ce65759 100644 --- a/tests/sys/netinet6/frag6/frag6_01.py +++ b/tests/sys/netinet6/frag6/frag6_01.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_02.py b/tests/sys/netinet6/frag6/frag6_02.py index 945b428c3dac..794801b4a819 100644 --- a/tests/sys/netinet6/frag6/frag6_02.py +++ b/tests/sys/netinet6/frag6/frag6_02.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_03.py b/tests/sys/netinet6/frag6/frag6_03.py index 341de7915bd8..434dfe554a5a 100644 --- a/tests/sys/netinet6/frag6/frag6_03.py +++ b/tests/sys/netinet6/frag6/frag6_03.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_04.py b/tests/sys/netinet6/frag6/frag6_04.py index 6c35d4858ccb..8f0a20e003da 100644 --- a/tests/sys/netinet6/frag6/frag6_04.py +++ b/tests/sys/netinet6/frag6/frag6_04.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_05.py b/tests/sys/netinet6/frag6/frag6_05.py index d67c35581bbf..f9bc947d5465 100644 --- a/tests/sys/netinet6/frag6/frag6_05.py +++ b/tests/sys/netinet6/frag6/frag6_05.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_06.py b/tests/sys/netinet6/frag6/frag6_06.py index 42c8b02042cd..ca4e9b1a5ca0 100644 --- a/tests/sys/netinet6/frag6/frag6_06.py +++ b/tests/sys/netinet6/frag6/frag6_06.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_07.py b/tests/sys/netinet6/frag6/frag6_07.py index c84a783137d3..231f49eac2e0 100644 --- a/tests/sys/netinet6/frag6/frag6_07.py +++ b/tests/sys/netinet6/frag6/frag6_07.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_08.py b/tests/sys/netinet6/frag6/frag6_08.py index fa17e1e5c774..25f57f702e71 100644 --- a/tests/sys/netinet6/frag6/frag6_08.py +++ b/tests/sys/netinet6/frag6/frag6_08.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_09.py b/tests/sys/netinet6/frag6/frag6_09.py index 6e9771bc7d58..63ec646e1175 100644 --- a/tests/sys/netinet6/frag6/frag6_09.py +++ b/tests/sys/netinet6/frag6/frag6_09.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_10.py b/tests/sys/netinet6/frag6/frag6_10.py index 02d25bd96450..fcd331190c02 100644 --- a/tests/sys/netinet6/frag6/frag6_10.py +++ b/tests/sys/netinet6/frag6/frag6_10.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_11.py b/tests/sys/netinet6/frag6/frag6_11.py index a5c8e1918430..6b9643337597 100644 --- a/tests/sys/netinet6/frag6/frag6_11.py +++ b/tests/sys/netinet6/frag6/frag6_11.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_12.py b/tests/sys/netinet6/frag6/frag6_12.py index 68ea180599e1..a683782f2b69 100644 --- a/tests/sys/netinet6/frag6/frag6_12.py +++ b/tests/sys/netinet6/frag6/frag6_12.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_13.py b/tests/sys/netinet6/frag6/frag6_13.py index da3b2afe239f..e377a4272fa1 100644 --- a/tests/sys/netinet6/frag6/frag6_13.py +++ b/tests/sys/netinet6/frag6/frag6_13.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_14.py b/tests/sys/netinet6/frag6/frag6_14.py index 915571cfc36f..b53a65e67529 100644 --- a/tests/sys/netinet6/frag6/frag6_14.py +++ b/tests/sys/netinet6/frag6/frag6_14.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_15.py b/tests/sys/netinet6/frag6/frag6_15.py index f9922aaa9717..fff5c1efbe17 100644 --- a/tests/sys/netinet6/frag6/frag6_15.py +++ b/tests/sys/netinet6/frag6/frag6_15.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_16.py b/tests/sys/netinet6/frag6/frag6_16.py index 42ac8e2b4675..bf5b78cb6d6b 100644 --- a/tests/sys/netinet6/frag6/frag6_16.py +++ b/tests/sys/netinet6/frag6/frag6_16.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_17.py b/tests/sys/netinet6/frag6/frag6_17.py index a4d6deea0a24..b4a1a1898c2e 100644 --- a/tests/sys/netinet6/frag6/frag6_17.py +++ b/tests/sys/netinet6/frag6/frag6_17.py @@ -30,6 +30,8 @@ import argparse import random as random +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_18.py b/tests/sys/netinet6/frag6/frag6_18.py index a4d6deea0a24..b4a1a1898c2e 100644 --- a/tests/sys/netinet6/frag6/frag6_18.py +++ b/tests/sys/netinet6/frag6/frag6_18.py @@ -30,6 +30,8 @@ import argparse import random as random +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_19.py b/tests/sys/netinet6/frag6/frag6_19.py index 9248f5f40c43..f8613f757573 100644 --- a/tests/sys/netinet6/frag6/frag6_19.py +++ b/tests/sys/netinet6/frag6/frag6_19.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_20.py b/tests/sys/netinet6/frag6/frag6_20.py index 4e935a1f640a..6dd4c2379357 100755 --- a/tests/sys/netinet6/frag6/frag6_20.py +++ b/tests/sys/netinet6/frag6/frag6_20.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/sniffer.py b/tests/sys/netinet6/frag6/sniffer.py index 2c5f460488db..7e1d283dbf91 100644 --- a/tests/sys/netinet6/frag6/sniffer.py +++ b/tests/sys/netinet6/frag6/sniffer.py @@ -1,6 +1,8 @@ # $FreeBSD$ import threading +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp class Sniffer(threading.Thread): diff --git a/tests/sys/netinet6/mld.py b/tests/sys/netinet6/mld.py index b1fcf2f8e50a..1f43cee5d6ad 100644 --- a/tests/sys/netinet6/mld.py +++ b/tests/sys/netinet6/mld.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/scapyi386.py b/tests/sys/netinet6/scapyi386.py index 745c01b45881..ac0c877380c4 100644 --- a/tests/sys/netinet6/scapyi386.py +++ b/tests/sys/netinet6/scapyi386.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netpfil/common/pft_ping.py b/tests/sys/netpfil/common/pft_ping.py index 8c47df24ea0d..a0ca66742f77 100644 --- a/tests/sys/netpfil/common/pft_ping.py +++ b/tests/sys/netpfil/common/pft_ping.py @@ -1,6 +1,8 @@ #!/usr/bin/env python import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netpfil/pf/CVE-2019-5597.py b/tests/sys/netpfil/pf/CVE-2019-5597.py index 68579e99590c..6ba56e33ff91 100644 --- a/tests/sys/netpfil/pf/CVE-2019-5597.py +++ b/tests/sys/netpfil/pf/CVE-2019-5597.py @@ -1,6 +1,8 @@ #!/usr/bin/env python import random +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import sys diff --git a/tests/sys/netpfil/pf/CVE-2019-5598.py b/tests/sys/netpfil/pf/CVE-2019-5598.py index 1a2619f7e52f..5e997a34f9be 100644 --- a/tests/sys/netpfil/pf/CVE-2019-5598.py +++ b/tests/sys/netpfil/pf/CVE-2019-5598.py @@ -1,6 +1,8 @@ #!/usr/bin/env python import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import sys from sniffer import Sniffer From owner-dev-commits-src-branches@freebsd.org Tue May 18 12:18:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 AC07764B243; Tue, 18 May 2021 12:18:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fkw5d2tjtz3Ppv; Tue, 18 May 2021 12:18:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 336151F2CE; Tue, 18 May 2021 12:18:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14ICIjFG051797; Tue, 18 May 2021 12:18:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14ICIjSC051796; Tue, 18 May 2021 12:18:45 GMT (envelope-from git) Date: Tue, 18 May 2021 12:18:45 GMT Message-Id: <202105181218.14ICIjSC051796@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 2b8399210bb0 - stable/13 - tests: Only log critical errors from scapy MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2b8399210bb00c868b4cce86d86fc68a5a0a9121 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 12:18:47 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2b8399210bb00c868b4cce86d86fc68a5a0a9121 commit 2b8399210bb00c868b4cce86d86fc68a5a0a9121 Author: Kristof Provost AuthorDate: 2021-05-12 17:13:40 +0000 Commit: Kristof Provost CommitDate: 2021-05-18 10:00:38 +0000 tests: Only log critical errors from scapy Since 2.4.5 scapy started issuing warnings about a few different configurations during our tests. These are harmless, but they generate stderr output, which upsets atf_check. Configure scapy to only log critical errors (and thus not warnings) to fix these tests. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit a26e895f3d803cc1f4ee1c2b33c61330998808b9) --- tests/sys/common/divert.py | 2 ++ tests/sys/common/sender.py | 2 ++ tests/sys/net/stp.py | 2 ++ tests/sys/netinet6/exthdr.py | 2 ++ tests/sys/netinet6/frag6/frag6_01.py | 2 ++ tests/sys/netinet6/frag6/frag6_02.py | 2 ++ tests/sys/netinet6/frag6/frag6_03.py | 2 ++ tests/sys/netinet6/frag6/frag6_04.py | 2 ++ tests/sys/netinet6/frag6/frag6_05.py | 2 ++ tests/sys/netinet6/frag6/frag6_06.py | 2 ++ tests/sys/netinet6/frag6/frag6_07.py | 2 ++ tests/sys/netinet6/frag6/frag6_08.py | 2 ++ tests/sys/netinet6/frag6/frag6_09.py | 2 ++ tests/sys/netinet6/frag6/frag6_10.py | 2 ++ tests/sys/netinet6/frag6/frag6_11.py | 2 ++ tests/sys/netinet6/frag6/frag6_12.py | 2 ++ tests/sys/netinet6/frag6/frag6_13.py | 2 ++ tests/sys/netinet6/frag6/frag6_14.py | 2 ++ tests/sys/netinet6/frag6/frag6_15.py | 2 ++ tests/sys/netinet6/frag6/frag6_16.py | 2 ++ tests/sys/netinet6/frag6/frag6_17.py | 2 ++ tests/sys/netinet6/frag6/frag6_18.py | 2 ++ tests/sys/netinet6/frag6/frag6_19.py | 2 ++ tests/sys/netinet6/frag6/frag6_20.py | 2 ++ tests/sys/netinet6/frag6/sniffer.py | 2 ++ tests/sys/netinet6/mld.py | 2 ++ tests/sys/netinet6/redirect.py | 2 ++ tests/sys/netinet6/scapyi386.py | 2 ++ tests/sys/netpfil/common/pft_ping.py | 2 ++ tests/sys/netpfil/pf/CVE-2019-5597.py | 2 ++ tests/sys/netpfil/pf/CVE-2019-5598.py | 2 ++ 31 files changed, 62 insertions(+) diff --git a/tests/sys/common/divert.py b/tests/sys/common/divert.py index 1861f87402ad..f23fbe857cbb 100755 --- a/tests/sys/common/divert.py +++ b/tests/sys/common/divert.py @@ -30,6 +30,8 @@ import socket +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sc import argparse diff --git a/tests/sys/common/sender.py b/tests/sys/common/sender.py index 483210e54fcb..2ff699a8ef6d 100755 --- a/tests/sys/common/sender.py +++ b/tests/sys/common/sender.py @@ -31,6 +31,8 @@ from functools import partial import socket +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sc import argparse import time diff --git a/tests/sys/net/stp.py b/tests/sys/net/stp.py index 4c4c0af4c728..3e7d011efdd1 100644 --- a/tests/sys/net/stp.py +++ b/tests/sys/net/stp.py @@ -27,6 +27,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import sys import os diff --git a/tests/sys/netinet6/exthdr.py b/tests/sys/netinet6/exthdr.py index 7c09f44c5b58..52739a9cfa11 100644 --- a/tests/sys/netinet6/exthdr.py +++ b/tests/sys/netinet6/exthdr.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_01.py b/tests/sys/netinet6/frag6/frag6_01.py index 5a6b327337c6..efa99ce65759 100644 --- a/tests/sys/netinet6/frag6/frag6_01.py +++ b/tests/sys/netinet6/frag6/frag6_01.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_02.py b/tests/sys/netinet6/frag6/frag6_02.py index 945b428c3dac..794801b4a819 100644 --- a/tests/sys/netinet6/frag6/frag6_02.py +++ b/tests/sys/netinet6/frag6/frag6_02.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_03.py b/tests/sys/netinet6/frag6/frag6_03.py index 341de7915bd8..434dfe554a5a 100644 --- a/tests/sys/netinet6/frag6/frag6_03.py +++ b/tests/sys/netinet6/frag6/frag6_03.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_04.py b/tests/sys/netinet6/frag6/frag6_04.py index 6c35d4858ccb..8f0a20e003da 100644 --- a/tests/sys/netinet6/frag6/frag6_04.py +++ b/tests/sys/netinet6/frag6/frag6_04.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_05.py b/tests/sys/netinet6/frag6/frag6_05.py index d67c35581bbf..f9bc947d5465 100644 --- a/tests/sys/netinet6/frag6/frag6_05.py +++ b/tests/sys/netinet6/frag6/frag6_05.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_06.py b/tests/sys/netinet6/frag6/frag6_06.py index 42c8b02042cd..ca4e9b1a5ca0 100644 --- a/tests/sys/netinet6/frag6/frag6_06.py +++ b/tests/sys/netinet6/frag6/frag6_06.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_07.py b/tests/sys/netinet6/frag6/frag6_07.py index c84a783137d3..231f49eac2e0 100644 --- a/tests/sys/netinet6/frag6/frag6_07.py +++ b/tests/sys/netinet6/frag6/frag6_07.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_08.py b/tests/sys/netinet6/frag6/frag6_08.py index fa17e1e5c774..25f57f702e71 100644 --- a/tests/sys/netinet6/frag6/frag6_08.py +++ b/tests/sys/netinet6/frag6/frag6_08.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_09.py b/tests/sys/netinet6/frag6/frag6_09.py index 6e9771bc7d58..63ec646e1175 100644 --- a/tests/sys/netinet6/frag6/frag6_09.py +++ b/tests/sys/netinet6/frag6/frag6_09.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_10.py b/tests/sys/netinet6/frag6/frag6_10.py index 02d25bd96450..fcd331190c02 100644 --- a/tests/sys/netinet6/frag6/frag6_10.py +++ b/tests/sys/netinet6/frag6/frag6_10.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_11.py b/tests/sys/netinet6/frag6/frag6_11.py index a5c8e1918430..6b9643337597 100644 --- a/tests/sys/netinet6/frag6/frag6_11.py +++ b/tests/sys/netinet6/frag6/frag6_11.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_12.py b/tests/sys/netinet6/frag6/frag6_12.py index 68ea180599e1..a683782f2b69 100644 --- a/tests/sys/netinet6/frag6/frag6_12.py +++ b/tests/sys/netinet6/frag6/frag6_12.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_13.py b/tests/sys/netinet6/frag6/frag6_13.py index da3b2afe239f..e377a4272fa1 100644 --- a/tests/sys/netinet6/frag6/frag6_13.py +++ b/tests/sys/netinet6/frag6/frag6_13.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_14.py b/tests/sys/netinet6/frag6/frag6_14.py index 915571cfc36f..b53a65e67529 100644 --- a/tests/sys/netinet6/frag6/frag6_14.py +++ b/tests/sys/netinet6/frag6/frag6_14.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_15.py b/tests/sys/netinet6/frag6/frag6_15.py index f9922aaa9717..fff5c1efbe17 100644 --- a/tests/sys/netinet6/frag6/frag6_15.py +++ b/tests/sys/netinet6/frag6/frag6_15.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_16.py b/tests/sys/netinet6/frag6/frag6_16.py index 42ac8e2b4675..bf5b78cb6d6b 100644 --- a/tests/sys/netinet6/frag6/frag6_16.py +++ b/tests/sys/netinet6/frag6/frag6_16.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_17.py b/tests/sys/netinet6/frag6/frag6_17.py index a4d6deea0a24..b4a1a1898c2e 100644 --- a/tests/sys/netinet6/frag6/frag6_17.py +++ b/tests/sys/netinet6/frag6/frag6_17.py @@ -30,6 +30,8 @@ import argparse import random as random +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_18.py b/tests/sys/netinet6/frag6/frag6_18.py index a4d6deea0a24..b4a1a1898c2e 100644 --- a/tests/sys/netinet6/frag6/frag6_18.py +++ b/tests/sys/netinet6/frag6/frag6_18.py @@ -30,6 +30,8 @@ import argparse import random as random +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_19.py b/tests/sys/netinet6/frag6/frag6_19.py index 9248f5f40c43..f8613f757573 100644 --- a/tests/sys/netinet6/frag6/frag6_19.py +++ b/tests/sys/netinet6/frag6/frag6_19.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_20.py b/tests/sys/netinet6/frag6/frag6_20.py index 4e935a1f640a..6dd4c2379357 100755 --- a/tests/sys/netinet6/frag6/frag6_20.py +++ b/tests/sys/netinet6/frag6/frag6_20.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/sniffer.py b/tests/sys/netinet6/frag6/sniffer.py index 2c5f460488db..7e1d283dbf91 100644 --- a/tests/sys/netinet6/frag6/sniffer.py +++ b/tests/sys/netinet6/frag6/sniffer.py @@ -1,6 +1,8 @@ # $FreeBSD$ import threading +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp class Sniffer(threading.Thread): diff --git a/tests/sys/netinet6/mld.py b/tests/sys/netinet6/mld.py index b1fcf2f8e50a..1f43cee5d6ad 100644 --- a/tests/sys/netinet6/mld.py +++ b/tests/sys/netinet6/mld.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/redirect.py b/tests/sys/netinet6/redirect.py index 7066f8066518..4f785c615f62 100644 --- a/tests/sys/netinet6/redirect.py +++ b/tests/sys/netinet6/redirect.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sc import socket import sys diff --git a/tests/sys/netinet6/scapyi386.py b/tests/sys/netinet6/scapyi386.py index 745c01b45881..ac0c877380c4 100644 --- a/tests/sys/netinet6/scapyi386.py +++ b/tests/sys/netinet6/scapyi386.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netpfil/common/pft_ping.py b/tests/sys/netpfil/common/pft_ping.py index de673f026c77..9cc7c5d5c5c0 100644 --- a/tests/sys/netpfil/common/pft_ping.py +++ b/tests/sys/netpfil/common/pft_ping.py @@ -27,6 +27,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netpfil/pf/CVE-2019-5597.py b/tests/sys/netpfil/pf/CVE-2019-5597.py index 1050af506f8d..1b25809cbedf 100644 --- a/tests/sys/netpfil/pf/CVE-2019-5597.py +++ b/tests/sys/netpfil/pf/CVE-2019-5597.py @@ -26,6 +26,8 @@ # SUCH DAMAGE. import random +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import sys diff --git a/tests/sys/netpfil/pf/CVE-2019-5598.py b/tests/sys/netpfil/pf/CVE-2019-5598.py index ac1e4f3438f5..603a1aef376f 100644 --- a/tests/sys/netpfil/pf/CVE-2019-5598.py +++ b/tests/sys/netpfil/pf/CVE-2019-5598.py @@ -26,6 +26,8 @@ # SUCH DAMAGE. import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import sys from sniffer import Sniffer From owner-dev-commits-src-branches@freebsd.org Tue May 18 12:18:43 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 3695264B688; Tue, 18 May 2021 12:18:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fkw5b0fMdz3PgR; Tue, 18 May 2021 12:18:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E2E371F31E; Tue, 18 May 2021 12:18:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14ICIgYA051708; Tue, 18 May 2021 12:18:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14ICIg1C051707; Tue, 18 May 2021 12:18:42 GMT (envelope-from git) Date: Tue, 18 May 2021 12:18:42 GMT Message-Id: <202105181218.14ICIg1C051707@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 61d771b63df6 - stable/13 - bridgestp: validate timer values in config BPDU MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 61d771b63df62e4e8764b187c1307a87933248ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 12:18:43 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=61d771b63df62e4e8764b187c1307a87933248ef commit 61d771b63df62e4e8764b187c1307a87933248ef Author: Jonah Caplan AuthorDate: 2021-04-15 09:28:42 +0000 Commit: Kristof Provost CommitDate: 2021-05-18 10:00:38 +0000 bridgestp: validate timer values in config BPDU IEEE Std 802.1D-2004 Section 17.14 defines permitted ranges for timers. Incoming BPDU messages should be checked against the permitted ranges. The rest of 17.14 appears to be enforced already. PR: 254924 Reviewed by: kp, donner Differential Revision: https://reviews.freebsd.org/D29782 (cherry picked from commit 0e4025bffa2bab3461b72b40d0b1468722ff76e6) --- sys/net/bridgestp.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c index 9e3a3e14ecda..cf182d2efe7b 100644 --- a/sys/net/bridgestp.c +++ b/sys/net/bridgestp.c @@ -597,6 +597,23 @@ bstp_received_bpdu(struct bstp_state *bs, struct bstp_port *bp, return; } + /* range checks */ + if (cu->cu_message_age >= cu->cu_max_age) { + return; + } + if (cu->cu_max_age < BSTP_MIN_MAX_AGE || + cu->cu_max_age > BSTP_MAX_MAX_AGE) { + return; + } + if (cu->cu_forward_delay < BSTP_MIN_FORWARD_DELAY || + cu->cu_forward_delay > BSTP_MAX_FORWARD_DELAY) { + return; + } + if (cu->cu_hello_time < BSTP_MIN_HELLO_TIME || + cu->cu_hello_time > BSTP_MAX_HELLO_TIME) { + return; + } + type = bstp_pdu_rcvtype(bp, cu); switch (type) { From owner-dev-commits-src-branches@freebsd.org Tue May 18 20:22:43 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 6FF286568F0; Tue, 18 May 2021 20:22:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fl6r32n08z4s2n; Tue, 18 May 2021 20:22:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4833D25CE8; Tue, 18 May 2021 20:22:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14IKMhxN004499; Tue, 18 May 2021 20:22:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14IKMhSO004498; Tue, 18 May 2021 20:22:43 GMT (envelope-from git) Date: Tue, 18 May 2021 20:22:43 GMT Message-Id: <202105182022.14IKMhSO004498@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: e2a49768a4ad - stable/13 - Ensure that files with no allocated blocks are trimmed to zero length. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e2a49768a4ad938c4dc0b9ce11298b409832a9ab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 20:22:43 -0000 The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=e2a49768a4ad938c4dc0b9ce11298b409832a9ab commit e2a49768a4ad938c4dc0b9ce11298b409832a9ab Author: Kirk McKusick AuthorDate: 2021-05-11 21:51:06 +0000 Commit: Kirk McKusick CommitDate: 2021-05-18 20:26:00 +0000 Ensure that files with no allocated blocks are trimmed to zero length. (cherry picked from commit a3628327e7b62c955e7bad9e43044cdb01984d80) --- sbin/fsck_ffs/pass1.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c index c1f1b1ec04f5..319a324cc070 100644 --- a/sbin/fsck_ffs/pass1.c +++ b/sbin/fsck_ffs/pass1.c @@ -248,7 +248,7 @@ checkinode(ino_t inumber, struct inodesc *idesc, int rebuildcg) off_t kernmaxfilesize; ufs2_daddr_t ndb; mode_t mode; - uintmax_t fixsize; + intmax_t size, fixsize; int j, ret, offset; if ((dp = getnextinode(inumber, rebuildcg)) == NULL) @@ -429,25 +429,37 @@ checkinode(ino_t inumber, struct inodesc *idesc, int rebuildcg) } } /* + * UFS does not allow files to end with a hole; it requires that + * the last block of a file be allocated. The last allocated block + * in a file is tracked in id_lballoc. Here, we check for a size + * past the last allocated block of the file and if that is found, + * shorten the file to reference the last allocated block to avoid + * having it reference a hole at its end. + * * Soft updates will always ensure that the file size is correct * for files that contain only direct block pointers. However * soft updates does not roll back sizes for files with indirect * blocks that it has set to unallocated because their contents * have not yet been written to disk. Hence, the file can appear * to have a hole at its end because the block pointer has been - * rolled back to zero. Thus, id_lballoc tracks the last allocated - * block in the file. Here, for files that extend into indirect - * blocks, we check for a size past the last allocated block of - * the file and if that is found, shorten the file to reference - * the last allocated block to avoid having it reference a hole - * at its end. + * rolled back to zero. Thus finding a hole at the end of a file + * that is located in an indirect block receives only a warning + * while finding a hole at the end of a file in a direct block + * receives a fatal error message. */ - if (DIP(dp, di_size) > UFS_NDADDR * sblock.fs_bsize && - idesc->id_lballoc < lblkno(&sblock, DIP(dp, di_size) - 1)) { - fixsize = lblktosize(&sblock, idesc->id_lballoc + 1); - pwarn("INODE %lu: FILE SIZE %ju BEYOND END OF ALLOCATED FILE, " - "SIZE SHOULD BE %ju", (u_long)inumber, - (uintmax_t)DIP(dp, di_size), fixsize); + size = DIP(dp, di_size); + if (idesc->id_lballoc < lblkno(&sblock, size - 1) && + /* exclude embedded symbolic links */ + ((mode != IFLNK) || size >= sblock.fs_maxsymlinklen)) { + fixsize = lblktosize(&sblock, idesc->id_lballoc + 1); + if (size > UFS_NDADDR * sblock.fs_bsize) + pwarn("INODE %lu: FILE SIZE %ju BEYOND END OF " + "ALLOCATED FILE, SIZE SHOULD BE %ju", + (u_long)inumber, size, fixsize); + else + pfatal("INODE %lu: FILE SIZE %ju BEYOND END OF " + "ALLOCATED FILE, SIZE SHOULD BE %ju", + (u_long)inumber, size, fixsize); if (preen) printf(" (ADJUSTED)\n"); else if (reply("ADJUST") == 0) From owner-dev-commits-src-branches@freebsd.org Tue May 18 20:25:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 5029B6569CF; Tue, 18 May 2021 20:25:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fl6vT1bwfz4swY; Tue, 18 May 2021 20:25:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2062C25CF1; Tue, 18 May 2021 20:25:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14IKPfKK004804; Tue, 18 May 2021 20:25:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14IKPfD1004803; Tue, 18 May 2021 20:25:41 GMT (envelope-from git) Date: Tue, 18 May 2021 20:25:41 GMT Message-Id: <202105182025.14IKPfD1004803@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: 80e3f1df8ca8 - stable/12 - Ensure that files with no allocated blocks are trimmed to zero length. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 80e3f1df8ca8d355b31f1b7596e025edb3a2746d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 20:25:41 -0000 The branch stable/12 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=80e3f1df8ca8d355b31f1b7596e025edb3a2746d commit 80e3f1df8ca8d355b31f1b7596e025edb3a2746d Author: Kirk McKusick AuthorDate: 2021-05-11 21:51:06 +0000 Commit: Kirk McKusick CommitDate: 2021-05-18 20:28:34 +0000 Ensure that files with no allocated blocks are trimmed to zero length. (cherry picked from commit a3628327e7b62c955e7bad9e43044cdb01984d80) --- sbin/fsck_ffs/pass1.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c index 81aa73bffc26..4cfacef2a4d0 100644 --- a/sbin/fsck_ffs/pass1.c +++ b/sbin/fsck_ffs/pass1.c @@ -247,7 +247,7 @@ checkinode(ino_t inumber, struct inodesc *idesc, int rebuildcg) off_t kernmaxfilesize; ufs2_daddr_t ndb; mode_t mode; - uintmax_t fixsize; + intmax_t size, fixsize; int j, ret, offset; if ((dp = getnextinode(inumber, rebuildcg)) == NULL) @@ -424,25 +424,37 @@ checkinode(ino_t inumber, struct inodesc *idesc, int rebuildcg) } } /* + * UFS does not allow files to end with a hole; it requires that + * the last block of a file be allocated. The last allocated block + * in a file is tracked in id_lballoc. Here, we check for a size + * past the last allocated block of the file and if that is found, + * shorten the file to reference the last allocated block to avoid + * having it reference a hole at its end. + * * Soft updates will always ensure that the file size is correct * for files that contain only direct block pointers. However * soft updates does not roll back sizes for files with indirect * blocks that it has set to unallocated because their contents * have not yet been written to disk. Hence, the file can appear * to have a hole at its end because the block pointer has been - * rolled back to zero. Thus, id_lballoc tracks the last allocated - * block in the file. Here, for files that extend into indirect - * blocks, we check for a size past the last allocated block of - * the file and if that is found, shorten the file to reference - * the last allocated block to avoid having it reference a hole - * at its end. + * rolled back to zero. Thus finding a hole at the end of a file + * that is located in an indirect block receives only a warning + * while finding a hole at the end of a file in a direct block + * receives a fatal error message. */ - if (DIP(dp, di_size) > UFS_NDADDR * sblock.fs_bsize && - idesc->id_lballoc < lblkno(&sblock, DIP(dp, di_size) - 1)) { - fixsize = lblktosize(&sblock, idesc->id_lballoc + 1); - pwarn("INODE %lu: FILE SIZE %ju BEYOND END OF ALLOCATED FILE, " - "SIZE SHOULD BE %ju", (u_long)inumber, - (uintmax_t)DIP(dp, di_size), fixsize); + size = DIP(dp, di_size); + if (idesc->id_lballoc < lblkno(&sblock, size - 1) && + /* exclude embedded symbolic links */ + ((mode != IFLNK) || size >= sblock.fs_maxsymlinklen)) { + fixsize = lblktosize(&sblock, idesc->id_lballoc + 1); + if (size > UFS_NDADDR * sblock.fs_bsize) + pwarn("INODE %lu: FILE SIZE %ju BEYOND END OF " + "ALLOCATED FILE, SIZE SHOULD BE %ju", + (u_long)inumber, size, fixsize); + else + pfatal("INODE %lu: FILE SIZE %ju BEYOND END OF " + "ALLOCATED FILE, SIZE SHOULD BE %ju", + (u_long)inumber, size, fixsize); if (preen) printf(" (ADJUSTED)\n"); else if (reply("ADJUST") == 0) From owner-dev-commits-src-branches@freebsd.org Wed May 19 03:13:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 E239C635FF5; Wed, 19 May 2021 03:13:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlHyb5trMz4h1Z; Wed, 19 May 2021 03:13:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2DE7372F; Wed, 19 May 2021 03:13:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14J3DxHt051266; Wed, 19 May 2021 03:13:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14J3Dxaf051265; Wed, 19 May 2021 03:13:59 GMT (envelope-from git) Date: Wed, 19 May 2021 03:13:59 GMT Message-Id: <202105190313.14J3Dxaf051265@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 29b896e67ddb - stable/13 - rtld: preserve the 'seen' state of the dlerror message in errmsg_save() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 29b896e67ddb055d0b6878ded41738b6a294db0e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 03:13:59 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=29b896e67ddb055d0b6878ded41738b6a294db0e commit 29b896e67ddb055d0b6878ded41738b6a294db0e Author: Konstantin Belousov AuthorDate: 2021-05-10 19:02:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-19 03:13:14 +0000 rtld: preserve the 'seen' state of the dlerror message in errmsg_save() PR: 255698 (cherry picked from commit 630caa95d46191220dd457c2ae2d06460cb4f71b) --- libexec/rtld-elf/rtld.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index d50774868908..2943c1d06fa3 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -81,6 +81,10 @@ extern struct r_debug r_debug; /* For GDB */ extern int _thread_autoinit_dummy_decl; extern void (*__cleanup)(void); +struct dlerror_save { + int seen; + char *msg; +}; /* * Function declarations. @@ -100,8 +104,8 @@ static Obj_Entry *dlopen_object(const char *name, int fd, Obj_Entry *refobj, static Obj_Entry *do_load_object(int, const char *, char *, struct stat *, int); static int do_search_info(const Obj_Entry *obj, int, struct dl_serinfo *); static bool donelist_check(DoneList *, const Obj_Entry *); -static void errmsg_restore(char *); -static char *errmsg_save(void); +static void errmsg_restore(struct dlerror_save *); +static struct dlerror_save *errmsg_save(void); static void *fill_search_info(const char *, size_t, void *); static char *find_library(const char *, const Obj_Entry *, int *); static const char *gethints(bool); @@ -933,10 +937,16 @@ _rtld_error(const char *fmt, ...) /* * Return a dynamically-allocated copy of the current error message, if any. */ -static char * +static struct dlerror_save * errmsg_save(void) { - return (xstrdup(lockinfo.dlerror_loc())); + struct dlerror_save *res; + + res = xmalloc(sizeof(*res)); + res->seen = *lockinfo.dlerror_seen(); + if (res->seen == 0) + res->msg = xstrdup(lockinfo.dlerror_loc()); + return (res); } /* @@ -944,14 +954,17 @@ errmsg_save(void) * by errmsg_save(). The copy is freed. */ static void -errmsg_restore(char *saved_msg) +errmsg_restore(struct dlerror_save *saved_msg) { - if (saved_msg == NULL) - _rtld_error(""); - else { - _rtld_error("%s", saved_msg); - free(saved_msg); + if (saved_msg == NULL || saved_msg->seen == 1) { + *lockinfo.dlerror_seen() = 1; + } else { + *lockinfo.dlerror_seen() = 0; + strlcpy(lockinfo.dlerror_loc(), saved_msg->msg, + lockinfo.dlerror_loc_sz); + free(saved_msg->msg); } + free(saved_msg); } static const char * @@ -2716,7 +2729,7 @@ static void objlist_call_fini(Objlist *list, Obj_Entry *root, RtldLockState *lockstate) { Objlist_Entry *elm; - char *saved_msg; + struct dlerror_save *saved_msg; Elf_Addr *fini_addr; int index; @@ -2792,7 +2805,7 @@ objlist_call_init(Objlist *list, RtldLockState *lockstate) { Objlist_Entry *elm; Obj_Entry *obj; - char *saved_msg; + struct dlerror_save *saved_msg; Elf_Addr *init_addr; void (*reg)(void (*)(void)); int index; From owner-dev-commits-src-branches@freebsd.org Wed May 19 03:14:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 EFE50636131; Wed, 19 May 2021 03:14:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlHyc6Rw8z4gvx; Wed, 19 May 2021 03:14:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C625436B7; Wed, 19 May 2021 03:14:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14J3E0iO051287; Wed, 19 May 2021 03:14:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14J3E0nh051286; Wed, 19 May 2021 03:14:00 GMT (envelope-from git) Date: Wed, 19 May 2021 03:14:00 GMT Message-Id: <202105190314.14J3E0nh051286@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: db4a2731e9ec - stable/13 - rtld: initialize default dlerror_seen_val as true MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: db4a2731e9ec9723038dc3a63d963336cda8aecd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 03:14:01 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=db4a2731e9ec9723038dc3a63d963336cda8aecd commit db4a2731e9ec9723038dc3a63d963336cda8aecd Author: Konstantin Belousov AuthorDate: 2021-05-11 23:36:09 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-19 03:13:14 +0000 rtld: initialize default dlerror_seen_val as true PR: 255698 (cherry picked from commit 529ab5a75925c9c1eeea0b2712911048119d06ae) --- libexec/rtld-elf/rtld_lock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rtld-elf/rtld_lock.c b/libexec/rtld-elf/rtld_lock.c index 94e931c2f760..e501c03f0722 100644 --- a/libexec/rtld-elf/rtld_lock.c +++ b/libexec/rtld-elf/rtld_lock.c @@ -60,7 +60,7 @@ void _rtld_atfork_pre(int *) __exported; void _rtld_atfork_post(int *) __exported; static char def_dlerror_msg[512]; -static int def_dlerror_seen_val; +static int def_dlerror_seen_val = 1; static char * def_dlerror_loc(void) From owner-dev-commits-src-branches@freebsd.org Wed May 19 04:56:48 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 C49486378B2; Wed, 19 May 2021 04:56:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlLFD5Ht8z3kW7; Wed, 19 May 2021 04:56:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9AA704C93; Wed, 19 May 2021 04:56:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14J4umOK083040; Wed, 19 May 2021 04:56:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14J4umfs083039; Wed, 19 May 2021 04:56:48 GMT (envelope-from git) Date: Wed, 19 May 2021 04:56:48 GMT Message-Id: <202105190456.14J4umfs083039@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 824cca5934e5 - stable/13 - openat(2): add O_EMPTY_PATH MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 824cca5934e522b72d9806cf493c56d030f8ce63 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 04:56:48 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=824cca5934e522b72d9806cf493c56d030f8ce63 commit 824cca5934e522b72d9806cf493c56d030f8ce63 Author: Konstantin Belousov AuthorDate: 2021-05-06 17:16:53 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-19 03:13:14 +0000 openat(2): add O_EMPTY_PATH (cherry picked from commit 5e7cdf1817924f8ae0333c0b53c2da32f35b65ea) --- lib/libc/sys/open.2 | 18 +++++++++++++++++- sys/kern/vfs_vnops.c | 2 ++ sys/sys/fcntl.h | 3 +++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2 index a7806df69daf..5a6f161291f6 100644 --- a/lib/libc/sys/open.2 +++ b/lib/libc/sys/open.2 @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd March 18, 2021 +.Dd May 6, 2021 .Dt OPEN 2 .Os .Sh NAME @@ -169,6 +169,7 @@ O_CLOEXEC set FD_CLOEXEC upon open O_VERIFY verify the contents of the file O_RESOLVE_BENEATH path resolution must not cross the fd directory O_PATH record only the target path in the opened descriptor +O_EMPTY_PATH openat, open file referenced by fd if path is empty .Ed .Pp Opening a file with @@ -355,6 +356,21 @@ are not allowed. File opened with the .Dv O_PATH flag does not prevent non-forced unmount of the volume it belongs to. +.Pp +A file descriptor created with the +.Dv O_PATH +flag can be opened into normal (operable) file descriptor by +specifying it as the +.Fa fd +argument to +.Fn openat +with empty +.Fa path +and flag +.Dv O_EMPTY_PATH . +Such an open behaves as if the current path of the file referenced by +.Fa fd +is passed, except that the path walk permissions are not checked. See also the description of .Dv AT_EMPTY_PATH flag for diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index d4396f67a67b..670bc4bf8fcc 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -200,6 +200,8 @@ open2nameif(int fmode, u_int vn_open_flags) res = ISOPEN | LOCKLEAF; if ((fmode & O_RESOLVE_BENEATH) != 0) res |= RBENEATH; + if ((fmode & O_EMPTY_PATH) != 0) + res |= EMPTYPATH; if ((vn_open_flags & VN_OPEN_NOAUDIT) == 0) res |= AUDITVNODE1; if ((vn_open_flags & VN_OPEN_NOCAPCHECK) != 0) diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h index 58d46ae26338..8fa52aeacafd 100644 --- a/sys/sys/fcntl.h +++ b/sys/sys/fcntl.h @@ -141,6 +141,9 @@ typedef __pid_t pid_t; #endif #define O_DSYNC 0x01000000 /* POSIX data sync */ +#if __BSD_VISIBLE +#define O_EMPTY_PATH 0x02000000 +#endif /* * XXX missing O_RSYNC. From owner-dev-commits-src-branches@freebsd.org Wed May 19 04:56:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 CE549637C0C; Wed, 19 May 2021 04:56:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlLFF5NMrz3kY0; Wed, 19 May 2021 04:56:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F2F24E88; Wed, 19 May 2021 04:56:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14J4unEX083068; Wed, 19 May 2021 04:56:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14J4unWq083067; Wed, 19 May 2021 04:56:49 GMT (envelope-from git) Date: Wed, 19 May 2021 04:56:49 GMT Message-Id: <202105190456.14J4unWq083067@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: eea4a0b81aed - stable/13 - vn_open_cred(): disallow O_CREAT | O_EMPTY_PATH MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: eea4a0b81aedfdbb80245e779c92a74131c572aa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 04:56:49 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=eea4a0b81aedfdbb80245e779c92a74131c572aa commit eea4a0b81aedfdbb80245e779c92a74131c572aa Author: Konstantin Belousov AuthorDate: 2021-05-12 19:04:44 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-19 03:13:15 +0000 vn_open_cred(): disallow O_CREAT | O_EMPTY_PATH (cherry picked from commit 6de3cf14c47d97b423ae25d5bd1d80b896ecd9e6) --- sys/kern/vfs_vnops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 670bc4bf8fcc..8f583329f067 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -233,7 +233,8 @@ restart: first_open = false; fmode = *flagp; if ((fmode & (O_CREAT | O_EXCL | O_DIRECTORY)) == (O_CREAT | - O_EXCL | O_DIRECTORY)) + O_EXCL | O_DIRECTORY) || + (fmode & (O_CREAT | O_EMPTY_PATH)) == (O_CREAT | O_EMPTY_PATH)) return (EINVAL); else if ((fmode & (O_CREAT | O_DIRECTORY)) == O_CREAT) { ndp->ni_cnd.cn_nameiop = CREATE; From owner-dev-commits-src-branches@freebsd.org Wed May 19 12:05:19 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 082AF63FFC9; Wed, 19 May 2021 12:05:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlWlf6rC8z3Hbw; Wed, 19 May 2021 12:05:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF1B1124EE; Wed, 19 May 2021 12:05:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14JC5Iov054851; Wed, 19 May 2021 12:05:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JC5Ixj054850; Wed, 19 May 2021 12:05:18 GMT (envelope-from git) Date: Wed, 19 May 2021 12:05:18 GMT Message-Id: <202105191205.14JC5Ixj054850@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eugene Grosbein Subject: git: 271f9f2e8b93 - stable/11 - MFC r307882: bsnmpd: fix SNMPv3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 271f9f2e8b93f0724d00b5405f8b53f6695408b2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 12:05:19 -0000 The branch stable/11 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=271f9f2e8b93f0724d00b5405f8b53f6695408b2 commit 271f9f2e8b93f0724d00b5405f8b53f6695408b2 Author: Shteryana Shopova AuthorDate: 2016-10-24 21:05:23 +0000 Commit: Eugene Grosbein CommitDate: 2021-05-19 12:00:52 +0000 MFC r307882: bsnmpd: fix SNMPv3 This change fixes SNMPv3 for bsnmpd in stable/11. Note this is already fixed in stable/12 and above. Original commit log: Fix a regression introduced in SVN r256678 that breaks USM header parsing Reviewed by: bz@ (cherry picked from commit 1108712cb5b14130380c93b00f4e9ef2a797a07d) --- contrib/bsnmp/lib/snmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/bsnmp/lib/snmp.c b/contrib/bsnmp/lib/snmp.c index d86f88a03fd6..d1dabc8884a0 100644 --- a/contrib/bsnmp/lib/snmp.c +++ b/contrib/bsnmp/lib/snmp.c @@ -290,7 +290,7 @@ parse_secparams(struct asn_buf *b, struct snmp_pdu *pdu) memset(buf, 0, 256); tb.asn_ptr = buf; tb.asn_len = 256; - u_int len; + u_int len = 256; if (asn_get_octetstring(b, buf, &len) != ASN_ERR_OK) { snmp_error("cannot parse usm header"); From owner-dev-commits-src-branches@freebsd.org Wed May 19 13:35:22 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 3DA47641F5D; Wed, 19 May 2021 13:35:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlYlZ18J2z4gwp; Wed, 19 May 2021 13:35:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0593913C55; Wed, 19 May 2021 13:35:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14JDZLUw074611; Wed, 19 May 2021 13:35:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JDZLdc074609; Wed, 19 May 2021 13:35:21 GMT (envelope-from git) Date: Wed, 19 May 2021 13:35:21 GMT Message-Id: <202105191335.14JDZLdc074609@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 178633e28291 - stable/13 - if: Remove unnecessary validation in the SIOCSIFNAME handler MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 178633e28291d2e4168e51e6d970c25bca43bc1e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 13:35:22 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=178633e28291d2e4168e51e6d970c25bca43bc1e commit 178633e28291d2e4168e51e6d970c25bca43bc1e Author: Mark Johnston AuthorDate: 2021-05-12 14:05:37 +0000 Commit: Mark Johnston CommitDate: 2021-05-19 13:32:11 +0000 if: Remove unnecessary validation in the SIOCSIFNAME handler A successful copyinstr() call guarantees that the returned string is nul-terminated. Furthermore, the removed check would harmlessly compare an uninitialized byte with '\0' if the new name is shorter than IFNAMESIZ - 1. Reported by: KMSAN Sponsored by: The FreeBSD Foundation (cherry picked from commit ad22ba2b9f3b6ff5d85be14627d3a59ca389f5e4) --- sys/net/if.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 776fcf2fc78d..f6926c43ef96 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -2663,11 +2663,6 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) return (error); if (new_name[0] == '\0') return (EINVAL); - if (new_name[IFNAMSIZ-1] != '\0') { - new_name[IFNAMSIZ-1] = '\0'; - if (strlen(new_name) == IFNAMSIZ-1) - return (EINVAL); - } if (strcmp(new_name, ifp->if_xname) == 0) break; if (ifunit(new_name) != NULL) From owner-dev-commits-src-branches@freebsd.org Wed May 19 13:35:23 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 54B9F641F6C; Wed, 19 May 2021 13:35:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlYlb1sRcz4gkP; Wed, 19 May 2021 13:35:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2750D13BA6; Wed, 19 May 2021 13:35:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14JDZN9J074638; Wed, 19 May 2021 13:35:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JDZNGT074637; Wed, 19 May 2021 13:35:23 GMT (envelope-from git) Date: Wed, 19 May 2021 13:35:23 GMT Message-Id: <202105191335.14JDZNGT074637@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 4a6c5c8f592f - stable/13 - swap_pager: Zero swap info before exporting to userspace MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4a6c5c8f592f320bd72616836239b765f042b323 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 13:35:23 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4a6c5c8f592f320bd72616836239b765f042b323 commit 4a6c5c8f592f320bd72616836239b765f042b323 Author: Mark Johnston AuthorDate: 2021-05-12 13:42:44 +0000 Commit: Mark Johnston CommitDate: 2021-05-19 13:32:18 +0000 swap_pager: Zero swap info before exporting to userspace Otherwise padding bytes are leaked. Reported by: KMSAN Sponsored by: The FreeBSD Foundation (cherry picked from commit 06d1fd9f42fa9c060fad8f3a71fcaada3baaf200) --- sys/vm/swap_pager.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 888df04741b4..f7cde181a7c4 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -2668,11 +2668,14 @@ sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS) if (arg2 != 1) /* name length */ return (EINVAL); + + memset(&xs, 0, sizeof(xs)); error = swap_dev_info(*(int *)arg1, &xs, NULL, 0); if (error != 0) return (error); #if defined(__amd64__) && defined(COMPAT_FREEBSD32) if (req->oldlen == sizeof(xs32)) { + memset(&xs32, 0, sizeof(xs32)); xs32.xsw_version = XSWDEV_VERSION; xs32.xsw_dev1 = xs.xsw_dev; xs32.xsw_dev2 = xs.xsw_dev >> 32; @@ -2685,6 +2688,7 @@ sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS) #endif #if defined(COMPAT_FREEBSD11) if (req->oldlen == sizeof(xs11)) { + memset(&xs11, 0, sizeof(xs11)); xs11.xsw_version = XSWDEV_VERSION_11; xs11.xsw_dev = xs.xsw_dev; /* truncation */ xs11.xsw_flags = xs.xsw_flags; From owner-dev-commits-src-branches@freebsd.org Wed May 19 13:35:24 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 97D3564206A; Wed, 19 May 2021 13:35:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlYlc37xcz4gn0; Wed, 19 May 2021 13:35:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A71F138F6; Wed, 19 May 2021 13:35:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14JDZOwC074659; Wed, 19 May 2021 13:35:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JDZO2w074658; Wed, 19 May 2021 13:35:24 GMT (envelope-from git) Date: Wed, 19 May 2021 13:35:24 GMT Message-Id: <202105191335.14JDZO2w074658@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 010f19777085 - stable/13 - nd6: Avoid using an uninitialized sockaddr in nd6_prefix_offlink() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 010f19777085561cae108e5fd228ff258f7d102a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 13:35:24 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=010f19777085561cae108e5fd228ff258f7d102a commit 010f19777085561cae108e5fd228ff258f7d102a Author: Mark Johnston AuthorDate: 2021-05-12 15:49:24 +0000 Commit: Mark Johnston CommitDate: 2021-05-19 13:32:28 +0000 nd6: Avoid using an uninitialized sockaddr in nd6_prefix_offlink() Commit 81728a538 ("Split rtinit() into multiple functions.") removed the initialization of sa6, but not one of its uses. This meant that we were passing an uninitialized sockaddr as the address to lltable_prefix_free(). Remove the variable outright to fix the problem. The caller is expected to hold a reference on pr. Fixes: 81728a538 ("Split rtinit() into multiple functions.") Reported by: KMSAN Reviewed by: donner Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30166 (cherry picked from commit c1dd4d642fa0e2c8ea4f9a879f2cc4e5d6c39211) --- sys/netinet6/nd6_rtr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 2f721b4edcc3..2960b6cad951 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -2165,7 +2165,6 @@ nd6_prefix_offlink(struct nd_prefix *pr) int error = 0; struct ifnet *ifp = pr->ndpr_ifp; struct nd_prefix *opr; - struct sockaddr_in6 sa6; char ip6buf[INET6_ADDRSTRLEN]; uint64_t genid; int a_failure; @@ -2240,7 +2239,8 @@ restart: } if (a_failure) - lltable_prefix_free(AF_INET6, (struct sockaddr *)&sa6, + lltable_prefix_free(AF_INET6, + (struct sockaddr *)&pr->ndpr_prefix, (struct sockaddr *)&mask6, LLE_STATIC); return (error); From owner-dev-commits-src-branches@freebsd.org Wed May 19 13:35:26 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 435826423D4; Wed, 19 May 2021 13:35:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlYld4T6vz4gkf; Wed, 19 May 2021 13:35:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7151613B46; Wed, 19 May 2021 13:35:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14JDZPhp074680; Wed, 19 May 2021 13:35:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JDZPPj074679; Wed, 19 May 2021 13:35:25 GMT (envelope-from git) Date: Wed, 19 May 2021 13:35:25 GMT Message-Id: <202105191335.14JDZPPj074679@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 8aed0580e40e - stable/13 - truss: Decode FreeBSD 11 mknod(2) and mknodat(2) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8aed0580e40e08446ef1fc2cc9bef70cb5f68ec1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 13:35:27 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8aed0580e40e08446ef1fc2cc9bef70cb5f68ec1 commit 8aed0580e40e08446ef1fc2cc9bef70cb5f68ec1 Author: Mark Johnston AuthorDate: 2021-05-12 13:42:11 +0000 Commit: Mark Johnston CommitDate: 2021-05-19 13:32:40 +0000 truss: Decode FreeBSD 11 mknod(2) and mknodat(2) Sponsored by: The FreeBSD Foundation (cherry picked from commit cd497bd40bb65b5e4603d57614eb15ca7d947a10) --- usr.bin/truss/syscalls.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index eaea3ad96765..a8eed9eed355 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -193,6 +193,10 @@ static const struct syscall_decode decoded_syscalls[] = { { Kevent11 | OUT, 3 }, { Int, 4 }, { Timespec, 5 } } }, { .name = "compat11.lstat", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Stat11 | OUT, 1 } } }, + { .name = "compat11.mknod", .ret_type = 1, .nargs = 3, + .args = { { Name, 0 }, { Octal, 1 }, { Int, 2 } } }, + { .name = "compat11.mknodat", .ret_type = 1, .nargs = 4, + .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 }, { Int, 3 } } }, { .name = "compat11.stat", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Stat11 | OUT, 1 } } }, { .name = "connect", .ret_type = 1, .nargs = 3, @@ -372,9 +376,9 @@ static const struct syscall_decode decoded_syscalls[] = { { .name = "mkfifoat", .ret_type = 1, .nargs = 3, .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 } } }, { .name = "mknod", .ret_type = 1, .nargs = 3, - .args = { { Name, 0 }, { Octal, 1 }, { Int, 2 } } }, + .args = { { Name, 0 }, { Octal, 1 }, { Quad, 2 } } }, { .name = "mknodat", .ret_type = 1, .nargs = 4, - .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 }, { Int, 3 } } }, + .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 }, { Quad, 3 } } }, { .name = "mlock", .ret_type = 1, .nargs = 2, .args = { { Ptr, 0 }, { Sizet, 1 } } }, { .name = "mlockall", .ret_type = 1, .nargs = 1, From owner-dev-commits-src-branches@freebsd.org Wed May 19 15:53:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 80BB9645236; Wed, 19 May 2021 15:53:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Flcq93BmQz4mpn; Wed, 19 May 2021 15:53:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 571B4158C9; Wed, 19 May 2021 15:53:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14JFrf06061285; Wed, 19 May 2021 15:53:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JFrfBM061284; Wed, 19 May 2021 15:53:41 GMT (envelope-from git) Date: Wed, 19 May 2021 15:53:41 GMT Message-Id: <202105191553.14JFrfBM061284@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: b3e8bfd771b4 - stable/13 - cache: fix lockless absolute symlink traversal to non-fp mounts MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b3e8bfd771b4b172a4f3619da25b79459e46ba41 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 15:53:41 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=b3e8bfd771b4b172a4f3619da25b79459e46ba41 commit b3e8bfd771b4b172a4f3619da25b79459e46ba41 Author: Mateusz Guzik AuthorDate: 2021-05-11 03:48:08 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-19 15:53:34 +0000 cache: fix lockless absolute symlink traversal to non-fp mounts Said lookups would incorrectly fail with EOPNOTSUP. Reported by: kib (cherry picked from commit 12288bd999ca3a493b8dc4cba109e5a8fa838c45) --- sys/kern/vfs_cache.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 8819ef483af5..31d6668a3565 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3936,6 +3936,7 @@ struct cache_fpl { #endif }; +static bool cache_fplookup_mp_supported(struct mount *mp); static bool cache_fplookup_is_mp(struct cache_fpl *fpl); static int cache_fplookup_cross_mount(struct cache_fpl *fpl); static int cache_fplookup_partial_setup(struct cache_fpl *fpl); @@ -5174,6 +5175,19 @@ cache_fplookup_symlink(struct cache_fpl *fpl) if (seqc_in_modify(fpl->dvp_seqc)) { return (cache_fpl_aborted(fpl)); } + /* + * The main loop assumes that ->dvp points to a vnode belonging + * to a filesystem which can do lockless lookup, but the absolute + * symlink can be wandering off to one which does not. + */ + mp = atomic_load_ptr(&fpl->dvp->v_mount); + if (__predict_false(mp == NULL)) { + return (cache_fpl_aborted(fpl)); + } + if (!cache_fplookup_mp_supported(mp)) { + cache_fpl_checkpoint(fpl); + return (cache_fpl_partial(fpl)); + } } return (0); } From owner-dev-commits-src-branches@freebsd.org Wed May 19 21:22:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 EB34664C41E; Wed, 19 May 2021 21:22:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Flm776JG3z4f1B; Wed, 19 May 2021 21:22:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C119D19DC3; Wed, 19 May 2021 21:22:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14JLMxoM001724; Wed, 19 May 2021 21:22:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JLMxGF001723; Wed, 19 May 2021 21:22:59 GMT (envelope-from git) Date: Wed, 19 May 2021 21:22:59 GMT Message-Id: <202105192122.14JLMxGF001723@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Guangyuan Yang Subject: git: 024a9aa7010c - stable/13 - kerberos.8: Replace dead link MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 024a9aa7010ce54ff05224bda1cd9f361b648c23 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 21:23:00 -0000 The branch stable/13 has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=024a9aa7010ce54ff05224bda1cd9f361b648c23 commit 024a9aa7010ce54ff05224bda1cd9f361b648c23 Author: Guangyuan Yang AuthorDate: 2021-05-16 05:37:09 +0000 Commit: Guangyuan Yang CommitDate: 2021-05-19 21:22:44 +0000 kerberos.8: Replace dead link Replace it with a tutorial hosted on kerberos.org and the classic "dialogue" from Bill Bryant. The change has been reported and merged upstream (https://github.com/heimdal/heimdal/commit/7f3445f1b7). PR: 251854 Reported by: ktullavik@gmail.com Submitted by: bjk (upstream github) Reviewed by: bcr (cherry picked from commit 80ba60f64394fab3cda10d5921af896ed1c57c5f) --- crypto/heimdal/lib/krb5/kerberos.8 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/crypto/heimdal/lib/krb5/kerberos.8 b/crypto/heimdal/lib/krb5/kerberos.8 index 94d49955180b..a4161eea5953 100644 --- a/crypto/heimdal/lib/krb5/kerberos.8 +++ b/crypto/heimdal/lib/krb5/kerberos.8 @@ -31,7 +31,7 @@ .\" .\" $Id$ .\" -.Dd September 1, 2000 +.Dd May 15, 2021 .Dt KERBEROS 8 .Os HEIMDAL .Sh NAME @@ -71,9 +71,12 @@ or .Ic ftp , without giving your password. .Pp -For more information on how Kerberos works, and other general Kerberos -questions see the Kerberos FAQ at -.Pa http://www.nrl.navy.mil/CCS/people/kenh/kerberos-faq.html . +For more information on how Kerberos works, see the tutorial at +.Lk https://kerberos.org/software/tutorial.html +or the informal +.Dq dialogue +at +.Lk https://web.mit.edu/kerberos/dialogue.html . .Pp For setup instructions see the Heimdal Texinfo manual. .Sh SEE ALSO From owner-dev-commits-src-branches@freebsd.org Thu May 20 00:33:52 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 DB98B64F749; Thu, 20 May 2021 00:33:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlrMN5tGLz3QNr; Thu, 20 May 2021 00:33:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1D931C4E9; Thu, 20 May 2021 00:33:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14K0XqtQ054512; Thu, 20 May 2021 00:33:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14K0XqQI054511; Thu, 20 May 2021 00:33:52 GMT (envelope-from git) Date: Thu, 20 May 2021 00:33:52 GMT Message-Id: <202105200033.14K0XqQI054511@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 0bd5d81f1edf - stable/13 - makesyscalls.lua: improve generated file style(9) compliance MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0bd5d81f1edf9810568d2403cf83f0fbf8adacb7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 00:33:52 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=0bd5d81f1edf9810568d2403cf83f0fbf8adacb7 commit 0bd5d81f1edf9810568d2403cf83f0fbf8adacb7 Author: Ed Maste AuthorDate: 2021-05-12 20:11:44 +0000 Commit: Ed Maste CommitDate: 2021-05-20 00:31:54 +0000 makesyscalls.lua: improve generated file style(9) compliance We generally like to avoid style changes when other changes are not planned. In this case there are some makesyscalls.lua changes in the pipeline, and this cleans up style nits in generated files that were highlighted by experiments with clang-format. Reviewed by: brooks, kevans MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30235 (cherry picked from commit ad385f7b46e7636b11fb0fd56bc42b60b06b16ad) --- sys/tools/makesyscalls.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/tools/makesyscalls.lua b/sys/tools/makesyscalls.lua index e225e9f7ebbe..acae55050752 100644 --- a/sys/tools/makesyscalls.lua +++ b/sys/tools/makesyscalls.lua @@ -647,7 +647,7 @@ local function handle_noncompat(sysnum, thr_flag, flags, sysflags, rettype, ]], funcname, sysnum)) if #funcargs > 0 then - write_line("systracetmp", "\t\tswitch(ndx) {\n") + write_line("systracetmp", "\t\tswitch (ndx) {\n") write_line("systrace", string.format( "\t\tstruct %s *p = params;\n", argalias)) @@ -670,7 +670,7 @@ local function handle_noncompat(sysnum, thr_flag, flags, sysflags, rettype, if isptrtype(argtype) then write_line("systrace", string.format( - "\t\tuarg[%d] = (%s) p->%s; /* %s */\n", + "\t\tuarg[%d] = (%s)p->%s; /* %s */\n", idx - 1, config["ptr_intptr_t_cast"], argname, argtype)) elseif argtype == "union l_semun" then @@ -1278,7 +1278,7 @@ write_line("systrace", string.format([[/* static void systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) { - int64_t *iarg = (int64_t *) uarg; + int64_t *iarg = (int64_t *)uarg; switch (sysnum) { ]], generated_tag, config['os_id_keyword'])) @@ -1309,7 +1309,7 @@ for _, v in pairs(compat_options) do write_line("sysinc", string.format([[ #ifdef %s -#define %s(n, name) .sy_narg = n, .sy_call = (sy_call_t *)__CONCAT(%s,name) +#define %s(n, name) .sy_narg = n, .sy_call = (sy_call_t *)__CONCAT(%s, name) #else #define %s(n, name) .sy_narg = 0, .sy_call = (sy_call_t *)nosys #endif From owner-dev-commits-src-branches@freebsd.org Thu May 20 00:33:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 533D364F2FB; Thu, 20 May 2021 00:33:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlrMQ1pqFz3QGn; Thu, 20 May 2021 00:33:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25BFF1C5C5; Thu, 20 May 2021 00:33:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14K0Xs74054533; Thu, 20 May 2021 00:33:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14K0XrAv054532; Thu, 20 May 2021 00:33:53 GMT (envelope-from git) Date: Thu, 20 May 2021 00:33:53 GMT Message-Id: <202105200033.14K0XrAv054532@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 6cd1cb27a978 - stable/13 - regen syscall files after 0bd5d81f1edf MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6cd1cb27a978f4bea9f541bd55618e7372fcc70e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 00:33:54 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=6cd1cb27a978f4bea9f541bd55618e7372fcc70e commit 6cd1cb27a978f4bea9f541bd55618e7372fcc70e Author: Ed Maste AuthorDate: 2021-05-20 00:32:37 +0000 Commit: Ed Maste CommitDate: 2021-05-20 00:32:47 +0000 regen syscall files after 0bd5d81f1edf --- sys/amd64/linux/linux_systrace_args.c | 1052 +++++++------- sys/amd64/linux32/linux32_systrace_args.c | 1212 ++++++++-------- sys/arm/linux/linux_systrace_args.c | 946 ++++++------- sys/arm64/linux/linux_systrace_args.c | 888 ++++++------ sys/compat/cloudabi32/cloudabi32_systrace_args.c | 182 +-- sys/compat/cloudabi64/cloudabi64_systrace_args.c | 182 +-- sys/compat/freebsd32/freebsd32_sysent.c | 14 +- sys/compat/freebsd32/freebsd32_systrace_args.c | 1568 ++++++++++----------- sys/i386/linux/linux_systrace_args.c | 1232 ++++++++-------- sys/kern/init_sysent.c | 14 +- sys/kern/systrace_args.c | 1632 +++++++++++----------- 11 files changed, 4461 insertions(+), 4461 deletions(-) diff --git a/sys/amd64/linux/linux_systrace_args.c b/sys/amd64/linux/linux_systrace_args.c index 5aa83b94e7a3..daacb1af287c 100644 --- a/sys/amd64/linux/linux_systrace_args.c +++ b/sys/amd64/linux/linux_systrace_args.c @@ -9,14 +9,14 @@ static void systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) { - int64_t *iarg = (int64_t *) uarg; + int64_t *iarg = (int64_t *)uarg; switch (sysnum) { #define nosys linux_nosys /* read */ case 0: { struct read_args *p = params; iarg[0] = p->fd; /* int */ - uarg[1] = (intptr_t) p->buf; /* char * */ + uarg[1] = (intptr_t)p->buf; /* char * */ iarg[2] = p->nbyte; /* l_size_t */ *n_args = 3; break; @@ -25,7 +25,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 1: { struct write_args *p = params; iarg[0] = p->fd; /* int */ - uarg[1] = (intptr_t) p->buf; /* char * */ + uarg[1] = (intptr_t)p->buf; /* char * */ iarg[2] = p->nbyte; /* l_size_t */ *n_args = 3; break; @@ -33,7 +33,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_open */ case 2: { struct linux_open_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->flags; /* l_int */ iarg[2] = p->mode; /* l_mode_t */ *n_args = 3; @@ -49,8 +49,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_newstat */ case 4: { struct linux_newstat_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ - uarg[1] = (intptr_t) p->buf; /* struct l_newstat * */ + uarg[0] = (intptr_t)p->path; /* char * */ + uarg[1] = (intptr_t)p->buf; /* struct l_newstat * */ *n_args = 2; break; } @@ -58,22 +58,22 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 5: { struct linux_newfstat_args *p = params; iarg[0] = p->fd; /* l_uint */ - uarg[1] = (intptr_t) p->buf; /* struct l_newstat * */ + uarg[1] = (intptr_t)p->buf; /* struct l_newstat * */ *n_args = 2; break; } /* linux_newlstat */ case 6: { struct linux_newlstat_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ - uarg[1] = (intptr_t) p->buf; /* struct l_newstat * */ + uarg[0] = (intptr_t)p->path; /* char * */ + uarg[1] = (intptr_t)p->buf; /* struct l_newstat * */ *n_args = 2; break; } /* poll */ case 7: { struct poll_args *p = params; - uarg[0] = (intptr_t) p->fds; /* struct pollfd * */ + uarg[0] = (intptr_t)p->fds; /* struct pollfd * */ uarg[1] = p->nfds; /* u_int */ iarg[2] = p->timeout; /* int */ *n_args = 3; @@ -112,7 +112,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* munmap */ case 11: { struct munmap_args *p = params; - uarg[0] = (intptr_t) p->addr; /* void * */ + uarg[0] = (intptr_t)p->addr; /* void * */ iarg[1] = p->len; /* l_size_t */ *n_args = 2; break; @@ -128,8 +128,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 13: { struct linux_rt_sigaction_args *p = params; iarg[0] = p->sig; /* l_int */ - uarg[1] = (intptr_t) p->act; /* l_sigaction_t * */ - uarg[2] = (intptr_t) p->oact; /* l_sigaction_t * */ + uarg[1] = (intptr_t)p->act; /* l_sigaction_t * */ + uarg[2] = (intptr_t)p->oact; /* l_sigaction_t * */ iarg[3] = p->sigsetsize; /* l_size_t */ *n_args = 4; break; @@ -138,8 +138,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 14: { struct linux_rt_sigprocmask_args *p = params; iarg[0] = p->how; /* l_int */ - uarg[1] = (intptr_t) p->mask; /* l_sigset_t * */ - uarg[2] = (intptr_t) p->omask; /* l_sigset_t * */ + uarg[1] = (intptr_t)p->mask; /* l_sigset_t * */ + uarg[2] = (intptr_t)p->omask; /* l_sigset_t * */ iarg[3] = p->sigsetsize; /* l_size_t */ *n_args = 4; break; @@ -147,7 +147,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_rt_sigreturn */ case 15: { struct linux_rt_sigreturn_args *p = params; - uarg[0] = (intptr_t) p->ucp; /* struct l_ucontext * */ + uarg[0] = (intptr_t)p->ucp; /* struct l_ucontext * */ *n_args = 1; break; } @@ -164,7 +164,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 17: { struct linux_pread_args *p = params; iarg[0] = p->fd; /* l_uint */ - uarg[1] = (intptr_t) p->buf; /* char * */ + uarg[1] = (intptr_t)p->buf; /* char * */ iarg[2] = p->nbyte; /* l_size_t */ iarg[3] = p->offset; /* l_loff_t */ *n_args = 4; @@ -174,7 +174,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 18: { struct linux_pwrite_args *p = params; iarg[0] = p->fd; /* l_uint */ - uarg[1] = (intptr_t) p->buf; /* char * */ + uarg[1] = (intptr_t)p->buf; /* char * */ iarg[2] = p->nbyte; /* l_size_t */ iarg[3] = p->offset; /* l_loff_t */ *n_args = 4; @@ -184,7 +184,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 19: { struct readv_args *p = params; iarg[0] = p->fd; /* int */ - uarg[1] = (intptr_t) p->iovp; /* struct iovec * */ + uarg[1] = (intptr_t)p->iovp; /* struct iovec * */ uarg[2] = p->iovcnt; /* u_int */ *n_args = 3; break; @@ -193,7 +193,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 20: { struct writev_args *p = params; iarg[0] = p->fd; /* int */ - uarg[1] = (intptr_t) p->iovp; /* struct iovec * */ + uarg[1] = (intptr_t)p->iovp; /* struct iovec * */ uarg[2] = p->iovcnt; /* u_int */ *n_args = 3; break; @@ -201,7 +201,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_access */ case 21: { struct linux_access_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->amode; /* l_int */ *n_args = 2; break; @@ -209,7 +209,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_pipe */ case 22: { struct linux_pipe_args *p = params; - uarg[0] = (intptr_t) p->pipefds; /* l_int * */ + uarg[0] = (intptr_t)p->pipefds; /* l_int * */ *n_args = 1; break; } @@ -217,10 +217,10 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 23: { struct linux_select_args *p = params; iarg[0] = p->nfds; /* l_int */ - uarg[1] = (intptr_t) p->readfds; /* l_fd_set * */ - uarg[2] = (intptr_t) p->writefds; /* l_fd_set * */ - uarg[3] = (intptr_t) p->exceptfds; /* l_fd_set * */ - uarg[4] = (intptr_t) p->timeout; /* struct l_timeval * */ + uarg[1] = (intptr_t)p->readfds; /* l_fd_set * */ + uarg[2] = (intptr_t)p->writefds; /* l_fd_set * */ + uarg[3] = (intptr_t)p->exceptfds; /* l_fd_set * */ + uarg[4] = (intptr_t)p->timeout; /* struct l_timeval * */ *n_args = 5; break; } @@ -254,7 +254,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_mincore_args *p = params; iarg[0] = p->start; /* l_ulong */ iarg[1] = p->len; /* l_size_t */ - uarg[2] = (intptr_t) p->vec; /* u_char * */ + uarg[2] = (intptr_t)p->vec; /* u_char * */ *n_args = 3; break; } @@ -280,7 +280,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 30: { struct linux_shmat_args *p = params; iarg[0] = p->shmid; /* l_int */ - uarg[1] = (intptr_t) p->shmaddr; /* char * */ + uarg[1] = (intptr_t)p->shmaddr; /* char * */ iarg[2] = p->shmflg; /* l_int */ *n_args = 3; break; @@ -290,7 +290,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_shmctl_args *p = params; iarg[0] = p->shmid; /* l_int */ iarg[1] = p->cmd; /* l_int */ - uarg[2] = (intptr_t) p->buf; /* struct l_shmid_ds * */ + uarg[2] = (intptr_t)p->buf; /* struct l_shmid_ds * */ *n_args = 3; break; } @@ -317,8 +317,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_nanosleep */ case 35: { struct linux_nanosleep_args *p = params; - uarg[0] = (intptr_t) p->rqtp; /* const struct l_timespec * */ - uarg[1] = (intptr_t) p->rmtp; /* struct l_timespec * */ + uarg[0] = (intptr_t)p->rqtp; /* const struct l_timespec * */ + uarg[1] = (intptr_t)p->rmtp; /* struct l_timespec * */ *n_args = 2; break; } @@ -326,7 +326,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 36: { struct linux_getitimer_args *p = params; iarg[0] = p->which; /* l_int */ - uarg[1] = (intptr_t) p->itv; /* struct l_itimerval * */ + uarg[1] = (intptr_t)p->itv; /* struct l_itimerval * */ *n_args = 2; break; } @@ -341,8 +341,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 38: { struct linux_setitimer_args *p = params; iarg[0] = p->which; /* l_int */ - uarg[1] = (intptr_t) p->itv; /* struct l_itimerval * */ - uarg[2] = (intptr_t) p->oitv; /* struct l_itimerval * */ + uarg[1] = (intptr_t)p->itv; /* struct l_itimerval * */ + uarg[2] = (intptr_t)p->oitv; /* struct l_itimerval * */ *n_args = 3; break; } @@ -356,7 +356,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_sendfile_args *p = params; iarg[0] = p->out; /* l_int */ iarg[1] = p->in; /* l_int */ - uarg[2] = (intptr_t) p->offset; /* l_off_t * */ + uarg[2] = (intptr_t)p->offset; /* l_off_t * */ iarg[3] = p->count; /* l_size_t */ *n_args = 4; break; @@ -509,10 +509,10 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 56: { struct linux_clone_args *p = params; iarg[0] = p->flags; /* l_ulong */ - uarg[1] = (intptr_t) p->stack; /* void * */ - uarg[2] = (intptr_t) p->parent_tidptr; /* void * */ - uarg[3] = (intptr_t) p->child_tidptr; /* void * */ - uarg[4] = (intptr_t) p->tls; /* void * */ + uarg[1] = (intptr_t)p->stack; /* void * */ + uarg[2] = (intptr_t)p->parent_tidptr; /* void * */ + uarg[3] = (intptr_t)p->child_tidptr; /* void * */ + uarg[4] = (intptr_t)p->tls; /* void * */ *n_args = 5; break; } @@ -529,9 +529,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_execve */ case 59: { struct linux_execve_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ - uarg[1] = (intptr_t) p->argp; /* char ** */ - uarg[2] = (intptr_t) p->envp; /* char ** */ + uarg[0] = (intptr_t)p->path; /* char * */ + uarg[1] = (intptr_t)p->argp; /* char ** */ + uarg[2] = (intptr_t)p->envp; /* char ** */ *n_args = 3; break; } @@ -546,9 +546,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 61: { struct linux_wait4_args *p = params; iarg[0] = p->pid; /* l_pid_t */ - uarg[1] = (intptr_t) p->status; /* l_int * */ + uarg[1] = (intptr_t)p->status; /* l_int * */ iarg[2] = p->options; /* l_int */ - uarg[3] = (intptr_t) p->rusage; /* struct rusage * */ + uarg[3] = (intptr_t)p->rusage; /* struct rusage * */ *n_args = 4; break; } @@ -563,7 +563,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_newuname */ case 63: { struct linux_newuname_args *p = params; - uarg[0] = (intptr_t) p->buf; /* struct l_new_utsname * */ + uarg[0] = (intptr_t)p->buf; /* struct l_new_utsname * */ *n_args = 1; break; } @@ -580,7 +580,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 65: { struct linux_semop_args *p = params; iarg[0] = p->semid; /* l_int */ - uarg[1] = (intptr_t) p->tsops; /* struct l_sembuf * */ + uarg[1] = (intptr_t)p->tsops; /* struct l_sembuf * */ iarg[2] = p->nsops; /* l_uint */ *n_args = 3; break; @@ -598,7 +598,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_shmdt */ case 67: { struct linux_shmdt_args *p = params; - uarg[0] = (intptr_t) p->shmaddr; /* char * */ + uarg[0] = (intptr_t)p->shmaddr; /* char * */ *n_args = 1; break; } @@ -614,7 +614,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 69: { struct linux_msgsnd_args *p = params; iarg[0] = p->msqid; /* l_int */ - uarg[1] = (intptr_t) p->msgp; /* struct l_msgbuf * */ + uarg[1] = (intptr_t)p->msgp; /* struct l_msgbuf * */ iarg[2] = p->msgsz; /* l_size_t */ iarg[3] = p->msgflg; /* l_int */ *n_args = 4; @@ -624,7 +624,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 70: { struct linux_msgrcv_args *p = params; iarg[0] = p->msqid; /* l_int */ - uarg[1] = (intptr_t) p->msgp; /* struct l_msgbuf * */ + uarg[1] = (intptr_t)p->msgp; /* struct l_msgbuf * */ iarg[2] = p->msgsz; /* l_size_t */ iarg[3] = p->msgtyp; /* l_long */ iarg[4] = p->msgflg; /* l_int */ @@ -636,7 +636,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_msgctl_args *p = params; iarg[0] = p->msqid; /* l_int */ iarg[1] = p->cmd; /* l_int */ - uarg[2] = (intptr_t) p->buf; /* struct l_msqid_ds * */ + uarg[2] = (intptr_t)p->buf; /* struct l_msqid_ds * */ *n_args = 3; break; } @@ -674,7 +674,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_truncate */ case 76: { struct linux_truncate_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->length; /* l_long */ *n_args = 2; break; @@ -691,7 +691,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 78: { struct linux_getdents_args *p = params; iarg[0] = p->fd; /* l_uint */ - uarg[1] = (intptr_t) p->dent; /* void * */ + uarg[1] = (intptr_t)p->dent; /* void * */ iarg[2] = p->count; /* l_uint */ *n_args = 3; break; @@ -699,7 +699,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_getcwd */ case 79: { struct linux_getcwd_args *p = params; - uarg[0] = (intptr_t) p->buf; /* char * */ + uarg[0] = (intptr_t)p->buf; /* char * */ iarg[1] = p->bufsize; /* l_ulong */ *n_args = 2; break; @@ -707,7 +707,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_chdir */ case 80: { struct linux_chdir_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ *n_args = 1; break; } @@ -721,15 +721,15 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_rename */ case 82: { struct linux_rename_args *p = params; - uarg[0] = (intptr_t) p->from; /* char * */ - uarg[1] = (intptr_t) p->to; /* char * */ + uarg[0] = (intptr_t)p->from; /* char * */ + uarg[1] = (intptr_t)p->to; /* char * */ *n_args = 2; break; } /* linux_mkdir */ case 83: { struct linux_mkdir_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->mode; /* l_mode_t */ *n_args = 2; break; @@ -737,14 +737,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_rmdir */ case 84: { struct linux_rmdir_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ *n_args = 1; break; } /* linux_creat */ case 85: { struct linux_creat_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->mode; /* l_mode_t */ *n_args = 2; break; @@ -752,31 +752,31 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_link */ case 86: { struct linux_link_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ - uarg[1] = (intptr_t) p->to; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ + uarg[1] = (intptr_t)p->to; /* char * */ *n_args = 2; break; } /* linux_unlink */ case 87: { struct linux_unlink_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ *n_args = 1; break; } /* linux_symlink */ case 88: { struct linux_symlink_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ - uarg[1] = (intptr_t) p->to; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ + uarg[1] = (intptr_t)p->to; /* char * */ *n_args = 2; break; } /* linux_readlink */ case 89: { struct linux_readlink_args *p = params; - uarg[0] = (intptr_t) p->name; /* char * */ - uarg[1] = (intptr_t) p->buf; /* char * */ + uarg[0] = (intptr_t)p->name; /* char * */ + uarg[1] = (intptr_t)p->buf; /* char * */ iarg[2] = p->count; /* l_int */ *n_args = 3; break; @@ -784,7 +784,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_chmod */ case 90: { struct linux_chmod_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->mode; /* l_mode_t */ *n_args = 2; break; @@ -800,7 +800,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_chown */ case 92: { struct linux_chown_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->uid; /* l_uid_t */ iarg[2] = p->gid; /* l_gid_t */ *n_args = 3; @@ -818,7 +818,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_lchown */ case 94: { struct linux_lchown_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->uid; /* l_uid_t */ iarg[2] = p->gid; /* l_gid_t */ *n_args = 3; @@ -834,8 +834,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* gettimeofday */ case 96: { struct gettimeofday_args *p = params; - uarg[0] = (intptr_t) p->tp; /* struct l_timeval * */ - uarg[1] = (intptr_t) p->tzp; /* struct timezone * */ + uarg[0] = (intptr_t)p->tp; /* struct l_timeval * */ + uarg[1] = (intptr_t)p->tzp; /* struct timezone * */ *n_args = 2; break; } @@ -843,7 +843,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 97: { struct linux_getrlimit_args *p = params; iarg[0] = p->resource; /* l_uint */ - uarg[1] = (intptr_t) p->rlim; /* struct l_rlimit * */ + uarg[1] = (intptr_t)p->rlim; /* struct l_rlimit * */ *n_args = 2; break; } @@ -851,21 +851,21 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 98: { struct getrusage_args *p = params; iarg[0] = p->who; /* int */ - uarg[1] = (intptr_t) p->rusage; /* struct rusage * */ + uarg[1] = (intptr_t)p->rusage; /* struct rusage * */ *n_args = 2; break; } /* linux_sysinfo */ case 99: { struct linux_sysinfo_args *p = params; - uarg[0] = (intptr_t) p->info; /* struct l_sysinfo * */ + uarg[0] = (intptr_t)p->info; /* struct l_sysinfo * */ *n_args = 1; break; } /* linux_times */ case 100: { struct linux_times_args *p = params; - uarg[0] = (intptr_t) p->buf; /* struct l_times_argv * */ + uarg[0] = (intptr_t)p->buf; /* struct l_times_argv * */ *n_args = 1; break; } @@ -888,7 +888,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 103: { struct linux_syslog_args *p = params; iarg[0] = p->type; /* l_int */ - uarg[1] = (intptr_t) p->buf; /* char * */ + uarg[1] = (intptr_t)p->buf; /* char * */ iarg[2] = p->len; /* l_int */ *n_args = 3; break; @@ -965,7 +965,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 115: { struct linux_getgroups_args *p = params; iarg[0] = p->gidsetsize; /* l_int */ - uarg[1] = (intptr_t) p->grouplist; /* l_gid_t * */ + uarg[1] = (intptr_t)p->grouplist; /* l_gid_t * */ *n_args = 2; break; } @@ -973,7 +973,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 116: { struct linux_setgroups_args *p = params; iarg[0] = p->gidsetsize; /* l_int */ - uarg[1] = (intptr_t) p->grouplist; /* l_gid_t * */ + uarg[1] = (intptr_t)p->grouplist; /* l_gid_t * */ *n_args = 2; break; } @@ -989,9 +989,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* getresuid */ case 118: { struct getresuid_args *p = params; - uarg[0] = (intptr_t) p->ruid; /* uid_t * */ - uarg[1] = (intptr_t) p->euid; /* uid_t * */ - uarg[2] = (intptr_t) p->suid; /* uid_t * */ + uarg[0] = (intptr_t)p->ruid; /* uid_t * */ + uarg[1] = (intptr_t)p->euid; /* uid_t * */ + uarg[2] = (intptr_t)p->suid; /* uid_t * */ *n_args = 3; break; } @@ -1007,9 +1007,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* getresgid */ case 120: { struct getresgid_args *p = params; - uarg[0] = (intptr_t) p->rgid; /* gid_t * */ - uarg[1] = (intptr_t) p->egid; /* gid_t * */ - uarg[2] = (intptr_t) p->sgid; /* gid_t * */ + uarg[0] = (intptr_t)p->rgid; /* gid_t * */ + uarg[1] = (intptr_t)p->egid; /* gid_t * */ + uarg[2] = (intptr_t)p->sgid; /* gid_t * */ *n_args = 3; break; } @@ -1044,23 +1044,23 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_capget */ case 125: { struct linux_capget_args *p = params; - uarg[0] = (intptr_t) p->hdrp; /* struct l_user_cap_header * */ - uarg[1] = (intptr_t) p->datap; /* struct l_user_cap_data * */ + uarg[0] = (intptr_t)p->hdrp; /* struct l_user_cap_header * */ + uarg[1] = (intptr_t)p->datap; /* struct l_user_cap_data * */ *n_args = 2; break; } /* linux_capset */ case 126: { struct linux_capset_args *p = params; - uarg[0] = (intptr_t) p->hdrp; /* struct l_user_cap_header * */ - uarg[1] = (intptr_t) p->datap; /* struct l_user_cap_data * */ + uarg[0] = (intptr_t)p->hdrp; /* struct l_user_cap_header * */ + uarg[1] = (intptr_t)p->datap; /* struct l_user_cap_data * */ *n_args = 2; break; } /* linux_rt_sigpending */ case 127: { struct linux_rt_sigpending_args *p = params; - uarg[0] = (intptr_t) p->set; /* l_sigset_t * */ + uarg[0] = (intptr_t)p->set; /* l_sigset_t * */ iarg[1] = p->sigsetsize; /* l_size_t */ *n_args = 2; break; @@ -1068,9 +1068,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_rt_sigtimedwait */ case 128: { struct linux_rt_sigtimedwait_args *p = params; - uarg[0] = (intptr_t) p->mask; /* l_sigset_t * */ - uarg[1] = (intptr_t) p->ptr; /* l_siginfo_t * */ - uarg[2] = (intptr_t) p->timeout; /* struct l_timeval * */ + uarg[0] = (intptr_t)p->mask; /* l_sigset_t * */ + uarg[1] = (intptr_t)p->ptr; /* l_siginfo_t * */ + uarg[2] = (intptr_t)p->timeout; /* struct l_timeval * */ iarg[3] = p->sigsetsize; /* l_size_t */ *n_args = 4; break; @@ -1080,14 +1080,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_rt_sigqueueinfo_args *p = params; iarg[0] = p->pid; /* l_pid_t */ iarg[1] = p->sig; /* l_int */ - uarg[2] = (intptr_t) p->info; /* l_siginfo_t * */ + uarg[2] = (intptr_t)p->info; /* l_siginfo_t * */ *n_args = 3; break; } /* linux_rt_sigsuspend */ case 130: { struct linux_rt_sigsuspend_args *p = params; - uarg[0] = (intptr_t) p->newset; /* l_sigset_t * */ + uarg[0] = (intptr_t)p->newset; /* l_sigset_t * */ iarg[1] = p->sigsetsize; /* l_size_t */ *n_args = 2; break; @@ -1095,23 +1095,23 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_sigaltstack */ case 131: { struct linux_sigaltstack_args *p = params; - uarg[0] = (intptr_t) p->uss; /* l_stack_t * */ - uarg[1] = (intptr_t) p->uoss; /* l_stack_t * */ + uarg[0] = (intptr_t)p->uss; /* l_stack_t * */ + uarg[1] = (intptr_t)p->uoss; /* l_stack_t * */ *n_args = 2; break; } /* linux_utime */ case 132: { struct linux_utime_args *p = params; - uarg[0] = (intptr_t) p->fname; /* char * */ - uarg[1] = (intptr_t) p->times; /* struct l_utimbuf * */ + uarg[0] = (intptr_t)p->fname; /* char * */ + uarg[1] = (intptr_t)p->times; /* struct l_utimbuf * */ *n_args = 2; break; } /* linux_mknod */ case 133: { struct linux_mknod_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->mode; /* l_mode_t */ iarg[2] = p->dev; /* l_uint */ *n_args = 3; @@ -1128,15 +1128,15 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 136: { struct linux_ustat_args *p = params; iarg[0] = p->dev; /* l_uint */ - uarg[1] = (intptr_t) p->ubuf; /* struct l_ustat * */ + uarg[1] = (intptr_t)p->ubuf; /* struct l_ustat * */ *n_args = 2; break; } /* linux_statfs */ case 137: { struct linux_statfs_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ - uarg[1] = (intptr_t) p->buf; /* struct l_statfs_buf * */ + uarg[0] = (intptr_t)p->path; /* char * */ + uarg[1] = (intptr_t)p->buf; /* struct l_statfs_buf * */ *n_args = 2; break; } @@ -1144,7 +1144,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 138: { struct linux_fstatfs_args *p = params; iarg[0] = p->fd; /* l_uint */ - uarg[1] = (intptr_t) p->buf; /* struct l_statfs_buf * */ + uarg[1] = (intptr_t)p->buf; /* struct l_statfs_buf * */ *n_args = 2; break; } @@ -1178,7 +1178,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 142: { struct linux_sched_setparam_args *p = params; iarg[0] = p->pid; /* l_pid_t */ - uarg[1] = (intptr_t) p->param; /* struct sched_param * */ + uarg[1] = (intptr_t)p->param; /* struct sched_param * */ *n_args = 2; break; } @@ -1186,7 +1186,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 143: { struct linux_sched_getparam_args *p = params; iarg[0] = p->pid; /* l_pid_t */ - uarg[1] = (intptr_t) p->param; /* struct sched_param * */ + uarg[1] = (intptr_t)p->param; /* struct sched_param * */ *n_args = 2; break; } @@ -1195,7 +1195,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_sched_setscheduler_args *p = params; iarg[0] = p->pid; /* l_pid_t */ iarg[1] = p->policy; /* l_int */ - uarg[2] = (intptr_t) p->param; /* struct sched_param * */ + uarg[2] = (intptr_t)p->param; /* struct sched_param * */ *n_args = 3; break; } @@ -1224,14 +1224,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 148: { struct linux_sched_rr_get_interval_args *p = params; iarg[0] = p->pid; /* l_pid_t */ - uarg[1] = (intptr_t) p->interval; /* struct l_timespec * */ + uarg[1] = (intptr_t)p->interval; /* struct l_timespec * */ *n_args = 2; break; } /* mlock */ case 149: { struct mlock_args *p = params; - uarg[0] = (intptr_t) p->addr; /* const void * */ + uarg[0] = (intptr_t)p->addr; /* const void * */ uarg[1] = p->len; /* size_t */ *n_args = 2; break; @@ -1239,7 +1239,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* munlock */ case 150: { struct munlock_args *p = params; - uarg[0] = (intptr_t) p->addr; /* const void * */ + uarg[0] = (intptr_t)p->addr; /* const void * */ uarg[1] = p->len; /* size_t */ *n_args = 2; break; @@ -1274,7 +1274,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_sysctl */ case 156: { struct linux_sysctl_args *p = params; - uarg[0] = (intptr_t) p->args; /* struct l___sysctl_args * */ + uarg[0] = (intptr_t)p->args; /* struct l___sysctl_args * */ *n_args = 1; break; } @@ -1306,14 +1306,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 160: { struct linux_setrlimit_args *p = params; iarg[0] = p->resource; /* l_uint */ - uarg[1] = (intptr_t) p->rlim; /* struct l_rlimit * */ + uarg[1] = (intptr_t)p->rlim; /* struct l_rlimit * */ *n_args = 2; break; } /* chroot */ case 161: { struct chroot_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ *n_args = 1; break; } @@ -1325,33 +1325,33 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* acct */ case 163: { struct acct_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ *n_args = 1; break; } /* settimeofday */ case 164: { struct settimeofday_args *p = params; - uarg[0] = (intptr_t) p->tv; /* struct l_timeval * */ - uarg[1] = (intptr_t) p->tzp; /* struct timezone * */ + uarg[0] = (intptr_t)p->tv; /* struct l_timeval * */ + uarg[1] = (intptr_t)p->tzp; /* struct timezone * */ *n_args = 2; break; } /* linux_mount */ case 165: { struct linux_mount_args *p = params; - uarg[0] = (intptr_t) p->specialfile; /* char * */ - uarg[1] = (intptr_t) p->dir; /* char * */ - uarg[2] = (intptr_t) p->filesystemtype; /* char * */ + uarg[0] = (intptr_t)p->specialfile; /* char * */ + uarg[1] = (intptr_t)p->dir; /* char * */ + uarg[2] = (intptr_t)p->filesystemtype; /* char * */ iarg[3] = p->rwflag; /* l_ulong */ - uarg[4] = (intptr_t) p->data; /* void * */ + uarg[4] = (intptr_t)p->data; /* void * */ *n_args = 5; break; } /* linux_umount */ case 166: { struct linux_umount_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->flags; /* l_int */ *n_args = 2; break; @@ -1359,7 +1359,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* swapon */ case 167: { struct swapon_args *p = params; - uarg[0] = (intptr_t) p->name; /* char * */ + uarg[0] = (intptr_t)p->name; /* char * */ *n_args = 1; break; } @@ -1374,14 +1374,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) iarg[0] = p->magic1; /* l_int */ iarg[1] = p->magic2; /* l_int */ iarg[2] = p->cmd; /* l_uint */ - uarg[3] = (intptr_t) p->arg; /* void * */ + uarg[3] = (intptr_t)p->arg; /* void * */ *n_args = 4; break; } /* linux_sethostname */ case 170: { struct linux_sethostname_args *p = params; - uarg[0] = (intptr_t) p->hostname; /* char * */ + uarg[0] = (intptr_t)p->hostname; /* char * */ iarg[1] = p->len; /* l_int */ *n_args = 2; break; @@ -1389,7 +1389,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_setdomainname */ case 171: { struct linux_setdomainname_args *p = params; - uarg[0] = (intptr_t) p->name; /* char * */ + uarg[0] = (intptr_t)p->name; /* char * */ iarg[1] = p->len; /* l_int */ *n_args = 2; break; @@ -1434,9 +1434,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_setxattr */ case 188: { struct linux_setxattr_args *p = params; - uarg[0] = (intptr_t) p->path; /* const char * */ - uarg[1] = (intptr_t) p->name; /* const char * */ - uarg[2] = (intptr_t) p->value; /* const char * */ + uarg[0] = (intptr_t)p->path; /* const char * */ + uarg[1] = (intptr_t)p->name; /* const char * */ + uarg[2] = (intptr_t)p->value; /* const char * */ iarg[3] = p->size; /* l_size_t */ iarg[4] = p->flags; /* l_int */ *n_args = 5; @@ -1445,9 +1445,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_lsetxattr */ case 189: { struct linux_lsetxattr_args *p = params; - uarg[0] = (intptr_t) p->path; /* const char * */ - uarg[1] = (intptr_t) p->name; /* const char * */ - uarg[2] = (intptr_t) p->value; /* const char * */ + uarg[0] = (intptr_t)p->path; /* const char * */ + uarg[1] = (intptr_t)p->name; /* const char * */ + uarg[2] = (intptr_t)p->value; /* const char * */ iarg[3] = p->size; /* l_size_t */ iarg[4] = p->flags; /* l_int */ *n_args = 5; @@ -1457,8 +1457,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 190: { struct linux_fsetxattr_args *p = params; iarg[0] = p->fd; /* l_int */ - uarg[1] = (intptr_t) p->name; /* const char * */ - uarg[2] = (intptr_t) p->value; /* const char * */ + uarg[1] = (intptr_t)p->name; /* const char * */ + uarg[2] = (intptr_t)p->value; /* const char * */ iarg[3] = p->size; /* l_size_t */ iarg[4] = p->flags; /* l_int */ *n_args = 5; @@ -1467,9 +1467,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_getxattr */ case 191: { struct linux_getxattr_args *p = params; - uarg[0] = (intptr_t) p->path; /* const char * */ - uarg[1] = (intptr_t) p->name; /* const char * */ - uarg[2] = (intptr_t) p->value; /* char * */ + uarg[0] = (intptr_t)p->path; /* const char * */ + uarg[1] = (intptr_t)p->name; /* const char * */ + uarg[2] = (intptr_t)p->value; /* char * */ iarg[3] = p->size; /* l_size_t */ *n_args = 4; break; @@ -1477,9 +1477,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_lgetxattr */ case 192: { struct linux_lgetxattr_args *p = params; - uarg[0] = (intptr_t) p->path; /* const char * */ - uarg[1] = (intptr_t) p->name; /* const char * */ - uarg[2] = (intptr_t) p->value; /* char * */ + uarg[0] = (intptr_t)p->path; /* const char * */ + uarg[1] = (intptr_t)p->name; /* const char * */ + uarg[2] = (intptr_t)p->value; /* char * */ iarg[3] = p->size; /* l_size_t */ *n_args = 4; break; @@ -1488,8 +1488,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 193: { struct linux_fgetxattr_args *p = params; iarg[0] = p->fd; /* l_int */ - uarg[1] = (intptr_t) p->name; /* const char * */ - uarg[2] = (intptr_t) p->value; /* char * */ + uarg[1] = (intptr_t)p->name; /* const char * */ + uarg[2] = (intptr_t)p->value; /* char * */ iarg[3] = p->size; /* l_size_t */ *n_args = 4; break; @@ -1497,8 +1497,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_listxattr */ case 194: { struct linux_listxattr_args *p = params; - uarg[0] = (intptr_t) p->path; /* const char * */ - uarg[1] = (intptr_t) p->list; /* const char * */ + uarg[0] = (intptr_t)p->path; /* const char * */ + uarg[1] = (intptr_t)p->list; /* const char * */ iarg[2] = p->size; /* l_size_t */ *n_args = 3; break; @@ -1506,8 +1506,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_llistxattr */ case 195: { struct linux_llistxattr_args *p = params; - uarg[0] = (intptr_t) p->path; /* const char * */ - uarg[1] = (intptr_t) p->list; /* const char * */ + uarg[0] = (intptr_t)p->path; /* const char * */ + uarg[1] = (intptr_t)p->list; /* const char * */ iarg[2] = p->size; /* l_size_t */ *n_args = 3; break; @@ -1516,7 +1516,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 196: { struct linux_flistxattr_args *p = params; iarg[0] = p->fd; /* l_int */ - uarg[1] = (intptr_t) p->list; /* const char * */ + uarg[1] = (intptr_t)p->list; /* const char * */ iarg[2] = p->size; /* l_size_t */ *n_args = 3; break; @@ -1524,16 +1524,16 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_removexattr */ *** 33954 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Thu May 20 05:54:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 A7DE8635AAD; Thu, 20 May 2021 05:54:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlzSn4R1qz3kfF; Thu, 20 May 2021 05:54:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8052A2094C; Thu, 20 May 2021 05:54:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14K5s1si079221; Thu, 20 May 2021 05:54:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14K5s1N3079220; Thu, 20 May 2021 05:54:01 GMT (envelope-from git) Date: Thu, 20 May 2021 05:54:01 GMT Message-Id: <202105200554.14K5s1N3079220@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: e240dd0d502e - stable/13 - netgraph/ng_bridge: Handle send errors during loop handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e240dd0d502e5c6741007e6e8f9ac41a0e5c33cd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 05:54:01 -0000 The branch stable/13 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=e240dd0d502e5c6741007e6e8f9ac41a0e5c33cd commit e240dd0d502e5c6741007e6e8f9ac41a0e5c33cd Author: Lutz Donnerhacke AuthorDate: 2021-04-27 07:49:50 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-20 05:52:21 +0000 netgraph/ng_bridge: Handle send errors during loop handling If sending out a packet fails during the loop over all links, the allocated memory is leaked and not all links receive a copy. This patch fixes those problems, clarifies a premature abort of the loop, and fixes a minory style(9) bug. PR: 255430 Submitted by: Dancho Penev Tested by: Dancho Penev Differential Revision: https://reviews.freebsd.org/D30008 (cherry picked from commit a56e5ad6903037861457da754574b4903dcb0e7e) --- sys/netgraph/ng_bridge.c | 55 ++++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c index 3b00e4c03124..c97aac24cba6 100644 --- a/sys/netgraph/ng_bridge.c +++ b/sys/netgraph/ng_bridge.c @@ -708,22 +708,28 @@ ng_bridge_send_data(link_cp dst, int manycast, struct mbuf *m, item_p item) { else NG_SEND_DATA_ONLY(error, dst->hook, m); - if (error == 0) { - counter_u64_add(dst->stats.xmitPackets, 1); - counter_u64_add(dst->stats.xmitOctets, len); - switch (manycast) { - default: /* unknown unicast */ - break; - case 1: /* multicast */ - counter_u64_add(dst->stats.xmitMulticasts, 1); - break; - case 2: /* broadcast */ - counter_u64_add(dst->stats.xmitBroadcasts, 1); - break; - } + if (error) { + /* The packet is still ours */ + if (item != NULL) + NG_FREE_ITEM(item); + if (m != NULL) + NG_FREE_M(m); + return (error); } - return (error); + counter_u64_add(dst->stats.xmitPackets, 1); + counter_u64_add(dst->stats.xmitOctets, len); + switch (manycast) { + default: /* unknown unicast */ + break; + case 1: /* multicast */ + counter_u64_add(dst->stats.xmitMulticasts, 1); + break; + case 2: /* broadcast */ + counter_u64_add(dst->stats.xmitBroadcasts, 1); + break; + } + return (0); } /* @@ -761,16 +767,16 @@ ng_bridge_send_ctx(hook_p dst, void *arg) * It's usable link but not the reserved (first) one. * Copy mbuf info for sending. */ - m2 = m_dup(ctx->m, M_NOWAIT); /* XXX m_copypacket() */ + m2 = m_dup(ctx->m, M_NOWAIT); if (m2 == NULL) { counter_u64_add(ctx->incoming->stats.memoryFailures, 1); ctx->error = ENOBUFS; - return (0); /* abort loop */ + return (0); /* abort loop, do not try again and again */ } /* Send packet */ error = ng_bridge_send_data(destLink, ctx->manycast, m2, NULL); - if(error) + if (error) ctx->error = error; return (1); } @@ -920,18 +926,17 @@ ng_bridge_rcvdata(hook_p hook, item_p item) /* Distribute unknown, multicast, broadcast pkts to all other links */ NG_NODE_FOREACH_HOOK(node, ng_bridge_send_ctx, &ctx, ret); - /* If we never saw a good link, leave. */ - if (ctx.foundFirst == NULL || ctx.error != 0) { + /* Finally send out on the first link found */ + if (ctx.foundFirst != NULL) { + int error = ng_bridge_send_data(ctx.foundFirst, ctx.manycast, ctx.m, item); + if (error) + ctx.error = error; + } else { /* nothing to send at all */ NG_FREE_ITEM(item); NG_FREE_M(ctx.m); - return (ctx.error); } - /* - * If we've sent all the others, send the original - * on the first link we found. - */ - return (ng_bridge_send_data(ctx.foundFirst, ctx.manycast, ctx.m, item)); + return (ctx.error); } /* From owner-dev-commits-src-branches@freebsd.org Thu May 20 05:59:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 356F5635D22; Thu, 20 May 2021 05:59:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlzbR14SXz3p9J; Thu, 20 May 2021 05:59:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D15E20A55; Thu, 20 May 2021 05:59:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14K5xkI7079723; Thu, 20 May 2021 05:59:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14K5xkL8079722; Thu, 20 May 2021 05:59:46 GMT (envelope-from git) Date: Thu, 20 May 2021 05:59:46 GMT Message-Id: <202105200559.14K5xkL8079722@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 1165cafa0bae - stable/12 - netgraph/ng_bridge: Handle send errors during loop handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1165cafa0baee55a46459e4cf7c2573ca25a0a1c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 05:59:47 -0000 The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=1165cafa0baee55a46459e4cf7c2573ca25a0a1c commit 1165cafa0baee55a46459e4cf7c2573ca25a0a1c Author: Lutz Donnerhacke AuthorDate: 2021-04-27 07:49:50 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-20 05:58:30 +0000 netgraph/ng_bridge: Handle send errors during loop handling If sending out a packet fails during the loop over all links, the allocated memory is leaked and not all links receive a copy. This patch fixes those problems, clarifies a premature abort of the loop, and fixes a minory style(9) bug. PR: 255430 Submitted by: Dancho Penev Tested by: Dancho Penev Differential Revision: https://reviews.freebsd.org/D30008 (cherry picked from commit a56e5ad6903037861457da754574b4903dcb0e7e) --- sys/netgraph/ng_bridge.c | 57 ++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c index 5917c1084527..3243319c99e8 100644 --- a/sys/netgraph/ng_bridge.c +++ b/sys/netgraph/ng_bridge.c @@ -707,22 +707,28 @@ ng_bridge_send_data(link_cp dst, int manycast, struct mbuf *m, item_p item) { else NG_SEND_DATA_ONLY(error, dst->hook, m); - if (error == 0) { - counter_u64_add(dst->stats.xmitPackets, 1); - counter_u64_add(dst->stats.xmitOctets, len); - switch (manycast) { - default: /* unknown unicast */ - break; - case 1: /* multicast */ - counter_u64_add(dst->stats.xmitMulticasts, 1); - break; - case 2: /* broadcast */ - counter_u64_add(dst->stats.xmitBroadcasts, 1); - break; - } + if (error) { + /* The packet is still ours */ + if (item != NULL) + NG_FREE_ITEM(item); + if (m != NULL) + NG_FREE_M(m); + return (error); } - return (error); + counter_u64_add(dst->stats.xmitPackets, 1); + counter_u64_add(dst->stats.xmitOctets, len); + switch (manycast) { + default: /* unknown unicast */ + break; + case 1: /* multicast */ + counter_u64_add(dst->stats.xmitMulticasts, 1); + break; + case 2: /* broadcast */ + counter_u64_add(dst->stats.xmitBroadcasts, 1); + break; + } + return (0); } /* @@ -760,16 +766,16 @@ ng_bridge_send_ctx(hook_p dst, void *arg) * It's usable link but not the reserved (first) one. * Copy mbuf info for sending. */ - m2 = m_dup(ctx->m, M_NOWAIT); /* XXX m_copypacket() */ + m2 = m_dup(ctx->m, M_NOWAIT); if (m2 == NULL) { counter_u64_add(ctx->incoming->stats.memoryFailures, 1); ctx->error = ENOBUFS; - return (0); /* abort loop */ + return (0); /* abort loop, do not try again and again */ } /* Send packet */ error = ng_bridge_send_data(destLink, ctx->manycast, m2, NULL); - if(error) + if (error) ctx->error = error; return (1); } @@ -922,18 +928,17 @@ ng_bridge_rcvdata(hook_p hook, item_p item) /* Distribute unknown, multicast, broadcast pkts to all other links */ NG_NODE_FOREACH_HOOK(node, ng_bridge_send_ctx, &ctx, ret); - /* If we never saw a good link, leave. */ - if (ctx.foundFirst == NULL || ctx.error != 0) { + /* Finally send out on the first link found */ + if (ctx.foundFirst != NULL) { + int error = ng_bridge_send_data(ctx.foundFirst, ctx.manycast, ctx.m, item); + if (error) + ctx.error = error; + } else { /* nothing to send at all */ NG_FREE_ITEM(item); NG_FREE_M(ctx.m); - return (ctx.error); } - - /* - * If we've sent all the others, send the original - * on the first link we found. - */ - return (ng_bridge_send_data(ctx.foundFirst, ctx.manycast, ctx.m, item)); + + return (ctx.error); } /* From owner-dev-commits-src-branches@freebsd.org Thu May 20 14:10:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 0CD8963FC91; Thu, 20 May 2021 14:10:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmBTl5ylhz3Lv7; Thu, 20 May 2021 14:10:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B133C27451; Thu, 20 May 2021 14:10:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14KEAZU2038918; Thu, 20 May 2021 14:10:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KEAZNM038917; Thu, 20 May 2021 14:10:35 GMT (envelope-from git) Date: Thu, 20 May 2021 14:10:35 GMT Message-Id: <202105201410.14KEAZNM038917@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: f80d1c0035ce - stable/13 - sort: Stop "fixing" obsolete key syntax after -- flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f80d1c0035ce2ee5325271ea28916377f813d737 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 14:10:36 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f80d1c0035ce2ee5325271ea28916377f813d737 commit f80d1c0035ce2ee5325271ea28916377f813d737 Author: Cyril Zhang AuthorDate: 2021-05-13 12:52:51 +0000 Commit: Mark Johnston CommitDate: 2021-05-20 13:15:40 +0000 sort: Stop "fixing" obsolete key syntax after -- flag PR: 255798 Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30234 (cherry picked from commit fa43162c63790806d0effba5ac98a1a3c6b835e1) --- usr.bin/sort/sort.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c index fee6f72449e2..d5c18552d914 100644 --- a/usr.bin/sort/sort.c +++ b/usr.bin/sort/sort.c @@ -858,6 +858,11 @@ fix_obsolete_keys(int *argc, char **argv) arg1 = argv[i]; + if (strcmp(arg1, "--") == 0) { + /* Following arguments are treated as filenames. */ + break; + } + if (strlen(arg1) > 1 && arg1[0] == '+') { int c1, f1; char sopts1[128]; From owner-dev-commits-src-branches@freebsd.org Thu May 20 14:10:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 51C8A63FA46; Thu, 20 May 2021 14:10:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmBTn0mPNz3LgC; Thu, 20 May 2021 14:10:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F181426F73; Thu, 20 May 2021 14:10:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14KEAalH038939; Thu, 20 May 2021 14:10:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KEAakj038938; Thu, 20 May 2021 14:10:36 GMT (envelope-from git) Date: Thu, 20 May 2021 14:10:36 GMT Message-Id: <202105201410.14KEAakj038938@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: df40dcbf7c79 - stable/13 - sort: Cache value of MB_CUR_MAX MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: df40dcbf7c794f5448c13e23670466658a620933 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 14:10:37 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=df40dcbf7c794f5448c13e23670466658a620933 commit df40dcbf7c794f5448c13e23670466658a620933 Author: Cyril Zhang AuthorDate: 2021-05-13 12:55:06 +0000 Commit: Mark Johnston CommitDate: 2021-05-20 13:15:43 +0000 sort: Cache value of MB_CUR_MAX Every usage of MB_CUR_MAX results in a call to __mb_cur_max. This is inefficient and redundant. Caching the value of MB_CUR_MAX in a global variable removes these calls and speeds up the runtime of sort. For numeric sorting, runtime is almost halved in some tests. PR: 255551 PR: 255840 Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30170 (cherry picked from commit 71ec05a21257e159f40d54e26ad0011bb19b5134) --- usr.bin/sort/bwstring.c | 54 ++++++++++++++++++++++++------------------------ usr.bin/sort/bwstring.h | 9 ++++---- usr.bin/sort/radixsort.c | 4 ++-- usr.bin/sort/sort.c | 6 +++++- usr.bin/sort/sort.h | 6 ++++++ 5 files changed, 45 insertions(+), 34 deletions(-) diff --git a/usr.bin/sort/bwstring.c b/usr.bin/sort/bwstring.c index cab21324c4b3..f6200c53c83e 100644 --- a/usr.bin/sort/bwstring.c +++ b/usr.bin/sort/bwstring.c @@ -59,7 +59,7 @@ initialise_months(void) char *tmp; size_t len; - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { if (cmonths == NULL) { char *m; @@ -143,7 +143,7 @@ void bwsprintf(FILE *f, struct bwstring *bws, const char *prefix, const char *suffix) { - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) fprintf(f, "%s%s%s", prefix, bws->data.cstr, suffix); else fprintf(f, "%s%S%s", prefix, bws->data.wstr, suffix); @@ -158,14 +158,14 @@ const void* bwsrawdata(const struct bwstring *bws) size_t bwsrawlen(const struct bwstring *bws) { - return ((MB_CUR_MAX == 1) ? bws->len : SIZEOF_WCHAR_STRING(bws->len)); + return ((mb_cur_max == 1) ? bws->len : SIZEOF_WCHAR_STRING(bws->len)); } size_t bws_memsize(const struct bwstring *bws) { - return ((MB_CUR_MAX == 1) ? (bws->len + 2 + sizeof(struct bwstring)) : + return ((mb_cur_max == 1) ? (bws->len + 2 + sizeof(struct bwstring)) : (SIZEOF_WCHAR_STRING(bws->len + 1) + sizeof(struct bwstring))); } @@ -175,7 +175,7 @@ bws_setlen(struct bwstring *bws, size_t newlen) if (bws && newlen != bws->len && newlen <= bws->len) { bws->len = newlen; - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) bws->data.cstr[newlen] = '\0'; else bws->data.wstr[newlen] = L'\0'; @@ -190,14 +190,14 @@ bwsalloc(size_t sz) { struct bwstring *ret; - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) ret = sort_malloc(sizeof(struct bwstring) + 1 + sz); else ret = sort_malloc(sizeof(struct bwstring) + SIZEOF_WCHAR_STRING(sz + 1)); ret->len = sz; - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) ret->data.cstr[ret->len] = '\0'; else ret->data.wstr[ret->len] = L'\0'; @@ -218,7 +218,7 @@ bwsdup(const struct bwstring *s) else { struct bwstring *ret = bwsalloc(s->len); - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) memcpy(ret->data.cstr, s->data.cstr, (s->len)); else memcpy(ret->data.wstr, s->data.wstr, @@ -242,7 +242,7 @@ bwssbdup(const wchar_t *str, size_t len) ret = bwsalloc(len); - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) for (size_t i = 0; i < len; ++i) ret->data.cstr[i] = (unsigned char) str[i]; else @@ -263,7 +263,7 @@ bwscsbdup(const unsigned char *str, size_t len) ret = bwsalloc(len); if (str) { - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) memcpy(ret->data.cstr, str, len); else { mbstate_t mbs; @@ -277,7 +277,7 @@ bwscsbdup(const unsigned char *str, size_t len) memset(&mbs, 0, sizeof(mbs)); while (cptr < len) { - size_t n = MB_CUR_MAX; + size_t n = mb_cur_max; if (n > len - cptr) n = len - cptr; @@ -334,7 +334,7 @@ bwscpy(struct bwstring *dst, const struct bwstring *src) nums = dst->len; dst->len = nums; - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { memcpy(dst->data.cstr, src->data.cstr, nums); dst->data.cstr[dst->len] = '\0'; } else { @@ -363,7 +363,7 @@ bwsncpy(struct bwstring *dst, const struct bwstring *src, size_t size) nums = size; dst->len = nums; - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { memcpy(dst->data.cstr, src->data.cstr, nums); dst->data.cstr[dst->len] = '\0'; } else { @@ -398,7 +398,7 @@ bwsnocpy(struct bwstring *dst, const struct bwstring *src, size_t offset, if (nums > size) nums = size; dst->len = nums; - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { memcpy(dst->data.cstr, src->data.cstr + offset, (nums)); dst->data.cstr[dst->len] = '\0'; @@ -420,7 +420,7 @@ size_t bwsfwrite(struct bwstring *bws, FILE *f, bool zero_ended) { - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { size_t len = bws->len; if (!zero_ended) { @@ -478,7 +478,7 @@ bwsfgetln(FILE *f, size_t *len, bool zero_ended, struct reader_buffer *rb) eols = zero_ended ? btowc('\0') : btowc('\n'); - if (!zero_ended && (MB_CUR_MAX > 1)) { + if (!zero_ended && (mb_cur_max > 1)) { wchar_t *ret; ret = fgetwln(f, len); @@ -494,7 +494,7 @@ bwsfgetln(FILE *f, size_t *len, bool zero_ended, struct reader_buffer *rb) } return (bwssbdup(ret, *len)); - } else if (!zero_ended && (MB_CUR_MAX == 1)) { + } else if (!zero_ended && (mb_cur_max == 1)) { char *ret; ret = fgetln(f, len); @@ -523,7 +523,7 @@ bwsfgetln(FILE *f, size_t *len, bool zero_ended, struct reader_buffer *rb) } rb->fgetwln_z_buffer[*len] = 0; - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) while (!feof(f)) { int c; @@ -603,7 +603,7 @@ bwsncmp(const struct bwstring *bws1, const struct bwstring *bws2, if (len < cmp_len) cmp_len = len; - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { const unsigned char *s1, *s2; s1 = bws1->data.cstr + offset; @@ -696,7 +696,7 @@ bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) len1 -= offset; len2 -= offset; - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { const unsigned char *s1, *s2; s1 = bws1->data.cstr + offset; @@ -852,7 +852,7 @@ bwstod(struct bwstring *s0, bool *empty) { double ret = 0; - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { unsigned char *end, *s; char *ep; @@ -909,7 +909,7 @@ int bws_month_score(const struct bwstring *s0) { - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { const unsigned char *end, *s; s = s0->data.cstr; @@ -949,7 +949,7 @@ struct bwstring * ignore_leading_blanks(struct bwstring *str) { - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { unsigned char *dst, *end, *src; src = str->data.cstr; @@ -1005,7 +1005,7 @@ ignore_nonprinting(struct bwstring *str) { size_t newlen = str->len; - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { unsigned char *dst, *end, *src; unsigned char c; @@ -1058,7 +1058,7 @@ dictionary_order(struct bwstring *str) { size_t newlen = str->len; - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { unsigned char *dst, *end, *src; unsigned char c; @@ -1109,7 +1109,7 @@ struct bwstring * ignore_case(struct bwstring *str) { - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { unsigned char *end, *s; s = str->data.cstr; @@ -1137,7 +1137,7 @@ void bws_disorder_warnx(struct bwstring *s, const char *fn, size_t pos) { - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) warnx("%s:%zu: disorder: %s", fn, pos + 1, s->data.cstr); else warnx("%s:%zu: disorder: %ls", fn, pos + 1, s->data.wstr); diff --git a/usr.bin/sort/bwstring.h b/usr.bin/sort/bwstring.h index 9d62eaf37f62..b63bb97ab93f 100644 --- a/usr.bin/sort/bwstring.h +++ b/usr.bin/sort/bwstring.h @@ -38,6 +38,7 @@ #include #include +#include "sort.h" #include "mem.h" extern bool byte_sort; @@ -109,7 +110,7 @@ static inline bwstring_iterator bws_end(struct bwstring *bws) { - return ((MB_CUR_MAX == 1) ? + return ((mb_cur_max == 1) ? (bwstring_iterator) (bws->data.cstr + bws->len) : (bwstring_iterator) (bws->data.wstr + bws->len)); } @@ -118,7 +119,7 @@ static inline bwstring_iterator bws_iterator_inc(bwstring_iterator iter, size_t pos) { - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) return ((unsigned char *) iter) + pos; else return ((wchar_t*) iter) + pos; @@ -128,7 +129,7 @@ static inline wchar_t bws_get_iter_value(bwstring_iterator iter) { - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) return *((unsigned char *) iter); else return *((wchar_t*) iter); @@ -137,7 +138,7 @@ bws_get_iter_value(bwstring_iterator iter) int bws_iterator_cmp(bwstring_iterator iter1, bwstring_iterator iter2, size_t len); -#define BWS_GET(bws, pos) ((MB_CUR_MAX == 1) ? ((bws)->data.cstr[(pos)]) : (bws)->data.wstr[(pos)]) +#define BWS_GET(bws, pos) ((mb_cur_max == 1) ? ((bws)->data.cstr[(pos)]) : (bws)->data.wstr[(pos)]) void initialise_months(void); diff --git a/usr.bin/sort/radixsort.c b/usr.bin/sort/radixsort.c index 4993566aeb77..4c448fad69e9 100644 --- a/usr.bin/sort/radixsort.c +++ b/usr.bin/sort/radixsort.c @@ -258,7 +258,7 @@ add_leaf(struct sort_level *sl, struct sort_list_item *item) static inline int get_wc_index(struct sort_list_item *sli, size_t level) { - const size_t wcfact = (MB_CUR_MAX == 1) ? 1 : sizeof(wchar_t); + const size_t wcfact = (mb_cur_max == 1) ? 1 : sizeof(wchar_t); const struct key_value *kv; const struct bwstring *bws; @@ -331,7 +331,7 @@ free_sort_level(struct sort_level *sl) static void run_sort_level_next(struct sort_level *sl) { - const size_t wcfact = (MB_CUR_MAX == 1) ? 1 : sizeof(wchar_t); + const size_t wcfact = (mb_cur_max == 1) ? 1 : sizeof(wchar_t); struct sort_level *slc; size_t i, sln, tosort_num; diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c index d5c18552d914..0fbbd9284aad 100644 --- a/usr.bin/sort/sort.c +++ b/usr.bin/sort/sort.c @@ -99,6 +99,8 @@ struct sort_opts sort_opts_vals; bool debug_sort; bool need_hint; +size_t mb_cur_max; + #if defined(SORT_THREADS) unsigned int ncpu = 1; size_t nthreads = 1; @@ -305,7 +307,7 @@ conv_mbtowc(wchar_t *wc, const char *c, const wchar_t def) if (wc && c) { int res; - res = mbtowc(wc, c, MB_CUR_MAX); + res = mbtowc(wc, c, mb_cur_max); if (res < 1) *wc = def; } @@ -322,6 +324,8 @@ set_locale(void) setlocale(LC_ALL, ""); + mb_cur_max = MB_CUR_MAX; + lc = localeconv(); if (lc) { diff --git a/usr.bin/sort/sort.h b/usr.bin/sort/sort.h index b472fd16c098..96b36a65f4e4 100644 --- a/usr.bin/sort/sort.h +++ b/usr.bin/sort/sort.h @@ -127,4 +127,10 @@ extern struct sort_opts sort_opts_vals; extern struct sort_mods * const default_sort_mods; +/* + * Cached value of MB_CUR_MAX. Because MB_CUR_MAX is used often throughout the program, + * this avoids frequent calls to __mb_cur_max. + */ +extern size_t mb_cur_max; + #endif /* __BSD_SORT_H__ */ From owner-dev-commits-src-branches@freebsd.org Thu May 20 14:10:38 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 7A13463F3FA; Thu, 20 May 2021 14:10:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmBTp2TjKz3Lwm; Thu, 20 May 2021 14:10:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F14F427452; Thu, 20 May 2021 14:10:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14KEAbVj038962; Thu, 20 May 2021 14:10:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KEAbEI038961; Thu, 20 May 2021 14:10:37 GMT (envelope-from git) Date: Thu, 20 May 2021 14:10:37 GMT Message-Id: <202105201410.14KEAbEI038961@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: f2f241349486 - stable/13 - sort: Make NetBSD sort tests compatible with our sort MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f2f241349486ee2a003f7c8a23c4f15e78e29a1d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 14:10:38 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f2f241349486ee2a003f7c8a23c4f15e78e29a1d commit f2f241349486ee2a003f7c8a23c4f15e78e29a1d Author: Cyril Zhang AuthorDate: 2021-05-13 12:50:23 +0000 Commit: Mark Johnston CommitDate: 2021-05-20 13:15:46 +0000 sort: Make NetBSD sort tests compatible with our sort This diff primarily adds/removes flags to make the tests compatible with sort. Two tests are removed. One test is changed to expect fail due to a bug. Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30217 (cherry picked from commit f9e565abca9b5880fe3203ba67c90eaf3e906e95) --- contrib/netbsd-tests/usr.bin/sort/t_sort.sh | 57 ++++++++++++++++++----------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/contrib/netbsd-tests/usr.bin/sort/t_sort.sh b/contrib/netbsd-tests/usr.bin/sort/t_sort.sh index a36457cb41ec..431d23b69f96 100755 --- a/contrib/netbsd-tests/usr.bin/sort/t_sort.sh +++ b/contrib/netbsd-tests/usr.bin/sort/t_sort.sh @@ -25,6 +25,13 @@ # POSSIBILITY OF SUCH DAMAGE. # +# The -S flag in NetBSD sort enables non-stable sorting order. This flag +# doesn't exist in FreeBSD sort, and instead indicates buffer size, so all +# instances of this flag should be removed. +# +# For tests that expect exact output, but where some lines may compare +# the same, the flag -s should be added to enforce an expected sorting order. + atf_test_case basic basic_head() { @@ -57,9 +64,9 @@ empty_file_head() empty_file_body() { touch empty - atf_check -o empty sort -S empty - atf_check sort -S -c empty - atf_check sort -S -c -u empty + atf_check -o empty sort empty + atf_check sort -c empty + atf_check sort -c -u empty } atf_test_case end_of_options @@ -70,8 +77,8 @@ end_of_options_head() end_of_options_body() { echo x >-k - atf_check -o file:-k -x "sort -S -- -k in - atf_check -o inline:'\0a\n\0b\n' sort -S in + atf_check -o inline:'\0a\n\0b\n' sort in } atf_test_case long_records @@ -126,7 +133,7 @@ long_file_head() long_file_body() { awk 'BEGIN { for(i=0; i<20000; i++) print rand() }' >in - sort -S -r in | awk '$0 "x" != x { print ; x = $0 "x" }' >out + sort -r in | awk '$0 "x" != x { print ; x = $0 "x" }' >out atf_check -o file:out sort -u -r in } @@ -155,6 +162,7 @@ bflag_head() } bflag_body() { + atf_expect_fail "Behavior differs from NetBSD" cat >in <xx" + atf_check -x "sort -k2b -k2 in >xx" atf_check -e ignore sort -c -t: -k2n xx - atf_check -x "sort -S -k2,2.1b -k2 in >xx" + atf_check -x "sort -k2,2.1b -k2 in >xx" atf_check -e ignore sort -c -t: -k3n xx - atf_check -x "sort -S -k2.3 -k2 in >xx" + atf_check -x "sort -k2.3 -k2 in >xx" atf_check -e ignore sort -c -t: -k4n xx - atf_check -x "sort -S -k2b,2.3 -k2 in >xx" + atf_check -x "sort -k2b,2.3 -k2 in >xx" atf_check -e ignore sort -c -t: -k5n xx - atf_check -x "sort -S -k2.3,2.1b -k2 in >xx" + atf_check -x "sort -k2.3,2.1b -k2 in >xx" atf_check -e ignore sort -c -t: -k6n xx - atf_check -x "sort -S -k2,2.1b -k2r in >xx" + atf_check -x "sort -k2,2.1b -k2r in >xx" atf_check -e ignore sort -c -t: -k7n xx - atf_check -x "sort -S -b -k2,2 -k2 in >xx" + atf_check -x "sort -b -k2,2 -k2 in >xx" atf_check -e ignore sort -c -t: -k8n xx # XXX This test is broken. The standard is not clear on the behavior. @@ -442,7 +452,7 @@ c ca EOF - atf_check -o file:out sort -S -m in1 in2 + atf_check -o file:out sort -m in1 in2 } atf_test_case mflag_uflag @@ -585,7 +595,7 @@ oflag_displaced_head() } oflag_displaced_body() { - atf_check sort -S /dev/null -o out + atf_check sort /dev/null -o out test -f out || atf_fail "File not created" } @@ -757,7 +767,7 @@ EOF b c EOF - atf_check -o file:out sort -S -k2 in + atf_check -o file:out sort -k2 in cat >out <./+0 echo 'more contents' >in cat ./+0 in >expout @@ -926,6 +937,8 @@ plus_rflag_invalid_head() } plus_rflag_invalid_body() { + atf_expect_fail "-R flag not available on FreeBSD" + ( echo 'z b m f' echo 'y c o e' From owner-dev-commits-src-branches@freebsd.org Thu May 20 14:10:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 5F02863F3FC; Thu, 20 May 2021 14:10:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmBTs0DKNz3Lvg; Thu, 20 May 2021 14:10:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 519D827711; Thu, 20 May 2021 14:10:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14KEAe6k039009; Thu, 20 May 2021 14:10:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KEAeC2039008; Thu, 20 May 2021 14:10:40 GMT (envelope-from git) Date: Thu, 20 May 2021 14:10:40 GMT Message-Id: <202105201410.14KEAeC2039008@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: ec00c33f8181 - stable/13 - posix timers: Check for overflow when converting to ns MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ec00c33f8181978cdeb56b392ce9e5a823251483 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 14:10:41 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ec00c33f8181978cdeb56b392ce9e5a823251483 commit ec00c33f8181978cdeb56b392ce9e5a823251483 Author: Mark Johnston AuthorDate: 2021-05-13 12:33:37 +0000 Commit: Mark Johnston CommitDate: 2021-05-20 13:16:05 +0000 posix timers: Check for overflow when converting to ns Disallow a time or timer period value when the conversion to nanoseconds would overflow. Otherwise it is possible to trigger a divison by zero in realtime_expire_l(), where we compute the number of overruns by dividing by the timer interval. Fixes: 7995dae9 ("posix timers: Improve the overrun calculation") Reported by: syzbot+5ab360bd3d3e3c5a6e0e@syzkaller.appspotmail.com Reported by: syzbot+157b74ff493140d86eac@syzkaller.appspotmail.com Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30233 (cherry picked from commit 8b3c4231abf0ef6ac79655e463d0ef98ad84cd51) --- sys/kern/kern_time.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index ab22ac4a1697..323ef9a1f7a0 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -72,6 +72,8 @@ __FBSDID("$FreeBSD$"); #define MAKE_PROCESS_CPUCLOCK(pid) \ (CPUCLOCK_BIT|CPUCLOCK_PROCESS_BIT|(pid)) +#define NS_PER_SEC 1000000000 + static struct kclock posix_clocks[MAX_CLOCKS]; static uma_zone_t itimer_zone = NULL; @@ -408,8 +410,7 @@ kern_clock_settime(struct thread *td, clockid_t clock_id, struct timespec *ats) return (error); if (clock_id != CLOCK_REALTIME) return (EINVAL); - if (ats->tv_nsec < 0 || ats->tv_nsec >= 1000000000 || - ats->tv_sec < 0) + if (ats->tv_nsec < 0 || ats->tv_nsec >= NS_PER_SEC || ats->tv_sec < 0) return (EINVAL); if (!allow_insane_settime && (ats->tv_sec > 8000ULL * 365 * 24 * 60 * 60 || @@ -462,12 +463,12 @@ kern_clock_getres(struct thread *td, clockid_t clock_id, struct timespec *ts) * Rounding up is especially important if rounding down * would give 0. Perfect rounding is unimportant. */ - ts->tv_nsec = 1000000000 / tc_getfrequency() + 1; + ts->tv_nsec = NS_PER_SEC / tc_getfrequency() + 1; break; case CLOCK_VIRTUAL: case CLOCK_PROF: /* Accurately round up here because we can do so cheaply. */ - ts->tv_nsec = howmany(1000000000, hz); + ts->tv_nsec = howmany(NS_PER_SEC, hz); break; case CLOCK_SECOND: ts->tv_sec = 1; @@ -509,7 +510,7 @@ kern_clock_nanosleep(struct thread *td, clockid_t clock_id, int flags, int error; bool is_abs_real; - if (rqt->tv_nsec < 0 || rqt->tv_nsec >= 1000000000) + if (rqt->tv_nsec < 0 || rqt->tv_nsec >= NS_PER_SEC) return (EINVAL); if ((flags & ~TIMER_ABSTIME) != 0) return (EINVAL); @@ -1650,7 +1651,9 @@ static int itimespecfix(struct timespec *ts) { - if (ts->tv_sec < 0 || ts->tv_nsec < 0 || ts->tv_nsec >= 1000000000) + if (ts->tv_sec < 0 || ts->tv_nsec < 0 || ts->tv_nsec >= NS_PER_SEC) + return (EINVAL); + if ((UINT64_MAX - ts->tv_nsec) / NS_PER_SEC < ts->tv_sec) return (EINVAL); if (ts->tv_sec == 0 && ts->tv_nsec != 0 && ts->tv_nsec < tick * 1000) ts->tv_nsec = tick * 1000; @@ -1658,10 +1661,10 @@ itimespecfix(struct timespec *ts) } #define timespectons(tsp) \ - ((uint64_t)(tsp)->tv_sec * 1000000000 + (tsp)->tv_nsec) + ((uint64_t)(tsp)->tv_sec * NS_PER_SEC + (tsp)->tv_nsec) #define timespecfromns(ns) (struct timespec){ \ - .tv_sec = (ns) / 1000000000, \ - .tv_nsec = (ns) % 1000000000 \ + .tv_sec = (ns) / NS_PER_SEC, \ + .tv_nsec = (ns) % NS_PER_SEC \ } static void From owner-dev-commits-src-branches@freebsd.org Thu May 20 14:10:43 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 F03DC63F3FD; Thu, 20 May 2021 14:10:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmBTt0Zgnz3LrX; Thu, 20 May 2021 14:10:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5EE7326F74; Thu, 20 May 2021 14:10:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14KEAf1M039030; Thu, 20 May 2021 14:10:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KEAfYF039029; Thu, 20 May 2021 14:10:41 GMT (envelope-from git) Date: Thu, 20 May 2021 14:10:41 GMT Message-Id: <202105201410.14KEAfYF039029@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: cf60931c32d7 - stable/13 - fork: Suspend other threads if both RFPROC and RFMEM are not set MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cf60931c32d7c5401c69ff0081e049a100673444 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 14:10:43 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=cf60931c32d7c5401c69ff0081e049a100673444 commit cf60931c32d7c5401c69ff0081e049a100673444 Author: Mark Johnston AuthorDate: 2021-05-13 12:33:23 +0000 Commit: Mark Johnston CommitDate: 2021-05-20 13:16:47 +0000 fork: Suspend other threads if both RFPROC and RFMEM are not set Otherwise, a multithreaded parent process may trigger races in vm_forkproc() if one thread calls rfork() with RFMEM set and another calls rfork() without RFMEM. Also simplify vm_forkproc() a bit, vmspace_unshare() already checks to see if the address space is shared. Reported by: syzbot+0aa7c2bec74c4066c36f@syzkaller.appspotmail.com Reported by: syzbot+ea84cb06937afeae609d@syzkaller.appspotmail.com Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30220 (cherry picked from commit 9246b3090cbc82c54350391601b9acef2aa9a625) --- sys/kern/kern_fork.c | 13 +++++++++---- sys/vm/vm_glue.c | 8 +++----- sys/vm/vm_map.c | 4 ++++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 2a092b192878..0d0659b432fe 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -313,8 +313,13 @@ fork_norfproc(struct thread *td, int flags) ("fork_norfproc called with RFPROC set")); p1 = td->td_proc; - if (((p1->p_flag & (P_HADTHREADS|P_SYSTEM)) == P_HADTHREADS) && - (flags & (RFCFDG | RFFDG))) { + /* + * Quiesce other threads if necessary. If RFMEM is not specified we + * must ensure that other threads do not concurrently create a second + * process sharing the vmspace, see vmspace_unshare(). + */ + if ((p1->p_flag & (P_HADTHREADS | P_SYSTEM)) == P_HADTHREADS && + ((flags & (RFCFDG | RFFDG)) != 0 || (flags & RFMEM) == 0)) { PROC_LOCK(p1); if (thread_single(p1, SINGLE_BOUNDARY)) { PROC_UNLOCK(p1); @@ -350,8 +355,8 @@ fork_norfproc(struct thread *td, int flags) } fail: - if (((p1->p_flag & (P_HADTHREADS|P_SYSTEM)) == P_HADTHREADS) && - (flags & (RFCFDG | RFFDG))) { + if ((p1->p_flag & (P_HADTHREADS | P_SYSTEM)) == P_HADTHREADS && + ((flags & (RFCFDG | RFFDG)) != 0 || (flags & RFMEM) == 0)) { PROC_LOCK(p1); thread_single_end(p1, SINGLE_BOUNDARY); PROC_UNLOCK(p1); diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index a2500828eae4..be741fd40199 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -550,11 +550,9 @@ vm_forkproc(struct thread *td, struct proc *p2, struct thread *td2, * COW locally. */ if ((flags & RFMEM) == 0) { - if (refcount_load(&p1->p_vmspace->vm_refcnt) > 1) { - error = vmspace_unshare(p1); - if (error) - return (error); - } + error = vmspace_unshare(p1); + if (error) + return (error); } cpu_fork(td, p2, td2, flags); return (0); diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index b3288fce5114..f17342b2a545 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -4896,6 +4896,10 @@ vmspace_unshare(struct proc *p) struct vmspace *newvmspace; vm_ooffset_t fork_charge; + /* + * The caller is responsible for ensuring that the reference count + * cannot concurrently transition 1 -> 2. + */ if (refcount_load(&oldvmspace->vm_refcnt) == 1) return (0); fork_charge = 0; From owner-dev-commits-src-branches@freebsd.org Thu May 20 14:10:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 E638C63FC9D; Thu, 20 May 2021 14:10:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmBTq4xPdz3Lyx; Thu, 20 May 2021 14:10:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21C642765A; Thu, 20 May 2021 14:10:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14KEAdFH038988; Thu, 20 May 2021 14:10:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KEAdcN038987; Thu, 20 May 2021 14:10:39 GMT (envelope-from git) Date: Thu, 20 May 2021 14:10:39 GMT Message-Id: <202105201410.14KEAdcN038987@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: b98b323813f0 - stable/13 - sort: Hook NetBSD tests up to the build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b98b323813f0b05bcac913c3ceb3e059fd3c8af9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 14:10:40 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b98b323813f0b05bcac913c3ceb3e059fd3c8af9 commit b98b323813f0b05bcac913c3ceb3e059fd3c8af9 Author: Mark Johnston AuthorDate: 2021-05-13 12:57:26 +0000 Commit: Mark Johnston CommitDate: 2021-05-20 13:15:49 +0000 sort: Hook NetBSD tests up to the build Sponsored by: The FreeBSD Foundation (cherry picked from commit 186ba88a7c1f2bea14eb3fb092671e8367f7187f) --- etc/mtree/BSD.tests.dist | 2 ++ usr.bin/sort/Makefile | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index 3d50a1943ce4..a38e6ce04b84 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -1056,6 +1056,8 @@ .. soelim .. + sort + .. stat .. tail diff --git a/usr.bin/sort/Makefile b/usr.bin/sort/Makefile index 41feec2bdee0..d38e036b90c0 100644 --- a/usr.bin/sort/Makefile +++ b/usr.bin/sort/Makefile @@ -32,7 +32,7 @@ CFLAGS+= -DWITHOUT_NLS MAN_SUB+= -e 's|%%NLS%%|\.\\"|g' .endif -#HAS_TESTS= -#SUBDIR.${MK_TESTS}+= tests +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include From owner-dev-commits-src-branches@freebsd.org Thu May 20 22:54:25 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 EEB9D64AD40; Thu, 20 May 2021 22:54:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmQ696C2dz3hqb; Thu, 20 May 2021 22:54:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD33D2E891; Thu, 20 May 2021 22:54:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14KMsPUU033291; Thu, 20 May 2021 22:54:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KMsPOk033290; Thu, 20 May 2021 22:54:25 GMT (envelope-from git) Date: Thu, 20 May 2021 22:54:25 GMT Message-Id: <202105202254.14KMsPOk033290@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: c910e015ba8b - stable/13 - Correct assert added to dump program. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c910e015ba8b88bb3dd853f72fb8eeb87dfb9309 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 22:54:26 -0000 The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=c910e015ba8b88bb3dd853f72fb8eeb87dfb9309 commit c910e015ba8b88bb3dd853f72fb8eeb87dfb9309 Author: Kirk McKusick AuthorDate: 2021-05-17 23:33:59 +0000 Commit: Kirk McKusick CommitDate: 2021-05-20 22:57:37 +0000 Correct assert added to dump program. (cherry picked from commit efe145a7453e4208f032816ce3f80e9fb6b0e4ee) --- sbin/dump/traverse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/dump/traverse.c b/sbin/dump/traverse.c index d094a08a7eb0..3630d2240f58 100644 --- a/sbin/dump/traverse.c +++ b/sbin/dump/traverse.c @@ -756,7 +756,7 @@ appendextdata(union dinode *dp) * data by the writeextdata() routine. */ tbperdb = sblock->fs_bsize >> tp_bshift; - assert(spcl.c_count + blks < TP_NINDIR); + assert(spcl.c_count + blks <= TP_NINDIR); for (i = 0; i < blks; i++) if (&dp->dp2.di_extb[i / tbperdb] != 0) spcl.c_addr[spcl.c_count + i] = 1; From owner-dev-commits-src-branches@freebsd.org Thu May 20 22:57:34 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 440C464AD60; Thu, 20 May 2021 22:57:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmQ9p1FXZz3j8j; Thu, 20 May 2021 22:57:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A2912E892; Thu, 20 May 2021 22:57:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14KMvXNf033618; Thu, 20 May 2021 22:57:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KMvXF5033617; Thu, 20 May 2021 22:57:33 GMT (envelope-from git) Date: Thu, 20 May 2021 22:57:33 GMT Message-Id: <202105202257.14KMvXF5033617@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: 8ab4e1b95122 - stable/12 - Correct assert added to dump program. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 8ab4e1b951228f2a1ade693f72339b4c483afe26 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 22:57:34 -0000 The branch stable/12 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=8ab4e1b951228f2a1ade693f72339b4c483afe26 commit 8ab4e1b951228f2a1ade693f72339b4c483afe26 Author: Kirk McKusick AuthorDate: 2021-05-17 23:33:59 +0000 Commit: Kirk McKusick CommitDate: 2021-05-20 23:00:57 +0000 Correct assert added to dump program. (cherry picked from commit efe145a7453e4208f032816ce3f80e9fb6b0e4ee) --- sbin/dump/traverse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/dump/traverse.c b/sbin/dump/traverse.c index 46f7e8a854a8..eb264306dce7 100644 --- a/sbin/dump/traverse.c +++ b/sbin/dump/traverse.c @@ -756,7 +756,7 @@ appendextdata(union dinode *dp) * data by the writeextdata() routine. */ tbperdb = sblock->fs_bsize >> tp_bshift; - assert(spcl.c_count + blks < TP_NINDIR); + assert(spcl.c_count + blks <= TP_NINDIR); for (i = 0; i < blks; i++) if (&dp->dp2.di_extb[i / tbperdb] != 0) spcl.c_addr[spcl.c_count + i] = 1; From owner-dev-commits-src-branches@freebsd.org Fri May 21 01:00:35 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 B766064CCC4; Fri, 21 May 2021 01:00:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmSvl4mrdz3rhs; Fri, 21 May 2021 01:00:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C0372FEB1; Fri, 21 May 2021 01:00:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14L10ZSe000633; Fri, 21 May 2021 01:00:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14L10ZCe000632; Fri, 21 May 2021 01:00:35 GMT (envelope-from git) Date: Fri, 21 May 2021 01:00:35 GMT Message-Id: <202105210100.14L10ZCe000632@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Colin Percival Subject: git: 3099792c874d - stable/13 - MFC fixes to hostuuid handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3099792c874dee0645672c7609d3db1373d9e5a4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 01:00:35 -0000 The branch stable/13 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=3099792c874dee0645672c7609d3db1373d9e5a4 commit 3099792c874dee0645672c7609d3db1373d9e5a4 Author: Colin Percival AuthorDate: 2021-05-15 05:57:38 +0000 Commit: Colin Percival CommitDate: 2021-05-21 00:57:15 +0000 MFC fixes to hostuuid handling 330f110b: Fix 'hostuuid: preload data malformed' warning If the preloaded hostuuid value is invalid and verbose booting is enabled, a warning is printed. This printf had two bugs: 1. It was missing a trailing \n character. 2. The malformed UUID is printed with %s even though it is not known to be NUL-terminated. This commit adds the missing \n and uses %.*s with the (already known) length of the preloaded UUID to ensure that we don't read past the end of the buffer. Reported by: kevans Fixes: c3188289 Preload hostuuid for early-boot use b6be9566: Fix buffer overflow in preloaded hostuuid cleaning When a module of type "hostuuid" is provided by the loader, prison0_init strips any trailing whitespace and ASCII control characters by (a) adjusting the buffer length, and (b) zeroing out the characters in question, before storing it as the system's hostuuid. The buffer length adjustment was correct, but the zeroing overwrote one byte higher in memory than intended -- in the typical case, zeroing one byte past the end of the hostuuid buffer. Due to the layout of buffers passed by the boot loader to the kernel, this will be the first byte of a subsequent buffer. This was *probably* harmless; prison0_init runs after preloaded kernel modules have been linked and after the preloaded /boot/entropy cache has been processed, so in both cases having the first byte overwritten will not cause problems. We cannot however rule out the possibility that other objects which are preloaded by the loader could suffer from having the first byte overwritten. Since the zeroing does not in fact serve any purpose, remove it and trim trailing whitespace and ASCII control characters by adjusting the buffer length alone. Fixes: c3188289 Preload hostuuid for early-boot use Reviewed by: kevans, markj (cherry picked from commit 330f110bf1e420dc8d8ddadc4030e0ae1f1c52bd) (cherry picked from commit b6be9566d236f83ad1a44170a64b9a34e382eafa) --- sys/kern/kern_jail.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index b5c8f6ebf9be..303e31490eb1 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -257,14 +257,14 @@ prison0_init(void) * non-printable characters to be safe. */ while (size > 0 && data[size - 1] <= 0x20) { - data[size--] = '\0'; + size--; } if (validate_uuid(data, size, NULL, 0) == 0) { (void)strlcpy(prison0.pr_hostuuid, data, size + 1); } else if (bootverbose) { - printf("hostuuid: preload data malformed: '%s'", - data); + printf("hostuuid: preload data malformed: '%.*s'\n", + (int)size, data); } } } From owner-dev-commits-src-branches@freebsd.org Fri May 21 10:28:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 B40DC65685E; Fri, 21 May 2021 10:28:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmjWC4dJmz3tVJ; Fri, 21 May 2021 10:28:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88567754B; Fri, 21 May 2021 10:28:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14LASdN9051231; Fri, 21 May 2021 10:28:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LASdQA051230; Fri, 21 May 2021 10:28:39 GMT (envelope-from git) Date: Fri, 21 May 2021 10:28:39 GMT Message-Id: <202105211028.14LASdQA051230@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: d7d4592ada54 - stable/13 - PCI hot-plug: use dedicated taskqueue for device attach / detach MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d7d4592ada54a4babcb9336d518929168539b515 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 10:28:39 -0000 The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=d7d4592ada54a4babcb9336d518929168539b515 commit d7d4592ada54a4babcb9336d518929168539b515 Author: Andriy Gapon AuthorDate: 2021-05-06 18:49:37 +0000 Commit: Andriy Gapon CommitDate: 2021-05-21 10:28:06 +0000 PCI hot-plug: use dedicated taskqueue for device attach / detach Attaching and detaching devices can be heavy-weight and detaching can sleep waiting for events. For that reason using the system-wide single-threaded taskqueue_thread is not really appropriate. There is even a possibility for a deadlock if taskqueue_thread is used for detaching. In fact, there is an easy to reproduce deadlock involving nvme, pass and a sudden removal of an NVMe device. A pass peripheral would not release a reference on an nvme sim until pass_shutdown_kqueue() is executed via taskqueue_thread. But the taskqueue's thread is blocked in nvme_detach() -> ... -> cam_sim_free() because of the outstanding reference. Sponsored by: CyberSecure Reviewed by: mav, imp (cherry picked from commit 12588ce02dd835b332952d9fece5881d943554a9) --- sys/dev/pci/pci_pci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c index 3a11d59f51fd..d6fbb06a61ac 100644 --- a/sys/dev/pci/pci_pci.c +++ b/sys/dev/pci/pci_pci.c @@ -925,6 +925,8 @@ SYSCTL_INT(_hw_pci, OID_AUTO, enable_pcie_hp, CTLFLAG_RDTUN, &pci_enable_pcie_hp, 0, "Enable support for native PCI-express HotPlug."); +TASKQUEUE_DEFINE_THREAD(pci_hp); + static void pcib_probe_hotplug(struct pcib_softc *sc) { @@ -1154,7 +1156,7 @@ pcib_pcie_hotplug_update(struct pcib_softc *sc, uint16_t val, uint16_t mask, */ if (schedule_task && (pcib_hotplug_present(sc) != 0) != (sc->child != NULL)) - taskqueue_enqueue(taskqueue_thread, &sc->pcie_hp_task); + taskqueue_enqueue(taskqueue_pci_hp, &sc->pcie_hp_task); } static void @@ -1449,7 +1451,7 @@ pcib_detach_hotplug(struct pcib_softc *sc) error = pcib_release_pcie_irq(sc); if (error) return (error); - taskqueue_drain(taskqueue_thread, &sc->pcie_hp_task); + taskqueue_drain(taskqueue_pci_hp, &sc->pcie_hp_task); callout_drain(&sc->pcie_ab_timer); callout_drain(&sc->pcie_cc_timer); callout_drain(&sc->pcie_dll_timer); From owner-dev-commits-src-branches@freebsd.org Fri May 21 10:30:02 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 040EE656C19; Fri, 21 May 2021 10:30:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmjXn6m8hz3tVc; Fri, 21 May 2021 10:30:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C653D77D8; Fri, 21 May 2021 10:30:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14LAU1H3053150; Fri, 21 May 2021 10:30:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LAU1Id053148; Fri, 21 May 2021 10:30:01 GMT (envelope-from git) Date: Fri, 21 May 2021 10:30:01 GMT Message-Id: <202105211030.14LAU1Id053148@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: 395bc3598b47 - stable/13 - mpsutil: extend show adapter information, add NCQ control MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 395bc3598b47ef270d17beae778830e134814fbe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 10:30:02 -0000 The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=395bc3598b47ef270d17beae778830e134814fbe commit 395bc3598b47ef270d17beae778830e134814fbe Author: Daniel Austin AuthorDate: 2021-05-07 11:41:53 +0000 Commit: Andriy Gapon CommitDate: 2021-05-21 10:29:17 +0000 mpsutil: extend show adapter information, add NCQ control 'show adapter' now shows PCIe width and speed, IOC Speed, and the temperature of the controller. A new command, 'set ncq', is added. It enables or disables SATA NCQ in the NVRAM of the card. Its current setting is added to 'show adapter' as well. PR: 254841 MFC after: 2 weeks Relnotes: perhaps (cherry picked from commit e2ea6942ab316d4cd5c2fef73ab28dc974b8dc51) --- usr.sbin/mpsutil/Makefile | 2 +- usr.sbin/mpsutil/mps_set.c | 129 ++++++++++++++++++++++++++++++++++++++++++++ usr.sbin/mpsutil/mps_show.c | 34 ++++++++++++ usr.sbin/mpsutil/mpsutil.8 | 8 ++- 4 files changed, 171 insertions(+), 2 deletions(-) diff --git a/usr.sbin/mpsutil/Makefile b/usr.sbin/mpsutil/Makefile index dd99f5814565..0bc981366650 100644 --- a/usr.sbin/mpsutil/Makefile +++ b/usr.sbin/mpsutil/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ PROG= mpsutil -SRCS= mps_cmd.c mps_debug.c mps_flash.c mps_show.c mps_slot.c mpsutil.c +SRCS= mps_cmd.c mps_debug.c mps_flash.c mps_set.c mps_show.c mps_slot.c mpsutil.c MAN= mpsutil.8 WARNS?= 3 diff --git a/usr.sbin/mpsutil/mps_set.c b/usr.sbin/mpsutil/mps_set.c new file mode 100644 index 000000000000..91e4d23ab78d --- /dev/null +++ b/usr.sbin/mpsutil/mps_set.c @@ -0,0 +1,129 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Daniel Austin + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__RCSID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include "mpsutil.h" + +static int set_ncq(int ac, char **av); + +MPS_TABLE(top, set); + +static int +set_ncq(int ac, char **av) +{ + MPI2_CONFIG_PAGE_HEADER header; + MPI2_CONFIG_PAGE_IO_UNIT_1 *iounit1; + MPI2_CONFIG_REQUEST req; + MPI2_CONFIG_REPLY reply; + int error, fd; + + bzero(&req, sizeof(req)); + bzero(&header, sizeof(header)); + bzero(&reply, sizeof(reply)); + + fd = mps_open(mps_unit); + if (fd < 0) { + error = errno; + warn("mps_open"); + return (error); + } + + error = mps_read_config_page_header(fd, MPI2_CONFIG_PAGETYPE_IO_UNIT, 1, 0, + &header, NULL); + if (error) { + error = errno; + warn("Failed to get IOUNIT page 1 header"); + return (error); + } + + iounit1 = mps_read_config_page(fd, MPI2_CONFIG_PAGETYPE_IO_UNIT, 1, 0, NULL); + if (iounit1 == NULL) { + error = errno; + warn("Failed to get IOUNIT page 1 info"); + return (error); + } + + if (ac == 1) { + /* just show current setting */ + printf("SATA Native Command Queueing is currently: %s\n", + ((iounit1->Flags & MPI2_IOUNITPAGE1_NATIVE_COMMAND_Q_DISABLE) == 0) ? + "ENABLED" : "DISABLED"); + } else if (ac == 2) { + if (!strcasecmp(av[1], "enable") || !strcmp(av[1], "1")) { + iounit1->Flags &= ~MPI2_IOUNITPAGE1_NATIVE_COMMAND_Q_DISABLE; + } else if (!strcasecmp(av[1], "disable") || !strcmp(av[1], "0")) { + iounit1->Flags |= MPI2_IOUNITPAGE1_NATIVE_COMMAND_Q_DISABLE; + } else { + free(iounit1); + error = EINVAL; + warn("set ncq: Only 'enable' and 'disable' allowed."); + return (EINVAL); + } + req.Function = MPI2_FUNCTION_CONFIG; + req.Action = MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT; + req.ExtPageLength = 0; + req.ExtPageType = 0; + req.Header = header; + req.PageAddress = 0; + if (mps_pass_command(fd, &req, sizeof(req) - sizeof(req.PageBufferSGE), &reply, sizeof(reply), + NULL, 0, iounit1, sizeof(iounit1), 30) != 0) { + free(iounit1); + error = errno; + warn("Failed to update config page"); + return (error); + } + if (!IOC_STATUS_SUCCESS(reply.IOCStatus)) { + free(iounit1); + error = errno; + warn("%s", mps_ioc_status(reply.IOCStatus)); + return (error); + } + printf("NCQ setting accepted. It may not take effect until the controller is reset.\n"); + } else { + free(iounit1); + errno = EINVAL; + warn("set ncq: too many arguments"); + return (EINVAL); + } + free(iounit1); + + close(fd); + return (0); +} + +MPS_COMMAND(set, ncq, set_ncq, "[enable|disable]", "set SATA NCQ function") + diff --git a/usr.sbin/mpsutil/mps_show.c b/usr.sbin/mpsutil/mps_show.c index 620bb5e27f89..7c2596497818 100644 --- a/usr.sbin/mpsutil/mps_show.c +++ b/usr.sbin/mpsutil/mps_show.c @@ -59,12 +59,18 @@ MPS_TABLE(top, show); static int show_adapter(int ac, char **av) { + const char* pcie_speed[] = { "2.5", "5.0", "8.0" }; + const char* temp_units[] = { "", "F", "C" }; + const char* ioc_speeds[] = { "", "Full", "Half", "Quarter", "Eighth" }; + MPI2_CONFIG_PAGE_SASIOUNIT_0 *sas0; MPI2_CONFIG_PAGE_SASIOUNIT_1 *sas1; MPI2_SAS_IO_UNIT0_PHY_DATA *phy0; MPI2_SAS_IO_UNIT1_PHY_DATA *phy1; MPI2_CONFIG_PAGE_MAN_0 *man0; MPI2_CONFIG_PAGE_BIOS_3 *bios3; + MPI2_CONFIG_PAGE_IO_UNIT_1 *iounit1; + MPI2_CONFIG_PAGE_IO_UNIT_7 *iounit7; MPI2_IOC_FACTS_REPLY *facts; U16 IOCStatus; char *speed, *minspeed, *maxspeed, *isdisabled, *type; @@ -126,6 +132,34 @@ show_adapter(int ac, char **av) ? "yes" : "no"); free(facts); + iounit1 = mps_read_config_page(fd, MPI2_CONFIG_PAGETYPE_IO_UNIT, 1, 0, NULL); + if (iounit1 == NULL) { + error = errno; + warn("Failed to get IOUNIT page 1 info"); + return (error); + } + printf(" SATA NCQ: %s\n", + ((iounit1->Flags & MPI2_IOUNITPAGE1_NATIVE_COMMAND_Q_DISABLE) == 0) ? + "ENABLED" : "DISABLED"); + free(iounit1); + + iounit7 = mps_read_config_page(fd, MPI2_CONFIG_PAGETYPE_IO_UNIT, 7, 0, NULL); + if (iounit7 == NULL) { + error = errno; + warn("Failed to get IOUNIT page 7 info"); + return (error); + } + printf(" PCIe Width/Speed: x%d (%s GB/sec)\n", iounit7->PCIeWidth, + pcie_speed[iounit7->PCIeSpeed]); + printf(" IOC Speed: %s\n", ioc_speeds[iounit7->IOCSpeed]); + printf(" Temperature: "); + if (iounit7->IOCTemperatureUnits == MPI2_IOUNITPAGE7_IOC_TEMP_NOT_PRESENT) + printf("Unknown/Unsupported\n"); + else + printf("%d %s\n", iounit7->IOCTemperature, + temp_units[iounit7->IOCTemperatureUnits]); + free(iounit7); + fd = mps_open(mps_unit); if (fd < 0) { error = errno; diff --git a/usr.sbin/mpsutil/mpsutil.8 b/usr.sbin/mpsutil/mpsutil.8 index 1bb7c4d5eaec..e7c2fda8f84e 100644 --- a/usr.sbin/mpsutil/mpsutil.8 +++ b/usr.sbin/mpsutil/mpsutil.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 25, 2021 +.Dd May 7, 2021 .Dt MPSUTIL 8 .Os .Sh NAME @@ -62,6 +62,10 @@ .Cm show iocfacts .Nm .Op Fl u Ar unit +.Cm set ncq +.Op Ar enable Ns | Ns Ar disable +.Nm +.Op Fl u Ar unit .Cm flash save .Op Ar firmware Ns | Ns Ar bios .Op Ar file @@ -134,6 +138,8 @@ Dump raw config page in hex. .Pp Controller management commands include: .Bl -tag -width indent +.It Cm set ncq Oo Ar enable Ns | Ns Ar disable Oc +Enables or disables NCQ in the NVRAM of the card. .It Cm flash save Oo Ar firmware Ns | Ns Ar bios Oc Op Ar file Save the .Ar firmware From owner-dev-commits-src-branches@freebsd.org Fri May 21 10:31:27 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 9D4776567E9; Fri, 21 May 2021 10:31:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmjZR0v9fz3vMG; Fri, 21 May 2021 10:31:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F4047A2C; Fri, 21 May 2021 10:31:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14LAVQZ0063149; Fri, 21 May 2021 10:31:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LAVQYo063148; Fri, 21 May 2021 10:31:26 GMT (envelope-from git) Date: Fri, 21 May 2021 10:31:26 GMT Message-Id: <202105211031.14LAVQYo063148@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: 2def2de60a6d - stable/12 - PCI hot-plug: use dedicated taskqueue for device attach / detach MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2def2de60a6d0b979964bb67c5ff0e24d098e4a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 10:31:27 -0000 The branch stable/12 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=2def2de60a6d0b979964bb67c5ff0e24d098e4a9 commit 2def2de60a6d0b979964bb67c5ff0e24d098e4a9 Author: Andriy Gapon AuthorDate: 2021-05-06 18:49:37 +0000 Commit: Andriy Gapon CommitDate: 2021-05-21 10:31:04 +0000 PCI hot-plug: use dedicated taskqueue for device attach / detach Attaching and detaching devices can be heavy-weight and detaching can sleep waiting for events. For that reason using the system-wide single-threaded taskqueue_thread is not really appropriate. There is even a possibility for a deadlock if taskqueue_thread is used for detaching. In fact, there is an easy to reproduce deadlock involving nvme, pass and a sudden removal of an NVMe device. A pass peripheral would not release a reference on an nvme sim until pass_shutdown_kqueue() is executed via taskqueue_thread. But the taskqueue's thread is blocked in nvme_detach() -> ... -> cam_sim_free() because of the outstanding reference. Sponsored by: CyberSecure Reviewed by: mav, imp (cherry picked from commit 12588ce02dd835b332952d9fece5881d943554a9) --- sys/dev/pci/pci_pci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c index ff3dcdc84c47..4b7560f499ef 100644 --- a/sys/dev/pci/pci_pci.c +++ b/sys/dev/pci/pci_pci.c @@ -922,6 +922,8 @@ SYSCTL_INT(_hw_pci, OID_AUTO, enable_pcie_hp, CTLFLAG_RDTUN, &pci_enable_pcie_hp, 0, "Enable support for native PCI-express HotPlug."); +TASKQUEUE_DEFINE_THREAD(pci_hp); + static void pcib_probe_hotplug(struct pcib_softc *sc) { @@ -1151,7 +1153,7 @@ pcib_pcie_hotplug_update(struct pcib_softc *sc, uint16_t val, uint16_t mask, */ if (schedule_task && (pcib_hotplug_present(sc) != 0) != (sc->child != NULL)) - taskqueue_enqueue(taskqueue_thread, &sc->pcie_hp_task); + taskqueue_enqueue(taskqueue_pci_hp, &sc->pcie_hp_task); } static void @@ -1443,7 +1445,7 @@ pcib_detach_hotplug(struct pcib_softc *sc) error = pcib_release_pcie_irq(sc); if (error) return (error); - taskqueue_drain(taskqueue_thread, &sc->pcie_hp_task); + taskqueue_drain(taskqueue_pci_hp, &sc->pcie_hp_task); callout_drain(&sc->pcie_ab_timer); callout_drain(&sc->pcie_cc_timer); callout_drain(&sc->pcie_dll_timer); From owner-dev-commits-src-branches@freebsd.org Fri May 21 10:32:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 649E16567FA; Fri, 21 May 2021 10:32:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fmjbn0g2Zz3wMd; Fri, 21 May 2021 10:32:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E19B87D70; Fri, 21 May 2021 10:32:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14LAWaAU064042; Fri, 21 May 2021 10:32:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LAWaBP064041; Fri, 21 May 2021 10:32:36 GMT (envelope-from git) Date: Fri, 21 May 2021 10:32:36 GMT Message-Id: <202105211032.14LAWaBP064041@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: 4a7dcb174ce8 - stable/13 - storvsc: fix auto-sense reporting MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4a7dcb174ce87c1e771486eb956ef697914fcc44 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 10:32:37 -0000 The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=4a7dcb174ce87c1e771486eb956ef697914fcc44 commit 4a7dcb174ce87c1e771486eb956ef697914fcc44 Author: Andriy Gapon AuthorDate: 2021-05-07 07:17:57 +0000 Commit: Andriy Gapon CommitDate: 2021-05-21 10:32:13 +0000 storvsc: fix auto-sense reporting I saw a situation where the driver set CAM_AUTOSNS_VALID on a failed ccb even though SRB_STATUS_AUTOSENSE_VALID was not set in the status. The actual sense data remained all zeros. The problem seems to be that create_storvsc_request() always sets hv_storvsc_request::sense_info_len, so checking for sense_info_len != 0 is not enough to determine if any auto-sense data is actually available. Sponsored by: CyberSecure (cherry picked from commit 8afecefd57c5ac95200f43227cd00f265154acee) --- sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c index 968de9d14e7b..702308e26a1d 100644 --- a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c +++ b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c @@ -2406,7 +2406,8 @@ storvsc_io_done(struct hv_storvsc_request *reqp) else ccb->csio.resid = ccb->csio.dxfer_len; - if (reqp->sense_info_len != 0) { + if ((vm_srb->srb_status & SRB_STATUS_AUTOSENSE_VALID) != 0 && + reqp->sense_info_len != 0) { csio->sense_resid = csio->sense_len - reqp->sense_info_len; ccb->ccb_h.status |= CAM_AUTOSNS_VALID; } From owner-dev-commits-src-branches@freebsd.org Fri May 21 12:46:28 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 70DD263182A; Fri, 21 May 2021 12:46:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmmZD2Y66z4TjH; Fri, 21 May 2021 12:46:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36D5D1117C; Fri, 21 May 2021 12:46:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14LCkSe7037729; Fri, 21 May 2021 12:46:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LCkS3Q037728; Fri, 21 May 2021 12:46:28 GMT (envelope-from git) Date: Fri, 21 May 2021 12:46:28 GMT Message-Id: <202105211246.14LCkS3Q037728@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 347ae5f3457b - stable/13 - kqueue timer: Remove detached knotes from the process stop queue MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 347ae5f3457bfe316aa2fb3c27dd7f431da6e45a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 12:46:28 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=347ae5f3457bfe316aa2fb3c27dd7f431da6e45a commit 347ae5f3457bfe316aa2fb3c27dd7f431da6e45a Author: Mark Johnston AuthorDate: 2021-05-14 14:07:56 +0000 Commit: Mark Johnston CommitDate: 2021-05-21 12:45:34 +0000 kqueue timer: Remove detached knotes from the process stop queue There are some scenarios where a timer event may be detached when it is on the process' kqueue timer stop queue. If kqtimer_proc_continue() is called after that point, it will iterate over the queue and access freed timer structures. It is also possible, at least in a multithreaded program, for a stopped timer event to be scheduled without removing it from the process' stop queue. Ensure that we do not doubly enqueue the event structure in this case. Reported by: syzbot+cea0931bb4e34cd728bd@syzkaller.appspotmail.com Reported by: syzbot+9e1a2f3734652015998c@syzkaller.appspotmail.com Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30251 (cherry picked from commit 2cca77ee01343bf080f1b70f0217a84c200fe7c1) --- sys/kern/kern_event.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 03f4b3afbc28..6b8ab11cb2dc 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -680,11 +680,14 @@ struct kq_timer_cb_data { struct proc *p; struct knote *kn; int cpuid; + int flags; TAILQ_ENTRY(kq_timer_cb_data) link; sbintime_t next; /* next timer event fires at */ sbintime_t to; /* precalculated timer period, 0 for abs */ }; +#define KQ_TIMER_CB_ENQUEUED 0x01 + static void kqtimer_sched_callout(struct kq_timer_cb_data *kc) { @@ -706,6 +709,7 @@ kqtimer_proc_continue(struct proc *p) TAILQ_FOREACH_SAFE(kc, &p->p_kqtim_stop, link, kc1) { TAILQ_REMOVE(&p->p_kqtim_stop, kc, link); + kc->flags &= ~KQ_TIMER_CB_ENQUEUED; if (kc->next <= now) filt_timerexpire_l(kc->kn, true); else @@ -753,7 +757,10 @@ filt_timerexpire_l(struct knote *kn, bool proc_locked) if (!proc_locked) PROC_LOCK(p); if (P_SHOULDSTOP(p) || P_KILLED(p)) { - TAILQ_INSERT_TAIL(&p->p_kqtim_stop, kc, link); + if ((kc->flags & KQ_TIMER_CB_ENQUEUED) == 0) { + kc->flags |= KQ_TIMER_CB_ENQUEUED; + TAILQ_INSERT_TAIL(&p->p_kqtim_stop, kc, link); + } if (!proc_locked) PROC_UNLOCK(p); return; @@ -826,6 +833,7 @@ filt_timerattach(struct knote *kn) kc->kn = kn; kc->p = curproc; kc->cpuid = PCPU_GET(cpuid); + kc->flags = 0; callout_init(&kc->c, 1); filt_timerstart(kn, to); @@ -856,6 +864,11 @@ filt_timerdetach(struct knote *kn) kc = kn->kn_ptr.p_v; callout_drain(&kc->c); + if ((kc->flags & KQ_TIMER_CB_ENQUEUED) != 0) { + PROC_LOCK(kc->p); + TAILQ_REMOVE(&kc->p->p_kqtim_stop, kc, link); + PROC_UNLOCK(kc->p); + } free(kc, M_KQUEUE); old = atomic_fetchadd_int(&kq_ncallouts, -1); KASSERT(old > 0, ("Number of callouts cannot become negative")); From owner-dev-commits-src-branches@freebsd.org Fri May 21 13:45:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 EF633632DF5; Fri, 21 May 2021 13:45:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fmnsm6MDrz3CkF; Fri, 21 May 2021 13:45:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF15A125D1; Fri, 21 May 2021 13:45:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14LDj0UC018148; Fri, 21 May 2021 13:45:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LDj0vu018147; Fri, 21 May 2021 13:45:00 GMT (envelope-from git) Date: Fri, 21 May 2021 13:45:00 GMT Message-Id: <202105211345.14LDj0vu018147@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: 4b9d54e2aeca - stable/12 - mpsutil: extend show adapter information, add NCQ control MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4b9d54e2aeca7435698bd37a2d99416acb23c9b5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 13:45:01 -0000 The branch stable/12 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=4b9d54e2aeca7435698bd37a2d99416acb23c9b5 commit 4b9d54e2aeca7435698bd37a2d99416acb23c9b5 Author: Daniel Austin AuthorDate: 2021-05-07 11:41:53 +0000 Commit: Andriy Gapon CommitDate: 2021-05-21 10:32:35 +0000 mpsutil: extend show adapter information, add NCQ control 'show adapter' now shows PCIe width and speed, IOC Speed, and the temperature of the controller. A new command, 'set ncq', is added. It enables or disables SATA NCQ in the NVRAM of the card. Its current setting is added to 'show adapter' as well. PR: 254841 Relnotes: perhaps (cherry picked from commit e2ea6942ab316d4cd5c2fef73ab28dc974b8dc51) --- usr.sbin/mpsutil/Makefile | 2 +- usr.sbin/mpsutil/mps_set.c | 129 ++++++++++++++++++++++++++++++++++++++++++++ usr.sbin/mpsutil/mps_show.c | 34 ++++++++++++ usr.sbin/mpsutil/mpsutil.8 | 8 ++- 4 files changed, 171 insertions(+), 2 deletions(-) diff --git a/usr.sbin/mpsutil/Makefile b/usr.sbin/mpsutil/Makefile index dd99f5814565..0bc981366650 100644 --- a/usr.sbin/mpsutil/Makefile +++ b/usr.sbin/mpsutil/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ PROG= mpsutil -SRCS= mps_cmd.c mps_debug.c mps_flash.c mps_show.c mps_slot.c mpsutil.c +SRCS= mps_cmd.c mps_debug.c mps_flash.c mps_set.c mps_show.c mps_slot.c mpsutil.c MAN= mpsutil.8 WARNS?= 3 diff --git a/usr.sbin/mpsutil/mps_set.c b/usr.sbin/mpsutil/mps_set.c new file mode 100644 index 000000000000..91e4d23ab78d --- /dev/null +++ b/usr.sbin/mpsutil/mps_set.c @@ -0,0 +1,129 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Daniel Austin + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__RCSID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include "mpsutil.h" + +static int set_ncq(int ac, char **av); + +MPS_TABLE(top, set); + +static int +set_ncq(int ac, char **av) +{ + MPI2_CONFIG_PAGE_HEADER header; + MPI2_CONFIG_PAGE_IO_UNIT_1 *iounit1; + MPI2_CONFIG_REQUEST req; + MPI2_CONFIG_REPLY reply; + int error, fd; + + bzero(&req, sizeof(req)); + bzero(&header, sizeof(header)); + bzero(&reply, sizeof(reply)); + + fd = mps_open(mps_unit); + if (fd < 0) { + error = errno; + warn("mps_open"); + return (error); + } + + error = mps_read_config_page_header(fd, MPI2_CONFIG_PAGETYPE_IO_UNIT, 1, 0, + &header, NULL); + if (error) { + error = errno; + warn("Failed to get IOUNIT page 1 header"); + return (error); + } + + iounit1 = mps_read_config_page(fd, MPI2_CONFIG_PAGETYPE_IO_UNIT, 1, 0, NULL); + if (iounit1 == NULL) { + error = errno; + warn("Failed to get IOUNIT page 1 info"); + return (error); + } + + if (ac == 1) { + /* just show current setting */ + printf("SATA Native Command Queueing is currently: %s\n", + ((iounit1->Flags & MPI2_IOUNITPAGE1_NATIVE_COMMAND_Q_DISABLE) == 0) ? + "ENABLED" : "DISABLED"); + } else if (ac == 2) { + if (!strcasecmp(av[1], "enable") || !strcmp(av[1], "1")) { + iounit1->Flags &= ~MPI2_IOUNITPAGE1_NATIVE_COMMAND_Q_DISABLE; + } else if (!strcasecmp(av[1], "disable") || !strcmp(av[1], "0")) { + iounit1->Flags |= MPI2_IOUNITPAGE1_NATIVE_COMMAND_Q_DISABLE; + } else { + free(iounit1); + error = EINVAL; + warn("set ncq: Only 'enable' and 'disable' allowed."); + return (EINVAL); + } + req.Function = MPI2_FUNCTION_CONFIG; + req.Action = MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT; + req.ExtPageLength = 0; + req.ExtPageType = 0; + req.Header = header; + req.PageAddress = 0; + if (mps_pass_command(fd, &req, sizeof(req) - sizeof(req.PageBufferSGE), &reply, sizeof(reply), + NULL, 0, iounit1, sizeof(iounit1), 30) != 0) { + free(iounit1); + error = errno; + warn("Failed to update config page"); + return (error); + } + if (!IOC_STATUS_SUCCESS(reply.IOCStatus)) { + free(iounit1); + error = errno; + warn("%s", mps_ioc_status(reply.IOCStatus)); + return (error); + } + printf("NCQ setting accepted. It may not take effect until the controller is reset.\n"); + } else { + free(iounit1); + errno = EINVAL; + warn("set ncq: too many arguments"); + return (EINVAL); + } + free(iounit1); + + close(fd); + return (0); +} + +MPS_COMMAND(set, ncq, set_ncq, "[enable|disable]", "set SATA NCQ function") + diff --git a/usr.sbin/mpsutil/mps_show.c b/usr.sbin/mpsutil/mps_show.c index 57aed20a7d60..814b22ab6f69 100644 --- a/usr.sbin/mpsutil/mps_show.c +++ b/usr.sbin/mpsutil/mps_show.c @@ -58,12 +58,18 @@ MPS_TABLE(top, show); static int show_adapter(int ac, char **av) { + const char* pcie_speed[] = { "2.5", "5.0", "8.0" }; + const char* temp_units[] = { "", "F", "C" }; + const char* ioc_speeds[] = { "", "Full", "Half", "Quarter", "Eighth" }; + MPI2_CONFIG_PAGE_SASIOUNIT_0 *sas0; MPI2_CONFIG_PAGE_SASIOUNIT_1 *sas1; MPI2_SAS_IO_UNIT0_PHY_DATA *phy0; MPI2_SAS_IO_UNIT1_PHY_DATA *phy1; MPI2_CONFIG_PAGE_MAN_0 *man0; MPI2_CONFIG_PAGE_BIOS_3 *bios3; + MPI2_CONFIG_PAGE_IO_UNIT_1 *iounit1; + MPI2_CONFIG_PAGE_IO_UNIT_7 *iounit7; MPI2_IOC_FACTS_REPLY *facts; U16 IOCStatus; char *speed, *minspeed, *maxspeed, *isdisabled, *type; @@ -125,6 +131,34 @@ show_adapter(int ac, char **av) ? "yes" : "no"); free(facts); + iounit1 = mps_read_config_page(fd, MPI2_CONFIG_PAGETYPE_IO_UNIT, 1, 0, NULL); + if (iounit1 == NULL) { + error = errno; + warn("Failed to get IOUNIT page 1 info"); + return (error); + } + printf(" SATA NCQ: %s\n", + ((iounit1->Flags & MPI2_IOUNITPAGE1_NATIVE_COMMAND_Q_DISABLE) == 0) ? + "ENABLED" : "DISABLED"); + free(iounit1); + + iounit7 = mps_read_config_page(fd, MPI2_CONFIG_PAGETYPE_IO_UNIT, 7, 0, NULL); + if (iounit7 == NULL) { + error = errno; + warn("Failed to get IOUNIT page 7 info"); + return (error); + } + printf(" PCIe Width/Speed: x%d (%s GB/sec)\n", iounit7->PCIeWidth, + pcie_speed[iounit7->PCIeSpeed]); + printf(" IOC Speed: %s\n", ioc_speeds[iounit7->IOCSpeed]); + printf(" Temperature: "); + if (iounit7->IOCTemperatureUnits == MPI2_IOUNITPAGE7_IOC_TEMP_NOT_PRESENT) + printf("Unknown/Unsupported\n"); + else + printf("%d %s\n", iounit7->IOCTemperature, + temp_units[iounit7->IOCTemperatureUnits]); + free(iounit7); + fd = mps_open(mps_unit); if (fd < 0) { error = errno; diff --git a/usr.sbin/mpsutil/mpsutil.8 b/usr.sbin/mpsutil/mpsutil.8 index 1dd4f0509174..7bd6728d49de 100644 --- a/usr.sbin/mpsutil/mpsutil.8 +++ b/usr.sbin/mpsutil/mpsutil.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 25, 2021 +.Dd May 7, 2021 .Dt MPSUTIL 8 .Os .Sh NAME @@ -62,6 +62,10 @@ .Cm show iocfacts .Nm .Op Fl u Ar unit +.Cm set ncq +.Op Ar enable Ns | Ns Ar disable +.Nm +.Op Fl u Ar unit .Cm flash save .Op Ar firmware Ns | Ns Ar bios .Op Ar file @@ -134,6 +138,8 @@ Dump raw config page in hex. .Pp Controller management commands include: .Bl -tag -width indent +.It Cm set ncq Oo Ar enable Ns | Ns Ar disable Oc +Enables or disables NCQ in the NVRAM of the card. .It Cm flash save Oo Ar firmware Ns | Ns Ar bios Oc Op Ar file Save the .Ar firmware From owner-dev-commits-src-branches@freebsd.org Fri May 21 13:52:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 185E363314F; Fri, 21 May 2021 13:52:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fmp2d06XDz3H5p; Fri, 21 May 2021 13:52:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF0A4129A2; Fri, 21 May 2021 13:52:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14LDqeLn031064; Fri, 21 May 2021 13:52:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LDqeEw031063; Fri, 21 May 2021 13:52:40 GMT (envelope-from git) Date: Fri, 21 May 2021 13:52:40 GMT Message-Id: <202105211352.14LDqeEw031063@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: 9120716d91d4 - stable/12 - storvsc: fix auto-sense reporting MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 9120716d91d4d98fc7fe4833bda13e100cdd3b31 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 13:52:41 -0000 The branch stable/12 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=9120716d91d4d98fc7fe4833bda13e100cdd3b31 commit 9120716d91d4d98fc7fe4833bda13e100cdd3b31 Author: Andriy Gapon AuthorDate: 2021-05-07 07:17:57 +0000 Commit: Andriy Gapon CommitDate: 2021-05-21 13:49:54 +0000 storvsc: fix auto-sense reporting I saw a situation where the driver set CAM_AUTOSNS_VALID on a failed ccb even though SRB_STATUS_AUTOSENSE_VALID was not set in the status. The actual sense data remained all zeros. The problem seems to be that create_storvsc_request() always sets hv_storvsc_request::sense_info_len, so checking for sense_info_len != 0 is not enough to determine if any auto-sense data is actually available. Sponsored by: CyberSecure (cherry picked from commit 8afecefd57c5ac95200f43227cd00f265154acee) --- sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c index 968de9d14e7b..702308e26a1d 100644 --- a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c +++ b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c @@ -2406,7 +2406,8 @@ storvsc_io_done(struct hv_storvsc_request *reqp) else ccb->csio.resid = ccb->csio.dxfer_len; - if (reqp->sense_info_len != 0) { + if ((vm_srb->srb_status & SRB_STATUS_AUTOSENSE_VALID) != 0 && + reqp->sense_info_len != 0) { csio->sense_resid = csio->sense_len - reqp->sense_info_len; ccb->ccb_h.status |= CAM_AUTOSNS_VALID; } From owner-dev-commits-src-branches@freebsd.org Fri May 21 15:35:46 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 940496351AC; Fri, 21 May 2021 15:35:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmrKZ3j9Kz4mTf; Fri, 21 May 2021 15:35:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6209B13C67; Fri, 21 May 2021 15:35:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14LFZkhR063950; Fri, 21 May 2021 15:35:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LFZkPV063949; Fri, 21 May 2021 15:35:46 GMT (envelope-from git) Date: Fri, 21 May 2021 15:35:46 GMT Message-Id: <202105211535.14LFZkPV063949@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Robert Wing Subject: git: 942e69146ea2 - stable/13 - fstyp(8): define HAVE_ZFS macro when built with zfs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 942e69146ea242e94d1e5486c5d04a96c91e2bd3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 15:35:46 -0000 The branch stable/13 has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=942e69146ea242e94d1e5486c5d04a96c91e2bd3 commit 942e69146ea242e94d1e5486c5d04a96c91e2bd3 Author: Robert Wing AuthorDate: 2021-05-12 02:57:24 +0000 Commit: Robert Wing CommitDate: 2021-05-21 15:21:00 +0000 fstyp(8): define HAVE_ZFS macro when built with zfs The HAVE_ZFS macro was dropped from the Makefile during the OpenZFS merge, bring it back. While here, drop unused WARNS setting. PR: 255616 Reported by: Michael Büker Submitted by: Michael Büker Fixes: 9e5787d2284e187abb5b654d924394a65772e004 Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D30221 (cherry picked from commit 91f251b2ab3ade5de703756873142bfae2573753) --- usr.sbin/fstyp/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/fstyp/Makefile b/usr.sbin/fstyp/Makefile index bfdc845bba4a..14b5d9dfd9c3 100644 --- a/usr.sbin/fstyp/Makefile +++ b/usr.sbin/fstyp/Makefile @@ -28,7 +28,7 @@ SUBDIR.${MK_TESTS}+= tests .if ${MK_ZFS} != "no" IGNORE_PRAGMA= YES -WARNS?= 0 +CFLAGS+= -DHAVE_ZFS CFLAGS.zfs.c+= -DIN_BASE CFLAGS.zfs.c+= -I${SRCTOP}/sys/contrib/openzfs/include CFLAGS.zfs.c+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include From owner-dev-commits-src-branches@freebsd.org Sat May 22 01:19:34 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 C9C846405E1; Sat, 22 May 2021 01:19:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fn5HB599bz3vHB; Sat, 22 May 2021 01:19:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A0DB1B875; Sat, 22 May 2021 01:19:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M1JY3E034707; Sat, 22 May 2021 01:19:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M1JYD6034706; Sat, 22 May 2021 01:19:34 GMT (envelope-from git) Date: Sat, 22 May 2021 01:19:34 GMT Message-Id: <202105220119.14M1JYD6034706@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: b7ef4b7eb23d - stable/13 - nfscl: Add support for va_birthtime to NFSv4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b7ef4b7eb23dd88901aceb569225a79161e08e3d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 01:19:34 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=b7ef4b7eb23dd88901aceb569225a79161e08e3d commit b7ef4b7eb23dd88901aceb569225a79161e08e3d Author: Rick Macklem AuthorDate: 2021-05-08 00:30:56 +0000 Commit: Rick Macklem CommitDate: 2021-05-22 01:16:01 +0000 nfscl: Add support for va_birthtime to NFSv4 There is a NFSv4 file attribute called TimeCreate that can be used for va_birthtime. r362175 added some support for use of TimeCreate. This patch completes support of va_birthtime by adding support for setting this attribute to the server. It also eanbles the client to acquire and set the attribute for a NFSv4 server that supports the attribute. (cherry picked from commit dd02d9d605b6d8849e858d7644bb84b45c606b46) --- sys/fs/nfs/nfs_commonsubs.c | 2 ++ sys/fs/nfs/nfsproto.h | 2 ++ sys/fs/nfsclient/nfs_clcomsubs.c | 4 ++++ sys/fs/nfsclient/nfs_clport.c | 2 ++ sys/fs/nfsclient/nfs_clrpcops.c | 3 +++ sys/fs/nfsclient/nfs_clvnops.c | 5 ++++- sys/fs/nfsserver/nfs_nfsdserv.c | 9 +++++++++ 7 files changed, 26 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 539cbbbde7d2..7ddef0f19ddc 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -1248,6 +1248,8 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, nap->na_rdev = (NFSDEV_T)0; nap->na_mtime.tv_sec = 0; nap->na_mtime.tv_nsec = 0; + nap->na_btime.tv_sec = -1; + nap->na_btime.tv_nsec = 0; nap->na_gen = 0; nap->na_flags = 0; nap->na_blocksize = NFS_FABLKSIZE; diff --git a/sys/fs/nfs/nfsproto.h b/sys/fs/nfs/nfsproto.h index 236d8c14ff24..a1a992d14cdb 100644 --- a/sys/fs/nfs/nfsproto.h +++ b/sys/fs/nfs/nfsproto.h @@ -1227,6 +1227,7 @@ struct nfsv3_sattr { NFSATTRBM_RAWDEV | \ NFSATTRBM_SPACEUSED | \ NFSATTRBM_TIMEACCESS | \ + NFSATTRBM_TIMECREATE | \ NFSATTRBM_TIMEMETADATA | \ NFSATTRBM_TIMEMODIFY) @@ -1258,6 +1259,7 @@ struct nfsv3_sattr { NFSATTRBM_RAWDEV | \ NFSATTRBM_SPACEUSED | \ NFSATTRBM_TIMEACCESS | \ + NFSATTRBM_TIMECREATE | \ NFSATTRBM_TIMEMETADATA | \ NFSATTRBM_TIMEMODIFY) diff --git a/sys/fs/nfsclient/nfs_clcomsubs.c b/sys/fs/nfsclient/nfs_clcomsubs.c index 8a51d51f093f..554f5e820f54 100644 --- a/sys/fs/nfsclient/nfs_clcomsubs.c +++ b/sys/fs/nfsclient/nfs_clcomsubs.c @@ -284,6 +284,8 @@ nfsm_loadattr(struct nfsrv_descript *nd, struct nfsvattr *nap) fxdr_nfsv3time(&fp->fa3_atime, &nap->na_atime); fxdr_nfsv3time(&fp->fa3_ctime, &nap->na_ctime); fxdr_nfsv3time(&fp->fa3_mtime, &nap->na_mtime); + nap->na_btime.tv_sec = -1; + nap->na_btime.tv_nsec = 0; nap->na_flags = 0; nap->na_gen = 0; nap->na_filerev = 0; @@ -315,6 +317,8 @@ nfsm_loadattr(struct nfsrv_descript *nd, struct nfsvattr *nap) nap->na_ctime.tv_sec = fxdr_unsigned(u_int32_t, fp->fa2_ctime.nfsv2_sec); nap->na_ctime.tv_nsec = 0; + nap->na_btime.tv_sec = -1; + nap->na_btime.tv_nsec = 0; nap->na_gen = fxdr_unsigned(u_int32_t,fp->fa2_ctime.nfsv2_usec); nap->na_filerev = 0; } diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c index 64820cd11f1c..492b93340e4e 100644 --- a/sys/fs/nfsclient/nfs_clport.c +++ b/sys/fs/nfsclient/nfs_clport.c @@ -415,6 +415,7 @@ ncl_copy_vattr(struct vattr *dst, struct vattr *src) dst->va_atime = src->va_atime; dst->va_mtime = src->va_mtime; dst->va_ctime = src->va_ctime; + dst->va_birthtime = src->va_birthtime; dst->va_gen = src->va_gen; dst->va_flags = src->va_flags; dst->va_rdev = src->va_rdev; @@ -466,6 +467,7 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvattr *nap, void *nvaper, np->n_vattr.na_size = nap->na_size; np->n_vattr.na_mtime = nap->na_mtime; np->n_vattr.na_ctime = nap->na_ctime; + np->n_vattr.na_btime = nap->na_btime; np->n_vattr.na_fsid = nap->na_fsid; np->n_vattr.na_mode = nap->na_mode; } else { diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 43050e15050a..ef345dc391e5 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -3548,6 +3548,9 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, if (gotmnton) NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_MOUNTEDONFILEID); + if (!NFSISSET_ATTRBIT(&dnp->n_vattr.na_suppattr, + NFSATTRBIT_TIMECREATE)) + NFSCLRBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMECREATE); } /* diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 5f81bb5b42a4..2311ea099042 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -1024,7 +1024,9 @@ nfs_setattr(struct vop_setattr_args *ap) */ if ((vap->va_flags != VNOVAL || vap->va_uid != (uid_t)VNOVAL || vap->va_gid != (gid_t)VNOVAL || vap->va_atime.tv_sec != VNOVAL || - vap->va_mtime.tv_sec != VNOVAL || vap->va_mode != (mode_t)VNOVAL) && + vap->va_mtime.tv_sec != VNOVAL || + vap->va_birthtime.tv_sec != VNOVAL || + vap->va_mode != (mode_t)VNOVAL) && (vp->v_mount->mnt_flag & MNT_RDONLY)) return (EROFS); if (vap->va_size != VNOVAL) { @@ -1037,6 +1039,7 @@ nfs_setattr(struct vop_setattr_args *ap) case VFIFO: if (vap->va_mtime.tv_sec == VNOVAL && vap->va_atime.tv_sec == VNOVAL && + vap->va_birthtime.tv_sec == VNOVAL && vap->va_mode == (mode_t)VNOVAL && vap->va_uid == (uid_t)VNOVAL && vap->va_gid == (gid_t)VNOVAL) diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index 0c4fcebb8e05..8aa39e5018d9 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -491,6 +491,15 @@ nfsrvd_setattr(struct nfsrv_descript *nd, __unused int isdgram, NFSSETBIT_ATTRBIT(&retbits, NFSATTRBIT_TIMEMODIFYSET); } } + if (!nd->nd_repstat && + NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_TIMECREATE)) { + NFSVNO_ATTRINIT(&nva2); + NFSVNO_SETATTRVAL(&nva2, btime, nva.na_btime); + nd->nd_repstat = nfsvno_setattr(vp, &nva2, nd->nd_cred, p, + exp); + if (!nd->nd_repstat) + NFSSETBIT_ATTRBIT(&retbits, NFSATTRBIT_TIMECREATE); + } if (!nd->nd_repstat && (NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_MODE) || NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_MODESETMASKED))) { From owner-dev-commits-src-branches@freebsd.org Sat May 22 09:46:23 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 59A1A648EEA; Sat, 22 May 2021 09:46:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJWz1Ns0z3ljS; Sat, 22 May 2021 09:46:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17F73225AB; Sat, 22 May 2021 09:46:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9kNGx012321; Sat, 22 May 2021 09:46:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9kMbC012320; Sat, 22 May 2021 09:46:22 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:22 GMT Message-Id: <202105220946.14M9kMbC012320@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 951abff52ff2 - stable/13 - swappagerops: slightly more style-compliant formatting MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 951abff52ff213ce26146285915e683453950869 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:23 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=951abff52ff213ce26146285915e683453950869 commit 951abff52ff213ce26146285915e683453950869 Author: Konstantin Belousov AuthorDate: 2021-04-30 23:54:17 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:28 +0000 swappagerops: slightly more style-compliant formatting (cherry picked from commit a0850dd0570fcfbb5cf72cb0962a201d39db040e) --- sys/vm/swap_pager.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index f7cde181a7c4..fa0aa0c41925 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -436,13 +436,13 @@ static void swap_pager_release_writecount(vm_object_t object, struct pagerops swappagerops = { .pgo_init = swap_pager_init, /* early system initialization of pager */ - .pgo_alloc = swap_pager_alloc, /* allocate an OBJT_SWAP object */ - .pgo_dealloc = swap_pager_dealloc, /* deallocate an OBJT_SWAP object */ - .pgo_getpages = swap_pager_getpages, /* pagein */ - .pgo_getpages_async = swap_pager_getpages_async, /* pagein (async) */ - .pgo_putpages = swap_pager_putpages, /* pageout */ - .pgo_haspage = swap_pager_haspage, /* get backing store status for page */ - .pgo_pageunswapped = swap_pager_unswapped, /* remove swap related to page */ + .pgo_alloc = swap_pager_alloc, /* allocate an OBJT_SWAP object */ + .pgo_dealloc = swap_pager_dealloc, /* deallocate an OBJT_SWAP object */ + .pgo_getpages = swap_pager_getpages, /* pagein */ + .pgo_getpages_async = swap_pager_getpages_async, /* pagein (async) */ + .pgo_putpages = swap_pager_putpages, /* pageout */ + .pgo_haspage = swap_pager_haspage, /* get backing store status for page */ + .pgo_pageunswapped = swap_pager_unswapped, /* remove swap related to page */ .pgo_update_writecount = swap_pager_update_writecount, .pgo_release_writecount = swap_pager_release_writecount, }; From owner-dev-commits-src-branches@freebsd.org Sat May 22 09:46:25 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 C8284648DE9; Sat, 22 May 2021 09:46:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJX14rrvz3ljZ; Sat, 22 May 2021 09:46:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CE6D2215D; Sat, 22 May 2021 09:46:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9kPPr012363; Sat, 22 May 2021 09:46:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9kPJn012362; Sat, 22 May 2021 09:46:25 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:25 GMT Message-Id: <202105220946.14M9kPJn012362@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: f3b6b7de3cc0 - stable/13 - vm_pager: add pgo_set_writeable_dirty method MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f3b6b7de3cc0b3379b9ed991cc3d4980eedf17b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:25 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f3b6b7de3cc0b3379b9ed991cc3d4980eedf17b1 commit f3b6b7de3cc0b3379b9ed991cc3d4980eedf17b1 Author: Konstantin Belousov AuthorDate: 2021-05-01 00:14:48 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:28 +0000 vm_pager: add pgo_set_writeable_dirty method (cherry picked from commit 180bcaa46c5d297d137749258b23593d578d76a5) --- sys/vm/swap_pager.c | 9 +++++++++ sys/vm/vm_object.c | 7 +------ sys/vm/vm_object.h | 1 + sys/vm/vm_pager.c | 11 +++++++++++ sys/vm/vm_pager.h | 3 ++- sys/vm/vnode_pager.c | 1 + 6 files changed, 25 insertions(+), 7 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index fa0aa0c41925..8ccc3a6710e0 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -433,6 +433,7 @@ static void swap_pager_update_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); static void swap_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); +static void swap_pager_set_writeable_dirty(vm_object_t object); struct pagerops swappagerops = { .pgo_init = swap_pager_init, /* early system initialization of pager */ @@ -445,6 +446,7 @@ struct pagerops swappagerops = { .pgo_pageunswapped = swap_pager_unswapped, /* remove swap related to page */ .pgo_update_writecount = swap_pager_update_writecount, .pgo_release_writecount = swap_pager_release_writecount, + .pgo_set_writeable_dirty = swap_pager_set_writeable_dirty, }; /* @@ -3127,3 +3129,10 @@ swap_pager_release_writecount(vm_object_t object, vm_offset_t start, object->un_pager.swp.writemappings -= (vm_ooffset_t)end - start; VM_OBJECT_WUNLOCK(object); } + +static void +swap_pager_set_writeable_dirty(vm_object_t object) +{ + if ((object->flags & OBJ_TMPFS_NODE) != 0) + vm_object_set_writeable_dirty_(object); +} diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 1f5194464b69..46b43e8cee14 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2332,13 +2332,8 @@ vm_object_coalesce(vm_object_t prev_object, vm_ooffset_t prev_offset, } void -vm_object_set_writeable_dirty(vm_object_t object) +vm_object_set_writeable_dirty_(vm_object_t object) { - - /* Only set for vnodes & tmpfs */ - if (object->type != OBJT_VNODE && - (object->flags & OBJ_TMPFS_NODE) == 0) - return; atomic_add_int(&object->generation, 1); } diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index 3c589bd4b42e..93380d904526 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -378,6 +378,7 @@ void vm_object_deallocate (vm_object_t); void vm_object_destroy (vm_object_t); void vm_object_terminate (vm_object_t); void vm_object_set_writeable_dirty (vm_object_t); +void vm_object_set_writeable_dirty_(vm_object_t object); void vm_object_init (void); int vm_object_kvme_type(vm_object_t object, struct vnode **vpp); void vm_object_madvise(vm_object_t, vm_pindex_t, vm_pindex_t, int); diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 2a30a2073b36..258c06fd3947 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -497,3 +497,14 @@ pbrelbo(struct buf *bp) bp->b_bufobj = NULL; bp->b_flags &= ~B_PAGING; } + +void +vm_object_set_writeable_dirty(vm_object_t object) +{ + pgo_set_writeable_dirty_t *method; + + method = pagertab[object->type]->pgo_set_writeable_dirty; + if (method != NULL) + method(object); +} + diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index 2dfe374b9d4a..e17e29ea961f 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -62,6 +62,7 @@ typedef int pgo_populate_t(vm_object_t, vm_pindex_t, int, vm_prot_t, vm_pindex_t *, vm_pindex_t *); typedef void pgo_pageunswapped_t(vm_page_t); typedef void pgo_writecount_t(vm_object_t, vm_offset_t, vm_offset_t); +typedef void pgo_set_writeable_dirty_t(vm_object_t); struct pagerops { pgo_init_t *pgo_init; /* Initialize pager. */ @@ -73,9 +74,9 @@ struct pagerops { pgo_haspage_t *pgo_haspage; /* Query page. */ pgo_populate_t *pgo_populate; /* Bulk spec pagein. */ pgo_pageunswapped_t *pgo_pageunswapped; - /* Operations for specialized writecount handling */ pgo_writecount_t *pgo_update_writecount; pgo_writecount_t *pgo_release_writecount; + pgo_set_writeable_dirty_t *pgo_set_writeable_dirty; }; extern struct pagerops defaultpagerops; diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index e75c6fb6b5d7..619121b672eb 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -115,6 +115,7 @@ struct pagerops vnodepagerops = { .pgo_haspage = vnode_pager_haspage, .pgo_update_writecount = vnode_pager_update_writecount, .pgo_release_writecount = vnode_pager_release_writecount, + .pgo_set_writeable_dirty = vm_object_set_writeable_dirty_, }; static struct domainset *vnode_domainset = NULL; From owner-dev-commits-src-branches@freebsd.org Sat May 22 09:46:26 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 A6E0D6491F1; Sat, 22 May 2021 09:46:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJX23rMDz3lrL; Sat, 22 May 2021 09:46:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A39D21AFF; Sat, 22 May 2021 09:46:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9kQ5H012384; Sat, 22 May 2021 09:46:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9kQNn012383; Sat, 22 May 2021 09:46:26 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:26 GMT Message-Id: <202105220946.14M9kQNn012383@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2ad6fea03249 - stable/13 - Add pgo_mightbedirty method MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2ad6fea03249ea89489d5d7ca51e5e25c123042d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:26 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2ad6fea03249ea89489d5d7ca51e5e25c123042d commit 2ad6fea03249ea89489d5d7ca51e5e25c123042d Author: Konstantin Belousov AuthorDate: 2021-05-01 00:43:08 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:28 +0000 Add pgo_mightbedirty method (cherry picked from commit c23c555bc15ce1523b95fb8da99ae77c0bb0977e) --- sys/vm/swap_pager.c | 10 ++++++++++ sys/vm/vm_object.c | 6 ++++++ sys/vm/vm_object.h | 17 ++--------------- sys/vm/vm_pager.c | 10 ++++++++++ sys/vm/vm_pager.h | 2 ++ sys/vm/vnode_pager.c | 1 + 6 files changed, 31 insertions(+), 15 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 8ccc3a6710e0..7cfce53aba79 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -434,6 +434,7 @@ static void swap_pager_update_writecount(vm_object_t object, static void swap_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); static void swap_pager_set_writeable_dirty(vm_object_t object); +static bool swap_pager_mightbedirty(vm_object_t object); struct pagerops swappagerops = { .pgo_init = swap_pager_init, /* early system initialization of pager */ @@ -447,6 +448,7 @@ struct pagerops swappagerops = { .pgo_update_writecount = swap_pager_update_writecount, .pgo_release_writecount = swap_pager_release_writecount, .pgo_set_writeable_dirty = swap_pager_set_writeable_dirty, + .pgo_mightbedirty = swap_pager_mightbedirty, }; /* @@ -3136,3 +3138,11 @@ swap_pager_set_writeable_dirty(vm_object_t object) if ((object->flags & OBJ_TMPFS_NODE) != 0) vm_object_set_writeable_dirty_(object); } + +static bool +swap_pager_mightbedirty(vm_object_t object) +{ + if ((object->flags & OBJ_TMPFS_NODE) != 0) + return (vm_object_mightbedirty_(object)); + return (false); +} diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 46b43e8cee14..b601bff33ff4 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2337,6 +2337,12 @@ vm_object_set_writeable_dirty_(vm_object_t object) atomic_add_int(&object->generation, 1); } +bool +vm_object_mightbedirty_(vm_object_t object) +{ + return (object->generation != object->cleangeneration); +} + /* * vm_object_unwire: * diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index 93380d904526..c7bbec0e7a86 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -330,21 +330,6 @@ vm_object_reserv(vm_object_t object) return (false); } -static __inline bool -vm_object_mightbedirty(vm_object_t object) -{ - - if (object->type != OBJT_VNODE) { - if ((object->flags & OBJ_TMPFS_NODE) == 0) - return (false); -#ifdef KASSERT - KASSERT(object->type == OBJT_SWAP, - ("TMPFS_NODE obj %p is not swap", object)); -#endif - } - return (object->generation != object->cleangeneration); -} - void vm_object_clear_flag(vm_object_t object, u_short bits); void vm_object_pip_add(vm_object_t object, short i); void vm_object_pip_wakeup(vm_object_t object); @@ -379,6 +364,8 @@ void vm_object_destroy (vm_object_t); void vm_object_terminate (vm_object_t); void vm_object_set_writeable_dirty (vm_object_t); void vm_object_set_writeable_dirty_(vm_object_t object); +bool vm_object_mightbedirty(vm_object_t object); +bool vm_object_mightbedirty_(vm_object_t object); void vm_object_init (void); int vm_object_kvme_type(vm_object_t object, struct vnode **vpp); void vm_object_madvise(vm_object_t, vm_pindex_t, vm_pindex_t, int); diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 258c06fd3947..b113ce569e14 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -508,3 +508,13 @@ vm_object_set_writeable_dirty(vm_object_t object) method(object); } +bool +vm_object_mightbedirty(vm_object_t object) +{ + pgo_mightbedirty_t *method; + + method = pagertab[object->type]->pgo_mightbedirty; + if (method == NULL) + return (false); + return (method(object)); +} diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index e17e29ea961f..014a67c2e055 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -63,6 +63,7 @@ typedef int pgo_populate_t(vm_object_t, vm_pindex_t, int, vm_prot_t, typedef void pgo_pageunswapped_t(vm_page_t); typedef void pgo_writecount_t(vm_object_t, vm_offset_t, vm_offset_t); typedef void pgo_set_writeable_dirty_t(vm_object_t); +typedef bool pgo_mightbedirty_t(vm_object_t); struct pagerops { pgo_init_t *pgo_init; /* Initialize pager. */ @@ -77,6 +78,7 @@ struct pagerops { pgo_writecount_t *pgo_update_writecount; pgo_writecount_t *pgo_release_writecount; pgo_set_writeable_dirty_t *pgo_set_writeable_dirty; + pgo_mightbedirty_t *pgo_mightbedirty; }; extern struct pagerops defaultpagerops; diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index 619121b672eb..5e89d91548fd 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -116,6 +116,7 @@ struct pagerops vnodepagerops = { .pgo_update_writecount = vnode_pager_update_writecount, .pgo_release_writecount = vnode_pager_release_writecount, .pgo_set_writeable_dirty = vm_object_set_writeable_dirty_, + .pgo_mightbedirty = vm_object_mightbedirty_, }; static struct domainset *vnode_domainset = NULL; From owner-dev-commits-src-branches@freebsd.org Sat May 22 09:46:24 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 81CEC64940A; Sat, 22 May 2021 09:46:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJX02mvbz3llM; Sat, 22 May 2021 09:46:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E1E4221F0; Sat, 22 May 2021 09:46:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9kOZH012342; Sat, 22 May 2021 09:46:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9kOa7012341; Sat, 22 May 2021 09:46:24 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:24 GMT Message-Id: <202105220946.14M9kOa7012341@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 12e1d859a67b - stable/13 - vm_pager: style some wrappers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 12e1d859a67bd0c0b0418cfa3215e7a18f2241e2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:24 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=12e1d859a67bd0c0b0418cfa3215e7a18f2241e2 commit 12e1d859a67bd0c0b0418cfa3215e7a18f2241e2 Author: Konstantin Belousov AuthorDate: 2021-05-01 00:28:39 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:28 +0000 vm_pager: style some wrappers (cherry picked from commit ee4211bca600af48aab95000f39b4797a74eeb85) --- sys/vm/vm_pager.h | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index 45a5a5654806..2dfe374b9d4a 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -129,13 +129,9 @@ void vm_pager_init(void); vm_object_t vm_pager_object_lookup(struct pagerlst *, void *); static __inline void -vm_pager_put_pages( - vm_object_t object, - vm_page_t *m, - int count, - int flags, - int *rtvals -) { +vm_pager_put_pages(vm_object_t object, vm_page_t *m, int count, int flags, + int *rtvals) +{ VM_OBJECT_ASSERT_WLOCKED(object); (*pagertab[object->type]->pgo_putpages) (object, m, count, flags, rtvals); @@ -152,12 +148,9 @@ vm_pager_put_pages( * The object must be locked. */ static __inline boolean_t -vm_pager_has_page( - vm_object_t object, - vm_pindex_t offset, - int *before, - int *after -) { +vm_pager_has_page(vm_object_t object, vm_pindex_t offset, int *before, + int *after) +{ boolean_t ret; VM_OBJECT_ASSERT_LOCKED(object); @@ -191,29 +184,33 @@ vm_pager_populate(vm_object_t object, vm_pindex_t pidx, int fault_type, static __inline void vm_pager_page_unswapped(vm_page_t m) { + pgo_pageunswapped_t *method; - if (pagertab[m->object->type]->pgo_pageunswapped) - (*pagertab[m->object->type]->pgo_pageunswapped)(m); + method = pagertab[m->object->type]->pgo_pageunswapped; + if (method != NULL) + method(m); } static __inline void vm_pager_update_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end) { + pgo_writecount_t *method; - if (pagertab[object->type]->pgo_update_writecount) - pagertab[object->type]->pgo_update_writecount(object, start, - end); + method = pagertab[object->type]->pgo_update_writecount; + if (method != NULL) + method(object, start, end); } static __inline void vm_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end) { + pgo_writecount_t *method; - if (pagertab[object->type]->pgo_release_writecount) - pagertab[object->type]->pgo_release_writecount(object, start, - end); + method = pagertab[object->type]->pgo_release_writecount; + if (method != NULL) + method(object, start, end); } struct cdev_pager_ops { From owner-dev-commits-src-branches@freebsd.org Sat May 22 09:46:27 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 DAAC66493B3; Sat, 22 May 2021 09:46:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJX35Dmyz3llX; Sat, 22 May 2021 09:46:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9287A2252F; Sat, 22 May 2021 09:46:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9kRJE012412; Sat, 22 May 2021 09:46:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9kRM4012411; Sat, 22 May 2021 09:46:27 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:27 GMT Message-Id: <202105220946.14M9kRM4012411@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 9a311cf995fe - stable/13 - Add pgo_getvp method MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9a311cf995febd628c8d18c9b91c0d80bf95267b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:28 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9a311cf995febd628c8d18c9b91c0d80bf95267b commit 9a311cf995febd628c8d18c9b91c0d80bf95267b Author: Konstantin Belousov AuthorDate: 2021-05-01 01:04:04 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:28 +0000 Add pgo_getvp method (cherry picked from commit 192112b74fed56ca652cf1d70c11ba7e17bc1ce2) --- sys/vm/swap_pager.c | 28 ++++++++++++++++++++++++++++ sys/vm/vm_map.c | 33 +-------------------------------- sys/vm/vm_pager.c | 11 +++++++++++ sys/vm/vm_pager.h | 20 ++++++++++++++++++++ sys/vm/vnode_pager.c | 8 ++++++++ 5 files changed, 68 insertions(+), 32 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 7cfce53aba79..91383244a0f9 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -435,6 +435,8 @@ static void swap_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); static void swap_pager_set_writeable_dirty(vm_object_t object); static bool swap_pager_mightbedirty(vm_object_t object); +static void swap_pager_getvp(vm_object_t object, struct vnode **vpp, + bool *vp_heldp); struct pagerops swappagerops = { .pgo_init = swap_pager_init, /* early system initialization of pager */ @@ -449,6 +451,7 @@ struct pagerops swappagerops = { .pgo_release_writecount = swap_pager_release_writecount, .pgo_set_writeable_dirty = swap_pager_set_writeable_dirty, .pgo_mightbedirty = swap_pager_mightbedirty, + .pgo_getvp = swap_pager_getvp, }; /* @@ -3146,3 +3149,28 @@ swap_pager_mightbedirty(vm_object_t object) return (vm_object_mightbedirty_(object)); return (false); } + +static void +swap_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) +{ + struct vnode *vp; + + KASSERT((object->flags & OBJ_TMPFS_NODE) != 0, + ("swap_pager_getvp: swap and !TMPFS obj %p", object)); + + /* + * Tmpfs VREG node, which was reclaimed, has + * OBJ_TMPFS_NODE flag set, but not OBJ_TMPFS. In + * this case there is no v_writecount to adjust. + */ + VM_OBJECT_RLOCK(object); + if ((object->flags & OBJ_TMPFS) != 0) { + vp = object->un_pager.swp.swp_tmpfs; + if (vp != NULL) { + vhold(vp); + *vpp = vp; + *vp_heldp = true; + } + } + VM_OBJECT_RUNLOCK(object); +} diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index f17342b2a545..60c88a7b71bf 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -561,38 +561,7 @@ vm_map_entry_set_vnode_text(vm_map_entry_t entry, bool add) * referenced by the entry we are processing, so it cannot go * away. */ - vp = NULL; - vp_held = false; - if (object->type == OBJT_DEAD) { - /* - * For OBJT_DEAD objects, v_writecount was handled in - * vnode_pager_dealloc(). - */ - } else if (object->type == OBJT_VNODE) { - vp = object->handle; - } else if (object->type == OBJT_SWAP) { - KASSERT((object->flags & OBJ_TMPFS_NODE) != 0, - ("vm_map_entry_set_vnode_text: swap and !TMPFS " - "entry %p, object %p, add %d", entry, object, add)); - /* - * Tmpfs VREG node, which was reclaimed, has - * OBJ_TMPFS_NODE flag set, but not OBJ_TMPFS. In - * this case there is no v_writecount to adjust. - */ - VM_OBJECT_RLOCK(object); - if ((object->flags & OBJ_TMPFS) != 0) { - vp = object->un_pager.swp.swp_tmpfs; - if (vp != NULL) { - vhold(vp); - vp_held = true; - } - } - VM_OBJECT_RUNLOCK(object); - } else { - KASSERT(0, - ("vm_map_entry_set_vnode_text: wrong object type, " - "entry %p, object %p, add %d", entry, object, add)); - } + vm_pager_getvp(object, &vp, &vp_held); if (vp != NULL) { if (add) { VOP_SET_TEXT_CHECKED(vp); diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index b113ce569e14..587407a06291 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -100,6 +100,7 @@ static vm_object_t dead_pager_alloc(void *, vm_ooffset_t, vm_prot_t, static void dead_pager_putpages(vm_object_t, vm_page_t *, int, int, int *); static boolean_t dead_pager_haspage(vm_object_t, vm_pindex_t, int *, int *); static void dead_pager_dealloc(vm_object_t); +static void dead_pager_getvp(vm_object_t, struct vnode **, bool *); static int dead_pager_getpages(vm_object_t obj, vm_page_t *ma, int count, int *rbehind, @@ -144,12 +145,22 @@ dead_pager_dealloc(vm_object_t object) } +static void +dead_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) +{ + /* + * For OBJT_DEAD objects, v_writecount was handled in + * vnode_pager_dealloc(). + */ +} + static struct pagerops deadpagerops = { .pgo_alloc = dead_pager_alloc, .pgo_dealloc = dead_pager_dealloc, .pgo_getpages = dead_pager_getpages, .pgo_putpages = dead_pager_putpages, .pgo_haspage = dead_pager_haspage, + .pgo_getvp = dead_pager_getvp, }; struct pagerops *pagertab[] = { diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index 014a67c2e055..cb2a896c8749 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -47,6 +47,7 @@ #include TAILQ_HEAD(pagerlst, vm_object); +struct vnode; typedef void pgo_init_t(void); typedef vm_object_t pgo_alloc_t(void *, vm_ooffset_t, vm_prot_t, vm_ooffset_t, @@ -64,6 +65,8 @@ typedef void pgo_pageunswapped_t(vm_page_t); typedef void pgo_writecount_t(vm_object_t, vm_offset_t, vm_offset_t); typedef void pgo_set_writeable_dirty_t(vm_object_t); typedef bool pgo_mightbedirty_t(vm_object_t); +typedef void pgo_getvp_t(vm_object_t object, struct vnode **vpp, + bool *vp_heldp); struct pagerops { pgo_init_t *pgo_init; /* Initialize pager. */ @@ -79,6 +82,7 @@ struct pagerops { pgo_writecount_t *pgo_release_writecount; pgo_set_writeable_dirty_t *pgo_set_writeable_dirty; pgo_mightbedirty_t *pgo_mightbedirty; + pgo_getvp_t *pgo_getvp; }; extern struct pagerops defaultpagerops; @@ -216,6 +220,22 @@ vm_pager_release_writecount(vm_object_t object, vm_offset_t start, method(object, start, end); } +static __inline void +vm_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) +{ + pgo_getvp_t *method; + + *vpp = NULL; + *vp_heldp = false; + method = pagertab[object->type]->pgo_getvp; + if (method != NULL) { + method(object, vpp, vp_heldp); + } else { + KASSERT(0, + ("vm_pager_getvp: wrong object type obj %p", object)); + } +} + struct cdev_pager_ops { int (*cdev_pg_fault)(vm_object_t vm_obj, vm_ooffset_t offset, int prot, vm_page_t *mres); diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index 5e89d91548fd..eeced1b981d1 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -105,6 +105,7 @@ static void vnode_pager_update_writecount(vm_object_t, vm_offset_t, vm_offset_t); static void vnode_pager_release_writecount(vm_object_t, vm_offset_t, vm_offset_t); +static void vnode_pager_getvp(vm_object_t, struct vnode **, bool *); struct pagerops vnodepagerops = { .pgo_alloc = vnode_pager_alloc, @@ -117,6 +118,7 @@ struct pagerops vnodepagerops = { .pgo_release_writecount = vnode_pager_release_writecount, .pgo_set_writeable_dirty = vm_object_set_writeable_dirty_, .pgo_mightbedirty = vm_object_mightbedirty_, + .pgo_getvp = vnode_pager_getvp, }; static struct domainset *vnode_domainset = NULL; @@ -1604,3 +1606,9 @@ vnode_pager_release_writecount(vm_object_t object, vm_offset_t start, if (mp != NULL) vn_finished_write(mp); } + +static void +vnode_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) +{ + *vpp = object->handle; +} From owner-dev-commits-src-branches@freebsd.org Sat May 22 09:46:29 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 3FEB6648EF4; Sat, 22 May 2021 09:46:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJX46Cb6z3ltW; Sat, 22 May 2021 09:46:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B00ED225AC; Sat, 22 May 2021 09:46:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9kSXl012433; Sat, 22 May 2021 09:46:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9kSZQ012432; Sat, 22 May 2021 09:46:28 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:28 GMT Message-Id: <202105220946.14M9kSZQ012432@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 76674f6896cb - stable/13 - Add pgo_freespace method MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 76674f6896cbb5f76368df04282a6fcc73365838 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:29 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=76674f6896cbb5f76368df04282a6fcc73365838 commit 76674f6896cbb5f76368df04282a6fcc73365838 Author: Konstantin Belousov AuthorDate: 2021-05-01 17:12:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:29 +0000 Add pgo_freespace method (cherry picked from commit 1390a5cbeb1828b11584783c53f50b9679379651) --- sys/vm/swap_pager.c | 7 ++++--- sys/vm/swap_pager.h | 1 - sys/vm/vm_object.c | 24 ++++++++---------------- sys/vm/vm_pager.h | 14 ++++++++++++++ 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 91383244a0f9..22205510ff94 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -437,6 +437,8 @@ static void swap_pager_set_writeable_dirty(vm_object_t object); static bool swap_pager_mightbedirty(vm_object_t object); static void swap_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp); +static void swap_pager_freespace(vm_object_t object, vm_pindex_t start, + vm_size_t size); struct pagerops swappagerops = { .pgo_init = swap_pager_init, /* early system initialization of pager */ @@ -452,6 +454,7 @@ struct pagerops swappagerops = { .pgo_set_writeable_dirty = swap_pager_set_writeable_dirty, .pgo_mightbedirty = swap_pager_mightbedirty, .pgo_getvp = swap_pager_getvp, + .pgo_freespace = swap_pager_freespace, }; /* @@ -942,8 +945,6 @@ sysctl_swap_fragmentation(SYSCTL_HANDLER_ARGS) * SWAP_PAGER_FREESPACE() - frees swap blocks associated with a page * range within an object. * - * This is a globally accessible routine. - * * This routine removes swapblk assignments from swap metadata. * * The external callers of this routine typically have already destroyed @@ -952,7 +953,7 @@ sysctl_swap_fragmentation(SYSCTL_HANDLER_ARGS) * * The object must be locked. */ -void +static void swap_pager_freespace(vm_object_t object, vm_pindex_t start, vm_size_t size) { diff --git a/sys/vm/swap_pager.h b/sys/vm/swap_pager.h index 59ca2cc2cfdb..7a2ea12e887d 100644 --- a/sys/vm/swap_pager.h +++ b/sys/vm/swap_pager.h @@ -76,7 +76,6 @@ struct xswdev; int swap_dev_info(int name, struct xswdev *xs, char *devname, size_t len); void swap_pager_copy(vm_object_t, vm_object_t, vm_pindex_t, int); vm_pindex_t swap_pager_find_least(vm_object_t object, vm_pindex_t pindex); -void swap_pager_freespace(vm_object_t, vm_pindex_t, vm_size_t); void swap_pager_swap_init(void); int swap_pager_nswapdev(void); int swap_pager_reserve(vm_object_t, vm_pindex_t, vm_size_t); diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index b601bff33ff4..7b380608cdf4 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -1277,8 +1277,8 @@ vm_object_madvise_freespace(vm_object_t object, int advice, vm_pindex_t pindex, vm_size_t size) { - if (advice == MADV_FREE && object->type == OBJT_SWAP) - swap_pager_freespace(object, pindex, size); + if (advice == MADV_FREE) + vm_pager_freespace(object, pindex, size); } /* @@ -1798,9 +1798,7 @@ vm_object_collapse_scan(vm_object_t object) if (p->pindex < backing_offset_index || new_pindex >= object->size) { - if (backing_object->type == OBJT_SWAP) - swap_pager_freespace(backing_object, p->pindex, - 1); + vm_pager_freespace(backing_object, p->pindex, 1); KASSERT(!pmap_page_is_mapped(p), ("freeing mapped page %p", p)); @@ -1849,9 +1847,7 @@ vm_object_collapse_scan(vm_object_t object) * page alone. Destroy the original page from the * backing object. */ - if (backing_object->type == OBJT_SWAP) - swap_pager_freespace(backing_object, p->pindex, - 1); + vm_pager_freespace(backing_object, p->pindex, 1); KASSERT(!pmap_page_is_mapped(p), ("freeing mapped page %p", p)); if (vm_page_remove(p)) @@ -1875,9 +1871,8 @@ vm_object_collapse_scan(vm_object_t object) } /* Use the old pindex to free the right page. */ - if (backing_object->type == OBJT_SWAP) - swap_pager_freespace(backing_object, - new_pindex + backing_offset_index, 1); + vm_pager_freespace(backing_object, new_pindex + + backing_offset_index, 1); #if VM_NRESERVLEVEL > 0 /* @@ -2138,11 +2133,8 @@ wired: } vm_object_pip_wakeup(object); - if (object->type == OBJT_SWAP) { - if (end == 0) - end = object->size; - swap_pager_freespace(object, start, end - start); - } + vm_pager_freespace(object, start, (end == 0 ? object->size : end) - + start); } /* diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index cb2a896c8749..6a35c066bea6 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -67,6 +67,8 @@ typedef void pgo_set_writeable_dirty_t(vm_object_t); typedef bool pgo_mightbedirty_t(vm_object_t); typedef void pgo_getvp_t(vm_object_t object, struct vnode **vpp, bool *vp_heldp); +typedef void pgo_freespace_t(vm_object_t object, vm_pindex_t start, + vm_size_t size); struct pagerops { pgo_init_t *pgo_init; /* Initialize pager. */ @@ -83,6 +85,7 @@ struct pagerops { pgo_set_writeable_dirty_t *pgo_set_writeable_dirty; pgo_mightbedirty_t *pgo_mightbedirty; pgo_getvp_t *pgo_getvp; + pgo_freespace_t *pgo_freespace; }; extern struct pagerops defaultpagerops; @@ -236,6 +239,17 @@ vm_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) } } +static __inline void +vm_pager_freespace(vm_object_t object, vm_pindex_t start, + vm_size_t size) +{ + pgo_freespace_t *method; + + method = pagertab[object->type]->pgo_freespace; + if (method != NULL) + method(object, start, size); +} + struct cdev_pager_ops { int (*cdev_pg_fault)(vm_object_t vm_obj, vm_ooffset_t offset, int prot, vm_page_t *mres); From owner-dev-commits-src-branches@freebsd.org Sat May 22 09:46:30 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 91238649483; Sat, 22 May 2021 09:46:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJX60rpXz3lrf; Sat, 22 May 2021 09:46:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD61E225AD; Sat, 22 May 2021 09:46:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9kT82012454; Sat, 22 May 2021 09:46:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9kTLr012453; Sat, 22 May 2021 09:46:29 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:29 GMT Message-Id: <202105220946.14M9kTLr012453@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: da0e85f9ebc9 - stable/13 - Implement vm_object_vnode() using vm_pager_getvp() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: da0e85f9ebc9c4f5b9b7ddf126248d7d781b74d7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:31 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=da0e85f9ebc9c4f5b9b7ddf126248d7d781b74d7 commit da0e85f9ebc9c4f5b9b7ddf126248d7d781b74d7 Author: Konstantin Belousov AuthorDate: 2021-05-01 01:08:28 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:29 +0000 Implement vm_object_vnode() using vm_pager_getvp() (cherry picked from commit a7c198a24b12b9e6d83d7718d8d16a5cef48d35f) --- sys/vm/swap_pager.c | 14 ++++++++++---- sys/vm/vm_object.c | 11 +---------- sys/vm/vm_pager.h | 9 +++------ 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 22205510ff94..b81f73e41d05 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -3164,14 +3164,20 @@ swap_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) * OBJ_TMPFS_NODE flag set, but not OBJ_TMPFS. In * this case there is no v_writecount to adjust. */ - VM_OBJECT_RLOCK(object); + if (vp_heldp != NULL) + VM_OBJECT_RLOCK(object); + else + VM_OBJECT_ASSERT_LOCKED(object); if ((object->flags & OBJ_TMPFS) != 0) { vp = object->un_pager.swp.swp_tmpfs; if (vp != NULL) { - vhold(vp); *vpp = vp; - *vp_heldp = true; + if (vp_heldp != NULL) { + vhold(vp); + *vp_heldp = true; + } } } - VM_OBJECT_RUNLOCK(object); + if (vp_heldp != NULL) + VM_OBJECT_RUNLOCK(object); } diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 7b380608cdf4..bbcbad41f10c 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2429,16 +2429,7 @@ vm_object_vnode(vm_object_t object) struct vnode *vp; VM_OBJECT_ASSERT_LOCKED(object); - if (object->type == OBJT_VNODE) { - vp = object->handle; - KASSERT(vp != NULL, ("%s: OBJT_VNODE has no vnode", __func__)); - } else if (object->type == OBJT_SWAP && - (object->flags & OBJ_TMPFS) != 0) { - vp = object->un_pager.swp.swp_tmpfs; - KASSERT(vp != NULL, ("%s: OBJT_TMPFS has no vnode", __func__)); - } else { - vp = NULL; - } + vm_pager_getvp(object, &vp, NULL); return (vp); } diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index 6a35c066bea6..507123adb454 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -229,14 +229,11 @@ vm_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) pgo_getvp_t *method; *vpp = NULL; - *vp_heldp = false; + if (vp_heldp != NULL) + *vp_heldp = false; method = pagertab[object->type]->pgo_getvp; - if (method != NULL) { + if (method != NULL) method(object, vpp, vp_heldp); - } else { - KASSERT(0, - ("vm_pager_getvp: wrong object type obj %p", object)); - } } static __inline void From owner-dev-commits-src-branches@freebsd.org Sat May 22 09:46:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 A2CBB649414; Sat, 22 May 2021 09:46:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJX736G5z3ltd; Sat, 22 May 2021 09:46:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07873225AE; Sat, 22 May 2021 09:46:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9kUCm012475; Sat, 22 May 2021 09:46:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9kUAi012474; Sat, 22 May 2021 09:46:30 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:30 GMT Message-Id: <202105220946.14M9kUAi012474@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 6ecea720f361 - stable/13 - Style enum obj_type MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6ecea720f3619b490130d24d0a49f062c8a31236 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:31 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6ecea720f3619b490130d24d0a49f062c8a31236 commit 6ecea720f3619b490130d24d0a49f062c8a31236 Author: Konstantin Belousov AuthorDate: 2021-05-01 01:14:24 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:29 +0000 Style enum obj_type (cherry picked from commit 838adc533fa11b8c4e7da5603377fdd62c2f1d90) --- sys/vm/vm.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/vm/vm.h b/sys/vm/vm.h index 296449edc7c1..78d4cbbb1fd3 100644 --- a/sys/vm/vm.h +++ b/sys/vm/vm.h @@ -88,8 +88,16 @@ typedef u_char vm_prot_t; /* protection codes */ #define VM_PROT_RW (VM_PROT_READ|VM_PROT_WRITE) #define VM_PROT_DEFAULT VM_PROT_ALL -enum obj_type { OBJT_DEFAULT, OBJT_SWAP, OBJT_VNODE, OBJT_DEVICE, OBJT_PHYS, - OBJT_DEAD, OBJT_SG, OBJT_MGTDEVICE }; +enum obj_type { + OBJT_DEFAULT, + OBJT_SWAP, + OBJT_VNODE, + OBJT_DEVICE, + OBJT_PHYS, + OBJT_DEAD, + OBJT_SG, + OBJT_MGTDEVICE, +}; typedef u_char objtype_t; union vm_map_object; From owner-dev-commits-src-branches@freebsd.org Sat May 22 09:46:34 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 66F91649600; Sat, 22 May 2021 09:46:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJX94BxQz3llp; Sat, 22 May 2021 09:46:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4913C221F1; Sat, 22 May 2021 09:46:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9kXVr012523; Sat, 22 May 2021 09:46:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9kXLH012522; Sat, 22 May 2021 09:46:33 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:33 GMT Message-Id: <202105220946.14M9kXLH012522@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2daf5ac2e53e - stable/13 - Add OBJT_SWAP_TMPFS pager MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2daf5ac2e53efeb799c5127f3579fb09bbfc5306 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:35 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2daf5ac2e53efeb799c5127f3579fb09bbfc5306 commit 2daf5ac2e53efeb799c5127f3579fb09bbfc5306 Author: Konstantin Belousov AuthorDate: 2021-05-01 01:18:00 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:29 +0000 Add OBJT_SWAP_TMPFS pager (cherry picked from commit 4b8365d752ef48c14f0584d21b719bb386a7be82) --- sys/fs/procfs/procfs_map.c | 17 ++++--- sys/fs/tmpfs/tmpfs_subr.c | 11 ++--- sys/fs/tmpfs/tmpfs_vfsops.c | 10 ++-- sys/fs/tmpfs/tmpfs_vnops.c | 5 +- sys/vm/swap_pager.c | 114 ++++++++++++++++++++++++-------------------- sys/vm/vm.h | 1 + sys/vm/vm_fault.c | 2 +- sys/vm/vm_map.c | 8 ++-- sys/vm/vm_mmap.c | 5 +- sys/vm/vm_object.c | 24 ++++++---- sys/vm/vm_object.h | 2 +- sys/vm/vm_page.c | 4 +- sys/vm/vm_pageout.c | 5 +- sys/vm/vm_pager.c | 1 + sys/vm/vm_pager.h | 1 + 15 files changed, 115 insertions(+), 95 deletions(-) diff --git a/sys/fs/procfs/procfs_map.c b/sys/fs/procfs/procfs_map.c index a9893e5e10f0..eaa1cf8d4d35 100644 --- a/sys/fs/procfs/procfs_map.c +++ b/sys/fs/procfs/procfs_map.c @@ -165,17 +165,16 @@ procfs_doprocmap(PFS_FILL_ARGS) vp = lobj->handle; vref(vp); break; - case OBJT_SWAP: - if ((lobj->flags & OBJ_TMPFS_NODE) != 0) { - type = "vnode"; - if ((lobj->flags & OBJ_TMPFS) != 0) { - vp = lobj->un_pager.swp.swp_tmpfs; - vref(vp); - } - } else { - type = "swap"; + case OBJT_SWAP_TMPFS: + type = "vnode"; + if ((lobj->flags & OBJ_TMPFS) != 0) { + vp = lobj->un_pager.swp.swp_tmpfs; + vref(vp); } break; + case OBJT_SWAP: + type = "swap"; + break; case OBJT_SG: case OBJT_DEVICE: type = "device"; diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 84473a439c43..1ea4cf23b314 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -364,12 +364,10 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type, case VREG: obj = nnode->tn_reg.tn_aobj = - vm_pager_allocate(OBJT_SWAP, NULL, 0, VM_PROT_DEFAULT, 0, + vm_pager_allocate(OBJT_SWAP_TMPFS, NULL, 0, + VM_PROT_DEFAULT, 0, NULL /* XXXKIB - tmpfs needs swap reservation */); - VM_OBJECT_WLOCK(obj); /* OBJ_TMPFS is set together with the setting of vp->v_object */ - vm_object_set_flag(obj, OBJ_TMPFS_NODE); - VM_OBJECT_WUNLOCK(obj); nnode->tn_reg.tn_tmp = tmp; break; @@ -1590,8 +1588,9 @@ tmpfs_check_mtime(struct vnode *vp) if (vp->v_type != VREG) return; obj = vp->v_object; - KASSERT((obj->flags & (OBJ_TMPFS_NODE | OBJ_TMPFS)) == - (OBJ_TMPFS_NODE | OBJ_TMPFS), ("non-tmpfs obj")); + KASSERT(obj->type == OBJT_SWAP_TMPFS && + (obj->flags & (OBJ_SWAP | OBJ_TMPFS)) == + (OBJ_SWAP | OBJ_TMPFS), ("non-tmpfs obj")); /* unlocked read */ if (obj->generation != obj->cleangeneration) { VM_OBJECT_WLOCK(obj); diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index ba7c654d4f0a..51d097203135 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -120,8 +120,8 @@ tmpfs_update_mtime(struct mount *mp, bool lazy) continue; } obj = vp->v_object; - KASSERT((obj->flags & (OBJ_TMPFS_NODE | OBJ_TMPFS)) == - (OBJ_TMPFS_NODE | OBJ_TMPFS), ("non-tmpfs obj")); + MPASS(obj->type == OBJT_SWAP_TMPFS); + MPASS((obj->flags & OBJ_TMPFS) != 0); /* * In lazy case, do unlocked read, avoid taking vnode @@ -225,8 +225,7 @@ again: (entry->max_protection & VM_PROT_WRITE) == 0) continue; object = entry->object.vm_object; - if (object == NULL || object->type != OBJT_SWAP || - (object->flags & OBJ_TMPFS_NODE) == 0) + if (object == NULL || object->type != OBJT_SWAP_TMPFS) continue; /* * No need to dig into shadow chain, mapping @@ -239,8 +238,7 @@ again: continue; } MPASS(object->ref_count > 1); - if ((object->flags & (OBJ_TMPFS_NODE | OBJ_TMPFS)) != - (OBJ_TMPFS_NODE | OBJ_TMPFS)) { + if ((object->flags & OBJ_TMPFS) == 0) { VM_OBJECT_RUNLOCK(object); continue; } diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 94cb7fd868fa..401ee672b96a 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -623,8 +623,9 @@ tmpfs_read_pgcache(struct vop_read_pgcache_args *v) if (object == NULL) goto out_smr; - MPASS((object->flags & (OBJ_ANON | OBJ_DEAD | OBJ_TMPFS_NODE)) == - OBJ_TMPFS_NODE); + MPASS(object->type == OBJT_SWAP_TMPFS); + MPASS((object->flags & (OBJ_ANON | OBJ_DEAD | OBJ_SWAP)) == + OBJ_SWAP); if (!VN_IS_DOOMED(vp)) { /* size cannot become shorter due to rangelock. */ size = node->tn_size; diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index b81f73e41d05..2eaf1f746b58 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -418,6 +418,9 @@ static uma_zone_t swpctrie_zone; static vm_object_t swap_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t offset, struct ucred *); +static vm_object_t + swap_tmpfs_pager_alloc(void *handle, vm_ooffset_t size, + vm_prot_t prot, vm_ooffset_t offset, struct ucred *); static void swap_pager_dealloc(vm_object_t object); static int swap_pager_getpages(vm_object_t, vm_page_t *, int, int *, int *); @@ -433,9 +436,7 @@ static void swap_pager_update_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); static void swap_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); -static void swap_pager_set_writeable_dirty(vm_object_t object); -static bool swap_pager_mightbedirty(vm_object_t object); -static void swap_pager_getvp(vm_object_t object, struct vnode **vpp, +static void swap_tmpfs_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp); static void swap_pager_freespace(vm_object_t object, vm_pindex_t start, vm_size_t size); @@ -451,9 +452,22 @@ struct pagerops swappagerops = { .pgo_pageunswapped = swap_pager_unswapped, /* remove swap related to page */ .pgo_update_writecount = swap_pager_update_writecount, .pgo_release_writecount = swap_pager_release_writecount, - .pgo_set_writeable_dirty = swap_pager_set_writeable_dirty, - .pgo_mightbedirty = swap_pager_mightbedirty, - .pgo_getvp = swap_pager_getvp, + .pgo_freespace = swap_pager_freespace, +}; + +struct pagerops swaptmpfspagerops = { + .pgo_alloc = swap_tmpfs_pager_alloc, + .pgo_dealloc = swap_pager_dealloc, + .pgo_getpages = swap_pager_getpages, + .pgo_getpages_async = swap_pager_getpages_async, + .pgo_putpages = swap_pager_putpages, + .pgo_haspage = swap_pager_haspage, + .pgo_pageunswapped = swap_pager_unswapped, + .pgo_update_writecount = swap_pager_update_writecount, + .pgo_release_writecount = swap_pager_release_writecount, + .pgo_set_writeable_dirty = vm_object_set_writeable_dirty_, + .pgo_mightbedirty = vm_object_mightbedirty_, + .pgo_getvp = swap_tmpfs_pager_getvp, .pgo_freespace = swap_pager_freespace, }; @@ -665,8 +679,8 @@ swap_pager_swap_init(void) } static vm_object_t -swap_pager_alloc_init(void *handle, struct ucred *cred, vm_ooffset_t size, - vm_ooffset_t offset) +swap_pager_alloc_init(objtype_t otype, void *handle, struct ucred *cred, + vm_ooffset_t size, vm_ooffset_t offset) { vm_object_t object; @@ -681,7 +695,7 @@ swap_pager_alloc_init(void *handle, struct ucred *cred, vm_ooffset_t size, * vm_object_allocate() to ensure the correct order of * visibility to other threads. */ - object = vm_object_allocate(OBJT_SWAP, OFF_TO_IDX(offset + + object = vm_object_allocate(otype, OFF_TO_IDX(offset + PAGE_MASK + size)); object->un_pager.swp.writemappings = 0; @@ -720,8 +734,8 @@ swap_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, sx_xlock(&sw_alloc_sx); object = vm_pager_object_lookup(NOBJLIST(handle), handle); if (object == NULL) { - object = swap_pager_alloc_init(handle, cred, size, - offset); + object = swap_pager_alloc_init(OBJT_SWAP, handle, cred, + size, offset); if (object != NULL) { TAILQ_INSERT_TAIL(NOBJLIST(object->handle), object, pager_object_list); @@ -729,11 +743,24 @@ swap_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, } sx_xunlock(&sw_alloc_sx); } else { - object = swap_pager_alloc_init(handle, cred, size, offset); + object = swap_pager_alloc_init(OBJT_SWAP, handle, cred, + size, offset); } return (object); } +static vm_object_t +swap_tmpfs_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, + vm_ooffset_t offset, struct ucred *cred) +{ + vm_object_t object; + + MPASS(handle == NULL); + object = swap_pager_alloc_init(OBJT_SWAP_TMPFS, handle, cred, + size, offset); + return (object); +} + /* * SWAP_PAGER_DEALLOC() - remove swap metadata from object * @@ -775,6 +802,7 @@ swap_pager_dealloc(vm_object_t object) swp_pager_meta_free_all(object); object->handle = NULL; object->type = OBJT_DEAD; + vm_object_clear_flag(object, OBJ_SWAP); } /************************************************************************ @@ -1003,9 +1031,9 @@ swp_pager_xfer_source(vm_object_t srcobject, vm_object_t dstobject, { daddr_t dstaddr; - KASSERT(srcobject->type == OBJT_SWAP, + KASSERT((srcobject->flags & OBJ_SWAP) != 0, ("%s: Srcobject not swappable", __func__)); - if (dstobject->type == OBJT_SWAP && + if ((dstobject->flags & OBJ_SWAP) != 0 && swp_pager_meta_lookup(dstobject, pindex) != SWAPBLK_NONE) { /* Caller should destroy the source block. */ return (false); @@ -1086,6 +1114,7 @@ swap_pager_copy(vm_object_t srcobject, vm_object_t dstobject, * queues. */ srcobject->type = OBJT_DEFAULT; + vm_object_clear_flag(srcobject, OBJ_SWAP); } } @@ -1107,7 +1136,7 @@ swap_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before, int i; VM_OBJECT_ASSERT_LOCKED(object); - KASSERT(object->type == OBJT_SWAP, + KASSERT((object->flags & OBJ_SWAP) != 0, ("%s: object not swappable", __func__)); /* @@ -1203,7 +1232,7 @@ swap_pager_unswapped(vm_page_t m) * The meta data only exists if the object is OBJT_SWAP * and even then might not be allocated yet. */ - KASSERT(m->object->type == OBJT_SWAP, + KASSERT((m->object->flags & OBJ_SWAP) != 0, ("Free object not swappable")); sb = SWAP_PCTRIE_LOOKUP(&m->object->un_pager.swp.swp_blks, @@ -1241,7 +1270,7 @@ swap_pager_getpages_locked(vm_object_t object, vm_page_t *ma, int count, VM_OBJECT_ASSERT_WLOCKED(object); reqcount = count; - KASSERT(object->type == OBJT_SWAP, + KASSERT((object->flags & OBJ_SWAP) != 0, ("%s: object not swappable", __func__)); if (!swap_pager_haspage(object, ma[0]->pindex, &maxbehind, &maxahead)) { VM_OBJECT_WUNLOCK(object); @@ -1475,7 +1504,7 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma, int count, * * Turn object into OBJT_SWAP. Force sync if not a pageout process. */ - if (object->type != OBJT_SWAP) { + if ((object->flags & OBJ_SWAP) == 0) { addr = swp_pager_meta_build(object, 0, SWAPBLK_NONE); KASSERT(addr == SWAPBLK_NONE, ("unexpected object swap block")); @@ -1780,7 +1809,7 @@ swap_pager_swapped_pages(vm_object_t object) int i; VM_OBJECT_ASSERT_LOCKED(object); - if (object->type != OBJT_SWAP) + if ((object->flags & OBJ_SWAP) == 0) return (0); for (res = 0, pi = 0; (sb = SWAP_PCTRIE_LOOKUP_GE( @@ -1809,7 +1838,7 @@ swap_pager_swapoff_object(struct swdevt *sp, vm_object_t object) daddr_t blk; int i, nv, rahead, rv; - KASSERT(object->type == OBJT_SWAP, + KASSERT((object->flags & OBJ_SWAP) != 0, ("%s: Object not swappable", __func__)); for (pi = 0; (sb = SWAP_PCTRIE_LOOKUP_GE( @@ -1917,7 +1946,7 @@ swap_pager_swapoff(struct swdevt *sp) full_rescan: mtx_lock(&vm_object_list_mtx); TAILQ_FOREACH(object, &vm_object_list, object_list) { - if (object->type != OBJT_SWAP) + if ((object->flags & OBJ_SWAP) == 0) continue; mtx_unlock(&vm_object_list_mtx); /* Depends on type-stability. */ @@ -1936,7 +1965,7 @@ full_rescan: * dead. */ atomic_thread_fence_acq(); - if (object->type != OBJT_SWAP) + if ((object->flags & OBJ_SWAP) == 0) goto next_obj; swap_pager_swapoff_object(sp, object); @@ -2031,7 +2060,7 @@ swp_pager_meta_build(vm_object_t object, vm_pindex_t pindex, daddr_t swapblk) /* * Convert default object to swap object if necessary */ - if (object->type != OBJT_SWAP) { + if ((object->flags & OBJ_SWAP) == 0) { pctrie_init(&object->un_pager.swp.swp_blks); /* @@ -2041,6 +2070,7 @@ swp_pager_meta_build(vm_object_t object, vm_pindex_t pindex, daddr_t swapblk) atomic_thread_fence_rel(); object->type = OBJT_SWAP; + vm_object_set_flag(object, OBJ_SWAP); object->un_pager.swp.writemappings = 0; KASSERT((object->flags & OBJ_ANON) != 0 || object->handle == NULL, @@ -2149,7 +2179,7 @@ swp_pager_meta_transfer(vm_object_t srcobject, vm_object_t dstobject, int i, limit, start; VM_OBJECT_ASSERT_WLOCKED(srcobject); - if (srcobject->type != OBJT_SWAP || count == 0) + if ((srcobject->flags & OBJ_SWAP) == 0 || count == 0) return; swp_pager_init_freerange(&s_free, &n_free); @@ -2216,7 +2246,7 @@ swp_pager_meta_free_all(vm_object_t object) int i; VM_OBJECT_ASSERT_WLOCKED(object); - if (object->type != OBJT_SWAP) + if ((object->flags & OBJ_SWAP) == 0) return; swp_pager_init_freerange(&s_free, &n_free); @@ -2256,7 +2286,7 @@ swp_pager_meta_lookup(vm_object_t object, vm_pindex_t pindex) * The meta data only exists if the object is OBJT_SWAP * and even then might not be allocated yet. */ - KASSERT(object->type == OBJT_SWAP, + KASSERT((object->flags & OBJ_SWAP) != 0, ("Lookup object not swappable")); sb = SWAP_PCTRIE_LOOKUP(&object->un_pager.swp.swp_blks, @@ -2280,7 +2310,7 @@ swap_pager_find_least(vm_object_t object, vm_pindex_t pindex) int i; VM_OBJECT_ASSERT_LOCKED(object); - if (object->type != OBJT_SWAP) + if ((object->flags & OBJ_SWAP) == 0) return (object->size); sb = SWAP_PCTRIE_LOOKUP_GE(&object->un_pager.swp.swp_blks, @@ -2739,10 +2769,10 @@ vmspace_swap_count(struct vmspace *vmspace) if ((cur->eflags & MAP_ENTRY_IS_SUB_MAP) != 0) continue; object = cur->object.vm_object; - if (object == NULL || object->type != OBJT_SWAP) + if (object == NULL || (object->flags & OBJ_SWAP) == 0) continue; VM_OBJECT_RLOCK(object); - if (object->type != OBJT_SWAP) + if ((object->flags & OBJ_SWAP) == 0) goto unlock; pi = OFF_TO_IDX(cur->offset); e = pi + OFF_TO_IDX(cur->end - cur->start); @@ -3137,32 +3167,14 @@ swap_pager_release_writecount(vm_object_t object, vm_offset_t start, } static void -swap_pager_set_writeable_dirty(vm_object_t object) -{ - if ((object->flags & OBJ_TMPFS_NODE) != 0) - vm_object_set_writeable_dirty_(object); -} - -static bool -swap_pager_mightbedirty(vm_object_t object) -{ - if ((object->flags & OBJ_TMPFS_NODE) != 0) - return (vm_object_mightbedirty_(object)); - return (false); -} - -static void -swap_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) +swap_tmpfs_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) { struct vnode *vp; - KASSERT((object->flags & OBJ_TMPFS_NODE) != 0, - ("swap_pager_getvp: swap and !TMPFS obj %p", object)); - /* - * Tmpfs VREG node, which was reclaimed, has - * OBJ_TMPFS_NODE flag set, but not OBJ_TMPFS. In - * this case there is no v_writecount to adjust. + * Tmpfs VREG node, which was reclaimed, has OBJT_SWAP_TMPFS + * type, but not OBJ_TMPFS flag. In this case there is no + * v_writecount to adjust. */ if (vp_heldp != NULL) VM_OBJECT_RLOCK(object); diff --git a/sys/vm/vm.h b/sys/vm/vm.h index 78d4cbbb1fd3..10bf3d46f2c0 100644 --- a/sys/vm/vm.h +++ b/sys/vm/vm.h @@ -97,6 +97,7 @@ enum obj_type { OBJT_DEAD, OBJT_SG, OBJT_MGTDEVICE, + OBJT_SWAP_TMPFS, }; typedef u_char objtype_t; diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 0e8ff9b27ed1..03ca297ea683 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -1943,7 +1943,7 @@ vm_fault_copy_entry(vm_map_t dst_map, vm_map_t src_map, crhold(dst_object->cred); *fork_charge += dst_object->charge; } else if ((dst_object->type == OBJT_DEFAULT || - dst_object->type == OBJT_SWAP) && + (dst_object->flags & OBJ_SWAP) != 0) && dst_object->cred == NULL) { KASSERT(dst_entry->cred != NULL, ("no cred for entry %p", dst_entry)); diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 60c88a7b71bf..1ac4ccf72f11 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -2826,10 +2826,12 @@ again: continue; } - if (obj->type != OBJT_DEFAULT && obj->type != OBJT_SWAP) + if (obj->type != OBJT_DEFAULT && + (obj->flags & OBJ_SWAP) == 0) continue; VM_OBJECT_WLOCK(obj); - if (obj->type != OBJT_DEFAULT && obj->type != OBJT_SWAP) { + if (obj->type != OBJT_DEFAULT && + (obj->flags & OBJ_SWAP) == 0) { VM_OBJECT_WUNLOCK(obj); continue; } @@ -4140,7 +4142,7 @@ vm_map_copy_entry( size = src_entry->end - src_entry->start; if ((src_object = src_entry->object.vm_object) != NULL) { if (src_object->type == OBJT_DEFAULT || - src_object->type == OBJT_SWAP) { + (src_object->flags & OBJ_SWAP) != 0) { vm_map_copy_swap_object(src_entry, dst_entry, size, fork_charge); /* May have split/collapsed, reload obj. */ diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 30c485010ac8..adbecd01ef38 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -929,7 +929,7 @@ retry: VM_OBJECT_WLOCK(object); } if (object->type == OBJT_DEFAULT || - object->type == OBJT_SWAP || + (object->flags & OBJ_SWAP) != 0 || object->type == OBJT_VNODE) { pindex = OFF_TO_IDX(current->offset + (addr - current->start)); @@ -1356,7 +1356,8 @@ vm_mmap_vnode(struct thread *td, vm_size_t objsize, goto done; } } else { - KASSERT(obj->type == OBJT_DEFAULT || obj->type == OBJT_SWAP, + KASSERT(obj->type == OBJT_DEFAULT || + (obj->flags & OBJ_SWAP) != 0, ("wrong object type")); vm_object_reference(obj); #if VM_NRESERVLEVEL > 0 diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index bbcbad41f10c..1c4e879d82ea 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -240,7 +240,8 @@ _vm_object_allocate(objtype_t type, vm_pindex_t size, u_short flags, LIST_INIT(&object->shadow_head); object->type = type; - if (type == OBJT_SWAP) + object->flags = flags; + if ((flags & OBJ_SWAP) != 0) pctrie_init(&object->un_pager.swp.swp_blks); /* @@ -251,7 +252,6 @@ _vm_object_allocate(objtype_t type, vm_pindex_t size, u_short flags, atomic_thread_fence_rel(); object->pg_color = 0; - object->flags = flags; object->size = size; object->domain.dr_policy = NULL; object->generation = 1; @@ -337,6 +337,7 @@ vm_object_set_memattr(vm_object_t object, vm_memattr_t memattr) case OBJT_PHYS: case OBJT_SG: case OBJT_SWAP: + case OBJT_SWAP_TMPFS: case OBJT_VNODE: if (!TAILQ_EMPTY(&object->memq)) return (KERN_FAILURE); @@ -421,9 +422,12 @@ vm_object_allocate(objtype_t type, vm_pindex_t size) case OBJT_DEAD: panic("vm_object_allocate: can't create OBJT_DEAD"); case OBJT_DEFAULT: - case OBJT_SWAP: flags = OBJ_COLORED; break; + case OBJT_SWAP: + case OBJT_SWAP_TMPFS: + flags = OBJ_COLORED | OBJ_SWAP; + break; case OBJT_DEVICE: case OBJT_SG: flags = OBJ_FICTITIOUS | OBJ_UNMANAGED; @@ -573,7 +577,7 @@ vm_object_deallocate_anon(vm_object_t backing_object) KASSERT(object != NULL && backing_object->shadow_count == 1, ("vm_object_anon_deallocate: ref_count: %d, shadow_count: %d", backing_object->ref_count, backing_object->shadow_count)); - KASSERT((object->flags & (OBJ_TMPFS_NODE | OBJ_ANON)) == OBJ_ANON, + KASSERT((object->flags & OBJ_ANON) != 0, ("invalid shadow object %p", object)); if (!VM_OBJECT_TRYWLOCK(object)) { @@ -677,7 +681,7 @@ vm_object_deallocate(vm_object_t object) umtx_shm_object_terminated(object); temp = object->backing_object; if (temp != NULL) { - KASSERT((object->flags & OBJ_TMPFS_NODE) == 0, + KASSERT(object->type != OBJT_SWAP_TMPFS, ("shadowed tmpfs v_object 2 %p", object)); vm_object_backing_remove(object); } @@ -958,7 +962,7 @@ vm_object_terminate(vm_object_t object) #endif KASSERT(object->cred == NULL || object->type == OBJT_DEFAULT || - object->type == OBJT_SWAP, + object->type == OBJT_SWAP || object->type == OBJT_SWAP_TMPFS, ("%s: non-swap obj %p has cred", __func__, object)); /* @@ -1627,7 +1631,7 @@ retry: else if (m_busy == NULL) m_busy = m; } - if (orig_object->type == OBJT_SWAP) { + if ((orig_object->flags & OBJ_SWAP) != 0) { /* * swap_pager_copy() can sleep, in which case the orig_object's * and new_object's locks are released and reacquired. @@ -1955,7 +1959,7 @@ vm_object_collapse(vm_object_t object) /* * Move the pager from backing_object to object. */ - if (backing_object->type == OBJT_SWAP) { + if ((backing_object->flags & OBJ_SWAP) != 0) { /* * swap_pager_copy() can sleep, in which case * the backing_object's and object's locks are @@ -2482,9 +2486,9 @@ vm_object_kvme_type(vm_object_t object, struct vnode **vpp) case OBJT_VNODE: return (KVME_TYPE_VNODE); case OBJT_SWAP: - if ((object->flags & OBJ_TMPFS_NODE) != 0) - return (KVME_TYPE_VNODE); return (KVME_TYPE_SWAP); + case OBJT_SWAP_TMPFS: + return (KVME_TYPE_VNODE); case OBJT_DEVICE: return (KVME_TYPE_DEVICE); case OBJT_PHYS: diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index c7bbec0e7a86..749f33ee16c0 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -201,7 +201,7 @@ struct vm_object { #define OBJ_UMTXDEAD 0x0020 /* umtx pshared was terminated */ #define OBJ_SIZEVNLOCK 0x0040 /* lock vnode to check obj size */ #define OBJ_PG_DTOR 0x0080 /* dont reset object, leave that for dtor */ -#define OBJ_TMPFS_NODE 0x0200 /* object belongs to tmpfs VREG node */ +#define OBJ_SWAP 0x0200 /* object swaps */ #define OBJ_SPLIT 0x0400 /* object is being split */ #define OBJ_COLLAPSING 0x0800 /* Parent of collapse. */ #define OBJ_COLORED 0x1000 /* pg_color is defined */ diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index da62e6795c81..c7d548471e89 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2639,7 +2639,7 @@ retry: } /* Don't care: PG_NODUMP, PG_ZERO. */ if (object->type != OBJT_DEFAULT && - object->type != OBJT_SWAP && + (object->flags & OBJ_SWAP) == 0 && object->type != OBJT_VNODE) { run_ext = 0; #if VM_NRESERVLEVEL > 0 @@ -2777,7 +2777,7 @@ vm_page_reclaim_run(int req_class, int domain, u_long npages, vm_page_t m_run, /* Don't care: PG_NODUMP, PG_ZERO. */ if (m->object != object || (object->type != OBJT_DEFAULT && - object->type != OBJT_SWAP && + (object->flags & OBJ_SWAP) == 0 && object->type != OBJT_VNODE)) error = EINVAL; else if (object->memattr != VM_MEMATTR_DEFAULT) diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index e49966102a9c..521fc4ce95f2 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -545,7 +545,7 @@ vm_pageout_flush(vm_page_t *mc, int count, int flags, int mreq, int *prunlen, * clog the laundry and inactive queues. (We will try * paging it out again later.) */ - if (object->type == OBJT_SWAP && + if ((object->flags & OBJ_SWAP) != 0 && pageout_status[i] == VM_PAGER_FAIL) { vm_page_unswappable(mt); numpagedout++; @@ -897,7 +897,7 @@ free_page: vm_page_free(m); VM_CNT_INC(v_dfree); } else if ((object->flags & OBJ_DEAD) == 0) { - if (object->type != OBJT_SWAP && + if ((object->flags & OBJ_SWAP) == 0 && object->type != OBJT_DEFAULT) pageout_ok = true; else if (disable_swap_pageouts) @@ -1890,6 +1890,7 @@ vm_pageout_oom_pagecount(struct vmspace *vmspace) switch (obj->type) { case OBJT_DEFAULT: case OBJT_SWAP: + case OBJT_SWAP_TMPFS: case OBJT_PHYS: case OBJT_VNODE: res += obj->resident_page_count; diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 8be344b7665b..30e84fa00a3e 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -172,6 +172,7 @@ struct pagerops *pagertab[] = { [OBJT_DEAD] = &deadpagerops, [OBJT_SG] = &sgpagerops, [OBJT_MGTDEVICE] = &mgtdevicepagerops, + [OBJT_SWAP_TMPFS] = &swaptmpfspagerops, }; void diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index 507123adb454..55d231a73f39 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -95,6 +95,7 @@ extern struct pagerops devicepagerops; extern struct pagerops physpagerops; extern struct pagerops sgpagerops; extern struct pagerops mgtdevicepagerops; +extern struct pagerops swaptmpfspagerops; /* * get/put return values From owner-dev-commits-src-branches@freebsd.org Sat May 22 09:46:32 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 CF53C64948F; Sat, 22 May 2021 09:46:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJX82zHrz3lrk; Sat, 22 May 2021 09:46:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A609225AF; Sat, 22 May 2021 09:46:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9kWkc012496; Sat, 22 May 2021 09:46:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9kWPE012495; Sat, 22 May 2021 09:46:32 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:32 GMT Message-Id: <202105220946.14M9kWPE012495@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: f871a71a8253 - stable/13 - pagertab: use designated initializers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f871a71a82531bb5f62a47c5589199fda09803ec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:33 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f871a71a82531bb5f62a47c5589199fda09803ec commit f871a71a82531bb5f62a47c5589199fda09803ec Author: Konstantin Belousov AuthorDate: 2021-05-01 17:20:36 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:29 +0000 pagertab: use designated initializers (cherry picked from commit 0d2dfc6fed03c36f7c4a9bb2a4223028f3b4431b) --- sys/vm/vm_pager.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 587407a06291..8be344b7665b 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -164,14 +164,14 @@ static struct pagerops deadpagerops = { }; struct pagerops *pagertab[] = { - &defaultpagerops, /* OBJT_DEFAULT */ - &swappagerops, /* OBJT_SWAP */ - &vnodepagerops, /* OBJT_VNODE */ - &devicepagerops, /* OBJT_DEVICE */ - &physpagerops, /* OBJT_PHYS */ - &deadpagerops, /* OBJT_DEAD */ - &sgpagerops, /* OBJT_SG */ - &mgtdevicepagerops, /* OBJT_MGTDEVICE */ + [OBJT_DEFAULT] = &defaultpagerops, + [OBJT_SWAP] = &swappagerops, + [OBJT_VNODE] = &vnodepagerops, + [OBJT_DEVICE] = &devicepagerops, + [OBJT_PHYS] = &physpagerops, + [OBJT_DEAD] = &deadpagerops, + [OBJT_SG] = &sgpagerops, + [OBJT_MGTDEVICE] = &mgtdevicepagerops, }; void From owner-dev-commits-src-branches@freebsd.org Sat May 22 09:46:38 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 27392649686; Sat, 22 May 2021 09:46:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJXF1hpbz3lpS; Sat, 22 May 2021 09:46:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CFFF8225B0; Sat, 22 May 2021 09:46:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9kaGm012591; Sat, 22 May 2021 09:46:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9ka85012590; Sat, 22 May 2021 09:46:36 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:36 GMT Message-Id: <202105220946.14M9ka85012590@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 4c4bb6da853b - stable/13 - vm_object_kvme_type(): reimplement by embedding kvme_type into pagerops MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4c4bb6da853bb86f24483fefa5a676a3a6b6c556 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:38 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4c4bb6da853bb86f24483fefa5a676a3a6b6c556 commit 4c4bb6da853bb86f24483fefa5a676a3a6b6c556 Author: Konstantin Belousov AuthorDate: 2021-05-07 17:46:51 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:30 +0000 vm_object_kvme_type(): reimplement by embedding kvme_type into pagerops (cherry picked from commit 00a3fe968b840ee197c32dfe4107dab730bd9915) --- sys/vm/default_pager.c | 2 ++ sys/vm/device_pager.c | 3 +++ sys/vm/phys_pager.c | 2 ++ sys/vm/sg_pager.c | 2 ++ sys/vm/swap_pager.c | 3 +++ sys/vm/vm_object.c | 35 ----------------------------------- sys/vm/vm_pager.c | 16 ++++++++++++++++ sys/vm/vm_pager.h | 1 + sys/vm/vnode_pager.c | 2 ++ 9 files changed, 31 insertions(+), 35 deletions(-) diff --git a/sys/vm/default_pager.c b/sys/vm/default_pager.c index 758012692a48..d07a84f8c98e 100644 --- a/sys/vm/default_pager.c +++ b/sys/vm/default_pager.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -71,6 +72,7 @@ static boolean_t default_pager_haspage(vm_object_t, vm_pindex_t, int *, * object is converted to swap pager type. */ const struct pagerops defaultpagerops = { + .pgo_kvme_type = KVME_TYPE_DEFAULT, .pgo_alloc = default_pager_alloc, .pgo_dealloc = default_pager_dealloc, .pgo_getpages = default_pager_getpages, diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c index 25affb114a47..567f8fe55817 100644 --- a/sys/vm/device_pager.c +++ b/sys/vm/device_pager.c @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -75,6 +76,7 @@ static struct pagerlst dev_pager_object_list; static struct mtx dev_pager_mtx; const struct pagerops devicepagerops = { + .pgo_kvme_type = KVME_TYPE_DEVICE, .pgo_init = dev_pager_init, .pgo_alloc = dev_pager_alloc, .pgo_dealloc = dev_pager_dealloc, @@ -84,6 +86,7 @@ const struct pagerops devicepagerops = { }; const struct pagerops mgtdevicepagerops = { + .pgo_kvme_type = KVME_TYPE_MGTDEVICE, .pgo_alloc = dev_pager_alloc, .pgo_dealloc = dev_pager_dealloc, .pgo_getpages = dev_pager_getpages, diff --git a/sys/vm/phys_pager.c b/sys/vm/phys_pager.c index af7b10701b16..6d7c5a4a7291 100644 --- a/sys/vm/phys_pager.c +++ b/sys/vm/phys_pager.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -299,6 +300,7 @@ phys_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before, } const struct pagerops physpagerops = { + .pgo_kvme_type = KVME_TYPE_PHYS, .pgo_init = phys_pager_init, .pgo_alloc = phys_pager_alloc, .pgo_dealloc = phys_pager_dealloc, diff --git a/sys/vm/sg_pager.c b/sys/vm/sg_pager.c index 9b3e60bc170a..d7af2aed935a 100644 --- a/sys/vm/sg_pager.c +++ b/sys/vm/sg_pager.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -60,6 +61,7 @@ static boolean_t sg_pager_haspage(vm_object_t, vm_pindex_t, int *, int *); const struct pagerops sgpagerops = { + .pgo_kvme_type = KVME_TYPE_SG, .pgo_alloc = sg_pager_alloc, .pgo_dealloc = sg_pager_dealloc, .pgo_getpages = sg_pager_getpages, diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 57c953542a88..37db4cbac857 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -99,6 +99,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -442,6 +443,7 @@ static void swap_pager_freespace(vm_object_t object, vm_pindex_t start, vm_size_t size); const struct pagerops swappagerops = { + .pgo_kvme_type = KVME_TYPE_SWAP, .pgo_init = swap_pager_init, /* early system initialization of pager */ .pgo_alloc = swap_pager_alloc, /* allocate an OBJT_SWAP object */ .pgo_dealloc = swap_pager_dealloc, /* deallocate an OBJT_SWAP object */ @@ -456,6 +458,7 @@ const struct pagerops swappagerops = { }; const struct pagerops swaptmpfspagerops = { + .pgo_kvme_type = KVME_TYPE_VNODE, .pgo_alloc = swap_tmpfs_pager_alloc, .pgo_dealloc = swap_pager_dealloc, .pgo_getpages = swap_pager_getpages, diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 1c4e879d82ea..735ab603a09b 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2469,41 +2469,6 @@ vm_object_busy_wait(vm_object_t obj, const char *wmesg) (void)blockcount_sleep(&obj->busy, NULL, wmesg, PVM); } -/* - * Return the kvme type of the given object. - * If vpp is not NULL, set it to the object's vm_object_vnode() or NULL. - */ -int -vm_object_kvme_type(vm_object_t object, struct vnode **vpp) -{ - - VM_OBJECT_ASSERT_LOCKED(object); - if (vpp != NULL) - *vpp = vm_object_vnode(object); - switch (object->type) { - case OBJT_DEFAULT: - return (KVME_TYPE_DEFAULT); - case OBJT_VNODE: - return (KVME_TYPE_VNODE); - case OBJT_SWAP: - return (KVME_TYPE_SWAP); - case OBJT_SWAP_TMPFS: - return (KVME_TYPE_VNODE); - case OBJT_DEVICE: - return (KVME_TYPE_DEVICE); - case OBJT_PHYS: - return (KVME_TYPE_PHYS); - case OBJT_DEAD: - return (KVME_TYPE_DEAD); - case OBJT_SG: - return (KVME_TYPE_SG); - case OBJT_MGTDEVICE: - return (KVME_TYPE_MGTDEVICE); - default: - return (KVME_TYPE_UNKNOWN); - } -} - static int sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) { diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 240847903f62..9476058a75bf 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -155,6 +156,7 @@ dead_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) } static const struct pagerops deadpagerops = { + .pgo_kvme_type = KVME_TYPE_DEAD, .pgo_alloc = dead_pager_alloc, .pgo_dealloc = dead_pager_dealloc, .pgo_getpages = dead_pager_getpages, @@ -530,3 +532,17 @@ vm_object_mightbedirty(vm_object_t object) return (false); return (method(object)); } + +/* + * Return the kvme type of the given object. + * If vpp is not NULL, set it to the object's vm_object_vnode() or NULL. + */ +int +vm_object_kvme_type(vm_object_t object, struct vnode **vpp) +{ + VM_OBJECT_ASSERT_LOCKED(object); + + if (vpp != NULL) + *vpp = vm_object_vnode(object); + return (pagertab[object->type]->pgo_kvme_type); +} diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index 68c5fe42351e..5e0261f818cf 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -71,6 +71,7 @@ typedef void pgo_freespace_t(vm_object_t object, vm_pindex_t start, vm_size_t size); struct pagerops { + int pgo_kvme_type; pgo_init_t *pgo_init; /* Initialize pager. */ pgo_alloc_t *pgo_alloc; /* Allocate pager. */ pgo_dealloc_t *pgo_dealloc; /* Disassociate. */ diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index c264fc992b26..08927b5671f6 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -108,6 +109,7 @@ static void vnode_pager_release_writecount(vm_object_t, vm_offset_t, static void vnode_pager_getvp(vm_object_t, struct vnode **, bool *); const struct pagerops vnodepagerops = { + .pgo_kvme_type = KVME_TYPE_VNODE, .pgo_alloc = vnode_pager_alloc, .pgo_dealloc = vnode_pager_dealloc, .pgo_getpages = vnode_pager_getpages, From owner-dev-commits-src-branches@freebsd.org Sat May 22 09:46:35 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 66E8C648F7E; Sat, 22 May 2021 09:46:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJXC0kLjz3m31; Sat, 22 May 2021 09:46:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 68900221F2; Sat, 22 May 2021 09:46:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9kYUh012545; Sat, 22 May 2021 09:46:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9kYL2012544; Sat, 22 May 2021 09:46:34 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:34 GMT Message-Id: <202105220946.14M9kYL2012544@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 55b68c9ac1f7 - stable/13 - Constify vm_pager-related virtual tables. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 55b68c9ac1f70b04665cf29b7db3baf122aadbd2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:35 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=55b68c9ac1f70b04665cf29b7db3baf122aadbd2 commit 55b68c9ac1f70b04665cf29b7db3baf122aadbd2 Author: Konstantin Belousov AuthorDate: 2021-05-03 21:58:07 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:29 +0000 Constify vm_pager-related virtual tables. (cherry picked from commit d474440ab33c683b0e3f55e8e854f055615db6ec) --- sys/kern/uipc_shm.c | 2 +- sys/vm/default_pager.c | 2 +- sys/vm/device_pager.c | 11 ++++++----- sys/vm/phys_pager.c | 6 +++--- sys/vm/sg_pager.c | 2 +- sys/vm/swap_pager.c | 4 ++-- sys/vm/vm_object.h | 4 ++-- sys/vm/vm_pager.c | 8 ++++---- sys/vm/vm_pager.h | 24 ++++++++++++------------ sys/vm/vnode_pager.c | 2 +- 10 files changed, 33 insertions(+), 32 deletions(-) diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c index 88151f1422f9..58c9f8cec239 100644 --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -327,7 +327,7 @@ shm_largepage_phys_dtor(vm_object_t object) } } -static struct phys_pager_ops shm_largepage_phys_ops = { +static const struct phys_pager_ops shm_largepage_phys_ops = { .phys_pg_populate = shm_largepage_phys_populate, .phys_pg_haspage = shm_largepage_phys_haspage, .phys_pg_ctor = shm_largepage_phys_ctor, diff --git a/sys/vm/default_pager.c b/sys/vm/default_pager.c index 057dbe895050..758012692a48 100644 --- a/sys/vm/default_pager.c +++ b/sys/vm/default_pager.c @@ -70,7 +70,7 @@ static boolean_t default_pager_haspage(vm_object_t, vm_pindex_t, int *, * On the first request to page out a page from a default object, the * object is converted to swap pager type. */ -struct pagerops defaultpagerops = { +const struct pagerops defaultpagerops = { .pgo_alloc = default_pager_alloc, .pgo_dealloc = default_pager_dealloc, .pgo_getpages = default_pager_getpages, diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c index 40b32e9bad74..25affb114a47 100644 --- a/sys/vm/device_pager.c +++ b/sys/vm/device_pager.c @@ -74,7 +74,7 @@ static struct pagerlst dev_pager_object_list; /* protect list manipulation */ static struct mtx dev_pager_mtx; -struct pagerops devicepagerops = { +const struct pagerops devicepagerops = { .pgo_init = dev_pager_init, .pgo_alloc = dev_pager_alloc, .pgo_dealloc = dev_pager_dealloc, @@ -83,7 +83,7 @@ struct pagerops devicepagerops = { .pgo_haspage = dev_pager_haspage, }; -struct pagerops mgtdevicepagerops = { +const struct pagerops mgtdevicepagerops = { .pgo_alloc = dev_pager_alloc, .pgo_dealloc = dev_pager_dealloc, .pgo_getpages = dev_pager_getpages, @@ -98,7 +98,7 @@ static void old_dev_pager_dtor(void *handle); static int old_dev_pager_fault(vm_object_t object, vm_ooffset_t offset, int prot, vm_page_t *mres); -static struct cdev_pager_ops old_dev_pager_ops = { +static const struct cdev_pager_ops old_dev_pager_ops = { .cdev_pg_ctor = old_dev_pager_ctor, .cdev_pg_dtor = old_dev_pager_dtor, .cdev_pg_fault = old_dev_pager_fault @@ -124,8 +124,9 @@ cdev_pager_lookup(void *handle) } vm_object_t -cdev_pager_allocate(void *handle, enum obj_type tp, struct cdev_pager_ops *ops, - vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t foff, struct ucred *cred) +cdev_pager_allocate(void *handle, enum obj_type tp, + const struct cdev_pager_ops *ops, vm_ooffset_t size, vm_prot_t prot, + vm_ooffset_t foff, struct ucred *cred) { vm_object_t object, object1; vm_pindex_t pindex; diff --git a/sys/vm/phys_pager.c b/sys/vm/phys_pager.c index 19a8b97a3d56..af7b10701b16 100644 --- a/sys/vm/phys_pager.c +++ b/sys/vm/phys_pager.c @@ -57,7 +57,7 @@ static int default_phys_pager_populate(vm_object_t object, vm_pindex_t pidx, int fault_type, vm_prot_t max_prot, vm_pindex_t *first, vm_pindex_t *last); static boolean_t default_phys_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before, int *after); -struct phys_pager_ops default_phys_pg_ops = { +const struct phys_pager_ops default_phys_pg_ops = { .phys_pg_getpages = default_phys_pager_getpages, .phys_pg_populate = default_phys_pager_populate, .phys_pg_haspage = default_phys_pager_haspage, @@ -74,7 +74,7 @@ phys_pager_init(void) } vm_object_t -phys_pager_allocate(void *handle, struct phys_pager_ops *ops, void *data, +phys_pager_allocate(void *handle, const struct phys_pager_ops *ops, void *data, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t foff, struct ucred *cred) { vm_object_t object, object1; @@ -298,7 +298,7 @@ phys_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before, before, after)); } -struct pagerops physpagerops = { +const struct pagerops physpagerops = { .pgo_init = phys_pager_init, .pgo_alloc = phys_pager_alloc, .pgo_dealloc = phys_pager_dealloc, diff --git a/sys/vm/sg_pager.c b/sys/vm/sg_pager.c index 2145f487ec34..9b3e60bc170a 100644 --- a/sys/vm/sg_pager.c +++ b/sys/vm/sg_pager.c @@ -59,7 +59,7 @@ static void sg_pager_putpages(vm_object_t, vm_page_t *, int, static boolean_t sg_pager_haspage(vm_object_t, vm_pindex_t, int *, int *); -struct pagerops sgpagerops = { +const struct pagerops sgpagerops = { .pgo_alloc = sg_pager_alloc, .pgo_dealloc = sg_pager_dealloc, .pgo_getpages = sg_pager_getpages, diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 2eaf1f746b58..57c953542a88 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -441,7 +441,7 @@ static void swap_tmpfs_pager_getvp(vm_object_t object, struct vnode **vpp, static void swap_pager_freespace(vm_object_t object, vm_pindex_t start, vm_size_t size); -struct pagerops swappagerops = { +const struct pagerops swappagerops = { .pgo_init = swap_pager_init, /* early system initialization of pager */ .pgo_alloc = swap_pager_alloc, /* allocate an OBJT_SWAP object */ .pgo_dealloc = swap_pager_dealloc, /* deallocate an OBJT_SWAP object */ @@ -455,7 +455,7 @@ struct pagerops swappagerops = { .pgo_freespace = swap_pager_freespace, }; -struct pagerops swaptmpfspagerops = { +const struct pagerops swaptmpfspagerops = { .pgo_alloc = swap_tmpfs_pager_alloc, .pgo_dealloc = swap_pager_dealloc, .pgo_getpages = swap_pager_getpages, diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index 749f33ee16c0..0e1ed321255f 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -140,7 +140,7 @@ struct vm_object { */ struct { TAILQ_HEAD(, vm_page) devp_pglist; - struct cdev_pager_ops *ops; + const struct cdev_pager_ops *ops; struct cdev *dev; } devp; @@ -178,7 +178,7 @@ struct vm_object { * Phys pager */ struct { - struct phys_pager_ops *ops; + const struct phys_pager_ops *ops; union { void *data_ptr; uintptr_t data_val; diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 30e84fa00a3e..240847903f62 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -154,7 +154,7 @@ dead_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) */ } -static struct pagerops deadpagerops = { +static const struct pagerops deadpagerops = { .pgo_alloc = dead_pager_alloc, .pgo_dealloc = dead_pager_dealloc, .pgo_getpages = dead_pager_getpages, @@ -163,7 +163,7 @@ static struct pagerops deadpagerops = { .pgo_getvp = dead_pager_getvp, }; -struct pagerops *pagertab[] = { +const struct pagerops *pagertab[] __read_mostly = { [OBJT_DEFAULT] = &defaultpagerops, [OBJT_SWAP] = &swappagerops, [OBJT_VNODE] = &vnodepagerops, @@ -178,7 +178,7 @@ struct pagerops *pagertab[] = { void vm_pager_init(void) { - struct pagerops **pgops; + const struct pagerops **pgops; /* * Initialize known pagers @@ -244,7 +244,7 @@ vm_pager_allocate(objtype_t type, void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t off, struct ucred *cred) { vm_object_t ret; - struct pagerops *ops; + const struct pagerops *ops; ops = pagertab[type]; if (ops) diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index 55d231a73f39..68c5fe42351e 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -88,14 +88,14 @@ struct pagerops { pgo_freespace_t *pgo_freespace; }; -extern struct pagerops defaultpagerops; -extern struct pagerops swappagerops; -extern struct pagerops vnodepagerops; -extern struct pagerops devicepagerops; -extern struct pagerops physpagerops; -extern struct pagerops sgpagerops; -extern struct pagerops mgtdevicepagerops; -extern struct pagerops swaptmpfspagerops; +extern const struct pagerops defaultpagerops; +extern const struct pagerops swappagerops; +extern const struct pagerops vnodepagerops; +extern const struct pagerops devicepagerops; +extern const struct pagerops physpagerops; +extern const struct pagerops sgpagerops; +extern const struct pagerops mgtdevicepagerops; +extern const struct pagerops swaptmpfspagerops; /* * get/put return values @@ -120,7 +120,7 @@ extern struct pagerops swaptmpfspagerops; #ifdef _KERNEL -extern struct pagerops *pagertab[]; +extern const struct pagerops *pagertab[] __read_mostly; extern struct mtx_padalign pbuf_mtx; /* @@ -260,7 +260,7 @@ struct cdev_pager_ops { }; vm_object_t cdev_pager_allocate(void *handle, enum obj_type tp, - struct cdev_pager_ops *ops, vm_ooffset_t size, vm_prot_t prot, + const struct cdev_pager_ops *ops, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t foff, struct ucred *cred); vm_object_t cdev_pager_lookup(void *handle); void cdev_pager_free_page(vm_object_t object, vm_page_t m); @@ -277,8 +277,8 @@ struct phys_pager_ops { vm_ooffset_t foff, struct ucred *cred); void (*phys_pg_dtor)(vm_object_t vm_obj); }; -extern struct phys_pager_ops default_phys_pg_ops; -vm_object_t phys_pager_allocate(void *handle, struct phys_pager_ops *ops, +extern const struct phys_pager_ops default_phys_pg_ops; +vm_object_t phys_pager_allocate(void *handle, const struct phys_pager_ops *ops, void *data, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t foff, struct ucred *cred); diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index eeced1b981d1..c264fc992b26 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -107,7 +107,7 @@ static void vnode_pager_release_writecount(vm_object_t, vm_offset_t, vm_offset_t); static void vnode_pager_getvp(vm_object_t, struct vnode **, bool *); -struct pagerops vnodepagerops = { +const struct pagerops vnodepagerops = { .pgo_alloc = vnode_pager_alloc, .pgo_dealloc = vnode_pager_dealloc, .pgo_getpages = vnode_pager_getpages, From owner-dev-commits-src-branches@freebsd.org Sat May 22 09:46:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 4FD7564925D; Sat, 22 May 2021 09:46:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJXC5XQ0z3ltp; Sat, 22 May 2021 09:46:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 86740221F3; Sat, 22 May 2021 09:46:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9kZTZ012568; Sat, 22 May 2021 09:46:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9kZ3t012567; Sat, 22 May 2021 09:46:35 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:35 GMT Message-Id: <202105220946.14M9kZ3t012567@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 35d83ba23556 - stable/13 - Close races in vm object chain traversal for unlock MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 35d83ba2355692a4d323936086bbf36aa95ce43b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:36 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=35d83ba2355692a4d323936086bbf36aa95ce43b commit 35d83ba2355692a4d323936086bbf36aa95ce43b Author: Ryan Libby AuthorDate: 2021-02-25 20:11:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:29 +0000 Close races in vm object chain traversal for unlock (cherry picked from commit d7671ad8d6ebe205933628466dc0a52d32eea2e8) --- sys/fs/procfs/procfs_map.c | 5 +++-- sys/kern/kern_proc.c | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/fs/procfs/procfs_map.c b/sys/fs/procfs/procfs_map.c index eaa1cf8d4d35..9ee49b0149a2 100644 --- a/sys/fs/procfs/procfs_map.c +++ b/sys/fs/procfs/procfs_map.c @@ -84,7 +84,7 @@ procfs_doprocmap(PFS_FILL_ARGS) struct vnode *vp; char *fullpath, *freepath, *type; struct ucred *cred; - vm_object_t obj, tobj, lobj; + vm_object_t lobj, nobj, obj, tobj; int error, privateresident, ref_count, resident, shadow_count, flags; vm_offset_t e_start, e_end; vm_eflags_t e_eflags; @@ -144,7 +144,8 @@ procfs_doprocmap(PFS_FILL_ARGS) } if (obj != NULL) kern_proc_vmmap_resident(map, entry, &resident, &super); - for (tobj = obj; tobj != NULL; tobj = tobj->backing_object) { + for (tobj = obj; tobj != NULL; tobj = nobj) { + nobj = tobj->backing_object; if (tobj != obj && tobj != lobj) VM_OBJECT_RUNLOCK(tobj); } diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index d2414df60d7a..33f168836370 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -2505,7 +2505,7 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, ssize_t maxlen, int flags) vm_map_entry_t entry, tmp_entry; struct vattr va; vm_map_t map; - vm_object_t obj, tobj, lobj; + vm_object_t lobj, nobj, obj, tobj; char *fullpath, *freepath; struct kinfo_vmentry *kve; struct ucred *cred; @@ -2554,8 +2554,8 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, ssize_t maxlen, int flags) &kve->kve_resident, &super); if (super) kve->kve_flags |= KVME_FLAG_SUPER; - for (tobj = obj; tobj != NULL; - tobj = tobj->backing_object) { + for (tobj = obj; tobj != NULL; tobj = nobj) { + nobj = tobj->backing_object; if (tobj != obj && tobj != lobj) VM_OBJECT_RUNLOCK(tobj); } From owner-dev-commits-src-branches@freebsd.org Sat May 22 09:46:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 625EC6493CA; Sat, 22 May 2021 09:46:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJXG4LGfz3lm3; Sat, 22 May 2021 09:46:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E723F225B1; Sat, 22 May 2021 09:46:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9kbjv012612; Sat, 22 May 2021 09:46:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9kbmw012611; Sat, 22 May 2021 09:46:37 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:37 GMT Message-Id: <202105220946.14M9kbmw012611@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: f3253c60b426 - stable/13 - procfs_map: switch to use vm_object_kvme_type MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f3253c60b426ba7ce4c2da47a8ad04f688ced52c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:39 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f3253c60b426ba7ce4c2da47a8ad04f688ced52c commit f3253c60b426ba7ce4c2da47a8ad04f688ced52c Author: Konstantin Belousov AuthorDate: 2021-05-10 15:20:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:30 +0000 procfs_map: switch to use vm_object_kvme_type (cherry picked from commit 8b99833ac2538a74d013d101e2b5ec2d9e29d198) --- sys/fs/procfs/procfs_map.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/sys/fs/procfs/procfs_map.c b/sys/fs/procfs/procfs_map.c index 9ee49b0149a2..bd4cd2c09c00 100644 --- a/sys/fs/procfs/procfs_map.c +++ b/sys/fs/procfs/procfs_map.c @@ -51,6 +51,7 @@ #include #endif #include +#include #include #include @@ -85,7 +86,8 @@ procfs_doprocmap(PFS_FILL_ARGS) char *fullpath, *freepath, *type; struct ucred *cred; vm_object_t lobj, nobj, obj, tobj; - int error, privateresident, ref_count, resident, shadow_count, flags; + int error, flags, kvme, privateresident, ref_count, resident; + int shadow_count; vm_offset_t e_start, e_end; vm_eflags_t e_eflags; vm_prot_t e_prot; @@ -155,29 +157,29 @@ procfs_doprocmap(PFS_FILL_ARGS) freepath = NULL; fullpath = "-"; if (lobj) { - vp = NULL; - switch (lobj->type) { - default: - case OBJT_DEFAULT: - type = "default"; - break; - case OBJT_VNODE: - type = "vnode"; - vp = lobj->handle; + kvme = vm_object_kvme_type(lobj, &vp); + if (vp != NULL) vref(vp); + switch (kvme) { + default: + type = "unknown"; break; - case OBJT_SWAP_TMPFS: - type = "vnode"; - if ((lobj->flags & OBJ_TMPFS) != 0) { - vp = lobj->un_pager.swp.swp_tmpfs; - vref(vp); - } + case KVME_TYPE_PHYS: + type = "phys"; break; - case OBJT_SWAP: + case KVME_TYPE_DEFAULT: + case KVME_TYPE_SWAP: type = "swap"; break; - case OBJT_SG: - case OBJT_DEVICE: + case KVME_TYPE_DEAD: + type = "dead"; + break; + case KVME_TYPE_VNODE: + type = "vnode"; + break; + case KVME_TYPE_SG: + case KVME_TYPE_DEVICE: + case KVME_TYPE_MGTDEVICE: type = "device"; break; } From owner-dev-commits-src-branches@freebsd.org Sat May 22 09:46:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 BECF86495A5; Sat, 22 May 2021 09:46:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJXJ36mLz3lkR; Sat, 22 May 2021 09:46:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A5FC225B2; Sat, 22 May 2021 09:46:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9keMJ012660; Sat, 22 May 2021 09:46:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9ke1m012659; Sat, 22 May 2021 09:46:40 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:40 GMT Message-Id: <202105220946.14M9ke1m012659@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: bf9b8d2ae09a - stable/13 - sys/vm: remove several other uses of OBJT_SWAP_TMPFS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bf9b8d2ae09a347a9fc98d3eda6558314ba9f9ec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:41 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bf9b8d2ae09a347a9fc98d3eda6558314ba9f9ec commit bf9b8d2ae09a347a9fc98d3eda6558314ba9f9ec Author: Konstantin Belousov AuthorDate: 2021-05-07 18:21:22 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:30 +0000 sys/vm: remove several other uses of OBJT_SWAP_TMPFS (cherry picked from commit 7079449b0b56d13b4ae7b4039ac8eb7c45c03fb5) --- sys/vm/vm_object.c | 5 +++-- sys/vm/vm_pageout.c | 10 ++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 1aa05093f93a..8cb4c0006c59 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -669,7 +669,8 @@ vm_object_deallocate(vm_object_t object) umtx_shm_object_terminated(object); temp = object->backing_object; if (temp != NULL) { - KASSERT(object->type != OBJT_SWAP_TMPFS, + KASSERT(object->type == OBJT_DEFAULT || + object->type == OBJT_SWAP, ("shadowed tmpfs v_object 2 %p", object)); vm_object_backing_remove(object); } @@ -950,7 +951,7 @@ vm_object_terminate(vm_object_t object) #endif KASSERT(object->cred == NULL || object->type == OBJT_DEFAULT || - object->type == OBJT_SWAP || object->type == OBJT_SWAP_TMPFS, + (object->flags & OBJ_SWAP) != 0, ("%s: non-swap obj %p has cred", __func__, object)); /* diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 521fc4ce95f2..216e76359631 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -1887,15 +1887,9 @@ vm_pageout_oom_pagecount(struct vmspace *vmspace) if ((entry->eflags & MAP_ENTRY_NEEDS_COPY) != 0 && obj->ref_count != 1) continue; - switch (obj->type) { - case OBJT_DEFAULT: - case OBJT_SWAP: - case OBJT_SWAP_TMPFS: - case OBJT_PHYS: - case OBJT_VNODE: + if (obj->type == OBJT_DEFAULT || obj->type == OBJT_PHYS || + obj->type == OBJT_VNODE || (obj->flags & OBJ_SWAP) != 0) res += obj->resident_page_count; - break; - } } return (res); } From owner-dev-commits-src-branches@freebsd.org Sat May 22 09:46:46 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 863A164927D; Sat, 22 May 2021 09:46:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJXM5tmbz3lkf; Sat, 22 May 2021 09:46:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4822E225B3; Sat, 22 May 2021 09:46:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9kfPZ012681; Sat, 22 May 2021 09:46:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9kfBA012680; Sat, 22 May 2021 09:46:41 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:41 GMT Message-Id: <202105220946.14M9kfBA012680@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2f5321c1709a - stable/13 - vm: Add KPI to dynamically register pagers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2f5321c1709a742edc06f7f66fe4c92828fa8a87 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:46 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2f5321c1709a742edc06f7f66fe4c92828fa8a87 commit 2f5321c1709a742edc06f7f66fe4c92828fa8a87 Author: Konstantin Belousov AuthorDate: 2021-05-07 19:06:16 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:30 +0000 vm: Add KPI to dynamically register pagers (cherry picked from commit b730fd30b78f502ed5dd08e5285cb2c951495d65) --- sys/vm/vm.h | 1 + sys/vm/vm_object.c | 15 +++++++++- sys/vm/vm_object.h | 1 + sys/vm/vm_pager.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++------- sys/vm/vm_pager.h | 3 ++ 5 files changed, 91 insertions(+), 11 deletions(-) diff --git a/sys/vm/vm.h b/sys/vm/vm.h index 10bf3d46f2c0..f44affac69f1 100644 --- a/sys/vm/vm.h +++ b/sys/vm/vm.h @@ -98,6 +98,7 @@ enum obj_type { OBJT_SG, OBJT_MGTDEVICE, OBJT_SWAP_TMPFS, + OBJT_FIRST_DYN, }; typedef u_char objtype_t; diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 8cb4c0006c59..73cbdfb1ece4 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -430,7 +430,8 @@ vm_object_allocate(objtype_t type, vm_pindex_t size) flags = 0; break; default: - panic("vm_object_allocate: type %d is undefined", type); + panic("vm_object_allocate: type %d is undefined or dynamic", + type); } object = (vm_object_t)uma_zalloc(obj_zone, M_WAITOK); _vm_object_allocate(type, size, flags, object, NULL); @@ -438,6 +439,18 @@ vm_object_allocate(objtype_t type, vm_pindex_t size) return (object); } +vm_object_t +vm_object_allocate_dyn(objtype_t dyntype, vm_pindex_t size, u_short flags) +{ + vm_object_t object; + + MPASS(dyntype >= OBJT_FIRST_DYN /* && dyntype < nitems(pagertab) */); + object = (vm_object_t)uma_zalloc(obj_zone, M_WAITOK); + _vm_object_allocate(dyntype, size, flags, object, NULL); + + return (object); +} + /* * vm_object_allocate_anon: * diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index 0e1ed321255f..7e99288e0ff2 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -356,6 +356,7 @@ extern int umtx_shm_vnobj_persistent; vm_object_t vm_object_allocate (objtype_t, vm_pindex_t); vm_object_t vm_object_allocate_anon(vm_pindex_t, vm_object_t, struct ucred *, vm_size_t); +vm_object_t vm_object_allocate_dyn(objtype_t, vm_pindex_t, u_short); boolean_t vm_object_coalesce(vm_object_t, vm_ooffset_t, vm_size_t, vm_size_t, boolean_t); void vm_object_collapse (vm_object_t); diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 9476058a75bf..432a948cfe81 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -165,7 +165,7 @@ static const struct pagerops deadpagerops = { .pgo_getvp = dead_pager_getvp, }; -const struct pagerops *pagertab[] __read_mostly = { +const struct pagerops *pagertab[16] __read_mostly = { [OBJT_DEFAULT] = &defaultpagerops, [OBJT_SWAP] = &swappagerops, [OBJT_VNODE] = &vnodepagerops, @@ -176,18 +176,24 @@ const struct pagerops *pagertab[] __read_mostly = { [OBJT_MGTDEVICE] = &mgtdevicepagerops, [OBJT_SWAP_TMPFS] = &swaptmpfspagerops, }; +static struct mtx pagertab_lock; void vm_pager_init(void) { const struct pagerops **pgops; + int i; + + mtx_init(&pagertab_lock, "dynpag", NULL, MTX_DEF); /* * Initialize known pagers */ - for (pgops = pagertab; pgops < &pagertab[nitems(pagertab)]; pgops++) + for (i = 0; i < OBJT_FIRST_DYN; i++) { + pgops = &pagertab[i]; if ((*pgops)->pgo_init != NULL) (*(*pgops)->pgo_init)(); + } } static int nswbuf_max; @@ -245,15 +251,9 @@ vm_object_t vm_pager_allocate(objtype_t type, void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t off, struct ucred *cred) { - vm_object_t ret; - const struct pagerops *ops; + MPASS(type < nitems(pagertab)); - ops = pagertab[type]; - if (ops) - ret = (*ops->pgo_alloc)(handle, size, prot, off, cred); - else - ret = NULL; - return (ret); + return ((*pagertab[type]->pgo_alloc)(handle, size, prot, off, cred)); } /* @@ -264,6 +264,7 @@ vm_pager_deallocate(vm_object_t object) { VM_OBJECT_ASSERT_WLOCKED(object); + MPASS(object->type < nitems(pagertab)); (*pagertab[object->type]->pgo_dealloc) (object); } @@ -315,6 +316,7 @@ vm_pager_get_pages(vm_object_t object, vm_page_t *m, int count, int *rbehind, #endif int r; + MPASS(object->type < nitems(pagertab)); vm_pager_assert_in(object, m, count); r = (*pagertab[object->type]->pgo_getpages)(object, m, count, rbehind, @@ -348,6 +350,7 @@ vm_pager_get_pages_async(vm_object_t object, vm_page_t *m, int count, int *rbehind, int *rahead, pgo_getpages_iodone_t iodone, void *arg) { + MPASS(object->type < nitems(pagertab)); vm_pager_assert_in(object, m, count); return ((*pagertab[object->type]->pgo_getpages_async)(object, m, @@ -385,6 +388,60 @@ vm_pager_object_lookup(struct pagerlst *pg_list, void *handle) return (object); } +int +vm_pager_alloc_dyn_type(struct pagerops *ops, int base_type) +{ + int res; + + mtx_lock(&pagertab_lock); + MPASS(base_type == -1 || + (base_type >= OBJT_DEFAULT && base_type < nitems(pagertab))); + for (res = OBJT_FIRST_DYN; res < nitems(pagertab); res++) { + if (pagertab[res] == NULL) + break; + } + if (res == nitems(pagertab)) { + mtx_unlock(&pagertab_lock); + return (-1); + } + if (base_type != -1) { + MPASS(pagertab[base_type] != NULL); +#define FIX(n) \ + if (ops->pgo_##n == NULL) \ + ops->pgo_##n = pagertab[base_type]->pgo_##n + FIX(init); + FIX(alloc); + FIX(dealloc); + FIX(getpages); + FIX(getpages_async); + FIX(putpages); + FIX(haspage); + FIX(populate); + FIX(pageunswapped); + FIX(update_writecount); + FIX(release_writecount); + FIX(set_writeable_dirty); + FIX(mightbedirty); + FIX(getvp); + FIX(freespace); +#undef FIX + } + pagertab[res] = ops; /* XXXKIB should be rel, but acq is too much */ + mtx_unlock(&pagertab_lock); + return (res); +} + +void +vm_pager_free_dyn_type(objtype_t type) +{ + MPASS(type >= OBJT_FIRST_DYN && type < nitems(pagertab)); + + mtx_lock(&pagertab_lock); + MPASS(pagertab[type] != NULL); + pagertab[type] = NULL; + mtx_unlock(&pagertab_lock); +} + static int pbuf_ctor(void *mem, int size, void *arg, int flags) { @@ -517,6 +574,8 @@ vm_object_set_writeable_dirty(vm_object_t object) { pgo_set_writeable_dirty_t *method; + MPASS(object->type < nitems(pagertab)); + method = pagertab[object->type]->pgo_set_writeable_dirty; if (method != NULL) method(object); @@ -527,6 +586,8 @@ vm_object_mightbedirty(vm_object_t object) { pgo_mightbedirty_t *method; + MPASS(object->type < nitems(pagertab)); + method = pagertab[object->type]->pgo_mightbedirty; if (method == NULL) return (false); @@ -541,6 +602,7 @@ int vm_object_kvme_type(vm_object_t object, struct vnode **vpp) { VM_OBJECT_ASSERT_LOCKED(object); + MPASS(object->type < nitems(pagertab)); if (vpp != NULL) *vpp = vm_object_vnode(object); diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index 5e0261f818cf..098d48ea3d9d 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -249,6 +249,9 @@ vm_pager_freespace(vm_object_t object, vm_pindex_t start, method(object, start, size); } +int vm_pager_alloc_dyn_type(struct pagerops *ops, int base_type); +void vm_pager_free_dyn_type(objtype_t type); + struct cdev_pager_ops { int (*cdev_pg_fault)(vm_object_t vm_obj, vm_ooffset_t offset, int prot, vm_page_t *mres); From owner-dev-commits-src-branches@freebsd.org Sat May 22 09:46:43 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 E564F649618; Sat, 22 May 2021 09:46:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJXM2vS1z3lmJ; Sat, 22 May 2021 09:46:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A4CE22530; Sat, 22 May 2021 09:46:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9kg9k012702; Sat, 22 May 2021 09:46:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9kg0V012701; Sat, 22 May 2021 09:46:42 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:42 GMT Message-Id: <202105220946.14M9kg0V012701@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 03aecce81c07 - stable/13 - tmpfs: dynamically register tmpfs pager MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 03aecce81c07909df196166d2cc168bf5e280a99 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:44 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=03aecce81c07909df196166d2cc168bf5e280a99 commit 03aecce81c07909df196166d2cc168bf5e280a99 Author: Konstantin Belousov AuthorDate: 2021-05-07 19:42:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:30 +0000 tmpfs: dynamically register tmpfs pager (cherry picked from commit 28bc23ab92ce7393aab48da7d71ccde63592ff2d) --- sys/fs/tmpfs/tmpfs.h | 6 ++- sys/fs/tmpfs/tmpfs_subr.c | 70 ++++++++++++++++++++++++++++++++-- sys/fs/tmpfs/tmpfs_vfsops.c | 14 ++++--- sys/fs/tmpfs/tmpfs_vnops.c | 2 +- sys/vm/swap_pager.c | 93 ++++++++++----------------------------------- sys/vm/swap_pager.h | 3 +- sys/vm/vm.h | 1 - sys/vm/vm_object.c | 1 - sys/vm/vm_object.h | 2 +- sys/vm/vm_pager.c | 1 - 10 files changed, 106 insertions(+), 87 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index 28493a550252..549339d9b6d1 100644 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -45,6 +45,8 @@ MALLOC_DECLARE(M_TMPFSNAME); #endif +#define OBJ_TMPFS OBJ_PAGERPRIV /* has tmpfs vnode allocated */ + /* * Internal representation of a tmpfs directory entry. */ @@ -514,9 +516,11 @@ tmpfs_update(struct vnode *vp) size_t tmpfs_mem_avail(void); size_t tmpfs_pages_used(struct tmpfs_mount *tmp); -void tmpfs_subr_init(void); +int tmpfs_subr_init(void); void tmpfs_subr_uninit(void); +extern int tmpfs_pager_type; + /* * Macros/functions to convert from generic data structures to tmpfs * specific ones. diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 1ea4cf23b314..67eb12598e24 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -79,6 +80,61 @@ MALLOC_DEFINE(M_TMPFSDIR, "tmpfs dir", "tmpfs dirent structure"); static uma_zone_t tmpfs_node_pool; VFS_SMR_DECLARE; +int tmpfs_pager_type = -1; + +static vm_object_t +tmpfs_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, + vm_ooffset_t offset, struct ucred *cred) +{ + vm_object_t object; + + MPASS(handle == NULL); + MPASS(offset == 0); + object = vm_object_allocate_dyn(tmpfs_pager_type, size, + OBJ_COLORED | OBJ_SWAP); + if (!swap_pager_init_object(object, NULL, NULL, size, 0)) { + vm_object_deallocate(object); + object = NULL; + } + return (object); +} + +static void +tmpfs_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) +{ + struct vnode *vp; + + /* + * Tmpfs VREG node, which was reclaimed, has tmpfs_pager_type + * type, but not OBJ_TMPFS flag. In this case there is no + * v_writecount to adjust. + */ + if (vp_heldp != NULL) + VM_OBJECT_RLOCK(object); + else + VM_OBJECT_ASSERT_LOCKED(object); + if ((object->flags & OBJ_TMPFS) != 0) { + vp = object->un_pager.swp.swp_tmpfs; + if (vp != NULL) { + *vpp = vp; + if (vp_heldp != NULL) { + vhold(vp); + *vp_heldp = true; + } + } + } + if (vp_heldp != NULL) + VM_OBJECT_RUNLOCK(object); +} + +struct pagerops tmpfs_pager_ops = { + .pgo_kvme_type = KVME_TYPE_VNODE, + .pgo_alloc = tmpfs_pager_alloc, + .pgo_set_writeable_dirty = vm_object_set_writeable_dirty_, + .pgo_mightbedirty = vm_object_mightbedirty_, + .pgo_getvp = tmpfs_pager_getvp, +}; + static int tmpfs_node_ctor(void *mem, int size, void *arg, int flags) { @@ -126,18 +182,26 @@ tmpfs_node_fini(void *mem, int size) mtx_destroy(&node->tn_interlock); } -void +int tmpfs_subr_init(void) { + tmpfs_pager_type = vm_pager_alloc_dyn_type(&tmpfs_pager_ops, + OBJT_SWAP); + if (tmpfs_pager_type == -1) + return (EINVAL); tmpfs_node_pool = uma_zcreate("TMPFS node", sizeof(struct tmpfs_node), tmpfs_node_ctor, tmpfs_node_dtor, tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); VFS_SMR_ZONE_SET(tmpfs_node_pool); + return (0); } void tmpfs_subr_uninit(void) { + if (tmpfs_pager_type != -1) + vm_pager_free_dyn_type(tmpfs_pager_type); + tmpfs_pager_type = -1; uma_zdestroy(tmpfs_node_pool); } @@ -364,7 +428,7 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type, case VREG: obj = nnode->tn_reg.tn_aobj = - vm_pager_allocate(OBJT_SWAP_TMPFS, NULL, 0, + vm_pager_allocate(tmpfs_pager_type, NULL, 0, VM_PROT_DEFAULT, 0, NULL /* XXXKIB - tmpfs needs swap reservation */); /* OBJ_TMPFS is set together with the setting of vp->v_object */ @@ -1588,7 +1652,7 @@ tmpfs_check_mtime(struct vnode *vp) if (vp->v_type != VREG) return; obj = vp->v_object; - KASSERT(obj->type == OBJT_SWAP_TMPFS && + KASSERT(obj->type == tmpfs_pager_type && (obj->flags & (OBJ_SWAP | OBJ_TMPFS)) == (OBJ_SWAP | OBJ_TMPFS), ("non-tmpfs obj")); /* unlocked read */ diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index 51d097203135..4f29b5dfc6f0 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -103,8 +103,8 @@ static const char *tmpfs_updateopts[] = { * Handle updates of time from writes to mmaped regions, if allowed. * Use MNT_VNODE_FOREACH_ALL instead of MNT_VNODE_FOREACH_LAZY, since * unmap of the tmpfs-backed vnode does not call vinactive(), due to - * vm object type is OBJT_SWAP. If lazy, only handle delayed update - * of mtime due to the writes to mapped files. + * vm object type is basically OBJT_SWAP. If lazy, only handle + * delayed update of mtime due to the writes to mapped files. */ static void tmpfs_update_mtime(struct mount *mp, bool lazy) @@ -120,7 +120,7 @@ tmpfs_update_mtime(struct mount *mp, bool lazy) continue; } obj = vp->v_object; - MPASS(obj->type == OBJT_SWAP_TMPFS); + MPASS(obj->type == tmpfs_pager_type); MPASS((obj->flags & OBJ_TMPFS) != 0); /* @@ -225,7 +225,7 @@ again: (entry->max_protection & VM_PROT_WRITE) == 0) continue; object = entry->object.vm_object; - if (object == NULL || object->type != OBJT_SWAP_TMPFS) + if (object == NULL || object->type != tmpfs_pager_type) continue; /* * No need to dig into shadow chain, mapping @@ -661,7 +661,11 @@ tmpfs_sync(struct mount *mp, int waitfor) static int tmpfs_init(struct vfsconf *conf) { - tmpfs_subr_init(); + int res; + + res = tmpfs_subr_init(); + if (res != 0) + return (res); memcpy(&tmpfs_fnops, &vnops, sizeof(struct fileops)); tmpfs_fnops.fo_close = tmpfs_fo_close; return (0); diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 401ee672b96a..43a2aa77dbbb 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -623,7 +623,7 @@ tmpfs_read_pgcache(struct vop_read_pgcache_args *v) if (object == NULL) goto out_smr; - MPASS(object->type == OBJT_SWAP_TMPFS); + MPASS(object->type == tmpfs_pager_type); MPASS((object->flags & (OBJ_ANON | OBJ_DEAD | OBJ_SWAP)) == OBJ_SWAP); if (!VN_IS_DOOMED(vp)) { diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 37db4cbac857..63f0d22ed705 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -419,9 +419,6 @@ static uma_zone_t swpctrie_zone; static vm_object_t swap_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t offset, struct ucred *); -static vm_object_t - swap_tmpfs_pager_alloc(void *handle, vm_ooffset_t size, - vm_prot_t prot, vm_ooffset_t offset, struct ucred *); static void swap_pager_dealloc(vm_object_t object); static int swap_pager_getpages(vm_object_t, vm_page_t *, int, int *, int *); @@ -437,8 +434,6 @@ static void swap_pager_update_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); static void swap_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); -static void swap_tmpfs_pager_getvp(vm_object_t object, struct vnode **vpp, - bool *vp_heldp); static void swap_pager_freespace(vm_object_t object, vm_pindex_t start, vm_size_t size); @@ -457,23 +452,6 @@ const struct pagerops swappagerops = { .pgo_freespace = swap_pager_freespace, }; -const struct pagerops swaptmpfspagerops = { - .pgo_kvme_type = KVME_TYPE_VNODE, - .pgo_alloc = swap_tmpfs_pager_alloc, - .pgo_dealloc = swap_pager_dealloc, - .pgo_getpages = swap_pager_getpages, - .pgo_getpages_async = swap_pager_getpages_async, - .pgo_putpages = swap_pager_putpages, - .pgo_haspage = swap_pager_haspage, - .pgo_pageunswapped = swap_pager_unswapped, - .pgo_update_writecount = swap_pager_update_writecount, - .pgo_release_writecount = swap_pager_release_writecount, - .pgo_set_writeable_dirty = vm_object_set_writeable_dirty_, - .pgo_mightbedirty = vm_object_mightbedirty_, - .pgo_getvp = swap_tmpfs_pager_getvp, - .pgo_freespace = swap_pager_freespace, -}; - /* * swap_*() routines are externally accessible. swp_*() routines are * internal. @@ -681,18 +659,31 @@ swap_pager_swap_init(void) "reduce kern.maxswzone.\n"); } -static vm_object_t -swap_pager_alloc_init(objtype_t otype, void *handle, struct ucred *cred, +bool +swap_pager_init_object(vm_object_t object, void *handle, struct ucred *cred, vm_ooffset_t size, vm_ooffset_t offset) { - vm_object_t object; - if (cred != NULL) { if (!swap_reserve_by_cred(size, cred)) - return (NULL); + return (false); crhold(cred); } + object->un_pager.swp.writemappings = 0; + object->handle = handle; + if (cred != NULL) { + object->cred = cred; + object->charge = size; + } + return (true); +} + +static vm_object_t +swap_pager_alloc_init(objtype_t otype, void *handle, struct ucred *cred, + vm_ooffset_t size, vm_ooffset_t offset) +{ + vm_object_t object; + /* * The un_pager.swp.swp_blks trie is initialized by * vm_object_allocate() to ensure the correct order of @@ -701,11 +692,9 @@ swap_pager_alloc_init(objtype_t otype, void *handle, struct ucred *cred, object = vm_object_allocate(otype, OFF_TO_IDX(offset + PAGE_MASK + size)); - object->un_pager.swp.writemappings = 0; - object->handle = handle; - if (cred != NULL) { - object->cred = cred; - object->charge = size; + if (!swap_pager_init_object(object, handle, cred, size, offset)) { + vm_object_deallocate(object); + return (NULL); } return (object); } @@ -752,18 +741,6 @@ swap_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, return (object); } -static vm_object_t -swap_tmpfs_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, - vm_ooffset_t offset, struct ucred *cred) -{ - vm_object_t object; - - MPASS(handle == NULL); - object = swap_pager_alloc_init(OBJT_SWAP_TMPFS, handle, cred, - size, offset); - return (object); -} - /* * SWAP_PAGER_DEALLOC() - remove swap metadata from object * @@ -3168,31 +3145,3 @@ swap_pager_release_writecount(vm_object_t object, vm_offset_t start, object->un_pager.swp.writemappings -= (vm_ooffset_t)end - start; VM_OBJECT_WUNLOCK(object); } - -static void -swap_tmpfs_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) -{ - struct vnode *vp; - - /* - * Tmpfs VREG node, which was reclaimed, has OBJT_SWAP_TMPFS - * type, but not OBJ_TMPFS flag. In this case there is no - * v_writecount to adjust. - */ - if (vp_heldp != NULL) - VM_OBJECT_RLOCK(object); - else - VM_OBJECT_ASSERT_LOCKED(object); - if ((object->flags & OBJ_TMPFS) != 0) { - vp = object->un_pager.swp.swp_tmpfs; - if (vp != NULL) { - *vpp = vp; - if (vp_heldp != NULL) { - vhold(vp); - *vp_heldp = true; - } - } - } - if (vp_heldp != NULL) - VM_OBJECT_RUNLOCK(object); -} diff --git a/sys/vm/swap_pager.h b/sys/vm/swap_pager.h index 7a2ea12e887d..20ff70acc3d8 100644 --- a/sys/vm/swap_pager.h +++ b/sys/vm/swap_pager.h @@ -82,6 +82,7 @@ int swap_pager_reserve(vm_object_t, vm_pindex_t, vm_size_t); void swap_pager_status(int *total, int *used); u_long swap_pager_swapped_pages(vm_object_t object); void swapoff_all(void); - +bool swap_pager_init_object(vm_object_t object, void *handle, + struct ucred *cred, vm_ooffset_t size, vm_ooffset_t offset); #endif /* _KERNEL */ #endif /* _VM_SWAP_PAGER_H_ */ diff --git a/sys/vm/vm.h b/sys/vm/vm.h index f44affac69f1..42d799d025b9 100644 --- a/sys/vm/vm.h +++ b/sys/vm/vm.h @@ -97,7 +97,6 @@ enum obj_type { OBJT_DEAD, OBJT_SG, OBJT_MGTDEVICE, - OBJT_SWAP_TMPFS, OBJT_FIRST_DYN, }; typedef u_char objtype_t; diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 73cbdfb1ece4..9bd3f416ff94 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -413,7 +413,6 @@ vm_object_allocate(objtype_t type, vm_pindex_t size) flags = OBJ_COLORED; break; case OBJT_SWAP: - case OBJT_SWAP_TMPFS: flags = OBJ_COLORED | OBJ_SWAP; break; case OBJT_DEVICE: diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index 7e99288e0ff2..d159c621d2e6 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -207,7 +207,7 @@ struct vm_object { #define OBJ_COLORED 0x1000 /* pg_color is defined */ #define OBJ_ONEMAPPING 0x2000 /* One USE (a single, non-forked) mapping flag */ #define OBJ_SHADOWLIST 0x4000 /* Object is on the shadow list. */ -#define OBJ_TMPFS 0x8000 /* has tmpfs vnode allocated */ +#define OBJ_PAGERPRIV 0x8000 /* Pager private */ /* * Helpers to perform conversion between vm_object page indexes and offsets. diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 432a948cfe81..640e3d977e99 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -174,7 +174,6 @@ const struct pagerops *pagertab[16] __read_mostly = { [OBJT_DEAD] = &deadpagerops, [OBJT_SG] = &sgpagerops, [OBJT_MGTDEVICE] = &mgtdevicepagerops, - [OBJT_SWAP_TMPFS] = &swaptmpfspagerops, }; static struct mtx pagertab_lock; From owner-dev-commits-src-branches@freebsd.org Sat May 22 09:46:40 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 CDFDA649611; Sat, 22 May 2021 09:46:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJXH2BQxz3lv6; Sat, 22 May 2021 09:46:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 02F3E223A2; Sat, 22 May 2021 09:46:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9kcMA012639; Sat, 22 May 2021 09:46:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9kcHb012638; Sat, 22 May 2021 09:46:38 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:38 GMT Message-Id: <202105220946.14M9kcHb012638@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 324fbdb27ab1 - stable/13 - vm_object_set_memattr(): handle all object types without listing them explicitly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 324fbdb27ab1dbf027cf250fd575739985bf5434 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:41 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=324fbdb27ab1dbf027cf250fd575739985bf5434 commit 324fbdb27ab1dbf027cf250fd575739985bf5434 Author: Konstantin Belousov AuthorDate: 2021-05-07 18:19:30 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:30 +0000 vm_object_set_memattr(): handle all object types without listing them explicitly (cherry picked from commit 3e7a11ca21f3a7948c50f27de5b2159f0bb56672) --- sys/vm/vm_object.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 735ab603a09b..1aa05093f93a 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -330,24 +330,12 @@ vm_object_set_memattr(vm_object_t object, vm_memattr_t memattr) { VM_OBJECT_ASSERT_WLOCKED(object); - switch (object->type) { - case OBJT_DEFAULT: - case OBJT_DEVICE: - case OBJT_MGTDEVICE: - case OBJT_PHYS: - case OBJT_SG: - case OBJT_SWAP: - case OBJT_SWAP_TMPFS: - case OBJT_VNODE: - if (!TAILQ_EMPTY(&object->memq)) - return (KERN_FAILURE); - break; - case OBJT_DEAD: + + if (object->type == OBJT_DEAD) return (KERN_INVALID_ARGUMENT); - default: - panic("vm_object_set_memattr: object %p is of undefined type", - object); - } + if (!TAILQ_EMPTY(&object->memq)) + return (KERN_FAILURE); + object->memattr = memattr; return (KERN_SUCCESS); } From owner-dev-commits-src-branches@freebsd.org Sat May 22 18:23:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 6BC456340A7; Sat, 22 May 2021 18:23:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnX1620nFz4Tv8; Sat, 22 May 2021 18:23:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD79C10BD; Sat, 22 May 2021 18:23:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14MINr9t005811; Sat, 22 May 2021 18:23:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MINr7n005810; Sat, 22 May 2021 18:23:53 GMT (envelope-from git) Date: Sat, 22 May 2021 18:23:53 GMT Message-Id: <202105221823.14MINr7n005810@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 400907c645ce - stable/13 - cache: extend mismatch vnode assert print to include the name MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 400907c645ce0b6e8bbd0375f4f46dd6cd2d54a1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:23:54 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=400907c645ce0b6e8bbd0375f4f46dd6cd2d54a1 commit 400907c645ce0b6e8bbd0375f4f46dd6cd2d54a1 Author: Mateusz Guzik AuthorDate: 2021-04-15 07:55:43 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 18:21:28 +0000 cache: extend mismatch vnode assert print to include the name (cherry picked from commit 4f0279e064bb163dbcc4859e409fc65dcbe8f1bf) --- sys/kern/vfs_cache.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 31d6668a3565..ec5bb0c39c99 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -2468,12 +2468,12 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, struct componentname *cnp, MPASS(cache_ncp_canuse(n2)); if ((n2->nc_flag & NCF_NEGATIVE) != 0) KASSERT(vp == NULL, - ("%s: found entry pointing to a different vnode (%p != %p)", - __func__, NULL, vp)); + ("%s: found entry pointing to a different vnode (%p != %p) ; name [%s]", + __func__, NULL, vp, cnp->cn_nameptr)); else KASSERT(n2->nc_vp == vp, - ("%s: found entry pointing to a different vnode (%p != %p)", - __func__, n2->nc_vp, vp)); + ("%s: found entry pointing to a different vnode (%p != %p) ; name [%s]", + __func__, n2->nc_vp, vp, cnp->cn_nameptr)); /* * Entries are supposed to be immutable unless in the * process of getting destroyed. Accommodating for From owner-dev-commits-src-branches@freebsd.org Sat May 22 18:23:55 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 3B003634015; Sat, 22 May 2021 18:23:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnX1715C3z4TvF; Sat, 22 May 2021 18:23:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09C8EDC5; Sat, 22 May 2021 18:23:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14MINsGQ005838; Sat, 22 May 2021 18:23:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MINsbl005837; Sat, 22 May 2021 18:23:54 GMT (envelope-from git) Date: Sat, 22 May 2021 18:23:54 GMT Message-Id: <202105221823.14MINsbl005837@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 0ef41997b3c7 - stable/13 - cache: remove incomplete lockless lockout support during resize MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0ef41997b3c740dc5369b1dfac82ac107fe7d707 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:23:55 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=0ef41997b3c740dc5369b1dfac82ac107fe7d707 commit 0ef41997b3c740dc5369b1dfac82ac107fe7d707 Author: Mateusz Guzik AuthorDate: 2021-04-10 17:20:28 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 18:21:39 +0000 cache: remove incomplete lockless lockout support during resize This is already properly handled thanks to 2 step hash replacement. (cherry picked from commit 074abaccfaadef0da6e2695225ce537cb53bb8de) --- sys/kern/vfs_cache.c | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index ec5bb0c39c99..2def9900096f 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -580,9 +580,6 @@ static long cache_lock_vnodes_cel_3_failures; DEBUGNODE_ULONG(vnodes_cel_3_failures, cache_lock_vnodes_cel_3_failures, "Number of times 3-way vnode locking failed"); -static void cache_fplookup_lockout(void); -static void cache_fplookup_restore(void); - static void cache_zap_locked(struct namecache *ncp); static int vn_fullpath_hardlink(struct nameidata *ndp, char **retbuf, char **freebuf, size_t *buflen); @@ -2771,7 +2768,6 @@ cache_changesize(u_long newmaxvnodes) * None of the namecache entries in the table can be removed * because to do so, they have to be removed from the hash table. */ - cache_fplookup_lockout(); cache_lock_all_vnodes(); cache_lock_all_buckets(); old_nchashtbl = nchashtbl; @@ -2790,7 +2786,6 @@ cache_changesize(u_long newmaxvnodes) cache_changesize_set_new(new_nchashtbl, new_nchash); cache_unlock_all_buckets(); cache_unlock_all_vnodes(); - cache_fplookup_restore(); ncfreetbl(old_nchashtbl); ncfreetbl(temptbl); } @@ -3865,33 +3860,6 @@ syscal_vfs_cache_fast_lookup(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_vfs, OID_AUTO, cache_fast_lookup, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MPSAFE, &cache_fast_lookup, 0, syscal_vfs_cache_fast_lookup, "IU", ""); -/* - * Disable lockless lookup and observe all CPUs not executing it. - * - * Used when resizing the hash table. - * - * TODO: no provisions are made to handle tweaking of the knob at the same time - */ -static void -cache_fplookup_lockout(void) -{ - bool on; - - on = atomic_load_char(&cache_fast_lookup_enabled); - if (on) { - atomic_store_char(&cache_fast_lookup_enabled, false); - atomic_thread_fence_rel(); - vfs_smr_synchronize(); - } -} - -static void -cache_fplookup_restore(void) -{ - - cache_fast_lookup_enabled_recalc(); -} - /* * Components of nameidata (or objects it can point to) which may * need restoring in case fast path lookup fails. From owner-dev-commits-src-branches@freebsd.org Sat May 22 18:23:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 F02C7634246; Sat, 22 May 2021 18:23:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnX183pcBz4V0x; Sat, 22 May 2021 18:23:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 219CEF69; Sat, 22 May 2021 18:23:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14MINuql005860; Sat, 22 May 2021 18:23:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MINuPv005859; Sat, 22 May 2021 18:23:56 GMT (envelope-from git) Date: Sat, 22 May 2021 18:23:56 GMT Message-Id: <202105221823.14MINuPv005859@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 4869c1571f34 - stable/13 - vfs: lockless writecount adjustment in set/unset text MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4869c1571f34b603279a9addd18181aefc4f17e9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:23:57 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=4869c1571f34b603279a9addd18181aefc4f17e9 commit 4869c1571f34b603279a9addd18181aefc4f17e9 Author: Mateusz Guzik AuthorDate: 2021-05-07 14:04:27 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 18:22:03 +0000 vfs: lockless writecount adjustment in set/unset text ... for cases where this is not the first/last exec. (cherry picked from commit b5fb9ae6872c499f1a02bec41f48b163a73a2aaa) --- sys/kern/vfs_default.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 4b9b1b43f1ce..eb584feb6c41 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -1177,9 +1177,23 @@ vop_stdset_text(struct vop_set_text_args *ap) { struct vnode *vp; struct mount *mp; - int error; + int error, n; vp = ap->a_vp; + + /* + * Avoid the interlock if execs are already present. + */ + n = atomic_load_int(&vp->v_writecount); + for (;;) { + if (n > -1) { + break; + } + if (atomic_fcmpset_int(&vp->v_writecount, &n, n - 1)) { + return (0); + } + } + VI_LOCK(vp); if (vp->v_writecount > 0) { error = ETXTBSY; @@ -1207,10 +1221,24 @@ static int vop_stdunset_text(struct vop_unset_text_args *ap) { struct vnode *vp; - int error; + int error, n; bool last; vp = ap->a_vp; + + /* + * Avoid the interlock if this is not the last exec. + */ + n = atomic_load_int(&vp->v_writecount); + for (;;) { + if (n >= -1) { + break; + } + if (atomic_fcmpset_int(&vp->v_writecount, &n, n + 1)) { + return (0); + } + } + last = false; VI_LOCK(vp); if (vp->v_writecount < 0) { From owner-dev-commits-src-branches@freebsd.org Sat May 22 18:23:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 B5E4C633F38; Sat, 22 May 2021 18:23:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnX193Jfbz4Txb; Sat, 22 May 2021 18:23:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4BD2F10BE; Sat, 22 May 2021 18:23:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14MINvh2005881; Sat, 22 May 2021 18:23:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MINvV9005880; Sat, 22 May 2021 18:23:57 GMT (envelope-from git) Date: Sat, 22 May 2021 18:23:57 GMT Message-Id: <202105221823.14MINvV9005880@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 2923b7015ffb - stable/13 - vfs: add more safety against concurrent forced unmount to vn_write MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2923b7015ffb808ed5219cb04d42d1756ba06361 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:23:57 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=2923b7015ffb808ed5219cb04d42d1756ba06361 commit 2923b7015ffb808ed5219cb04d42d1756ba06361 Author: Mateusz Guzik AuthorDate: 2021-05-14 11:26:56 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 18:22:10 +0000 vfs: add more safety against concurrent forced unmount to vn_write 1. stop re-reading ->v_mount (can become NULL) 2. stop re-reading ->v_type (can change to VBAD) (cherry picked from commit ca1ce50b2b5ef11d85841f3aead98b2a9ad18819) --- sys/kern/vfs_vnops.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 8f583329f067..6bf798cd73c5 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1107,6 +1107,7 @@ vn_write(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, off_t orig_offset; int error, ioflag, lock_flags; int advice; + bool need_finished_write; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); @@ -1121,9 +1122,11 @@ vn_write(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, ioflag |= IO_NDELAY; if (fp->f_flag & O_DIRECT) ioflag |= IO_DIRECT; - if ((fp->f_flag & O_FSYNC) || - (vp->v_mount && (vp->v_mount->mnt_flag & MNT_SYNCHRONOUS))) - ioflag |= IO_SYNC; + if (fp->f_flag & O_FSYNC) { + mp = atomic_load_ptr(&vp->v_mount); + if (mp != NULL && mp->mnt_flag & MNT_SYNCHRONOUS) + ioflag |= IO_SYNC; + } /* * For O_DSYNC we set both IO_SYNC and IO_DATASYNC, so that VOP_WRITE() * implementations that don't understand IO_DATASYNC fall back to full @@ -1132,9 +1135,13 @@ vn_write(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, if (fp->f_flag & O_DSYNC) ioflag |= IO_SYNC | IO_DATASYNC; mp = NULL; - if (vp->v_type != VCHR && - (error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) - goto unlock; + need_finished_write = false; + if (vp->v_type != VCHR) { + error = vn_start_write(vp, &mp, V_WAIT | PCATCH); + if (error != 0) + goto unlock; + need_finished_write = true; + } advice = get_advice(fp, uio); @@ -1165,7 +1172,7 @@ vn_write(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, error = VOP_WRITE(vp, uio, ioflag, fp->f_cred); fp->f_nextoff[UIO_WRITE] = uio->uio_offset; VOP_UNLOCK(vp); - if (vp->v_type != VCHR) + if (need_finished_write) vn_finished_write(mp); if (error == 0 && advice == POSIX_FADV_NOREUSE && orig_offset != uio->uio_offset) From owner-dev-commits-src-branches@freebsd.org Sat May 22 18:23:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 DBCFD633D73; Sat, 22 May 2021 18:23:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnX1B4d1mz4TvZ; Sat, 22 May 2021 18:23:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 704B6F6A; Sat, 22 May 2021 18:23:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14MINw2x005902; Sat, 22 May 2021 18:23:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MINwXu005901; Sat, 22 May 2021 18:23:58 GMT (envelope-from git) Date: Sat, 22 May 2021 18:23:58 GMT Message-Id: <202105221823.14MINwXu005901@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: de1b69aec286 - stable/13 - vfs: add missing atomic conversion to writecount adjustment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: de1b69aec28617ffa6b0c3554ec78e7a87eb27a5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:23:59 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=de1b69aec28617ffa6b0c3554ec78e7a87eb27a5 commit de1b69aec28617ffa6b0c3554ec78e7a87eb27a5 Author: Mateusz Guzik AuthorDate: 2021-05-14 15:41:39 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 18:22:16 +0000 vfs: add missing atomic conversion to writecount adjustment Fixes: ("vfs: lockless writecount adjustment in set/unset text") (cherry picked from commit 852088f6af6c5cd44542dde72aa5c3f4c4f9353c) --- sys/kern/vfs_default.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index eb584feb6c41..5a233603631e 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -1210,7 +1210,7 @@ vop_stdset_text(struct vop_set_text_args *ap) vrefl(vp); } - vp->v_writecount--; + atomic_subtract_int(&vp->v_writecount, 1); error = 0; } VI_UNLOCK(vp); @@ -1247,7 +1247,7 @@ vop_stdunset_text(struct vop_unset_text_args *ap) last = true; vp->v_iflag &= ~VI_TEXT_REF; } - vp->v_writecount++; + atomic_add_int(&vp->v_writecount, 1); error = 0; } else { error = EINVAL; From owner-dev-commits-src-branches@freebsd.org Sat May 22 18:24:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 3FBCE6340B0; Sat, 22 May 2021 18:24:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnX1C6NXXz4Txj; Sat, 22 May 2021 18:23:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93016EB9; Sat, 22 May 2021 18:23:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14MINxEg005923; Sat, 22 May 2021 18:23:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MINxf0005922; Sat, 22 May 2021 18:23:59 GMT (envelope-from git) Date: Sat, 22 May 2021 18:23:59 GMT Message-Id: <202105221823.14MINxf0005922@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: df6533f9b40a - stable/13 - vfs: change vn_freevnodes_* prefix to idiomatic vfs_freevnodes_* MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: df6533f9b40ab5480aec3990561f4f50c94351d1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:24:00 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=df6533f9b40ab5480aec3990561f4f50c94351d1 commit df6533f9b40ab5480aec3990561f4f50c94351d1 Author: Mateusz Guzik AuthorDate: 2021-05-14 19:01:56 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 18:22:25 +0000 vfs: change vn_freevnodes_* prefix to idiomatic vfs_freevnodes_* (cherry picked from commit 715fcc0d342684da5d109a7e4891d30aa38667c9) --- sys/kern/vfs_subr.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 98c97324e467..53c9c12be34c 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1364,7 +1364,7 @@ static int vnlruproc_sig; #define VNLRU_FREEVNODES_SLOP 128 static __inline void -vn_freevnodes_inc(void) +vfs_freevnodes_inc(void) { struct vdbatch *vd; @@ -1375,7 +1375,7 @@ vn_freevnodes_inc(void) } static __inline void -vn_freevnodes_dec(void) +vfs_freevnodes_dec(void) { struct vdbatch *vd; @@ -3308,7 +3308,7 @@ vhold(struct vnode *vp) VNASSERT(old >= 0 && (old & VHOLD_ALL_FLAGS) == 0, vp, ("%s: wrong hold count %d", __func__, old)); if (old == 0) - vn_freevnodes_dec(); + vfs_freevnodes_dec(); } void @@ -3361,7 +3361,7 @@ vhold_smr(struct vnode *vp) VNASSERT(count >= 0, vp, ("invalid hold count %d\n", count)); if (atomic_fcmpset_int(&vp->v_holdcnt, &count, count + 1)) { if (count == 0) - vn_freevnodes_dec(); + vfs_freevnodes_dec(); return (true); } } @@ -3402,7 +3402,7 @@ vhold_recycle_free(struct vnode *vp) return (false); } if (atomic_fcmpset_int(&vp->v_holdcnt, &count, count + 1)) { - vn_freevnodes_dec(); + vfs_freevnodes_dec(); return (true); } } @@ -3563,7 +3563,7 @@ vdropl_final(struct vnode *vp) * we never got this far, they will vdrop later. */ if (__predict_false(!atomic_cmpset_int(&vp->v_holdcnt, 0, VHOLD_NO_SMR))) { - vn_freevnodes_inc(); + vfs_freevnodes_inc(); VI_UNLOCK(vp); /* * We lost the aforementioned race. Any subsequent access is @@ -3600,7 +3600,7 @@ vdropl(struct vnode *vp) return; } if (!VN_IS_DOOMED(vp)) { - vn_freevnodes_inc(); + vfs_freevnodes_inc(); vdrop_deactivate(vp); /* * Also unlocks the interlock. We can't assert on it as we From owner-dev-commits-src-branches@freebsd.org Sat May 22 18:24:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 439106340B1; Sat, 22 May 2021 18:24:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnX1D6yQkz4TtB; Sat, 22 May 2021 18:24:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB20DF6B; Sat, 22 May 2021 18:24:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14MIO08e005948; Sat, 22 May 2021 18:24:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MIO0wc005947; Sat, 22 May 2021 18:24:00 GMT (envelope-from git) Date: Sat, 22 May 2021 18:24:00 GMT Message-Id: <202105221824.14MIO0wc005947@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: e9757b0c94c0 - stable/13 - vfs: refactor vdrop MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e9757b0c94c02db1a2a154089af3ec0e4e8b3b1a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:24:01 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=e9757b0c94c02db1a2a154089af3ec0e4e8b3b1a commit e9757b0c94c02db1a2a154089af3ec0e4e8b3b1a Author: Mateusz Guzik AuthorDate: 2021-05-14 19:01:32 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 18:22:30 +0000 vfs: refactor vdrop In particular move vunlazy into its own routine. (cherry picked from commit cc6f46ac2fd5d910e632fced3f21d0b0f53030d8) --- sys/kern/vfs_subr.c | 85 +++++++++++++++++++++++++---------------------------- 1 file changed, 40 insertions(+), 45 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 53c9c12be34c..270dab02bf39 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -3059,6 +3059,31 @@ vlazy(struct vnode *vp) mtx_unlock(&mp->mnt_listmtx); } +static void +vunlazy(struct vnode *vp) +{ + struct mount *mp; + + ASSERT_VI_LOCKED(vp, __func__); + VNPASS(!VN_IS_DOOMED(vp), vp); + + mp = vp->v_mount; + mtx_lock(&mp->mnt_listmtx); + VNPASS(vp->v_mflag & VMP_LAZYLIST, vp); + /* + * Don't remove the vnode from the lazy list if another thread + * has increased the hold count. It may have re-enqueued the + * vnode to the lazy list and is now responsible for its + * removal. + */ + if (vp->v_holdcnt == 0) { + vp->v_mflag &= ~VMP_LAZYLIST; + TAILQ_REMOVE(&mp->mnt_lazyvnodelist, vp, v_lazylist); + mp->mnt_lazyvnodelistsize--; + } + mtx_unlock(&mp->mnt_listmtx); +} + /* * This routine is only meant to be called from vgonel prior to dooming * the vnode. @@ -3514,42 +3539,6 @@ vdbatch_dequeue(struct vnode *vp) * there is at least one resident non-cached page, the vnode cannot * leave the active list without the page cleanup done. */ -static void -vdrop_deactivate(struct vnode *vp) -{ - struct mount *mp; - - ASSERT_VI_LOCKED(vp, __func__); - /* - * Mark a vnode as free: remove it from its active list - * and put it up for recycling on the freelist. - */ - VNASSERT(!VN_IS_DOOMED(vp), vp, - ("vdrop: returning doomed vnode")); - VNASSERT((vp->v_iflag & VI_OWEINACT) == 0, vp, - ("vnode with VI_OWEINACT set")); - VNASSERT((vp->v_iflag & VI_DEFINACT) == 0, vp, - ("vnode with VI_DEFINACT set")); - if (vp->v_mflag & VMP_LAZYLIST) { - mp = vp->v_mount; - mtx_lock(&mp->mnt_listmtx); - VNASSERT(vp->v_mflag & VMP_LAZYLIST, vp, ("lost VMP_LAZYLIST")); - /* - * Don't remove the vnode from the lazy list if another thread - * has increased the hold count. It may have re-enqueued the - * vnode to the lazy list and is now responsible for its - * removal. - */ - if (vp->v_holdcnt == 0) { - vp->v_mflag &= ~VMP_LAZYLIST; - TAILQ_REMOVE(&mp->mnt_lazyvnodelist, vp, v_lazylist); - mp->mnt_lazyvnodelistsize--; - } - mtx_unlock(&mp->mnt_listmtx); - } - vdbatch_enqueue(vp); -} - static void __noinline vdropl_final(struct vnode *vp) { @@ -3599,17 +3588,23 @@ vdropl(struct vnode *vp) VI_UNLOCK(vp); return; } - if (!VN_IS_DOOMED(vp)) { - vfs_freevnodes_inc(); - vdrop_deactivate(vp); - /* - * Also unlocks the interlock. We can't assert on it as we - * released our hold and by now the vnode might have been - * freed. - */ + VNPASS((vp->v_iflag & VI_OWEINACT) == 0, vp); + VNPASS((vp->v_iflag & VI_DEFINACT) == 0, vp); + if (VN_IS_DOOMED(vp)) { + vdropl_final(vp); return; } - vdropl_final(vp); + + vfs_freevnodes_inc(); + if (vp->v_mflag & VMP_LAZYLIST) { + vunlazy(vp); + } + /* + * Also unlocks the interlock. We can't assert on it as we + * released our hold and by now the vnode might have been + * freed. + */ + vdbatch_enqueue(vp); } /* From owner-dev-commits-src-branches@freebsd.org Sat May 22 18:24:02 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 8C18A633F54; Sat, 22 May 2021 18:24:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnX1G3C8Fz4V1B; Sat, 22 May 2021 18:24:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7606A60; Sat, 22 May 2021 18:24:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14MIO14c005971; Sat, 22 May 2021 18:24:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MIO1YS005970; Sat, 22 May 2021 18:24:01 GMT (envelope-from git) Date: Sat, 22 May 2021 18:24:01 GMT Message-Id: <202105221824.14MIO1YS005970@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: af68d00a202f - stable/13 - pseudofs: use vget_prep + vget_finish instead of vget + the interlock MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: af68d00a202f74011d165182c85cfecb63eaa3e5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:24:03 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=af68d00a202f74011d165182c85cfecb63eaa3e5 commit af68d00a202f74011d165182c85cfecb63eaa3e5 Author: Mateusz Guzik AuthorDate: 2021-05-19 14:20:23 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 18:22:35 +0000 pseudofs: use vget_prep + vget_finish instead of vget + the interlock (cherry picked from commit 43999a5cba3cfbf0a0f6244c76a3cd548b6925e8) --- sys/fs/pseudofs/pseudofs_vncache.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/fs/pseudofs/pseudofs_vncache.c b/sys/fs/pseudofs/pseudofs_vncache.c index 8d6f56f6fe27..b0b10d525783 100644 --- a/sys/fs/pseudofs/pseudofs_vncache.c +++ b/sys/fs/pseudofs/pseudofs_vncache.c @@ -120,6 +120,7 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp, struct pfs_vncache_head *hash; struct pfs_vdata *pvd, *pvd2; struct vnode *vp; + enum vgetstate vs; int error; /* @@ -134,9 +135,9 @@ retry: if (pvd->pvd_pn == pn && pvd->pvd_pid == pid && pvd->pvd_vnode->v_mount == mp) { vp = pvd->pvd_vnode; - VI_LOCK(vp); + vs = vget_prep(vp); mtx_unlock(&pfs_vncache_mutex); - if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK) == 0) { + if (vget_finish(vp, LK_EXCLUSIVE, vs) == 0) { ++pfs_vncache_hits; *vpp = vp; /* From owner-dev-commits-src-branches@freebsd.org Sat May 22 18:24:04 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 A353B633F55; Sat, 22 May 2021 18:24:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnX1H66Whz4Tks; Sat, 22 May 2021 18:24:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B4521210; Sat, 22 May 2021 18:24:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14MIO2ZY005992; Sat, 22 May 2021 18:24:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MIO2wx005991; Sat, 22 May 2021 18:24:02 GMT (envelope-from git) Date: Sat, 22 May 2021 18:24:02 GMT Message-Id: <202105221824.14MIO2wx005991@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 8a0ec6bd40e8 - stable/13 - fdescfs: allow shared locking of root vnode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8a0ec6bd40e8f2c451de025d55b1637dde77d982 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:24:04 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=8a0ec6bd40e8f2c451de025d55b1637dde77d982 commit 8a0ec6bd40e8f2c451de025d55b1637dde77d982 Author: Mateusz Guzik AuthorDate: 2021-05-19 15:59:20 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 18:22:39 +0000 fdescfs: allow shared locking of root vnode Eliminates fdescfs from lock profile when running poudriere. (cherry picked from commit 4fe925b81e75b5885ec6d504c6217f848439164a) --- sys/fs/fdescfs/fdesc_vfsops.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c index e7878f115ac2..64f8d28bdcfd 100644 --- a/sys/fs/fdescfs/fdesc_vfsops.c +++ b/sys/fs/fdescfs/fdesc_vfsops.c @@ -107,12 +107,23 @@ fdesc_mount(struct mount *mp) mp->mnt_data = NULL; return (error); } + VN_LOCK_ASHARE(rvp); rvp->v_type = VDIR; rvp->v_vflag |= VV_ROOT; fmp->f_root = rvp; VOP_UNLOCK(rvp); + + MNT_ILOCK(mp); /* XXX -- don't mark as local to work around fts() problems */ /*mp->mnt_flag |= MNT_LOCAL;*/ + /* + * Enable shared locking so that there is no contention on the root + * vnode. Note only root vnode enables shared locking for itself, + * so this end up being a nop for the rest. + */ + mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED; + MNT_IUNLOCK(mp); + vfs_getnewfsid(mp); vfs_mountedfrom(mp, "fdescfs"); @@ -163,7 +174,7 @@ fdesc_root(struct mount *mp, int flags, struct vnode **vpp) * Return locked reference to root. */ vp = VFSTOFDESC(mp)->f_root; - vget(vp, LK_EXCLUSIVE | LK_RETRY); + vget(vp, flags | LK_RETRY); *vpp = vp; return (0); } From owner-dev-commits-src-branches@freebsd.org Sat May 22 18:29:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 B5E69634515; Sat, 22 May 2021 18:29:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnX8128WWz4YGt; Sat, 22 May 2021 18:29:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23CF6DC7; Sat, 22 May 2021 18:29:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14MITqrW006521; Sat, 22 May 2021 18:29:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MITqlk006520; Sat, 22 May 2021 18:29:52 GMT (envelope-from git) Date: Sat, 22 May 2021 18:29:52 GMT Message-Id: <202105221829.14MITqlk006520@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 90b82ea9a64f - stable/13 - vm: add another pager private flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 90b82ea9a64fe3bc1c5caa26228d1983b9681fa1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:29:53 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=90b82ea9a64fe3bc1c5caa26228d1983b9681fa1 commit 90b82ea9a64fe3bc1c5caa26228d1983b9681fa1 Author: Mateusz Guzik AuthorDate: 2021-05-14 07:50:10 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 18:28:29 +0000 vm: add another pager private flag Contrary to what was done in main, skip the following in order to not disrupt KBI: Move OBJ_SHADOWLIST around to let pager flags be next to each other. (cherry picked from commit 128e25842ef510b39815d784e1d2af0d4afd584f) --- sys/fs/tmpfs/tmpfs.h | 2 +- sys/vm/vm_object.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index 549339d9b6d1..bb777e29e3d0 100644 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -45,7 +45,7 @@ MALLOC_DECLARE(M_TMPFSNAME); #endif -#define OBJ_TMPFS OBJ_PAGERPRIV /* has tmpfs vnode allocated */ +#define OBJ_TMPFS OBJ_PAGERPRIV1 /* has tmpfs vnode allocated */ /* * Internal representation of a tmpfs directory entry. diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index d159c621d2e6..adbe022417f4 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -201,13 +201,14 @@ struct vm_object { #define OBJ_UMTXDEAD 0x0020 /* umtx pshared was terminated */ #define OBJ_SIZEVNLOCK 0x0040 /* lock vnode to check obj size */ #define OBJ_PG_DTOR 0x0080 /* dont reset object, leave that for dtor */ +#define OBJ_PAGERPRIV2 0x0100 /* Pager private */ #define OBJ_SWAP 0x0200 /* object swaps */ #define OBJ_SPLIT 0x0400 /* object is being split */ #define OBJ_COLLAPSING 0x0800 /* Parent of collapse. */ #define OBJ_COLORED 0x1000 /* pg_color is defined */ #define OBJ_ONEMAPPING 0x2000 /* One USE (a single, non-forked) mapping flag */ -#define OBJ_SHADOWLIST 0x4000 /* Object is on the shadow list. */ -#define OBJ_PAGERPRIV 0x8000 /* Pager private */ +#define OBJ_PAGERPRIV1 0x4000 /* Pager private */ +#define OBJ_SHADOWLIST 0x8000 /* Object is on the shadow list. */ /* * Helpers to perform conversion between vm_object page indexes and offsets. From owner-dev-commits-src-branches@freebsd.org Sat May 22 18:29:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 699A16346E1; Sat, 22 May 2021 18:29:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnX822JdSz4YPf; Sat, 22 May 2021 18:29:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23FA3DC8; Sat, 22 May 2021 18:29:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14MITrda006542; Sat, 22 May 2021 18:29:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MITrGH006541; Sat, 22 May 2021 18:29:53 GMT (envelope-from git) Date: Sat, 22 May 2021 18:29:53 GMT Message-Id: <202105221829.14MITrGH006541@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 443baed524c9 - stable/13 - tmpfs: reimplement the mtime scan to use the lazy list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 443baed524c9171c3774bf2e3a118970f2fa8c0f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:29:54 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=443baed524c9171c3774bf2e3a118970f2fa8c0f commit 443baed524c9171c3774bf2e3a118970f2fa8c0f Author: Mateusz Guzik AuthorDate: 2021-05-07 14:43:43 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 18:28:55 +0000 tmpfs: reimplement the mtime scan to use the lazy list Tested by: pho Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D30065 (cherry picked from commit eec2e4ef7f964d18fcec3dc2cdcd7530be490835) --- sys/fs/tmpfs/tmpfs.h | 1 + sys/fs/tmpfs/tmpfs_subr.c | 107 ++++++++++++++++++++++++++++++++++++++++++++ sys/fs/tmpfs/tmpfs_vfsops.c | 67 ++++++++++++++------------- 3 files changed, 143 insertions(+), 32 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index bb777e29e3d0..99368d67aaaa 100644 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -46,6 +46,7 @@ MALLOC_DECLARE(M_TMPFSNAME); #endif #define OBJ_TMPFS OBJ_PAGERPRIV1 /* has tmpfs vnode allocated */ +#define OBJ_TMPFS_VREF OBJ_PAGERPRIV2 /* vnode is referenced */ /* * Internal representation of a tmpfs directory entry. diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 67eb12598e24..8b75c58d69a2 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -99,6 +99,92 @@ tmpfs_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, return (object); } +/* + * Make sure tmpfs vnodes with writable mappings can be found on the lazy list. + * + * This allows for periodic mtime updates while only scanning vnodes which are + * plausibly dirty, see tmpfs_update_mtime_lazy. + */ +static void +tmpfs_pager_writecount_recalc(vm_object_t object, vm_offset_t old, + vm_offset_t new) +{ + struct vnode *vp; + + VM_OBJECT_ASSERT_WLOCKED(object); + + vp = object->un_pager.swp.swp_tmpfs; + + /* + * Forced unmount? + */ + if (vp == NULL) { + KASSERT((object->flags & OBJ_TMPFS_VREF) == 0, + ("object %p with OBJ_TMPFS_VREF but without vnode", object)); + VM_OBJECT_WUNLOCK(object); + return; + } + + if (old == 0) { + VNASSERT((object->flags & OBJ_TMPFS_VREF) == 0, vp, + ("object without writable mappings has a reference")); + VNPASS(vp->v_usecount > 0, vp); + } else { + VNASSERT((object->flags & OBJ_TMPFS_VREF) != 0, vp, + ("object with writable mappings does not have a reference")); + } + + if (old == new) { + VM_OBJECT_WUNLOCK(object); + return; + } + + if (new == 0) { + vm_object_clear_flag(object, OBJ_TMPFS_VREF); + VM_OBJECT_WUNLOCK(object); + vrele(vp); + } else { + if ((object->flags & OBJ_TMPFS_VREF) == 0) { + vref(vp); + vlazy(vp); + vm_object_set_flag(object, OBJ_TMPFS_VREF); + } + VM_OBJECT_WUNLOCK(object); + } +} + +static void +tmpfs_pager_update_writecount(vm_object_t object, vm_offset_t start, + vm_offset_t end) +{ + vm_offset_t new, old; + + VM_OBJECT_WLOCK(object); + KASSERT((object->flags & OBJ_ANON) == 0, + ("%s: object %p with OBJ_ANON", __func__, object)); + old = object->un_pager.swp.writemappings; + object->un_pager.swp.writemappings += (vm_ooffset_t)end - start; + new = object->un_pager.swp.writemappings; + tmpfs_pager_writecount_recalc(object, old, new); + VM_OBJECT_ASSERT_UNLOCKED(object); +} + +static void +tmpfs_pager_release_writecount(vm_object_t object, vm_offset_t start, + vm_offset_t end) +{ + vm_offset_t new, old; + + VM_OBJECT_WLOCK(object); + KASSERT((object->flags & OBJ_ANON) == 0, + ("%s: object %p with OBJ_ANON", __func__, object)); + old = object->un_pager.swp.writemappings; + object->un_pager.swp.writemappings -= (vm_ooffset_t)end - start; + new = object->un_pager.swp.writemappings; + tmpfs_pager_writecount_recalc(object, old, new); + VM_OBJECT_ASSERT_UNLOCKED(object); +} + static void tmpfs_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) { @@ -131,6 +217,8 @@ struct pagerops tmpfs_pager_ops = { .pgo_kvme_type = KVME_TYPE_VNODE, .pgo_alloc = tmpfs_pager_alloc, .pgo_set_writeable_dirty = vm_object_set_writeable_dirty_, + .pgo_update_writecount = tmpfs_pager_update_writecount, + .pgo_release_writecount = tmpfs_pager_release_writecount, .pgo_mightbedirty = vm_object_mightbedirty_, .pgo_getvp = tmpfs_pager_getvp, }; @@ -643,6 +731,7 @@ tmpfs_free_dirent(struct tmpfs_mount *tmp, struct tmpfs_dirent *de) void tmpfs_destroy_vobject(struct vnode *vp, vm_object_t obj) { + bool want_vrele; ASSERT_VOP_ELOCKED(vp, "tmpfs_destroy_vobject"); if (vp->v_type != VREG || obj == NULL) @@ -650,12 +739,24 @@ tmpfs_destroy_vobject(struct vnode *vp, vm_object_t obj) VM_OBJECT_WLOCK(obj); VI_LOCK(vp); + /* + * May be going through forced unmount. + */ + want_vrele = false; + if ((obj->flags & OBJ_TMPFS_VREF) != 0) { + vm_object_clear_flag(obj, OBJ_TMPFS_VREF); + want_vrele = true; + } + vm_object_clear_flag(obj, OBJ_TMPFS); obj->un_pager.swp.swp_tmpfs = NULL; if (vp->v_writecount < 0) vp->v_writecount = 0; VI_UNLOCK(vp); VM_OBJECT_WUNLOCK(obj); + if (want_vrele) { + vrele(vp); + } } /* @@ -792,6 +893,12 @@ loop: case VREG: object = node->tn_reg.tn_aobj; VM_OBJECT_WLOCK(object); + KASSERT((object->flags & OBJ_TMPFS_VREF) == 0, + ("%s: object %p with OBJ_TMPFS_VREF but without vnode", + __func__, object)); + KASSERT(object->un_pager.swp.writemappings == 0, + ("%s: object %p has writemappings", + __func__, object)); VI_LOCK(vp); KASSERT(vp->v_object == NULL, ("Not NULL v_object in tmpfs")); vp->v_object = object; diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index 4f29b5dfc6f0..7dffb9027946 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -99,18 +99,38 @@ static const char *tmpfs_updateopts[] = { "from", "export", "nomtime", "size", NULL }; -/* - * Handle updates of time from writes to mmaped regions, if allowed. - * Use MNT_VNODE_FOREACH_ALL instead of MNT_VNODE_FOREACH_LAZY, since - * unmap of the tmpfs-backed vnode does not call vinactive(), due to - * vm object type is basically OBJT_SWAP. If lazy, only handle - * delayed update of mtime due to the writes to mapped files. - */ +static int +tmpfs_update_mtime_lazy_filter(struct vnode *vp, void *arg) +{ + struct vm_object *obj; + + if (vp->v_type != VREG) + return (0); + + obj = atomic_load_ptr(&vp->v_object); + if (obj == NULL) + return (0); + + return (vm_object_mightbedirty_(obj)); +} + static void -tmpfs_update_mtime(struct mount *mp, bool lazy) +tmpfs_update_mtime_lazy(struct mount *mp) +{ + struct vnode *vp, *mvp; + + MNT_VNODE_FOREACH_LAZY(vp, mp, mvp, tmpfs_update_mtime_lazy_filter, NULL) { + if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK) != 0) + continue; + tmpfs_check_mtime(vp); + vput(vp); + } +} + +static void +tmpfs_update_mtime_all(struct mount *mp) { struct vnode *vp, *mvp; - struct vm_object *obj; if (VFS_TO_TMPFS(mp)->tm_nomtime) return; @@ -119,28 +139,11 @@ tmpfs_update_mtime(struct mount *mp, bool lazy) VI_UNLOCK(vp); continue; } - obj = vp->v_object; - MPASS(obj->type == tmpfs_pager_type); - MPASS((obj->flags & OBJ_TMPFS) != 0); - - /* - * In lazy case, do unlocked read, avoid taking vnode - * lock if not needed. Lost update will be handled on - * the next call. - * For non-lazy case, we must flush all pending - * metadata changes now. - */ - if (!lazy || obj->generation != obj->cleangeneration) { - if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK) != 0) - continue; - tmpfs_check_mtime(vp); - if (!lazy) - tmpfs_update(vp); - vput(vp); - } else { - VI_UNLOCK(vp); + if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK) != 0) continue; - } + tmpfs_check_mtime(vp); + tmpfs_update(vp); + vput(vp); } } @@ -300,7 +303,7 @@ tmpfs_rw_to_ro(struct mount *mp) MNT_IUNLOCK(mp); for (;;) { tmpfs_all_rw_maps(mp, tmpfs_revoke_rw_maps_cb, NULL); - tmpfs_update_mtime(mp, false); + tmpfs_update_mtime_all(mp); error = vflush(mp, 0, flags, curthread); if (error != 0) { VFS_TO_TMPFS(mp)->tm_ronly = 0; @@ -653,7 +656,7 @@ tmpfs_sync(struct mount *mp, int waitfor) mp->mnt_kern_flag |= MNTK_SUSPEND2 | MNTK_SUSPENDED; MNT_IUNLOCK(mp); } else if (waitfor == MNT_LAZY) { - tmpfs_update_mtime(mp, true); + tmpfs_update_mtime_lazy(mp); } return (0); } From owner-dev-commits-src-branches@freebsd.org Sat May 22 18:31:03 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 495F963489D; Sat, 22 May 2021 18:31:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnX9M1XHsz4Z8p; Sat, 22 May 2021 18:31:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B9671227; Sat, 22 May 2021 18:31:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14MIV3H7017989; Sat, 22 May 2021 18:31:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MIV3qC017988; Sat, 22 May 2021 18:31:03 GMT (envelope-from git) Date: Sat, 22 May 2021 18:31:03 GMT Message-Id: <202105221831.14MIV3qC017988@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: d2e0a3bb2194 - stable/13 - zfs: damage control racing .. lookups in face of mkdir/rmdir MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d2e0a3bb2194f1d938aacbd48afbab758f9f2314 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:31:03 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=d2e0a3bb2194f1d938aacbd48afbab758f9f2314 commit d2e0a3bb2194f1d938aacbd48afbab758f9f2314 Author: Mateusz Guzik AuthorDate: 2021-04-15 07:54:18 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 18:30:44 +0000 zfs: damage control racing .. lookups in face of mkdir/rmdir Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D29769 (cherry picked from commit 9c651561a2a31fcb08390d37947afc27ec03d87b) --- .../openzfs/module/os/freebsd/zfs/zfs_vnops_os.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c index 8172916c4329..a1e9c359b893 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c @@ -781,6 +781,7 @@ zfs_lookup(vnode_t *dvp, const char *nm, vnode_t **vpp, znode_t *zdp = VTOZ(dvp); znode_t *zp; zfsvfs_t *zfsvfs = zdp->z_zfsvfs; + seqc_t dvp_seqc; int error = 0; /* @@ -806,6 +807,8 @@ zfs_lookup(vnode_t *dvp, const char *nm, vnode_t **vpp, ZFS_ENTER(zfsvfs); ZFS_VERIFY_ZP(zdp); + dvp_seqc = vn_seqc_read_any(dvp); + *vpp = NULL; if (flags & LOOKUP_XATTR) { @@ -975,6 +978,24 @@ zfs_lookup(vnode_t *dvp, const char *nm, vnode_t **vpp, } } + if ((cnp->cn_flags & ISDOTDOT) != 0) { + /* + * FIXME: zfs_lookup_lock relocks vnodes and does nothing to + * handle races. In particular different callers may end up + * with different vnodes and will try to add conflicting + * entries to the namecache. + * + * While finding different result may be acceptable in face + * of concurrent modification, adding conflicting entries + * trips over an assert in the namecache. + * + * Ultimately let an entry through once everything settles. + */ + if (!vn_seqc_consistent(dvp, dvp_seqc)) { + cnp->cn_flags &= ~MAKEENTRY; + } + } + /* Insert name into cache (as non-existent) if appropriate. */ if (zfsvfs->z_use_namecache && !zfsvfs->z_replay && error == ENOENT && (cnp->cn_flags & MAKEENTRY) != 0) From owner-dev-commits-src-branches@freebsd.org Sat May 22 18:31:04 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 980DA6348AF; Sat, 22 May 2021 18:31:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnX9N2YqRz4Z42; Sat, 22 May 2021 18:31:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D6BDF79; Sat, 22 May 2021 18:31:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14MIV4PI018012; Sat, 22 May 2021 18:31:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MIV4rs018011; Sat, 22 May 2021 18:31:04 GMT (envelope-from git) Date: Sat, 22 May 2021 18:31:04 GMT Message-Id: <202105221831.14MIV4rs018011@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: a9d418fbb843 - stable/13 - zfs: use vn_seqc_read_notmodify for racing .. lookups MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a9d418fbb843927fe193d19616ddef48c50ae206 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:31:04 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=a9d418fbb843927fe193d19616ddef48c50ae206 commit a9d418fbb843927fe193d19616ddef48c50ae206 Author: Mateusz Guzik AuthorDate: 2021-04-22 13:18:39 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 18:30:50 +0000 zfs: use vn_seqc_read_notmodify for racing .. lookups Catching an in-flight unlocked vnode is fine here. Reported by; pho (cherry picked from commit 7ea3223c7822d20acfc907683fd0153d623185b3) --- sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c index a1e9c359b893..50454cad2468 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c @@ -807,7 +807,7 @@ zfs_lookup(vnode_t *dvp, const char *nm, vnode_t **vpp, ZFS_ENTER(zfsvfs); ZFS_VERIFY_ZP(zdp); - dvp_seqc = vn_seqc_read_any(dvp); + dvp_seqc = vn_seqc_read_notmodify(dvp); *vpp = NULL; From owner-dev-commits-src-branches@freebsd.org Sat May 22 18:33:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 55B5A63486E; Sat, 22 May 2021 18:33:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnXDW1zmgz4bby; Sat, 22 May 2021 18:33:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2CBB11297; Sat, 22 May 2021 18:33:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14MIXlMq019457; Sat, 22 May 2021 18:33:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MIXlRa019456; Sat, 22 May 2021 18:33:47 GMT (envelope-from git) Date: Sat, 22 May 2021 18:33:47 GMT Message-Id: <202105221833.14MIXlRa019456@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 8b59c6af27d1 - stable/13 - vfs: Fix error handling in vn_fullpath_hardlink() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8b59c6af27d188f6f32800a34b872c9415533895 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:33:47 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=8b59c6af27d188f6f32800a34b872c9415533895 commit 8b59c6af27d188f6f32800a34b872c9415533895 Author: Mark Johnston AuthorDate: 2021-05-11 00:18:00 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 18:33:16 +0000 vfs: Fix error handling in vn_fullpath_hardlink() vn_fullpath_any_smr() will return a positive error number if the caller-supplied buffer isn't big enough. In this case the error must be propagated up, otherwise we may copy out uninitialized bytes. Reported by: syzkaller+KMSAN Reviewed by: mjg, kib MFC aftr: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30198 (cherry picked from commit c8bbb1272c8bc103cfaa42c7a1639f42b62483dd) --- sys/kern/vfs_cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 2def9900096f..5b978511db17 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3646,9 +3646,9 @@ vn_fullpath_hardlink(struct nameidata *ndp, char **retbuf, char **freebuf, error = vn_fullpath_dir(vp, pwd->pwd_rdir, buf, retbuf, buflen, addend); pwd_drop(pwd); - if (error != 0) - goto out_bad; } + if (error != 0) + goto out_bad; *freebuf = buf; From owner-dev-commits-src-branches@freebsd.org Sat May 22 18:36:38 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 F15A4634CAE; Sat, 22 May 2021 18:36:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnXHn62yjz4cGM; Sat, 22 May 2021 18:36:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B294BED5; Sat, 22 May 2021 18:36:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14MIabj3019885; Sat, 22 May 2021 18:36:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MIabWV019884; Sat, 22 May 2021 18:36:37 GMT (envelope-from git) Date: Sat, 22 May 2021 18:36:37 GMT Message-Id: <202105221836.14MIabWV019884@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: bb3b814b2516 - stable/13 - zfs: make seqc asserts conditional on replay MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bb3b814b2516fa30833dc5b1a0349270c549ac40 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:36:38 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=bb3b814b2516fa30833dc5b1a0349270c549ac40 commit bb3b814b2516fa30833dc5b1a0349270c549ac40 Author: Mateusz Guzik AuthorDate: 2021-03-13 09:10:16 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 18:36:29 +0000 zfs: make seqc asserts conditional on replay Avoids tripping on asserts when doing pool recovery. (cherry picked from commit 59146a6921d06d5cf4320dc8ed82810363ffe7c4) --- sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c | 9 ++++++--- sys/contrib/openzfs/module/zfs/zfs_replay.c | 5 ----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c index 23b87de8bd0d..7089d0e0e887 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c @@ -1141,10 +1141,11 @@ zfs_acl_chown_setattr(znode_t *zp) int error; zfs_acl_t *aclp; - if (zp->z_zfsvfs->z_replay == B_FALSE) + if (zp->z_zfsvfs->z_replay == B_FALSE) { ASSERT_VOP_ELOCKED(ZTOV(zp), __func__); + ASSERT_VOP_IN_SEQC(ZTOV(zp)); + } ASSERT(MUTEX_HELD(&zp->z_acl_lock)); - ASSERT_VOP_IN_SEQC(ZTOV(zp)); if ((error = zfs_acl_node_read(zp, B_TRUE, &aclp, B_FALSE)) == 0) zp->z_mode = zfs_mode_compute(zp->z_mode, aclp, @@ -1172,7 +1173,9 @@ zfs_aclset_common(znode_t *zp, zfs_acl_t *aclp, cred_t *cr, dmu_tx_t *tx) int count = 0; zfs_acl_phys_t acl_phys; - ASSERT_VOP_IN_SEQC(ZTOV(zp)); + if (zp->z_zfsvfs->z_replay == B_FALSE) { + ASSERT_VOP_IN_SEQC(ZTOV(zp)); + } mode = zp->z_mode; diff --git a/sys/contrib/openzfs/module/zfs/zfs_replay.c b/sys/contrib/openzfs/module/zfs/zfs_replay.c index 53c7dbd5df43..cba5e8c9cd0b 100644 --- a/sys/contrib/openzfs/module/zfs/zfs_replay.c +++ b/sys/contrib/openzfs/module/zfs/zfs_replay.c @@ -859,12 +859,7 @@ zfs_replay_setattr(void *arg1, void *arg2, boolean_t byteswap) zfsvfs->z_fuid_replay = zfs_replay_fuid_domain(start, &start, lr->lr_uid, lr->lr_gid); - /* - * Satisfy assertions. - */ - vn_seqc_write_begin(ZTOV(zp)); error = zfs_setattr(zp, vap, 0, kcred); - vn_seqc_write_end(ZTOV(zp)); zfs_fuid_info_free(zfsvfs->z_fuid_replay); zfsvfs->z_fuid_replay = NULL; From owner-dev-commits-src-branches@freebsd.org Sat May 22 18:38:25 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 8CCD8634DBE; Sat, 22 May 2021 18:38:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnXKs3Yttz4dFG; Sat, 22 May 2021 18:38:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5ACE1DE5; Sat, 22 May 2021 18:38:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14MIcP7T020113; Sat, 22 May 2021 18:38:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MIcPNd020112; Sat, 22 May 2021 18:38:25 GMT (envelope-from git) Date: Sat, 22 May 2021 18:38:25 GMT Message-Id: <202105221838.14MIcPNd020112@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 8bb6b6a46147 - stable/13 - zfs: change format string in zio_fini to get rid of the cast MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8bb6b6a46147375486d888f3e460b0aaa5c203b5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:38:25 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=8bb6b6a46147375486d888f3e460b0aaa5c203b5 commit 8bb6b6a46147375486d888f3e460b0aaa5c203b5 Author: Mateusz Guzik AuthorDate: 2021-04-10 19:12:00 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 18:37:19 +0000 zfs: change format string in zio_fini to get rid of the cast (cherry picked from commit a7fbfdee732bd8728d0e642016bf8b6548cfa1bb) --- sys/contrib/openzfs/module/zfs/zio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/contrib/openzfs/module/zfs/zio.c b/sys/contrib/openzfs/module/zfs/zio.c index b5ffe9c294df..26e40716710e 100644 --- a/sys/contrib/openzfs/module/zfs/zio.c +++ b/sys/contrib/openzfs/module/zfs/zio.c @@ -293,9 +293,9 @@ zio_fini(void) for (i = 0; i < n; i++) { if (zio_buf_cache[i] != NULL) - panic("zio_fini: zio_buf_cache[%d] != NULL", (int)i); + panic("zio_fini: zio_buf_cache[%zd] != NULL", i); if (zio_data_buf_cache[i] != NULL) - panic("zio_fini: zio_data_buf_cache[%d] != NULL", (int)i); + panic("zio_fini: zio_data_buf_cache[%zd] != NULL", i); } kmem_cache_destroy(zio_link_cache); From owner-dev-commits-src-branches@freebsd.org Sat May 22 18:38:26 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 AEE42634E8C; Sat, 22 May 2021 18:38:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnXKt45dyz4d28; Sat, 22 May 2021 18:38:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7245BDE6; Sat, 22 May 2021 18:38:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14MIcQdr020134; Sat, 22 May 2021 18:38:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MIcQqv020133; Sat, 22 May 2021 18:38:26 GMT (envelope-from git) Date: Sat, 22 May 2021 18:38:26 GMT Message-Id: <202105221838.14MIcQqv020133@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 8ea3f6a3e454 - stable/13 - zfs: make vnlru_free_vfsops use conditional on version MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8ea3f6a3e45473bcd494c385b8614a8cc88b1356 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:38:26 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=8ea3f6a3e45473bcd494c385b8614a8cc88b1356 commit 8ea3f6a3e45473bcd494c385b8614a8cc88b1356 Author: Mateusz Guzik AuthorDate: 2021-04-11 04:49:24 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 18:37:23 +0000 zfs: make vnlru_free_vfsops use conditional on version Diff reduction against upstream. (cherry picked from commit feea35bed0dd7a029b70b700cc3c0d2139e3deb8) --- sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c index 0d5cffbe8d1e..201dbc423336 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c @@ -51,8 +51,10 @@ #include #include +#if __FreeBSD_version >= 1300139 static struct sx arc_vnlru_lock; static struct vnode *arc_vnlru_marker; +#endif extern struct vfsops zfs_vfsops; @@ -160,9 +162,13 @@ arc_prune_task(void *arg) arc_reduce_target_size(ptob(nr_scan)); free(arg, M_TEMP); +#if __FreeBSD_version >= 1300139 sx_xlock(&arc_vnlru_lock); vnlru_free_vfsops(nr_scan, &zfs_vfsops, arc_vnlru_marker); sx_xunlock(&arc_vnlru_lock); +#else + vnlru_free(nr_scan, &zfs_vfsops); +#endif } /* @@ -239,8 +245,10 @@ arc_lowmem_init(void) { arc_event_lowmem = EVENTHANDLER_REGISTER(vm_lowmem, arc_lowmem, NULL, EVENTHANDLER_PRI_FIRST); +#if __FreeBSD_version >= 1300139 arc_vnlru_marker = vnlru_alloc_marker(); sx_init(&arc_vnlru_lock, "arc vnlru lock"); +#endif } void @@ -248,10 +256,12 @@ arc_lowmem_fini(void) { if (arc_event_lowmem != NULL) EVENTHANDLER_DEREGISTER(vm_lowmem, arc_event_lowmem); +#if __FreeBSD_version >= 1300139 if (arc_vnlru_marker != NULL) { vnlru_free_marker(arc_vnlru_marker); sx_destroy(&arc_vnlru_lock); } +#endif } void From owner-dev-commits-src-branches@freebsd.org Sat May 22 18:38:28 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 AC53C634965; Sat, 22 May 2021 18:38:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnXKw3dTCz4d4c; Sat, 22 May 2021 18:38:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 87FFB1299; Sat, 22 May 2021 18:38:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14MIcRu7020162; Sat, 22 May 2021 18:38:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MIcRO4020161; Sat, 22 May 2021 18:38:27 GMT (envelope-from git) Date: Sat, 22 May 2021 18:38:27 GMT Message-Id: <202105221838.14MIcRO4020161@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: a6e5d0305505 - stable/13 - zfs: avoid memory allocation in arc_prune_async MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a6e5d0305505ab1a70c92b9dea344b7c6914cf91 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:38:29 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=a6e5d0305505ab1a70c92b9dea344b7c6914cf91 commit a6e5d0305505ab1a70c92b9dea344b7c6914cf91 Author: Mateusz Guzik AuthorDate: 2021-04-11 05:15:41 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 18:37:28 +0000 zfs: avoid memory allocation in arc_prune_async (cherry picked from commit 97ed4babb51636d8a4b11bc7b207c3219ffcd0e3) --- sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c index 201dbc423336..e73efd810e53 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c @@ -158,10 +158,13 @@ arc_default_max(uint64_t min, uint64_t allmem) static void arc_prune_task(void *arg) { - int64_t nr_scan = *(int64_t *)arg; +#ifdef __LP64__ + int64_t nr_scan = (int64_t)arg; +#else + int64_t nr_scan = (int32_t)arg; +#endif arc_reduce_target_size(ptob(nr_scan)); - free(arg, M_TEMP); #if __FreeBSD_version >= 1300139 sx_xlock(&arc_vnlru_lock); vnlru_free_vfsops(nr_scan, &zfs_vfsops, arc_vnlru_marker); @@ -185,13 +188,14 @@ arc_prune_task(void *arg) void arc_prune_async(int64_t adjust) { - int64_t *adjustptr; - if ((adjustptr = malloc(sizeof (int64_t), M_TEMP, M_NOWAIT)) == NULL) - return; +#ifndef __LP64__ + if (adjust > __LONG_MAX) + adjust = __LONG_MAX; +#endif - *adjustptr = adjust; + adjustptr = (void *)adjust; taskq_dispatch(arc_prune_taskq, arc_prune_task, adjustptr, TQ_SLEEP); ARCSTAT_BUMP(arcstat_prune); } From owner-dev-commits-src-branches@freebsd.org Sat May 22 21:00:13 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 EC653637932; Sat, 22 May 2021 21:00:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnbTT5z6Jz4kMT; Sat, 22 May 2021 21:00:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5A9F2E30; Sat, 22 May 2021 21:00:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14ML0DDJ012912; Sat, 22 May 2021 21:00:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14ML0DIN012905; Sat, 22 May 2021 21:00:13 GMT (envelope-from git) Date: Sat, 22 May 2021 21:00:13 GMT Message-Id: <202105222100.14ML0DIN012905@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: e198c1dc8f6f - stable/13 - Fix fsck_ffs Pass 1b error exit "bad inode number 256 to nextinode". MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e198c1dc8f6faaa85bd20990d15e3bcb9d081873 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 21:00:14 -0000 The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=e198c1dc8f6faaa85bd20990d15e3bcb9d081873 commit e198c1dc8f6faaa85bd20990d15e3bcb9d081873 Author: Kirk McKusick AuthorDate: 2021-05-19 21:38:21 +0000 Commit: Kirk McKusick CommitDate: 2021-05-22 21:03:37 +0000 Fix fsck_ffs Pass 1b error exit "bad inode number 256 to nextinode". (cherry picked from commit fe815b88b553667c40353c46b58f9779efa3570e) PR: 255979 Sponsored by: Netflix --- sbin/fsck_ffs/pass1b.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/fsck_ffs/pass1b.c b/sbin/fsck_ffs/pass1b.c index b44e0107c982..17a3b6495dc4 100644 --- a/sbin/fsck_ffs/pass1b.c +++ b/sbin/fsck_ffs/pass1b.c @@ -60,7 +60,6 @@ pass1b(void) memset(&idesc, 0, sizeof(struct inodesc)); idesc.id_func = pass1bcheck; duphead = duplist; - inumber = 0; for (c = 0; c < sblock.fs_ncg; c++) { if (got_siginfo) { printf("%s: phase 1b: cyl group %d of %d (%d%%)\n", @@ -77,6 +76,7 @@ pass1b(void) if (inosused == 0) continue; setinodebuf(c, inosused); + inumber = c * sblock.fs_ipg; for (i = 0; i < inosused; i++, inumber++) { if (inumber < UFS_ROOTINO) { (void)getnextinode(inumber, 0); From owner-dev-commits-src-branches@freebsd.org Sun May 23 00:04:17 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 5BC1F63AACD; Sun, 23 May 2021 00:04:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FngYs1y2mz3hLQ; Sun, 23 May 2021 00:04:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29B6C57C4; Sun, 23 May 2021 00:04:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14N04H9b060521; Sun, 23 May 2021 00:04:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14N04HMk060520; Sun, 23 May 2021 00:04:17 GMT (envelope-from git) Date: Sun, 23 May 2021 00:04:17 GMT Message-Id: <202105230004.14N04HMk060520@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eugene Grosbein Subject: git: 18fa0cbfc4e9 - stable/12 - MFC r351629: sys/net/if_vlan.c: Wrap a vlan's parent's if_output in a separate function. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 18fa0cbfc4e906fbf824651140f68d0a85c1d08f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 00:04:17 -0000 The branch stable/12 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=18fa0cbfc4e906fbf824651140f68d0a85c1d08f commit 18fa0cbfc4e906fbf824651140f68d0a85c1d08f Author: Matt Joras AuthorDate: 2019-08-30 20:19:43 +0000 Commit: Eugene Grosbein CommitDate: 2021-05-22 23:59:40 +0000 MFC r351629: sys/net/if_vlan.c: Wrap a vlan's parent's if_output in a separate function. The merge is done in preparation of another merge to support 802.1ad (qinq). Original commit log follows. When a vlan interface is created, its if_output is set directly to the parent interface's if_output. This is fine in the normal case but has an unfortunate consequence if you end up with a certain combination of vlan and lagg interfaces. Consider you have a lagg interface with a single laggport member. When an interface is added to a lagg its if_output is set to lagg_port_output, which blackholes traffic from the normal networking stack but not certain frames from BPF (pseudo_AF_HDRCMPLT). If you now create a vlan with the laggport member (not the lagg interface) as its parent, its if_output is set to lagg_port_output as well. While this is confusing conceptually and likely represents a misconfigured system, it is not itself a problem. The problem arises when you then remove the lagg interface. Doing this resets the if_output of the laggport member back to its original state, but the vlan's if_output is left pointing to lagg_port_output. This gives rise to the possibility that the system will panic when e.g. bpf is used to send any frames on the vlan interface. Fix this by creating a new function, vlan_output, which simply wraps the parent's current if_output. That way when the parent's if_output is restored there is no stale usage of lagg_port_output. Reviewed by: rstone Differential Revision: D21209 (cherry picked from commit 16cf6bdbb6cb18a5af7b499034b2176a1fa0a503) --- sys/net/if_vlan.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 1f5a95cdda7c..450c4b9bbe3b 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -291,6 +291,8 @@ static int vlan_setflag(struct ifnet *ifp, int flag, int status, static int vlan_setflags(struct ifnet *ifp, int status); static int vlan_setmulti(struct ifnet *ifp); static int vlan_transmit(struct ifnet *ifp, struct mbuf *m); +static int vlan_output(struct ifnet *ifp, struct mbuf *m, + const struct sockaddr *dst, struct route *ro); static void vlan_unconfig(struct ifnet *ifp); static void vlan_unconfig_locked(struct ifnet *ifp, int departing); static int vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t tag); @@ -1179,6 +1181,27 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) return (error); } +static int +vlan_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, + struct route *ro) +{ + struct epoch_tracker et; + struct ifvlan *ifv; + struct ifnet *p; + + NET_EPOCH_ENTER(et); + ifv = ifp->if_softc; + if (TRUNK(ifv) == NULL) { + NET_EPOCH_EXIT(et); + m_freem(m); + return (ENETDOWN); + } + p = PARENT(ifv); + NET_EPOCH_EXIT(et); + return p->if_output(ifp, m, dst, ro); +} + + /* * The ifp->if_qflush entry point for vlan(4) is a no-op. */ @@ -1392,13 +1415,18 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t vid) */ ifp->if_mtu = p->if_mtu - ifv->ifv_mtufudge; ifp->if_baudrate = p->if_baudrate; - ifp->if_output = p->if_output; ifp->if_input = p->if_input; ifp->if_resolvemulti = p->if_resolvemulti; ifp->if_addrlen = p->if_addrlen; ifp->if_broadcastaddr = p->if_broadcastaddr; ifp->if_pcp = ifv->ifv_pcp; + /* + * We wrap the parent's if_output using vlan_output to ensure that it + * can't become stale. + */ + ifp->if_output = vlan_output; + /* * Copy only a selected subset of flags from the parent. * Other flags are none of our business. From owner-dev-commits-src-branches@freebsd.org Sun May 23 01:06:48 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 748BD63C236; Sun, 23 May 2021 01:06:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fnhy02kw3z4fsf; Sun, 23 May 2021 01:06:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 477AF66FF; Sun, 23 May 2021 01:06:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14N16mnn040820; Sun, 23 May 2021 01:06:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14N16mZw040819; Sun, 23 May 2021 01:06:48 GMT (envelope-from git) Date: Sun, 23 May 2021 01:06:48 GMT Message-Id: <202105230106.14N16mZw040819@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eugene Grosbein Subject: git: bb12347c3b30 - stable/12 - if_vlan.c: fix breakage after previous merge MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: bb12347c3b302c5a07085a94e52adc4f2008b4e2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 01:06:48 -0000 The branch stable/12 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=bb12347c3b302c5a07085a94e52adc4f2008b4e2 commit bb12347c3b302c5a07085a94e52adc4f2008b4e2 Author: Eugene Grosbein AuthorDate: 2021-05-23 01:04:47 +0000 Commit: Eugene Grosbein CommitDate: 2021-05-23 01:04:47 +0000 if_vlan.c: fix breakage after previous merge Fix breakage after the commit 18fa0cbfc4e906fbf824651140f68d0a85c1d08f. This is direct commit to stable/12 due to code base difference with head. --- sys/net/if_vlan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 450c4b9bbe3b..1830c1cc441a 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1189,15 +1189,15 @@ vlan_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, struct ifvlan *ifv; struct ifnet *p; - NET_EPOCH_ENTER(et); + NET_EPOCH_ENTER(); ifv = ifp->if_softc; if (TRUNK(ifv) == NULL) { - NET_EPOCH_EXIT(et); + NET_EPOCH_EXIT(); m_freem(m); return (ENETDOWN); } p = PARENT(ifv); - NET_EPOCH_EXIT(et); + NET_EPOCH_EXIT(); return p->if_output(ifp, m, dst, ro); } From owner-dev-commits-src-branches@freebsd.org Sun May 23 03:03:33 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 7A0D363E141; Sun, 23 May 2021 03:03:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnlXj2rNlz4fb1; Sun, 23 May 2021 03:03:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A77F7FDB; Sun, 23 May 2021 03:03:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14N33XQ8099661; Sun, 23 May 2021 03:03:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14N33X9f099660; Sun, 23 May 2021 03:03:33 GMT (envelope-from git) Date: Sun, 23 May 2021 03:03:33 GMT Message-Id: <202105230303.14N33X9f099660@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eugene Grosbein Subject: git: d6112f7dd874 - stable/12 - if_vlan.c: really fix it. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d6112f7dd8742a2a17292557352c12dff1aa24a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 03:03:33 -0000 The branch stable/12 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=d6112f7dd8742a2a17292557352c12dff1aa24a9 commit d6112f7dd8742a2a17292557352c12dff1aa24a9 Author: Eugene Grosbein AuthorDate: 2021-05-23 03:01:56 +0000 Commit: Eugene Grosbein CommitDate: 2021-05-23 03:01:56 +0000 if_vlan.c: really fix it. Sigh... Another direct commit to stable/12 to fix build. --- sys/net/if_vlan.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 1830c1cc441a..2f1b1dec9603 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1185,7 +1185,6 @@ static int vlan_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, struct route *ro) { - struct epoch_tracker et; struct ifvlan *ifv; struct ifnet *p; From owner-dev-commits-src-branches@freebsd.org Sun May 23 08:23:05 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 7DB96642571; Sun, 23 May 2021 08:23:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FntdP30p7z4SNw; Sun, 23 May 2021 08:23:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C74B1441A; Sun, 23 May 2021 08:23:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14N8N5gV023622; Sun, 23 May 2021 08:23:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14N8N5Gc023621; Sun, 23 May 2021 08:23:05 GMT (envelope-from git) Date: Sun, 23 May 2021 08:23:05 GMT Message-Id: <202105230823.14N8N5Gc023621@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Toomas Soome Subject: git: 3dc9f92a0d3d - stable/13 - loader: gfx_fb_drawrect should use GfxFbBltVideoFill MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3dc9f92a0d3dbe0d56201d8806cd9e93e4676cc4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 08:23:05 -0000 The branch stable/13 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=3dc9f92a0d3dbe0d56201d8806cd9e93e4676cc4 commit 3dc9f92a0d3dbe0d56201d8806cd9e93e4676cc4 Author: Toomas Soome AuthorDate: 2021-05-11 18:05:12 +0000 Commit: Toomas Soome CommitDate: 2021-05-23 00:46:51 +0000 loader: gfx_fb_drawrect should use GfxFbBltVideoFill The gfx_fb_drawrect() is drawing rectangle by pixels, this can be very slow on some systems. Use Blt() video fill primitive instead. Testing done: Tested on mac mini 2012 where the issue was revealed (cherry picked from commit 5365af662c78d7bded3bf83c7271d6bff17229a9) Reviewed by: yuripv --- stand/common/gfx_fb.c | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index 3eae0a3a859e..92af49913748 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -1357,16 +1357,12 @@ isqrt(int num) return (res); } -/* set pixel in framebuffer using gfx coordinates */ -void -gfx_fb_setpixel(uint32_t x, uint32_t y) +static uint32_t +gfx_fb_getcolor(void) { uint32_t c; const teken_attr_t *ap; - if (gfx_state.tg_fb_type == FB_TEXT) - return; - ap = teken_get_curattr(&gfx_state.tg_teken); if (ap->ta_format & TF_REVERSE) { c = ap->ta_bgcolor; @@ -1378,7 +1374,19 @@ gfx_fb_setpixel(uint32_t x, uint32_t y) c |= TC_LIGHT; } - c = gfx_fb_color_map(c); + return (gfx_fb_color_map(c)); +} + +/* set pixel in framebuffer using gfx coordinates */ +void +gfx_fb_setpixel(uint32_t x, uint32_t y) +{ + uint32_t c; + + if (gfx_state.tg_fb_type == FB_TEXT) + return; + + c = gfx_fb_getcolor(); if (x >= gfx_state.tg_fb.fb_width || y >= gfx_state.tg_fb.fb_height) @@ -1389,25 +1397,26 @@ gfx_fb_setpixel(uint32_t x, uint32_t y) /* * draw rectangle in framebuffer using gfx coordinates. - * The function is borrowed from vt_fb.c */ void gfx_fb_drawrect(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t fill) { - uint32_t x, y; + uint32_t c; if (gfx_state.tg_fb_type == FB_TEXT) return; - for (y = y1; y <= y2; y++) { - if (fill || (y == y1) || (y == y2)) { - for (x = x1; x <= x2; x++) - gfx_fb_setpixel(x, y); - } else { - gfx_fb_setpixel(x1, y); - gfx_fb_setpixel(x2, y); - } + c = gfx_fb_getcolor(); + + if (fill != 0) { + gfxfb_blt(&c, GfxFbBltVideoFill, 0, 0, x1, y1, x2 - x1, + y2 - y1, 0); + } else { + gfxfb_blt(&c, GfxFbBltVideoFill, 0, 0, x1, y1, x2 - x1, 1, 0); + gfxfb_blt(&c, GfxFbBltVideoFill, 0, 0, x1, y2, x2 - x1, 1, 0); + gfxfb_blt(&c, GfxFbBltVideoFill, 0, 0, x1, y1, 1, y2 - y1, 0); + gfxfb_blt(&c, GfxFbBltVideoFill, 0, 0, x2, y1, 1, y2 - y1, 0); } } From owner-dev-commits-src-branches@freebsd.org Sun May 23 12:56:40 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 670DB64791E; Sun, 23 May 2021 12:56:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fp0j347yHz3s05; Sun, 23 May 2021 12:56:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A9AE17ABC; Sun, 23 May 2021 12:56:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14NCubc4084070; Sun, 23 May 2021 12:56:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NCubWY084069; Sun, 23 May 2021 12:56:37 GMT (envelope-from git) Date: Sun, 23 May 2021 12:56:37 GMT Message-Id: <202105231256.14NCubWY084069@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: fa670efa25ad - stable/13 - netgraph/ng_checksum: Fix double free error MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fa670efa25ad960e17a6a9cb4601e5c3f19de5da Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 12:56:41 -0000 The branch stable/13 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=fa670efa25ad960e17a6a9cb4601e5c3f19de5da commit fa670efa25ad960e17a6a9cb4601e5c3f19de5da Author: Lutz Donnerhacke AuthorDate: 2021-05-15 09:32:57 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-23 12:55:20 +0000 netgraph/ng_checksum: Fix double free error m_pullup(9) frees the mbuf(9) chain in the case of an allocation error. The mbuf chain must not be freed again in this case. PR: 255874 Submitted by: Approved by: markj Differential Revision: https://reviews.freebsd.org/D30273 (cherry picked from commit 687e510e5ce32fddf46a9dc1d517ccc8a8e25581) --- sys/netgraph/ng_checksum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netgraph/ng_checksum.c b/sys/netgraph/ng_checksum.c index 682375c805da..3b542bd86acc 100644 --- a/sys/netgraph/ng_checksum.c +++ b/sys/netgraph/ng_checksum.c @@ -682,9 +682,9 @@ bypass: return (error); done: + NG_FREE_M(m); drop: NG_FREE_ITEM(item); - NG_FREE_M(m); priv->stats.dropped++; From owner-dev-commits-src-branches@freebsd.org Sun May 23 12:59:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 0E82A647A21; Sun, 23 May 2021 12:59:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fp0md70Mzz3tYG; Sun, 23 May 2021 12:59:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADF8617BBA; Sun, 23 May 2021 12:59:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14NCxjRP084570; Sun, 23 May 2021 12:59:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NCxj4g084569; Sun, 23 May 2021 12:59:45 GMT (envelope-from git) Date: Sun, 23 May 2021 12:59:45 GMT Message-Id: <202105231259.14NCxj4g084569@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 76b96a4ec7fa - stable/12 - netgraph/ng_checksum: Fix double free error MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 76b96a4ec7fa8cffbfe8e876d622fd4e69f25267 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 12:59:47 -0000 The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=76b96a4ec7fa8cffbfe8e876d622fd4e69f25267 commit 76b96a4ec7fa8cffbfe8e876d622fd4e69f25267 Author: Lutz Donnerhacke AuthorDate: 2021-05-15 09:32:57 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-23 12:59:28 +0000 netgraph/ng_checksum: Fix double free error m_pullup(9) frees the mbuf(9) chain in the case of an allocation error. The mbuf chain must not be freed again in this case. PR: 255874 Submitted by: Approved by: markj Differential Revision: https://reviews.freebsd.org/D30273 (cherry picked from commit 687e510e5ce32fddf46a9dc1d517ccc8a8e25581) --- sys/netgraph/ng_checksum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netgraph/ng_checksum.c b/sys/netgraph/ng_checksum.c index c7fecb0ab78d..0100b7ef3260 100644 --- a/sys/netgraph/ng_checksum.c +++ b/sys/netgraph/ng_checksum.c @@ -683,9 +683,9 @@ bypass: return (error); done: + NG_FREE_M(m); drop: NG_FREE_ITEM(item); - NG_FREE_M(m); priv->stats.dropped++; From owner-dev-commits-src-branches@freebsd.org Sun May 23 13:02:08 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 157F6647875; Sun, 23 May 2021 13:02:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fp0qL5bkPz3vnk; Sun, 23 May 2021 13:02:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9C5F17AD9; Sun, 23 May 2021 13:02:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14ND25H4097384; Sun, 23 May 2021 13:02:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14ND25hH097383; Sun, 23 May 2021 13:02:05 GMT (envelope-from git) Date: Sun, 23 May 2021 13:02:05 GMT Message-Id: <202105231302.14ND25hH097383@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 6bc3535519f7 - stable/11 - netgraph/ng_checksum: Fix double free error MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 6bc3535519f7206f844c3ffd0ee282e8875dceb4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 13:02:08 -0000 The branch stable/11 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=6bc3535519f7206f844c3ffd0ee282e8875dceb4 commit 6bc3535519f7206f844c3ffd0ee282e8875dceb4 Author: Lutz Donnerhacke AuthorDate: 2021-05-15 09:32:57 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-23 13:01:34 +0000 netgraph/ng_checksum: Fix double free error m_pullup(9) frees the mbuf(9) chain in the case of an allocation error. The mbuf chain must not be freed again in this case. PR: 255874 Submitted by: Approved by: markj Differential Revision: https://reviews.freebsd.org/D30273 (cherry picked from commit 687e510e5ce32fddf46a9dc1d517ccc8a8e25581) --- sys/netgraph/ng_checksum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netgraph/ng_checksum.c b/sys/netgraph/ng_checksum.c index c7fecb0ab78d..0100b7ef3260 100644 --- a/sys/netgraph/ng_checksum.c +++ b/sys/netgraph/ng_checksum.c @@ -683,9 +683,9 @@ bypass: return (error); done: + NG_FREE_M(m); drop: NG_FREE_ITEM(item); - NG_FREE_M(m); priv->stats.dropped++; From owner-dev-commits-src-branches@freebsd.org Sun May 23 13:32:23 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 A39016486AA; Sun, 23 May 2021 13:32:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fp1VH25RJz4gD8; Sun, 23 May 2021 13:32:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F67D17FDE; Sun, 23 May 2021 13:32:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14NDWNI4036714; Sun, 23 May 2021 13:32:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NDWN2H036698; Sun, 23 May 2021 13:32:23 GMT (envelope-from git) Date: Sun, 23 May 2021 13:32:23 GMT Message-Id: <202105231332.14NDWN2H036698@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Juraj Lutter Subject: git: e7cd56cfe037 - stable/13 - rpi_ft5406: Recognize raspberrypi, firmware-ts touchscreen MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: otis X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e7cd56cfe03720b5c0e8596303f6d1672a402903 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 13:32:23 -0000 The branch stable/13 has been updated by otis (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e7cd56cfe03720b5c0e8596303f6d1672a402903 commit e7cd56cfe03720b5c0e8596303f6d1672a402903 Author: Juraj Lutter AuthorDate: 2021-05-07 21:48:21 +0000 Commit: Juraj Lutter CommitDate: 2021-05-23 13:31:22 +0000 rpi_ft5406: Recognize raspberrypi,firmware-ts touchscreen - Recognize raspberrypi,firmware-ts touchscreen - Move the driver from ofwbus to simplebus Reviewed by: manu MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30169 (cherry picked from commit c2c9ef3cedf6d83bdf27308e9e022658cc9b2a08) --- sys/arm/broadcom/bcm2835/bcm2835_ft5406.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c b/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c index d9a01b4a929a..24396b1bd90b 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c @@ -270,7 +270,7 @@ static int ft5406ts_probe(device_t dev) { - if (!ofw_bus_is_compatible(dev, "rpi,rpi-ft5406")) + if (!ofw_bus_is_compatible(dev, "raspberrypi,firmware-ts")) return (ENXIO); device_set_desc(dev, "FT5406 touchscreen (VC memory interface)"); @@ -332,5 +332,5 @@ static driver_t ft5406ts_driver = { sizeof(struct ft5406ts_softc), }; -DRIVER_MODULE(ft5406ts, ofwbus, ft5406ts_driver, ft5406ts_devclass, 0, 0); +DRIVER_MODULE(ft5406ts, simplebus, ft5406ts_driver, ft5406ts_devclass, 0, 0); MODULE_DEPEND(ft5406ts, evdev, 1, 1, 1); From owner-dev-commits-src-branches@freebsd.org Sun May 23 13:35:15 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 D9F6A64833E; Sun, 23 May 2021 13:35:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fp1Yb5pltz4h93; Sun, 23 May 2021 13:35:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEE6B181E0; Sun, 23 May 2021 13:35:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14NDZFUL039241; Sun, 23 May 2021 13:35:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NDZFnq039240; Sun, 23 May 2021 13:35:15 GMT (envelope-from git) Date: Sun, 23 May 2021 13:35:15 GMT Message-Id: <202105231335.14NDZFnq039240@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Juraj Lutter Subject: git: 0f12b394faa1 - stable/12 - rpi_ft5406: Recognize raspberrypi, firmware-ts touchscreen MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: otis X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0f12b394faa1f5b4039c96151f95c98034ce6cc1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 13:35:15 -0000 The branch stable/12 has been updated by otis (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=0f12b394faa1f5b4039c96151f95c98034ce6cc1 commit 0f12b394faa1f5b4039c96151f95c98034ce6cc1 Author: Juraj Lutter AuthorDate: 2021-05-07 21:48:21 +0000 Commit: Juraj Lutter CommitDate: 2021-05-23 13:34:55 +0000 rpi_ft5406: Recognize raspberrypi,firmware-ts touchscreen - Recognize raspberrypi,firmware-ts touchscreen - Move the driver from ofwbus to simplebus Reviewed by: manu MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30169 (cherry picked from commit c2c9ef3cedf6d83bdf27308e9e022658cc9b2a08) (cherry picked from commit e7cd56cfe03720b5c0e8596303f6d1672a402903) --- sys/arm/broadcom/bcm2835/bcm2835_ft5406.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c b/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c index 48fa702f5c46..4cc0c87b194b 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c @@ -270,7 +270,7 @@ static int ft5406ts_probe(device_t dev) { - if (!ofw_bus_is_compatible(dev, "rpi,rpi-ft5406")) + if (!ofw_bus_is_compatible(dev, "raspberrypi,firmware-ts")) return (ENXIO); device_set_desc(dev, "FT5406 touchscreen (VC memory interface)"); @@ -332,5 +332,5 @@ static driver_t ft5406ts_driver = { sizeof(struct ft5406ts_softc), }; -DRIVER_MODULE(ft5406ts, ofwbus, ft5406ts_driver, ft5406ts_devclass, 0, 0); +DRIVER_MODULE(ft5406ts, simplebus, ft5406ts_driver, ft5406ts_devclass, 0, 0); MODULE_DEPEND(ft5406ts, evdev, 1, 1, 1); From owner-dev-commits-src-branches@freebsd.org Sun May 23 13:40:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 75E0D648367; Sun, 23 May 2021 13:40:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fp1h21X9Dz4kWc; Sun, 23 May 2021 13:40:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0700717FE4; Sun, 23 May 2021 13:40:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14NDenAg048085; Sun, 23 May 2021 13:40:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NDenpf048084; Sun, 23 May 2021 13:40:49 GMT (envelope-from git) Date: Sun, 23 May 2021 13:40:49 GMT Message-Id: <202105231340.14NDenpf048084@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Juraj Lutter Subject: git: 7e863cb9893b - stable/11 - newsyslog(8): Implement a new 'E' flag to not rotate empty log files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: otis X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 7e863cb9893b96f4ca6e0597572e3df218dd3830 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 13:40:50 -0000 The branch stable/11 has been updated by otis (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=7e863cb9893b96f4ca6e0597572e3df218dd3830 commit 7e863cb9893b96f4ca6e0597572e3df218dd3830 Author: Juraj Lutter AuthorDate: 2021-02-28 22:07:14 +0000 Commit: Juraj Lutter CommitDate: 2021-05-23 13:35:51 +0000 newsyslog(8): Implement a new 'E' flag to not rotate empty log files Based on an idea from dvl's coworker, László DANIELISZ, implement a new flag, 'E', that prevents newsyslog(8) from rotating the empty log files. This 'E' flag ist mostly usable in conjunction with 'B' flag that instructs newsyslog(8) to not insert an informational message into the log file after rotation, keeping it still empty. Reviewed by: markj, ian, manpages (rpokala) Approved by: markj, ian, manpages (rpokala) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28940 (cherry picked from commit c7d27b225df8d7fb36a31a21737d4309593c4604) --- usr.sbin/newsyslog/newsyslog.c | 11 ++++++++++- usr.sbin/newsyslog/newsyslog.conf.5 | 14 +++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c index d850b0af9f53..c20a36cf31c0 100644 --- a/usr.sbin/newsyslog/newsyslog.c +++ b/usr.sbin/newsyslog/newsyslog.c @@ -129,7 +129,8 @@ __FBSDID("$FreeBSD$"); #define CE_PID2CMD 0x0400 /* Replace PID file with a shell command.*/ #define CE_PLAIN0 0x0800 /* Do not compress zero'th history file */ #define CE_RFC5424 0x1000 /* Use RFC5424 format rotation message */ - +#define CE_NOEMPTY 0x2000 /* Do not rotate the file when its size */ + /* is zero */ #define MIN_PID 5 /* Don't touch pids lower than this */ #define MAX_PID 99999 /* was lower, see /usr/include/sys/proc.h */ @@ -538,6 +539,11 @@ do_entry(struct conf_entry * ent) printf("does not exist, skipped%s.\n", temp_reason); } } else { + if (ent->flags & CE_NOEMPTY && ent->fsize == 0) { + if (verbose) + printf("--> Not rotating empty file\n"); + return (free_or_keep); + } if (ent->flags & CE_TRIMAT && !force && !rotatereq && !oversized) { diffsecs = ptimeget_diff(timenow, ent->trim_at); @@ -1292,6 +1298,9 @@ no_trimat: case 'd': working->flags |= CE_NODUMP; break; + case 'e': + working->flags |= CE_NOEMPTY; + break; case 'g': working->flags |= CE_GLOB; break; diff --git a/usr.sbin/newsyslog/newsyslog.conf.5 b/usr.sbin/newsyslog/newsyslog.conf.5 index e307375c766e..ec21cfdaca2a 100644 --- a/usr.sbin/newsyslog/newsyslog.conf.5 +++ b/usr.sbin/newsyslog/newsyslog.conf.5 @@ -21,7 +21,7 @@ .\" the suitability of this software for any purpose. It is .\" provided "as is" without express or implied warranty. .\" -.Dd January 15, 2018 +.Dd February 26, 2021 .Dt NEWSYSLOG.CONF 5 .Os .Sh NAME @@ -281,6 +281,18 @@ this log file. This option would affect how the .Xr dump 8 command treats the log file when making a file system backup. +.It Cm E +indicates that the log file should not be rotated when its +size is zero. +The +.Cm E +flag is mostly useful in conjunction with +.Cm B +flag to prevent +.Xr newsyslog 8 +from inserting an informational +.Tn ASCII +message into the new file. .It Cm G indicates that the specified .Ar logfile_name From owner-dev-commits-src-branches@freebsd.org Sun May 23 13:40:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 6A71F6483FB; Sun, 23 May 2021 13:40:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fp1h31ynJz4kWg; Sun, 23 May 2021 13:40:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29E72184A8; Sun, 23 May 2021 13:40:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14NDepxH048113; Sun, 23 May 2021 13:40:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NDepGD048112; Sun, 23 May 2021 13:40:51 GMT (envelope-from git) Date: Sun, 23 May 2021 13:40:51 GMT Message-Id: <202105231340.14NDepGD048112@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Juraj Lutter Subject: git: c988a558fafe - stable/11 - rpi_ft5406: Recognize raspberrypi, firmware-ts touchscreen MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: otis X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: c988a558fafe7a361e448c26254d4832ec3fd1ff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 13:40:51 -0000 The branch stable/11 has been updated by otis (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c988a558fafe7a361e448c26254d4832ec3fd1ff commit c988a558fafe7a361e448c26254d4832ec3fd1ff Author: Juraj Lutter AuthorDate: 2021-05-07 21:48:21 +0000 Commit: Juraj Lutter CommitDate: 2021-05-23 13:40:24 +0000 rpi_ft5406: Recognize raspberrypi,firmware-ts touchscreen - Recognize raspberrypi,firmware-ts touchscreen - Move the driver from ofwbus to simplebus Reviewed by: manu MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30169 (cherry picked from commit c2c9ef3cedf6d83bdf27308e9e022658cc9b2a08) --- sys/arm/broadcom/bcm2835/bcm2835_ft5406.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c b/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c index 86432cfca4ad..cfec565a8130 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c @@ -269,7 +269,7 @@ static int ft5406ts_probe(device_t dev) { - if (!ofw_bus_is_compatible(dev, "rpi,rpi-ft5406")) + if (!ofw_bus_is_compatible(dev, "raspberrypi,firmware-ts")) return (ENXIO); device_set_desc(dev, "FT5406 touchscreen (VC memory interface)"); @@ -331,5 +331,5 @@ static driver_t ft5406ts_driver = { sizeof(struct ft5406ts_softc), }; -DRIVER_MODULE(ft5406ts, ofwbus, ft5406ts_driver, ft5406ts_devclass, 0, 0); +DRIVER_MODULE(ft5406ts, simplebus, ft5406ts_driver, ft5406ts_devclass, 0, 0); MODULE_DEPEND(ft5406ts, evdev, 1, 1, 1); From owner-dev-commits-src-branches@freebsd.org Sun May 23 16:50:38 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 014E664B6CE; Sun, 23 May 2021 16:50:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fp5v16XxRz3lQG; Sun, 23 May 2021 16:50:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9C2A1A940; Sun, 23 May 2021 16:50:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14NGobmm098484; Sun, 23 May 2021 16:50:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NGoboL098483; Sun, 23 May 2021 16:50:37 GMT (envelope-from git) Date: Sun, 23 May 2021 16:50:37 GMT Message-Id: <202105231650.14NGoboL098483@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 22d340828e06 - stable/12 - linux: Fix SMAP-enabled futex routines MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 22d340828e06818fb47e6034aadbd52a01795793 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 16:50:38 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=22d340828e06818fb47e6034aadbd52a01795793 commit 22d340828e06818fb47e6034aadbd52a01795793 Author: Mark Johnston AuthorDate: 2021-05-16 17:41:41 +0000 Commit: Mark Johnston CommitDate: 2021-05-23 16:44:06 +0000 linux: Fix SMAP-enabled futex routines Some of them were dereferencing the user pointer before disabling SMAP. PR: 255591 Reviewed by: kib Tested by: pitwuu@gmail.com Sponsored by: The FreeBSD Foundation (cherry picked from commit fb580451456aa769daa2f4b2f077e39692f80c62) --- sys/amd64/linux/linux_support.s | 12 ++++++------ sys/amd64/linux32/linux32_support.s | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/amd64/linux/linux_support.s b/sys/amd64/linux/linux_support.s index 391f76414f22..45eb565f667d 100644 --- a/sys/amd64/linux/linux_support.s +++ b/sys/amd64/linux/linux_support.s @@ -126,16 +126,16 @@ ENTRY(futex_orl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx orl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) @@ -168,16 +168,16 @@ ENTRY(futex_andl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx andl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) @@ -210,16 +210,16 @@ ENTRY(futex_xorl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx xorl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) diff --git a/sys/amd64/linux32/linux32_support.s b/sys/amd64/linux32/linux32_support.s index 981bba9f5821..f3ec3bd8c776 100644 --- a/sys/amd64/linux32/linux32_support.s +++ b/sys/amd64/linux32/linux32_support.s @@ -126,16 +126,16 @@ ENTRY(futex_orl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx orl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) @@ -169,15 +169,15 @@ ENTRY(futex_andl_smap) cmpq %rax,%rsi ja futex_fault movl (%rsi),%eax + stac 1: movl %eax,%ecx andl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) @@ -210,16 +210,16 @@ ENTRY(futex_xorl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx xorl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) From owner-dev-commits-src-branches@freebsd.org Sun May 23 16:50:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 79BF164B5F6; Sun, 23 May 2021 16:50:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fp5v90YYzz3lW2; Sun, 23 May 2021 16:50:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B303B1AB4E; Sun, 23 May 2021 16:50:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14NGoifR002536; Sun, 23 May 2021 16:50:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NGoijJ002535; Sun, 23 May 2021 16:50:44 GMT (envelope-from git) Date: Sun, 23 May 2021 16:50:44 GMT Message-Id: <202105231650.14NGoijJ002535@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 14cc1326579b - stable/13 - linux: Fix SMAP-enabled futex routines MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 14cc1326579b24c5eb743a62874fc768d0ca0ab5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 16:50:45 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=14cc1326579b24c5eb743a62874fc768d0ca0ab5 commit 14cc1326579b24c5eb743a62874fc768d0ca0ab5 Author: Mark Johnston AuthorDate: 2021-05-16 17:41:41 +0000 Commit: Mark Johnston CommitDate: 2021-05-23 16:43:43 +0000 linux: Fix SMAP-enabled futex routines Some of them were dereferencing the user pointer before disabling SMAP. PR: 255591 Reviewed by: kib Tested by: pitwuu@gmail.com Sponsored by: The FreeBSD Foundation (cherry picked from commit fb580451456aa769daa2f4b2f077e39692f80c62) --- sys/amd64/linux/linux_support.s | 12 ++++++------ sys/amd64/linux32/linux32_support.s | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/amd64/linux/linux_support.s b/sys/amd64/linux/linux_support.s index 391f76414f22..45eb565f667d 100644 --- a/sys/amd64/linux/linux_support.s +++ b/sys/amd64/linux/linux_support.s @@ -126,16 +126,16 @@ ENTRY(futex_orl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx orl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) @@ -168,16 +168,16 @@ ENTRY(futex_andl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx andl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) @@ -210,16 +210,16 @@ ENTRY(futex_xorl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx xorl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) diff --git a/sys/amd64/linux32/linux32_support.s b/sys/amd64/linux32/linux32_support.s index 981bba9f5821..f3ec3bd8c776 100644 --- a/sys/amd64/linux32/linux32_support.s +++ b/sys/amd64/linux32/linux32_support.s @@ -126,16 +126,16 @@ ENTRY(futex_orl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx orl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) @@ -169,15 +169,15 @@ ENTRY(futex_andl_smap) cmpq %rax,%rsi ja futex_fault movl (%rsi),%eax + stac 1: movl %eax,%ecx andl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) @@ -210,16 +210,16 @@ ENTRY(futex_xorl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx xorl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) From owner-dev-commits-src-branches@freebsd.org Sun May 23 22:46:38 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 B5E63651330; Sun, 23 May 2021 22:46:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FpFnp4kYpz3mrR; Sun, 23 May 2021 22:46:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A7981F27C; Sun, 23 May 2021 22:46:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14NMkcVO068480; Sun, 23 May 2021 22:46:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NMkcj8068479; Sun, 23 May 2021 22:46:38 GMT (envelope-from git) Date: Sun, 23 May 2021 22:46:38 GMT Message-Id: <202105232246.14NMkcj8068479@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 0be693b3d5f1 - stable/13 - iwmbtfw(8): Add support for Intel 7260/7265 bluetooth adapter firmwares MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0be693b3d5f1bda593a96ba3fcd5a31538b35781 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 22:46:38 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=0be693b3d5f1bda593a96ba3fcd5a31538b35781 commit 0be693b3d5f1bda593a96ba3fcd5a31538b35781 Author: Philippe Michaud-Boudreault AuthorDate: 2021-05-04 23:48:21 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-05-23 22:44:36 +0000 iwmbtfw(8): Add support for Intel 7260/7265 bluetooth adapter firmwares To use it comms/iwmbt-firmware port should be updated to 20210315 version. Submitted by: Philippe Michaud-Boudreault Tested by: Helge Oldach Reviewed by: wulf PR: 228787 --- usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c | 14 ++ usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c | 189 +++++++++++++++++++++++- usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.h | 5 + usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8 | 10 +- usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf | 2 +- usr.sbin/bluetooth/iwmbtfw/main.c | 253 +++++++++++++++++++++++--------- 6 files changed, 401 insertions(+), 72 deletions(-) diff --git a/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c b/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c index 7764f8bc4ac3..fc93ce094adc 100644 --- a/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c +++ b/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c @@ -119,6 +119,20 @@ iwmbt_get_fwname(struct iwmbt_version *ver, struct iwmbt_boot_params *params, char *fwname; switch (ver->hw_variant) { + case 0x07: /* 7260 */ + asprintf(&fwname, "%s/ibt-hw-%x.%x.%x-fw-%x.%x.%x.%x.%x.%s", + prefix, + le16toh(ver->hw_platform), + le16toh(ver->hw_variant), + le16toh(ver->hw_revision), + le16toh(ver->fw_variant), + le16toh(ver->fw_revision), + le16toh(ver->fw_build_num), + le16toh(ver->fw_build_ww), + le16toh(ver->fw_build_yy), + suffix); + break; + case 0x0b: /* 8260 */ case 0x0c: /* 8265 */ asprintf(&fwname, "%s/ibt-%u-%u.%s", diff --git a/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c b/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c index af48e038340f..f4272548d560 100644 --- a/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c +++ b/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c @@ -27,7 +27,7 @@ * $FreeBSD$ */ -#include +#include #include #include @@ -126,6 +126,125 @@ iwmbt_hci_command(struct libusb_device_handle *hdl, struct iwmbt_hci_cmd *cmd, return (ret); } +int +iwmbt_patch_fwfile(struct libusb_device_handle *hdl, + const struct iwmbt_firmware *fw) +{ + int ret, transferred; + struct iwmbt_firmware fw_job = *fw; + uint16_t cmd_opcode; + uint8_t cmd_length; + uint8_t cmd_buf[IWMBT_HCI_MAX_CMD_SIZE]; + uint8_t evt_code; + uint8_t evt_length; + uint8_t evt_buf[IWMBT_HCI_MAX_EVENT_SIZE]; + int skip_patch = 0; + + for (;;) { + skip_patch = 0; + + if (fw_job.len < 4) + break; + + if (fw_job.buf[0] != 0x01) { + iwmbt_err("Invalid firmware, expected HCI command (%d)", + fw_job.buf[0]); + return (-1); + } + + /* Advance by one. */ + fw_job.buf++; + fw_job.len--; + + /* Load in the HCI command to perform. */ + cmd_opcode = le16dec(fw_job.buf); + cmd_length = fw_job.buf[2]; + memcpy(cmd_buf, fw_job.buf, 3); + + iwmbt_debug("opcode=%04x, len=%02x", cmd_opcode, cmd_length); + + /* For some reason the command 0xfc2f hangs up my card. */ + if (cmd_opcode == 0xfc2f) + skip_patch = 1; + + /* Advance by three. */ + fw_job.buf += 3; + fw_job.len -= 3; + + if (fw_job.len < cmd_length) + cmd_length = fw_job.len; + + /* Copy data to HCI command buffer. */ + memcpy(cmd_buf + 3, fw_job.buf, + MIN(cmd_length, IWMBT_HCI_MAX_CMD_SIZE - 3)); + + /* Advance by data length. */ + fw_job.buf += cmd_length; + fw_job.len -= cmd_length; + + /* + * Every command has its associated event: data must match + * what is recorded in the firmware file. Perform that check + * now. + * + * Some commands are mapped to more than one event sequence, + * in that case we can drop the non-patch commands, as we + * probably don't need them for operation of the card. + * + */ + + for (;;) { + /* Is this the end of the file? */ + if (fw_job.len < 3) + break; + + if (fw_job.buf[0] != 0x02) + break; + + /* Advance by one. */ + fw_job.buf++; + fw_job.len--; + + /* Load in the HCI event. */ + evt_code = fw_job.buf[0]; + evt_length = fw_job.buf[1]; + + /* Advance by two. */ + fw_job.buf += 2; + fw_job.len -= 2; + + /* Prepare HCI event buffer. */ + memset(evt_buf, 0, IWMBT_HCI_MAX_EVENT_SIZE); + + iwmbt_debug("event=%04x, len=%02x", + evt_code, evt_length); + + /* Advance by data length. */ + fw_job.buf += evt_length; + fw_job.len -= evt_length; + + if (skip_patch == 0) { + ret = iwmbt_hci_command(hdl, + (struct iwmbt_hci_cmd *)cmd_buf, + evt_buf, + IWMBT_HCI_MAX_EVENT_SIZE, + &transferred, + IWMBT_HCI_CMD_TIMEOUT); + + if (ret < 0) { + iwmbt_debug("Can't send patch: " + "code=%d, size=%d", + ret, + transferred); + return (-1); + } + } + } + } + + return (0); +} + int iwmbt_load_fwfile(struct libusb_device_handle *hdl, const struct iwmbt_firmware *fw, uint32_t *boot_param) @@ -217,6 +336,74 @@ iwmbt_load_fwfile(struct libusb_device_handle *hdl, return (0); } +int +iwmbt_enter_manufacturer(struct libusb_device_handle *hdl) +{ + int ret, transferred; + static struct iwmbt_hci_cmd cmd = { + .opcode = htole16(0xfc11), + .length = 2, + .data = { 0x01, 0x00 }, + }; + uint8_t buf[IWMBT_HCI_MAX_EVENT_SIZE]; + + ret = iwmbt_hci_command(hdl, + &cmd, + buf, + sizeof(buf), + &transferred, + IWMBT_HCI_CMD_TIMEOUT); + + if (ret < 0) { + iwmbt_debug("Can't enter manufacturer mode: code=%d, size=%d", + ret, + transferred); + return (-1); + } + + return (0); +} + +int +iwmbt_exit_manufacturer(struct libusb_device_handle *hdl, int mode) +{ + int ret, transferred; + static struct iwmbt_hci_cmd cmd = { + .opcode = htole16(0xfc11), + .length = 2, + .data = { 0x00, 0x00 }, + }; + uint8_t buf[IWMBT_HCI_MAX_EVENT_SIZE]; + + /* + * The mode sets the type of reset we want to perform: + * 0x00: simply exit manufacturer mode without a reset. + * 0x01: exit manufacturer mode with a reset and patches disabled + * 0x02: exit manufacturer mode with a reset and patches enabled + */ + if (mode > 2) { + iwmbt_debug("iwmbt_exit_manufacturer(): unknown mode (%d)", + mode); + } + cmd.data[1] = mode; + + ret = iwmbt_hci_command(hdl, + &cmd, + buf, + sizeof(buf), + &transferred, + IWMBT_HCI_CMD_TIMEOUT); + + if (ret < 0) { + iwmbt_debug("Can't exit manufacturer mode: code=%d, size=%d", + ret, + transferred); + return (-1); + } + + return (0); +} + int iwmbt_get_version(struct libusb_device_handle *hdl, struct iwmbt_version *version) diff --git a/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.h b/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.h index 6a87f499fa26..5bc1d15181cd 100644 --- a/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.h +++ b/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.h @@ -73,8 +73,13 @@ struct iwmbt_hci_event_cmd_compl { #define IWMBT_HCI_CMD_TIMEOUT 2000 /* ms */ #define IWMBT_LOADCMPL_TIMEOUT 5000 /* ms */ +extern int iwmbt_patch_fwfile(struct libusb_device_handle *hdl, + const struct iwmbt_firmware *fw); extern int iwmbt_load_fwfile(struct libusb_device_handle *hdl, const struct iwmbt_firmware *fw, uint32_t *boot_param); +extern int iwmbt_enter_manufacturer(struct libusb_device_handle *hdl); +extern int iwmbt_exit_manufacturer(struct libusb_device_handle *hdl, + int mode); extern int iwmbt_get_version(struct libusb_device_handle *hdl, struct iwmbt_version *version); extern int iwmbt_get_boot_params(struct libusb_device_handle *hdl, diff --git a/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8 b/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8 index 3afbf54793f9..10e68040e0e4 100644 --- a/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8 +++ b/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8 @@ -1,5 +1,6 @@ .\" Copyright (c) 2013, 2016 Adrian Chadd .\" Copyright (c) 2019 Vladimir Kondratyev +.\" Copyright (c) 2021 Philippe Michaud-Boudreault .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -24,12 +25,12 @@ .\" .\" $FreeBSD$ .\" -.Dd June 4, 2019 +.Dd May 3, 2021 .Dt IWMBTFW 8 .Os .Sh NAME .Nm iwmbtfw -.Nd firmware download utility for Intel Wireless 8260/8265 chip based Bluetooth +.Nd firmware download utility for Intel Wireless 7260/8260/8265 chip based Bluetooth USB devices .Sh SYNOPSIS .Nm @@ -46,7 +47,7 @@ device. .Pp This utility will .Em only -work with Intel Wireless 8260/8265 chip based Bluetooth USB devices and some of +work with Intel Wireless 7260/8260/8265 chip based Bluetooth USB devices and some of their successors. The identification is currently based on USB vendor ID/product ID pair. The vendor ID should be 0x8087 @@ -91,6 +92,9 @@ utility used as firmware downloader template and on Linux btintel driver source code. It is written by .An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . +.Pp +Support for the 7260 card added by +.An Philippe Michaud-Boudreault Aq Mt pitwuu@gmail.com . .Sh BUGS Most likely. Please report if found. diff --git a/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf b/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf index 4bd1f020237c..6b417089c68b 100644 --- a/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf +++ b/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf @@ -7,6 +7,6 @@ notify 100 { match "subsystem" "DEVICE"; match "type" "ATTACH"; match "vendor" "0x8087"; - match "product" "(0x0a2b|0x0aaa|0x0025|0x0026|0x0029)"; + match "product" "(0x07dc|0x0a2a|0x0aa7|0x0a2b|0x0aaa|0x0025|0x0026|0x0029)"; action "/usr/sbin/iwmbtfw -d $cdev -f /usr/local/share/iwmbt-firmware"; }; diff --git a/usr.sbin/bluetooth/iwmbtfw/main.c b/usr.sbin/bluetooth/iwmbtfw/main.c index ecd9d226b91f..3476e3fcd613 100644 --- a/usr.sbin/bluetooth/iwmbtfw/main.c +++ b/usr.sbin/bluetooth/iwmbtfw/main.c @@ -57,7 +57,15 @@ struct iwmbt_devid { uint16_t vendor_id; }; -static struct iwmbt_devid iwmbt_list[] = { +static struct iwmbt_devid iwmbt_list_72xx[] = { + + /* Intel Wireless 7260/7265 and successors */ + { .vendor_id = 0x8087, .product_id = 0x07dc }, + { .vendor_id = 0x8087, .product_id = 0x0a2a }, + { .vendor_id = 0x8087, .product_id = 0x0aa7 }, +}; + +static struct iwmbt_devid iwmbt_list_82xx[] = { /* Intel Wireless 8260/8265 and successors */ { .vendor_id = 0x8087, .product_id = 0x0a2b }, @@ -67,15 +75,33 @@ static struct iwmbt_devid iwmbt_list[] = { { .vendor_id = 0x8087, .product_id = 0x0029 }, }; +static int +iwmbt_is_7260(struct libusb_device_descriptor *d) +{ + int i; + + /* Search looking for whether it's an 7260/7265 */ + for (i = 0; i < (int) nitems(iwmbt_list_72xx); i++) { + if ((iwmbt_list_72xx[i].product_id == d->idProduct) && + (iwmbt_list_72xx[i].vendor_id == d->idVendor)) { + iwmbt_info("found 7260/7265"); + return (1); + } + } + + /* Not found */ + return (0); +} + static int iwmbt_is_8260(struct libusb_device_descriptor *d) { int i; /* Search looking for whether it's an 8260/8265 */ - for (i = 0; i < (int) nitems(iwmbt_list); i++) { - if ((iwmbt_list[i].product_id == d->idProduct) && - (iwmbt_list[i].vendor_id == d->idVendor)) { + for (i = 0; i < (int) nitems(iwmbt_list_82xx); i++) { + if ((iwmbt_list_82xx[i].product_id == d->idProduct) && + (iwmbt_list_82xx[i].vendor_id == d->idVendor)) { iwmbt_info("found 8260/8265"); return (1); } @@ -86,7 +112,8 @@ iwmbt_is_8260(struct libusb_device_descriptor *d) } static libusb_device * -iwmbt_find_device(libusb_context *ctx, int bus_id, int dev_id) +iwmbt_find_device(libusb_context *ctx, int bus_id, int dev_id, + int *iwmbt_use_old_method) { libusb_device **list, *dev = NULL, *found = NULL; struct libusb_device_descriptor d; @@ -116,11 +143,20 @@ iwmbt_find_device(libusb_context *ctx, int bus_id, int dev_id) } /* Match on the vendor/product id */ + if (iwmbt_is_7260(&d)) { + /* + * Take a reference so it's not freed later on. + */ + found = libusb_ref_device(dev); + *iwmbt_use_old_method = 1; + break; + } else if (iwmbt_is_8260(&d)) { /* * Take a reference so it's not freed later on. */ found = libusb_ref_device(dev); + *iwmbt_use_old_method = 0; break; } } @@ -166,6 +202,31 @@ iwmbt_dump_boot_params(struct iwmbt_boot_params *params) params->otp_bdaddr[0]); } +static int +iwmbt_patch_firmware(libusb_device_handle *hdl, const char *firmware_path) +{ + struct iwmbt_firmware fw; + int ret; + + iwmbt_debug("loading %s", firmware_path); + + /* Read in the firmware */ + if (iwmbt_fw_read(&fw, firmware_path) <= 0) { + iwmbt_debug("iwmbt_fw_read() failed"); + return (-1); + } + + /* Load in the firmware */ + ret = iwmbt_patch_fwfile(hdl, &fw); + if (ret < 0) + iwmbt_debug("Loading firmware file failed"); + + /* free it */ + iwmbt_fw_free(&fw); + + return (ret); +} + static int iwmbt_init_firmware(libusb_device_handle *hdl, const char *firmware_path, uint32_t *boot_param) @@ -268,6 +329,7 @@ main(int argc, char *argv[]) char *firmware_dir = NULL; char *firmware_path = NULL; int retcode = 1; + int iwmbt_use_old_method = 0; /* Parse command line arguments */ while ((n = getopt(argc, argv, "Dd:f:hIm:p:v:")) != -1) { @@ -312,7 +374,7 @@ main(int argc, char *argv[]) iwmbt_debug("opening dev %d.%d", (int) bus_id, (int) dev_id); /* Find a device based on the bus/dev id */ - dev = iwmbt_find_device(ctx, bus_id, dev_id); + dev = iwmbt_find_device(ctx, bus_id, dev_id, &iwmbt_use_old_method); if (dev == NULL) { iwmbt_err("device not found"); goto shutdown; @@ -344,87 +406,144 @@ main(int argc, char *argv[]) /* Get Intel version */ r = iwmbt_get_version(hdl, &ver); if (r < 0) { - iwmbt_debug("iwmbt_get_version() failedL code %d", r); + iwmbt_debug("iwmbt_get_version() failed code %d", r); goto shutdown; } iwmbt_dump_version(&ver); iwmbt_debug("fw_variant=0x%02x", (int) ver.fw_variant); - /* fw_variant = 0x06 bootloader mode / 0x23 operational mode */ - if (ver.fw_variant == 0x23) { - iwmbt_info("Firmware has already been downloaded"); + if (iwmbt_use_old_method) { + + /* fw_patch_num = >0 operational mode */ + if (ver.fw_patch_num > 0x00) { + iwmbt_info("Firmware has already been downloaded"); + retcode = 0; + goto reset; + } + + /* Default the firmware path */ + if (firmware_dir == NULL) + firmware_dir = strdup(_DEFAULT_IWMBT_FIRMWARE_PATH); + + firmware_path = iwmbt_get_fwname(&ver, ¶ms, firmware_dir, "bseq"); + if (firmware_path == NULL) + goto shutdown; + + iwmbt_debug("firmware_path = %s", firmware_path); + + /* Enter manufacturer mode */ + r = iwmbt_enter_manufacturer(hdl); + if (r < 0) { + iwmbt_debug("iwmbt_enter_manufacturer() failed code %d", r); + goto shutdown; + } + + /* Download firmware and parse it for magic Intel Reset parameter */ + r = iwmbt_patch_firmware(hdl, firmware_path); + free(firmware_path); + if (r < 0) + goto shutdown; + + iwmbt_info("Firmware download complete"); + + /* Exit manufacturer mode */ + r = iwmbt_exit_manufacturer(hdl, 0x02); + if (r < 0) { + iwmbt_debug("iwmbt_exit_manufacturer() failed code %d", r); + goto shutdown; + } + + /* Once device is running in operational mode we can ignore failures */ retcode = 0; - goto reset; - } - if (ver.fw_variant != 0x06){ - iwmbt_err("unknown fw_variant 0x%02x", (int) ver.fw_variant); - goto shutdown; - } + /* Execute Read Intel Version one more time */ + r = iwmbt_get_version(hdl, &ver); + if (r == 0) + iwmbt_dump_version(&ver); - /* Read Intel Secure Boot Params */ - r = iwmbt_get_boot_params(hdl, ¶ms); - if (r < 0) { - iwmbt_debug("iwmbt_get_boot_params() failed!"); - goto shutdown; - } - iwmbt_dump_boot_params(¶ms); + /* Set Intel Event mask */ + r = iwmbt_set_event_mask(hdl); + if (r == 0) + iwmbt_info("Intel Event Mask is set"); - /* Check if firmware fragments are ACKed with a cmd complete event */ - if (params.limited_cce != 0x00) { - iwmbt_err("Unsupported Intel firmware loading method (%u)", - params.limited_cce); - goto shutdown; - } + } else { - /* Default the firmware path */ - if (firmware_dir == NULL) - firmware_dir = strdup(_DEFAULT_IWMBT_FIRMWARE_PATH); + /* fw_variant = 0x06 bootloader mode / 0x23 operational mode */ + if (ver.fw_variant == 0x23) { + iwmbt_info("Firmware has already been downloaded"); + retcode = 0; + goto reset; + } - firmware_path = iwmbt_get_fwname(&ver, ¶ms, firmware_dir, "sfi"); - if (firmware_path == NULL) - goto shutdown; + if (ver.fw_variant != 0x06){ + iwmbt_err("unknown fw_variant 0x%02x", (int) ver.fw_variant); + goto shutdown; + } - iwmbt_debug("firmware_path = %s", firmware_path); + /* Read Intel Secure Boot Params */ + r = iwmbt_get_boot_params(hdl, ¶ms); + if (r < 0) { + iwmbt_debug("iwmbt_get_boot_params() failed!"); + goto shutdown; + } + iwmbt_dump_boot_params(¶ms); - /* Download firmware and parse it for magic Intel Reset parameter */ - r = iwmbt_init_firmware(hdl, firmware_path, &boot_param); - free(firmware_path); - if (r < 0) - goto shutdown; + /* Check if firmware fragments are ACKed with a cmd complete event */ + if (params.limited_cce != 0x00) { + iwmbt_err("Unsupported Intel firmware loading method (%u)", + params.limited_cce); + goto shutdown; + } - iwmbt_info("Firmware download complete"); + /* Default the firmware path */ + if (firmware_dir == NULL) + firmware_dir = strdup(_DEFAULT_IWMBT_FIRMWARE_PATH); - r = iwmbt_intel_reset(hdl, boot_param); - if (r < 0) { - iwmbt_debug("iwmbt_intel_reset() failed!"); - goto shutdown; - } + firmware_path = iwmbt_get_fwname(&ver, ¶ms, firmware_dir, "sfi"); + if (firmware_path == NULL) + goto shutdown; - iwmbt_info("Firmware operational"); + iwmbt_debug("firmware_path = %s", firmware_path); - /* Once device is running in operational mode we can ignore failures */ - retcode = 0; + /* Download firmware and parse it for magic Intel Reset parameter */ + r = iwmbt_init_firmware(hdl, firmware_path, &boot_param); + free(firmware_path); + if (r < 0) + goto shutdown; - /* Execute Read Intel Version one more time */ - r = iwmbt_get_version(hdl, &ver); - if (r == 0) - iwmbt_dump_version(&ver); - - /* Apply the device configuration (DDC) parameters */ - firmware_path = iwmbt_get_fwname(&ver, ¶ms, firmware_dir, "ddc"); - iwmbt_debug("ddc_path = %s", firmware_path); - if (firmware_path != NULL) { - r = iwmbt_init_ddc(hdl, firmware_path); + iwmbt_info("Firmware download complete"); + + r = iwmbt_intel_reset(hdl, boot_param); + if (r < 0) { + iwmbt_debug("iwmbt_intel_reset() failed!"); + goto shutdown; + } + + iwmbt_info("Firmware operational"); + + /* Once device is running in operational mode we can ignore failures */ + retcode = 0; + + /* Execute Read Intel Version one more time */ + r = iwmbt_get_version(hdl, &ver); if (r == 0) - iwmbt_info("DDC download complete"); - free(firmware_path); - } + iwmbt_dump_version(&ver); + + /* Apply the device configuration (DDC) parameters */ + firmware_path = iwmbt_get_fwname(&ver, ¶ms, firmware_dir, "ddc"); + iwmbt_debug("ddc_path = %s", firmware_path); + if (firmware_path != NULL) { + r = iwmbt_init_ddc(hdl, firmware_path); + if (r == 0) + iwmbt_info("DDC download complete"); + free(firmware_path); + } - /* Set Intel Event mask */ - r = iwmbt_set_event_mask(hdl); - if (r == 0) - iwmbt_info("Intel Event Mask is set"); + /* Set Intel Event mask */ + r = iwmbt_set_event_mask(hdl); + if (r == 0) + iwmbt_info("Intel Event Mask is set"); + } reset: