From owner-dev-commits-src-all@freebsd.org Mon May 17 00:00:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E36396365C5; Mon, 17 May 2021 00:00: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 4Fjzm75qNVz4r3c; Mon, 17 May 2021 00:00: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 A582621E61; Mon, 17 May 2021 00:00: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 14H00NWD054354; Mon, 17 May 2021 00:00:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14H00NgY054353; Mon, 17 May 2021 00:00:23 GMT (envelope-from git) Date: Mon, 17 May 2021 00:00:23 GMT Message-Id: <202105170000.14H00NgY054353@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: 9a2fac6ba65f - main - Fix handling of embedded symbolic links (and history lesson). 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/main X-Git-Reftype: branch X-Git-Commit: 9a2fac6ba65fbd14d37ccedbc2aec27a190128ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 00:00:24 -0000 The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=9a2fac6ba65fbd14d37ccedbc2aec27a190128ea commit 9a2fac6ba65fbd14d37ccedbc2aec27a190128ea Author: Kirk McKusick AuthorDate: 2021-05-17 00:02:42 +0000 Commit: Kirk McKusick CommitDate: 2021-05-17 00:04:11 +0000 Fix handling of embedded symbolic links (and history lesson). The original filesystem release (4.2BSD) had no embedded sysmlinks. Historically symbolic links were just a different type of file, so the content of the symbolic link was contained in a single disk block fragment. We observed that most symbolic links were short enough that they could fit in the area of the inode that normally holds the block pointers. So we created embedded symlinks where the content of the link was held in the inode's pointer area thus avoiding the need to seek and read a data fragment and reducing the pressure on the block cache. At the time we had only UFS1 with 32-bit block pointers, so the test for a fastlink was: di_size < (NDADDR + NIADDR) * sizeof(daddr_t) (where daddr_t would be ufs1_daddr_t today). When embedded symlinks were added, a spare field in the superblock with a known zero value became fs_maxsymlinklen. New filesystems set this field to (NDADDR + NIADDR) * sizeof(daddr_t). Embedded symlinks were assumed when di_size < fs->fs_maxsymlinklen. Thus filesystems that preceeded this change always read from blocks (since fs->fs_maxsymlinklen == 0) and newer ones used embedded symlinks if they fit. Similarly symlinks created on pre-embedded symlink filesystems always spill into blocks while newer ones will embed if they fit. At the same time that the embedded symbolic links were added, the on-disk directory structure was changed splitting the former u_int16_t d_namlen into u_int8_t d_type and u_int8_t d_namlen. Thus fs_maxsymlinklen <= 0 (as used by the OFSFMT() macro) can be used to distinguish old directory formats. In retrospect that should have just been an added flag, but we did not realize we needed to know about that change until it was already in production. Code was split into ufs/ffs so that the log structured filesystem could use ufs functionality while doing its own disk layout. This meant that no ffs superblock fields could be used in the ufs code. Thus ffs superblock fields that were needed in ufs code had to be copied to fields in the mount structure. Since ufs_readlink needed to know if a link was embedded, fs_maxlinklen gets copied to mnt_maxsymlinklen. The kernel panic that arose to making this fix was triggered when a disk error created an inode of type symlink with no allocated data blocks but a large size. When readlink was called the uiomove was attempted which segment faulted. static int ufs_readlink(ap) struct vop_readlink_args /* { struct vnode *a_vp; struct uio *a_uio; struct ucred *a_cred; } */ *ap; { struct vnode *vp = ap->a_vp; struct inode *ip = VTOI(vp); doff_t isize; isize = ip->i_size; if ((isize < vp->v_mount->mnt_maxsymlinklen) || DIP(ip, i_blocks) == 0) { /* XXX - for old fastlink support */ return (uiomove(SHORTLINK(ip), isize, ap->a_uio)); } return (VOP_READ(vp, ap->a_uio, 0, ap->a_cred)); } The second part of the "if" statement that adds DIP(ip, i_blocks) == 0) { /* XXX - for old fastlink support */ is problematic. It never appeared in BSD released by Berkeley because as noted above mnt_maxsymlinklen is 0 for old format filesystems, so will always fall through to the VOP_READ as it should. I had to dig back through `git blame' to find that Rodney Grimes added it as part of ``The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.'' He must have brought it across from an earlier FreeBSD. Unfortunately the source-control logs for FreeBSD up to the merger with the AT&T-blessed 4.4BSD-Lite conversion were destroyed as part of the agreement to let FreeBSD remain unencumbered, so I cannot pin-point where that line got added on the FreeBSD side. The one change needed here is that mnt_maxsymlinklen is declared as an `int' and should be changed to be `u_int64_t'. This discovery led us to check out the code that deletes symbolic links. Specifically if (vp->v_type == VLNK && (ip->i_size < vp->v_mount->mnt_maxsymlinklen || datablocks == 0)) { if (length != 0) panic("ffs_truncate: partial truncate of symlink"); bzero(SHORTLINK(ip), (u_int)ip->i_size); ip->i_size = 0; DIP_SET(ip, i_size, 0); UFS_INODE_SET_FLAG(ip, IN_SIZEMOD | IN_CHANGE | IN_UPDATE); if (needextclean) goto extclean; return (ffs_update(vp, waitforupdate)); } Here too our broken symlink inode with no data blocks allocated and a large size will segment fault as we are incorrectly using the test that we have no data blocks to decide that it is an embdedded symbolic link and attempting to bzero past the end of the inode. The test for datablocks == 0 is unnecessary as the test for ip->i_size < vp->v_mount->mnt_maxsymlinklen will do the right thing in all cases. The test for datablocks == 0 was added by David Greenman in this commit: Author: David Greenman Date: Tue Aug 2 13:51:05 1994 +0000 Completed (hopefully) the kernel support for old style "fastlinks". Notes: svn path=/head/; revision=1821 I am guessing that he likely earlier added the incorrect test in the ufs_readlink code. I asked David if he had any recollection of why he made this change. Amazingly, he still had a recollection of why he had made a one-line change more than twenty years ago. And unsurpisingly it was because he had been stuck between a rock and a hard place. FreeBSD was up to 1.1.5 before the switch to the 4.4BSD-Lite code base. Prior to that, there were three years of development in all areas of the kernel, including the filesystem code, from the combined set of people including Bill Jolitz, Patchkit contributors, and FreeBSD Project members. The compatibility issue at hand was caused by the FASTLINKS patches from Curt Mayer. In merging in the 4.4BSD-Lite changes David had to find a way to provide compatibility with both the changes that had been made in FreeBSD 1.1.5 and with 4.4BSD-Lite. He felt that these changes would provide compatibility with both systems. In his words: ``My recollection is that the 'FASTLINKS' symlinks support in FreeBSD-1.x, as implemented by Curt Mayer, worked differently than 4.4BSD. He used a spare field in the inode to duplicately store the length. When the 4.4BSD-Lite merge was done, the optimized symlinks support for existing filesystems (those that were initialized in FreeBSD-1.x) were broken due to the FFS on-disk structure of 4.4BSD-Lite differing from FreeBSD-1.x. My commit was needed to restore the backward compatibility with FreeBSD-1.x filesystems. I think it was the best that could be done in the somewhat urgent circumstances of the post Berkeley-USL settlement. Also, regarding Rod's massive commit with little explanation, some context: John Dyson and I did the initial re-port of the 4.4BSD-Lite kernel to the 386 platform in just 10 days. It was by far the most intense hacking effort of my life. In addition to the porting of tons of FreeBSD-1 code, I think we wrote more than 30,000 lines of new code in that time to deal with the missing pieces and architectural changes of 4.4BSD-Lite. We didn't make many notes along the way. There was a lot of pressure to get something out to the rest of the developer community as fast as possible, so detailed discrete commits didn't happen - it all came as a giant wad, which is why Rod's commit message was worded the way it was.'' Reported by: Chuck Silvers Tested by: Chuck Silvers History by: David Greenman Lawrence MFC after: 1 week Sponsored by: Netflix --- sys/kern/vfs_subr.c | 3 ++- sys/sys/mount.h | 2 +- sys/ufs/ffs/ffs_inode.c | 4 +--- sys/ufs/ufs/ufs_vnops.c | 4 +--- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 2be3a81ad799..468bd21dae21 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -4469,7 +4469,8 @@ DB_SHOW_COMMAND(mount, db_show_mount) mp->mnt_lazyvnodelistsize); db_printf(" mnt_writeopcount = %d (with %d in the struct)\n", vfs_mount_fetch_counter(mp, MNT_COUNT_WRITEOPCOUNT), mp->mnt_writeopcount); - db_printf(" mnt_maxsymlinklen = %d\n", mp->mnt_maxsymlinklen); + db_printf(" mnt_maxsymlinklen = %jd\n", + (uintmax_t)mp->mnt_maxsymlinklen); db_printf(" mnt_iosize_max = %d\n", mp->mnt_iosize_max); db_printf(" mnt_hashseed = %u\n", mp->mnt_hashseed); db_printf(" mnt_lockref = %d (with %d in the struct)\n", diff --git a/sys/sys/mount.h b/sys/sys/mount.h index a6d750a1ff37..f341370ecd86 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -224,7 +224,7 @@ struct mount { int mnt_writeopcount; /* (i) write syscalls pending */ struct vfsoptlist *mnt_opt; /* current mount options */ struct vfsoptlist *mnt_optnew; /* new options passed to fs */ - int mnt_maxsymlinklen; /* max size of short symlink */ + uint64_t mnt_maxsymlinklen; /* max size of short symlink */ struct statfs mnt_stat; /* cache of filesystem stats */ struct ucred *mnt_cred; /* credentials of mounter */ void * mnt_data; /* private data */ diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 5598c7ba30e8..8fe7f7ab97de 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -329,9 +329,7 @@ ffs_truncate(vp, length, flags, cred) } if ((flags & IO_NORMAL) == 0) return (0); - if (vp->v_type == VLNK && - (ip->i_size < vp->v_mount->mnt_maxsymlinklen || - datablocks == 0)) { + if (vp->v_type == VLNK && ip->i_size < vp->v_mount->mnt_maxsymlinklen) { #ifdef INVARIANTS if (length != 0) panic("ffs_truncate: partial truncate of symlink"); diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 301c583291d1..70bf1a1d9036 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -2458,10 +2458,8 @@ ufs_readlink(ap) doff_t isize; isize = ip->i_size; - if ((isize < vp->v_mount->mnt_maxsymlinklen) || - DIP(ip, i_blocks) == 0) { /* XXX - for old fastlink support */ + if (isize < vp->v_mount->mnt_maxsymlinklen) return (uiomove(SHORTLINK(ip), isize, ap->a_uio)); - } return (VOP_READ(vp, ap->a_uio, 0, ap->a_cred)); } From owner-dev-commits-src-all@freebsd.org Mon May 17 00:16:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Mon May 17 00:32:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Mon May 17 00:38:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Mon May 17 02:23:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Mon May 17 02:25:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DD9CC6390F2; Mon, 17 May 2021 02:25: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 4Fk2zg5kDgz3hKq; Mon, 17 May 2021 02:25: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 A9C4B23F96; Mon, 17 May 2021 02:25: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 14H2PZiS044439; Mon, 17 May 2021 02:25:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14H2PZ2w044438; Mon, 17 May 2021 02:25:35 GMT (envelope-from git) Date: Mon, 17 May 2021 02:25:35 GMT Message-Id: <202105170225.14H2PZ2w044438@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 5b81e2e1bcdc - main - virtio_scsi: Zero stack-allocated CCBs 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/main X-Git-Reftype: branch X-Git-Commit: 5b81e2e1bcdc2692044873e147f84b67e35e8dcd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 02:25:36 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5b81e2e1bcdc2692044873e147f84b67e35e8dcd commit 5b81e2e1bcdc2692044873e147f84b67e35e8dcd Author: Mark Johnston AuthorDate: 2021-05-17 02:14:41 +0000 Commit: Mark Johnston CommitDate: 2021-05-17 02:20:39 +0000 virtio_scsi: Zero stack-allocated CCBs Fixes: 3394d4239b ("cam: allocate CCBs from UMA for SCSI and ATA IO") Reported by: syzbot+2e9ce63919709feb3d1c@syzkaller.appspotmail.com Reviewed by: trasz Sponsored by: The FreeBSD Foundation --- sys/dev/virtio/scsi/virtio_scsi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/virtio/scsi/virtio_scsi.c b/sys/dev/virtio/scsi/virtio_scsi.c index 51d9e5f532f7..adf4fd17fc5b 100644 --- a/sys/dev/virtio/scsi/virtio_scsi.c +++ b/sys/dev/virtio/scsi/virtio_scsi.c @@ -700,6 +700,7 @@ vtscsi_register_async(struct vtscsi_softc *sc) { struct ccb_setasync csa; + memset(&csa, 0, sizeof(csa)); xpt_setup_ccb(&csa.ccb_h, sc->vtscsi_path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_LOST_DEVICE | AC_FOUND_DEVICE; @@ -716,6 +717,7 @@ vtscsi_deregister_async(struct vtscsi_softc *sc) { struct ccb_setasync csa; + memset(&csa, 0, sizeof(csa)); xpt_setup_ccb(&csa.ccb_h, sc->vtscsi_path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = 0; From owner-dev-commits-src-all@freebsd.org Mon May 17 02:25:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9EE0363943C; Mon, 17 May 2021 02:25: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 4Fk2zj1ZkLz3hV3; Mon, 17 May 2021 02:25: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 C415E24007; Mon, 17 May 2021 02:25: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 14H2PaDs044460; Mon, 17 May 2021 02:25:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14H2Papd044459; Mon, 17 May 2021 02:25:36 GMT (envelope-from git) Date: Mon, 17 May 2021 02:25:36 GMT Message-Id: <202105170225.14H2Papd044459@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 60cb98a1bd2e - main - linux: Fix a mistake in commit fb58045145 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/main X-Git-Reftype: branch X-Git-Commit: 60cb98a1bd2e4ea8fda532261f7211f5d4eba9c0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 02:25:37 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=60cb98a1bd2e4ea8fda532261f7211f5d4eba9c0 commit 60cb98a1bd2e4ea8fda532261f7211f5d4eba9c0 Author: Mark Johnston AuthorDate: 2021-05-17 02:17:53 +0000 Commit: Mark Johnston CommitDate: 2021-05-17 02:23:14 +0000 linux: Fix a mistake in commit fb58045145 The change to futex_andl_smap() should have ordered stac before the load from a user address, otherwise it does not fix anything. Fixes: fb58045145 ("linux: Fix SMAP-enabled futex routines") MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/amd64/linux32/linux32_support.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/linux32/linux32_support.s b/sys/amd64/linux32/linux32_support.s index f3ec3bd8c776..da076010c13c 100644 --- a/sys/amd64/linux32/linux32_support.s +++ b/sys/amd64/linux32/linux32_support.s @@ -168,8 +168,8 @@ ENTRY(futex_andl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault - movl (%rsi),%eax stac + movl (%rsi),%eax 1: movl %eax,%ecx andl %edi,%ecx #ifdef SMP From owner-dev-commits-src-all@freebsd.org Mon May 17 03:57:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 31BF863B01C; Mon, 17 May 2021 03:57: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 4Fk51Y109bz3vGy; Mon, 17 May 2021 03:57: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 0A93424EEC; Mon, 17 May 2021 03:57: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 14H3vKTd064741; Mon, 17 May 2021 03:57:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14H3vK4Z064740; Mon, 17 May 2021 03:57:20 GMT (envelope-from git) Date: Mon, 17 May 2021 03:57:20 GMT Message-Id: <202105170357.14H3vK4Z064740@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Guangyuan Yang Subject: git: a44489fb5132 - main - Add myself (ygy) as a ports committer 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/main X-Git-Reftype: branch X-Git-Commit: a44489fb51325c54bedc2e7c97f148694e6f6eaf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 03:57:21 -0000 The branch main has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a44489fb51325c54bedc2e7c97f148694e6f6eaf commit a44489fb51325c54bedc2e7c97f148694e6f6eaf Author: Guangyuan Yang AuthorDate: 2021-05-17 03:54:25 +0000 Commit: Guangyuan Yang CommitDate: 2021-05-17 03:54:25 +0000 Add myself (ygy) as a ports committer Approved by: lwhsu (mentor) Differential Revision: https://reviews.freebsd.org/D30308 --- share/misc/committers-ports.dot | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/misc/committers-ports.dot b/share/misc/committers-ports.dot index fd594645a5d0..cc600bc03fff 100644 --- a/share/misc/committers-ports.dot +++ b/share/misc/committers-ports.dot @@ -291,6 +291,7 @@ woodsb02 [label="Ben Woods\nwoodsb02@FreeBSD.org\n2016/05/09"] wxs [label="Wesley Shields\nwxs@FreeBSD.org\n2008/01/03"] xmj [label="Johannes Jost Meixner\nxmj@FreeBSD.org\n2014/04/07"] xride [label="Soeren Straarup\nxride@FreeBSD.org\n2006/09/27"] +ygy [label="Guangyuan Yang\nygy@FreeBSD.org\n2021/05/17"] yuri [label="Yuri Victorovich\nyuri@FreeBSD.org\n2017/10/30"] yzlin [label="Yi-Jheng Lin\nyzlin@FreeBSD.org\n2009/07/19"] zeising [label="Niclas Zeising\nzeising@FreeBSD.org\n2012/07/03"] @@ -563,6 +564,7 @@ lioux -> pat lme -> pizzamig lme -> tobik +lwhsu -> ygy lwhsu -> yzlin maho -> stephen From owner-dev-commits-src-all@freebsd.org Mon May 17 05:00:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Mon May 17 06:05:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Mon May 17 06:07:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Mon May 17 06:10:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Mon May 17 06:12:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Mon May 17 06:17:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Mon May 17 06:52:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 76E8B63E712; Mon, 17 May 2021 06:52:55 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4Fk8w61sSpz4mVj; Mon, 17 May 2021 06:52:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 14H6qj5I043000 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 17 May 2021 09:52:48 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 14H6qj5I043000 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 14H6qjS2042999; Mon, 17 May 2021 09:52:45 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 17 May 2021 09:52:45 +0300 From: Konstantin Belousov To: Warner Losh , Mark Johnston , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 0f206cc91279 - main - cam: add missing zeroing of a stack-allocated CCB. Message-ID: References: <202105161045.14GAjZIL093217@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4Fk8w61sSpz4mVj X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-2.93 / 15.00]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2001:470:d5e7:1::1:from]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-0.95)[-0.946]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-0.98)[-0.983]; R_SPF_SOFTFAIL(0.00)[~all:c]; RCPT_COUNT_FIVE(0.00)[5]; SPAMHAUS_ZRD(0.00)[2001:470:d5e7:1::1:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 06:52:55 -0000 On Sun, May 16, 2021 at 07:03:24PM +0100, Edward Tomasz Napierala wrote: > On 0516T1227, Warner Losh wrote: > > On Sun, May 16, 2021, 11:55 AM Mark Johnston wrote: > > > > > On Sun, May 16, 2021 at 10:45:35AM +0000, Edward Tomasz Napierala wrote: > > > > The branch main has been updated by trasz: > > > > > > > > URL: > > > https://cgit.FreeBSD.org/src/commit/?id=0f206cc91279e630ad9e733eb6e330b7dbe6c70e > > > > > > > > commit 0f206cc91279e630ad9e733eb6e330b7dbe6c70e > > > > Author: Edward Tomasz Napierala > > > > AuthorDate: 2021-05-16 09:28:04 +0000 > > > > Commit: Edward Tomasz Napierala > > > > CommitDate: 2021-05-16 10:38:26 +0000 > > > > > > > > cam: add missing zeroing of a stack-allocated CCB. > > > > > > > > This could cause a panic at boot. > > > > > > There are other instances of this, for example syzbot is currently > > > hitting an assertion, seemingly because the alloc_flags field of a > > > stack-allocated CCB was not zeroed: > > > https://syzkaller.appspot.com/bug?extid=2e9ce63919709feb3d1c > > > > > > I think the patch below will fix it, but I did not audit other callers. > > > It feels a bit strange to require all callers of xpt_setup_ccb() to > > > manually zero the structure first, can we provide a single routine to > > > initialize stack-allocated CCBs? > > We definitely could, although in some cases it's a bit more > complicated than that - a function that gets passed a CCB and then > calls xpt_setup_ccb() to fill it shouldn't zero it, as that would > be making assumption on how the CCB passed to it was allocated. > > Now that I look at the code, I can definitely see that I've missed > a couple of places. Perhaps I should replace those two KASSERTs with > diagnostic printfs for now, until I get that sorted out? > > > If we did, we could set a flag we could assert on, and/or do static > > analysis to find any others... > > That sounds promising, except I've never done anything like that; > I don't even know where to start. Are stack-allocated ccbs passed around? In particular, can the thread that allocated the ccb, put to sleep while ccb is processed elsewere? This should break under swapping. From owner-dev-commits-src-all@freebsd.org Mon May 17 06:55:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CBEC863E8A9; Mon, 17 May 2021 06:55:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4Fk8zf3tM1z4nDx; Mon, 17 May 2021 06:55:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 14H6toMF044176 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 17 May 2021 09:55:53 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 14H6toMF044176 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 14H6toQx044175; Mon, 17 May 2021 09:55:50 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 17 May 2021 09:55:50 +0300 From: Konstantin Belousov To: Kirk McKusick Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 9a2fac6ba65f - main - Fix handling of embedded symbolic links (and history lesson). Message-ID: References: <202105170000.14H00NgY054353@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202105170000.14H00NgY054353@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4Fk8zf3tM1z4nDx X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 06:55:58 -0000 On Mon, May 17, 2021 at 12:00:23AM +0000, Kirk McKusick wrote: > diff --git a/sys/sys/mount.h b/sys/sys/mount.h > index a6d750a1ff37..f341370ecd86 100644 > --- a/sys/sys/mount.h > +++ b/sys/sys/mount.h > @@ -224,7 +224,7 @@ struct mount { > int mnt_writeopcount; /* (i) write syscalls pending */ > struct vfsoptlist *mnt_opt; /* current mount options */ > struct vfsoptlist *mnt_optnew; /* new options passed to fs */ > - int mnt_maxsymlinklen; /* max size of short symlink */ > + uint64_t mnt_maxsymlinklen; /* max size of short symlink */ Thank you for the interesting reading in the commit message. Somewhat (un)related question is, why maxsymlinklen is put into struct mount? Shouldn't it be contained to struct ufsmount and similar ext2 data structure. The value is private to UFS, it has no use outside sys/ufs. From owner-dev-commits-src-all@freebsd.org Mon May 17 09:43:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EEA62641AE0; Mon, 17 May 2021 09:43: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 4FkDhR6QD0z3j6F; Mon, 17 May 2021 09:43: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 C44D91C97; Mon, 17 May 2021 09:43: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 14H9h39l030586; Mon, 17 May 2021 09:43:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14H9h38q030585; Mon, 17 May 2021 09:43:03 GMT (envelope-from git) Date: Mon, 17 May 2021 09:43:03 GMT Message-Id: <202105170943.14H9h38q030585@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?B?Um9nZXIgUGF1IE1vbm7DqQ==?= Subject: git: c93e6ea344a1 - main - xen: remove support for PVHv1 bootpath MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c93e6ea344a1616219d18b6a2b6761ef19d38c39 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 09:43:04 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=c93e6ea344a1616219d18b6a2b6761ef19d38c39 commit c93e6ea344a1616219d18b6a2b6761ef19d38c39 Author: Mitchell Horne AuthorDate: 2021-05-06 20:45:40 +0000 Commit: Roger Pau Monné CommitDate: 2021-05-17 08:56:52 +0000 xen: remove support for PVHv1 bootpath PVHv1 is a legacy interface supported only by Xen versions 4.4 through 4.9. Reviewed by: royger --- sys/amd64/amd64/xen-locore.S | 24 ------ sys/x86/xen/pv.c | 186 ------------------------------------------- 2 files changed, 210 deletions(-) diff --git a/sys/amd64/amd64/xen-locore.S b/sys/amd64/amd64/xen-locore.S index 97d81711a051..c112fa909adf 100644 --- a/sys/amd64/amd64/xen-locore.S +++ b/sys/amd64/amd64/xen-locore.S @@ -54,7 +54,6 @@ ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz, "xen-3.0") ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .quad, KERNBASE) ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad, 0) - ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .quad, xen_start) ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad, hypercall_page) ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, .quad, HYPERVISOR_VIRT_START) ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz, "writable_descriptor_tables|auto_translated_physmap|supervisor_mode_kernel|hvm_callback_vector") @@ -72,29 +71,6 @@ ENTRY(hypercall_page) .skip 0x1000, 0x90 /* Fill with "nop"s */ -/* Legacy PVH entry point, to be removed. */ -ENTRY(xen_start) - /* Don't trust what the loader gives for rflags. */ - pushq $PSL_KERNEL - popfq - - /* Parameters for the xen init function */ - movq %rsi, %rdi /* shared_info (arg 1) */ - movq %rsp, %rsi /* xenstack (arg 2) */ - - /* Use our own stack */ - movq $bootstack,%rsp - xorl %ebp, %ebp - - /* u_int64_t hammer_time_xen(start_info_t *si, u_int64_t xenstack); */ - call hammer_time_xen_legacy - movq %rax, %rsp /* set up kstack for mi_startup() */ - call mi_startup /* autoconfiguration, mountroot etc */ - - /* NOTREACHED */ -0: hlt - jmp 0b - /* PVH entry point. */ .code32 ENTRY(xen_start32) diff --git a/sys/x86/xen/pv.c b/sys/x86/xen/pv.c index a2424423aded..3511df779a92 100644 --- a/sys/x86/xen/pv.c +++ b/sys/x86/xen/pv.c @@ -88,13 +88,11 @@ __FBSDID("$FreeBSD$"); /* Native initial function */ extern u_int64_t hammer_time(u_int64_t, u_int64_t); /* Xen initial function */ -uint64_t hammer_time_xen_legacy(start_info_t *, uint64_t); uint64_t hammer_time_xen(vm_paddr_t); #define MAX_E820_ENTRIES 128 /*--------------------------- Forward Declarations ---------------------------*/ -static caddr_t xen_legacy_pvh_parse_preload_data(uint64_t); static caddr_t xen_pvh_parse_preload_data(uint64_t); static void xen_pvh_parse_memmap(caddr_t, vm_paddr_t *, int *); @@ -118,18 +116,6 @@ extern char *dbg_stack; extern uint32_t end; /*-------------------------------- Global Data -------------------------------*/ -/* Xen init_ops implementation. */ -struct init_ops xen_legacy_init_ops = { - .parse_preload_data = xen_legacy_pvh_parse_preload_data, - .early_clock_source_init = xen_clock_init, - .early_delay = xen_delay, - .parse_memmap = xen_pvh_parse_memmap, -#ifdef SMP - .start_all_aps = xen_pv_start_all_aps, -#endif - .msi_init = xen_msi_init, -}; - struct init_ops xen_pvh_init_ops = { .parse_preload_data = xen_pvh_parse_preload_data, .early_clock_source_init = xen_clock_init, @@ -144,134 +130,9 @@ struct init_ops xen_pvh_init_ops = { static struct bios_smap xen_smap[MAX_E820_ENTRIES]; -static start_info_t *legacy_start_info; static struct hvm_start_info *start_info; -/*----------------------- Legacy PVH start_info accessors --------------------*/ -static vm_paddr_t -legacy_get_xenstore_mfn(void) -{ - - return (legacy_start_info->store_mfn); -} - -static evtchn_port_t -legacy_get_xenstore_evtchn(void) -{ - - return (legacy_start_info->store_evtchn); -} - -static vm_paddr_t -legacy_get_console_mfn(void) -{ - - return (legacy_start_info->console.domU.mfn); -} - -static evtchn_port_t -legacy_get_console_evtchn(void) -{ - - return (legacy_start_info->console.domU.evtchn); -} - -static uint32_t -legacy_get_start_flags(void) -{ - - return (legacy_start_info->flags); -} - -struct hypervisor_info legacy_info = { - .get_xenstore_mfn = legacy_get_xenstore_mfn, - .get_xenstore_evtchn = legacy_get_xenstore_evtchn, - .get_console_mfn = legacy_get_console_mfn, - .get_console_evtchn = legacy_get_console_evtchn, - .get_start_flags = legacy_get_start_flags, -}; - /*-------------------------------- Xen PV init -------------------------------*/ -/* - * First function called by the Xen legacy PVH boot sequence. - * - * Set some Xen global variables and prepare the environment so it is - * as similar as possible to what native FreeBSD init function expects. - */ -uint64_t -hammer_time_xen_legacy(start_info_t *si, uint64_t xenstack) -{ - uint64_t physfree; - uint64_t *PT4 = (u_int64_t *)xenstack; - uint64_t *PT3 = (u_int64_t *)(xenstack + PAGE_SIZE); - uint64_t *PT2 = (u_int64_t *)(xenstack + 2 * PAGE_SIZE); - int i; - char *kenv; - - xen_domain_type = XEN_PV_DOMAIN; - vm_guest = VM_GUEST_XEN; - - if ((si == NULL) || (xenstack == 0)) { - xc_printf("ERROR: invalid start_info or xen stack, halting\n"); - HYPERVISOR_shutdown(SHUTDOWN_crash); - } - - xc_printf("FreeBSD PVH running on %s\n", si->magic); - - /* We use 3 pages of xen stack for the boot pagetables */ - physfree = xenstack + 3 * PAGE_SIZE - KERNBASE; - - /* Setup Xen global variables */ - legacy_start_info = si; - HYPERVISOR_shared_info = - (shared_info_t *)(si->shared_info + KERNBASE); - - /* - * Use the stack Xen gives us to build the page tables - * as native FreeBSD expects to find them (created - * by the boot trampoline). - */ - for (i = 0; i < (PAGE_SIZE / sizeof(uint64_t)); i++) { - /* - * Each slot of the level 4 pages points - * to the same level 3 page - */ - PT4[i] = ((uint64_t)&PT3[0]) - KERNBASE; - PT4[i] |= PG_V | PG_RW | PG_U; - - /* - * Each slot of the level 3 pages points - * to the same level 2 page - */ - PT3[i] = ((uint64_t)&PT2[0]) - KERNBASE; - PT3[i] |= PG_V | PG_RW | PG_U; - - /* - * The level 2 page slots are mapped with - * 2MB pages for 1GB. - */ - PT2[i] = i * (2 * 1024 * 1024); - PT2[i] |= PG_V | PG_RW | PG_PS | PG_U; - } - load_cr3(((uint64_t)&PT4[0]) - KERNBASE); - - /* - * Init an empty static kenv using a free page. The contents will be - * filled from the parse_preload_data hook. - */ - kenv = (void *)(physfree + KERNBASE); - physfree += PAGE_SIZE; - bzero_early(kenv, PAGE_SIZE); - init_static_kenv(kenv, PAGE_SIZE); - - /* Set the hooks for early functions that diverge from bare metal */ - init_ops = xen_legacy_init_ops; - apic_ops = xen_apic_ops; - hypervisor_info = legacy_info; - - /* Now we can jump into the native init function */ - return (hammer_time(0, physfree)); -} uint64_t hammer_time_xen(vm_paddr_t start_info_paddr) @@ -512,53 +373,6 @@ xen_pvh_parse_symtab(void) } #endif -static caddr_t -xen_legacy_pvh_parse_preload_data(uint64_t modulep) -{ - caddr_t kmdp; - vm_ooffset_t off; - vm_paddr_t metadata; - char *envp; - - if (legacy_start_info->mod_start != 0) { - preload_metadata = (caddr_t)legacy_start_info->mod_start; - - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - KASSERT(kmdp != NULL, ("unable to find kernel")); - - /* - * Xen has relocated the metadata and the modules, - * so we need to recalculate it's position. This is - * done by saving the original modulep address and - * then calculating the offset with mod_start, - * which contains the relocated modulep address. - */ - metadata = MD_FETCH(kmdp, MODINFOMD_MODULEP, vm_paddr_t); - off = legacy_start_info->mod_start - metadata; - - preload_bootstrap_relocate(off); - - boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); - envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); - if (envp != NULL) - envp += off; - xen_pvh_set_env(envp, NULL); - } else { - /* Parse the extra boot information given by Xen */ - boot_parse_cmdline_delim(legacy_start_info->cmd_line, ","); - kmdp = NULL; - } - - boothowto |= boot_env_to_howto(); - -#ifdef DDB - xen_pvh_parse_symtab(); -#endif - return (kmdp); -} - static caddr_t xen_pvh_parse_preload_data(uint64_t modulep) { From owner-dev-commits-src-all@freebsd.org Mon May 17 09:43:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7865D641F23; Mon, 17 May 2021 09:43:06 +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 4FkDhV1Srbz3j8Z; Mon, 17 May 2021 09:43: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 196501D00; Mon, 17 May 2021 09:43:06 +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 14H9h6vu030643; Mon, 17 May 2021 09:43:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14H9h5cG030642; Mon, 17 May 2021 09:43:05 GMT (envelope-from git) Date: Mon, 17 May 2021 09:43:05 GMT Message-Id: <202105170943.14H9h5cG030642@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?B?Um9nZXIgUGF1IE1vbm7DqQ==?= Subject: git: ac3ede5371af - main - x86/xen: remove PVHv1 code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ac3ede5371af34b0a89fa72b7a5bb706457b99ad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 09:43:06 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=ac3ede5371af34b0a89fa72b7a5bb706457b99ad commit ac3ede5371af34b0a89fa72b7a5bb706457b99ad Author: Roger Pau Monné AuthorDate: 2021-05-12 10:17:53 +0000 Commit: Roger Pau Monné CommitDate: 2021-05-17 09:41:21 +0000 x86/xen: remove PVHv1 code PVHv1 was officially removed from Xen in 4.9, so just axe the related code from FreeBSD. Note FreeBSD supports PVHv2, which is the replacement for PVHv1. Sponsored by: Citrix Systems R&D Reviewed by: kib, Elliott Mitchell Differential Revision: https://reviews.freebsd.org/D30228 --- sys/amd64/amd64/machdep.c | 12 +- sys/amd64/amd64/mp_machdep.c | 4 +- sys/amd64/include/smp.h | 2 +- sys/conf/files | 1 - sys/conf/files.amd64 | 4 - sys/conf/files.x86 | 2 - sys/dev/xen/pci/xen_acpi_pci.c | 97 ------------ sys/dev/xen/pci/xen_pci.c | 79 ---------- sys/dev/xen/pvcpu/pvcpu.c | 99 ------------ sys/i386/i386/machdep.c | 3 - sys/x86/include/init.h | 3 - sys/x86/x86/local_apic.c | 2 +- sys/x86/xen/pv.c | 6 - sys/x86/xen/pvcpu_enum.c | 264 -------------------------------- sys/x86/xen/xen_intr.c | 340 +---------------------------------------- sys/x86/xen/xen_msi.c | 133 ---------------- sys/x86/xen/xen_nexus.c | 166 -------------------- sys/x86/xen/xen_pci_bus.c | 90 ----------- sys/xen/evtchn/evtchnvar.h | 1 - sys/xen/xen_intr.h | 44 ------ sys/xen/xen_msi.h | 39 ----- sys/xen/xen_pci.h | 37 ----- 22 files changed, 14 insertions(+), 1414 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 497975f0ee30..9ddad323449b 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -187,13 +187,6 @@ struct init_ops init_ops = { .early_clock_source_init = i8254_init, .early_delay = i8254_delay, .parse_memmap = native_parse_memmap, -#ifdef SMP - .mp_bootaddress = mp_bootaddress, - .start_all_aps = native_start_all_aps, -#endif -#ifdef DEV_PCI - .msi_init = msi_init, -#endif }; /* @@ -1283,8 +1276,9 @@ getmemsize(caddr_t kmdp, u_int64_t first) * is configured to support APs and APs for the system start * in real mode mode (e.g. SMP bare metal). */ - if (init_ops.mp_bootaddress) - init_ops.mp_bootaddress(physmap, &physmap_idx); +#ifdef SMP + mp_bootaddress(physmap, &physmap_idx); +#endif /* call pmap initialization to make new kernel address space */ pmap_bootstrap(&first); diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 11f2bb8bbfc1..6f788c087f06 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -245,7 +245,7 @@ cpu_mp_start(void) mptramp_la57 = la57; /* Start each Application Processor */ - init_ops.start_all_aps(); + start_all_aps(); set_interrupt_apic_ids(); @@ -397,7 +397,7 @@ mp_realloc_pcpu(int cpuid, int domain) * start each AP in our list */ int -native_start_all_aps(void) +start_all_aps(void) { u_int64_t *pt5, *pt4, *pt3, *pt2; u_int32_t mpbioswarmvec; diff --git a/sys/amd64/include/smp.h b/sys/amd64/include/smp.h index 8fbd89da0e57..ac9ed5f61a23 100644 --- a/sys/amd64/include/smp.h +++ b/sys/amd64/include/smp.h @@ -38,7 +38,7 @@ inthand_t IDTVEC(rendezvous_pti); void invlop_handler(void); -int native_start_all_aps(void); +int start_all_aps(void); void mp_bootaddress(vm_paddr_t *, unsigned int *); #endif /* !LOCORE */ diff --git a/sys/conf/files b/sys/conf/files index 40b02aba28d6..22083169bfc7 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3545,7 +3545,6 @@ dev/xen/netback/netback.c optional xenhvm dev/xen/netfront/netfront.c optional xenhvm dev/xen/xenpci/xenpci.c optional xenpci dev/xen/timer/timer.c optional xenhvm -dev/xen/pvcpu/pvcpu.c optional xenhvm dev/xen/xenstore/xenstore.c optional xenhvm dev/xen/xenstore/xenstore_dev.c optional xenhvm dev/xen/xenstore/xenstored_dev.c optional xenhvm diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index 9afaad72af74..1dd3a51a3af3 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -387,8 +387,6 @@ dev/viawd/viawd.c optional viawd dev/vmd/vmd.c optional vmd dev/vmd/vmd_bus.c optional vmd_bus dev/wbwd/wbwd.c optional wbwd -dev/xen/pci/xen_acpi_pci.c optional xenhvm -dev/xen/pci/xen_pci.c optional xenhvm isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/imgact_aout.c optional compat_aout @@ -461,8 +459,6 @@ x86/x86/mptable.c optional mptable x86/x86/mptable_pci.c optional mptable pci x86/x86/msi.c optional pci x86/xen/pv.c optional xenhvm -x86/xen/pvcpu_enum.c optional xenhvm -x86/xen/xen_pci_bus.c optional xenhvm compat/linuxkpi/common/src/linux_fpu.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" diff --git a/sys/conf/files.x86 b/sys/conf/files.x86 index 0a2cd1554eb4..b8d1e5a17048 100644 --- a/sys/conf/files.x86 +++ b/sys/conf/files.x86 @@ -328,5 +328,3 @@ x86/xen/hvm.c optional xenhvm x86/xen/xen_intr.c optional xenhvm x86/xen/xen_apic.c optional xenhvm x86/xen/xenpv.c optional xenhvm -x86/xen/xen_msi.c optional xenhvm -x86/xen/xen_nexus.c optional xenhvm diff --git a/sys/dev/xen/pci/xen_acpi_pci.c b/sys/dev/xen/pci/xen_acpi_pci.c deleted file mode 100644 index 11797fb772dd..000000000000 --- a/sys/dev/xen/pci/xen_acpi_pci.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2014 Roger Pau Monné - * All rights reserved. - * - * 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 -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include "pcib_if.h" -#include "pci_if.h" - -static int -xen_acpi_pci_probe(device_t dev) -{ - - if (!xen_pv_domain()) - return (ENXIO); - if (acpi_get_handle(dev) == NULL) - return (ENXIO); - - device_set_desc(dev, "Xen ACPI PCI bus"); - - return (BUS_PROBE_SPECIFIC); -} - -static void -xen_acpi_pci_child_added(device_t dev, device_t child) -{ - - acpi_pci_child_added(dev, child); - xen_pci_child_added_method(dev, child); -} - -static device_method_t xen_acpi_pci_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, xen_acpi_pci_probe), - - /* PCI interface overwrites */ - DEVMETHOD(pci_enable_msi, xen_pci_enable_msi_method), - DEVMETHOD(pci_disable_msi, xen_pci_disable_msi_method), - DEVMETHOD(pci_child_added, xen_acpi_pci_child_added), - - DEVMETHOD_END -}; - -static devclass_t pci_devclass; - -DECLARE_CLASS(acpi_pci_driver); -DEFINE_CLASS_1(pci, xen_acpi_pci_driver, xen_acpi_pci_methods, - sizeof(struct pci_softc), acpi_pci_driver); -DRIVER_MODULE(xen_acpi_pci, pcib, xen_acpi_pci_driver, pci_devclass, 0, 0); -MODULE_DEPEND(xen_acpi_pci, pci, 1, 1, 1); -MODULE_DEPEND(xen_acpi_pci, acpi, 1, 1, 1); -MODULE_VERSION(xen_acpi_pci, 1); diff --git a/sys/dev/xen/pci/xen_pci.c b/sys/dev/xen/pci/xen_pci.c deleted file mode 100644 index d1bd439d4b76..000000000000 --- a/sys/dev/xen/pci/xen_pci.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2014 Roger Pau Monné - * All rights reserved. - * - * 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 -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include "pcib_if.h" -#include "pci_if.h" - -static int -xen_pci_probe(device_t dev) -{ - - if (!xen_pv_domain()) - return (ENXIO); - - device_set_desc(dev, "Xen PCI bus"); - - return (BUS_PROBE_DEFAULT); -} - -static device_method_t xen_pci_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, xen_pci_probe), - - /* PCI interface overwrites */ - DEVMETHOD(pci_enable_msi, xen_pci_enable_msi_method), - DEVMETHOD(pci_disable_msi, xen_pci_disable_msi_method), - DEVMETHOD(pci_child_added, xen_pci_child_added_method), - - DEVMETHOD_END -}; - -static devclass_t pci_devclass; - -DEFINE_CLASS_1(pci, xen_pci_driver, xen_pci_methods, sizeof(struct pci_softc), - pci_driver); -DRIVER_MODULE(xen_pci, pcib, xen_pci_driver, pci_devclass, 0, 0); -MODULE_DEPEND(xen_pci, pci, 1, 1, 1); -MODULE_VERSION(xen_pci, 1); diff --git a/sys/dev/xen/pvcpu/pvcpu.c b/sys/dev/xen/pvcpu/pvcpu.c deleted file mode 100644 index 2d41dac387ad..000000000000 --- a/sys/dev/xen/pvcpu/pvcpu.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2013 Roger Pau Monné - * All rights reserved. - * - * 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 -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include - -#include - -/* - * Dummy Xen cpu device - * - * Since there's no ACPI on PVH guests, we need to create a dummy - * CPU device in order to fill the pcpu->pc_device field. - */ - -static void -xenpvcpu_identify(driver_t *driver, device_t parent) -{ - int i; - - /* Only attach in case the per-CPU device is not set. */ - if (!xen_domain() || PCPU_GET(device) != NULL) - return; - - CPU_FOREACH(i) { - if (BUS_ADD_CHILD(parent, 0, "pvcpu", i) == NULL) - panic("Unable to add Xen PV CPU device."); - } -} - -static int -xenpvcpu_probe(device_t dev) -{ - - device_set_desc(dev, "Xen PV CPU"); - return (BUS_PROBE_NOWILDCARD); -} - -static int -xenpvcpu_attach(device_t dev) -{ - struct pcpu *pc; - int cpu; - - cpu = device_get_unit(dev); - pc = pcpu_find(cpu); - pc->pc_device = dev; - return (0); -} - -static device_method_t xenpvcpu_methods[] = { - DEVMETHOD(device_identify, xenpvcpu_identify), - DEVMETHOD(device_probe, xenpvcpu_probe), - DEVMETHOD(device_attach, xenpvcpu_attach), - - DEVMETHOD_END -}; - -static driver_t xenpvcpu_driver = { - "pvcpu", - xenpvcpu_methods, - 0, -}; - -devclass_t xenpvcpu_devclass; - -DRIVER_MODULE(xenpvcpu, xenpv, xenpvcpu_driver, xenpvcpu_devclass, 0, 0); -MODULE_DEPEND(xenpvcpu, xenpv, 1, 1, 1); diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 5fec2e448c53..ce4a264ede01 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -212,9 +212,6 @@ extern struct sysentvec elf32_freebsd_sysvec; struct init_ops init_ops = { .early_clock_source_init = i8254_init, .early_delay = i8254_delay, -#ifdef DEV_APIC - .msi_init = msi_init, -#endif }; static void diff --git a/sys/x86/include/init.h b/sys/x86/include/init.h index 880cabaa9496..4b1d318a6523 100644 --- a/sys/x86/include/init.h +++ b/sys/x86/include/init.h @@ -41,9 +41,6 @@ struct init_ops { void (*early_clock_source_init)(void); void (*early_delay)(int); void (*parse_memmap)(caddr_t, vm_paddr_t *, int *); - void (*mp_bootaddress)(vm_paddr_t *, unsigned int *); - int (*start_all_aps)(void); - void (*msi_init)(void); }; extern struct init_ops init_ops; diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c index 36010fe38102..5b4910d4b891 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -1979,7 +1979,7 @@ apic_setup_io(void *dummy __unused) lapic_dump("BSP"); /* Enable the MSI "pic". */ - init_ops.msi_init(); + msi_init(); #ifdef XENHVM xen_intr_alloc_irqs(); diff --git a/sys/x86/xen/pv.c b/sys/x86/xen/pv.c index 3511df779a92..c6dfff511c0c 100644 --- a/sys/x86/xen/pv.c +++ b/sys/x86/xen/pv.c @@ -74,7 +74,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -121,11 +120,6 @@ struct init_ops xen_pvh_init_ops = { .early_clock_source_init = xen_clock_init, .early_delay = xen_delay, .parse_memmap = xen_pvh_parse_memmap, -#ifdef SMP - .mp_bootaddress = mp_bootaddress, - .start_all_aps = native_start_all_aps, -#endif - .msi_init = msi_init, }; static struct bios_smap xen_smap[MAX_E820_ENTRIES]; diff --git a/sys/x86/xen/pvcpu_enum.c b/sys/x86/xen/pvcpu_enum.c deleted file mode 100644 index 5d5c265fcc5f..000000000000 --- a/sys/x86/xen/pvcpu_enum.c +++ /dev/null @@ -1,264 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2013 Roger Pau Monné - * All rights reserved. - * Copyright (c) 2003 John Baldwin - * - * 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 -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include - -#include - -static int xenpv_probe(void); -static int xenpv_probe_cpus(void); -static int xenpv_setup_local(void); -static int xenpv_setup_io(void); - -static ACPI_TABLE_MADT *madt; -static vm_paddr_t madt_physaddr; -static vm_offset_t madt_length; - -static struct apic_enumerator xenpv_enumerator = { - .apic_name = "Xen PV", - .apic_probe = xenpv_probe, - .apic_probe_cpus = xenpv_probe_cpus, - .apic_setup_local = xenpv_setup_local, - .apic_setup_io = xenpv_setup_io -}; - -/*--------------------- Helper functions to parse MADT -----------------------*/ - -/* - * Parse an interrupt source override for an ISA interrupt. - */ -static void -madt_parse_interrupt_override(ACPI_MADT_INTERRUPT_OVERRIDE *intr) -{ - enum intr_trigger trig; - enum intr_polarity pol; - int ret; - - if (acpi_quirks & ACPI_Q_MADT_IRQ0 && intr->SourceIrq == 0 && - intr->GlobalIrq == 2) { - if (bootverbose) - printf("MADT: Skipping timer override\n"); - return; - } - - madt_parse_interrupt_values(intr, &trig, &pol); - - /* Remap the IRQ if it is mapped to a different interrupt vector. */ - if (intr->SourceIrq != intr->GlobalIrq && intr->GlobalIrq > 15 && - intr->SourceIrq == AcpiGbl_FADT.SciInterrupt) - /* - * If the SCI is remapped to a non-ISA global interrupt, - * then override the vector we use to setup. - */ - acpi_OverrideInterruptLevel(intr->GlobalIrq); - - /* Register the IRQ with the polarity and trigger mode found. */ - ret = xen_register_pirq(intr->GlobalIrq, trig, pol); - if (ret != 0) - panic("Unable to register interrupt override"); -} - -/* - * Call the handler routine for each entry in the MADT table. - */ -static void -madt_walk_table(acpi_subtable_handler *handler, void *arg) -{ - - acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length, - handler, arg); -} - -/* - * Parse interrupt entries. - */ -static void -madt_parse_ints(ACPI_SUBTABLE_HEADER *entry, void *arg __unused) -{ - - if (entry->Type == ACPI_MADT_TYPE_INTERRUPT_OVERRIDE) - madt_parse_interrupt_override( - (ACPI_MADT_INTERRUPT_OVERRIDE *)entry); -} - -/*---------------------------- Xen PV enumerator -----------------------------*/ - -/* - * This enumerator will only be registered on PVH - */ -static int -xenpv_probe(void) -{ - return (0); -} - -/* - * Test each possible vCPU in order to find the number of vCPUs - */ -static int -xenpv_probe_cpus(void) -{ -#ifdef SMP - int i, ret; - - for (i = 0; i < MAXCPU && (i * 2) < MAX_APIC_ID; i++) { - ret = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL); - mp_ncpus = min(mp_ncpus + 1, MAXCPU); - } - mp_maxid = mp_ncpus - 1; - max_apic_id = mp_ncpus * 2; -#endif - return (0); -} - -/* - * Initialize the vCPU id of the BSP - */ -static int -xenpv_setup_local(void) -{ -#ifdef SMP - int i, ret; - - for (i = 0; i < MAXCPU && (i * 2) < MAX_APIC_ID; i++) { - ret = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL); - if (ret >= 0) - lapic_create((i * 2), (i == 0)); - } -#endif - - PCPU_SET(vcpu_id, 0); - lapic_init(0); - return (0); -} - -/* - * On PVH guests there's no IO APIC - */ -static int -xenpv_setup_io(void) -{ - - if (xen_initial_domain()) { - /* - * NB: we could iterate over the MADT IOAPIC entries in order - * to figure out the exact number of IOAPIC interrupts, but - * this is legacy code so just keep using the previous - * behaviour and assume a maximum of 256 interrupts. - */ - num_io_irqs = max(255, num_io_irqs); - - acpi_SetDefaultIntrModel(ACPI_INTR_APIC); - } - return (0); -} - -void -xenpv_register_pirqs(struct pic *pic __unused) -{ - unsigned int i; - int ret; - - /* Map MADT */ - madt_physaddr = acpi_find_table(ACPI_SIG_MADT); - madt = acpi_map_table(madt_physaddr, ACPI_SIG_MADT); - madt_length = madt->Header.Length; - - /* Try to initialize ACPI so that we can access the FADT. */ - ret = acpi_Startup(); - if (ACPI_FAILURE(ret)) { - printf("MADT: ACPI Startup failed with %s\n", - AcpiFormatException(ret)); - printf("Try disabling either ACPI or apic support.\n"); - panic("Using MADT but ACPI doesn't work"); - } - - /* Run through the table to see if there are any overrides. */ - madt_walk_table(madt_parse_ints, NULL); - - /* - * If there was not an explicit override entry for the SCI, - * force it to use level trigger and active-low polarity. - */ - if (!madt_found_sci_override) { - printf( -"MADT: Forcing active-low polarity and level trigger for SCI\n"); - ret = xen_register_pirq(AcpiGbl_FADT.SciInterrupt, - INTR_TRIGGER_LEVEL, INTR_POLARITY_LOW); - if (ret != 0) - panic("Unable to register SCI IRQ"); - } - - /* Register legacy ISA IRQs */ - for (i = 1; i < 16; i++) { - if (intr_lookup_source(i) != NULL) - continue; - ret = xen_register_pirq(i, INTR_TRIGGER_EDGE, - INTR_POLARITY_LOW); - if (ret != 0 && bootverbose) - printf("Unable to register legacy IRQ#%u: %d\n", i, - ret); - } -} - -static void -xenpv_register(void *dummy __unused) -{ - if (xen_pv_domain()) { - apic_register_enumerator(&xenpv_enumerator); - } -} -SYSINIT(xenpv_register, SI_SUB_TUNABLES - 1, SI_ORDER_FIRST, xenpv_register, NULL); diff --git a/sys/x86/xen/xen_intr.c b/sys/x86/xen/xen_intr.c index 435db2e31693..c729ffddb345 100644 --- a/sys/x86/xen/xen_intr.c +++ b/sys/x86/xen/xen_intr.c @@ -114,8 +114,6 @@ DPCPU_DEFINE_STATIC(struct xen_intr_pcpu_data, xen_intr_pcpu) = { DPCPU_DECLARE(struct vcpu_info *, vcpu_info); -#define XEN_EEXIST 17 /* Xen "already exists" error */ -#define XEN_ALLOCATE_VECTOR 0 /* Allocate a vector for this event channel */ #define XEN_INVALID_EVTCHN 0 /* Invalid event channel */ #define is_valid_evtchn(x) ((x) != XEN_INVALID_EVTCHN) @@ -126,7 +124,6 @@ struct xenisrc { int xi_cpu; /* VCPU for delivery. */ int xi_vector; /* Global isrc vector number. */ evtchn_port_t xi_port; - int xi_pirq; int xi_virq; void *xi_cookie; u_int xi_close:1; /* close on unbind? */ @@ -149,14 +146,6 @@ static int xen_intr_config_intr(struct intsrc *isrc, enum intr_trigger trig, enum intr_polarity pol); static int xen_intr_assign_cpu(struct intsrc *isrc, u_int apic_id); -static void xen_intr_pirq_enable_source(struct intsrc *isrc); -static void xen_intr_pirq_disable_source(struct intsrc *isrc, int eoi); -static void xen_intr_pirq_eoi_source(struct intsrc *isrc); -static void xen_intr_pirq_enable_intr(struct intsrc *isrc); -static void xen_intr_pirq_disable_intr(struct intsrc *isrc); -static int xen_intr_pirq_config_intr(struct intsrc *isrc, - enum intr_trigger trig, enum intr_polarity pol); - /** * PIC interface for all event channel port types except physical IRQs. */ @@ -174,30 +163,9 @@ struct pic xen_intr_pic = { .pic_assign_cpu = xen_intr_assign_cpu }; -/** - * PIC interface for all event channel representing - * physical interrupt sources. - */ -struct pic xen_intr_pirq_pic = { -#ifdef __amd64__ - .pic_register_sources = xenpv_register_pirqs, -#endif - .pic_enable_source = xen_intr_pirq_enable_source, - .pic_disable_source = xen_intr_pirq_disable_source, - .pic_eoi_source = xen_intr_pirq_eoi_source, - .pic_enable_intr = xen_intr_pirq_enable_intr, - .pic_disable_intr = xen_intr_pirq_disable_intr, - .pic_vector = xen_intr_vector, - .pic_source_pending = xen_intr_source_pending, - .pic_config_intr = xen_intr_pirq_config_intr, - .pic_assign_cpu = xen_intr_assign_cpu -}; - static struct mtx xen_intr_isrc_lock; static u_int xen_intr_auto_vector_count; static struct xenisrc *xen_intr_port_to_isrc[NR_EVENT_CHANNELS]; -static u_long *xen_intr_pirq_eoi_map; -static boolean_t xen_intr_pirq_eoi_map_enabled; /*------------------------- Private Functions --------------------------------*/ /** @@ -305,10 +273,11 @@ xen_intr_find_unused_isrc(enum evtchn_type type) * object or NULL. */ static struct xenisrc * -xen_intr_alloc_isrc(enum evtchn_type type, int vector) +xen_intr_alloc_isrc(enum evtchn_type type) { static int warned; struct xenisrc *isrc; + unsigned int vector; KASSERT(mtx_owned(&xen_intr_isrc_lock), ("Evtchn alloc lock not held")); @@ -320,18 +289,15 @@ xen_intr_alloc_isrc(enum evtchn_type type, int vector) return (NULL); } - if (type != EVTCHN_TYPE_PIRQ) { - vector = first_evtchn_irq + xen_intr_auto_vector_count; - xen_intr_auto_vector_count++; - } + vector = first_evtchn_irq + xen_intr_auto_vector_count; + xen_intr_auto_vector_count++; KASSERT((intr_lookup_source(vector) == NULL), ("Trying to use an already allocated vector")); mtx_unlock(&xen_intr_isrc_lock); isrc = malloc(sizeof(*isrc), M_XENINTR, M_WAITOK | M_ZERO); - isrc->xi_intsrc.is_pic = - (type == EVTCHN_TYPE_PIRQ) ? &xen_intr_pirq_pic : &xen_intr_pic; + isrc->xi_intsrc.is_pic = &xen_intr_pic; isrc->xi_vector = vector; isrc->xi_type = type; intr_register_source(&isrc->xi_intsrc); @@ -416,7 +382,7 @@ xen_intr_bind_isrc(struct xenisrc **isrcp, evtchn_port_t local_port, mtx_lock(&xen_intr_isrc_lock); isrc = xen_intr_find_unused_isrc(type); if (isrc == NULL) { - isrc = xen_intr_alloc_isrc(type, XEN_ALLOCATE_VECTOR); + isrc = xen_intr_alloc_isrc(type); if (isrc == NULL) { mtx_unlock(&xen_intr_isrc_lock); return (ENOSPC); @@ -632,8 +598,7 @@ xen_intr_init(void *dummy __unused) { shared_info_t *s = HYPERVISOR_shared_info; struct xen_intr_pcpu_data *pcpu; - struct physdev_pirq_eoi_gmfn eoi_gmfn; - int i, rc; + int i; if (!xen_domain()) return (0); @@ -653,18 +618,7 @@ xen_intr_init(void *dummy __unused) for (i = 0; i < nitems(s->evtchn_mask); i++) atomic_store_rel_long(&s->evtchn_mask[i], ~0); - /* Try to register PIRQ EOI map */ - xen_intr_pirq_eoi_map = malloc(PAGE_SIZE, M_XENINTR, M_WAITOK | M_ZERO); - eoi_gmfn.gmfn = atop(vtophys(xen_intr_pirq_eoi_map)); - rc = HYPERVISOR_physdev_op(PHYSDEVOP_pirq_eoi_gmfn_v2, &eoi_gmfn); - if (rc != 0 && bootverbose) - printf("Xen interrupts: unable to register PIRQ EOI map\n"); - else - xen_intr_pirq_eoi_map_enabled = true; - intr_register_pic(&xen_intr_pic); - if (xen_pv_domain() && xen_initial_domain()) - intr_register_pic(&xen_intr_pirq_pic); if (bootverbose) printf("Xen interrupt system initialized\n"); @@ -1020,184 +974,6 @@ xen_intr_enable_intr(struct intsrc *base_isrc) evtchn_unmask_port(isrc->xi_port); } -/*------------------ Physical Interrupt Source PIC Functions -----------------*/ -/* - * Mask a level triggered interrupt source. - * - * \param isrc The interrupt source to mask (if necessary). - * \param eoi If non-zero, perform any necessary end-of-interrupt - * acknowledgements. - */ -static void -xen_intr_pirq_disable_source(struct intsrc *base_isrc, int eoi) -{ - struct xenisrc *isrc; - - isrc = (struct xenisrc *)base_isrc; - - if (isrc->xi_edgetrigger == 0) - evtchn_mask_port(isrc->xi_port); - if (eoi == PIC_EOI) - xen_intr_pirq_eoi_source(base_isrc); -} - -/* - * Unmask a level triggered interrupt source. - * - * \param isrc The interrupt source to unmask (if necessary). - */ -static void -xen_intr_pirq_enable_source(struct intsrc *base_isrc) -{ - struct xenisrc *isrc; - - isrc = (struct xenisrc *)base_isrc; - - if (isrc->xi_edgetrigger == 0) - evtchn_unmask_port(isrc->xi_port); -} - -/* - * Perform any necessary end-of-interrupt acknowledgements. - * - * \param isrc The interrupt source to EOI. - */ -static void -xen_intr_pirq_eoi_source(struct intsrc *base_isrc) -{ - struct xenisrc *isrc; - int error; - - isrc = (struct xenisrc *)base_isrc; - - if (xen_test_bit(isrc->xi_pirq, xen_intr_pirq_eoi_map)) { - struct physdev_eoi eoi = { .irq = isrc->xi_pirq }; - - error = HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi); - if (error != 0) - panic("Unable to EOI PIRQ#%d: %d\n", - isrc->xi_pirq, error); - } -} - -/* *** 817 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Mon May 17 09:43:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 20611641DE8; Mon, 17 May 2021 09:43: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 4FkDhT0HDrz3j8T; Mon, 17 May 2021 09:43: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 E75841AB5; Mon, 17 May 2021 09:43: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 14H9h4u5030617; Mon, 17 May 2021 09:43:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14H9h4Vh030616; Mon, 17 May 2021 09:43:04 GMT (envelope-from git) Date: Mon, 17 May 2021 09:43:04 GMT Message-Id: <202105170943.14H9h4Vh030616@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?B?Um9nZXIgUGF1IE1vbm7DqQ==?= Subject: git: 2117a66af54f - main - xen: remove hypervisor_info MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2117a66af54f63cc474b4358bbb6967267e452cb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 09:43:05 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=2117a66af54f63cc474b4358bbb6967267e452cb commit 2117a66af54f63cc474b4358bbb6967267e452cb Author: Mitchell Horne AuthorDate: 2021-05-06 21:16:10 +0000 Commit: Roger Pau Monné CommitDate: 2021-05-17 08:56:52 +0000 xen: remove hypervisor_info This was a source of indirection needed to support PVHv1. Now that that support has been removed, we can eliminate it. Reviewed by: royger --- sys/x86/xen/hvm.c | 44 -------------------------------------------- sys/xen/xen-os.h | 27 ++++++--------------------- 2 files changed, 6 insertions(+), 65 deletions(-) diff --git a/sys/x86/xen/hvm.c b/sys/x86/xen/hvm.c index 9b5b588234c4..569b113364b1 100644 --- a/sys/x86/xen/hvm.c +++ b/sys/x86/xen/hvm.c @@ -489,47 +489,3 @@ xen_hvm_cpu_init(void) DPCPU_SET(vcpu_info, vcpu_info); } SYSINIT(xen_hvm_cpu_init, SI_SUB_INTR, SI_ORDER_FIRST, xen_hvm_cpu_init, NULL); - -/* HVM/PVH start_info accessors */ -static vm_paddr_t -hvm_get_xenstore_mfn(void) -{ - - return (hvm_get_parameter(HVM_PARAM_STORE_PFN)); -} - -static evtchn_port_t -hvm_get_xenstore_evtchn(void) -{ - - return (hvm_get_parameter(HVM_PARAM_STORE_EVTCHN)); -} - -static vm_paddr_t -hvm_get_console_mfn(void) -{ - - return (hvm_get_parameter(HVM_PARAM_CONSOLE_PFN)); -} - -static evtchn_port_t -hvm_get_console_evtchn(void) -{ - - return (hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN)); -} - -static uint32_t -hvm_get_start_flags(void) -{ - - return (hvm_start_flags); -} - -struct hypervisor_info hypervisor_info = { - .get_xenstore_mfn = hvm_get_xenstore_mfn, - .get_xenstore_evtchn = hvm_get_xenstore_evtchn, - .get_console_mfn = hvm_get_console_mfn, - .get_console_evtchn = hvm_get_console_evtchn, - .get_start_flags = hvm_get_start_flags, -}; diff --git a/sys/xen/xen-os.h b/sys/xen/xen-os.h index 874c3b71b861..cd8a53aab54f 100644 --- a/sys/xen/xen-os.h +++ b/sys/xen/xen-os.h @@ -43,50 +43,35 @@ #include #ifndef __ASSEMBLY__ +#include #include -struct hypervisor_info { - vm_paddr_t (*get_xenstore_mfn)(void); - evtchn_port_t (*get_xenstore_evtchn)(void); - vm_paddr_t (*get_console_mfn)(void); - evtchn_port_t (*get_console_evtchn)(void); - uint32_t (*get_start_flags)(void); -}; -extern struct hypervisor_info hypervisor_info; - static inline vm_paddr_t xen_get_xenstore_mfn(void) { - return (hypervisor_info.get_xenstore_mfn()); + return (hvm_get_parameter(HVM_PARAM_STORE_PFN)); } static inline evtchn_port_t xen_get_xenstore_evtchn(void) { - return (hypervisor_info.get_xenstore_evtchn()); + return (hvm_get_parameter(HVM_PARAM_STORE_EVTCHN)); } static inline vm_paddr_t xen_get_console_mfn(void) { - return (hypervisor_info.get_console_mfn()); + return (hvm_get_parameter(HVM_PARAM_CONSOLE_PFN)); } static inline evtchn_port_t xen_get_console_evtchn(void) { - return (hypervisor_info.get_console_evtchn()); -} - -static inline uint32_t -xen_get_start_flags(void) -{ - - return (hypervisor_info.get_start_flags()); + return (hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN)); } #endif @@ -132,7 +117,7 @@ static inline bool xen_initial_domain(void) { - return (xen_domain() && (xen_get_start_flags() & SIF_INITDOMAIN) != 0); + return (xen_domain() && (hvm_start_flags & SIF_INITDOMAIN) != 0); } /* From owner-dev-commits-src-all@freebsd.org Mon May 17 10:00:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Mon May 17 10:00:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Mon May 17 13:32:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Mon May 17 13:33:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Mon May 17 13:47:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CDDBD648974; Mon, 17 May 2021 13:47: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 4FkL6y595tz3Bv7; Mon, 17 May 2021 13:47: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 95D125215; Mon, 17 May 2021 13:47: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 14HDlsXx051552; Mon, 17 May 2021 13:47:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14HDlsX6051551; Mon, 17 May 2021 13:47:54 GMT (envelope-from git) Date: Mon, 17 May 2021 13:47:54 GMT Message-Id: <202105171347.14HDlsX6051551@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 9aad27931e61 - main - powerpc64/radix mmu: Remove dead variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9aad27931e61b7b418bb71a1e83e206ef549df22 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 13:47:54 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=9aad27931e61b7b418bb71a1e83e206ef549df22 commit 9aad27931e61b7b418bb71a1e83e206ef549df22 Author: Justin Hibbits AuthorDate: 2021-05-10 00:37:42 +0000 Commit: Justin Hibbits CommitDate: 2021-05-17 13:26:39 +0000 powerpc64/radix mmu: Remove dead variable Remove dead variable from mmu_radix_extract_and_hold(). Based on r352408 for amd64. --- sys/powerpc/aim/mmu_radix.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index 01fcc94bafb5..6ab2edf17dd9 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -3456,10 +3456,8 @@ mmu_radix_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot) { pml3_entry_t l3e, *l3ep; pt_entry_t pte; - vm_paddr_t pa; vm_page_t m; - pa = 0; m = NULL; CTR4(KTR_PMAP, "%s(%p, %#x, %#x)", __func__, pmap, va, prot); PMAP_LOCK(pmap); From owner-dev-commits-src-all@freebsd.org Mon May 17 13:47:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 02BDF6484EC; Mon, 17 May 2021 13:47: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 4FkL6z6HfJz3Bp2; Mon, 17 May 2021 13:47: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 AE4704FF4; Mon, 17 May 2021 13:47: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 14HDltVM051580; Mon, 17 May 2021 13:47:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14HDltNE051579; Mon, 17 May 2021 13:47:55 GMT (envelope-from git) Date: Mon, 17 May 2021 13:47:55 GMT Message-Id: <202105171347.14HDltNE051579@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 7ed09a6778d3 - main - powerpc: Rework IPI message processing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7ed09a6778d3fdd5d0484c9a60f4aa48f7ffbb83 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 13:47:56 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=7ed09a6778d3fdd5d0484c9a60f4aa48f7ffbb83 commit 7ed09a6778d3fdd5d0484c9a60f4aa48f7ffbb83 Author: Justin Hibbits AuthorDate: 2021-04-27 00:10:41 +0000 Commit: Justin Hibbits CommitDate: 2021-05-17 13:26:40 +0000 powerpc: Rework IPI message processing Summary: There's no need to use a while loop in the IPI handler, the message list is cached once and processed. Instead, since the existing code calls ffs(), sort the handlers, and use a simple 'if' sequence. Reviewed By: nwhitehorn Differential Revision: https://reviews.freebsd.org/D30018 --- sys/powerpc/powerpc/mp_machdep.c | 68 ++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 37 deletions(-) diff --git a/sys/powerpc/powerpc/mp_machdep.c b/sys/powerpc/powerpc/mp_machdep.c index a9f2aaf36adc..627cde77adbf 100644 --- a/sys/powerpc/powerpc/mp_machdep.c +++ b/sys/powerpc/powerpc/mp_machdep.c @@ -299,49 +299,43 @@ powerpc_ipi_handler(void *arg) { u_int cpuid; uint32_t ipimask; - int msg; CTR2(KTR_SMP, "%s: MSR 0x%08x", __func__, mfmsr()); ipimask = atomic_readandclear_32(&(pcpup->pc_ipimask)); if (ipimask == 0) return (FILTER_STRAY); - while ((msg = ffs(ipimask) - 1) != -1) { - ipimask &= ~(1u << msg); - switch (msg) { - case IPI_AST: - CTR1(KTR_SMP, "%s: IPI_AST", __func__); - break; - case IPI_PREEMPT: - CTR1(KTR_SMP, "%s: IPI_PREEMPT", __func__); - sched_preempt(curthread); - break; - case IPI_RENDEZVOUS: - CTR1(KTR_SMP, "%s: IPI_RENDEZVOUS", __func__); - smp_rendezvous_action(); - break; - case IPI_STOP: - - /* - * IPI_STOP_HARD is mapped to IPI_STOP so it is not - * necessary to add such case in the switch. - */ - CTR1(KTR_SMP, "%s: IPI_STOP or IPI_STOP_HARD (stop)", - __func__); - cpuid = PCPU_GET(cpuid); - savectx(&stoppcbs[cpuid]); - CPU_SET_ATOMIC(cpuid, &stopped_cpus); - while (!CPU_ISSET(cpuid, &started_cpus)) - cpu_spinwait(); - CPU_CLR_ATOMIC(cpuid, &stopped_cpus); - CPU_CLR_ATOMIC(cpuid, &started_cpus); - CTR1(KTR_SMP, "%s: IPI_STOP (restart)", __func__); - break; - case IPI_HARDCLOCK: - CTR1(KTR_SMP, "%s: IPI_HARDCLOCK", __func__); - hardclockintr(); - break; - } + if (ipimask & (1 << IPI_AST)) { + CTR1(KTR_SMP, "%s: IPI_AST", __func__); + } + if (ipimask & (1 << IPI_PREEMPT)) { + CTR1(KTR_SMP, "%s: IPI_PREEMPT", __func__); + sched_preempt(curthread); + } + if (ipimask & (1 << IPI_RENDEZVOUS)) { + CTR1(KTR_SMP, "%s: IPI_RENDEZVOUS", __func__); + smp_rendezvous_action(); + } + if (ipimask & (1 << IPI_STOP)) { + + /* + * IPI_STOP_HARD is mapped to IPI_STOP so it is not + * necessary to add such case. + */ + CTR1(KTR_SMP, "%s: IPI_STOP or IPI_STOP_HARD (stop)", + __func__); + cpuid = PCPU_GET(cpuid); + savectx(&stoppcbs[cpuid]); + CPU_SET_ATOMIC(cpuid, &stopped_cpus); + while (!CPU_ISSET(cpuid, &started_cpus)) + cpu_spinwait(); + CPU_CLR_ATOMIC(cpuid, &stopped_cpus); + CPU_CLR_ATOMIC(cpuid, &started_cpus); + CTR1(KTR_SMP, "%s: IPI_STOP (restart)", __func__); + } + if (ipimask & (1 << IPI_HARDCLOCK)) { + CTR1(KTR_SMP, "%s: IPI_HARDCLOCK", __func__); + hardclockintr(); } return (FILTER_HANDLED); From owner-dev-commits-src-all@freebsd.org Mon May 17 13:47:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4AA466487EF; Mon, 17 May 2021 13:47: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 4FkL7109kWz3C6X; Mon, 17 May 2021 13:47: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 DAC854FF5; Mon, 17 May 2021 13:47: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 14HDlucN051601; Mon, 17 May 2021 13:47:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14HDlumE051600; Mon, 17 May 2021 13:47:56 GMT (envelope-from git) Date: Mon, 17 May 2021 13:47:56 GMT Message-Id: <202105171347.14HDlumE051600@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: ffd21bd2892d - main - Make ISA_206_ATOMICS a kernel option MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ffd21bd2892df271a8a259b1d98ce81c8637facd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 13:47:57 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=ffd21bd2892df271a8a259b1d98ce81c8637facd commit ffd21bd2892df271a8a259b1d98ce81c8637facd Author: Justin Hibbits AuthorDate: 2021-05-17 13:46:33 +0000 Commit: Justin Hibbits CommitDate: 2021-05-17 13:46:38 +0000 Make ISA_206_ATOMICS a kernel option Summary: To make it easier to build a kernel with PowerISA 2.06 atomics (sub-word atomics), add a kernel config option. User space still needs to specify it as a CFLAG but that seems easier to do than for the kernel config. Reviewed By: luporl Differential Revision: https://reviews.freebsd.org/D29809 --- sys/conf/options.powerpc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/conf/options.powerpc b/sys/conf/options.powerpc index 857fa8091f4a..463c2b9da8c7 100644 --- a/sys/conf/options.powerpc +++ b/sys/conf/options.powerpc @@ -15,6 +15,8 @@ FPU_EMU COMPAT_FREEBSD32 opt_global.h +ISA_206_ATOMICS opt_global.h + MOEA64_STATS opt_pmap.h AMIGAONE opt_platform.h MIKROTIK opt_platform.h From owner-dev-commits-src-all@freebsd.org Mon May 17 13:47:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 721926487F0; Mon, 17 May 2021 13:47: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 4FkL7217Vpz3C52; Mon, 17 May 2021 13:47: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 02E4E5216; Mon, 17 May 2021 13:47: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 14HDlvel051626; Mon, 17 May 2021 13:47:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14HDlvhx051625; Mon, 17 May 2021 13:47:57 GMT (envelope-from git) Date: Mon, 17 May 2021 13:47:57 GMT Message-Id: <202105171347.14HDlvhx051625@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: b2ee069e8cf7 - main - Fix locking in qoriq_gpio MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b2ee069e8cf73ea91388dbbc9061af01109c774a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 13:47:58 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=b2ee069e8cf73ea91388dbbc9061af01109c774a commit b2ee069e8cf73ea91388dbbc9061af01109c774a Author: Justin Hibbits AuthorDate: 2021-05-17 13:22:30 +0000 Commit: Justin Hibbits CommitDate: 2021-05-17 13:46:45 +0000 Fix locking in qoriq_gpio qoriq_gpio_pin_setflags() locks the device mutex, as does qoriq_gpio_map_gpios(), causing a recursion on non-recursive lock. This was missed during testing for 16e549ebe. --- sys/dev/gpio/qoriq_gpio.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/sys/dev/gpio/qoriq_gpio.c b/sys/dev/gpio/qoriq_gpio.c index 82bd6cd9a72b..dc4813e07b8e 100644 --- a/sys/dev/gpio/qoriq_gpio.c +++ b/sys/dev/gpio/qoriq_gpio.c @@ -131,23 +131,15 @@ qoriq_gpio_pin_getname(device_t dev, uint32_t pin, char *name) return (0); } -/* Set flags for the pin. */ static int -qoriq_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) +qoriq_gpio_pin_configure(device_t dev, uint32_t pin, uint32_t flags) { - struct qoriq_gpio_softc *sc = device_get_softc(dev); + struct qoriq_gpio_softc *sc; uint32_t reg; - if (!VALID_PIN(pin)) - return (EINVAL); - - if ((flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) == - (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) - return (EINVAL); + sc = device_get_softc(dev); - GPIO_LOCK(sc); if ((flags & sc->sc_pins[pin].gp_caps) != flags) { - GPIO_UNLOCK(sc); return (EINVAL); } @@ -168,6 +160,26 @@ qoriq_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) bus_write_4(sc->sc_mem, GPIO_GPODR, reg); } sc->sc_pins[pin].gp_flags = flags; + + return (0); +} + +/* Set flags for the pin. */ +static int +qoriq_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) +{ + struct qoriq_gpio_softc *sc = device_get_softc(dev); + uint32_t ret; + + if (!VALID_PIN(pin)) + return (EINVAL); + + if ((flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) == + (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) + return (EINVAL); + + GPIO_LOCK(sc); + ret = qoriq_gpio_pin_configure(dev, pin, flags); GPIO_UNLOCK(sc); return (0); } @@ -356,7 +368,7 @@ qoriq_gpio_map_gpios(device_t bus, phandle_t dev, phandle_t gparent, int gcells, sc = device_get_softc(bus); GPIO_LOCK(sc); - err = qoriq_gpio_pin_setflags(bus, gpios[0], gpios[1]); + err = qoriq_gpio_pin_configure(bus, gpios[0], gpios[1]); GPIO_UNLOCK(sc); if (err == 0) { From owner-dev-commits-src-all@freebsd.org Mon May 17 13:48:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7BEA6648D86; Mon, 17 May 2021 13:48: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 4FkL7R1zNJz3CB3; Mon, 17 May 2021 13:48: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 2D97C531C; Mon, 17 May 2021 13:48: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 14HDmJJb051825; Mon, 17 May 2021 13:48:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14HDmJwE051824; Mon, 17 May 2021 13:48:19 GMT (envelope-from git) Date: Mon, 17 May 2021 13:48:19 GMT Message-Id: <202105171348.14HDmJwE051824@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: d69cc0401472 - main - pf: Set the pfik_group for userspace 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/main X-Git-Reftype: branch X-Git-Commit: d69cc040147284c414dfd1c9f498dcc7c8291a8b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 13:48:19 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d69cc040147284c414dfd1c9f498dcc7c8291a8b commit d69cc040147284c414dfd1c9f498dcc7c8291a8b Author: Kristof Provost AuthorDate: 2021-05-16 06:50:17 +0000 Commit: Kristof Provost CommitDate: 2021-05-17 11:48:06 +0000 pf: Set the pfik_group for userspace Userspace relies on this pointer to work out if the kif is a group or not. It can't use it for anything else, because it's a pointer to a kernel address. Substitute 0xfeedc0de for 'true', so that we don't leak kernel memory addresses to userspace. PR: 255852 Reviewed by: donner MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30284 --- sys/netpfil/pf/pf_if.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index 4630098221c8..3c9b53daa28c 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -831,6 +831,14 @@ pf_kkif_to_kif(const struct pfi_kkif *kkif, struct pfi_kif *kif) kif->pfik_flags = kkif->pfik_flags; kif->pfik_tzero = kkif->pfik_tzero; kif->pfik_rulerefs = kkif->pfik_rulerefs; + /* + * Userspace relies on this pointer to decide if this is a group or + * not. We don't want to share the actual pointer, because it's + * useless to userspace and leaks kernel memory layout information. + * So instead we provide 0xfeedcode as 'true' and NULL as 'false'. + */ + kif->pfik_group = + kkif->pfik_group ? (struct ifg_group *)0xfeedc0de : NULL; } void From owner-dev-commits-src-all@freebsd.org Mon May 17 13:48:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 90E78648C17; Mon, 17 May 2021 13:48: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 4FkL7S3X04z3CCj; Mon, 17 May 2021 13:48: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 5C86E510A; Mon, 17 May 2021 13:48:20 +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 14HDmKil051848; Mon, 17 May 2021 13:48:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14HDmKn2051847; Mon, 17 May 2021 13:48:20 GMT (envelope-from git) Date: Mon, 17 May 2021 13:48:20 GMT Message-Id: <202105171348.14HDmKn2051847@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 45db38554517 - main - pf tests: More set skip on tests 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/main X-Git-Reftype: branch X-Git-Commit: 45db38554517c7e1b0cc0265113c22f92a0eb494 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 13:48:20 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=45db38554517c7e1b0cc0265113c22f92a0eb494 commit 45db38554517c7e1b0cc0265113c22f92a0eb494 Author: Kristof Provost AuthorDate: 2021-05-16 06:51:54 +0000 Commit: Kristof Provost CommitDate: 2021-05-17 11:48:06 +0000 pf tests: More set skip on tests Test the specific case reported in PR 255852. Clearing the skip flag on groups was broken because pfctl couldn't work out if a kif was a group or not, because the kernel no longer set the pfik_group pointer. PR: 255852 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30285 --- tests/sys/netpfil/pf/set_skip.sh | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tests/sys/netpfil/pf/set_skip.sh b/tests/sys/netpfil/pf/set_skip.sh index 95c6b6f77825..ce7b1900ae00 100644 --- a/tests/sys/netpfil/pf/set_skip.sh +++ b/tests/sys/netpfil/pf/set_skip.sh @@ -117,9 +117,55 @@ set_skip_dynamic_cleanup() pft_cleanup } +atf_test_case "pr255852" "cleanup" +pr255852_head() +{ + atf_set descr "PR 255852" + atf_set require.user root +} + +pr255852_body() +{ + pft_init + + epair=$(vnet_mkepair) + + ifconfig ${epair}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig lo0 127.0.0.1/8 up + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + jexec alcatraz pfctl -e + pft_set_rules alcatraz "set skip on { lo0, epair }" \ + "block" + jexec alcatraz pfctl -vsI + + # We're skipping on epair, so this should work + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # Note: flushing avoid the issue + pft_set_rules noflush alcatraz "set skip on { lo0 }" \ + "block" + + jexec alcatraz pfctl -vsI + + # No longer skipping, so this should fail + atf_check -s exit:2 -o ignore ping -c 1 -t 1 192.0.2.2 +} + +pr255852_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "set_skip_group" atf_add_test_case "set_skip_group_lo" atf_add_test_case "set_skip_dynamic" + atf_add_test_case "pr255852" } From owner-dev-commits-src-all@freebsd.org Mon May 17 15:05:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6B38D64AEAC; Mon, 17 May 2021 15:05: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 4FkMrq2dLCz3kPL; Mon, 17 May 2021 15:05: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 41DFA604A; Mon, 17 May 2021 15:05: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 14HF5lY7059162; Mon, 17 May 2021 15:05:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14HF5lNN059161; Mon, 17 May 2021 15:05:47 GMT (envelope-from git) Date: Mon, 17 May 2021 15:05:47 GMT Message-Id: <202105171505.14HF5lNN059161@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 02c44f40f984 - main - dummynet: Remove unused code 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/main X-Git-Reftype: branch X-Git-Commit: 02c44f40f984951fe34a1c5a43f40ff8147c52ca Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 15:05:47 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=02c44f40f984951fe34a1c5a43f40ff8147c52ca commit 02c44f40f984951fe34a1c5a43f40ff8147c52ca Author: Kristof Provost AuthorDate: 2021-05-17 11:41:39 +0000 Commit: Kristof Provost CommitDate: 2021-05-17 13:03:55 +0000 dummynet: Remove unused code We never set 'busy' and never dequeue from the pending mq. Remove this code. Reviewed by: ae MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30313 --- sys/netpfil/ipfw/ip_dn_io.c | 8 -------- sys/netpfil/ipfw/ip_dn_private.h | 7 ------- 2 files changed, 15 deletions(-) diff --git a/sys/netpfil/ipfw/ip_dn_io.c b/sys/netpfil/ipfw/ip_dn_io.c index b439d2679f3c..4a65bd0ef798 100644 --- a/sys/netpfil/ipfw/ip_dn_io.c +++ b/sys/netpfil/ipfw/ip_dn_io.c @@ -870,14 +870,6 @@ dummynet_io(struct mbuf **m0, struct ip_fw_args *fwa) /* we could actually tag outside the lock, but who cares... */ if (tag_mbuf(m, dir, fwa)) goto dropit; - if (dn_cfg.busy) { - /* if the upper half is busy doing something expensive, - * lets queue the packet and move forward - */ - mq_append(&dn_cfg.pending, m); - m = *m0 = NULL; /* consumed */ - goto done; /* already active, nothing to do */ - } /* XXX locate_flowset could be optimised with a direct ref. */ fs = dn_ht_find(dn_cfg.fshash, fs_id, 0, NULL); if (fs == NULL) diff --git a/sys/netpfil/ipfw/ip_dn_private.h b/sys/netpfil/ipfw/ip_dn_private.h index 6e48bc5116a7..e6e699bf35b2 100644 --- a/sys/netpfil/ipfw/ip_dn_private.h +++ b/sys/netpfil/ipfw/ip_dn_private.h @@ -171,13 +171,6 @@ struct dn_parms { int init_done; - /* if the upper half is busy doing something long, - * can set the busy flag and we will enqueue packets in - * a queue for later processing. - */ - int busy; - struct mq pending; - #ifdef _KERNEL /* * This file is normally used in the kernel, unless we do From owner-dev-commits-src-all@freebsd.org Mon May 17 17:06:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3B6F164DA46; Mon, 17 May 2021 17:06: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 4FkQXX1BYSz4cc5; Mon, 17 May 2021 17:06: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 11FCF7E12; Mon, 17 May 2021 17:06: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 14HH6ptl021362; Mon, 17 May 2021 17:06:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14HH6paS021361; Mon, 17 May 2021 17:06:51 GMT (envelope-from git) Date: Mon, 17 May 2021 17:06:51 GMT Message-Id: <202105171706.14HH6paS021361@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4224dbf4c7c4 - main - xen: Remove leftover bits missed in commit ac3ede5371 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/main X-Git-Reftype: branch X-Git-Commit: 4224dbf4c7c497130150eafb0442f5306389e068 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 17:06:52 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4224dbf4c7c497130150eafb0442f5306389e068 commit 4224dbf4c7c497130150eafb0442f5306389e068 Author: Mark Johnston AuthorDate: 2021-05-17 17:05:58 +0000 Commit: Mark Johnston CommitDate: 2021-05-17 17:06:44 +0000 xen: Remove leftover bits missed in commit ac3ede5371 Fixes: ac3ede5371 ("x86/xen: remove PVHv1 code") Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D30316 --- sys/x86/xen/pv.c | 69 -------------------------------------------------------- 1 file changed, 69 deletions(-) diff --git a/sys/x86/xen/pv.c b/sys/x86/xen/pv.c index c6dfff511c0c..254ca4002bda 100644 --- a/sys/x86/xen/pv.c +++ b/sys/x86/xen/pv.c @@ -95,10 +95,6 @@ uint64_t hammer_time_xen(vm_paddr_t); static caddr_t xen_pvh_parse_preload_data(uint64_t); static void xen_pvh_parse_memmap(caddr_t, vm_paddr_t *, int *); -#ifdef SMP -static int xen_pv_start_all_aps(void); -#endif - /*---------------------------- Extern Declarations ---------------------------*/ #ifdef SMP /* Variables used by amd64 mp_machdep to start APs */ @@ -208,71 +204,6 @@ hammer_time_xen(vm_paddr_t start_info_paddr) } /*-------------------------------- PV specific -------------------------------*/ -#ifdef SMP -static bool -start_xen_ap(int cpu) -{ - struct vcpu_guest_context *ctxt; - int ms, cpus = mp_naps; - const size_t stacksize = kstack_pages * PAGE_SIZE; - - /* allocate and set up an idle stack data page */ - bootstacks[cpu] = (void *)kmem_malloc(stacksize, M_WAITOK | M_ZERO); - doublefault_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | M_ZERO); - mce_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | M_ZERO); - nmi_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | M_ZERO); - dbg_stack = (void *)kmem_malloc(PAGE_SIZE, M_WAITOK | M_ZERO); - dpcpu = (void *)kmem_malloc(DPCPU_SIZE, M_WAITOK | M_ZERO); - - bootSTK = (char *)bootstacks[cpu] + kstack_pages * PAGE_SIZE - 8; - bootAP = cpu; - - ctxt = malloc(sizeof(*ctxt), M_TEMP, M_WAITOK | M_ZERO); - - ctxt->flags = VGCF_IN_KERNEL; - ctxt->user_regs.rip = (unsigned long) init_secondary; - ctxt->user_regs.rsp = (unsigned long) bootSTK; - - /* Set the AP to use the same page tables */ - ctxt->ctrlreg[3] = KPML4phys; - - if (HYPERVISOR_vcpu_op(VCPUOP_initialise, cpu, ctxt)) - panic("unable to initialize AP#%d", cpu); - - free(ctxt, M_TEMP); - - /* Launch the vCPU */ - if (HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL)) - panic("unable to start AP#%d", cpu); - - /* Wait up to 5 seconds for it to start. */ - for (ms = 0; ms < 5000; ms++) { - if (mp_naps > cpus) - return (true); - DELAY(1000); - } - - return (false); -} - -static int -xen_pv_start_all_aps(void) -{ - int cpu; - - mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); - - for (cpu = 1; cpu < mp_ncpus; cpu++) { - /* attempt to start the Application Processor */ - if (!start_xen_ap(cpu)) - panic("AP #%d failed to start!", cpu); - - CPU_SET(cpu, &all_cpus); /* record AP in CPU map */ - } - - return (mp_naps); -} -#endif /* SMP */ /* * When booted as a PVH guest FreeBSD needs to avoid using the RSDP address From owner-dev-commits-src-all@freebsd.org Mon May 17 17:49:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Mon May 17 21:26:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 83E0E6339AF; Mon, 17 May 2021 21:26: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 4FkXHn3Htzz3vy6; Mon, 17 May 2021 21:26: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 556421367B; Mon, 17 May 2021 21:26: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 14HLQDDB067704; Mon, 17 May 2021 21:26:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14HLQDM2067703; Mon, 17 May 2021 21:26:13 GMT (envelope-from git) Date: Mon, 17 May 2021 21:26:13 GMT Message-Id: <202105172126.14HLQDM2067703@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eugene Grosbein Subject: git: f5b5de1a3210 - main - ipfw: reload sysctl.conf variables if needed 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/main X-Git-Reftype: branch X-Git-Commit: f5b5de1a3210234f3a6864c88a2d3e11ac2dbf04 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 21:26:13 -0000 The branch main has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=f5b5de1a3210234f3a6864c88a2d3e11ac2dbf04 commit f5b5de1a3210234f3a6864c88a2d3e11ac2dbf04 Author: Eugene Grosbein AuthorDate: 2021-05-17 21:03:15 +0000 Commit: Eugene Grosbein CommitDate: 2021-05-17 21:03:15 +0000 ipfw: reload sysctl.conf variables if needed Currently ipfw has multiple components that are not parts of GENERIC kernel like dummynet etc. They can bring in important sysctls if enabled with rc.conf(5) and loaded with ipfw startup script by means of "required_modules" after initial consult with /etc/sysctl.conf at boot time. Here is an example of one increasing limit for dummynet hold queues that defaults to 100: net.inet.ip.dummynet.pipe_slot_limit=1000 This makes it possible to use ipfw/dummynet rules such as: ipfw pipe 1 config bw 50Mbit/s queue 1000 Such rule is rejected unless above sysctl is applied. Another example is a group of net.inet.ip.alias.* sysctls created after libalias.ko loaded as dependency of ipfw_nat. This is not a problem if corresponding code compiled in custom kernel so sysctls exist when sysctl.conf is read early or kernel modules loaded with a loader. This change makes it work also for GENERIC and modules loaded by means of rc.conf(5) settings. MFC after: 1 month --- libexec/rc/rc.d/ipfw | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/ipfw b/libexec/rc/rc.d/ipfw index fd1c97671d70..22b65d2908cb 100755 --- a/libexec/rc/rc.d/ipfw +++ b/libexec/rc/rc.d/ipfw @@ -47,7 +47,7 @@ ipfw_prestart() ipfw_start() { - local _firewall_type + local _firewall_type _module _sysctl_reload if [ -n "${1}" ]; then _firewall_type=$1 @@ -55,6 +55,19 @@ ipfw_start() _firewall_type=${firewall_type} fi + _sysctl_reload=no + for _module in ${required_modules} + do + if kldstat -qn ${_module}; then + _sysctl_reload=yes + break + fi + done + + if [ ${_sysctl_reload} = yes ]; then + /etc/rc.d/sysctl reload + fi + # set the firewall rules script if none was specified [ -z "${firewall_script}" ] && firewall_script=/etc/rc.firewall From owner-dev-commits-src-all@freebsd.org Mon May 17 23:30:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 849F0635D46; Mon, 17 May 2021 23:30: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 4Fkb3g3KXMz4mS6; Mon, 17 May 2021 23:30: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 5AC1114E77; Mon, 17 May 2021 23:30: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 14HNUtIS037274; Mon, 17 May 2021 23:30:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14HNUtfT037273; Mon, 17 May 2021 23:30:55 GMT (envelope-from git) Date: Mon, 17 May 2021 23:30:55 GMT Message-Id: <202105172330.14HNUtfT037273@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: efe145a7453e - main - 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/main X-Git-Reftype: branch X-Git-Commit: efe145a7453e4208f032816ce3f80e9fb6b0e4ee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 23:30:55 -0000 The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=efe145a7453e4208f032816ce3f80e9fb6b0e4ee commit efe145a7453e4208f032816ce3f80e9fb6b0e4ee Author: Kirk McKusick AuthorDate: 2021-05-17 23:33:59 +0000 Commit: Kirk McKusick CommitDate: 2021-05-17 23:34:53 +0000 Correct assert added to dump program. The dump program was exiting with the message: Assertion failed: (spcl.c_count + blks < TP_NINDIR), function appendextdata, file /usr/src/sbin/dump/traverse.c, line 759. The problem arose when dumping external attributes. This assertion was added in this commit with no review by someone with expertise in the dump program: commit 2d518c6518cdb256ff6f2c463e6b115d89c104c3 Author: Warner Losh AuthorDate: Mon Jun 11 19:32:36 2018 +0000 Commit: Warner Losh CommitDate: Mon Jun 11 19:32:36 2018 +0000 Add asserts to prevent overflows of c_addr. It is clearly wrong as the statement immediately above it in the code which is deciding if the data will fit is: if (spcl.c_count + blks > TP_NINDIR) return (0); As is pointed out in the bug report, the assert should be: (spcl.c_count + blks <= TP_NINDIR) This commit corrects the assert. I am sorry that it took so long to be brought to my attention and get fixed. Reported by: Hampton Finger PR: 244470 MFC after: 3 days Sponsored by: Netflix --- 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-all@freebsd.org Tue May 18 00:06:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 08CE5636E5F; Tue, 18 May 2021 00:06: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 4FkbrH6rwwz4t3F; Tue, 18 May 2021 00:06:07 +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 D00D3153CF; Tue, 18 May 2021 00:06:07 +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 14I067pB080744; Tue, 18 May 2021 00:06:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14I067uC080743; Tue, 18 May 2021 00:06:07 GMT (envelope-from git) Date: Tue, 18 May 2021 00:06:07 GMT Message-Id: <202105180006.14I067uC080743@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 8d2b4b2e7c1e - main - cxgbe: Cast pointer arguments to trunc_page() to vm_offset_t. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8d2b4b2e7c1e0b10c4d49963753db31c4794dbc4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 00:06:08 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8d2b4b2e7c1e0b10c4d49963753db31c4794dbc4 commit 8d2b4b2e7c1e0b10c4d49963753db31c4794dbc4 Author: John Baldwin AuthorDate: 2021-05-18 00:04:22 +0000 Commit: John Baldwin CommitDate: 2021-05-18 00:04:22 +0000 cxgbe: Cast pointer arguments to trunc_page() to vm_offset_t. Reported by: mjg, jenkins, rmacklem Fixes: 46bee8043ee2bd352d420cd573e0364ca45f813e Sponsored by: Chelsio Communications --- sys/dev/cxgbe/tom/t4_ddp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_ddp.c b/sys/dev/cxgbe/tom/t4_ddp.c index c266a2e39fa9..34c01674659a 100644 --- a/sys/dev/cxgbe/tom/t4_ddp.c +++ b/sys/dev/cxgbe/tom/t4_ddp.c @@ -1042,7 +1042,7 @@ have_pgsz: npages = 0; while (entries--) { npages++; - start_pva = trunc_page(sgl->addr); + start_pva = trunc_page((vm_offset_t)sgl->addr); end_pva = trunc_page((vm_offset_t)sgl->addr + sgl->len - 1); npages += (end_pva - start_pva) >> pr->pr_page_shift[idx]; sgl = sgl + 1; @@ -1297,7 +1297,7 @@ t4_write_page_pods_for_sgl(struct adapter *sc, struct toepcb *toep, ddp_pgsz = 1 << pr->pr_page_shift[G_PPOD_PGSZ(prsv->prsv_tag)]; offset = (vm_offset_t)sgl->addr & PAGE_MASK; ppod_addr = pr->pr_start + (prsv->prsv_tag & pr->pr_tag_mask); - pva = trunc_page(sgl->addr); + pva = trunc_page((vm_offset_t)sgl->addr); mbufq_init(&wrq, INT_MAX); for (i = 0; i < prsv->prsv_nppods; ppod_addr += chunk) { From owner-dev-commits-src-all@freebsd.org Tue May 18 01:27:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Tue May 18 01:36:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Tue May 18 03:08:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D3DD463B978; Tue, 18 May 2021 03:08: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 4FkgtT5gdGz3wQW; Tue, 18 May 2021 03:08: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 AB11D17EA8; Tue, 18 May 2021 03:08: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 14I38HBJ021353; Tue, 18 May 2021 03:08:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14I38Hil021352; Tue, 18 May 2021 03:08:17 GMT (envelope-from git) Date: Tue, 18 May 2021 03:08:17 GMT Message-Id: <202105180308.14I38Hil021352@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 330f110bf1e4 - main - Fix 'hostuuid: preload data malformed' warning 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/main X-Git-Reftype: branch X-Git-Commit: 330f110bf1e420dc8d8ddadc4030e0ae1f1c52bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 03:08:17 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=330f110bf1e420dc8d8ddadc4030e0ae1f1c52bd commit 330f110bf1e420dc8d8ddadc4030e0ae1f1c52bd Author: Colin Percival AuthorDate: 2021-05-15 05:57:38 +0000 Commit: Colin Percival CommitDate: 2021-05-18 03:07:49 +0000 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 MFC after: 3 days --- sys/kern/kern_jail.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index b5c8f6ebf9be..f4cd6bd38d35 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -263,8 +263,8 @@ prison0_init(void) (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-all@freebsd.org Tue May 18 03:08:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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 05D6763BD4E; Tue, 18 May 2021 03:08: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 4FkgtV6cmrz3wQZ; Tue, 18 May 2021 03:08: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 CBF0D17DA3; Tue, 18 May 2021 03:08: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 14I38IDQ021374; Tue, 18 May 2021 03:08:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14I38ImZ021373; Tue, 18 May 2021 03:08:18 GMT (envelope-from git) Date: Tue, 18 May 2021 03:08:18 GMT Message-Id: <202105180308.14I38ImZ021373@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: b6be9566d236 - main - Fix buffer overflow in preloaded hostuuid cleaning 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/main X-Git-Reftype: branch X-Git-Commit: b6be9566d236f83ad1a44170a64b9a34e382eafa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 03:08:19 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=b6be9566d236f83ad1a44170a64b9a34e382eafa commit b6be9566d236f83ad1a44170a64b9a34e382eafa Author: Colin Percival AuthorDate: 2021-05-14 18:07:37 +0000 Commit: Colin Percival CommitDate: 2021-05-18 03:07:49 +0000 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 MFC after: 3 days --- sys/kern/kern_jail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index f4cd6bd38d35..303e31490eb1 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -257,7 +257,7 @@ 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, From owner-dev-commits-src-all@freebsd.org Tue May 18 06:04:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Tue May 18 06:11:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Tue May 18 06:15:29 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Tue May 18 07:43:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 77561642E61; Tue, 18 May 2021 07:43: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 4Fknzr2vhVz3nC6; Tue, 18 May 2021 07:43: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 4BFC31BBA3; Tue, 18 May 2021 07:43:20 +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 14I7hKPV091547; Tue, 18 May 2021 07:43:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14I7hKa1091546; Tue, 18 May 2021 07:43:20 GMT (envelope-from git) Date: Tue, 18 May 2021 07:43:20 GMT Message-Id: <202105180743.14I7hKa1091546@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: c232fd4b4191 - main - sndstat.4: Improve manpage wording MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c232fd4b4191a722f8c3193ef1e7c6efd8385182 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 07:43:20 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=c232fd4b4191a722f8c3193ef1e7c6efd8385182 commit c232fd4b4191a722f8c3193ef1e7c6efd8385182 Author: Goran Mekić AuthorDate: 2021-05-18 07:34:34 +0000 Commit: Ka Ho Ng CommitDate: 2021-05-18 07:40:28 +0000 sndstat.4: Improve manpage wording Reviewed by: bcr, khng Differential Revision: https://reviews.freebsd.org/D30027 --- share/man/man4/sndstat.4 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/share/man/man4/sndstat.4 b/share/man/man4/sndstat.4 index 26ecf9084dc1..92e17d86116a 100644 --- a/share/man/man4/sndstat.4 +++ b/share/man/man4/sndstat.4 @@ -47,10 +47,11 @@ kernel configuration file: .Sh DESCRIPTION The ioctl interface provided by .Pa /dev/sndstat -device allows callers to enumeration PCM audio devices available for use. +device allows callers to enumerate PCM audio devices available for use. +In other words, it provides means to get the list of all audio devices +available to the system. .Sh IOCTLS -For all ioctls requiring data exchange between the subsystem and callers, -the following structures are used to describe a serialized nvlist: +For ioctl calls that take an argument, the following structure is used: .Bd -literal -offset indent struct sndstioc_nv_arg { size_t nbytes; @@ -58,7 +59,7 @@ struct sndstioc_nv_arg { }; .Ed .Pp -Here is an example of an nvlist, with explanations of the common fields: +Here is an example of an nvlist object with explanations of the common fields: .Bd -literal -offset indent dsps (NVLIST ARRAY): 1 from_user (BOOL): FALSE From owner-dev-commits-src-all@freebsd.org Tue May 18 07:47:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Tue May 18 07:47:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Tue May 18 07:49:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Tue May 18 07:49:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Tue May 18 08:44:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 20FCE64534B; Tue, 18 May 2021 08:44: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 4FkqLw0C6Fz4Txb; Tue, 18 May 2021 08:44: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 E38971C4D2; Tue, 18 May 2021 08:44: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 14I8it8p071664; Tue, 18 May 2021 08:44:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14I8it5X071663; Tue, 18 May 2021 08:44:55 GMT (envelope-from git) Date: Tue, 18 May 2021 08:44:55 GMT Message-Id: <202105180844.14I8it5X071663@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?B?Um9nZXIgUGF1IE1vbm7DqQ==?= Subject: git: 9e14ac116e70 - main - x86/xen: further PVHv1 removal cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9e14ac116e70722b7fcc803736184535295b165d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 08:44:56 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=9e14ac116e70722b7fcc803736184535295b165d commit 9e14ac116e70722b7fcc803736184535295b165d Author: Roger Pau Monné AuthorDate: 2021-05-18 08:43:19 +0000 Commit: Roger Pau Monné CommitDate: 2021-05-18 08:43:31 +0000 x86/xen: further PVHv1 removal cleanup The AP startup extern variable declarations are not longer needed, since PVHv2 uses the native AP startup path using the lapic. Remove the declaration and make the variables static to mp_machdep.c Sponsored by: Citrix Systems R&D --- sys/amd64/amd64/mp_machdep.c | 8 ++++---- sys/x86/xen/pv.c | 8 -------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 6f788c087f06..1513393a4387 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -99,10 +99,10 @@ __FBSDID("$FreeBSD$"); #define AP_BOOTPT_SZ (PAGE_SIZE * 4) /* Temporary variables for init_secondary() */ -char *doublefault_stack; -char *mce_stack; -char *nmi_stack; -char *dbg_stack; +static char *doublefault_stack; +static char *mce_stack; +static char *nmi_stack; +static char *dbg_stack; extern u_int mptramp_la57; diff --git a/sys/x86/xen/pv.c b/sys/x86/xen/pv.c index 254ca4002bda..6e1bba691171 100644 --- a/sys/x86/xen/pv.c +++ b/sys/x86/xen/pv.c @@ -96,14 +96,6 @@ static caddr_t xen_pvh_parse_preload_data(uint64_t); static void xen_pvh_parse_memmap(caddr_t, vm_paddr_t *, int *); /*---------------------------- Extern Declarations ---------------------------*/ -#ifdef SMP -/* Variables used by amd64 mp_machdep to start APs */ -extern char *doublefault_stack; -extern char *mce_stack; -extern char *nmi_stack; -extern char *dbg_stack; -#endif - /* * Placed by the linker at the end of the bss section, which is the last * section loaded by Xen before loading the symtab and strtab. From owner-dev-commits-src-all@freebsd.org Tue May 18 12:18:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Tue May 18 12:18:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Tue May 18 12:18:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Tue May 18 12:18:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Tue May 18 12:18:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Tue May 18 12:18:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Tue May 18 12:18:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Tue May 18 12:18:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Tue May 18 14:16:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C42E964DF34; Tue, 18 May 2021 14:16:06 +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 4Fkyj25Bszz4XDh; Tue, 18 May 2021 14:16: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 99C8D20B43; Tue, 18 May 2021 14:16:06 +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 14IEG68b010246; Tue, 18 May 2021 14:16:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14IEG6cT010245; Tue, 18 May 2021 14:16:06 GMT (envelope-from git) Date: Tue, 18 May 2021 14:16:06 GMT Message-Id: <202105181416.14IEG6cT010245@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 00e501d720d4 - main - Update usb_timings_sysctl_handler() to accept any value for timings between 0 milliseconds and 2 seconds inclusivly. Some style fixes while at it. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 00e501d720d46386e6c8d0ebb4b3a8e98cb0390e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 14:16:06 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=00e501d720d46386e6c8d0ebb4b3a8e98cb0390e commit 00e501d720d46386e6c8d0ebb4b3a8e98cb0390e Author: Hans Petter Selasky AuthorDate: 2021-05-18 13:16:29 +0000 Commit: Hans Petter Selasky CommitDate: 2021-05-18 13:52:41 +0000 Update usb_timings_sysctl_handler() to accept any value for timings between 0 milliseconds and 2 seconds inclusivly. Some style fixes while at it. The USB specification has minimum values and maximum values, and not only minimum values. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/usb/usb_debug.c | 57 +++++++++++-------------------------------------- 1 file changed, 13 insertions(+), 44 deletions(-) diff --git a/sys/dev/usb/usb_debug.c b/sys/dev/usb/usb_debug.c index 5b5d141508c3..5e521f7ec3a5 100644 --- a/sys/dev/usb/usb_debug.c +++ b/sys/dev/usb/usb_debug.c @@ -249,71 +249,40 @@ unsigned int usb_extra_power_up_time = USB_EXTRA_POWER_UP_TIME; /*------------------------------------------------------------------------* * usb_timings_sysctl_handler * - * This function updates timings variables, adjusting them where necessary. + * This function is used to update USB timing variables. *------------------------------------------------------------------------*/ static int usb_timings_sysctl_handler(SYSCTL_HANDLER_ARGS) { int error = 0; - unsigned int val; + unsigned val; /* * Attempt to get a coherent snapshot by making a copy of the data. */ if (arg1) - val = *(unsigned int *)arg1; + val = *(unsigned *)arg1; else val = arg2; - error = SYSCTL_OUT(req, &val, sizeof(int)); + error = SYSCTL_OUT(req, &val, sizeof(unsigned)); if (error || !req->newptr) return (error); if (!arg1) - return EPERM; + return (EPERM); - error = SYSCTL_IN(req, &val, sizeof(unsigned int)); + error = SYSCTL_IN(req, &val, sizeof(unsigned)); if (error) return (error); /* - * Now make sure the values are decent, and certainly no lower than - * what the USB spec prescribes. + * Make sure the specified value is not too big. Accept any + * value from 0 milliseconds to 2 seconds inclusivly for all + * parameters. */ - unsigned int *p = (unsigned int *)arg1; - if (p == &usb_port_reset_delay) { - if (val < USB_PORT_RESET_DELAY_SPEC) - return (EINVAL); - } else if (p == &usb_port_root_reset_delay) { - if (val < USB_PORT_ROOT_RESET_DELAY_SPEC) - return (EINVAL); - } else if (p == &usb_port_reset_recovery) { - if (val < USB_PORT_RESET_RECOVERY_SPEC) - return (EINVAL); - } else if (p == &usb_port_powerup_delay) { - if (val < USB_PORT_POWERUP_DELAY_SPEC) - return (EINVAL); - } else if (p == &usb_port_resume_delay) { - if (val < USB_PORT_RESUME_DELAY_SPEC) - return (EINVAL); - } else if (p == &usb_set_address_settle) { - if (val < USB_SET_ADDRESS_SETTLE_SPEC) - return (EINVAL); - } else if (p == &usb_resume_delay) { - if (val < USB_RESUME_DELAY_SPEC) - return (EINVAL); - } else if (p == &usb_resume_wait) { - if (val < USB_RESUME_WAIT_SPEC) - return (EINVAL); - } else if (p == &usb_resume_recovery) { - if (val < USB_RESUME_RECOVERY_SPEC) - return (EINVAL); - } else if (p == &usb_extra_power_up_time) { - if (val < USB_EXTRA_POWER_UP_TIME_SPEC) - return (EINVAL); - } else { - /* noop */ - } + if (val > 2000) + return (EINVAL); - *p = val; - return 0; + *(unsigned *)arg1 = val; + return (0); } #endif From owner-dev-commits-src-all@freebsd.org Tue May 18 14:16:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1336A64E236; Tue, 18 May 2021 14:16: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 4Fkyj36D9tz4XGR; Tue, 18 May 2021 14:16:07 +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 BBB0620CC8; Tue, 18 May 2021 14:16:07 +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 14IEG7AR010267; Tue, 18 May 2021 14:16:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14IEG7vP010266; Tue, 18 May 2021 14:16:07 GMT (envelope-from git) Date: Tue, 18 May 2021 14:16:07 GMT Message-Id: <202105181416.14IEG7vP010266@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 70ffaaa69c83 - main - Update USB_PORT_RESET_RECOVERY to comply with the USB 2.0 specification which says it should be max 10 milliseconds. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 70ffaaa69c830d26b59136d0b0447ab2f8683db8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 14:16:08 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=70ffaaa69c830d26b59136d0b0447ab2f8683db8 commit 70ffaaa69c830d26b59136d0b0447ab2f8683db8 Author: Hans Petter Selasky AuthorDate: 2021-05-18 13:22:32 +0000 Commit: Hans Petter Selasky CommitDate: 2021-05-18 13:52:41 +0000 Update USB_PORT_RESET_RECOVERY to comply with the USB 2.0 specification which says it should be max 10 milliseconds. This may fix some USB enumeration issues: > usbd_req_re_enumerate: addr=3, set address failed! (USB_ERR_IOERROR, ignored) > usbd_setup_device_desc: getting device descriptor at addr 3 failed, Found by: Zhichao1.Li@dell.com MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/usb/usb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/usb/usb.h b/sys/dev/usb/usb.h index 346ecd3059d7..dcdb62114d63 100644 --- a/sys/dev/usb/usb.h +++ b/sys/dev/usb/usb.h @@ -115,7 +115,7 @@ MALLOC_DECLARE(M_USBDEV); /* Allow for marginal and non-conforming devices. */ #define USB_PORT_RESET_DELAY 50 /* ms */ #define USB_PORT_ROOT_RESET_DELAY 200 /* ms */ -#define USB_PORT_RESET_RECOVERY 250 /* ms */ +#define USB_PORT_RESET_RECOVERY 10 /* ms */ #define USB_PORT_POWERUP_DELAY 300 /* ms */ #define USB_PORT_RESUME_DELAY (20*2) /* ms */ #define USB_SET_ADDRESS_SETTLE 10 /* ms */ From owner-dev-commits-src-all@freebsd.org Tue May 18 14:16:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CE0C864E0AE; Tue, 18 May 2021 14:16:09 +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 4Fkyj50yVXz4X5Y; Tue, 18 May 2021 14:16:09 +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 DDD58209E9; Tue, 18 May 2021 14:16: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 14IEG829010288; Tue, 18 May 2021 14:16:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14IEG8hu010287; Tue, 18 May 2021 14:16:08 GMT (envelope-from git) Date: Tue, 18 May 2021 14:16:08 GMT Message-Id: <202105181416.14IEG8hu010287@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: e5ff940a81b5 - main - Propagate down USB explore error codes, so that failures to enumerate USB HUBs behind USB HUBs are detected and the USB reset counter logic will kick in preventing enumeration of continuously failing ports. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e5ff940a81b56cb236795e0059c44981053f8404 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 14:16:10 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=e5ff940a81b56cb236795e0059c44981053f8404 commit e5ff940a81b56cb236795e0059c44981053f8404 Author: Hans Petter Selasky AuthorDate: 2021-05-18 13:52:00 +0000 Commit: Hans Petter Selasky CommitDate: 2021-05-18 14:11:35 +0000 Propagate down USB explore error codes, so that failures to enumerate USB HUBs behind USB HUBs are detected and the USB reset counter logic will kick in preventing enumeration of continuously failing ports. Submitted by: phk@ Tested by: bz@ PR: 237666 MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/usb/usb_hub.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/sys/dev/usb/usb_hub.c b/sys/dev/usb/usb_hub.c index 6ed30b64b1e0..52ac0a8a7ff7 100644 --- a/sys/dev/usb/usb_hub.c +++ b/sys/dev/usb/usb_hub.c @@ -513,7 +513,7 @@ uhub_explore_sub(struct uhub_softc *sc, struct usb_port *up) usb_error_t err; bus = sc->sc_udev->bus; - err = 0; + err = USB_ERR_NORMAL_COMPLETION; /* get driver added refcount from USB bus */ refcount = bus->driver_added_refcount; @@ -1013,7 +1013,7 @@ uhub_explore(struct usb_device *udev) if (udev->flags.self_suspended) { /* need to wait until the child signals resume */ DPRINTF("Device is suspended!\n"); - return (0); + return (USB_ERR_NORMAL_COMPLETION); } /* @@ -1022,6 +1022,12 @@ uhub_explore(struct usb_device *udev) */ do_unlock = usbd_enum_lock(udev); + /* + * Set default error code to avoid compiler warnings. + * Note that hub->nports cannot be zero. + */ + err = USB_ERR_NORMAL_COMPLETION; + for (x = 0; x != hub->nports; x++) { up = hub->ports + x; portno = x + 1; @@ -1090,13 +1096,11 @@ uhub_explore(struct usb_device *udev) break; } } - err = uhub_explore_sub(sc, up); - if (err) { - /* no device(s) present */ - continue; + + if (uhub_explore_sub(sc, up) == USB_ERR_NORMAL_COMPLETION) { + /* explore succeeded - reset restart counter */ + up->restartcnt = 0; } - /* explore succeeded - reset restart counter */ - up->restartcnt = 0; } if (do_unlock) @@ -1105,8 +1109,7 @@ uhub_explore(struct usb_device *udev) /* initial status checked */ sc->sc_flags |= UHUB_FLAG_DID_EXPLORE; - /* return success */ - return (USB_ERR_NORMAL_COMPLETION); + return (err); } int From owner-dev-commits-src-all@freebsd.org Tue May 18 15:30:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C7FE264FEAC; Tue, 18 May 2021 15:30: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 4Fl0Lw5JMzz4mnT; Tue, 18 May 2021 15:30: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 9EA9021E8F; Tue, 18 May 2021 15:30: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 14IFUW1v011746; Tue, 18 May 2021 15:30:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14IFUWN6011745; Tue, 18 May 2021 15:30:32 GMT (envelope-from git) Date: Tue, 18 May 2021 15:30:32 GMT Message-Id: <202105181530.14IFUWN6011745@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 715fcc0d3426 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 715fcc0d342684da5d109a7e4891d30aa38667c9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 15:30:32 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=715fcc0d342684da5d109a7e4891d30aa38667c9 commit 715fcc0d342684da5d109a7e4891d30aa38667c9 Author: Mateusz Guzik AuthorDate: 2021-05-14 19:01:56 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-18 15:30:28 +0000 vfs: change vn_freevnodes_* prefix to idiomatic vfs_freevnodes_* --- 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 468bd21dae21..875925ac9a58 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1426,7 +1426,7 @@ static int vnlruproc_sig; #define VNLRU_FREEVNODES_SLOP 128 static __inline void -vn_freevnodes_inc(void) +vfs_freevnodes_inc(void) { struct vdbatch *vd; @@ -1437,7 +1437,7 @@ vn_freevnodes_inc(void) } static __inline void -vn_freevnodes_dec(void) +vfs_freevnodes_dec(void) { struct vdbatch *vd; @@ -3369,7 +3369,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 @@ -3422,7 +3422,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); } } @@ -3463,7 +3463,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); } } @@ -3624,7 +3624,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 @@ -3661,7 +3661,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-all@freebsd.org Tue May 18 15:30:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EE0B564FF91; Tue, 18 May 2021 15:30: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 4Fl0Lx6NJyz4mq5; Tue, 18 May 2021 15:30: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 BE81521AE2; Tue, 18 May 2021 15:30: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 14IFUXJn011767; Tue, 18 May 2021 15:30:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14IFUXrq011766; Tue, 18 May 2021 15:30:33 GMT (envelope-from git) Date: Tue, 18 May 2021 15:30:33 GMT Message-Id: <202105181530.14IFUXrq011766@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: cc6f46ac2fd5 - main - 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/main X-Git-Reftype: branch X-Git-Commit: cc6f46ac2fd5d910e632fced3f21d0b0f53030d8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 15:30:34 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=cc6f46ac2fd5d910e632fced3f21d0b0f53030d8 commit cc6f46ac2fd5d910e632fced3f21d0b0f53030d8 Author: Mateusz Guzik AuthorDate: 2021-05-14 19:01:32 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-18 15:30:28 +0000 vfs: refactor vdrop In particular move vunlazy into its own routine. --- 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 875925ac9a58..18c5b5b3b148 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -3120,6 +3120,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. @@ -3575,42 +3600,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) { @@ -3660,17 +3649,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-all@freebsd.org Tue May 18 18:05:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DC6406531FF; Tue, 18 May 2021 18:05: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 4Fl3nP5y91z3r55; Tue, 18 May 2021 18:05: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 B4A6C23E27; Tue, 18 May 2021 18:05: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 14II5DoA017577; Tue, 18 May 2021 18:05:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14II5DTG017576; Tue, 18 May 2021 18:05:13 GMT (envelope-from git) Date: Tue, 18 May 2021 18:05:13 GMT Message-Id: <202105181805.14II5DTG017576@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 8cf912b017a0 - main - ttydev_write: prevent stops while terminal is busied 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/main X-Git-Reftype: branch X-Git-Commit: 8cf912b017a04a2eec01fbaa1f7b9ef556403ede Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 18:05:13 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8cf912b017a04a2eec01fbaa1f7b9ef556403ede commit 8cf912b017a04a2eec01fbaa1f7b9ef556403ede Author: Konstantin Belousov AuthorDate: 2021-05-13 01:35:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-18 17:52:03 +0000 ttydev_write: prevent stops while terminal is busied Since busy state is checked by all blocked writes, stopping a process which waits in ttydisc_write() causes cascade. Utilize sigdeferstop() to avoid the issue. Submitted by: Jakub Piecuch PR: 255816 MFC after: 1 week --- sys/kern/tty.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 00b4df675311..8700eb8f9ef1 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -525,7 +525,7 @@ static int ttydev_write(struct cdev *dev, struct uio *uio, int ioflag) { struct tty *tp = dev->si_drv1; - int error; + int defer, error; error = ttydev_enter(tp); if (error) @@ -549,7 +549,9 @@ ttydev_write(struct cdev *dev, struct uio *uio, int ioflag) } tp->t_flags |= TF_BUSY_OUT; + defer = sigdeferstop(SIGDEFERSTOP_ERESTART); error = ttydisc_write(tp, uio, ioflag); + sigallowstop(defer); tp->t_flags &= ~TF_BUSY_OUT; cv_signal(&tp->t_outserwait); } From owner-dev-commits-src-all@freebsd.org Tue May 18 19:43:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 64EF1655DA7; Tue, 18 May 2021 19:43: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 4Fl5z92T2Tz4jhS; Tue, 18 May 2021 19:43: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 3D3D5252D8; Tue, 18 May 2021 19:43: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 14IJhnNx051245; Tue, 18 May 2021 19:43:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14IJhnFD051244; Tue, 18 May 2021 19:43:49 GMT (envelope-from git) Date: Tue, 18 May 2021 19:43:49 GMT Message-Id: <202105181943.14IJhnFD051244@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: c4a6258d70f7 - main - dummynet: Fix mbuf tag allocation failure handling 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/main X-Git-Reftype: branch X-Git-Commit: c4a6258d70f73c27d8f0c6233edbcc609791806b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 19:43:49 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c4a6258d70f73c27d8f0c6233edbcc609791806b commit c4a6258d70f73c27d8f0c6233edbcc609791806b Author: Mark Johnston AuthorDate: 2021-05-18 19:22:21 +0000 Commit: Mark Johnston CommitDate: 2021-05-18 19:25:16 +0000 dummynet: Fix mbuf tag allocation failure handling PR: 255875, 255878, 255879, 255880 Reviewed by: donner, kp MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30318 --- sys/netpfil/ipfw/dn_aqm_codel.c | 4 +--- sys/netpfil/ipfw/dn_aqm_pie.c | 6 +++--- sys/netpfil/ipfw/dn_sched_fq_codel.c | 4 +--- sys/netpfil/ipfw/dn_sched_fq_pie.c | 6 +++--- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/sys/netpfil/ipfw/dn_aqm_codel.c b/sys/netpfil/ipfw/dn_aqm_codel.c index 4b921f0f52c8..a1f90461ecab 100644 --- a/sys/netpfil/ipfw/dn_aqm_codel.c +++ b/sys/netpfil/ipfw/dn_aqm_codel.c @@ -256,10 +256,8 @@ aqm_codel_enqueue(struct dn_queue *q, struct mbuf *m) if (mtag == NULL) mtag = m_tag_alloc(MTAG_ABI_COMPAT, DN_AQM_MTAG_TS, sizeof(aqm_time_t), M_NOWAIT); - if (mtag == NULL) { - m_freem(m); + if (mtag == NULL) goto drop; - } *(aqm_time_t *)(mtag + 1) = AQM_UNOW; m_tag_prepend(m, mtag); diff --git a/sys/netpfil/ipfw/dn_aqm_pie.c b/sys/netpfil/ipfw/dn_aqm_pie.c index abd5bbf0eb9a..2d5d500e275c 100644 --- a/sys/netpfil/ipfw/dn_aqm_pie.c +++ b/sys/netpfil/ipfw/dn_aqm_pie.c @@ -542,11 +542,11 @@ aqm_pie_enqueue(struct dn_queue *q, struct mbuf* m) mtag = m_tag_alloc(MTAG_ABI_COMPAT, DN_AQM_MTAG_TS, sizeof(aqm_time_t), M_NOWAIT); if (mtag == NULL) { - m_freem(m); t = DROP; + } else { + *(aqm_time_t *)(mtag + 1) = AQM_UNOW; + m_tag_prepend(m, mtag); } - *(aqm_time_t *)(mtag + 1) = AQM_UNOW; - m_tag_prepend(m, mtag); } if (t != DROP) { diff --git a/sys/netpfil/ipfw/dn_sched_fq_codel.c b/sys/netpfil/ipfw/dn_sched_fq_codel.c index 5580dd91bbfe..bc61be867d36 100644 --- a/sys/netpfil/ipfw/dn_sched_fq_codel.c +++ b/sys/netpfil/ipfw/dn_sched_fq_codel.c @@ -189,10 +189,8 @@ codel_enqueue(struct fq_codel_flow *q, struct mbuf *m, struct fq_codel_si *si) if (mtag == NULL) mtag = m_tag_alloc(MTAG_ABI_COMPAT, DN_AQM_MTAG_TS, sizeof(aqm_time_t), M_NOWAIT); - if (mtag == NULL) { - m_freem(m); + if (mtag == NULL) goto drop; - } *(aqm_time_t *)(mtag + 1) = AQM_UNOW; m_tag_prepend(m, mtag); diff --git a/sys/netpfil/ipfw/dn_sched_fq_pie.c b/sys/netpfil/ipfw/dn_sched_fq_pie.c index 257dada44345..809ca2b5f4e8 100644 --- a/sys/netpfil/ipfw/dn_sched_fq_pie.c +++ b/sys/netpfil/ipfw/dn_sched_fq_pie.c @@ -734,11 +734,11 @@ pie_enqueue(struct fq_pie_flow *q, struct mbuf* m, struct fq_pie_si *si) mtag = m_tag_alloc(MTAG_ABI_COMPAT, DN_AQM_MTAG_TS, sizeof(aqm_time_t), M_NOWAIT); if (mtag == NULL) { - m_freem(m); t = DROP; + } else { + *(aqm_time_t *)(mtag + 1) = AQM_UNOW; + m_tag_prepend(m, mtag); } - *(aqm_time_t *)(mtag + 1) = AQM_UNOW; - m_tag_prepend(m, mtag); } if (t != DROP) { From owner-dev-commits-src-all@freebsd.org Tue May 18 19:43:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A20236559E2; Tue, 18 May 2021 19:43: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 4Fl5zB3RMRz4jqb; Tue, 18 May 2021 19:43: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 5E09125448; Tue, 18 May 2021 19:43: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 14IJho3L051266; Tue, 18 May 2021 19:43:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14IJho7p051265; Tue, 18 May 2021 19:43:50 GMT (envelope-from git) Date: Tue, 18 May 2021 19:43:50 GMT Message-Id: <202105181943.14IJho7p051265@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: b295c5ddcef4 - main - socket: Release cred reference later in sodealloc() 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/main X-Git-Reftype: branch X-Git-Commit: b295c5ddcef4744ef7044d2327b4258b6ad055f0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 19:43:50 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b295c5ddcef4744ef7044d2327b4258b6ad055f0 commit b295c5ddcef4744ef7044d2327b4258b6ad055f0 Author: Lv Yunlong AuthorDate: 2021-05-18 19:23:15 +0000 Commit: Mark Johnston CommitDate: 2021-05-18 19:25:40 +0000 socket: Release cred reference later in sodealloc() We dereference so->so_cred to update the per-uid socket buffer accounting, so the crfree() call must be deferred until after that point. PR: 255869 MFC after: 1 week --- sys/kern/uipc_socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index ea86f66556ea..2a167eb68a22 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -476,7 +476,6 @@ sodealloc(struct socket *so) #endif hhook_run_socket(so, NULL, HHOOK_SOCKET_CLOSE); - crfree(so->so_cred); khelp_destroy_osd(&so->osd); if (SOLISTENING(so)) { if (so->sol_accept_filter != NULL) @@ -493,6 +492,7 @@ sodealloc(struct socket *so) SOCKBUF_LOCK_DESTROY(&so->so_snd); SOCKBUF_LOCK_DESTROY(&so->so_rcv); } + crfree(so->so_cred); mtx_destroy(&so->so_lock); uma_zfree(socket_zone, so); } From owner-dev-commits-src-all@freebsd.org Tue May 18 20:19:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D2F85656938; Tue, 18 May 2021 20:19: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 4Fl6mb5XmBz4rlb; Tue, 18 May 2021 20:19: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 A5AA025C1F; Tue, 18 May 2021 20:19: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 14IKJh5J091858; Tue, 18 May 2021 20:19:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14IKJhY6091857; Tue, 18 May 2021 20:19:43 GMT (envelope-from git) Date: Tue, 18 May 2021 20:19:43 GMT Message-Id: <202105182019.14IKJhY6091857@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 7fd8baee756e - main - test/libalias: Tests for instantiation 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/main X-Git-Reftype: branch X-Git-Commit: 7fd8baee756efa18b6bbb17cbf3a652eb2058d87 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 20:19:43 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=7fd8baee756efa18b6bbb17cbf3a652eb2058d87 commit 7fd8baee756efa18b6bbb17cbf3a652eb2058d87 Author: Lutz Donnerhacke AuthorDate: 2021-05-16 21:37:37 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-18 20:15:39 +0000 test/libalias: Tests for instantiation In order to modify libalias for performance, the existing functionality must not change. Enforce this. Reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30307 --- tests/sys/netinet/Makefile | 2 + tests/sys/netinet/libalias/1_instance.c | 95 +++++++++++++++++++++++++++++++++ tests/sys/netinet/libalias/Makefile | 26 +++++++++ 3 files changed, 123 insertions(+) diff --git a/tests/sys/netinet/Makefile b/tests/sys/netinet/Makefile index 56a1cf877135..ec2e6e679c18 100644 --- a/tests/sys/netinet/Makefile +++ b/tests/sys/netinet/Makefile @@ -5,6 +5,8 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/netinet BINDIR= ${TESTSDIR} +TESTS_SUBDIRS+= libalias + ATF_TESTS_C= ip_reass_test \ so_reuseport_lb_test \ socket_afinet \ diff --git a/tests/sys/netinet/libalias/1_instance.c b/tests/sys/netinet/libalias/1_instance.c new file mode 100644 index 000000000000..e9137eb99d50 --- /dev/null +++ b/tests/sys/netinet/libalias/1_instance.c @@ -0,0 +1,95 @@ +#include +#include +#include +#include + +static int randcmp(const void *a, const void *b) { + int res, r = rand(); + + (void)a; + (void)b; + res = (r/4 < RAND_MAX/9) ? 1 + : (r/5 < RAND_MAX/9) ? 0 + : -1; + return (res); +} + +ATF_TC(2_destroynull); +ATF_TC_HEAD(2_destroynull, env) +{ + atf_tc_set_md_var(env, "descr", "Destroy the NULL instance"); +} +ATF_TC_BODY(2_destroynull, dummy) +{ + atf_tc_expect_death("Code expects valid pointer."); + LibAliasUninit(NULL); +} + +ATF_TC(1_singleinit); +ATF_TC_HEAD(1_singleinit, env) +{ + atf_tc_set_md_var(env, "descr", "Create an instance"); +} +ATF_TC_BODY(1_singleinit, dummy) +{ + struct libalias *la; + + la = LibAliasInit(NULL); + ATF_CHECK_MSG(la != NULL, "Creating an instance failed."); + LibAliasUninit(la); +} + +ATF_TC(3_multiinit); +ATF_TC_HEAD(3_multiinit, env) +{ + atf_tc_set_md_var(env, "descr", "Recreate an instance multiple times"); +} +ATF_TC_BODY(3_multiinit, dummy) +{ + struct libalias *la; + int i; + + la = LibAliasInit(NULL); + for(i = 1; i < 30; i++) { + struct libalias *lo = la; + + la = LibAliasInit(la); + ATF_CHECK_MSG(la == lo, "Recreating moved the instance around: %d", i); + } + LibAliasUninit(la); +} + +ATF_TC(4_multiinstance); +ATF_TC_HEAD(4_multiinstance, env) +{ + atf_tc_set_md_var(env, "descr", "Create and destoy multiple instances."); +} +ATF_TC_BODY(4_multiinstance, dummy) +{ + struct libalias *la[300]; + int const num_instances = sizeof(la) / sizeof(*la); + int i; + + for (i = 0; i < num_instances; i++) { + la[i] = LibAliasInit(NULL); + ATF_CHECK_MSG(la[i] != NULL, "Creating instance %d failed.", i); + } + + qsort(la, num_instances, sizeof(*la), randcmp); + + for (i = 0; i < num_instances; i++) + LibAliasUninit(la[i]); +} + +ATF_TP_ADD_TCS(instance) +{ + /* Use "dd if=/dev/random bs=2 count=1 | od -x" to reproduce */ + srand(0x5ac4); + + ATF_TP_ADD_TC(instance, 2_destroynull); + ATF_TP_ADD_TC(instance, 1_singleinit); + ATF_TP_ADD_TC(instance, 3_multiinit); + ATF_TP_ADD_TC(instance, 4_multiinstance); + + return atf_no_error(); +} diff --git a/tests/sys/netinet/libalias/Makefile b/tests/sys/netinet/libalias/Makefile new file mode 100644 index 000000000000..3b2a3b144298 --- /dev/null +++ b/tests/sys/netinet/libalias/Makefile @@ -0,0 +1,26 @@ +# $FreeBSD$ + +.include + +PACKAGE= tests + +TESTSDIR= ${TESTSBASE}/sys/netinet/libalias +BINDIR= ${TESTSDIR} + +ATF_TESTS_C+= 1_instance + +LIBADD+= alias + +.include + +# +# Testing during development +# +test: all + cd ${.OBJDIR}; kyua test + +report: + cd ${.OBJDIR}; kyua report + +report-v: + cd ${.OBJDIR}; kyua report --verbose From owner-dev-commits-src-all@freebsd.org Tue May 18 20:22:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Tue May 18 20:25:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Tue May 18 20:39:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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 16A00657304; Tue, 18 May 2021 20:39: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 4Fl7Cg09RXz3Cbl; Tue, 18 May 2021 20:39: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 E2DA8260B6; Tue, 18 May 2021 20:39: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 14IKdgtV018597; Tue, 18 May 2021 20:39:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14IKdgpv018596; Tue, 18 May 2021 20:39:42 GMT (envelope-from git) Date: Tue, 18 May 2021 20:39:42 GMT Message-Id: <202105182039.14IKdgpv018596@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 63b6a08ce246 - main - ng_parse: IP address parsing in netgraph eating too many characters 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/main X-Git-Reftype: branch X-Git-Commit: 63b6a08ce2467b8e230e7a4ecb3e1ddf1b48851c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 20:39:43 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=63b6a08ce2467b8e230e7a4ecb3e1ddf1b48851c commit 63b6a08ce2467b8e230e7a4ecb3e1ddf1b48851c Author: Markus Stoff AuthorDate: 2021-05-18 20:35:33 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-18 20:36:28 +0000 ng_parse: IP address parsing in netgraph eating too many characters Once the final component of the IP address has been parsed, the offset on the input must not be advanced, as this would remove an unparsed character from the input. Submitted by: Markus Stoff Reviewed by: donner MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D26489 --- sys/netgraph/ng_parse.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/netgraph/ng_parse.c b/sys/netgraph/ng_parse.c index 8050edbba562..c3c2126bdef5 100644 --- a/sys/netgraph/ng_parse.c +++ b/sys/netgraph/ng_parse.c @@ -960,9 +960,11 @@ ng_ipaddr_parse(const struct ng_parse_type *type, if ((error = ng_int8_parse(&ng_parse_int8_type, s, off, start, buf + i, buflen)) != 0) return (error); - if (i < 3 && s[*off] != '.') - return (EINVAL); - (*off)++; + if (i < 3) { + if (s[*off] != '.') + return (EINVAL); + (*off)++; + } } *buflen = 4; return (0); From owner-dev-commits-src-all@freebsd.org Tue May 18 21:01:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A4A626579F8; Tue, 18 May 2021 21:01: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 4Fl7hX4CvTz3JQL; Tue, 18 May 2021 21:01: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 7A39C2678E; Tue, 18 May 2021 21:01: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 14IL1GxA054230; Tue, 18 May 2021 21:01:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14IL1Gki054229; Tue, 18 May 2021 21:01:16 GMT (envelope-from git) Date: Tue, 18 May 2021 21:01:16 GMT Message-Id: <202105182101.14IL1Gki054229@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 3d846e48227e - main - Do not forward datagrams originated by link-local addresses 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/main X-Git-Reftype: branch X-Git-Commit: 3d846e48227e2e78c1e7b35145f57353ffda56ba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 21:01:16 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=3d846e48227e2e78c1e7b35145f57353ffda56ba commit 3d846e48227e2e78c1e7b35145f57353ffda56ba Author: Zhenlei Huang AuthorDate: 2021-05-18 20:51:37 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-18 20:59:46 +0000 Do not forward datagrams originated by link-local addresses The current implement of ip_input() reject packets destined for 169.254.0.0/16, but not those original from 169.254.0.0/16 link-local addresses. Fix to fully respect RFC 3927 section 2.7. PR: 255388 Reviewed by: donner, rgrimes, karels MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D29968 --- sys/netinet/ip_input.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 43d375c2385f..1139e3a5abfa 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -738,15 +738,10 @@ passin: } ia = NULL; } - /* RFC 3927 2.7: Do not forward datagrams for 169.254.0.0/16. */ - if (IN_LINKLOCAL(ntohl(ip->ip_dst.s_addr))) { - IPSTAT_INC(ips_cantforward); - m_freem(m); - return; - } if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { MROUTER_RLOCK(); - if (V_ip_mrouter) { + /* Do not forward packets from IN_LINKLOCAL. */ + if (V_ip_mrouter && !IN_LINKLOCAL(ntohl(ip->ip_src.s_addr))) { /* * If we are acting as a multicast router, all * incoming multicast packets are passed to the @@ -785,6 +780,13 @@ passin: goto ours; if (ip->ip_dst.s_addr == INADDR_ANY) goto ours; + /* Do not forward packets to or from IN_LINKLOCAL. */ + if (IN_LINKLOCAL(ntohl(ip->ip_dst.s_addr)) || + IN_LINKLOCAL(ntohl(ip->ip_src.s_addr))) { + IPSTAT_INC(ips_cantforward); + m_freem(m); + return; + } /* * Not for us; forward if possible and desirable. From owner-dev-commits-src-all@freebsd.org Tue May 18 22:57:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DF4F263176F; Tue, 18 May 2021 22:57: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 4FlBG45wNkz4hFw; Tue, 18 May 2021 22:57: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 B3C0D27CB1; Tue, 18 May 2021 22:57: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 14IMv0AI005858; Tue, 18 May 2021 22:57:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14IMv0tl005857; Tue, 18 May 2021 22:57:00 GMT (envelope-from git) Date: Tue, 18 May 2021 22:57:00 GMT Message-Id: <202105182257.14IMv0tl005857@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: b3d4c70dc60f - main - nfsd: Add support for CLAIM_DELEG_CUR_FH to the NFSv4.1/4.2 Open 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/main X-Git-Reftype: branch X-Git-Commit: b3d4c70dc60f1913f2363751b905b562c39ca126 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 22:57:00 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=b3d4c70dc60f1913f2363751b905b562c39ca126 commit b3d4c70dc60f1913f2363751b905b562c39ca126 Author: Rick Macklem AuthorDate: 2021-05-18 22:53:54 +0000 Commit: Rick Macklem CommitDate: 2021-05-18 22:53:54 +0000 nfsd: Add support for CLAIM_DELEG_CUR_FH to the NFSv4.1/4.2 Open The Linux NFSv4.1/4.2 client now uses the CLAIM_DELEG_CUR_FH variant of the Open operation when delegations are recalled and the client has a local open of the file. This patch adds support for this variant of Open to the NFSv4.1/4.2 server. This patch only affects mounts from Linux clients when delegations are enabled on the server. MFC after: 2 weeks --- sys/fs/nfsserver/nfs_nfsdserv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index 8aa39e5018d9..5d6cac23b722 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -2981,7 +2981,8 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram, */ NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); claim = fxdr_unsigned(int, *tl); - if (claim == NFSV4OPEN_CLAIMDELEGATECUR) { + if (claim == NFSV4OPEN_CLAIMDELEGATECUR || claim == + NFSV4OPEN_CLAIMDELEGATECURFH) { NFSM_DISSECT(tl, u_int32_t *, NFSX_STATEID); stateid.seqid = fxdr_unsigned(u_int32_t, *tl++); NFSBCOPY((caddr_t)tl,(caddr_t)stateid.other,NFSX_STATEIDOTHER); @@ -3056,7 +3057,7 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram, &exclusive_flag, &nva, cverf, create, aclp, &attrbits, nd->nd_cred, exp, &vp); } else if (claim == NFSV4OPEN_CLAIMPREVIOUS || claim == - NFSV4OPEN_CLAIMFH) { + NFSV4OPEN_CLAIMFH || claim == NFSV4OPEN_CLAIMDELEGATECURFH) { if (claim == NFSV4OPEN_CLAIMPREVIOUS) { NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); i = fxdr_unsigned(int, *tl); @@ -3074,7 +3075,6 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram, } stp->ls_flags |= NFSLCK_RECLAIM; } else { - /* CLAIM_NULL_FH */ if (nd->nd_repstat == 0 && create == NFSV4OPEN_CREATE) nd->nd_repstat = NFSERR_INVAL; } From owner-dev-commits-src-all@freebsd.org Tue May 18 23:21:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 07E7D6320A2; Tue, 18 May 2021 23:21: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 4FlBnl6gyPz4ncN; Tue, 18 May 2021 23:20: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 CC9EC27B76; Tue, 18 May 2021 23:20: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 14INKxrI043427; Tue, 18 May 2021 23:20:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14INKx5Z043426; Tue, 18 May 2021 23:20:59 GMT (envelope-from git) Date: Tue, 18 May 2021 23:20:59 GMT Message-Id: <202105182320.14INKx5Z043426@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: fc0dc94029df - main - nfsd: Reduce the callback timeout to 800msec 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/main X-Git-Reftype: branch X-Git-Commit: fc0dc94029df8150301b925bda690b20d9d0bcbf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 23:21:00 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=fc0dc94029df8150301b925bda690b20d9d0bcbf commit fc0dc94029df8150301b925bda690b20d9d0bcbf Author: Rick Macklem AuthorDate: 2021-05-18 23:17:58 +0000 Commit: Rick Macklem CommitDate: 2021-05-18 23:17:58 +0000 nfsd: Reduce the callback timeout to 800msec Recent discussion on the nfsv4@ietf.org mailing list confirmed that an NFSv4 server should reply to an RPC in less than 1second. If an NFSv4 RPC requires a delegation be recalled, the server will attempt a CB_RECALL callback. If the client is not responsive, the RPC reply will be delayed until the callback times out. Without this patch, the timeout is set to 4 seconds (set in ticks, but used as seconds), resulting in the RPC reply taking over 4sec. This patch redefines the constant as being in milliseconds and it implements that for a value of 800msec, to ensure the RPC reply is sent in less than 1second. This patch only affects mounts from clients when delegations are enabled on the server and the client is unresponsive to callbacks. MFC after: 2 weeks --- sys/fs/nfs/nfs.h | 2 +- sys/fs/nfs/nfs_commonkrpc.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/fs/nfs/nfs.h b/sys/fs/nfs/nfs.h index 44b6042a2ce7..272b8dbfee22 100644 --- a/sys/fs/nfs/nfs.h +++ b/sys/fs/nfs/nfs.h @@ -50,7 +50,7 @@ #define NFS_MAXRCVTIMEO 60 /* 1 minute in seconds */ #define NFS_MINIDEMTIMEO (5 * NFS_HZ) /* Min timeout for non-idempotent ops*/ #define NFS_MAXREXMIT 100 /* Stop counting after this many */ -#define NFSV4_CALLBACKTIMEO (2 * NFS_HZ) /* Timeout in ticks */ +#define NFSV4_CALLBACKTIMEO 800 /* Timeout in msec */ #define NFSV4_CALLBACKRETRY 5 /* Number of retries before failure */ #define NFSV4_SLOTS 64 /* Number of slots, fore channel */ #define NFSV4_CBSLOTS 8 /* Number of slots, back channel */ diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c index 49c68da45a69..04ef04955ce0 100644 --- a/sys/fs/nfs/nfs_commonkrpc.c +++ b/sys/fs/nfs/nfs_commonkrpc.c @@ -767,11 +767,13 @@ tryagain: * use the same xid. */ if (nmp == NULL) { - timo.tv_usec = 0; - if (clp == NULL) + if (clp == NULL) { timo.tv_sec = NFSV4_UPCALLTIMEO; - else - timo.tv_sec = NFSV4_CALLBACKTIMEO; + timo.tv_usec = 0; + } else { + timo.tv_sec = NFSV4_CALLBACKTIMEO / 1000; + timo.tv_usec = NFSV4_CALLBACKTIMEO * 1000; + } } else { if (nrp->nr_sotype != SOCK_DGRAM) { timo.tv_usec = 0; From owner-dev-commits-src-all@freebsd.org Tue May 18 23:51:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 09DF663269F; Tue, 18 May 2021 23:51:52 +0000 (UTC) (envelope-from jclarke@marcuscom.com) Received: from creme-brulee.marcuscom.com (creme-brulee.marcuscom.com [IPv6:2607:fc50:1:f300::2]) (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 (2048 bits) client-digest SHA256) (Client CN "*.marcuscom.com", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlCTM6ldJz4vhW; Tue, 18 May 2021 23:51:51 +0000 (UTC) (envelope-from jclarke@marcuscom.com) Received: from smtpclient.apple ([IPv6:2600:1700:b00:b239:9484:26f7:8d5:dda3]) (authenticated bits=0) by creme-brulee.marcuscom.com (8.16.1/8.16.1) with ESMTPSA id 14INphr6060204 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Tue, 18 May 2021 19:51:44 -0400 (EDT) (envelope-from jclarke@marcuscom.com) X-Authentication-Warning: creme-brulee.marcuscom.com: Host [IPv6:2600:1700:b00:b239:9484:26f7:8d5:dda3] claimed to be smtpclient.apple Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Joe Clarke Mime-Version: 1.0 (1.0) Subject: Re: git: 3d846e48227e - main - Do not forward datagrams originated by link-local addresses Date: Tue, 18 May 2021 19:51:38 -0400 Message-Id: References: <202105182101.14IL1Gki054229@gitrepo.freebsd.org> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org In-Reply-To: <202105182101.14IL1Gki054229@gitrepo.freebsd.org> To: Lutz Donnerhacke X-Mailer: iPhone Mail (18E212) X-Spam-Status: No, score=2.5 required=5.0 tests=RDNS_NONE autolearn=disabled version=3.4.5 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on creme-brulee.marcuscom.com X-Rspamd-Queue-Id: 4FlCTM6ldJz4vhW X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 23:51:52 -0000 Just out of curiosity, why remove the RFC reference from the comment? Seems= useful for those that want to know why this is a good practice. Joe PGP Key : https://www.marcuscom.com/pgp.asc > On May 18, 2021, at 17:01, Lutz Donnerhacke wrote: >=20 > =EF=BB=BFThe branch main has been updated by donner: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D3d846e48227e2e78c1e7b35145f= 57353ffda56ba >=20 > commit 3d846e48227e2e78c1e7b35145f57353ffda56ba > Author: Zhenlei Huang > AuthorDate: 2021-05-18 20:51:37 +0000 > Commit: Lutz Donnerhacke > CommitDate: 2021-05-18 20:59:46 +0000 >=20 > Do not forward datagrams originated by link-local addresses >=20 > The current implement of ip_input() reject packets destined for > 169.254.0.0/16, but not those original from 169.254.0.0/16 link-local > addresses. >=20 > Fix to fully respect RFC 3927 section 2.7. >=20 > PR: 255388 > Reviewed by: donner, rgrimes, karels > MFC after: 1 month > Differential Revision: https://reviews.freebsd.org/D29968 > --- > sys/netinet/ip_input.c | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) >=20 > diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c > index 43d375c2385f..1139e3a5abfa 100644 > --- a/sys/netinet/ip_input.c > +++ b/sys/netinet/ip_input.c > @@ -738,15 +738,10 @@ passin: > } > ia =3D NULL; > } > - /* RFC 3927 2.7: Do not forward datagrams for 169.254.0.0/16. */ > - if (IN_LINKLOCAL(ntohl(ip->ip_dst.s_addr))) { > - IPSTAT_INC(ips_cantforward); > - m_freem(m); > - return; > - } > if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { > MROUTER_RLOCK(); > - if (V_ip_mrouter) { > + /* Do not forward packets from IN_LINKLOCAL. */ > + if (V_ip_mrouter && !IN_LINKLOCAL(ntohl(ip->ip_src.s_addr))) { > /* > * If we are acting as a multicast router, all > * incoming multicast packets are passed to the > @@ -785,6 +780,13 @@ passin: > goto ours; > if (ip->ip_dst.s_addr =3D=3D INADDR_ANY) > goto ours; > + /* Do not forward packets to or from IN_LINKLOCAL. */ > + if (IN_LINKLOCAL(ntohl(ip->ip_dst.s_addr)) || > + IN_LINKLOCAL(ntohl(ip->ip_src.s_addr))) { > + IPSTAT_INC(ips_cantforward); > + m_freem(m); > + return; > + } >=20 > /* > * Not for us; forward if possible and desirable. > _______________________________________________ > dev-commits-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all > To unsubscribe, send any mail to "dev-commits-src-all-unsubscribe@freebsd.= org" From owner-dev-commits-src-all@freebsd.org Wed May 19 01:04:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C20AF63362C; Wed, 19 May 2021 01:04:31 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlF5C4Bcvz3GlQ; Wed, 19 May 2021 01:04:31 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 14J14RpI001048; Tue, 18 May 2021 18:04:27 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 14J14Rh6001047; Tue, 18 May 2021 18:04:27 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202105190104.14J14Rh6001047@gndrsh.dnsmgr.net> Subject: Re: git: 3d846e48227e - main - Do not forward datagrams originated by link-local addresses In-Reply-To: To: Joe Clarke Date: Tue, 18 May 2021 18:04:27 -0700 (PDT) CC: Lutz Donnerhacke , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4FlF5C4Bcvz3GlQ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 01:04:31 -0000 > Just out of curiosity, why remove the RFC reference from the comment? Seems useful for those that want to know why this is a good practice. RFC's are not immutable and more often that not an RFC comment is out dated in the src. As an example, network "10/8", original RFC 1627, obsoleted by 1918, but the ietf tracker doesnt tell you that this was covered in RFC5735, obsoleted by 6890, updated by 8190 (the 169.254.0.0/16 block is covered in 6890 with no changes to that part by 8190....) SOOOO.. RFC references are very hard to keep upto date and correct. > > Joe > > PGP Key : https://www.marcuscom.com/pgp.asc > > > On May 18, 2021, at 17:01, Lutz Donnerhacke wrote: > > > > ?The branch main has been updated by donner: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3d846e48227e2e78c1e7b35145f57353ffda56ba > > > > commit 3d846e48227e2e78c1e7b35145f57353ffda56ba > > Author: Zhenlei Huang > > AuthorDate: 2021-05-18 20:51:37 +0000 > > Commit: Lutz Donnerhacke > > CommitDate: 2021-05-18 20:59:46 +0000 > > > > Do not forward datagrams originated by link-local addresses > > > > The current implement of ip_input() reject packets destined for > > 169.254.0.0/16, but not those original from 169.254.0.0/16 link-local > > addresses. > > > > Fix to fully respect RFC 3927 section 2.7. > > > > PR: 255388 > > Reviewed by: donner, rgrimes, karels > > MFC after: 1 month > > Differential Revision: https://reviews.freebsd.org/D29968 > > --- > > sys/netinet/ip_input.c | 16 +++++++++------- > > 1 file changed, 9 insertions(+), 7 deletions(-) > > > > diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c > > index 43d375c2385f..1139e3a5abfa 100644 > > --- a/sys/netinet/ip_input.c > > +++ b/sys/netinet/ip_input.c > > @@ -738,15 +738,10 @@ passin: > > } > > ia = NULL; > > } > > - /* RFC 3927 2.7: Do not forward datagrams for 169.254.0.0/16. */ > > - if (IN_LINKLOCAL(ntohl(ip->ip_dst.s_addr))) { > > - IPSTAT_INC(ips_cantforward); > > - m_freem(m); > > - return; > > - } > > if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { > > MROUTER_RLOCK(); > > - if (V_ip_mrouter) { > > + /* Do not forward packets from IN_LINKLOCAL. */ > > + if (V_ip_mrouter && !IN_LINKLOCAL(ntohl(ip->ip_src.s_addr))) { > > /* > > * If we are acting as a multicast router, all > > * incoming multicast packets are passed to the > > @@ -785,6 +780,13 @@ passin: > > goto ours; > > if (ip->ip_dst.s_addr == INADDR_ANY) > > goto ours; > > + /* Do not forward packets to or from IN_LINKLOCAL. */ > > + if (IN_LINKLOCAL(ntohl(ip->ip_dst.s_addr)) || > > + IN_LINKLOCAL(ntohl(ip->ip_src.s_addr))) { > > + IPSTAT_INC(ips_cantforward); > > + m_freem(m); > > + return; > > + } > > > > /* > > * Not for us; forward if possible and desirable. > > _______________________________________________ > > dev-commits-src-all@freebsd.org mailing list > > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all > > To unsubscribe, send any mail to "dev-commits-src-all-unsubscribe@freebsd.org" > > > -- Rod Grimes rgrimes@freebsd.org From owner-dev-commits-src-all@freebsd.org Wed May 19 01:57:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D691C634AD0; Wed, 19 May 2021 01:57:21 +0000 (UTC) (envelope-from jclarke@marcuscom.com) Received: from creme-brulee.marcuscom.com (creme-brulee.marcuscom.com [IPv6:2607:fc50:1:f300::2]) (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 (2048 bits) client-digest SHA256) (Client CN "*.marcuscom.com", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlGG95bsTz3l5y; Wed, 19 May 2021 01:57:21 +0000 (UTC) (envelope-from jclarke@marcuscom.com) Received: from smtpclient.apple ([IPv6:2600:1700:b00:b239:9484:26f7:8d5:dda3]) (authenticated bits=0) by creme-brulee.marcuscom.com (8.16.1/8.16.1) with ESMTPSA id 14J1vJYP000896 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Tue, 18 May 2021 21:57:19 -0400 (EDT) (envelope-from jclarke@marcuscom.com) X-Authentication-Warning: creme-brulee.marcuscom.com: Host [IPv6:2600:1700:b00:b239:9484:26f7:8d5:dda3] claimed to be smtpclient.apple Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Joe Clarke Mime-Version: 1.0 (1.0) Subject: Re: git: 3d846e48227e - main - Do not forward datagrams originated by link-local addresses Date: Tue, 18 May 2021 21:57:14 -0400 Message-Id: <79D18D6B-EDD7-4FB4-B3C6-7755A3B9F5F3@marcuscom.com> References: <202105190104.14J14Rh6001047@gndrsh.dnsmgr.net> Cc: Lutz Donnerhacke , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org In-Reply-To: <202105190104.14J14Rh6001047@gndrsh.dnsmgr.net> To: rgrimes@freebsd.org X-Mailer: iPhone Mail (18E212) X-Spam-Status: No, score=2.5 required=5.0 tests=RDNS_NONE autolearn=disabled version=3.4.5 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on creme-brulee.marcuscom.com X-Rspamd-Queue-Id: 4FlGG95bsTz3l5y X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 01:57:21 -0000 To be fair, an obsolete RFC can be followed to the current document. Having= an anchor, even one that is obsolete, has value as a reference. Joe PGP Key : https://www.marcuscom.com/pgp.asc > On May 18, 2021, at 21:04, Rodney W. Grimes wr= ote: >=20 > =EF=BB=BF >>=20 >> Just out of curiosity, why remove the RFC reference from the comment? Se= ems useful for those that want to know why this is a good practice. >=20 > RFC's are not immutable and more often that not an RFC comment > is out dated in the src. >=20 > As an example, network "10/8", original RFC 1627, obsoleted by 1918, > but the ietf tracker doesnt tell you that this was covered > in RFC5735, obsoleted by 6890, updated by 8190 > (the 169.254.0.0/16 block is covered in 6890 with no changes to that > part by 8190....) >=20 > SOOOO.. RFC references are very hard to keep upto date and correct. >=20 >>=20 >> Joe >>=20 >> PGP Key : https://www.marcuscom.com/pgp.asc >>=20 >>>> On May 18, 2021, at 17:01, Lutz Donnerhacke wrote:= >>>=20 >>> ?The branch main has been updated by donner: >>>=20 >>> URL: https://cgit.FreeBSD.org/src/commit/?id=3D3d846e48227e2e78c1e7b3514= 5f57353ffda56ba >>>=20 >>> commit 3d846e48227e2e78c1e7b35145f57353ffda56ba >>> Author: Zhenlei Huang >>> AuthorDate: 2021-05-18 20:51:37 +0000 >>> Commit: Lutz Donnerhacke >>> CommitDate: 2021-05-18 20:59:46 +0000 >>>=20 >>> Do not forward datagrams originated by link-local addresses >>>=20 >>> The current implement of ip_input() reject packets destined for >>> 169.254.0.0/16, but not those original from 169.254.0.0/16 link-local >>> addresses. >>>=20 >>> Fix to fully respect RFC 3927 section 2.7. >>>=20 >>> PR: 255388 >>> Reviewed by: donner, rgrimes, karels >>> MFC after: 1 month >>> Differential Revision: https://reviews.freebsd.org/D29968 >>> --- >>> sys/netinet/ip_input.c | 16 +++++++++------- >>> 1 file changed, 9 insertions(+), 7 deletions(-) >>>=20 >>> diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c >>> index 43d375c2385f..1139e3a5abfa 100644 >>> --- a/sys/netinet/ip_input.c >>> +++ b/sys/netinet/ip_input.c >>> @@ -738,15 +738,10 @@ passin: >>> } >>> ia =3D NULL; >>> } >>> - /* RFC 3927 2.7: Do not forward datagrams for 169.254.0.0/16. */ >>> - if (IN_LINKLOCAL(ntohl(ip->ip_dst.s_addr))) { >>> - IPSTAT_INC(ips_cantforward); >>> - m_freem(m); >>> - return; >>> - } >>> if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { >>> MROUTER_RLOCK(); >>> - if (V_ip_mrouter) { >>> + /* Do not forward packets from IN_LINKLOCAL. */ >>> + if (V_ip_mrouter && !IN_LINKLOCAL(ntohl(ip->ip_src.s_addr))) { >>> /* >>> * If we are acting as a multicast router, all >>> * incoming multicast packets are passed to the >>> @@ -785,6 +780,13 @@ passin: >>> goto ours; >>> if (ip->ip_dst.s_addr =3D=3D INADDR_ANY) >>> goto ours; >>> + /* Do not forward packets to or from IN_LINKLOCAL. */ >>> + if (IN_LINKLOCAL(ntohl(ip->ip_dst.s_addr)) || >>> + IN_LINKLOCAL(ntohl(ip->ip_src.s_addr))) { >>> + IPSTAT_INC(ips_cantforward); >>> + m_freem(m); >>> + return; >>> + } >>>=20 >>> /* >>> * Not for us; forward if possible and desirable. >>> _______________________________________________ >>> dev-commits-src-all@freebsd.org mailing list >>> https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all >>> To unsubscribe, send any mail to "dev-commits-src-all-unsubscribe@freebs= d.org" >>=20 >>=20 >>=20 >=20 > --=20 > Rod Grimes rgrimes@freebsd= .org > _______________________________________________ > dev-commits-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all > To unsubscribe, send any mail to "dev-commits-src-all-unsubscribe@freebsd.= org" From owner-dev-commits-src-all@freebsd.org Wed May 19 03:13:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Wed May 19 03:14:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Wed May 19 04:56:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Wed May 19 04:56:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Wed May 19 05:54:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DCCF9638248; Wed, 19 May 2021 05:54:20 +0000 (UTC) (envelope-from lutz@iks-jena.de) Received: from annwfn.iks-jena.de (annwfn.iks-jena.de [IPv6:2001:4bd8::19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlMWc4MbJz4Tj2; Wed, 19 May 2021 05:54:20 +0000 (UTC) (envelope-from lutz@iks-jena.de) X-SMTP-Sender: IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f Received: from belenus.iks-jena.de (belenus.iks-jena.de [IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f]) by annwfn.iks-jena.de (8.15.2/8.15.2) with ESMTPS id 14J5s7Av030977 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 19 May 2021 07:54:07 +0200 X-MSA-Host: belenus.iks-jena.de Received: (from lutz@localhost) by belenus.iks-jena.de (8.14.3/8.14.1/Submit) id 14J5s77T009919; Wed, 19 May 2021 07:54:07 +0200 Date: Wed, 19 May 2021 07:54:07 +0200 From: Lutz Donnerhacke To: Joe Clarke , Zhenlei Huang Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 3d846e48227e - main - Do not forward datagrams originated by link-local addresses Message-ID: <20210519055407.GA9715@belenus.iks-jena.de> References: <202105182101.14IL1Gki054229@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-message-flag: Please send plain text messages only. Thank you. User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspamd-Queue-Id: 4FlMWc4MbJz4Tj2 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_RCPT(0.00)[]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 05:54:20 -0000 On Tue, May 18, 2021 at 07:51:38PM -0400, Joe Clarke wrote: > Just out of curiosity, why remove the RFC reference from the comment? May you please include the author of the change for such questions? > > commit 3d846e48227e2e78c1e7b35145f57353ffda56ba > > Author: Zhenlei Huang > > AuthorDate: 2021-05-18 20:51:37 +0000 > > Commit: Lutz Donnerhacke > > CommitDate: 2021-05-18 20:59:46 +0000 > > > > The current implement of ip_input() reject packets destined for > > 169.254.0.0/16, but not those original from 169.254.0.0/16 link-local > > addresses. > > > > Fix to fully respect RFC 3927 section 2.7. > > > > PR: 255388 > > Reviewed by: donner, rgrimes, karels > > MFC after: 1 month > > Differential Revision: https://reviews.freebsd.org/D29968 I did only commit this differential, but set a month for MFC, exactly to have to opportunity to fix such mistakes. From owner-dev-commits-src-all@freebsd.org Wed May 19 06:19:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C98E2638E89; Wed, 19 May 2021 06:19:09 +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 4FlN4F5J6Nz4bTr; Wed, 19 May 2021 06:19:09 +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 9A2B25AD5; Wed, 19 May 2021 06:19:09 +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 14J6J9lQ090211; Wed, 19 May 2021 06:19:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14J6J9a2090210; Wed, 19 May 2021 06:19:09 GMT (envelope-from git) Date: Wed, 19 May 2021 06:19:09 GMT Message-Id: <202105190619.14J6J9a2090210@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 3965469eaa33 - main - cxgbe(4): Remove some dead code. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3965469eaa33aca03837baf5f88a55fa89f3f987 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 06:19:09 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=3965469eaa33aca03837baf5f88a55fa89f3f987 commit 3965469eaa33aca03837baf5f88a55fa89f3f987 Author: Navdeep Parhar AuthorDate: 2021-05-19 06:16:03 +0000 Commit: Navdeep Parhar CommitDate: 2021-05-19 06:16:03 +0000 cxgbe(4): Remove some dead code. MFC after: 3 days --- sys/dev/cxgbe/adapter.h | 10 ---------- sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h | 2 -- 2 files changed, 12 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index cce58f9729c1..b3b214ce3c96 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -68,16 +68,6 @@ MALLOC_DECLARE(M_CXGBE); #define CXGBE_UNIMPLEMENTED(s) \ panic("%s (%s, line %d) not implemented yet.", s, __FILE__, __LINE__) -#if defined(__i386__) || defined(__amd64__) -static __inline void -prefetch(void *x) -{ - __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); -} -#else -#define prefetch(x) __builtin_prefetch(x) -#endif - #ifndef SYSCTL_ADD_UQUAD #define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD #define sysctl_handle_64 sysctl_handle_quad diff --git a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h index aa94a40add1e..689eb0644893 100644 --- a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h +++ b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h @@ -56,8 +56,6 @@ #include #include -#undef prefetch - #include "common/common.h" #include "common/t4_msg.h" #include "common/t4_regs.h" From owner-dev-commits-src-all@freebsd.org Wed May 19 06:22:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8AB85638C4E; Wed, 19 May 2021 06:22: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 4FlN8d3QPFz4cxR; Wed, 19 May 2021 06:22: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 5C2FD5CDF; Wed, 19 May 2021 06:22: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 14J6Mv4T003018; Wed, 19 May 2021 06:22:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14J6MvkW003017; Wed, 19 May 2021 06:22:57 GMT (envelope-from git) Date: Wed, 19 May 2021 06:22:57 GMT Message-Id: <202105190622.14J6MvkW003017@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 7de0aa01350e - main - stress2: Added a new "mdconfig -o force" test scenario MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7de0aa01350eba647de862542a40f426e970a796 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 06:22:57 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=7de0aa01350eba647de862542a40f426e970a796 commit 7de0aa01350eba647de862542a40f426e970a796 Author: Peter Holm AuthorDate: 2021-05-19 06:22:09 +0000 Commit: Peter Holm CommitDate: 2021-05-19 06:22:09 +0000 stress2: Added a new "mdconfig -o force" test scenario --- tools/test/stress2/misc/force7.sh | 75 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/tools/test/stress2/misc/force7.sh b/tools/test/stress2/misc/force7.sh new file mode 100755 index 000000000000..9eef1936cb98 --- /dev/null +++ b/tools/test/stress2/misc/force7.sh @@ -0,0 +1,75 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2020 Peter Holm +# +# 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. +# + +# "mdconfig -o force" test scenario. +# fsck_ffs core dump seen + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +. ../default.cfg + +log=/tmp/force7.sh.log +mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart +truncate -s 1g $diskimage +mdconfig -a -t vnode -f $diskimage -s 1g -u $mdstart +flags=$newfs_flags +echo "newfs $flags md$mdstart" +newfs $flags md$mdstart > /dev/null 2>&1 + +export TESTPROGS=`cd ..; find testcases/ -perm -1 -type f | \ + egrep -Ev "/run/|/badcode/|/pty/|/shm/|/socket/|sysctl|tcp|thr|udp"` +export runRUNTIME=3m +export RUNDIR=$mntpoint/stressX +start=`date +%s` +while [ $((`date +%s` - start)) -lt 300 ]; do + mount /dev/md$mdstart $mntpoint + rm -fr $mntpoint/lost+found + chmod 777 $mntpoint + + su $testuser -c 'cd ..; ./testcases/run/run $TESTPROGS' > \ + /dev/null 2>&1 & + + sleep `jot -r 1 5 9` + while mdconfig -l | grep -q md$mdstart; do + mdconfig -d -u $mdstart -o force || sleep 1 + done + sleep 1 + ../tools/killall.sh + wait + n=0 + while mount | grep $mntpoint | grep -q /dev/md; do + umount $mntpoint || sleep 1 + [ $((n += 1)) -gt 300 ] && { echo FAIL; exit 1; } + done + mdconfig -a -t vnode -f $diskimage -s 1g -u $mdstart + fsck_ffs -fyR /dev/md$mdstart > $log 2>&1; s=$? + [ $s -ne 0 ] && break +done +[ $s -eq 0 ] && rm -f $diskimage $log || cat $log +exit $s From owner-dev-commits-src-all@freebsd.org Wed May 19 11:41:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 ECD3E63EEE2 for ; Wed, 19 May 2021 11:41: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 4FlWCv6QQ5z4qvT; Wed, 19 May 2021 11:41: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 C47F411F56; Wed, 19 May 2021 11:41: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 14JBfFVt024492; Wed, 19 May 2021 11:41:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JBfFvg024491; Wed, 19 May 2021 11:41:15 GMT (envelope-from git) Date: Wed, 19 May 2021 11:41:15 GMT Message-Id: <202105191141.14JBfFvg024491@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Baptiste Daroussin Subject: git: 8e6e1224184e - vendor/nvi - import nvi 2.2.0-3bbdfe4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/vendor/nvi X-Git-Reftype: branch X-Git-Commit: 8e6e1224184eb6cd3dfa05b2ecd9515c59f4f425 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 11:41:16 -0000 The branch vendor/nvi has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=8e6e1224184eb6cd3dfa05b2ecd9515c59f4f425 commit 8e6e1224184eb6cd3dfa05b2ecd9515c59f4f425 Author: Baptiste Daroussin AuthorDate: 2021-05-19 11:35:56 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-19 11:35:56 +0000 import nvi 2.2.0-3bbdfe4 --- .gitignore | 5 ++ CMakeLists.txt | 38 ++++++++++++-- catalog/dump.c | 12 ++--- cl/cl.h | 3 -- cl/cl_read.c | 4 +- cl/extern.h | 31 ----------- common/common.h | 6 +-- common/conv.h | 2 +- common/exf.c | 27 ++++++++++ common/extern.h | 131 ---------------------------------------------- common/key.h | 6 +-- common/options.h | 4 ++ common/options_def.h | 84 ----------------------------- common/recover.c | 12 +++++ ex/ex.c | 3 +- ex/ex_cscope.c | 14 +++++ ex/ex_def.h | 76 --------------------------- ex/extern.h | 131 ---------------------------------------------- ex/version.h | 1 - man/vi.1 | 50 +++++++++++++----- vi/extern.h | 145 --------------------------------------------------- vi/v_increment.c | 4 +- vi/vs_line.c | 2 +- 23 files changed, 155 insertions(+), 636 deletions(-) diff --git a/.gitignore b/.gitignore index aac7860d7299..2b79229e57e0 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,8 @@ extern.h version.h tags build/ + +# Ignore files by the GNU Global source code tagging system. +/GPATH +/GRTAGS +/GTAGS diff --git a/CMakeLists.txt b/CMakeLists.txt index 996e0e72de99..66d3ca2aafb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,20 +13,28 @@ project(nvi2 C) include(CheckIncludeFiles) include(CheckFunctionExists) +include(CheckSymbolExists) include(CheckStructHasMember) include(CheckCSourceCompiles) +include(CheckCCompilerFlag) mark_as_advanced(CMAKE_INSTALL_PREFIX) option(USE_WIDECHAR "Enable wide character support" ON) option(USE_ICONV "Enable iconv support" ON) -add_compile_options(-fcolor-diagnostics) +check_c_compiler_flag(-fcolor-diagnostics USE_FCOLOR_DIAGNOSTICS) +if(USE_FCOLOR_DIAGNOSTICS) + add_compile_options(-fcolor-diagnostics) +endif() + add_compile_options($<$:-Wall>) add_compile_options($<$:-Wno-parentheses>) add_compile_options($<$:-Wno-uninitialized>) add_compile_options($<$:-Wmissing-prototypes>) -add_compile_options($<$:-Wsystem-headers>) +if (NOT APPLE) + add_compile_options($<$:-Wsystem-headers>) +endif() add_compile_options($<$:-Wuninitialized>) add_compile_options($<$:-Wno-dangling-else>) add_compile_options(-Wstack-protector -fstack-protector) @@ -126,6 +134,11 @@ if(NOT RESOLV_IN_LIBC) target_link_libraries(nvi PRIVATE ${RESOLV_LIBRARY}) endif() +check_symbol_exists(asprintf "stdio.h" ASPRINTF_IN_STDIO_H) +if(NOT ASPRINTF_IN_STDIO_H) + target_compile_definitions(nvi PRIVATE _GNU_SOURCE) +endif() + if(USE_WIDECHAR) find_library(CURSES_LIBRARY NAMES ncursesw cursesw curses HINTS /usr/lib) find_library(TERMINFO_LIBRARY NAMES tinfow terminfo HINTS /usr/lib) @@ -142,7 +155,10 @@ else() target_compile_options(nvi PRIVATE -Wno-pointer-sign) endif() -target_link_libraries(nvi PRIVATE ${CURSES_LIBRARY} ${TERMINFO_LIBRARY}) +target_link_libraries(nvi PRIVATE ${CURSES_LIBRARY}) +if(TERMINFO_LIBRARY) + target_link_libraries(nvi PRIVATE ${TERMINFO_LIBRARY}) +endif() if(USE_ICONV) check_function_exists(iconv ICONV_IN_LIBC) @@ -189,6 +205,18 @@ check_function_exists(dbopen DBOPEN_IN_LIBC) if(NOT DBOPEN_IN_LIBC) target_link_libraries(nvi PRIVATE db1) endif() +if (APPLE) + # Avoid using an incompatible db.h installed to /usr/local (since this is + # part of the default search path on macOS) + set(DB_H_GUESS "${CMAKE_OSX_SYSROOT}/usr/include/db.h") + if (NOT EXISTS ${DB_H_GUESS}) + message(FATAL_ERROR "Could not find db.h at the expected path (${DB_H_GUESS}).") + endif() + add_definitions("-DDB_H_ABS_PATH=<${DB_H_GUESS}>") +else() + find_path(DB_INCLUDE_DIR db.h PATH_SUFFIXES db1) + target_include_directories(nvi PRIVATE ${DB_INCLUDE_DIR}) +endif() check_include_files(libutil.h HAVE_LIBUTIL_H) check_include_files(ncurses.h HAVE_NCURSES_H) @@ -196,6 +224,10 @@ check_include_files(ncursesw/ncurses.h HAVE_NCURSESW_NCURSES_H) check_include_files(pty.h HAVE_PTY_H) check_include_files(term.h HAVE_TERM_H) check_struct_has_member("struct dirent" d_namlen dirent.h HAVE_DIRENT_D_NAMLEN LANGUAGE C) +check_struct_has_member("struct stat" st_mtimespec + "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIMESPEC LANGUAGE C) +check_struct_has_member("struct stat" st_mtim + "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM LANGUAGE C) configure_file(files/config.h.in config.h) diff --git a/catalog/dump.c b/catalog/dump.c index 248f718d719b..ef893d647edf 100644 --- a/catalog/dump.c +++ b/catalog/dump.c @@ -35,24 +35,24 @@ parse(FILE *fp) { int ch, s1, s2, s3; -#define TESTD(s) do { \ +#define TESTD(s) { \ if ((s = getc(fp)) == EOF) \ return; \ if (!isdigit(s)) \ continue; \ -} while (0) -#define TESTP do { \ +} +#define TESTP { \ if ((ch = getc(fp)) == EOF) \ return; \ if (ch != '|') \ continue; \ -} while (0) -#define MOVEC(t) do { \ +} +#define MOVEC(t) { \ do { \ if ((ch = getc(fp)) == EOF) \ return; \ } while (ch != (t)); \ -} while (0) +} for (;;) { MOVEC('"'); TESTD(s1); diff --git a/cl/cl.h b/cl/cl.h index d230a55a56d7..a04c9e9f1b0d 100644 --- a/cl/cl.h +++ b/cl/cl.h @@ -7,9 +7,6 @@ * See the LICENSE file for redistribution information. */ -#ifdef USE_WIDECHAR -#define _XOPEN_SOURCE_EXTENDED -#endif #ifdef HAVE_NCURSESW_NCURSES_H #include #elif defined HAVE_NCURSES_H diff --git a/cl/cl_read.c b/cl/cl_read.c index ddf3acc1918c..8dc1d3cbebc9 100644 --- a/cl/cl_read.c +++ b/cl/cl_read.c @@ -317,10 +317,10 @@ cl_resize(SCR *sp, size_t lines, size_t columns) argv[0] = &a; argv[1] = &b; - a.len = SPRINTF(b1, sizeof(b1), L("lines=%lu"), (u_long)lines); + a.len = SPRINTF(b1, SIZE(b1), L("lines=%lu"), (u_long)lines); if (opts_set(sp, argv, NULL)) return (1); - a.len = SPRINTF(b1, sizeof(b1), L("columns=%lu"), (u_long)columns); + a.len = SPRINTF(b1, SIZE(b1), L("columns=%lu"), (u_long)columns); if (opts_set(sp, argv, NULL)) return (1); return (0); diff --git a/cl/extern.h b/cl/extern.h deleted file mode 100644 index 7b01ccd3f8cf..000000000000 --- a/cl/extern.h +++ /dev/null @@ -1,31 +0,0 @@ -int cl_waddstr(SCR *, const CHAR_T *, size_t); -int cl_addstr(SCR *, const char *, size_t); -int cl_attr(SCR *, scr_attr_t, int); -int cl_baud(SCR *, u_long *); -int cl_bell(SCR *); -int cl_clrtoeol(SCR *); -int cl_cursor(SCR *, size_t *, size_t *); -int cl_deleteln(SCR *); -int cl_discard(SCR *, SCR **); -int cl_ex_adjust(SCR *, exadj_t); -int cl_insertln(SCR *); -int cl_keyval(SCR *, scr_keyval_t, CHAR_T *, int *); -int cl_move(SCR *, size_t, size_t); -int cl_refresh(SCR *, int); -int cl_rename(SCR *, char *, int); -void cl_setname(GS *, char *); -int cl_split(SCR *, SCR *); -int cl_suspend(SCR *, int *); -void cl_usage(void); -int sig_init(GS *, SCR *); -int cl_event(SCR *, EVENT *, u_int32_t, int); -int cl_screen(SCR *, u_int32_t); -int cl_quit(GS *); -int cl_getcap(SCR *, char *, char **); -int cl_term_init(SCR *); -int cl_term_end(GS *); -int cl_fmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t); -int cl_optchange(SCR *, int, char *, u_long *); -int cl_omesg(SCR *, CL_PRIVATE *, int); -int cl_ssize(SCR *, int, size_t *, size_t *, int *); -int cl_putchar(int); diff --git a/common/common.h b/common/common.h index dc4155610225..45f22fb49d1b 100644 --- a/common/common.h +++ b/common/common.h @@ -11,10 +11,10 @@ #define TCSASOFT 0 #endif -#ifdef __linux__ -#include "/usr/include/db1/db.h" /* Only include db1. */ +#ifdef DB_H_ABS_PATH +#include DB_H_ABS_PATH #else -#include "/usr/include/db.h" /* Only include db1. */ +#include #endif #include /* May refer to the bundled regex. */ diff --git a/common/conv.h b/common/conv.h index ee3efb5a8308..4daa8221ff8f 100644 --- a/common/conv.h +++ b/common/conv.h @@ -28,7 +28,7 @@ typedef int iconv_t; #define KEY_NEEDSWIDE(sp, ch) \ (INTISWIDE(ch) && KEY_LEN(sp, ch) <= 4) #define KEY_COL(sp, ch) \ - (KEY_NEEDSWIDE(sp, ch) ? CHAR_WIDTH(sp, ch) : KEY_LEN(sp, ch)) + (KEY_NEEDSWIDE(sp, ch) ? XCHAR_WIDTH(sp, ch) : KEY_LEN(sp, ch)) enum { IC_FE_CHAR2INT, IC_FE_INT2CHAR, IC_IE_CHAR2INT, IC_IE_TO_UTF16 }; diff --git a/common/exf.c b/common/exf.c index f9eb2150276d..49e39c242648 100644 --- a/common/exf.c +++ b/common/exf.c @@ -199,7 +199,14 @@ file_init(SCR *sp, FREF *frp, char *rcv_name, int flags) if (!LF_ISSET(FS_OPENERR)) F_SET(frp, FR_NEWFILE); +#if defined HAVE_STRUCT_STAT_ST_MTIMESPEC + ep->mtim = sb.st_mtimespec; +#elif defined HAVE_STRUCT_STAT_ST_MTIM ep->mtim = sb.st_mtim; +#else + ep->mtim.tv_sec = sb.st_mtime; + ep->mtim.tv_nsec = 0; +#endif } else { /* * XXX @@ -218,7 +225,14 @@ file_init(SCR *sp, FREF *frp, char *rcv_name, int flags) ep->mdev = sb.st_dev; ep->minode = sb.st_ino; +#if defined HAVE_STRUCT_STAT_ST_MTIMESPEC + ep->mtim = sb.st_mtimespec; +#elif defined HAVE_STRUCT_STAT_ST_MTIM ep->mtim = sb.st_mtim; +#else + ep->mtim.tv_sec = sb.st_mtime; + ep->mtim.tv_nsec = 0; +#endif if (!S_ISREG(sb.st_mode)) msgq_str(sp, M_ERR, oname, @@ -796,7 +810,13 @@ file_write(SCR *sp, MARK *fm, MARK *tm, char *name, int flags) if (noname && !LF_ISSET(FS_FORCE | FS_APPEND) && ((F_ISSET(ep, F_DEVSET) && (sb.st_dev != ep->mdev || sb.st_ino != ep->minode)) || +#if defined HAVE_STRUCT_STAT_ST_MTIMESPEC + timespeccmp(&sb.st_mtimespec, &ep->mtim, !=))) { +#elif defined HAVE_STRUCT_STAT_ST_MTIM timespeccmp(&sb.st_mtim, &ep->mtim, !=))) { +#else + sb.st_mtime != ep->mtim.tv_sec)) { +#endif msgq_str(sp, M_ERR, name, LF_ISSET(FS_POSSIBLE) ? "250|%s: file modified more recently than this copy; use ! to override" : "251|%s: file modified more recently than this copy"); @@ -895,7 +915,14 @@ success_open: ep->mdev = sb.st_dev; ep->minode = sb.st_ino; +#if defined HAVE_STRUCT_STAT_ST_MTIMESPEC + ep->mtim = sb.st_mtimespec; +#elif defined HAVE_STRUCT_STAT_ST_MTIM ep->mtim = sb.st_mtim; +#else + ep->mtim.tv_sec = sb.st_mtime; + ep->mtim.tv_nsec = 0; +#endif } } diff --git a/common/extern.h b/common/extern.h deleted file mode 100644 index c887696080de..000000000000 --- a/common/extern.h +++ /dev/null @@ -1,131 +0,0 @@ -char * codeset(void); -void conv_init(SCR *, SCR *); -int conv_enc(SCR *, int, char *); -void conv_end(SCR *); -int cut(SCR *, CHAR_T *, MARK *, MARK *, int); -int cut_line(SCR *, recno_t, size_t, size_t, CB *); -void cut_close(GS *); -TEXT *text_init(SCR *, const CHAR_T *, size_t, size_t); -void text_lfree(TEXTH *); -void text_free(TEXT *); -int del(SCR *, MARK *, MARK *, int); -int looks_utf8(const char *, size_t); -int looks_utf16(const char *, size_t); -int decode_utf8(const char *); -int decode_utf16(const char *, int); -FREF *file_add(SCR *, char *); -int file_init(SCR *, FREF *, char *, int); -int file_end(SCR *, EXF *, int); -int file_write(SCR *, MARK *, MARK *, char *, int); -int file_m1(SCR *, int, int); -int file_m2(SCR *, int); -int file_m3(SCR *, int); -int file_aw(SCR *, int); -void set_alt_name(SCR *, char *); -lockr_t file_lock(SCR *, char *, int, int); -int v_key_init(SCR *); -void v_key_ilookup(SCR *); -size_t v_key_len(SCR *, ARG_CHAR_T); -char *v_key_name(SCR *, ARG_CHAR_T); -e_key_t v_key_val(SCR *, ARG_CHAR_T); -int v_event_push(SCR *, EVENT *, CHAR_T *, size_t, u_int); -int v_event_get(SCR *, EVENT *, int, u_int32_t); -void v_event_err(SCR *, EVENT *); -int v_event_flush(SCR *, u_int); -int db_eget(SCR *, recno_t, CHAR_T **, size_t *, int *); -int db_get(SCR *, recno_t, u_int32_t, CHAR_T **, size_t *); -int db_delete(SCR *, recno_t); -int db_append(SCR *, int, recno_t, CHAR_T *, size_t); -int db_insert(SCR *, recno_t, CHAR_T *, size_t); -int db_set(SCR *, recno_t, CHAR_T *, size_t); -int db_exist(SCR *, recno_t); -int db_last(SCR *, recno_t *); -int db_rget(SCR *, recno_t, char **, size_t *); -int db_rset(SCR *, recno_t, char *, size_t); -void db_err(SCR *, recno_t); -int log_init(SCR *, EXF *); -int log_end(SCR *, EXF *); -int log_cursor(SCR *); -int log_line(SCR *, recno_t, u_int); -int log_mark(SCR *, LMARK *); -int log_backward(SCR *, MARK *); -int log_setline(SCR *); -int log_forward(SCR *, MARK *); -int editor(GS *, int, char *[]); -void v_end(GS *); -int mark_init(SCR *, EXF *); -int mark_end(SCR *, EXF *); -int mark_get(SCR *, ARG_CHAR_T, MARK *, mtype_t); -int mark_set(SCR *, ARG_CHAR_T, MARK *, int); -int mark_insdel(SCR *, lnop_t, recno_t); -void msgq(SCR *, mtype_t, const char *, ...); -void msgq_wstr(SCR *, mtype_t, const CHAR_T *, const char *); -void msgq_str(SCR *, mtype_t, const char *, const char *); -void mod_rpt(SCR *); -void msgq_status(SCR *, recno_t, u_int); -int msg_open(SCR *, char *); -void msg_close(GS *); -const char *msg_cmsg(SCR *, cmsg_t, size_t *); -const char *msg_cat(SCR *, const char *, size_t *); -char *msg_print(SCR *, const char *, int *); -int opts_init(SCR *, int *); -int opts_set(SCR *, ARGS *[], char *); -int o_set(SCR *, int, u_int, char *, u_long); -int opts_empty(SCR *, int, int); -void opts_dump(SCR *, enum optdisp); -int opts_save(SCR *, FILE *); -OPTLIST const *opts_search(CHAR_T *); -void opts_nomatch(SCR *, CHAR_T *); -int opts_copy(SCR *, SCR *); -void opts_free(SCR *); -int f_altwerase(SCR *, OPTION *, char *, u_long *); -int f_columns(SCR *, OPTION *, char *, u_long *); -int f_lines(SCR *, OPTION *, char *, u_long *); -int f_lisp(SCR *, OPTION *, char *, u_long *); -int f_msgcat(SCR *, OPTION *, char *, u_long *); -int f_print(SCR *, OPTION *, char *, u_long *); -int f_readonly(SCR *, OPTION *, char *, u_long *); -int f_recompile(SCR *, OPTION *, char *, u_long *); -int f_reformat(SCR *, OPTION *, char *, u_long *); -int f_ttywerase(SCR *, OPTION *, char *, u_long *); -int f_w300(SCR *, OPTION *, char *, u_long *); -int f_w1200(SCR *, OPTION *, char *, u_long *); -int f_w9600(SCR *, OPTION *, char *, u_long *); -int f_window(SCR *, OPTION *, char *, u_long *); -int f_encoding(SCR *, OPTION *, char *, u_long *); -int put(SCR *, CB *, CHAR_T *, MARK *, MARK *, int); -int rcv_tmp(SCR *, EXF *, char *); -int rcv_init(SCR *); -int rcv_sync(SCR *, u_int); -int rcv_list(SCR *); -int rcv_read(SCR *, FREF *); -int screen_init(GS *, SCR *, SCR **); -int screen_end(SCR *); -SCR *screen_next(SCR *); -int f_search(SCR *, - MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int); -int b_search(SCR *, - MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int); -void search_busy(SCR *, busy_t); -int seq_set(SCR *, CHAR_T *, - size_t, CHAR_T *, size_t, CHAR_T *, size_t, seq_t, int); -int seq_delete(SCR *, CHAR_T *, size_t, seq_t); -int seq_free(SEQ *); -SEQ *seq_find - (SCR *, SEQ **, EVENT *, CHAR_T *, size_t, seq_t, int *); -void seq_close(GS *); -int seq_dump(SCR *, seq_t, int); -int seq_save(SCR *, FILE *, char *, seq_t); -int e_memcmp(CHAR_T *, EVENT *, size_t); -void *binc(SCR *, void *, size_t *, size_t); -int nonblank(SCR *, recno_t, size_t *); -char *join(char *, char *); -char *expanduser(char *); -char *quote(char *); -char *v_strdup(SCR *, const char *, size_t); -CHAR_T *v_wstrdup(SCR *, const CHAR_T *, size_t); -enum nresult nget_uslong(u_long *, const CHAR_T *, CHAR_T **, int); -enum nresult nget_slong(long *, const CHAR_T *, CHAR_T **, int); -void timepoint_steady(struct timespec *); -void timepoint_system(struct timespec *); -void TRACE(SCR *, const char *, ...); diff --git a/common/key.h b/common/key.h index 3e55d3044129..ae0ba92d1ce5 100644 --- a/common/key.h +++ b/common/key.h @@ -22,8 +22,8 @@ sp->conv.input2int(sp, n, nlen, &(cw), &wlen, &w) #define CONST #define INTISWIDE(c) (wctob(c) == EOF) -#define CHAR_WIDTH(sp, ch) wcwidth(ch) -#define CAN_PRINT(sp, ch) (CHAR_WIDTH(sp, ch) > 0) +#define XCHAR_WIDTH(sp, ch) wcwidth(ch) +#define CAN_PRINT(sp, ch) (XCHAR_WIDTH(sp, ch) > 0) #else #define FILE2INT5(sp,buf,n,nlen,w,wlen) \ (w = n, wlen = nlen, 0) @@ -37,7 +37,7 @@ (w = n, wlen = nlen, 0) #define CONST const #define INTISWIDE(c) 0 -#define CHAR_WIDTH(sp, ch) 1 +#define XCHAR_WIDTH(sp, ch) 1 #define CAN_PRINT(sp, ch) isprint(ch) #endif #define FILE2INT(sp,n,nlen,w,wlen) \ diff --git a/common/options.h b/common/options.h index 5ed12d39c342..d723a51217bc 100644 --- a/common/options.h +++ b/common/options.h @@ -97,4 +97,8 @@ enum optdisp { NO_DISPLAY, ALL_DISPLAY, CHANGED_DISPLAY, SELECT_DISPLAY }; /* Options array. */ extern OPTLIST const optlist[]; +#ifdef O_PATH +#undef O_PATH /* bits/fcntl-linux.h may have defined O_PATH. */ +#endif + #include "options_def.h" diff --git a/common/options_def.h b/common/options_def.h deleted file mode 100644 index 54dd6c20c891..000000000000 --- a/common/options_def.h +++ /dev/null @@ -1,84 +0,0 @@ -#define O_ALTWERASE 0 -#define O_AUTOINDENT 1 -#define O_AUTOPRINT 2 -#define O_AUTOWRITE 3 -#define O_BACKUP 4 -#define O_BEAUTIFY 5 -#define O_CDPATH 6 -#define O_CEDIT 7 -#define O_COLUMNS 8 -#define O_COMBINED 9 -#define O_COMMENT 10 -#define O_TMPDIR 11 -#define O_EDCOMPATIBLE 12 -#define O_ERRORBELLS 13 -#define O_ESCAPETIME 14 -#define O_EXPANDTAB 15 -#define O_EXRC 16 -#define O_EXTENDED 17 -#define O_FILEC 18 -#define O_FILEENCODING 19 -#define O_FLASH 20 -#define O_HARDTABS 21 -#define O_ICLOWER 22 -#define O_IGNORECASE 23 -#define O_INPUTENCODING 24 -#define O_KEYTIME 25 -#define O_LEFTRIGHT 26 -#define O_LINES 27 -#define O_LISP 28 -#define O_LIST 29 -#define O_LOCKFILES 30 -#define O_MAGIC 31 -#define O_MATCHCHARS 32 -#define O_MATCHTIME 33 -#define O_MESG 34 -#define O_MODELINE 35 -#define O_MSGCAT 36 -#define O_NOPRINT 37 -#define O_NUMBER 38 -#define O_OCTAL 39 -#define O_OPEN 40 -#define O_OPTIMIZE 41 -#define O_PARAGRAPHS 42 -#define O_PATH 43 -#define O_PRINT 44 -#define O_PROMPT 45 -#define O_READONLY 46 -#define O_RECDIR 47 -#define O_REDRAW 48 -#define O_REMAP 49 -#define O_REPORT 50 -#define O_RULER 51 -#define O_SCROLL 52 -#define O_SEARCHINCR 53 -#define O_SECTIONS 54 -#define O_SECURE 55 -#define O_SHELL 56 -#define O_SHELLMETA 57 -#define O_SHIFTWIDTH 58 -#define O_SHOWMATCH 59 -#define O_SHOWMODE 60 -#define O_SIDESCROLL 61 -#define O_SLOWOPEN 62 -#define O_SOURCEANY 63 -#define O_TABSTOP 64 -#define O_TAGLENGTH 65 -#define O_TAGS 66 -#define O_TERM 67 -#define O_TERSE 68 -#define O_TILDEOP 69 -#define O_TIMEOUT 70 -#define O_TTYWERASE 71 -#define O_VERBOSE 72 -#define O_W1200 73 -#define O_W300 74 -#define O_W9600 75 -#define O_WARN 76 -#define O_WINDOW 77 -#define O_WINDOWNAME 78 -#define O_WRAPLEN 79 -#define O_WRAPMARGIN 80 -#define O_WRAPSCAN 81 -#define O_WRITEANY 82 -#define O_OPTIONCOUNT 83 diff --git a/common/recover.c b/common/recover.c index 120cf4f60b19..cf222bfb5200 100644 --- a/common/recover.c +++ b/common/recover.c @@ -701,7 +701,13 @@ rcv_read(SCR *sp, FREF *frp) /* If we've found more than one, take the most recent. */ (void)fstat(fileno(fp), &sb); if (recp == NULL || +#if defined HAVE_STRUCT_STAT_ST_MTIMESPEC + timespeccmp(&rec_mtim, &sb.st_mtimespec, <)) { +#elif defined HAVE_STRUCT_STAT_ST_MTIM timespeccmp(&rec_mtim, &sb.st_mtim, <)) { +#else + rec_mtim.tv_sec < sb.st_mtime) { +#endif p = recp; t = pathp; recp = recpath; @@ -710,7 +716,13 @@ rcv_read(SCR *sp, FREF *frp) free(p); free(t); } +#if defined HAVE_STRUCT_STAT_ST_MTIMESPEC + rec_mtim = sb.st_mtimespec; +#elif defined HAVE_STRUCT_STAT_ST_MTIM rec_mtim = sb.st_mtim; +#else + rec_mtim.tv_sec = sb.st_mtime; +#endif if (sv_fd != -1) (void)close(sv_fd); sv_fd = dup(fileno(fp)); diff --git a/ex/ex.c b/ex/ex.c index 343131537afa..fd920a8df9a1 100644 --- a/ex/ex.c +++ b/ex/ex.c @@ -2266,7 +2266,8 @@ ex_comm_search(CHAR_T *name, size_t len) return (NULL); if (cp->name[0] != name[0]) continue; - if (!MEMCMP(name, cp->name, len)) + if (STRLEN(cp->name) >= len && + !MEMCMP(name, cp->name, len)) return (cp); } return (NULL); diff --git a/ex/ex_cscope.c b/ex/ex_cscope.c index 74d7f8af95be..e07aa64df802 100644 --- a/ex/ex_cscope.c +++ b/ex/ex_cscope.c @@ -261,7 +261,14 @@ cscope_add(SCR *sp, EXCMD *cmdp, CHAR_T *dname) csc->dname = csc->buf; csc->dlen = len; memcpy(csc->dname, np, len); +#if defined HAVE_STRUCT_STAT_ST_MTIMESPEC + csc->mtim = sb.st_mtimespec; +#elif defined HAVE_STRUCT_STAT_ST_MTIM csc->mtim = sb.st_mtim; +#else + csc->mtim.tv_sec = sb.st_mtime; + csc->mtim.tv_nsec = 0; +#endif /* Get the search paths for the cscope. */ if (get_paths(sp, csc)) @@ -812,8 +819,15 @@ csc_file(SCR *sp, CSC *csc, char *name, char **dirp, size_t *dlenp, int *isolder free(buf); *dirp = *pp; *dlenp = strlen(*pp); +#if defined HAVE_STRUCT_STAT_ST_MTIMESPEC + *isolderp = timespeccmp( + &sb.st_mtimespec, &csc->mtim, <); +#elif defined HAVE_STRUCT_STAT_ST_MTIM *isolderp = timespeccmp( &sb.st_mtim, &csc->mtim, <); +#else + *isolderp = sb.st_mtime < csc->mtim.tv_sec; +#endif return; } free(buf); diff --git a/ex/ex_def.h b/ex/ex_def.h deleted file mode 100644 index 7afb7b19d677..000000000000 --- a/ex/ex_def.h +++ /dev/null @@ -1,76 +0,0 @@ -#define C_SCROLL 0 -#define C_BANG 1 -#define C_HASH 2 -#define C_SUBAGAIN 3 -#define C_STAR 4 -#define C_SHIFTL 5 -#define C_EQUAL 6 -#define C_SHIFTR 7 -#define C_AT 8 -#define C_APPEND 9 -#define C_ABBR 10 -#define C_ARGS 11 -#define C_BG 12 -#define C_CHANGE 13 -#define C_CD 14 -#define C_CHDIR 15 -#define C_COPY 16 -#define C_CSCOPE 17 -#define C_DELETE 18 -#define C_DISPLAY 19 -#define C_EDIT 20 -#define C_EX 21 -#define C_EXUSAGE 22 -#define C_FILE 23 -#define C_FG 24 -#define C_GLOBAL 25 -#define C_HELP 26 -#define C_INSERT 27 -#define C_JOIN 28 -#define C_K 29 -#define C_LIST 30 -#define C_MOVE 31 -#define C_MARK 32 -#define C_MAP 33 -#define C_MKEXRC 34 -#define C_NEXT 35 -#define C_NUMBER 36 -#define C_OPEN 37 -#define C_PRINT 38 -#define C_PRESERVE 39 -#define C_PREVIOUS 40 -#define C_PUT 41 -#define C_QUIT 42 -#define C_READ 43 -#define C_RECOVER 44 -#define C_RESIZE 45 -#define C_REWIND 46 -#define C_SUBSTITUTE 47 -#define C_SCRIPT 48 -#define C_SET 49 -#define C_SHELL 50 -#define C_SOURCE 51 -#define C_STOP 52 -#define C_SUSPEND 53 -#define C_T 54 -#define C_TAG 55 -#define C_TAGNEXT 56 -#define C_TAGPOP 57 -#define C_TAGPREV 58 -#define C_TAGTOP 59 -#define C_UNDO 60 -#define C_UNABBREVIATE 61 -#define C_UNMAP 62 -#define C_V 63 -#define C_VERSION 64 -#define C_VISUAL_EX 65 -#define C_VISUAL_VI 66 -#define C_VIUSAGE 67 -#define C_VSPLIT 68 -#define C_WRITE 69 -#define C_WN 70 -#define C_WQ 71 -#define C_XIT 72 -#define C_YANK 73 -#define C_Z 74 -#define C_SUBTILDE 75 diff --git a/ex/extern.h b/ex/extern.h deleted file mode 100644 index 9d7b1d674c3c..000000000000 --- a/ex/extern.h +++ /dev/null @@ -1,131 +0,0 @@ -int ex(SCR **); -int ex_cmd(SCR *); -int ex_range(SCR *, EXCMD *, int *); -int ex_is_abbrev(CHAR_T *, size_t); -int ex_is_unmap(CHAR_T *, size_t); -void ex_badaddr - (SCR *, EXCMDLIST const *, enum badaddr, enum nresult); -int ex_abbr(SCR *, EXCMD *); -int ex_unabbr(SCR *, EXCMD *); -int ex_append(SCR *, EXCMD *); -int ex_change(SCR *, EXCMD *); -int ex_insert(SCR *, EXCMD *); -int ex_next(SCR *, EXCMD *); -int ex_prev(SCR *, EXCMD *); -int ex_rew(SCR *, EXCMD *); -int ex_args(SCR *, EXCMD *); -char **ex_buildargv(SCR *, EXCMD *, char *); -int argv_init(SCR *, EXCMD *); -int argv_exp0(SCR *, EXCMD *, CHAR_T *, size_t); -int argv_exp1(SCR *, EXCMD *, CHAR_T *, size_t, int); -int argv_exp2(SCR *, EXCMD *, CHAR_T *, size_t); -int argv_exp3(SCR *, EXCMD *, CHAR_T *, size_t); -int argv_flt_ex(SCR *, EXCMD *, CHAR_T *, size_t); -int argv_free(SCR *); -int argv_flt_path(SCR *, EXCMD *, CHAR_T *, size_t); -CHAR_T *argv_esc(SCR *, EXCMD *, CHAR_T *, size_t); -CHAR_T *argv_uesc(SCR *, EXCMD *, CHAR_T *, size_t); -int ex_at(SCR *, EXCMD *); -int ex_bang(SCR *, EXCMD *); -int ex_cd(SCR *, EXCMD *); -int ex_cscope(SCR *, EXCMD *); -int cscope_end(SCR *); -int cscope_display(SCR *); -int cscope_search(SCR *, TAGQ *, TAG *); -int ex_delete(SCR *, EXCMD *); -int ex_display(SCR *, EXCMD *); -int ex_edit(SCR *, EXCMD *); -int ex_equal(SCR *, EXCMD *); -int ex_file(SCR *, EXCMD *); -int ex_filter(SCR *, - EXCMD *, MARK *, MARK *, MARK *, CHAR_T *, enum filtertype); -int ex_global(SCR *, EXCMD *); -int ex_v(SCR *, EXCMD *); -int ex_g_insdel(SCR *, lnop_t, recno_t); -int ex_screen_copy(SCR *, SCR *); -int ex_screen_end(SCR *); -int ex_optchange(SCR *, int, char *, u_long *); -int ex_exrc(SCR *); -int ex_run_str(SCR *, char *, CHAR_T *, size_t, int, int); -int ex_join(SCR *, EXCMD *); -int ex_map(SCR *, EXCMD *); -int ex_unmap(SCR *, EXCMD *); -int ex_mark(SCR *, EXCMD *); -int ex_mkexrc(SCR *, EXCMD *); -int ex_copy(SCR *, EXCMD *); -int ex_move(SCR *, EXCMD *); -int ex_open(SCR *, EXCMD *); -int ex_preserve(SCR *, EXCMD *); -int ex_recover(SCR *, EXCMD *); -int ex_list(SCR *, EXCMD *); -int ex_number(SCR *, EXCMD *); -int ex_pr(SCR *, EXCMD *); -int ex_print(SCR *, EXCMD *, MARK *, MARK *, u_int32_t); -int ex_ldisplay(SCR *, const CHAR_T *, size_t, size_t, u_int); -int ex_scprint(SCR *, MARK *, MARK *); -int ex_printf(SCR *, const char *, ...); -int ex_puts(SCR *, const char *); -int ex_fflush(SCR *sp); -int ex_put(SCR *, EXCMD *); -int ex_quit(SCR *, EXCMD *); -int ex_read(SCR *, EXCMD *); -int ex_readfp(SCR *, char *, FILE *, MARK *, recno_t *, int); -int ex_bg(SCR *, EXCMD *); -int ex_fg(SCR *, EXCMD *); -int ex_resize(SCR *, EXCMD *); -int ex_sdisplay(SCR *); -int ex_script(SCR *, EXCMD *); -int sscr_exec(SCR *, recno_t); -int sscr_input(SCR *); -int sscr_end(SCR *); -int ex_set(SCR *, EXCMD *); -int ex_shell(SCR *, EXCMD *); -int ex_exec_proc(SCR *, EXCMD *, char *, const char *, int); -int proc_wait(SCR *, long, const char *, int, int); -int ex_shiftl(SCR *, EXCMD *); -int ex_shiftr(SCR *, EXCMD *); -int ex_retab(SCR *, EXCMD *); -int ex_source(SCR *, EXCMD *); -int ex_stop(SCR *, EXCMD *); -int ex_s(SCR *, EXCMD *); -int ex_subagain(SCR *, EXCMD *); -int ex_subtilde(SCR *, EXCMD *); -int re_compile(SCR *, - CHAR_T *, size_t, CHAR_T **, size_t *, regex_t *, u_int); -void re_error(SCR *, int, regex_t *); -int ex_tag_first(SCR *, CHAR_T *); -int ex_tag_push(SCR *, EXCMD *); -int ex_tag_next(SCR *, EXCMD *); -int ex_tag_prev(SCR *, EXCMD *); -int ex_tag_nswitch(SCR *, TAG *, int); -int ex_tag_Nswitch(SCR *, TAG *, int); -int ex_tag_pop(SCR *, EXCMD *); -int ex_tag_top(SCR *, EXCMD *); -int ex_tag_display(SCR *); -int ex_tag_copy(SCR *, SCR *); -int tagq_free(SCR *, TAGQ *); -int tagq_push(SCR*, TAGQ*, int, int ); -void tag_msg(SCR *, tagmsg_t, char *); -int ex_tagf_alloc(SCR *, char *); -int ex_tag_free(SCR *); -int ex_txt(SCR *, TEXTH *, ARG_CHAR_T, u_int32_t); -int ex_undo(SCR *, EXCMD *); -int ex_help(SCR *, EXCMD *); -int ex_usage(SCR *, EXCMD *); -int ex_viusage(SCR *, EXCMD *); -void ex_cinit(SCR *, EXCMD *, int, int, recno_t, recno_t, int); -int ex_getline(SCR *, FILE *, size_t *); -int ex_ncheck(SCR *, int); -int ex_init(SCR *); -void ex_wemsg(SCR *, CHAR_T *, exm_t); -void ex_emsg(SCR *, char *, exm_t); -int ex_version(SCR *, EXCMD *); -int ex_visual(SCR *, EXCMD *); -int ex_wn(SCR *, EXCMD *); -int ex_wq(SCR *, EXCMD *); -int ex_write(SCR *, EXCMD *); -int ex_xit(SCR *, EXCMD *); -int ex_writefp(SCR *, - char *, FILE *, MARK *, MARK *, u_long *, u_long *, int); -int ex_yank(SCR *, EXCMD *); -int ex_z(SCR *, EXCMD *); diff --git a/ex/version.h b/ex/version.h deleted file mode 100644 index 742b145ebd3f..000000000000 --- a/ex/version.h +++ /dev/null @@ -1 +0,0 @@ -#define VI_VERSION "2.2.0 (2020-08-01)" diff --git a/man/vi.1 b/man/vi.1 index ce7b883f8497..62f28d72569c 100644 --- a/man/vi.1 +++ b/man/vi.1 @@ -1809,7 +1809,8 @@ Display buffers, Cscope connections, screens or tags. .Op Ar +cmd .Op Ar file .Xc -Edit a different file. +Edit a different file. The capitalized command opens a new screen below the +current screen. .Pp .It Xo .Cm exu Ns Op Cm sage @@ -1832,7 +1833,8 @@ Display and optionally change the file name. .Xc .Nm vi mode only. -Foreground the specified screen. +Foreground the specified screen. The capitalized command opens a new screen +below the current screen. .Pp .It Xo .Op Ar range @@ -1919,7 +1921,8 @@ Write the abbreviations, editor options and maps to the specified .Op Cm !\& .Op Ar .Xc -Edit the next file from the argument list. +Edit the next file from the argument list. The capitalized command opens a +new screen below the current screen. .\" .Pp .\" .It Xo .\" .Op Ar line @@ -1940,7 +1943,8 @@ option. .Cm rev Ns Op Cm ious Ns .Op Cm !\& .Xc -Edit the previous file from the argument list. +Edit the previous file from the argument list. The capitalized command opens +a new screen below the current screen. .Pp .It Xo .Op Ar range @@ -2103,7 +2107,8 @@ character is usually .Op Cm !\& .Ar tagstring .Xc -Edit the file containing the specified tag. +Edit the file containing the specified tag. The capitalized command opens a +new screen below the current screen. .Pp .It Xo .Cm tagn Ns Op Cm ext Ns @@ -2166,15 +2171,15 @@ Enter .Nm vi . .Pp .It Xo -.Op Cm Vi Ns -.Cm i Ns Op Cm sual Ns +.Cm Vi Ns +.Op Cm sual Ns .Op Cm !\& .Op Ar +cmd .Op Ar file .Xc .Nm vi -mode only. -Edit a new file. +mode only. Edit a different file by opening a new screen below the current +screen. .Pp .It Xo .Cm viu Ns Op Cm sage @@ -2185,6 +2190,14 @@ Display usage for a command. .Pp .It Xo +.Cm vs Ns Op Cm plit +.Op Ar +cmd *** 228 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed May 19 11:41:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 33D2C63EEE5 for ; Wed, 19 May 2021 11:41: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 4FlWCx0djLz4qsF; Wed, 19 May 2021 11:41: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 E9AB712240; Wed, 19 May 2021 11:41: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 14JBfG3x024517; Wed, 19 May 2021 11:41:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JBfGMR024516; Wed, 19 May 2021 11:41:16 GMT (envelope-from git) Date: Wed, 19 May 2021 11:41:16 GMT Message-Id: <202105191141.14JBfGMR024516@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Baptiste Daroussin Subject: git: 4c51682101a7 - Create tag vendor/nvi/2.2.0-3bbdfe4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/tags/vendor/nvi/2.2.0-3bbdfe4 X-Git-Reftype: annotated tag X-Git-Commit: 4c51682101a735e0f19a3d3624735d1bc3a7a342 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 11:41:17 -0000 The annotated tag vendor/nvi/2.2.0-3bbdfe4 has been created by bapt: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/nvi/2.2.0-3bbdfe4 tag vendor/nvi/2.2.0-3bbdfe4 Tagger: Baptiste Daroussin TaggerDate: 2021-05-19 11:40:45 +0000 tag import of nvi 2.2.0-3bbdfe4 commit 8e6e1224184eb6cd3dfa05b2ecd9515c59f4f425 Author: Baptiste Daroussin AuthorDate: 2021-05-19 11:35:56 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-19 11:35:56 +0000 import nvi 2.2.0-3bbdfe4 From owner-dev-commits-src-all@freebsd.org Wed May 19 12:05:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Wed May 19 12:14:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9DD80640442; Wed, 19 May 2021 12:14:18 +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 4FlWy243TPz3LW0; Wed, 19 May 2021 12:14: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 73D2112859; Wed, 19 May 2021 12:14: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 14JCEIJi068727; Wed, 19 May 2021 12:14:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JCEI4m068726; Wed, 19 May 2021 12:14:18 GMT (envelope-from git) Date: Wed, 19 May 2021 12:14:18 GMT Message-Id: <202105191214.14JCEI4m068726@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: f0a5e81af436 - main - arm64: rockchip, implement the two rk805/808 clocks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0a5e81af4361abfc09ccaefbc375ece35ff79cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 12:14:18 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=f0a5e81af4361abfc09ccaefbc375ece35ff79cc commit f0a5e81af4361abfc09ccaefbc375ece35ff79cc Author: Bjoern A. Zeeb AuthorDate: 2021-05-06 14:25:52 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-19 11:48:11 +0000 arm64: rockchip, implement the two rk805/808 clocks While the xin32k clk was implemented in rk3399_cru as a fixed rate clock, migrate it to rk805 as we will also need the 2nd clock 'rtc_clko_wifi' for SDIO and BT. Both clocks remain fixed rate, and while the 1st one is always on (though that is not expressed in the clk framework), the 2nd one we can toggle on/off. Reviewed-by: manu Tested-by: manu MFC-after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26870 --- sys/arm64/rockchip/clk/rk3399_cru.c | 2 +- sys/arm64/rockchip/rk805.c | 122 +++++++++++++++++++++++++++++++++++- 2 files changed, 120 insertions(+), 4 deletions(-) diff --git a/sys/arm64/rockchip/clk/rk3399_cru.c b/sys/arm64/rockchip/clk/rk3399_cru.c index 595085862e13..585f6d4c33b9 100644 --- a/sys/arm64/rockchip/clk/rk3399_cru.c +++ b/sys/arm64/rockchip/clk/rk3399_cru.c @@ -775,7 +775,7 @@ PLIST(uart3_p)= {"clk_uart3_div", "clk_uart3_frac", "xin24m"}; static struct rk_clk rk3399_clks[] = { /* External clocks */ LINK("xin24m"), - FRATE(0, "xin32k", 32768), + LINK("xin32k"), FFACT(0, "xin12m", "xin24m", 1, 2), FRATE(0, "clkin_i2s", 0), FRATE(0, "pclkin_cif", 0), diff --git a/sys/arm64/rockchip/rk805.c b/sys/arm64/rockchip/rk805.c index d3e04081aeb2..2d5635fee72a 100644 --- a/sys/arm64/rockchip/rk805.c +++ b/sys/arm64/rockchip/rk805.c @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -584,6 +585,118 @@ rk805_reg_attach(device_t dev, phandle_t node, return (reg_sc); } +/* -------------------------------------------------------------------------- */ + +/* Clock class and method */ +struct rk805_clk_sc { + device_t base_dev; +}; + +#define CLK32OUT_REG 0x20 +#define CLK32OUT_CLKOUT2_EN 1 + +static int +rk805_clk_set_gate_1(struct clknode *clk, bool enable) +{ + struct rk805_clk_sc *sc; + uint8_t val; + + sc = clknode_get_softc(clk); + + rk805_read(sc->base_dev, CLK32OUT_REG, &val, sizeof(val)); + if (enable) + val |= CLK32OUT_CLKOUT2_EN; + else + val &= ~CLK32OUT_CLKOUT2_EN; + rk805_write(sc->base_dev, CLK32OUT_REG, &val, 1); + + return (0); +} + +static int +rk805_clk_recalc(struct clknode *clk, uint64_t *freq) +{ + + *freq = 32768; + return (0); +} + +static clknode_method_t rk805_clk_clknode_methods_0[] = { + CLKNODEMETHOD(clknode_recalc_freq, rk805_clk_recalc), + CLKNODEMETHOD_END +}; + +DEFINE_CLASS_1(rk805_clk_clknode_0, rk805_clk_clknode_class_0, + rk805_clk_clknode_methods_0, sizeof(struct rk805_clk_sc), + clknode_class); + +static clknode_method_t rk805_clk_clknode_methods_1[] = { + CLKNODEMETHOD(clknode_set_gate, rk805_clk_set_gate_1), + CLKNODEMETHOD_END +}; + +DEFINE_CLASS_1(rk805_clk_clknode_1, rk805_clk_clknode_class_1, + rk805_clk_clknode_methods_1, sizeof(struct rk805_clk_sc), + rk805_clk_clknode_class_0); + +static int +rk805_export_clocks(device_t dev) +{ + struct clkdom *clkdom; + struct clknode_init_def clkidef; + struct clknode *clk; + struct rk805_clk_sc *clksc; + const char **clknames; + phandle_t node; + int nclks, rv; + + node = ofw_bus_get_node(dev); + + /* clock-output-names are optional. Could use them for clkidef.name. */ + nclks = ofw_bus_string_list_to_array(node, "clock-output-names", + &clknames); + + clkdom = clkdom_create(dev); + + memset(&clkidef, 0, sizeof(clkidef)); + clkidef.id = 0; + clkidef.name = (nclks = 2) ? clknames[0] : "clk32kout1"; + clk = clknode_create(clkdom, &rk805_clk_clknode_class_0, &clkidef); + if (clk == NULL) { + device_printf(dev, "Cannot create '%s'.\n", clkidef.name); + return (ENXIO); + } + clksc = clknode_get_softc(clk); + clksc->base_dev = dev; + clknode_register(clkdom, clk); + + memset(&clkidef, 0, sizeof(clkidef)); + clkidef.id = 1; + clkidef.name = (nclks = 2) ? clknames[1] : "clk32kout2"; + clk = clknode_create(clkdom, &rk805_clk_clknode_class_1, &clkidef); + if (clk == NULL) { + device_printf(dev, "Cannot create '%s'.\n", clkidef.name); + return (ENXIO); + } + clksc = clknode_get_softc(clk); + clksc->base_dev = dev; + clknode_register(clkdom, clk); + + rv = clkdom_finit(clkdom); + if (rv != 0) { + device_printf(dev, "Cannot finalize clkdom initialization: " + "%d\n", rv); + return (ENXIO); + } + + if (bootverbose) + clkdom_dump(clkdom); + + return (0); +} + +/* -------------------------------------------------------------------------- */ + static int rk805_probe(device_t dev) { @@ -745,17 +858,20 @@ rk805_attach(device_t dev) struct rk805_regdef *regdefs; struct reg_list *regp; phandle_t rnode, child; - int i; + int error, i; sc = device_get_softc(dev); + sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + error = rk805_export_clocks(dev); + if (error != 0) + return (error); + sc->intr_hook.ich_func = rk805_start; sc->intr_hook.ich_arg = dev; - if (config_intrhook_establish(&sc->intr_hook) != 0) return (ENOMEM); - sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data; switch (sc->type) { case RK805: regdefs = rk805_regdefs; From owner-dev-commits-src-all@freebsd.org Wed May 19 13:09:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6BDDF641553; Wed, 19 May 2021 13:09: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 4FlY9P2YnRz4VF4; Wed, 19 May 2021 13:09: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 40FE91337E; Wed, 19 May 2021 13:09: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 14JD9DnP035425; Wed, 19 May 2021 13:09:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JD9DKq035424; Wed, 19 May 2021 13:09:13 GMT (envelope-from git) Date: Wed, 19 May 2021 13:09:13 GMT Message-Id: <202105191309.14JD9DKq035424@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eugene Grosbein Subject: git: f4b38c360e63 - main - rc.d: unbreak sysctl lastload 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/main X-Git-Reftype: branch X-Git-Commit: f4b38c360e63a6e66245efedbd6c070f9c0aee55 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 13:09:13 -0000 The branch main has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=f4b38c360e63a6e66245efedbd6c070f9c0aee55 commit f4b38c360e63a6e66245efedbd6c070f9c0aee55 Author: Eugene Grosbein AuthorDate: 2021-05-19 13:02:31 +0000 Commit: Eugene Grosbein CommitDate: 2021-05-19 13:02:31 +0000 rc.d: unbreak sysctl lastload /etc/rc.d/securelevel is supposed to run /etc/rc.d/sysctl lastload late at boot time to apply /etc/sysctl.conf settings that fail to apply early. However, this does not work in default configuration because of kern_securelevel_enable="NO" by default. Add new script /etc/rc.d/sysctl lastload that starts unconditionally. Reported by: Marek Zarychta MFC after: 1 month --- libexec/rc/rc.d/securelevel | 6 +----- libexec/rc/rc.d/sysctl_lastload | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/libexec/rc/rc.d/securelevel b/libexec/rc/rc.d/securelevel index 24dbf269df3f..8bb09dd920bd 100755 --- a/libexec/rc/rc.d/securelevel +++ b/libexec/rc/rc.d/securelevel @@ -4,7 +4,7 @@ # # PROVIDE: securelevel -# REQUIRE: adjkerntz ipfw pf +# REQUIRE: adjkerntz ipfw pf sysctl_lastload . /etc/rc.subr @@ -14,10 +14,6 @@ rcvar='kern_securelevel_enable' start_cmd="securelevel_start" stop_cmd=":" -# Last chance to set sysctl variables that failed the first time. -# -/etc/rc.d/sysctl lastload - securelevel_start() { if [ ${kern_securelevel} -ge 0 ]; then diff --git a/libexec/rc/rc.d/sysctl_lastload b/libexec/rc/rc.d/sysctl_lastload new file mode 100755 index 000000000000..22aafd96d051 --- /dev/null +++ b/libexec/rc/rc.d/sysctl_lastload @@ -0,0 +1,18 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: sysctl_lastload +# REQUIRE: LOGIN +# BEFORE: jail + +. /etc/rc.subr + +name="sysctl_lastload" +desc="Last chance to set sysctl variables that failed the first time." +start_cmd="/etc/rc.d/sysctl lastload" +stop_cmd=":" + +load_rc_config $name +run_rc_command "$1" From owner-dev-commits-src-all@freebsd.org Wed May 19 13:35:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Wed May 19 13:35:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Wed May 19 13:35:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Wed May 19 13:35:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Wed May 19 13:42:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BE5F5642BEF; Wed, 19 May 2021 13:42:13 +0000 (UTC) (envelope-from jclarke@marcuscom.com) Received: from creme-brulee.marcuscom.com (creme-brulee.marcuscom.com [IPv6:2607:fc50:1:f300::2]) (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 (2048 bits) client-digest SHA256) (Client CN "*.marcuscom.com", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlYvT3WTVz4lv0; Wed, 19 May 2021 13:42:12 +0000 (UTC) (envelope-from jclarke@marcuscom.com) Received: from [10.116.79.227] ([173.38.117.71]) (authenticated bits=0) by creme-brulee.marcuscom.com (8.16.1/8.16.1) with ESMTPSA id 14JDg5Hp080695 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Wed, 19 May 2021 09:42:05 -0400 (EDT) (envelope-from jclarke@marcuscom.com) X-Authentication-Warning: creme-brulee.marcuscom.com: Host [173.38.117.71] claimed to be [10.116.79.227] Subject: Re: git: 3d846e48227e - main - Do not forward datagrams originated by link-local addresses To: Lutz Donnerhacke , Zhenlei Huang Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202105182101.14IL1Gki054229@gitrepo.freebsd.org> <20210519055407.GA9715@belenus.iks-jena.de> From: Joe Clarke Message-ID: <10b475c5-0100-2567-4e92-73b168b97e3f@marcuscom.com> Date: Wed, 19 May 2021 09:42:00 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <20210519055407.GA9715@belenus.iks-jena.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=2.5 required=5.0 tests=NICE_REPLY_A,RDNS_NONE autolearn=disabled version=3.4.5 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on creme-brulee.marcuscom.com X-Rspamd-Queue-Id: 4FlYvT3WTVz4lv0 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_RCPT(0.00)[]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 13:42:13 -0000 On 5/19/21 01:54, Lutz Donnerhacke wrote: > On Tue, May 18, 2021 at 07:51:38PM -0400, Joe Clarke wrote: >> Just out of curiosity, why remove the RFC reference from the comment? > > May you please include the author of the change for such questions? > >>> commit 3d846e48227e2e78c1e7b35145f57353ffda56ba >>> Author: Zhenlei Huang >>> AuthorDate: 2021-05-18 20:51:37 +0000 >>> Commit: Lutz Donnerhacke >>> CommitDate: 2021-05-18 20:59:46 +0000 >>> >>> The current implement of ip_input() reject packets destined for >>> 169.254.0.0/16, but not those original from 169.254.0.0/16 link-local >>> addresses. >>> >>> Fix to fully respect RFC 3927 section 2.7. >>> >>> PR: 255388 >>> Reviewed by: donner, rgrimes, karels >>> MFC after: 1 month >>> Differential Revision: https://reviews.freebsd.org/D29968 > > I did only commit this differential, but set a month for MFC, exactly to > have to opportunity to fix such mistakes. > IMHO, I'd like to see the RFC reference remain. I see rgrimes response that the RFC's can change with errata and bis docs, but the anchor still provides additional context that one can use to learn more about why this code exists, and they can chase any future forward references. It was there in the initial code, and the commit message saw fit to reference it again. Removing it just seems like lost context. Joe -- PGP Key : http://www.marcuscom.com/pgp.asc From owner-dev-commits-src-all@freebsd.org Wed May 19 15:04:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7A30A64482B; Wed, 19 May 2021 15:04: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 4Flbk52kB3z3v5b; Wed, 19 May 2021 15:04: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 45AF915013; Wed, 19 May 2021 15:04: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 14JF4DS2095443; Wed, 19 May 2021 15:04:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JF4DTZ095442; Wed, 19 May 2021 15:04:13 GMT (envelope-from git) Date: Wed, 19 May 2021 15:04:13 GMT Message-Id: <202105191504.14JF4DTZ095442@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 4a6830761c65 - main - Fix packet cbs/ebs conversion. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4a6830761c6552bfe2c118a73a5a461694cb84c7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 15:04:13 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=4a6830761c6552bfe2c118a73a5a461694cb84c7 commit 4a6830761c6552bfe2c118a73a5a461694cb84c7 Author: Alexander Motin AuthorDate: 2021-05-19 15:00:21 +0000 Commit: Alexander Motin CommitDate: 2021-05-19 15:04:08 +0000 Fix packet cbs/ebs conversion. Each packet is counted as 128 bytes by the code, not 125. Not sure what I was thinking about here 14 years ago. May be just a typo. Reported by: Dmitry Luhtionov MFC after: 2 weeks --- sys/netgraph/ng_car.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/netgraph/ng_car.c b/sys/netgraph/ng_car.c index 9474e2467439..ec61a3565ec9 100644 --- a/sys/netgraph/ng_car.c +++ b/sys/netgraph/ng_car.c @@ -491,14 +491,14 @@ ng_car_rcvmsg(node_p node, item_p item, hook_p lasthook) if (bconf->downstream.opt & NG_CAR_COUNT_PACKETS) { bconf->downstream.cir *= 1024; bconf->downstream.pir *= 1024; - bconf->downstream.cbs *= 125; - bconf->downstream.ebs *= 125; + bconf->downstream.cbs *= 128; + bconf->downstream.ebs *= 128; } if (bconf->upstream.opt & NG_CAR_COUNT_PACKETS) { bconf->upstream.cir *= 1024; bconf->upstream.pir *= 1024; - bconf->upstream.cbs *= 125; - bconf->upstream.ebs *= 125; + bconf->upstream.cbs *= 128; + bconf->upstream.ebs *= 128; } if ((bconf->downstream.cir > 1000000000) || (bconf->downstream.pir > 1000000000) || From owner-dev-commits-src-all@freebsd.org Wed May 19 15:53:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Wed May 19 17:44:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A4512647B18; Wed, 19 May 2021 17:44:06 +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 4FlgGZ3P79z4k6s; Wed, 19 May 2021 17:44: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 5B31F16ADD; Wed, 19 May 2021 17:44:06 +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 14JHi6pX008047; Wed, 19 May 2021 17:44:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JHi6fA008046; Wed, 19 May 2021 17:44:06 GMT (envelope-from git) Date: Wed, 19 May 2021 17:44:06 GMT Message-Id: <202105191744.14JHi6fA008046@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 086feed850c3 - main - md5: Create md5sum, etc compatible programs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 086feed850c31c278f25c958b97992d024139896 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 17:44:06 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=086feed850c31c278f25c958b97992d024139896 commit 086feed850c31c278f25c958b97992d024139896 Author: Warner Losh AuthorDate: 2021-05-19 17:26:20 +0000 Commit: Warner Losh CommitDate: 2021-05-19 17:41:53 +0000 md5: Create md5sum, etc compatible programs On Linux, there's a similar set of programs to ours, but that end in the letters 'sum'. These act basically like FreeBSD versions run with the -r option. Add code so that when the program ends in 'sum' you get the linux -r behavior. This is enough to make most things that use sha*sum work correctly (the -c / --check options, as well as the long args are not implemented). When running with the -sum programs, ignore -t instead of running internal speed tests and make -c an error. Reviewed by: sef, and kp and allanjude (earlier version) Relnotes: yes Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30309 --- sbin/md5/Makefile | 30 ++++++++++++++++++++++++++---- sbin/md5/md5.1 | 34 ++++++++++++++++++++++++++++++++-- sbin/md5/md5.c | 35 ++++++++++++++++++++++++++++++----- 3 files changed, 88 insertions(+), 11 deletions(-) diff --git a/sbin/md5/Makefile b/sbin/md5/Makefile index dcbd94dcd381..b1e40713c219 100644 --- a/sbin/md5/Makefile +++ b/sbin/md5/Makefile @@ -4,27 +4,49 @@ PACKAGE=runtime PROG= md5 -LINKS= ${BINDIR}/md5 ${BINDIR}/rmd160 \ +LINKS= ${BINDIR}/md5 ${BINDIR}/md5sum \ + ${BINDIR}/md5 ${BINDIR}/rmd160 \ + ${BINDIR}/md5 ${BINDIR}/rmd160sum \ ${BINDIR}/md5 ${BINDIR}/sha1 \ + ${BINDIR}/md5 ${BINDIR}/sha1sum \ ${BINDIR}/md5 ${BINDIR}/sha224 \ + ${BINDIR}/md5 ${BINDIR}/sha224sum \ ${BINDIR}/md5 ${BINDIR}/sha256 \ + ${BINDIR}/md5 ${BINDIR}/sha256sum \ ${BINDIR}/md5 ${BINDIR}/sha384 \ + ${BINDIR}/md5 ${BINDIR}/sha384sum \ ${BINDIR}/md5 ${BINDIR}/sha512 \ + ${BINDIR}/md5 ${BINDIR}/sha512sum \ ${BINDIR}/md5 ${BINDIR}/sha512t256 \ + ${BINDIR}/md5 ${BINDIR}/sha512t256sum \ ${BINDIR}/md5 ${BINDIR}/skein256 \ + ${BINDIR}/md5 ${BINDIR}/skein256sum \ ${BINDIR}/md5 ${BINDIR}/skein512 \ - ${BINDIR}/md5 ${BINDIR}/skein1024 + ${BINDIR}/md5 ${BINDIR}/skein512sum \ + ${BINDIR}/md5 ${BINDIR}/skein1024 \ + ${BINDIR}/md5 ${BINDIR}/skein1024sum -MLINKS= md5.1 rmd160.1 \ +MLINKS= md5.1 md5sum.1 \ + md5.1 rmd160.1 \ + md5.1 rmd160sum.1 \ md5.1 sha1.1 \ + md5.1 sha1sum.1 \ md5.1 sha224.1 \ + md5.1 sha224sum.1 \ md5.1 sha256.1 \ + md5.1 sha256sum.1 \ md5.1 sha384.1 \ + md5.1 sha384sum.1 \ md5.1 sha512.1 \ + md5.1 sha512sum.1 \ md5.1 sha512t256.1 \ + md5.1 sha512t256sum.1 \ md5.1 skein256.1 \ + md5.1 skein256sum.1 \ md5.1 skein512.1 \ - md5.1 skein1024.1 + md5.1 skein512sum.1 \ + md5.1 skein1024.1 \ + md5.1 skein1024sum.1 LIBADD= md diff --git a/sbin/md5/md5.1 b/sbin/md5/md5.1 index e6b29233c399..c154c4788f8d 100644 --- a/sbin/md5/md5.1 +++ b/sbin/md5/md5.1 @@ -1,10 +1,12 @@ .\" $FreeBSD$ -.Dd June 19, 2020 +.Dd May 19, 2021 .Dt MD5 1 .Os .Sh NAME .Nm md5 , sha1 , sha224 , sha256 , sha384 , sha512 , sha512t256 , rmd160 , -.Nm skein256 , skein512 , skein1024 +.Nm skein256 , skein512 , skein1024 , +.Nm md5sum , sha1sum , sha224sum , sha256sum , sha384sum , sha512sum , +.Nm sha512t256sum , rmd160sum , skein256sum , skein512sum , skein1024sum .Nd calculate a message-digest fingerprint (checksum) for a file .Sh SYNOPSIS .Nm @@ -26,6 +28,15 @@ output a or .Dq message digest of the input. +The +.Nm md5sum , sha1sum , sha224sum , sha256sum , sha384sum , sha512sum , +.Nm sha512t256sum , rmd160sum , skein256sum , skein512sum , +and +.Nm skein1024sum +utilities do the same, but default to the reversed format of +the +.Fl r +flag. It is conjectured that it is computationally infeasible to produce two messages having the same message digest, or to produce any message having a given prespecified target message digest. @@ -59,9 +70,18 @@ precede any files named on the command line. The hexadecimal checksum of each file listed on the command line is printed after the options are processed. .Bl -tag -width indent +.It Fl b +Ignored for compatibility with the coreutils +.Nm -sum +programs. .It Fl c Ar string Compare the digest of the file against this string. .Pq Note that this option is not yet useful if multiple files are specified. +This option causes an error in for the +.Nm -sum +programs because it check the checksums listed in a file for the coreutils +.Nm -sum +programs that is not yet implemented. .It Fl s Ar string Print a checksum of the given .Ar string . @@ -81,6 +101,9 @@ when combined with the options. .It Fl t Run a built-in time trial. +For the +.Nm -sum +versions, this is a nop for compatibility with coreutils. .It Fl x Run a built-in test script. .El @@ -171,6 +194,13 @@ Secure Hash Standard (SHS): .Pp The RIPEMD-160 page: .Pa http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html . +.Sh BUGS +All of the utilities that end in +.Sq sum +are intended to be compatible with the GNU coreutils programs. +However, the long arguments and the +.Fl -check +functionality are not provided. .Sh ACKNOWLEDGMENTS This program is placed in the public domain for free general use by RSA Data Security. diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c index 96dfcede9711..4381ef124c7b 100644 --- a/sbin/md5/md5.c +++ b/sbin/md5/md5.c @@ -177,13 +177,32 @@ main(int argc, char *argv[]) char buf[HEX_DIGEST_LENGTH]; size_t len; unsigned digest; - const char* progname; + char *progname; + bool gnu_emu = false; if ((progname = strrchr(argv[0], '/')) == NULL) progname = argv[0]; else progname++; + /* + * GNU coreutils has a number of programs named *sum. These produce + * similar results to the BSD version, but in a different format, + * similar to BSD's -r flag. We install links to this program with + * ending 'sum' to provide this compatibility. Check here to see if the + * name of the program ends in 'sum', set the flag and drop the 'sum' so + * the digest lookup works. Also, make -t a nop when running in this mode + * since that means 'text file' there (though it's a nop in coreutils + * on unix-like systems). The -c flag conflicts, so it's just disabled + * in this mode (though in the future it might be implemented). + */ + len = strlen(progname); + if (len > 3 && strcmp(progname + len - 3, "sum") == 0) { + progname[len - 3] = '\0'; + rflag = 1; + gnu_emu = true; + } + for (digest = 0; digest < sizeof(Algorithm)/sizeof(*Algorithm); digest++) if (strcasecmp(Algorithm[digest].progname, progname) == 0) break; @@ -195,9 +214,13 @@ main(int argc, char *argv[]) checkAgainst = NULL; checksFailed = 0; skip = 0; - while ((ch = getopt(argc, argv, "c:pqrs:tx")) != -1) + while ((ch = getopt(argc, argv, "bc:pqrs:tx")) != -1) switch (ch) { + case 'b': + break; case 'c': + if (gnu_emu) + errx(1, "-c check option not supported"); checkAgainst = optarg; break; case 'p': @@ -214,8 +237,10 @@ main(int argc, char *argv[]) string = optarg; break; case 't': - MDTimeTrial(&Algorithm[digest]); - skip = 1; + if (!gnu_emu) { + MDTimeTrial(&Algorithm[digest]); + skip = 1; + } /* else: text mode is a nop */ break; case 'x': MDTestSuite(&Algorithm[digest]); @@ -348,7 +373,7 @@ MDTimeTrial(const Algorithm_t *alg) printf(" done\n"); printf("Digest = %s", p); printf("\nTime = %f seconds\n", seconds); - printf("Speed = %f MiB/second\n", (float) TEST_BLOCK_LEN * + printf("Speed = %f MiB/second\n", (float) TEST_BLOCK_LEN * (float) TEST_BLOCK_COUNT / seconds / (1 << 20)); } /* From owner-dev-commits-src-all@freebsd.org Wed May 19 17:59:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9E803648105; Wed, 19 May 2021 17:59: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 4FlgcH43Q1z4qpr; Wed, 19 May 2021 17:59: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 6F9B41703A; Wed, 19 May 2021 17:59: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 14JHxRba021635; Wed, 19 May 2021 17:59:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JHxR3J021634; Wed, 19 May 2021 17:59:27 GMT (envelope-from git) Date: Wed, 19 May 2021 17:59:27 GMT Message-Id: <202105191759.14JHxR3J021634@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 43999a5cba3c - main - 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/main X-Git-Reftype: branch X-Git-Commit: 43999a5cba3cfbf0a0f6244c76a3cd548b6925e8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 17:59:27 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=43999a5cba3cfbf0a0f6244c76a3cd548b6925e8 commit 43999a5cba3cfbf0a0f6244c76a3cd548b6925e8 Author: Mateusz Guzik AuthorDate: 2021-05-19 14:20:23 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-19 17:58:42 +0000 pseudofs: use vget_prep + vget_finish instead of vget + the interlock --- 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-all@freebsd.org Wed May 19 17:59:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DBFEB647DB3; Wed, 19 May 2021 17:59: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 4FlgcJ53kFz4qc3; Wed, 19 May 2021 17:59: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 926C416FBB; Wed, 19 May 2021 17:59: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 14JHxSP1021659; Wed, 19 May 2021 17:59:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JHxSOv021658; Wed, 19 May 2021 17:59:28 GMT (envelope-from git) Date: Wed, 19 May 2021 17:59:28 GMT Message-Id: <202105191759.14JHxSOv021658@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 4fe925b81e75 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 4fe925b81e75b5885ec6d504c6217f848439164a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 17:59:29 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=4fe925b81e75b5885ec6d504c6217f848439164a commit 4fe925b81e75b5885ec6d504c6217f848439164a Author: Mateusz Guzik AuthorDate: 2021-05-19 15:59:20 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-19 17:58:54 +0000 fdescfs: allow shared locking of root vnode Eliminates fdescfs from lock profile when running poudriere. --- 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-all@freebsd.org Wed May 19 18:32:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9EEE06489C8 for ; Wed, 19 May 2021 18:32:05 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlhKx3pPVz3LlJ for ; Wed, 19 May 2021 18:32:05 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f45.google.com with SMTP id h4so15002673wrt.12 for ; Wed, 19 May 2021 11:32:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=gt///jaZUlH+E+/C4Hd30zXGPOifU0F8mwghNacnRqI=; b=rSt3PHBXwwE/Mq/HLiKbCzulGHY/qpjqxL/BPEdiNVFJNPfHLVkAoNVQ6PZyzvukju veaSrcoDPHIF4athKRjOjYLKJyTjoCaBzPHOypUwZoCeH8oWubrrzVeEVHM5IEsRYLb7 Y7VRizX4ObGfb/zTBZ0g1iOBRGZaU4uCuY+EyMXXiYwpmUVhPDrMu8wrkyFJZs2OAIC2 SaurnlkOy8GDZuhB9Hpy1E40BjjAg63Jf6z1zhuZaYa0HP8xXFvrpkwbG8Mq/fiUP0ie PbLX1qZ1c4rv4619Jusxi4y8IqE7+tOjlPNyOnwDr4gwGKVqGIUl5ICwisdu0GT5ls1W tsYw== X-Gm-Message-State: AOAM531V9lyEzetvGybuT6bPL5o7h0v7iz1pJ77Iu8fSW4nh+Z++Qgqg c+BEm4BFWgdvAxU/WWf41KzYxg== X-Google-Smtp-Source: ABdhPJz6qDs+m8i81DAguYdV5088Ok5JFOUiiv+PJsogakJOE2+i2/a7Gp6bQ66xJtFEZ1B2oTeEGw== X-Received: by 2002:a5d:5301:: with SMTP id e1mr326355wrv.36.1621449124025; Wed, 19 May 2021 11:32:04 -0700 (PDT) Received: from [192.168.150.48] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id r14sm174247wrx.74.2021.05.19.11.32.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 May 2021 11:32:03 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: 086feed850c3 - main - md5: Create md5sum, etc compatible programs From: Jessica Clarke In-Reply-To: <202105191744.14JHi6fA008046@gitrepo.freebsd.org> Date: Wed, 19 May 2021 19:32:02 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <9BE6FB36-5958-4220-9C95-86DED767F6ED@freebsd.org> References: <202105191744.14JHi6fA008046@gitrepo.freebsd.org> To: Warner Losh X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4FlhKx3pPVz3LlJ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 18:32:05 -0000 On 19 May 2021, at 18:44, Warner Losh wrote: >=20 > The branch main has been updated by imp: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D086feed850c31c278f25c958b97992d0= 24139896 >=20 > commit 086feed850c31c278f25c958b97992d024139896 > Author: Warner Losh > AuthorDate: 2021-05-19 17:26:20 +0000 > Commit: Warner Losh > CommitDate: 2021-05-19 17:41:53 +0000 >=20 > md5: Create md5sum, etc compatible programs >=20 > On Linux, there's a similar set of programs to ours, but that end = in the > letters 'sum'. These act basically like FreeBSD versions run with = the -r > option. Add code so that when the program ends in 'sum' you get the > linux -r behavior. This is enough to make most things that use = sha*sum > work correctly (the -c / --check options, as well as the long args = are > not implemented). When running with the -sum programs, ignore -t = instead > of running internal speed tests and make -c an error. >=20 > Reviewed by: sef, and kp and allanjude (earlier version) > Relnotes: yes > Sponsored by: Netflix > Differential Revision: https://reviews.freebsd.org/D30309 > --- > diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c > index 96dfcede9711..4381ef124c7b 100644 > --- a/sbin/md5/md5.c > +++ b/sbin/md5/md5.c > @@ -177,13 +177,32 @@ main(int argc, char *argv[]) > char buf[HEX_DIGEST_LENGTH]; > size_t len; > unsigned digest; > - const char* progname; > + char *progname; > + bool gnu_emu =3D false; This file doesn=E2=80=99t currently include stdbool.h explicitly, and = apparently that is not implicitly included by any of the headers on Linux (and I cannot = work out where it comes from on FreeBSD). Could you please add the explicit = include to fix cross-building? Thanks, Jess From owner-dev-commits-src-all@freebsd.org Wed May 19 18:58:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BB595648D4F; Wed, 19 May 2021 18:58: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 4Flhvr4mbZz3mJl; Wed, 19 May 2021 18:58: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 8D80917E5B; Wed, 19 May 2021 18:58: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 14JIw0FR000992; Wed, 19 May 2021 18:58:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JIw0L1000991; Wed, 19 May 2021 18:58:00 GMT (envelope-from git) Date: Wed, 19 May 2021 18:58:00 GMT Message-Id: <202105191858.14JIw0L1000991@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Poul-Henning Kamp Subject: git: f4583ebabc0d - main - i2c(8): Polish: sort switches, dont confuse address & offset MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: phk X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f4583ebabc0db99992f65bcfb3eb8d8a95921a34 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 18:58:00 -0000 The branch main has been updated by phk: URL: https://cgit.FreeBSD.org/src/commit/?id=f4583ebabc0db99992f65bcfb3eb8d8a95921a34 commit f4583ebabc0db99992f65bcfb3eb8d8a95921a34 Author: Poul-Henning Kamp AuthorDate: 2021-05-19 18:47:32 +0000 Commit: Poul-Henning Kamp CommitDate: 2021-05-19 18:47:32 +0000 i2c(8): Polish: sort switches, dont confuse address & offset --- usr.sbin/i2c/i2c.c | 60 +++++++++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/usr.sbin/i2c/i2c.c b/usr.sbin/i2c/i2c.c index ef0ca0e8fda5..099418a5715c 100644 --- a/usr.sbin/i2c/i2c.c +++ b/usr.sbin/i2c/i2c.c @@ -281,7 +281,7 @@ reset_bus(const char *dev, int fd, int verbose) } static const char * -encode_offset(const char *width, unsigned address, uint8_t *dst, size_t *len) +encode_offset(const char *width, unsigned offset, uint8_t *dst, size_t *len) { if (!strcmp(width, "0")) { @@ -289,21 +289,21 @@ encode_offset(const char *width, unsigned address, uint8_t *dst, size_t *len) return (NULL); } if (!strcmp(width, "8")) { - if (address > 0xff) - return ("Invalid 8-bit address\n"); - *dst = address; + if (offset > 0xff) + return ("Invalid 8-bit offset\n"); + *dst = offset; *len = 1; return (NULL); } - if (address > 0xffff) - return ("Invalid 16-bit address\n"); + if (offset > 0xffff) + return ("Invalid 16-bit offset\n"); if (!strcmp(width, "16LE") || !strcmp(width, "16")) { - le16enc(dst, address); + le16enc(dst, offset); *len = 2; return (NULL); } if (!strcmp(width, "16BE")) { - be16enc(dst, address); + be16enc(dst, offset); *len = 2; return (NULL); } @@ -594,26 +594,21 @@ main(int argc, char** argv) usage("Bad -a argument (01..7f)"); i2c_opt.addr <<= 1; break; - case 'f': - dev = optarg; + case 'b': + i2c_opt.binary = 1; + break; + case 'c': + i2c_opt.count = (strtoul(optarg, 0, 10)); + if (i2c_opt.count == 0 && errno == EINVAL) + usage("Bad -c argument (decimal)"); break; case 'd': if (strcmp(optarg, "r") && strcmp(optarg, "w")) usage("Bad -d argument ([r|w])"); i2c_opt.dir = optarg[0]; break; - case 'o': - i2c_opt.off = strtoul(optarg, 0, 16); - if (i2c_opt.off == 0 && errno == EINVAL) - usage("Bad -o argument (hex)"); - break; - case 'w': - i2c_opt.width = optarg; // checked later. - break; - case 'c': - i2c_opt.count = (strtoul(optarg, 0, 10)); - if (i2c_opt.count == 0 && errno == EINVAL) - usage("Bad -c argument (decimal)"); + case 'f': + dev = optarg; break; case 'm': if (!strcmp(optarg, "no")) @@ -630,14 +625,19 @@ main(int argc, char** argv) case 'n': i2c_opt.skip = optarg; break; - case 's': break; - case 'b': - i2c_opt.binary = 1; + case 'o': + i2c_opt.off = strtoul(optarg, 0, 16); + if (i2c_opt.off == 0 && errno == EINVAL) + usage("Bad -o argument (hex)"); break; + case 'r': break; + case 's': break; case 'v': i2c_opt.verbose = 1; break; - case 'r': break; + case 'w': + i2c_opt.width = optarg; // checked later. + break; default: fprintf(stderr, "Illegal -%c option", ch); usage(NULL); @@ -660,7 +660,7 @@ main(int argc, char** argv) i2c_opt.off_buf, &i2c_opt.off_len); if (err_msg != NULL) { fprintf(stderr, "%s", err_msg); - exit(EX_USAGE); + return(EX_USAGE); } if (i2c_opt.verbose) @@ -677,15 +677,15 @@ main(int argc, char** argv) } switch (do_what) { + case 'a': + error = access_bus(fd, i2c_opt); + break; case 's': error = scan_bus(dev, fd, i2c_opt.skip, i2c_opt.verbose); break; case 'r': error = reset_bus(dev, fd, i2c_opt.verbose); break; - case 'a': - error = access_bus(fd, i2c_opt); - break; default: assert("Bad do_what"); } From owner-dev-commits-src-all@freebsd.org Wed May 19 18:58:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 153B8648865; Wed, 19 May 2021 18:58: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 4Flhvs69sgz3mPM; Wed, 19 May 2021 18:58: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 B1FC717E5C; Wed, 19 May 2021 18:58: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 14JIw1PM001020; Wed, 19 May 2021 18:58:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JIw1mE001019; Wed, 19 May 2021 18:58:01 GMT (envelope-from git) Date: Wed, 19 May 2021 18:58:01 GMT Message-Id: <202105191858.14JIw1mE001019@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Poul-Henning Kamp Subject: git: e32b2bcff02e - main - i2c(8): Change default mode to "transfer", which should work everywhere¹ MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: phk X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e32b2bcff02ee6885c2e2e8db040f91e5a06214d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 18:58:02 -0000 The branch main has been updated by phk: URL: https://cgit.FreeBSD.org/src/commit/?id=e32b2bcff02ee6885c2e2e8db040f91e5a06214d commit e32b2bcff02ee6885c2e2e8db040f91e5a06214d Author: Poul-Henning Kamp AuthorDate: 2021-05-19 18:48:28 +0000 Commit: Poul-Henning Kamp CommitDate: 2021-05-19 18:48:28 +0000 i2c(8): Change default mode to "transfer", which should work everywhere¹ ¹ According to @ian --- usr.sbin/i2c/i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/i2c/i2c.c b/usr.sbin/i2c/i2c.c index 099418a5715c..a471b6533170 100644 --- a/usr.sbin/i2c/i2c.c +++ b/usr.sbin/i2c/i2c.c @@ -550,7 +550,7 @@ main(int argc, char** argv) i2c_opt.count = 1; i2c_opt.binary = 0; /* ASCII text output */ i2c_opt.skip = NULL; /* scan all addresses */ - i2c_opt.mode = I2C_MODE_NOTSET; + i2c_opt.mode = I2C_MODE_TRANSFER; /* Find out what we are going to do */ From owner-dev-commits-src-all@freebsd.org Wed May 19 18:58:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5776E648F93; Wed, 19 May 2021 18:58: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 4Flhvv07YPz3mPY; Wed, 19 May 2021 18:58: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 D296018020; Wed, 19 May 2021 18:58: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 14JIw2KB001041; Wed, 19 May 2021 18:58:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JIw28t001040; Wed, 19 May 2021 18:58:02 GMT (envelope-from git) Date: Wed, 19 May 2021 18:58:02 GMT Message-Id: <202105191858.14JIw28t001040@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Poul-Henning Kamp Subject: git: 9c10d00bf8cd - main - i2c(8): Add interpreted mode for batch/scripted i2c operations MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: phk X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9c10d00bf8cdf7735cdba7c09bc16495ce22095b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 18:58:03 -0000 The branch main has been updated by phk: URL: https://cgit.FreeBSD.org/src/commit/?id=9c10d00bf8cdf7735cdba7c09bc16495ce22095b commit 9c10d00bf8cdf7735cdba7c09bc16495ce22095b Author: Poul-Henning Kamp AuthorDate: 2021-05-19 18:56:59 +0000 Commit: Poul-Henning Kamp CommitDate: 2021-05-19 18:56:59 +0000 i2c(8): Add interpreted mode for batch/scripted i2c operations --- usr.sbin/i2c/i2c.8 | 63 ++++++++++++++-- usr.sbin/i2c/i2c.c | 218 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 274 insertions(+), 7 deletions(-) diff --git a/usr.sbin/i2c/i2c.8 b/usr.sbin/i2c/i2c.8 index 92cc62e983aa..7c995f5743a4 100644 --- a/usr.sbin/i2c/i2c.8 +++ b/usr.sbin/i2c/i2c.8 @@ -43,19 +43,26 @@ .Op Fl b .Op Fl v .Nm -.Cm -s -.Op Fl f Ar device -.Op Fl n Ar skip_addr +.Cm -h +.Nm +.Cm -i .Op Fl v +.Op Ar cmd ... +.Op Ar - .Nm .Cm -r .Op Fl f Ar device .Op Fl v +.Nm +.Cm -s +.Op Fl f Ar device +.Op Fl n Ar skip_addr +.Op Fl v .Sh DESCRIPTION The .Nm -utility can be used to perform raw data transfers (read or write) with devices -on the I2C bus. +utility can be used to perform raw data transfers (read or write) to devices +on an I2C bus. It can also scan the bus for available devices and reset the I2C controller. .Pp The options are as follows: @@ -72,6 +79,10 @@ transfer direction: r - read, w - write. Data to be written is read from stdin as binary bytes. .It Fl f Ar device I2C bus to use (default is /dev/iic0). +.It Fl i +Interpreted mode +.It Fl h +Help .It Fl m Ar tr|ss|rs|no addressing mode, i.e., I2C bus operations performed after the offset for the transfer has been written to the device and before the actual read/write @@ -121,6 +132,37 @@ to the slave. Zero means that the offset is ignored and not passed to the slave at all. The endianess defaults to little-endian. .El +.Sh INTERPRETED MODE +When started with +.Fl i +any remaining arguments are interpreted as commands, and +if the last argument is '-', or there are no arguments, +commands will (also) be read from stdin. +.Pp +Available commands: +.Bl -tag -compact +.It 'r' bus address [0|8|16|16LE|16BE] offset count +Read command, count bytes are read and hexdumped to stdout. +.It 'w' bus address [0|8|16|16LE|16BE] offset hexstring +Write command, hexstring (white-space is allowed) is written to device. +.It 'p' anything +Print command, the entire line is printed to stdout. (This can be used +for synchronization.) +.El +.Pp +All numeric fields accept canonical decimal/octal/hex notation. +.Pp +Without the +.Fl v +option, all errors are fatal with non-zero exit status. +.Pp +With the +.Fl v +option, no errors are fatal, and all commands will return +either "OK\en" or "ERROR\en" on stdout. +In case of error, detailed diagnostics will precede that on stderr. +.Pp +Blank lines and lines starting with '#' are ignored. .Sh EXAMPLES .Bl -bullet .It @@ -148,6 +190,14 @@ i2c -a 0x56 -f /dev/iic1 -d r -c 0x4 -b | i2c -a 0x57 -f /dev/iic0 -d w -c 4 -b Reset the controller: .Pp i2c -f /dev/iic1 -r +.It +Read 8 bytes at address 24 in an EEPROM: +.Pp +i2c -i 'r 0 0x50 16BE 24 8' +.It +Read 2x8 bytes at address 24 and 48 in an EEPROM: +.Pp +echo 'r 0 0x50 16BE 48 8' | i2c -i 'r 0 0x50 16BE 24 8' - .El .Sh WARNING Many systems store critical low-level information in I2C memories, and @@ -171,3 +221,6 @@ utility and this manual page were written by .An Bartlomiej Sieka Aq Mt tur@semihalf.com and .An Michal Hajduk Aq Mt mih@semihalf.com . +.Pp +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org +added interpreted mode. diff --git a/usr.sbin/i2c/i2c.c b/usr.sbin/i2c/i2c.c index a471b6533170..87bb1f0fe983 100644 --- a/usr.sbin/i2c/i2c.c +++ b/usr.sbin/i2c/i2c.c @@ -65,6 +65,9 @@ struct options { size_t off_len; }; +#define N_FDCACHE 128 +static int fd_cache[N_FDCACHE]; + __dead2 static void usage(const char *msg) { @@ -531,6 +534,210 @@ access_bus(int fd, struct options i2c_opt) return (error); } +static const char *widths[] = { + "0", + "8", + "16LE", + "16BE", + "16", + NULL, +}; + +static int +command_bus(struct options i2c_opt, char *cmd) +{ + int error, fd; + char devbuf[64]; + uint8_t dbuf[BUFSIZ]; + unsigned bus; + const char *width = NULL; + const char *err_msg; + unsigned offset; + unsigned u; + size_t length; + + while (isspace(*cmd)) + cmd++; + + switch(*cmd) { + case 0: + case '#': + return (0); + case 'p': + case 'P': + printf("%s", cmd); + return (0); + case 'r': + case 'R': + i2c_opt.dir = 'r'; + break; + case 'w': + case 'W': + i2c_opt.dir = 'w'; + break; + default: + fprintf(stderr, + "Did not understand command: 0x%02x ", *cmd); + if (isgraph(*cmd)) + fprintf(stderr, "'%c'", *cmd); + fprintf(stderr, "\n"); + return(-1); + } + cmd++; + + bus = strtoul(cmd, &cmd, 0); + if (bus == 0 && errno == EINVAL) { + fprintf(stderr, "Could not translate bus number\n"); + return(-1); + } + + i2c_opt.addr = strtoul(cmd, &cmd, 0); + if (i2c_opt.addr == 0 && errno == EINVAL) { + fprintf(stderr, "Could not translate device\n"); + return(-1); + } + if (i2c_opt.addr < 1 || i2c_opt.addr > 0x7f) { + fprintf(stderr, "Invalid device (0x%x)\n", i2c_opt.addr); + return(-1); + } + i2c_opt.addr <<= 1; + + while(isspace(*cmd)) + cmd++; + + for(u = 0; widths[u]; u++) { + length = strlen(widths[u]); + if (memcmp(cmd, widths[u], length)) + continue; + if (!isspace(cmd[length])) + continue; + width = widths[u]; + cmd += length; + break; + } + if (width == NULL) { + fprintf(stderr, "Invalid width\n"); + return(-1); + } + + offset = strtoul(cmd, &cmd, 0); + if (offset == 0 && errno == EINVAL) { + fprintf(stderr, "Could not translate offset\n"); + return(-1); + } + + err_msg = encode_offset(width, offset, + i2c_opt.off_buf, &i2c_opt.off_len); + if (err_msg) { + fprintf(stderr, "%s", err_msg); + return(-1); + } + + if (i2c_opt.dir == 'r') { + i2c_opt.count = strtoul(cmd, &cmd, 0); + if (i2c_opt.count == 0 && errno == EINVAL) { + fprintf(stderr, "Could not translate length\n"); + return(-1); + } + } else { + i2c_opt.count = 0; + while (1) { + while(isspace(*cmd)) + cmd++; + if (!*cmd) + break; + if (!isxdigit(*cmd)) { + fprintf(stderr, "Not a hex digit.\n"); + return(-1); + } + dbuf[i2c_opt.count] = digittoint(*cmd++) << 4; + while(isspace(*cmd)) + cmd++; + if (!*cmd) { + fprintf(stderr, + "Uneven number of hex digits.\n"); + return(-1); + } + if (!isxdigit(*cmd)) { + fprintf(stderr, "Not a hex digit.\n"); + return(-1); + } + dbuf[i2c_opt.count++] |= digittoint(*cmd++); + } + } + assert(bus < N_FDCACHE); + fd = fd_cache[bus]; + if (fd < 0) { + (void)sprintf(devbuf, "/dev/iic%u", bus); + fd = open(devbuf, O_RDWR); + if (fd == -1) { + fprintf(stderr, "Error opening I2C controller (%s): %s\n", + devbuf, strerror(errno)); + return (EX_NOINPUT); + } + fd_cache[bus] = fd; + } + + error = i2c_rdwr_transfer(fd, i2c_opt, dbuf); + if (error) + return(-1); + + if (i2c_opt.dir == 'r') { + for (u = 0; u < i2c_opt.count; u++) + printf("%02x", dbuf[u]); + printf("\n"); + } + return (0); +} + +static int +exec_bus(struct options i2c_opt, char *cmd) +{ + int error; + + while (isspace(*cmd)) + cmd++; + if (*cmd == '#' || *cmd == '\0') + return (0); + error = command_bus(i2c_opt, cmd); + if (i2c_opt.verbose) { + (void)fflush(stderr); + printf(error ? "ERROR\n" : "OK\n"); + error = 0; + } else if (error) { + fprintf(stderr, " in: %s", cmd); + } + (void)fflush(stdout); + return (error); +} + +static int +instruct_bus(struct options i2c_opt, int argc, char **argv) +{ + char buf[BUFSIZ]; + int rd_cmds = (argc == 0); + int error; + + while (argc-- > 0) { + if (argc == 0 && !strcmp(*argv, "-")) { + rd_cmds = 1; + } else { + error = exec_bus(i2c_opt, *argv); + if (error) + return (error); + } + argv++; + } + if (!rd_cmds) + return (0); + while (fgets(buf, sizeof buf, stdin) != NULL) { + error = exec_bus(i2c_opt, buf); + if (error) + return (error); + } + return (0); +} + int main(int argc, char** argv) { @@ -541,6 +748,8 @@ main(int argc, char** argv) char do_what = 0; dev = I2C_DEV; + for (ch = 0; ch < N_FDCACHE; ch++) + fd_cache[ch] = -1; /* Default values */ i2c_opt.off = 0; @@ -554,9 +763,10 @@ main(int argc, char** argv) /* Find out what we are going to do */ - while ((ch = getopt(argc, argv, "a:f:d:o:w:c:m:n:sbvrh")) != -1) { + while ((ch = getopt(argc, argv, "a:f:d:iw:c:m:n:sbvrh")) != -1) { switch(ch) { case 'a': + case 'i': case 'r': case 's': if (do_what) @@ -574,8 +784,9 @@ main(int argc, char** argv) /* Then handle the legal subset of arguments */ switch (do_what) { - case 0: usage("Pick one of [-a|-h|-r|-s]"); break; + case 0: usage("Pick one of [-a|-h|-i|-r|-s]"); break; case 'a': optflags = "a:f:d:w:o:c:m:bv"; break; + case 'i': optflags = "iv"; break; case 'r': optflags = "rf:v"; break; case 's': optflags = "sf:n:v"; break; default: assert("Bad do_what"); @@ -610,6 +821,7 @@ main(int argc, char** argv) case 'f': dev = optarg; break; + case 'i': break; case 'm': if (!strcmp(optarg, "no")) i2c_opt.mode = I2C_MODE_NONE; @@ -645,6 +857,8 @@ main(int argc, char** argv) } argc -= optind; argv += optind; + if (do_what == 'i') + return(instruct_bus(i2c_opt, argc, argv)); if (argc > 0) usage("Too many arguments"); From owner-dev-commits-src-all@freebsd.org Wed May 19 21:02:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A85C964BE82 for ; Wed, 19 May 2021 21:02:22 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FllgJ5tPrz3w3R for ; Wed, 19 May 2021 21:02:20 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x732.google.com with SMTP id k4so3069004qkd.0 for ; Wed, 19 May 2021 14:02:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bnLDBG9O91+WOP5nPd+HzZaTii7mLDnN+gkiD+kh784=; b=BfzlTQ5EwP+BZm1iTzwJmNWgX7gFH0UX49fp1HskixLfEfiG20+hlH0b1+jyAAMcVV 3mOfceLhpNAylpCDZ6/mOk3/MC34DbIYhpiM6Rsfk3+BOg+HSFhdIkOshoKtkuqW+I+h qCQ8FbiFgEXy68LuVm4KTzqrAKMhWSAJJVwf5+ah3p0GbWhLj50p5+fuWDLm8aa8AOTH AMAdmxMQ5FbWrpEyDnxmns+oNlNTWvvzSGoLJRb3ITXAq/kNl7cyaj35uS7sjn1+Q39q NrS9FDEUzhPL9+GVnUXZNv8WO7u5Omj3mnisq78oNWAZVlP1Cs45jWCiXh8PTu7/6Os1 aB5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bnLDBG9O91+WOP5nPd+HzZaTii7mLDnN+gkiD+kh784=; b=XlskK9CV4Ohd/HulujpvLbTQZFm+L1wXmRNRS0mQbZTO3YmxRDIKXcyBAkMgMxUWwI qlgMwGGirb7mmCqFLdbYY8Ex7osZws81oU3U3njxQYI576yyaS1bge51mxaozCC0J6Lk gM4UatlEye1sTEE7sAXe7uPSQCDnjeexTIkHNUgk1yJ3yxfDJs917MkM5EkFaueDdrBi 8HfgNGQ9JxGAfsMaTUZ1v154VfaEOiFP85UVGIsbkL+K+lM4M6De7TpeFKz4XQEiKVM6 uJio9on7AbEmkugsiZUyruLc+inSgLIHybzCjsU3GpmRsdAoPIGniCpnidMgfalNQQjn GWeg== X-Gm-Message-State: AOAM5313FG0tmW5lLtzbUIuUKKtStNiZaGNTZe73eLWcepsG6sr1Zxqz GhFd3jdtUjWRnH4+jOGuUZ9NvfczgnCJP02vSzD+9Q== X-Google-Smtp-Source: ABdhPJyTWCjB4uEINxvcmWH+lUdDgh/0tlp9M9cpJ/uqBMH1ofE9Gxt9w4njzas8XMHnX9ZAmjBeIKEt3ISetF+Hb1s= X-Received: by 2002:a37:30b:: with SMTP id 11mr1408279qkd.206.1621458139291; Wed, 19 May 2021 14:02:19 -0700 (PDT) MIME-Version: 1.0 References: <202105161045.14GAjZIL093217@gitrepo.freebsd.org> In-Reply-To: From: Warner Losh Date: Wed, 19 May 2021 15:02:08 -0600 Message-ID: Subject: Re: git: 0f206cc91279 - main - cam: add missing zeroing of a stack-allocated CCB. To: Konstantin Belousov Cc: Mark Johnston , src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4FllgJ5tPrz3w3R X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=BfzlTQ5E; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::732) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-2.79 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-0.79)[-0.789]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::732:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::732:from]; R_SPF_NA(0.00)[no SPF record]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::732:from]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; MAILMAN_DEST(0.00)[dev-commits-src-all]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 21:02:23 -0000 On Mon, May 17, 2021 at 12:52 AM Konstantin Belousov wrote: > On Sun, May 16, 2021 at 07:03:24PM +0100, Edward Tomasz Napierala wrote: > > On 0516T1227, Warner Losh wrote: > > > On Sun, May 16, 2021, 11:55 AM Mark Johnston > wrote: > > > > > > > On Sun, May 16, 2021 at 10:45:35AM +0000, Edward Tomasz Napierala > wrote: > > > > > The branch main has been updated by trasz: > > > > > > > > > > URL: > > > > > https://cgit.FreeBSD.org/src/commit/?id=0f206cc91279e630ad9e733eb6e330b7dbe6c70e > > > > > > > > > > commit 0f206cc91279e630ad9e733eb6e330b7dbe6c70e > > > > > Author: Edward Tomasz Napierala > > > > > AuthorDate: 2021-05-16 09:28:04 +0000 > > > > > Commit: Edward Tomasz Napierala > > > > > CommitDate: 2021-05-16 10:38:26 +0000 > > > > > > > > > > cam: add missing zeroing of a stack-allocated CCB. > > > > > > > > > > This could cause a panic at boot. > > > > > > > > There are other instances of this, for example syzbot is currently > > > > hitting an assertion, seemingly because the alloc_flags field of a > > > > stack-allocated CCB was not zeroed: > > > > https://syzkaller.appspot.com/bug?extid=2e9ce63919709feb3d1c > > > > > > > > I think the patch below will fix it, but I did not audit other > callers. > > > > It feels a bit strange to require all callers of xpt_setup_ccb() to > > > > manually zero the structure first, can we provide a single routine to > > > > initialize stack-allocated CCBs? > > > > We definitely could, although in some cases it's a bit more > > complicated than that - a function that gets passed a CCB and then > > calls xpt_setup_ccb() to fill it shouldn't zero it, as that would > > be making assumption on how the CCB passed to it was allocated. > > > > Now that I look at the code, I can definitely see that I've missed > > a couple of places. Perhaps I should replace those two KASSERTs with > > diagnostic printfs for now, until I get that sorted out? > > > > > If we did, we could set a flag we could assert on, and/or do static > > > analysis to find any others... > > > > That sounds promising, except I've never done anything like that; > > I don't even know where to start. > > Are stack-allocated ccbs passed around? In particular, can the thread > that allocated the ccb, put to sleep while ccb is processed elsewere? > This should break under swapping. > I don't think so, but we should check. Most of the ones I've spot checked are immediate operations that don't block. I've not checked every single one, though. This is another reason to use xpt_stack_ccb_inint() or similar. That way, we can flag this as 'stack allocated' and assert in xpt_setup_ccb when it is stack allocated and trying to do a queued operation. Sadly, traz reports that there's some tricky uses/reuses of ccbs that make this difficult to do at this time. Warner From owner-dev-commits-src-all@freebsd.org Wed May 19 21:18:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C06F264C1A3 for ; Wed, 19 May 2021 21: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 4Flm2B55lnz4bmW; Wed, 19 May 2021 21: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 9788219C7C; Wed, 19 May 2021 21: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 14JLIgux088944; Wed, 19 May 2021 21: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 14JLIg0j088943; Wed, 19 May 2021 21:18:42 GMT (envelope-from git) Date: Wed, 19 May 2021 21:18:42 GMT Message-Id: <202105192118.14JLIg0j088943@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Dmitry Chagin Subject: git: 174d8b60324d - vendor/tcsh - Vendor import of tcsh-6.22.04 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/vendor/tcsh X-Git-Reftype: branch X-Git-Commit: 174d8b60324d7e8754709f7155e13ca95220b48c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 21:18:42 -0000 The branch vendor/tcsh has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=174d8b60324d7e8754709f7155e13ca95220b48c commit 174d8b60324d7e8754709f7155e13ca95220b48c Author: Dmitry Chagin AuthorDate: 2021-05-12 06:01:23 +0000 Commit: Dmitry Chagin CommitDate: 2021-05-12 06:01:23 +0000 Vendor import of tcsh-6.22.04 --- Fixes | 1 + configure | 954 +++++++++++++++++++++++++++++++++++----------------------- configure.ac | 2 +- ed.chared.c | 98 +++--- ed.defns.c | 10 +- ed.h | 10 +- ed.init.c | 48 +-- ed.inputl.c | 20 +- ed.refresh.c | 16 +- ed.screen.c | 18 +- ed.term.c | 34 +-- ed.term.h | 6 +- ed.xmap.c | 10 +- gethost.c | 8 +- glob.c | 18 +- glob.h | 2 +- ma.setp.c | 4 +- mi.termios.c | 2 +- mi.wait.h | 2 +- patchlevel.h | 4 +- sh.c | 100 +++--- sh.char.c | 136 ++++----- sh.char.h | 2 +- sh.decls.h | 14 +- sh.dir.c | 44 +-- sh.dol.c | 10 +- sh.err.c | 2 +- sh.exec.c | 10 +- sh.exp.c | 44 +-- sh.file.c | 2 +- sh.func.c | 84 +++--- sh.glob.c | 18 +- sh.h | 36 +-- sh.hist.c | 46 +-- sh.init.c | 12 +- sh.lex.c | 16 +- sh.misc.c | 6 +- sh.parse.c | 1 + sh.print.c | 6 +- sh.proc.c | 28 +- sh.sem.c | 22 +- sh.set.c | 16 +- sh.time.c | 6 +- sh.types.h | 36 +-- tc.alloc.c | 18 +- tc.bind.c | 4 +- tc.const.c | 20 +- tc.decls.h | 4 +- tc.func.c | 32 +- tc.os.c | 52 ++-- tc.os.h | 22 +- tc.printf.c | 4 +- tc.prompt.c | 10 +- tc.str.c | 8 +- tc.vers.c | 22 +- tc.who.c | 8 +- tcsh.man | 4 +- tw.color.c | 6 +- tw.comp.c | 14 +- tw.h | 2 +- tw.init.c | 18 +- tw.parse.c | 48 +-- vms.termcap.c | 2 +- 63 files changed, 1237 insertions(+), 1025 deletions(-) diff --git a/Fixes b/Fixes index e539c8241a86..76fdede0c4b7 100644 --- a/Fixes +++ b/Fixes @@ -1,3 +1,4 @@ + 15. V6.22.04 - 20210426 14. Don't crash with 'bindkey "^0" clear-screen' (Karl Jeacle) 13. Fix $x:q:h and $x:q:t return the whole string for strings not containing / 12. V6.22.03 - 20201118 diff --git a/configure b/configure index 27a6bec356a0..90ddda07cc98 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for tcsh 6.22.03. +# Generated by GNU Autoconf 2.69 for tcsh 6.22.04. # # Report bugs to . # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='tcsh' PACKAGE_TARNAME='tcsh' -PACKAGE_VERSION='6.22.03' -PACKAGE_STRING='tcsh 6.22.03' +PACKAGE_VERSION='6.22.04' +PACKAGE_STRING='tcsh 6.22.04' PACKAGE_BUGREPORT='https://bugs.astron.com/' PACKAGE_URL='' @@ -630,11 +630,11 @@ HESDEF DFLAGS CC_FOR_GETHOST GENCAT -LTLIBICONV -LIBICONV EGREP GREP CPP +LTLIBICONV +LIBICONV OBJEXT EXEEXT ac_ct_CC @@ -1250,7 +1250,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures tcsh 6.22.03 to adapt to many kinds of systems. +\`configure' configures tcsh 6.22.04 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1315,7 +1315,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of tcsh 6.22.03:";; + short | recursive ) echo "Configuration of tcsh 6.22.04:";; esac cat <<\_ACEOF @@ -1411,7 +1411,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -tcsh configure 6.22.03 +tcsh configure 6.22.04 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1463,43 +1463,6 @@ fi } # ac_fn_c_try_compile -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. @@ -1588,6 +1551,43 @@ fi } # ac_fn_c_try_run +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using @@ -2174,7 +2174,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by tcsh $as_me 6.22.03, which was +It was created by tcsh $as_me 6.22.04, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3530,6 +3530,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes @@ -3550,38 +3551,12 @@ if test "${PATH_SEPARATOR+set}" != set; then } fi -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. +if test -n "$LD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld" >&5 +$as_echo_n "checking for ld... " >&6; } +elif test "$GCC" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'` - while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } @@ -3589,44 +3564,129 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi -if ${acl_cv_path_LD+:} false; then : +if test -n "$LD"; then + # Let the user override the test with a path. + : +else + if ${acl_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else - if test -z "$LD"; then - acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$acl_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$acl_cv_path_LD" -v 2>&1 &5 | tr -d '\015'` ;; + *) + acl_output=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $acl_output in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'` + while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do + acl_output=`echo $acl_output | sed "s%$re_direlt%/%"` + done + # Got the pathname. No search in PATH is needed. + acl_cv_path_LD="$acl_output" + ac_prog= + ;; + "") + # If it fails, then pretend we aren't using GCC. + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; esac fi - done - IFS="$acl_save_ifs" + if test -n "$ac_prog"; then + # Search for $ac_prog in $PATH. + acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$acl_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 conftest.$ac_ext +/* end confdefs.h. */ +#if defined __powerpc64__ || defined _ARCH_PPC64 + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # The compiler produces 64-bit code. Add option '-b64' so that the + # linker groks 64-bit object files. + case "$acl_cv_path_LD " in + *" -b64 "*) ;; + *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;; + esac + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; + sparc64-*-netbsd*) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __sparcv9 || defined __arch64__ + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + else - acl_cv_path_LD="$LD" # Let the user override the test with a path. + # The compiler produces 32-bit code. Add option '-m elf32_sparc' + # so that the linker groks 32-bit object files. + case "$acl_cv_path_LD " in + *" -m elf32_sparc "*) ;; + *) acl_cv_path_LD="$acl_cv_path_LD -m elf32_sparc" ;; + esac + fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; + esac + fi -LD="$acl_cv_path_LD" + LD="$acl_cv_path_LD" +fi if test -n "$LD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${acl_cv_prog_gnu_ld+:} false; then : @@ -3682,337 +3742,325 @@ fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking 32-bit host C ABI" >&5 +$as_echo_n "checking 32-bit host C ABI... " >&6; } +if ${gl_cv_host_cpu_c_abi_32bit+:} false; then : $as_echo_n "(cached) " >&6 else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test -n "$gl_cv_host_cpu_c_abi"; then + case "$gl_cv_host_cpu_c_abi" in + i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc) + gl_cv_host_cpu_c_abi_32bit=yes ;; + *) + gl_cv_host_cpu_c_abi_32bit=no ;; + esac + else + case "$host_cpu" in + + i[4567]86 ) + gl_cv_host_cpu_c_abi_32bit=yes + ;; + + x86_64 ) + # On x86_64 systems, the C compiler may be generating code in one of + # these ABIs: + # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. + # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 + # with native Windows (mingw, MSVC). + # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. + # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error +#if (defined __x86_64__ || defined __amd64__ \ + || defined _M_X64 || defined _M_AMD64) \ + && !(defined __ILP32__ || defined _ILP32) + int ok; + #else + error fail + #endif + _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_host_cpu_c_abi_32bit=no +else + gl_cv_host_cpu_c_abi_32bit=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; + + arm* | aarch64 ) + # Assume arm with EABI. + # On arm64 systems, the C compiler may be generating code in one of + # these ABIs: + # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. + # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. + # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __aarch64__ && !(defined __ILP32__ || defined _ILP32) + int ok; + #else + error fail + #endif +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_host_cpu_c_abi_32bit=no else - # Broken: fails on valid input. -continue + gl_cv_host_cpu_c_abi_32bit=yes fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) + # On hppa, the C compiler may be generating 32-bit code or 64-bit + # code. In the latter case, it defines _LP64 and __LP64__. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#ifdef __LP64__ + int ok; + #else + error fail + #endif + _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_host_cpu_c_abi_32bit=no else - # Passes both tests. -ac_preproc_ok=: -break + gl_cv_host_cpu_c_abi_32bit=yes fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break + ia64* ) + # On ia64 on HP-UX, the C compiler may be generating 64-bit code or + # 32-bit code. In the latter case, it defines _ILP32. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef _ILP32 + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_host_cpu_c_abi_32bit=yes +else + gl_cv_host_cpu_c_abi_32bit=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; - done - ac_cv_prog_CPP=$CPP + mips* ) + # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this + # at 32. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) + int ok; + #else + error fail + #endif -fi - CPP=$ac_cv_prog_CPP +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_host_cpu_c_abi_32bit=no else - ac_cv_prog_CPP=$CPP + gl_cv_host_cpu_c_abi_32bit=yes fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; + + powerpc* ) + # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. + # No need to distinguish them here; the caller may distinguish + # them based on the OS. + # On powerpc64 systems, the C compiler may still be generating + # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may + # be generating 64-bit code. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +#if defined __powerpc64__ || defined _ARCH_PPC64 + int ok; + #else + error fail + #endif +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_host_cpu_c_abi_32bit=no else - # Broken: fails on valid input. -continue + gl_cv_host_cpu_c_abi_32bit=yes fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + rs6000 ) + gl_cv_host_cpu_c_abi_32bit=yes + ;; + + riscv32 | riscv64 ) + # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. + # Size of 'long' and 'void *': + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#if defined __LP64__ + int ok; + #else + error fail + #endif + _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_host_cpu_c_abi_32bit=no else - # Passes both tests. -ac_preproc_ok=: -break + gl_cv_host_cpu_c_abi_32bit=yes fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : + s390* ) + # On s390x, the C compiler may be generating 64-bit (= s390x) code + # or 31-bit (= s390) code. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __LP64__ || defined __s390x__ + int ok; + #else + error fail + #endif +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_host_cpu_c_abi_32bit=no else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } + gl_cv_host_cpu_c_abi_32bit=yes fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac + sparc | sparc64 ) + # UltraSPARCs running Linux have `uname -m` = "sparc64", but the + # C compiler still generates 32-bit code. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __sparcv9 || defined __arch64__ + int ok; + #else + error fail + #endif - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_host_cpu_c_abi_32bit=no else - ac_cv_path_GREP=$GREP -fi - + gl_cv_host_cpu_c_abi_32bit=yes fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac + *) + gl_cv_host_cpu_c_abi_32bit=no + ;; + esac + fi - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_host_cpu_c_abi_32bit" >&5 +$as_echo "$gl_cv_host_cpu_c_abi_32bit" >&6; } + + HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit" - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - acl_libdirstem=lib - acl_libdirstem2= case "$host_os" in solaris*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5 $as_echo_n "checking for 64-bit host... " >&6; } if ${gl_cv_solaris_64bit+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #ifdef _LP64 -sixtyfour bits -#endif + int ok; + #else + error fail + #endif _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "sixtyfour bits" >/dev/null 2>&1; then : +if ac_fn_c_try_compile "$LINENO"; then : gl_cv_solaris_64bit=yes else gl_cv_solaris_64bit=no fi -rm -f conftest* - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5 -$as_echo "$gl_cv_solaris_64bit" >&6; } - if test $gl_cv_solaris_64bit = yes; then - acl_libdirstem=lib/64 - case "$host_cpu" in - sparc*) acl_libdirstem2=lib/sparcv9 ;; - i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; - esac - fi - ;; - *) - searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` - if test -n "$searchpath"; then - acl_save_IFS="${IFS= }"; IFS=":" - for searchdir in $searchpath; do - if test -d "$searchdir"; then - case "$searchdir" in - */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; - */../ | */.. ) - # Better ignore directories of this form. They are misleading. - ;; - *) searchdir=`cd "$searchdir" && pwd` - case "$searchdir" in - */lib64 ) acl_libdirstem=lib64 ;; - esac ;; - esac - fi - done - IFS="$acl_save_IFS" - fi - ;; +$as_echo "$gl_cv_solaris_64bit" >&6; };; esac - test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the common suffixes of directories in the library search path" >&5 *** 4997 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed May 19 21:18:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EFDEE64C38F for ; Wed, 19 May 2021 21: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 4Flm2C6FYpz4bjr; Wed, 19 May 2021 21: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 B933B19B48; Wed, 19 May 2021 21: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 14JLIhXi088969; Wed, 19 May 2021 21: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 14JLIhj0088968; Wed, 19 May 2021 21:18:43 GMT (envelope-from git) Date: Wed, 19 May 2021 21:18:43 GMT Message-Id: <202105192118.14JLIhj0088968@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Dmitry Chagin Subject: git: eccc6834d28d - Create tag vendor/tcsh/6.22.04 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/tags/vendor/tcsh/6.22.04 X-Git-Reftype: annotated tag X-Git-Commit: eccc6834d28d242718e0ae436a5c95a04cec2ef3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 21:18:44 -0000 The annotated tag vendor/tcsh/6.22.04 has been created by dchagin: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/tcsh/6.22.04 tag vendor/tcsh/6.22.04 Tagger: Dmitry Chagin TaggerDate: 2021-05-12 06:07:08 +0000 Tag tcsh 6.22.04 commit 174d8b60324d7e8754709f7155e13ca95220b48c Author: Dmitry Chagin AuthorDate: 2021-05-12 06:01:23 +0000 Commit: Dmitry Chagin CommitDate: 2021-05-12 06:01:23 +0000 Vendor import of tcsh-6.22.04 From owner-dev-commits-src-all@freebsd.org Wed May 19 21:22:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Wed May 19 21:30:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8C14F64C881; Wed, 19 May 2021 21:30: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 4FlmJ12Qf9z4jJ6; Wed, 19 May 2021 21:30: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 3475119EB7; Wed, 19 May 2021 21:30: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 14JLUfrR010593; Wed, 19 May 2021 21:30:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JLUfdt010592; Wed, 19 May 2021 21:30:41 GMT (envelope-from git) Date: Wed, 19 May 2021 21:30:41 GMT Message-Id: <202105192130.14JLUfdt010592@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 6190ff6104ae - main - tcsh: cleanup source tree to reduce diff size. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6190ff6104aed4cd753019325a252c4d66495b5e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 21:30:41 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=6190ff6104aed4cd753019325a252c4d66495b5e commit 6190ff6104aed4cd753019325a252c4d66495b5e Author: Dmitry Chagin AuthorDate: 2021-05-19 21:08:25 +0000 Commit: Dmitry Chagin CommitDate: 2021-05-19 21:08:25 +0000 tcsh: cleanup source tree to reduce diff size. Remove makefiles, configure files and unused at build time files to reduce the diff size. Otherwise the diff contains a lot of unnecessary lines what makes reviewing and merging proccess so hard, especially for re@. MFC after: 2 weeks --- contrib/tcsh/FREEBSD-Xlist | 15 + contrib/tcsh/Imakefile | 631 --- contrib/tcsh/MAKEDIFFS | 40 - contrib/tcsh/MAKESHAR | 120 - contrib/tcsh/Makefile.ADMIN | 24 - contrib/tcsh/Makefile.in | 782 ---- contrib/tcsh/Makefile.std | 630 --- contrib/tcsh/Makefile.vms | 592 --- contrib/tcsh/config.guess | 1438 ------- contrib/tcsh/config.h.in | 275 -- contrib/tcsh/config.rpath | 571 --- contrib/tcsh/config.sub | 1788 --------- contrib/tcsh/configure | 8842 ------------------------------------------- contrib/tcsh/imake.config | 63 - contrib/tcsh/install-sh | 520 --- contrib/tcsh/svn | 32 - 16 files changed, 15 insertions(+), 16348 deletions(-) diff --git a/contrib/tcsh/FREEBSD-Xlist b/contrib/tcsh/FREEBSD-Xlist index b6e5636aa567..49621ab36f0f 100644 --- a/contrib/tcsh/FREEBSD-Xlist +++ b/contrib/tcsh/FREEBSD-Xlist @@ -1,5 +1,20 @@ $FreeBSD$ */BUGS +*/Imakefile +*/MAKEDIFFS +*/MAKESHAR +*/Makefile.ADMIN +*/Makefile.in +*/Makefile.std +*/Makefile.vms +*/config.guess +*/config.h.in +*/config.rpath +*/config.sub +*/configure +*/imake.config +*/install-sh +*/svn */config/a* */config/bs2000 */config/bsd diff --git a/contrib/tcsh/Imakefile b/contrib/tcsh/Imakefile deleted file mode 100644 index bd1b43b1a24e..000000000000 --- a/contrib/tcsh/Imakefile +++ /dev/null @@ -1,631 +0,0 @@ -XCOMM -XCOMM Imakefile for tcsh 6.12 -XCOMM Marc Horowitz, MIT SIPB -XCOMM - -#ifdef DestDir -#undef DestDir -#endif -#ifdef ManSuffix -#undef ManSuffix -#endif - -/* All config options go in a separate file. */ - -#include "imake.config" - -#ifndef HasGcc -# define HasGcc 0 -#endif - -#ifndef HasGcc2 -# define HasGcc2 0 -#endif - -/* This is a giant conditional block. It should be set up right for -platforms which are in here, but it may need to be changed for new -ones. Please send in your fixes and additions! */ - -/**** tcsh configuration defines ****/ - -/* specific platforms */ - -#ifndef ConfigH -# ifdef UltrixArchitecture -# define ConfigH ultrix -# endif - -# ifdef UxpArchitecture -# define ConfigH sysv4 -# endif - -# if defined(LinuxArchitecture) || defined(GNUArchitecture) -# define ConfigH linux -# endif - -# ifdef AlphaArchitecture -# if !defined(LinuxArchitecture) && !defined(GNUArchitecture) -# define ConfigH decosf1 -# endif -# if !HasGcc -# define MyCflags -std1 -Olimit 2000 -# else -# define NoCombineRegs -# endif -# endif - -# if defined(VaxArchitecture) && !defined(UltrixArchitecture) -# define ConfigH bsd -# endif - -# ifdef NeXTArchitecture -# define ConfigH mach -# endif - -# if defined(SunArchitecture) -# if (OSMajorVersion == 3) -# define ConfigH sunos35 -# else -# if (OSMajorVersion == 4) -# if (OSMinorVersion == 0) -# define ConfigH sunos40 -# else /* OSMinorVersion == 1 */ -# if (OSTeenyVersion == 3) -# define ConfigH sunos413 -# else /* OsTeenyVersion in [0,1,2] */ -# define ConfigH sunos41 -# endif -# endif -# define NoCombineRegs -# else /* OSMajorVersion == 5 */ -# if (OSMinorVersion < 3) -# if (OSMinorVersion < 2) -# define ConfigH sol2 -# else -# define ConfigH sol22 -# endif -# else -# if (OSMinorVersion < 4) -# define ConfigH sol23 -# else -# if (OSMinorVersion < 6) -# define ConfigH sol24 -# else -# if (OSMinorVersion < 9) -# define ConfigH sol26 -# else -# define ConfigH sol29 -# endif -# endif -# endif -# endif -# define NoCombineRegs -# endif -# endif -# endif - -# ifdef HPArchitecture -/* For some stupid reason makedepend on HP requires this */ -DEPENDFLAGS = -o.o -# if (OSMajorVersion >= 8) -# define ConfigH hpux8 -# else -# define ConfigH hpux7 -# endif -# endif - -# ifdef CrayArchitecture -# define ConfigH cray -# endif - -# ifdef SGIArchitecture -# define ConfigH irix -# define UseLibBSD -# if (OSMajorVersion < 5) -# ifdef you_are_using_yp -# define UseSunLib -# endif -# if !HasGCC -# define MyStdc -D__STDC__ -# if SGICompilerMajorVersion < 4 -CCOPTIONS=-float # We don't want -cckr and -prototypes -# endif -# endif -# endif -# if (OSMajorVersion == 6) -# if (OSMinorVersion >= 2) -# undef UseLibBSD -# define ConfigH irix62 -# endif -# endif -# endif - -# ifdef IBMArchitecture -# undef UseLibBSD -# if (SystemV == YES) -# define ConfigH aix -# if OSMajorVersion < 3 -# if OSMinorVersion < 2 -# define UseLibBSD -# endif -# endif -# else -# define ConfigH bsd -# define AOSArchitecture -# endif -# endif - - -#ifdef AOSArchitecture -#define MyStdc -U__STDC__ -#endif - -# if defined(MipsBsdArchitecture) || defined(MipsSysvArchitecture) -# define ConfigH mips -# endif - -# ifdef DguxArchitecture -# define ConfigH dgux -# endif - -# ifdef ConvexArchitecture -# define ConfigH convex -# endif - -# if defined(SQNTArchitecture) || defined(SequentArchitecture) -# define ConfigH sequent -# endif - -# ifdef MacIIArchitecture -# define ConfigH mac2 -# endif - -# ifdef MinixArchitecture -/* Maybe conditional on MACH? */ -SYSSRCS=mi.termios.c mi.wait.h mi.varargs.h -SYSOBJS=mi.termios.${SUF} -EXTF=ma.setp.c vms.termcap.c -# else -/* Maybe conditional on MACH? */ -SYSSRCS=ma.setp.c -SYSOBJS=ma.setp.${SUF} -EXTF=mi.termios.c mi.wait.h mi.varargs.h vms.termcap.c -# endif - -# ifdef i386Isc -# if IscVersion != 202 -# define ConfigH isc -# define UseLibCposix -# else -# define ConfigH isc202 -# endif -# endif /* i386Isc */ - -# ifdef OpenBSDArchitecture -# define ConfigH bsd4.4 -# endif /* OpenBsdArchitecture */ - -# ifdef NetBSDArchitecture -# define ConfigH bsd4.4 -# endif /* NetBsdArchitecture */ - -# ifdef FreeBSDArchitecture -# define ConfigH bsd4.4 -# endif /* FreeBsdArchitecture */ - -# ifdef MidnightBSDArchitecture -# define ConfigH bsd4.4 -# endif /* MidnightBsdArchitecture */ - -# ifdef i386SVR4Architecture -# define ConfigH sysv4 -# ifdef DELL -# define NoCombineRegs -# endif -# endif - -#endif /* !ConfigH */ - -/* generic os's */ - -#ifndef ConfigH - -#if (SystemV == YES) -#define ConfigH sysv3 -#else -/* why this as a default? Why not? */ -#define ConfigH bsd -#endif - -#endif /* !ConfigH */ - -/**** libraries ****/ - -#if (SystemV == NO) || defined(HPArchitecture) || \ - defined(SQNTArchitecture) || defined(SequentArchitecture) || \ - defined(MacIIArchitecture) || defined(UseLibTermcap) -LIBTERMCAP = -ltermcap -#else -LIBTERMCAP = -#endif - -#if defined(SQNTArchitecture) || defined(SequentArchitecture) -LIBSQNT=-lsocket -linet -lnsl -lseq -#endif - -/* This may not be good enough - I don't have access to enough systems -to really test it. */ -#if (SystemV == YES) || defined(UseLibCurses) && !defined(HPArchitecture) -LIBCURSES = -lcurses -#else -LIBCURSES = -#endif - -#if defined(UseLibNet) -LIBNET = -lnet -#else -LIBNET = -#endif - -#if defined(UseLibSocket) -LIBSOCKET = -lsocket -#else -LIBSOCKET = -#endif - -#if defined(UseLibBSD) -LIBBSD = -lbsd -#else -LIBBSD = -#endif - -#if (defined(SGIArchitecture) && \ - (OSMajorVersion == 3) && (OSMinorVersion == 3)) || \ - defined(UseLibC_S) -LIBC_S = -lc_s -#else -LIBC_S = -#endif - -#if defined(UseLibSun) -LIBSUN = -lsun -#else -LIBSUN = -#endif - -#if defined(UseLibCposix) -LIBCPOSIX = -lcposix -#else -LIBCPOSIX = -#endif - -#if defined(UseLibInet) -LIBINET = -linet -#else -LIBINET = -#endif - -#if defined(UseLibDir) -LIBDIRECT = -ldir -#else -LIBDIRECT = -#endif - -#if defined(UseLibX) -LIBX = -lx -#else -LIBX = -#endif - -#if defined(UseLibIntl) -LIBINTL = -lintl -#else -LIBINTL = -#endif - -#if (HasLibCrypt == YES) -LIBCRYPT = -lcrypt -#else -LIBCRYPT = -#endif - -#if defined(MacIIArchitecture) || defined(UseLibPosix) -LIBPOSIX = -lposix -#else -LIBPOSIX = -#endif - -#if defined(ATTArchitecture) || defined(UseLibDirent) -LIBDIRECTENT = -ldirent -#else -LIBDIRECTENT = -#endif - -/* The order here is significant. Although nothing uses all of these, -some platforms which use more than one do care about the order. */ - -SYSLIBS = $(LIBPOSIX) $(LIBDIRECTENT) $(LIBTERMCAP) $(LIBCURSES) \ - $(LIBNET) $(LIBINTL) $(LIBSOCKET) $(LIBSUN) $(LIBBSD) $(LIBCPOSIX) \ - $(LIBINET) $(LIBDIRECT) $(LIBX) $(LIBC_S) $(LIBSQNT) $(LIBCRYPT) - -/* Past here, nothing should need to be changed to compile on a different -platform, unless you have a really weird architecture. */ - -#ifdef MyCC -CC = MyCC -#else -# if HasGcc -# if HasGcc2 -CC = gcc -# else -# ifdef NoCombineRegs -CC = gcc -finline-functions -fstrength-reduce -# else -CC = gcc -fcombine-regs -finline-functions -fstrength-reduce -# endif -# endif -# else -CC = cc -# endif -#endif - -#ifdef HESIOD -HESLIB = -L/usr/athena/lib -lhesiod -/* it seems to me that the -I shouldn't be necessary, but there seems -to be a bug in the Imake stuff, so here it is. */ -HESDEF = -DHESIOD -I/usr/athena/include -#else -HESLIB = -HESDEF = -#endif - -#ifdef AFS -#ifndef AFSDIR -AFSDIR = /usr/afsws -#endif -#ifdef AFS33 -#define AFS33LIB -laudit -#else -#define AFS33LIB -#endif -/* Auxilliary libs needed for AFS */ -/* Both HPUX and Solaris need the BSD libraries. We need -lc before - * the bsd library to avoid using any more of it than is necessary. - */ -#if defined(HPArchitecture) -#define AFSAUXLIB -lc -lBSD -/* This is probably a kludge, but so is imake. */ -#else -#if defined(SunArchitecture) && (OSMajorVersion == 5) -#define AFSAUXLIB -lsocket -lnsl -lc -lucb -#else -#define AFSAUXLIB -#endif -#endif /* AFSAUXLIB */ -AFSLIB = -L$(AFSDIR)/lib -L$(AFSDIR)/lib/afs -lkauth -lprot -lubik\ - -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err\ - $(AFSDIR)/lib/afs/util.a AFS33LIB AFSAUXLIB -AFSDEF = -DAFS -I$(AFSDIR)/include -#else -AFSLIB = -AFSDEF = -#endif - -/* This is encore specific, but I don't know what encore's #define is, -and it shouldn't hurt to have it here, so here it is */ -PARALLEL=12 # Make the multi-max run fast. - -#ifndef TcshTop -#define TcshTop /usr/local -#endif -TCSHTOP = TcshTop - -#ifndef ManSuffix -#define ManSuffix 1 -#endif -MANSUFFIX = ManSuffix - -#ifdef TcshPath -PATH_TCSHELL = TcshPath -TCSHPATH = -D_PATH_TCSHELL='"$(PATH_TCSHELL)"' -#else -TCSHPATH = -#endif - -#ifdef DestBin -TCSH_BINDIR = DestBin -#else -TCSH_BINDIR = $(TCSHTOP)/bin -#endif -#ifdef DestMan -TCSH_MANDIR = DestMan -#else -TCSH_MANDIR = $(TCSHTOP)/man/man$(MANSUFFIX) -#endif - -LOCALLIBS = - -#ifndef MyCflags -#define MyCflags -#endif - -#ifndef MyDefines -#define MyDefines -#endif - -#ifndef MyIncludes -#define MyIncludes -#endif - -#ifndef MyStdc -#define MyStdc -#endif - -#ifdef CDebugFlags -CDEBUGFLAGS = CDebugFlags -#else -# if HasGcc2 -CDEBUGFLAGS = -O2 -# else -CDEBUGFLAGS = -O -# endif -#endif - - -#ifdef HostType -HOSTTYPE=HostType -HTDEF = -DHOSTTYPE='"$(HOSTTYPE)"' -#else -HTDEF = -#endif - -DEFINES = $(TCSHPATH) $(HESDEF) $(AFSDEF) $(HTDEF) MyDefines MyCflags MyStdc -INCLUDES = -I. MyIncludes -#ifdef MyLibs -LDLIBS = MyLibs -#endif - -SUF = o -VERSION = 6.12 - -SHSRCS= sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c \ - sh.char.c sh.exp.c sh.file.c sh.func.c \ - sh.glob.c sh.hist.c sh.init.c sh.lex.c \ - sh.misc.c sh.parse.c sh.print.c sh.proc.c \ - sh.sem.c sh.set.c sh.time.c dotlock.c dotlock.h glob.c \ - sh.char.h sh.dir.h sh.proc.h sh.h \ - sh.decls.h glob.h ${SYSSRCS} -SHOBJS= sh.${SUF} sh.dir.${SUF} sh.dol.${SUF} sh.err.${SUF} sh.exec.${SUF} \ - sh.char.${SUF} sh.exp.${SUF} sh.file.${SUF} sh.func.${SUF} \ - sh.glob.${SUF} sh.hist.${SUF} sh.init.${SUF} sh.lex.${SUF} \ - sh.misc.${SUF} sh.parse.${SUF} sh.print.${SUF} sh.proc.${SUF} \ - sh.sem.${SUF} sh.set.${SUF} sh.time.${SUF} dotlock.${SUF} glob.${SUF} \ - ${SYSOBJS} - -TWSRCS= tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \ - tw.comp.c tw.color.c -TWOBJS= tw.help.${SUF} tw.init.${SUF} tw.parse.${SUF} tw.spell.${SUF} \ - tw.comp.${SUF} tw.color.${SUF} - -EDSRCS= ed.chared.c ed.decls.h ed.defns.c ed.h ed.init.c ed.inputl.c \ - ed.refresh.c ed.screen.c ed.xmap.c ed.term.c ed.term.h -EDOBJS= ed.chared.${SUF} ed.refresh.${SUF} ed.screen.${SUF} ed.init.${SUF} \ - ed.inputl.${SUF} ed.defns.${SUF} ed.xmap.${SUF} ed.term.${SUF} - -TCSRCS= tc.alloc.c tc.bind.c tc.const.c tc.decls.h tc.disc.c \ - tc.func.c tc.nls.c tc.nls.h tc.os.c tc.os.h tc.printf.c tc.prompt.c \ - tc.disc.${SUF} tc.func.${SUF} tc.nls.${SUF} tc.os.${SUF} \ - tc.printf.${SUF} tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h \ - tc.vers.c tc.wait.h tc.who.c tc.h -TCOBJS= tc.alloc.${SUF} tc.bind.${SUF} tc.const.${SUF} tc.defs.${SUF} \ - tc.disc.${SUF} tc.func.${SUF} tc.os.${SUF} tc.printf.${SUF} \ - tc.prompt.${SUF} tc.sched.${SUF} tc.sig.${SUF} tc.str.${SUF} \ - tc.vers.${SUF} tc.who.${SUF} - -MISCF = Makefile.std BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md \ - FAQ WishList config_f.h eight-bit.me glob.3 patchlevel.h pathnames.h \ - tcsh.man Ported src.desc Imakefile imake.config complete.tcsh \ - Makefile.vms termcap.vms snames.h host.defs gethost.c tcsh.man2html \ - Makefile.in configure.ac Makefile.win32 aclocal.m4 dot.login dot.tcshrc -CONFSRCS=config/[a-z]* - - -SRCS = $(SHSRCS) $(TWSRCS) $(EDSRCS) $(TCSRCS) -OBJS = $(SHOBJS) $(TWOBJS) $(EDOBJS) $(TCOBJS) - -ALLSRCS= $(MISCF) $(SRCS) $(EXTF) - -AllTarget(tcsh) - -ed.defns.h: config.h ed.defns.c - @rm -f $@ - @echo '/* Do not edit this file, make creates it. */' > $@ - @echo '#ifndef _h_ed_defns' >> $@ - @echo '#define _h_ed_defns' >> $@ - egrep '[FV]_' ed.defns.c | egrep '^#define' >> $@ - @echo '#endif /* _h_ed_defns */' >> $@ - -sh.err.h: config.h sh.err.c - @rm -f $@ - @echo '/* Do not edit this file, make creates it. */' > $@ - @echo '#ifndef _h_sh_err' >> $@ - @echo '#define _h_sh_err' >> $@ - egrep 'ERR_' sh.err.c | egrep '^#define' >> $@ - @echo '#endif /* _h_sh_err */' >> $@ - -tc.const.h: config.h tc.const.c - @rm -f $@ - @echo '/* Do not edit this file, make creates it. */' > $@ - @echo '#ifndef _h_tc_const' >> $@ - @echo '#define _h_tc_const' >> $@ - ${CC} -E $(INCLUDES) ${DEFINES} -D_h_tc_const tc.const.c | \ - grep 'Char STR' | \ - sed -e 's/Char \([a-zA-Z0-9_]*\)\[\].*/extern Char \1[];/' | \ - sort >> $@ - @echo '#endif /* _h_tc_const */' >> $@ - -config.h: config_f.h - cp config/ConfigH config.h - -$(OBJS): sh.err.h tc.const.h ed.defns.h - -tar.Z: - rm -f tcsh-${VERSION}.tar.Z - rm -rf tcsh-${VERSION} - mkdir tcsh-${VERSION} tcsh-${VERSION}/config - cp ${ALLSRCS} tcsh-${VERSION} - cp ${CONFSRCS} tcsh-${VERSION}/config - tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) - tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z - rm -rf tcsh-${VERSION} - -tar.gz: - rm -f tcsh-${VERSION}.tar.gz - rm -rf tcsh-${VERSION} - mkdir tcsh-${VERSION} tcsh-${VERSION}/config - cp ${ALLSRCS} tcsh-${VERSION} - cp ${CONFSRCS} tcsh-${VERSION}/config - tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) - tar cvf - tcsh-${VERSION} | gzip > tcsh-${VERSION}.tar.gz - rm -rf tcsh-${VERSION} - -shar: - rm -f tcsh-*.shar - rm -rf tcsh-${VERSION} - mkdir tcsh-${VERSION} tcsh-${VERSION}/config - cp ${ALLSRCS} tcsh-${VERSION} - cp ${CONFSRCS} tcsh-${VERSION}/config - tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) - MAKESHAR -v -n tcsh-${VERSION} tcsh-${VERSION} \ - tcsh-${VERSION}/?* tcsh-${VERSION}/config/?* \ - tcsh-${VERSION}/?*/set?* - rm -rf tcsh-${VERSION} - -catalogs: - @(cd nls; make catalogs) - -world: - $(MAKE) clean ; $(MAKE) depend ; $(MAKE) tcsh ; $(MAKE) install - -clean:: - rm -f ed.defns.h sh.err.h tc.const.h config.h tc.defs.* - rm -f tcsh.*.m tcsh.*.cat - -depend:: config.h ed.defns.h sh.err.h tc.const.h $(SRCS) tc.defs.c - -tc.defs.${SUF}: tc.defs.c sh.h - -tc.defs.c: gethost host.defs - @rm -f $@ - @echo "/* Do not edit this file, make creates it */" > $@ - ./gethost host.defs >> $@ - -ALIB=$(HESLIB) $(AFSLIB) $(SYSLIBS) -AINC=ed.defns.h sh.err.h tc.const.h sh.h - -NormalProgramTarget(tcsh, $(OBJS), $(AINC), $(LOCALLIBS), $(ALIB)) -NormalProgramTarget(gethost, gethost.${SUF}, $(AINC), $(LOCALLIBS), $(ALIB)) - -InstallProgram(tcsh,$(TCSH_BINDIR)) -InstallManPage(tcsh,$(TCSH_MANDIR)) -DependTarget() diff --git a/contrib/tcsh/MAKEDIFFS b/contrib/tcsh/MAKEDIFFS deleted file mode 100755 index be0e5b242668..000000000000 --- a/contrib/tcsh/MAKEDIFFS +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# -# MAKEDIFFS.sh: Make context diffs for the csh sources -# -XINUDIR=/usr/share/src/mtXinu/bin/csh -BSDDIR=/usr/share/src/mtXinu/BSD/bin/csh -TAHOEDIR=/usr/share/src/mtXinu/TAHOE/bin/csh -RENODIR=/usr/share/src/mtXinu/RENO/bin/csh -TCSHDIR=`pwd` -case "x$1" in -xxinu) - CSHDIR=$XINUDIR;; -xbsd) - CSHDIR=$BSDDIR;; -xtahoe) - CSHDIR=$TAHOEDIR;; -xreno) - CSHDIR=$RENODIR;; -x*) - echo "Usage: `basename $0` [bsd|tahoe|xinu|reno]";exit 1;; -esac -DIFF1='sh.c sh.char.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.exp.c sh.file.c' -DIFF2='sh.func.c sh.glob.c sh.hist.c sh.init.c sh.lex.c sh.misc.c sh.parse.c sh.print.c' -DIFF3='sh.proc.c sh.sem.c sh.set.c sh.time.c sh.char.h sh.dir.h sh.h sh.local.h sh.proc.h' - -for i in $DIFF1 -do - diff -c $CSHDIR/$i $TCSHDIR/$i -done > DIFFS.1 - -for i in $DIFF2 -do - diff -c $CSHDIR/$i $TCSHDIR/$i -done > DIFFS.2 - -for i in $DIFF3 -do - diff -c $CSHDIR/$i $TCSHDIR/$i -done > DIFFS.3 -exit 0 diff --git a/contrib/tcsh/MAKESHAR b/contrib/tcsh/MAKESHAR deleted file mode 100755 index 48c73b7c74ab..000000000000 --- a/contrib/tcsh/MAKESHAR +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/sh -# -# MAKESHAR.sh: Make a shar file for the sources -# - -AWK=/usr/bin/nawk # Must be nawk or gawk cause of 2D arrays -WC=/usr/ucb/wc -GREP=/usr/bin/egrep -SORT=/usr/bin/sort -SH=/bin/sh - -dirs= -name=kit -files= -verbose=0 -size=45000 - -for i -do - case $i in - -n) - name=;; - -v) - verbose=1;; - -d) - SH=/bin/cat;; - -s) - size=$1;; - *) - if [ -z "$name" ] - then - name=$i - elif [ -d $i ] - then - dirs="$dirs $i" - elif [ -f $i ] - then - files="$files $i" - else - echo "$0: File `$i' not found." 1>&2 - exit 1 - fi;; - esac -done - -if [ \( -z "$files" \) -a \( -z "$dirs" \) ] -then - echo "Usage: $0 [-n name] [-s size] [-vd] ." 1>&2 - exit 1 -fi - -$WC $files | $GREP -v total | $SORT +2 | $AWK ' - BEGIN { - i = 0; - seq = 1; - size = 0; - name = 1; - used = 2; - verbose='"$verbose"'; - tty = "/dev/tty"; - maxsize = '"$size"'; - dirs = "'"$dirs"'"; - }; - { - a[i, size] = $3; - a[i, name] = $4; - a[i, used] = 0; - i++; - }; - END { - for (maxi = i--; i >= 0; i--) { - idx = 0; - if (a[i, used] == 0) { - if (verbose && a[i, size] > maxsize) - printf("Warning: File %s is %d > %d\n", - a[i, name], a[i, size], maxsize) > tty; - s = a[i, size]; - a[i, used] = 1; - kit[seq, idx++] = i; - j = 0; - while (j < maxi) { - # Find the greatest file we can add - j = maxi; - for (k = 0; k < maxi; k++) - if (a[k, used] == 0 && a[k, size] + s < maxsize) - j = k; - if (j < maxi) { - s += a[j, size]; - a[j, used] = 1; - kit[seq, idx++] = j; - } - } - sizes[seq] = s; - kit[seq++, idx] = -1; - } - } - for (i = 1; i < seq; i++) { - printf("shar -n%d -e%d %s ", i, seq - 1, dirs); - if (verbose) { - printf("%3d of %3d: ", i, seq - 1) > tty; - len = 12; - } - for (j = 0; kit[i, j] != -1; j++) { - s = a[kit[i, j], name]; - if (verbose) { - clen = length(s) + 1; - len += clen; - if (len > 70) { - printf("\n ") > tty; - len = 12 + clen; - } - printf("%s ", s) > tty; - } - printf("%s ", s); - } - printf("> '"$name"'-%d.shar;", i); - if (verbose) - printf("= %5d\n", sizes[i]) > tty; - } - }' | $SH diff --git a/contrib/tcsh/Makefile.ADMIN b/contrib/tcsh/Makefile.ADMIN deleted file mode 100644 index 5ad3bb8fb3c5..000000000000 --- a/contrib/tcsh/Makefile.ADMIN +++ /dev/null @@ -1,24 +0,0 @@ -# -# Makefile.ADMIN -# -# Maintenance tasks -# -# You can refetch files from the website, then run "git diff" to -# sanity check any changes before committing. -# - -LYNX= lynx -dump -nolist -TRIM= expand | sed -e 's/^ *$$//' | cat -s -WEB= https://www.tcsh.org - -PAGES= FAQ - -all: ${PAGES} - -.for i in ${PAGES} -$i: force - ${LYNX} ${WEB}/${i:tl}/ | ${TRIM} > ${.TARGET} -.endfor - -.DUMMY: force -force: diff --git a/contrib/tcsh/Makefile.in b/contrib/tcsh/Makefile.in deleted file mode 100644 index c6b5f2554cc0..000000000000 --- a/contrib/tcsh/Makefile.in +++ /dev/null @@ -1,782 +0,0 @@ -# -# C Shell with process control; VM/UNIX VAX Makefile -# Bill Joy UC Berkeley; Jim Kulp IIASA, Austria -# -# With an input editor, command completion, etc. and ported to all sorts of -# things; Paul Placeway, CIS Dept., Ohio State University -# -SHELL=/bin/sh -ENVCMD=/usr/bin/env -VERSION=@PACKAGE_VERSION@ -BUILD=tcsh$(EXEEXT) -VPATH=@srcdir@ -srcdir=@srcdir@ - -################################################################ -## CFLAGS. For various -D things, see config.h -################################################################ -# -# These are the default suffixes from .c to .o and -c to get there -# but to use the global optimizer on the mips boxes, see below -# -SUF=o -CF=-c - -CPPFLAGS=-I. -I$(srcdir) - -LFLAGS= -# hpux lint -#LFLAGS= -Zn10000 - - -# This is set by autoconf: -CFLAGS = @CFLAGS@ -# debug: -#CFLAGS= -g -# production: -#CFLAGS= -O -# Broken optimizers.... -#CFLAGS= - -#CFLAGS= -g -pg -DPROF -#CFLAGS= -O -pg -DPROF - -# gcc 1.00-1.37 -#CFLAGS= -O -finline-functions -fstrength-reduce - -# gcc 1.37-1.40 -#CFLAGS= -O -fcombine-regs -finline-functions -fstrength-reduce -# add -msoft-float for 68881 machines. - -# gcc 2.0 -# On the sparc, don't use -O2; it breaks setjmp() and vfork() -#CFLAGS= -O - -# gcc-2.1+ -#CFLAGS= -O2 - -# lucid c on suns -#CFLAGS= -O5 - -# gcc 2.1 on linux -#CFLAGS= -O6 -fomit-frame-pointer - -# HP/UX 8.0, 9.0 -#CFLAGS= +O3 -Aa - -# Ultrix 4.2a -#CFLAGS= -O -Olimit 2000 - -# Intel Paragon OSF/1 with PGI compilers -#CFLAGS= -O -Mnodebug -Mnoperfmon - -# DEC Alpha OSF/1 -## Normal Optimization -#CFLAGS= -O2 -Olimit 2000 -## Full Optimization - may not work -#CFLAGS= -O3 -Olimit 2000 -#CF=-j -#SUF=u -#.SUFFIXES: .u *** 15513 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed May 19 21:30:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1220064C443; Wed, 19 May 2021 21:30: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 4FlmJ268sSz4jJL; Wed, 19 May 2021 21:30: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 B17591A04B; Wed, 19 May 2021 21:30: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 14JLUgSa010614; Wed, 19 May 2021 21:30:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JLUgvX010613; Wed, 19 May 2021 21:30:42 GMT (envelope-from git) Date: Wed, 19 May 2021 21:30:42 GMT Message-Id: <202105192130.14JLUgvX010613@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 6560ac57ce87 - main - tcsh: update to version 6.22.04. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6560ac57ce879857203bc456cdc3849808dc0700 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 21:30:43 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=6560ac57ce879857203bc456cdc3849808dc0700 commit 6560ac57ce879857203bc456cdc3849808dc0700 Merge: 6190ff6104ae 174d8b60324d Author: Dmitry Chagin AuthorDate: 2021-05-19 21:12:27 +0000 Commit: Dmitry Chagin CommitDate: 2021-05-19 21:12:27 +0000 tcsh: update to version 6.22.04. Merge commit '174d8b60324d7e8754709f7155e13ca95220b48c' into main. MFC After: 2 weeks contrib/tcsh/Fixes | 1 + contrib/tcsh/ed.chared.c | 98 ++++++++++++++++---------------- contrib/tcsh/ed.defns.c | 10 ++-- contrib/tcsh/ed.h | 10 +++- contrib/tcsh/ed.init.c | 48 ++++++++-------- contrib/tcsh/ed.inputl.c | 20 +++---- contrib/tcsh/ed.refresh.c | 16 +++--- contrib/tcsh/ed.screen.c | 18 +++--- contrib/tcsh/ed.term.c | 34 ++++++------ contrib/tcsh/ed.term.h | 6 +- contrib/tcsh/ed.xmap.c | 10 ++-- contrib/tcsh/gethost.c | 8 +-- contrib/tcsh/glob.c | 18 +++--- contrib/tcsh/glob.h | 2 +- contrib/tcsh/ma.setp.c | 4 +- contrib/tcsh/mi.termios.c | 2 +- contrib/tcsh/mi.wait.h | 2 +- contrib/tcsh/patchlevel.h | 4 +- contrib/tcsh/sh.c | 100 ++++++++++++++++----------------- contrib/tcsh/sh.char.c | 136 ++++++++++++++++++++++----------------------- contrib/tcsh/sh.char.h | 2 +- contrib/tcsh/sh.decls.h | 14 ++--- contrib/tcsh/sh.dir.c | 44 +++++++-------- contrib/tcsh/sh.dol.c | 10 ++-- contrib/tcsh/sh.err.c | 2 +- contrib/tcsh/sh.exec.c | 10 ++-- contrib/tcsh/sh.exp.c | 44 +++++++-------- contrib/tcsh/sh.file.c | 2 +- contrib/tcsh/sh.func.c | 84 ++++++++++++++-------------- contrib/tcsh/sh.glob.c | 18 +++--- contrib/tcsh/sh.h | 36 ++++++------ contrib/tcsh/sh.hist.c | 46 +++++++++------ contrib/tcsh/sh.init.c | 12 ++-- contrib/tcsh/sh.lex.c | 16 +++--- contrib/tcsh/sh.misc.c | 6 +- contrib/tcsh/sh.parse.c | 1 + contrib/tcsh/sh.print.c | 6 +- contrib/tcsh/sh.proc.c | 28 +++++----- contrib/tcsh/sh.sem.c | 22 ++++---- contrib/tcsh/sh.set.c | 16 +++--- contrib/tcsh/sh.time.c | 6 +- contrib/tcsh/sh.types.h | 36 ++++++------ contrib/tcsh/tc.alloc.c | 18 +++--- contrib/tcsh/tc.bind.c | 4 +- contrib/tcsh/tc.const.c | 20 +++---- contrib/tcsh/tc.decls.h | 4 +- contrib/tcsh/tc.func.c | 32 +++++------ contrib/tcsh/tc.os.c | 52 ++++++++--------- contrib/tcsh/tc.os.h | 22 ++++---- contrib/tcsh/tc.printf.c | 4 +- contrib/tcsh/tc.prompt.c | 10 ++-- contrib/tcsh/tc.str.c | 8 +-- contrib/tcsh/tc.vers.c | 22 ++++---- contrib/tcsh/tc.who.c | 8 +-- contrib/tcsh/tcsh.man | 4 +- contrib/tcsh/tw.color.c | 6 +- contrib/tcsh/tw.comp.c | 14 ++--- contrib/tcsh/tw.h | 2 +- contrib/tcsh/tw.init.c | 18 +++--- contrib/tcsh/tw.parse.c | 48 ++++++++-------- contrib/tcsh/vms.termcap.c | 2 +- 61 files changed, 663 insertions(+), 643 deletions(-) diff --cc contrib/tcsh/glob.c index bd9856c8a8af,000000000000..a5a21f1f715c mode 100644,000000..100644 --- a/contrib/tcsh/glob.c +++ b/contrib/tcsh/glob.c @@@ -1,801 -1,0 +1,801 @@@ +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Guido van Rossum. + * + * 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. + * 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 + * 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 + * 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. + */ +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)glob.c 5.12 (Berkeley) 6/24/91"; +#endif /* LIBC_SCCS and not lint */ +/* + * Glob: the interface is a superset of the one defined in POSIX 1003.2, + * draft 9. + * + * The [!...] convention to negate a range is supported (SysV, Posix, ksh). + * + * Optional extra services, controlled by flags not defined by POSIX: + * + * GLOB_QUOTE: + * Escaping convention: \ inhibits any special meaning the following + * character might have (except \ at end of string is retained). + * GLOB_MAGCHAR: + * Set in gl_flags if pattern contained a globbing character. + * GLOB_ALTNOT: + * Use ^ instead of ! for "not". + * gl_matchc: + * Number of matches in the current invocation of glob. + */ + +#ifdef WINNT_NATIVE + #pragma warning(disable:4244) +#endif /* WINNT_NATIVE */ + +#define Char __Char +#include "sh.h" +#include "glob.h" + +#ifndef HAVE_MBLEN +#undef mblen +#define mblen(_s,_n) mbrlen((_s),(_n),NULL) +#endif + +#undef Char +#undef QUOTE +#undef TILDE +#undef META +#undef ismeta +#undef Strchr + +#ifndef S_ISDIR +#define S_ISDIR(a) (((a) & S_IFMT) == S_IFDIR) +#endif + +#if !defined(S_ISLNK) && defined(S_IFLNK) +#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK) +#endif + +#if !defined(S_ISLNK) && !defined(lstat) +#define lstat stat +#endif + +typedef unsigned short Char; + +static int glob1 (Char *, glob_t *, int); +static int glob2 (struct strbuf *, const Char *, glob_t *, int); +static int glob3 (struct strbuf *, const Char *, const Char *, + const Char *, glob_t *, int); +static void globextend (const char *, glob_t *); +static int match (const char *, const Char *, const Char *, + int); +static int compare (const void *, const void *); +static DIR *Opendir (const char *); +#ifdef S_IFLNK +static int Lstat (const char *, struct stat *); +#endif +static int Stat (const char *, struct stat *sb); +static Char *Strchr (Char *, int); +#ifdef DEBUG +static void qprintf (const char *, const Char *); +#endif + +#define DOLLAR '$' +#define DOT '.' +#define EOS '\0' +#define LBRACKET '[' +#define NOT '!' +#define ALTNOT '^' +#define QUESTION '?' +#define QUOTE '\\' +#define RANGE '-' +#define RBRACKET ']' +#define SEP '/' +#define STAR '*' +#define TILDE '~' +#define UNDERSCORE '_' + +#define M_META 0x8000 +#define M_PROTECT 0x4000 +#define M_MASK 0xffff +#define M_ASCII 0x00ff + +#define LCHAR(c) ((c)&M_ASCII) +#define META(c) ((c)|M_META) +#define M_ALL META('*') +#define M_END META(']') +#define M_NOT META('!') +#define M_ALTNOT META('^') +#define M_ONE META('?') +#define M_RNG META('-') +#define M_SET META('[') +#define ismeta(c) (((c)&M_META) != 0) + +int +globcharcoll(__Char c1, __Char c2, int cs) +{ +#if defined(NLS) && defined(LC_COLLATE) && defined(HAVE_STRCOLL) +# if defined(WIDE_STRINGS) + wchar_t s1[2], s2[2]; + + if (c1 == c2) + return (0); + if (cs) { + c1 = towlower(c1); + c2 = towlower(c2); + } else { +#ifndef __FreeBSD__ + /* This should not be here, but I'll rather leave it in than engage in + a LC_COLLATE flamewar about a shell I don't use... */ + if (iswlower(c1) && iswupper(c2)) + return (1); + if (iswupper(c1) && iswlower(c2)) + return (-1); +#endif + } + s1[0] = c1; + s2[0] = c2; + s1[1] = s2[1] = '\0'; + return wcscoll(s1, s2); +# else /* not WIDE_STRINGS */ + char s1[2], s2[2]; + + if (c1 == c2) + return (0); + /* + * From kevin lyda : + * strcoll does not guarantee case sorting, so we pre-process now: + */ + if (cs) { + c1 = islower(c1) ? c1 : tolower(c1); + c2 = islower(c2) ? c2 : tolower(c2); + } else { + if (islower(c1) && isupper(c2)) + return (1); + if (isupper(c1) && islower(c2)) + return (-1); + } + s1[0] = c1; + s2[0] = c2; + s1[1] = s2[1] = '\0'; + return strcoll(s1, s2); +# endif +#else + return (c1 - c2); +#endif +} + +/* + * Need to dodge two kernel bugs: + * opendir("") != opendir(".") + * NAMEI_BUG: on plain files trailing slashes are ignored in some kernels. + * POSIX specifies that they should be ignored in directories. + */ + +static DIR * +Opendir(const char *str) +{ +#if defined(hpux) || defined(__hpux) + struct stat st; +#endif + + if (!*str) + return (opendir(".")); +#if defined(hpux) || defined(__hpux) + /* + * Opendir on some device files hangs, so avoid it + */ + if (stat(str, &st) == -1 || !S_ISDIR(st.st_mode)) + return NULL; +#endif + return opendir(str); +} + +#ifdef S_IFLNK +static int +Lstat(const char *fn, struct stat *sb) +{ + int st; + + st = lstat(fn, sb); +# ifdef NAMEI_BUG + if (*fn != 0 && strend(fn)[-1] == '/' && !S_ISDIR(sb->st_mode)) + st = -1; +# endif /* NAMEI_BUG */ + return st; +} +#else +#define Lstat Stat +#endif /* S_IFLNK */ + +static int +Stat(const char *fn, struct stat *sb) +{ + int st; + + st = stat(fn, sb); +#ifdef NAMEI_BUG + if (*fn != 0 && strend(fn)[-1] == '/' && !S_ISDIR(sb->st_mode)) + st = -1; +#endif /* NAMEI_BUG */ + return st; +} + +static Char * +Strchr(Char *str, int ch) +{ + do + if (*str == ch) + return (str); + while (*str++); + return (NULL); +} + +#ifdef DEBUG +static void +qprintf(const char *pre, const Char *s) +{ + const Char *p; - ++ + xprintf("%s", pre); + for (p = s; *p; p++) + xprintf("%c", *p & 0xff); + xprintf("\n%s", pre); + for (p = s; *p; p++) + xprintf("%c", *p & M_PROTECT ? '"' : ' '); + xprintf("\n%s", pre); + for (p = s; *p; p++) + xprintf("%c", *p & M_META ? '_' : ' '); + xprintf("\n"); +} +#endif /* DEBUG */ + +static int +compare(const void *p, const void *q) +{ +#if defined(NLS) && defined(HAVE_STRCOLL) + return (strcoll(*(char *const *) p, *(char *const *) q)); +#else + return (strcmp(*(char *const *) p, *(char *const *) q)); +#endif /* NLS && HAVE_STRCOLL */ +} + +/* + * The main glob() routine: compiles the pattern (optionally processing + * quotes), calls glob1() to do the real pattern matching, and finally + * sorts the list (unless unsorted operation is requested). Returns 0 + * if things went well, nonzero if errors occurred. It is not an error + * to find no matches. + */ +int +glob(const char *pattern, int flags, int (*errfunc) (const char *, int), + glob_t *pglob) +{ + int err, oldpathc; + Char *bufnext, m_not; + const unsigned char *patnext; + int c, not; + Char *qpatnext, *patbuf; + int no_match; + + patnext = (const unsigned char *) pattern; + if (!(flags & GLOB_APPEND)) { + pglob->gl_pathc = 0; + pglob->gl_pathv = NULL; + if (!(flags & GLOB_DOOFFS)) + pglob->gl_offs = 0; + } + pglob->gl_flags = flags & ~GLOB_MAGCHAR; + pglob->gl_errfunc = errfunc; + oldpathc = pglob->gl_pathc; + pglob->gl_matchc = 0; + + if (pglob->gl_flags & GLOB_ALTNOT) { + not = ALTNOT; + m_not = M_ALTNOT; + } + else { + not = NOT; + m_not = M_NOT; + } + + patbuf = xmalloc((strlen(pattern) + 1) * sizeof(*patbuf)); + bufnext = patbuf; + + no_match = *patnext == not; + if (no_match) + patnext++; + + if (flags & GLOB_QUOTE) { + /* Protect the quoted characters */ + while ((c = *patnext++) != EOS) { +#ifdef WIDE_STRINGS + int len; - ++ + len = mblen((const char *)(patnext - 1), MB_LEN_MAX); + if (len == -1) + TCSH_IGNORE(mblen(NULL, 0)); + else if (len > 1) { + *bufnext++ = (Char) c; + while (--len != 0) + *bufnext++ = (Char) (*patnext++ | M_PROTECT); + } else +#endif /* WIDE_STRINGS */ + if (c == QUOTE) { + if ((c = *patnext++) == EOS) { + c = QUOTE; + --patnext; + } + *bufnext++ = (Char) (c | M_PROTECT); + } + else + *bufnext++ = (Char) c; + } + } + else + while ((c = *patnext++) != EOS) + *bufnext++ = (Char) c; + *bufnext = EOS; + + bufnext = patbuf; + qpatnext = patbuf; + while ((c = *qpatnext++) != EOS) { + switch (c) { + case LBRACKET: + c = *qpatnext; + if (c == not) + ++qpatnext; + if (*qpatnext == EOS || + Strchr(qpatnext + 1, RBRACKET) == NULL) { + *bufnext++ = LBRACKET; + if (c == not) + --qpatnext; + break; + } + pglob->gl_flags |= GLOB_MAGCHAR; + *bufnext++ = M_SET; + if (c == not) + *bufnext++ = m_not; + c = *qpatnext++; + do { + *bufnext++ = LCHAR(c); + if (*qpatnext == RANGE && + (c = qpatnext[1]) != RBRACKET) { + *bufnext++ = M_RNG; + *bufnext++ = LCHAR(c); + qpatnext += 2; + } + } while ((c = *qpatnext++) != RBRACKET); + *bufnext++ = M_END; + break; + case QUESTION: + pglob->gl_flags |= GLOB_MAGCHAR; + *bufnext++ = M_ONE; + break; + case STAR: + pglob->gl_flags |= GLOB_MAGCHAR; + /* collapse adjacent stars to one [or three if globstar], + * to avoid exponential behavior + */ + if (bufnext == patbuf || bufnext[-1] != M_ALL || - ((flags & GLOB_STAR) != 0 && ++ ((flags & GLOB_STAR) != 0 && + (bufnext - 1 == patbuf || bufnext[-2] != M_ALL || + bufnext - 2 == patbuf || bufnext[-3] != M_ALL))) + *bufnext++ = M_ALL; + break; + default: + *bufnext++ = LCHAR(c); + break; + } + } + *bufnext = EOS; +#ifdef DEBUG + qprintf("patbuf=", patbuf); +#endif + + if ((err = glob1(patbuf, pglob, no_match)) != 0) { + xfree(patbuf); + return (err); + } + + /* - * If there was no match we are going to append the pattern ++ * If there was no match we are going to append the pattern + * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified + * and the pattern did not contain any magic characters + * GLOB_NOMAGIC is there just for compatibility with csh. + */ - if (pglob->gl_pathc == oldpathc && - ((flags & GLOB_NOCHECK) || ++ if (pglob->gl_pathc == oldpathc && ++ ((flags & GLOB_NOCHECK) || + ((flags & GLOB_NOMAGIC) && !(pglob->gl_flags & GLOB_MAGCHAR)))) { + if (!(flags & GLOB_QUOTE)) + globextend(pattern, pglob); + else { + char *copy, *dest; + const char *src; + + /* copy pattern, interpreting quotes */ + copy = xmalloc(strlen(pattern) + 1); + dest = copy; + src = pattern; + while (*src != EOS) { + /* Don't interpret quotes. The spec does not say we should do */ + if (*src == QUOTE) { + if (*++src == EOS) + --src; + } + *dest++ = *src++; + } + *dest = EOS; + globextend(copy, pglob); + xfree(copy); + } + xfree(patbuf); + return 0; + } + else if (!(flags & GLOB_NOSORT) && (pglob->gl_pathc != oldpathc)) + qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc, + pglob->gl_pathc - oldpathc, sizeof(char *), compare); + xfree(patbuf); + return (0); +} + +static int +glob1(Char *pattern, glob_t *pglob, int no_match) +{ + struct strbuf pathbuf = strbuf_INIT; + int err; + + /* + * a null pathname is invalid -- POSIX 1003.1 sect. 2.4. + */ + if (*pattern == EOS) + return (0); + err = glob2(&pathbuf, pattern, pglob, no_match); + xfree(pathbuf.s); + return err; +} + +/* + * functions glob2 and glob3 are mutually recursive; there is one level + * of recursion for each segment in the pattern that contains one or + * more meta characters. + */ +static int +glob2(struct strbuf *pathbuf, const Char *pattern, glob_t *pglob, int no_match) +{ + struct stat sbuf; + int anymeta; + const Char *p; + size_t orig_len; + + /* + * loop over pattern segments until end of pattern or until segment with + * meta character found. + */ + anymeta = 0; + for (;;) { + if (*pattern == EOS) { /* end of pattern? */ + strbuf_terminate(pathbuf); + + if (Lstat(pathbuf->s, &sbuf)) + return (0); + + if (((pglob->gl_flags & GLOB_MARK) && + pathbuf->s[pathbuf->len - 1] != SEP) && + (S_ISDIR(sbuf.st_mode) +#ifdef S_IFLNK + || (S_ISLNK(sbuf.st_mode) && + (Stat(pathbuf->s, &sbuf) == 0) && + S_ISDIR(sbuf.st_mode)) +#endif + )) { + strbuf_append1(pathbuf, SEP); + strbuf_terminate(pathbuf); + } + ++pglob->gl_matchc; + globextend(pathbuf->s, pglob); + return 0; + } + + /* find end of next segment, tentatively copy to pathbuf */ + p = pattern; + orig_len = pathbuf->len; + while (*p != EOS && *p != SEP) { + if (ismeta(*p)) + anymeta = 1; + strbuf_append1(pathbuf, *p++); + } + + if (!anymeta) { /* no expansion, do next segment */ + pattern = p; + while (*pattern == SEP) + strbuf_append1(pathbuf, *pattern++); + } + else { /* need expansion, recurse */ + pathbuf->len = orig_len; + return (glob3(pathbuf, pattern, p, pattern, pglob, no_match)); + } + } + /* NOTREACHED */ +} + +static size_t +One_Char_mbtowc(__Char *pwc, const Char *s, size_t n) +{ +#ifdef WIDE_STRINGS + char buf[MB_LEN_MAX], *p; + + if (n > MB_LEN_MAX) + n = MB_LEN_MAX; + p = buf; + while (p < buf + n && (*p++ = LCHAR(*s++)) != 0) + ; + return one_mbtowc(pwc, buf, n); +#else + *pwc = *s & CHAR; + return 1; +#endif +} - ++ +static int +glob3(struct strbuf *pathbuf, const Char *pattern, const Char *restpattern, + const Char *pglobstar, glob_t *pglob, int no_match) +{ + DIR *dirp; + struct dirent *dp; + struct stat sbuf; + int err; + Char m_not = (pglob->gl_flags & GLOB_ALTNOT) ? M_ALTNOT : M_NOT; + size_t orig_len; + int globstar = 0; + int chase_symlinks = 0; + const Char *termstar = NULL; + + strbuf_terminate(pathbuf); + orig_len = pathbuf->len; + errno = err = 0; + + while (pglobstar < restpattern) { + __Char wc; + size_t width = One_Char_mbtowc(&wc, pglobstar, MB_LEN_MAX); + if ((pglobstar[0] & M_MASK) == M_ALL && + (pglobstar[width] & M_MASK) == M_ALL) { + globstar = 1; + chase_symlinks = (pglobstar[2 * width] & M_MASK) == M_ALL; + termstar = pglobstar + (2 + chase_symlinks) * width; + break; + } + pglobstar += width; - } ++ } + + if (globstar) { + err = pglobstar==pattern && termstar==restpattern ? + *restpattern == EOS ? + glob2(pathbuf, restpattern - 1, pglob, no_match) : + glob2(pathbuf, restpattern + 1, pglob, no_match) : + glob3(pathbuf, pattern, restpattern, termstar, pglob, no_match); + if (err) + return err; + pathbuf->len = orig_len; + strbuf_terminate(pathbuf); + } + + if (*pathbuf->s && (Lstat(pathbuf->s, &sbuf) || !S_ISDIR(sbuf.st_mode) +#ifdef S_IFLINK + && ((globstar && !chase_symlinks) || !S_ISLNK(sbuf.st_mode)) +#endif + )) + return 0; + + if (!(dirp = Opendir(pathbuf->s))) { + /* todo: don't call for ENOENT or ENOTDIR? */ + if ((pglob->gl_errfunc && (*pglob->gl_errfunc) (pathbuf->s, errno)) || + (pglob->gl_flags & GLOB_ERR)) + return (GLOB_ABEND); + else + return (0); + } + + /* search directory for matching names */ + while ((dp = readdir(dirp)) != NULL) { + /* initial DOT must be matched literally */ + if (dp->d_name[0] == DOT && *pattern != DOT) + if (!(pglob->gl_flags & GLOB_DOT) || !dp->d_name[1] || + (dp->d_name[1] == DOT && !dp->d_name[2])) + continue; /*unless globdot and not . or .. */ + pathbuf->len = orig_len; + strbuf_append(pathbuf, dp->d_name); + strbuf_terminate(pathbuf); + + if (globstar) { +#ifdef S_IFLNK + if (!chase_symlinks && + (Lstat(pathbuf->s, &sbuf) || S_ISLNK(sbuf.st_mode))) + continue; +#endif + if (match(pathbuf->s + orig_len, pattern, termstar, - (int)m_not) == no_match) ++ (int)m_not) == no_match) + continue; + strbuf_append1(pathbuf, SEP); + strbuf_terminate(pathbuf); + if ((err = glob2(pathbuf, pglobstar, pglob, no_match)) != 0) + break; + } else { + if (match(pathbuf->s + orig_len, pattern, restpattern, + (int) m_not) == no_match) + continue; + if ((err = glob2(pathbuf, restpattern, pglob, no_match)) != 0) + break; + } + } + /* todo: check error from readdir? */ + closedir(dirp); + return (err); +} + + +/* + * Extend the gl_pathv member of a glob_t structure to accomodate a new item, + * add the new item, and update gl_pathc. + * + * This assumes the BSD realloc, which only copies the block when its size + * crosses a power-of-two boundary; for v7 realloc, this would cause quadratic + * behavior. + * + * Return 0 if new item added, error code if memory couldn't be allocated. + * + * Invariant of the glob_t structure: + * Either gl_pathc is zero and gl_pathv is NULL; or gl_pathc > 0 and + * gl_pathv points to (gl_offs + gl_pathc + 1) items. + */ +static void +globextend(const char *path, glob_t *pglob) +{ + char **pathv; + int i; + size_t newsize; + + newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs); + pathv = xrealloc(pglob->gl_pathv, newsize); + + if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) { + /* first time around -- clear initial gl_offs items */ + pathv += pglob->gl_offs; + for (i = pglob->gl_offs; --i >= 0;) + *--pathv = NULL; + } + pglob->gl_pathv = pathv; + + pathv[pglob->gl_offs + pglob->gl_pathc++] = strsave(path); + pathv[pglob->gl_offs + pglob->gl_pathc] = NULL; +} + +/* + * pattern matching function for filenames. + */ +static int +match(const char *name, const Char *pat, const Char *patend, int m_not) +{ + int ok, negate_range; + const Char *patNext; + const char *nameNext, *nameStart, *nameEnd; + Char c; + + patNext = pat; + nameStart = nameNext = name; + nameEnd = NULL; + + while (pat < patend || *name) { + size_t lwk, pwk; + __Char wc, wk, wc1; + + c = *pat; /* Only for M_MASK bits */ + if (*name == EOS) + nameEnd = name; + + pwk = One_Char_mbtowc(&wc, pat, MB_LEN_MAX); + lwk = one_mbtowc(&wk, name, MB_LEN_MAX); + switch (c & M_MASK) { + case M_ALL: + while ((*(pat + pwk) & M_MASK) == M_ALL) { + pat += pwk; + pwk = One_Char_mbtowc(&wc, pat, MB_LEN_MAX); + } + patNext = pat; + nameNext = name + lwk; + pat += pwk; + continue; + case M_ONE: + if (*name == EOS) + break; + name += lwk; + pat += pwk; + continue; + case M_SET: + ok = 0; + if (*name == EOS) + break; + pat += pwk; + pwk = One_Char_mbtowc(&wc, pat, MB_LEN_MAX); + name += lwk; + if ((negate_range = ((*pat & M_MASK) == m_not)) != 0) { + pat += pwk; + pwk = One_Char_mbtowc(&wc, pat, MB_LEN_MAX); + } + wc1 = wc; + while ((*pat & M_MASK) != M_END) { + if ((*pat & M_MASK) == M_RNG) { + __Char wc2; + + pat += pwk; + pwk = One_Char_mbtowc(&wc2, pat, MB_LEN_MAX); + if (globcharcoll(wc1, wk, 0) <= 0 && + globcharcoll(wk, wc2, 0) <= 0) + ok = 1; + } else if (wc == wk) + ok = 1; + pat += pwk; + wc1 = wc; + pwk = One_Char_mbtowc(&wc, pat, MB_LEN_MAX); + } + pat += pwk; + pwk = One_Char_mbtowc(&wc, pat, MB_LEN_MAX); + if (ok == negate_range) + break; + continue; + default: + if (*name == EOS || samecase(wk) != samecase(wc)) + break; + name += lwk; + pat += pwk; + continue; + } + if (nameNext != nameStart + && (nameEnd == NULL || nameNext <= nameEnd)) { + pat = patNext; + name = nameNext; + continue; + } + return 0; + } + return 1; +} + +/* free allocated data belonging to a glob_t structure */ +void +globfree(glob_t *pglob) +{ + int i; + char **pp; + + if (pglob->gl_pathv != NULL) { + pp = pglob->gl_pathv + pglob->gl_offs; + for (i = pglob->gl_pathc; i--; ++pp) + if (*pp) + xfree(*pp), *pp = NULL; + xfree(pglob->gl_pathv), pglob->gl_pathv = NULL; + } +} From owner-dev-commits-src-all@freebsd.org Wed May 19 21:34:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2481F64C7C4; Wed, 19 May 2021 21:34: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 4FlmMq6WKPz4lyG; Wed, 19 May 2021 21:33: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 BF0551A1B7; Wed, 19 May 2021 21:33: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 14JLXxGW014927; Wed, 19 May 2021 21:33:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JLXxcs014926; Wed, 19 May 2021 21:33:59 GMT (envelope-from git) Date: Wed, 19 May 2021 21:33:59 GMT Message-Id: <202105192133.14JLXxcs014926@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 71a071be1c5a - main - bsd-family-tree: Add NetBSD 9.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 71a071be1c5ae971421a830d76ee30186ffdd199 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 21:34:00 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=71a071be1c5ae971421a830d76ee30186ffdd199 commit 71a071be1c5ae971421a830d76ee30186ffdd199 Author: Warner Losh AuthorDate: 2021-05-19 21:29:11 +0000 Commit: Warner Losh CommitDate: 2021-05-19 21:31:47 +0000 bsd-family-tree: Add NetBSD 9.2 NetBSD 9.2 was released on May 12, 2021 Submitted by: Martin Husemann Sponsored by: Netflix --- share/misc/bsd-family-tree | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/share/misc/bsd-family-tree b/share/misc/bsd-family-tree index e9eeae85f6bf..ac69e94502e0 100644 --- a/share/misc/bsd-family-tree +++ b/share/misc/bsd-family-tree @@ -420,11 +420,11 @@ FreeBSD 5.2 | | | | | | | | | | DragonFly 5.8.2 | | | | | | DragonFly 5.8.3 | | | | NetBSD 9.1 OpenBSD 6.8 | - | FreeBSD | | | | - | 12.2 | | | | - | | | | | - *--FreeBSD | | | | - | 13.0 | | OpenBSD 6.9 | + | FreeBSD | | | | | + | 12.2 | | | | | + | | | | | | + *--FreeBSD | | | | | + | 13.0 | | NetBSD 9.2 OpenBSD 6.9 | | | | | | FreeBSD 14 -current | NetBSD -current OpenBSD -current DragonFly -current | | | | | @@ -832,6 +832,7 @@ NetBSD 9.1 2020-10-18 [NBD] FreeBSD 12.2 2020-10-27 [FBD] FreeBSD 13.0 2021-04-13 [FBD] OpenBSD 6.9 2021-05-01 [OBD] +NetBSD 9.2 2021-05-12 [NBD] Bibliography ------------------------ From owner-dev-commits-src-all@freebsd.org Wed May 19 21:35:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4312564C936; Wed, 19 May 2021 21: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 4FlmPS1H00z4m9c; Wed, 19 May 2021 21: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 138EF1A131; Wed, 19 May 2021 21: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 14JLZN5i015133; Wed, 19 May 2021 21: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 14JLZNFr015132; Wed, 19 May 2021 21:35:23 GMT (envelope-from git) Date: Wed, 19 May 2021 21:35:23 GMT Message-Id: <202105192135.14JLZNFr015132@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: fe815b88b553 - main - 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/main X-Git-Reftype: branch X-Git-Commit: fe815b88b553667c40353c46b58f9779efa3570e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 21:35:24 -0000 The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=fe815b88b553667c40353c46b58f9779efa3570e commit fe815b88b553667c40353c46b58f9779efa3570e Author: Kirk McKusick AuthorDate: 2021-05-19 21:38:21 +0000 Commit: Kirk McKusick CommitDate: 2021-05-19 21:39:24 +0000 Fix fsck_ffs Pass 1b error exit "bad inode number 256 to nextinode". Pass 1b of fsck_ffs runs only when Pass 1 has found duplicate blocks. Pass 1 only knows that a block is duplicate when it finds the second instance of its use. The role of Pass 1b is to find the first use of all the duplicate blocks. It makes a pass over the cylinder groups looking for these blocks. When moving to the next cylinder group, Pass 1b failed to properly calculate the starting inode number for the cylinder group resulting in the above error message when it tried to read the first inode in the cylinder group. Reported by: Px Tested by: Px PR: 255979 MFC after: 3 days 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-all@freebsd.org Wed May 19 21:56:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C1A2164CF30; Wed, 19 May 2021 21:56: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 4FlmsR4xfQz3Bq2; Wed, 19 May 2021 21:56: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 8E3EA19E72; Wed, 19 May 2021 21:56: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 14JLuB57041838; Wed, 19 May 2021 21:56:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JLuBJT041837; Wed, 19 May 2021 21:56:11 GMT (envelope-from git) Date: Wed, 19 May 2021 21:56:11 GMT Message-Id: <202105192156.14JLuBJT041837@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: c28cb257ddfe - main - nfscl: Fix NFSv4.1/4.2 mount recovery from an expired lease 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/main X-Git-Reftype: branch X-Git-Commit: c28cb257ddfe3339756f6fd659fa4a2efa4de2cb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 21:56:11 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=c28cb257ddfe3339756f6fd659fa4a2efa4de2cb commit c28cb257ddfe3339756f6fd659fa4a2efa4de2cb Author: Rick Macklem AuthorDate: 2021-05-19 21:52:56 +0000 Commit: Rick Macklem CommitDate: 2021-05-19 21:52:56 +0000 nfscl: Fix NFSv4.1/4.2 mount recovery from an expired lease The most difficult NFSv4 client recovery case happens when the lease has expired on the server. For NFSv4.0, the client will receive a NFSERR_EXPIRED reply from the server to indicate this has happened. For NFSv4.1/4.2, most RPCs have a Sequence operation and, as such, the client will receive a NFSERR_BADSESSION reply when the lease has expired for these RPCs. The client will then call nfscl_recover() to handle the NFSERR_BADSESSION reply. However, for the expired lease case, the first reclaim Open will fail with NFSERR_NOGRACE. This patch recognizes this case and calls nfscl_expireclient() to handle the recovery from an expired lease. This patch only affects NFSv4.1/4.2 mounts when the lease expires on the server, due to a network partitioning that exceeds the lease duration or similar. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clstate.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 8b5f07b5aa2a..1ed3630ce6e7 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -1996,6 +1996,7 @@ nfscl_recover(struct nfsclclient *clp, bool *retokp, struct ucred *cred, u_int32_t delegtype = NFSV4OPEN_DELEGATEWRITE, mode; int i, igotlock = 0, error, trycnt, firstlock; struct nfscllayout *lyp, *nlyp; + bool recovered_one; /* * First, lock the client structure, so everyone else will @@ -2077,6 +2078,7 @@ nfscl_recover(struct nfsclclient *clp, bool *retokp, struct ucred *cred, * Now traverse the state lists, doing Open and Lock Reclaims. */ tcred = newnfs_getcred(); + recovered_one = false; owp = LIST_FIRST(&clp->nfsc_owner); while (owp != NULL) { nowp = LIST_NEXT(owp, nfsow_list); @@ -2110,6 +2112,7 @@ nfscl_recover(struct nfsclclient *clp, bool *retokp, struct ucred *cred, op->nfso_mode, op, NULL, 0, &ndp, 1, delegtype, tcred, p); if (!error) { + recovered_one = true; /* Handle any replied delegation */ if (ndp != NULL && ((ndp->nfsdl_flags & NFSCLDL_WRITE) || NFSMNT_RDONLY(nmp->nm_mountp))) { @@ -2168,6 +2171,21 @@ nfscl_recover(struct nfsclclient *clp, bool *retokp, struct ucred *cred, nfscl_freelockowner(lp, 0); lp = nlp; } + } else if (error == NFSERR_NOGRACE && !recovered_one && + NFSHASNFSV4N(nmp)) { + /* + * For NFSv4.1/4.2, the NFSERR_EXPIRED case will + * actually end up here, since the client will do + * a recovery for NFSERR_BADSESSION, but will get + * an NFSERR_NOGRACE reply for the first "reclaim" + * attempt. + * So, call nfscl_expireclient() to recover the + * opens as best we can and then do a reclaim + * complete and return. + */ + nfsrpc_reclaimcomplete(nmp, cred, p); + nfscl_expireclient(clp, nmp, tcred, p); + goto out; } } if (error != 0 && error != NFSERR_BADSESSION) @@ -2254,6 +2272,23 @@ nfscl_recover(struct nfsclclient *clp, bool *retokp, struct ucred *cred, if (error) { if (nop != NULL) free(nop, M_NFSCLOPEN); + if (error == NFSERR_NOGRACE && !recovered_one && + NFSHASNFSV4N(nmp)) { + /* + * For NFSv4.1/4.2, the NFSERR_EXPIRED case will + * actually end up here, since the client will do + * a recovery for NFSERR_BADSESSION, but will get + * an NFSERR_NOGRACE reply for the first "reclaim" + * attempt. + * So, call nfscl_expireclient() to recover the + * opens as best we can and then do a reclaim + * complete and return. + */ + nfsrpc_reclaimcomplete(nmp, cred, p); + nfscl_expireclient(clp, nmp, tcred, p); + free(nowp, M_NFSCLOWNER); + goto out; + } /* * Couldn't reclaim it, so throw the state * away. Ouch!! @@ -2261,6 +2296,7 @@ nfscl_recover(struct nfsclclient *clp, bool *retokp, struct ucred *cred, nfscl_cleandeleg(dp); nfscl_freedeleg(&clp->nfsc_deleg, dp, true); } else { + recovered_one = true; LIST_INSERT_HEAD(&extra_open, nop, nfso_list); } } From owner-dev-commits-src-all@freebsd.org Wed May 19 22:25:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AC0B164D2EC; Wed, 19 May 2021 22:25: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 4FlnW94MBWz3jpn; Wed, 19 May 2021 22:25: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 74A1C1ABC9; Wed, 19 May 2021 22:25: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 14JMPPGM081855; Wed, 19 May 2021 22:25:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JMPPgA081854; Wed, 19 May 2021 22:25:25 GMT (envelope-from git) Date: Wed, 19 May 2021 22:25:25 GMT Message-Id: <202105192225.14JMPPgA081854@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 96480d9b338b - main - cam_sim: add doxygen to cam_sim_alloc_dev MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 96480d9b338bd501d1a92bd961a0776ff0c39f71 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 22:25:25 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=96480d9b338bd501d1a92bd961a0776ff0c39f71 commit 96480d9b338bd501d1a92bd961a0776ff0c39f71 Author: Warner Losh AuthorDate: 2021-05-16 15:37:26 +0000 Commit: Warner Losh CommitDate: 2021-05-19 21:59:09 +0000 cam_sim: add doxygen to cam_sim_alloc_dev cam_sim_alloc_dev was overlooked when cam_sim_alloc was documented. Add doxygen docs for it, pointing at cam_sim_alloc. Sponsored by: Netflix --- sys/cam/cam_sim.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sys/cam/cam_sim.c b/sys/cam/cam_sim.c index 5b6d43b81d5d..64427795426e 100644 --- a/sys/cam/cam_sim.c +++ b/sys/cam/cam_sim.c @@ -130,11 +130,19 @@ cam_sim_alloc(sim_action_func sim_action, sim_poll_func sim_poll, return (sim); } +/** + * @brief allocate a new sim and fill in the details with a device_t + * + * Just like @c cam_sim_alloc, but with an additional paramter. + * + * @param dev A newbus device that's associated with the + * sim. Must be non-NULL. + */ struct cam_sim * cam_sim_alloc_dev(sim_action_func sim_action, sim_poll_func sim_poll, - const char *sim_name, void *softc, device_t dev, - struct mtx *mtx, int max_dev_transactions, - int max_tagged_dev_transactions, struct cam_devq *queue) + const char *sim_name, void *softc, device_t dev, struct mtx *mtx, + int max_dev_transactions, int max_tagged_dev_transactions, + struct cam_devq *queue) { struct cam_sim *sim; From owner-dev-commits-src-all@freebsd.org Wed May 19 22:30:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 123F164D80E; Wed, 19 May 2021 22:30: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 4FlndQ6zdJz3lRm; Wed, 19 May 2021 22:30: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 D7B981ABD4; Wed, 19 May 2021 22:30: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 14JMUoI8090581; Wed, 19 May 2021 22:30:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JMUokt090580; Wed, 19 May 2021 22:30:50 GMT (envelope-from git) Date: Wed, 19 May 2021 22:30:50 GMT Message-Id: <202105192230.14JMUokt090580@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 77b637338a36 - main - alc(4): add support for Mikrotik 10/25G NIC 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/main X-Git-Reftype: branch X-Git-Commit: 77b637338a3656d4ccedb9798a3f98ac283962f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 22:30:51 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=77b637338a3656d4ccedb9798a3f98ac283962f4 commit 77b637338a3656d4ccedb9798a3f98ac283962f4 Author: Konstantin Belousov AuthorDate: 2021-05-19 22:14:18 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-19 22:30:25 +0000 alc(4): add support for Mikrotik 10/25G NIC The new Mikrotik 10/25G NIC is mostly compatible with AR8151 hardware, with few exceptions: * card supports only 32bit DMA operations * card does not support write-one-to-clear semantics for interrupt status register * MDIO operations can take longer to complete This patch adds support for Mikrotik 10/25G NIC to the alc driver while maintaining support for all earlier HW. The patch was tested with FreeBSD main branch as of commit f4b38c360e63a6e66245efedbd6c070f9c0aee55 This was tested on Intel i7-4790K system with Mikrotik 10/25G NIC. This was tested on Intel i7-4790K system with RB44Ge (AR8151 based 4-port NIC) to verify backwards compatibility. PR: 256000 Submitted by: Gatis Peisenieks MFC after: 1 week --- sys/dev/alc/if_alc.c | 16 ++++++++++++++-- sys/dev/alc/if_alcreg.h | 8 ++++++++ sys/dev/alc/if_alcvar.h | 3 ++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/sys/dev/alc/if_alc.c b/sys/dev/alc/if_alc.c index 255fea53acfa..eb906d60bcbe 100644 --- a/sys/dev/alc/if_alc.c +++ b/sys/dev/alc/if_alc.c @@ -1438,6 +1438,8 @@ alc_attach(device_t dev) case DEVICEID_ATHEROS_AR8151: case DEVICEID_ATHEROS_AR8151_V2: sc->alc_flags |= ALC_FLAG_APS; + if (CSR_READ_4(sc, ALC_MT_MAGIC) == MT_MAGIC) + sc->alc_flags |= ALC_FLAG_MT; /* FALLTHROUGH */ default: break; @@ -1977,6 +1979,8 @@ alc_dma_alloc(struct alc_softc *sc) int error, i; lowaddr = BUS_SPACE_MAXADDR; + if (sc->alc_flags & ALC_FLAG_MT) + lowaddr = BUS_SPACE_MAXSIZE_32BIT; again: /* Create parent DMA tag. */ error = bus_dma_tag_create( @@ -2219,7 +2223,7 @@ again: error = bus_dma_tag_create( bus_get_dma_tag(sc->alc_dev), /* parent */ 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ + lowaddr, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ @@ -3339,6 +3343,11 @@ alc_intr(void *arg) sc = (struct alc_softc *)arg; + if (sc->alc_flags & ALC_FLAG_MT) { + taskqueue_enqueue(sc->alc_tq, &sc->alc_int_task); + return (FILTER_HANDLED); + } + status = CSR_READ_4(sc, ALC_INTR_STATUS); if ((status & ALC_INTRS) == 0) return (FILTER_STRAY); @@ -3416,7 +3425,10 @@ alc_int_task(void *arg, int pending) done: if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { /* Re-enable interrupts if we're running. */ - CSR_WRITE_4(sc, ALC_INTR_STATUS, 0x7FFFFFFF); + if (sc->alc_flags & ALC_FLAG_MT) + CSR_WRITE_4(sc, ALC_INTR_STATUS, 0); + else + CSR_WRITE_4(sc, ALC_INTR_STATUS, 0x7FFFFFFF); } ALC_UNLOCK(sc); } diff --git a/sys/dev/alc/if_alcreg.h b/sys/dev/alc/if_alcreg.h index 3b4ee133b01a..7668f0960d9f 100644 --- a/sys/dev/alc/if_alcreg.h +++ b/sys/dev/alc/if_alcreg.h @@ -1121,6 +1121,14 @@ #define MII_EXT_ANEG_NLP78 0x8027 #define ANEG_NLP78_120M_DEFAULT 0x8A05 +#define ALC_MT_MAGIC 0x1F00 +#define ALC_MT_MODE 0x1F04 +#define ALC_MT_SPEED 0x1F08 +#define ALC_MT_VERSION 0x1F0C + +#define MT_MAGIC 0xaabb1234 +#define MT_MODE_4Q BIT(0) + /* Statistics counters collected by the MAC. */ struct smb { /* Rx stats. */ diff --git a/sys/dev/alc/if_alcvar.h b/sys/dev/alc/if_alcvar.h index 8dea20196dae..926c80021858 100644 --- a/sys/dev/alc/if_alcvar.h +++ b/sys/dev/alc/if_alcvar.h @@ -239,6 +239,7 @@ struct alc_softc { #define ALC_FLAG_LINK_WAR 0x4000 #define ALC_FLAG_E2X00 0x8000 #define ALC_FLAG_LINK 0x10000 +#define ALC_FLAG_MT 0x20000 struct callout alc_tick_ch; struct alc_hw_stats alc_stats; @@ -284,6 +285,6 @@ do { \ #define ALC_TX_TIMEOUT 5 #define ALC_RESET_TIMEOUT 100 #define ALC_TIMEOUT 1000 -#define ALC_PHY_TIMEOUT 1000 +#define ALC_PHY_TIMEOUT 10000 #endif /* _IF_ALCVAR_H */ From owner-dev-commits-src-all@freebsd.org Wed May 19 22:57:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3119664DD56; Wed, 19 May 2021 22:57: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 4FlpDH0vRpz4S1n; Wed, 19 May 2021 22:57: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 07A321B40A; Wed, 19 May 2021 22:57: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 14JMvYlS021592; Wed, 19 May 2021 22:57:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JMvYaF021591; Wed, 19 May 2021 22:57:34 GMT (envelope-from git) Date: Wed, 19 May 2021 22:57:34 GMT Message-Id: <202105192257.14JMvYaF021591@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: a9f0cf4838cb - main - cxgbe: Fix some merge-o's for the per-rxq iSCSI counters. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a9f0cf4838cb1991707fa32e1cf363ea18076249 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 22:57:35 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a9f0cf4838cb1991707fa32e1cf363ea18076249 commit a9f0cf4838cb1991707fa32e1cf363ea18076249 Author: John Baldwin AuthorDate: 2021-05-19 22:56:31 +0000 Commit: John Baldwin CommitDate: 2021-05-19 22:56:31 +0000 cxgbe: Fix some merge-o's for the per-rxq iSCSI counters. I botched a few of the changes when rebasing the changes in 4b6ed0758dc6fad17081d7bd791cb0edbddbddb8 across the changes in 43bbae19483fbde0a91e61acad8a6e71e334c8b8. - Move the counter allocations into alloc_ofld_rxq(). - Free the counters freeing an ofld rxq. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D30267 --- sys/dev/cxgbe/t4_sge.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index ac79d8002784..8a5dc6acc745 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -4070,6 +4070,9 @@ alloc_ofld_rxq(struct vi_info *vi, struct sge_ofld_rxq *ofld_rxq, int idx, return (rc); } MPASS(ofld_rxq->iq.flags & IQ_SW_ALLOCATED); + ofld_rxq->rx_iscsi_ddp_setup_ok = counter_u64_alloc(M_WAITOK); + ofld_rxq->rx_iscsi_ddp_setup_error = + counter_u64_alloc(M_WAITOK); add_ofld_rxq_sysctls(&vi->ctx, oid, ofld_rxq); } @@ -4102,6 +4105,8 @@ free_ofld_rxq(struct vi_info *vi, struct sge_ofld_rxq *ofld_rxq) MPASS(!(ofld_rxq->iq.flags & IQ_HW_ALLOCATED)); free_iq_fl(vi->adapter, &ofld_rxq->iq, &ofld_rxq->fl); MPASS(!(ofld_rxq->iq.flags & IQ_SW_ALLOCATED)); + counter_u64_free(ofld_rxq->rx_iscsi_ddp_setup_ok); + counter_u64_free(ofld_rxq->rx_iscsi_ddp_setup_error); bzero(ofld_rxq, sizeof(*ofld_rxq)); } } @@ -4127,8 +4132,6 @@ add_ofld_rxq_sysctls(struct sysctl_ctx_list *ctx, struct sysctl_oid *oid, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "TOE iSCSI statistics"); children = SYSCTL_CHILDREN(oid); - ofld_rxq->rx_iscsi_ddp_setup_ok = counter_u64_alloc(M_WAITOK); - ofld_rxq->rx_iscsi_ddp_setup_error = counter_u64_alloc(M_WAITOK); SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "ddp_setup_ok", CTLFLAG_RD, &ofld_rxq->rx_iscsi_ddp_setup_ok, "# of times DDP buffer was setup successfully."); From owner-dev-commits-src-all@freebsd.org Wed May 19 22:57:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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 897D964DFBD; Wed, 19 May 2021 22:57: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 4FlpDJ2RPZz4S4F; Wed, 19 May 2021 22:57: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 383CF1B40B; Wed, 19 May 2021 22:57: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 14JMvaNl021617; Wed, 19 May 2021 22:57:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JMvalt021616; Wed, 19 May 2021 22:57:36 GMT (envelope-from git) Date: Wed, 19 May 2021 22:57:36 GMT Message-Id: <202105192257.14JMvalt021616@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 671fd0ec8dbe - main - cxgbei: Remove unused sysctls. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 671fd0ec8dbe5fb9c02e4d9cb7080e427dc1048b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 22:57:36 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=671fd0ec8dbe5fb9c02e4d9cb7080e427dc1048b commit 671fd0ec8dbe5fb9c02e4d9cb7080e427dc1048b Author: John Baldwin AuthorDate: 2021-05-19 22:56:45 +0000 Commit: John Baldwin CommitDate: 2021-05-19 22:56:45 +0000 cxgbei: Remove unused sysctls. These were seemingly copied over from icl_soft. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D30268 --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index c4eb4a35ad31..d54464b63542 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -104,13 +104,6 @@ static MALLOC_DEFINE(M_CXGBEI, "cxgbei", "cxgbei(4)"); SYSCTL_NODE(_kern_icl, OID_AUTO, cxgbei, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "Chelsio iSCSI offload"); -static int coalesce = 1; -SYSCTL_INT(_kern_icl_cxgbei, OID_AUTO, coalesce, CTLFLAG_RWTUN, - &coalesce, 0, "Try to coalesce PDUs before sending"); -static int partial_receive_len = 128 * 1024; -SYSCTL_INT(_kern_icl_cxgbei, OID_AUTO, partial_receive_len, CTLFLAG_RWTUN, - &partial_receive_len, 0, "Minimum read size for partially received " - "data segment"); static int sendspace = 1048576; SYSCTL_INT(_kern_icl_cxgbei, OID_AUTO, sendspace, CTLFLAG_RWTUN, &sendspace, 0, "Default send socket buffer size"); From owner-dev-commits-src-all@freebsd.org Wed May 19 22:57:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9B83C64E0B3; Wed, 19 May 2021 22:57: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 4FlpDL662Mz4Rmr; Wed, 19 May 2021 22:57: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 76F631B210; Wed, 19 May 2021 22:57: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 14JMvbhB021641; Wed, 19 May 2021 22:57:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14JMvbfE021640; Wed, 19 May 2021 22:57:37 GMT (envelope-from git) Date: Wed, 19 May 2021 22:57:37 GMT Message-Id: <202105192257.14JMvbfE021640@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 3bede2908acc - main - cxgbei: Add tunable sysctls for the FirstBurstLength and MaxBurstLength. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3bede2908acc6cbc8e809d63d7c9b5fd95932dfb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 22:57:39 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3bede2908acc6cbc8e809d63d7c9b5fd95932dfb commit 3bede2908acc6cbc8e809d63d7c9b5fd95932dfb Author: John Baldwin AuthorDate: 2021-05-19 22:56:54 +0000 Commit: John Baldwin CommitDate: 2021-05-19 22:56:54 +0000 cxgbei: Add tunable sysctls for the FirstBurstLength and MaxBurstLength. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D30269 --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index d54464b63542..fce593b54032 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -104,6 +104,12 @@ static MALLOC_DEFINE(M_CXGBEI, "cxgbei", "cxgbei(4)"); SYSCTL_NODE(_kern_icl, OID_AUTO, cxgbei, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "Chelsio iSCSI offload"); +static int first_burst_length = 8192; +SYSCTL_INT(_kern_icl_cxgbei, OID_AUTO, first_burst_length, CTLFLAG_RWTUN, + &first_burst_length, 0, "First burst length"); +static int max_burst_length = 2 * 1024 * 1024; +SYSCTL_INT(_kern_icl_cxgbei, OID_AUTO, max_burst_length, CTLFLAG_RWTUN, + &max_burst_length, 0, "Maximum burst length"); static int sendspace = 1048576; SYSCTL_INT(_kern_icl_cxgbei, OID_AUTO, sendspace, CTLFLAG_RWTUN, &sendspace, 0, "Default send socket buffer size"); @@ -1206,8 +1212,8 @@ icl_cxgbei_limits(struct icl_drv_limits *idl) idl->idl_max_send_data_segment_length = (1 << 24) - 1; /* These are somewhat arbitrary. */ - idl->idl_max_burst_length = 2 * 1024 * 1024; - idl->idl_first_burst_length = 8192; + idl->idl_max_burst_length = max_burst_length; + idl->idl_first_burst_length = first_burst_length; t4_iterate(cxgbei_limits, idl); From owner-dev-commits-src-all@freebsd.org Thu May 20 00:33:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Thu May 20 00:33:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Thu May 20 01:39:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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 92679630A4B for ; Thu, 20 May 2021 01:39:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FlsqL3Xlfz4fkb for ; Thu, 20 May 2021 01:39:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x829.google.com with SMTP id i19so5178805qtw.9 for ; Wed, 19 May 2021 18:39:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LRdrpbLhHwedpUus4wzNNszy5c4QqGGBw1NsfRXXkkg=; b=R5MzbBSA7vyxVC5PvmqSuveEDNJsh/UFHkK6bqnGd9ochXSjB/rsskVKBjVYmt0E0h XL8GNbIsqf7nbfA1CuHGYpFftgWU+wakXrW9laVAMbCg8Mnohr7/DAqD8QMmLerC7hcz Z9aORPwpesA4sdsOZaNHgGpRT2Jh/JLYZsJA83Wgpa+iRaiRsB3hivI0sLbToayMU8c3 NYiPha3jdTAJCBTW6w/zG8VPgVSJII4jnGWg6sj/daeVo9hoZXAfaOdk1bYMLnfeGUgp /5epDf3/dYdTUIgRfPNK0KCRi5aO4kmG95W1gIvkFDDxPOxig6j1XeNNvJKAVC2yRt7s 9ndQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LRdrpbLhHwedpUus4wzNNszy5c4QqGGBw1NsfRXXkkg=; b=LBfRYl+T9bS1cNRJFtguEt2yXBldeSU8bXUtmLmVH1P63F48mRBI8mXlMWRsBFyUK9 6ay8Pcjt0mwVhqaMs9f6mdu6yiPSa9cI4mM6AA+8xzARKwEGIFxNG+H9o8EFL9z28ajD wNxqPqwTCuIU9aq/oF3Ya0a0tIOdBOTvHDthKePnj4Fd2PV4j1gebt19kRKMdMFeZbqR hCFTA2rkqXCt8hny1R4fGrEnYCenv/azD4kxGcVyRHEiBpIac2/dhf0IK0y73lI4M/Sl GY4ef/GHjE6HNdtW/xt1x61h/KHgIdV8iaErqVtfHHithYW2cwpLqDAkfblh6zeUkawv X9bQ== X-Gm-Message-State: AOAM533uyMbcn+Ng8C0zbS6w5TnvjXHP+tO9XpnICwbHZLIPxAvQ94Yj ARgQSFugLCRzMwPTBJjTV8dHoelkJcRAXUM9yH4u4Q== X-Google-Smtp-Source: ABdhPJy7o2dF7ltEHI+4H9ZlwRjuAcMwQ4M3+sXRn6QmfGSGUlxnf8OYNchjnzmtfWop6Tsj/B8lPQkPfPEB3CdyrBY= X-Received: by 2002:a05:622a:588:: with SMTP id c8mr2618268qtb.49.1621474781496; Wed, 19 May 2021 18:39:41 -0700 (PDT) MIME-Version: 1.0 References: <202105191744.14JHi6fA008046@gitrepo.freebsd.org> <9BE6FB36-5958-4220-9C95-86DED767F6ED@freebsd.org> In-Reply-To: <9BE6FB36-5958-4220-9C95-86DED767F6ED@freebsd.org> From: Warner Losh Date: Wed, 19 May 2021 19:39:30 -0600 Message-ID: Subject: Re: git: 086feed850c3 - main - md5: Create md5sum, etc compatible programs To: Jessica Clarke Cc: Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4FlsqL3Xlfz4fkb X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 01:39:42 -0000 On Wed, May 19, 2021, 12:32 PM Jessica Clarke wrote: > On 19 May 2021, at 18:44, Warner Losh wrote: > > > > The branch main has been updated by imp: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3D086feed850c31c278f25c958b97992d= 024139896 > > > > commit 086feed850c31c278f25c958b97992d024139896 > > Author: Warner Losh > > AuthorDate: 2021-05-19 17:26:20 +0000 > > Commit: Warner Losh > > CommitDate: 2021-05-19 17:41:53 +0000 > > > > md5: Create md5sum, etc compatible programs > > > > On Linux, there's a similar set of programs to ours, but that end in > the > > letters 'sum'. These act basically like FreeBSD versions run with th= e > -r > > option. Add code so that when the program ends in 'sum' you get the > > linux -r behavior. This is enough to make most things that use sha*s= um > > work correctly (the -c / --check options, as well as the long args a= re > > not implemented). When running with the -sum programs, ignore -t > instead > > of running internal speed tests and make -c an error. > > > > Reviewed by: sef, and kp and allanjude (earlier version) > > Relnotes: yes > > Sponsored by: Netflix > > Differential Revision: https://reviews.freebsd.org/D30309 > > --- > > diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c > > index 96dfcede9711..4381ef124c7b 100644 > > --- a/sbin/md5/md5.c > > +++ b/sbin/md5/md5.c > > @@ -177,13 +177,32 @@ main(int argc, char *argv[]) > > char buf[HEX_DIGEST_LENGTH]; > > size_t len; > > unsigned digest; > > - const char* progname; > > + char *progname; > > + bool gnu_emu =3D false; > > This file doesn=E2=80=99t currently include stdbool.h explicitly, and app= arently > that > is not implicitly included by any of the headers on Linux (and I cannot > work > out where it comes from on FreeBSD). Could you please add the explicit > include > to fix cross-building? > Sure Thanks, > Jess > > From owner-dev-commits-src-all@freebsd.org Thu May 20 02:33:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 08B9C6319BF; Thu, 20 May 2021 02:33:38 +0000 (UTC) (envelope-from zlei.huang@gmail.com) Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Flv1Y6GDqz3KK8; Thu, 20 May 2021 02:33:37 +0000 (UTC) (envelope-from zlei.huang@gmail.com) Received: by mail-pg1-x52e.google.com with SMTP id k15so10787255pgb.10; Wed, 19 May 2021 19:33:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Maq6XDlK7RAjJcWDlFIMOPGZmpiFePUlNQvqCC4YrjY=; b=AcfKfxGr/C8jFoprti1j4XaZQwcrbKHwmsSzCvI7cT5VVXZBXkd3romjPHhO47uwdb Y5mmsk63/pKFtPX2/riIrFkplLE19S1BsMSTzAn1xQma8mlCYfIJLX1vfyXtljIeUZlY bNYNrP/QG/zMIjMtU6fXgu1GZb5gcFGB3TdsuHPU5et2q2CAnwehG3JzYVorb1i6/u31 CMTB/p55q05yY55Yg7bI8pItTlLGdhr9BtIljCXRZLbBK5EF/SqbhScp95U1nBL/U1LE LsVL/IQWbwTFJuEPDPMDxlj0/wkzG2PdepJ/RkJZQUIcDX6YB4p3jQvUs5CcNpE3pQKR L+WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Maq6XDlK7RAjJcWDlFIMOPGZmpiFePUlNQvqCC4YrjY=; b=Rs+h8kQLEuP1xJdLzmFA/TswjoEXdQPM5nTD1XSBiy1O6Pyy6Oto1V60HjSTePWkbI gTmi3BfaWTbmO39C1h1L7vlOpm+uwP/p+n98tW4FvaIowVaCi8J7fyWVhs0DvQDE4rrw KxHeHsIyWTgBChyNJQzgoQT9XgKFZJmVw9vwun6apV0UlF0mJ2stQmRQNeaVvUXXI1BP /UV5kcQkSD/qFld+5DNHJyUADPPErYVsjMlWFQFSAYlIge/65gLjwJKMJzEasz+I1yEX jGJh0tjAcch8xPELq075Qr3xe0nIXZDHQfc0fPwh/FcQcCbGB6jBaIFOZIEoc5AoNZIN P08w== X-Gm-Message-State: AOAM533fTabNth7i16MjtICXLlodq5vX6LXtN2rXni3POIIVHlhqD0bF InndxsMPRrtHtqvJ9KGJ5eHMM7YFkr0Wu4Ak X-Google-Smtp-Source: ABdhPJwo1J1U80G3tMD0BUljzolbH2OSg1usU5dGdq/eOo/qWr3o/CKbmKtWW4rSSUBrSrlcVzzctA== X-Received: by 2002:a63:2686:: with SMTP id m128mr2188695pgm.406.1621478016422; Wed, 19 May 2021 19:33:36 -0700 (PDT) Received: from [192.168.10.252] ([112.66.183.133]) by smtp.gmail.com with ESMTPSA id u19sm543015pfn.158.2021.05.19.19.33.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 May 2021 19:33:35 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: 3d846e48227e - main - Do not forward datagrams originated by link-local addresses From: Zhenlei Huang In-Reply-To: <10b475c5-0100-2567-4e92-73b168b97e3f@marcuscom.com> Date: Thu, 20 May 2021 10:33:28 +0800 Cc: Lutz Donnerhacke , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: <1DD8ABB9-94B1-4B44-8003-25432A91D520@gmail.com> References: <202105182101.14IL1Gki054229@gitrepo.freebsd.org> <20210519055407.GA9715@belenus.iks-jena.de> <10b475c5-0100-2567-4e92-73b168b97e3f@marcuscom.com> To: Joe Clarke , rgrimes@freebsd.org X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4Flv1Y6GDqz3KK8 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 02:33:38 -0000 Hi joe, > On May 19, 2021, at 9:42 PM, Joe Clarke wrote: > > On 5/19/21 01:54, Lutz Donnerhacke wrote: >> On Tue, May 18, 2021 at 07:51:38PM -0400, Joe Clarke wrote: >>> Just out of curiosity, why remove the RFC reference from the comment? >> >> May you please include the author of the change for such questions? >> >>>> commit 3d846e48227e2e78c1e7b35145f57353ffda56ba >>>> Author: Zhenlei Huang >>>> AuthorDate: 2021-05-18 20:51:37 +0000 >>>> Commit: Lutz Donnerhacke >>>> CommitDate: 2021-05-18 20:59:46 +0000 >>>> >>>> The current implement of ip_input() reject packets destined for >>>> 169.254.0.0/16, but not those original from 169.254.0.0/16 link-local >>>> addresses. >>>> >>>> Fix to fully respect RFC 3927 section 2.7. >>>> >>>> PR: 255388 >>>> Reviewed by: donner, rgrimes, karels >>>> MFC after: 1 month >>>> Differential Revision: https://reviews.freebsd.org/D29968 >> >> I did only commit this differential, but set a month for MFC, exactly to >> have to opportunity to fix such mistakes. >> > > IMHO, I'd like to see the RFC reference remain. I see rgrimes response > that the RFC's can change with errata and bis docs, but the anchor still > provides additional context that one can use to learn more about why > this code exists, and they can chase any future forward references. RFC's indeed change, and I think it is common in network stack. Then we need guidelines to better regulate these. CC rgrimes . > > It was there in the initial code, and the commit message saw fit to > reference it again. Removing it just seems like lost context. To track down the changes of the code, I'd personally prefer git-blame. There's still RFC reference in the git commit message, though it is not fully consistent with the comments in the diff. > > Joe > > -- > PGP Key : http://www.marcuscom.com/pgp.asc From owner-dev-commits-src-all@freebsd.org Thu May 20 02:39:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 670D6631BBC; Thu, 20 May 2021 02:39:53 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Flv8m2S5dz3Ly0; Thu, 20 May 2021 02:39:52 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: by mail-ot1-x333.google.com with SMTP id 36-20020a9d0ba70000b02902e0a0a8fe36so13569714oth.8; Wed, 19 May 2021 19:39:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=81DEhEfWiVgW6/vax+rjmfI/ueXRe16uKlIVc/utYZs=; b=JVlXLaZpTFF/r6vkoFiXSmNQ7ymINVY1ayxjmfwoV0rWoHaEddn0wjIau6MU5Ez3xV Rw2QbgBQOYoddVbLAM4kt04zRvygYBLav0+1NEunWrpgYUWYqy6+fJaUfwLNIFlmJ+Wi bSat9Lb53k7wtcPAguV0JxH/QoVTQIGcAiK33AYiwgNWTjyrsIFsbnyJ6EmyFGY98BHP /mExdLWAwzrgT4X8l1lf3kU4Evx4DkE8lR2ZaCvTi4+oeYXYc5fepebMSiibpvqmDkj6 MHF0d64cKY51PDW6ZG8FnmKhisBErFaXan9nYX5bmSAWGwgoejimeoKkFWNazQuiUAzk 9VFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=81DEhEfWiVgW6/vax+rjmfI/ueXRe16uKlIVc/utYZs=; b=aDvIkffVYh0nCnsHqimC2Wxosbbv2Az098IarLtrHFo2xUpU5tzPmukSYuwDzDGis4 VDb+hq+5yPdqEXp/xUreYTPydZie4RZQy4i36nTLaw6Pj/YwKs6HPhyda8dXD765GRHw p+sp3DuHs+vjGWD2HmHcWCG1IN7C9ukKdhBmYL21SypPx7H3/jv6kmdDKUUQO62MBGdR Mjugb6/K66+2Kgk41LH5nkRbgHFxZihd5bGsHQRDN9CBlFuAFtz7L2nRxAGSDvTtvZM0 b5ijDULEtr9YvgQ57aqh6hqIbAPk8NzL3n3L8QqkPBgtdMFMuyxHQfL8ScN+vKFQv7iz dfig== X-Gm-Message-State: AOAM530//iFT1BUSzx7RmjqzRfukq/aUVjMolZsixGioHXbKHYEF9SVp y1Q9LH07m4lew5i4QnSvJs1FE4FJOhg9BZw/ZR0= X-Google-Smtp-Source: ABdhPJyMCBfT8F9f5UQt33OKmh6ZHAqdWZx+cEJVxkJ4mwvEeDbFllr9RCoABEt5DxZ7AJxi8ZBNWhfNZNt1DRWhxx4= X-Received: by 2002:a9d:2271:: with SMTP id o104mr2106195ota.201.1621478391335; Wed, 19 May 2021 19:39:51 -0700 (PDT) MIME-Version: 1.0 References: <202105182101.14IL1Gki054229@gitrepo.freebsd.org> <20210519055407.GA9715@belenus.iks-jena.de> <10b475c5-0100-2567-4e92-73b168b97e3f@marcuscom.com> <1DD8ABB9-94B1-4B44-8003-25432A91D520@gmail.com> In-Reply-To: <1DD8ABB9-94B1-4B44-8003-25432A91D520@gmail.com> From: Benjamin Kaduk Date: Wed, 19 May 2021 19:39:40 -0700 Message-ID: Subject: Re: git: 3d846e48227e - main - Do not forward datagrams originated by link-local addresses To: Zhenlei Huang Cc: Joe Clarke , "Rodney W. Grimes" , Lutz Donnerhacke , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4Flv8m2S5dz3Ly0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=JVlXLaZp; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of bjkfbsd@gmail.com designates 2607:f8b0:4864:20::333 as permitted sender) smtp.mailfrom=bjkfbsd@gmail.com X-Spamd-Result: default: False [-2.50 / 15.00]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCPT_COUNT_SEVEN(0.00)[7]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::333:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::333:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::333:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 02:39:53 -0000 On Wed, May 19, 2021 at 7:33 PM Zhenlei Huang wrote: > > IMHO, I'd like to see the RFC reference remain. I see rgrimes response > > that the RFC's can change with errata and bis docs, but the anchor still > > provides additional context that one can use to learn more about why > > this code exists, and they can chase any future forward references. > RFC's indeed change, and I think it is common in network stack. Then we > need guidelines to better regulate these. CC rgrimes . > Sorry, RFCs themselves do not change -- one of the distinctive features of RFCs is precisely that they are immutable once published. The sentiment that what the current RFC for a given topic is, can change, is something that I can agree with, but that's not quite what was being discussed. -Ben From owner-dev-commits-src-all@freebsd.org Thu May 20 04:52:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D02806349C2; Thu, 20 May 2021 04:52:09 +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 4Fly5P5YWyz52mw; Thu, 20 May 2021 04:52:09 +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 A7B611FF76; Thu, 20 May 2021 04:52:09 +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 14K4q9Cm099256; Thu, 20 May 2021 04:52:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14K4q9gf099255; Thu, 20 May 2021 04:52:09 GMT (envelope-from git) Date: Thu, 20 May 2021 04:52:09 GMT Message-Id: <202105200452.14K4q9gf099255@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eugene Grosbein Subject: git: 20eb96979392 - main - rc.d: connect sysctl_lastload 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/main X-Git-Reftype: branch X-Git-Commit: 20eb969793921dce9e524d19fc02b84cabd98f74 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 04:52:09 -0000 The branch main has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=20eb969793921dce9e524d19fc02b84cabd98f74 commit 20eb969793921dce9e524d19fc02b84cabd98f74 Author: Eugene Grosbein AuthorDate: 2021-05-20 04:51:31 +0000 Commit: Eugene Grosbein CommitDate: 2021-05-20 04:51:31 +0000 rc.d: connect sysctl_lastload Add recently added sysctl_lastload. --- libexec/rc/rc.d/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile index 63dc17eceeaf..0834d8c4c2a0 100644 --- a/libexec/rc/rc.d/Makefile +++ b/libexec/rc/rc.d/Makefile @@ -104,6 +104,7 @@ CONFS= DAEMON \ swap \ swaplate \ sysctl \ + sysctl_lastload \ syslogd \ sysvipc \ tmp \ From owner-dev-commits-src-all@freebsd.org Thu May 20 05:54:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Thu May 20 05:59:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Thu May 20 08:14:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DCF9A637F78; Thu, 20 May 2021 08:14:18 +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 4Fm2Zf5rnpz3r47; Thu, 20 May 2021 08:14: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 AF8A2225F8; Thu, 20 May 2021 08:14: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 14K8EIU1065073; Thu, 20 May 2021 08:14:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14K8EIfh065072; Thu, 20 May 2021 08:14:18 GMT (envelope-from git) Date: Thu, 20 May 2021 08:14:18 GMT Message-Id: <202105200814.14K8EIfh065072@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: d1cd99b14741 - main - ip_mroute: refactor bw_meter API MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d1cd99b147411b331a9bff659533780ef297ef58 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 08:14:19 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=d1cd99b147411b331a9bff659533780ef297ef58 commit d1cd99b147411b331a9bff659533780ef297ef58 Author: Wojciech Macek AuthorDate: 2021-05-05 03:28:56 +0000 Commit: Wojciech Macek CommitDate: 2021-05-20 08:13:55 +0000 ip_mroute: refactor bw_meter API API should work as following: - periodicaly report Lower-or-EQual bandwidth (LEQ) connections over kernel socket, if user application registered for such per-flow notifications - report Grater-or-EQual (GEQ) bandwidth as soon as it reaches specified value in configured time window Custom implementation of callouts was removed. There is no point of doing calout-wheel here as generic callouts are doing exactly the same. The performance is not critical for such reporting, so the biggest concern should be to have a code which can be easily maintained. This is ia preparation for locking rework which is highly inefficient. Approved by: mw Sponsored by: Stormshield Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D30210 --- sys/netinet/ip_mroute.c | 610 +++++++++++++++++------------------------------- sys/netinet/ip_mroute.h | 10 +- 2 files changed, 220 insertions(+), 400 deletions(-) diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index b8e677ba9af1..0cb980b7247e 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -49,6 +49,7 @@ * Modified by Pavlin Radoslavov, USC/ISI, May 1998, August 1999, October 2000 * Modified by Hitoshi Asaeda, WIDE, August 2000 * Modified by Pavlin Radoslavov, ICSI, October 2002 + * Modified by Wojciech Macek, Semihalf, May 2021 * * MROUTING Revision: 3.5 * and PIM-SMv2 and PIM-DM support, advanced API support, @@ -202,16 +203,6 @@ VNET_DEFINE_STATIC(struct callout, expire_upcalls_ch); * Bandwidth meter variables and constants */ static MALLOC_DEFINE(M_BWMETER, "bwmeter", "multicast upcall bw meters"); -/* - * Pending timeouts are stored in a hash table, the key being the - * expiration time. Periodically, the entries are analysed and processed. - */ -#define BW_METER_BUCKETS 1024 -VNET_DEFINE_STATIC(struct bw_meter **, bw_meter_timers); -#define V_bw_meter_timers VNET(bw_meter_timers) -VNET_DEFINE_STATIC(struct callout, bw_meter_ch); -#define V_bw_meter_ch VNET(bw_meter_ch) -#define BW_METER_PERIOD (hz) /* periodical handling of bw meters */ /* * Pending upcalls are stored in a vector which is flushed when @@ -320,14 +311,13 @@ static int add_mfc(struct mfcctl2 *); static int add_vif(struct vifctl *); static void bw_meter_prepare_upcall(struct bw_meter *, struct timeval *); static void bw_meter_process(void); -static void bw_meter_receive_packet(struct bw_meter *, int, +static void bw_meter_geq_receive_packet(struct bw_meter *, int, struct timeval *); static void bw_upcalls_send(void); static int del_bw_upcall(struct bw_upcall *); static int del_mfc(struct mfcctl2 *); static int del_vif(vifi_t); static int del_vif_locked(vifi_t); -static void expire_bw_meter_process(void *); static void expire_bw_upcalls_send(void *); static void expire_mfc(struct mfc *); static void expire_upcalls(void *); @@ -685,8 +675,6 @@ ip_mrouter_init(struct socket *so, int version) curvnet); callout_reset(&V_bw_upcalls_ch, BW_UPCALLS_PERIOD, expire_bw_upcalls_send, curvnet); - callout_reset(&V_bw_meter_ch, BW_METER_PERIOD, expire_bw_meter_process, - curvnet); V_ip_mrouter = so; ip_mrouter_cnt++; @@ -745,7 +733,6 @@ X_ip_mrouter_done(void) callout_stop(&V_expire_upcalls_ch); callout_stop(&V_bw_upcalls_ch); - callout_stop(&V_bw_meter_ch); MFC_LOCK(); @@ -766,7 +753,6 @@ X_ip_mrouter_done(void) bzero(V_nexpire, sizeof(V_nexpire[0]) * mfchashsize); V_bw_upcalls_n = 0; - bzero(V_bw_meter_timers, BW_METER_BUCKETS * sizeof(*V_bw_meter_timers)); MFC_UNLOCK(); @@ -1036,7 +1022,8 @@ expire_mfc(struct mfc *rt) MFC_LOCK_ASSERT(); - free_bw_list(rt->mfc_bw_meter); + free_bw_list(rt->mfc_bw_meter_leq); + free_bw_list(rt->mfc_bw_meter_geq); TAILQ_FOREACH_SAFE(rte, &rt->mfc_stall, rte_link, nrte) { m_freem(rte->m); @@ -1139,7 +1126,8 @@ add_mfc(struct mfcctl2 *mfccp) rt->mfc_nstall = 0; rt->mfc_expire = 0; - rt->mfc_bw_meter = NULL; + rt->mfc_bw_meter_leq = NULL; + rt->mfc_bw_meter_geq = NULL; /* insert new entry at head of hash chain */ LIST_INSERT_HEAD(&V_mfchashtbl[hash], rt, mfc_hash); @@ -1179,8 +1167,10 @@ del_mfc(struct mfcctl2 *mfccp) /* * free the bw_meter entries */ - free_bw_list(rt->mfc_bw_meter); - rt->mfc_bw_meter = NULL; + free_bw_list(rt->mfc_bw_meter_leq); + rt->mfc_bw_meter_leq = NULL; + free_bw_list(rt->mfc_bw_meter_geq); + rt->mfc_bw_meter_geq = NULL; LIST_REMOVE(rt, mfc_hash); free(rt, M_MRTABLE); @@ -1393,7 +1383,8 @@ fail: /* clear the RP address */ rt->mfc_rp.s_addr = INADDR_ANY; - rt->mfc_bw_meter = NULL; + rt->mfc_bw_meter_leq = NULL; + rt->mfc_bw_meter_geq = NULL; /* initialize pkt counters per src-grp */ rt->mfc_pkt_cnt = 0; @@ -1459,16 +1450,6 @@ expire_upcalls(void *arg) if (rt->mfc_expire == 0 || --rt->mfc_expire > 0) continue; - /* - * free the bw_meter entries - */ - while (rt->mfc_bw_meter != NULL) { - struct bw_meter *x = rt->mfc_bw_meter; - - rt->mfc_bw_meter = x->bm_mfc_next; - free(x, M_BWMETER); - } - MRTSTAT_INC(mrts_cache_cleanups); CTR3(KTR_IPMF, "%s: expire (%lx, %lx)", __func__, (u_long)ntohl(rt->mfc_origin.s_addr), @@ -1602,14 +1583,22 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp, struct mfc *rt, vifi_t xmt_vif) /* * Perform upcall-related bw measuring. */ - if (rt->mfc_bw_meter != NULL) { + if ((rt->mfc_bw_meter_geq != NULL) || (rt->mfc_bw_meter_leq != NULL)) { struct bw_meter *x; struct timeval now; microtime(&now); MFC_LOCK_ASSERT(); - for (x = rt->mfc_bw_meter; x != NULL; x = x->bm_mfc_next) - bw_meter_receive_packet(x, plen, &now); + /* Process meters for Greater-or-EQual case */ + for (x = rt->mfc_bw_meter_geq; x != NULL; x = x->bm_mfc_next) + bw_meter_geq_receive_packet(x, plen, &now); + + /* Process meters for Lower-or-EQual case */ + for (x = rt->mfc_bw_meter_leq; x != NULL; x = x->bm_mfc_next) { + /* Record that a packet is received */ + x->bm_measured.b_packets++; + x->bm_measured.b_bytes += plen; + } } return 0; @@ -1759,84 +1748,139 @@ compute_bw_meter_flags(struct bw_upcall *req) return flags; } +static void +expire_bw_meter_leq(void *arg) +{ + struct bw_meter *x = arg; + struct timeval now; + /* + * INFO: + * callout is always executed with MFC_LOCK taken + */ + + CURVNET_SET((struct vnet *)x->arg); + + microtime(&now); + + /* + * Test if we should deliver an upcall + */ + if (((x->bm_flags & BW_METER_UNIT_PACKETS) && + (x->bm_measured.b_packets <= x->bm_threshold.b_packets)) || + ((x->bm_flags & BW_METER_UNIT_BYTES) && + (x->bm_measured.b_bytes <= x->bm_threshold.b_bytes))) { + /* Prepare an upcall for delivery */ + bw_meter_prepare_upcall(x, &now); + } + + /* Send all upcalls that are pending delivery */ + bw_upcalls_send(); + + /* Reset counters */ + x->bm_start_time = now; + x->bm_measured.b_bytes = 0; + x->bm_measured.b_packets = 0; + + callout_schedule(&x->bm_meter_callout, tvtohz(&x->bm_threshold.b_time)); + + CURVNET_RESTORE(); +} + /* * Add a bw_meter entry */ static int add_bw_upcall(struct bw_upcall *req) { - struct mfc *mfc; - struct timeval delta = { BW_UPCALL_THRESHOLD_INTERVAL_MIN_SEC, - BW_UPCALL_THRESHOLD_INTERVAL_MIN_USEC }; - struct timeval now; - struct bw_meter *x; - uint32_t flags; + struct mfc *mfc; + struct timeval delta = { BW_UPCALL_THRESHOLD_INTERVAL_MIN_SEC, + BW_UPCALL_THRESHOLD_INTERVAL_MIN_USEC }; + struct timeval now; + struct bw_meter *x, **bwm_ptr; + uint32_t flags; - if (!(V_mrt_api_config & MRT_MFC_BW_UPCALL)) - return EOPNOTSUPP; + if (!(V_mrt_api_config & MRT_MFC_BW_UPCALL)) + return EOPNOTSUPP; - /* Test if the flags are valid */ - if (!(req->bu_flags & (BW_UPCALL_UNIT_PACKETS | BW_UPCALL_UNIT_BYTES))) - return EINVAL; - if (!(req->bu_flags & (BW_UPCALL_GEQ | BW_UPCALL_LEQ))) - return EINVAL; - if ((req->bu_flags & (BW_UPCALL_GEQ | BW_UPCALL_LEQ)) - == (BW_UPCALL_GEQ | BW_UPCALL_LEQ)) - return EINVAL; + /* Test if the flags are valid */ + if (!(req->bu_flags & (BW_UPCALL_UNIT_PACKETS | BW_UPCALL_UNIT_BYTES))) + return EINVAL; + if (!(req->bu_flags & (BW_UPCALL_GEQ | BW_UPCALL_LEQ))) + return EINVAL; + if ((req->bu_flags & (BW_UPCALL_GEQ | BW_UPCALL_LEQ)) + == (BW_UPCALL_GEQ | BW_UPCALL_LEQ)) + return EINVAL; - /* Test if the threshold time interval is valid */ - if (BW_TIMEVALCMP(&req->bu_threshold.b_time, &delta, <)) - return EINVAL; + /* Test if the threshold time interval is valid */ + if (BW_TIMEVALCMP(&req->bu_threshold.b_time, &delta, <)) + return EINVAL; - flags = compute_bw_meter_flags(req); + flags = compute_bw_meter_flags(req); - /* - * Find if we have already same bw_meter entry - */ - MFC_LOCK(); - mfc = mfc_find(&req->bu_src, &req->bu_dst); - if (mfc == NULL) { - MFC_UNLOCK(); - return EADDRNOTAVAIL; - } - for (x = mfc->mfc_bw_meter; x != NULL; x = x->bm_mfc_next) { - if ((BW_TIMEVALCMP(&x->bm_threshold.b_time, - &req->bu_threshold.b_time, ==)) && - (x->bm_threshold.b_packets == req->bu_threshold.b_packets) && - (x->bm_threshold.b_bytes == req->bu_threshold.b_bytes) && - (x->bm_flags & BW_METER_USER_FLAGS) == flags) { - MFC_UNLOCK(); - return 0; /* XXX Already installed */ + /* + * Find if we have already same bw_meter entry + */ + MFC_LOCK(); + mfc = mfc_find(&req->bu_src, &req->bu_dst); + if (mfc == NULL) { + MFC_UNLOCK(); + return EADDRNOTAVAIL; } - } - /* Allocate the new bw_meter entry */ - x = (struct bw_meter *)malloc(sizeof(*x), M_BWMETER, M_NOWAIT); - if (x == NULL) { - MFC_UNLOCK(); - return ENOBUFS; - } + /* Choose an appropriate bw_meter list */ + if (req->bu_flags & BW_UPCALL_GEQ) + bwm_ptr = &mfc->mfc_bw_meter_geq; + else + bwm_ptr = &mfc->mfc_bw_meter_leq; + + for (x = *bwm_ptr; x != NULL; x = x->bm_mfc_next) { + if ((BW_TIMEVALCMP(&x->bm_threshold.b_time, + &req->bu_threshold.b_time, ==)) + && (x->bm_threshold.b_packets + == req->bu_threshold.b_packets) + && (x->bm_threshold.b_bytes + == req->bu_threshold.b_bytes) + && (x->bm_flags & BW_METER_USER_FLAGS) + == flags) { + MFC_UNLOCK(); + return 0; /* XXX Already installed */ + } + } - /* Set the new bw_meter entry */ - x->bm_threshold.b_time = req->bu_threshold.b_time; - microtime(&now); - x->bm_start_time = now; - x->bm_threshold.b_packets = req->bu_threshold.b_packets; - x->bm_threshold.b_bytes = req->bu_threshold.b_bytes; - x->bm_measured.b_packets = 0; - x->bm_measured.b_bytes = 0; - x->bm_flags = flags; - x->bm_time_next = NULL; - x->bm_time_hash = BW_METER_BUCKETS; - - /* Add the new bw_meter entry to the front of entries for this MFC */ - x->bm_mfc = mfc; - x->bm_mfc_next = mfc->mfc_bw_meter; - mfc->mfc_bw_meter = x; - schedule_bw_meter(x, &now); - MFC_UNLOCK(); + /* Allocate the new bw_meter entry */ + x = (struct bw_meter*) malloc(sizeof(*x), M_BWMETER, M_NOWAIT); + if (x == NULL) { + MFC_UNLOCK(); + return ENOBUFS; + } - return 0; + /* Set the new bw_meter entry */ + x->bm_threshold.b_time = req->bu_threshold.b_time; + microtime(&now); + x->bm_start_time = now; + x->bm_threshold.b_packets = req->bu_threshold.b_packets; + x->bm_threshold.b_bytes = req->bu_threshold.b_bytes; + x->bm_measured.b_packets = 0; + x->bm_measured.b_bytes = 0; + x->bm_flags = flags; + x->bm_time_next = NULL; + x->bm_mfc = mfc; + x->arg = curvnet; + + /* For LEQ case create periodic callout */ + if (req->bu_flags & BW_UPCALL_LEQ) { + callout_init_mtx(&x->bm_meter_callout, &mfc_mtx,0); + callout_reset(&x->bm_meter_callout, tvtohz(&x->bm_threshold.b_time), + expire_bw_meter_leq, x); + } + + /* Add the new bw_meter entry to the front of entries for this MFC */ + x->bm_mfc_next = *bwm_ptr; + *bwm_ptr = x; + + MFC_UNLOCK(); + + return 0; } static void @@ -1845,8 +1889,11 @@ free_bw_list(struct bw_meter *list) while (list != NULL) { struct bw_meter *x = list; + /* MFC_LOCK must be held here */ + if (x->bm_flags & BW_METER_LEQ) + callout_drain(&x->bm_meter_callout); + list = list->bm_mfc_next; - unschedule_bw_meter(x); free(x, M_BWMETER); } } @@ -1858,7 +1905,7 @@ static int del_bw_upcall(struct bw_upcall *req) { struct mfc *mfc; - struct bw_meter *x; + struct bw_meter *x, **bwm_ptr; if (!(V_mrt_api_config & MRT_MFC_BW_UPCALL)) return EOPNOTSUPP; @@ -1876,8 +1923,14 @@ del_bw_upcall(struct bw_upcall *req) */ struct bw_meter *list; - list = mfc->mfc_bw_meter; - mfc->mfc_bw_meter = NULL; + /* Free LEQ list */ + list = mfc->mfc_bw_meter_leq; + mfc->mfc_bw_meter_leq = NULL; + free_bw_list(list); + + /* Free GEQ list */ + list = mfc->mfc_bw_meter_geq; + mfc->mfc_bw_meter_geq = NULL; free_bw_list(list); MFC_UNLOCK(); return 0; @@ -1887,8 +1940,14 @@ del_bw_upcall(struct bw_upcall *req) flags = compute_bw_meter_flags(req); + /* Choose an appropriate bw_meter list */ + if (req->bu_flags & BW_UPCALL_GEQ) + bwm_ptr = &mfc->mfc_bw_meter_geq; + else + bwm_ptr = &mfc->mfc_bw_meter_leq; + /* Find the bw_meter entry to delete */ - for (prev = NULL, x = mfc->mfc_bw_meter; x != NULL; + for (prev = NULL, x = *bwm_ptr; x != NULL; prev = x, x = x->bm_mfc_next) { if ((BW_TIMEVALCMP(&x->bm_threshold.b_time, &req->bu_threshold.b_time, ==)) && @@ -1901,9 +1960,11 @@ del_bw_upcall(struct bw_upcall *req) if (prev != NULL) prev->bm_mfc_next = x->bm_mfc_next; /* remove from middle*/ else - x->bm_mfc->mfc_bw_meter = x->bm_mfc_next;/* new head of list */ + *bwm_ptr = x->bm_mfc_next;/* new head of list */ + + if (req->bu_flags & BW_UPCALL_LEQ) + callout_stop(&x->bm_meter_callout); - unschedule_bw_meter(x); MFC_UNLOCK(); /* Free the bw_meter entry */ free(x, M_BWMETER); @@ -1920,16 +1981,15 @@ del_bw_upcall(struct bw_upcall *req) * Perform bandwidth measurement processing that may result in an upcall */ static void -bw_meter_receive_packet(struct bw_meter *x, int plen, struct timeval *nowp) +bw_meter_geq_receive_packet(struct bw_meter *x, int plen, struct timeval *nowp) { - struct timeval delta; + struct timeval delta; - MFC_LOCK_ASSERT(); + MFC_LOCK_ASSERT(); - delta = *nowp; - BW_TIMEVALDECR(&delta, &x->bm_start_time); + delta = *nowp; + BW_TIMEVALDECR(&delta, &x->bm_start_time); - if (x->bm_flags & BW_METER_GEQ) { /* * Processing for ">=" type of bw_meter entry */ @@ -1949,63 +2009,15 @@ bw_meter_receive_packet(struct bw_meter *x, int plen, struct timeval *nowp) * Test if we should deliver an upcall */ if (!(x->bm_flags & BW_METER_UPCALL_DELIVERED)) { - if (((x->bm_flags & BW_METER_UNIT_PACKETS) && - (x->bm_measured.b_packets >= x->bm_threshold.b_packets)) || - ((x->bm_flags & BW_METER_UNIT_BYTES) && - (x->bm_measured.b_bytes >= x->bm_threshold.b_bytes))) { - /* Prepare an upcall for delivery */ - bw_meter_prepare_upcall(x, nowp); - x->bm_flags |= BW_METER_UPCALL_DELIVERED; - } - } - } else if (x->bm_flags & BW_METER_LEQ) { - /* - * Processing for "<=" type of bw_meter entry - */ - if (BW_TIMEVALCMP(&delta, &x->bm_threshold.b_time, >)) { - /* - * We are behind time with the multicast forwarding table - * scanning for "<=" type of bw_meter entries, so test now - * if we should deliver an upcall. - */ - if (((x->bm_flags & BW_METER_UNIT_PACKETS) && - (x->bm_measured.b_packets <= x->bm_threshold.b_packets)) || - ((x->bm_flags & BW_METER_UNIT_BYTES) && - (x->bm_measured.b_bytes <= x->bm_threshold.b_bytes))) { - /* Prepare an upcall for delivery */ - bw_meter_prepare_upcall(x, nowp); - } - /* Reschedule the bw_meter entry */ - unschedule_bw_meter(x); - schedule_bw_meter(x, nowp); - } - - /* Record that a packet is received */ - x->bm_measured.b_packets++; - x->bm_measured.b_bytes += plen; - - /* - * Test if we should restart the measuring interval - */ - if ((x->bm_flags & BW_METER_UNIT_PACKETS && - x->bm_measured.b_packets <= x->bm_threshold.b_packets) || - (x->bm_flags & BW_METER_UNIT_BYTES && - x->bm_measured.b_bytes <= x->bm_threshold.b_bytes)) { - /* Don't restart the measuring interval */ - } else { - /* Do restart the measuring interval */ - /* - * XXX: note that we don't unschedule and schedule, because this - * might be too much overhead per packet. Instead, when we process - * all entries for a given timer hash bin, we check whether it is - * really a timeout. If not, we reschedule at that time. - */ - x->bm_start_time = *nowp; - x->bm_measured.b_packets = 0; - x->bm_measured.b_bytes = 0; - x->bm_flags &= ~BW_METER_UPCALL_DELIVERED; + if (((x->bm_flags & BW_METER_UNIT_PACKETS) && + (x->bm_measured.b_packets >= x->bm_threshold.b_packets)) || + ((x->bm_flags & BW_METER_UNIT_BYTES) && + (x->bm_measured.b_bytes >= x->bm_threshold.b_bytes))) { + /* Prepare an upcall for delivery */ + bw_meter_prepare_upcall(x, nowp); + x->bm_flags |= BW_METER_UPCALL_DELIVERED; + } } - } } /* @@ -2014,44 +2026,44 @@ bw_meter_receive_packet(struct bw_meter *x, int plen, struct timeval *nowp) static void bw_meter_prepare_upcall(struct bw_meter *x, struct timeval *nowp) { - struct timeval delta; - struct bw_upcall *u; + struct timeval delta; + struct bw_upcall *u; - MFC_LOCK_ASSERT(); + MFC_LOCK_ASSERT(); - /* - * Compute the measured time interval - */ - delta = *nowp; - BW_TIMEVALDECR(&delta, &x->bm_start_time); + /* + * Compute the measured time interval + */ + delta = *nowp; + BW_TIMEVALDECR(&delta, &x->bm_start_time); - /* - * If there are too many pending upcalls, deliver them now - */ - if (V_bw_upcalls_n >= BW_UPCALLS_MAX) - bw_upcalls_send(); + /* + * If there are too many pending upcalls, deliver them now + */ + if (V_bw_upcalls_n >= BW_UPCALLS_MAX) + bw_upcalls_send(); - /* - * Set the bw_upcall entry - */ - u = &V_bw_upcalls[V_bw_upcalls_n++]; - u->bu_src = x->bm_mfc->mfc_origin; - u->bu_dst = x->bm_mfc->mfc_mcastgrp; - u->bu_threshold.b_time = x->bm_threshold.b_time; - u->bu_threshold.b_packets = x->bm_threshold.b_packets; - u->bu_threshold.b_bytes = x->bm_threshold.b_bytes; - u->bu_measured.b_time = delta; - u->bu_measured.b_packets = x->bm_measured.b_packets; - u->bu_measured.b_bytes = x->bm_measured.b_bytes; - u->bu_flags = 0; - if (x->bm_flags & BW_METER_UNIT_PACKETS) - u->bu_flags |= BW_UPCALL_UNIT_PACKETS; - if (x->bm_flags & BW_METER_UNIT_BYTES) - u->bu_flags |= BW_UPCALL_UNIT_BYTES; - if (x->bm_flags & BW_METER_GEQ) - u->bu_flags |= BW_UPCALL_GEQ; - if (x->bm_flags & BW_METER_LEQ) - u->bu_flags |= BW_UPCALL_LEQ; + /* + * Set the bw_upcall entry + */ + u = &V_bw_upcalls[V_bw_upcalls_n++]; + u->bu_src = x->bm_mfc->mfc_origin; + u->bu_dst = x->bm_mfc->mfc_mcastgrp; + u->bu_threshold.b_time = x->bm_threshold.b_time; + u->bu_threshold.b_packets = x->bm_threshold.b_packets; + u->bu_threshold.b_bytes = x->bm_threshold.b_bytes; + u->bu_measured.b_time = delta; + u->bu_measured.b_packets = x->bm_measured.b_packets; + u->bu_measured.b_bytes = x->bm_measured.b_bytes; + u->bu_flags = 0; + if (x->bm_flags & BW_METER_UNIT_PACKETS) + u->bu_flags |= BW_UPCALL_UNIT_PACKETS; + if (x->bm_flags & BW_METER_UNIT_BYTES) + u->bu_flags |= BW_UPCALL_UNIT_BYTES; + if (x->bm_flags & BW_METER_GEQ) + u->bu_flags |= BW_UPCALL_GEQ; + if (x->bm_flags & BW_METER_LEQ) + u->bu_flags |= BW_UPCALL_LEQ; } /* @@ -2103,183 +2115,6 @@ bw_upcalls_send(void) } } -/* - * Compute the timeout hash value for the bw_meter entries - */ -#define BW_METER_TIMEHASH(bw_meter, hash) \ - do { \ - struct timeval next_timeval = (bw_meter)->bm_start_time; \ - \ - BW_TIMEVALADD(&next_timeval, &(bw_meter)->bm_threshold.b_time); \ - (hash) = next_timeval.tv_sec; \ - if (next_timeval.tv_usec) \ - (hash)++; /* XXX: make sure we don't timeout early */ \ - (hash) %= BW_METER_BUCKETS; \ - } while (0) - -/* - * Schedule a timer to process periodically bw_meter entry of type "<=" - * by linking the entry in the proper hash bucket. - */ -static void -schedule_bw_meter(struct bw_meter *x, struct timeval *nowp) -{ - int time_hash; - - MFC_LOCK_ASSERT(); - - if (!(x->bm_flags & BW_METER_LEQ)) - return; /* XXX: we schedule timers only for "<=" entries */ - - /* - * Reset the bw_meter entry - */ - x->bm_start_time = *nowp; - x->bm_measured.b_packets = 0; - x->bm_measured.b_bytes = 0; - x->bm_flags &= ~BW_METER_UPCALL_DELIVERED; - - /* - * Compute the timeout hash value and insert the entry - */ - BW_METER_TIMEHASH(x, time_hash); - x->bm_time_next = V_bw_meter_timers[time_hash]; - V_bw_meter_timers[time_hash] = x; - x->bm_time_hash = time_hash; -} - -/* - * Unschedule the periodic timer that processes bw_meter entry of type "<=" - * by removing the entry from the proper hash bucket. - */ -static void -unschedule_bw_meter(struct bw_meter *x) -{ - int time_hash; - struct bw_meter *prev, *tmp; - - MFC_LOCK_ASSERT(); - - if (!(x->bm_flags & BW_METER_LEQ)) - return; /* XXX: we schedule timers only for "<=" entries */ - - /* - * Compute the timeout hash value and delete the entry - */ - time_hash = x->bm_time_hash; - if (time_hash >= BW_METER_BUCKETS) - return; /* Entry was not scheduled */ - - for (prev = NULL, tmp = V_bw_meter_timers[time_hash]; - tmp != NULL; prev = tmp, tmp = tmp->bm_time_next) - if (tmp == x) - break; - - if (tmp == NULL) - panic("unschedule_bw_meter: bw_meter entry not found"); - - if (prev != NULL) - prev->bm_time_next = x->bm_time_next; - else - V_bw_meter_timers[time_hash] = x->bm_time_next; - - x->bm_time_next = NULL; - x->bm_time_hash = BW_METER_BUCKETS; -} - -/* - * Process all "<=" type of bw_meter that should be processed now, - * and for each entry prepare an upcall if necessary. Each processed - * entry is rescheduled again for the (periodic) processing. - * - * This is run periodically (once per second normally). On each round, - * all the potentially matching entries are in the hash slot that we are - * looking at. - */ -static void -bw_meter_process() -{ - uint32_t loops; - int i; - struct timeval now, process_endtime; - - microtime(&now); - if (V_last_tv_sec == now.tv_sec) - return; /* nothing to do */ - - loops = now.tv_sec - V_last_tv_sec; - V_last_tv_sec = now.tv_sec; - if (loops > BW_METER_BUCKETS) - loops = BW_METER_BUCKETS; - - MFC_LOCK(); - /* - * Process all bins of bw_meter entries from the one after the last - * processed to the current one. On entry, i points to the last bucket - * visited, so we need to increment i at the beginning of the loop. - */ - for (i = (now.tv_sec - loops) % BW_METER_BUCKETS; loops > 0; loops--) { - struct bw_meter *x, *tmp_list; - - if (++i >= BW_METER_BUCKETS) - i = 0; - - /* Disconnect the list of bw_meter entries from the bin */ - tmp_list = V_bw_meter_timers[i]; - V_bw_meter_timers[i] = NULL; - - /* Process the list of bw_meter entries */ - while (tmp_list != NULL) { - x = tmp_list; - tmp_list = tmp_list->bm_time_next; - - /* Test if the time interval is over */ - process_endtime = x->bm_start_time; - BW_TIMEVALADD(&process_endtime, &x->bm_threshold.b_time); - if (BW_TIMEVALCMP(&process_endtime, &now, >)) { - /* Not yet: reschedule, but don't reset */ - int time_hash; - - BW_METER_TIMEHASH(x, time_hash); - if (time_hash == i && process_endtime.tv_sec == now.tv_sec) { - /* - * XXX: somehow the bin processing is a bit ahead of time. - * Put the entry in the next bin. - */ - if (++time_hash >= BW_METER_BUCKETS) - time_hash = 0; - } - x->bm_time_next = V_bw_meter_timers[time_hash]; - V_bw_meter_timers[time_hash] = x; - x->bm_time_hash = time_hash; - - continue; - } - - /* - * Test if we should deliver an upcall - */ - if (((x->bm_flags & BW_METER_UNIT_PACKETS) && - (x->bm_measured.b_packets <= x->bm_threshold.b_packets)) || - ((x->bm_flags & BW_METER_UNIT_BYTES) && - (x->bm_measured.b_bytes <= x->bm_threshold.b_bytes))) { - /* Prepare an upcall for delivery */ - bw_meter_prepare_upcall(x, &now); - } - - /* - * Reschedule for next processing - */ - schedule_bw_meter(x, &now); - } - } - - /* Send all upcalls that are pending delivery */ - bw_upcalls_send(); - - MFC_UNLOCK(); -} - /* * A periodic function for sending all upcalls that are pending delivery */ @@ -2297,23 +2132,6 @@ expire_bw_upcalls_send(void *arg) CURVNET_RESTORE(); } -/* - * A periodic function for periodic scanning of the multicast forwarding - * table for processing all "<=" bw_meter entries. - */ -static void -expire_bw_meter_process(void *arg) -{ - CURVNET_SET((struct vnet *) arg); - - if (V_mrt_api_config & MRT_MFC_BW_UPCALL) - bw_meter_process(); - - callout_reset(&V_bw_meter_ch, BW_METER_PERIOD, expire_bw_meter_process, - curvnet); - CURVNET_RESTORE(); -} - /* * End of bandwidth monitoring code */ @@ -2835,14 +2653,11 @@ vnet_mroute_init(const void *unused __unused) V_viftable = mallocarray(MAXVIFS, sizeof(*V_viftable), M_MRTABLE, M_WAITOK|M_ZERO); - V_bw_meter_timers = mallocarray(BW_METER_BUCKETS, - sizeof(*V_bw_meter_timers), M_MRTABLE, M_WAITOK|M_ZERO); V_bw_upcalls = mallocarray(BW_UPCALLS_MAX, sizeof(*V_bw_upcalls), M_MRTABLE, M_WAITOK|M_ZERO); callout_init(&V_expire_upcalls_ch, 1); callout_init(&V_bw_upcalls_ch, 1); - callout_init(&V_bw_meter_ch, 1); } VNET_SYSINIT(vnet_mroute_init, SI_SUB_PROTO_MC, SI_ORDER_ANY, vnet_mroute_init, @@ -2853,7 +2668,6 @@ vnet_mroute_uninit(const void *unused __unused) { free(V_bw_upcalls, M_MRTABLE); - free(V_bw_meter_timers, M_MRTABLE); free(V_viftable, M_MRTABLE); free(V_nexpire, M_MRTABLE); V_nexpire = NULL; diff --git a/sys/netinet/ip_mroute.h b/sys/netinet/ip_mroute.h index 6ef99c0172f3..07d77065de33 100644 --- a/sys/netinet/ip_mroute.h +++ b/sys/netinet/ip_mroute.h @@ -283,7 +283,10 @@ struct mfc { struct timeval mfc_last_assert; /* last time I sent an assert*/ uint8_t mfc_flags[MAXVIFS]; /* the MRT_MFC_FLAGS_* flags */ struct in_addr mfc_rp; /* the RP address */ - struct bw_meter *mfc_bw_meter; /* list of bandwidth meters */ + struct bw_meter *mfc_bw_meter_leq; /* list of bandwidth meters + for Lower-or-EQual case */ + struct bw_meter *mfc_bw_meter_geq; /* list of bandwidth meters + for Greater-or-EQual case */ u_long mfc_nstall; /* # of packets awaiting mfc */ TAILQ_HEAD(, rtdetq) mfc_stall; /* q of packets awaiting mfc */ }; @@ -327,7 +330,6 @@ struct rtdetq { struct bw_meter { struct bw_meter *bm_mfc_next; /* next bw meter (same mfc) */ struct bw_meter *bm_time_next; /* next bw meter (same time) */ - uint32_t bm_time_hash; /* the time hash value */ struct mfc *bm_mfc; /* the corresponding mfc */ uint32_t bm_flags; /* misc flags (see below) */ #define BW_METER_UNIT_PACKETS (1 << 0) /* threshold (in packets) */ @@ -344,6 +346,10 @@ struct bw_meter { struct bw_data bm_threshold; /* the upcall threshold */ struct bw_data bm_measured; /* the measured bw */ struct timeval bm_start_time; /* abs. time */ +#ifdef _KERNEL + struct callout bm_meter_callout; /* Periodic callout */ + void* arg; /* custom argument */ +#endif }; #ifdef _KERNEL From owner-dev-commits-src-all@freebsd.org Thu May 20 08:27:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8AB6F63889B; Thu, 20 May 2021 08:27: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 4Fm2t42Zp8z4TVh; Thu, 20 May 2021 08:27: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 404EC22941; Thu, 20 May 2021 08:27: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 14K8ReIB078854; Thu, 20 May 2021 08:27:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14K8ReTU078853; Thu, 20 May 2021 08:27:40 GMT (envelope-from git) Date: Thu, 20 May 2021 08:27:40 GMT Message-Id: <202105200827.14K8ReTU078853@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ceri Davies Subject: git: c1a148873d64 - main - sys/*/conf/*, docs: fix links to handbook MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ceri X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c1a148873d6488f1dac1cfb207a5927cef89888e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 08:27:40 -0000 The branch main has been updated by ceri (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c1a148873d6488f1dac1cfb207a5927cef89888e commit c1a148873d6488f1dac1cfb207a5927cef89888e Author: Ceri Davies AuthorDate: 2021-05-20 08:26:02 +0000 Commit: Ceri Davies CommitDate: 2021-05-20 08:27:10 +0000 sys/*/conf/*, docs: fix links to handbook While here, fix all links to older en_US.ISO8859-1 documentation in the src/ tree. PR: 255026 Reported by: Michael Büker Reviewed by: dbaio Approved by: blackend (mentor), re (gjb) MFC after: 10 days Differential Revision: https://reviews.freebsd.org/D30265 --- UPDATING | 2 +- release/Makefile | 1 - share/man/man4/mac.4 | 4 ++-- share/man/man7/release.7 | 6 +++--- share/man/man9/mac.9 | 4 ++-- share/man/man9/pci.9 | 4 ++-- sys/amd64/conf/GENERIC | 2 +- sys/amd64/conf/GENERIC-KCSAN | 2 +- sys/amd64/conf/GENERIC-NODEBUG | 2 +- sys/amd64/conf/MINIMAL | 2 +- sys/arm/conf/ALPINE | 2 +- sys/arm/conf/APALIS-IMX6 | 2 +- sys/arm/conf/ARMADAXP | 2 +- sys/arm/conf/COLIBRI-VF50 | 2 +- sys/arm/conf/COSMIC | 2 +- sys/arm/conf/EFIKA_MX | 2 +- sys/arm/conf/GENERIC | 2 +- sys/arm/conf/GENERIC-NODEBUG | 2 +- sys/arm/conf/IMX53 | 2 +- sys/arm/conf/IMX6 | 2 +- sys/arm/conf/JETSON-TK1 | 2 +- sys/arm/conf/QUARTZ | 2 +- sys/arm/conf/RPI-B | 2 +- sys/arm/conf/SOCDK | 2 +- sys/arm/conf/SOCFPGA | 2 +- sys/arm/conf/SOCKIT | 2 +- sys/arm/conf/SOCKIT-BERI | 2 +- sys/arm/conf/TEGRA124 | 2 +- sys/arm/conf/VYBRID | 2 +- sys/arm/conf/ZEDBOARD | 2 +- sys/arm64/conf/GENERIC | 2 +- sys/arm64/conf/GENERIC-NODEBUG | 2 +- sys/arm64/conf/GENERIC-UP | 2 +- sys/contrib/zstd/FREEBSD-upgrade | 2 +- sys/i386/conf/GENERIC | 2 +- sys/i386/conf/GENERIC-NODEBUG | 2 +- sys/i386/conf/MINIMAL | 2 +- sys/mips/conf/ERL | 2 +- sys/mips/conf/OCTEON1 | 2 +- sys/mips/conf/XLP64 | 2 +- sys/mips/conf/XLPN32 | 2 +- sys/powerpc/conf/GENERIC | 2 +- sys/powerpc/conf/GENERIC-NODEBUG | 2 +- sys/powerpc/conf/GENERIC64 | 2 +- sys/powerpc/conf/GENERIC64-NODEBUG | 2 +- sys/powerpc/conf/GENERIC64LE | 2 +- sys/riscv/conf/GENERIC | 2 +- sys/riscv/conf/GENERIC-NODEBUG | 2 +- usr.bin/fortune/datfiles/freebsd-tips | 3 +-- usr.bin/timeout/timeout.1 | 6 +++--- usr.sbin/lpr/lpd/printcap | 2 +- usr.sbin/mergemaster/mergemaster.8 | 7 +++---- usr.sbin/ppp/ppp.8 | 8 +++----- 53 files changed, 63 insertions(+), 68 deletions(-) diff --git a/UPDATING b/UPDATING index efccbf3b2fff..45f85647980b 100644 --- a/UPDATING +++ b/UPDATING @@ -6,7 +6,7 @@ COMMON ITEMS: section later in the file. These instructions assume that you basically know what you are doing. If not, then please consult the FreeBSD handbook: - https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html + https://docs.freebsd.org/en/books/handbook/cutting-edge/#makeworld Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before updating system packages diff --git a/release/Makefile b/release/Makefile index c176ae6f2bb7..646b9f8738d2 100644 --- a/release/Makefile +++ b/release/Makefile @@ -36,7 +36,6 @@ WORLDDIR?= ${.CURDIR}/.. PORTSDIR?= /usr/ports -RELNOTES_LANG?= en_US.ISO8859-1 .if !defined(TARGET) || empty(TARGET) TARGET= ${MACHINE} diff --git a/share/man/man4/mac.4 b/share/man/man4/mac.4 index 135301962f3b..ecc13257960d 100644 --- a/share/man/man4/mac.4 +++ b/share/man/man4/mac.4 @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 25, 2015 +.Dd May 20, 2021 .Dt MAC 4 .Os .Sh NAME @@ -219,7 +219,7 @@ man page. .Rs .%B "The FreeBSD Handbook" .%T "Mandatory Access Control" -.%U https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/mac.html +.%U https://docs.FreeBSD.org/en/books/handbook/mac/ .Re .Sh HISTORY The diff --git a/share/man/man7/release.7 b/share/man/man7/release.7 index a474de83ec93..aa0cee1e32b8 100644 --- a/share/man/man7/release.7 +++ b/share/man/man7/release.7 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 4, 2021 +.Dd May 20, 2021 .Dt RELEASE 7 .Os .Sh NAME @@ -697,11 +697,11 @@ are therefore no longer supported. .Xr sysctl 8 .Rs .%T "FreeBSD Release Engineering" -.%U https://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/freebsd-releng/ +.%U https://docs.freebsd.org/en/articles/freebsd-releng/ .Re .Rs .%T "FreeBSD Developers' Handbook" -.%U https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/developers-handbook/ +.%U https://docs.freebsd.org/en/books/developers-handbook/ .Re .Sh HISTORY .Fx diff --git a/share/man/man9/mac.9 b/share/man/man9/mac.9 index 89238d28b61c..9357c1189bd7 100644 --- a/share/man/man9/mac.9 +++ b/share/man/man9/mac.9 @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 27, 2021 +.Dd May 20, 2021 .Dt MAC 9 .Os .Sh NAME @@ -166,7 +166,7 @@ for information on the MAC Framework APIs. .Xr VOP_SETLABEL 9 . .Rs .%T "The FreeBSD Architecture Handbook" -.%U "https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/arch-handbook/" +.%U "https://docs.freebsd.org/en/books/arch-handbook/" .Re .Sh HISTORY The diff --git a/share/man/man9/pci.9 b/share/man/man9/pci.9 index e55ea02547b6..5dc9ef099a87 100644 --- a/share/man/man9/pci.9 +++ b/share/man/man9/pci.9 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 15, 2017 +.Dd May 20, 2021 .Dt PCI 9 .Os .Sh NAME @@ -1104,7 +1104,7 @@ is unattached but with valid instance variables. .Rs .%B FreeBSD Developers' Handbook .%T NewBus -.%U https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/developers-handbook/ +.%U https://docs.freebsd.org/en/books/developers-handbook/ .Re .Rs .%A Shanley diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index bb7299a60382..696d15698baf 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -4,7 +4,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/amd64/conf/GENERIC-KCSAN b/sys/amd64/conf/GENERIC-KCSAN index 2864596860ab..b578fbf641cd 100644 --- a/sys/amd64/conf/GENERIC-KCSAN +++ b/sys/amd64/conf/GENERIC-KCSAN @@ -12,7 +12,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/amd64/conf/GENERIC-NODEBUG b/sys/amd64/conf/GENERIC-NODEBUG index 332cf85eb372..1c767e84d483 100644 --- a/sys/amd64/conf/GENERIC-NODEBUG +++ b/sys/amd64/conf/GENERIC-NODEBUG @@ -12,7 +12,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/amd64/conf/MINIMAL b/sys/amd64/conf/MINIMAL index 603fce8320bb..b03b17b1bfcd 100644 --- a/sys/amd64/conf/MINIMAL +++ b/sys/amd64/conf/MINIMAL @@ -18,7 +18,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/ALPINE b/sys/arm/conf/ALPINE index fdfb591f8614..871ee698b953 100644 --- a/sys/arm/conf/ALPINE +++ b/sys/arm/conf/ALPINE @@ -3,7 +3,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/APALIS-IMX6 b/sys/arm/conf/APALIS-IMX6 index 9b5886216ada..084bee232a12 100644 --- a/sys/arm/conf/APALIS-IMX6 +++ b/sys/arm/conf/APALIS-IMX6 @@ -3,7 +3,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/ARMADAXP b/sys/arm/conf/ARMADAXP index 96c90c639a42..39727aad4403 100644 --- a/sys/arm/conf/ARMADAXP +++ b/sys/arm/conf/ARMADAXP @@ -4,7 +4,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/COLIBRI-VF50 b/sys/arm/conf/COLIBRI-VF50 index 86dcb0b9ef73..af0085615786 100644 --- a/sys/arm/conf/COLIBRI-VF50 +++ b/sys/arm/conf/COLIBRI-VF50 @@ -3,7 +3,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/COSMIC b/sys/arm/conf/COSMIC index cd49dbc5b050..b9d1ffc5aa42 100644 --- a/sys/arm/conf/COSMIC +++ b/sys/arm/conf/COSMIC @@ -3,7 +3,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/EFIKA_MX b/sys/arm/conf/EFIKA_MX index 724d742e03af..d45d6e815269 100644 --- a/sys/arm/conf/EFIKA_MX +++ b/sys/arm/conf/EFIKA_MX @@ -4,7 +4,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/GENERIC b/sys/arm/conf/GENERIC index 3cfe16ccfe54..dc6e2657779d 100644 --- a/sys/arm/conf/GENERIC +++ b/sys/arm/conf/GENERIC @@ -4,7 +4,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/GENERIC-NODEBUG b/sys/arm/conf/GENERIC-NODEBUG index 6e60deff7569..517d3310c9d5 100644 --- a/sys/arm/conf/GENERIC-NODEBUG +++ b/sys/arm/conf/GENERIC-NODEBUG @@ -12,7 +12,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/IMX53 b/sys/arm/conf/IMX53 index 0372cb62088d..4cbd14aa13a4 100644 --- a/sys/arm/conf/IMX53 +++ b/sys/arm/conf/IMX53 @@ -4,7 +4,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/IMX6 b/sys/arm/conf/IMX6 index 6d8388ff0d60..5288b4a75622 100644 --- a/sys/arm/conf/IMX6 +++ b/sys/arm/conf/IMX6 @@ -4,7 +4,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/JETSON-TK1 b/sys/arm/conf/JETSON-TK1 index b12186d91c2c..859d1535842f 100644 --- a/sys/arm/conf/JETSON-TK1 +++ b/sys/arm/conf/JETSON-TK1 @@ -3,7 +3,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/QUARTZ b/sys/arm/conf/QUARTZ index 3e7d239785e2..de6d38463b17 100644 --- a/sys/arm/conf/QUARTZ +++ b/sys/arm/conf/QUARTZ @@ -3,7 +3,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/RPI-B b/sys/arm/conf/RPI-B index 36eaff0c0f28..ebaa0462b155 100644 --- a/sys/arm/conf/RPI-B +++ b/sys/arm/conf/RPI-B @@ -4,7 +4,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/SOCDK b/sys/arm/conf/SOCDK index 4c92aaea108a..59f93d480a86 100644 --- a/sys/arm/conf/SOCDK +++ b/sys/arm/conf/SOCDK @@ -4,7 +4,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/SOCFPGA b/sys/arm/conf/SOCFPGA index 3d7511565307..717f7546a594 100644 --- a/sys/arm/conf/SOCFPGA +++ b/sys/arm/conf/SOCFPGA @@ -4,7 +4,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/SOCKIT b/sys/arm/conf/SOCKIT index c83a3f260691..d1e9a85d7bd9 100644 --- a/sys/arm/conf/SOCKIT +++ b/sys/arm/conf/SOCKIT @@ -4,7 +4,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/SOCKIT-BERI b/sys/arm/conf/SOCKIT-BERI index 7dd37a340502..0e21f5c27604 100644 --- a/sys/arm/conf/SOCKIT-BERI +++ b/sys/arm/conf/SOCKIT-BERI @@ -4,7 +4,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/TEGRA124 b/sys/arm/conf/TEGRA124 index 68d7bf037525..881d6e811a85 100644 --- a/sys/arm/conf/TEGRA124 +++ b/sys/arm/conf/TEGRA124 @@ -4,7 +4,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/VYBRID b/sys/arm/conf/VYBRID index e7ded5f42d82..24297a6febe2 100644 --- a/sys/arm/conf/VYBRID +++ b/sys/arm/conf/VYBRID @@ -4,7 +4,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm/conf/ZEDBOARD b/sys/arm/conf/ZEDBOARD index 24490a5129e5..1a7d011f51b0 100644 --- a/sys/arm/conf/ZEDBOARD +++ b/sys/arm/conf/ZEDBOARD @@ -5,7 +5,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index 430ba8a4a45f..23126cc81127 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -4,7 +4,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm64/conf/GENERIC-NODEBUG b/sys/arm64/conf/GENERIC-NODEBUG index 8b99852be971..accbc464862c 100644 --- a/sys/arm64/conf/GENERIC-NODEBUG +++ b/sys/arm64/conf/GENERIC-NODEBUG @@ -12,7 +12,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/arm64/conf/GENERIC-UP b/sys/arm64/conf/GENERIC-UP index f6c4e6edeca9..f18c5defc1a6 100644 --- a/sys/arm64/conf/GENERIC-UP +++ b/sys/arm64/conf/GENERIC-UP @@ -4,7 +4,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/contrib/zstd/FREEBSD-upgrade b/sys/contrib/zstd/FREEBSD-upgrade index dfcad88572b2..fb46da059004 100644 --- a/sys/contrib/zstd/FREEBSD-upgrade +++ b/sys/contrib/zstd/FREEBSD-upgrade @@ -11,4 +11,4 @@ we don't want. Please find instructions for importing new releases and merging to HEAD here: -https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/subversion-primer.html#idp45937784 +https://docs.freebsd.org/en/articles/committers-guide/#vendor-import-git diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC index 874c3237ec77..1b4d853fe1d4 100644 --- a/sys/i386/conf/GENERIC +++ b/sys/i386/conf/GENERIC @@ -4,7 +4,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/i386/conf/GENERIC-NODEBUG b/sys/i386/conf/GENERIC-NODEBUG index d09663e1b9db..f0b3ecd818fd 100644 --- a/sys/i386/conf/GENERIC-NODEBUG +++ b/sys/i386/conf/GENERIC-NODEBUG @@ -12,7 +12,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/i386/conf/MINIMAL b/sys/i386/conf/MINIMAL index 8eed963b8f0a..f80c5cf40b48 100644 --- a/sys/i386/conf/MINIMAL +++ b/sys/i386/conf/MINIMAL @@ -18,7 +18,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/mips/conf/ERL b/sys/mips/conf/ERL index d0bb25455fa4..ae18cddd84ba 100644 --- a/sys/mips/conf/ERL +++ b/sys/mips/conf/ERL @@ -5,7 +5,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/mips/conf/OCTEON1 b/sys/mips/conf/OCTEON1 index 99a839ac8b28..7596a61a09da 100644 --- a/sys/mips/conf/OCTEON1 +++ b/sys/mips/conf/OCTEON1 @@ -4,7 +4,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/mips/conf/XLP64 b/sys/mips/conf/XLP64 index cf35005f0768..537091458e00 100644 --- a/sys/mips/conf/XLP64 +++ b/sys/mips/conf/XLP64 @@ -3,7 +3,7 @@ # For more information on this file, please read the handbook section on # Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/mips/conf/XLPN32 b/sys/mips/conf/XLPN32 index bc2593d6ebdb..cf8dbcffb020 100644 --- a/sys/mips/conf/XLPN32 +++ b/sys/mips/conf/XLPN32 @@ -3,7 +3,7 @@ # For more information on this file, please read the handbook section on # Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/powerpc/conf/GENERIC b/sys/powerpc/conf/GENERIC index 7854e89d17b7..cdf1266ec5a6 100644 --- a/sys/powerpc/conf/GENERIC +++ b/sys/powerpc/conf/GENERIC @@ -4,7 +4,7 @@ # For more information on this file, please read the handbook section on # Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/powerpc/conf/GENERIC-NODEBUG b/sys/powerpc/conf/GENERIC-NODEBUG index b86116253d78..b21984636e1d 100644 --- a/sys/powerpc/conf/GENERIC-NODEBUG +++ b/sys/powerpc/conf/GENERIC-NODEBUG @@ -12,7 +12,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/powerpc/conf/GENERIC64 b/sys/powerpc/conf/GENERIC64 index 634a8c2731a8..93a130e07dc6 100644 --- a/sys/powerpc/conf/GENERIC64 +++ b/sys/powerpc/conf/GENERIC64 @@ -4,7 +4,7 @@ # For more information on this file, please read the handbook section on # Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/powerpc/conf/GENERIC64-NODEBUG b/sys/powerpc/conf/GENERIC64-NODEBUG index da382e5e76de..cc82f38fb22c 100644 --- a/sys/powerpc/conf/GENERIC64-NODEBUG +++ b/sys/powerpc/conf/GENERIC64-NODEBUG @@ -12,7 +12,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/powerpc/conf/GENERIC64LE b/sys/powerpc/conf/GENERIC64LE index 41815a6a01cc..6bd0c8154673 100644 --- a/sys/powerpc/conf/GENERIC64LE +++ b/sys/powerpc/conf/GENERIC64LE @@ -4,7 +4,7 @@ # For more information on this file, please read the handbook section on # Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC index a04d5557c83c..4c31e5dcf31d 100644 --- a/sys/riscv/conf/GENERIC +++ b/sys/riscv/conf/GENERIC @@ -4,7 +4,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/sys/riscv/conf/GENERIC-NODEBUG b/sys/riscv/conf/GENERIC-NODEBUG index 9b1d9fe5a9af..09155b59f46f 100644 --- a/sys/riscv/conf/GENERIC-NODEBUG +++ b/sys/riscv/conf/GENERIC-NODEBUG @@ -12,7 +12,7 @@ # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: # -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips index 0b596dec4575..eb7339cec698 100644 --- a/usr.bin/fortune/datfiles/freebsd-tips +++ b/usr.bin/fortune/datfiles/freebsd-tips @@ -62,8 +62,7 @@ If you need a reminder to leave your terminal, type "leave +hhmm" where % If you need to ask a question on the FreeBSD-questions mailing list then - https://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/\ - freebsd-questions/index.html + https://docs.freebsd.org/en/articles/freebsd-questions contains lots of useful advice to help you get the best results. % diff --git a/usr.bin/timeout/timeout.1 b/usr.bin/timeout/timeout.1 index b9613128755e..87a86c81e6ee 100644 --- a/usr.bin/timeout/timeout.1 +++ b/usr.bin/timeout/timeout.1 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 7, 2020 +.Dd May 20, 2021 .Dt TIMEOUT 1 .Os .Sh NAME @@ -180,7 +180,7 @@ $ echo $? .Pp Try to .Xr fetch 1 -the single page version of the +the PDF version of the .Fx Handbook. Send a @@ -190,7 +190,7 @@ signal after 1 minute and send a signal 5 seconds later if the process refuses to stop: .Bd -literal -offset indent timeout -k 5s 1m fetch \\ -https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html +https://download.freebsd.org/ftp/doc/en/books/handbook/book.pdf .Ed .Sh SEE ALSO .Xr kill 1 , diff --git a/usr.sbin/lpr/lpd/printcap b/usr.sbin/lpr/lpd/printcap index b1f83b344c8f..1bfa1abb4c20 100644 --- a/usr.sbin/lpr/lpd/printcap +++ b/usr.sbin/lpr/lpd/printcap @@ -22,7 +22,7 @@ # # Do also refer to the "printing" section of the handbook. # -# https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/printing.html +# https://docs.freebsd.org/en/books/handbook/printing/ # # A local copy can be found under # diff --git a/usr.sbin/mergemaster/mergemaster.8 b/usr.sbin/mergemaster/mergemaster.8 index b76799e39cd5..2f5b85f30b4c 100644 --- a/usr.sbin/mergemaster/mergemaster.8 +++ b/usr.sbin/mergemaster/mergemaster.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 27, 2018 +.Dd May 20, 2021 .Dt MERGEMASTER 8 .Os .Sh NAME @@ -458,9 +458,8 @@ comparison, use: .Pp .Pa /usr/src/etc/Makefile .Rs -.%U https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html -.%T The Cutting Edge (using make world) -.%A Nik Clayton +.%U https://docs.freebsd.org/en/books/handbook/cutting-edge/#makeworld +.%T The FreeBSD Handbook .Re .Sh HISTORY The diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8 index 02819b1b3578..00470f6e5273 100644 --- a/usr.sbin/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp.8 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 11, 2020 +.Dd May 20, 2021 .Dt PPP 8 .Os .Sh NAME @@ -5963,12 +5963,10 @@ and .Dq show ?\& to get online information about what is available. .It -The following URLs contain useful information: +The following URL contains useful information: .Bl -bullet -compact .It -https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/faq/ppp.html -.It -https://www.FreeBSD.org/doc/handbook/userppp.html +https://docs.freebsd.org/en/books/handbook/ppp-and-slip/ .El .El .Sh FILES From owner-dev-commits-src-all@freebsd.org Thu May 20 09:22:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B7864639A67; Thu, 20 May 2021 09:22: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 4Fm45X4gZTz4rvH; Thu, 20 May 2021 09:22: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 89428235D5; Thu, 20 May 2021 09:22: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 14K9Menn058288; Thu, 20 May 2021 09:22:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14K9MeJV058287; Thu, 20 May 2021 09:22:40 GMT (envelope-from git) Date: Thu, 20 May 2021 09:22:40 GMT Message-Id: <202105200922.14K9MeJV058287@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: b08bf4c35caa - main - sdhci_fsl_fdt: Skip vccq reconfiguration without regulator MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b08bf4c35caa2baaa0453b7979ed538cf71b6de5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 09:22:40 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=b08bf4c35caa2baaa0453b7979ed538cf71b6de5 commit b08bf4c35caa2baaa0453b7979ed538cf71b6de5 Author: Marcin Wojtas AuthorDate: 2021-05-20 09:16:40 +0000 Commit: Marcin Wojtas CommitDate: 2021-05-20 09:21:53 +0000 sdhci_fsl_fdt: Skip vccq reconfiguration without regulator There is no need to preform any voltage reconfiguration in case the vccq regulator is not physically attached to the slot. Submitted by: Lukasz Hajec Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D30355 --- sys/dev/sdhci/sdhci_fsl_fdt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/sdhci/sdhci_fsl_fdt.c b/sys/dev/sdhci/sdhci_fsl_fdt.c index 26092f662406..91d926c343cc 100644 --- a/sys/dev/sdhci/sdhci_fsl_fdt.c +++ b/sys/dev/sdhci/sdhci_fsl_fdt.c @@ -493,15 +493,15 @@ sdhci_fsl_fdt_switch_vccq(device_t brdev, device_t reqdev) struct sdhci_slot *slot; int uvolt, err; - err = sdhci_generic_switch_vccq(brdev, reqdev); - if (err != 0) - return (err); - sc = device_get_softc(brdev); if (sc->fdt_helper.vqmmc_supply == NULL) return EOPNOTSUPP; + err = sdhci_generic_switch_vccq(brdev, reqdev); + if (err != 0) + return (err); + slot = device_get_ivars(reqdev); switch (slot->host.ios.vccq) { case vccq_180: From owner-dev-commits-src-all@freebsd.org Thu May 20 09:22:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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 317E8639A68; Thu, 20 May 2021 09:22: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 4Fm45Z0Gl3z4rms; Thu, 20 May 2021 09:22: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 B3F2423980; Thu, 20 May 2021 09:22: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 14K9Mf7X058309; Thu, 20 May 2021 09:22:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14K9MfXQ058308; Thu, 20 May 2021 09:22:41 GMT (envelope-from git) Date: Thu, 20 May 2021 09:22:41 GMT Message-Id: <202105200922.14K9MfXQ058308@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 240429103cd0 - main - Rename ofwpci.c to ofw_pcib.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 240429103cd05bcecb20fbfd8310cf3faff39681 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 09:22:42 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=240429103cd05bcecb20fbfd8310cf3faff39681 commit 240429103cd05bcecb20fbfd8310cf3faff39681 Author: Marcin Wojtas AuthorDate: 2021-05-19 15:27:42 +0000 Commit: Marcin Wojtas CommitDate: 2021-05-20 09:22:25 +0000 Rename ofwpci.c to ofw_pcib.c It's a class0 driver that implements some pcib methods and creates a pci bus as its children. The "ofw_pci" name will be used by a new driver that will be a subclass of the pci bus. No functional changes intended. Submitted by: Kornel Duleba Reviewed by: andrew Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D30226 --- sys/arm/nvidia/tegra_pcie.c | 4 +- sys/arm64/rockchip/rk_pcie.c | 4 +- sys/conf/files.arm | 2 +- sys/conf/files.arm64 | 2 +- sys/conf/files.i386 | 2 +- sys/conf/files.mips | 2 +- sys/conf/files.powerpc | 2 +- sys/conf/files.riscv | 2 +- sys/dev/ofw/{ofwpci.c => ofw_pcib.c} | 102 +++++++++++++++++------------------ sys/dev/ofw/ofwpci.h | 14 ++--- sys/dev/pci/pci_dw.c | 4 +- sys/powerpc/mpc85xx/pci_mpc85xx.c | 6 +-- sys/powerpc/powermac/cpcht.c | 4 +- sys/powerpc/powermac/grackle.c | 4 +- sys/powerpc/powermac/uninorthpci.c | 4 +- sys/powerpc/powernv/opal_pci.c | 6 +-- sys/powerpc/pseries/rtas_pci.c | 4 +- 17 files changed, 84 insertions(+), 84 deletions(-) diff --git a/sys/arm/nvidia/tegra_pcie.c b/sys/arm/nvidia/tegra_pcie.c index 44eb682a40b4..aa488bb8c0e4 100644 --- a/sys/arm/nvidia/tegra_pcie.c +++ b/sys/arm/nvidia/tegra_pcie.c @@ -1533,7 +1533,7 @@ tegra_pcib_attach(device_t dev) } sc->ofw_pci.sc_range_mask = 0x3; - rv = ofw_pci_init(dev); + rv = ofw_pcib_init(dev); if (rv != 0) goto out; @@ -1625,6 +1625,6 @@ static device_method_t tegra_pcib_methods[] = { static devclass_t pcib_devclass; DEFINE_CLASS_1(pcib, tegra_pcib_driver, tegra_pcib_methods, - sizeof(struct tegra_pcib_softc), ofw_pci_driver); + sizeof(struct tegra_pcib_softc), ofw_pcib_driver); DRIVER_MODULE(tegra_pcib, simplebus, tegra_pcib_driver, pcib_devclass, NULL, NULL); diff --git a/sys/arm64/rockchip/rk_pcie.c b/sys/arm64/rockchip/rk_pcie.c index ea4ce5b568e6..dabd7931e442 100644 --- a/sys/arm64/rockchip/rk_pcie.c +++ b/sys/arm64/rockchip/rk_pcie.c @@ -1276,7 +1276,7 @@ rk_pcie_attach(device_t dev) if (rv != 0) goto out; - rv = ofw_pci_init(dev); + rv = ofw_pcib_init(dev); if (rv != 0) goto out; @@ -1383,7 +1383,7 @@ static device_method_t rk_pcie_methods[] = { }; DEFINE_CLASS_1(pcib, rk_pcie_driver, rk_pcie_methods, - sizeof(struct rk_pcie_softc), ofw_pci_driver); + sizeof(struct rk_pcie_softc), ofw_pcib_driver); static devclass_t rk_pcie_devclass; DRIVER_MODULE( rk_pcie, simplebus, rk_pcie_driver, rk_pcie_devclass, NULL, NULL); diff --git a/sys/conf/files.arm b/sys/conf/files.arm index ad7a8ddd1fe3..e2af76567549 100644 --- a/sys/conf/files.arm +++ b/sys/conf/files.arm @@ -91,7 +91,7 @@ dev/hwpmc/hwpmc_arm.c optional hwpmc dev/hwpmc/hwpmc_armv7.c optional hwpmc armv6 dev/hwpmc/hwpmc_armv7.c optional hwpmc armv7 dev/iicbus/twsi/twsi.c optional twsi -dev/ofw/ofwpci.c optional fdt pci +dev/ofw/ofw_pcib.c optional fdt pci dev/pci/pci_host_generic.c optional pci_host_generic pci dev/pci/pci_host_generic_fdt.c optional pci_host_generic pci fdt dev/psci/psci.c optional psci diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 3b0266736d7a..fed33562b834 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -245,7 +245,7 @@ dev/neta/if_mvneta_fdt.c optional neta fdt dev/neta/if_mvneta.c optional neta mdio mii dev/ofw/ofw_cpu.c optional fdt -dev/ofw/ofwpci.c optional fdt pci +dev/ofw/ofw_pcib.c optional fdt pci dev/pci/controller/pci_n1sdp.c optional pci_n1sdp acpi dev/pci/pci_host_generic.c optional pci diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index f09e7d5844f0..331ad5fec79a 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -115,7 +115,7 @@ dev/ntb/ntb_hw/ntb_hw_intel.c optional ntb_hw_intel | ntb_hw dev/ntb/ntb_hw/ntb_hw_plx.c optional ntb_hw_plx | ntb_hw dev/ntb/test/ntb_tool.c optional ntb_tool dev/nvram/nvram.c optional nvram isa -dev/ofw/ofwpci.c optional fdt pci +dev/ofw/ofw_pcib.c optional fdt pci dev/pcf/pcf_isa.c optional pcf dev/random/ivy.c optional rdrand_rng !random_loadable dev/random/nehemiah.c optional padlock_rng !random_loadable diff --git a/sys/conf/files.mips b/sys/conf/files.mips index 7ee5b0019bd7..6211c90f4e7e 100644 --- a/sys/conf/files.mips +++ b/sys/conf/files.mips @@ -96,7 +96,7 @@ dev/hwpmc/hwpmc_mips24k.c optional hwpmc_mips24k dev/hwpmc/hwpmc_mips74k.c optional hwpmc_mips74k # ofw support -dev/ofw/ofwpci.c optional fdt pci +dev/ofw/ofw_pcib.c optional fdt pci # INTRNG support code kern/msi_if.m optional intrng diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc index 19c97c34fa86..a57367a23017 100644 --- a/sys/conf/files.powerpc +++ b/sys/conf/files.powerpc @@ -90,7 +90,7 @@ dev/ofw/ofw_bus_subr.c standard dev/ofw/ofw_console.c optional aim dev/ofw/ofw_disk.c optional ofwd aim dev/ofw/ofwbus.c standard -dev/ofw/ofwpci.c optional pci +dev/ofw/ofw_pcib.c optional pci dev/ofw/ofw_standard.c optional aim powerpc dev/ofw/ofw_subr.c standard dev/powermac_nvram/powermac_nvram.c optional powermac_nvram powermac diff --git a/sys/conf/files.riscv b/sys/conf/files.riscv index c2d911cd68de..cf7b58bfe4e3 100644 --- a/sys/conf/files.riscv +++ b/sys/conf/files.riscv @@ -4,7 +4,7 @@ cddl/dev/dtrace/riscv/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" cddl/dev/fbt/riscv/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}" crypto/des/des_enc.c optional netsmb dev/ofw/ofw_cpu.c optional fdt -dev/ofw/ofwpci.c optional pci fdt +dev/ofw/ofw_pcib.c optional pci fdt dev/pci/pci_host_generic.c optional pci dev/pci/pci_host_generic_fdt.c optional pci fdt dev/uart/uart_cpu_fdt.c optional uart fdt diff --git a/sys/dev/ofw/ofwpci.c b/sys/dev/ofw/ofw_pcib.c similarity index 83% rename from sys/dev/ofw/ofwpci.c rename to sys/dev/ofw/ofw_pcib.c index a912da6698a0..1de5a884ebc9 100644 --- a/sys/dev/ofw/ofwpci.c +++ b/sys/dev/ofw/ofw_pcib.c @@ -66,77 +66,77 @@ __FBSDID("$FreeBSD$"); /* * bus interface. */ -static struct resource * ofw_pci_alloc_resource(device_t, device_t, +static struct resource * ofw_pcib_alloc_resource(device_t, device_t, int, int *, rman_res_t, rman_res_t, rman_res_t, u_int); -static int ofw_pci_release_resource(device_t, device_t, int, int, +static int ofw_pcib_release_resource(device_t, device_t, int, int, struct resource *); -static int ofw_pci_activate_resource(device_t, device_t, int, int, +static int ofw_pcib_activate_resource(device_t, device_t, int, int, struct resource *); -static int ofw_pci_deactivate_resource(device_t, device_t, int, int, +static int ofw_pcib_deactivate_resource(device_t, device_t, int, int, struct resource *); -static int ofw_pci_adjust_resource(device_t, device_t, int, +static int ofw_pcib_adjust_resource(device_t, device_t, int, struct resource *, rman_res_t, rman_res_t); -static int ofw_pci_translate_resource(device_t bus, int type, +static int ofw_pcib_translate_resource(device_t bus, int type, rman_res_t start, rman_res_t *newstart); #ifdef __powerpc__ -static bus_space_tag_t ofw_pci_bus_get_bus_tag(device_t, device_t); +static bus_space_tag_t ofw_pcib_bus_get_bus_tag(device_t, device_t); #endif /* * pcib interface */ -static int ofw_pci_maxslots(device_t); +static int ofw_pcib_maxslots(device_t); /* * ofw_bus interface */ -static phandle_t ofw_pci_get_node(device_t, device_t); +static phandle_t ofw_pcib_get_node(device_t, device_t); /* * local methods */ -static int ofw_pci_fill_ranges(phandle_t, struct ofw_pci_range *); -static struct rman *ofw_pci_get_rman(struct ofw_pci_softc *, int, u_int); +static int ofw_pcib_fill_ranges(phandle_t, struct ofw_pci_range *); +static struct rman *ofw_pcib_get_rman(struct ofw_pci_softc *, int, u_int); /* * Driver methods. */ -static device_method_t ofw_pci_methods[] = { +static device_method_t ofw_pcib_methods[] = { /* Device interface */ - DEVMETHOD(device_attach, ofw_pci_attach), + DEVMETHOD(device_attach, ofw_pcib_attach), /* Bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_read_ivar, ofw_pci_read_ivar), - DEVMETHOD(bus_write_ivar, ofw_pci_write_ivar), + DEVMETHOD(bus_read_ivar, ofw_pcib_read_ivar), + DEVMETHOD(bus_write_ivar, ofw_pcib_write_ivar), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - DEVMETHOD(bus_alloc_resource, ofw_pci_alloc_resource), - DEVMETHOD(bus_release_resource, ofw_pci_release_resource), - DEVMETHOD(bus_activate_resource, ofw_pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, ofw_pci_deactivate_resource), - DEVMETHOD(bus_adjust_resource, ofw_pci_adjust_resource), - DEVMETHOD(bus_translate_resource, ofw_pci_translate_resource), + DEVMETHOD(bus_alloc_resource, ofw_pcib_alloc_resource), + DEVMETHOD(bus_release_resource, ofw_pcib_release_resource), + DEVMETHOD(bus_activate_resource, ofw_pcib_activate_resource), + DEVMETHOD(bus_deactivate_resource, ofw_pcib_deactivate_resource), + DEVMETHOD(bus_adjust_resource, ofw_pcib_adjust_resource), + DEVMETHOD(bus_translate_resource, ofw_pcib_translate_resource), #ifdef __powerpc__ - DEVMETHOD(bus_get_bus_tag, ofw_pci_bus_get_bus_tag), + DEVMETHOD(bus_get_bus_tag, ofw_pcib_bus_get_bus_tag), #endif /* pcib interface */ - DEVMETHOD(pcib_maxslots, ofw_pci_maxslots), - DEVMETHOD(pcib_route_interrupt, ofw_pci_route_interrupt), + DEVMETHOD(pcib_maxslots, ofw_pcib_maxslots), + DEVMETHOD(pcib_route_interrupt, ofw_pcib_route_interrupt), DEVMETHOD(pcib_request_feature, pcib_request_feature_allow), /* ofw_bus interface */ - DEVMETHOD(ofw_bus_get_node, ofw_pci_get_node), + DEVMETHOD(ofw_bus_get_node, ofw_pcib_get_node), DEVMETHOD_END }; -DEFINE_CLASS_0(ofw_pci, ofw_pci_driver, ofw_pci_methods, 0); +DEFINE_CLASS_0(ofw_pcib, ofw_pcib_driver, ofw_pcib_methods, 0); int -ofw_pci_init(device_t dev) +ofw_pcib_init(device_t dev) { struct ofw_pci_softc *sc; phandle_t node; @@ -169,7 +169,7 @@ ofw_pci_init(device_t dev) sc->sc_nrange = 0; for (c = OF_child(node); c != 0; c = OF_peer(c)) { - n = ofw_pci_nranges(c, cell_info); + n = ofw_pcib_nranges(c, cell_info); if (n > 0) sc->sc_nrange += n; } @@ -181,13 +181,13 @@ ofw_pci_init(device_t dev) M_DEVBUF, M_WAITOK); i = 0; for (c = OF_child(node); c != 0; c = OF_peer(c)) { - n = ofw_pci_fill_ranges(c, &sc->sc_range[i]); + n = ofw_pcib_fill_ranges(c, &sc->sc_range[i]); if (n > 0) i += n; } KASSERT(i == sc->sc_nrange, ("range count mismatch")); } else { - sc->sc_nrange = ofw_pci_nranges(node, cell_info); + sc->sc_nrange = ofw_pcib_nranges(node, cell_info); if (sc->sc_nrange <= 0) { device_printf(dev, "could not getranges\n"); error = ENXIO; @@ -195,7 +195,7 @@ ofw_pci_init(device_t dev) } sc->sc_range = malloc(sc->sc_nrange * sizeof(sc->sc_range[0]), M_DEVBUF, M_WAITOK); - ofw_pci_fill_ranges(node, sc->sc_range); + ofw_pcib_fill_ranges(node, sc->sc_range); } sc->sc_io_rman.rm_type = RMAN_ARRAY; @@ -272,14 +272,14 @@ out: } int -ofw_pci_attach(device_t dev) +ofw_pcib_attach(device_t dev) { struct ofw_pci_softc *sc; int error; sc = device_get_softc(dev); if (!sc->sc_initialized) { - error = ofw_pci_init(dev); + error = ofw_pcib_init(dev); if (error != 0) return (error); } @@ -289,14 +289,14 @@ ofw_pci_attach(device_t dev) } static int -ofw_pci_maxslots(device_t dev) +ofw_pcib_maxslots(device_t dev) { return (PCI_SLOTMAX); } int -ofw_pci_route_interrupt(device_t bus, device_t dev, int pin) +ofw_pcib_route_interrupt(device_t bus, device_t dev, int pin) { struct ofw_pci_softc *sc; struct ofw_pci_register reg; @@ -333,7 +333,7 @@ ofw_pci_route_interrupt(device_t bus, device_t dev, int pin) } int -ofw_pci_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) +ofw_pcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) { struct ofw_pci_softc *sc; @@ -354,7 +354,7 @@ ofw_pci_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) } int -ofw_pci_write_ivar(device_t dev, device_t child, int which, uintptr_t value) +ofw_pcib_write_ivar(device_t dev, device_t child, int which, uintptr_t value) { struct ofw_pci_softc *sc; @@ -372,7 +372,7 @@ ofw_pci_write_ivar(device_t dev, device_t child, int which, uintptr_t value) } int -ofw_pci_nranges(phandle_t node, struct ofw_pci_cell_info *info) +ofw_pcib_nranges(phandle_t node, struct ofw_pci_cell_info *info) { ssize_t nbase_ranges; @@ -400,7 +400,7 @@ ofw_pci_nranges(phandle_t node, struct ofw_pci_cell_info *info) } static struct resource * -ofw_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, +ofw_pcib_alloc_resource(device_t bus, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct ofw_pci_softc *sc; @@ -420,7 +420,7 @@ ofw_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, } #endif - rm = ofw_pci_get_rman(sc, type, flags); + rm = ofw_pcib_get_rman(sc, type, flags); if (rm == NULL) { return (bus_generic_alloc_resource(bus, child, type, rid, start, end, count, flags | needactivate)); @@ -449,7 +449,7 @@ ofw_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, } static int -ofw_pci_release_resource(device_t bus, device_t child, int type, int rid, +ofw_pcib_release_resource(device_t bus, device_t child, int type, int rid, struct resource *res) { struct ofw_pci_softc *sc; @@ -464,7 +464,7 @@ ofw_pci_release_resource(device_t bus, device_t child, int type, int rid, res)); #endif - rm = ofw_pci_get_rman(sc, type, rman_get_flags(res)); + rm = ofw_pcib_get_rman(sc, type, rman_get_flags(res)); if (rm == NULL) { return (bus_generic_release_resource(bus, child, type, rid, res)); @@ -480,7 +480,7 @@ ofw_pci_release_resource(device_t bus, device_t child, int type, int rid, } static int -ofw_pci_translate_resource(device_t bus, int type, rman_res_t start, +ofw_pcib_translate_resource(device_t bus, int type, rman_res_t start, rman_res_t *newstart) { struct ofw_pci_softc *sc; @@ -519,7 +519,7 @@ ofw_pci_translate_resource(device_t bus, int type, rman_res_t start, } static int -ofw_pci_activate_resource(device_t bus, device_t child, int type, int rid, +ofw_pcib_activate_resource(device_t bus, device_t child, int type, int rid, struct resource *res) { struct ofw_pci_softc *sc; @@ -587,7 +587,7 @@ ofw_pci_activate_resource(device_t bus, device_t child, int type, int rid, #ifdef __powerpc__ static bus_space_tag_t -ofw_pci_bus_get_bus_tag(device_t bus, device_t child) +ofw_pcib_bus_get_bus_tag(device_t bus, device_t child) { return (&bs_le_tag); @@ -595,7 +595,7 @@ ofw_pci_bus_get_bus_tag(device_t bus, device_t child) #endif static int -ofw_pci_deactivate_resource(device_t bus, device_t child, int type, int rid, +ofw_pcib_deactivate_resource(device_t bus, device_t child, int type, int rid, struct resource *res) { vm_size_t psize; @@ -612,7 +612,7 @@ ofw_pci_deactivate_resource(device_t bus, device_t child, int type, int rid, } static int -ofw_pci_adjust_resource(device_t bus, device_t child, int type, +ofw_pcib_adjust_resource(device_t bus, device_t child, int type, struct resource *res, rman_res_t start, rman_res_t end) { struct rman *rm; @@ -625,7 +625,7 @@ ofw_pci_adjust_resource(device_t bus, device_t child, int type, start, end)); #endif - rm = ofw_pci_get_rman(sc, type, rman_get_flags(res)); + rm = ofw_pcib_get_rman(sc, type, rman_get_flags(res)); if (rm == NULL) { return (bus_generic_adjust_resource(bus, child, type, res, start, end)); @@ -638,7 +638,7 @@ ofw_pci_adjust_resource(device_t bus, device_t child, int type, } static phandle_t -ofw_pci_get_node(device_t bus, device_t dev) +ofw_pcib_get_node(device_t bus, device_t dev) { struct ofw_pci_softc *sc; @@ -649,7 +649,7 @@ ofw_pci_get_node(device_t bus, device_t dev) } static int -ofw_pci_fill_ranges(phandle_t node, struct ofw_pci_range *ranges) +ofw_pcib_fill_ranges(phandle_t node, struct ofw_pci_range *ranges) { int host_address_cells = 1, pci_address_cells = 3, size_cells = 2; cell_t *base_ranges; @@ -696,7 +696,7 @@ ofw_pci_fill_ranges(phandle_t node, struct ofw_pci_range *ranges) } static struct rman * -ofw_pci_get_rman(struct ofw_pci_softc *sc, int type, u_int flags) +ofw_pcib_get_rman(struct ofw_pci_softc *sc, int type, u_int flags) { switch (type) { diff --git a/sys/dev/ofw/ofwpci.h b/sys/dev/ofw/ofwpci.h index 3257fe68d49b..d58efa2daaef 100644 --- a/sys/dev/ofw/ofwpci.h +++ b/sys/dev/ofw/ofwpci.h @@ -32,7 +32,7 @@ /* * Export class definition for inheritance purposes */ -DECLARE_CLASS(ofw_pci_driver); +DECLARE_CLASS(ofw_pcib_driver); struct ofw_pci_cell_info { pcell_t host_address_cells; @@ -77,11 +77,11 @@ struct ofw_pci_softc { struct ofw_bus_iinfo sc_pci_iinfo; }; -int ofw_pci_init(device_t); -int ofw_pci_attach(device_t); -int ofw_pci_read_ivar(device_t, device_t, int, uintptr_t *); -int ofw_pci_write_ivar(device_t, device_t, int, uintptr_t); -int ofw_pci_route_interrupt(device_t, device_t, int); -int ofw_pci_nranges(phandle_t, struct ofw_pci_cell_info *); +int ofw_pcib_init(device_t); +int ofw_pcib_attach(device_t); +int ofw_pcib_read_ivar(device_t, device_t, int, uintptr_t *); +int ofw_pcib_write_ivar(device_t, device_t, int, uintptr_t); +int ofw_pcib_route_interrupt(device_t, device_t, int); +int ofw_pcib_nranges(phandle_t, struct ofw_pci_cell_info *); #endif /* _DEV_OFW_OFWPCI_H_ */ diff --git a/sys/dev/pci/pci_dw.c b/sys/dev/pci/pci_dw.c index f0aae5bf8418..47324eb70c8a 100644 --- a/sys/dev/pci/pci_dw.c +++ b/sys/dev/pci/pci_dw.c @@ -638,7 +638,7 @@ pci_dw_init(device_t dev) if (rv != 0) goto out; - rv = ofw_pci_init(dev); + rv = ofw_pcib_init(dev); if (rv != 0) goto out; rv = pci_dw_decode_ranges(sc, sc->ofw_pci.sc_range, @@ -686,4 +686,4 @@ static device_method_t pci_dw_methods[] = { }; DEFINE_CLASS_1(pcib, pci_dw_driver, pci_dw_methods, - sizeof(struct pci_dw_softc), ofw_pci_driver); + sizeof(struct pci_dw_softc), ofw_pcib_driver); diff --git a/sys/powerpc/mpc85xx/pci_mpc85xx.c b/sys/powerpc/mpc85xx/pci_mpc85xx.c index b7035e372105..ced24d224860 100644 --- a/sys/powerpc/mpc85xx/pci_mpc85xx.c +++ b/sys/powerpc/mpc85xx/pci_mpc85xx.c @@ -258,7 +258,7 @@ static device_method_t fsl_pcib_methods[] = { static devclass_t fsl_pcib_devclass; DEFINE_CLASS_1(pcib, fsl_pcib_driver, fsl_pcib_methods, - sizeof(struct fsl_pcib_softc), ofw_pci_driver); + sizeof(struct fsl_pcib_softc), ofw_pcib_driver); EARLY_DRIVER_MODULE(pcib, ofwbus, fsl_pcib_driver, fsl_pcib_devclass, 0, 0, BUS_PASS_BUS); @@ -361,7 +361,7 @@ fsl_pcib_attach(device_t dev) * Initialize generic OF PCI interface (ranges, etc.) */ - error = ofw_pci_init(dev); + error = ofw_pcib_init(dev); if (error) return (error); @@ -429,7 +429,7 @@ fsl_pcib_attach(device_t dev) fsl_pcib_err_init(dev); - return (ofw_pci_attach(dev)); + return (ofw_pcib_attach(dev)); err: return (ENXIO); diff --git a/sys/powerpc/powermac/cpcht.c b/sys/powerpc/powermac/cpcht.c index a475cafb93cd..965b1eeb45e7 100644 --- a/sys/powerpc/powermac/cpcht.c +++ b/sys/powerpc/powermac/cpcht.c @@ -140,7 +140,7 @@ struct cpcht_softc { static devclass_t cpcht_devclass; DEFINE_CLASS_1(pcib, cpcht_driver, cpcht_methods, sizeof(struct cpcht_softc), - ofw_pci_driver); + ofw_pcib_driver); EARLY_DRIVER_MODULE(cpcht, ofwbus, cpcht_driver, cpcht_devclass, 0, 0, BUS_PASS_BUS); @@ -212,7 +212,7 @@ cpcht_attach(device_t dev) /* Now make the mapping table available to the MPIC */ cpcht_irqmap = sc->htirq_map; - return (ofw_pci_attach(dev)); + return (ofw_pcib_attach(dev)); } static void diff --git a/sys/powerpc/powermac/grackle.c b/sys/powerpc/powermac/grackle.c index af5f5a389998..d3eb9ded1736 100644 --- a/sys/powerpc/powermac/grackle.c +++ b/sys/powerpc/powermac/grackle.c @@ -100,7 +100,7 @@ static device_method_t grackle_methods[] = { static devclass_t grackle_devclass; DEFINE_CLASS_1(pcib, grackle_driver, grackle_methods, - sizeof(struct grackle_softc), ofw_pci_driver); + sizeof(struct grackle_softc), ofw_pcib_driver); DRIVER_MODULE(grackle, ofwbus, grackle_driver, grackle_devclass, 0, 0); static int @@ -137,7 +137,7 @@ grackle_attach(device_t dev) sc->sc_addr = (vm_offset_t)pmap_mapdev(GRACKLE_ADDR, PAGE_SIZE); sc->sc_data = (vm_offset_t)pmap_mapdev(GRACKLE_DATA, PAGE_SIZE); - return (ofw_pci_attach(dev)); + return (ofw_pcib_attach(dev)); } static u_int32_t diff --git a/sys/powerpc/powermac/uninorthpci.c b/sys/powerpc/powermac/uninorthpci.c index 8933693963f5..508bcd29df0e 100644 --- a/sys/powerpc/powermac/uninorthpci.c +++ b/sys/powerpc/powermac/uninorthpci.c @@ -100,7 +100,7 @@ static device_method_t uninorth_methods[] = { static devclass_t uninorth_devclass; DEFINE_CLASS_1(pcib, uninorth_driver, uninorth_methods, - sizeof(struct uninorth_softc), ofw_pci_driver); + sizeof(struct uninorth_softc), ofw_pcib_driver); EARLY_DRIVER_MODULE(uninorth, ofwbus, uninorth_driver, uninorth_devclass, 0, 0, BUS_PASS_BUS); @@ -176,7 +176,7 @@ uninorth_attach(device_t dev) mtx_init(&sc->sc_cfg_mtx, "uninorth pcicfg", NULL, MTX_SPIN); - return (ofw_pci_attach(dev)); + return (ofw_pcib_attach(dev)); } static u_int32_t diff --git a/sys/powerpc/powernv/opal_pci.c b/sys/powerpc/powernv/opal_pci.c index 7bbffdff8e62..cbaa638863c7 100644 --- a/sys/powerpc/powernv/opal_pci.c +++ b/sys/powerpc/powernv/opal_pci.c @@ -169,7 +169,7 @@ struct opalpci_softc { static devclass_t opalpci_devclass; DEFINE_CLASS_1(pcib, opalpci_driver, opalpci_methods, - sizeof(struct opalpci_softc), ofw_pci_driver); + sizeof(struct opalpci_softc), ofw_pcib_driver); EARLY_DRIVER_MODULE(opalpci, ofwbus, opalpci_driver, opalpci_devclass, 0, 0, BUS_PASS_BUS); @@ -464,7 +464,7 @@ opalpci_attach(device_t dev) /* * General OFW PCI attach */ - err = ofw_pci_init(dev); + err = ofw_pcib_init(dev); if (err != 0) return (err); @@ -496,7 +496,7 @@ opalpci_attach(device_t dev) rp->pci + rp->size - 1); } - return (ofw_pci_attach(dev)); + return (ofw_pcib_attach(dev)); } static uint32_t diff --git a/sys/powerpc/pseries/rtas_pci.c b/sys/powerpc/pseries/rtas_pci.c index 97ece878aa7b..3c03724cf3d6 100644 --- a/sys/powerpc/pseries/rtas_pci.c +++ b/sys/powerpc/pseries/rtas_pci.c @@ -101,7 +101,7 @@ struct rtaspci_softc { static devclass_t rtaspci_devclass; DEFINE_CLASS_1(pcib, rtaspci_driver, rtaspci_methods, - sizeof(struct rtaspci_softc), ofw_pci_driver); + sizeof(struct rtaspci_softc), ofw_pcib_driver); DRIVER_MODULE(rtaspci, ofwbus, rtaspci_driver, rtaspci_devclass, 0, 0); static int @@ -143,7 +143,7 @@ rtaspci_attach(device_t dev) OF_getencprop(ofw_bus_get_node(dev), "ibm,pci-config-space-type", &sc->sc_extended_config, sizeof(sc->sc_extended_config)); - return (ofw_pci_attach(dev)); + return (ofw_pcib_attach(dev)); } static uint32_t From owner-dev-commits-src-all@freebsd.org Thu May 20 09:51:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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 83A3B63A586; Thu, 20 May 2021 09:51:36 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fm4kw3R8Nz3NFF; Thu, 20 May 2021 09:51:36 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 4073727A95; Thu, 20 May 2021 09:51:36 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 6771C2A691; Thu, 20 May 2021 11:51:34 +0200 (CEST) From: "Kristof Provost" To: "Wojciech Macek" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: d1cd99b14741 - main - ip_mroute: refactor bw_meter API Date: Thu, 20 May 2021 11:51:33 +0200 X-Mailer: MailMate (1.13.2r5673) Message-ID: <56731159-4265-4869-B253-F6FBFE573E71@FreeBSD.org> In-Reply-To: <202105200814.14K8EIfh065072@gitrepo.freebsd.org> References: <202105200814.14K8EIfh065072@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 09:51:36 -0000 Hi Wojciech, On 20 May 2021, at 10:14, Wojciech Macek wrote: > The branch main has been updated by wma: > > URL: = > https://cgit.FreeBSD.org/src/commit/?id=3Dd1cd99b147411b331a9bff6595337= 80ef297ef58 > > commit d1cd99b147411b331a9bff659533780ef297ef58 > Author: Wojciech Macek > AuthorDate: 2021-05-05 03:28:56 +0000 > Commit: Wojciech Macek > CommitDate: 2021-05-20 08:13:55 +0000 > > ip_mroute: refactor bw_meter API > It looks like this fails to build: = https://ci.freebsd.org/job/FreeBSD-main-amd64-build/20963/console Best regards, Kristof From owner-dev-commits-src-all@freebsd.org Thu May 20 10:13:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 52BF863A6E2 for ; Thu, 20 May 2021 10:13:33 +0000 (UTC) (envelope-from wma@semihalf.com) Received: from mail-yb1-xb29.google.com (mail-yb1-xb29.google.com [IPv6:2607:f8b0:4864:20::b29]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fm5DF0yrdz3mMg for ; Thu, 20 May 2021 10:13:32 +0000 (UTC) (envelope-from wma@semihalf.com) Received: by mail-yb1-xb29.google.com with SMTP id n4so3594358ybf.5 for ; Thu, 20 May 2021 03:13:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kRqvFCrdnE3cCamfUHp3DBs5VkAmL1jf7KOu7a/8iGM=; b=i4bPcjysZfNGkw0axUOSlARtBn5A/kpWfdxzLdXSo99sZePwF19+uj8ckbROqEsbGq dXwhthR8gjpLWz+FSoz/ncc8JCo2FB6gKaaKvKNKg65EDhgMoIle6fcWRvdeYT4/iLJa Q6RHtf0ohdgUHUXnazHiwDbTkw1xDtiewVn9bENqgQ23DvggaxF5se2dsYKVAS+NLstg eFfmPzY5xEtfm8PsjZi6wX7qatEegPWEvIOA7aJDBJZ27K3T7eZ+vRQJjrBUlVwcQE8s qLpfDdEPLN1dU2AjbW+z8+IDIuAPqAsOtsZK04L2UZDOAiLvLDuOPwuGhid2yvC2T4QM zUfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kRqvFCrdnE3cCamfUHp3DBs5VkAmL1jf7KOu7a/8iGM=; b=tvmK0SDrkij7ztkKH2tLlDIVMiQWnixdLAk0WuguR/PzJppbboAE7yDNDjuCHXRqEk WjKH/KuHQ99os1STYivNOHJrxn933uX3/sm/CHnQdsvDUpO5rX9YbI5BLm2srerSH4fr 2XOdJXUc57nn/wwswep6bNeo43lN2QrX13HJsToUC8giRtXjKBasm0ixmKhTjsYkPY8+ LaWXeAtArUXklwJICxZCp8lBjw2n+mpxAJeMFYV81194bGP1ZaXgiH/3D1b9z5rD16Gl ZtH0SasCD1ArPvmEnjEufLVA30tFGw95OLqCeNrdVWuaqFeXrwr3RpeRE6LzyoyTiJgA J+Yw== X-Gm-Message-State: AOAM532vLAsKfTwdWK5L9LEffXn42iv/mpqhA8eOfHgZlwePcfrBhvXC /46W8jeGcMfuS95A4FmZXAhzvgHH50hY/uen0RVPAA== X-Google-Smtp-Source: ABdhPJxtl6GRSMYHU2TuYzit94xyU8DBvfXLjBfwjLw0dDJFAu7bO/EfPH3XWYps8flvIblm92GPxAnnQBfaeLWgOIg= X-Received: by 2002:a25:af0d:: with SMTP id a13mr6214802ybh.14.1621505612132; Thu, 20 May 2021 03:13:32 -0700 (PDT) MIME-Version: 1.0 References: <202105200814.14K8EIfh065072@gitrepo.freebsd.org> <56731159-4265-4869-B253-F6FBFE573E71@FreeBSD.org> In-Reply-To: <56731159-4265-4869-B253-F6FBFE573E71@FreeBSD.org> From: Wojciech Macek Date: Thu, 20 May 2021 12:13:21 +0200 Message-ID: Subject: Re: git: d1cd99b14741 - main - ip_mroute: refactor bw_meter API To: Kristof Provost Cc: Wojciech Macek , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4Fm5DF0yrdz3mMg X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 10:13:33 -0000 Sorry, I will handle it. For now I'm going to revert it and push a fixed one tomorrow. Wojtek czw., 20 maj 2021 o 11:51 Kristof Provost napisa=C5=82(a): > Hi Wojciech, > > On 20 May 2021, at 10:14, Wojciech Macek wrote: > > The branch main has been updated by wma: > > > > URL: > > > https://cgit.FreeBSD.org/src/commit/?id=3Dd1cd99b147411b331a9bff659533780= ef297ef58 > > > > commit d1cd99b147411b331a9bff659533780ef297ef58 > > Author: Wojciech Macek > > AuthorDate: 2021-05-05 03:28:56 +0000 > > Commit: Wojciech Macek > > CommitDate: 2021-05-20 08:13:55 +0000 > > > > ip_mroute: refactor bw_meter API > > > It looks like this fails to build: > https://ci.freebsd.org/job/FreeBSD-main-amd64-build/20963/console > > Best regards, > Kristof > From owner-dev-commits-src-all@freebsd.org Thu May 20 10:15:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E014263AB9C; Thu, 20 May 2021 10:15: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 4Fm5G65B9Yz3nMY; Thu, 20 May 2021 10:15: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 8209F23FC4; Thu, 20 May 2021 10:15: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 14KAFACI025534; Thu, 20 May 2021 10:15:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KAFAq5025533; Thu, 20 May 2021 10:15:10 GMT (envelope-from git) Date: Thu, 20 May 2021 10:15:10 GMT Message-Id: <202105201015.14KAFAq5025533@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 787845c0e8e8 - main - Revert "ip_mroute: refactor bw_meter API" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 787845c0e8e831bf5b2d000950241cb23c16ca45 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 10:15:11 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=787845c0e8e831bf5b2d000950241cb23c16ca45 commit 787845c0e8e831bf5b2d000950241cb23c16ca45 Author: Wojciech Macek AuthorDate: 2021-05-20 10:14:58 +0000 Commit: Wojciech Macek CommitDate: 2021-05-20 10:14:58 +0000 Revert "ip_mroute: refactor bw_meter API" This reverts commit d1cd99b147411b331a9bff659533780ef297ef58. --- sys/netinet/ip_mroute.c | 610 +++++++++++++++++++++++++++++++----------------- sys/netinet/ip_mroute.h | 10 +- 2 files changed, 400 insertions(+), 220 deletions(-) diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index 0cb980b7247e..b8e677ba9af1 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -49,7 +49,6 @@ * Modified by Pavlin Radoslavov, USC/ISI, May 1998, August 1999, October 2000 * Modified by Hitoshi Asaeda, WIDE, August 2000 * Modified by Pavlin Radoslavov, ICSI, October 2002 - * Modified by Wojciech Macek, Semihalf, May 2021 * * MROUTING Revision: 3.5 * and PIM-SMv2 and PIM-DM support, advanced API support, @@ -203,6 +202,16 @@ VNET_DEFINE_STATIC(struct callout, expire_upcalls_ch); * Bandwidth meter variables and constants */ static MALLOC_DEFINE(M_BWMETER, "bwmeter", "multicast upcall bw meters"); +/* + * Pending timeouts are stored in a hash table, the key being the + * expiration time. Periodically, the entries are analysed and processed. + */ +#define BW_METER_BUCKETS 1024 +VNET_DEFINE_STATIC(struct bw_meter **, bw_meter_timers); +#define V_bw_meter_timers VNET(bw_meter_timers) +VNET_DEFINE_STATIC(struct callout, bw_meter_ch); +#define V_bw_meter_ch VNET(bw_meter_ch) +#define BW_METER_PERIOD (hz) /* periodical handling of bw meters */ /* * Pending upcalls are stored in a vector which is flushed when @@ -311,13 +320,14 @@ static int add_mfc(struct mfcctl2 *); static int add_vif(struct vifctl *); static void bw_meter_prepare_upcall(struct bw_meter *, struct timeval *); static void bw_meter_process(void); -static void bw_meter_geq_receive_packet(struct bw_meter *, int, +static void bw_meter_receive_packet(struct bw_meter *, int, struct timeval *); static void bw_upcalls_send(void); static int del_bw_upcall(struct bw_upcall *); static int del_mfc(struct mfcctl2 *); static int del_vif(vifi_t); static int del_vif_locked(vifi_t); +static void expire_bw_meter_process(void *); static void expire_bw_upcalls_send(void *); static void expire_mfc(struct mfc *); static void expire_upcalls(void *); @@ -675,6 +685,8 @@ ip_mrouter_init(struct socket *so, int version) curvnet); callout_reset(&V_bw_upcalls_ch, BW_UPCALLS_PERIOD, expire_bw_upcalls_send, curvnet); + callout_reset(&V_bw_meter_ch, BW_METER_PERIOD, expire_bw_meter_process, + curvnet); V_ip_mrouter = so; ip_mrouter_cnt++; @@ -733,6 +745,7 @@ X_ip_mrouter_done(void) callout_stop(&V_expire_upcalls_ch); callout_stop(&V_bw_upcalls_ch); + callout_stop(&V_bw_meter_ch); MFC_LOCK(); @@ -753,6 +766,7 @@ X_ip_mrouter_done(void) bzero(V_nexpire, sizeof(V_nexpire[0]) * mfchashsize); V_bw_upcalls_n = 0; + bzero(V_bw_meter_timers, BW_METER_BUCKETS * sizeof(*V_bw_meter_timers)); MFC_UNLOCK(); @@ -1022,8 +1036,7 @@ expire_mfc(struct mfc *rt) MFC_LOCK_ASSERT(); - free_bw_list(rt->mfc_bw_meter_leq); - free_bw_list(rt->mfc_bw_meter_geq); + free_bw_list(rt->mfc_bw_meter); TAILQ_FOREACH_SAFE(rte, &rt->mfc_stall, rte_link, nrte) { m_freem(rte->m); @@ -1126,8 +1139,7 @@ add_mfc(struct mfcctl2 *mfccp) rt->mfc_nstall = 0; rt->mfc_expire = 0; - rt->mfc_bw_meter_leq = NULL; - rt->mfc_bw_meter_geq = NULL; + rt->mfc_bw_meter = NULL; /* insert new entry at head of hash chain */ LIST_INSERT_HEAD(&V_mfchashtbl[hash], rt, mfc_hash); @@ -1167,10 +1179,8 @@ del_mfc(struct mfcctl2 *mfccp) /* * free the bw_meter entries */ - free_bw_list(rt->mfc_bw_meter_leq); - rt->mfc_bw_meter_leq = NULL; - free_bw_list(rt->mfc_bw_meter_geq); - rt->mfc_bw_meter_geq = NULL; + free_bw_list(rt->mfc_bw_meter); + rt->mfc_bw_meter = NULL; LIST_REMOVE(rt, mfc_hash); free(rt, M_MRTABLE); @@ -1383,8 +1393,7 @@ fail: /* clear the RP address */ rt->mfc_rp.s_addr = INADDR_ANY; - rt->mfc_bw_meter_leq = NULL; - rt->mfc_bw_meter_geq = NULL; + rt->mfc_bw_meter = NULL; /* initialize pkt counters per src-grp */ rt->mfc_pkt_cnt = 0; @@ -1450,6 +1459,16 @@ expire_upcalls(void *arg) if (rt->mfc_expire == 0 || --rt->mfc_expire > 0) continue; + /* + * free the bw_meter entries + */ + while (rt->mfc_bw_meter != NULL) { + struct bw_meter *x = rt->mfc_bw_meter; + + rt->mfc_bw_meter = x->bm_mfc_next; + free(x, M_BWMETER); + } + MRTSTAT_INC(mrts_cache_cleanups); CTR3(KTR_IPMF, "%s: expire (%lx, %lx)", __func__, (u_long)ntohl(rt->mfc_origin.s_addr), @@ -1583,22 +1602,14 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp, struct mfc *rt, vifi_t xmt_vif) /* * Perform upcall-related bw measuring. */ - if ((rt->mfc_bw_meter_geq != NULL) || (rt->mfc_bw_meter_leq != NULL)) { + if (rt->mfc_bw_meter != NULL) { struct bw_meter *x; struct timeval now; microtime(&now); MFC_LOCK_ASSERT(); - /* Process meters for Greater-or-EQual case */ - for (x = rt->mfc_bw_meter_geq; x != NULL; x = x->bm_mfc_next) - bw_meter_geq_receive_packet(x, plen, &now); - - /* Process meters for Lower-or-EQual case */ - for (x = rt->mfc_bw_meter_leq; x != NULL; x = x->bm_mfc_next) { - /* Record that a packet is received */ - x->bm_measured.b_packets++; - x->bm_measured.b_bytes += plen; - } + for (x = rt->mfc_bw_meter; x != NULL; x = x->bm_mfc_next) + bw_meter_receive_packet(x, plen, &now); } return 0; @@ -1748,139 +1759,84 @@ compute_bw_meter_flags(struct bw_upcall *req) return flags; } -static void -expire_bw_meter_leq(void *arg) -{ - struct bw_meter *x = arg; - struct timeval now; - /* - * INFO: - * callout is always executed with MFC_LOCK taken - */ - - CURVNET_SET((struct vnet *)x->arg); - - microtime(&now); - - /* - * Test if we should deliver an upcall - */ - if (((x->bm_flags & BW_METER_UNIT_PACKETS) && - (x->bm_measured.b_packets <= x->bm_threshold.b_packets)) || - ((x->bm_flags & BW_METER_UNIT_BYTES) && - (x->bm_measured.b_bytes <= x->bm_threshold.b_bytes))) { - /* Prepare an upcall for delivery */ - bw_meter_prepare_upcall(x, &now); - } - - /* Send all upcalls that are pending delivery */ - bw_upcalls_send(); - - /* Reset counters */ - x->bm_start_time = now; - x->bm_measured.b_bytes = 0; - x->bm_measured.b_packets = 0; - - callout_schedule(&x->bm_meter_callout, tvtohz(&x->bm_threshold.b_time)); - - CURVNET_RESTORE(); -} - /* * Add a bw_meter entry */ static int add_bw_upcall(struct bw_upcall *req) { - struct mfc *mfc; - struct timeval delta = { BW_UPCALL_THRESHOLD_INTERVAL_MIN_SEC, - BW_UPCALL_THRESHOLD_INTERVAL_MIN_USEC }; - struct timeval now; - struct bw_meter *x, **bwm_ptr; - uint32_t flags; - - if (!(V_mrt_api_config & MRT_MFC_BW_UPCALL)) - return EOPNOTSUPP; - - /* Test if the flags are valid */ - if (!(req->bu_flags & (BW_UPCALL_UNIT_PACKETS | BW_UPCALL_UNIT_BYTES))) - return EINVAL; - if (!(req->bu_flags & (BW_UPCALL_GEQ | BW_UPCALL_LEQ))) - return EINVAL; - if ((req->bu_flags & (BW_UPCALL_GEQ | BW_UPCALL_LEQ)) - == (BW_UPCALL_GEQ | BW_UPCALL_LEQ)) - return EINVAL; - - /* Test if the threshold time interval is valid */ - if (BW_TIMEVALCMP(&req->bu_threshold.b_time, &delta, <)) - return EINVAL; + struct mfc *mfc; + struct timeval delta = { BW_UPCALL_THRESHOLD_INTERVAL_MIN_SEC, + BW_UPCALL_THRESHOLD_INTERVAL_MIN_USEC }; + struct timeval now; + struct bw_meter *x; + uint32_t flags; - flags = compute_bw_meter_flags(req); + if (!(V_mrt_api_config & MRT_MFC_BW_UPCALL)) + return EOPNOTSUPP; - /* - * Find if we have already same bw_meter entry - */ - MFC_LOCK(); - mfc = mfc_find(&req->bu_src, &req->bu_dst); - if (mfc == NULL) { - MFC_UNLOCK(); - return EADDRNOTAVAIL; - } + /* Test if the flags are valid */ + if (!(req->bu_flags & (BW_UPCALL_UNIT_PACKETS | BW_UPCALL_UNIT_BYTES))) + return EINVAL; + if (!(req->bu_flags & (BW_UPCALL_GEQ | BW_UPCALL_LEQ))) + return EINVAL; + if ((req->bu_flags & (BW_UPCALL_GEQ | BW_UPCALL_LEQ)) + == (BW_UPCALL_GEQ | BW_UPCALL_LEQ)) + return EINVAL; - /* Choose an appropriate bw_meter list */ - if (req->bu_flags & BW_UPCALL_GEQ) - bwm_ptr = &mfc->mfc_bw_meter_geq; - else - bwm_ptr = &mfc->mfc_bw_meter_leq; - - for (x = *bwm_ptr; x != NULL; x = x->bm_mfc_next) { - if ((BW_TIMEVALCMP(&x->bm_threshold.b_time, - &req->bu_threshold.b_time, ==)) - && (x->bm_threshold.b_packets - == req->bu_threshold.b_packets) - && (x->bm_threshold.b_bytes - == req->bu_threshold.b_bytes) - && (x->bm_flags & BW_METER_USER_FLAGS) - == flags) { - MFC_UNLOCK(); - return 0; /* XXX Already installed */ - } - } + /* Test if the threshold time interval is valid */ + if (BW_TIMEVALCMP(&req->bu_threshold.b_time, &delta, <)) + return EINVAL; - /* Allocate the new bw_meter entry */ - x = (struct bw_meter*) malloc(sizeof(*x), M_BWMETER, M_NOWAIT); - if (x == NULL) { - MFC_UNLOCK(); - return ENOBUFS; - } + flags = compute_bw_meter_flags(req); - /* Set the new bw_meter entry */ - x->bm_threshold.b_time = req->bu_threshold.b_time; - microtime(&now); - x->bm_start_time = now; - x->bm_threshold.b_packets = req->bu_threshold.b_packets; - x->bm_threshold.b_bytes = req->bu_threshold.b_bytes; - x->bm_measured.b_packets = 0; - x->bm_measured.b_bytes = 0; - x->bm_flags = flags; - x->bm_time_next = NULL; - x->bm_mfc = mfc; - x->arg = curvnet; - - /* For LEQ case create periodic callout */ - if (req->bu_flags & BW_UPCALL_LEQ) { - callout_init_mtx(&x->bm_meter_callout, &mfc_mtx,0); - callout_reset(&x->bm_meter_callout, tvtohz(&x->bm_threshold.b_time), - expire_bw_meter_leq, x); + /* + * Find if we have already same bw_meter entry + */ + MFC_LOCK(); + mfc = mfc_find(&req->bu_src, &req->bu_dst); + if (mfc == NULL) { + MFC_UNLOCK(); + return EADDRNOTAVAIL; + } + for (x = mfc->mfc_bw_meter; x != NULL; x = x->bm_mfc_next) { + if ((BW_TIMEVALCMP(&x->bm_threshold.b_time, + &req->bu_threshold.b_time, ==)) && + (x->bm_threshold.b_packets == req->bu_threshold.b_packets) && + (x->bm_threshold.b_bytes == req->bu_threshold.b_bytes) && + (x->bm_flags & BW_METER_USER_FLAGS) == flags) { + MFC_UNLOCK(); + return 0; /* XXX Already installed */ } + } - /* Add the new bw_meter entry to the front of entries for this MFC */ - x->bm_mfc_next = *bwm_ptr; - *bwm_ptr = x; - + /* Allocate the new bw_meter entry */ + x = (struct bw_meter *)malloc(sizeof(*x), M_BWMETER, M_NOWAIT); + if (x == NULL) { MFC_UNLOCK(); + return ENOBUFS; + } - return 0; + /* Set the new bw_meter entry */ + x->bm_threshold.b_time = req->bu_threshold.b_time; + microtime(&now); + x->bm_start_time = now; + x->bm_threshold.b_packets = req->bu_threshold.b_packets; + x->bm_threshold.b_bytes = req->bu_threshold.b_bytes; + x->bm_measured.b_packets = 0; + x->bm_measured.b_bytes = 0; + x->bm_flags = flags; + x->bm_time_next = NULL; + x->bm_time_hash = BW_METER_BUCKETS; + + /* Add the new bw_meter entry to the front of entries for this MFC */ + x->bm_mfc = mfc; + x->bm_mfc_next = mfc->mfc_bw_meter; + mfc->mfc_bw_meter = x; + schedule_bw_meter(x, &now); + MFC_UNLOCK(); + + return 0; } static void @@ -1889,11 +1845,8 @@ free_bw_list(struct bw_meter *list) while (list != NULL) { struct bw_meter *x = list; - /* MFC_LOCK must be held here */ - if (x->bm_flags & BW_METER_LEQ) - callout_drain(&x->bm_meter_callout); - list = list->bm_mfc_next; + unschedule_bw_meter(x); free(x, M_BWMETER); } } @@ -1905,7 +1858,7 @@ static int del_bw_upcall(struct bw_upcall *req) { struct mfc *mfc; - struct bw_meter *x, **bwm_ptr; + struct bw_meter *x; if (!(V_mrt_api_config & MRT_MFC_BW_UPCALL)) return EOPNOTSUPP; @@ -1923,14 +1876,8 @@ del_bw_upcall(struct bw_upcall *req) */ struct bw_meter *list; - /* Free LEQ list */ - list = mfc->mfc_bw_meter_leq; - mfc->mfc_bw_meter_leq = NULL; - free_bw_list(list); - - /* Free GEQ list */ - list = mfc->mfc_bw_meter_geq; - mfc->mfc_bw_meter_geq = NULL; + list = mfc->mfc_bw_meter; + mfc->mfc_bw_meter = NULL; free_bw_list(list); MFC_UNLOCK(); return 0; @@ -1940,14 +1887,8 @@ del_bw_upcall(struct bw_upcall *req) flags = compute_bw_meter_flags(req); - /* Choose an appropriate bw_meter list */ - if (req->bu_flags & BW_UPCALL_GEQ) - bwm_ptr = &mfc->mfc_bw_meter_geq; - else - bwm_ptr = &mfc->mfc_bw_meter_leq; - /* Find the bw_meter entry to delete */ - for (prev = NULL, x = *bwm_ptr; x != NULL; + for (prev = NULL, x = mfc->mfc_bw_meter; x != NULL; prev = x, x = x->bm_mfc_next) { if ((BW_TIMEVALCMP(&x->bm_threshold.b_time, &req->bu_threshold.b_time, ==)) && @@ -1960,11 +1901,9 @@ del_bw_upcall(struct bw_upcall *req) if (prev != NULL) prev->bm_mfc_next = x->bm_mfc_next; /* remove from middle*/ else - *bwm_ptr = x->bm_mfc_next;/* new head of list */ - - if (req->bu_flags & BW_UPCALL_LEQ) - callout_stop(&x->bm_meter_callout); + x->bm_mfc->mfc_bw_meter = x->bm_mfc_next;/* new head of list */ + unschedule_bw_meter(x); MFC_UNLOCK(); /* Free the bw_meter entry */ free(x, M_BWMETER); @@ -1981,15 +1920,16 @@ del_bw_upcall(struct bw_upcall *req) * Perform bandwidth measurement processing that may result in an upcall */ static void -bw_meter_geq_receive_packet(struct bw_meter *x, int plen, struct timeval *nowp) +bw_meter_receive_packet(struct bw_meter *x, int plen, struct timeval *nowp) { - struct timeval delta; + struct timeval delta; - MFC_LOCK_ASSERT(); + MFC_LOCK_ASSERT(); - delta = *nowp; - BW_TIMEVALDECR(&delta, &x->bm_start_time); + delta = *nowp; + BW_TIMEVALDECR(&delta, &x->bm_start_time); + if (x->bm_flags & BW_METER_GEQ) { /* * Processing for ">=" type of bw_meter entry */ @@ -2009,15 +1949,63 @@ bw_meter_geq_receive_packet(struct bw_meter *x, int plen, struct timeval *nowp) * Test if we should deliver an upcall */ if (!(x->bm_flags & BW_METER_UPCALL_DELIVERED)) { - if (((x->bm_flags & BW_METER_UNIT_PACKETS) && - (x->bm_measured.b_packets >= x->bm_threshold.b_packets)) || - ((x->bm_flags & BW_METER_UNIT_BYTES) && - (x->bm_measured.b_bytes >= x->bm_threshold.b_bytes))) { - /* Prepare an upcall for delivery */ - bw_meter_prepare_upcall(x, nowp); - x->bm_flags |= BW_METER_UPCALL_DELIVERED; - } + if (((x->bm_flags & BW_METER_UNIT_PACKETS) && + (x->bm_measured.b_packets >= x->bm_threshold.b_packets)) || + ((x->bm_flags & BW_METER_UNIT_BYTES) && + (x->bm_measured.b_bytes >= x->bm_threshold.b_bytes))) { + /* Prepare an upcall for delivery */ + bw_meter_prepare_upcall(x, nowp); + x->bm_flags |= BW_METER_UPCALL_DELIVERED; + } + } + } else if (x->bm_flags & BW_METER_LEQ) { + /* + * Processing for "<=" type of bw_meter entry + */ + if (BW_TIMEVALCMP(&delta, &x->bm_threshold.b_time, >)) { + /* + * We are behind time with the multicast forwarding table + * scanning for "<=" type of bw_meter entries, so test now + * if we should deliver an upcall. + */ + if (((x->bm_flags & BW_METER_UNIT_PACKETS) && + (x->bm_measured.b_packets <= x->bm_threshold.b_packets)) || + ((x->bm_flags & BW_METER_UNIT_BYTES) && + (x->bm_measured.b_bytes <= x->bm_threshold.b_bytes))) { + /* Prepare an upcall for delivery */ + bw_meter_prepare_upcall(x, nowp); + } + /* Reschedule the bw_meter entry */ + unschedule_bw_meter(x); + schedule_bw_meter(x, nowp); + } + + /* Record that a packet is received */ + x->bm_measured.b_packets++; + x->bm_measured.b_bytes += plen; + + /* + * Test if we should restart the measuring interval + */ + if ((x->bm_flags & BW_METER_UNIT_PACKETS && + x->bm_measured.b_packets <= x->bm_threshold.b_packets) || + (x->bm_flags & BW_METER_UNIT_BYTES && + x->bm_measured.b_bytes <= x->bm_threshold.b_bytes)) { + /* Don't restart the measuring interval */ + } else { + /* Do restart the measuring interval */ + /* + * XXX: note that we don't unschedule and schedule, because this + * might be too much overhead per packet. Instead, when we process + * all entries for a given timer hash bin, we check whether it is + * really a timeout. If not, we reschedule at that time. + */ + x->bm_start_time = *nowp; + x->bm_measured.b_packets = 0; + x->bm_measured.b_bytes = 0; + x->bm_flags &= ~BW_METER_UPCALL_DELIVERED; } + } } /* @@ -2026,44 +2014,44 @@ bw_meter_geq_receive_packet(struct bw_meter *x, int plen, struct timeval *nowp) static void bw_meter_prepare_upcall(struct bw_meter *x, struct timeval *nowp) { - struct timeval delta; - struct bw_upcall *u; + struct timeval delta; + struct bw_upcall *u; - MFC_LOCK_ASSERT(); + MFC_LOCK_ASSERT(); - /* - * Compute the measured time interval - */ - delta = *nowp; - BW_TIMEVALDECR(&delta, &x->bm_start_time); + /* + * Compute the measured time interval + */ + delta = *nowp; + BW_TIMEVALDECR(&delta, &x->bm_start_time); - /* - * If there are too many pending upcalls, deliver them now - */ - if (V_bw_upcalls_n >= BW_UPCALLS_MAX) - bw_upcalls_send(); + /* + * If there are too many pending upcalls, deliver them now + */ + if (V_bw_upcalls_n >= BW_UPCALLS_MAX) + bw_upcalls_send(); - /* - * Set the bw_upcall entry - */ - u = &V_bw_upcalls[V_bw_upcalls_n++]; - u->bu_src = x->bm_mfc->mfc_origin; - u->bu_dst = x->bm_mfc->mfc_mcastgrp; - u->bu_threshold.b_time = x->bm_threshold.b_time; - u->bu_threshold.b_packets = x->bm_threshold.b_packets; - u->bu_threshold.b_bytes = x->bm_threshold.b_bytes; - u->bu_measured.b_time = delta; - u->bu_measured.b_packets = x->bm_measured.b_packets; - u->bu_measured.b_bytes = x->bm_measured.b_bytes; - u->bu_flags = 0; - if (x->bm_flags & BW_METER_UNIT_PACKETS) - u->bu_flags |= BW_UPCALL_UNIT_PACKETS; - if (x->bm_flags & BW_METER_UNIT_BYTES) - u->bu_flags |= BW_UPCALL_UNIT_BYTES; - if (x->bm_flags & BW_METER_GEQ) - u->bu_flags |= BW_UPCALL_GEQ; - if (x->bm_flags & BW_METER_LEQ) - u->bu_flags |= BW_UPCALL_LEQ; + /* + * Set the bw_upcall entry + */ + u = &V_bw_upcalls[V_bw_upcalls_n++]; + u->bu_src = x->bm_mfc->mfc_origin; + u->bu_dst = x->bm_mfc->mfc_mcastgrp; + u->bu_threshold.b_time = x->bm_threshold.b_time; + u->bu_threshold.b_packets = x->bm_threshold.b_packets; + u->bu_threshold.b_bytes = x->bm_threshold.b_bytes; + u->bu_measured.b_time = delta; + u->bu_measured.b_packets = x->bm_measured.b_packets; + u->bu_measured.b_bytes = x->bm_measured.b_bytes; + u->bu_flags = 0; + if (x->bm_flags & BW_METER_UNIT_PACKETS) + u->bu_flags |= BW_UPCALL_UNIT_PACKETS; + if (x->bm_flags & BW_METER_UNIT_BYTES) + u->bu_flags |= BW_UPCALL_UNIT_BYTES; + if (x->bm_flags & BW_METER_GEQ) + u->bu_flags |= BW_UPCALL_GEQ; + if (x->bm_flags & BW_METER_LEQ) + u->bu_flags |= BW_UPCALL_LEQ; } /* @@ -2115,6 +2103,183 @@ bw_upcalls_send(void) } } +/* + * Compute the timeout hash value for the bw_meter entries + */ +#define BW_METER_TIMEHASH(bw_meter, hash) \ + do { \ + struct timeval next_timeval = (bw_meter)->bm_start_time; \ + \ + BW_TIMEVALADD(&next_timeval, &(bw_meter)->bm_threshold.b_time); \ + (hash) = next_timeval.tv_sec; \ + if (next_timeval.tv_usec) \ + (hash)++; /* XXX: make sure we don't timeout early */ \ + (hash) %= BW_METER_BUCKETS; \ + } while (0) + +/* + * Schedule a timer to process periodically bw_meter entry of type "<=" + * by linking the entry in the proper hash bucket. + */ +static void +schedule_bw_meter(struct bw_meter *x, struct timeval *nowp) +{ + int time_hash; + + MFC_LOCK_ASSERT(); + + if (!(x->bm_flags & BW_METER_LEQ)) + return; /* XXX: we schedule timers only for "<=" entries */ + + /* + * Reset the bw_meter entry + */ + x->bm_start_time = *nowp; + x->bm_measured.b_packets = 0; + x->bm_measured.b_bytes = 0; + x->bm_flags &= ~BW_METER_UPCALL_DELIVERED; + + /* + * Compute the timeout hash value and insert the entry + */ + BW_METER_TIMEHASH(x, time_hash); + x->bm_time_next = V_bw_meter_timers[time_hash]; + V_bw_meter_timers[time_hash] = x; + x->bm_time_hash = time_hash; +} + +/* + * Unschedule the periodic timer that processes bw_meter entry of type "<=" + * by removing the entry from the proper hash bucket. + */ +static void +unschedule_bw_meter(struct bw_meter *x) +{ + int time_hash; + struct bw_meter *prev, *tmp; + + MFC_LOCK_ASSERT(); + + if (!(x->bm_flags & BW_METER_LEQ)) + return; /* XXX: we schedule timers only for "<=" entries */ + + /* + * Compute the timeout hash value and delete the entry + */ + time_hash = x->bm_time_hash; + if (time_hash >= BW_METER_BUCKETS) + return; /* Entry was not scheduled */ + + for (prev = NULL, tmp = V_bw_meter_timers[time_hash]; + tmp != NULL; prev = tmp, tmp = tmp->bm_time_next) + if (tmp == x) + break; + + if (tmp == NULL) + panic("unschedule_bw_meter: bw_meter entry not found"); + + if (prev != NULL) + prev->bm_time_next = x->bm_time_next; + else + V_bw_meter_timers[time_hash] = x->bm_time_next; + + x->bm_time_next = NULL; + x->bm_time_hash = BW_METER_BUCKETS; +} + +/* + * Process all "<=" type of bw_meter that should be processed now, + * and for each entry prepare an upcall if necessary. Each processed + * entry is rescheduled again for the (periodic) processing. + * + * This is run periodically (once per second normally). On each round, + * all the potentially matching entries are in the hash slot that we are + * looking at. + */ +static void +bw_meter_process() +{ + uint32_t loops; + int i; + struct timeval now, process_endtime; + + microtime(&now); + if (V_last_tv_sec == now.tv_sec) + return; /* nothing to do */ + + loops = now.tv_sec - V_last_tv_sec; + V_last_tv_sec = now.tv_sec; + if (loops > BW_METER_BUCKETS) + loops = BW_METER_BUCKETS; + + MFC_LOCK(); + /* + * Process all bins of bw_meter entries from the one after the last + * processed to the current one. On entry, i points to the last bucket + * visited, so we need to increment i at the beginning of the loop. + */ + for (i = (now.tv_sec - loops) % BW_METER_BUCKETS; loops > 0; loops--) { + struct bw_meter *x, *tmp_list; + + if (++i >= BW_METER_BUCKETS) + i = 0; + + /* Disconnect the list of bw_meter entries from the bin */ + tmp_list = V_bw_meter_timers[i]; + V_bw_meter_timers[i] = NULL; + + /* Process the list of bw_meter entries */ + while (tmp_list != NULL) { + x = tmp_list; + tmp_list = tmp_list->bm_time_next; + + /* Test if the time interval is over */ + process_endtime = x->bm_start_time; + BW_TIMEVALADD(&process_endtime, &x->bm_threshold.b_time); + if (BW_TIMEVALCMP(&process_endtime, &now, >)) { + /* Not yet: reschedule, but don't reset */ + int time_hash; + + BW_METER_TIMEHASH(x, time_hash); + if (time_hash == i && process_endtime.tv_sec == now.tv_sec) { + /* + * XXX: somehow the bin processing is a bit ahead of time. + * Put the entry in the next bin. + */ + if (++time_hash >= BW_METER_BUCKETS) + time_hash = 0; + } + x->bm_time_next = V_bw_meter_timers[time_hash]; + V_bw_meter_timers[time_hash] = x; + x->bm_time_hash = time_hash; + + continue; + } + + /* + * Test if we should deliver an upcall + */ + if (((x->bm_flags & BW_METER_UNIT_PACKETS) && + (x->bm_measured.b_packets <= x->bm_threshold.b_packets)) || + ((x->bm_flags & BW_METER_UNIT_BYTES) && + (x->bm_measured.b_bytes <= x->bm_threshold.b_bytes))) { + /* Prepare an upcall for delivery */ + bw_meter_prepare_upcall(x, &now); + } + + /* + * Reschedule for next processing + */ + schedule_bw_meter(x, &now); + } + } + + /* Send all upcalls that are pending delivery */ + bw_upcalls_send(); + + MFC_UNLOCK(); +} + /* * A periodic function for sending all upcalls that are pending delivery */ @@ -2132,6 +2297,23 @@ expire_bw_upcalls_send(void *arg) CURVNET_RESTORE(); } +/* + * A periodic function for periodic scanning of the multicast forwarding + * table for processing all "<=" bw_meter entries. + */ +static void +expire_bw_meter_process(void *arg) +{ + CURVNET_SET((struct vnet *) arg); + + if (V_mrt_api_config & MRT_MFC_BW_UPCALL) + bw_meter_process(); + + callout_reset(&V_bw_meter_ch, BW_METER_PERIOD, expire_bw_meter_process, + curvnet); + CURVNET_RESTORE(); +} + /* * End of bandwidth monitoring code */ @@ -2653,11 +2835,14 @@ vnet_mroute_init(const void *unused __unused) V_viftable = mallocarray(MAXVIFS, sizeof(*V_viftable), M_MRTABLE, M_WAITOK|M_ZERO); + V_bw_meter_timers = mallocarray(BW_METER_BUCKETS, + sizeof(*V_bw_meter_timers), M_MRTABLE, M_WAITOK|M_ZERO); V_bw_upcalls = mallocarray(BW_UPCALLS_MAX, sizeof(*V_bw_upcalls), M_MRTABLE, M_WAITOK|M_ZERO); callout_init(&V_expire_upcalls_ch, 1); callout_init(&V_bw_upcalls_ch, 1); + callout_init(&V_bw_meter_ch, 1); } VNET_SYSINIT(vnet_mroute_init, SI_SUB_PROTO_MC, SI_ORDER_ANY, vnet_mroute_init, @@ -2668,6 +2853,7 @@ vnet_mroute_uninit(const void *unused __unused) { free(V_bw_upcalls, M_MRTABLE); + free(V_bw_meter_timers, M_MRTABLE); free(V_viftable, M_MRTABLE); free(V_nexpire, M_MRTABLE); V_nexpire = NULL; diff --git a/sys/netinet/ip_mroute.h b/sys/netinet/ip_mroute.h index 07d77065de33..6ef99c0172f3 100644 --- a/sys/netinet/ip_mroute.h +++ b/sys/netinet/ip_mroute.h @@ -283,10 +283,7 @@ struct mfc { struct timeval mfc_last_assert; /* last time I sent an assert*/ uint8_t mfc_flags[MAXVIFS]; /* the MRT_MFC_FLAGS_* flags */ struct in_addr mfc_rp; /* the RP address */ - struct bw_meter *mfc_bw_meter_leq; /* list of bandwidth meters - for Lower-or-EQual case */ - struct bw_meter *mfc_bw_meter_geq; /* list of bandwidth meters - for Greater-or-EQual case */ + struct bw_meter *mfc_bw_meter; /* list of bandwidth meters */ u_long mfc_nstall; /* # of packets awaiting mfc */ TAILQ_HEAD(, rtdetq) mfc_stall; /* q of packets awaiting mfc */ }; @@ -330,6 +327,7 @@ struct rtdetq { struct bw_meter { struct bw_meter *bm_mfc_next; /* next bw meter (same mfc) */ struct bw_meter *bm_time_next; /* next bw meter (same time) */ + uint32_t bm_time_hash; /* the time hash value */ struct mfc *bm_mfc; /* the corresponding mfc */ uint32_t bm_flags; /* misc flags (see below) */ #define BW_METER_UNIT_PACKETS (1 << 0) /* threshold (in packets) */ @@ -346,10 +344,6 @@ struct bw_meter { struct bw_data bm_threshold; /* the upcall threshold */ struct bw_data bm_measured; /* the measured bw */ struct timeval bm_start_time; /* abs. time */ -#ifdef _KERNEL - struct callout bm_meter_callout; /* Periodic callout */ - void* arg; /* custom argument */ -#endif }; #ifdef _KERNEL From owner-dev-commits-src-all@freebsd.org Thu May 20 11:54:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8F4AD63BFD3; Thu, 20 May 2021 11:54: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 4Fm7T53YyTz3G5k; Thu, 20 May 2021 11:54: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 612D7259C9; Thu, 20 May 2021 11:54: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 14KBsnx6056820; Thu, 20 May 2021 11:54:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KBsn6O056819; Thu, 20 May 2021 11:54:49 GMT (envelope-from git) Date: Thu, 20 May 2021 11:54:49 GMT Message-Id: <202105201154.14KBsn6O056819@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 1732afaa0dae - main - pf: Add DIOCGETSTATENV 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/main X-Git-Reftype: branch X-Git-Commit: 1732afaa0dae9d844e341f2c1d6ed4b79c403bfb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 11:54:49 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1732afaa0dae9d844e341f2c1d6ed4b79c403bfb commit 1732afaa0dae9d844e341f2c1d6ed4b79c403bfb Author: Kristof Provost AuthorDate: 2021-05-05 12:33:55 +0000 Commit: Kristof Provost CommitDate: 2021-05-20 10:49:26 +0000 pf: Add DIOCGETSTATENV Add DIOCGETSTATENV, an nvlist-based alternative to DIOCGETSTATE. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30242 --- share/man/man4/pf.4 | 4 +- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf_ioctl.c | 226 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 229 insertions(+), 2 deletions(-) diff --git a/share/man/man4/pf.4 b/share/man/man4/pf.4 index 2fb132203908..24843535c924 100644 --- a/share/man/man4/pf.4 +++ b/share/man/man4/pf.4 @@ -326,14 +326,14 @@ struct pfioc_state { struct pfsync_state state; }; .Ed -.It Dv DIOCGETSTATE Fa "struct pfioc_state *ps" +.It Dv DIOCGETSTATENV Fa "struct pfioc_nv *nv" Extract the entry identified by the .Va id and .Va creatorid fields of the .Va state -structure from the state table. +nvlist from the state table. .It Dv DIOCKILLSTATES Fa "struct pfioc_state_kill *psk" Remove matching entries from the state table. This ioctl returns the number of killed states in diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 51c51a82b36d..1bd1ebd27449 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1257,6 +1257,7 @@ struct pfioc_iface { #define DIOCCLRSTATES _IOWR('D', 18, struct pfioc_state_kill) #define DIOCCLRSTATESNV _IOWR('D', 18, struct pfioc_nv) #define DIOCGETSTATE _IOWR('D', 19, struct pfioc_state) +#define DIOCGETSTATENV _IOWR('D', 19, struct pfioc_nv) #define DIOCSETSTATUSIF _IOWR('D', 20, struct pfioc_if) #define DIOCGETSTATUS _IOWR('D', 21, struct pf_status) #define DIOCCLRSTATUS _IO ('D', 22) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 2d13ddf1ac61..1ea7310ebebb 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -208,6 +208,7 @@ static int pf_killstates_row(struct pf_kstate_kill *, struct pf_idhash *); static int pf_killstates_nv(struct pfioc_nv *); static int pf_clearstates_nv(struct pfioc_nv *); +static int pf_getstate(struct pfioc_nv *); static int pf_clear_tables(void); static void pf_clear_srcnodes(struct pf_ksrc_node *); static void pf_kill_srcnodes(struct pfioc_src_node_kill *); @@ -2474,6 +2475,157 @@ errout: return (error); } +static nvlist_t * +pf_state_key_to_nvstate_key(const struct pf_state_key *key) +{ + nvlist_t *nvl, *tmp; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (NULL); + + for (int i = 0; i < 2; i++) { + tmp = pf_addr_to_nvaddr(&key->addr[i]); + if (tmp == NULL) + goto errout; + nvlist_append_nvlist_array(nvl, "addr", tmp); + nvlist_append_number_array(nvl, "port", key->port[i]); + } + nvlist_add_number(nvl, "af", key->af); + nvlist_add_number(nvl, "proto", key->proto); + + return (nvl); + +errout: + nvlist_destroy(nvl); + return (NULL); +} + +static nvlist_t * +pf_state_scrub_to_nvstate_scrub(const struct pf_state_scrub *scrub) +{ + nvlist_t *nvl; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (NULL); + + nvlist_add_bool(nvl, "timestamp", scrub->pfss_flags & PFSS_TIMESTAMP); + nvlist_add_number(nvl, "ttl", scrub->pfss_ttl); + nvlist_add_number(nvl, "ts_mod", scrub->pfss_ts_mod); + + return (nvl); +} + +static nvlist_t * +pf_state_peer_to_nvstate_peer(const struct pf_state_peer *peer) +{ + nvlist_t *nvl, *tmp; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (NULL); + + if (peer->scrub) { + tmp = pf_state_scrub_to_nvstate_scrub(peer->scrub); + if (tmp == NULL) + goto errout; + nvlist_add_nvlist(nvl, "scrub", tmp); + } + + nvlist_add_number(nvl, "seqlo", peer->seqlo); + nvlist_add_number(nvl, "seqhi", peer->seqhi); + nvlist_add_number(nvl, "seqdiff", peer->seqdiff); + nvlist_add_number(nvl, "max_win", peer->max_win); + nvlist_add_number(nvl, "mss", peer->mss); + nvlist_add_number(nvl, "state", peer->state); + nvlist_add_number(nvl, "wscale", peer->wscale); + + return (nvl); + +errout: + nvlist_destroy(nvl); + return (NULL); +} + + +static nvlist_t * +pf_state_to_nvstate(const struct pf_state *s) +{ + nvlist_t *nvl, *tmp; + uint32_t expire, flags = 0; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (NULL); + + nvlist_add_number(nvl, "id", s->id); + nvlist_add_string(nvl, "ifname", s->kif->pfik_name); + + tmp = pf_state_key_to_nvstate_key(s->key[PF_SK_STACK]); + if (tmp == NULL) + goto errout; + nvlist_add_nvlist(nvl, "stack_key", tmp); + + tmp = pf_state_key_to_nvstate_key(s->key[PF_SK_WIRE]); + if (tmp == NULL) + goto errout; + nvlist_add_nvlist(nvl, "wire_key", tmp); + + tmp = pf_state_peer_to_nvstate_peer(&s->src); + if (tmp == NULL) + goto errout; + nvlist_add_nvlist(nvl, "src", tmp); + + tmp = pf_state_peer_to_nvstate_peer(&s->dst); + if (tmp == NULL) + goto errout; + nvlist_add_nvlist(nvl, "dst", tmp); + + tmp = pf_addr_to_nvaddr(&s->rt_addr); + if (tmp == NULL) + goto errout; + nvlist_add_nvlist(nvl, "rt_addr", tmp); + + nvlist_add_number(nvl, "rule", s->rule.ptr ? s->rule.ptr->nr : -1); + nvlist_add_number(nvl, "anchor", + s->anchor.ptr ? s->anchor.ptr->nr : -1); + nvlist_add_number(nvl, "nat_rule", + s->nat_rule.ptr ? s->nat_rule.ptr->nr : -1); + nvlist_add_number(nvl, "creation", s->creation); + + expire = pf_state_expires(s); + if (expire <= time_uptime) + expire = 0; + else + expire = expire - time_uptime; + nvlist_add_number(nvl, "expire", expire); + + for (int i = 0; i < 2; i++) { + nvlist_append_number_array(nvl, "packets", + counter_u64_fetch(s->packets[i])); + nvlist_append_number_array(nvl, "bytes", + counter_u64_fetch(s->bytes[i])); + } + + nvlist_add_number(nvl, "creatorid", s->creatorid); + nvlist_add_number(nvl, "direction", s->direction); + nvlist_add_number(nvl, "log", s->log); + nvlist_add_number(nvl, "state_flags", s->state_flags); + nvlist_add_number(nvl, "timeout", s->timeout); + if (s->src_node) + flags |= PFSYNC_FLAG_SRCNODE; + if (s->nat_src_node) + flags |= PFSYNC_FLAG_NATSRCNODE; + nvlist_add_number(nvl, "sync_flags", flags); + + return (nvl); + +errout: + nvlist_destroy(nvl); + return (NULL); +} + static int pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket, uint32_t pool_ticket, const char *anchor, const char *anchor_call, @@ -2789,6 +2941,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCGETADDRS: case DIOCGETADDR: case DIOCGETSTATE: + case DIOCGETSTATENV: case DIOCSETSTATUSIF: case DIOCGETSTATUS: case DIOCCLRSTATUS: @@ -2844,6 +2997,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCGETADDRS: case DIOCGETADDR: case DIOCGETSTATE: + case DIOCGETSTATENV: case DIOCGETSTATUS: case DIOCGETSTATES: case DIOCGETTIMEOUT: @@ -3504,6 +3658,11 @@ DIOCCHANGERULE_error: break; } + case DIOCGETSTATENV: { + error = pf_getstate((struct pfioc_nv *)addr); + break; + } + case DIOCGETSTATES: { struct pfioc_states *ps = (struct pfioc_states *)addr; struct pf_state *s; @@ -5684,12 +5843,79 @@ pf_clearstates_nv(struct pfioc_nv *nv) error = copyout(nvlpacked, nv->data, nv->len); +#undef ERROUT on_error: nvlist_destroy(nvl); free(nvlpacked, M_TEMP); return (error); } +static int +pf_getstate(struct pfioc_nv *nv) +{ + nvlist_t *nvl = NULL, *nvls; + void *nvlpacked = NULL; + struct pf_state *s = NULL; + int error = 0; + uint64_t id, creatorid; + +#define ERROUT(x) ERROUT_FUNCTION(errout, x) + + if (nv->len > pf_ioctl_maxcount) + ERROUT(ENOMEM); + + nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); + if (nvlpacked == NULL) + ERROUT(ENOMEM); + + error = copyin(nv->data, nvlpacked, nv->len); + if (error) + ERROUT(error); + + nvl = nvlist_unpack(nvlpacked, nv->len, 0); + if (nvl == NULL) + ERROUT(EBADMSG); + + PFNV_CHK(pf_nvuint64(nvl, "id", &id)); + PFNV_CHK(pf_nvuint64(nvl, "creatorid", &creatorid)); + + s = pf_find_state_byid(id, creatorid); + if (s == NULL) + ERROUT(ENOENT); + + free(nvlpacked, M_TEMP); + nvlpacked = NULL; + nvlist_destroy(nvl); + nvl = nvlist_create(0); + if (nvl == NULL) + ERROUT(ENOMEM); + + nvls = pf_state_to_nvstate(s); + if (nvls == NULL) + ERROUT(ENOMEM); + + nvlist_add_nvlist(nvl, "state", nvls); + + nvlpacked = nvlist_pack(nvl, &nv->len); + if (nvlpacked == NULL) + ERROUT(ENOMEM); + + if (nv->size == 0) + ERROUT(0); + else if (nv->size < nv->len) + ERROUT(ENOSPC); + + error = copyout(nvlpacked, nv->data, nv->len); + +#undef ERROUT +errout: + if (s != NULL) + PF_STATE_UNLOCK(s); + free(nvlpacked, M_TEMP); + nvlist_destroy(nvl); + return (error); +} + /* * XXX - Check for version missmatch!!! */ From owner-dev-commits-src-all@freebsd.org Thu May 20 11:54:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AA08A63C501; Thu, 20 May 2021 11:54: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 4Fm7T64M8dz3Gd3; Thu, 20 May 2021 11:54: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 7F35F258A3; Thu, 20 May 2021 11:54: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 14KBsoUv056843; Thu, 20 May 2021 11:54:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KBsocI056842; Thu, 20 May 2021 11:54:50 GMT (envelope-from git) Date: Thu, 20 May 2021 11:54:50 GMT Message-Id: <202105201154.14KBsocI056842@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 0592a4c83d67 - main - pf: Add DIOCGETSTATESNV 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/main X-Git-Reftype: branch X-Git-Commit: 0592a4c83d67547644763fb023abd5eb28e57f92 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 11:54:50 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0592a4c83d67547644763fb023abd5eb28e57f92 commit 0592a4c83d67547644763fb023abd5eb28e57f92 Author: Kristof Provost AuthorDate: 2021-05-05 19:00:16 +0000 Commit: Kristof Provost CommitDate: 2021-05-20 10:49:27 +0000 pf: Add DIOCGETSTATESNV Add DIOCGETSTATESNV, an nvlist-based alternative to DIOCGETSTATES. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30243 --- share/man/man4/pf.4 | 71 ++++++++++++++++++++++++++++++++----------- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf_ioctl.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 130 insertions(+), 18 deletions(-) diff --git a/share/man/man4/pf.4 b/share/man/man4/pf.4 index 24843535c924..133e4d300043 100644 --- a/share/man/man4/pf.4 +++ b/share/man/man4/pf.4 @@ -415,30 +415,65 @@ Set the debug level. enum { PF_DEBUG_NONE, PF_DEBUG_URGENT, PF_DEBUG_MISC, PF_DEBUG_NOISY }; .Ed -.It Dv DIOCGETSTATES Fa "struct pfioc_states *ps" +.It Dv DIOCGETSTATESNV Fa "struct pfioc_nv *nv" Get state table entries. .Bd -literal -struct pfioc_states { - int ps_len; - union { - caddr_t psu_buf; - struct pf_state *psu_states; - } ps_u; -#define ps_buf ps_u.psu_buf -#define ps_states ps_u.psu_states +nvlist pf_state_key { + nvlist pf_addr addr[2]; + number port[2]; + number af; + number proto; +}; + +nvlist pf_state_scrub { + bool timestamp; + number ttl; + number ts_mod; +}; + +nvlist pf_state_peer { + nvlist pf_state_scrub scrub; + number seqlo; + number seqhi; + number seqdiff; + number max_win; + number mss; + number state; + number wscale; +}; + +nvlist pf_state { + number id; + string ifname; + nvlist pf_state_key stack_key; + nvlist pf_state_key wire_key; + nvlist pf_state_peer src; + nvlist pf_state_peer dst; + nvlist pf_addr rt_addr; + number rule; + number anchor; + number nat_rule; + number expire; + number packets[2]; + number bytes[2]; + number creatorid; + number direction; + number log; + number state_flags; + number timeout; + number sync_flags; +}; + +nvlist pf_states { + number count; + nvlist pf_state states[]; }; .Ed .Pp If -.Va ps_len -is non-zero on entry, as many states as possible that can fit into this -size will be copied into the supplied buffer -.Va ps_states . -On exit, -.Va ps_len -is always set to the total size required to hold all state table entries -(i.e., it is set to -.Li sizeof(struct pf_state) * nr ) . +.Va pfioc_nv.size +is insufficiently large, as many states as possible that can fit into this +size will be copied into the supplied buffer. .It Dv DIOCCHANGERULE Fa "struct pfioc_rule *pcr" Add or remove the .Va rule diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 1bd1ebd27449..d9e35dae753a 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1264,6 +1264,7 @@ struct pfioc_iface { #define DIOCNATLOOK _IOWR('D', 23, struct pfioc_natlook) #define DIOCSETDEBUG _IOWR('D', 24, u_int32_t) #define DIOCGETSTATES _IOWR('D', 25, struct pfioc_states) +#define DIOCGETSTATESNV _IOWR('D', 25, struct pfioc_nv) #define DIOCCHANGERULE _IOWR('D', 26, struct pfioc_rule) /* XXX cut 26 - 28 */ #define DIOCSETTIMEOUT _IOWR('D', 29, struct pfioc_tm) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 1ea7310ebebb..8424e0ce5689 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -209,6 +209,7 @@ static int pf_killstates_row(struct pf_kstate_kill *, static int pf_killstates_nv(struct pfioc_nv *); static int pf_clearstates_nv(struct pfioc_nv *); static int pf_getstate(struct pfioc_nv *); +static int pf_getstates(struct pfioc_nv *); static int pf_clear_tables(void); static void pf_clear_srcnodes(struct pf_ksrc_node *); static void pf_kill_srcnodes(struct pfioc_src_node_kill *); @@ -2948,6 +2949,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCNATLOOK: case DIOCSETDEBUG: case DIOCGETSTATES: + case DIOCGETSTATESNV: case DIOCGETTIMEOUT: case DIOCCLRRULECTRS: case DIOCGETLIMIT: @@ -3000,6 +3002,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCGETSTATENV: case DIOCGETSTATUS: case DIOCGETSTATES: + case DIOCGETSTATESNV: case DIOCGETTIMEOUT: case DIOCGETLIMIT: case DIOCGETALTQSV0: @@ -3709,6 +3712,11 @@ DIOCGETSTATES_full: break; } + case DIOCGETSTATESNV: { + error = pf_getstates((struct pfioc_nv *)addr); + break; + } + case DIOCGETSTATUS: { struct pf_status *s = (struct pf_status *)addr; @@ -5916,6 +5924,74 @@ errout: return (error); } +static int +pf_getstates(struct pfioc_nv *nv) +{ + nvlist_t *nvl = NULL, *nvls; + void *nvlpacked = NULL; + struct pf_state *s = NULL; + int error = 0; + uint64_t count = 0; + +#define ERROUT(x) ERROUT_FUNCTION(errout, x) + + nvl = nvlist_create(0); + if (nvl == NULL) + ERROUT(ENOMEM); + + nvlist_add_number(nvl, "count", uma_zone_get_cur(V_pf_state_z)); + + for (int i = 0; i < pf_hashmask; i++) { + struct pf_idhash *ih = &V_pf_idhash[i]; + + PF_HASHROW_LOCK(ih); + LIST_FOREACH(s, &ih->states, entry) { + if (s->timeout == PFTM_UNLINKED) + continue; + + nvls = pf_state_to_nvstate(s); + if (nvls == NULL) { + PF_HASHROW_UNLOCK(ih); + ERROUT(ENOMEM); + } + if ((nvlist_size(nvl) + nvlist_size(nvls)) > nv->size) { + /* We've run out of room for more states. */ + nvlist_destroy(nvls); + PF_HASHROW_UNLOCK(ih); + goto DIOCGETSTATESNV_full; + } + nvlist_append_nvlist_array(nvl, "states", nvls); + count++; + } + PF_HASHROW_UNLOCK(ih); + } + + /* We've managed to put them all the available space. Let's make sure + * 'count' matches our array (that's racy, because we don't hold a lock + * over all states, only over each row individually. */ + (void)nvlist_take_number(nvl, "count"); + nvlist_add_number(nvl, "count", count); + +DIOCGETSTATESNV_full: + + nvlpacked = nvlist_pack(nvl, &nv->len); + if (nvlpacked == NULL) + ERROUT(ENOMEM); + + if (nv->size == 0) + ERROUT(0); + else if (nv->size < nv->len) + ERROUT(ENOSPC); + + error = copyout(nvlpacked, nv->data, nv->len); + +#undef ERROUT +errout: + free(nvlpacked, M_TEMP); + nvlist_destroy(nvl); + return (error); +} + /* * XXX - Check for version missmatch!!! */ From owner-dev-commits-src-all@freebsd.org Thu May 20 11:54:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1D33963C487; Thu, 20 May 2021 11:54: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 4Fm7T806mvz3GhQ; Thu, 20 May 2021 11:54: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 B33B0254C9; Thu, 20 May 2021 11:54: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 14KBspxF056869; Thu, 20 May 2021 11:54:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KBsp1Q056868; Thu, 20 May 2021 11:54:51 GMT (envelope-from git) Date: Thu, 20 May 2021 11:54:51 GMT Message-Id: <202105201154.14KBsp1Q056868@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: bc941291473d - main - pfctl: Use DIOCGETSTATESNV 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/main X-Git-Reftype: branch X-Git-Commit: bc941291473d8a2164e4ffc3f3e7e6a356cbe747 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 11:54:52 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=bc941291473d8a2164e4ffc3f3e7e6a356cbe747 commit bc941291473d8a2164e4ffc3f3e7e6a356cbe747 Author: Kristof Provost AuthorDate: 2021-05-10 14:51:38 +0000 Commit: Kristof Provost CommitDate: 2021-05-20 10:49:27 +0000 pfctl: Use DIOCGETSTATESNV Migrate to using the new nvlist-based DIOCGETSTATESNV call to obtain the states list. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30244 --- lib/libpfctl/libpfctl.c | 173 ++++++++++++++++++++++++++++++++++++++++++++ lib/libpfctl/libpfctl.h | 60 +++++++++++++++ sbin/pfctl/pf_print_state.c | 82 ++++++++++----------- sbin/pfctl/pfctl.c | 49 ++++--------- sbin/pfctl/pfctl.h | 4 +- 5 files changed, 289 insertions(+), 79 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 8271d9bab3df..6a6ecd8fb136 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -627,6 +627,179 @@ pfctl_nv_add_state_cmp(nvlist_t *nvl, const char *name, nvlist_add_nvlist(nvl, name, nv); } +static void +pf_nvstate_scrub_to_state_scrub(const nvlist_t *nvl, + struct pfctl_state_scrub *scrub) +{ + bzero(scrub, sizeof(*scrub)); + + scrub->timestamp = nvlist_get_bool(nvl, "timestamp"); + scrub->ttl = nvlist_get_number(nvl, "ttl"); + scrub->ts_mod = nvlist_get_number(nvl, "ts_mod"); +} + +static void +pf_nvstate_peer_to_state_peer(const nvlist_t *nvl, + struct pfctl_state_peer *peer) +{ + bzero(peer, sizeof(*peer)); + + if (nvlist_exists_nvlist(nvl, "scrub")) { + peer->scrub = malloc(sizeof(*peer->scrub)); + pf_nvstate_scrub_to_state_scrub( + nvlist_get_nvlist(nvl, "scrub"), + peer->scrub); + } + + peer->seqlo = nvlist_get_number(nvl, "seqlo"); + peer->seqhi = nvlist_get_number(nvl, "seqhi"); + peer->seqdiff = nvlist_get_number(nvl, "seqdiff"); + peer->max_win = nvlist_get_number(nvl, "max_win"); + peer->mss = nvlist_get_number(nvl, "mss"); + peer->state = nvlist_get_number(nvl, "state"); + peer->wscale = nvlist_get_number(nvl, "wscale"); +} + +static void +pf_nvstate_key_to_state_key(const nvlist_t *nvl, struct pfctl_state_key *key) +{ + const nvlist_t * const *tmp; + size_t count; + + bzero(key, sizeof(*key)); + + tmp = nvlist_get_nvlist_array(nvl, "addr", &count); + assert(count == 2); + + for (int i = 0; i < 2; i++) + pf_nvaddr_to_addr(tmp[i], &key->addr[i]); + + pf_nvuint_16_array(nvl, "port", 2, key->port, NULL); + + key->af = nvlist_get_number(nvl, "af"); + key->proto = nvlist_get_number(nvl, "proto"); +} + +static void +pf_nvstate_to_state(const nvlist_t *nvl, struct pfctl_state *s) +{ + bzero(s, sizeof(*s)); + + s->id = nvlist_get_number(nvl, "id"); + s->creatorid = nvlist_get_number(nvl, "creatorid"); + s->direction = nvlist_get_number(nvl, "direction"); + + pf_nvstate_peer_to_state_peer(nvlist_get_nvlist(nvl, "src"), &s->src); + pf_nvstate_peer_to_state_peer(nvlist_get_nvlist(nvl, "dst"), &s->dst); + + pf_nvstate_key_to_state_key(nvlist_get_nvlist(nvl, "stack_key"), + &s->key[0]); + pf_nvstate_key_to_state_key(nvlist_get_nvlist(nvl, "wire_key"), + &s->key[1]); + + strlcpy(s->ifname, nvlist_get_string(nvl, "ifname"), + sizeof(s->ifname)); + + pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "rt_addr"), &s->rt_addr); + s->rule = nvlist_get_number(nvl, "rule"); + s->anchor = nvlist_get_number(nvl, "anchor"); + s->nat_rule = nvlist_get_number(nvl, "nat_rule"); + s->creation = nvlist_get_number(nvl, "creation"); + s->expire = nvlist_get_number(nvl, "expire"); + + pf_nvuint_64_array(nvl, "packets", 2, s->packets, NULL); + pf_nvuint_64_array(nvl, "bytes", 2, s->bytes, NULL); + + s->log = nvlist_get_number(nvl, "log"); + s->state_flags = nvlist_get_number(nvl, "state_flags"); + s->timeout = nvlist_get_number(nvl, "timeout"); + s->sync_flags = nvlist_get_number(nvl, "sync_flags"); +} + +int +pfctl_get_states(int dev, struct pfctl_states *states) +{ + struct pfioc_nv nv; + nvlist_t *nvl; + const nvlist_t * const *slist; + size_t found_count; + + bzero(states, sizeof(*states)); + TAILQ_INIT(&states->states); + + /* Just enough to get a number, and we'll grow from there. */ + nv.data = malloc(64); + nv.len = nv.size = 64; + + for (;;) { + if (ioctl(dev, DIOCGETSTATESNV, &nv)) { + free(nv.data); + return (errno); + } + + nvl = nvlist_unpack(nv.data, nv.len, 0); + if (nvl == NULL) { + free(nv.data); + return (EIO); + } + + states->count = nvlist_get_number(nvl, "count"); + + /* Are there any states? */ + if (states->count == 0) + break; + + if (nvlist_exists_nvlist_array(nvl, "states")) + slist = nvlist_get_nvlist_array(nvl, "states", &found_count); + else + found_count = 0; + + if (found_count < states->count) { + size_t new_size = nv.size + + (nv.size * states->count / (found_count + 1) * 2); + + /* Our buffer is too small. Estimate what we need based + * on how many states fit in the previous allocation + * and how many states there are. Doubled for margin. + * */ + nv.data = realloc(nv.data, new_size); + nv.size = new_size; + + if (nv.data == NULL) + return (ENOMEM); + continue; + } + + for (size_t i = 0; i < found_count; i++) { + struct pfctl_state *s = malloc(sizeof(*s)); + if (s == NULL) { + pfctl_free_states(states); + nvlist_destroy(nvl); + free(nv.data); + return (ENOMEM); + } + + pf_nvstate_to_state(slist[i], s); + TAILQ_INSERT_TAIL(&states->states, s, entry); + } + break; + } + + return (0); +} + +void +pfctl_free_states(struct pfctl_states *states) +{ + struct pfctl_state *s, *tmp; + + TAILQ_FOREACH_SAFE(s, &states->states, entry, tmp) { + free(s); + } + + bzero(states, sizeof(*states)); +} + static int _pfctl_clear_states(int dev, const struct pfctl_kill *kill, unsigned int *killed, uint64_t ioctlval) diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 7a1e02f3d01b..05447b5d8673 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -197,6 +197,64 @@ struct pfctl_kill { bool kill_match; }; +struct pfctl_state_scrub { + bool timestamp; + uint8_t ttl; + uint32_t ts_mod; +}; + +struct pfctl_state_peer { + struct pfctl_state_scrub *scrub; + uint32_t seqlo; + uint32_t seqhi; + uint32_t seqdiff; + uint16_t max_win; + uint16_t mss; + uint8_t state; + uint8_t wscale; +}; + +struct pfctl_state_key { + struct pf_addr addr[2]; + uint16_t port[2]; + sa_family_t af; + uint8_t proto; +}; + +struct pfctl_state { + TAILQ_ENTRY(pfctl_state) entry; + + uint64_t id; + uint32_t creatorid; + uint8_t direction; + + struct pfctl_state_peer src; + struct pfctl_state_peer dst; + + uint32_t rule; + uint32_t anchor; + uint32_t nat_rule; + struct pf_addr rt_addr; + struct pfctl_state_key key[2]; /* addresses stack and wire */ + char ifname[IFNAMSIZ]; + uint64_t packets[2]; + uint64_t bytes[2]; + uint32_t creation; + uint32_t expire; + uint32_t pfsync_time; + uint16_t tag; + uint8_t log; + uint8_t state_flags; + uint8_t timeout; + uint32_t sync_flags; +}; + +TAILQ_HEAD(pfctl_statelist, pfctl_state); +struct pfctl_states { + struct pfctl_statelist states; + size_t count; +}; + int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, char *anchor_call); @@ -207,6 +265,8 @@ int pfctl_add_rule(int dev, const struct pfctl_rule *r, const char *anchor, const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket); int pfctl_set_keepcounters(int dev, bool keep); +int pfctl_get_states(int dev, struct pfctl_states *states); +void pfctl_free_states(struct pfctl_states *states); int pfctl_clear_states(int dev, const struct pfctl_kill *kill, unsigned int *killed); int pfctl_kill_states(int dev, const struct pfctl_kill *kill, diff --git a/sbin/pfctl/pf_print_state.c b/sbin/pfctl/pf_print_state.c index e2f9d6efe609..7119308d195b 100644 --- a/sbin/pfctl/pf_print_state.c +++ b/sbin/pfctl/pf_print_state.c @@ -196,25 +196,27 @@ print_host(struct pf_addr *addr, u_int16_t port, sa_family_t af, int opts) } void -print_seq(struct pfsync_state_peer *p) +print_seq(struct pfctl_state_peer *p) { if (p->seqdiff) - printf("[%u + %u](+%u)", ntohl(p->seqlo), - ntohl(p->seqhi) - ntohl(p->seqlo), ntohl(p->seqdiff)); + printf("[%u + %u](+%u)", p->seqlo, + p->seqhi - p->seqlo, p->seqdiff); else - printf("[%u + %u]", ntohl(p->seqlo), - ntohl(p->seqhi) - ntohl(p->seqlo)); + printf("[%u + %u]", p->seqlo, + p->seqhi - p->seqlo); } void -print_state(struct pfsync_state *s, int opts) +print_state(struct pfctl_state *s, int opts) { - struct pfsync_state_peer *src, *dst; - struct pfsync_state_key *key, *sk, *nk; + struct pfctl_state_peer *src, *dst; + struct pfctl_state_key *key, *sk, *nk; struct protoent *p; int min, sec; + sa_family_t af; + uint8_t proto; #ifndef __NO_STRICT_ALIGNMENT - struct pfsync_state_key aligned_key[2]; + struct pfctl_state_key aligned_key[2]; bcopy(&s->key, aligned_key, sizeof(aligned_key)); key = aligned_key; @@ -222,48 +224,51 @@ print_state(struct pfsync_state *s, int opts) key = s->key; #endif + af = s->key[PF_SK_WIRE].af; + proto = s->key[PF_SK_WIRE].proto; + if (s->direction == PF_OUT) { src = &s->src; dst = &s->dst; sk = &key[PF_SK_STACK]; nk = &key[PF_SK_WIRE]; - if (s->proto == IPPROTO_ICMP || s->proto == IPPROTO_ICMPV6) + if (proto == IPPROTO_ICMP || proto == IPPROTO_ICMPV6) sk->port[0] = nk->port[0]; } else { src = &s->dst; dst = &s->src; sk = &key[PF_SK_WIRE]; nk = &key[PF_SK_STACK]; - if (s->proto == IPPROTO_ICMP || s->proto == IPPROTO_ICMPV6) + if (proto == IPPROTO_ICMP || proto == IPPROTO_ICMPV6) sk->port[1] = nk->port[1]; } printf("%s ", s->ifname); - if ((p = getprotobynumber(s->proto)) != NULL) + if ((p = getprotobynumber(proto)) != NULL) printf("%s ", p->p_name); else - printf("%u ", s->proto); + printf("%u ", proto); - print_host(&nk->addr[1], nk->port[1], s->af, opts); - if (PF_ANEQ(&nk->addr[1], &sk->addr[1], s->af) || + print_host(&nk->addr[1], nk->port[1], af, opts); + if (PF_ANEQ(&nk->addr[1], &sk->addr[1], af) || nk->port[1] != sk->port[1]) { printf(" ("); - print_host(&sk->addr[1], sk->port[1], s->af, opts); + print_host(&sk->addr[1], sk->port[1], af, opts); printf(")"); } if (s->direction == PF_OUT) printf(" -> "); else printf(" <- "); - print_host(&nk->addr[0], nk->port[0], s->af, opts); - if (PF_ANEQ(&nk->addr[0], &sk->addr[0], s->af) || + print_host(&nk->addr[0], nk->port[0], af, opts); + if (PF_ANEQ(&nk->addr[0], &sk->addr[0], af) || nk->port[0] != sk->port[0]) { printf(" ("); - print_host(&sk->addr[0], sk->port[0], s->af, opts); + print_host(&sk->addr[0], sk->port[0], af, opts); printf(")"); } printf(" "); - if (s->proto == IPPROTO_TCP) { + if (proto == IPPROTO_TCP) { if (src->state <= TCPS_TIME_WAIT && dst->state <= TCPS_TIME_WAIT) printf(" %s:%s\n", tcpstates[src->state], @@ -290,16 +295,16 @@ print_state(struct pfsync_state *s, int opts) dst->wscale & PF_WSCALE_MASK); printf("\n"); } - } else if (s->proto == IPPROTO_UDP && src->state < PFUDPS_NSTATES && + } else if (proto == IPPROTO_UDP && src->state < PFUDPS_NSTATES && dst->state < PFUDPS_NSTATES) { const char *states[] = PFUDPS_NAMES; printf(" %s:%s\n", states[src->state], states[dst->state]); #ifndef INET6 - } else if (s->proto != IPPROTO_ICMP && src->state < PFOTHERS_NSTATES && + } else if (proto != IPPROTO_ICMP && src->state < PFOTHERS_NSTATES && dst->state < PFOTHERS_NSTATES) { #else - } else if (s->proto != IPPROTO_ICMP && s->proto != IPPROTO_ICMPV6 && + } else if (proto != IPPROTO_ICMP && proto != IPPROTO_ICMPV6 && src->state < PFOTHERS_NSTATES && dst->state < PFOTHERS_NSTATES) { #endif /* XXX ICMP doesn't really have state levels */ @@ -311,10 +316,8 @@ print_state(struct pfsync_state *s, int opts) } if (opts & PF_OPT_VERBOSE) { - u_int64_t packets[2]; - u_int64_t bytes[2]; - u_int32_t creation = ntohl(s->creation); - u_int32_t expire = ntohl(s->expire); + u_int32_t creation = s->creation; + u_int32_t expire = s->expire; sec = creation % 60; creation /= 60; @@ -327,19 +330,15 @@ print_state(struct pfsync_state *s, int opts) expire /= 60; printf(", expires in %.2u:%.2u:%.2u", expire, min, sec); - bcopy(s->packets[0], &packets[0], sizeof(u_int64_t)); - bcopy(s->packets[1], &packets[1], sizeof(u_int64_t)); - bcopy(s->bytes[0], &bytes[0], sizeof(u_int64_t)); - bcopy(s->bytes[1], &bytes[1], sizeof(u_int64_t)); printf(", %ju:%ju pkts, %ju:%ju bytes", - (uintmax_t )be64toh(packets[0]), - (uintmax_t )be64toh(packets[1]), - (uintmax_t )be64toh(bytes[0]), - (uintmax_t )be64toh(bytes[1])); - if (ntohl(s->anchor) != -1) - printf(", anchor %u", ntohl(s->anchor)); - if (ntohl(s->rule) != -1) - printf(", rule %u", ntohl(s->rule)); + s->packets[0], + s->packets[1], + s->bytes[0], + s->bytes[1]); + if (s->anchor != -1) + printf(", anchor %u", s->anchor); + if (s->rule != -1) + printf(", rule %u", s->rule); if (s->state_flags & PFSTATE_SLOPPY) printf(", sloppy"); if (s->sync_flags & PFSYNC_FLAG_SRCNODE) @@ -352,10 +351,9 @@ print_state(struct pfsync_state *s, int opts) u_int64_t id; bcopy(&s->id, &id, sizeof(u_int64_t)); - printf(" id: %016jx creatorid: %08x", - (uintmax_t )be64toh(id), ntohl(s->creatorid)); + printf(" id: %016jx creatorid: %08x", id, s->creatorid); printf(" gateway: "); - print_host(&s->rt_addr, 0, s->af, opts); + print_host(&s->rt_addr, 0, af, opts); printf("\n"); } } diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index fd937cac9f63..f82d75198d61 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1237,48 +1237,27 @@ done: int pfctl_show_states(int dev, const char *iface, int opts) { - struct pfioc_states ps; - struct pfsync_state *p; - char *inbuf = NULL, *newinbuf = NULL; - unsigned int len = 0; - int i, dotitle = (opts & PF_OPT_SHOWALL); + struct pfctl_states states; + struct pfctl_state *s; + int dotitle = (opts & PF_OPT_SHOWALL); - memset(&ps, 0, sizeof(ps)); - for (;;) { - ps.ps_len = len; - if (len) { - newinbuf = realloc(inbuf, len); - if (newinbuf == NULL) - err(1, "realloc"); - ps.ps_buf = inbuf = newinbuf; - } - if (ioctl(dev, DIOCGETSTATES, &ps) < 0) { - warn("DIOCGETSTATES"); - free(inbuf); - return (-1); - } - if (ps.ps_len + sizeof(struct pfioc_states) < len) - break; - if (len == 0 && ps.ps_len == 0) - goto done; - if (len == 0 && ps.ps_len != 0) - len = ps.ps_len; - if (ps.ps_len == 0) - goto done; /* no states */ - len *= 2; - } - p = ps.ps_states; - for (i = 0; i < ps.ps_len; i += sizeof(*p), p++) { - if (iface != NULL && strcmp(p->ifname, iface)) + memset(&states, 0, sizeof(states)); + + if (pfctl_get_states(dev, &states)) + return (-1); + + TAILQ_FOREACH(s, &states.states, entry) { + if (iface != NULL && strcmp(s->ifname, iface)) continue; if (dotitle) { pfctl_print_title("STATES:"); dotitle = 0; } - print_state(p, opts); + print_state(s, opts); } -done: - free(inbuf); + + pfctl_free_states(&states); + return (0); } diff --git a/sbin/pfctl/pfctl.h b/sbin/pfctl/pfctl.h index 93b3af083b5f..f8ff5012e01b 100644 --- a/sbin/pfctl/pfctl.h +++ b/sbin/pfctl/pfctl.h @@ -120,8 +120,8 @@ char *rate2str(double); void print_addr(struct pf_addr_wrap *, sa_family_t, int); void print_host(struct pf_addr *, u_int16_t p, sa_family_t, int); -void print_seq(struct pfsync_state_peer *); -void print_state(struct pfsync_state *, int); +void print_seq(struct pfctl_state_peer *); +void print_state(struct pfctl_state *, int); int unmask(struct pf_addr *, sa_family_t); int pfctl_cmdline_symset(char *); From owner-dev-commits-src-all@freebsd.org Thu May 20 11:54:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 427E263C302; Thu, 20 May 2021 11:54: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 4Fm7T90Bbgz3GWm; Thu, 20 May 2021 11:54: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 D5A722535E; Thu, 20 May 2021 11:54: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 14KBsqTC056890; Thu, 20 May 2021 11:54:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KBsqX1056889; Thu, 20 May 2021 11:54:52 GMT (envelope-from git) Date: Thu, 20 May 2021 11:54:52 GMT Message-Id: <202105201154.14KBsqX1056889@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: d0fdf2b28f9b - main - pf: Track the original kif for floating states 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/main X-Git-Reftype: branch X-Git-Commit: d0fdf2b28f9b981d2cb98e9da8a715e046ef1e92 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 11:54:53 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d0fdf2b28f9b981d2cb98e9da8a715e046ef1e92 commit d0fdf2b28f9b981d2cb98e9da8a715e046ef1e92 Author: Kristof Provost AuthorDate: 2021-05-12 11:24:57 +0000 Commit: Kristof Provost CommitDate: 2021-05-20 10:49:27 +0000 pf: Track the original kif for floating states Track (and display) the interface that created a state, even if it's a floating state (and thus uses virtual interface 'all'). MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30245 --- lib/libpfctl/libpfctl.c | 2 ++ lib/libpfctl/libpfctl.h | 1 + sbin/pfctl/pf_print_state.c | 5 ++++- sys/net/pfvar.h | 2 ++ sys/netpfil/pf/if_pfsync.c | 2 +- sys/netpfil/pf/pf.c | 7 ++++--- sys/netpfil/pf/pf_ioctl.c | 1 + 7 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 6a6ecd8fb136..e207a55a8673 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -699,6 +699,8 @@ pf_nvstate_to_state(const nvlist_t *nvl, struct pfctl_state *s) strlcpy(s->ifname, nvlist_get_string(nvl, "ifname"), sizeof(s->ifname)); + strlcpy(s->orig_ifname, nvlist_get_string(nvl, "orig_ifname"), + sizeof(s->orig_ifname)); pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "rt_addr"), &s->rt_addr); s->rule = nvlist_get_number(nvl, "rule"); diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 05447b5d8673..a54ee9db6ec7 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -237,6 +237,7 @@ struct pfctl_state { struct pf_addr rt_addr; struct pfctl_state_key key[2]; /* addresses stack and wire */ char ifname[IFNAMSIZ]; + char orig_ifname[IFNAMSIZ]; uint64_t packets[2]; uint64_t bytes[2]; uint32_t creation; diff --git a/sbin/pfctl/pf_print_state.c b/sbin/pfctl/pf_print_state.c index 7119308d195b..b1f0079154cf 100644 --- a/sbin/pfctl/pf_print_state.c +++ b/sbin/pfctl/pf_print_state.c @@ -352,9 +352,12 @@ print_state(struct pfctl_state *s, int opts) bcopy(&s->id, &id, sizeof(u_int64_t)); printf(" id: %016jx creatorid: %08x", id, s->creatorid); - printf(" gateway: "); + printf(" gateway: "); print_host(&s->rt_addr, 0, af, opts); printf("\n"); + + if (strcmp(s->ifname, s->orig_ifname) != 0) + printf(" origif: %s\n", s->orig_ifname); } } diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index d9e35dae753a..2202421086d2 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -522,6 +522,7 @@ struct pf_state { struct pf_addr rt_addr; struct pf_state_key *key[2]; /* addresses stack and wire */ struct pfi_kkif *kif; + struct pfi_kkif *orig_kif; /* The real kif, even if we're a floating state (i.e. if == V_pfi_all). */ struct pfi_kkif *rt_kif; struct pf_ksrc_node *src_node; struct pf_ksrc_node *nat_src_node; @@ -1475,6 +1476,7 @@ extern int pf_unlink_state(struct pf_state *, u_int); #define PF_ENTER_LOCKED 0x00000001 #define PF_RETURN_LOCKED 0x00000002 extern int pf_state_insert(struct pfi_kkif *, + struct pfi_kkif *, struct pf_state_key *, struct pf_state_key *, struct pf_state *); diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 96813fd11dc3..3514c922c361 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -593,7 +593,7 @@ pfsync_state_import(struct pfsync_state *sp, u_int8_t flags) if (!(flags & PFSYNC_SI_IOCTL)) st->state_flags |= PFSTATE_NOSYNC; - if ((error = pf_state_insert(kif, skw, sks, st)) != 0) + if ((error = pf_state_insert(kif, kif, skw, sks, st)) != 0) goto cleanup_state; /* XXX when we have nat_rule/anchors, use STATE_INC_COUNTERS */ diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index a5c4ef6bfbb4..985b55af5263 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1263,8 +1263,8 @@ pf_state_key_clone(struct pf_state_key *orig) } int -pf_state_insert(struct pfi_kkif *kif, struct pf_state_key *skw, - struct pf_state_key *sks, struct pf_state *s) +pf_state_insert(struct pfi_kkif *kif, struct pfi_kkif *orig_kif, + struct pf_state_key *skw, struct pf_state_key *sks, struct pf_state *s) { struct pf_idhash *ih; struct pf_state *cur; @@ -1277,6 +1277,7 @@ pf_state_insert(struct pfi_kkif *kif, struct pf_state_key *skw, KASSERT(s->refs == 0, ("%s: state not pristine", __func__)); s->kif = kif; + s->orig_kif = orig_kif; if (s->id == 0 && s->creatorid == 0) { /* XXX: should be atomic, but probability of collision low */ @@ -3877,7 +3878,7 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, __func__, nr, sk, nk)); /* Swap sk/nk for PF_OUT. */ - if (pf_state_insert(BOUND_IFACE(r, kif), + if (pf_state_insert(BOUND_IFACE(r, kif), kif, (pd->dir == PF_IN) ? sk : nk, (pd->dir == PF_IN) ? nk : sk, s)) { if (pd->proto == IPPROTO_TCP) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 8424e0ce5689..62c1f35c3c3f 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2562,6 +2562,7 @@ pf_state_to_nvstate(const struct pf_state *s) nvlist_add_number(nvl, "id", s->id); nvlist_add_string(nvl, "ifname", s->kif->pfik_name); + nvlist_add_string(nvl, "orig_ifname", s->orig_kif->pfik_name); tmp = pf_state_key_to_nvstate_key(s->key[PF_SK_STACK]); if (tmp == NULL) From owner-dev-commits-src-all@freebsd.org Thu May 20 11:54:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4920F63BF5F; Thu, 20 May 2021 11:54: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 4Fm7TB0PFxz3GZD; Thu, 20 May 2021 11:54: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 E456A25A01; Thu, 20 May 2021 11:54: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 14KBsrZQ056911; Thu, 20 May 2021 11:54:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KBsrXX056910; Thu, 20 May 2021 11:54:53 GMT (envelope-from git) Date: Thu, 20 May 2021 11:54:53 GMT Message-Id: <202105201154.14KBsrXX056910@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: b62489cc92ed - main - pf: Support killing floating states by interface 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/main X-Git-Reftype: branch X-Git-Commit: b62489cc92edbec318fb6c57cdc02b5e3cfa3a67 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 11:54:54 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b62489cc92edbec318fb6c57cdc02b5e3cfa3a67 commit b62489cc92edbec318fb6c57cdc02b5e3cfa3a67 Author: Kristof Provost AuthorDate: 2021-05-13 07:51:28 +0000 Commit: Kristof Provost CommitDate: 2021-05-20 10:49:27 +0000 pf: Support killing floating states by interface Floating states get assigned to interface 'all' (V_pfi_all), so when we try to flush all states for an interface states originally created through this interface are not flushed. Only if-bound states can be flushed in this way. Given that we track the original interface we can check if the state's interface is 'all', and if so compare to the orig_if instead. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30246 --- sys/netpfil/pf/pf_ioctl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 62c1f35c3c3f..91a175caa74f 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2828,10 +2828,14 @@ pf_killstates_row(struct pf_kstate_kill *psk, struct pf_idhash *ih) int idx, killed = 0; unsigned int dir; u_int16_t srcport, dstport; + struct pfi_kkif *kif; relock_DIOCKILLSTATES: PF_HASHROW_LOCK(ih); LIST_FOREACH(s, &ih->states, entry) { + /* For floating states look at the original kif. */ + kif = s->kif == V_pfi_all ? s->orig_kif : s->kif; + sk = s->key[PF_SK_WIRE]; if (s->direction == PF_OUT) { srcaddr = &sk->addr[1]; @@ -2880,7 +2884,7 @@ relock_DIOCKILLSTATES: continue; if (psk->psk_ifname[0] && strcmp(psk->psk_ifname, - s->kif->pfik_name)) + kif->pfik_name)) continue; if (psk->psk_kill_match) { @@ -5662,6 +5666,7 @@ pf_clear_states(const struct pf_kstate_kill *kill) { struct pf_state_key_cmp match_key; struct pf_state *s; + struct pfi_kkif *kif; int idx; unsigned int killed = 0, dir; @@ -5671,9 +5676,12 @@ pf_clear_states(const struct pf_kstate_kill *kill) relock_DIOCCLRSTATES: PF_HASHROW_LOCK(ih); LIST_FOREACH(s, &ih->states, entry) { + /* For floating states look at the original kif. */ + kif = s->kif == V_pfi_all ? s->orig_kif : s->kif; + if (kill->psk_ifname[0] && strcmp(kill->psk_ifname, - s->kif->pfik_name)) + kif->pfik_name)) continue; if (kill->psk_kill_match) { From owner-dev-commits-src-all@freebsd.org Thu May 20 11:54:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7F8B363C1C5; Thu, 20 May 2021 11:54: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 4Fm7TC275yz3GdW; Thu, 20 May 2021 11:54: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 1E5D5258A4; Thu, 20 May 2021 11:54: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 14KBssiZ056932; Thu, 20 May 2021 11:54:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KBssbM056931; Thu, 20 May 2021 11:54:54 GMT (envelope-from git) Date: Thu, 20 May 2021 11:54:54 GMT Message-Id: <202105201154.14KBssbM056931@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 7bd7933f9a4f - main - pf tests: Test the ability to kill floating states by interface 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/main X-Git-Reftype: branch X-Git-Commit: 7bd7933f9a4f1757fdefeee2e1ac8b8c4d299fc3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 11:54:55 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7bd7933f9a4f1757fdefeee2e1ac8b8c4d299fc3 commit 7bd7933f9a4f1757fdefeee2e1ac8b8c4d299fc3 Author: Kristof Provost AuthorDate: 2021-05-13 08:04:20 +0000 Commit: Kristof Provost CommitDate: 2021-05-20 10:49:27 +0000 pf tests: Test the ability to kill floating states by interface Reviewed by: eri MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30247 --- tests/sys/netpfil/pf/killstate.sh | 60 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/tests/sys/netpfil/pf/killstate.sh b/tests/sys/netpfil/pf/killstate.sh index ec01910f0867..b3d94a245548 100644 --- a/tests/sys/netpfil/pf/killstate.sh +++ b/tests/sys/netpfil/pf/killstate.sh @@ -447,6 +447,65 @@ match_cleanup() pft_cleanup } +atf_test_case "interface" "cleanup" +interface_head() +{ + atf_set descr 'Test killing states based on interface' + atf_set require.user root + atf_set require.progs scapy +} + +interface_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + jexec alcatraz pfctl -e + + pft_set_rules alcatraz "block all" \ + "pass in proto icmp" + + # Sanity check & establish state + # Note: use pft_ping so we always use the same ID, so pf considers all + # echo requests part of the same flow. + atf_check -s exit:0 -o ignore ${common_dir}/pft_ping.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --replyif ${epair}a + + # Change rules to now deny the ICMP traffic + pft_set_rules noflush alcatraz "block all" + + # Established state means we can still ping alcatraz + atf_check -s exit:0 -o ignore ${common_dir}/pft_ping.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --replyif ${epair}a + + # Flushing states on a different interface doesn't affect our state + jexec alcatraz pfctl -i ${epair}a -Fs + atf_check -s exit:0 -o ignore ${common_dir}/pft_ping.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --replyif ${epair}a + + # Flushing on the correct interface does (even with floating states) + jexec alcatraz pfctl -i ${epair}b -Fs + atf_check -s exit:1 -o ignore ${common_dir}/pft_ping.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --replyif ${epair}a +} + +interface_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4" @@ -455,4 +514,5 @@ atf_init_test_cases() atf_add_test_case "multilabel" atf_add_test_case "gateway" atf_add_test_case "match" + atf_add_test_case "interface" } From owner-dev-commits-src-all@freebsd.org Thu May 20 12:06:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 24ED763CED9; Thu, 20 May 2021 12:06: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 4Fm7km0WS5z3M67; Thu, 20 May 2021 12:06: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 EE0B825E85; Thu, 20 May 2021 12:06: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 14KC6dQB070975; Thu, 20 May 2021 12:06:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KC6dhR070974; Thu, 20 May 2021 12:06:39 GMT (envelope-from git) Date: Thu, 20 May 2021 12:06:39 GMT Message-Id: <202105201206.14KC6dhR070974@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 26705a39e51e - main - pfctl: Fix crash on ALTQ configuration 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/main X-Git-Reftype: branch X-Git-Commit: 26705a39e51eaf5b32efa98fb86df2d4ecfbdc61 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 12:06:40 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=26705a39e51eaf5b32efa98fb86df2d4ecfbdc61 commit 26705a39e51eaf5b32efa98fb86df2d4ecfbdc61 Author: Kristof Provost AuthorDate: 2021-05-18 13:03:01 +0000 Commit: Kristof Provost CommitDate: 2021-05-20 12:06:22 +0000 pfctl: Fix crash on ALTQ configuration The following config could crash pfctl: altq on igb0 fairq bandwidth 1Gb queue { qLink } queue qLink fairq(default) That happens because when we're parsing the parent queue (on igb0) it doesn't have a parent, and the check in eval_pfqueue_fairq() checks pa->parent rather than parent. This was changed in eval_pfqueue_hfsc() in 1d34c9dac8624c5c315ae39ad3ae8e5879b23256, but not for fairq. Reviewed by: pkelsey MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30346 --- sbin/pfctl/pfctl_altq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/pfctl/pfctl_altq.c b/sbin/pfctl/pfctl_altq.c index 6541c031c75e..304bf69d7c7a 100644 --- a/sbin/pfctl/pfctl_altq.c +++ b/sbin/pfctl/pfctl_altq.c @@ -864,7 +864,7 @@ eval_pfqueue_fairq(struct pfctl *pf __unused, struct pf_altq *pa, opts = &pa->pq_u.fairq_opts; - if (pa->parent == NULL) { + if (parent == NULL) { /* root queue */ opts->lssc_m1 = pa->ifbandwidth; opts->lssc_m2 = pa->ifbandwidth; From owner-dev-commits-src-all@freebsd.org Thu May 20 12:06:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4B32763D1C4; Thu, 20 May 2021 12:06: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 4Fm7kn1XJRz3Ly3; Thu, 20 May 2021 12:06: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 1BDF125B18; Thu, 20 May 2021 12:06: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 14KC6f6D070996; Thu, 20 May 2021 12:06:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KC6fdp070995; Thu, 20 May 2021 12:06:41 GMT (envelope-from git) Date: Thu, 20 May 2021 12:06:41 GMT Message-Id: <202105201206.14KC6fdp070995@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: dc784287967d - main - pfctl: Ensure parent queue is configured for FAIRQ 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/main X-Git-Reftype: branch X-Git-Commit: dc784287967d45ab681dc51e9e20b78c8c535834 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 12:06:41 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=dc784287967d45ab681dc51e9e20b78c8c535834 commit dc784287967d45ab681dc51e9e20b78c8c535834 Author: Kristof Provost AuthorDate: 2021-05-18 16:22:13 +0000 Commit: Kristof Provost CommitDate: 2021-05-20 12:06:23 +0000 pfctl: Ensure parent queue is configured for FAIRQ We failed to account for the FAIRQ scheduler in expand_altq(), which led it to be set up without its parent queue. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30347 --- sbin/pfctl/parse.y | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 6acfefbf5ad3..4448a8255ce1 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -5107,7 +5107,8 @@ expand_altq(struct pf_altq *a, struct node_if *interfaces, } if (pa.scheduler == ALTQT_CBQ || - pa.scheduler == ALTQT_HFSC) { + pa.scheduler == ALTQT_HFSC || + pa.scheduler == ALTQT_FAIRQ) { /* now create a root queue */ memset(&pb, 0, sizeof(struct pf_altq)); if (strlcpy(qname, "root_", sizeof(qname)) >= @@ -5138,7 +5139,8 @@ expand_altq(struct pf_altq *a, struct node_if *interfaces, if (n == NULL) err(1, "expand_altq: calloc"); if (pa.scheduler == ALTQT_CBQ || - pa.scheduler == ALTQT_HFSC) + pa.scheduler == ALTQT_HFSC || + pa.scheduler == ALTQT_FAIRQ) if (strlcpy(n->parent, qname, sizeof(n->parent)) >= sizeof(n->parent)) From owner-dev-commits-src-all@freebsd.org Thu May 20 12:06:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EDAFC63CEDE; Thu, 20 May 2021 12:06: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 4Fm7kp2p1pz3Lq7; Thu, 20 May 2021 12:06: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 364D625A4A; Thu, 20 May 2021 12:06: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 14KC6gEC071021; Thu, 20 May 2021 12:06:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KC6ghH071020; Thu, 20 May 2021 12:06:42 GMT (envelope-from git) Date: Thu, 20 May 2021 12:06:42 GMT Message-Id: <202105201206.14KC6ghH071020@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 9938fcaa6565 - main - pfctl tests: Test fairq configuration 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/main X-Git-Reftype: branch X-Git-Commit: 9938fcaa6565a660c555a0e9c712842ba1a2d31c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 12:06:43 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9938fcaa6565a660c555a0e9c712842ba1a2d31c commit 9938fcaa6565a660c555a0e9c712842ba1a2d31c Author: Kristof Provost AuthorDate: 2021-05-19 07:52:50 +0000 Commit: Kristof Provost CommitDate: 2021-05-20 12:06:23 +0000 pfctl tests: Test fairq configuration We used to have a bug where pfctl could crash setting fairq queues. Test this case and ensure it does not crash pfctl. Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30348 --- sbin/pfctl/tests/files/pf1006.in | 2 ++ sbin/pfctl/tests/files/pf1006.ok | 2 ++ sbin/pfctl/tests/pfctl_test_list.inc | 1 + 3 files changed, 5 insertions(+) diff --git a/sbin/pfctl/tests/files/pf1006.in b/sbin/pfctl/tests/files/pf1006.in new file mode 100644 index 000000000000..b50c16994cfc --- /dev/null +++ b/sbin/pfctl/tests/files/pf1006.in @@ -0,0 +1,2 @@ +altq on igb0 fairq bandwidth 1Gb queue { qLink } +queue qLink fairq(default) diff --git a/sbin/pfctl/tests/files/pf1006.ok b/sbin/pfctl/tests/files/pf1006.ok new file mode 100644 index 000000000000..be44b765c2e9 --- /dev/null +++ b/sbin/pfctl/tests/files/pf1006.ok @@ -0,0 +1,2 @@ +altq on igb0 fairq bandwidth 1Gb tbrsize 36000 queue { qLink } +queue qLink fairq( default ) diff --git a/sbin/pfctl/tests/pfctl_test_list.inc b/sbin/pfctl/tests/pfctl_test_list.inc index 337dff640f42..060a6019d05c 100644 --- a/sbin/pfctl/tests/pfctl_test_list.inc +++ b/sbin/pfctl/tests/pfctl_test_list.inc @@ -116,3 +116,4 @@ PFCTL_TEST(1002, "Set timeout interval") PFCTL_TEST(1003, "ALTQ") PFCTL_TEST(1004, "ALTQ with Codel") PFCTL_TEST(1005, "PR 231323") +PFCTL_TEST(1006, "pfctl crashes with certain fairq configurations") From owner-dev-commits-src-all@freebsd.org Thu May 20 13:08:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1885863E781; Thu, 20 May 2021 13:08:32 +0000 (UTC) (envelope-from jclarke@marcuscom.com) Received: from creme-brulee.marcuscom.com (creme-brulee.marcuscom.com [IPv6:2607:fc50:1:f300::2]) (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 (2048 bits) client-digest SHA256) (Client CN "*.marcuscom.com", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fm96773VXz4XKV; Thu, 20 May 2021 13:08:31 +0000 (UTC) (envelope-from jclarke@marcuscom.com) Received: from [10.116.79.227] ([173.38.117.71]) (authenticated bits=0) by creme-brulee.marcuscom.com (8.16.1/8.16.1) with ESMTPSA id 14KD7IY6093125 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Thu, 20 May 2021 09:07:34 -0400 (EDT) (envelope-from jclarke@marcuscom.com) X-Authentication-Warning: creme-brulee.marcuscom.com: Host [173.38.117.71] claimed to be [10.116.79.227] Subject: Re: git: 3d846e48227e - main - Do not forward datagrams originated by link-local addresses To: Benjamin Kaduk , Zhenlei Huang Cc: "Rodney W. Grimes" , Lutz Donnerhacke , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202105182101.14IL1Gki054229@gitrepo.freebsd.org> <20210519055407.GA9715@belenus.iks-jena.de> <10b475c5-0100-2567-4e92-73b168b97e3f@marcuscom.com> <1DD8ABB9-94B1-4B44-8003-25432A91D520@gmail.com> From: Joe Clarke Message-ID: <5cee6177-8b75-382e-cd3a-403397de0190@marcuscom.com> Date: Thu, 20 May 2021 09:07:08 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=2.5 required=5.0 tests=NICE_REPLY_A,RDNS_NONE autolearn=disabled version=3.4.5 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on creme-brulee.marcuscom.com X-Rspamd-Queue-Id: 4Fm96773VXz4XKV X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_RCPT(0.00)[]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 13:08:32 -0000 On 5/19/21 22:39, Benjamin Kaduk wrote: > On Wed, May 19, 2021 at 7:33 PM Zhenlei Huang wrote: > >>> IMHO, I'd like to see the RFC reference remain. I see rgrimes response >>> that the RFC's can change with errata and bis docs, but the anchor still >>> provides additional context that one can use to learn more about why >>> this code exists, and they can chase any future forward references. >> RFC's indeed change, and I think it is common in network stack. Then we >> need guidelines to better regulate these. CC rgrimes . >> > > Sorry, RFCs themselves do not change -- one of the distinctive features of > RFCs is precisely that they are immutable once published. > The sentiment that what the current RFC for a given topic is, can change, is > something that I can agree with, but that's not quite what was being > discussed. Agreed, which is why I say the reference still has value and one can use it as a basis to follow the errata and newer docs. That said, I've expressed my desire to leave the reference in, and I'll leave it at that. I didn't think this would be that controversial. Joe -- PGP Key : http://www.marcuscom.com/pgp.asc From owner-dev-commits-src-all@freebsd.org Thu May 20 14:10:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Thu May 20 14:10:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Thu May 20 14:10:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Thu May 20 14:10:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Thu May 20 14:10:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Thu May 20 14:10:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Thu May 20 15:27:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2A0FE641B35; Thu, 20 May 2021 15:27: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 4FmDBm0lFcz4frd; Thu, 20 May 2021 15:27: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 01C3E285D0; Thu, 20 May 2021 15:27: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 14KFRhql036649; Thu, 20 May 2021 15: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 14KFRhEL036648; Thu, 20 May 2021 15:27:43 GMT (envelope-from git) Date: Thu, 20 May 2021 15:27:43 GMT Message-Id: <202105201527.14KFRhEL036648@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f17a5900850b - main - ufs: Avoid M_WAITOK allocations when building a dirhash 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/main X-Git-Reftype: branch X-Git-Commit: f17a5900850b4d449a91cbe9c61dfb62373c3cd1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 15:27:44 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f17a5900850b4d449a91cbe9c61dfb62373c3cd1 commit f17a5900850b4d449a91cbe9c61dfb62373c3cd1 Author: Don Morris AuthorDate: 2021-05-20 14:54:38 +0000 Commit: Mark Johnston CommitDate: 2021-05-20 15:25:45 +0000 ufs: Avoid M_WAITOK allocations when building a dirhash At this point the directory's vnode lock is held, so blocking while waiting for free pages makes the system more susceptible to deadlock in low memory conditions. This is particularly problematic on NUMA systems as UMA currently implements a strict first-touch policy. ufsdirhash_build() already uses M_NOWAIT for other allocations and already handled failures for the block array allocation, so just convert to M_NOWAIT. PR: 253992 Reviewed by: markj, mckusick, vangyzen MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29045 --- sys/ufs/ufs/ufs_dirhash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/ufs/ufs/ufs_dirhash.c b/sys/ufs/ufs/ufs_dirhash.c index 13094b5a1c97..d1e1bed0bde4 100644 --- a/sys/ufs/ufs/ufs_dirhash.c +++ b/sys/ufs/ufs/ufs_dirhash.c @@ -108,7 +108,7 @@ static uma_zone_t ufsdirhash_zone; #define DIRHASHLIST_LOCK() mtx_lock(&ufsdirhash_mtx) #define DIRHASHLIST_UNLOCK() mtx_unlock(&ufsdirhash_mtx) -#define DIRHASH_BLKALLOC_WAITOK() uma_zalloc(ufsdirhash_zone, M_WAITOK) +#define DIRHASH_BLKALLOC() uma_zalloc(ufsdirhash_zone, M_NOWAIT) #define DIRHASH_BLKFREE(ptr) uma_zfree(ufsdirhash_zone, (ptr)) #define DIRHASH_ASSERT_LOCKED(dh) \ sx_assert(&(dh)->dh_lock, SA_LOCKED) @@ -425,7 +425,7 @@ ufsdirhash_build(struct inode *ip) if (dh->dh_blkfree == NULL) goto fail; for (i = 0; i < narrays; i++) { - if ((dh->dh_hash[i] = DIRHASH_BLKALLOC_WAITOK()) == NULL) + if ((dh->dh_hash[i] = DIRHASH_BLKALLOC()) == NULL) goto fail; for (j = 0; j < DH_NBLKOFF; j++) dh->dh_hash[i][j] = DIRHASH_EMPTY; From owner-dev-commits-src-all@freebsd.org Thu May 20 16:59:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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 71628643E23; Thu, 20 May 2021 16:59: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 4FmGDq2Ztcz4VYr; Thu, 20 May 2021 16:59: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 42379298D2; Thu, 20 May 2021 16:59: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 14KGxd7I056449; Thu, 20 May 2021 16:59:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KGxdOQ056448; Thu, 20 May 2021 16:59:39 GMT (envelope-from git) Date: Thu, 20 May 2021 16:59:39 GMT Message-Id: <202105201659.14KGxdOQ056448@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 71e3d1b3a0ee - main - iscsi: Always free a cdw before its associated ctl_io. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 71e3d1b3a0ee4080c53615167bde4d93efe103fe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 16:59:39 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=71e3d1b3a0ee4080c53615167bde4d93efe103fe commit 71e3d1b3a0ee4080c53615167bde4d93efe103fe Author: John Baldwin AuthorDate: 2021-05-20 16:58:59 +0000 Commit: John Baldwin CommitDate: 2021-05-20 16:58:59 +0000 iscsi: Always free a cdw before its associated ctl_io. cxgbei stores state about a target transfer in the ctl_private[] array of a ctl_io that is freed when a target transfer (represented by the cdw) is freed. As such, freeing a ctl_io before a cdw that references it can result in a use after free in cxgbei. Two of the four places freed the cdw first, and the other two freed the ctl_io first. Fix the latter two places to free the cdw first. Reported by: Jithesh Arakkan @ Chelsio Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D30270 --- sys/cam/ctl/ctl_frontend_iscsi.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index fdbc06150f93..a5a80848c763 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -1112,7 +1112,7 @@ static void cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs) { struct cfiscsi_data_wait *cdw; - union ctl_io *io; + union ctl_io *io, *cdw_io; int error, last, wait; if (cs->cs_target == NULL) @@ -1144,10 +1144,11 @@ cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs) * assuming that the data transfer actually succeeded * and writing uninitialized data to disk. */ - cdw->cdw_ctl_io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; - cdw->cdw_ctl_io->scsiio.io_hdr.port_status = 42; - ctl_datamove_done(cdw->cdw_ctl_io, false); + cdw_io = cdw->cdw_ctl_io; + cdw_io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; + cdw_io->scsiio.io_hdr.port_status = 42; cfiscsi_data_wait_free(cs, cdw); + ctl_datamove_done(cdw_io, false); CFISCSI_SESSION_LOCK(cs); } CFISCSI_SESSION_UNLOCK(cs); @@ -2920,6 +2921,7 @@ cfiscsi_task_management_done(union ctl_io *io) struct cfiscsi_data_wait *cdw, *tmpcdw; struct cfiscsi_session *cs, *tcs; struct cfiscsi_softc *softc; + union ctl_io *cdw_io; int cold_reset = 0; request = PRIV_REQUEST(io); @@ -2953,10 +2955,11 @@ cfiscsi_task_management_done(union ctl_io *io) #endif TAILQ_REMOVE(&cs->cs_waiting_for_data_out, cdw, cdw_next); - io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; - cdw->cdw_ctl_io->scsiio.io_hdr.port_status = 43; - ctl_datamove_done(cdw->cdw_ctl_io, false); + cdw_io = cdw->cdw_ctl_io; + cdw_io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; + cdw_io->scsiio.io_hdr.port_status = 43; cfiscsi_data_wait_free(cs, cdw); + ctl_datamove_done(cdw_io, false); } CFISCSI_SESSION_UNLOCK(cs); } From owner-dev-commits-src-all@freebsd.org Thu May 20 16:59:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 78EF5643E29; Thu, 20 May 2021 16:59: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 4FmGDr2xWJz4Vr9; Thu, 20 May 2021 16:59: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 4DCD629C81; Thu, 20 May 2021 16:59: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 14KGxeOA056476; Thu, 20 May 2021 16:59:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KGxeHr056475; Thu, 20 May 2021 16:59:40 GMT (envelope-from git) Date: Thu, 20 May 2021 16:59:40 GMT Message-Id: <202105201659.14KGxeHr056475@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 0cc7d64a2a37 - main - iscsi: Move the maximum data segment limits into 'struct icl_conn'. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0cc7d64a2a37533afe03d2b640dc107be41b5f56 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 16:59:40 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0cc7d64a2a37533afe03d2b640dc107be41b5f56 commit 0cc7d64a2a37533afe03d2b640dc107be41b5f56 Author: John Baldwin AuthorDate: 2021-05-20 16:59:11 +0000 Commit: John Baldwin CommitDate: 2021-05-20 16:59:11 +0000 iscsi: Move the maximum data segment limits into 'struct icl_conn'. This fixes a few bugs in iSCSI backends where the backends were using the limits they advertised initially during the login phase as the final values instead of the values negotiated with the other end. Reported by: Jithesh Arakkan @ Chelsio Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D30271 --- sys/cam/ctl/ctl_frontend_iscsi.c | 23 ++++++++++++-------- sys/cam/ctl/ctl_frontend_iscsi.h | 2 -- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 23 +++----------------- sys/dev/iscsi/icl.h | 3 ++- sys/dev/iscsi/icl_soft.c | 9 +++++--- sys/dev/iscsi/iscsi.c | 44 +++++++++++++++++++-------------------- sys/dev/iscsi/iscsi.h | 2 -- 7 files changed, 47 insertions(+), 59 deletions(-) diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index a5a80848c763..b3cd8ab79d76 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -1568,8 +1568,10 @@ cfiscsi_ioctl_handoff(struct ctl_iscsi *ci) */ cs->cs_cmdsn = cihp->cmdsn; cs->cs_statsn = cihp->statsn; - cs->cs_max_recv_data_segment_length = cihp->max_recv_data_segment_length; - cs->cs_max_send_data_segment_length = cihp->max_send_data_segment_length; + cs->cs_conn->ic_max_recv_data_segment_length = + cihp->max_recv_data_segment_length; + cs->cs_conn->ic_max_send_data_segment_length = + cihp->max_send_data_segment_length; cs->cs_max_burst_length = cihp->max_burst_length; cs->cs_first_burst_length = cihp->first_burst_length; cs->cs_immediate_data = !!cihp->immediate_data; @@ -1734,8 +1736,8 @@ cfiscsi_ioctl_list(struct ctl_iscsi *ci) cs->cs_target->ct_tag, cs->cs_conn->ic_header_crc32c ? "CRC32C" : "None", cs->cs_conn->ic_data_crc32c ? "CRC32C" : "None", - cs->cs_max_recv_data_segment_length, - cs->cs_max_send_data_segment_length, + cs->cs_conn->ic_max_recv_data_segment_length, + cs->cs_conn->ic_max_send_data_segment_length, cs->cs_max_burst_length, cs->cs_first_burst_length, cs->cs_immediate_data, @@ -2534,12 +2536,14 @@ cfiscsi_datamove_in(union ctl_io *io) /* * Truncate to maximum data segment length. */ - KASSERT(response->ip_data_len < cs->cs_max_send_data_segment_length, + KASSERT(response->ip_data_len < + cs->cs_conn->ic_max_send_data_segment_length, ("ip_data_len %zd >= max_send_data_segment_length %d", - response->ip_data_len, cs->cs_max_send_data_segment_length)); + response->ip_data_len, + cs->cs_conn->ic_max_send_data_segment_length)); if (response->ip_data_len + len > - cs->cs_max_send_data_segment_length) { - len = cs->cs_max_send_data_segment_length - + cs->cs_conn->ic_max_send_data_segment_length) { + len = cs->cs_conn->ic_max_send_data_segment_length - response->ip_data_len; KASSERT(len <= sg_len, ("len %zd > sg_len %zd", len, sg_len)); @@ -2599,7 +2603,8 @@ cfiscsi_datamove_in(union ctl_io *io) i++; } - if (response->ip_data_len == cs->cs_max_send_data_segment_length) { + if (response->ip_data_len == + cs->cs_conn->ic_max_send_data_segment_length) { /* * Can't stuff more data into the current PDU; * queue it. Note that's not enough to check diff --git a/sys/cam/ctl/ctl_frontend_iscsi.h b/sys/cam/ctl/ctl_frontend_iscsi.h index a1c857231428..7c7f422a8d1f 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.h +++ b/sys/cam/ctl/ctl_frontend_iscsi.h @@ -86,8 +86,6 @@ struct cfiscsi_session { bool cs_terminating; bool cs_handoff_in_progress; bool cs_tasks_aborted; - int cs_max_recv_data_segment_length; - int cs_max_send_data_segment_length; int cs_max_burst_length; int cs_first_burst_length; bool cs_immediate_data; diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index fce593b54032..17d5685f1c1a 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -469,7 +469,7 @@ icl_cxgbei_conn_pdu_append_data(struct icl_conn *ic, struct icl_pdu *ip, } MPASS(len == 0); } - MPASS(ip->ip_data_len <= ic->ic_max_data_segment_length); + MPASS(ip->ip_data_len <= ic->ic_max_send_data_segment_length); return (0); } @@ -565,8 +565,6 @@ icl_cxgbei_new_conn(const char *name, struct mtx *lock) #ifdef DIAGNOSTIC refcount_init(&ic->ic_outstanding_pdus, 0); #endif - /* This is a stop-gap value that will be corrected during handoff. */ - ic->ic_max_data_segment_length = 16384; ic->ic_name = name; ic->ic_offload = "cxgbei"; ic->ic_unmapped = false; @@ -806,26 +804,11 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) icc->toep = toep; icc->cwt = cxgbei_select_worker_thread(icc); - /* - * We maintain the _send_ DSL in this field just to have a - * convenient way to assert that the kernel never sends - * oversized PDUs. This field is otherwise unused in the driver - * or the kernel. - */ - ic->ic_max_data_segment_length = ci->max_tx_pdu_len - - ISCSI_BHS_SIZE; - icc->ulp_submode = 0; - if (ic->ic_header_crc32c) { + if (ic->ic_header_crc32c) icc->ulp_submode |= ULP_CRC_HEADER; - ic->ic_max_data_segment_length -= - ISCSI_HEADER_DIGEST_SIZE; - } - if (ic->ic_data_crc32c) { + if (ic->ic_data_crc32c) icc->ulp_submode |= ULP_CRC_DATA; - ic->ic_max_data_segment_length -= - ISCSI_DATA_DIGEST_SIZE; - } so->so_options |= SO_NO_DDP; toep->params.ulp_mode = ULP_MODE_ISCSI; toep->ulpcb = icc; diff --git a/sys/dev/iscsi/icl.h b/sys/dev/iscsi/icl.h index 0b897a50302a..94600c0edad1 100644 --- a/sys/dev/iscsi/icl.h +++ b/sys/dev/iscsi/icl.h @@ -109,7 +109,8 @@ struct icl_conn { bool ic_data_crc32c; bool ic_send_running; bool ic_receive_running; - size_t ic_max_data_segment_length; + uint32_t ic_max_recv_data_segment_length; + uint32_t ic_max_send_data_segment_length; size_t ic_maxtags; bool ic_disconnecting; bool ic_iser; diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index 9cede6b44311..c15afbb59a68 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -573,7 +573,7 @@ icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs) */ len = icl_pdu_data_segment_length(request); - if (len > ic->ic_max_data_segment_length) { + if (len > ic->ic_max_recv_data_segment_length) { ICL_WARN("received data segment " "length %zd is larger than negotiated; " "dropping connection", len); @@ -1154,7 +1154,6 @@ icl_soft_new_conn(const char *name, struct mtx *lock) #ifdef DIAGNOSTIC refcount_init(&ic->ic_outstanding_pdus, 0); #endif - ic->ic_max_data_segment_length = max_data_segment_length; ic->ic_name = name; ic->ic_offload = "None"; ic->ic_unmapped = false; @@ -1205,13 +1204,17 @@ icl_conn_start(struct icl_conn *ic) * send a PDU in pieces; thus, the minimum buffer size is equal * to the maximum PDU size. "+4" is to account for possible padding. */ - minspace = sizeof(struct iscsi_bhs) + ic->ic_max_data_segment_length + + minspace = sizeof(struct iscsi_bhs) + + ic->ic_max_send_data_segment_length + ISCSI_HEADER_DIGEST_SIZE + ISCSI_DATA_DIGEST_SIZE + 4; if (sendspace < minspace) { ICL_WARN("kern.icl.sendspace too low; must be at least %zd", minspace); sendspace = minspace; } + minspace = sizeof(struct iscsi_bhs) + + ic->ic_max_recv_data_segment_length + + ISCSI_HEADER_DIGEST_SIZE + ISCSI_DATA_DIGEST_SIZE + 4; if (recvspace < minspace) { ICL_WARN("kern.icl.recvspace too low; must be at least %zd", minspace); diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c index 13a35c371c40..7ddb5a9ce1ec 100644 --- a/sys/dev/iscsi/iscsi.c +++ b/sys/dev/iscsi/iscsi.c @@ -1206,8 +1206,8 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response) for (;;) { len = total_len; - if (len > is->is_max_send_data_segment_length) - len = is->is_max_send_data_segment_length; + if (len > is->is_conn->ic_max_send_data_segment_length) + len = is->is_conn->ic_max_send_data_segment_length; if (off + len > csio->dxfer_len) { ISCSI_SESSION_WARN(is, "target requested invalid " @@ -1433,9 +1433,9 @@ iscsi_ioctl_daemon_handoff(struct iscsi_softc *sc, is->is_initial_r2t = handoff->idh_initial_r2t; is->is_immediate_data = handoff->idh_immediate_data; - is->is_max_recv_data_segment_length = + ic->ic_max_recv_data_segment_length = handoff->idh_max_recv_data_segment_length; - is->is_max_send_data_segment_length = + ic->ic_max_send_data_segment_length = handoff->idh_max_send_data_segment_length; is->is_max_burst_length = handoff->idh_max_burst_length; is->is_first_burst_length = handoff->idh_first_burst_length; @@ -1648,7 +1648,7 @@ iscsi_ioctl_daemon_send(struct iscsi_softc *sc, return (EIO); datalen = ids->ids_data_segment_len; - if (datalen > is->is_max_send_data_segment_length) + if (datalen > is->is_conn->ic_max_send_data_segment_length) return (EINVAL); if (datalen > 0) { data = malloc(datalen, M_ISCSI, M_WAITOK); @@ -1793,18 +1793,6 @@ iscsi_ioctl_session_add(struct iscsi_softc *sc, struct iscsi_session_add *isa) is = malloc(sizeof(*is), M_ISCSI, M_ZERO | M_WAITOK); memcpy(&is->is_conf, &isa->isa_conf, sizeof(is->is_conf)); - /* - * Set some default values, from RFC 3720, section 12. - * - * These values are updated by the handoff IOCTL, but are - * needed prior to the handoff to support sending the ISER - * login PDU. - */ - is->is_max_recv_data_segment_length = 8192; - is->is_max_send_data_segment_length = 8192; - is->is_max_burst_length = 262144; - is->is_first_burst_length = 65536; - sx_xlock(&sc->sc_lock); /* @@ -1847,6 +1835,18 @@ iscsi_ioctl_session_add(struct iscsi_softc *sc, struct iscsi_session_add *isa) cv_init(&is->is_login_cv, "iscsi_login"); #endif + /* + * Set some default values, from RFC 3720, section 12. + * + * These values are updated by the handoff IOCTL, but are + * needed prior to the handoff to support sending the ISER + * login PDU. + */ + is->is_conn->ic_max_recv_data_segment_length = 8192; + is->is_conn->ic_max_send_data_segment_length = 8192; + is->is_max_burst_length = 262144; + is->is_first_burst_length = 65536; + is->is_softc = sc; sc->sc_last_session_id++; is->is_id = sc->sc_last_session_id; @@ -1960,9 +1960,9 @@ iscsi_ioctl_session_list(struct iscsi_softc *sc, struct iscsi_session_list *isl) iss.iss_data_digest = ISCSI_DIGEST_NONE; iss.iss_max_send_data_segment_length = - is->is_max_send_data_segment_length; + is->is_conn->ic_max_send_data_segment_length; iss.iss_max_recv_data_segment_length = - is->is_max_recv_data_segment_length; + is->is_conn->ic_max_recv_data_segment_length; iss.iss_max_burst_length = is->is_max_burst_length; iss.iss_first_burst_length = is->is_first_burst_length; iss.iss_immediate_data = is->is_immediate_data; @@ -2330,10 +2330,10 @@ iscsi_action_scsiio(struct iscsi_session *is, union ccb *ccb) ISCSI_SESSION_DEBUG(is, "len %zd -> %d", len, is->is_first_burst_length); len = is->is_first_burst_length; } - if (len > is->is_max_send_data_segment_length) { + if (len > is->is_conn->ic_max_send_data_segment_length) { ISCSI_SESSION_DEBUG(is, "len %zd -> %d", len, - is->is_max_send_data_segment_length); - len = is->is_max_send_data_segment_length; + is->is_conn->ic_max_send_data_segment_length); + len = is->is_conn->ic_max_send_data_segment_length; } error = icl_pdu_append_data(request, csio->data_ptr, len, M_NOWAIT); diff --git a/sys/dev/iscsi/iscsi.h b/sys/dev/iscsi/iscsi.h index 793b7529c7c0..fe1cc64f88db 100644 --- a/sys/dev/iscsi/iscsi.h +++ b/sys/dev/iscsi/iscsi.h @@ -67,8 +67,6 @@ struct iscsi_session { uint8_t is_isid[6]; uint16_t is_tsih; bool is_immediate_data; - int is_max_recv_data_segment_length; - int is_max_send_data_segment_length; char is_target_alias[ISCSI_ALIAS_LEN]; TAILQ_HEAD(, iscsi_outstanding) is_outstanding; From owner-dev-commits-src-all@freebsd.org Thu May 20 17:30:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 272386445FD; Thu, 20 May 2021 17:30: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 4FmGwY0L1Jz4kFg; Thu, 20 May 2021 17:30: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 E87062A190; Thu, 20 May 2021 17:30: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 14KHUarS005020; Thu, 20 May 2021 17:30:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KHUaq5005019; Thu, 20 May 2021 17:30:36 GMT (envelope-from git) Date: Thu, 20 May 2021 17:30:36 GMT Message-Id: <202105201730.14KHUaq5005019@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: d0ea5e467f3c - main - md5: portability fix -- include stdbool.h explicitly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d0ea5e467f3c44909667c5ee90c3d26653fb6687 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 17:30:37 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d0ea5e467f3c44909667c5ee90c3d26653fb6687 commit d0ea5e467f3c44909667c5ee90c3d26653fb6687 Author: Warner Losh AuthorDate: 2021-05-20 17:26:46 +0000 Commit: Warner Losh CommitDate: 2021-05-20 17:28:18 +0000 md5: portability fix -- include stdbool.h explicitly stdbool.h needs to be included to use type bool variables. Due to namespace pollution, this gets brought in on FreeBSD, but not on other systems. Include it explicilty. Noticed by: arichards@ Sponsored by: Netflix --- sbin/md5/md5.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c index 4381ef124c7b..e553d4c56e85 100644 --- a/sbin/md5/md5.c +++ b/sbin/md5/md5.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include From owner-dev-commits-src-all@freebsd.org Thu May 20 17:42:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 607BE6449B0 for ; Thu, 20 May 2021 17:42:37 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmHBP249Sz4rxv for ; Thu, 20 May 2021 17:42:37 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f51.google.com with SMTP id p7so14783463wru.10 for ; Thu, 20 May 2021 10:42:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=DD5J9xP9FCMUZ9HyHsOWuhxobAQG8y22hwkMVJsMWX8=; b=H80f7HTwkdp5+42qLrR/rTp3Pej/WD1rUTIReWMiVc4elIg5j/Np/TTWmfSmCThV9D PQ4LRJub+TF9bO3sNwLzYmUa7aYC0Vu7h3DbChXYG4aOCTuvVmH/NywF1UJ7zx5oO6vG rSLxWFl+GMQObuMd1MpkrnYrgPXWEXWxY+i6iBOpmbREZny3hnk0yKFKf1VqSEF7Rv6u ttVpmMqUfLcg6CZy00pB0LH6eXRiKz8RIk2crvYA9DlcaFCTTENslVARlvPUz2eIX0yK cKC8MDSX9wUECiEFlv78kCjRVNoVXIIkbhr5KzJLAJ7o5Lzebdj4tqgfkBoibb3abC16 i0HA== X-Gm-Message-State: AOAM531Xf03UgScexL8KFD16tvAUjZKvu/t9bLAJiDedsaLhjik6f1Iq ZOp3aSRxWfaYB83c4QHK9rVfgg== X-Google-Smtp-Source: ABdhPJywIWabfgrrCc+Vyq2ksf1krYddFRFOGE4FO8cOAyLUHDRri065zP3MTQG1Sw6+xiD4lXP3Jw== X-Received: by 2002:a5d:4e0b:: with SMTP id p11mr5378977wrt.220.1621532555466; Thu, 20 May 2021 10:42:35 -0700 (PDT) Received: from [192.168.150.48] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id y22sm11720988wma.36.2021.05.20.10.42.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 May 2021 10:42:35 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: d0ea5e467f3c - main - md5: portability fix -- include stdbool.h explicitly From: Jessica Clarke In-Reply-To: <202105201730.14KHUaq5005019@gitrepo.freebsd.org> Date: Thu, 20 May 2021 18:42:33 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <1D5D272D-639A-4CA3-BCBC-F1386E6991DB@freebsd.org> References: <202105201730.14KHUaq5005019@gitrepo.freebsd.org> To: Warner Losh X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4FmHBP249Sz4rxv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 17:42:37 -0000 =3DOn 20 May 2021, at 18:30, Warner Losh wrote: >=20 > The branch main has been updated by imp: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dd0ea5e467f3c44909667c5ee90c3d266= 53fb6687 >=20 > commit d0ea5e467f3c44909667c5ee90c3d26653fb6687 > Author: Warner Losh > AuthorDate: 2021-05-20 17:26:46 +0000 > Commit: Warner Losh > CommitDate: 2021-05-20 17:28:18 +0000 >=20 > md5: portability fix -- include stdbool.h explicitly >=20 > stdbool.h needs to be included to use type bool variables. Due to > namespace pollution, this gets brought in on FreeBSD, but not on > other systems. Include it explicilty. Thanks! > Noticed by: arichards@ For once a cross-building issue not reported by Alex, though still Cambridge :) Jess From owner-dev-commits-src-all@freebsd.org Thu May 20 19:09:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9589664676D; Thu, 20 May 2021 19:09: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 4FmK7B3sFpz4YBm; Thu, 20 May 2021 19:09: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 6BD6B2B17D; Thu, 20 May 2021 19:09: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 14KJ9wx8030000; Thu, 20 May 2021 19:09:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KJ9wkx029999; Thu, 20 May 2021 19:09:58 GMT (envelope-from git) Date: Thu, 20 May 2021 19:09:58 GMT Message-Id: <202105201909.14KJ9wkx029999@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 5d698386fbfe - main - hda: correct comment about Asus laptop digital mics 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/main X-Git-Reftype: branch X-Git-Commit: 5d698386fbfe166df72a17712ffde8cefeecefab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 19:09:58 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=5d698386fbfe166df72a17712ffde8cefeecefab commit 5d698386fbfe166df72a17712ffde8cefeecefab Author: Philippe Michaud-Boudreault AuthorDate: 2021-05-19 14:32:25 +0000 Commit: Ed Maste CommitDate: 2021-05-20 18:58:00 +0000 hda: correct comment about Asus laptop digital mics Reported in review D30333 MFC after: 1 week --- sys/dev/sound/pci/hda/hdaa_patches.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/sound/pci/hda/hdaa_patches.c b/sys/dev/sound/pci/hda/hdaa_patches.c index 755f2aef461b..590c9e4d46fb 100644 --- a/sys/dev/sound/pci/hda/hdaa_patches.c +++ b/sys/dev/sound/pci/hda/hdaa_patches.c @@ -808,10 +808,10 @@ hdaa_patch_direct(struct hdaa_devinfo *devinfo) subid == 0x834a1043 || subid == 0x83981043 || subid == 0x83ce1043) { /* - * The ditital mics on some Asus laptops produce + * The digital mics on some Asus laptops produce * differential signals instead of expected stereo. - * That results in silence if downmix it to mono. - * To workaround, make codec to handle signal as mono. + * That results in silence if downmixing to mono. + * To workaround, make codec handle the signal as mono. */ val = hdaa_read_coef(dev, 0x20, 0x07); hdaa_write_coef(dev, 0x20, 0x07, val|0x80); From owner-dev-commits-src-all@freebsd.org Thu May 20 19:40:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B6764646DF3; Thu, 20 May 2021 19:40: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 4FmKpZ4htsz4lhd; Thu, 20 May 2021 19:40: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 8823D2BC17; Thu, 20 May 2021 19:40: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 14KJecp0078331; Thu, 20 May 2021 19:40:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14KJecCB078330; Thu, 20 May 2021 19:40:38 GMT (envelope-from git) Date: Thu, 20 May 2021 19:40:38 GMT Message-Id: <202105201940.14KJecCB078330@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: d7751071bc41 - main - kldxref: do not error out if specified path is not directory, for -d mode 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/main X-Git-Reftype: branch X-Git-Commit: d7751071bc41c63c5dadd81ef4b0a26748d8f9b0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 19:40:38 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d7751071bc41c63c5dadd81ef4b0a26748d8f9b0 commit d7751071bc41c63c5dadd81ef4b0a26748d8f9b0 Author: Konstantin Belousov AuthorDate: 2021-05-20 19:12:11 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-20 19:40:01 +0000 kldxref: do not error out if specified path is not directory, for -d mode kldxref(8) is the only tool that can dump FreeBSD kernel module metadata, with the -d option. But the command line requirements for that are inconvenient, since parser requires that argv[1] is a directory containing whole set of modules to generate xref file. For -d, allow argv[0] to be a regular file, now it is possible to do e.g. $ kldxref -d /boot/kernel/ufs.ko to see only ufs.ko metadata. Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30368 --- usr.sbin/kldxref/kldxref.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/kldxref/kldxref.c b/usr.sbin/kldxref/kldxref.c index e1996862119a..7a4d704356b8 100644 --- a/usr.sbin/kldxref/kldxref.c +++ b/usr.sbin/kldxref/kldxref.c @@ -716,7 +716,7 @@ main(int argc, char *argv[]) if (stat(argv[0], &sb) != 0) err(1, "%s", argv[0]); - if ((sb.st_mode & S_IFDIR) == 0) { + if ((sb.st_mode & S_IFDIR) == 0 && !dflag) { errno = ENOTDIR; err(1, "%s", argv[0]); } From owner-dev-commits-src-all@freebsd.org Thu May 20 22:54:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Thu May 20 22:57:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Fri May 21 00:24:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1A03964C147 for ; Fri, 21 May 2021 00:24:51 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmS6V6dyfz3Gpg for ; Fri, 21 May 2021 00:24:50 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72d.google.com with SMTP id 124so5841315qkh.10 for ; Thu, 20 May 2021 17:24:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jgLYgMMmVahP/UDOmaYDcfKusxvmdBnE3ncS/PhIkvQ=; b=LEIa1xXWk06gZE9qul881/uDJzC8reAjuVF/renJPKwrBX9rpP4TbVdGvLZr0BWZe9 ZYsQRD2Sjjj376IEcwoR3Lk9SQNrP3RMGyCm0DWVrzHK9/xl9zjek5fJ19cTSw3Bbbiz FDO3RJjS1Lba18U+fmmKZDBd/ilIrugKV2u3yKz3zjTzqEmuQoJp1oPS2FF9SklVzJYv P2W3v711rLAligh0sOhOpNjyyV7Y+oB0TXYLCsZzn3bxvo3ih/bhos8alaUtZZAPVvd6 849C+LY2pE+T/xrd2hErxtesYjT8k0jbENlrmA4lG1zRaw/10eXPjnlkSbp39XP/rWQu eo5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jgLYgMMmVahP/UDOmaYDcfKusxvmdBnE3ncS/PhIkvQ=; b=U4Dq3mp37+/GQIPsorr9hx0MrwNE67CxtvsfmCq593vdCONsTiYvV/6SyIiDP89C/z va0mabffQb6L5gSy/es9XiiLYdGuxJSn3yuBODaWwe/ln9eJCQlVzIaR/lWJhT2Jfw23 KgNLFVAWuXlKoG7ZuMEM93OE0DtIhY8UqEHOH042O0SKQe4rZvv/1O9Qsk/R91X7C1bQ mMjhOZ2MQE5gS7fpY5qgOvAKU3NSfe8srXok3UEwPBH+ZSR8fypEhlLBRS0Lii8lclLI jA8P57FuCSyMwaQBRHE6cf6a0CAyuA1JoNyDdCFKlafh7wE7ap/JQSprKMR+Oy/G4xHK 0jYQ== X-Gm-Message-State: AOAM533rIOGJzZNhQddnc4zTQRQE1tb5Wmsu4WU9BsPlatytpur0YRpo J97K9/OQs2R+RXgt3VdEVQM3RovhJyeIMv44dZzmvw== X-Google-Smtp-Source: ABdhPJwuX9f9cOZnAbFdjQxK1ajqsTtCHDmZ7rIdEvu6X2baLM+TWkr8AXlGBCtCtQ+C0G2muSEUTOrqf+5fBgqHEPM= X-Received: by 2002:a37:30b:: with SMTP id 11mr8066201qkd.206.1621556690008; Thu, 20 May 2021 17:24:50 -0700 (PDT) MIME-Version: 1.0 References: <202105201730.14KHUaq5005019@gitrepo.freebsd.org> <1D5D272D-639A-4CA3-BCBC-F1386E6991DB@freebsd.org> In-Reply-To: <1D5D272D-639A-4CA3-BCBC-F1386E6991DB@freebsd.org> From: Warner Losh Date: Thu, 20 May 2021 18:24:39 -0600 Message-ID: Subject: Re: git: d0ea5e467f3c - main - md5: portability fix -- include stdbool.h explicitly To: Jessica Clarke Cc: Warner Losh , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" X-Rspamd-Queue-Id: 4FmS6V6dyfz3Gpg X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 00:24:51 -0000 On Thu, May 20, 2021 at 11:42 AM Jessica Clarke wrote: > =On 20 May 2021, at 18:30, Warner Losh wrote: > > > > The branch main has been updated by imp: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=d0ea5e467f3c44909667c5ee90c3d26653fb6687 > > > > commit d0ea5e467f3c44909667c5ee90c3d26653fb6687 > > Author: Warner Losh > > AuthorDate: 2021-05-20 17:26:46 +0000 > > Commit: Warner Losh > > CommitDate: 2021-05-20 17:28:18 +0000 > > > > md5: portability fix -- include stdbool.h explicitly > > > > stdbool.h needs to be included to use type bool variables. Due to > > namespace pollution, this gets brought in on FreeBSD, but not on > > other systems. Include it explicilty. > > Thanks! > > > Noticed by: arichards@ > > For once a cross-building issue not reported by Alex, though still > Cambridge :) > Doh! I've been in a daze all day. Sorry about that... Warner From owner-dev-commits-src-all@freebsd.org Fri May 21 01:00:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Fri May 21 01:40:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 065EB64D8C0; Fri, 21 May 2021 01: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 4FmTp96Txgz4dFc; Fri, 21 May 2021 01:40: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 C2FF9763; Fri, 21 May 2021 01:40: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 14L1en2r052803; Fri, 21 May 2021 01: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 14L1enks052802; Fri, 21 May 2021 01:40:49 GMT (envelope-from git) Date: Fri, 21 May 2021 01:40:49 GMT Message-Id: <202105210140.14L1enks052802@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: d80a903a1c2a - main - nfsd: Add support for CLAIM_DELEG_PREV_FH to the NFSv4.1/4.2 Open 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/main X-Git-Reftype: branch X-Git-Commit: d80a903a1c2acd73afbf06598955a0887433f8c6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 01:40:50 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=d80a903a1c2acd73afbf06598955a0887433f8c6 commit d80a903a1c2acd73afbf06598955a0887433f8c6 Author: Rick Macklem AuthorDate: 2021-05-21 01:37:40 +0000 Commit: Rick Macklem CommitDate: 2021-05-21 01:37:40 +0000 nfsd: Add support for CLAIM_DELEG_PREV_FH to the NFSv4.1/4.2 Open Commit b3d4c70dc60f added support for CLAIM_DELEG_CUR_FH to Open. While doing this, I noticed that CLAIM_DELEG_PREV_FH support could be added the same way. Although I am not aware of any extant NFSv4.1/4.2 client that uses this claim type, it seems prudent to add support for this variant of Open to the NFSv4.1/4.2 server. This patch does not affect mounts from extant NFSv4.1/4.2 clients, as far as I know. MFC after: 2 weeks --- sys/fs/nfsserver/nfs_nfsdserv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index 5d6cac23b722..ef78f90fabfc 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -2987,7 +2987,8 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram, stateid.seqid = fxdr_unsigned(u_int32_t, *tl++); NFSBCOPY((caddr_t)tl,(caddr_t)stateid.other,NFSX_STATEIDOTHER); stp->ls_flags |= NFSLCK_DELEGCUR; - } else if (claim == NFSV4OPEN_CLAIMDELEGATEPREV) { + } else if (claim == NFSV4OPEN_CLAIMDELEGATEPREV || claim == + NFSV4OPEN_CLAIMDELEGATEPREVFH) { stp->ls_flags |= NFSLCK_DELEGPREV; } if (claim == NFSV4OPEN_CLAIMNULL || claim == NFSV4OPEN_CLAIMDELEGATECUR @@ -3057,7 +3058,8 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram, &exclusive_flag, &nva, cverf, create, aclp, &attrbits, nd->nd_cred, exp, &vp); } else if (claim == NFSV4OPEN_CLAIMPREVIOUS || claim == - NFSV4OPEN_CLAIMFH || claim == NFSV4OPEN_CLAIMDELEGATECURFH) { + NFSV4OPEN_CLAIMFH || claim == NFSV4OPEN_CLAIMDELEGATECURFH || + claim == NFSV4OPEN_CLAIMDELEGATEPREVFH) { if (claim == NFSV4OPEN_CLAIMPREVIOUS) { NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); i = fxdr_unsigned(int, *tl); From owner-dev-commits-src-all@freebsd.org Fri May 21 04:57:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D0B16650A8B; Fri, 21 May 2021 04:57: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 4FmZ9b5LyLz3PBx; Fri, 21 May 2021 04:57: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 9FA91303E; Fri, 21 May 2021 04:57: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 14L4vtW5009098; Fri, 21 May 2021 04:57:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14L4vtje009097; Fri, 21 May 2021 04:57:55 GMT (envelope-from git) Date: Fri, 21 May 2021 04:57:55 GMT Message-Id: <202105210457.14L4vtje009097@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 741afc623391 - main - ip_mroute: refactor bw_meter API MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 741afc6233915ba33156c2221aa80d2dd2b76b9c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 04:57:55 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=741afc6233915ba33156c2221aa80d2dd2b76b9c commit 741afc6233915ba33156c2221aa80d2dd2b76b9c Author: Wojciech Macek AuthorDate: 2021-05-05 03:28:56 +0000 Commit: Wojciech Macek CommitDate: 2021-05-21 04:43:41 +0000 ip_mroute: refactor bw_meter API API should work as following: - periodicaly report Lower-or-EQual bandwidth (LEQ) connections over kernel socket, if user application registered for such per-flow notifications - report Grater-or-EQual (GEQ) bandwidth as soon as it reaches specified value in configured time window Custom implementation of callouts was removed. There is no point of doing calout-wheel here as generic callouts are doing exactly the same. The performance is not critical for such reporting, so the biggest concern should be to have a code which can be easily maintained. This is ia preparation for locking rework which is highly inefficient. Approved by: mw Sponsored by: Stormshield Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D30210 --- sys/netinet/ip_mroute.c | 610 ++++++++++++++++------------------------------- sys/netinet/ip_mroute.h | 12 +- usr.bin/netstat/mroute.c | 15 +- 3 files changed, 233 insertions(+), 404 deletions(-) diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index b8e677ba9af1..0cb980b7247e 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -49,6 +49,7 @@ * Modified by Pavlin Radoslavov, USC/ISI, May 1998, August 1999, October 2000 * Modified by Hitoshi Asaeda, WIDE, August 2000 * Modified by Pavlin Radoslavov, ICSI, October 2002 + * Modified by Wojciech Macek, Semihalf, May 2021 * * MROUTING Revision: 3.5 * and PIM-SMv2 and PIM-DM support, advanced API support, @@ -202,16 +203,6 @@ VNET_DEFINE_STATIC(struct callout, expire_upcalls_ch); * Bandwidth meter variables and constants */ static MALLOC_DEFINE(M_BWMETER, "bwmeter", "multicast upcall bw meters"); -/* - * Pending timeouts are stored in a hash table, the key being the - * expiration time. Periodically, the entries are analysed and processed. - */ -#define BW_METER_BUCKETS 1024 -VNET_DEFINE_STATIC(struct bw_meter **, bw_meter_timers); -#define V_bw_meter_timers VNET(bw_meter_timers) -VNET_DEFINE_STATIC(struct callout, bw_meter_ch); -#define V_bw_meter_ch VNET(bw_meter_ch) -#define BW_METER_PERIOD (hz) /* periodical handling of bw meters */ /* * Pending upcalls are stored in a vector which is flushed when @@ -320,14 +311,13 @@ static int add_mfc(struct mfcctl2 *); static int add_vif(struct vifctl *); static void bw_meter_prepare_upcall(struct bw_meter *, struct timeval *); static void bw_meter_process(void); -static void bw_meter_receive_packet(struct bw_meter *, int, +static void bw_meter_geq_receive_packet(struct bw_meter *, int, struct timeval *); static void bw_upcalls_send(void); static int del_bw_upcall(struct bw_upcall *); static int del_mfc(struct mfcctl2 *); static int del_vif(vifi_t); static int del_vif_locked(vifi_t); -static void expire_bw_meter_process(void *); static void expire_bw_upcalls_send(void *); static void expire_mfc(struct mfc *); static void expire_upcalls(void *); @@ -685,8 +675,6 @@ ip_mrouter_init(struct socket *so, int version) curvnet); callout_reset(&V_bw_upcalls_ch, BW_UPCALLS_PERIOD, expire_bw_upcalls_send, curvnet); - callout_reset(&V_bw_meter_ch, BW_METER_PERIOD, expire_bw_meter_process, - curvnet); V_ip_mrouter = so; ip_mrouter_cnt++; @@ -745,7 +733,6 @@ X_ip_mrouter_done(void) callout_stop(&V_expire_upcalls_ch); callout_stop(&V_bw_upcalls_ch); - callout_stop(&V_bw_meter_ch); MFC_LOCK(); @@ -766,7 +753,6 @@ X_ip_mrouter_done(void) bzero(V_nexpire, sizeof(V_nexpire[0]) * mfchashsize); V_bw_upcalls_n = 0; - bzero(V_bw_meter_timers, BW_METER_BUCKETS * sizeof(*V_bw_meter_timers)); MFC_UNLOCK(); @@ -1036,7 +1022,8 @@ expire_mfc(struct mfc *rt) MFC_LOCK_ASSERT(); - free_bw_list(rt->mfc_bw_meter); + free_bw_list(rt->mfc_bw_meter_leq); + free_bw_list(rt->mfc_bw_meter_geq); TAILQ_FOREACH_SAFE(rte, &rt->mfc_stall, rte_link, nrte) { m_freem(rte->m); @@ -1139,7 +1126,8 @@ add_mfc(struct mfcctl2 *mfccp) rt->mfc_nstall = 0; rt->mfc_expire = 0; - rt->mfc_bw_meter = NULL; + rt->mfc_bw_meter_leq = NULL; + rt->mfc_bw_meter_geq = NULL; /* insert new entry at head of hash chain */ LIST_INSERT_HEAD(&V_mfchashtbl[hash], rt, mfc_hash); @@ -1179,8 +1167,10 @@ del_mfc(struct mfcctl2 *mfccp) /* * free the bw_meter entries */ - free_bw_list(rt->mfc_bw_meter); - rt->mfc_bw_meter = NULL; + free_bw_list(rt->mfc_bw_meter_leq); + rt->mfc_bw_meter_leq = NULL; + free_bw_list(rt->mfc_bw_meter_geq); + rt->mfc_bw_meter_geq = NULL; LIST_REMOVE(rt, mfc_hash); free(rt, M_MRTABLE); @@ -1393,7 +1383,8 @@ fail: /* clear the RP address */ rt->mfc_rp.s_addr = INADDR_ANY; - rt->mfc_bw_meter = NULL; + rt->mfc_bw_meter_leq = NULL; + rt->mfc_bw_meter_geq = NULL; /* initialize pkt counters per src-grp */ rt->mfc_pkt_cnt = 0; @@ -1459,16 +1450,6 @@ expire_upcalls(void *arg) if (rt->mfc_expire == 0 || --rt->mfc_expire > 0) continue; - /* - * free the bw_meter entries - */ - while (rt->mfc_bw_meter != NULL) { - struct bw_meter *x = rt->mfc_bw_meter; - - rt->mfc_bw_meter = x->bm_mfc_next; - free(x, M_BWMETER); - } - MRTSTAT_INC(mrts_cache_cleanups); CTR3(KTR_IPMF, "%s: expire (%lx, %lx)", __func__, (u_long)ntohl(rt->mfc_origin.s_addr), @@ -1602,14 +1583,22 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp, struct mfc *rt, vifi_t xmt_vif) /* * Perform upcall-related bw measuring. */ - if (rt->mfc_bw_meter != NULL) { + if ((rt->mfc_bw_meter_geq != NULL) || (rt->mfc_bw_meter_leq != NULL)) { struct bw_meter *x; struct timeval now; microtime(&now); MFC_LOCK_ASSERT(); - for (x = rt->mfc_bw_meter; x != NULL; x = x->bm_mfc_next) - bw_meter_receive_packet(x, plen, &now); + /* Process meters for Greater-or-EQual case */ + for (x = rt->mfc_bw_meter_geq; x != NULL; x = x->bm_mfc_next) + bw_meter_geq_receive_packet(x, plen, &now); + + /* Process meters for Lower-or-EQual case */ + for (x = rt->mfc_bw_meter_leq; x != NULL; x = x->bm_mfc_next) { + /* Record that a packet is received */ + x->bm_measured.b_packets++; + x->bm_measured.b_bytes += plen; + } } return 0; @@ -1759,84 +1748,139 @@ compute_bw_meter_flags(struct bw_upcall *req) return flags; } +static void +expire_bw_meter_leq(void *arg) +{ + struct bw_meter *x = arg; + struct timeval now; + /* + * INFO: + * callout is always executed with MFC_LOCK taken + */ + + CURVNET_SET((struct vnet *)x->arg); + + microtime(&now); + + /* + * Test if we should deliver an upcall + */ + if (((x->bm_flags & BW_METER_UNIT_PACKETS) && + (x->bm_measured.b_packets <= x->bm_threshold.b_packets)) || + ((x->bm_flags & BW_METER_UNIT_BYTES) && + (x->bm_measured.b_bytes <= x->bm_threshold.b_bytes))) { + /* Prepare an upcall for delivery */ + bw_meter_prepare_upcall(x, &now); + } + + /* Send all upcalls that are pending delivery */ + bw_upcalls_send(); + + /* Reset counters */ + x->bm_start_time = now; + x->bm_measured.b_bytes = 0; + x->bm_measured.b_packets = 0; + + callout_schedule(&x->bm_meter_callout, tvtohz(&x->bm_threshold.b_time)); + + CURVNET_RESTORE(); +} + /* * Add a bw_meter entry */ static int add_bw_upcall(struct bw_upcall *req) { - struct mfc *mfc; - struct timeval delta = { BW_UPCALL_THRESHOLD_INTERVAL_MIN_SEC, - BW_UPCALL_THRESHOLD_INTERVAL_MIN_USEC }; - struct timeval now; - struct bw_meter *x; - uint32_t flags; + struct mfc *mfc; + struct timeval delta = { BW_UPCALL_THRESHOLD_INTERVAL_MIN_SEC, + BW_UPCALL_THRESHOLD_INTERVAL_MIN_USEC }; + struct timeval now; + struct bw_meter *x, **bwm_ptr; + uint32_t flags; - if (!(V_mrt_api_config & MRT_MFC_BW_UPCALL)) - return EOPNOTSUPP; + if (!(V_mrt_api_config & MRT_MFC_BW_UPCALL)) + return EOPNOTSUPP; - /* Test if the flags are valid */ - if (!(req->bu_flags & (BW_UPCALL_UNIT_PACKETS | BW_UPCALL_UNIT_BYTES))) - return EINVAL; - if (!(req->bu_flags & (BW_UPCALL_GEQ | BW_UPCALL_LEQ))) - return EINVAL; - if ((req->bu_flags & (BW_UPCALL_GEQ | BW_UPCALL_LEQ)) - == (BW_UPCALL_GEQ | BW_UPCALL_LEQ)) - return EINVAL; + /* Test if the flags are valid */ + if (!(req->bu_flags & (BW_UPCALL_UNIT_PACKETS | BW_UPCALL_UNIT_BYTES))) + return EINVAL; + if (!(req->bu_flags & (BW_UPCALL_GEQ | BW_UPCALL_LEQ))) + return EINVAL; + if ((req->bu_flags & (BW_UPCALL_GEQ | BW_UPCALL_LEQ)) + == (BW_UPCALL_GEQ | BW_UPCALL_LEQ)) + return EINVAL; - /* Test if the threshold time interval is valid */ - if (BW_TIMEVALCMP(&req->bu_threshold.b_time, &delta, <)) - return EINVAL; + /* Test if the threshold time interval is valid */ + if (BW_TIMEVALCMP(&req->bu_threshold.b_time, &delta, <)) + return EINVAL; - flags = compute_bw_meter_flags(req); + flags = compute_bw_meter_flags(req); - /* - * Find if we have already same bw_meter entry - */ - MFC_LOCK(); - mfc = mfc_find(&req->bu_src, &req->bu_dst); - if (mfc == NULL) { - MFC_UNLOCK(); - return EADDRNOTAVAIL; - } - for (x = mfc->mfc_bw_meter; x != NULL; x = x->bm_mfc_next) { - if ((BW_TIMEVALCMP(&x->bm_threshold.b_time, - &req->bu_threshold.b_time, ==)) && - (x->bm_threshold.b_packets == req->bu_threshold.b_packets) && - (x->bm_threshold.b_bytes == req->bu_threshold.b_bytes) && - (x->bm_flags & BW_METER_USER_FLAGS) == flags) { - MFC_UNLOCK(); - return 0; /* XXX Already installed */ + /* + * Find if we have already same bw_meter entry + */ + MFC_LOCK(); + mfc = mfc_find(&req->bu_src, &req->bu_dst); + if (mfc == NULL) { + MFC_UNLOCK(); + return EADDRNOTAVAIL; } - } - /* Allocate the new bw_meter entry */ - x = (struct bw_meter *)malloc(sizeof(*x), M_BWMETER, M_NOWAIT); - if (x == NULL) { - MFC_UNLOCK(); - return ENOBUFS; - } + /* Choose an appropriate bw_meter list */ + if (req->bu_flags & BW_UPCALL_GEQ) + bwm_ptr = &mfc->mfc_bw_meter_geq; + else + bwm_ptr = &mfc->mfc_bw_meter_leq; + + for (x = *bwm_ptr; x != NULL; x = x->bm_mfc_next) { + if ((BW_TIMEVALCMP(&x->bm_threshold.b_time, + &req->bu_threshold.b_time, ==)) + && (x->bm_threshold.b_packets + == req->bu_threshold.b_packets) + && (x->bm_threshold.b_bytes + == req->bu_threshold.b_bytes) + && (x->bm_flags & BW_METER_USER_FLAGS) + == flags) { + MFC_UNLOCK(); + return 0; /* XXX Already installed */ + } + } - /* Set the new bw_meter entry */ - x->bm_threshold.b_time = req->bu_threshold.b_time; - microtime(&now); - x->bm_start_time = now; - x->bm_threshold.b_packets = req->bu_threshold.b_packets; - x->bm_threshold.b_bytes = req->bu_threshold.b_bytes; - x->bm_measured.b_packets = 0; - x->bm_measured.b_bytes = 0; - x->bm_flags = flags; - x->bm_time_next = NULL; - x->bm_time_hash = BW_METER_BUCKETS; - - /* Add the new bw_meter entry to the front of entries for this MFC */ - x->bm_mfc = mfc; - x->bm_mfc_next = mfc->mfc_bw_meter; - mfc->mfc_bw_meter = x; - schedule_bw_meter(x, &now); - MFC_UNLOCK(); + /* Allocate the new bw_meter entry */ + x = (struct bw_meter*) malloc(sizeof(*x), M_BWMETER, M_NOWAIT); + if (x == NULL) { + MFC_UNLOCK(); + return ENOBUFS; + } - return 0; + /* Set the new bw_meter entry */ + x->bm_threshold.b_time = req->bu_threshold.b_time; + microtime(&now); + x->bm_start_time = now; + x->bm_threshold.b_packets = req->bu_threshold.b_packets; + x->bm_threshold.b_bytes = req->bu_threshold.b_bytes; + x->bm_measured.b_packets = 0; + x->bm_measured.b_bytes = 0; + x->bm_flags = flags; + x->bm_time_next = NULL; + x->bm_mfc = mfc; + x->arg = curvnet; + + /* For LEQ case create periodic callout */ + if (req->bu_flags & BW_UPCALL_LEQ) { + callout_init_mtx(&x->bm_meter_callout, &mfc_mtx,0); + callout_reset(&x->bm_meter_callout, tvtohz(&x->bm_threshold.b_time), + expire_bw_meter_leq, x); + } + + /* Add the new bw_meter entry to the front of entries for this MFC */ + x->bm_mfc_next = *bwm_ptr; + *bwm_ptr = x; + + MFC_UNLOCK(); + + return 0; } static void @@ -1845,8 +1889,11 @@ free_bw_list(struct bw_meter *list) while (list != NULL) { struct bw_meter *x = list; + /* MFC_LOCK must be held here */ + if (x->bm_flags & BW_METER_LEQ) + callout_drain(&x->bm_meter_callout); + list = list->bm_mfc_next; - unschedule_bw_meter(x); free(x, M_BWMETER); } } @@ -1858,7 +1905,7 @@ static int del_bw_upcall(struct bw_upcall *req) { struct mfc *mfc; - struct bw_meter *x; + struct bw_meter *x, **bwm_ptr; if (!(V_mrt_api_config & MRT_MFC_BW_UPCALL)) return EOPNOTSUPP; @@ -1876,8 +1923,14 @@ del_bw_upcall(struct bw_upcall *req) */ struct bw_meter *list; - list = mfc->mfc_bw_meter; - mfc->mfc_bw_meter = NULL; + /* Free LEQ list */ + list = mfc->mfc_bw_meter_leq; + mfc->mfc_bw_meter_leq = NULL; + free_bw_list(list); + + /* Free GEQ list */ + list = mfc->mfc_bw_meter_geq; + mfc->mfc_bw_meter_geq = NULL; free_bw_list(list); MFC_UNLOCK(); return 0; @@ -1887,8 +1940,14 @@ del_bw_upcall(struct bw_upcall *req) flags = compute_bw_meter_flags(req); + /* Choose an appropriate bw_meter list */ + if (req->bu_flags & BW_UPCALL_GEQ) + bwm_ptr = &mfc->mfc_bw_meter_geq; + else + bwm_ptr = &mfc->mfc_bw_meter_leq; + /* Find the bw_meter entry to delete */ - for (prev = NULL, x = mfc->mfc_bw_meter; x != NULL; + for (prev = NULL, x = *bwm_ptr; x != NULL; prev = x, x = x->bm_mfc_next) { if ((BW_TIMEVALCMP(&x->bm_threshold.b_time, &req->bu_threshold.b_time, ==)) && @@ -1901,9 +1960,11 @@ del_bw_upcall(struct bw_upcall *req) if (prev != NULL) prev->bm_mfc_next = x->bm_mfc_next; /* remove from middle*/ else - x->bm_mfc->mfc_bw_meter = x->bm_mfc_next;/* new head of list */ + *bwm_ptr = x->bm_mfc_next;/* new head of list */ + + if (req->bu_flags & BW_UPCALL_LEQ) + callout_stop(&x->bm_meter_callout); - unschedule_bw_meter(x); MFC_UNLOCK(); /* Free the bw_meter entry */ free(x, M_BWMETER); @@ -1920,16 +1981,15 @@ del_bw_upcall(struct bw_upcall *req) * Perform bandwidth measurement processing that may result in an upcall */ static void -bw_meter_receive_packet(struct bw_meter *x, int plen, struct timeval *nowp) +bw_meter_geq_receive_packet(struct bw_meter *x, int plen, struct timeval *nowp) { - struct timeval delta; + struct timeval delta; - MFC_LOCK_ASSERT(); + MFC_LOCK_ASSERT(); - delta = *nowp; - BW_TIMEVALDECR(&delta, &x->bm_start_time); + delta = *nowp; + BW_TIMEVALDECR(&delta, &x->bm_start_time); - if (x->bm_flags & BW_METER_GEQ) { /* * Processing for ">=" type of bw_meter entry */ @@ -1949,63 +2009,15 @@ bw_meter_receive_packet(struct bw_meter *x, int plen, struct timeval *nowp) * Test if we should deliver an upcall */ if (!(x->bm_flags & BW_METER_UPCALL_DELIVERED)) { - if (((x->bm_flags & BW_METER_UNIT_PACKETS) && - (x->bm_measured.b_packets >= x->bm_threshold.b_packets)) || - ((x->bm_flags & BW_METER_UNIT_BYTES) && - (x->bm_measured.b_bytes >= x->bm_threshold.b_bytes))) { - /* Prepare an upcall for delivery */ - bw_meter_prepare_upcall(x, nowp); - x->bm_flags |= BW_METER_UPCALL_DELIVERED; - } - } - } else if (x->bm_flags & BW_METER_LEQ) { - /* - * Processing for "<=" type of bw_meter entry - */ - if (BW_TIMEVALCMP(&delta, &x->bm_threshold.b_time, >)) { - /* - * We are behind time with the multicast forwarding table - * scanning for "<=" type of bw_meter entries, so test now - * if we should deliver an upcall. - */ - if (((x->bm_flags & BW_METER_UNIT_PACKETS) && - (x->bm_measured.b_packets <= x->bm_threshold.b_packets)) || - ((x->bm_flags & BW_METER_UNIT_BYTES) && - (x->bm_measured.b_bytes <= x->bm_threshold.b_bytes))) { - /* Prepare an upcall for delivery */ - bw_meter_prepare_upcall(x, nowp); - } - /* Reschedule the bw_meter entry */ - unschedule_bw_meter(x); - schedule_bw_meter(x, nowp); - } - - /* Record that a packet is received */ - x->bm_measured.b_packets++; - x->bm_measured.b_bytes += plen; - - /* - * Test if we should restart the measuring interval - */ - if ((x->bm_flags & BW_METER_UNIT_PACKETS && - x->bm_measured.b_packets <= x->bm_threshold.b_packets) || - (x->bm_flags & BW_METER_UNIT_BYTES && - x->bm_measured.b_bytes <= x->bm_threshold.b_bytes)) { - /* Don't restart the measuring interval */ - } else { - /* Do restart the measuring interval */ - /* - * XXX: note that we don't unschedule and schedule, because this - * might be too much overhead per packet. Instead, when we process - * all entries for a given timer hash bin, we check whether it is - * really a timeout. If not, we reschedule at that time. - */ - x->bm_start_time = *nowp; - x->bm_measured.b_packets = 0; - x->bm_measured.b_bytes = 0; - x->bm_flags &= ~BW_METER_UPCALL_DELIVERED; + if (((x->bm_flags & BW_METER_UNIT_PACKETS) && + (x->bm_measured.b_packets >= x->bm_threshold.b_packets)) || + ((x->bm_flags & BW_METER_UNIT_BYTES) && + (x->bm_measured.b_bytes >= x->bm_threshold.b_bytes))) { + /* Prepare an upcall for delivery */ + bw_meter_prepare_upcall(x, nowp); + x->bm_flags |= BW_METER_UPCALL_DELIVERED; + } } - } } /* @@ -2014,44 +2026,44 @@ bw_meter_receive_packet(struct bw_meter *x, int plen, struct timeval *nowp) static void bw_meter_prepare_upcall(struct bw_meter *x, struct timeval *nowp) { - struct timeval delta; - struct bw_upcall *u; + struct timeval delta; + struct bw_upcall *u; - MFC_LOCK_ASSERT(); + MFC_LOCK_ASSERT(); - /* - * Compute the measured time interval - */ - delta = *nowp; - BW_TIMEVALDECR(&delta, &x->bm_start_time); + /* + * Compute the measured time interval + */ + delta = *nowp; + BW_TIMEVALDECR(&delta, &x->bm_start_time); - /* - * If there are too many pending upcalls, deliver them now - */ - if (V_bw_upcalls_n >= BW_UPCALLS_MAX) - bw_upcalls_send(); + /* + * If there are too many pending upcalls, deliver them now + */ + if (V_bw_upcalls_n >= BW_UPCALLS_MAX) + bw_upcalls_send(); - /* - * Set the bw_upcall entry - */ - u = &V_bw_upcalls[V_bw_upcalls_n++]; - u->bu_src = x->bm_mfc->mfc_origin; - u->bu_dst = x->bm_mfc->mfc_mcastgrp; - u->bu_threshold.b_time = x->bm_threshold.b_time; - u->bu_threshold.b_packets = x->bm_threshold.b_packets; - u->bu_threshold.b_bytes = x->bm_threshold.b_bytes; - u->bu_measured.b_time = delta; - u->bu_measured.b_packets = x->bm_measured.b_packets; - u->bu_measured.b_bytes = x->bm_measured.b_bytes; - u->bu_flags = 0; - if (x->bm_flags & BW_METER_UNIT_PACKETS) - u->bu_flags |= BW_UPCALL_UNIT_PACKETS; - if (x->bm_flags & BW_METER_UNIT_BYTES) - u->bu_flags |= BW_UPCALL_UNIT_BYTES; - if (x->bm_flags & BW_METER_GEQ) - u->bu_flags |= BW_UPCALL_GEQ; - if (x->bm_flags & BW_METER_LEQ) - u->bu_flags |= BW_UPCALL_LEQ; + /* + * Set the bw_upcall entry + */ + u = &V_bw_upcalls[V_bw_upcalls_n++]; + u->bu_src = x->bm_mfc->mfc_origin; + u->bu_dst = x->bm_mfc->mfc_mcastgrp; + u->bu_threshold.b_time = x->bm_threshold.b_time; + u->bu_threshold.b_packets = x->bm_threshold.b_packets; + u->bu_threshold.b_bytes = x->bm_threshold.b_bytes; + u->bu_measured.b_time = delta; + u->bu_measured.b_packets = x->bm_measured.b_packets; + u->bu_measured.b_bytes = x->bm_measured.b_bytes; + u->bu_flags = 0; + if (x->bm_flags & BW_METER_UNIT_PACKETS) + u->bu_flags |= BW_UPCALL_UNIT_PACKETS; + if (x->bm_flags & BW_METER_UNIT_BYTES) + u->bu_flags |= BW_UPCALL_UNIT_BYTES; + if (x->bm_flags & BW_METER_GEQ) + u->bu_flags |= BW_UPCALL_GEQ; + if (x->bm_flags & BW_METER_LEQ) + u->bu_flags |= BW_UPCALL_LEQ; } /* @@ -2103,183 +2115,6 @@ bw_upcalls_send(void) } } -/* - * Compute the timeout hash value for the bw_meter entries - */ -#define BW_METER_TIMEHASH(bw_meter, hash) \ - do { \ - struct timeval next_timeval = (bw_meter)->bm_start_time; \ - \ - BW_TIMEVALADD(&next_timeval, &(bw_meter)->bm_threshold.b_time); \ - (hash) = next_timeval.tv_sec; \ - if (next_timeval.tv_usec) \ - (hash)++; /* XXX: make sure we don't timeout early */ \ - (hash) %= BW_METER_BUCKETS; \ - } while (0) - -/* - * Schedule a timer to process periodically bw_meter entry of type "<=" - * by linking the entry in the proper hash bucket. - */ -static void -schedule_bw_meter(struct bw_meter *x, struct timeval *nowp) -{ - int time_hash; - - MFC_LOCK_ASSERT(); - - if (!(x->bm_flags & BW_METER_LEQ)) - return; /* XXX: we schedule timers only for "<=" entries */ - - /* - * Reset the bw_meter entry - */ - x->bm_start_time = *nowp; - x->bm_measured.b_packets = 0; - x->bm_measured.b_bytes = 0; - x->bm_flags &= ~BW_METER_UPCALL_DELIVERED; - - /* - * Compute the timeout hash value and insert the entry - */ - BW_METER_TIMEHASH(x, time_hash); - x->bm_time_next = V_bw_meter_timers[time_hash]; - V_bw_meter_timers[time_hash] = x; - x->bm_time_hash = time_hash; -} - -/* - * Unschedule the periodic timer that processes bw_meter entry of type "<=" - * by removing the entry from the proper hash bucket. - */ -static void -unschedule_bw_meter(struct bw_meter *x) -{ - int time_hash; - struct bw_meter *prev, *tmp; - - MFC_LOCK_ASSERT(); - - if (!(x->bm_flags & BW_METER_LEQ)) - return; /* XXX: we schedule timers only for "<=" entries */ - - /* - * Compute the timeout hash value and delete the entry - */ - time_hash = x->bm_time_hash; - if (time_hash >= BW_METER_BUCKETS) - return; /* Entry was not scheduled */ - - for (prev = NULL, tmp = V_bw_meter_timers[time_hash]; - tmp != NULL; prev = tmp, tmp = tmp->bm_time_next) - if (tmp == x) - break; - - if (tmp == NULL) - panic("unschedule_bw_meter: bw_meter entry not found"); - - if (prev != NULL) - prev->bm_time_next = x->bm_time_next; - else - V_bw_meter_timers[time_hash] = x->bm_time_next; - - x->bm_time_next = NULL; - x->bm_time_hash = BW_METER_BUCKETS; -} - -/* - * Process all "<=" type of bw_meter that should be processed now, - * and for each entry prepare an upcall if necessary. Each processed - * entry is rescheduled again for the (periodic) processing. - * - * This is run periodically (once per second normally). On each round, - * all the potentially matching entries are in the hash slot that we are - * looking at. - */ -static void -bw_meter_process() -{ - uint32_t loops; - int i; - struct timeval now, process_endtime; - - microtime(&now); - if (V_last_tv_sec == now.tv_sec) - return; /* nothing to do */ - - loops = now.tv_sec - V_last_tv_sec; - V_last_tv_sec = now.tv_sec; - if (loops > BW_METER_BUCKETS) - loops = BW_METER_BUCKETS; - - MFC_LOCK(); - /* - * Process all bins of bw_meter entries from the one after the last - * processed to the current one. On entry, i points to the last bucket - * visited, so we need to increment i at the beginning of the loop. - */ - for (i = (now.tv_sec - loops) % BW_METER_BUCKETS; loops > 0; loops--) { - struct bw_meter *x, *tmp_list; - - if (++i >= BW_METER_BUCKETS) - i = 0; - - /* Disconnect the list of bw_meter entries from the bin */ - tmp_list = V_bw_meter_timers[i]; - V_bw_meter_timers[i] = NULL; - - /* Process the list of bw_meter entries */ - while (tmp_list != NULL) { - x = tmp_list; - tmp_list = tmp_list->bm_time_next; - - /* Test if the time interval is over */ - process_endtime = x->bm_start_time; - BW_TIMEVALADD(&process_endtime, &x->bm_threshold.b_time); - if (BW_TIMEVALCMP(&process_endtime, &now, >)) { - /* Not yet: reschedule, but don't reset */ - int time_hash; - - BW_METER_TIMEHASH(x, time_hash); - if (time_hash == i && process_endtime.tv_sec == now.tv_sec) { - /* - * XXX: somehow the bin processing is a bit ahead of time. - * Put the entry in the next bin. - */ - if (++time_hash >= BW_METER_BUCKETS) - time_hash = 0; - } - x->bm_time_next = V_bw_meter_timers[time_hash]; - V_bw_meter_timers[time_hash] = x; - x->bm_time_hash = time_hash; - - continue; - } - - /* - * Test if we should deliver an upcall - */ - if (((x->bm_flags & BW_METER_UNIT_PACKETS) && - (x->bm_measured.b_packets <= x->bm_threshold.b_packets)) || - ((x->bm_flags & BW_METER_UNIT_BYTES) && - (x->bm_measured.b_bytes <= x->bm_threshold.b_bytes))) { - /* Prepare an upcall for delivery */ - bw_meter_prepare_upcall(x, &now); - } - - /* - * Reschedule for next processing - */ - schedule_bw_meter(x, &now); - } - } - - /* Send all upcalls that are pending delivery */ - bw_upcalls_send(); - - MFC_UNLOCK(); -} - /* * A periodic function for sending all upcalls that are pending delivery */ @@ -2297,23 +2132,6 @@ expire_bw_upcalls_send(void *arg) CURVNET_RESTORE(); } -/* - * A periodic function for periodic scanning of the multicast forwarding - * table for processing all "<=" bw_meter entries. - */ -static void -expire_bw_meter_process(void *arg) -{ - CURVNET_SET((struct vnet *) arg); - - if (V_mrt_api_config & MRT_MFC_BW_UPCALL) - bw_meter_process(); - - callout_reset(&V_bw_meter_ch, BW_METER_PERIOD, expire_bw_meter_process, - curvnet); - CURVNET_RESTORE(); -} - /* * End of bandwidth monitoring code */ @@ -2835,14 +2653,11 @@ vnet_mroute_init(const void *unused __unused) V_viftable = mallocarray(MAXVIFS, sizeof(*V_viftable), M_MRTABLE, M_WAITOK|M_ZERO); - V_bw_meter_timers = mallocarray(BW_METER_BUCKETS, - sizeof(*V_bw_meter_timers), M_MRTABLE, M_WAITOK|M_ZERO); V_bw_upcalls = mallocarray(BW_UPCALLS_MAX, sizeof(*V_bw_upcalls), M_MRTABLE, M_WAITOK|M_ZERO); callout_init(&V_expire_upcalls_ch, 1); callout_init(&V_bw_upcalls_ch, 1); - callout_init(&V_bw_meter_ch, 1); } VNET_SYSINIT(vnet_mroute_init, SI_SUB_PROTO_MC, SI_ORDER_ANY, vnet_mroute_init, @@ -2853,7 +2668,6 @@ vnet_mroute_uninit(const void *unused __unused) { free(V_bw_upcalls, M_MRTABLE); - free(V_bw_meter_timers, M_MRTABLE); free(V_viftable, M_MRTABLE); free(V_nexpire, M_MRTABLE); V_nexpire = NULL; diff --git a/sys/netinet/ip_mroute.h b/sys/netinet/ip_mroute.h index 6ef99c0172f3..2895ecc964d3 100644 --- a/sys/netinet/ip_mroute.h +++ b/sys/netinet/ip_mroute.h @@ -266,7 +266,7 @@ struct vif { u_long v_bytes_out; /* # bytes out on interface */ }; -#ifdef _KERNEL +#if defined(_KERNEL) || defined (_NETSTAT) /* * The kernel's multicast forwarding cache entry structure */ @@ -283,7 +283,10 @@ struct mfc { struct timeval mfc_last_assert; /* last time I sent an assert*/ uint8_t mfc_flags[MAXVIFS]; /* the MRT_MFC_FLAGS_* flags */ struct in_addr mfc_rp; /* the RP address */ - struct bw_meter *mfc_bw_meter; /* list of bandwidth meters */ + struct bw_meter *mfc_bw_meter_leq; /* list of bandwidth meters + for Lower-or-EQual case */ + struct bw_meter *mfc_bw_meter_geq; /* list of bandwidth meters + for Greater-or-EQual case */ u_long mfc_nstall; /* # of packets awaiting mfc */ TAILQ_HEAD(, rtdetq) mfc_stall; /* q of packets awaiting mfc */ }; @@ -327,7 +330,6 @@ struct rtdetq { struct bw_meter { struct bw_meter *bm_mfc_next; /* next bw meter (same mfc) */ struct bw_meter *bm_time_next; /* next bw meter (same time) */ - uint32_t bm_time_hash; /* the time hash value */ struct mfc *bm_mfc; /* the corresponding mfc */ uint32_t bm_flags; /* misc flags (see below) */ #define BW_METER_UNIT_PACKETS (1 << 0) /* threshold (in packets) */ @@ -344,6 +346,10 @@ struct bw_meter { struct bw_data bm_threshold; /* the upcall threshold */ struct bw_data bm_measured; /* the measured bw */ struct timeval bm_start_time; /* abs. time */ +#ifdef _KERNEL + struct callout bm_meter_callout; /* Periodic callout */ + void* arg; /* custom argument */ +#endif }; #ifdef _KERNEL diff --git a/usr.bin/netstat/mroute.c b/usr.bin/netstat/mroute.c index 04b7ead03b7b..a7ce983d13a2 100644 --- a/usr.bin/netstat/mroute.c +++ b/usr.bin/netstat/mroute.c @@ -62,9 +62,9 @@ __FBSDID("$FreeBSD$"); #include #include -#define _KERNEL 1 +#define _NETSTAT 1 #include -#undef _KERNEL +#undef _NETSTAT_ #include #include @@ -213,7 +213,16 @@ print_mfc(struct mfc *m, int maxvif, int *banner_printed) * XXX We break the rules and try to use KVM to read the * bandwidth meters, they are not retrievable via sysctl yet. */ - bwm = m->mfc_bw_meter; + bwm = m->mfc_bw_meter_leq; + while (bwm != NULL) { + error = kread((u_long)bwm, (char *)&bw_meter, + sizeof(bw_meter)); + if (error) + break; + print_bw_meter(&bw_meter, &bw_banner_printed); + bwm = bw_meter.bm_mfc_next; + } + bwm = m->mfc_bw_meter_geq; while (bwm != NULL) { error = kread((u_long)bwm, (char *)&bw_meter, sizeof(bw_meter)); From owner-dev-commits-src-all@freebsd.org Fri May 21 06:01:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AA7E5651C29; Fri, 21 May 2021 06:01: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 4FmbbW4W2jz4dDD; Fri, 21 May 2021 06:01: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 82FED422A; Fri, 21 May 2021 06:01: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 14L61xv2002793; Fri, 21 May 2021 06:01:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14L61xQE002792; Fri, 21 May 2021 06:01:59 GMT (envelope-from git) Date: Fri, 21 May 2021 06:01:59 GMT Message-Id: <202105210601.14L61xQE002792@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: eedbbec3fd62 - main - ip_mroute: remove unused declarations MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eedbbec3fd624aca13649351ca1526036d10d855 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 06:01:59 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=eedbbec3fd624aca13649351ca1526036d10d855 commit eedbbec3fd624aca13649351ca1526036d10d855 Author: Wojciech Macek AuthorDate: 2021-05-21 06:01:26 +0000 Commit: Wojciech Macek CommitDate: 2021-05-21 06:01:26 +0000 ip_mroute: remove unused declarations fix build for non-x86 targets --- sys/netinet/ip_mroute.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index 0cb980b7247e..5414b0e3da0e 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -126,9 +126,6 @@ __FBSDID("$FreeBSD$"); #define VIFI_INVALID ((vifi_t) -1) -VNET_DEFINE_STATIC(uint32_t, last_tv_sec); /* last time we processed this */ -#define V_last_tv_sec VNET(last_tv_sec) - static MALLOC_DEFINE(M_MRTABLE, "mroutetbl", "multicast forwarding cache"); /* @@ -310,7 +307,6 @@ static int add_bw_upcall(struct bw_upcall *); static int add_mfc(struct mfcctl2 *); static int add_vif(struct vifctl *); static void bw_meter_prepare_upcall(struct bw_meter *, struct timeval *); -static void bw_meter_process(void); static void bw_meter_geq_receive_packet(struct bw_meter *, int, struct timeval *); static void bw_upcalls_send(void); @@ -338,13 +334,11 @@ static int pim_register_send_rp(struct ip *, struct vif *, struct mbuf *, struct mfc *); static int pim_register_send_upcall(struct ip *, struct vif *, struct mbuf *, struct mfc *); -static void schedule_bw_meter(struct bw_meter *, struct timeval *); static void send_packet(struct vif *, struct mbuf *); static int set_api_config(uint32_t *); static int set_assert(int); static int socket_send(struct socket *, struct mbuf *, struct sockaddr_in *); -static void unschedule_bw_meter(struct bw_meter *); /* * Kernel multicast forwarding API capabilities and setup. From owner-dev-commits-src-all@freebsd.org Fri May 21 06:26:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 39DAC651E34; Fri, 21 May 2021 06:26: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 4Fmc7g1168z4ngS; Fri, 21 May 2021 06:26: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 06CD648DF; Fri, 21 May 2021 06:26: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 14L6QM3M028852; Fri, 21 May 2021 06:26:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14L6QMSF028851; Fri, 21 May 2021 06:26:22 GMT (envelope-from git) Date: Fri, 21 May 2021 06:26:22 GMT Message-Id: <202105210626.14L6QMSF028851@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 95c19e1d6561 - main - linux: refactor bsd_to_linux_regset() out of linux_ptrace.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 95c19e1d65619624db4a7a21afc1685f122a05c1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 06:26:23 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=95c19e1d65619624db4a7a21afc1685f122a05c1 commit 95c19e1d65619624db4a7a21afc1685f122a05c1 Author: Edward Tomasz Napierala AuthorDate: 2021-05-21 06:22:25 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-21 06:26:07 +0000 linux: refactor bsd_to_linux_regset() out of linux_ptrace.c This will be used for Linux coredump support. Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30365 --- sys/amd64/linux/linux.h | 36 +++++++++++++++++++++++++++++ sys/amd64/linux/linux_ptrace.c | 46 ++++++------------------------------- sys/amd64/linux32/linux.h | 26 +++++++++++++++++++++ sys/amd64/linux32/linux32_machdep.c | 24 +++++++++++++++++++ 4 files changed, 93 insertions(+), 39 deletions(-) diff --git a/sys/amd64/linux/linux.h b/sys/amd64/linux/linux.h index dc4986817d11..4e27fd51a72d 100644 --- a/sys/amd64/linux/linux.h +++ b/sys/amd64/linux/linux.h @@ -446,4 +446,40 @@ struct linux_robust_list_head { l_uintptr_t pending_list; }; +/* This corresponds to 'struct user_regs_struct' in Linux. */ +struct linux_pt_regset { + l_ulong r15; + l_ulong r14; + l_ulong r13; + l_ulong r12; + l_ulong rbp; + l_ulong rbx; + l_ulong r11; + l_ulong r10; + l_ulong r9; + l_ulong r8; + l_ulong rax; + l_ulong rcx; + l_ulong rdx; + l_ulong rsi; + l_ulong rdi; + l_ulong orig_rax; + l_ulong rip; + l_ulong cs; + l_ulong eflags; + l_ulong rsp; + l_ulong ss; + l_ulong fs_base; + l_ulong gs_base; + l_ulong ds; + l_ulong es; + l_ulong fs; + l_ulong gs; +}; + +struct reg; + +void bsd_to_linux_regset(struct reg *b_reg, + struct linux_pt_regset *l_regset); + #endif /* !_AMD64_LINUX_H_ */ diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c index 43ecd8892e0f..32d736d49095 100644 --- a/sys/amd64/linux/linux_ptrace.c +++ b/sys/amd64/linux/linux_ptrace.c @@ -173,36 +173,6 @@ struct linux_pt_reg { l_ulong ss; }; -struct linux_pt_regset { - l_ulong r15; - l_ulong r14; - l_ulong r13; - l_ulong r12; - l_ulong rbp; - l_ulong rbx; - l_ulong r11; - l_ulong r10; - l_ulong r9; - l_ulong r8; - l_ulong rax; - l_ulong rcx; - l_ulong rdx; - l_ulong rsi; - l_ulong rdi; - l_ulong orig_rax; - l_ulong rip; - l_ulong cs; - l_ulong eflags; - l_ulong rsp; - l_ulong ss; - l_ulong fs_base; - l_ulong gs_base; - l_ulong ds; - l_ulong es; - l_ulong fs; - l_ulong gs; -}; - /* * Translate amd64 ptrace registers between Linux and FreeBSD formats. * The translation is pretty straighforward, for all registers but @@ -235,9 +205,8 @@ map_regs_to_linux(struct reg *b_reg, struct linux_pt_reg *l_reg) l_reg->ss = b_reg->r_ss; } -static void -map_regs_to_linux_regset(struct reg *b_reg, unsigned long fs_base, - unsigned long gs_base, struct linux_pt_regset *l_regset) +void +bsd_to_linux_regset(struct reg *b_reg, struct linux_pt_regset *l_regset) { l_regset->r15 = b_reg->r_r15; @@ -261,8 +230,8 @@ map_regs_to_linux_regset(struct reg *b_reg, unsigned long fs_base, l_regset->eflags = b_reg->r_rflags; l_regset->rsp = b_reg->r_rsp; l_regset->ss = b_reg->r_ss; - l_regset->fs_base = fs_base; - l_regset->gs_base = gs_base; + l_regset->fs_base = 0; + l_regset->gs_base = 0; l_regset->ds = b_reg->r_ds; l_regset->es = b_reg->r_es; l_regset->fs = b_reg->r_fs; @@ -477,7 +446,6 @@ linux_ptrace_getregset_prstatus(struct thread *td, pid_t pid, l_ulong data) struct linux_pt_regset l_regset; struct iovec iov; struct pcb *pcb; - unsigned long fsbase, gsbase; size_t len; int error; @@ -494,10 +462,10 @@ linux_ptrace_getregset_prstatus(struct thread *td, pid_t pid, l_ulong data) pcb = td->td_pcb; if (td == curthread) update_pcb_bases(pcb); - fsbase = pcb->pcb_fsbase; - gsbase = pcb->pcb_gsbase; - map_regs_to_linux_regset(&b_reg, fsbase, gsbase, &l_regset); + bsd_to_linux_regset(&b_reg, &l_regset); + l_regset.fs_base = pcb->pcb_fsbase; + l_regset.gs_base = pcb->pcb_gsbase; error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); if (error != 0) { diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h index 244daba4b5c0..286b9b52801c 100644 --- a/sys/amd64/linux32/linux.h +++ b/sys/amd64/linux32/linux.h @@ -630,4 +630,30 @@ struct linux_robust_list_head { l_uintptr_t pending_list; }; +/* This corresponds to 'struct user_regs_struct32' in Linux. */ +struct linux_pt_regset32 { + l_uint ebx; + l_uint ecx; + l_uint edx; + l_uint esi; + l_uint edi; + l_uint ebp; + l_uint eax; + l_uint ds; + l_uint es; + l_uint fs; + l_uint gs; + l_uint orig_eax; + l_uint eip; + l_uint cs; + l_uint eflags; + l_uint esp; + l_uint ss; +}; + +struct reg32; + +void bsd_to_linux_regset32(struct reg32 *b_reg, + struct linux_pt_regset32 *l_regset); + #endif /* !_AMD64_LINUX_H_ */ diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c index 8ae82f3df8ca..880cccbb2328 100644 --- a/sys/amd64/linux32/linux32_machdep.c +++ b/sys/amd64/linux32/linux32_machdep.c @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -721,6 +722,29 @@ linux_set_thread_area(struct thread *td, return (0); } +void +bsd_to_linux_regset32(struct reg32 *b_reg, struct linux_pt_regset32 *l_regset) +{ + + l_regset->ebx = b_reg->r_ebx; + l_regset->ecx = b_reg->r_ecx; + l_regset->edx = b_reg->r_edx; + l_regset->esi = b_reg->r_esi; + l_regset->edi = b_reg->r_edi; + l_regset->ebp = b_reg->r_ebp; + l_regset->eax = b_reg->r_eax; + l_regset->ds = b_reg->r_ds; + l_regset->es = b_reg->r_es; + l_regset->fs = b_reg->r_fs; + l_regset->gs = b_reg->r_gs; + l_regset->orig_eax = b_reg->r_eax; + l_regset->eip = b_reg->r_eip; + l_regset->cs = b_reg->r_cs; + l_regset->eflags = b_reg->r_eflags; + l_regset->esp = b_reg->r_esp; + l_regset->ss = b_reg->r_ss; +} + int futex_xchgl_nosmap(int oparg, uint32_t *uaddr, int *oldval); int futex_xchgl_smap(int oparg, uint32_t *uaddr, int *oldval); DEFINE_IFUNC(, int, futex_xchgl, (int, uint32_t *, int *)) From owner-dev-commits-src-all@freebsd.org Fri May 21 06:38:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D8603652551; Fri, 21 May 2021 06:38: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 4FmcPg5nLwz4sS5; Fri, 21 May 2021 06:38: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 AEBD2476B; Fri, 21 May 2021 06:38: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 14L6cVAN043266; Fri, 21 May 2021 06:38:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14L6cVh3043265; Fri, 21 May 2021 06:38:31 GMT (envelope-from git) Date: Fri, 21 May 2021 06:38:31 GMT Message-Id: <202105210638.14L6cVh3043265@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: d39aac796bd2 - main - pms(4): clear CCBs allocated on the stack MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d39aac796bd20692919223b1bbec6ce6b2779e1a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 06:38:31 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=d39aac796bd20692919223b1bbec6ce6b2779e1a commit d39aac796bd20692919223b1bbec6ce6b2779e1a Author: Edward Tomasz Napierala AuthorDate: 2021-05-21 06:28:46 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-21 06:29:23 +0000 pms(4): clear CCBs allocated on the stack Reviewed By: imp Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D30300 --- sys/dev/pms/freebsd/driver/ini/src/agtiapi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c b/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c index a2b20c9e9264..a4efec572864 100644 --- a/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c +++ b/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c @@ -470,6 +470,7 @@ int agtiapi_getCardInfo ( struct agtiapi_softc *pCard, void agtiapi_adjust_queue_depth(struct cam_path *path, bit32 QueueDepth) { struct ccb_relsim crs; + memset(&crs, 0, sizeof(crs)); xpt_setup_ccb(&crs.ccb_h, path, 5); crs.ccb_h.func_code = XPT_REL_SIMQ; crs.ccb_h.flags = CAM_DEV_QFREEZE; @@ -929,6 +930,7 @@ static int agtiapi_attach( device_t devx ) return( EIO ); } pmsc->path = ccb->ccb_h.path; + memset(&csa, 0, sizeof(csa)); xpt_setup_ccb(&csa.ccb_h, pmsc->path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_FOUND_DEVICE; @@ -6545,6 +6547,7 @@ int agtiapi_ReleaseHBA( device_t dev ) if (pCard->sim != NULL) { mtx_lock(&thisCardInst->pmIOLock); + memset(&csa, 0, sizeof(csa)); xpt_setup_ccb(&csa.ccb_h, pCard->path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = 0; From owner-dev-commits-src-all@freebsd.org Fri May 21 06:58:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C4401652777; Fri, 21 May 2021 06:58: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 4Fmcrc59L4z50Th; Fri, 21 May 2021 06:58: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 933D54D95; Fri, 21 May 2021 06:58: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 14L6wOeF070554; Fri, 21 May 2021 06:58:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14L6wOP6070553; Fri, 21 May 2021 06:58:24 GMT (envelope-from git) Date: Fri, 21 May 2021 06:58:24 GMT Message-Id: <202105210658.14L6wOP6070553@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 7608b98c4394 - main - mpr, mps: clear CCBs allocated on the stack MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7608b98c4394590840a53d2b38b908582253de32 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 06:58:24 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=7608b98c4394590840a53d2b38b908582253de32 commit 7608b98c4394590840a53d2b38b908582253de32 Author: Edward Tomasz Napierala AuthorDate: 2021-05-21 06:42:08 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-21 06:42:13 +0000 mpr, mps: clear CCBs allocated on the stack Reviewed By: imp Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D30301 --- sys/dev/mpr/mpr_sas.c | 1 + sys/dev/mps/mps_sas.c | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/dev/mpr/mpr_sas.c b/sys/dev/mpr/mpr_sas.c index a60881553f01..7c6bc110069a 100644 --- a/sys/dev/mpr/mpr_sas.c +++ b/sys/dev/mpr/mpr_sas.c @@ -3358,6 +3358,7 @@ mprsas_async(void *callback_arg, uint32_t code, struct cam_path *path, } bzero(&rcap_buf, sizeof(rcap_buf)); + bzero(&cdai, sizeof(cdai)); xpt_setup_ccb(&cdai.ccb_h, path, CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.ccb_h.flags = CAM_DIR_IN; diff --git a/sys/dev/mps/mps_sas.c b/sys/dev/mps/mps_sas.c index 97160a40ce08..e961b3fd826c 100644 --- a/sys/dev/mps/mps_sas.c +++ b/sys/dev/mps/mps_sas.c @@ -3204,6 +3204,7 @@ mpssas_async(void *callback_arg, uint32_t code, struct cam_path *path, } bzero(&rcap_buf, sizeof(rcap_buf)); + bzero(&cdai, sizeof(cdai)); xpt_setup_ccb(&cdai.ccb_h, path, CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.ccb_h.flags = CAM_DIR_IN; From owner-dev-commits-src-all@freebsd.org Fri May 21 07:03:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AC494652D2F; Fri, 21 May 2021 07:03:53 +0000 (UTC) (envelope-from se@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fmcyx49gQz53r3; Fri, 21 May 2021 07:03:53 +0000 (UTC) (envelope-from se@freebsd.org) Received: from Stefans-MBP-449.fritz.box (p200300cd5f135c00cd477658b2baa9e2.dip0.t-ipconnect.de [IPv6:2003:cd:5f13:5c00:cd47:7658:b2ba:a9e2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id DF82A1AF3; Fri, 21 May 2021 07:03:50 +0000 (UTC) (envelope-from se@freebsd.org) To: Joe Clarke , Benjamin Kaduk , Zhenlei Huang Cc: "Rodney W. Grimes" , Lutz Donnerhacke , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202105182101.14IL1Gki054229@gitrepo.freebsd.org> <20210519055407.GA9715@belenus.iks-jena.de> <10b475c5-0100-2567-4e92-73b168b97e3f@marcuscom.com> <1DD8ABB9-94B1-4B44-8003-25432A91D520@gmail.com> <5cee6177-8b75-382e-cd3a-403397de0190@marcuscom.com> From: Stefan Esser Subject: Re: git: 3d846e48227e - main - Do not forward datagrams originated by link-local addresses Message-ID: <1c001c3f-191e-c761-0eb4-ff78171af580@freebsd.org> Date: Fri, 21 May 2021 09:03:46 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <5cee6177-8b75-382e-cd3a-403397de0190@marcuscom.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="j1LGn9wI3ZymfDQKB09AngNlOVIbFtVyC" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 07:03:53 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --j1LGn9wI3ZymfDQKB09AngNlOVIbFtVyC Content-Type: multipart/mixed; boundary="DF8bNBci5TbMCjIAIqDsY7evhLh1k4PBa"; protected-headers="v1" From: Stefan Esser To: Joe Clarke , Benjamin Kaduk , Zhenlei Huang Cc: "Rodney W. Grimes" , Lutz Donnerhacke , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Message-ID: <1c001c3f-191e-c761-0eb4-ff78171af580@freebsd.org> Subject: Re: git: 3d846e48227e - main - Do not forward datagrams originated by link-local addresses References: <202105182101.14IL1Gki054229@gitrepo.freebsd.org> <20210519055407.GA9715@belenus.iks-jena.de> <10b475c5-0100-2567-4e92-73b168b97e3f@marcuscom.com> <1DD8ABB9-94B1-4B44-8003-25432A91D520@gmail.com> <5cee6177-8b75-382e-cd3a-403397de0190@marcuscom.com> In-Reply-To: <5cee6177-8b75-382e-cd3a-403397de0190@marcuscom.com> --DF8bNBci5TbMCjIAIqDsY7evhLh1k4PBa Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Am 20.05.21 um 15:07 schrieb Joe Clarke: > On 5/19/21 22:39, Benjamin Kaduk wrote: >> Sorry, RFCs themselves do not change -- one of the distinctive feature= s of >> RFCs is precisely that they are immutable once published. >> The sentiment that what the current RFC for a given topic is, can chan= ge, is >> something that I can agree with, but that's not quite what was being >> discussed. >=20 > Agreed, which is why I say the reference still has value and one can us= e > it as a basis to follow the errata and newer docs. That said, I've > expressed my desire to leave the reference in, and I'll leave it at > that. I didn't think this would be that controversial. And, adding to that: if somebody works on a code fragment with reference to an RFC that has been replaced by a newer one known by the committer, then updating that reference might be considered a service for future readers of that code ... Regards, STefan --DF8bNBci5TbMCjIAIqDsY7evhLh1k4PBa-- --j1LGn9wI3ZymfDQKB09AngNlOVIbFtVyC Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEEo3HqZZwL7MgrcVMTR+u171r99UQFAmCnW1MFAwAAAAAACgkQR+u171r99UT6 DAf/TAe2xt6ykdkb2BJ9ErhKYUt0J0GT6CgAt056HGa4Cebe5WtXc6QmLJCo3bYFJ++kfcRlN8HN jgRFjSWqNZ88vj6WCfDDKBnkifG7R3yzKSFJPOSMhBcC9JwkQGJPxzNF9poxHkD2hN0iDdP8OSuh pdjG2OCS5EABrXwrtInDOMsEnVcY9manGuZV66RPF2Qpw3nNEkqo3ubGCJLhMqY/tRvVEZ4KVOr7 /xXJ5d21Vmcz6i3EGwZ5wsoTkVc1XJs/n9OUjXc9Zl1hL22CL2yiVmUYQ96k3Rh9Fh9UGoubatEm w+J3gAa6KOP3Wom+TTCiltaMI7dIQdg8idZkhjD12w== =vVOq -----END PGP SIGNATURE----- --j1LGn9wI3ZymfDQKB09AngNlOVIbFtVyC-- From owner-dev-commits-src-all@freebsd.org Fri May 21 07:09:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7D5D2652DA1; Fri, 21 May 2021 07:09: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 4Fmd5V365Bz55Cb; Fri, 21 May 2021 07:09: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 4F8624AF8; Fri, 21 May 2021 07:09: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 14L79YIa084908; Fri, 21 May 2021 07:09:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14L79YKu084907; Fri, 21 May 2021 07:09:34 GMT (envelope-from git) Date: Fri, 21 May 2021 07:09:34 GMT Message-Id: <202105210709.14L79YKu084907@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: de992eed7818 - main - mpt: clear CCBs allocated on the stack MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: de992eed7818d49c027cdecabdfb8224a24bcac0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 07:09:34 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=de992eed7818d49c027cdecabdfb8224a24bcac0 commit de992eed7818d49c027cdecabdfb8224a24bcac0 Author: Edward Tomasz Napierala AuthorDate: 2021-05-21 06:58:49 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-21 06:59:02 +0000 mpt: clear CCBs allocated on the stack Reviewed By: imp Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D30302 --- sys/dev/mpt/mpt_cam.c | 1 + sys/dev/mpt/mpt_raid.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/sys/dev/mpt/mpt_cam.c b/sys/dev/mpt/mpt_cam.c index 64776d673674..54bdc22759fa 100644 --- a/sys/dev/mpt/mpt_cam.c +++ b/sys/dev/mpt/mpt_cam.c @@ -2448,6 +2448,7 @@ mpt_cam_event(struct mpt_softc *mpt, request_t *req, "XPT_REL_SIMQ"); break; } + memset(&crs, 0, sizeof(crs)); xpt_setup_ccb(&crs.ccb_h, tmppath, 5); crs.ccb_h.func_code = XPT_REL_SIMQ; crs.ccb_h.flags = CAM_DEV_QFREEZE; diff --git a/sys/dev/mpt/mpt_raid.c b/sys/dev/mpt/mpt_raid.c index 28667d85cf4d..603c2b42a370 100644 --- a/sys/dev/mpt/mpt_raid.c +++ b/sys/dev/mpt/mpt_raid.c @@ -296,6 +296,7 @@ mpt_raid_attach(struct mpt_softc *mpt) goto cleanup; } + memset(&csa, 0, sizeof(csa)); xpt_setup_ccb(&csa.ccb_h, mpt->path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_FOUND_DEVICE; @@ -336,6 +337,7 @@ mpt_raid_detach(struct mpt_softc *mpt) handler.reply_handler = mpt_raid_reply_handler; mpt_deregister_handler(mpt, MPT_HANDLER_REPLY, handler, raid_handler_id); + memset(&csa, 0, sizeof(csa)); xpt_setup_ccb(&csa.ccb_h, mpt->path, /*priority*/5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = 0; @@ -1071,6 +1073,7 @@ mpt_adjust_queue_depth(struct mpt_softc *mpt, struct mpt_raid_volume *mpt_vol, { struct ccb_relsim crs; + memset(&crs, 0, sizeof(crs)); xpt_setup_ccb(&crs.ccb_h, path, /*priority*/5); crs.ccb_h.func_code = XPT_REL_SIMQ; crs.ccb_h.flags = CAM_DEV_QFREEZE; From owner-dev-commits-src-all@freebsd.org Fri May 21 07:21:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B0B1C65321B; Fri, 21 May 2021 07:21: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 4FmdLk4f1wz3CFk; Fri, 21 May 2021 07:21: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 86FA250B3; Fri, 21 May 2021 07:21: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 14L7L270010174; Fri, 21 May 2021 07:21:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14L7L21L010173; Fri, 21 May 2021 07:21:02 GMT (envelope-from git) Date: Fri, 21 May 2021 07:21:02 GMT Message-Id: <202105210721.14L7L21L010173@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: b9353e0b44a3 - main - isci: clear CCBs allocated on the stack MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b9353e0b44a360dc8d45b640514aa8276b991289 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 07:21:02 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=b9353e0b44a360dc8d45b640514aa8276b991289 commit b9353e0b44a360dc8d45b640514aa8276b991289 Author: Edward Tomasz Napierala AuthorDate: 2021-05-21 07:10:15 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-21 07:10:22 +0000 isci: clear CCBs allocated on the stack Reviewed By: gallatin, imp Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D30303 --- sys/dev/isci/isci_io_request.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/isci/isci_io_request.c b/sys/dev/isci/isci_io_request.c index 711f5757ee5e..8d8d84b5b855 100644 --- a/sys/dev/isci/isci_io_request.c +++ b/sys/dev/isci/isci_io_request.c @@ -186,6 +186,7 @@ isci_io_request_complete(SCI_CONTROLLER_HANDLE_T scif_controller, cam_sim_path(isci_controller->sim), isci_remote_device->index, 0); + memset(&ccb_relsim, 0, sizeof(ccb_relsim)); xpt_setup_ccb(&ccb_relsim.ccb_h, path, 5); ccb_relsim.ccb_h.func_code = XPT_REL_SIMQ; ccb_relsim.ccb_h.flags = CAM_DEV_QFREEZE; From owner-dev-commits-src-all@freebsd.org Fri May 21 07:47:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1B4566533B3; Fri, 21 May 2021 07:47: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 4FmdxX0K8dz3QYd; Fri, 21 May 2021 07:47: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 E6FB5524C; Fri, 21 May 2021 07:47: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 14L7lhl6037990; Fri, 21 May 2021 07:47:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14L7lhmi037989; Fri, 21 May 2021 07:47:43 GMT (envelope-from git) Date: Fri, 21 May 2021 07:47:43 GMT Message-Id: <202105210747.14L7lhmi037989@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 45f57ce1224b - main - arcmsr: clear CCB allocated on the stack MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 45f57ce1224b5fdf05c0c68aee4d134436e0efba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 07:47:44 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=45f57ce1224b5fdf05c0c68aee4d134436e0efba commit 45f57ce1224b5fdf05c0c68aee4d134436e0efba Author: Edward Tomasz Napierala AuthorDate: 2021-05-21 07:21:45 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-21 07:22:13 +0000 arcmsr: clear CCB allocated on the stack Reviewed By: delphij, imp Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D30304 --- sys/dev/arcmsr/arcmsr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/arcmsr/arcmsr.c b/sys/dev/arcmsr/arcmsr.c index f7f913de89af..31d12f0ffd40 100644 --- a/sys/dev/arcmsr/arcmsr.c +++ b/sys/dev/arcmsr/arcmsr.c @@ -4957,6 +4957,7 @@ irqx: /* **************************************************** */ + memset(&csa, 0, sizeof(csa)); xpt_setup_ccb(&csa.ccb_h, acb->ppath, /*priority*/5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_FOUND_DEVICE|AC_LOST_DEVICE; From owner-dev-commits-src-all@freebsd.org Fri May 21 07:57:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C7AAD653A91; Fri, 21 May 2021 07:57:06 +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 4Fmf8L4kFzz3m3r; Fri, 21 May 2021 07:57: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 7E1D855C7; Fri, 21 May 2021 07:57:06 +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 14L7v6pZ051819; Fri, 21 May 2021 07:57:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14L7v6MU051818; Fri, 21 May 2021 07:57:06 GMT (envelope-from git) Date: Fri, 21 May 2021 07:57:06 GMT Message-Id: <202105210757.14L7v6MU051818@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 8dc96b74edb8 - main - cam: clear on-stack CCBs in last few drivers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8dc96b74edb844bb621afeba38fe4af104b13120 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 07:57:07 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=8dc96b74edb844bb621afeba38fe4af104b13120 commit 8dc96b74edb844bb621afeba38fe4af104b13120 Author: Edward Tomasz Napierala AuthorDate: 2021-05-21 07:48:27 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-21 07:53:59 +0000 cam: clear on-stack CCBs in last few drivers This changes ahc(4), ahd(4), hptiop(4), hptnr(4), hptrr(4), and ps3cdrom(4). Reviewed By: imp Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D30305 --- sys/dev/aic7xxx/aic79xx_osm.c | 1 + sys/dev/aic7xxx/aic7xxx_osm.c | 1 + sys/dev/hpt27xx/hpt27xx_osm_bsd.c | 1 + sys/dev/hptiop/hptiop.c | 2 ++ sys/dev/hptnr/hptnr_osm_bsd.c | 1 + sys/dev/hptrr/hptrr_osm_bsd.c | 1 + sys/powerpc/ps3/ps3cdrom.c | 1 + 7 files changed, 8 insertions(+) diff --git a/sys/dev/aic7xxx/aic79xx_osm.c b/sys/dev/aic7xxx/aic79xx_osm.c index 31750eced9c5..16d39f43a2cc 100644 --- a/sys/dev/aic7xxx/aic79xx_osm.c +++ b/sys/dev/aic7xxx/aic79xx_osm.c @@ -267,6 +267,7 @@ ahd_attach(struct ahd_softc *ahd) goto fail; } + memset(&csa, 0, sizeof(csa)); xpt_setup_ccb(&csa.ccb_h, path, /*priority*/5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_LOST_DEVICE; diff --git a/sys/dev/aic7xxx/aic7xxx_osm.c b/sys/dev/aic7xxx/aic7xxx_osm.c index 81059a281fba..de679ec210a1 100644 --- a/sys/dev/aic7xxx/aic7xxx_osm.c +++ b/sys/dev/aic7xxx/aic7xxx_osm.c @@ -215,6 +215,7 @@ ahc_attach(struct ahc_softc *ahc) goto fail; } + memset(&csa, 0, sizeof(csa)); xpt_setup_ccb(&csa.ccb_h, path, /*priority*/5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_LOST_DEVICE; diff --git a/sys/dev/hpt27xx/hpt27xx_osm_bsd.c b/sys/dev/hpt27xx/hpt27xx_osm_bsd.c index aa7c14e68d88..9a5a27482fab 100644 --- a/sys/dev/hpt27xx/hpt27xx_osm_bsd.c +++ b/sys/dev/hpt27xx/hpt27xx_osm_bsd.c @@ -1252,6 +1252,7 @@ static void hpt_final_init(void *dummy) return ; } + memset(&ccb, 0, sizeof(ccb)); xpt_setup_ccb(&ccb.ccb_h, vbus_ext->path, /*priority*/5); ccb.ccb_h.func_code = XPT_SASYNC_CB; ccb.event_enable = AC_LOST_DEVICE; diff --git a/sys/dev/hptiop/hptiop.c b/sys/dev/hptiop/hptiop.c index 50d26231a91c..c5ac59f31df5 100644 --- a/sys/dev/hptiop/hptiop.c +++ b/sys/dev/hptiop/hptiop.c @@ -2046,6 +2046,7 @@ static int hptiop_attach(device_t dev) goto free_hba_path; } + memset(&ccb, 0, sizeof(ccb)); xpt_setup_ccb(&ccb.ccb_h, hba->path, /*priority*/5); ccb.ccb_h.func_code = XPT_SASYNC_CB; ccb.event_enable = (AC_FOUND_DEVICE | AC_LOST_DEVICE); @@ -2797,6 +2798,7 @@ static void hptiop_release_resource(struct hpt_iop_hba *hba) if (hba->path) { struct ccb_setasync ccb; + memset(&ccb, 0, sizeof(ccb)); xpt_setup_ccb(&ccb.ccb_h, hba->path, /*priority*/5); ccb.ccb_h.func_code = XPT_SASYNC_CB; ccb.event_enable = 0; diff --git a/sys/dev/hptnr/hptnr_osm_bsd.c b/sys/dev/hptnr/hptnr_osm_bsd.c index 8afd3e22d2e8..2fe5c43d8b09 100644 --- a/sys/dev/hptnr/hptnr_osm_bsd.c +++ b/sys/dev/hptnr/hptnr_osm_bsd.c @@ -1438,6 +1438,7 @@ static void hpt_final_init(void *dummy) } hpt_unlock_vbus(vbus_ext); + memset(&ccb, 0, sizeof(ccb)); xpt_setup_ccb(&ccb.ccb_h, vbus_ext->path, /*priority*/5); ccb.ccb_h.func_code = XPT_SASYNC_CB; ccb.event_enable = AC_LOST_DEVICE; diff --git a/sys/dev/hptrr/hptrr_osm_bsd.c b/sys/dev/hptrr/hptrr_osm_bsd.c index 3fc13f65a984..5dc9680e5cc8 100644 --- a/sys/dev/hptrr/hptrr_osm_bsd.c +++ b/sys/dev/hptrr/hptrr_osm_bsd.c @@ -1086,6 +1086,7 @@ static void hpt_final_init(void *dummy) } hpt_unlock_vbus(vbus_ext); + memset(&ccb, 0, sizeof(ccb)); xpt_setup_ccb(&ccb.ccb_h, vbus_ext->path, /*priority*/5); ccb.ccb_h.func_code = XPT_SASYNC_CB; ccb.event_enable = AC_LOST_DEVICE; diff --git a/sys/powerpc/ps3/ps3cdrom.c b/sys/powerpc/ps3/ps3cdrom.c index 776f52d4db7b..2f9b193e9af4 100644 --- a/sys/powerpc/ps3/ps3cdrom.c +++ b/sys/powerpc/ps3/ps3cdrom.c @@ -262,6 +262,7 @@ ps3cdrom_attach(device_t dev) goto fail_unregister_xpt_bus; } + memset(&csa, 0, sizeof(csa)); xpt_setup_ccb(&csa.ccb_h, sc->sc_path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_LOST_DEVICE; From owner-dev-commits-src-all@freebsd.org Fri May 21 08:31:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D0A63654635; Fri, 21 May 2021 08:31: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 4Fmfw85JDKz4WQB; Fri, 21 May 2021 08:31: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 9DBD96129; Fri, 21 May 2021 08:31: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 14L8VajN000642; Fri, 21 May 2021 08:31:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14L8Va9P000641; Fri, 21 May 2021 08:31:36 GMT (envelope-from git) Date: Fri, 21 May 2021 08:31:36 GMT Message-Id: <202105210831.14L8Va9P000641@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 500eb6dd8040 - main - tcp: Fix sending of TCP segments with IP level options MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 500eb6dd80404ea512e31a8f795c73cb802c9c64 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 08:31:36 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=500eb6dd80404ea512e31a8f795c73cb802c9c64 commit 500eb6dd80404ea512e31a8f795c73cb802c9c64 Author: Michael Tuexen AuthorDate: 2021-05-21 07:45:00 +0000 Commit: Michael Tuexen CommitDate: 2021-05-21 07:49:45 +0000 tcp: Fix sending of TCP segments with IP level options When bringing in TCP over UDP support in https://cgit.FreeBSD.org/src/commit/?id=9e644c23000c2f5028b235f6263d17ffb24d3605, the length of IP level options was considered when locating the transport header. This was incorrect and is fixed by this patch. X-MFC with: https://cgit.FreeBSD.org/src/commit/?id=9e644c23000c2f5028b235f6263d17ffb24d3605 MFC after: 3 days Reviewed by: markj, rscheff Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D30358 --- sys/netinet/tcp_output.c | 4 ++-- sys/netinet/tcp_stacks/bbr.c | 4 ++-- sys/netinet/tcp_stacks/rack.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 20b9c0371122..93c376f81f1a 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1154,7 +1154,7 @@ send: if (isipv6) { ip6 = mtod(m, struct ip6_hdr *); if (tp->t_port) { - udp = (struct udphdr *)((caddr_t)ip6 + ipoptlen + sizeof(struct ip6_hdr)); + udp = (struct udphdr *)((caddr_t)ip6 + sizeof(struct ip6_hdr)); udp->uh_sport = htons(V_tcp_udp_tunneling_port); udp->uh_dport = tp->t_port; ulen = hdrlen + len - sizeof(struct ip6_hdr); @@ -1172,7 +1172,7 @@ send: ipov = (struct ipovly *)ip; #endif if (tp->t_port) { - udp = (struct udphdr *)((caddr_t)ip + ipoptlen + sizeof(struct ip)); + udp = (struct udphdr *)((caddr_t)ip + sizeof(struct ip)); udp->uh_sport = htons(V_tcp_udp_tunneling_port); udp->uh_dport = tp->t_port; ulen = hdrlen + len - sizeof(struct ip); diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index af6c9462c8e0..22762d21c289 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -13354,7 +13354,7 @@ send: if (isipv6) { ip6 = mtod(m, struct ip6_hdr *); if (tp->t_port) { - udp = (struct udphdr *)((caddr_t)ip6 + ipoptlen + sizeof(struct ip6_hdr)); + udp = (struct udphdr *)((caddr_t)ip6 + sizeof(struct ip6_hdr)); udp->uh_sport = htons(V_tcp_udp_tunneling_port); udp->uh_dport = tp->t_port; ulen = hdrlen + len - sizeof(struct ip6_hdr); @@ -13372,7 +13372,7 @@ send: ipov = (struct ipovly *)ip; #endif if (tp->t_port) { - udp = (struct udphdr *)((caddr_t)ip + ipoptlen + sizeof(struct ip)); + udp = (struct udphdr *)((caddr_t)ip + sizeof(struct ip)); udp->uh_sport = htons(V_tcp_udp_tunneling_port); udp->uh_dport = tp->t_port; ulen = hdrlen + len - sizeof(struct ip); diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index c4f3be02dd29..73b47745cbac 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -17658,7 +17658,7 @@ send: if (isipv6) { ip6 = mtod(m, struct ip6_hdr *); if (tp->t_port) { - udp = (struct udphdr *)((caddr_t)ip6 + ipoptlen + sizeof(struct ip6_hdr)); + udp = (struct udphdr *)((caddr_t)ip6 + sizeof(struct ip6_hdr)); udp->uh_sport = htons(V_tcp_udp_tunneling_port); udp->uh_dport = tp->t_port; ulen = hdrlen + len - sizeof(struct ip6_hdr); @@ -17675,7 +17675,7 @@ send: ipov = (struct ipovly *)ip; #endif if (tp->t_port) { - udp = (struct udphdr *)((caddr_t)ip + ipoptlen + sizeof(struct ip)); + udp = (struct udphdr *)((caddr_t)ip + sizeof(struct ip)); udp->uh_sport = htons(V_tcp_udp_tunneling_port); udp->uh_dport = tp->t_port; ulen = hdrlen + len - sizeof(struct ip); From owner-dev-commits-src-all@freebsd.org Fri May 21 08:40:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 508BD654678; Fri, 21 May 2021 08:40:05 +0000 (UTC) (envelope-from lutz@iks-jena.de) Received: from annwfn.iks-jena.de (annwfn.iks-jena.de [IPv6:2001:4bd8::19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fmg5x0gVdz4Z9q; Fri, 21 May 2021 08:40:04 +0000 (UTC) (envelope-from lutz@iks-jena.de) X-SMTP-Sender: IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f Received: from belenus.iks-jena.de (belenus.iks-jena.de [IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f]) by annwfn.iks-jena.de (8.15.2/8.15.2) with ESMTPS id 14L8dqon025351 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 21 May 2021 10:39:53 +0200 X-MSA-Host: belenus.iks-jena.de Received: (from lutz@localhost) by belenus.iks-jena.de (8.14.3/8.14.1/Submit) id 14L8dqMc022913; Fri, 21 May 2021 10:39:52 +0200 Date: Fri, 21 May 2021 10:39:52 +0200 From: Lutz Donnerhacke To: Stefan Esser Cc: Joe Clarke , Benjamin Kaduk , Zhenlei Huang , "Rodney W. Grimes" , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 3d846e48227e - main - Do not forward datagrams originated by link-local addresses Message-ID: <20210521083952.GA22854@belenus.iks-jena.de> References: <202105182101.14IL1Gki054229@gitrepo.freebsd.org> <20210519055407.GA9715@belenus.iks-jena.de> <10b475c5-0100-2567-4e92-73b168b97e3f@marcuscom.com> <1DD8ABB9-94B1-4B44-8003-25432A91D520@gmail.com> <5cee6177-8b75-382e-cd3a-403397de0190@marcuscom.com> <1c001c3f-191e-c761-0eb4-ff78171af580@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1c001c3f-191e-c761-0eb4-ff78171af580@freebsd.org> X-message-flag: Please send plain text messages only. Thank you. User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspamd-Queue-Id: 4Fmg5x0gVdz4Z9q X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_RCPT(0.00)[]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 08:40:05 -0000 On Fri, May 21, 2021 at 09:03:46AM +0200, Stefan Esser wrote: > Am 20.05.21 um 15:07 schrieb Joe Clarke: > > On 5/19/21 22:39, Benjamin Kaduk wrote: > >> Sorry, RFCs themselves do not change -- one of the distinctive features of > >> RFCs is precisely that they are immutable once published. > >> The sentiment that what the current RFC for a given topic is, can change, is > >> something that I can agree with, but that's not quite what was being > >> discussed. > > > > Agreed, which is why I say the reference still has value and one can use > > it as a basis to follow the errata and newer docs. That said, I've > > expressed my desire to leave the reference in, and I'll leave it at > > that. I didn't think this would be that controversial. > > And, adding to that: if somebody works on a code fragment with reference > to an RFC that has been replaced by a newer one known by the committer, > then updating that reference might be considered a service for future > readers of that code ... May I point you all to https://reviews.freebsd.org/D30374 and ask for comment there? From owner-dev-commits-src-all@freebsd.org Fri May 21 09:08:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0F5C86554B4; Fri, 21 May 2021 09:08: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 4Fmgkx5Jkdz4nTB; Fri, 21 May 2021 09:08: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 9E1CA6840; Fri, 21 May 2021 09:08: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 14L98fXA045093; Fri, 21 May 2021 09:08:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14L98fTa045092; Fri, 21 May 2021 09:08:41 GMT (envelope-from git) Date: Fri, 21 May 2021 09:08:41 GMT Message-Id: <202105210908.14L98fTa045092@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: 032bf749fd44 - main - [tcp] Keep socket buffer locked until upcall MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 032bf749fd44ac5ff20aab2c3d8e3c05491778ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 09:08:42 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=032bf749fd44ac5ff20aab2c3d8e3c05491778ea commit 032bf749fd44ac5ff20aab2c3d8e3c05491778ea Author: Richard Scheffenegger AuthorDate: 2021-05-21 09:00:53 +0000 Commit: Richard Scheffenegger CommitDate: 2021-05-21 09:07:51 +0000 [tcp] Keep socket buffer locked until upcall r367492 would unlock the socket buffer before eventually calling the upcall. This leads to problematic interaction with NFS kernel server/client components (MP threads) accessing the socket buffer with potentially not correctly updated state. Reported by: rmacklem Reviewed By: tuexen, #transport Tested by: rmacklem, otis MFC after: 2 weeks Sponsored By: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29690 --- sys/netinet/tcp_input.c | 38 ++++++++++++++------------------ sys/netinet/tcp_reass.c | 2 -- sys/netinet/tcp_stacks/bbr.c | 20 ++++++++--------- sys/netinet/tcp_stacks/rack.c | 20 ++++++++--------- sys/netinet/tcp_stacks/rack_bbr_common.c | 1 - sys/netinet/tcp_var.h | 2 +- 6 files changed, 37 insertions(+), 46 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 49db8cc63cb3..18ef52959c15 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1509,18 +1509,17 @@ tcp_handle_wakeup(struct tcpcb *tp, struct socket *so) * the TIME_WAIT state before coming here, we need * to check if the socket is still connected. */ - if ((so->so_state & SS_ISCONNECTED) == 0) + if (tp == NULL) { return; + } + if (so == NULL) { + return; + } INP_LOCK_ASSERT(tp->t_inpcb); if (tp->t_flags & TF_WAKESOR) { tp->t_flags &= ~TF_WAKESOR; - SOCKBUF_UNLOCK_ASSERT(&so->so_rcv); - sorwakeup(so); - } - if (tp->t_flags & TF_WAKESOW) { - tp->t_flags &= ~TF_WAKESOW; - SOCKBUF_UNLOCK_ASSERT(&so->so_snd); - sowwakeup(so); + SOCKBUF_LOCK_ASSERT(&so->so_rcv); + sorwakeup_locked(so); } } @@ -1898,7 +1897,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, else if (!tcp_timer_active(tp, TT_PERSIST)) tcp_timer_activate(tp, TT_REXMT, tp->t_rxtcur); - tp->t_flags |= TF_WAKESOW; + sowwakeup(so); if (sbavail(&so->so_snd)) (void) tp->t_fb->tfb_tcp_output(tp); goto check_delack; @@ -1963,8 +1962,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, m_adj(m, drop_hdrlen); /* delayed header drop */ sbappendstream_locked(&so->so_rcv, m, 0); } - SOCKBUF_UNLOCK(&so->so_rcv); - tp->t_flags |= TF_WAKESOR; + /* NB: sorwakeup_locked() does an implicit unlock. */ + sorwakeup_locked(so); if (DELAY_ACK(tp, tlen)) { tp->t_flags |= TF_DELACK; } else { @@ -2502,9 +2501,11 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, * If segment contains data or ACK, will call tcp_reass() * later; if not, do so now to pass queued data to user. */ - if (tlen == 0 && (thflags & TH_FIN) == 0) + if (tlen == 0 && (thflags & TH_FIN) == 0) { (void) tcp_reass(tp, (struct tcphdr *)0, NULL, 0, (struct mbuf *)0); + tcp_handle_wakeup(tp, so); + } tp->snd_wl1 = th->th_seq - 1; /* FALLTHROUGH */ @@ -2959,8 +2960,8 @@ process_ACK: tp->snd_wnd = 0; ourfinisacked = 0; } - SOCKBUF_UNLOCK(&so->so_snd); - tp->t_flags |= TF_WAKESOW; + /* NB: sowwakeup_locked() does an implicit unlock. */ + sowwakeup_locked(so); m_freem(mfree); /* Detect una wraparound. */ if (!IN_RECOVERY(tp->t_flags) && @@ -3181,7 +3182,6 @@ dodata: /* XXX */ m_freem(m); else sbappendstream_locked(&so->so_rcv, m, 0); - SOCKBUF_UNLOCK(&so->so_rcv); tp->t_flags |= TF_WAKESOR; } else { /* @@ -3227,6 +3227,7 @@ dodata: /* XXX */ save_start + tlen); } } + tcp_handle_wakeup(tp, so); #if 0 /* * Note the amount of data that peer has sent into @@ -3250,9 +3251,8 @@ dodata: /* XXX */ */ if (thflags & TH_FIN) { if (TCPS_HAVERCVDFIN(tp->t_state) == 0) { - socantrcvmore(so); /* The socket upcall is handled by socantrcvmore. */ - tp->t_flags &= ~TF_WAKESOR; + socantrcvmore(so); /* * If connection is half-synchronized * (ie NEEDSYN flag on) then delay ACK, @@ -3316,7 +3316,6 @@ check_delack: tp->t_flags &= ~TF_DELACK; tcp_timer_activate(tp, TT_DELACK, tcp_delacktime); } - tcp_handle_wakeup(tp, so); INP_WUNLOCK(tp->t_inpcb); return; @@ -3350,7 +3349,6 @@ dropafterack: TCP_PROBE3(debug__input, tp, th, m); tp->t_flags |= TF_ACKNOW; (void) tp->t_fb->tfb_tcp_output(tp); - tcp_handle_wakeup(tp, so); INP_WUNLOCK(tp->t_inpcb); m_freem(m); return; @@ -3358,7 +3356,6 @@ dropafterack: dropwithreset: if (tp != NULL) { tcp_dropwithreset(m, th, tp, tlen, rstreason); - tcp_handle_wakeup(tp, so); INP_WUNLOCK(tp->t_inpcb); } else tcp_dropwithreset(m, th, NULL, tlen, rstreason); @@ -3375,7 +3372,6 @@ drop: #endif TCP_PROBE3(debug__input, tp, th, m); if (tp != NULL) { - tcp_handle_wakeup(tp, so); INP_WUNLOCK(tp->t_inpcb); } m_freem(m); diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c index 310d7d540507..8e24e7412473 100644 --- a/sys/netinet/tcp_reass.c +++ b/sys/netinet/tcp_reass.c @@ -959,7 +959,6 @@ new_entry: } else { sbappendstream_locked(&so->so_rcv, m, 0); } - SOCKBUF_UNLOCK(&so->so_rcv); tp->t_flags |= TF_WAKESOR; return (flags); } @@ -1108,7 +1107,6 @@ present: #ifdef TCP_REASS_LOGGING tcp_reass_log_dump(tp); #endif - SOCKBUF_UNLOCK(&so->so_rcv); tp->t_flags |= TF_WAKESOR; return (flags); } diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index 22762d21c289..dd4cbfd7dc53 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -7825,8 +7825,8 @@ bbr_process_ack(struct mbuf *m, struct tcphdr *th, struct socket *so, acked_amount = min(acked, (int)sbavail(&so->so_snd)); tp->snd_wnd -= acked_amount; mfree = sbcut_locked(&so->so_snd, acked_amount); - SOCKBUF_UNLOCK(&so->so_snd); - tp->t_flags |= TF_WAKESOW; + /* NB: sowwakeup_locked() does an implicit unlock. */ + sowwakeup_locked(so); m_freem(mfree); if (SEQ_GT(th->th_ack, tp->snd_una)) { bbr_collapse_rtt(tp, bbr, TCP_REXMTVAL(tp)); @@ -8302,7 +8302,6 @@ bbr_process_data(struct mbuf *m, struct tcphdr *th, struct socket *so, appended = #endif sbappendstream_locked(&so->so_rcv, m, 0); - SOCKBUF_UNLOCK(&so->so_rcv); tp->t_flags |= TF_WAKESOR; #ifdef NETFLIX_SB_LIMITS if (so->so_rcv.sb_shlim && appended != mcnt) @@ -8353,6 +8352,7 @@ bbr_process_data(struct mbuf *m, struct tcphdr *th, struct socket *so, save_start + tlen); } } + tcp_handle_wakeup(tp, so); } else { m_freem(m); thflags &= ~TH_FIN; @@ -8364,9 +8364,8 @@ bbr_process_data(struct mbuf *m, struct tcphdr *th, struct socket *so, */ if (thflags & TH_FIN) { if (TCPS_HAVERCVDFIN(tp->t_state) == 0) { - socantrcvmore(so); /* The socket upcall is handled by socantrcvmore. */ - tp->t_flags &= ~TF_WAKESOR; + socantrcvmore(so); /* * If connection is half-synchronized (ie NEEDSYN * flag on) then delay ACK, so it may be piggybacked @@ -8557,8 +8556,8 @@ bbr_do_fastnewdata(struct mbuf *m, struct tcphdr *th, struct socket *so, sbappendstream_locked(&so->so_rcv, m, 0); ctf_calc_rwin(so, tp); } - SOCKBUF_UNLOCK(&so->so_rcv); - tp->t_flags |= TF_WAKESOR; + /* NB: sorwakeup_locked() does an implicit unlock. */ + sorwakeup_locked(so); #ifdef NETFLIX_SB_LIMITS if (so->so_rcv.sb_shlim && mcnt != appended) counter_fo_release(so->so_rcv.sb_shlim, mcnt - appended); @@ -8749,7 +8748,7 @@ bbr_fastack(struct mbuf *m, struct tcphdr *th, struct socket *so, &tcp_savetcp, 0); #endif /* Wake up the socket if we have room to write more */ - tp->t_flags |= TF_WAKESOW; + sowwakeup(so); if (tp->snd_una == tp->snd_max) { /* Nothing left outstanding */ bbr_log_progress_event(bbr, tp, ticks, PROGRESS_CLEAR, __LINE__); @@ -9157,9 +9156,11 @@ bbr_do_syn_recv(struct mbuf *m, struct tcphdr *th, struct socket *so, * If segment contains data or ACK, will call tcp_reass() later; if * not, do so now to pass queued data to user. */ - if (tlen == 0 && (thflags & TH_FIN) == 0) + if (tlen == 0 && (thflags & TH_FIN) == 0) { (void)tcp_reass(tp, (struct tcphdr *)0, NULL, 0, (struct mbuf *)0); + tcp_handle_wakeup(tp, so); + } tp->snd_wl1 = th->th_seq - 1; if (bbr_process_ack(m, th, so, tp, to, tiwin, tlen, &ourfinisacked, thflags, &ret_val)) { return (ret_val); @@ -11711,7 +11712,6 @@ bbr_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, retval = bbr_do_segment_nounlock(m, th, so, tp, drop_hdrlen, tlen, iptos, 0, &tv); if (retval == 0) { - tcp_handle_wakeup(tp, so); INP_WUNLOCK(tp->t_inpcb); } } diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 73b47745cbac..efab90a2e5bd 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -9857,8 +9857,8 @@ rack_process_ack(struct mbuf *m, struct tcphdr *th, struct socket *so, if (acked_amount && sbavail(&so->so_snd)) rack_adjust_sendmap(rack, &so->so_snd, tp->snd_una); rack_log_wakeup(tp,rack, &so->so_snd, acked, 2); - SOCKBUF_UNLOCK(&so->so_snd); - tp->t_flags |= TF_WAKESOW; + /* NB: sowwakeup_locked() does an implicit unlock. */ + sowwakeup_locked(so); m_freem(mfree); if (SEQ_GT(tp->snd_una, tp->snd_recover)) tp->snd_recover = tp->snd_una; @@ -10208,7 +10208,6 @@ rack_process_data(struct mbuf *m, struct tcphdr *th, struct socket *so, sbappendstream_locked(&so->so_rcv, m, 0); rack_log_wakeup(tp,rack, &so->so_rcv, tlen, 1); - SOCKBUF_UNLOCK(&so->so_rcv); tp->t_flags |= TF_WAKESOR; #ifdef NETFLIX_SB_LIMITS if (so->so_rcv.sb_shlim && appended != mcnt) @@ -10265,6 +10264,7 @@ rack_process_data(struct mbuf *m, struct tcphdr *th, struct socket *so, save_start + tlen); } } + tcp_handle_wakeup(tp, so); } else { m_freem(m); thflags &= ~TH_FIN; @@ -10276,9 +10276,8 @@ rack_process_data(struct mbuf *m, struct tcphdr *th, struct socket *so, */ if (thflags & TH_FIN) { if (TCPS_HAVERCVDFIN(tp->t_state) == 0) { - socantrcvmore(so); /* The socket upcall is handled by socantrcvmore. */ - tp->t_flags &= ~TF_WAKESOR; + socantrcvmore(so); /* * If connection is half-synchronized (ie NEEDSYN * flag on) then delay ACK, so it may be piggybacked @@ -10471,7 +10470,6 @@ rack_do_fastnewdata(struct mbuf *m, struct tcphdr *th, struct socket *so, ctf_calc_rwin(so, tp); } rack_log_wakeup(tp,rack, &so->so_rcv, tlen, 1); - SOCKBUF_UNLOCK(&so->so_rcv); tp->t_flags |= TF_WAKESOR; #ifdef NETFLIX_SB_LIMITS if (so->so_rcv.sb_shlim && mcnt != appended) @@ -10631,8 +10629,7 @@ rack_fastack(struct mbuf *m, struct tcphdr *th, struct socket *so, rack_adjust_sendmap(rack, &so->so_snd, tp->snd_una); /* Wake up the socket if we have room to write more */ rack_log_wakeup(tp,rack, &so->so_snd, acked, 2); - SOCKBUF_UNLOCK(&so->so_snd); - tp->t_flags |= TF_WAKESOW; + sowwakeup(so); m_freem(mfree); tp->t_rxtshift = 0; RACK_TCPT_RANGESET(tp->t_rxtcur, RACK_REXMTVAL(tp), @@ -11070,9 +11067,11 @@ rack_do_syn_recv(struct mbuf *m, struct tcphdr *th, struct socket *so, * If segment contains data or ACK, will call tcp_reass() later; if * not, do so now to pass queued data to user. */ - if (tlen == 0 && (thflags & TH_FIN) == 0) + if (tlen == 0 && (thflags & TH_FIN) == 0) { (void) tcp_reass(tp, (struct tcphdr *)0, NULL, 0, (struct mbuf *)0); + tcp_handle_wakeup(tp, so); + } tp->snd_wl1 = th->th_seq - 1; /* For syn-recv we need to possibly update the rtt */ if ((to->to_flags & TOF_TS) != 0 && to->to_tsecr) { @@ -13155,8 +13154,7 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb rack_adjust_sendmap(rack, &so->so_snd, tp->snd_una); /* Wake up the socket if we have room to write more */ rack_log_wakeup(tp,rack, &so->so_snd, acked, 2); - SOCKBUF_UNLOCK(&so->so_snd); - tp->t_flags |= TF_WAKESOW; + sowwakeup(so); m_freem(mfree); } /* update progress */ diff --git a/sys/netinet/tcp_stacks/rack_bbr_common.c b/sys/netinet/tcp_stacks/rack_bbr_common.c index 6475a1a01c26..501d29ac48da 100644 --- a/sys/netinet/tcp_stacks/rack_bbr_common.c +++ b/sys/netinet/tcp_stacks/rack_bbr_common.c @@ -533,7 +533,6 @@ ctf_do_queued_segments(struct socket *so, struct tcpcb *tp, int have_pkt) /* We lost the tcpcb (maybe a RST came in)? */ return(1); } - tcp_handle_wakeup(tp, so); } return (0); } diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index b80746b1ede4..1742b3b1c514 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -408,7 +408,7 @@ TAILQ_HEAD(tcp_funchead, tcp_function); #define TF_FORCEDATA 0x00800000 /* force out a byte */ #define TF_TSO 0x01000000 /* TSO enabled on this connection */ #define TF_TOE 0x02000000 /* this connection is offloaded */ -#define TF_WAKESOW 0x04000000 /* wake up send socket */ +#define TF_UNUSED0 0x04000000 /* unused */ #define TF_UNUSED1 0x08000000 /* unused */ #define TF_LRD 0x10000000 /* Lost Retransmission Detection */ #define TF_CONGRECOVERY 0x20000000 /* congestion recovery mode */ From owner-dev-commits-src-all@freebsd.org Fri May 21 09:25:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 73E43655457; Fri, 21 May 2021 09:25: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 4Fmh6P2vZSz4vvP; Fri, 21 May 2021 09:25: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 4801F6B72; Fri, 21 May 2021 09:25: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 14L9PXM3070753; Fri, 21 May 2021 09:25:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14L9PXkO070752; Fri, 21 May 2021 09:25:33 GMT (envelope-from git) Date: Fri, 21 May 2021 09:25:33 GMT Message-Id: <202105210925.14L9PXkO070752@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 209d4919c527 - main - Make sure all tasklets are drained before unloading the LinuxKPI. Else use-after-free may happen. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 209d4919c5270fe9e3c1d809cf91355d222dc2f3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 09:25:33 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=209d4919c5270fe9e3c1d809cf91355d222dc2f3 commit 209d4919c5270fe9e3c1d809cf91355d222dc2f3 Author: Hans Petter Selasky AuthorDate: 2021-05-21 06:52:59 +0000 Commit: Hans Petter Selasky CommitDate: 2021-05-21 09:21:32 +0000 Make sure all tasklets are drained before unloading the LinuxKPI. Else use-after-free may happen. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/compat/linuxkpi/common/src/linux_tasklet.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/compat/linuxkpi/common/src/linux_tasklet.c b/sys/compat/linuxkpi/common/src/linux_tasklet.c index 9a4c01737466..26e7bb75cf19 100644 --- a/sys/compat/linuxkpi/common/src/linux_tasklet.c +++ b/sys/compat/linuxkpi/common/src/linux_tasklet.c @@ -128,6 +128,8 @@ tasklet_subsystem_uninit(void *arg __unused) struct tasklet_worker *tw; int i; + taskqgroup_drain_all(qgroup_softirq); + CPU_FOREACH(i) { if (CPU_ABSENT(i)) continue; From owner-dev-commits-src-all@freebsd.org Fri May 21 09:25:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A2980655459; Fri, 21 May 2021 09:25: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 4Fmh6Q3swZz4vq7; Fri, 21 May 2021 09:25: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 611DD6D1C; Fri, 21 May 2021 09:25: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 14L9PYU5070774; Fri, 21 May 2021 09:25:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14L9PY9c070773; Fri, 21 May 2021 09:25:34 GMT (envelope-from git) Date: Fri, 21 May 2021 09:25:34 GMT Message-Id: <202105210925.14L9PY9c070773@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: cc9bb7a9b863 - main - Rework for-loop in EPOCH(9) to reduce indentation level. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cc9bb7a9b863c018a069a71392fa9baea98b5fdb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 09:25:34 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=cc9bb7a9b863c018a069a71392fa9baea98b5fdb commit cc9bb7a9b863c018a069a71392fa9baea98b5fdb Author: Hans Petter Selasky AuthorDate: 2021-05-21 08:20:34 +0000 Commit: Hans Petter Selasky CommitDate: 2021-05-21 09:21:32 +0000 Rework for-loop in EPOCH(9) to reduce indentation level. No functional change intended. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/kern/subr_epoch.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/kern/subr_epoch.c b/sys/kern/subr_epoch.c index 48567f97dcfa..210cf78d55f0 100644 --- a/sys/kern/subr_epoch.c +++ b/sys/kern/subr_epoch.c @@ -219,12 +219,14 @@ epoch_trace_enter(struct thread *td, epoch_t epoch, epoch_tracker_t et, { epoch_tracker_t iet; - SLIST_FOREACH(iet, &td->td_epochs, et_tlink) - if (iet->et_epoch == epoch) - epoch_trace_report("Recursively entering epoch %s " - "at %s:%d, previously entered at %s:%d\n", - epoch->e_name, file, line, - iet->et_file, iet->et_line); + SLIST_FOREACH(iet, &td->td_epochs, et_tlink) { + if (iet->et_epoch != epoch) + continue; + epoch_trace_report("Recursively entering epoch %s " + "at %s:%d, previously entered at %s:%d\n", + epoch->e_name, file, line, + iet->et_file, iet->et_line); + } et->et_epoch = epoch; et->et_file = file; et->et_line = line; From owner-dev-commits-src-all@freebsd.org Fri May 21 09:25:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C615E655920; Fri, 21 May 2021 09:25: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 4Fmh6R55tZz4vq9; Fri, 21 May 2021 09:25: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 8E7C266DC; Fri, 21 May 2021 09:25: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 14L9PZlL070799; Fri, 21 May 2021 09:25:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14L9PZPU070798; Fri, 21 May 2021 09:25:35 GMT (envelope-from git) Date: Fri, 21 May 2021 09:25:35 GMT Message-Id: <202105210925.14L9PZPU070798@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: f33168351b38 - main - Properly define EPOCH(9) function macro. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f33168351b3804664f5e82a409d9f956df2802f3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 09:25:35 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=f33168351b3804664f5e82a409d9f956df2802f3 commit f33168351b3804664f5e82a409d9f956df2802f3 Author: Hans Petter Selasky AuthorDate: 2021-05-21 08:22:13 +0000 Commit: Hans Petter Selasky CommitDate: 2021-05-21 09:21:32 +0000 Properly define EPOCH(9) function macro. No functional change intended. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/kern/subr_epoch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/subr_epoch.c b/sys/kern/subr_epoch.c index 210cf78d55f0..c5e4b78d8b79 100644 --- a/sys/kern/subr_epoch.c +++ b/sys/kern/subr_epoch.c @@ -870,7 +870,7 @@ epoch_assert_nocpu(epoch_t epoch, struct thread *td) } } #else -#define epoch_assert_nocpu(e, td) +#define epoch_assert_nocpu(e, td) do {} while (0) #endif int From owner-dev-commits-src-all@freebsd.org Fri May 21 09:25:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3762F6555DD; Fri, 21 May 2021 09:25: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 4Fmh6S5nWWz3Brv; Fri, 21 May 2021 09:25: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 A08066C40; Fri, 21 May 2021 09:25: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 14L9Pa8b070820; Fri, 21 May 2021 09:25:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14L9PahQ070819; Fri, 21 May 2021 09:25:36 GMT (envelope-from git) Date: Fri, 21 May 2021 09:25:36 GMT Message-Id: <202105210925.14L9PahQ070819@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: c82c200622b5 - main - Accessing the epoch structure should happen after the INIT_CHECK(). Else the epoch pointer may be NULL. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c82c200622b5380b8346de29879222538653f663 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 09:25:37 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c82c200622b5380b8346de29879222538653f663 commit c82c200622b5380b8346de29879222538653f663 Author: Hans Petter Selasky AuthorDate: 2021-05-21 09:06:27 +0000 Commit: Hans Petter Selasky CommitDate: 2021-05-21 09:21:32 +0000 Accessing the epoch structure should happen after the INIT_CHECK(). Else the epoch pointer may be NULL. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/kern/subr_epoch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/subr_epoch.c b/sys/kern/subr_epoch.c index c5e4b78d8b79..798dbdc4360e 100644 --- a/sys/kern/subr_epoch.c +++ b/sys/kern/subr_epoch.c @@ -442,13 +442,14 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et EPOCH_FILE_LINE) struct thread *td; MPASS(cold || epoch != NULL); - MPASS(epoch->e_flags & EPOCH_PREEMPT); td = curthread; MPASS((vm_offset_t)et >= td->td_kstack && (vm_offset_t)et + sizeof(struct epoch_tracker) <= td->td_kstack + td->td_kstack_pages * PAGE_SIZE); INIT_CHECK(epoch); + MPASS(epoch->e_flags & EPOCH_PREEMPT); + #ifdef EPOCH_TRACE epoch_trace_enter(td, epoch, et, file, line); #endif From owner-dev-commits-src-all@freebsd.org Fri May 21 09:49:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 428FC656019; Fri, 21 May 2021 09:49: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 4FmhfQ1MW4z3Nbj; Fri, 21 May 2021 09:49: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 0D2326ED6; Fri, 21 May 2021 09:49: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 14L9nnsw097502; Fri, 21 May 2021 09:49:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14L9nnoE097501; Fri, 21 May 2021 09:49:49 GMT (envelope-from git) Date: Fri, 21 May 2021 09:49:49 GMT Message-Id: <202105210949.14L9nnoE097501@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: c1fbb54f4b10 - main - test/libalias: Tests for outgoing NAT 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/main X-Git-Reftype: branch X-Git-Commit: c1fbb54f4b100d576da7ab065d1887a21f691936 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 09:49:50 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=c1fbb54f4b100d576da7ab065d1887a21f691936 commit c1fbb54f4b100d576da7ab065d1887a21f691936 Author: Lutz Donnerhacke AuthorDate: 2021-05-17 21:49:31 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-21 09:45:52 +0000 test/libalias: Tests for outgoing NAT Testing LibAliasOut functionality. This concentrates the typical use case of initiating data transfers from the inside. Provide a exhaustive test for the data structure in order to check for performance improvements. Reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30335 --- tests/sys/netinet/libalias/1_instance.c | 11 +- tests/sys/netinet/libalias/2_natout.c | 381 ++++++++++++++++++++++++++++++++ tests/sys/netinet/libalias/Makefile | 8 +- tests/sys/netinet/libalias/util.c | 74 +++++++ tests/sys/netinet/libalias/util.h | 29 +++ 5 files changed, 490 insertions(+), 13 deletions(-) diff --git a/tests/sys/netinet/libalias/1_instance.c b/tests/sys/netinet/libalias/1_instance.c index e9137eb99d50..d2f20011c520 100644 --- a/tests/sys/netinet/libalias/1_instance.c +++ b/tests/sys/netinet/libalias/1_instance.c @@ -3,16 +3,7 @@ #include #include -static int randcmp(const void *a, const void *b) { - int res, r = rand(); - - (void)a; - (void)b; - res = (r/4 < RAND_MAX/9) ? 1 - : (r/5 < RAND_MAX/9) ? 0 - : -1; - return (res); -} +#include "util.h" ATF_TC(2_destroynull); ATF_TC_HEAD(2_destroynull, env) diff --git a/tests/sys/netinet/libalias/2_natout.c b/tests/sys/netinet/libalias/2_natout.c new file mode 100644 index 000000000000..9eb9148f8377 --- /dev/null +++ b/tests/sys/netinet/libalias/2_natout.c @@ -0,0 +1,381 @@ +#include +#include +#include +#include + +#include "util.h" + +/* common ip ranges */ +static struct in_addr masq = { htonl(0x01020304) }; +static struct in_addr pub = { htonl(0x0102dead) }; +static struct in_addr prv1 = { htonl(0x0a00dead) }; +static struct in_addr prv2 = { htonl(0xac10dead) }; +static struct in_addr prv3 = { htonl(0xc0a8dead) }; +static struct in_addr cgn = { htonl(0x6440dead) }; +static struct in_addr ext = { htonl(0x12345678) }; + +#define NAT_CHECK(pip, src, msq) do { \ + int res; \ + int len = ntohs(pip->ip_len); \ + struct in_addr dst = pip->ip_dst; \ + pip->ip_src = src; \ + res = LibAliasOut(la, pip, len); \ + ATF_CHECK_MSG(res == PKT_ALIAS_OK, \ + ">%d< not met PKT_ALIAS_OK", res); \ + ATF_CHECK(addr_eq(msq, pip->ip_src)); \ + ATF_CHECK(addr_eq(dst, pip->ip_dst)); \ +} while(0) + +#define NAT_FAIL(pip, src, dst) do { \ + int res; \ + int len = ntohs(pip->ip_len); \ + pip->ip_src = src; \ + pip->ip_dst = dst; \ + res = LibAliasOut(la, pip, len); \ + ATF_CHECK_MSG(res != PKT_ALIAS_OK), \ + ">%d< not met !PKT_ALIAS_OK", res); \ + ATF_CHECK(addr_eq(src, pip->ip_src)); \ + ATF_CHECK(addr_eq(dst, pip->ip_dst)); \ +} while(0) + +#define UNNAT_CHECK(pip, src, dst, rel) do { \ + int res; \ + int len = ntohs(pip->ip_len); \ + pip->ip_src = src; \ + pip->ip_dst = dst; \ + res = LibAliasIn(la, pip, len); \ + ATF_CHECK_MSG(res == PKT_ALIAS_OK, \ + ">%d< not met PKT_ALIAS_OK", res); \ + ATF_CHECK(addr_eq(src, pip->ip_src)); \ + ATF_CHECK(addr_eq(rel, pip->ip_dst)); \ +} while(0) + +#define UNNAT_FAIL(pip, src, dst) do { \ + int res; \ + int len = ntohs(pip->ip_len); \ + pip->ip_src = src; \ + pip->ip_dst = dst; \ + res = LibAliasIn(la, pip, len); \ + ATF_CHECK_MSG(res != PKT_ALIAS_OK, \ + ">%d< not met !PKT_ALIAS_OK", res); \ + ATF_CHECK(addr_eq(src, pip->ip_src)); \ + ATF_CHECK(addr_eq(dst, pip->ip_dst)); \ +} while(0) + +ATF_TC_WITHOUT_HEAD(1_simplemasq); +ATF_TC_BODY(1_simplemasq, dummy) +{ + struct libalias *la = LibAliasInit(NULL); + struct ip *pip; + + ATF_REQUIRE(la != NULL); + LibAliasSetAddress(la, masq); + LibAliasSetMode(la, 0, ~0); + + pip = ip_packet(prv1, ext, 254, 64); + NAT_CHECK(pip, prv1, masq); + NAT_CHECK(pip, prv2, masq); + NAT_CHECK(pip, prv3, masq); + NAT_CHECK(pip, cgn, masq); + NAT_CHECK(pip, pub, masq); + + free(pip); + LibAliasUninit(la); +} + +ATF_TC_WITHOUT_HEAD(2_unregistered); +ATF_TC_BODY(2_unregistered, dummy) +{ + struct libalias *la = LibAliasInit(NULL); + struct ip *pip; + + ATF_REQUIRE(la != NULL); + LibAliasSetAddress(la, masq); + LibAliasSetMode(la, PKT_ALIAS_UNREGISTERED_ONLY, ~0); + + pip = ip_packet(prv1, ext, 254, 64); + NAT_CHECK(pip, prv1, masq); + NAT_CHECK(pip, prv2, masq); + NAT_CHECK(pip, prv3, masq); + NAT_CHECK(pip, cgn, cgn); + NAT_CHECK(pip, pub, pub); + + /* + * State is only for new connections + * Because they are now active, + * the mode setting should be ignored + */ + LibAliasSetMode(la, 0, PKT_ALIAS_UNREGISTERED_ONLY); + NAT_CHECK(pip, prv1, masq); + NAT_CHECK(pip, prv2, masq); + NAT_CHECK(pip, prv3, masq); + NAT_CHECK(pip, cgn, cgn); + NAT_CHECK(pip, pub, pub); + + free(pip); + LibAliasUninit(la); +} + +ATF_TC_WITHOUT_HEAD(3_cgn); +ATF_TC_BODY(3_cgn, dummy) +{ + struct libalias *la = LibAliasInit(NULL); + struct ip *pip; + + ATF_REQUIRE(la != NULL); + LibAliasSetAddress(la, masq); + LibAliasSetMode(la, PKT_ALIAS_UNREGISTERED_CGN, ~0); + + pip = ip_packet(prv1, ext, 254, 64); + NAT_CHECK(pip, prv1, masq); + NAT_CHECK(pip, prv2, masq); + NAT_CHECK(pip, prv3, masq); + NAT_CHECK(pip, cgn, masq); + NAT_CHECK(pip, pub, pub); + + /* + * State is only for new connections + * Because they are now active, + * the mode setting should be ignored + */ + LibAliasSetMode(la, 0, PKT_ALIAS_UNREGISTERED_CGN); + NAT_CHECK(pip, prv1, masq); + NAT_CHECK(pip, prv2, masq); + NAT_CHECK(pip, prv3, masq); + NAT_CHECK(pip, cgn, masq); + NAT_CHECK(pip, pub, pub); + + free(pip); + LibAliasUninit(la); +} + +ATF_TC_WITHOUT_HEAD(4_udp); +ATF_TC_BODY(4_udp, dummy) +{ + struct libalias *la = LibAliasInit(NULL); + struct ip *po, *pi; + struct udphdr *ui, *uo; + uint16_t sport = 0x1234; + uint16_t dport = 0x5678; + uint16_t aport; + + ATF_REQUIRE(la != NULL); + LibAliasSetAddress(la, masq); + LibAliasSetMode(la, 0, ~0); + + /* Query from prv1 */ + po = ip_packet(prv1, ext, 0, 64); + uo = set_udp(po, sport, dport); + NAT_CHECK(po, prv1, masq); + ATF_CHECK(uo->uh_dport == htons(dport)); + ATF_CHECK(addr_eq(po->ip_dst, ext)); + aport = ntohs(uo->uh_sport); + /* should use a different external port */ + ATF_CHECK(aport != sport); + + /* Response */ + pi = ip_packet(po->ip_dst, po->ip_src, 0, 64); + ui = set_udp(pi, ntohs(uo->uh_dport), ntohs(uo->uh_sport)); + UNNAT_CHECK(pi, ext, masq, prv1); + ATF_CHECK(ui->uh_sport == htons(dport)); + ATF_CHECK(ui->uh_dport == htons(sport)); + + /* Query from different source with same ports */ + uo = set_udp(po, sport, dport); + NAT_CHECK(po, prv2, masq); + ATF_CHECK(uo->uh_dport == htons(dport)); + ATF_CHECK(addr_eq(po->ip_dst, ext)); + /* should use a different external port */ + ATF_CHECK(uo->uh_sport != htons(aport)); + + /* Response to prv2 */ + ui->uh_dport = uo->uh_sport; + UNNAT_CHECK(pi, ext, masq, prv2); + ATF_CHECK(ui->uh_sport == htons(dport)); + ATF_CHECK(ui->uh_dport == htons(sport)); + + /* Response to prv1 again */ + ui->uh_dport = htons(aport); + UNNAT_CHECK(pi, ext, masq, prv1); + ATF_CHECK(ui->uh_sport == htons(dport)); + ATF_CHECK(ui->uh_dport == htons(sport)); + + free(pi); + free(po); + LibAliasUninit(la); +} + +ATF_TC_WITHOUT_HEAD(5_sameport); +ATF_TC_BODY(5_sameport, dummy) +{ + struct libalias *la = LibAliasInit(NULL); + struct ip *p; + struct udphdr *u; + uint16_t sport = 0x1234; + uint16_t dport = 0x5678; + uint16_t aport; + + ATF_REQUIRE(la != NULL); + LibAliasSetAddress(la, masq); + LibAliasSetMode(la, PKT_ALIAS_SAME_PORTS, ~0); + + /* Query from prv1 */ + p = ip_packet(prv1, ext, 0, 64); + u = set_udp(p, sport, dport); + NAT_CHECK(p, prv1, masq); + ATF_CHECK(u->uh_dport == htons(dport)); + ATF_CHECK(addr_eq(p->ip_dst, ext)); + aport = ntohs(u->uh_sport); + /* should use the same external port */ + ATF_CHECK(aport == sport); + + /* Query from different source with same ports */ + u = set_udp(p, sport, dport); + NAT_CHECK(p, prv2, masq); + ATF_CHECK(u->uh_dport == htons(dport)); + ATF_CHECK(addr_eq(p->ip_dst, ext)); + /* should use a different external port */ + ATF_CHECK(u->uh_sport != htons(aport)); + + free(p); + LibAliasUninit(la); +} + +ATF_TC_WITHOUT_HEAD(6_cleartable); +ATF_TC_BODY(6_cleartable, dummy) +{ + struct libalias *la = LibAliasInit(NULL); + struct ip *po, *pi; + struct udphdr *ui, *uo; + uint16_t sport = 0x1234; + uint16_t dport = 0x5678; + uint16_t aport; + + ATF_REQUIRE(la != NULL); + LibAliasSetAddress(la, masq); + LibAliasSetMode(la, PKT_ALIAS_RESET_ON_ADDR_CHANGE, ~0); + LibAliasSetMode(la, PKT_ALIAS_SAME_PORTS, PKT_ALIAS_SAME_PORTS); + LibAliasSetMode(la, PKT_ALIAS_DENY_INCOMING, PKT_ALIAS_DENY_INCOMING); + + /* Query from prv1 */ + po = ip_packet(prv1, ext, 0, 64); + uo = set_udp(po, sport, dport); + NAT_CHECK(po, prv1, masq); + ATF_CHECK(uo->uh_dport == htons(dport)); + ATF_CHECK(addr_eq(po->ip_dst, ext)); + aport = ntohs(uo->uh_sport); + /* should use the same external port */ + ATF_CHECK(aport == sport); + + /* Response */ + pi = ip_packet(po->ip_dst, po->ip_src, 0, 64); + ui = set_udp(pi, ntohs(uo->uh_dport), ntohs(uo->uh_sport)); + UNNAT_CHECK(pi, ext, masq, prv1); + ATF_CHECK(ui->uh_sport == htons(dport)); + ATF_CHECK(ui->uh_dport == htons(sport)); + + /* clear table by keeping the address */ + LibAliasSetAddress(la, ext); + LibAliasSetAddress(la, masq); + + /* Response to prv1 again -> DENY_INCOMING */ + ui->uh_dport = htons(aport); + UNNAT_FAIL(pi, ext, masq); + + /* Query from different source with same ports */ + uo = set_udp(po, sport, dport); + NAT_CHECK(po, prv2, masq); + ATF_CHECK(uo->uh_dport == htons(dport)); + ATF_CHECK(addr_eq(po->ip_dst, ext)); + /* should use the same external port, because it's free */ + ATF_CHECK(uo->uh_sport == htons(aport)); + + /* Response to prv2 */ + ui->uh_dport = uo->uh_sport; + UNNAT_CHECK(pi, ext, masq, prv2); + ATF_CHECK(ui->uh_sport == htons(dport)); + ATF_CHECK(ui->uh_dport == htons(sport)); + + free(pi); + free(po); + LibAliasUninit(la); +} + +ATF_TC_WITHOUT_HEAD(7_stress); +ATF_TC_BODY(7_stress, dummy) +{ + struct libalias *la = LibAliasInit(NULL); + struct ip *p; + struct udphdr *u; + struct { + struct in_addr src, dst; + uint16_t sport, dport, aport; + } *batch; + size_t const batch_size = 12000; + size_t const rounds = 25; + size_t i, j; + + ATF_REQUIRE(la != NULL); + LibAliasSetAddress(la, masq); + + p = ip_packet(prv1, ext, 0, 64); + u = set_udp(p, 0, 0); + + batch = calloc(batch_size, sizeof(*batch)); + ATF_REQUIRE(batch != NULL); + for (j = 0; j < rounds; j++) { + for (i = 0; i < batch_size; i++) { + struct in_addr s, d; + switch (i&3) { + case 0: s = prv1; d = ext; break; + case 1: s = prv2; d = pub; break; + case 2: s = prv3; d = ext; break; + case 3: s = cgn; d = pub; break; + } + s.s_addr &= htonl(0xffff0000); + d.s_addr &= htonl(0xffff0000); + batch[i].src.s_addr = s.s_addr | htonl(rand_range(0, 0xffff)); + batch[i].dst.s_addr = d.s_addr | htonl(rand_range(0, 0xffff)); + batch[i].sport = rand_range(1000, 60000); + batch[i].dport = rand_range(1000, 60000); + } + + for (i = 0; i < batch_size; i++) { + p->ip_dst = batch[i].dst; + u = set_udp(p, batch[i].sport, batch[i].dport); + NAT_CHECK(p, batch[i].src, masq); + ATF_CHECK(u->uh_dport == htons(batch[i].dport)); + ATF_CHECK(addr_eq(p->ip_dst, batch[i].dst)); + batch[i].aport = htons(u->uh_sport); + } + + qsort(batch, batch_size, sizeof(*batch), randcmp); + + for (i = 0; i < batch_size; i++) { + u = set_udp(p, batch[i].dport, batch[i].aport); + UNNAT_CHECK(p, batch[i].dst, masq, batch[i].src); + ATF_CHECK(u->uh_dport == htons(batch[i].sport)); + ATF_CHECK(u->uh_sport == htons(batch[i].dport)); + } + } + + free(batch); + free(p); + LibAliasUninit(la); +} + +ATF_TP_ADD_TCS(natout) +{ + /* Use "dd if=/dev/random bs=2 count=1 | od -x" to reproduce */ + srand(0x0b61); + + ATF_TP_ADD_TC(natout, 1_simplemasq); + ATF_TP_ADD_TC(natout, 2_unregistered); + ATF_TP_ADD_TC(natout, 3_cgn); + ATF_TP_ADD_TC(natout, 4_udp); + ATF_TP_ADD_TC(natout, 5_sameport); + ATF_TP_ADD_TC(natout, 6_cleartable); + ATF_TP_ADD_TC(natout, 7_stress); + + return atf_no_error(); +} diff --git a/tests/sys/netinet/libalias/Makefile b/tests/sys/netinet/libalias/Makefile index 3b2a3b144298..79922d7d4b13 100644 --- a/tests/sys/netinet/libalias/Makefile +++ b/tests/sys/netinet/libalias/Makefile @@ -1,16 +1,18 @@ # $FreeBSD$ -.include - PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/netinet/libalias BINDIR= ${TESTSDIR} -ATF_TESTS_C+= 1_instance +ATF_TESTS_C+= 1_instance \ + 2_natout \ LIBADD+= alias +SRCS.1_instance=1_instance.c util.c +SRCS.2_natout= 2_natout.c util.c + .include # diff --git a/tests/sys/netinet/libalias/util.c b/tests/sys/netinet/libalias/util.c new file mode 100644 index 000000000000..e0e5e08eb23e --- /dev/null +++ b/tests/sys/netinet/libalias/util.c @@ -0,0 +1,74 @@ +#include +#include +#include + +#include + +#include "util.h" + +int +randcmp(const void *a, const void *b) +{ + int res, r = rand(); + + (void)a; + (void)b; + res = (r/4 < RAND_MAX/9) ? 1 + : (r/5 < RAND_MAX/9) ? 0 + : -1; + return (res); +} + +void +hexdump(void *p, size_t len) +{ + size_t i; + unsigned char *c = p; + + for (i = 0; i < len; i++) { + printf(" %02x", c[i]); + switch (i & 0xf) { + case 0xf: printf("\n"); break; + case 0x7: printf(" "); break; + default: break; + } + } + if ((i & 0xf) != 0x0) + printf("\n"); +} + +struct ip * +ip_packet(struct in_addr src, struct in_addr dst, u_char protocol, size_t len) +{ + struct ip * p; + + ATF_REQUIRE(len >= 64 && len <= IP_MAXPACKET); + + p = calloc(1, len); + ATF_REQUIRE(p != NULL); + + p->ip_v = IPVERSION; + p->ip_hl = sizeof(*p)/4; + p->ip_len = htons(len); + p->ip_ttl = IPDEFTTL; + p->ip_src = src; + p->ip_dst = dst; + p->ip_p = protocol; + ATF_REQUIRE(p->ip_hl == 5); + + return (p); +} + +struct udphdr * +set_udp(struct ip *p, u_short sport, u_short dport) { + uint32_t *up = (void *)p; + struct udphdr *u = (void *)&(up[p->ip_hl]); + int payload = ntohs(p->ip_len) - 4*p->ip_hl; + + ATF_REQUIRE(payload >= (int)sizeof(*u)); + p->ip_p = IPPROTO_UDP; + u->uh_sport = htons(sport); + u->uh_dport = htons(dport); + u->uh_ulen = htons(payload); + return (u); +} diff --git a/tests/sys/netinet/libalias/util.h b/tests/sys/netinet/libalias/util.h new file mode 100644 index 000000000000..5edbadb2f64a --- /dev/null +++ b/tests/sys/netinet/libalias/util.h @@ -0,0 +1,29 @@ +#include + +#include +#include +#include + +#ifndef _UTIL_H +#define _UTIL_H + +int randcmp(const void *a, const void *b); +void hexdump(void *p, size_t len); +struct ip * ip_packet(struct in_addr src, struct in_addr dst, u_char protocol, size_t len); +struct udphdr * set_udp(struct ip *p, u_short sport, u_short dport); + +inline int +addr_eq(struct in_addr a, struct in_addr b) +{ + return a.s_addr == b.s_addr; +} + +#define a2h(a) ntohl(a.s_addr) + +inline int +rand_range(int min, int max) +{ + return min + rand()%(max - min); +} + +#endif /* _UTIL_H */ From owner-dev-commits-src-all@freebsd.org Fri May 21 10:28:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Fri May 21 10:30:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Fri May 21 10:31:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Fri May 21 10:32:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Fri May 21 11:21:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7A1BA6576B0; Fri, 21 May 2021 11:21: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 4Fmkgx2wp0z4mHC; Fri, 21 May 2021 11:21: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 4C23E7FEB; Fri, 21 May 2021 11:21: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 14LBLHB2026835; Fri, 21 May 2021 11:21:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LBLHI2026834; Fri, 21 May 2021 11:21:17 GMT (envelope-from git) Date: Fri, 21 May 2021 11:21:17 GMT Message-Id: <202105211121.14LBLHI2026834@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: b764a426534f - main - There is a window where threads are removed from the process list and where the thread destructor is invoked. Catch that window by waiting for all task_struct allocations to be returned before freeing the UMA zone in the LinuxKPI. Else UMA may fail to release the zone due to concurrent access and panic: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b764a426534f2f5f86d6625288c74dafdbc94d2b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 11:21:17 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=b764a426534f2f5f86d6625288c74dafdbc94d2b commit b764a426534f2f5f86d6625288c74dafdbc94d2b Author: Hans Petter Selasky AuthorDate: 2021-05-21 11:17:42 +0000 Commit: Hans Petter Selasky CommitDate: 2021-05-21 11:18:41 +0000 There is a window where threads are removed from the process list and where the thread destructor is invoked. Catch that window by waiting for all task_struct allocations to be returned before freeing the UMA zone in the LinuxKPI. Else UMA may fail to release the zone due to concurrent access and panic: panic() - Bad link element prev->next != elm zone_release() bucket_drain() bucket_free() zone_dtor() zone_free_item() uma_zdestroy() linux_current_uninit() This failure can be triggered by loading and unloading the LinuxKPI module in a loop: while true do kldload linuxkpi kldunload linuxkpi done Discussed with: kib@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/compat/linuxkpi/common/src/linux_current.c | 35 ++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_current.c b/sys/compat/linuxkpi/common/src/linux_current.c index 9bae7ee92e49..51e396081c04 100644 --- a/sys/compat/linuxkpi/common/src/linux_current.c +++ b/sys/compat/linuxkpi/common/src/linux_current.c @@ -45,6 +45,7 @@ extern u_int first_msi_irq, num_msi_irqs; static eventhandler_tag linuxkpi_thread_dtor_tag; +static atomic_t linux_current_allocs; static uma_zone_t linux_current_zone; static uma_zone_t linux_mm_zone; @@ -146,6 +147,10 @@ linux_alloc_current(struct thread *td, int flags) /* free mm_struct pointer, if any */ uma_zfree(linux_mm_zone, mm); + /* keep track of number of allocations */ + if (atomic_add_return(1, &linux_current_allocs) == INT_MAX) + panic("linux_alloc_current: Refcount too high!"); + return (0); } @@ -173,6 +178,10 @@ linux_free_current(struct task_struct *ts) { mmput(ts->mm); uma_zfree(linux_current_zone, ts); + + /* keep track of number of allocations */ + if (atomic_sub_return(1, &linux_current_allocs) < 0) + panic("linux_free_current: Negative refcount!"); } static void @@ -271,10 +280,6 @@ SYSCTL_INT(_compat_linuxkpi, OID_AUTO, task_struct_reserve, static void linux_current_init(void *arg __unused) { - lkpi_alloc_current = linux_alloc_current; - linuxkpi_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, - linuxkpi_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); - TUNABLE_INT_FETCH("compat.linuxkpi.task_struct_reserve", &lkpi_task_resrv); if (lkpi_task_resrv == 0) { @@ -298,6 +303,12 @@ linux_current_init(void *arg __unused) UMA_ALIGN_PTR, 0); uma_zone_reserve(linux_mm_zone, lkpi_task_resrv); uma_prealloc(linux_mm_zone, lkpi_task_resrv); + + atomic_thread_fence_seq_cst(); + + lkpi_alloc_current = linux_alloc_current; + linuxkpi_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, + linuxkpi_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); } SYSINIT(linux_current, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, linux_current_init, NULL); @@ -309,6 +320,10 @@ linux_current_uninit(void *arg __unused) struct task_struct *ts; struct thread *td; + lkpi_alloc_current = linux_alloc_current_noop; + + atomic_thread_fence_seq_cst(); + sx_slock(&allproc_lock); FOREACH_PROC_IN_SYSTEM(p) { PROC_LOCK(p); @@ -321,8 +336,18 @@ linux_current_uninit(void *arg __unused) PROC_UNLOCK(p); } sx_sunlock(&allproc_lock); + + /* + * There is a window where threads are removed from the + * process list and where the thread destructor is invoked. + * Catch that window by waiting for all task_struct + * allocations to be returned before freeing the UMA zone. + */ + while (atomic_read(&linux_current_allocs) != 0) + pause("W", 1); + EVENTHANDLER_DEREGISTER(thread_dtor, linuxkpi_thread_dtor_tag); - lkpi_alloc_current = linux_alloc_current_noop; + uma_zdestroy(linux_current_zone); uma_zdestroy(linux_mm_zone); } From owner-dev-commits-src-all@freebsd.org Fri May 21 11:51:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 51922657E30; Fri, 21 May 2021 11:51:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4FmlMD69fKz3J9l; Fri, 21 May 2021 11:51:52 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 14LBpcrV087325 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 21 May 2021 14:51:41 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 14LBpcrV087325 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 14LBpcZa087324; Fri, 21 May 2021 14:51:38 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 21 May 2021 14:51:38 +0300 From: Konstantin Belousov To: Hans Petter Selasky Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: b764a426534f - main - There is a window where threads are removed from the process list and where the thread destructor is invoked. Catch that window by waiting for all task_struct allocations to be returned before freeing the UMA zone in the LinuxKPI. Else UMA may fail to release the zone due to concurrent access and panic: Message-ID: References: <202105211121.14LBLHI2026834@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202105211121.14LBLHI2026834@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4FmlMD69fKz3J9l X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 11:51:53 -0000 On Fri, May 21, 2021 at 11:21:17AM +0000, Hans Petter Selasky wrote: > The branch main has been updated by hselasky: > > URL: https://cgit.FreeBSD.org/src/commit/?id=b764a426534f2f5f86d6625288c74dafdbc94d2b > > commit b764a426534f2f5f86d6625288c74dafdbc94d2b > Author: Hans Petter Selasky > AuthorDate: 2021-05-21 11:17:42 +0000 > Commit: Hans Petter Selasky > CommitDate: 2021-05-21 11:18:41 +0000 > > There is a window where threads are removed from the process list and where > the thread destructor is invoked. Catch that window by waiting for all > task_struct allocations to be returned before freeing the UMA zone in the > LinuxKPI. Else UMA may fail to release the zone due to concurrent access > and panic: > > panic() - Bad link element prev->next != elm > zone_release() > bucket_drain() > bucket_free() > zone_dtor() > zone_free_item() > uma_zdestroy() > linux_current_uninit() > > This failure can be triggered by loading and unloading the LinuxKPI module > in a loop: > > while true > do > kldload linuxkpi > kldunload linuxkpi > done > > Discussed with: kib@ No, it was not discussed, with me. It contains parts of my half-done patches. And I disagree with what the global counting you added there, both on principle and on implementation. > MFC after: 1 week > Sponsored by: Mellanox Technologies // NVIDIA Networking > --- > sys/compat/linuxkpi/common/src/linux_current.c | 35 ++++++++++++++++++++++---- > 1 file changed, 30 insertions(+), 5 deletions(-) > > diff --git a/sys/compat/linuxkpi/common/src/linux_current.c b/sys/compat/linuxkpi/common/src/linux_current.c > index 9bae7ee92e49..51e396081c04 100644 > --- a/sys/compat/linuxkpi/common/src/linux_current.c > +++ b/sys/compat/linuxkpi/common/src/linux_current.c > @@ -45,6 +45,7 @@ extern u_int first_msi_irq, num_msi_irqs; > > static eventhandler_tag linuxkpi_thread_dtor_tag; > > +static atomic_t linux_current_allocs; > static uma_zone_t linux_current_zone; > static uma_zone_t linux_mm_zone; > > @@ -146,6 +147,10 @@ linux_alloc_current(struct thread *td, int flags) > /* free mm_struct pointer, if any */ > uma_zfree(linux_mm_zone, mm); > > + /* keep track of number of allocations */ > + if (atomic_add_return(1, &linux_current_allocs) == INT_MAX) > + panic("linux_alloc_current: Refcount too high!"); > + > return (0); > } > > @@ -173,6 +178,10 @@ linux_free_current(struct task_struct *ts) > { > mmput(ts->mm); > uma_zfree(linux_current_zone, ts); > + > + /* keep track of number of allocations */ > + if (atomic_sub_return(1, &linux_current_allocs) < 0) > + panic("linux_free_current: Negative refcount!"); > } > > static void > @@ -271,10 +280,6 @@ SYSCTL_INT(_compat_linuxkpi, OID_AUTO, task_struct_reserve, > static void > linux_current_init(void *arg __unused) > { > - lkpi_alloc_current = linux_alloc_current; > - linuxkpi_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, > - linuxkpi_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); > - > TUNABLE_INT_FETCH("compat.linuxkpi.task_struct_reserve", > &lkpi_task_resrv); > if (lkpi_task_resrv == 0) { > @@ -298,6 +303,12 @@ linux_current_init(void *arg __unused) > UMA_ALIGN_PTR, 0); > uma_zone_reserve(linux_mm_zone, lkpi_task_resrv); > uma_prealloc(linux_mm_zone, lkpi_task_resrv); > + > + atomic_thread_fence_seq_cst(); > + > + lkpi_alloc_current = linux_alloc_current; > + linuxkpi_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, > + linuxkpi_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); > } > SYSINIT(linux_current, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, > linux_current_init, NULL); > @@ -309,6 +320,10 @@ linux_current_uninit(void *arg __unused) > struct task_struct *ts; > struct thread *td; > > + lkpi_alloc_current = linux_alloc_current_noop; > + > + atomic_thread_fence_seq_cst(); > + > sx_slock(&allproc_lock); > FOREACH_PROC_IN_SYSTEM(p) { > PROC_LOCK(p); > @@ -321,8 +336,18 @@ linux_current_uninit(void *arg __unused) > PROC_UNLOCK(p); > } > sx_sunlock(&allproc_lock); > + > + /* > + * There is a window where threads are removed from the > + * process list and where the thread destructor is invoked. > + * Catch that window by waiting for all task_struct > + * allocations to be returned before freeing the UMA zone. > + */ > + while (atomic_read(&linux_current_allocs) != 0) > + pause("W", 1); > + > EVENTHANDLER_DEREGISTER(thread_dtor, linuxkpi_thread_dtor_tag); > - lkpi_alloc_current = linux_alloc_current_noop; > + > uma_zdestroy(linux_current_zone); > uma_zdestroy(linux_mm_zone); > } From owner-dev-commits-src-all@freebsd.org Fri May 21 12:35:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B3A2C631423; Fri, 21 May 2021 12:35:40 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4FmmKm2H5qz3tGw; Fri, 21 May 2021 12:35:39 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id D52A3260100; Fri, 21 May 2021 14:35:37 +0200 (CEST) Subject: Re: git: b764a426534f - main - There is a window where threads are removed from the process list and where the thread destructor is invoked. Catch that window by waiting for all task_struct allocations to be returned before freeing the UMA zone in the LinuxKPI. Else UMA may fail to release the zone due to concurrent access and panic: To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202105211121.14LBLHI2026834@gitrepo.freebsd.org> From: Hans Petter Selasky Message-ID: <909153c4-695b-ebc9-419d-ce3d3da38dcc@selasky.org> Date: Fri, 21 May 2021 14:34:17 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4FmmKm2H5qz3tGw X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 12:35:40 -0000 On 5/21/21 1:51 PM, Konstantin Belousov wrote: > On Fri, May 21, 2021 at 11:21:17AM +0000, Hans Petter Selasky wrote: >> The branch main has been updated by hselasky: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=b764a426534f2f5f86d6625288c74dafdbc94d2b >> >> commit b764a426534f2f5f86d6625288c74dafdbc94d2b >> Author: Hans Petter Selasky >> AuthorDate: 2021-05-21 11:17:42 +0000 >> Commit: Hans Petter Selasky >> CommitDate: 2021-05-21 11:18:41 +0000 >> >> There is a window where threads are removed from the process list and where >> the thread destructor is invoked. Catch that window by waiting for all >> task_struct allocations to be returned before freeing the UMA zone in the >> LinuxKPI. Else UMA may fail to release the zone due to concurrent access >> and panic: >> >> panic() - Bad link element prev->next != elm >> zone_release() >> bucket_drain() >> bucket_free() >> zone_dtor() >> zone_free_item() >> uma_zdestroy() >> linux_current_uninit() >> >> This failure can be triggered by loading and unloading the LinuxKPI module >> in a loop: >> >> while true >> do >> kldload linuxkpi >> kldunload linuxkpi >> done >> >> Discussed with: kib@ > No, it was not discussed, with me. > It contains parts of my half-done patches. > And I disagree with what the global counting you added there, both on > principle and on implementation. Let's discuss this off-list. There are not that many choices from what I can see. --HPS From owner-dev-commits-src-all@freebsd.org Fri May 21 12:46:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Fri May 21 13:01:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4DF1D63190B; Fri, 21 May 2021 13:01: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 4Fmmvt1bBwz4ZcY; Fri, 21 May 2021 13:01: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 1E2EE11477; Fri, 21 May 2021 13:01: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 14LD1k6f061293; Fri, 21 May 2021 13:01:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LD1kTd061292; Fri, 21 May 2021 13:01:46 GMT (envelope-from git) Date: Fri, 21 May 2021 13:01:46 GMT Message-Id: <202105211301.14LD1kTd061292@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 4eac63af23dd - main - Fix for use-after-free by if_ioctl() calls from user-space in USB drivers by detaching the ifnet before the miibus. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4eac63af23ddafc2b1dfb2aad2896f4513c37cdd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 13:01:46 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=4eac63af23ddafc2b1dfb2aad2896f4513c37cdd commit 4eac63af23ddafc2b1dfb2aad2896f4513c37cdd Author: Hans Petter Selasky AuthorDate: 2021-01-12 17:51:09 +0000 Commit: Hans Petter Selasky CommitDate: 2021-05-21 12:59:19 +0000 Fix for use-after-free by if_ioctl() calls from user-space in USB drivers by detaching the ifnet before the miibus. PR: 252608 Suggested by: jhb@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/usb/net/uhso.c | 2 +- sys/dev/usb/net/usb_ethernet.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/dev/usb/net/uhso.c b/sys/dev/usb/net/uhso.c index c72fa8d7a36b..4ff5fcc075d3 100644 --- a/sys/dev/usb/net/uhso.c +++ b/sys/dev/usb/net/uhso.c @@ -691,10 +691,10 @@ uhso_detach(device_t self) free_unr(uhso_ifnet_unit, sc->sc_ifp->if_dunit); mtx_lock(&sc->sc_mtx); uhso_if_stop(sc); + mtx_unlock(&sc->sc_mtx); bpfdetach(sc->sc_ifp); if_detach(sc->sc_ifp); if_free(sc->sc_ifp); - mtx_unlock(&sc->sc_mtx); usbd_transfer_unsetup(sc->sc_if_xfer, UHSO_IFNET_MAX); } diff --git a/sys/dev/usb/net/usb_ethernet.c b/sys/dev/usb/net/usb_ethernet.c index e1eb2c247b5a..33659049f970 100644 --- a/sys/dev/usb/net/usb_ethernet.c +++ b/sys/dev/usb/net/usb_ethernet.c @@ -319,6 +319,12 @@ uether_ifdetach(struct usb_ether *ue) /* drain any callouts */ usb_callout_drain(&ue->ue_watchdog); + /* + * Detach ethernet first to stop miibus calls from + * user-space: + */ + ether_ifdetach(ifp); + /* detach miibus */ if (ue->ue_miibus != NULL) { mtx_lock(&Giant); /* device_xxx() depends on this */ @@ -326,9 +332,6 @@ uether_ifdetach(struct usb_ether *ue) mtx_unlock(&Giant); } - /* detach ethernet */ - ether_ifdetach(ifp); - /* free interface instance */ if_free(ifp); From owner-dev-commits-src-all@freebsd.org Fri May 21 13:34:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 630B46326A3; Fri, 21 May 2021 13:34: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 4Fmnf12MlPz4qHm; Fri, 21 May 2021 13:34: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 3979311FC7; Fri, 21 May 2021 13:34: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 14LDYnbS004274; Fri, 21 May 2021 13:34:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LDYnkB004273; Fri, 21 May 2021 13:34:49 GMT (envelope-from git) Date: Fri, 21 May 2021 13:34:49 GMT Message-Id: <202105211334.14LDYnkB004273@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 4a27bf128b10 - main - usr.bin/elfctl: Allow for cross-endian operations. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4a27bf128b108d90412190c06a54ebac36a8ca2e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 13:34:49 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=4a27bf128b108d90412190c06a54ebac36a8ca2e commit 4a27bf128b108d90412190c06a54ebac36a8ca2e Author: Marcin Wojtas AuthorDate: 2021-05-21 09:19:31 +0000 Commit: Marcin Wojtas CommitDate: 2021-05-21 13:32:04 +0000 usr.bin/elfctl: Allow for cross-endian operations. Detect if host endian is different than target endian and swap byte order of ELF note fields instead of failing. Submitted by: Dawid Gorecki Reviewed by: imp Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D29550 --- usr.bin/elfctl/elfctl.c | 55 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/usr.bin/elfctl/elfctl.c b/usr.bin/elfctl/elfctl.c index bcdd1be394a9..41660fc4acd5 100644 --- a/usr.bin/elfctl/elfctl.c +++ b/usr.bin/elfctl/elfctl.c @@ -52,10 +52,10 @@ __FBSDID("$FreeBSD$"); static bool convert_to_feature_val(char *, uint32_t *); -static bool edit_file_features(Elf *, int, int, char *); -static bool get_file_features(Elf *, int, int, uint32_t *, uint64_t *); +static bool edit_file_features(Elf *, int, int, char *, bool); +static bool get_file_features(Elf *, int, int, uint32_t *, uint64_t *, bool); static void print_features(void); -static bool print_file_features(Elf *, int, int, char *); +static bool print_file_features(Elf *, int, int, char *, bool); static void usage(void); struct ControlFeatures { @@ -81,9 +81,11 @@ static struct option long_opts[] = { }; #if BYTE_ORDER == LITTLE_ENDIAN -#define SUPPORTED_ENDIAN ELFDATA2LSB +#define HOST_ENDIAN ELFDATA2LSB +#define SWAP_ENDIAN ELFDATA2MSB #else -#define SUPPORTED_ENDIAN ELFDATA2MSB +#define HOST_ENDIAN ELFDATA2MSB +#define SWAP_ENDIAN ELFDATA2LSB #endif static bool iflag; @@ -96,7 +98,7 @@ main(int argc, char **argv) Elf_Kind kind; int ch, fd, retval; char *features; - bool editfeatures, lflag; + bool editfeatures, lflag, endian_swap; lflag = 0; editfeatures = false; @@ -165,24 +167,25 @@ main(int argc, char **argv) retval = 1; goto fail; } - /* - * XXX need to support cross-endian operation, but for now - * exit on error rather than misbehaving. - */ - if (ehdr.e_ident[EI_DATA] != SUPPORTED_ENDIAN) { - warnx("file endianness must match host"); + + if (ehdr.e_ident[EI_DATA] == HOST_ENDIAN) { + endian_swap = false; + } else if (ehdr.e_ident[EI_DATA] == SWAP_ENDIAN) { + endian_swap = true; + } else { + warnx("file endianness unknown"); retval = 1; goto fail; } if (!editfeatures) { if (!print_file_features(elf, ehdr.e_phnum, fd, - argv[0])) { + argv[0], endian_swap)) { retval = 1; goto fail; } } else if (!edit_file_features(elf, ehdr.e_phnum, fd, - features)) { + features, endian_swap)) { retval = 1; goto fail; } @@ -286,12 +289,13 @@ convert_to_feature_val(char *feature_str, uint32_t *feature_val) } static bool -edit_file_features(Elf *elf, int phcount, int fd, char *val) +edit_file_features(Elf *elf, int phcount, int fd, char *val, bool endian_swap) { uint32_t features; uint64_t off; - if (!get_file_features(elf, phcount, fd, &features, &off)) { + if (!get_file_features(elf, phcount, fd, &features, &off, + endian_swap)) { warnx("NT_FREEBSD_FEATURE_CTL note not found"); return (false); } @@ -299,6 +303,9 @@ edit_file_features(Elf *elf, int phcount, int fd, char *val) if (!convert_to_feature_val(val, &features)) return (false); + if (endian_swap) + features = bswap32(features); + if (lseek(fd, off, SEEK_SET) == -1 || write(fd, &features, sizeof(features)) < (ssize_t)sizeof(features)) { @@ -320,12 +327,14 @@ print_features(void) } static bool -print_file_features(Elf *elf, int phcount, int fd, char *filename) +print_file_features(Elf *elf, int phcount, int fd, char *filename, + bool endian_swap) { uint32_t features; unsigned long i; - if (!get_file_features(elf, phcount, fd, &features, NULL)) { + if (!get_file_features(elf, phcount, fd, &features, NULL, + endian_swap)) { return (false); } @@ -344,7 +353,7 @@ print_file_features(Elf *elf, int phcount, int fd, char *filename) static bool get_file_features(Elf *elf, int phcount, int fd, uint32_t *features, - uint64_t *off) + uint64_t *off, bool endian_swap) { GElf_Phdr phdr; Elf_Note note; @@ -379,6 +388,12 @@ get_file_features(Elf *elf, int phcount, int fd, uint32_t *features, } read_total += sizeof(note); + if (endian_swap) { + note.n_namesz = bswap32(note.n_namesz); + note.n_descsz = bswap32(note.n_descsz); + note.n_type = bswap32(note.n_type); + } + /* * XXX: Name and descriptor are 4 byte aligned, however, * the size given doesn't include the padding. @@ -430,6 +445,8 @@ get_file_features(Elf *elf, int phcount, int fd, uint32_t *features, free(name); return (false); } + if (endian_swap) + *features = bswap32(*features); if (off != NULL) *off = phdr.p_offset + read_total; free(name); From owner-dev-commits-src-all@freebsd.org Fri May 21 13:34:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EA6A263262A; Fri, 21 May 2021 13:34: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 4Fmnf24CKtz4qNJ; Fri, 21 May 2021 13:34: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 6A0AE124C3; Fri, 21 May 2021 13:34: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 14LDYoMf004295; Fri, 21 May 2021 13:34:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LDYo6F004294; Fri, 21 May 2021 13:34:50 GMT (envelope-from git) Date: Fri, 21 May 2021 13:34:50 GMT Message-Id: <202105211334.14LDYo6F004294@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 7c8d38112da7 - main - Add afterbuild target to bsd.prog.mk. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7c8d38112da7bddb5ebd93cb9613acfb16456dc1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 13:34:51 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=7c8d38112da7bddb5ebd93cb9613acfb16456dc1 commit 7c8d38112da7bddb5ebd93cb9613acfb16456dc1 Author: Marcin Wojtas AuthorDate: 2021-05-21 09:23:42 +0000 Commit: Marcin Wojtas CommitDate: 2021-05-21 13:32:29 +0000 Add afterbuild target to bsd.prog.mk. Afterbuild target allows to perform operations on fully built binary. This is needed to allow for ELF feature flags modification during world build. Submitted by: Dawid Gorecki Reviewed by: imp Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D29551 --- share/mk/bsd.prog.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 44a774957cfb..89eddb24abb0 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -232,7 +232,12 @@ MAN1= ${MAN} .if defined(_SKIP_BUILD) all: .else +.if target(afterbuild) +.ORDER: ${PROG} afterbuild +all: ${PROG} ${SCRIPTS} afterbuild +.else all: ${PROG} ${SCRIPTS} +.endif .if ${MK_MAN} != "no" all: all-man .endif From owner-dev-commits-src-all@freebsd.org Fri May 21 13:34:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B39E863262D; Fri, 21 May 2021 13:34: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 4Fmnf34M5zz4qTy; Fri, 21 May 2021 13:34: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 748FF1232A; Fri, 21 May 2021 13:34: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 14LDYp6Y004323; Fri, 21 May 2021 13:34:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LDYpx8004322; Fri, 21 May 2021 13:34:51 GMT (envelope-from git) Date: Fri, 21 May 2021 13:34:51 GMT Message-Id: <202105211334.14LDYpx8004322@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: c6081dea597a - main - Add elfctl to toolchain. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c6081dea597a475e4bbcc8588ece03ae78b58978 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 13:34:51 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=c6081dea597a475e4bbcc8588ece03ae78b58978 commit c6081dea597a475e4bbcc8588ece03ae78b58978 Author: Marcin Wojtas AuthorDate: 2021-05-21 09:27:27 +0000 Commit: Marcin Wojtas CommitDate: 2021-05-21 13:32:42 +0000 Add elfctl to toolchain. Add elfctl program to toolchain to allow modifying ELF feature flags during system build. Submitted by: Dawid Gorecki Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D29552 --- Makefile.inc1 | 8 +++++--- share/mk/sys.mk | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 5ae1ec72c279..5fd1fe81c2e7 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -199,7 +199,7 @@ MK_SYSTEM_LINKER= no .if defined(CROSS_TOOLCHAIN_PREFIX) CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} .endif -XBINUTILS= AS AR LD NM OBJCOPY RANLIB SIZE STRINGS STRIPBIN +XBINUTILS= AS AR ELFCTL LD NM OBJCOPY RANLIB SIZE STRINGS STRIPBIN .for BINUTIL in ${XBINUTILS} .if defined(CROSS_BINUTILS_PREFIX) && \ exists(${CROSS_BINUTILS_PREFIX}/${${BINUTIL}}) @@ -794,8 +794,8 @@ HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCXXFLAGS} ${XCFLAGS}" \ CPP="${XCPP} ${XCFLAGS}" \ - AS="${XAS}" AR="${XAR}" LD="${XLD}" LLVM_LINK="${XLLVM_LINK}" \ - NM=${XNM} OBJCOPY="${XOBJCOPY}" \ + AS="${XAS}" AR="${XAR}" ELFCTL="${XELFCTL}" LD="${XLD}" \ + LLVM_LINK="${XLLVM_LINK}" NM=${XNM} OBJCOPY="${XOBJCOPY}" \ RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \ SIZE="${XSIZE}" STRIPBIN="${XSTRIPBIN}" @@ -2600,6 +2600,7 @@ _dtrace_tools= cddl/lib/libctf cddl/lib/libspl cddl/usr.bin/ctfconvert \ .if ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no" _elftctools= lib/libelftc \ lib/libpe \ + usr.bin/elfctl \ usr.bin/objcopy \ usr.bin/nm \ usr.bin/size \ @@ -2613,6 +2614,7 @@ _elftctools+= usr.bin/addr2line # the target (for at least crunchide). _elftctools= lib/libelftc \ lib/libpe \ + usr.bin/elfctl \ usr.bin/objcopy .endif diff --git a/share/mk/sys.mk b/share/mk/sys.mk index 8f456b28593a..89ac2c549656 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -210,6 +210,8 @@ ECHODIR ?= true .endif .endif +ELFCTL ?= elfctl + .if ${.MAKEFLAGS:M-N} # bmake -N is supposed to skip executing anything but it does not skip # exeucting '+' commands. The '+' feature is used where .MAKE From owner-dev-commits-src-all@freebsd.org Fri May 21 13:34:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 40407632916; Fri, 21 May 2021 13:34: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 4Fmnf503STz4qYp; Fri, 21 May 2021 13:34: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 9394A122D4; Fri, 21 May 2021 13:34: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 14LDYqRo004344; Fri, 21 May 2021 13:34:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LDYqoa004343; Fri, 21 May 2021 13:34:52 GMT (envelope-from git) Date: Fri, 21 May 2021 13:34:52 GMT Message-Id: <202105211334.14LDYqoa004343@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: af949c590bd8 - main - Disable stack gap for ntpd during build. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: af949c590bd8a00a5973b5875d7e0fa6832ea64a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 13:34:53 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=af949c590bd8a00a5973b5875d7e0fa6832ea64a commit af949c590bd8a00a5973b5875d7e0fa6832ea64a Author: Marcin Wojtas AuthorDate: 2021-05-21 09:29:22 +0000 Commit: Marcin Wojtas CommitDate: 2021-05-21 13:33:06 +0000 Disable stack gap for ntpd during build. When starting, ntpd calls setrlimit(2) to limit maximum size of its stack. The stack limit chosen by ntpd is 200K, so when stack gap is enabled, the stack gap is larger than this limit, which results in ntpd crashing. Submitted by: Dawid Gorecki Reviewed by: cy, imp Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D29553 --- usr.sbin/ntp/ntpd/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.sbin/ntp/ntpd/Makefile b/usr.sbin/ntp/ntpd/Makefile index 2d8a8b9d2a2d..b9c3a05547d4 100644 --- a/usr.sbin/ntp/ntpd/Makefile +++ b/usr.sbin/ntp/ntpd/Makefile @@ -56,4 +56,7 @@ CLEANFILES+= .version version.c version.c: sh -e ${.CURDIR:H}/scripts/mkver ntpd +afterbuild: + ${ELFCTL} -e +noaslrstkgap ${PROG} + .include From owner-dev-commits-src-all@freebsd.org Fri May 21 13:37:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D13D1632B93 for ; Fri, 21 May 2021 13:37:16 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fmnhr3lqBz4rXK for ; Fri, 21 May 2021 13:37:16 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qv1-xf33.google.com with SMTP id a7so6049544qvf.11 for ; Fri, 21 May 2021 06:37:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=CSoPBpu6oONP8gXYJUsYdlHqkhvGXRkgBywH0KGxGMQ=; b=Y4BidaudvW2l0mrPoLk+yjbL2OYtV7t5WYOKFd3rWtmlVUOZ+9q2pp2zq6IuDpL/ZH ZZ6+P1pux5AfEqWgEnN3LxxziPvPJ0eaiTqJ13i4/FUMLFYRyQt0Q0NTKerqX59m9Uc+ J1y1fZro3LtVeLa6UIw/Om5A7qj+79EiwFFceKiTdZgbf7Vrb5ktFj1tGKGOozWDXD7R CUO+264ukfZBf7le8ucdLi6+J+Vq3PKWeR+9bjjfSFxEKZgkYsPgn5Etcy8JDJrQG2oy 7cdMp8XWetx6uxEUy3kWt+wAj0Rivu9uBBOhI26MCq0lA78cde+ahkoyFUPMf0+XsiRn yt8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=CSoPBpu6oONP8gXYJUsYdlHqkhvGXRkgBywH0KGxGMQ=; b=QTq93QduFS1GY2KDDbhzPUyzJeleGPRGOsRWSEH01zHVZePwEWkrtX8zTN1U8gs88W tKziFX7TJaHkY8Is89gP7dWq8M5sZ/8VJ2fJQJcsqQXyTmL47Jq/BM45GhzOGLeo5QZs YMmXPSdcT3K7ubxqMtS+ErcUR46TI55ECLXo6jAfFGKIOScnwQ4lnGN1iPzCXZUctf9/ D4CszOHFboi0UZOGUAa6V8nuIJfpX1rel9h/nX9O3Td04pkF8sXxf+iKoBkfHGxoMO8S L/HMo5A8/eAVhOBjqt7UfA+EMHwzfWvGqFl/vAkc4KaGzlDAX+4ji9uh9lKncGoUuM8q BfQA== X-Gm-Message-State: AOAM531Bni7ug48QsYnSxXq7DOsSH0X+U3sXTTxsQyYBPEmlk31Yu6dx Aeel9GQouYi3yfGLpJDKpne2eA== X-Google-Smtp-Source: ABdhPJxXQBJVtFYhSr8HzvASkaRKKRX6ZgwMbP50yzWjtEh+7ioqkJveFeYNWHVjiCgfJDv1RNXkQQ== X-Received: by 2002:a05:6214:1921:: with SMTP id es1mr13072594qvb.0.1621604235529; Fri, 21 May 2021 06:37:15 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id o5sm4588447qtl.85.2021.05.21.06.37.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 06:37:14 -0700 (PDT) Date: Fri, 21 May 2021 09:37:14 -0400 From: Shawn Webb To: Marcin Wojtas Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: af949c590bd8 - main - Disable stack gap for ntpd during build. Message-ID: <20210521133714.g5qpcs5wd4q27tya@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202105211334.14LDYqoa004343@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="acbqqhcrzins2o5s" Content-Disposition: inline In-Reply-To: <202105211334.14LDYqoa004343@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4Fmnhr3lqBz4rXK X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 13:37:16 -0000 --acbqqhcrzins2o5s Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 21, 2021 at 01:34:52PM +0000, Marcin Wojtas wrote: > The branch main has been updated by mw: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3Daf949c590bd8a00a5973b5875d= 7e0fa6832ea64a >=20 > commit af949c590bd8a00a5973b5875d7e0fa6832ea64a > Author: Marcin Wojtas > AuthorDate: 2021-05-21 09:29:22 +0000 > Commit: Marcin Wojtas > CommitDate: 2021-05-21 13:33:06 +0000 >=20 > Disable stack gap for ntpd during build. > =20 > When starting, ntpd calls setrlimit(2) to limit maximum size of its > stack. The stack limit chosen by ntpd is 200K, so when stack gap > is enabled, the stack gap is larger than this limit, which results > in ntpd crashing. Would it make sense to update the stack limit enforcement code to take the stack gap into account? I haven't looked at HardenedBSD's stack randomization for a while, but if memory serves correctly, we made that change. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --acbqqhcrzins2o5s Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmCnt4cACgkQ/y5nonf4 4frnvBAApuiHsM1JvQ91oeMnrPWi6Z2vg7mPf8Hdi1UO1MoYHWzKuVvFahVix+w+ YTFVmQl4XO1aHNRb6IFC5uq1VBBFSSCCDNBJJFWqG73ZVjr0ezPQMBTVMVKs65G1 UhA9s719/90O3AcnGstwJ9iTPs7+HcWAie3doCjJaxDDrjTSI+mIuoOcN3mG/vj9 iZ8dwuxbsk1TvYtNzqRlx4hz+ZdcePIEEx46jMLn4zOnTa1c/ae54r+Y+D0J4+cB JJqutQoN+z8PVGBujJs/bgtt7kIVNxuq1HtQS4J/bLqgRaQcghvxNkYhUStkA28x ZOPD55X6UwZswr3i7SH0Dbq6uuyd0opEsPfdqQ6EmWbaCf0gxd6IPvr6VFO7nga5 D74hHuEKUqTsOyPs8PK8mm3nnRPJDlC7GzIFAmj8CiEbdXTXsIWtxt+U3Xa6gcEv Qti3zFUdp8Q4oaN52rkeyegiYBeCNEkeWjM+lEtJBBOWhFVlkcRslVtyEfE5McmY aZoLuE3528rU9AFNt4dS1XuTdkUTtZqVyDTml4ismTybkmvYxRPnSAhiVg2sT3iY 5gOxuzyk+pTKcS59it8AjiHGvsVIjsuxNM885ZJQ+4ojtD3LvRg88+Bx6czXcInG WaUj9GjIJ3oO9y2RrKSSLNT0LpM0bub1IxIPpwTyivDIf5RyHx8= =OVVc -----END PGP SIGNATURE----- --acbqqhcrzins2o5s-- From owner-dev-commits-src-all@freebsd.org Fri May 21 13:39:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BAA13632B29 for ; Fri, 21 May 2021 13:39:09 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fmnl13mTZz4smG for ; Fri, 21 May 2021 13:39:09 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f47.google.com with SMTP id n2so21205439wrm.0 for ; Fri, 21 May 2021 06:39:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=FnoP9vPOrJrN0+KwakORUxztPyvBEpTFp5LQ0FUQhtQ=; b=P205NDMZ4bZYnzj1RxpaMWywS7RisB1ftoWvg+BfSBSRC5V7EBupHjY7Nc6jgtIm9M WoCY2Ib0Ufyxrq7J7vEVFJPrZTEi0rDDz3ndd0yaQ31kDiPI6jJXCodzJRFeFFAmPlU6 V2f+dq8niuUeVkBeWFkcJWfg8QEPjoI+gHiVex4S0C5ha54MbLpHTE7l2y0tynSzizXb LzzoAe/sf2fnNU5OjppVTg/YG/BCC6W3kLIF3kYEl9bntmejS3+WYHv1KYy07OAubpkA aIVDDtxUeTQZFg7WMhUWvr3+Mei1c51fEEnFEorgbnRpbtc3QTtCam1wj+NgO6lLnJxZ /Fng== X-Gm-Message-State: AOAM532AMmh2bBwAFL3y18QJrfy04wx4Y8IAcqw42jp9O/kVuniZ6KU6 f0BIhxSeQa8FE57E2rRna/hdG4xFS4pWcQ== X-Google-Smtp-Source: ABdhPJxtlWSkV2K+oceijHqYVqObayuU45CPygfcd1M5CK9+UFWSP6zTqOJWovqMuDWi9EA3lCZYfQ== X-Received: by 2002:a5d:59a4:: with SMTP id p4mr10024247wrr.248.1621604347960; Fri, 21 May 2021 06:39:07 -0700 (PDT) Received: from [192.168.150.48] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id c12sm2341000wrr.90.2021.05.21.06.39.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 May 2021 06:39:07 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: af949c590bd8 - main - Disable stack gap for ntpd during build. From: Jessica Clarke In-Reply-To: <202105211334.14LDYqoa004343@gitrepo.freebsd.org> Date: Fri, 21 May 2021 14:39:06 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <04F25FD0-7863-4AC1-A257-EF0F1EB90659@freebsd.org> References: <202105211334.14LDYqoa004343@gitrepo.freebsd.org> To: Marcin Wojtas X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4Fmnl13mTZz4smG X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 13:39:09 -0000 On 21 May 2021, at 14:34, Marcin Wojtas wrote: >=20 > The branch main has been updated by mw: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Daf949c590bd8a00a5973b5875d7e0fa6= 832ea64a >=20 > commit af949c590bd8a00a5973b5875d7e0fa6832ea64a > Author: Marcin Wojtas > AuthorDate: 2021-05-21 09:29:22 +0000 > Commit: Marcin Wojtas > CommitDate: 2021-05-21 13:33:06 +0000 >=20 > Disable stack gap for ntpd during build. >=20 > When starting, ntpd calls setrlimit(2) to limit maximum size of its > stack. The stack limit chosen by ntpd is 200K, so when stack gap > is enabled, the stack gap is larger than this limit, which results > in ntpd crashing. Isn=E2=80=99t the bug that the unusable gap counts as usage? Jess From owner-dev-commits-src-all@freebsd.org Fri May 21 13:45:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Fri May 21 13:52:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Fri May 21 14:11:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BEE6563361A for ; Fri, 21 May 2021 14:11:38 +0000 (UTC) (envelope-from mw@semihalf.com) Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmpSV4fxVz3Q6l for ; Fri, 21 May 2021 14:11:38 +0000 (UTC) (envelope-from mw@semihalf.com) Received: by mail-qk1-x72f.google.com with SMTP id 82so8440666qki.8 for ; Fri, 21 May 2021 07:11:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=RhDjwBklaIBDR8oby7gettn6bdTQ5xD+H7vR/fEk7ns=; b=U/EXKUXZUtcuScw/yBlhiZIBQVEQxKb5vaLwF4abTqhoVIHYi9Ll2b/4q0R1crMuQc qH0EkAufY09a3S4/oEX9xP1WIpMLsZz1P1fScDoi4J3N4DXbGCemoYaI0nl7ctPNCmtb 2iBlk1Knjgd+Poe7GI3ZLvxnAWWXZnmQCpXuwWQ40rMWlGwP0CtNlWepBPBgrmb1cErn Pf2SYXeery35Lk75vBGROGZOeRuudR6Y6EbxCrb/o2YxGhvgs812ddRqmlmHAa6XaAtR djLu7fLVK1KuobJj5zNVaaNkEItLlKb/lJMUtez811SlY8l00LKb/wxc/qbPt3HV05hR RtGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=RhDjwBklaIBDR8oby7gettn6bdTQ5xD+H7vR/fEk7ns=; b=DocUX6qSWA1eV+XJhR78AuPrwrElQ3O5XECez3r9JUrR3LQr+2x4IbScJ3DVRWgt86 6eXNzkQ3/zPWzUntddNBKHBW/aAeyF+kT8CkZC9b0eGGaveXOAaET1mZZsisQ7nkMiu7 RBprkCJD2sWF/HITJuBxkWUs6B8VVlqjP1jVR+XsezfIkMjvg1ftcr4BM3gKJdKngNl3 RkRzO6tQcRCTcRNOW61Ib9ZwjHYViBbCYged74EzaHU2HtyB0UE5n48L/EzyfuS6FFzj 2OBykzX9E+nDVM32En3Bif8XZP2vBFTGkq7kXc3oZ51ajdb+wgerbXWdCyVkCnQefZse 80vw== X-Gm-Message-State: AOAM530fHyuY5p6MHY7KDUCmGWCenBLahS7TbOrxSHa/+N5dMBBSXFcW u6sv+B/cTaenMK5YvCaRDwV5lqAtEQM9Pw8NGzV0uQ== X-Google-Smtp-Source: ABdhPJyqnEWijB/41rLoJSltLnpTA1rch/rGkbRU8jjdiIw8x7Ywb67/c9/+oaaKD9XLK/ULsLwNarq21tz9H4bgbPg= X-Received: by 2002:a05:620a:2a0f:: with SMTP id o15mr12118873qkp.295.1621606297698; Fri, 21 May 2021 07:11:37 -0700 (PDT) MIME-Version: 1.0 References: <202105211334.14LDYqoa004343@gitrepo.freebsd.org> <04F25FD0-7863-4AC1-A257-EF0F1EB90659@freebsd.org> In-Reply-To: <04F25FD0-7863-4AC1-A257-EF0F1EB90659@freebsd.org> From: Marcin Wojtas Date: Fri, 21 May 2021 16:11:25 +0200 Message-ID: Subject: Re: git: af949c590bd8 - main - Disable stack gap for ntpd during build. To: Jessica Clarke , shawn.webb@hardenedbsd.org Cc: Marcin Wojtas , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4FmpSV4fxVz3Q6l X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 14:11:38 -0000 Hi Jess pt., 21 maj 2021 o 15:39 Jessica Clarke napisa=C5=82(a= ): > > On 21 May 2021, at 14:34, Marcin Wojtas wrote: > > > > The branch main has been updated by mw: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3Daf949c590bd8a00a5973b587= 5d7e0fa6832ea64a > > > > commit af949c590bd8a00a5973b5875d7e0fa6832ea64a > > Author: Marcin Wojtas > > AuthorDate: 2021-05-21 09:29:22 +0000 > > Commit: Marcin Wojtas > > CommitDate: 2021-05-21 13:33:06 +0000 > > > > Disable stack gap for ntpd during build. > > > > When starting, ntpd calls setrlimit(2) to limit maximum size of its > > stack. The stack limit chosen by ntpd is 200K, so when stack gap > > is enabled, the stack gap is larger than this limit, which results > > in ntpd crashing. > > Isn=E2=80=99t the bug that the unusable gap counts as usage? > > Jess > An alternative solution was submitted (https://reviews.freebsd.org/D29832), so that to extend the limit for ntpd, but eventually it was recommended to simple disable the stack gap for it until it's fixed upstream (see the last comment in the linked revision). Best regards, Marcin From owner-dev-commits-src-all@freebsd.org Fri May 21 14:15:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8B13A63332C for ; Fri, 21 May 2021 14:15:46 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmpYF6gmCz3Qw1 for ; Fri, 21 May 2021 14:15:45 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f45.google.com with SMTP id i17so21222688wrq.11 for ; Fri, 21 May 2021 07:15:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ppNB69zkX8u8jBuNS1pCw/RXEsO2qqqDhDzxpvlnEDo=; b=SZTKf7sYiBRS6Z9bSYuPgWewEa1KWSpx+M/mOshhIbhb+p90NjzQGH0aw9dLrKYojD 9A1XSrxlFgWLXGzvSVB1ztzg1p9ckYSM3kFNDe1umfpyv822xbPpCLTOZl7XyXiIPFLp EWQqw2WFyaFfOq7ABos8XAN7g+rguT8Lo4AZraBPvHtELwSd7+DdnPwvMVCbTvjGJ0O3 OBWMoSPWu0lT5h1LFWkQ96cyfyaNMIExmSERz7//SKEuzH9OOkxAcsCuZhBEt8v1wzce No4NDHAQy0Ih47y0gpmy9n/+esSImQ9pNzRlVX9qVqbf4KkC6ghatit3NmMcZfJuTGpU c9UA== X-Gm-Message-State: AOAM532fwHE+H3VdRE9yKg8G+O4OZESvChZdHOf6RIk2GUbm1ZDgoGMs jPkSX0CK2CRX0hXcm6Qd91P2xw== X-Google-Smtp-Source: ABdhPJygD1b5xtLY/rqAmPGxcMIp+QlkHLJa9OvQd3sqWfsL4T/2jxv2aqprzFUBZKhDTza0q4bqVA== X-Received: by 2002:a5d:6803:: with SMTP id w3mr9838122wru.285.1621606544666; Fri, 21 May 2021 07:15:44 -0700 (PDT) Received: from [192.168.150.48] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id y2sm2325256wrl.92.2021.05.21.07.15.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 May 2021 07:15:44 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: af949c590bd8 - main - Disable stack gap for ntpd during build. From: Jessica Clarke In-Reply-To: Date: Fri, 21 May 2021 15:15:43 +0100 Cc: shawn.webb@hardenedbsd.org, Marcin Wojtas , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <02078965-24BE-4F23-92D5-5E8E54A0C3E7@freebsd.org> References: <202105211334.14LDYqoa004343@gitrepo.freebsd.org> <04F25FD0-7863-4AC1-A257-EF0F1EB90659@freebsd.org> To: Marcin Wojtas X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4FmpYF6gmCz3Qw1 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 14:15:46 -0000 > On 21 May 2021, at 15:11, Marcin Wojtas wrote: >=20 > Hi Jess >=20 > pt., 21 maj 2021 o 15:39 Jessica Clarke = napisa=C5=82(a): >>=20 >> On 21 May 2021, at 14:34, Marcin Wojtas wrote: >>>=20 >>> The branch main has been updated by mw: >>>=20 >>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Daf949c590bd8a00a5973b5875d7e0fa6= 832ea64a >>>=20 >>> commit af949c590bd8a00a5973b5875d7e0fa6832ea64a >>> Author: Marcin Wojtas >>> AuthorDate: 2021-05-21 09:29:22 +0000 >>> Commit: Marcin Wojtas >>> CommitDate: 2021-05-21 13:33:06 +0000 >>>=20 >>> Disable stack gap for ntpd during build. >>>=20 >>> When starting, ntpd calls setrlimit(2) to limit maximum size of = its >>> stack. The stack limit chosen by ntpd is 200K, so when stack gap >>> is enabled, the stack gap is larger than this limit, which results >>> in ntpd crashing. >>=20 >> Isn=E2=80=99t the bug that the unusable gap counts as usage? >>=20 >> Jess >>=20 >=20 > An alternative solution was submitted > (https://reviews.freebsd.org/D29832), so that to extend the limit for > ntpd, but eventually it was recommended to simple disable the stack > gap for it until it's fixed upstream (see the last comment in the > linked revision). That=E2=80=99s my point, there is nothing to =E2=80=9Cfix=E2=80=9D = upstream. NTPD uses less than 200K of stack, thus it is perfectly reasonable for it to set its limit to = that. The fact that FreeBSD decides to count an arbitrary, non-deterministic = amount of additional unusable virtual address space towards that limit is not its = fault, but a bug in FreeBSD that needs to be fixed as it=E2=80=99s entirely = unreasonable for applications to have to account for that. Jess From owner-dev-commits-src-all@freebsd.org Fri May 21 14:17:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3CC00633B50 for ; Fri, 21 May 2021 14:17:47 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fmpbb0M7zz3htL for ; Fri, 21 May 2021 14:17:46 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x72a.google.com with SMTP id 82so8463861qki.8 for ; Fri, 21 May 2021 07:17:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=v8f56cGYfUTiFhL3KQjhHcq07x9plt72zDvEsui2CFs=; b=HfK7c/CZCMqzdET1wT+48pSJZVnfQgT5wvzilqR54BC893v7j1NDhPlL0og9l4t9WF 4l3uK7dTEYwG1pUMaARV3tfupDTnP7f5kkS6Tqx+1ltMWlEo5VElfj7QBwy3zciEC7wH KBd7f2mxY1M+YI3BtR/RISUNNxLN34s4wCSLugjck1MzoglopZLVgQYF54/T1IzhRx6y FJFSKbN7v0B8dA20A95gNUO1MMwJxrS4pzPacNdjazVrSA+96Z4KTFB4B19TN8YVPJ/n yKSUm1/iKTdN4rgRP+hRtBkaVcYFqjU0cmn8TPO9mbUDpP3mryPoQoloun/OqRdbhOsP TWow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=v8f56cGYfUTiFhL3KQjhHcq07x9plt72zDvEsui2CFs=; b=YNaOY26sB0mn5Yh/KMqI+UuXMMcxuHkw3/97U/NIK+75nGBlhCNJC9wg442APkdinc KcToyGjHxUzFb5G0TWGpIMFi0I7FWQf12mckYQSGIgn+TN86MUk2C9+LUvwu440NOlM3 5D9v7lMPJ6MWb1/a2r5tp2vALNZvar0E3oR2FF1IRhVz8Hb0cS2xXNwKI4dxK7LhvN+D nRREwK0CVYxw1yg83LW1MnO5JAWB8npg7fqFKnBiPRAwVCtYfEPpZz0acXJbrvIFB3Zk o5RBOPxVdaXaNTPDIxColj9HqsjGToVcRYmnNMjxauQVm6E8wq/BIgbyzZn93Os8ESCA fPbg== X-Gm-Message-State: AOAM533Yj8e5q5Dxz3StcRGimeAuKMvdi58jpZ/Z1dm2KkXk8eV4Hvrh I/CBBt3htj09YcYDcx95cWDh6g== X-Google-Smtp-Source: ABdhPJzy9omNkr6fQ/qF9QTr56wLpPPi0RvzRNGfoUw1B8u43bHXIHoGj6cwGjfvogtUdjGtCVP69A== X-Received: by 2002:a37:4697:: with SMTP id t145mr12495233qka.188.1621606666257; Fri, 21 May 2021 07:17:46 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id q13sm5008168qkn.10.2021.05.21.07.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 07:17:45 -0700 (PDT) Date: Fri, 21 May 2021 10:17:44 -0400 From: Shawn Webb To: Jessica Clarke Cc: Marcin Wojtas , Marcin Wojtas , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: af949c590bd8 - main - Disable stack gap for ntpd during build. Message-ID: <20210521141744.pszt7s6l65h6jgtm@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202105211334.14LDYqoa004343@gitrepo.freebsd.org> <04F25FD0-7863-4AC1-A257-EF0F1EB90659@freebsd.org> <02078965-24BE-4F23-92D5-5E8E54A0C3E7@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ensr6kx62mdtqzwo" Content-Disposition: inline In-Reply-To: <02078965-24BE-4F23-92D5-5E8E54A0C3E7@freebsd.org> X-Rspamd-Queue-Id: 4Fmpbb0M7zz3htL X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 14:17:47 -0000 --ensr6kx62mdtqzwo Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 21, 2021 at 03:15:43PM +0100, Jessica Clarke wrote: > > On 21 May 2021, at 15:11, Marcin Wojtas wrote: > >=20 > > Hi Jess > >=20 > > pt., 21 maj 2021 o 15:39 Jessica Clarke napisa=C5= =82(a): > >>=20 > >> On 21 May 2021, at 14:34, Marcin Wojtas wrote: > >>>=20 > >>> The branch main has been updated by mw: > >>>=20 > >>> URL: https://cgit.FreeBSD.org/src/commit/?id=3Daf949c590bd8a00a5973b5= 875d7e0fa6832ea64a > >>>=20 > >>> commit af949c590bd8a00a5973b5875d7e0fa6832ea64a > >>> Author: Marcin Wojtas > >>> AuthorDate: 2021-05-21 09:29:22 +0000 > >>> Commit: Marcin Wojtas > >>> CommitDate: 2021-05-21 13:33:06 +0000 > >>>=20 > >>> Disable stack gap for ntpd during build. > >>>=20 > >>> When starting, ntpd calls setrlimit(2) to limit maximum size of its > >>> stack. The stack limit chosen by ntpd is 200K, so when stack gap > >>> is enabled, the stack gap is larger than this limit, which results > >>> in ntpd crashing. > >>=20 > >> Isn=E2=80=99t the bug that the unusable gap counts as usage? > >>=20 > >> Jess > >>=20 > >=20 > > An alternative solution was submitted > > (https://reviews.freebsd.org/D29832), so that to extend the limit for > > ntpd, but eventually it was recommended to simple disable the stack > > gap for it until it's fixed upstream (see the last comment in the > > linked revision). >=20 > That=E2=80=99s my point, there is nothing to =E2=80=9Cfix=E2=80=9D upstre= am. NTPD uses less than 200K > of stack, thus it is perfectly reasonable for it to set its limit to that= =2E The > fact that FreeBSD decides to count an arbitrary, non-deterministic amount= of > additional unusable virtual address space towards that limit is not its f= ault, > but a bug in FreeBSD that needs to be fixed as it=E2=80=99s entirely unre= asonable for > applications to have to account for that. Also: Disabling randomization of any part of the address space makes randomization other parts of the address space moot. Toggling ASLR should be all-or-nothing. Especially true for randomizing the stack. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --ensr6kx62mdtqzwo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmCnwQYACgkQ/y5nonf4 4fp3cQ//Vph+hclAo5YCOAElLn/5LTAEvw0pLVk3jzsNvavVOKHOABt9sEd07LVC TFlcManAZFHUs2KWTKRkZGwtp/xpUD/R/jfg8biP16aZGmGc/rD2n5B4jTPxSz2j hcD4h0jmNkhNxOR1KOsioKXUw0vEYs7qHhe07KaeIyA1RlM17typ570DBW+zB5ws u1PGx3Va89wsaV5SZkKjNZsjJMkGEElVY6ryF8YNCwEHpix8WbwIc070OHdDJ043 i7Xw2JTk8GUOfRralDtdOW/uoZd56Ci9qxsXs8Xl6cAtHkglO/L277FU4RHfwVcm iIHPbxgZEGl0007MdyglgjaDxTfR8KXP1Z7RKkvz4WIlWlhl3d2QcOq9zoXhWyWF +iSzDe+tweDfgi+71fzX7oSn/u1lSWJbJGVVHwkxQha7IXGnPa3fDt1maSXaxZSh IOFnIc7FM9uVyqfoFtUtbhkGvjPwR0rUOK2+qaXUQ5FuGkzYMJ8qA2Xflwu91Dzz OxzOLbNsYkvPT2xnp+huasvvmTKQNeHYigF+yGEO+mBEBZA0tbbjyCgZF25RI0u1 PeeiHZl/1GG1Kz8TlKU35JJjdb+zyF3Kp1OZWtZo9o5WChHvle4pGb5CNE+Li01k ZWspFA2LRe53GJQ+KHkYMndfuJyj/SK/NqDCz6C0fruPloy8ze8= =DGeC -----END PGP SIGNATURE----- --ensr6kx62mdtqzwo-- From owner-dev-commits-src-all@freebsd.org Fri May 21 14:43:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A9514634504; Fri, 21 May 2021 14:43:31 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fmq9H12xfz3w7S; Fri, 21 May 2021 14:43:30 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.66.148.124]) by shaw.ca with ESMTPA id k6N3l4ZxxiLmnk6N5lAWYc; Fri, 21 May 2021 08:43:29 -0600 X-Authority-Analysis: v=2.4 cv=W+Nb6Tak c=1 sm=1 tr=0 ts=60a7c711 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=8nJEP1OIZ-IA:10 a=5FLXtPjwQuUA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=Gai371H0N15RG5sVgL4A:9 a=wPNLvfGTeEIA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 465BDA01; Fri, 21 May 2021 07:43:25 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 14LEhO0e099047; Fri, 21 May 2021 07:43:25 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202105211443.14LEhO0e099047@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Marcin Wojtas cc: Jessica Clarke , shawn.webb@hardenedbsd.org, Marcin Wojtas , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: af949c590bd8 - main - Disable stack gap for ntpd during build. In-reply-to: References: <202105211334.14LDYqoa004343@gitrepo.freebsd.org> <04F25FD0-7863-4AC1-A257-EF0F1EB90659@freebsd.org> Comments: In-reply-to Marcin Wojtas message dated "Fri, 21 May 2021 16:11:25 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: Fri, 21 May 2021 07:43:24 -0700 X-CMAE-Envelope: MS4xfCn6psuItIPV0g+P+/I1oYNYBtBppOQPS2TwASh9XC5AiXRNbAuxv0Mw2uBb1QgQ2p93nBkDXN7+/rnhQadCgyPMXJy0phr4r1G6gX0lhsn2x+e6Fg22 PWd3sXI+yzGhxB7ED5FRPvMf6JTgQYixAAEznEgUw1K8pOB/DRFYVwadCbAit4d8wN0Xt9SufETDz73lYXqUgF7P4nY6WWV0hVb0alXwEXZaH2a5pvbwn8ix FcufhegnoEtESnAteiOk+wYN4vcgoKIjTJsrhI5UcjwCJs8FcTwQ5bLvpsv3UzYxskfxDVkXIxSXPeVz4ivxB5jmMienxKBtGq4Tq7rjCrP9F32HZWSD+vfy 2HizAQCEnTtFjId/Uw6X//IsMfV6LNsGGRiJg3we8lXMn91woEX1ZNwT7a/iw6Fq4UXq8lrI X-Rspamd-Queue-Id: 4Fmq9H12xfz3w7S X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 14:43:31 -0000 In message , Marcin Wojtas writes: > Hi Jess > > pt., 21 maj 2021 o 15:39 Jessica Clarke napisał(a): > > > > On 21 May 2021, at 14:34, Marcin Wojtas wrote: > > > > > > The branch main has been updated by mw: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=af949c590bd8a00a5973b5875d7e > 0fa6832ea64a > > > > > > commit af949c590bd8a00a5973b5875d7e0fa6832ea64a > > > Author: Marcin Wojtas > > > AuthorDate: 2021-05-21 09:29:22 +0000 > > > Commit: Marcin Wojtas > > > CommitDate: 2021-05-21 13:33:06 +0000 > > > > > > Disable stack gap for ntpd during build. > > > > > > When starting, ntpd calls setrlimit(2) to limit maximum size of its > > > stack. The stack limit chosen by ntpd is 200K, so when stack gap > > > is enabled, the stack gap is larger than this limit, which results > > > in ntpd crashing. > > > > Isn’t the bug that the unusable gap counts as usage? > > > > Jess > > > > An alternative solution was submitted > (https://reviews.freebsd.org/D29832), so that to extend the limit for > ntpd, but eventually it was recommended to simple disable the stack > gap for it until it's fixed upstream (see the last comment in the > linked revision). D29832 doesn't work. D29832 addressed the *already solved* stack gap issue in ntpd. The problem people failed to realize was that it wasn't stack gap but PIE. Enabling PIE regardless of the stack gap sysctl setting always resulted in the error. Ultimately a sledgehammer approach was the only way to address it. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-all@freebsd.org Fri May 21 14:46:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 ACB3D6344A2; Fri, 21 May 2021 14:46:12 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmqDN1LBsz4S4s; Fri, 21 May 2021 14:46:11 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.66.148.124]) by shaw.ca with ESMTPA id k6Phl4avriLmnk6PilAX5H; Fri, 21 May 2021 08:46:10 -0600 X-Authority-Analysis: v=2.4 cv=W+Nb6Tak c=1 sm=1 tr=0 ts=60a7c7b3 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=8nJEP1OIZ-IA:10 a=5FLXtPjwQuUA:10 a=6I5d2MoRAAAA:8 a=oCJs8q-oAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=c9e1ACnJ86l144AVqQ8A:9 a=wPNLvfGTeEIA:10 a=IjZwj45LgO3ly-622nXo:22 a=qUF70SbvcHBaGhGVny9j:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 1DFC9A08; Fri, 21 May 2021 07:46:09 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 14LEk8kZ009266; Fri, 21 May 2021 07:46:08 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202105211446.14LEk8kZ009266@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Jessica Clarke cc: Marcin Wojtas , shawn.webb@hardenedbsd.org, Marcin Wojtas , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: af949c590bd8 - main - Disable stack gap for ntpd during build. In-reply-to: <02078965-24BE-4F23-92D5-5E8E54A0C3E7@freebsd.org> References: <202105211334.14LDYqoa004343@gitrepo.freebsd.org> <04F25FD0-7863-4AC1-A257-EF0F1EB90659@freebsd.org> <02078965-24BE-4F23-92D5-5E8E54A0C3E7@freebsd.org> Comments: In-reply-to Jessica Clarke message dated "Fri, 21 May 2021 15:15:43 +0100." Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: Fri, 21 May 2021 07:46:08 -0700 X-CMAE-Envelope: MS4xfPABxL12k0lLku+u3r6gRPOld04lO+I9IJyc/NvtPipNO3O5C4T30UocazY7qgC63U4IGNLi/CKtRCt4jbj/P/NuIEJKfCVpN0FSq013bazM5QELojZx nIO8HU9NPQROc8fx0vEcaNDmJQwvCzji1v3iWgY3Ei0I+6PdYVhOfh7Jb5tD0DfZsyUI1bk8M8ywBx7b1XgeFa46IisM1ZRXtOG291edrQpuCmmpsGyFKlUi soPXCz1vAxPZfcXk1iR1HQt5dNhknkIHY13qK5EQBCO+FeU71zMKH2qbTIymqwop+o7rRiu86JAqeVW2lwfRv7T530c1EheGgo0sl4ydD/BtbbWuWnREcXFc +GrlmK5LpCQvS7JeF+zlssQ48vkZlS+U5TsoFYlImB2q3Aj4CBoNfJGSfKfa1MBfKQVRWdyk X-Rspamd-Queue-Id: 4FmqDN1LBsz4S4s X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 14:46:12 -0000 In message <02078965-24BE-4F23-92D5-5E8E54A0C3E7@freebsd.org>, Jessica Clarke w rites: > > On 21 May 2021, at 15:11, Marcin Wojtas wrote: > > > > Hi Jess > > > > pt., 21 maj 2021 o 15:39 Jessica Clarke napisał(a): > >> > >> On 21 May 2021, at 14:34, Marcin Wojtas wrote: > >>> > >>> The branch main has been updated by mw: > >>> > >>> URL: https://cgit.FreeBSD.org/src/commit/?id=af949c590bd8a00a5973b5875d7e > 0fa6832ea64a > >>> > >>> commit af949c590bd8a00a5973b5875d7e0fa6832ea64a > >>> Author: Marcin Wojtas > >>> AuthorDate: 2021-05-21 09:29:22 +0000 > >>> Commit: Marcin Wojtas > >>> CommitDate: 2021-05-21 13:33:06 +0000 > >>> > >>> Disable stack gap for ntpd during build. > >>> > >>> When starting, ntpd calls setrlimit(2) to limit maximum size of its > >>> stack. The stack limit chosen by ntpd is 200K, so when stack gap > >>> is enabled, the stack gap is larger than this limit, which results > >>> in ntpd crashing. > >> > >> Isn’t the bug that the unusable gap counts as usage? > >> > >> Jess > >> > > > > An alternative solution was submitted > > (https://reviews.freebsd.org/D29832), so that to extend the limit for > > ntpd, but eventually it was recommended to simple disable the stack > > gap for it until it's fixed upstream (see the last comment in the > > linked revision). > > That’s my point, there is nothing to “fix” upstream. NTPD uses less tha > n 200K > of stack, thus it is perfectly reasonable for it to set its limit to that. Th > e > fact that FreeBSD decides to count an arbitrary, non-deterministic amount of > additional unusable virtual address space towards that limit is not its fault > , > but a bug in FreeBSD that needs to be fixed as it’s entirely unreasonable f > or > applications to have to account for that. This latest problem is not stack gap. It is PIE. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-all@freebsd.org Fri May 21 14:52:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E99C96348A0; Fri, 21 May 2021 14:52: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 4FmqMM61d8z4TWY; Fri, 21 May 2021 14:52: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 96DB613323; Fri, 21 May 2021 14:52: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 14LEqF1G010615; Fri, 21 May 2021 14:52:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LEqFjZ010614; Fri, 21 May 2021 14:52:15 GMT (envelope-from git) Date: Fri, 21 May 2021 14:52:15 GMT Message-Id: <202105211452.14LEqFjZ010614@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 788401188f95 - main - scsi(4): fix "NMVe" typo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 788401188f950001cd9796cdcea9a7e5f92050ab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 14:52:16 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=788401188f950001cd9796cdcea9a7e5f92050ab commit 788401188f950001cd9796cdcea9a7e5f92050ab Author: Mitchell Horne AuthorDate: 2021-05-21 14:50:15 +0000 Commit: Mitchell Horne CommitDate: 2021-05-21 14:51:45 +0000 scsi(4): fix "NMVe" typo --- share/man/man4/scsi.4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man4/scsi.4 b/share/man/man4/scsi.4 index b2ed3a7eb5e5..d3f92fd6b8bb 100644 --- a/share/man/man4/scsi.4 +++ b/share/man/man4/scsi.4 @@ -56,7 +56,7 @@ subsystem provides a uniform and modular system for the implementation of drivers to control various .Tn SCSI , .Tn ATA , -.Tn NMVe , +.Tn NVMe , and .Tn MMC / SD devices, and to utilize different From owner-dev-commits-src-all@freebsd.org Fri May 21 15:35:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Fri May 21 16:04:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 37D616364EB; Fri, 21 May 2021 16:04: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 4FmryN0hZSz3JBr; Fri, 21 May 2021 16:04: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 F197414375; Fri, 21 May 2021 16:04: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 14LG4BVe005026; Fri, 21 May 2021 16:04:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LG4BWs005025; Fri, 21 May 2021 16:04:11 GMT (envelope-from git) Date: Fri, 21 May 2021 16:04:11 GMT Message-Id: <202105211604.14LG4BWs005025@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: af2253f61c43 - main - mmccam: Add two new XPT for MMC and use them in mmc_sim and sdhci MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: af2253f61c43a7608cdf6995701c1dc361320064 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 16:04:12 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=af2253f61c43a7608cdf6995701c1dc361320064 commit af2253f61c43a7608cdf6995701c1dc361320064 Author: Emmanuel Vadot AuthorDate: 2021-04-29 15:48:49 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-21 15:34:05 +0000 mmccam: Add two new XPT for MMC and use them in mmc_sim and sdhci For the discovery phase of SD/eMMC we need to do some transaction in a async way. The classic CAM XPT_{GET,SET}_TRAN_SETTING cannot be used in a async way. This also allow us to split the discovery phase into a more complete state machine and we don't mtx_sleep with a random number to wait for completion of the tasks. For mmc_sim we now do the SET_TRAN_SETTING in a taskqueue so we can call the needed function for regulators/clocks without the cam lock(s). This part is still needed to be done for sdhci. We also now save the host OCR in the discovery phase as it wasn't done before and only worked because the same ccb was reused. Reviewed by: imp, kibab, bz Differential Revision: https://reviews.freebsd.org/D30038 --- sys/cam/cam_ccb.h | 3 ++ sys/cam/cam_xpt.c | 2 + sys/cam/mmc/mmc_sim.c | 45 ++++++++++++++++++++- sys/cam/mmc/mmc_sim.h | 4 ++ sys/cam/mmc/mmc_xpt.c | 109 ++++++++++++++++++++++++++++++++++++++------------ sys/dev/sdhci/sdhci.c | 2 + 6 files changed, 137 insertions(+), 28 deletions(-) diff --git a/sys/cam/cam_ccb.h b/sys/cam/cam_ccb.h index 2545e40e192d..3a01cde1a442 100644 --- a/sys/cam/cam_ccb.h +++ b/sys/cam/cam_ccb.h @@ -253,6 +253,9 @@ typedef enum { XPT_REPROBE_LUN = 0x38 | XPT_FC_QUEUED | XPT_FC_USER_CCB, /* Query device capacity and notify GEOM */ + XPT_MMC_SET_TRAN_SETTINGS = 0x40 | XPT_FC_DEV_QUEUED, + XPT_MMC_GET_TRAN_SETTINGS = 0x41 | XPT_FC_DEV_QUEUED, + /* Vendor Unique codes: 0x80->0x8F */ XPT_VUNIQUE = 0x80 } xpt_opcode; diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 33361cfb68a5..91bac149c061 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -2702,6 +2702,8 @@ xpt_action_default(union ccb *start_ccb) case XPT_NVME_IO: case XPT_NVME_ADMIN: case XPT_MMC_IO: + case XPT_MMC_GET_TRAN_SETTINGS: + case XPT_MMC_SET_TRAN_SETTINGS: case XPT_RESET_DEV: case XPT_ENG_EXEC: case XPT_SMP_IO: diff --git a/sys/cam/mmc/mmc_sim.c b/sys/cam/mmc/mmc_sim.c index 03269a0b3d4d..1500e3f6f1cd 100644 --- a/sys/cam/mmc/mmc_sim.c +++ b/sys/cam/mmc/mmc_sim.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2020 Emmanuel Vadot + * Copyright (c) 2020-2021 Emmanuel Vadot * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -50,6 +50,30 @@ mmc_cam_default_poll(struct cam_sim *sim) return; } +static void +mmc_sim_task(void *arg, int pending) +{ + struct mmc_sim *mmc_sim; + struct ccb_trans_settings *cts; + int rv; + + mmc_sim = arg; + + if (mmc_sim->ccb == NULL) + return; + + cts = &mmc_sim->ccb->cts; + rv = MMC_SIM_SET_TRAN_SETTINGS(mmc_sim->dev, &cts->proto_specific.mmc); + if (rv != 0) + mmc_sim->ccb->ccb_h.status = CAM_REQ_INVALID; + else + mmc_sim->ccb->ccb_h.status = CAM_REQ_CMP; + + xpt_done(mmc_sim->ccb); + mmc_sim->ccb = NULL; +} + + static void mmc_cam_sim_default_action(struct cam_sim *sim, union ccb *ccb) { @@ -67,6 +91,12 @@ mmc_cam_sim_default_action(struct cam_sim *sim, union ccb *ccb) mtx_assert(&mmc_sim->mtx, MA_OWNED); + if (mmc_sim->ccb != NULL) { + ccb->ccb_h.status = CAM_BUSY; + xpt_done(ccb); + return; + } + switch (ccb->ccb_h.func_code) { case XPT_PATH_INQ: rv = MMC_SIM_GET_TRAN_SETTINGS(mmc_sim->dev, &mmc); @@ -78,6 +108,7 @@ mmc_cam_sim_default_action(struct cam_sim *sim, union ccb *ccb) } break; case XPT_GET_TRAN_SETTINGS: + case XPT_MMC_GET_TRAN_SETTINGS: { struct ccb_trans_settings *cts = &ccb->cts; @@ -105,6 +136,15 @@ mmc_cam_sim_default_action(struct cam_sim *sim, union ccb *ccb) ccb->ccb_h.status = CAM_REQ_CMP; break; } + case XPT_MMC_SET_TRAN_SETTINGS: + { + ccb->ccb_h.status = CAM_SIM_QUEUED; + mmc_sim->ccb = ccb; + taskqueue_enqueue(taskqueue_thread, &mmc_sim->sim_task); + return; + /* NOTREACHED */ + break; + } case XPT_RESET_BUS: ccb->ccb_h.status = CAM_REQ_CMP; break; @@ -112,7 +152,7 @@ mmc_cam_sim_default_action(struct cam_sim *sim, union ccb *ccb) { rv = MMC_SIM_CAM_REQUEST(mmc_sim->dev, ccb); if (rv != 0) - ccb->ccb_h.status = CAM_REQ_INPROG; + ccb->ccb_h.status = CAM_SIM_QUEUED; else ccb->ccb_h.status = CAM_REQ_INVALID; return; @@ -163,6 +203,7 @@ mmc_cam_sim_alloc(device_t dev, const char *name, struct mmc_sim *mmc_sim) } mtx_unlock(&mmc_sim->mtx); + TASK_INIT(&mmc_sim->sim_task, 0, mmc_sim_task, mmc_sim); return (0); diff --git a/sys/cam/mmc/mmc_sim.h b/sys/cam/mmc/mmc_sim.h index 629144656e51..2b1159a9758e 100644 --- a/sys/cam/mmc/mmc_sim.h +++ b/sys/cam/mmc/mmc_sim.h @@ -28,12 +28,16 @@ #ifndef __MMC_SIM_H__ #define __MMC_SIM_H__ +#include + struct mmc_sim { struct mmc_cam_sim_softc *sc; struct mtx mtx; struct cam_devq *devq; struct cam_sim *sim; device_t dev; + struct task sim_task; + union ccb *ccb; }; int mmc_cam_sim_alloc(device_t dev, const char *name, struct mmc_sim *mmc_sim); diff --git a/sys/cam/mmc/mmc_xpt.c b/sys/cam/mmc/mmc_xpt.c index 847fd7cdb412..6b2fecdab0fb 100644 --- a/sys/cam/mmc/mmc_xpt.c +++ b/sys/cam/mmc/mmc_xpt.c @@ -90,6 +90,12 @@ static void mmc_proto_debug_out(union ccb *ccb); typedef enum { PROBE_RESET, PROBE_IDENTIFY, + PROBE_POWER_OFF, + PROBE_GET_HOST_OCR, + PROBE_RESET_BUS, + PROBE_SET_ID_FREQ, + PROBE_SET_CS, + PROBE_GO_IDLE_STATE, PROBE_SDIO_RESET, PROBE_SEND_IF_COND, PROBE_SDIO_INIT, @@ -107,6 +113,12 @@ typedef enum { static char *probe_action_text[] = { "PROBE_RESET", "PROBE_IDENTIFY", + "PROBE_POWER_OFF", + "PROBE_GET_HOST_OCR", + "PROBE_RESET_BUS", + "PROBE_SET_ID_FREQ", + "PROBE_SET_CS", + "PROBE_GO_IDLE_STATE", "PROBE_SDIO_RESET", "PROBE_SEND_IF_COND", "PROBE_SDIO_INIT", @@ -165,6 +177,7 @@ typedef struct { probe_action action; int restart; union ccb saved_ccb; + uint32_t host_ocr; uint32_t flags; #define PROBE_FLAG_ACMD_SENT 0x1 /* CMD55 is sent, card expects ACMD */ #define PROBE_FLAG_HOST_CAN_DO_18V 0x2 /* Host can do 1.8V signaling */ @@ -584,7 +597,6 @@ mmcprobe_start(struct cam_periph *periph, union ccb *start_ccb) mmcprobe_softc *softc; struct cam_path *path; struct ccb_mmcio *mmcio; - struct mtx *p_mtx = cam_periph_mtx(periph); struct ccb_trans_settings_mmc *cts; CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("mmcprobe_start\n")); @@ -612,25 +624,29 @@ mmcprobe_start(struct cam_periph *periph, union ccb *start_ccb) case PROBE_IDENTIFY: xpt_path_inq(&start_ccb->cpi, periph->path); CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("Start with PROBE_IDENTIFY\n")); - init_standard_ccb(start_ccb, XPT_GET_TRAN_SETTINGS); - xpt_action(start_ccb); - if (cts->ios.power_mode != power_off) { - init_standard_ccb(start_ccb, XPT_SET_TRAN_SETTINGS); - cts->ios.power_mode = power_off; - cts->ios_valid = MMC_PM; - xpt_action(start_ccb); - mtx_sleep(periph, p_mtx, 0, "mmcios", 100); - } - /* mmc_power_up */ - /* Get the host OCR */ - init_standard_ccb(start_ccb, XPT_GET_TRAN_SETTINGS); - xpt_action(start_ccb); + init_standard_ccb(start_ccb, XPT_MMC_GET_TRAN_SETTINGS); + break; + + case PROBE_POWER_OFF: + CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("power off the card\n")); + init_standard_ccb(start_ccb, XPT_MMC_SET_TRAN_SETTINGS); + cts->ios.power_mode = power_off; + cts->ios_valid = MMC_PM; + break; + + case PROBE_GET_HOST_OCR: + CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("get the host ocr\n")); + init_standard_ccb(start_ccb, XPT_MMC_GET_TRAN_SETTINGS); + break; + case PROBE_RESET_BUS: + { uint32_t host_caps = cts->host_caps; if (host_caps & MMC_CAP_SIGNALING_180) softc->flags |= PROBE_FLAG_HOST_CAN_DO_18V; - uint32_t hv = mmc_highest_voltage(cts->host_ocr); - init_standard_ccb(start_ccb, XPT_SET_TRAN_SETTINGS); + uint32_t hv = mmc_highest_voltage(softc->host_ocr); + CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("reseting the bus\n")); + init_standard_ccb(start_ccb, XPT_MMC_SET_TRAN_SETTINGS); cts->ios.vdd = hv; cts->ios.bus_mode = opendrain; cts->ios.chip_select = cs_dontcare; @@ -639,25 +655,26 @@ mmcprobe_start(struct cam_periph *periph, union ccb *start_ccb) cts->ios.clock = 0; cts->ios_valid = MMC_VDD | MMC_PM | MMC_BM | MMC_CS | MMC_BW | MMC_CLK; - xpt_action(start_ccb); - mtx_sleep(periph, p_mtx, 0, "mmcios", 100); + break; + } - init_standard_ccb(start_ccb, XPT_SET_TRAN_SETTINGS); + case PROBE_SET_ID_FREQ: + CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("setting the ID freq\n")); + init_standard_ccb(start_ccb, XPT_MMC_SET_TRAN_SETTINGS); cts->ios.power_mode = power_on; cts->ios.clock = CARD_ID_FREQUENCY; cts->ios.timing = bus_timing_normal; cts->ios_valid = MMC_PM | MMC_CLK | MMC_BT; - xpt_action(start_ccb); - mtx_sleep(periph, p_mtx, 0, "mmcios", 100); - /* End for mmc_power_on */ + break; + case PROBE_SET_CS: /* Begin mmc_idle_cards() */ - init_standard_ccb(start_ccb, XPT_SET_TRAN_SETTINGS); + init_standard_ccb(start_ccb, XPT_MMC_SET_TRAN_SETTINGS); cts->ios.chip_select = cs_high; cts->ios_valid = MMC_CS; - xpt_action(start_ccb); - mtx_sleep(periph, p_mtx, 0, "mmcios", 1); + break; + case PROBE_GO_IDLE_STATE: CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("Send first XPT_MMC_IO\n")); init_standard_ccb(start_ccb, XPT_MMC_IO); mmcio->cmd.opcode = MMC_GO_IDLE_STATE; /* CMD 0 */ @@ -668,6 +685,7 @@ mmcprobe_start(struct cam_periph *periph, union ccb *start_ccb) /* XXX Reset I/O portion as well */ break; + case PROBE_SDIO_RESET: CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("Start with PROBE_SDIO_RESET\n")); @@ -805,7 +823,7 @@ mmcprobe_done(struct cam_periph *periph, union ccb *done_ccb) struct ccb_mmcio *mmcio; u_int32_t priority; - CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("mmcprobe_done\n")); + CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("mmcprobe_done\n")); softc = (mmcprobe_softc *)periph->softc; path = done_ccb->ccb_h.path; priority = done_ccb->ccb_h.pinfo.priority; @@ -816,6 +834,45 @@ mmcprobe_done(struct cam_periph *periph, union ccb *done_ccb) case PROBE_IDENTIFY: { CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("done with PROBE_RESET\n")); + PROBE_SET_ACTION(softc, PROBE_POWER_OFF); + break; + } + case PROBE_POWER_OFF: + { + CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("done with PROBE_POWER_OFF\n")); + PROBE_SET_ACTION(softc, PROBE_GET_HOST_OCR); + break; + } + case PROBE_GET_HOST_OCR: + { + struct ccb_trans_settings_mmc *cts; + cts = &done_ccb->cts.proto_specific.mmc; + softc->host_ocr = cts->host_ocr; + CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("done with PROBE_GET_HOST_OCR (Got OCR=%x\n", softc->host_ocr)); + PROBE_SET_ACTION(softc, PROBE_RESET_BUS); + break; + } + case PROBE_RESET_BUS: + { + CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("done with PROBE_RESET_BUS\n")); + PROBE_SET_ACTION(softc, PROBE_SET_ID_FREQ); + break; + } + case PROBE_SET_ID_FREQ: + { + CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("done with PROBE_SET_ID_FREQ\n")); + PROBE_SET_ACTION(softc, PROBE_SET_CS); + break; + } + case PROBE_SET_CS: + { + CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("done with PROBE_SET_CS\n")); + PROBE_SET_ACTION(softc, PROBE_GO_IDLE_STATE); + break; + } + case PROBE_GO_IDLE_STATE: + { + CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("done with PROBE_GO_IDLE_STATE\n")); mmcio = &done_ccb->mmcio; err = mmcio->cmd.error; diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c index 91474cabd2d3..0441320d4b35 100644 --- a/sys/dev/sdhci/sdhci.c +++ b/sys/dev/sdhci/sdhci.c @@ -2537,6 +2537,7 @@ sdhci_cam_action(struct cam_sim *sim, union ccb *ccb) mmc_path_inq(&ccb->cpi, "Deglitch Networks", sim, maxphys); break; + case XPT_MMC_GET_TRAN_SETTINGS: case XPT_GET_TRAN_SETTINGS: { struct ccb_trans_settings *cts = &ccb->cts; @@ -2571,6 +2572,7 @@ sdhci_cam_action(struct cam_sim *sim, union ccb *ccb) ccb->ccb_h.status = CAM_REQ_CMP; break; } + case XPT_MMC_SET_TRAN_SETTINGS: case XPT_SET_TRAN_SETTINGS: if (sdhci_debug > 1) slot_printf(slot, "Got XPT_SET_TRAN_SETTINGS\n"); From owner-dev-commits-src-all@freebsd.org Fri May 21 16:04:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 56F0B63627C; Fri, 21 May 2021 16:04: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 4FmryP1VCGz3JKq; Fri, 21 May 2021 16:04: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 17A8E1454B; Fri, 21 May 2021 16:04: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 14LG4Cow005047; Fri, 21 May 2021 16:04:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LG4Ci0005046; Fri, 21 May 2021 16:04:12 GMT (envelope-from git) Date: Fri, 21 May 2021 16:04:12 GMT Message-Id: <202105211604.14LG4Ci0005046@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: bc1bb80564ee - main - arm64: rockchip: gpio: Give friendlier name to gpio MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bc1bb80564eef66cef1a7b9791af87ae019aa71d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 16:04:13 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=bc1bb80564eef66cef1a7b9791af87ae019aa71d commit bc1bb80564eef66cef1a7b9791af87ae019aa71d Author: Emmanuel Vadot AuthorDate: 2021-05-16 12:47:16 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-21 15:35:43 +0000 arm64: rockchip: gpio: Give friendlier name to gpio By default name the gpio P This make it easier to find the gpio when reading schematics or DTS. Sponsored by: Diablotin Systems Differential Revision: https://reviews.freebsd.org/D30287 --- sys/arm64/rockchip/rk_gpio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/arm64/rockchip/rk_gpio.c b/sys/arm64/rockchip/rk_gpio.c index aa44a6bc9e09..d3623b2302ec 100644 --- a/sys/arm64/rockchip/rk_gpio.c +++ b/sys/arm64/rockchip/rk_gpio.c @@ -209,14 +209,17 @@ static int rk_gpio_pin_getname(device_t dev, uint32_t pin, char *name) { struct rk_gpio_softc *sc; + uint32_t bank; sc = device_get_softc(dev); if (pin >= 32) return (EINVAL); + bank = pin / 8; + pin = pin - (bank * 8); RK_GPIO_LOCK(sc); - snprintf(name, GPIOMAXNAME, "gpio%d", pin); + snprintf(name, GPIOMAXNAME, "P%c%d", bank + 'A', pin); RK_GPIO_UNLOCK(sc); return (0); From owner-dev-commits-src-all@freebsd.org Fri May 21 16:04:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9349F63670A; Fri, 21 May 2021 16:04: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 4FmryQ2J3yz3JKv; Fri, 21 May 2021 16:04: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 3243514602; Fri, 21 May 2021 16:04:14 +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 14LG4EQ9005068; Fri, 21 May 2021 16:04:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LG4EdR005067; Fri, 21 May 2021 16:04:14 GMT (envelope-from git) Date: Fri, 21 May 2021 16:04:14 GMT Message-Id: <202105211604.14LG4EdR005067@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 5b2a81f58dc7 - main - mmc: Add mmc-pwrseq driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5b2a81f58dc722ca76065536f07ba47efd98dc63 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 16:04:14 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=5b2a81f58dc722ca76065536f07ba47efd98dc63 commit 5b2a81f58dc722ca76065536f07ba47efd98dc63 Author: Emmanuel Vadot AuthorDate: 2021-05-16 12:48:56 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-21 15:36:20 +0000 mmc: Add mmc-pwrseq driver This driver is used to power up sdio card or eMMC. It handle the reset-gpio, clocks and needed delays for powerup/powerdown. Sponsored by: Diablotin Systems Differential Revision: https://reviews.freebsd.org/D30288 --- sys/conf/files | 2 + sys/dev/mmc/mmc_pwrseq.c | 194 ++++++++++++++++++++++++++++++++++++++++++++ sys/dev/mmc/mmc_pwrseq_if.m | 38 +++++++++ 3 files changed, 234 insertions(+) diff --git a/sys/conf/files b/sys/conf/files index 22083169bfc7..70cdd9f68dc6 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -2476,6 +2476,8 @@ dev/mmc/mmcbr_if.m standard dev/mmc/mmcbus_if.m standard dev/mmc/mmcsd.c optional mmcsd !mmccam dev/mmc/mmc_fdt_helpers.c optional mmc fdt | mmccam fdt +dev/mmc/mmc_pwrseq.c optional mmc fdt | mmccam fdt +dev/mmc/mmc_pwrseq_if.m optional mmc fdt | mmccam fdt dev/mmcnull/mmcnull.c optional mmcnull dev/mpr/mpr.c optional mpr dev/mpr/mpr_config.c optional mpr diff --git a/sys/dev/mmc/mmc_pwrseq.c b/sys/dev/mmc/mmc_pwrseq.c new file mode 100644 index 000000000000..d4ccf814fe53 --- /dev/null +++ b/sys/dev/mmc/mmc_pwrseq.c @@ -0,0 +1,194 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright 2021 Emmanuel Vadot + * + * 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 +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include "mmc_pwrseq_if.h" + +enum pwrseq_type { + PWRSEQ_SIMPLE = 1, + PWRSEQ_EMMC, +}; + +static struct ofw_compat_data compat_data[] = { + { "mmc-pwrseq-simple", PWRSEQ_SIMPLE }, + { "mmc-pwrseq-emmc", PWRSEQ_EMMC }, + { NULL, 0 } +}; + +struct mmc_pwrseq_softc { + enum pwrseq_type type; + clk_t ext_clock; + struct gpiobus_pin *reset_gpio; + + uint32_t post_power_on_delay_ms; + uint32_t power_off_delay_us; +}; + +static int +mmc_pwrseq_probe(device_t dev) +{ + enum pwrseq_type type; + + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) + return (ENXIO); + + type = (enum pwrseq_type)ofw_bus_search_compatible(dev, compat_data)->ocd_data; + switch (type) { + case PWRSEQ_SIMPLE: + device_set_desc(dev, "MMC Simple Power sequence"); + break; + case PWRSEQ_EMMC: + device_set_desc(dev, "MMC eMMC Power sequence"); + break; + } + return (BUS_PROBE_DEFAULT); +} + +static int +mmc_pwrseq_attach(device_t dev) +{ + struct mmc_pwrseq_softc *sc; + phandle_t node; + int rv; + + sc = device_get_softc(dev); + sc->type = (enum pwrseq_type)ofw_bus_search_compatible(dev, compat_data)->ocd_data; + node = ofw_bus_get_node(dev); + + if (sc->type == PWRSEQ_SIMPLE) { + if (OF_hasprop(node, "clocks")) { + rv = clk_get_by_ofw_name(dev, 0, "ext_clock", &sc->ext_clock); + if (rv != 0) { + device_printf(dev, + "Node have a clocks property but no clocks named \"ext_clock\"\n"); + return (ENXIO); + } + } + OF_getencprop(node, "post-power-on-delay-ms", &sc->post_power_on_delay_ms, sizeof(uint32_t)); + OF_getencprop(node, "power-off-delay-us", &sc->power_off_delay_us, sizeof(uint32_t)); + } + + if (OF_hasprop(node, "reset-gpios")) { + if (gpio_pin_get_by_ofw_property(dev, node, "reset-gpios", + &sc->reset_gpio) != 0) { + device_printf(dev, "Cannot get the reset-gpios\n"); + return (ENXIO); + } + gpio_pin_setflags(sc->reset_gpio, GPIO_PIN_OUTPUT); + gpio_pin_set_active(sc->reset_gpio, true); + } + + OF_device_register_xref(OF_xref_from_node(node), dev); + return (0); +} + +static int +mmc_pwrseq_detach(device_t dev) +{ + + return (EBUSY); +} + +static int +mmv_pwrseq_set_power(device_t dev, bool power_on) +{ + struct mmc_pwrseq_softc *sc; + int rv; + + sc = device_get_softc(dev); + + if (power_on) { + if (sc->ext_clock) { + rv = clk_enable(sc->ext_clock); + if (rv != 0) + return (rv); + } + + if (sc->reset_gpio) { + rv = gpio_pin_set_active(sc->reset_gpio, false); + if (rv != 0) + return (rv); + } + + if (sc->post_power_on_delay_ms) + DELAY(sc->post_power_on_delay_ms * 1000); + } else { + if (sc->reset_gpio) { + rv = gpio_pin_set_active(sc->reset_gpio, true); + if (rv != 0) + return (rv); + } + + if (sc->ext_clock) { + rv = clk_stop(sc->ext_clock); + if (rv != 0) + return (rv); + } + if (sc->power_off_delay_us) + DELAY(sc->power_off_delay_us); + } + + return (0); +} + +static device_method_t mmc_pwrseq_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, mmc_pwrseq_probe), + DEVMETHOD(device_attach, mmc_pwrseq_attach), + DEVMETHOD(device_detach, mmc_pwrseq_detach), + + DEVMETHOD(mmc_pwrseq_set_power, mmv_pwrseq_set_power), + DEVMETHOD_END +}; + +static driver_t mmc_pwrseq_driver = { + "mmc_pwrseq", + mmc_pwrseq_methods, + sizeof(struct mmc_pwrseq_softc), +}; + +static devclass_t mmc_pwrseq_devclass; + +EARLY_DRIVER_MODULE(mmc_pwrseq, simplebus, mmc_pwrseq_driver, mmc_pwrseq_devclass, 0, 0, + BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_FIRST); +MODULE_VERSION(mmc_pwrseq, 1); +SIMPLEBUS_PNP_INFO(compat_data); diff --git a/sys/dev/mmc/mmc_pwrseq_if.m b/sys/dev/mmc/mmc_pwrseq_if.m new file mode 100644 index 000000000000..e94b44052c20 --- /dev/null +++ b/sys/dev/mmc/mmc_pwrseq_if.m @@ -0,0 +1,38 @@ +#- +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Emmanuel Vadot +# +# 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. +# +# $FreeBSD$ +# + +INTERFACE mmc_pwrseq; + +# +# Power up/down the card +# +METHOD int set_power { + device_t bus; + bool power_on; +}; From owner-dev-commits-src-all@freebsd.org Fri May 21 16:04:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DAB136364EF; Fri, 21 May 2021 16:04: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 4FmryR3pX8z3JNS; Fri, 21 May 2021 16:04: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 5B6B514603; Fri, 21 May 2021 16:04: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 14LG4FNh005089; Fri, 21 May 2021 16:04:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LG4F4q005088; Fri, 21 May 2021 16:04:15 GMT (envelope-from git) Date: Fri, 21 May 2021 16:04:15 GMT Message-Id: <202105211604.14LG4F4q005088@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: b0387990a784 - main - mmc_fdt_helpers: Parse the optional pwrseq element. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b0387990a784050ef3a14ea49cb513b5eb737844 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 16:04:16 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=b0387990a784050ef3a14ea49cb513b5eb737844 commit b0387990a784050ef3a14ea49cb513b5eb737844 Author: Emmanuel Vadot AuthorDate: 2021-05-16 12:50:10 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-21 15:36:58 +0000 mmc_fdt_helpers: Parse the optional pwrseq element. If a sd/emmc node have a pwrseq property parse it and get the corresponding driver. This can later be used to powerup/powerdown the SDIO card or eMMC. Sponsored by: Diablotin Systems Differential Revision: https://reviews.freebsd.org/D30289 --- sys/dev/mmc/mmc_fdt_helpers.c | 8 ++++++++ sys/dev/mmc/mmc_fdt_helpers.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/sys/dev/mmc/mmc_fdt_helpers.c b/sys/dev/mmc/mmc_fdt_helpers.c index 7dff3851883b..e544f3c4ac08 100644 --- a/sys/dev/mmc/mmc_fdt_helpers.c +++ b/sys/dev/mmc/mmc_fdt_helpers.c @@ -100,6 +100,7 @@ mmc_fdt_parse(device_t dev, phandle_t node, struct mmc_fdt_helper *helper, struct mmc_host *host) { uint32_t bus_width; + phandle_t pwrseq_xref; if (node <= 0) node = ofw_bus_get_node(dev); @@ -181,6 +182,13 @@ mmc_fdt_parse(device_t dev, phandle_t node, struct mmc_fdt_helper *helper, host->caps |= MMC_CAP_SIGNALING_330; #endif + if (OF_hasprop(node, "mmc-pwrseq")) { + if (OF_getencprop(node, "mmc-pwrseq", &pwrseq_xref, sizeof(pwrseq_xref)) == -1) { + device_printf(dev, "Cannot get the pwrseq_xref property\n"); + return (ENXIO); + } + helper->mmc_pwrseq = OF_device_from_xref(pwrseq_xref); + } return (0); } diff --git a/sys/dev/mmc/mmc_fdt_helpers.h b/sys/dev/mmc/mmc_fdt_helpers.h index 73ec324d6b9f..c6e2175690ee 100644 --- a/sys/dev/mmc/mmc_fdt_helpers.h +++ b/sys/dev/mmc/mmc_fdt_helpers.h @@ -63,6 +63,8 @@ struct mmc_fdt_helper { regulator_t vmmc_supply; regulator_t vqmmc_supply; #endif + + device_t mmc_pwrseq; }; typedef void (*mmc_fdt_cd_handler)(device_t dev, bool present); From owner-dev-commits-src-all@freebsd.org Fri May 21 16:04:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2C7F2636629; Fri, 21 May 2021 16:04: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 4FmryV6l4xz3JWn; Fri, 21 May 2021 16:04: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 B3C4114376; Fri, 21 May 2021 16:04: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 14LG4I9A005159; Fri, 21 May 2021 16:04:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LG4IAo005158; Fri, 21 May 2021 16:04:18 GMT (envelope-from git) Date: Fri, 21 May 2021 16:04:18 GMT Message-Id: <202105211604.14LG4IAo005158@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: ce41765c21ac - main - mmc: dwmmc: Call mmc_fdt_set_power MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ce41765c21ac56a37c60a0e8cd227ee3396740cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 16:04:19 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=ce41765c21ac56a37c60a0e8cd227ee3396740cc commit ce41765c21ac56a37c60a0e8cd227ee3396740cc Author: Emmanuel Vadot AuthorDate: 2021-05-16 14:20:42 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-21 15:38:35 +0000 mmc: dwmmc: Call mmc_fdt_set_power This allow us to powerup/down the card and enabling/disabling the regulators if any. Sponsored by: Diablotin Systems Differential Revision: https://reviews.freebsd.org/D30292 --- sys/dev/mmc/host/dwmmc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/mmc/host/dwmmc.c b/sys/dev/mmc/host/dwmmc.c index f28d842bd801..145b7fe17f09 100644 --- a/sys/dev/mmc/host/dwmmc.c +++ b/sys/dev/mmc/host/dwmmc.c @@ -892,6 +892,8 @@ dwmmc_update_ios(device_t brdev, device_t reqdev) dprintf("Setting up clk %u bus_width %d, timming: %d\n", ios->clock, ios->bus_width, ios->timing); + mmc_fdt_set_power(&sc->mmc_helper, ios->power_mode); + if (ios->bus_width == bus_width_8) WRITE4(sc, SDMMC_CTYPE, SDMMC_CTYPE_8BIT); else if (ios->bus_width == bus_width_4) From owner-dev-commits-src-all@freebsd.org Fri May 21 16:04:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 91D4763627E; Fri, 21 May 2021 16: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 4FmryT1LbYz3JTl; Fri, 21 May 2021 16: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 7D6C414585; Fri, 21 May 2021 16: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 14LG4G86005110; Fri, 21 May 2021 16: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 14LG4GII005109; Fri, 21 May 2021 16:04:16 GMT (envelope-from git) Date: Fri, 21 May 2021 16:04:16 GMT Message-Id: <202105211604.14LG4GII005109@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 182717da8880 - main - arm64: allwinner: axp81x: Add support for regnode_status MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 182717da888023a8d0d1a66d579b5a5429b8681d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 16:04:17 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=182717da888023a8d0d1a66d579b5a5429b8681d commit 182717da888023a8d0d1a66d579b5a5429b8681d Author: Emmanuel Vadot AuthorDate: 2021-05-16 14:14:47 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-21 15:37:37 +0000 arm64: allwinner: axp81x: Add support for regnode_status This method is used to know if a regulator is enabled or not. Sponsored by: Diablotin Systems Differential Revision: https://reviews.freebsd.org/D30290 --- sys/arm/allwinner/axp81x.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sys/arm/allwinner/axp81x.c b/sys/arm/allwinner/axp81x.c index 85971a7773c4..df083ec49e32 100644 --- a/sys/arm/allwinner/axp81x.c +++ b/sys/arm/allwinner/axp81x.c @@ -850,6 +850,22 @@ axp8xx_regnode_voltage_to_reg(struct axp8xx_reg_sc *sc, int min_uvolt, return (0); } +static int +axp8xx_regnode_status(struct regnode *regnode, int *status) +{ + struct axp8xx_reg_sc *sc; + uint8_t val; + + sc = regnode_get_softc(regnode); + + *status = 0; + axp8xx_read(sc->base_dev, sc->def->enable_reg, &val, 1); + if (val & sc->def->enable_mask) + *status = REGULATOR_STATUS_ENABLED; + + return (0); +} + static int axp8xx_regnode_set_voltage(struct regnode *regnode, int min_uvolt, int max_uvolt, int *udelay) @@ -899,6 +915,7 @@ static regnode_method_t axp8xx_regnode_methods[] = { /* Regulator interface */ REGNODEMETHOD(regnode_init, axp8xx_regnode_init), REGNODEMETHOD(regnode_enable, axp8xx_regnode_enable), + REGNODEMETHOD(regnode_status, axp8xx_regnode_status), REGNODEMETHOD(regnode_set_voltage, axp8xx_regnode_set_voltage), REGNODEMETHOD(regnode_get_voltage, axp8xx_regnode_get_voltage), REGNODEMETHOD(regnode_check_voltage, regnode_method_check_voltage), From owner-dev-commits-src-all@freebsd.org Fri May 21 16:04:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 274526364F7; Fri, 21 May 2021 16:04:18 +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 4FmryT623Xz3JWg; Fri, 21 May 2021 16: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 98F7B1454C; Fri, 21 May 2021 16: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 14LG4HrS005138; Fri, 21 May 2021 16: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 14LG4HsE005137; Fri, 21 May 2021 16:04:17 GMT (envelope-from git) Date: Fri, 21 May 2021 16:04:17 GMT Message-Id: <202105211604.14LG4HsE005137@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 03d4e8bb6592 - main - mmc_fdt_helper: Add mmc_fdt_set_power MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 03d4e8bb6592fefab7b17f1d163adba4e35a12c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 16:04:18 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=03d4e8bb6592fefab7b17f1d163adba4e35a12c2 commit 03d4e8bb6592fefab7b17f1d163adba4e35a12c2 Author: Emmanuel Vadot AuthorDate: 2021-05-16 14:18:46 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-21 15:38:05 +0000 mmc_fdt_helper: Add mmc_fdt_set_power This helper can be used to enable/disable the regulator and starting the power sequence of sd/sdio/eMMC cards. Sponsored by: Diablotin Systems Differential Revision: https://reviews.freebsd.org/D30291 --- sys/dev/mmc/mmc_fdt_helpers.c | 42 ++++++++++++++++++++++++++++++++++++++++++ sys/dev/mmc/mmc_fdt_helpers.h | 1 + 2 files changed, 43 insertions(+) diff --git a/sys/dev/mmc/mmc_fdt_helpers.c b/sys/dev/mmc/mmc_fdt_helpers.c index e544f3c4ac08..4e8a1730d240 100644 --- a/sys/dev/mmc/mmc_fdt_helpers.c +++ b/sys/dev/mmc/mmc_fdt_helpers.c @@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$"); #include #endif +#include "mmc_pwrseq_if.h" + static inline void mmc_fdt_parse_sd_speed(phandle_t node, struct mmc_host *host) { @@ -423,3 +425,43 @@ mmc_fdt_gpio_get_readonly(struct mmc_fdt_helper *helper) return (pinstate ^ (helper->props & MMC_PROP_WP_INVERTED)); } + +void +mmc_fdt_set_power(struct mmc_fdt_helper *helper, enum mmc_power_mode power_mode) +{ + int reg_status; + int rv; + + switch (power_mode) { + case power_on: + break; + case power_off: + if (helper->vmmc_supply) { + rv = regulator_status(helper->vmmc_supply, ®_status); + if (rv == 0 && reg_status == REGULATOR_STATUS_ENABLED) + regulator_disable(helper->vmmc_supply); + } + if (helper->vqmmc_supply) { + rv = regulator_status(helper->vqmmc_supply, ®_status); + if (rv == 0 && reg_status == REGULATOR_STATUS_ENABLED) + regulator_disable(helper->vqmmc_supply); + } + if (helper->mmc_pwrseq) + MMC_PWRSEQ_SET_POWER(helper->mmc_pwrseq, false); + break; + case power_up: + if (helper->vmmc_supply) { + rv = regulator_status(helper->vmmc_supply, ®_status); + if (rv == 0 && reg_status != REGULATOR_STATUS_ENABLED) + regulator_enable(helper->vmmc_supply); + } + if (helper->vqmmc_supply) { + rv = regulator_status(helper->vqmmc_supply, ®_status); + if (rv == 0 && reg_status != REGULATOR_STATUS_ENABLED) + regulator_enable(helper->vqmmc_supply); + } + if (helper->mmc_pwrseq) + MMC_PWRSEQ_SET_POWER(helper->mmc_pwrseq, true); + break; + } +} diff --git a/sys/dev/mmc/mmc_fdt_helpers.h b/sys/dev/mmc/mmc_fdt_helpers.h index c6e2175690ee..e6d6f3fbfd84 100644 --- a/sys/dev/mmc/mmc_fdt_helpers.h +++ b/sys/dev/mmc/mmc_fdt_helpers.h @@ -74,5 +74,6 @@ int mmc_fdt_gpio_setup(device_t dev, phandle_t node, struct mmc_fdt_helper *help void mmc_fdt_gpio_teardown(struct mmc_fdt_helper *helper); bool mmc_fdt_gpio_get_present(struct mmc_fdt_helper *helper); bool mmc_fdt_gpio_get_readonly(struct mmc_fdt_helper *helper); +void mmc_fdt_set_power(struct mmc_fdt_helper *helper, enum mmc_power_mode power_mode); #endif From owner-dev-commits-src-all@freebsd.org Fri May 21 16:04:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 919DB6366B6; Fri, 21 May 2021 16:04: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 4FmryX23DHz3JcQ; Fri, 21 May 2021 16:04: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 DE066144FA; Fri, 21 May 2021 16:04: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 14LG4Jqh005180; Fri, 21 May 2021 16:04:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LG4J7O005179; Fri, 21 May 2021 16:04:19 GMT (envelope-from git) Date: Fri, 21 May 2021 16:04:19 GMT Message-Id: <202105211604.14LG4J7O005179@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: f52072b06da7 - main - extres: regulator: Fix regulator_status for already enable regulators MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f52072b06da761c05dcb636dd1a02dea7214174a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 16:04:20 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=f52072b06da761c05dcb636dd1a02dea7214174a commit f52072b06da761c05dcb636dd1a02dea7214174a Author: Emmanuel Vadot AuthorDate: 2021-05-16 14:21:43 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-21 15:39:07 +0000 extres: regulator: Fix regulator_status for already enable regulators If a regulator hasn't been enable by a driver but is enabled in hardware (most likely enabled by U-Boot), regulator_status will returns that it is enabled and so any call to regulator_disable will panic as it wasn't enabled by one of our drivers. Sponsored by: Diablotin Systems Differential Revision: https://reviews.freebsd.org/D30293 --- sys/dev/extres/regulator/regulator.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/extres/regulator/regulator.c b/sys/dev/extres/regulator/regulator.c index 63b7d116f416..eab79e9dfbc3 100644 --- a/sys/dev/extres/regulator/regulator.c +++ b/sys/dev/extres/regulator/regulator.c @@ -985,6 +985,10 @@ regulator_status(regulator_t reg, int *status) KASSERT(regnode->ref_cnt > 0, ("Attempt to access unreferenced regulator: %s\n", regnode->name)); + if (reg->enable_cnt == 0) { + *status = 0; + return (0); + } REG_TOPO_SLOCK(); rv = regnode_status(regnode, status); REG_TOPO_UNLOCK(); From owner-dev-commits-src-all@freebsd.org Fri May 21 16:04:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A7D5B636575; Fri, 21 May 2021 16:04: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 4FmryZ1lw8z3JZ6; Fri, 21 May 2021 16:04: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 0D415144FB; Fri, 21 May 2021 16:04: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 14LG4KF3005201; Fri, 21 May 2021 16:04:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LG4Klp005200; Fri, 21 May 2021 16:04:20 GMT (envelope-from git) Date: Fri, 21 May 2021 16:04:20 GMT Message-Id: <202105211604.14LG4Klp005200@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 115e71a45714 - main - arm: allwinner: aw_mmc: Check regulators status before enabling/disabling them MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 115e71a4571459e69001b5017ec19532e9d60e1b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 16:04:22 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=115e71a4571459e69001b5017ec19532e9d60e1b commit 115e71a4571459e69001b5017ec19532e9d60e1b Author: Emmanuel Vadot AuthorDate: 2021-05-16 14:24:31 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-21 15:39:47 +0000 arm: allwinner: aw_mmc: Check regulators status before enabling/disabling them Sponsored by: Diablotin Systems Differential Revision: https://reviews.freebsd.org/D30294 --- sys/arm/allwinner/aw_mmc.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/sys/arm/allwinner/aw_mmc.c b/sys/arm/allwinner/aw_mmc.c index f63b41f9b73c..0b3f19aea55f 100644 --- a/sys/arm/allwinner/aw_mmc.c +++ b/sys/arm/allwinner/aw_mmc.c @@ -1285,6 +1285,8 @@ aw_mmc_update_ios(device_t bus, device_t child) struct mmc_ios *ios; unsigned int clock; uint32_t reg, div = 1; + int reg_status; + int rv; sc = device_get_softc(bus); @@ -1310,10 +1312,16 @@ aw_mmc_update_ios(device_t bus, device_t child) if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_CARD)) device_printf(sc->aw_dev, "Powering down sd/mmc\n"); - if (sc->mmc_helper.vmmc_supply) - regulator_disable(sc->mmc_helper.vmmc_supply); - if (sc->mmc_helper.vqmmc_supply) - regulator_disable(sc->mmc_helper.vqmmc_supply); + if (sc->mmc_helper.vmmc_supply) { + rv = regulator_status(sc->mmc_helper.vmmc_supply, ®_status); + if (rv == 0 && reg_status == REGULATOR_STATUS_ENABLED) + regulator_disable(sc->mmc_helper.vmmc_supply); + } + if (sc->mmc_helper.vqmmc_supply) { + rv = regulator_status(sc->mmc_helper.vqmmc_supply, ®_status); + if (rv == 0 && reg_status == REGULATOR_STATUS_ENABLED) + regulator_disable(sc->mmc_helper.vqmmc_supply); + } aw_mmc_reset(sc); break; @@ -1321,10 +1329,16 @@ aw_mmc_update_ios(device_t bus, device_t child) if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_CARD)) device_printf(sc->aw_dev, "Powering up sd/mmc\n"); - if (sc->mmc_helper.vmmc_supply) - regulator_enable(sc->mmc_helper.vmmc_supply); - if (sc->mmc_helper.vqmmc_supply) - regulator_enable(sc->mmc_helper.vqmmc_supply); + if (sc->mmc_helper.vmmc_supply) { + rv = regulator_status(sc->mmc_helper.vmmc_supply, ®_status); + if (rv == 0 && reg_status != REGULATOR_STATUS_ENABLED) + regulator_enable(sc->mmc_helper.vmmc_supply); + } + if (sc->mmc_helper.vqmmc_supply) { + rv = regulator_status(sc->mmc_helper.vqmmc_supply, ®_status); + if (rv == 0 && reg_status != REGULATOR_STATUS_ENABLED) + regulator_enable(sc->mmc_helper.vqmmc_supply); + } aw_mmc_init(sc); break; }; From owner-dev-commits-src-all@freebsd.org Fri May 21 16:04:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5712D636727; Fri, 21 May 2021 16:04: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 4Fmryd2xSPz3JVB; Fri, 21 May 2021 16:04: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 355F01454D; Fri, 21 May 2021 16:04: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 14LG4M2X005222; Fri, 21 May 2021 16:04:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LG4MqJ005221; Fri, 21 May 2021 16:04:22 GMT (envelope-from git) Date: Fri, 21 May 2021 16:04:22 GMT Message-Id: <202105211604.14LG4MqJ005221@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: c99d887ca8c4 - main - dwmmc: Add bus_generic_add_child in the methods MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c99d887ca8c420297d2db335ce56075eb12443aa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 16:04:26 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=c99d887ca8c420297d2db335ce56075eb12443aa commit c99d887ca8c420297d2db335ce56075eb12443aa Author: Emmanuel Vadot AuthorDate: 2021-05-16 15:07:50 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-21 15:40:14 +0000 dwmmc: Add bus_generic_add_child in the methods Otherwise sdiob cannot add it's children. Sponsored by: Diablotin Systems Differential Revision: https://reviews.freebsd.org/D30295 --- sys/dev/mmc/host/dwmmc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/mmc/host/dwmmc.c b/sys/dev/mmc/host/dwmmc.c index 145b7fe17f09..b0e13719928a 100644 --- a/sys/dev/mmc/host/dwmmc.c +++ b/sys/dev/mmc/host/dwmmc.c @@ -1558,6 +1558,8 @@ static device_method_t dwmmc_methods[] = { DEVMETHOD(mmc_sim_get_tran_settings, dwmmc_get_tran_settings), DEVMETHOD(mmc_sim_set_tran_settings, dwmmc_set_tran_settings), DEVMETHOD(mmc_sim_cam_request, dwmmc_cam_request), + + DEVMETHOD(bus_add_child, bus_generic_add_child), #endif DEVMETHOD_END From owner-dev-commits-src-all@freebsd.org Fri May 21 16:42:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 527F163760B for ; Fri, 21 May 2021 16:42:46 +0000 (UTC) (envelope-from mw@semihalf.com) Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fmsps0yk1z3rGB for ; Fri, 21 May 2021 16:42:45 +0000 (UTC) (envelope-from mw@semihalf.com) Received: by mail-qt1-x835.google.com with SMTP id c10so15715290qtx.10 for ; Fri, 21 May 2021 09:42:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=xL4+f1eDR9mvoxSgmtHNM8ZxvRYze4yry2BPswOFyFo=; b=avFkGPt6IoclB8Cn3+IZWCEEpJOnNXazjQd72+/mIwH2SZ/93zqeVxyLq+TAl3B3Im Qu8S/DHTU5bj9DQVKUr0ztnG8F6uieIJQ2Kto6bD+2T5cH+bcu6ZtthsRQK4nR9Rcb1d vJZdBnqbNytPewOA4BbAOWiotRvda78vnhexFlsi6www6zLMGXVd09aW9mD3u4BT5FrH Xt+fYvvp5z/YSrCKNlwzq+JUWRKqdx43cYNoM5PHg3AEyw9bEOK5/is2BBt0z1qDh2hz rrRbK+dzlA+dgO4Ju3ONOvGvNci3RRmIYghrx6xT1SsKY+hT7ZhUyn7x3mDVECG+dAyB 9GbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=xL4+f1eDR9mvoxSgmtHNM8ZxvRYze4yry2BPswOFyFo=; b=fZMXggG9t0ea3ejPs/6dis+92ktDXK6CgN2W7kJG16NF3heybVdLEZ5pOHmI8W8wyM Ie6dJ87ZCW03YGT4dIxSRbxiicOwPodRn37fa+cFjycMsApYoHBviQuSx3gfrQCn4JgJ c9tEyMBRdCXdM3ML3ykQW1n+E3ky6ZBSgMcYvo6fxyza1LkAz6bf+hBPTBYLq4dV+EUi 17Nj4QFFY0fTxAYeikqmlImXu5khtG5jcoLO04QhASsKM8ix3BkKmoX6Ogk4D4dddtHg w5yFyLiv3GhRwRjxt46nVexKMY2qMkcXieAKRpSSqg7KrQqaETvkWJ67dhJHZdL5VOWP gLew== X-Gm-Message-State: AOAM532ZXH+afXeksgV2icZ03bUSefjEy05pxCFFvL2Zdj1vYtKVRQNA zPVDPXsHU17UYzVHA9lbjSY8Ea8NpCobN0WwQtGDwQ== X-Google-Smtp-Source: ABdhPJxFPOxWW9DA7BniEnhfPdPIEu0Ms8IaF/0vnYHxx4y+mBo/qlV0p1rrzlqPKUVCiKnWkq3n+NYzqs3BRVAx2G4= X-Received: by 2002:a05:622a:202:: with SMTP id b2mr11988511qtx.343.1621615363785; Fri, 21 May 2021 09:42:43 -0700 (PDT) MIME-Version: 1.0 References: <202105211334.14LDYqoa004343@gitrepo.freebsd.org> <04F25FD0-7863-4AC1-A257-EF0F1EB90659@freebsd.org> <02078965-24BE-4F23-92D5-5E8E54A0C3E7@freebsd.org> <202105211446.14LEk8kZ009266@slippy.cwsent.com> In-Reply-To: <202105211446.14LEk8kZ009266@slippy.cwsent.com> From: Marcin Wojtas Date: Fri, 21 May 2021 18:42:31 +0200 Message-ID: Subject: Re: git: af949c590bd8 - main - Disable stack gap for ntpd during build. To: Cy Schubert Cc: Jessica Clarke , shawn.webb@hardenedbsd.org, Marcin Wojtas , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" , =?UTF-8?Q?Dawid_G=C3=B3recki?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4Fmsps0yk1z3rGB X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=avFkGPt6; dmarc=none; spf=none (mx1.freebsd.org: domain of mw@semihalf.com has no SPF policy when checking 2607:f8b0:4864:20::835) smtp.mailfrom=mw@semihalf.com X-Spamd-Result: default: False [-3.26 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[semihalf-com.20150623.gappssmtp.com:s=20150623]; FREEFALL_USER(0.00)[mw]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-0.96)[-0.963]; RCVD_TLS_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[semihalf.com]; NEURAL_HAM_LONG(-1.00)[-1.000]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::835:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[semihalf-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_SEVEN(0.00)[8]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::835:from]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::835:from]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 16:42:46 -0000 Hi Cy, pt., 21 maj 2021 o 16:46 Cy Schubert napisa=C5= =82(a): > > In message <02078965-24BE-4F23-92D5-5E8E54A0C3E7@freebsd.org>, Jessica > Clarke w > rites: > > > On 21 May 2021, at 15:11, Marcin Wojtas wrote: > > > > > > Hi Jess > > > > > > pt., 21 maj 2021 o 15:39 Jessica Clarke napisa= =C5=82(a): > > >> > > >> On 21 May 2021, at 14:34, Marcin Wojtas wrote: > > >>> > > >>> The branch main has been updated by mw: > > >>> > > >>> URL: https://cgit.FreeBSD.org/src/commit/?id=3Daf949c590bd8a00a5973= b5875d7e > > 0fa6832ea64a > > >>> > > >>> commit af949c590bd8a00a5973b5875d7e0fa6832ea64a > > >>> Author: Marcin Wojtas > > >>> AuthorDate: 2021-05-21 09:29:22 +0000 > > >>> Commit: Marcin Wojtas > > >>> CommitDate: 2021-05-21 13:33:06 +0000 > > >>> > > >>> Disable stack gap for ntpd during build. > > >>> > > >>> When starting, ntpd calls setrlimit(2) to limit maximum size of i= ts > > >>> stack. The stack limit chosen by ntpd is 200K, so when stack gap > > >>> is enabled, the stack gap is larger than this limit, which result= s > > >>> in ntpd crashing. > > >> > > >> Isn=E2=80=99t the bug that the unusable gap counts as usage? > > >> > > >> Jess > > >> > > > > > > An alternative solution was submitted > > > (https://reviews.freebsd.org/D29832), so that to extend the limit for > > > ntpd, but eventually it was recommended to simple disable the stack > > > gap for it until it's fixed upstream (see the last comment in the > > > linked revision). > > > > That=E2=80=99s my point, there is nothing to =E2=80=9Cfix=E2=80=9D upst= ream. NTPD uses less tha > > n 200K > > of stack, thus it is perfectly reasonable for it to set its limit to th= at. Th > > e > > fact that FreeBSD decides to count an arbitrary, non-deterministic amou= nt of > > additional unusable virtual address space towards that limit is not its= fault > > , > > but a bug in FreeBSD that needs to be fixed as it=E2=80=99s entirely un= reasonable f > > or > > applications to have to account for that. > > This latest problem is not stack gap. It is PIE. > I have to disagree. ntpd does not start because of stack gap, not PIE, even though it may seem like PIE causes this. This is due to the fact that stack gap is disabled if PIE is disabled. Because of that value of sysctl kern.elf64.aslr.stack_gap does not matter when kern.elf64.aslr.pie_enable is set to 0. When pie_enabled is set to 1 and stack gap is enabled, then ntpd fails to start, but when pie_enabled is set to 1 and stack_gap is set to 0, then ntpd starts without any issue. We verified this on FreeBSD-CURRENT snapshot from 2021-05-20. The fact that this is a stack gap issue can be verified using following procedure: 1. Install FreeBSD-CURRENT snapshot from 2021-05-20 using default configuration. 2. On a newly installed system start ntpd. With default configuration it should start successfully. 3. Set sysctl kern.elf64.aslr.pie_enable=3D1 and start ntpd. This time ntpd should fail. An entry indicating that ntpd was killed because of signal 11 should be visible in /var/log/messages. 4. Set sysctl kern.elf64.aslr.stack_gap=3D0 and start ntpd once again. This time ntpd should start even though pie_enable is set to 1. Exact log from the boot it was tested: root@freebsd-ntpd-test:~ # sysctl -a | grep aslr kern.elf32.aslr.stack_gap: 3 kern.elf32.aslr.honor_sbrk: 1 kern.elf32.aslr.pie_enable: 0 kern.elf32.aslr.enable: 0 kern.elf64.aslr.stack_gap: 3 kern.elf64.aslr.honor_sbrk: 1 kern.elf64.aslr.pie_enable: 0 kern.elf64.aslr.enable: 0 vm.aslr_restarts: 0 root@freebsd-ntpd-test:~ # ntpd root@freebsd-ntpd-test:~ # ps aux | grep ntpd root 826 0.0 0.2 22060 6960 - Ss 17:38 0:00.01 ntpd root 828 0.0 0.1 12976 2416 0 S+ 17:38 0:00.00 grep ntpd root@freebsd-ntpd-test:~ # killall ntpd root@freebsd-ntpd-test:~ # ps aux | grep ntpd root 831 0.0 0.1 12976 2416 0 S+ 17:38 0:00.00 grep ntpd root@freebsd-ntpd-test:~ # sysctl kern.elf64.aslr.pie_enable=3D1 kern.elf64.aslr.pie_enable: 0 -> 1 root@freebsd-ntpd-test:~ # ntpd root@freebsd-ntpd-test:~ # ps aux | grep ntpd root 836 0.0 0.1 14128 2452 0 S+ 17:39 0:00.00 grep ntpd root@freebsd-ntpd-test:~ # cat /var/log/messages | tail May 21 17:38:25 freebsd-ntpd-test ntpd[826]: ntpd exiting on signal 15 (Terminated) May 21 17:39:14 freebsd-ntpd-test ntpd[833]: ntpd 4.2.8p15-a (1): Starting May 21 17:39:14 freebsd-ntpd-test ntpd[833]: Command line: ntpd May 21 17:39:14 freebsd-ntpd-test ntpd[833]: ---------------------------------------------------- May 21 17:39:14 freebsd-ntpd-test ntpd[833]: ntp-4 is maintained by Network Time Foundation, May 21 17:39:14 freebsd-ntpd-test ntpd[833]: Inc. (NTF), a non-profit 501(c)(3) public-benefit May 21 17:39:14 freebsd-ntpd-test ntpd[833]: corporation. Support and training for ntp-4 are May 21 17:39:14 freebsd-ntpd-test ntpd[833]: available at https://www.nwtime.org/support May 21 17:39:14 freebsd-ntpd-test ntpd[833]: ---------------------------------------------------- May 21 17:39:14 freebsd-ntpd-test kernel: pid 834 (ntpd), jid 0, uid 0: exited on signal 11 (core dumped) root@freebsd-ntpd-test:~ # sysctl kern.elf64.aslr.stack_gap=3D0 kern.elf64.aslr.stack_gap: 3 -> 0 root@freebsd-ntpd-test:~ # sysctl -a | grep aslr kern.elf32.aslr.stack_gap: 3 kern.elf32.aslr.honor_sbrk: 1 kern.elf32.aslr.pie_enable: 0 kern.elf32.aslr.enable: 0 kern.elf64.aslr.stack_gap: 0 kern.elf64.aslr.honor_sbrk: 1 kern.elf64.aslr.pie_enable: 1 kern.elf64.aslr.enable: 0 vm.aslr_restarts: 1 root@freebsd-ntpd-test:~ # ntpd root@freebsd-ntpd-test:~ # ps aux | grep ntpd root 845 0.0 0.2 22060 6924 - Ss 17:40 0:00.01 ntpd root 847 0.0 0.1 12976 2440 0 S+ 17:40 0:00.00 grep ntpd root@freebsd-ntpd-test:~ # cat /var/log/messages | tail May 21 17:39:14 freebsd-ntpd-test kernel: pid 834 (ntpd), jid 0, uid 0: exited on signal 11 (core dumped) May 21 17:40:52 freebsd-ntpd-test ntpd[844]: ntpd 4.2.8p15-a (1): Starting May 21 17:40:52 freebsd-ntpd-test ntpd[844]: Command line: ntpd May 21 17:40:52 freebsd-ntpd-test ntpd[844]: ---------------------------------------------------- May 21 17:40:52 freebsd-ntpd-test ntpd[844]: ntp-4 is maintained by Network Time Foundation, May 21 17:40:52 freebsd-ntpd-test ntpd[844]: Inc. (NTF), a non-profit 501(c)(3) public-benefit May 21 17:40:52 freebsd-ntpd-test ntpd[844]: corporation. Support and training for ntp-4 are May 21 17:40:52 freebsd-ntpd-test ntpd[844]: available at https://www.nwtime.org/support May 21 17:40:52 freebsd-ntpd-test ntpd[844]: ---------------------------------------------------- May 21 17:40:52 freebsd-ntpd-test ntpd[845]: leapsecond file ('/var/db/ntpd.leap-seconds.list'): stat failed: No such file or directory root@freebsd-ntpd-test:~ # killall ntpd Best regards, Marcin From owner-dev-commits-src-all@freebsd.org Fri May 21 16:51:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 66D9B6376A9; Fri, 21 May 2021 16:51: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 4Fmt1R1Qgwz3vhW; Fri, 21 May 2021 16:51: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 141FA15017; Fri, 21 May 2021 16:51: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 14LGpsHc070316; Fri, 21 May 2021 16:51:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LGpstI070315; Fri, 21 May 2021 16:51:54 GMT (envelope-from git) Date: Fri, 21 May 2021 16:51:54 GMT Message-Id: <202105211651.14LGpstI070315@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: a19e14ca2d36 - main - ldconfig(8): update manpage to reality 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/main X-Git-Reftype: branch X-Git-Commit: a19e14ca2d36aa9d5bd392881abd85bf9e2e89ad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 16:51:55 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a19e14ca2d36aa9d5bd392881abd85bf9e2e89ad commit a19e14ca2d36aa9d5bd392881abd85bf9e2e89ad Author: Konstantin Belousov AuthorDate: 2021-05-15 05:12:35 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-21 16:51:18 +0000 ldconfig(8): update manpage to reality ELF ldconfig only maintains the search list, there is no hints Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30272 --- sbin/ldconfig/ldconfig.8 | 114 +++++++++++++++++++---------------------------- 1 file changed, 47 insertions(+), 67 deletions(-) diff --git a/sbin/ldconfig/ldconfig.8 b/sbin/ldconfig/ldconfig.8 index 9a1463be1ad4..63e2271b7cd5 100644 --- a/sbin/ldconfig/ldconfig.8 +++ b/sbin/ldconfig/ldconfig.8 @@ -1,6 +1,11 @@ .\" .\" Copyright (c) 1993 Paul Kranenburg .\" All rights reserved. +.\" Copyright (c) 2021 The FreeBSD Foundation, Inc. +.\" +.\" Portions of this documentation were written by +.\" Konstantin Belousov under sponsorship +.\" from the FreeBSD Foundation. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -29,36 +34,40 @@ .\" .\" $FreeBSD$ .\" -.Dd December 31, 2020 +.Dd May 15, 2021 .Dt LDCONFIG 8 .Os .Sh NAME .Nm ldconfig -.Nd configure the shared library cache +.Nd configure the dynamic linker search path for shared libraries .Sh SYNOPSIS .Nm .Op Fl 32 -.Op Fl elf .Op Fl Rimrsv .Op Fl f Ar hints_file .Op Ar directory | Ar .Sh DESCRIPTION -The .Nm -utility is used to prepare a set of -.Dq hints -for use by the dynamic linker -to facilitate quick lookup of shared libraries available in multiple -directories. -It scans a set of built-in system directories and any +utility is used to configure the set of paths used by the dynamic linker +.Xr ld-elf.so.1 1 +when searching for shared libraries. +The dynamic linker looks for libraries in a set of built-in system directories +and any directories specified in the hints file. +This obviates the need for storing search paths within the executable, +see the +.Fl rpath +option for the static linker +.Xr ld 1 . +.Pp +The hints file is maintained by +.Nm . +The .Ar directories -specified on the command line (in the given order) looking for -shared libraries and stores the results in a system file to forestall -the overhead that would otherwise result from the directory search -operations the dynamic linker would have to perform to load the -required shared libraries. +list to be stored in the hints file is supplied on the command line. .Pp -Alternatively, +Alternatively to the +.Ar directories +list on the command line, .Ar files may be specified; these are expected to contain directories to scan for shared libraries. @@ -67,9 +76,6 @@ line. Blank lines and lines starting with the comment character .Ql \&# are ignored. -Filenames must conform to the -.Pa lib*.so.[0-9] -pattern in order to be added to the hints file. .Pp For security reasons, directories which are world or group-writable or which are not owned by root produce warning messages and are skipped, unless @@ -77,16 +83,10 @@ the .Fl i option is present. .Pp -The shared libraries which are found will be automatically available for loading -if needed by the program being prepared for execution. -This obviates the need -for storing search paths within the executable. -.Pp The .Ev LD_LIBRARY_PATH -environment variable can be used to override the use of -directories (or the order thereof) from the cache or to specify additional -directories where shared libraries might be found. +environment variable can be used to specify additional +shared library search directories. .Ev LD_LIBRARY_PATH is a .Sq \&: @@ -99,10 +99,6 @@ equivalent of the switch of .Xr ld 1 . .Pp -The -.Nm -utility is typically run as part of the boot sequence. -.Pp The following options are recognized by .Nm : .Bl -tag -width indent @@ -112,12 +108,10 @@ on 64-bit systems that support running 32-bit binaries. .It Fl elf Ignored for backwards compatibility. .It Fl R -Rescan the previously configured directories. -This opens the previous hints -file and fetches the directory list from the header. -Any additional pathnames -on the command line are also processed. -This is the default action when no parameters are given. +Appends pathnames on the command line to the directory list from +the hints file. +.Pp +This is the default action when no options are given. .It Fl f Ar hints_file Read and/or update the specified hints file, instead of the standard file. This option is provided primarily for testing. @@ -125,19 +119,15 @@ This option is provided primarily for testing. Run in insecure mode. The security checks will not be performed. .It Fl m -Instead of replacing the contents of the hints file -with those found in the directories specified, -.Dq merge -in new entries. -Directories recorded in the hints file by previous runs of -.Nm -are also rescanned for new shared libraries. +Instead of replacing the list of the directories to search with the +directories specified on the command line, merge existing list +with the specified directories, and write the result to the hints file. .It Fl r -List the current contents of the hints file +List the current list of the directories from the hints file on the standard output. The hints file is not modified. -The list of -directories stored in the hints file is included. +.Pp +Scan and print all libraries found on the directories list. .It Fl s Do not scan the built-in system directory .Pq Dq /usr/lib @@ -151,40 +141,31 @@ space of .Ev set-user-Id programs. Whenever such a program is run by any user except the owner of the program, -the dynamic linker -will only load shared libraries from the hints -file. +the dynamic linker will only load shared libraries from paths found in +the hints file. In particular, the .Ev LD_LIBRARY_PATH is not used to search for libraries. -Thus, the role of +Thus, .Nm -is dual. -In addition to building a set of hints for quick lookup, it also serves to -specify the trusted collection of directories from which shared objects can -be safely loaded. +serves to specify the trusted collection of directories from which +shared objects can be safely loaded. .Sh FILES .Bl -tag -width /var/run/ld-elf.so.hintsxxx -compact -.It Pa /var/run/ld.so.hints -Standard hints file for the a.out dynamic linker. .It Pa /var/run/ld-elf.so.hints Standard hints file for the ELF dynamic linker. -.It Pa /etc/ld.so.conf -Conventional configuration file containing directory names for -invocations with -.Fl aout . .It Pa /etc/ld-elf.so.conf Conventional configuration file containing directory names for invocations with .Fl elf . .It Pa /var/run/ld-elf32.so.hints -.It Pa /var/run/ld32.so.hints Conventional configuration files containing directory names for invocations with .Fl 32 . .El .Sh SEE ALSO .Xr ld 1 , +.Xr ld-elf.so.1 , .Xr link 5 .Sh HISTORY A @@ -192,8 +173,7 @@ A utility first appeared in SunOS 4.0, it appeared in its current form in .Fx 1.1 . -.Sh BUGS -Some security checks (for example, verifying root ownership of -added directories) are not performed when -.Fl aout -is specified. +.Pp +The name 'hints file' is historic from the times when the file also contained +hints to the dynamic linker. +This functionality is not provided for ELF. From owner-dev-commits-src-all@freebsd.org Fri May 21 17:28:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AA9B0638501; Fri, 21 May 2021 17:28:25 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmtqY499Wz4h07; Fri, 21 May 2021 17:28:25 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 7E5013C0199; Fri, 21 May 2021 17:28:24 +0000 (UTC) Date: Fri, 21 May 2021 17:28:24 +0000 From: Brooks Davis To: Marcin Wojtas Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: af949c590bd8 - main - Disable stack gap for ntpd during build. Message-ID: <20210521172824.GI60173@spindle.one-eyed-alien.net> References: <202105211334.14LDYqoa004343@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="TeJTyD9hb8KJN2Jy" Content-Disposition: inline In-Reply-To: <202105211334.14LDYqoa004343@gitrepo.freebsd.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 4FmtqY499Wz4h07 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 17:28:25 -0000 --TeJTyD9hb8KJN2Jy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 21, 2021 at 01:34:52PM +0000, Marcin Wojtas wrote: > The branch main has been updated by mw: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3Daf949c590bd8a00a5973b5875d= 7e0fa6832ea64a >=20 > commit af949c590bd8a00a5973b5875d7e0fa6832ea64a > Author: Marcin Wojtas > AuthorDate: 2021-05-21 09:29:22 +0000 > Commit: Marcin Wojtas > CommitDate: 2021-05-21 13:33:06 +0000 >=20 > Disable stack gap for ntpd during build. > =20 > When starting, ntpd calls setrlimit(2) to limit maximum size of its > stack. The stack limit chosen by ntpd is 200K, so when stack gap > is enabled, the stack gap is larger than this limit, which results > in ntpd crashing. > =20 > Submitted by: Dawid Gorecki > Reviewed by: cy, imp > Obtained from: Semihalf > Sponsored by: Stormshield > Differential Revision: https://reviews.freebsd.org/D29553 > --- > usr.sbin/ntp/ntpd/Makefile | 3 +++ > 1 file changed, 3 insertions(+) >=20 > diff --git a/usr.sbin/ntp/ntpd/Makefile b/usr.sbin/ntp/ntpd/Makefile > index 2d8a8b9d2a2d..b9c3a05547d4 100644 > --- a/usr.sbin/ntp/ntpd/Makefile > +++ b/usr.sbin/ntp/ntpd/Makefile > @@ -56,4 +56,7 @@ CLEANFILES+=3D .version version.c > version.c: > sh -e ${.CURDIR:H}/scripts/mkver ntpd > =20 > +afterbuild: > + ${ELFCTL} -e +noaslrstkgap ${PROG} > + > .include This is going to run every build and touch the file each time. It should be done as part of the link target like CTFMERGE. elfctl should also probably be taught not to write to the file if nothing changes. -- Brooks --TeJTyD9hb8KJN2Jy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJgp+23AAoJEKzQXbSebgfAUDIH/2csbDpn+XDbQQN4QAi5g/Qw Rqaqv16SytPZHXgTfDqWn7GwZ4POMtbLOEuvmZGwFEY4zSDLprgsjMEHJrtIhhHc zhlWb1Ua7s/ARNMEsZEcIcHKz0hlkCMdWh7xaWkI4uleTvhR6Q1YteqO0NfUPukm fqozGY0/QSipJm4q/e0pQkO2d3bzlcWVpyC0MXlhAZ/HGn2Oz9VecuYvKtcO12Eb P4BDnwkIUtLNwCv/IcP809jWJ1PZoxysiqtScXTjGRpPfBRZBGereOMNhW0ooxBg wjgjgTO1O2Xkb9RvglLLSotb18MsmQwGnFnhkljTc2+MCvOKMvE4GL8wWP55wf4= =VHRt -----END PGP SIGNATURE----- --TeJTyD9hb8KJN2Jy-- From owner-dev-commits-src-all@freebsd.org Fri May 21 17:36:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6D67E6380F9; Fri, 21 May 2021 17:36: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 4Fmv0x2KMMz4lXD; Fri, 21 May 2021 17:36: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 3393F1557F; Fri, 21 May 2021 17:36: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 14LHaXKW023994; Fri, 21 May 2021 17:36:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LHaXQO023993; Fri, 21 May 2021 17:36:33 GMT (envelope-from git) Date: Fri, 21 May 2021 17:36:33 GMT Message-Id: <202105211736.14LHaXQO023993@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 80e645dcdb8d - main - mmc: Only build mmc_fdt_helper and mmc_pwrseq for arch that uses ext_resources MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 80e645dcdb8df280cbbe978f96c49689170eca68 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 17:36:33 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=80e645dcdb8df280cbbe978f96c49689170eca68 commit 80e645dcdb8df280cbbe978f96c49689170eca68 Author: Emmanuel Vadot AuthorDate: 2021-05-21 17:35:20 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-21 17:35:20 +0000 mmc: Only build mmc_fdt_helper and mmc_pwrseq for arch that uses ext_resources This is now a needed requirement and fixes powerpc* build --- sys/conf/files | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 70cdd9f68dc6..9b67200b3c91 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -2475,9 +2475,9 @@ dev/mmc/mmc.c optional mmc !mmccam dev/mmc/mmcbr_if.m standard dev/mmc/mmcbus_if.m standard dev/mmc/mmcsd.c optional mmcsd !mmccam -dev/mmc/mmc_fdt_helpers.c optional mmc fdt | mmccam fdt -dev/mmc/mmc_pwrseq.c optional mmc fdt | mmccam fdt -dev/mmc/mmc_pwrseq_if.m optional mmc fdt | mmccam fdt +dev/mmc/mmc_fdt_helpers.c optional ext_resources mmc fdt | ext_resources mmccam fdt +dev/mmc/mmc_pwrseq.c optional ext_resources mmc fdt | ext_resources mmccam fdt +dev/mmc/mmc_pwrseq_if.m optional ext_resources mmc fdt | ext_resources mmccam fdt dev/mmcnull/mmcnull.c optional mmcnull dev/mpr/mpr.c optional mpr dev/mpr/mpr_config.c optional mpr From owner-dev-commits-src-all@freebsd.org Fri May 21 17:53:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CE34F638BE5; Fri, 21 May 2021 17:53:57 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FmvP12DPkz4v8P; Fri, 21 May 2021 17:53:57 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.66.148.124]) by shaw.ca with ESMTPA id k9LNlIwztMrQqk9LOlAhas; Fri, 21 May 2021 11:53:55 -0600 X-Authority-Analysis: v=2.4 cv=Nv6yz+RJ c=1 sm=1 tr=0 ts=60a7f3b3 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=8nJEP1OIZ-IA:10 a=5FLXtPjwQuUA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=oCJs8q-oAAAA:8 a=EkcXrb_YAAAA:8 a=ZEWdpI7IREN6c40-odoA:9 a=wPNLvfGTeEIA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 a=qUF70SbvcHBaGhGVny9j:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id F104E1E5; Fri, 21 May 2021 10:53:51 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 14LHrpAN004663; Fri, 21 May 2021 10:53:51 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202105211753.14LHrpAN004663@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Marcin Wojtas cc: Cy Schubert , Jessica Clarke , shawn.webb@hardenedbsd.org, Marcin Wojtas , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" , =?UTF-8?Q?Dawid_G=C3=B3recki?= Subject: Re: git: af949c590bd8 - main - Disable stack gap for ntpd during build. In-reply-to: References: <202105211334.14LDYqoa004343@gitrepo.freebsd.org> <04F25FD0-7863-4AC1-A257-EF0F1EB90659@freebsd.org> <02078965-24BE-4F23-92D5-5E8E54A0C3E7@freebsd.org> <202105211446.14LEk8kZ009266@slippy.cwsent.com> Comments: In-reply-to Marcin Wojtas message dated "Fri, 21 May 2021 18:42:31 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: Fri, 21 May 2021 10:53:51 -0700 X-CMAE-Envelope: MS4xfEgYXFa9V04gso1yKnFvwL1O9dbQnSXXmT7touAA2JRX63WY996JJfiguRBuN9sbkyjMMS7kqk84SvjqEYgH87VvnD5uTDg/FdtLkZC7AVo0xivojVC8 sHkeEIp8JDBhWLVGUOsja6v+vweRGFNIzPHYOYdQpI84GhYtYM3X5F8uhr+WleSmLjSmlm2zg3q4GFkfVfXNt2zGl9uzkFPaox5zM9jQLP4Hur7vlBxP81jD /SJHn4LrYRRYcew99l9pGAXAS/DD/8Kz4AAxiZIv0rTmF/ni7li5jVzzHAgW/k/4OqUCL5SOKOhjwWAElUKd71VjyaOx8uGDgcJWloty6AILHOq4neiGB5FK pFwG44PJ9y02f/DZ7QGtNqdqfvSTHNQ/bQxk4vnDSViVLSIanu2K2M80rBo7T+h5AdAy0bC5xzqZkNJU3S1URwFwA200tg== X-Rspamd-Queue-Id: 4FmvP12DPkz4v8P X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 17:53:57 -0000 In message , Marcin Wojtas writes: > Hi Cy, > > pt., 21 maj 2021 o 16:46 Cy Schubert napisał(a): > > > > In message <02078965-24BE-4F23-92D5-5E8E54A0C3E7@freebsd.org>, Jessica > > Clarke w > > rites: > > > > On 21 May 2021, at 15:11, Marcin Wojtas wrote: > > > > > > > > Hi Jess > > > > > > > > pt., 21 maj 2021 o 15:39 Jessica Clarke napisał(a > ): > > > >> > > > >> On 21 May 2021, at 14:34, Marcin Wojtas wrote: > > > >>> > > > >>> The branch main has been updated by mw: > > > >>> > > > >>> URL: https://cgit.FreeBSD.org/src/commit/?id=af949c590bd8a00a5973b587 > 5d7e > > > 0fa6832ea64a > > > >>> > > > >>> commit af949c590bd8a00a5973b5875d7e0fa6832ea64a > > > >>> Author: Marcin Wojtas > > > >>> AuthorDate: 2021-05-21 09:29:22 +0000 > > > >>> Commit: Marcin Wojtas > > > >>> CommitDate: 2021-05-21 13:33:06 +0000 > > > >>> > > > >>> Disable stack gap for ntpd during build. > > > >>> > > > >>> When starting, ntpd calls setrlimit(2) to limit maximum size of its > > > >>> stack. The stack limit chosen by ntpd is 200K, so when stack gap > > > >>> is enabled, the stack gap is larger than this limit, which results > > > >>> in ntpd crashing. > > > >> > > > >> Isn’t the bug that the unusable gap counts as usage? > > > >> > > > >> Jess > > > >> > > > > > > > > An alternative solution was submitted > > > > (https://reviews.freebsd.org/D29832), so that to extend the limit for > > > > ntpd, but eventually it was recommended to simple disable the stack > > > > gap for it until it's fixed upstream (see the last comment in the > > > > linked revision). > > > > > > That’s my point, there is nothing to “fix” upstream. NTPD uses less > tha > > > n 200K > > > of stack, thus it is perfectly reasonable for it to set its limit to that > . Th > > > e > > > fact that FreeBSD decides to count an arbitrary, non-deterministic amount > of > > > additional unusable virtual address space towards that limit is not its f > ault > > > , > > > but a bug in FreeBSD that needs to be fixed as it’s entirely unreasonab > le f > > > or > > > applications to have to account for that. > > > > This latest problem is not stack gap. It is PIE. > > > > I have to disagree. We are talking cross purposes. Your examples later on in your email prove my point. > ntpd does not start because of stack gap, not PIE, even though it may > seem like PIE causes this. This is due to the fact that stack gap is > disabled if PIE is disabled. Because of that value of sysctl > kern.elf64.aslr.stack_gap does not matter when kern.elf64.aslr.pie_enable > is set to 0. When pie_enabled is set to 1 and stack gap is enabled, then > ntpd fails to start, but when pie_enabled is set to 1 and stack_gap > is set to 0, then ntpd starts without any issue. We verified this on > FreeBSD-CURRENT snapshot from 2021-05-20. I verified the PIE problem on a -CURRENT as of my comments in the review. Enabling stack gap and disabling PIE resolved the issue. The reason for stack gap is not a problem is that ntpd disables stack gap at line 441 of ntpd.c. Furthermore enabling stack gap and disabling PIE circumvents the problem. I tested this myself and left that note in the review. Enable stack gap and disable PIE: It works. But look at line 441 of ntpd.c to see stack gap disabled before ntpd forks itself. > > The fact that this is a stack gap issue can be verified using following > procedure: > 1. Install FreeBSD-CURRENT snapshot from 2021-05-20 using default > configuration. > 2. On a newly installed system start ntpd. With default configuration > it should start successfully. > 3. Set sysctl kern.elf64.aslr.pie_enable=1 and start ntpd. This time ntpd > should fail. An entry indicating that ntpd was killed because of signal > 11 should be visible in /var/log/messages. > 4. Set sysctl kern.elf64.aslr.stack_gap=0 and start ntpd once again. This > time ntpd should start even though pie_enable is set to 1. > > Exact log from the boot it was tested: > root@freebsd-ntpd-test:~ # sysctl -a | grep aslr > kern.elf32.aslr.stack_gap: 3 > kern.elf32.aslr.honor_sbrk: 1 > kern.elf32.aslr.pie_enable: 0 > kern.elf32.aslr.enable: 0 > kern.elf64.aslr.stack_gap: 3 > kern.elf64.aslr.honor_sbrk: 1 > kern.elf64.aslr.pie_enable: 0 > kern.elf64.aslr.enable: 0 > vm.aslr_restarts: 0 > root@freebsd-ntpd-test:~ # ntpd > root@freebsd-ntpd-test:~ # ps aux | grep ntpd > root 826 0.0 0.2 22060 6960 - Ss 17:38 0:00.01 ntpd > root 828 0.0 0.1 12976 2416 0 S+ 17:38 0:00.00 grep ntpd > root@freebsd-ntpd-test:~ # killall ntpd > root@freebsd-ntpd-test:~ # ps aux | grep ntpd > root 831 0.0 0.1 12976 2416 0 S+ 17:38 0:00.00 grep ntpd > root@freebsd-ntpd-test:~ # sysctl kern.elf64.aslr.pie_enable=1 > kern.elf64.aslr.pie_enable: 0 -> 1 This causes the problem. > root@freebsd-ntpd-test:~ # ntpd > root@freebsd-ntpd-test:~ # ps aux | grep ntpd > root 836 0.0 0.1 14128 2452 0 S+ 17:39 0:00.00 grep ntpd > root@freebsd-ntpd-test:~ # cat /var/log/messages | tail > May 21 17:38:25 freebsd-ntpd-test ntpd[826]: ntpd exiting on signal 15 > (Terminated) > May 21 17:39:14 freebsd-ntpd-test ntpd[833]: ntpd 4.2.8p15-a (1): Starting > May 21 17:39:14 freebsd-ntpd-test ntpd[833]: Command line: ntpd > May 21 17:39:14 freebsd-ntpd-test ntpd[833]: > ---------------------------------------------------- > May 21 17:39:14 freebsd-ntpd-test ntpd[833]: ntp-4 is maintained by > Network Time Foundation, > May 21 17:39:14 freebsd-ntpd-test ntpd[833]: Inc. (NTF), a non-profit > 501(c)(3) public-benefit > May 21 17:39:14 freebsd-ntpd-test ntpd[833]: corporation. Support and > training for ntp-4 are > May 21 17:39:14 freebsd-ntpd-test ntpd[833]: available at > https://www.nwtime.org/support > May 21 17:39:14 freebsd-ntpd-test ntpd[833]: > ---------------------------------------------------- > May 21 17:39:14 freebsd-ntpd-test kernel: pid 834 (ntpd), jid 0, uid > 0: exited on signal 11 (core dumped) > root@freebsd-ntpd-test:~ # sysctl kern.elf64.aslr.stack_gap=0 > kern.elf64.aslr.stack_gap: 3 -> 0 > root@freebsd-ntpd-test:~ # sysctl -a | grep aslr > kern.elf32.aslr.stack_gap: 3 > kern.elf32.aslr.honor_sbrk: 1 > kern.elf32.aslr.pie_enable: 0 > kern.elf32.aslr.enable: 0 > kern.elf64.aslr.stack_gap: 0 > kern.elf64.aslr.honor_sbrk: 1 > kern.elf64.aslr.pie_enable: 1 This is the problem. > kern.elf64.aslr.enable: 0 > vm.aslr_restarts: 1 > root@freebsd-ntpd-test:~ # ntpd > root@freebsd-ntpd-test:~ # ps aux | grep ntpd > root 845 0.0 0.2 22060 6924 - Ss 17:40 0:00.01 ntpd > root 847 0.0 0.1 12976 2440 0 S+ 17:40 0:00.00 grep ntpd > root@freebsd-ntpd-test:~ # cat /var/log/messages | tail > May 21 17:39:14 freebsd-ntpd-test kernel: pid 834 (ntpd), jid 0, uid > 0: exited on signal 11 (core dumped) > May 21 17:40:52 freebsd-ntpd-test ntpd[844]: ntpd 4.2.8p15-a (1): Starting > May 21 17:40:52 freebsd-ntpd-test ntpd[844]: Command line: ntpd > May 21 17:40:52 freebsd-ntpd-test ntpd[844]: > ---------------------------------------------------- > May 21 17:40:52 freebsd-ntpd-test ntpd[844]: ntp-4 is maintained by > Network Time Foundation, > May 21 17:40:52 freebsd-ntpd-test ntpd[844]: Inc. (NTF), a non-profit > 501(c)(3) public-benefit > May 21 17:40:52 freebsd-ntpd-test ntpd[844]: corporation. Support and > training for ntp-4 are > May 21 17:40:52 freebsd-ntpd-test ntpd[844]: available at > https://www.nwtime.org/support > May 21 17:40:52 freebsd-ntpd-test ntpd[844]: > ---------------------------------------------------- > May 21 17:40:52 freebsd-ntpd-test ntpd[845]: leapsecond file > ('/var/db/ntpd.leap-seconds.list'): stat failed: No such file or > directory > root@freebsd-ntpd-test:~ # killall ntpd > > Best regards, > Marcin Running on my firewall, which has had this same ASLR configuration for about a year. cwfw# sysctl kern.elf64.aslr kern.elf64.aslr.stack_gap: 3 kern.elf64.aslr.honor_sbrk: 1 kern.elf64.aslr.pie_enable: 0 kern.elf64.aslr.enable: 1 cwfw# ps auxww | grep ntpd ntpd 1499 0.0 0.1 22044 5776 - Ss 09:30 0:00.28 /usr/sbin/ntpd -p /var/db/ntp/ntpd.pid -c /etc/ntp.conf -f /var/db/ntp/ntpd.drift -g root 3032 0.0 0.0 13044 2384 0 S+ 10:49 0:00.00 grep ntpd cwfw# uptime 10:49AM up 1:20, 1 user, load averages: 1.06, 1.02, 0.97 cwfw# uname -a FreeBSD cwfw 14.0-CURRENT FreeBSD 14.0-CURRENT #151 komquats-n246804-af949c590bd8-dirty: Fri May 21 07:09:32 PDT 2021 root@cwsys:/export/obj/opt/src/git-src/amd64.amd64/sys/PROD2 amd64 cwfw# My laptop: slippy# sysctl kern.elf64.aslr kern.elf64.aslr.stack_gap: 3 kern.elf64.aslr.honor_sbrk: 1 kern.elf64.aslr.pie_enable: 0 kern.elf64.aslr.enable: 1 slippy# ps auxww | grep ntpd ntpd 2100 0.0 0.1 22036 8600 - Ss 09:35 0:00.27 /usr/sbin/ntpd -p /var/db/ntp/ntpd.pid -c /etc/ntp.conf -f /var/db/ntp/ntpd.drift -g root 4632 0.0 0.0 13040 2724 1 S+ 10:51 0:00.00 grep ntpd slippy# uptime 10:51AM up 1:17, 0 users, load averages: 0.11, 0.16, 0.16 slippy# uname -a FreeBSD slippy 14.0-CURRENT FreeBSD 14.0-CURRENT #155 komquats-n246804-af949c590bd8-dirty: Fri May 21 07:07:22 PDT 2021 root@cwsys:/export/obj/opt/src/git-src/amd64.amd64/sys/BREAK amd64 slippy# One of my poudriere machines: cwsys# sysctl kern.elf64.aslr kern.elf64.aslr.stack_gap: 3 kern.elf64.aslr.honor_sbrk: 1 kern.elf64.aslr.pie_enable: 0 kern.elf64.aslr.enable: 1 cwsys# ps auxww | grep ntpd ntpd 4039 0.0 0.1 22040 7340 - Ss 09:34 0:00.46 /usr/sbin/ntpd -p /var/db/ntp/ntpd.pid -c /etc/ntp.conf -f /var/db/ntp/ntpd.drift -g root 6385 0.0 0.0 13044 2712 2 S+ 10:52 0:00.01 grep ntpd cwsys# uptime 10:52AM up 1:19, 2 users, load averages: 0.26, 0.25, 0.24 cwsys# uname -a FreeBSD cwsys 14.0-CURRENT FreeBSD 14.0-CURRENT #155 komquats-n246804-af949c590bd8-dirty: Fri May 21 07:07:22 PDT 2021 root@cwsys:/export/obj/opt/src/git-src/amd64.amd64/sys/BREAK amd64 cwsys# Three examples of stack gap enabled and PIE disabled. When I enable PIE, ntpd fails. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-all@freebsd.org Fri May 21 18:50:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 93A266398C0; Fri, 21 May 2021 18:50:59 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fmwfq3JGxz3pjR; Fri, 21 May 2021 18:50:59 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt1-x82a.google.com with SMTP id m13so15998826qtk.13; Fri, 21 May 2021 11:50:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TOGmC3E9/OdBAAd6wXGZ/sTfMHJGtfGsSiuBncBhl9g=; b=e4K5Hxm/JwOunU6QioxjCV2Owm2bCs/aapPMpXOUjxSev+hBrMDYRldkiNuKg4UcfD iyvw9aq7TLgf3DI4VZ0otbq0PIWH6FzHjIxey6B6Xrl2A09Jz4QfgVR0YfvplOKbk4wF g9VelyLPf4VAcYhIBWyQFJ4fD47l/YGi3EAc2qjqdUbiy5nEFtHlcvLevtgiNjPxUwVv IgSzxGm7JIDtmJRFHXymuGxD5lgdyGsJVBCJDQOtaAVRfqN86gVlpPlYadufWXPcJm/2 Qeuhsnw6rrWSYmOj8PLErM6GFwc3xygqdkQ1W5b97l7Mxqhk8VIsswLEJVNV7NM6RlNq GI5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=TOGmC3E9/OdBAAd6wXGZ/sTfMHJGtfGsSiuBncBhl9g=; b=fTzVMj6GlICVnl48U4DFWX7AJ0jumesgTJ/TcCgkndQf9xQI2fJD11o2neDww6x8uu o5qtMHeS8/q4ji+Llcxtq1B+mug1DUqIhgNwq9lKtTy2l+bQGDpHyey/r4J+6M5h/ruM t6gvFGDA/NtAn1WV8nzJp4kTpJN+snT8X1cdWrxIykHKA4DaUx7/BLSfTHAYiruOCRcs a//FArKJcgNAxGrKuca/CxRrxLhKgG20ZtB2tPb+t/jBDKJfQ5ZCBOfPK3a//kC2CySe +hidqPjDJmxDLNAT6xEUxnQ9yATCtT8+xd8p1G/44UXRE7cPo99jD4gsGihPQkWKOUoh hVcQ== X-Gm-Message-State: AOAM531A/zIh83a0EAhRfLpZMJqePR/BafQyiOvGcD5pA2j8cQgz38RD RMSIhX+WnGxaFMw8HexDq7zCN3YnWn8Tnw== X-Google-Smtp-Source: ABdhPJxS6f3vs16PHmGgQ74C2VY1YJ4k5AAx9sUJwOfoM/m48Mx49G/Um01Fn+PqGb5rAY5rYkugvw== X-Received: by 2002:a05:622a:202:: with SMTP id b2mr12583644qtx.343.1621623058335; Fri, 21 May 2021 11:50:58 -0700 (PDT) Received: from nuc ([142.126.172.178]) by smtp.gmail.com with ESMTPSA id c9sm5885463qke.8.2021.05.21.11.50.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 11:50:57 -0700 (PDT) Sender: Mark Johnston Date: Fri, 21 May 2021 14:50:57 -0400 From: Mark Johnston To: Richard Scheffenegger Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 032bf749fd44 - main - [tcp] Keep socket buffer locked until upcall Message-ID: References: <202105210908.14L98fTa045092@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202105210908.14L98fTa045092@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4Fmwfq3JGxz3pjR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 18:50:59 -0000 On Fri, May 21, 2021 at 09:08:41AM +0000, Richard Scheffenegger wrote: > The branch main has been updated by rscheff: > > URL: https://cgit.FreeBSD.org/src/commit/?id=032bf749fd44ac5ff20aab2c3d8e3c05491778ea > > commit 032bf749fd44ac5ff20aab2c3d8e3c05491778ea > Author: Richard Scheffenegger > AuthorDate: 2021-05-21 09:00:53 +0000 > Commit: Richard Scheffenegger > CommitDate: 2021-05-21 09:07:51 +0000 > > [tcp] Keep socket buffer locked until upcall > > r367492 would unlock the socket buffer before eventually calling the upcall. > This leads to problematic interaction with NFS kernel server/client components > (MP threads) accessing the socket buffer with potentially not correctly updated > state. The RACK change at least appears to have introduced a bug: https://syzkaller.appspot.com/bug?id=d7abacdaf60c556dbfa05f15f460cd7174e974ba https://syzkaller.appspot.com/bug?id=650a391473e34b753b280db1c9c97918d23c6cdb From owner-dev-commits-src-all@freebsd.org Fri May 21 19:40:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CE07063A4FA; Fri, 21 May 2021 19:40: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 4Fmxlv5VpGz4g8l; Fri, 21 May 2021 19:40: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 966961731C; Fri, 21 May 2021 19:40: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 14LJeRqP091575; Fri, 21 May 2021 19:40:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LJeRaL091574; Fri, 21 May 2021 19:40:27 GMT (envelope-from git) Date: Fri, 21 May 2021 19:40:27 GMT Message-Id: <202105211940.14LJeRaL091574@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: fdbc86cf7978 - main - bhyve/snapshot: split up mutex/cond initialization from socket creation 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/main X-Git-Reftype: branch X-Git-Commit: fdbc86cf79784f56fab8115f2d565962e1111b2e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 19:40:27 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=fdbc86cf79784f56fab8115f2d565962e1111b2e commit fdbc86cf79784f56fab8115f2d565962e1111b2e Author: Robert Wing AuthorDate: 2021-05-15 19:58:21 +0000 Commit: Robert Wing CommitDate: 2021-05-21 19:23:06 +0000 bhyve/snapshot: split up mutex/cond initialization from socket creation Move initialization of the mutex/condition variables required by the save/restore feature to their own function. The unix domain socket that facilitates communication between bhyvectl and bhyve doesn't rely on these variables in order to be functional. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D30281 --- usr.sbin/bhyve/bhyverun.c | 3 +++ usr.sbin/bhyve/snapshot.c | 25 ++++++++++++++++--------- usr.sbin/bhyve/snapshot.h | 1 + 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index d14219bbef65..acf0df6cc9bf 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -1540,6 +1540,9 @@ main(int argc, char *argv[]) if (restore_file != NULL) destroy_restore_state(&rstate); + /* initialize mutex/cond variables */ + init_snapshot(); + /* * checkpointing thread for communication with bhyvectl */ diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c index 019f4fdd6cb0..1a06c3e8d065 100644 --- a/usr.sbin/bhyve/snapshot.c +++ b/usr.sbin/bhyve/snapshot.c @@ -1493,6 +1493,22 @@ checkpoint_thread(void *param) return (NULL); } +void +init_snapshot(void) +{ + int err; + + err = pthread_mutex_init(&vcpu_lock, NULL); + if (err != 0) + errc(1, err, "checkpoint mutex init"); + err = pthread_cond_init(&vcpus_idle, NULL); + if (err != 0) + errc(1, err, "checkpoint cv init (vcpus_idle)"); + err = pthread_cond_init(&vcpus_can_run, NULL); + if (err != 0) + errc(1, err, "checkpoint cv init (vcpus_can_run)"); +} + /* * Create the listening socket for IPC with bhyvectl */ @@ -1508,15 +1524,6 @@ init_checkpoint_thread(struct vmctx *ctx) memset(&addr, 0, sizeof(addr)); - err = pthread_mutex_init(&vcpu_lock, NULL); - if (err != 0) - errc(1, err, "checkpoint mutex init"); - err = pthread_cond_init(&vcpus_idle, NULL); - if (err == 0) - err = pthread_cond_init(&vcpus_can_run, NULL); - if (err != 0) - errc(1, err, "checkpoint cv init"); - socket_fd = socket(PF_UNIX, SOCK_DGRAM, 0); if (socket_fd < 0) { EPRINTLN("Socket creation failed: %s", strerror(errno)); diff --git a/usr.sbin/bhyve/snapshot.h b/usr.sbin/bhyve/snapshot.h index f28b56cf0a7f..3ffd42fbeabc 100644 --- a/usr.sbin/bhyve/snapshot.h +++ b/usr.sbin/bhyve/snapshot.h @@ -127,6 +127,7 @@ int vm_resume_user_devs(struct vmctx *ctx); int get_checkpoint_msg(int conn_fd, struct vmctx *ctx); void *checkpoint_thread(void *param); int init_checkpoint_thread(struct vmctx *ctx); +void init_snapshot(void); int load_restore_file(const char *filename, struct restore_state *rstate); From owner-dev-commits-src-all@freebsd.org Fri May 21 20:38:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AA96063B7E9; Fri, 21 May 2021 20:38: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 4Fmz3149TNz3QZJ; Fri, 21 May 2021 20:38: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 76D7917F96; Fri, 21 May 2021 20:38: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 14LKcbCf062830; Fri, 21 May 2021 20:38:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LKcb3U062829; Fri, 21 May 2021 20:38:37 GMT (envelope-from git) Date: Fri, 21 May 2021 20:38:37 GMT Message-Id: <202105212038.14LKcb3U062829@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: f190f9193bc1 - main - Fix fsck_ufs segfaults with gjournal (SU+J) 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/main X-Git-Reftype: branch X-Git-Commit: f190f9193bc10a8193c87e0a02fa91400e4eb159 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 20:38:37 -0000 The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=f190f9193bc10a8193c87e0a02fa91400e4eb159 commit f190f9193bc10a8193c87e0a02fa91400e4eb159 Author: Kirk McKusick AuthorDate: 2021-05-21 20:41:40 +0000 Commit: Kirk McKusick CommitDate: 2021-05-21 20:42:37 +0000 Fix fsck_ufs segfaults with gjournal (SU+J) The segfault was being hit in ckfini() (sbin/fsck_ffs/fsutil.c) while attempting to traverse the buffer cache to flush dirty buffers. The tail queue used for the buffer cache was not initialized before dropping into gjournal_check(). Move the buffer initialization earlier so that it has been done before calling gjournal_check(). Reported by: crypt47, nvass Fix by: Robert Wing Tested by: Robert Wing PR: 255030 PR: 255979 MFC after: 3 days Sponsored by: Netflix --- sbin/fsck_ffs/main.c | 1 + sbin/fsck_ffs/setup.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c index 401ee10f9be3..642e321fdd35 100644 --- a/sbin/fsck_ffs/main.c +++ b/sbin/fsck_ffs/main.c @@ -272,6 +272,7 @@ checkfilesys(char *filesys) * exit status will cause a foreground check to be run. */ sblock_init(); + bufinit(); if (bkgrdcheck) { if ((fsreadfd = open(filesys, O_RDONLY)) < 0 || readsb(0) == 0) exit(3); /* Cannot read superblock */ diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c index 0ae7f1bbb28f..d69beff879e9 100644 --- a/sbin/fsck_ffs/setup.c +++ b/sbin/fsck_ffs/setup.c @@ -298,7 +298,6 @@ setup(char *dev) (uintmax_t)numdirs * sizeof(struct inoinfo *)); goto badsb; } - bufinit(); if (sblock.fs_flags & FS_DOSOFTDEP) usedsoftdep = 1; else From owner-dev-commits-src-all@freebsd.org Fri May 21 20:51:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 732C963B8BE; Fri, 21 May 2021 20:51: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 4FmzLB2p61z3m5c; Fri, 21 May 2021 20:51: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 482EF17FE2; Fri, 21 May 2021 20:51: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 14LKpk53087363; Fri, 21 May 2021 20:51:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LKpi7w087362; Fri, 21 May 2021 20:51:44 GMT (envelope-from git) Date: Fri, 21 May 2021 20:51:44 GMT Message-Id: <202105212051.14LKpi7w087362@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 6680e5a52f8a - main - import nvi 2.2.0-3bbdfe4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6680e5a52f8abf059bbbd3e0be66d9dce476cdf9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 20:51:46 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=6680e5a52f8abf059bbbd3e0be66d9dce476cdf9 commit 6680e5a52f8abf059bbbd3e0be66d9dce476cdf9 Merge: f190f9193bc1 8e6e1224184e Author: Baptiste Daroussin AuthorDate: 2021-05-21 20:50:50 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-21 20:51:21 +0000 import nvi 2.2.0-3bbdfe4 contrib/nvi/.gitignore | 5 + contrib/nvi/CMakeLists.txt | 38 +- contrib/nvi/cl/cl.h | 3 - contrib/nvi/cl/cl_read.c | 4 +- contrib/nvi/cl/extern.h | 31 -- contrib/nvi/common/common.h | 6 +- contrib/nvi/common/conv.h | 2 +- contrib/nvi/common/exf.c | 27 ++ contrib/nvi/common/extern.h | 131 ------- contrib/nvi/common/key.h | 6 +- contrib/nvi/common/options.h | 4 + contrib/nvi/common/recover.c | 12 + contrib/nvi/ex/ex.c | 3 +- contrib/nvi/ex/ex_cscope.c | 14 + contrib/nvi/ex/extern.h | 131 ------- contrib/nvi/man/vi.1 | 50 ++- contrib/nvi/vi/extern.h | 145 -------- contrib/nvi/vi/v_increment.c | 4 +- contrib/nvi/vi/vs_line.c | 2 +- usr.bin/vi/Makefile | 5 +- usr.bin/vi/config.h | 9 + {contrib/nvi => usr.bin/vi}/ex/version.h | 2 + {contrib/nvi/ex => usr.bin/vi}/ex_def.h | 0 usr.bin/vi/extern.h | 444 +++++++++++++++++++++++ {contrib/nvi/common => usr.bin/vi}/options_def.h | 0 25 files changed, 607 insertions(+), 471 deletions(-) diff --cc contrib/nvi/.gitignore index aac7860d7299,000000000000..2b79229e57e0 mode 100644,000000..100644 --- a/contrib/nvi/.gitignore +++ b/contrib/nvi/.gitignore @@@ -1,9 -1,0 +1,14 @@@ +*.swp +*~ +*.orig +*.core +extern.h +*_def.h +version.h +tags +build/ ++ ++# Ignore files by the GNU Global source code tagging system. ++/GPATH ++/GRTAGS ++/GTAGS diff --cc usr.bin/vi/Makefile index 993970fd3051,000000000000..5769a34c6d2e mode 100644,000000..100644 --- a/usr.bin/vi/Makefile +++ b/usr.bin/vi/Makefile @@@ -1,76 -1,0 +1,77 @@@ +# +# $FreeBSD$ +# + +.include + +PACKAGE= vi +SRCDIR= ${SRCTOP}/contrib/nvi +SUBDIR+= catalog + +WARNS?= 0 # some warn issues on 32 bit machines + +VI= nvi +EX= nex +VIEW= nview + +PROG= nvi + - CFLAGS+= -D__REGEX_PRIVATE ++CFLAGS+= -D__REGEX_PRIVATE -D_XOPEN_SOURCE_EXTENDED=1 + +LINKS= ${BINDIR}/${VI} ${BINDIR}/${EX} ${BINDIR}/${VI} ${BINDIR}/${VIEW} +LINKS+= ${BINDIR}/${VI} ${BINDIR}/vi ${BINDIR}/${EX} ${BINDIR}/ex +LINKS+= ${BINDIR}/${VI} ${BINDIR}/view + +MAN= ${SRCDIR}/man/vi.1 +MLINKS+=vi.1 ex.1 vi.1 view.1 +MLINKS+=vi.1 nex.1 vi.1 nview.1 vi.1 nvi.1 + +.PATH: ${SRCDIR}/common +.PATH: ${SRCDIR}/ex +.PATH: ${SRCDIR}/cl +.PATH: ${SRCDIR}/vi +.PATH: ${SRCDIR}/regex + - CFLAGS+=-I${.CURDIR} -I${SRCDIR} -I${SRCDIR}/regex ++CFLAGS+=-I${.CURDIR} -I${SRCDIR} -I${SRCDIR}/regex \ ++ -I${.CURDIR}/ex + +LIBADD= util ncursesw + +.if ${MK_ICONV} == "yes" && !defined(RESCUE) +CFLAGS+= -DUSE_ICONV -DICONV_TRADITIONAL +.endif + +CLEANFILES+=${EX} + +# Vi curses sources +SRCS+= cl_funcs.c cl_main.c cl_read.c cl_screen.c cl_term.c + +# General sources. +SRCS+= conv.c cut.c delete.c encoding.c exf.c key.c line.c log.c main.c mark.c msg.c options.c \ + options_f.c put.c recover.c screen.c search.c seq.c util.c + +# Ex source. +SRCS+= ex.c ex_abbrev.c ex_append.c ex_args.c ex_argv.c ex_at.c ex_bang.c \ + ex_cd.c ex_cmd.c ex_cscope.c ex_delete.c ex_display.c \ + ex_edit.c ex_equal.c ex_file.c ex_filter.c ex_global.c \ + ex_init.c ex_join.c ex_map.c ex_mark.c ex_mkexrc.c ex_move.c \ + ex_open.c ex_preserve.c ex_print.c ex_put.c ex_quit.c \ + ex_read.c ex_screen.c ex_script.c ex_set.c ex_shell.c \ + ex_shift.c ex_source.c ex_stop.c ex_subst.c ex_tag.c \ + ex_txt.c ex_undo.c ex_usage.c ex_util.c ex_version.c ex_visual.c \ + ex_write.c ex_yank.c ex_z.c + +# Vi source. +SRCS+= getc.c v_at.c v_ch.c v_cmd.c v_delete.c v_ex.c v_increment.c v_init.c \ + v_itxt.c v_left.c v_mark.c v_match.c v_paragraph.c v_put.c v_redraw.c \ + v_replace.c v_right.c v_screen.c v_scroll.c v_search.c v_section.c \ + v_sentence.c v_status.c v_txt.c v_ulcase.c v_undo.c \ + v_util.c v_word.c v_xchar.c v_yank.c v_z.c v_zexit.c vi.c + +# Vi screen source. +SRCS+= vs_line.c vs_msg.c vs_refresh.c vs_relative.c vs_smap.c vs_split.c + +# Wide char regex +SRCS+= regcomp.c regerror.c regexec.c regfree.c + +.include diff --cc usr.bin/vi/config.h index 85ffb2874b34,000000000000..2b4348870db4 mode 100644,000000..100644 --- a/usr.bin/vi/config.h +++ b/usr.bin/vi/config.h @@@ -1,19 -1,0 +1,28 @@@ +/* $FreeBSD$ */ + +/* Define when using wide characters */ +#define USE_WIDECHAR + +/* Define when iconv can be used */ +/* #undef USE_ICONV */ + +/* Define when the 2nd argument of iconv(3) is not const */ +/* #undef ICONV_TRADITIONAL */ + +/* Define if you have */ +#define HAVE_LIBUTIL_H + +/* Define if you have */ +#define HAVE_NCURSES_H + ++/* Define if you have */ ++/* #undef HAVE_NCURSESW_NCURSES_H */ ++ ++/* Define if you have */ ++/* #undef HAVE_PTY_H */ ++ +/* Define if you have */ +#define HAVE_TERM_H ++ ++/* Define if struct dirent has field d_namlen */ ++#define HAVE_DIRENT_D_NAMLEN diff --cc usr.bin/vi/ex/version.h index 742b145ebd3f,000000000000..f14fc879222e mode 100644,000000..100644 --- a/usr.bin/vi/ex/version.h +++ b/usr.bin/vi/ex/version.h @@@ -1,1 -1,0 +1,3 @@@ ++/* $FreeBSD$ */ ++ +#define VI_VERSION "2.2.0 (2020-08-01)" diff --cc usr.bin/vi/ex_def.h index 7afb7b19d677,000000000000..7afb7b19d677 mode 100644,000000..100644 --- a/usr.bin/vi/ex_def.h +++ b/usr.bin/vi/ex_def.h diff --cc usr.bin/vi/extern.h index 000000000000,000000000000..1252726d9d8b new file mode 100644 --- /dev/null +++ b/usr.bin/vi/extern.h @@@ -1,0 -1,0 +1,444 @@@ ++#ifdef CL_IN_EX /* cl.h */ ++int cl_waddstr(SCR *, const CHAR_T *, size_t); ++int cl_addstr(SCR *, const char *, size_t); ++int cl_attr(SCR *, scr_attr_t, int); ++int cl_baud(SCR *, u_long *); ++int cl_bell(SCR *); ++int cl_clrtoeol(SCR *); ++int cl_cursor(SCR *, size_t *, size_t *); ++int cl_deleteln(SCR *); ++int cl_discard(SCR *, SCR **); ++int cl_ex_adjust(SCR *, exadj_t); ++int cl_insertln(SCR *); ++int cl_keyval(SCR *, scr_keyval_t, CHAR_T *, int *); ++int cl_move(SCR *, size_t, size_t); ++int cl_refresh(SCR *, int); ++int cl_rename(SCR *, char *, int); ++void cl_setname(GS *, char *); ++int cl_split(SCR *, SCR *); ++int cl_suspend(SCR *, int *); ++void cl_usage(void); ++int sig_init(GS *, SCR *); ++int cl_event(SCR *, EVENT *, u_int32_t, int); ++int cl_screen(SCR *, u_int32_t); ++int cl_quit(GS *); ++int cl_getcap(SCR *, char *, char **); ++int cl_term_init(SCR *); ++int cl_term_end(GS *); ++int cl_fmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t); ++int cl_optchange(SCR *, int, char *, u_long *); ++int cl_omesg(SCR *, CL_PRIVATE *, int); ++int cl_ssize(SCR *, int, size_t *, size_t *, int *); ++int cl_putchar(int); ++#endif ++#ifdef EXP /* ex.h */ ++int ex(SCR **); ++int ex_cmd(SCR *); ++int ex_range(SCR *, EXCMD *, int *); ++int ex_is_abbrev(CHAR_T *, size_t); ++int ex_is_unmap(CHAR_T *, size_t); ++void ex_badaddr ++ (SCR *, EXCMDLIST const *, enum badaddr, enum nresult); ++int ex_abbr(SCR *, EXCMD *); ++int ex_unabbr(SCR *, EXCMD *); ++int ex_append(SCR *, EXCMD *); ++int ex_change(SCR *, EXCMD *); ++int ex_insert(SCR *, EXCMD *); ++int ex_next(SCR *, EXCMD *); ++int ex_prev(SCR *, EXCMD *); ++int ex_rew(SCR *, EXCMD *); ++int ex_args(SCR *, EXCMD *); ++char **ex_buildargv(SCR *, EXCMD *, char *); ++int argv_init(SCR *, EXCMD *); ++int argv_exp0(SCR *, EXCMD *, CHAR_T *, size_t); ++int argv_exp1(SCR *, EXCMD *, CHAR_T *, size_t, int); ++int argv_exp2(SCR *, EXCMD *, CHAR_T *, size_t); ++int argv_exp3(SCR *, EXCMD *, CHAR_T *, size_t); ++int argv_flt_ex(SCR *, EXCMD *, CHAR_T *, size_t); ++int argv_free(SCR *); ++int argv_flt_path(SCR *, EXCMD *, CHAR_T *, size_t); ++CHAR_T *argv_esc(SCR *, EXCMD *, CHAR_T *, size_t); ++CHAR_T *argv_uesc(SCR *, EXCMD *, CHAR_T *, size_t); ++int ex_at(SCR *, EXCMD *); ++int ex_bang(SCR *, EXCMD *); ++int ex_cd(SCR *, EXCMD *); ++int ex_cscope(SCR *, EXCMD *); ++int cscope_end(SCR *); ++int cscope_display(SCR *); ++int cscope_search(SCR *, TAGQ *, TAG *); ++int ex_delete(SCR *, EXCMD *); ++int ex_display(SCR *, EXCMD *); ++int ex_edit(SCR *, EXCMD *); ++int ex_equal(SCR *, EXCMD *); ++int ex_file(SCR *, EXCMD *); ++int ex_filter(SCR *, ++ EXCMD *, MARK *, MARK *, MARK *, CHAR_T *, enum filtertype); ++int ex_global(SCR *, EXCMD *); ++int ex_v(SCR *, EXCMD *); ++int ex_g_insdel(SCR *, lnop_t, recno_t); ++int ex_screen_copy(SCR *, SCR *); ++int ex_screen_end(SCR *); ++int ex_optchange(SCR *, int, char *, u_long *); ++int ex_exrc(SCR *); ++int ex_run_str(SCR *, char *, CHAR_T *, size_t, int, int); ++int ex_join(SCR *, EXCMD *); ++int ex_map(SCR *, EXCMD *); ++int ex_unmap(SCR *, EXCMD *); ++int ex_mark(SCR *, EXCMD *); ++int ex_mkexrc(SCR *, EXCMD *); ++int ex_copy(SCR *, EXCMD *); ++int ex_move(SCR *, EXCMD *); ++int ex_open(SCR *, EXCMD *); ++int ex_preserve(SCR *, EXCMD *); ++int ex_recover(SCR *, EXCMD *); ++int ex_list(SCR *, EXCMD *); ++int ex_number(SCR *, EXCMD *); ++int ex_pr(SCR *, EXCMD *); ++int ex_print(SCR *, EXCMD *, MARK *, MARK *, u_int32_t); ++int ex_ldisplay(SCR *, const CHAR_T *, size_t, size_t, u_int); ++int ex_scprint(SCR *, MARK *, MARK *); ++int ex_printf(SCR *, const char *, ...); ++int ex_puts(SCR *, const char *); ++int ex_fflush(SCR *sp); ++int ex_put(SCR *, EXCMD *); ++int ex_quit(SCR *, EXCMD *); ++int ex_read(SCR *, EXCMD *); ++int ex_readfp(SCR *, char *, FILE *, MARK *, recno_t *, int); ++int ex_bg(SCR *, EXCMD *); ++int ex_fg(SCR *, EXCMD *); ++int ex_resize(SCR *, EXCMD *); ++int ex_sdisplay(SCR *); ++int ex_script(SCR *, EXCMD *); ++int sscr_exec(SCR *, recno_t); ++int sscr_input(SCR *); ++int sscr_end(SCR *); ++int ex_set(SCR *, EXCMD *); ++int ex_shell(SCR *, EXCMD *); ++int ex_exec_proc(SCR *, EXCMD *, char *, const char *, int); ++int proc_wait(SCR *, long, const char *, int, int); ++int ex_shiftl(SCR *, EXCMD *); ++int ex_shiftr(SCR *, EXCMD *); ++int ex_retab(SCR *, EXCMD *); ++int ex_source(SCR *, EXCMD *); ++int ex_stop(SCR *, EXCMD *); ++int ex_s(SCR *, EXCMD *); ++int ex_subagain(SCR *, EXCMD *); ++int ex_subtilde(SCR *, EXCMD *); ++int re_compile(SCR *, ++ CHAR_T *, size_t, CHAR_T **, size_t *, regex_t *, u_int); ++void re_error(SCR *, int, regex_t *); ++int ex_tag_first(SCR *, CHAR_T *); ++int ex_tag_push(SCR *, EXCMD *); ++int ex_tag_next(SCR *, EXCMD *); ++int ex_tag_prev(SCR *, EXCMD *); ++int ex_tag_nswitch(SCR *, TAG *, int); ++int ex_tag_Nswitch(SCR *, TAG *, int); ++int ex_tag_pop(SCR *, EXCMD *); ++int ex_tag_top(SCR *, EXCMD *); ++int ex_tag_display(SCR *); ++int ex_tag_copy(SCR *, SCR *); ++int tagq_free(SCR *, TAGQ *); ++int tagq_push(SCR*, TAGQ*, int, int ); ++void tag_msg(SCR *, tagmsg_t, char *); ++int ex_tagf_alloc(SCR *, char *); ++int ex_tag_free(SCR *); ++int ex_txt(SCR *, TEXTH *, ARG_CHAR_T, u_int32_t); ++int ex_undo(SCR *, EXCMD *); ++int ex_help(SCR *, EXCMD *); ++int ex_usage(SCR *, EXCMD *); ++int ex_viusage(SCR *, EXCMD *); ++void ex_cinit(SCR *, EXCMD *, int, int, recno_t, recno_t, int); ++int ex_getline(SCR *, FILE *, size_t *); ++int ex_ncheck(SCR *, int); ++int ex_init(SCR *); ++void ex_wemsg(SCR *, CHAR_T *, exm_t); ++void ex_emsg(SCR *, char *, exm_t); ++int ex_version(SCR *, EXCMD *); ++int ex_visual(SCR *, EXCMD *); ++int ex_wn(SCR *, EXCMD *); ++int ex_wq(SCR *, EXCMD *); ++int ex_write(SCR *, EXCMD *); ++int ex_xit(SCR *, EXCMD *); ++int ex_writefp(SCR *, ++ char *, FILE *, MARK *, MARK *, u_long *, u_long *, int); ++int ex_yank(SCR *, EXCMD *); ++int ex_z(SCR *, EXCMD *); ++#endif ++#ifdef V_ABS /* vi.h */ ++int cs_init(SCR *, VCS *); ++int cs_next(SCR *, VCS *); ++int cs_fspace(SCR *, VCS *); ++int cs_fblank(SCR *, VCS *); ++int cs_prev(SCR *, VCS *); ++int cs_bblank(SCR *, VCS *); ++int v_at(SCR *, VICMD *); ++int v_chrepeat(SCR *, VICMD *); ++int v_chrrepeat(SCR *, VICMD *); ++int v_cht(SCR *, VICMD *); ++int v_chf(SCR *, VICMD *); ++int v_chT(SCR *, VICMD *); ++int v_chF(SCR *, VICMD *); ++int v_delete(SCR *, VICMD *); ++int v_again(SCR *, VICMD *); ++int v_exmode(SCR *, VICMD *); ++int v_join(SCR *, VICMD *); ++int v_shiftl(SCR *, VICMD *); ++int v_shiftr(SCR *, VICMD *); ++int v_suspend(SCR *, VICMD *); ++int v_switch(SCR *, VICMD *); ++int v_tagpush(SCR *, VICMD *); ++int v_tagpop(SCR *, VICMD *); ++int v_filter(SCR *, VICMD *); ++int v_ex(SCR *, VICMD *); ++int v_ecl_exec(SCR *); ++int v_increment(SCR *, VICMD *); ++int v_screen_copy(SCR *, SCR *); ++int v_screen_end(SCR *); ++int v_optchange(SCR *, int, char *, u_long *); ++int v_iA(SCR *, VICMD *); ++int v_ia(SCR *, VICMD *); ++int v_iI(SCR *, VICMD *); ++int v_ii(SCR *, VICMD *); ++int v_iO(SCR *, VICMD *); ++int v_io(SCR *, VICMD *); ++int v_change(SCR *, VICMD *); ++int v_Replace(SCR *, VICMD *); ++int v_subst(SCR *, VICMD *); ++int v_left(SCR *, VICMD *); ++int v_cfirst(SCR *, VICMD *); ++int v_first(SCR *, VICMD *); ++int v_ncol(SCR *, VICMD *); ++int v_zero(SCR *, VICMD *); ++int v_mark(SCR *, VICMD *); ++int v_bmark(SCR *, VICMD *); ++int v_fmark(SCR *, VICMD *); ++int v_emark(SCR *, VICMD *); ++int v_match(SCR *, VICMD *); ++int v_buildmcs(SCR *, char *); ++int v_paragraphf(SCR *, VICMD *); ++int v_paragraphb(SCR *, VICMD *); ++int v_buildps(SCR *, char *, char *); ++int v_Put(SCR *, VICMD *); ++int v_put(SCR *, VICMD *); ++int v_redraw(SCR *, VICMD *); ++int v_replace(SCR *, VICMD *); ++int v_right(SCR *, VICMD *); ++int v_dollar(SCR *, VICMD *); ++int v_screen(SCR *, VICMD *); ++int v_lgoto(SCR *, VICMD *); ++int v_home(SCR *, VICMD *); ++int v_middle(SCR *, VICMD *); ++int v_bottom(SCR *, VICMD *); ++int v_up(SCR *, VICMD *); ++int v_cr(SCR *, VICMD *); ++int v_down(SCR *, VICMD *); ++int v_hpageup(SCR *, VICMD *); ++int v_hpagedown(SCR *, VICMD *); ++int v_pagedown(SCR *, VICMD *); ++int v_pageup(SCR *, VICMD *); ++int v_lineup(SCR *, VICMD *); ++int v_linedown(SCR *, VICMD *); ++int v_searchb(SCR *, VICMD *); ++int v_searchf(SCR *, VICMD *); ++int v_searchN(SCR *, VICMD *); ++int v_searchn(SCR *, VICMD *); ++int v_searchw(SCR *, VICMD *); ++int v_correct(SCR *, VICMD *, int); ++int v_sectionf(SCR *, VICMD *); ++int v_sectionb(SCR *, VICMD *); ++int v_sentencef(SCR *, VICMD *); ++int v_sentenceb(SCR *, VICMD *); ++int v_status(SCR *, VICMD *); ++int v_tcmd(SCR *, VICMD *, ARG_CHAR_T, u_int); ++int v_txt(SCR *, VICMD *, MARK *, ++ const CHAR_T *, size_t, ARG_CHAR_T, recno_t, u_long, u_int32_t); ++int v_txt_auto(SCR *, recno_t, TEXT *, size_t, TEXT *); ++int v_ulcase(SCR *, VICMD *); ++int v_mulcase(SCR *, VICMD *); ++int v_Undo(SCR *, VICMD *); ++int v_undo(SCR *, VICMD *); ++void v_eof(SCR *, MARK *); ++void v_eol(SCR *, MARK *); ++void v_nomove(SCR *); ++void v_sof(SCR *, MARK *); ++void v_sol(SCR *); ++int v_isempty(CHAR_T *, size_t); ++void v_emsg(SCR *, char *, vim_t); ++int v_wordW(SCR *, VICMD *); ++int v_wordw(SCR *, VICMD *); ++int v_wordE(SCR *, VICMD *); ++int v_worde(SCR *, VICMD *); ++int v_wordB(SCR *, VICMD *); ++int v_wordb(SCR *, VICMD *); ++int v_xchar(SCR *, VICMD *); ++int v_Xchar(SCR *, VICMD *); ++int v_yank(SCR *, VICMD *); ++int v_z(SCR *, VICMD *); ++int vs_crel(SCR *, long); ++int v_zexit(SCR *, VICMD *); ++int vi(SCR **); ++int v_curword(SCR *); ++int vs_line(SCR *, SMAP *, size_t *, size_t *); ++int vs_number(SCR *); ++void vs_busy(SCR *, const char *, busy_t); ++void vs_home(SCR *); ++void vs_update(SCR *, const char *, const CHAR_T *); ++void vs_msg(SCR *, mtype_t, char *, size_t); ++int vs_ex_resolve(SCR *, int *); ++int vs_resolve(SCR *, SCR *, int); ++int vs_repaint(SCR *, EVENT *); ++int vs_refresh(SCR *, int); ++int vs_column(SCR *, size_t *); ++size_t vs_screens(SCR *, recno_t, size_t *); ++size_t vs_columns(SCR *, CHAR_T *, recno_t, size_t *, size_t *); ++size_t vs_rcm(SCR *, recno_t, int); ++size_t vs_colpos(SCR *, recno_t, size_t); ++int vs_change(SCR *, recno_t, lnop_t); ++int vs_sm_fill(SCR *, recno_t, pos_t); ++int vs_sm_scroll(SCR *, MARK *, recno_t, scroll_t); ++int vs_sm_1up(SCR *); ++int vs_sm_1down(SCR *); ++int vs_sm_next(SCR *, SMAP *, SMAP *); ++int vs_sm_prev(SCR *, SMAP *, SMAP *); ++int vs_sm_cursor(SCR *, SMAP **); ++int vs_sm_position(SCR *, MARK *, u_long, pos_t); ++recno_t vs_sm_nlines(SCR *, SMAP *, recno_t, size_t); ++int vs_split(SCR *, SCR *, int); ++int vs_vsplit(SCR *, SCR *); ++int vs_discard(SCR *, SCR **); ++int vs_fg(SCR *, SCR **, CHAR_T *, int); ++int vs_bg(SCR *); ++int vs_swap(SCR *, SCR **, char *); ++int vs_resize(SCR *, long, adj_t); ++#endif /* common.h */ ++char * codeset(void); ++void conv_init(SCR *, SCR *); ++int conv_enc(SCR *, int, char *); ++void conv_end(SCR *); ++int cut(SCR *, CHAR_T *, MARK *, MARK *, int); ++int cut_line(SCR *, recno_t, size_t, size_t, CB *); ++void cut_close(GS *); ++TEXT *text_init(SCR *, const CHAR_T *, size_t, size_t); ++void text_lfree(TEXTH *); ++void text_free(TEXT *); ++int del(SCR *, MARK *, MARK *, int); ++int looks_utf8(const char *, size_t); ++int looks_utf16(const char *, size_t); ++int decode_utf8(const char *); ++int decode_utf16(const char *, int); ++FREF *file_add(SCR *, char *); ++int file_init(SCR *, FREF *, char *, int); ++int file_end(SCR *, EXF *, int); ++int file_write(SCR *, MARK *, MARK *, char *, int); ++int file_m1(SCR *, int, int); ++int file_m2(SCR *, int); ++int file_m3(SCR *, int); ++int file_aw(SCR *, int); ++void set_alt_name(SCR *, char *); ++lockr_t file_lock(SCR *, char *, int, int); ++int v_key_init(SCR *); ++void v_key_ilookup(SCR *); ++size_t v_key_len(SCR *, ARG_CHAR_T); ++char *v_key_name(SCR *, ARG_CHAR_T); ++e_key_t v_key_val(SCR *, ARG_CHAR_T); ++int v_event_push(SCR *, EVENT *, CHAR_T *, size_t, u_int); ++int v_event_get(SCR *, EVENT *, int, u_int32_t); ++void v_event_err(SCR *, EVENT *); ++int v_event_flush(SCR *, u_int); ++int db_eget(SCR *, recno_t, CHAR_T **, size_t *, int *); ++int db_get(SCR *, recno_t, u_int32_t, CHAR_T **, size_t *); ++int db_delete(SCR *, recno_t); ++int db_append(SCR *, int, recno_t, CHAR_T *, size_t); ++int db_insert(SCR *, recno_t, CHAR_T *, size_t); ++int db_set(SCR *, recno_t, CHAR_T *, size_t); ++int db_exist(SCR *, recno_t); ++int db_last(SCR *, recno_t *); ++int db_rget(SCR *, recno_t, char **, size_t *); ++int db_rset(SCR *, recno_t, char *, size_t); ++void db_err(SCR *, recno_t); ++int log_init(SCR *, EXF *); ++int log_end(SCR *, EXF *); ++int log_cursor(SCR *); ++int log_line(SCR *, recno_t, u_int); ++int log_mark(SCR *, LMARK *); ++int log_backward(SCR *, MARK *); ++int log_setline(SCR *); ++int log_forward(SCR *, MARK *); ++int editor(GS *, int, char *[]); ++void v_end(GS *); ++int mark_init(SCR *, EXF *); ++int mark_end(SCR *, EXF *); ++int mark_get(SCR *, ARG_CHAR_T, MARK *, mtype_t); ++int mark_set(SCR *, ARG_CHAR_T, MARK *, int); ++int mark_insdel(SCR *, lnop_t, recno_t); ++void msgq(SCR *, mtype_t, const char *, ...); ++void msgq_wstr(SCR *, mtype_t, const CHAR_T *, const char *); ++void msgq_str(SCR *, mtype_t, const char *, const char *); ++void mod_rpt(SCR *); ++void msgq_status(SCR *, recno_t, u_int); ++int msg_open(SCR *, char *); ++void msg_close(GS *); ++const char *msg_cmsg(SCR *, cmsg_t, size_t *); ++const char *msg_cat(SCR *, const char *, size_t *); ++char *msg_print(SCR *, const char *, int *); ++int opts_init(SCR *, int *); ++int opts_set(SCR *, ARGS *[], char *); ++int o_set(SCR *, int, u_int, char *, u_long); ++int opts_empty(SCR *, int, int); ++void opts_dump(SCR *, enum optdisp); ++int opts_save(SCR *, FILE *); ++OPTLIST const *opts_search(CHAR_T *); ++void opts_nomatch(SCR *, CHAR_T *); ++int opts_copy(SCR *, SCR *); ++void opts_free(SCR *); ++int f_altwerase(SCR *, OPTION *, char *, u_long *); ++int f_columns(SCR *, OPTION *, char *, u_long *); ++int f_lines(SCR *, OPTION *, char *, u_long *); ++int f_lisp(SCR *, OPTION *, char *, u_long *); ++int f_msgcat(SCR *, OPTION *, char *, u_long *); ++int f_print(SCR *, OPTION *, char *, u_long *); ++int f_readonly(SCR *, OPTION *, char *, u_long *); ++int f_recompile(SCR *, OPTION *, char *, u_long *); ++int f_reformat(SCR *, OPTION *, char *, u_long *); ++int f_ttywerase(SCR *, OPTION *, char *, u_long *); ++int f_w300(SCR *, OPTION *, char *, u_long *); ++int f_w1200(SCR *, OPTION *, char *, u_long *); ++int f_w9600(SCR *, OPTION *, char *, u_long *); ++int f_window(SCR *, OPTION *, char *, u_long *); ++int f_encoding(SCR *, OPTION *, char *, u_long *); ++int put(SCR *, CB *, CHAR_T *, MARK *, MARK *, int); ++int rcv_tmp(SCR *, EXF *, char *); ++int rcv_init(SCR *); ++int rcv_sync(SCR *, u_int); ++int rcv_list(SCR *); ++int rcv_read(SCR *, FREF *); ++int screen_init(GS *, SCR *, SCR **); ++int screen_end(SCR *); ++SCR *screen_next(SCR *); ++int f_search(SCR *, ++ MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int); ++int b_search(SCR *, ++ MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int); ++void search_busy(SCR *, busy_t); ++int seq_set(SCR *, CHAR_T *, ++ size_t, CHAR_T *, size_t, CHAR_T *, size_t, seq_t, int); ++int seq_delete(SCR *, CHAR_T *, size_t, seq_t); ++int seq_free(SEQ *); ++SEQ *seq_find ++ (SCR *, SEQ **, EVENT *, CHAR_T *, size_t, seq_t, int *); ++void seq_close(GS *); ++int seq_dump(SCR *, seq_t, int); ++int seq_save(SCR *, FILE *, char *, seq_t); ++int e_memcmp(CHAR_T *, EVENT *, size_t); ++void *binc(SCR *, void *, size_t *, size_t); ++int nonblank(SCR *, recno_t, size_t *); ++char *join(char *, char *); ++char *expanduser(char *); ++char *quote(char *); ++char *v_strdup(SCR *, const char *, size_t); ++CHAR_T *v_wstrdup(SCR *, const CHAR_T *, size_t); ++enum nresult nget_uslong(u_long *, const CHAR_T *, CHAR_T **, int); ++enum nresult nget_slong(long *, const CHAR_T *, CHAR_T **, int); ++void timepoint_steady(struct timespec *); ++void timepoint_system(struct timespec *); ++void TRACE(SCR *, const char *, ...); diff --cc usr.bin/vi/options_def.h index 54dd6c20c891,000000000000..54dd6c20c891 mode 100644,000000..100644 --- a/usr.bin/vi/options_def.h +++ b/usr.bin/vi/options_def.h From owner-dev-commits-src-all@freebsd.org Fri May 21 21:45:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 822E163C450; Fri, 21 May 2021 21:45: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 4Fn0XB2yv3z4gMZ; Fri, 21 May 2021 21:45: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 4DF5918ACA; Fri, 21 May 2021 21:45:30 +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 14LLjU4r055449; Fri, 21 May 2021 21:45:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LLjUGX055448; Fri, 21 May 2021 21:45:30 GMT (envelope-from git) Date: Fri, 21 May 2021 21:45:30 GMT Message-Id: <202105212145.14LLjUGX055448@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 7d2608a5d24e - main - tcp: Make error handling in tcp_usr_send() more consistent 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/main X-Git-Reftype: branch X-Git-Commit: 7d2608a5d24ec3534dad7f24191f12a8181ea206 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 21:45:30 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7d2608a5d24ec3534dad7f24191f12a8181ea206 commit 7d2608a5d24ec3534dad7f24191f12a8181ea206 Author: Mark Johnston AuthorDate: 2021-05-21 21:44:40 +0000 Commit: Mark Johnston CommitDate: 2021-05-21 21:45:18 +0000 tcp: Make error handling in tcp_usr_send() more consistent - Free the input mbuf in a single place instead of in every error path. - Handle PRUS_NOTREADY consistently. - Flush the socket's send buffer if an implicit connect fails. At that point the mbuf has already been enqueued but we don't want to keep it in the send buffer. Reviewed by: gallatin, tuexen Discussed with: jhb MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30349 --- sys/netinet/tcp_usrreq.c | 67 +++++++++++++++++++----------------------------- 1 file changed, 26 insertions(+), 41 deletions(-) diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 693cf553de44..37bedc0125c9 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -993,13 +993,6 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { if (control) m_freem(control); - - /* - * In case of PRUS_NOTREADY, tcp_usr_ready() is responsible - * for freeing memory. - */ - if ((flags & PRUS_NOTREADY) == 0) - m_freem(m); error = ECONNRESET; goto out; } @@ -1007,7 +1000,6 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, /* TCP doesn't do control messages (rights, creds, etc) */ if (control->m_len) { m_freem(control); - m_freem(m); error = EINVAL; goto out; } @@ -1015,13 +1007,10 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, control = NULL; } tp = intotcpcb(inp); - if (flags & PRUS_OOB) { - if ((error = tcp_pru_options_support(tp, PRUS_OOB)) != 0) { - if ((flags & PRUS_NOTREADY) == 0) - m_freem(m); - goto out; - } - } + if ((flags & PRUS_OOB) != 0 && + (error = tcp_pru_options_support(tp, PRUS_OOB)) != 0) + goto out; + TCPDEBUG1(); if (nam != NULL && tp->t_state < TCPS_SYN_SENT) { switch (nam->sa_family) { @@ -1029,30 +1018,24 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, case AF_INET: sinp = (struct sockaddr_in *)nam; if (sinp->sin_len != sizeof(struct sockaddr_in)) { - m_freem(m); error = EINVAL; goto out; } if ((inp->inp_vflag & INP_IPV6) != 0) { - m_freem(m); error = EAFNOSUPPORT; goto out; } if (IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) { - m_freem(m); error = EAFNOSUPPORT; goto out; } if (ntohl(sinp->sin_addr.s_addr) == INADDR_BROADCAST) { - m_freem(m); error = EACCES; goto out; } if ((error = prison_remote_ip4(td->td_ucred, - &sinp->sin_addr))) { - m_freem(m); + &sinp->sin_addr))) goto out; - } #ifdef INET6 isipv6 = 0; #endif @@ -1065,17 +1048,14 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, sin6 = (struct sockaddr_in6 *)nam; if (sin6->sin6_len != sizeof(*sin6)) { - m_freem(m); error = EINVAL; goto out; } if ((inp->inp_vflag & INP_IPV6PROTO) == 0) { - m_freem(m); error = EAFNOSUPPORT; goto out; } if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) { - m_freem(m); error = EAFNOSUPPORT; goto out; } @@ -1083,12 +1063,10 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, #ifdef INET if ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0) { error = EINVAL; - m_freem(m); goto out; } if ((inp->inp_vflag & INP_IPV4) == 0) { error = EAFNOSUPPORT; - m_freem(m); goto out; } restoreflags = true; @@ -1098,23 +1076,18 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, if (IN_MULTICAST( ntohl(sinp->sin_addr.s_addr))) { error = EAFNOSUPPORT; - m_freem(m); goto out; } if ((error = prison_remote_ip4(td->td_ucred, - &sinp->sin_addr))) { - m_freem(m); + &sinp->sin_addr))) goto out; - } isipv6 = 0; #else /* !INET */ error = EAFNOSUPPORT; - m_freem(m); goto out; #endif /* INET */ } else { if ((inp->inp_vflag & INP_IPV6) == 0) { - m_freem(m); error = EAFNOSUPPORT; goto out; } @@ -1122,23 +1095,21 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, inp->inp_vflag &= ~INP_IPV4; inp->inp_inc.inc_flags |= INC_ISIPV6; if ((error = prison_remote_ip6(td->td_ucred, - &sin6->sin6_addr))) { - m_freem(m); + &sin6->sin6_addr))) goto out; - } isipv6 = 1; } break; } #endif /* INET6 */ default: - m_freem(m); error = EAFNOSUPPORT; goto out; } } if (!(flags & PRUS_OOB)) { sbappendstream(&so->so_snd, m, flags); + m = NULL; if (nam && tp->t_state < TCPS_SYN_SENT) { /* * Do implied connect if not yet connected, @@ -1164,8 +1135,11 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, if (error == 0 || inp->inp_lport != 0) restoreflags = false; - if (error) + if (error) { + /* m is freed if PRUS_NOTREADY is unset. */ + sbflush(&so->so_snd); goto out; + } if (IS_FASTOPEN(tp->t_flags)) tcp_fastopen_connect(tp); else { @@ -1206,7 +1180,6 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, SOCKBUF_LOCK(&so->so_snd); if (sbspace(&so->so_snd) < -512) { SOCKBUF_UNLOCK(&so->so_snd); - m_freem(m); error = ENOBUFS; goto out; } @@ -1220,6 +1193,7 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, */ sbappendstream_locked(&so->so_snd, m, flags); SOCKBUF_UNLOCK(&so->so_snd); + m = NULL; if (nam && tp->t_state < TCPS_SYN_SENT) { /* * Do implied connect if not yet connected, @@ -1251,13 +1225,16 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, if (error == 0 || inp->inp_lport != 0) restoreflags = false; - if (error) + if (error != 0) { + /* m is freed if PRUS_NOTREADY is unset. */ + sbflush(&so->so_snd); goto out; + } tp->snd_wnd = TTCP_CLIENT_SND_WND; tcp_mss(tp, -1); } tp->snd_up = tp->snd_una + sbavail(&so->so_snd); - if (!(flags & PRUS_NOTREADY)) { + if ((flags & PRUS_NOTREADY) == 0) { tp->t_flags |= TF_FORCEDATA; error = tp->t_fb->tfb_tcp_output(tp); tp->t_flags &= ~TF_FORCEDATA; @@ -1268,7 +1245,15 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, &inp->inp_socket->so_snd, TCP_LOG_USERSEND, error, 0, NULL, false); + out: + /* + * In case of PRUS_NOTREADY, the caller or tcp_usr_ready() is + * responsible for freeing memory. + */ + if (m != NULL && (flags & PRUS_NOTREADY) == 0) + m_freem(m); + /* * If the request was unsuccessful and we changed flags, * restore the original flags. From owner-dev-commits-src-all@freebsd.org Fri May 21 21:45:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D219363C4C5; Fri, 21 May 2021 21:45: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 4Fn0XC4hfZz4g5C; Fri, 21 May 2021 21:45: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 84E1718D35; Fri, 21 May 2021 21:45: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 14LLjVfE055476; Fri, 21 May 2021 21:45:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LLjVq5055475; Fri, 21 May 2021 21:45:31 GMT (envelope-from git) Date: Fri, 21 May 2021 21:45:31 GMT Message-Id: <202105212145.14LLjVq5055475@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 916c61a5ed37 - main - Fix handling of errors from pru_send(PRUS_NOTREADY) 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/main X-Git-Reftype: branch X-Git-Commit: 916c61a5ed37da8ecdedd3c5512813d8dcec9a24 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 21:45:31 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=916c61a5ed37da8ecdedd3c5512813d8dcec9a24 commit 916c61a5ed37da8ecdedd3c5512813d8dcec9a24 Author: Mark Johnston AuthorDate: 2021-05-21 21:44:46 +0000 Commit: Mark Johnston CommitDate: 2021-05-21 21:45:19 +0000 Fix handling of errors from pru_send(PRUS_NOTREADY) PRUS_NOTREADY indicates that the caller has not yet populated the chain with data, and so it is not ready for transmission. This is used by sendfile (for async I/O) and KTLS (for encryption). In particular, if pru_send returns an error, the caller is responsible for freeing the chain since other implicit references to the data buffers exist. For async sendfile, it happens that an error will only be returned if the connection was dropped, in which case tcp_usr_ready() will handle freeing the chain. But since KTLS can be used in conjunction with the regular socket I/O system calls, many more error cases - which do not result in the connection being dropped - are reachable. In these cases, KTLS was effectively assuming success. So: - Change sosend_generic() to free the mbuf chain if pru_send(PRUS_NOTREADY) fails. Nothing else owns a reference to the chain at that point. - Similarly, in vn_sendfile() change the !async I/O && KTLS case to free the chain. - If async I/O is still outstanding when pru_send fails in vn_sendfile(), set an error in the sfio structure so that the connection is aborted and the mbuf chain is freed. Reviewed by: gallatin, tuexen Discussed with: jhb MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30349 --- sys/kern/kern_sendfile.c | 12 ++++++++---- sys/kern/uipc_socket.c | 19 +++++++------------ 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c index 520b7c9c62d0..ac1072ca2406 100644 --- a/sys/kern/kern_sendfile.c +++ b/sys/kern/kern_sendfile.c @@ -1175,8 +1175,12 @@ prepend_header: if (tls != NULL && tls->mode == TCP_TLS_MODE_SW) { error = (*so->so_proto->pr_usrreqs->pru_send) (so, PRUS_NOTREADY, m, NULL, NULL, td); - soref(so); - ktls_enqueue(m, so, tls_enq_cnt); + if (error != 0) { + m_freem(m); + } else { + soref(so); + ktls_enqueue(m, so, tls_enq_cnt); + } } else #endif error = (*so->so_proto->pr_usrreqs->pru_send) @@ -1187,11 +1191,11 @@ prepend_header: soref(so); error = (*so->so_proto->pr_usrreqs->pru_send) (so, PRUS_NOTREADY, m, NULL, NULL, td); - sendfile_iodone(sfio, NULL, 0, 0); + sendfile_iodone(sfio, NULL, 0, error); } CURVNET_RESTORE(); - m = NULL; /* pru_send always consumes */ + m = NULL; if (error) goto done; sbytes += space + hdrlen; diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 2a167eb68a22..0ca87bfc522a 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1767,18 +1767,13 @@ restart: #ifdef KERN_TLS if (tls != NULL && tls->mode == TCP_TLS_MODE_SW) { - /* - * Note that error is intentionally - * ignored. - * - * Like sendfile(), we rely on the - * completion routine (pru_ready()) - * to free the mbufs in the event that - * pru_send() encountered an error and - * did not append them to the sockbuf. - */ - soref(so); - ktls_enqueue(top, so, tls_enq_cnt); + if (error != 0) { + m_freem(top); + top = NULL; + } else { + soref(so); + ktls_enqueue(top, so, tls_enq_cnt); + } } #endif clen = 0; From owner-dev-commits-src-all@freebsd.org Fri May 21 22:16:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9356463CE66; Fri, 21 May 2021 22:16: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 4Fn1CS3cnGz4tbq; Fri, 21 May 2021 22:16: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 6039819252; Fri, 21 May 2021 22:16: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 14LMG4DC095928; Fri, 21 May 2021 22:16:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14LMG4I5095927; Fri, 21 May 2021 22:16:04 GMT (envelope-from git) Date: Fri, 21 May 2021 22:16:04 GMT Message-Id: <202105212216.14LMG4I5095927@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: 39756885633f - main - rack: honor prior socket buffer lock when doing the upcall MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 39756885633fd9d9649b4cb0f0abf594bfeb8dbb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 22:16:04 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=39756885633fd9d9649b4cb0f0abf594bfeb8dbb commit 39756885633fd9d9649b4cb0f0abf594bfeb8dbb Author: Richard Scheffenegger AuthorDate: 2021-05-21 22:08:56 +0000 Commit: Richard Scheffenegger CommitDate: 2021-05-21 22:09:59 +0000 rack: honor prior socket buffer lock when doing the upcall While partially reverting D24237 with D29690, due to introducing some unintended effects for in-kernel TCP consumers, the preexisting lock on the socket send buffer was not considered properly. Found by: markj MFC after: 2 weeks Reviewed By: tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D30390 --- sys/netinet/tcp_stacks/rack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index efab90a2e5bd..47f4c6835de9 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -10629,7 +10629,7 @@ rack_fastack(struct mbuf *m, struct tcphdr *th, struct socket *so, rack_adjust_sendmap(rack, &so->so_snd, tp->snd_una); /* Wake up the socket if we have room to write more */ rack_log_wakeup(tp,rack, &so->so_snd, acked, 2); - sowwakeup(so); + sowwakeup_locked(so); m_freem(mfree); tp->t_rxtshift = 0; RACK_TCPT_RANGESET(tp->t_rxtcur, RACK_REXMTVAL(tp), @@ -13154,7 +13154,7 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb rack_adjust_sendmap(rack, &so->so_snd, tp->snd_una); /* Wake up the socket if we have room to write more */ rack_log_wakeup(tp,rack, &so->so_snd, acked, 2); - sowwakeup(so); + sowwakeup_locked(so); m_freem(mfree); } /* update progress */ From owner-dev-commits-src-all@freebsd.org Sat May 22 01:19:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 01:44:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 77AFB6409B1; Sat, 22 May 2021 01:44: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 4Fn5r12bHTz4dXP; Sat, 22 May 2021 01:44: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 40EA31C188; Sat, 22 May 2021 01:44: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 14M1iXNO074013; Sat, 22 May 2021 01:44:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M1iXww074012; Sat, 22 May 2021 01:44:33 GMT (envelope-from git) Date: Sat, 22 May 2021 01:44:33 GMT Message-Id: <202105220144.14M1iXww074012@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: 73e77cf90ba3 - main - Netmap: fix documentation for NR_REG_NIC_SW mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 73e77cf90ba35809adefcc6cd129da5ef15c8e9d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 01:44:33 -0000 The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=73e77cf90ba35809adefcc6cd129da5ef15c8e9d commit 73e77cf90ba35809adefcc6cd129da5ef15c8e9d Author: Allan Jude AuthorDate: 2021-05-17 23:07:53 +0000 Commit: Allan Jude CommitDate: 2021-05-22 01:44:23 +0000 Netmap: fix documentation for NR_REG_NIC_SW mode The correct character to add to the intername name is *, not + Reviewed by: vmaffione, bcr Sponsored By: Klara Inc. Differential Revision: https://reviews.freebsd.org/D30324 --- share/man/man4/netmap.4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man4/netmap.4 b/share/man/man4/netmap.4 index d247c44b0df8..732e3bfaeaab 100644 --- a/share/man/man4/netmap.4 +++ b/share/man/man4/netmap.4 @@ -655,7 +655,7 @@ In the example below, "netmap:foo" is any valid netmap port name. (default) all hardware ring pairs .It NR_REG_SW "netmap:foo^" the ``host rings'', connecting to the host stack. -.It NR_REG_NIC_SW "netmap:foo+" +.It NR_REG_NIC_SW "netmap:foo*" all hardware rings and the host rings .It NR_REG_ONE_NIC "netmap:foo-i" only the i-th hardware ring pair, where the number is in From owner-dev-commits-src-all@freebsd.org Sat May 22 01:56:29 2021 Return-Path: Delivered-To: dev-commits-src-all@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 ED9BF6412E6; Sat, 22 May 2021 01:56: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 4Fn65n6Q9jz4jNv; Sat, 22 May 2021 01:56: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 C475D1C222; Sat, 22 May 2021 01:56: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 14M1uTYo088097; Sat, 22 May 2021 01:56:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M1uTFD088096; Sat, 22 May 2021 01:56:29 GMT (envelope-from git) Date: Sat, 22 May 2021 01:56:29 GMT Message-Id: <202105220156.14M1uTFD088096@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: 20d684ecc9d7 - main - pkt-gen: Allow limiting received packets MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 20d684ecc9d7d9128774f2e3c287058868f48bb0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 01:56:30 -0000 The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=20d684ecc9d7d9128774f2e3c287058868f48bb0 commit 20d684ecc9d7d9128774f2e3c287058868f48bb0 Author: Allan Jude AuthorDate: 2021-05-17 23:04:08 +0000 Commit: Allan Jude CommitDate: 2021-05-22 01:55:29 +0000 pkt-gen: Allow limiting received packets Makes pkg-gen quit after having received N packets, the same way it already supports doing for sent packets. Reviewed by: vmaffione Sponsored by: Klara Inc. MFC after: 4 weeks Differential Revision: https://reviews.freebsd.org/D30266 --- tools/tools/netmap/pkt-gen.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/tools/netmap/pkt-gen.c b/tools/tools/netmap/pkt-gen.c index c958af3b9781..b24915e150a5 100644 --- a/tools/tools/netmap/pkt-gen.c +++ b/tools/tools/netmap/pkt-gen.c @@ -1816,6 +1816,7 @@ receiver_body(void *data) struct netmap_ring *rxring; int i; struct my_ctrs cur; + uint64_t n = targ->g->npackets / targ->g->nthreads; memset(&cur, 0, sizeof(cur)); @@ -1843,7 +1844,7 @@ receiver_body(void *data) /* main loop, exit after 1s silence */ clock_gettime(CLOCK_REALTIME_PRECISE, &targ->tic); if (targ->g->dev_type == DEV_TAP) { - while (!targ->cancel) { + while (!targ->cancel && (n == 0 || targ->ctr.pkts < n)) {) { char buf[MAX_BODYSIZE]; /* XXX should we poll ? */ i = read(targ->g->main_fd, buf, sizeof(buf)); @@ -1855,7 +1856,7 @@ receiver_body(void *data) } #ifndef NO_PCAP } else if (targ->g->dev_type == DEV_PCAP) { - while (!targ->cancel) { + while (!targ->cancel && (n == 0 || targ->ctr.pkts < n)) { /* XXX should we poll ? */ pcap_dispatch(targ->g->p, targ->g->burst, receive_pcap, (u_char *)&targ->ctr); @@ -1866,7 +1867,7 @@ receiver_body(void *data) int dump = targ->g->options & OPT_DUMP; nifp = targ->nmd->nifp; - while (!targ->cancel) { + while (!targ->cancel && (n == 0 || targ->ctr.pkts < n)) { /* Once we started to receive packets, wait at most 1 seconds before quitting. */ #ifdef BUSYWAIT From owner-dev-commits-src-all@freebsd.org Sat May 22 03:50:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DE8C164339C; Sat, 22 May 2021 03:50: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 4Fn8d55jdbz4dpb; Sat, 22 May 2021 03:50: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 ACDB31D4E2; Sat, 22 May 2021 03:50: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 14M3oHpF041986; Sat, 22 May 2021 03:50:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M3oHUV041980; Sat, 22 May 2021 03:50:17 GMT (envelope-from git) Date: Sat, 22 May 2021 03:50:17 GMT Message-Id: <202105220350.14M3oHUV041980@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: ffbb373c5a95 - main - cxgbe(4): Fix build warnings with NOINET kernels. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ffbb373c5a95c37be693330a76a093fbcf546440 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 03:50:17 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=ffbb373c5a95c37be693330a76a093fbcf546440 commit ffbb373c5a95c37be693330a76a093fbcf546440 Author: Navdeep Parhar AuthorDate: 2021-05-22 03:42:04 +0000 Commit: Navdeep Parhar CommitDate: 2021-05-22 03:42:04 +0000 cxgbe(4): Fix build warnings with NOINET kernels. MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D26334 --- sys/dev/cxgbe/t4_sge.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 8a5dc6acc745..4b685129193e 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -333,7 +333,9 @@ static void drain_wrq_wr_list(struct adapter *, struct sge_wrq *); static int sysctl_bufsizes(SYSCTL_HANDLER_ARGS); #ifdef RATELIMIT +#if defined(INET) || defined(INET6) static inline u_int txpkt_eo_len16(u_int, u_int, u_int); +#endif static int ethofld_fw4_ack(struct sge_iq *, const struct rss_header *, struct mbuf *); #endif @@ -1497,12 +1499,14 @@ service_iq(struct sge_iq *iq, int budget) return (0); } +#if defined(INET) || defined(INET6) static inline int sort_before_lro(struct lro_ctrl *lro) { return (lro->lro_mbuf_max != 0); } +#endif static inline uint64_t last_flit_to_ns(struct adapter *sc, uint64_t lf) @@ -2311,6 +2315,7 @@ mbuf_eo_nsegs(struct mbuf *m) return (m->m_pkthdr.PH_loc.eight[1]); } +#if defined(INET) || defined(INET6) static inline void set_mbuf_eo_nsegs(struct mbuf *m, uint8_t nsegs) { @@ -2318,6 +2323,7 @@ set_mbuf_eo_nsegs(struct mbuf *m, uint8_t nsegs) M_ASSERTPKTHDR(m); m->m_pkthdr.PH_loc.eight[1] = nsegs; } +#endif static inline int mbuf_eo_len16(struct mbuf *m) @@ -2331,6 +2337,7 @@ mbuf_eo_len16(struct mbuf *m) return (n); } +#if defined(INET) || defined(INET6) static inline void set_mbuf_eo_len16(struct mbuf *m, uint8_t len16) { @@ -2338,6 +2345,7 @@ set_mbuf_eo_len16(struct mbuf *m, uint8_t len16) M_ASSERTPKTHDR(m); m->m_pkthdr.PH_loc.eight[2] = len16; } +#endif static inline int mbuf_eo_tsclk_tsoff(struct mbuf *m) @@ -2347,6 +2355,7 @@ mbuf_eo_tsclk_tsoff(struct mbuf *m) return (m->m_pkthdr.PH_loc.eight[3]); } +#if defined(INET) || defined(INET6) static inline void set_mbuf_eo_tsclk_tsoff(struct mbuf *m, uint8_t tsclk_tsoff) { @@ -2354,6 +2363,7 @@ set_mbuf_eo_tsclk_tsoff(struct mbuf *m, uint8_t tsclk_tsoff) M_ASSERTPKTHDR(m); m->m_pkthdr.PH_loc.eight[3] = tsclk_tsoff; } +#endif static inline int needs_eo(struct m_snd_tag *mst) @@ -2434,6 +2444,7 @@ needs_vxlan_tso(struct mbuf *m) (m->m_pkthdr.csum_flags & csum_flags) != CSUM_ENCAP_VXLAN); } +#if defined(INET) || defined(INET6) static inline bool needs_inner_tcp_csum(struct mbuf *m) { @@ -2443,6 +2454,7 @@ needs_inner_tcp_csum(struct mbuf *m) return (m->m_pkthdr.csum_flags & csum_flags); } +#endif static inline bool needs_l3_csum(struct mbuf *m) @@ -6421,6 +6433,7 @@ sysctl_bufsizes(SYSCTL_HANDLER_ARGS) } #ifdef RATELIMIT +#if defined(INET) || defined(INET6) /* * len16 for a txpkt WR with a GL. Includes the firmware work request header. */ @@ -6444,6 +6457,7 @@ txpkt_eo_len16(u_int nsegs, u_int immhdrs, u_int tso) done: return (howmany(n, 16)); } +#endif #define ETID_FLOWC_NPARAMS 6 #define ETID_FLOWC_LEN (roundup2((sizeof(struct fw_flowc_wr) + \ From owner-dev-commits-src-all@freebsd.org Sat May 22 09:06:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9678964889D; Sat, 22 May 2021 09:06: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 4FnHfQ3m7nz59Sb; Sat, 22 May 2021 09:06: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 65D6921AA9; Sat, 22 May 2021 09:06: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 14M96saU059951; Sat, 22 May 2021 09:06:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M96spe059950; Sat, 22 May 2021 09:06:54 GMT (envelope-from git) Date: Sat, 22 May 2021 09:06:54 GMT Message-Id: <202105220906.14M96spe059950@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 33621dfc196e - main - Refactor core dumping code a bit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 33621dfc196e317026aa8b9d916567598a1cedcb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:06:54 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=33621dfc196e317026aa8b9d916567598a1cedcb commit 33621dfc196e317026aa8b9d916567598a1cedcb Author: Edward Tomasz Napierala AuthorDate: 2021-05-22 08:58:35 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-22 08:59:00 +0000 Refactor core dumping code a bit This makes it possible to use core_write(), core_output(), and sbuf_drain_core_output(), in Linux coredump code. Moving them out of imgact_elf.c is necessary because of the weird way it's being built. Reviewed By: kib Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30369 --- sys/kern/imgact_elf.c | 160 -------------------------------------------------- sys/kern/kern_exec.c | 147 ++++++++++++++++++++++++++++++++++++++++++++++ sys/sys/exec.h | 19 ++++++ 3 files changed, 166 insertions(+), 160 deletions(-) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 563629b747b5..15976d143988 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -106,8 +106,6 @@ SYSCTL_NODE(_kern, OID_AUTO, __CONCAT(elf, __ELF_WORD_SIZE), CTLFLAG_RW | CTLFLAG_MPSAFE, 0, ""); -#define CORE_BUF_SIZE (16 * 1024) - int __elfN(fallback_brand) = -1; SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, fallback_brand, CTLFLAG_RWTUN, &__elfN(fallback_brand), 0, @@ -1454,23 +1452,11 @@ struct note_info { TAILQ_HEAD(note_info_list, note_info); -/* Coredump output parameters. */ -struct coredump_params { - off_t offset; - struct ucred *active_cred; - struct ucred *file_cred; - struct thread *td; - struct vnode *vp; - struct compressor *comp; -}; - extern int compress_user_cores; extern int compress_user_cores_level; static void cb_put_phdr(vm_map_entry_t, void *); static void cb_size_segment(vm_map_entry_t, void *); -static int core_write(struct coredump_params *, const void *, size_t, off_t, - enum uio_seg, size_t *); static void each_dumpable_segment(struct thread *, segment_callback, void *, int); static int __elfN(corehdr)(struct coredump_params *, int, void *, size_t, @@ -1480,7 +1466,6 @@ static void __elfN(prepare_notes)(struct thread *, struct note_info_list *, static void __elfN(puthdr)(struct thread *, void *, size_t, int, size_t, int); static void __elfN(putnote)(struct note_info *, struct sbuf *); static size_t register_note(struct note_info_list *, int, outfunc_t, void *); -static int sbuf_drain_core_output(void *, const char *, int); static void __elfN(note_fpregset)(void *, struct sbuf *, size_t *); static void __elfN(note_prpsinfo)(void *, struct sbuf *, size_t *); @@ -1498,34 +1483,6 @@ static void note_procstat_rlimit(void *, struct sbuf *, size_t *); static void note_procstat_umask(void *, struct sbuf *, size_t *); static void note_procstat_vmmap(void *, struct sbuf *, size_t *); -/* - * Write out a core segment to the compression stream. - */ -static int -compress_chunk(struct coredump_params *p, char *base, char *buf, u_int len) -{ - u_int chunk_len; - int error; - - while (len > 0) { - chunk_len = MIN(len, CORE_BUF_SIZE); - - /* - * We can get EFAULT error here. - * In that case zero out the current chunk of the segment. - */ - error = copyin(base, buf, chunk_len); - if (error != 0) - bzero(buf, chunk_len); - error = compressor_write(p->comp, buf, chunk_len); - if (error != 0) - break; - base += chunk_len; - len -= chunk_len; - } - return (error); -} - static int core_compressed_write(void *base, size_t len, off_t offset, void *arg) { @@ -1534,123 +1491,6 @@ core_compressed_write(void *base, size_t len, off_t offset, void *arg) UIO_SYSSPACE, NULL)); } -static int -core_write(struct coredump_params *p, const void *base, size_t len, - off_t offset, enum uio_seg seg, size_t *resid) -{ - - return (vn_rdwr_inchunks(UIO_WRITE, p->vp, __DECONST(void *, base), - len, offset, seg, IO_UNIT | IO_DIRECT | IO_RANGELOCKED, - p->active_cred, p->file_cred, resid, p->td)); -} - -static int -core_output(char *base, size_t len, off_t offset, struct coredump_params *p, - void *tmpbuf) -{ - vm_map_t map; - struct mount *mp; - size_t resid, runlen; - int error; - bool success; - - KASSERT((uintptr_t)base % PAGE_SIZE == 0, - ("%s: user address %p is not page-aligned", __func__, base)); - - if (p->comp != NULL) - return (compress_chunk(p, base, tmpbuf, len)); - - map = &p->td->td_proc->p_vmspace->vm_map; - for (; len > 0; base += runlen, offset += runlen, len -= runlen) { - /* - * Attempt to page in all virtual pages in the range. If a - * virtual page is not backed by the pager, it is represented as - * a hole in the file. This can occur with zero-filled - * anonymous memory or truncated files, for example. - */ - for (runlen = 0; runlen < len; runlen += PAGE_SIZE) { - error = vm_fault(map, (uintptr_t)base + runlen, - VM_PROT_READ, VM_FAULT_NOFILL, NULL); - if (runlen == 0) - success = error == KERN_SUCCESS; - else if ((error == KERN_SUCCESS) != success) - break; - } - - if (success) { - error = core_write(p, base, runlen, offset, - UIO_USERSPACE, &resid); - if (error != 0) { - if (error != EFAULT) - break; - - /* - * EFAULT may be returned if the user mapping - * could not be accessed, e.g., because a mapped - * file has been truncated. Skip the page if no - * progress was made, to protect against a - * hypothetical scenario where vm_fault() was - * successful but core_write() returns EFAULT - * anyway. - */ - runlen -= resid; - if (runlen == 0) { - success = false; - runlen = PAGE_SIZE; - } - } - } - if (!success) { - error = vn_start_write(p->vp, &mp, V_WAIT); - if (error != 0) - break; - vn_lock(p->vp, LK_EXCLUSIVE | LK_RETRY); - error = vn_truncate_locked(p->vp, offset + runlen, - false, p->td->td_ucred); - VOP_UNLOCK(p->vp); - vn_finished_write(mp); - if (error != 0) - break; - } - } - return (error); -} - -/* - * Drain into a core file. - */ -static int -sbuf_drain_core_output(void *arg, const char *data, int len) -{ - struct coredump_params *p; - int error, locked; - - p = (struct coredump_params *)arg; - - /* - * Some kern_proc out routines that print to this sbuf may - * call us with the process lock held. Draining with the - * non-sleepable lock held is unsafe. The lock is needed for - * those routines when dumping a live process. In our case we - * can safely release the lock before draining and acquire - * again after. - */ - locked = PROC_LOCKED(p->td->td_proc); - if (locked) - PROC_UNLOCK(p->td->td_proc); - if (p->comp != NULL) - error = compressor_write(p->comp, __DECONST(char *, data), len); - else - error = core_write(p, __DECONST(void *, data), len, p->offset, - UIO_SYSSPACE, NULL); - if (locked) - PROC_LOCK(p->td->td_proc); - if (error != 0) - return (-error); - p->offset += len; - return (len); -} - int __elfN(coredump)(struct thread *td, struct vnode *vp, off_t limit, int flags) { diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 22a050019ce0..04dedfa59c9b 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1867,3 +1868,149 @@ exec_unregister(const struct execsw *execsw_arg) execsw = newexecsw; return (0); } + +/* + * Write out a core segment to the compression stream. + */ +static int +compress_chunk(struct coredump_params *p, char *base, char *buf, u_int len) +{ + u_int chunk_len; + int error; + + while (len > 0) { + chunk_len = MIN(len, CORE_BUF_SIZE); + + /* + * We can get EFAULT error here. + * In that case zero out the current chunk of the segment. + */ + error = copyin(base, buf, chunk_len); + if (error != 0) + bzero(buf, chunk_len); + error = compressor_write(p->comp, buf, chunk_len); + if (error != 0) + break; + base += chunk_len; + len -= chunk_len; + } + return (error); +} + +int +core_write(struct coredump_params *p, const void *base, size_t len, + off_t offset, enum uio_seg seg, size_t *resid) +{ + + return (vn_rdwr_inchunks(UIO_WRITE, p->vp, __DECONST(void *, base), + len, offset, seg, IO_UNIT | IO_DIRECT | IO_RANGELOCKED, + p->active_cred, p->file_cred, resid, p->td)); +} + +int +core_output(char *base, size_t len, off_t offset, struct coredump_params *p, + void *tmpbuf) +{ + vm_map_t map; + struct mount *mp; + size_t resid, runlen; + int error; + bool success; + + KASSERT((uintptr_t)base % PAGE_SIZE == 0, + ("%s: user address %p is not page-aligned", __func__, base)); + + if (p->comp != NULL) + return (compress_chunk(p, base, tmpbuf, len)); + + map = &p->td->td_proc->p_vmspace->vm_map; + for (; len > 0; base += runlen, offset += runlen, len -= runlen) { + /* + * Attempt to page in all virtual pages in the range. If a + * virtual page is not backed by the pager, it is represented as + * a hole in the file. This can occur with zero-filled + * anonymous memory or truncated files, for example. + */ + for (runlen = 0; runlen < len; runlen += PAGE_SIZE) { + error = vm_fault(map, (uintptr_t)base + runlen, + VM_PROT_READ, VM_FAULT_NOFILL, NULL); + if (runlen == 0) + success = error == KERN_SUCCESS; + else if ((error == KERN_SUCCESS) != success) + break; + } + + if (success) { + error = core_write(p, base, runlen, offset, + UIO_USERSPACE, &resid); + if (error != 0) { + if (error != EFAULT) + break; + + /* + * EFAULT may be returned if the user mapping + * could not be accessed, e.g., because a mapped + * file has been truncated. Skip the page if no + * progress was made, to protect against a + * hypothetical scenario where vm_fault() was + * successful but core_write() returns EFAULT + * anyway. + */ + runlen -= resid; + if (runlen == 0) { + success = false; + runlen = PAGE_SIZE; + } + } + } + if (!success) { + error = vn_start_write(p->vp, &mp, V_WAIT); + if (error != 0) + break; + vn_lock(p->vp, LK_EXCLUSIVE | LK_RETRY); + error = vn_truncate_locked(p->vp, offset + runlen, + false, p->td->td_ucred); + VOP_UNLOCK(p->vp); + vn_finished_write(mp); + if (error != 0) + break; + } + } + return (error); +} + +/* + * Drain into a core file. + */ +int +sbuf_drain_core_output(void *arg, const char *data, int len) +{ + struct coredump_params *p; + int error, locked; + + p = (struct coredump_params *)arg; + + /* + * Some kern_proc out routines that print to this sbuf may + * call us with the process lock held. Draining with the + * non-sleepable lock held is unsafe. The lock is needed for + * those routines when dumping a live process. In our case we + * can safely release the lock before draining and acquire + * again after. + */ + locked = PROC_LOCKED(p->td->td_proc); + if (locked) + PROC_UNLOCK(p->td->td_proc); + if (p->comp != NULL) + error = compressor_write(p->comp, __DECONST(char *, data), len); + else + error = core_write(p, __DECONST(void *, data), len, p->offset, + UIO_SYSSPACE, NULL); + if (locked) + PROC_LOCK(p->td->td_proc); + if (error != 0) + return (-error); + p->offset += len; + return (len); +} + diff --git a/sys/sys/exec.h b/sys/sys/exec.h index c7b3aa8b9550..39ebb7efee47 100644 --- a/sys/sys/exec.h +++ b/sys/sys/exec.h @@ -60,6 +60,16 @@ struct ps_strings { unsigned int ps_nenvstr; /* the number of environment strings */ }; +/* Coredump output parameters. */ +struct coredump_params { + off_t offset; + struct ucred *active_cred; + struct ucred *file_cred; + struct thread *td; + struct vnode *vp; + struct compressor *comp; +}; + struct image_params; struct execsw { @@ -84,6 +94,15 @@ void exec_unmap_first_page(struct image_params *); int exec_register(const struct execsw *); int exec_unregister(const struct execsw *); +enum uio_seg; + +#define CORE_BUF_SIZE (16 * 1024) + +int core_write(struct coredump_params *, const void *, size_t, off_t, + enum uio_seg, size_t *); +int core_output(char *, size_t, off_t, struct coredump_params *, void *); +int sbuf_drain_core_output(void *, const char *, int); + extern int coredump_pack_fileinfo; extern int coredump_pack_vmmapinfo; From owner-dev-commits-src-all@freebsd.org Sat May 22 09:31:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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 98AE6648F1C; Sat, 22 May 2021 09:31: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 4FnJBz3kXFz3Mt3; Sat, 22 May 2021 09:31: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 68C8321E78; Sat, 22 May 2021 09:31: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 14M9VdND095517; Sat, 22 May 2021 09:31:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9Vdm2095516; Sat, 22 May 2021 09:31:39 GMT (envelope-from git) Date: Sat, 22 May 2021 09:31:39 GMT Message-Id: <202105220931.14M9Vdm2095516@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: d713bf79273a - main - vn_need_pageq_flush(): simplify 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/main X-Git-Reftype: branch X-Git-Commit: d713bf79273ad928f591dee2f8a553487e515e9b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:31:39 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d713bf79273ad928f591dee2f8a553487e515e9b commit d713bf79273ad928f591dee2f8a553487e515e9b Author: Konstantin Belousov AuthorDate: 2021-05-21 07:34:27 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:29:44 +0000 vn_need_pageq_flush(): simplify There is no need to own vnode interlock, since v_object is type stable and can only change to/from NULL, and no other checks in the function access fields protected by the interlock. Remove the need variable, the result of the test is directly usable as return value. Tested by: mav, pho Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/kern/vfs_subr.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 18c5b5b3b148..620d3e974397 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -5184,14 +5184,10 @@ int vn_need_pageq_flush(struct vnode *vp) { struct vm_object *obj; - int need; - MPASS(mtx_owned(VI_MTX(vp))); - need = 0; - if ((obj = vp->v_object) != NULL && (vp->v_vflag & VV_NOSYNC) == 0 && - vm_object_mightbedirty(obj)) - need = 1; - return (need); + obj = vp->v_object; + return (obj != NULL && (vp->v_vflag & VV_NOSYNC) == 0 && + vm_object_mightbedirty(obj)); } /* From owner-dev-commits-src-all@freebsd.org Sat May 22 09:31:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D692E649129; Sat, 22 May 2021 09:31: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 4FnJC05C1zz3Mn3; Sat, 22 May 2021 09:31: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 900112235F; Sat, 22 May 2021 09:31: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 14M9VeAg095538; Sat, 22 May 2021 09:31:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9VewJ095537; Sat, 22 May 2021 09:31:40 GMT (envelope-from git) Date: Sat, 22 May 2021 09:31:40 GMT Message-Id: <202105220931.14M9VewJ095537@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 42881526d401 - main - nullfs: dirty v_object must imply the need for inactivation 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/main X-Git-Reftype: branch X-Git-Commit: 42881526d401e7a9c09241e392b7ffa18cfe11d6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:31:41 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=42881526d401e7a9c09241e392b7ffa18cfe11d6 commit 42881526d401e7a9c09241e392b7ffa18cfe11d6 Author: Konstantin Belousov AuthorDate: 2021-05-21 07:30:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:30:17 +0000 nullfs: dirty v_object must imply the need for inactivation Otherwise pages are cleaned some time later when the lower fs decides that it is time to do it. This mostly manifests itself as delayed mtime update, e.g. breaking make-like programs. Reported by: mav Tested by: mav, pho Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/fs/nullfs/null_vnops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 5bf470897c08..aeebce4ed086 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -818,7 +818,7 @@ static int null_need_inactive(struct vop_need_inactive_args *ap) { - return (null_want_recycle(ap->a_vp)); + return (null_want_recycle(ap->a_vp) || vn_need_pageq_flush(ap->a_vp)); } /* From owner-dev-commits-src-all@freebsd.org Sat May 22 09:46:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 09:46:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 09:46:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 09:46:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 09:46:29 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 09:46:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 09:46:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 09:46:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 09:46:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 09:46:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 09:46:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 09:46:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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=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-all@freebsd.org Sat May 22 09:46:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 09:46:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 09:46:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 09:46:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 09:46:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 09:46:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:42 -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-all@freebsd.org Sat May 22 10:56:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D83A664ABE6; Sat, 22 May 2021 10:56: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 4FnL555RXfz4mXk; Sat, 22 May 2021 10:56: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 86A0D230F5; Sat, 22 May 2021 10:56: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 14MAufR6005378; Sat, 22 May 2021 10:56:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MAufEi005377; Sat, 22 May 2021 10:56:41 GMT (envelope-from git) Date: Sat, 22 May 2021 10:56:41 GMT Message-Id: <202105221056.14MAufEi005377@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: d6fd321ef60d - main - run(4): add support for ASUS USB-N14 wireless adaptor. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d6fd321ef60d43dce9f437187c94a7de2b91ab69 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 10:56:42 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=d6fd321ef60d43dce9f437187c94a7de2b91ab69 commit d6fd321ef60d43dce9f437187c94a7de2b91ab69 Author: Dmitry Chagin AuthorDate: 2021-05-22 10:52:12 +0000 Commit: Dmitry Chagin CommitDate: 2021-05-22 10:52:12 +0000 run(4): add support for ASUS USB-N14 wireless adaptor. PR: 255759 Submitted by: john.lmurdoch at gmail.com MFC After: 1 week --- sys/dev/usb/usbdevs | 1 + sys/dev/usb/wlan/if_run.c | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index d92d98614b07..91a243e26bac 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -1266,6 +1266,7 @@ product ASUS USBN66 0x17ad USB-N66 product ASUS USBN10NANO 0x17ba USB-N10 Nano product ASUS USBAC51 0x17d1 USB-AC51 product ASUS USBAC56 0x17d2 USB-AC56 +product ASUS USBN14 0x17e8 USB-N14 product ASUS A730W 0x4202 ASUS MyPal A730W product ASUS P535 0x420f ASUS P535 PDA product ASUS GMSC 0x422f ASUS Generic Mass Storage diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c index dbbdc9bdcbd2..c7f0ae40f666 100644 --- a/sys/dev/usb/wlan/if_run.c +++ b/sys/dev/usb/wlan/if_run.c @@ -173,6 +173,7 @@ static const STRUCT_USB_HOST_ID run_devs[] = { RUN_DEV(ASUS, RT3070_1), RUN_DEV(ASUS, USBN66), RUN_DEV(ASUS, USB_N53), + RUN_DEV(ASUS, USBN14), RUN_DEV(ASUS2, USBN11), RUN_DEV(AZUREWAVE, RT2870_1), RUN_DEV(AZUREWAVE, RT2870_2), From owner-dev-commits-src-all@freebsd.org Sat May 22 12:16:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 65CC664C9B6; Sat, 22 May 2021 12:16: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 4FnMsd2Nh1z4Rmg; Sat, 22 May 2021 12:16: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 3A1FC244DD; Sat, 22 May 2021 12:16: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 14MCGrKm011697; Sat, 22 May 2021 12:16:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MCGr8C011696; Sat, 22 May 2021 12:16:53 GMT (envelope-from git) Date: Sat, 22 May 2021 12:16:53 GMT Message-Id: <202105221216.14MCGr8C011696@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 70c05850e276 - main - kern_descrip.c: Style 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/main X-Git-Reftype: branch X-Git-Commit: 70c05850e276624bb3eb928fa52160712909ec7b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 12:16:53 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=70c05850e276624bb3eb928fa52160712909ec7b commit 70c05850e276624bb3eb928fa52160712909ec7b Author: Konstantin Belousov AuthorDate: 2021-05-14 23:22:22 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 12:16:08 +0000 kern_descrip.c: Style Wrap too long lines. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30257 --- sys/kern/kern_descrip.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 30ac40ffe296..168bddda9c45 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -4405,17 +4405,20 @@ kern_proc_filedesc_out(struct proc *p, struct sbuf *sb, ssize_t maxlen, /* working directory */ if (pwd->pwd_cdir != NULL) { vrefact(pwd->pwd_cdir); - export_vnode_to_sb(pwd->pwd_cdir, KF_FD_TYPE_CWD, FREAD, efbuf); + export_vnode_to_sb(pwd->pwd_cdir, KF_FD_TYPE_CWD, + FREAD, efbuf); } /* root directory */ if (pwd->pwd_rdir != NULL) { vrefact(pwd->pwd_rdir); - export_vnode_to_sb(pwd->pwd_rdir, KF_FD_TYPE_ROOT, FREAD, efbuf); + export_vnode_to_sb(pwd->pwd_rdir, KF_FD_TYPE_ROOT, + FREAD, efbuf); } /* jail directory */ if (pwd->pwd_jdir != NULL) { vrefact(pwd->pwd_jdir); - export_vnode_to_sb(pwd->pwd_jdir, KF_FD_TYPE_JAIL, FREAD, efbuf); + export_vnode_to_sb(pwd->pwd_jdir, KF_FD_TYPE_JAIL, + FREAD, efbuf); } } PWDDESC_XUNLOCK(pdp); From owner-dev-commits-src-all@freebsd.org Sat May 22 12:16:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9AB7164C842; Sat, 22 May 2021 12:16: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 4FnMsf3V0pz4Rvt; Sat, 22 May 2021 12:16: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 58DCF24178; Sat, 22 May 2021 12:16: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 14MCGsTw011718; Sat, 22 May 2021 12:16:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MCGsvi011717; Sat, 22 May 2021 12:16:54 GMT (envelope-from git) Date: Sat, 22 May 2021 12:16:54 GMT Message-Id: <202105221216.14MCGsvi011717@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 9bb84c23e762 - main - accounting: explicitly mark the exiting thread as doing accounting 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/main X-Git-Reftype: branch X-Git-Commit: 9bb84c23e762e7d1b6154ef4afdcc80662692e76 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 12:16:54 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9bb84c23e762e7d1b6154ef4afdcc80662692e76 commit 9bb84c23e762e7d1b6154ef4afdcc80662692e76 Author: Konstantin Belousov AuthorDate: 2021-05-13 23:48:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 12:16:08 +0000 accounting: explicitly mark the exiting thread as doing accounting and use the mark to stop applying file size limits on the write of the accounting record. This allows to remove hack to clear process limits in acct_process(), and avoids the bug with the clearing being ineffective because limits are also cached in the thread structure. Reported and reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30257 --- sys/kern/kern_acct.c | 26 +++++--------------------- sys/kern/vfs_vnops.c | 3 ++- sys/sys/proc.h | 1 + 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c index 675113c6b2ba..4c1efada10da 100644 --- a/sys/kern/kern_acct.c +++ b/sys/kern/kern_acct.c @@ -141,7 +141,6 @@ static int acct_configured; static int acct_suspended; static struct vnode *acct_vp; static struct ucred *acct_cred; -static struct plimit *acct_limit; static int acct_flags; static struct sx acct_sx; @@ -206,7 +205,7 @@ int sys_acct(struct thread *td, struct acct_args *uap) { struct nameidata nd; - int error, flags, i, replacing; + int error, flags, replacing; error = priv_check(td, PRIV_ACCT); if (error) @@ -276,15 +275,6 @@ sys_acct(struct thread *td, struct acct_args *uap) return (error); } - /* - * Create our own plimit object without limits. It will be assigned - * to exiting processes. - */ - acct_limit = lim_alloc(); - for (i = 0; i < RLIM_NLIMITS; i++) - acct_limit->pl_rlimit[i].rlim_cur = - acct_limit->pl_rlimit[i].rlim_max = RLIM_INFINITY; - /* * Save the new accounting file vnode, and schedule the new * free space watcher. @@ -328,7 +318,6 @@ acct_disable(struct thread *td, int logging) sx_assert(&acct_sx, SX_XLOCKED); error = vn_close(acct_vp, acct_flags, acct_cred, td); crfree(acct_cred); - lim_free(acct_limit); acct_configured = 0; acct_vp = NULL; acct_cred = NULL; @@ -349,7 +338,6 @@ acct_process(struct thread *td) { struct acctv3 acct; struct timeval ut, st, tmp; - struct plimit *oldlim; struct proc *p; struct rusage ru; int t, ret; @@ -374,6 +362,7 @@ acct_process(struct thread *td) } p = td->td_proc; + td->td_pflags2 |= TDP2_ACCT; /* * Get process accounting information. @@ -426,20 +415,14 @@ acct_process(struct thread *td) /* (8) The boolean flags that tell how the process terminated, etc. */ acct.ac_flagx = p->p_acflag; + PROC_UNLOCK(p); + /* Setup ancillary structure fields. */ acct.ac_flagx |= ANVER; acct.ac_zero = 0; acct.ac_version = 3; acct.ac_len = acct.ac_len2 = sizeof(acct); - /* - * Eliminate rlimits (file size limit in particular). - */ - oldlim = p->p_limit; - p->p_limit = lim_hold(acct_limit); - PROC_UNLOCK(p); - lim_free(oldlim); - /* * Write the accounting information to the file. */ @@ -447,6 +430,7 @@ acct_process(struct thread *td) (off_t)0, UIO_SYSSPACE, IO_APPEND|IO_UNIT, acct_cred, NOCRED, NULL, td); sx_sunlock(&acct_sx); + td->td_pflags2 &= ~TDP2_ACCT; return (ret); } diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 6bf798cd73c5..69da69da19d4 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -2360,7 +2360,8 @@ vn_rlimit_fsize(const struct vnode *vp, const struct uio *uio, struct thread *td) { - if (vp->v_type != VREG || td == NULL) + if (vp->v_type != VREG || td == NULL || + (td->td_pflags2 & TDP2_ACCT) != 0) return (0); if ((uoff_t)uio->uio_offset + uio->uio_resid > lim_cur(td, RLIMIT_FSIZE)) { diff --git a/sys/sys/proc.h b/sys/sys/proc.h index ebd396b4aebe..d957412424aa 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -528,6 +528,7 @@ do { \ #define TDP2_SBPAGES 0x00000001 /* Owns sbusy on some pages */ #define TDP2_COMPAT32RB 0x00000002 /* compat32 ABI for robust lists */ +#define TDP2_ACCT 0x00000004 /* Doing accounting */ /* * Reasons that the current thread can not be run yet. From owner-dev-commits-src-all@freebsd.org Sat May 22 12:16:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E9A3164C7DD; Sat, 22 May 2021 12: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 4FnMsh54dFz4S7x; Sat, 22 May 2021 12: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 8EC83240CD; Sat, 22 May 2021 12: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 14MCGu9B011767; Sat, 22 May 2021 12: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 14MCGuCZ011765; Sat, 22 May 2021 12:16:56 GMT (envelope-from git) Date: Sat, 22 May 2021 12:16:56 GMT Message-Id: <202105221216.14MCGuCZ011765@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 1762f674ccb5 - main - ktrace: pack all ktrace parameters into allocated structure ktr_io_params 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/main X-Git-Reftype: branch X-Git-Commit: 1762f674ccb571e6b03c009906dd1af3c6343f9b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 12:16:57 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1762f674ccb571e6b03c009906dd1af3c6343f9b commit 1762f674ccb571e6b03c009906dd1af3c6343f9b Author: Konstantin Belousov AuthorDate: 2021-05-14 23:22:55 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 12:16:08 +0000 ktrace: pack all ktrace parameters into allocated structure ktr_io_params Ref-count the ktr_io_params structure instead of vnode/cred. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30257 --- sys/kern/kern_descrip.c | 6 +- sys/kern/kern_exec.c | 16 ++-- sys/kern/kern_ktrace.c | 234 ++++++++++++++++++++++++++++++------------------ sys/kern/kern_proc.c | 5 +- sys/kern/kern_thread.c | 12 +-- sys/sys/ktrace.h | 6 +- sys/sys/proc.h | 3 +- 7 files changed, 170 insertions(+), 112 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 168bddda9c45..09eb0770bcda 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -79,9 +79,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef KTRACE #include -#endif #include @@ -4363,9 +4361,7 @@ kern_proc_filedesc_out(struct proc *p, struct sbuf *sb, ssize_t maxlen, PROC_LOCK_ASSERT(p, MA_OWNED); /* ktrace vnode */ - tracevp = p->p_tracevp; - if (tracevp != NULL) - vrefact(tracevp); + tracevp = ktr_get_tracevp(p, true); /* text vnode */ textvp = p->p_textvp; if (textvp != NULL) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 04dedfa59c9b..d9b9e1ae122b 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -374,8 +374,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p, struct pargs *oldargs = NULL, *newargs = NULL; struct sigacts *oldsigacts = NULL, *newsigacts = NULL; #ifdef KTRACE - struct vnode *tracevp = NULL; - struct ucred *tracecred = NULL; + struct ktr_io_params *kiop; #endif struct vnode *oldtextvp = NULL, *newtextvp; int credential_changing; @@ -391,6 +390,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p, static const char fexecv_proc_title[] = "(fexecv)"; imgp = &image_params; + kiop = NULL; /* * Lock the process and set the P_INEXEC flag to indicate that @@ -780,11 +780,10 @@ interpret: * we do not regain any tracing during a possible block. */ setsugid(p); + kiop = NULL; #ifdef KTRACE - if (p->p_tracecred != NULL && - priv_check_cred(p->p_tracecred, PRIV_DEBUG_DIFFCRED)) - ktrprocexec(p, &tracecred, &tracevp); + kiop = ktrprocexec(p); #endif /* * Close any file descriptors 0..2 that reference procfs, @@ -939,12 +938,7 @@ exec_fail: */ if (oldtextvp != NULL) vrele(oldtextvp); -#ifdef KTRACE - if (tracevp != NULL) - vrele(tracevp); - if (tracecred != NULL) - crfree(tracecred); -#endif + ktr_io_params_free(kiop); pargs_drop(oldargs); pargs_drop(newargs); if (oldsigacts != NULL) diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 9916022961e9..c03eea4991a1 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -145,20 +145,27 @@ static int print_message = 1; static struct mtx ktrace_mtx; static struct sx ktrace_sx; +struct ktr_io_params { + struct vnode *vp; + struct ucred *cr; + u_int refs; +}; + static void ktrace_init(void *dummy); static int sysctl_kern_ktrace_request_pool(SYSCTL_HANDLER_ARGS); static u_int ktrace_resize_pool(u_int oldsize, u_int newsize); static struct ktr_request *ktr_getrequest_entered(struct thread *td, int type); static struct ktr_request *ktr_getrequest(int type); static void ktr_submitrequest(struct thread *td, struct ktr_request *req); -static void ktr_freeproc(struct proc *p, struct ucred **uc, - struct vnode **vp); +static struct ktr_io_params *ktr_freeproc(struct proc *p); static void ktr_freerequest(struct ktr_request *req); static void ktr_freerequest_locked(struct ktr_request *req); static void ktr_writerequest(struct thread *td, struct ktr_request *req); static int ktrcanset(struct thread *,struct proc *); -static int ktrsetchildren(struct thread *,struct proc *,int,int,struct vnode *); -static int ktrops(struct thread *,struct proc *,int,int,struct vnode *); +static int ktrsetchildren(struct thread *, struct proc *, int, int, + struct ktr_io_params *); +static int ktrops(struct thread *, struct proc *, int, int, + struct ktr_io_params *); static void ktrprocctor_entered(struct thread *, struct proc *); /* @@ -421,28 +428,85 @@ ktr_freerequest_locked(struct ktr_request *req) STAILQ_INSERT_HEAD(&ktr_free, req, ktr_list); } +static void +ktr_io_params_ref(struct ktr_io_params *kiop) +{ + mtx_assert(&ktrace_mtx, MA_OWNED); + kiop->refs++; +} + +static struct ktr_io_params * +ktr_io_params_rele(struct ktr_io_params *kiop) +{ + mtx_assert(&ktrace_mtx, MA_OWNED); + if (kiop == NULL) + return (NULL); + KASSERT(kiop->refs > 0, ("kiop ref == 0 %p", kiop)); + return (--(kiop->refs) == 0 ? kiop : NULL); +} + +void +ktr_io_params_free(struct ktr_io_params *kiop) +{ + if (kiop == NULL) + return; + + MPASS(kiop->refs == 0); + vn_close(kiop->vp, FWRITE, kiop->cr, curthread); + crfree(kiop->cr); + free(kiop, M_KTRACE); +} + +static struct ktr_io_params * +ktr_io_params_alloc(struct thread *td, struct vnode *vp) +{ + struct ktr_io_params *res; + + res = malloc(sizeof(struct ktr_io_params), M_KTRACE, M_WAITOK); + res->vp = vp; + res->cr = crhold(td->td_ucred); + res->refs = 1; + return (res); +} + /* * Disable tracing for a process and release all associated resources. * The caller is responsible for releasing a reference on the returned * vnode and credentials. */ -static void -ktr_freeproc(struct proc *p, struct ucred **uc, struct vnode **vp) +static struct ktr_io_params * +ktr_freeproc(struct proc *p) { + struct ktr_io_params *kiop; struct ktr_request *req; PROC_LOCK_ASSERT(p, MA_OWNED); mtx_assert(&ktrace_mtx, MA_OWNED); - *uc = p->p_tracecred; - p->p_tracecred = NULL; - if (vp != NULL) - *vp = p->p_tracevp; - p->p_tracevp = NULL; + kiop = ktr_io_params_rele(p->p_ktrioparms); + p->p_ktrioparms = NULL; p->p_traceflag = 0; while ((req = STAILQ_FIRST(&p->p_ktr)) != NULL) { STAILQ_REMOVE_HEAD(&p->p_ktr, ktr_list); ktr_freerequest_locked(req); } + return (kiop); +} + +struct vnode * +ktr_get_tracevp(struct proc *p, bool ref) +{ + struct vnode *vp; + + PROC_LOCK_ASSERT(p, MA_OWNED); + + if (p->p_ktrioparms != NULL) { + vp = p->p_ktrioparms->vp; + if (ref) + vrefact(vp); + } else { + vp = NULL; + } + return (vp); } void @@ -501,14 +565,21 @@ ktrsysret(int code, int error, register_t retval) * * XXX: We toss any pending asynchronous records. */ -void -ktrprocexec(struct proc *p, struct ucred **uc, struct vnode **vp) +struct ktr_io_params * +ktrprocexec(struct proc *p) { + struct ktr_io_params *kiop; PROC_LOCK_ASSERT(p, MA_OWNED); + + kiop = p->p_ktrioparms; + if (kiop == NULL || priv_check_cred(kiop->cr, PRIV_DEBUG_DIFFCRED)) + return (NULL); + mtx_lock(&ktrace_mtx); - ktr_freeproc(p, uc, vp); + kiop = ktr_freeproc(p); mtx_unlock(&ktrace_mtx); + return (kiop); } /* @@ -520,8 +591,7 @@ ktrprocexit(struct thread *td) { struct ktr_request *req; struct proc *p; - struct ucred *cred; - struct vnode *vp; + struct ktr_io_params *kiop; p = td->td_proc; if (p->p_traceflag == 0) @@ -536,13 +606,10 @@ ktrprocexit(struct thread *td) sx_xunlock(&ktrace_sx); PROC_LOCK(p); mtx_lock(&ktrace_mtx); - ktr_freeproc(p, &cred, &vp); + kiop = ktr_freeproc(p); mtx_unlock(&ktrace_mtx); PROC_UNLOCK(p); - if (vp != NULL) - vrele(vp); - if (cred != NULL) - crfree(cred); + ktr_io_params_free(kiop); ktrace_exit(td); } @@ -583,7 +650,7 @@ void ktrprocfork(struct proc *p1, struct proc *p2) { - MPASS(p2->p_tracevp == NULL); + MPASS(p2->p_ktrioparms == NULL); MPASS(p2->p_traceflag == 0); if (p1->p_traceflag == 0) @@ -593,12 +660,8 @@ ktrprocfork(struct proc *p1, struct proc *p2) mtx_lock(&ktrace_mtx); if (p1->p_traceflag & KTRFAC_INHERIT) { p2->p_traceflag = p1->p_traceflag; - if ((p2->p_tracevp = p1->p_tracevp) != NULL) { - VREF(p2->p_tracevp); - KASSERT(p1->p_tracecred != NULL, - ("ktrace vnode with no cred")); - p2->p_tracecred = crhold(p1->p_tracecred); - } + if ((p2->p_ktrioparms = p1->p_ktrioparms) != NULL) + p1->p_ktrioparms->refs++; } mtx_unlock(&ktrace_mtx); PROC_UNLOCK(p1); @@ -932,7 +995,7 @@ sys_ktrace(struct thread *td, struct ktrace_args *uap) int nfound, ret = 0; int flags, error = 0; struct nameidata nd; - struct ucred *cred; + struct ktr_io_params *kiop, *old_kiop; /* * Need something to (un)trace. @@ -940,6 +1003,7 @@ sys_ktrace(struct thread *td, struct ktrace_args *uap) if (ops != KTROP_CLEARFILE && facs == 0) return (EINVAL); + kiop = NULL; ktrace_enter(td); if (ops != KTROP_CLEAR) { /* @@ -960,34 +1024,34 @@ sys_ktrace(struct thread *td, struct ktrace_args *uap) ktrace_exit(td); return (EACCES); } + kiop = ktr_io_params_alloc(td, vp); } /* * Clear all uses of the tracefile. */ if (ops == KTROP_CLEARFILE) { - int vrele_count; - - vrele_count = 0; +restart: sx_slock(&allproc_lock); FOREACH_PROC_IN_SYSTEM(p) { + old_kiop = NULL; PROC_LOCK(p); - if (p->p_tracevp == vp) { + if (p->p_ktrioparms != NULL && + p->p_ktrioparms->vp == vp) { if (ktrcanset(td, p)) { mtx_lock(&ktrace_mtx); - ktr_freeproc(p, &cred, NULL); + old_kiop = ktr_freeproc(p); mtx_unlock(&ktrace_mtx); - vrele_count++; - crfree(cred); } else error = EPERM; } PROC_UNLOCK(p); + if (old_kiop != NULL) { + sx_sunlock(&allproc_lock); + ktr_io_params_free(old_kiop); + goto restart; + } } sx_sunlock(&allproc_lock); - if (vrele_count > 0) { - while (vrele_count-- > 0) - vrele(vp); - } goto done; } /* @@ -1019,9 +1083,9 @@ sys_ktrace(struct thread *td, struct ktrace_args *uap) } nfound++; if (descend) - ret |= ktrsetchildren(td, p, ops, facs, vp); + ret |= ktrsetchildren(td, p, ops, facs, kiop); else - ret |= ktrops(td, p, ops, facs, vp); + ret |= ktrops(td, p, ops, facs, kiop); } if (nfound == 0) { sx_sunlock(&proctree_lock); @@ -1044,16 +1108,20 @@ sys_ktrace(struct thread *td, struct ktrace_args *uap) goto done; } if (descend) - ret |= ktrsetchildren(td, p, ops, facs, vp); + ret |= ktrsetchildren(td, p, ops, facs, kiop); else - ret |= ktrops(td, p, ops, facs, vp); + ret |= ktrops(td, p, ops, facs, kiop); } sx_sunlock(&proctree_lock); if (!ret) error = EPERM; done: - if (vp != NULL) - (void) vn_close(vp, FWRITE, td->td_ucred, td); + if (kiop != NULL) { + mtx_lock(&ktrace_mtx); + kiop = ktr_io_params_rele(kiop); + mtx_unlock(&ktrace_mtx); + ktr_io_params_free(kiop); + } ktrace_exit(td); return (error); #else /* !KTRACE */ @@ -1097,10 +1165,10 @@ sys_utrace(struct thread *td, struct utrace_args *uap) #ifdef KTRACE static int -ktrops(struct thread *td, struct proc *p, int ops, int facs, struct vnode *vp) +ktrops(struct thread *td, struct proc *p, int ops, int facs, + struct ktr_io_params *new_kiop) { - struct vnode *tracevp = NULL; - struct ucred *tracecred = NULL; + struct ktr_io_params *old_kiop; PROC_LOCK_ASSERT(p, MA_OWNED); if (!ktrcanset(td, p)) { @@ -1112,19 +1180,18 @@ ktrops(struct thread *td, struct proc *p, int ops, int facs, struct vnode *vp) PROC_UNLOCK(p); return (1); } + old_kiop = NULL; mtx_lock(&ktrace_mtx); if (ops == KTROP_SET) { - if (p->p_tracevp != vp) { - /* - * if trace file already in use, relinquish below - */ - tracevp = p->p_tracevp; - VREF(vp); - p->p_tracevp = vp; + if (p->p_ktrioparms != NULL && + p->p_ktrioparms->vp != new_kiop->vp) { + /* if trace file already in use, relinquish below */ + old_kiop = ktr_io_params_rele(p->p_ktrioparms); + p->p_ktrioparms = NULL; } - if (p->p_tracecred != td->td_ucred) { - tracecred = p->p_tracecred; - p->p_tracecred = crhold(td->td_ucred); + if (p->p_ktrioparms == NULL) { + p->p_ktrioparms = new_kiop; + ktr_io_params_ref(new_kiop); } p->p_traceflag |= facs; if (priv_check(td, PRIV_KTRACE) == 0) @@ -1133,23 +1200,20 @@ ktrops(struct thread *td, struct proc *p, int ops, int facs, struct vnode *vp) /* KTROP_CLEAR */ if (((p->p_traceflag &= ~facs) & KTRFAC_MASK) == 0) /* no more tracing */ - ktr_freeproc(p, &tracecred, &tracevp); + old_kiop = ktr_freeproc(p); } mtx_unlock(&ktrace_mtx); if ((p->p_traceflag & KTRFAC_MASK) != 0) ktrprocctor_entered(td, p); PROC_UNLOCK(p); - if (tracevp != NULL) - vrele(tracevp); - if (tracecred != NULL) - crfree(tracecred); + ktr_io_params_free(old_kiop); return (1); } static int ktrsetchildren(struct thread *td, struct proc *top, int ops, int facs, - struct vnode *vp) + struct ktr_io_params *new_kiop) { struct proc *p; int ret = 0; @@ -1158,7 +1222,7 @@ ktrsetchildren(struct thread *td, struct proc *top, int ops, int facs, PROC_LOCK_ASSERT(p, MA_OWNED); sx_assert(&proctree_lock, SX_LOCKED); for (;;) { - ret |= ktrops(td, p, ops, facs, vp); + ret |= ktrops(td, p, ops, facs, new_kiop); /* * If this process has children, descend to them next, * otherwise do any siblings, and if done with this level, @@ -1183,6 +1247,7 @@ ktrsetchildren(struct thread *td, struct proc *top, int ops, int facs, static void ktr_writerequest(struct thread *td, struct ktr_request *req) { + struct ktr_io_params *kiop; struct ktr_header *kth; struct vnode *vp; struct proc *p; @@ -1193,6 +1258,8 @@ ktr_writerequest(struct thread *td, struct ktr_request *req) int datalen, buflen; int error; + p = td->td_proc; + /* * We hold the vnode and credential for use in I/O in case ktrace is * disabled on the process as we write out the request. @@ -1201,20 +1268,22 @@ ktr_writerequest(struct thread *td, struct ktr_request *req) * the vnode has been closed. */ mtx_lock(&ktrace_mtx); - vp = td->td_proc->p_tracevp; - cred = td->td_proc->p_tracecred; + + kiop = p->p_ktrioparms; /* - * If vp is NULL, the vp has been cleared out from under this - * request, so just drop it. Make sure the credential and vnode are - * in sync: we should have both or neither. + * If kiop is NULL, it has been cleared out from under this + * request, so just drop it. */ - if (vp == NULL) { - KASSERT(cred == NULL, ("ktr_writerequest: cred != NULL")); + if (kiop == NULL) { mtx_unlock(&ktrace_mtx); return; } - VREF(vp); + + vp = kiop->vp; + cred = kiop->cr; + + vrefact(vp); KASSERT(cred != NULL, ("ktr_writerequest: cred == NULL")); crhold(cred); mtx_unlock(&ktrace_mtx); @@ -1258,7 +1327,7 @@ ktr_writerequest(struct thread *td, struct ktr_request *req) VOP_UNLOCK(vp); vn_finished_write(mp); crfree(cred); - if (!error) { + if (error == 0) { vrele(vp); return; } @@ -1268,24 +1337,17 @@ ktr_writerequest(struct thread *td, struct ktr_request *req) * process. Other processes might still be suitable for * writes to this vnode. */ - p = td->td_proc; log(LOG_NOTICE, "ktrace write failed, errno %d, tracing stopped for pid %d\n", error, p->p_pid); - cred = NULL; - sx_slock(&allproc_lock); + PROC_LOCK(p); mtx_lock(&ktrace_mtx); - if (p->p_tracevp == vp) - ktr_freeproc(p, &cred, NULL); + if (p->p_ktrioparms != NULL && p->p_ktrioparms->vp == vp) + kiop = ktr_freeproc(p); mtx_unlock(&ktrace_mtx); PROC_UNLOCK(p); - if (cred != NULL) { - crfree(cred); - cred = NULL; - } - sx_sunlock(&allproc_lock); - vrele(vp); + ktr_io_params_free(kiop); vrele(vp); } diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 33f168836370..ec732e8db060 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -75,6 +75,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef KTRACE +#include +#endif #ifdef DDB #include @@ -1058,7 +1061,7 @@ fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp) kp->ki_args = p->p_args; kp->ki_textvp = p->p_textvp; #ifdef KTRACE - kp->ki_tracep = p->p_tracevp; + kp->ki_tracep = ktr_get_tracevp(p, false); kp->ki_traceflag = p->p_traceflag; #endif kp->ki_fd = p->p_fd; diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index d5549baa6ad5..a52d6e75fd03 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -96,11 +96,11 @@ _Static_assert(offsetof(struct proc, p_flag) == 0xb8, "struct proc KBI p_flag"); _Static_assert(offsetof(struct proc, p_pid) == 0xc4, "struct proc KBI p_pid"); -_Static_assert(offsetof(struct proc, p_filemon) == 0x3c0, +_Static_assert(offsetof(struct proc, p_filemon) == 0x3b8, "struct proc KBI p_filemon"); -_Static_assert(offsetof(struct proc, p_comm) == 0x3d8, +_Static_assert(offsetof(struct proc, p_comm) == 0x3d0, "struct proc KBI p_comm"); -_Static_assert(offsetof(struct proc, p_emuldata) == 0x4b8, +_Static_assert(offsetof(struct proc, p_emuldata) == 0x4b0, "struct proc KBI p_emuldata"); #endif #ifdef __i386__ @@ -116,11 +116,11 @@ _Static_assert(offsetof(struct proc, p_flag) == 0x6c, "struct proc KBI p_flag"); _Static_assert(offsetof(struct proc, p_pid) == 0x78, "struct proc KBI p_pid"); -_Static_assert(offsetof(struct proc, p_filemon) == 0x26c, +_Static_assert(offsetof(struct proc, p_filemon) == 0x268, "struct proc KBI p_filemon"); -_Static_assert(offsetof(struct proc, p_comm) == 0x280, +_Static_assert(offsetof(struct proc, p_comm) == 0x27c, "struct proc KBI p_comm"); -_Static_assert(offsetof(struct proc, p_emuldata) == 0x30c, +_Static_assert(offsetof(struct proc, p_emuldata) == 0x308, "struct proc KBI p_emuldata"); #endif diff --git a/sys/sys/ktrace.h b/sys/sys/ktrace.h index a0b02f7d3ac5..c4ab985722c0 100644 --- a/sys/sys/ktrace.h +++ b/sys/sys/ktrace.h @@ -265,6 +265,10 @@ struct ktr_struct_array { #define KTRFAC_DROP 0x20000000 /* last event was dropped */ #ifdef _KERNEL +struct ktr_io_params; + +struct vnode *ktr_get_tracevp(struct proc *, bool); +void ktr_io_params_free(struct ktr_io_params *); void ktrnamei(char *); void ktrcsw(int, int, const char *); void ktrpsig(int, sig_t, sigset_t *, int); @@ -275,7 +279,7 @@ void ktrsyscall(int, int narg, register_t args[]); void ktrsysctl(int *name, u_int namelen); void ktrsysret(int, int, register_t); void ktrprocctor(struct proc *); -void ktrprocexec(struct proc *, struct ucred **, struct vnode **); +struct ktr_io_params *ktrprocexec(struct proc *); void ktrprocexit(struct thread *); void ktrprocfork(struct proc *, struct proc *); void ktruserret(struct thread *); diff --git a/sys/sys/proc.h b/sys/sys/proc.h index d957412424aa..c54d4399f948 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -662,8 +662,7 @@ struct proc { int p_profthreads; /* (c) Num threads in addupc_task. */ volatile int p_exitthreads; /* (j) Number of threads exiting */ int p_traceflag; /* (o) Kernel trace points. */ - struct vnode *p_tracevp; /* (c + o) Trace to vnode. */ - struct ucred *p_tracecred; /* (o) Credentials to trace with. */ + struct ktr_io_params *p_ktrioparms; /* (c + o) Params for ktrace. */ struct vnode *p_textvp; /* (b) Vnode of executable. */ u_int p_lock; /* (c) Proclock (prevent swap) count. */ struct sigiolst p_sigiolst; /* (c) List of sigio sources. */ From owner-dev-commits-src-all@freebsd.org Sat May 22 12:16:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9687764CB83; Sat, 22 May 2021 12:16: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 4FnMsk03mWz4S84; Sat, 22 May 2021 12:16: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 A79C3244DE; Sat, 22 May 2021 12:16: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 14MCGvqY011788; Sat, 22 May 2021 12:16:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MCGvs7011787; Sat, 22 May 2021 12:16:57 GMT (envelope-from git) Date: Sat, 22 May 2021 12:16:57 GMT Message-Id: <202105221216.14MCGvs7011787@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 02645b886bc6 - main - ktrace: use the limit of the trace initiator for file size limit on writes 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/main X-Git-Reftype: branch X-Git-Commit: 02645b886bc62dfd8a998fd51d2e6c1bbca03ecb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 12:16:58 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=02645b886bc62dfd8a998fd51d2e6c1bbca03ecb commit 02645b886bc62dfd8a998fd51d2e6c1bbca03ecb Author: Konstantin Belousov AuthorDate: 2021-05-14 23:51:01 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 12:16:09 +0000 ktrace: use the limit of the trace initiator for file size limit on writes Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30257 --- sys/kern/kern_ktrace.c | 6 ++++++ sys/kern/vfs_vnops.c | 18 ++++++++++-------- sys/sys/proc.h | 1 + 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index c03eea4991a1..b686f2e2717a 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -148,6 +149,7 @@ static struct sx ktrace_sx; struct ktr_io_params { struct vnode *vp; struct ucred *cr; + off_t lim; u_int refs; }; @@ -465,6 +467,7 @@ ktr_io_params_alloc(struct thread *td, struct vnode *vp) res = malloc(sizeof(struct ktr_io_params), M_KTRACE, M_WAITOK); res->vp = vp; res->cr = crhold(td->td_ucred); + res->lim = lim_cur(td, RLIMIT_FSIZE); res->refs = 1; return (res); } @@ -1255,6 +1258,7 @@ ktr_writerequest(struct thread *td, struct ktr_request *req) struct uio auio; struct iovec aiov[3]; struct mount *mp; + off_t lim; int datalen, buflen; int error; @@ -1282,6 +1286,7 @@ ktr_writerequest(struct thread *td, struct ktr_request *req) vp = kiop->vp; cred = kiop->cr; + lim = kiop->lim; vrefact(vp); KASSERT(cred != NULL, ("ktr_writerequest: cred == NULL")); @@ -1319,6 +1324,7 @@ ktr_writerequest(struct thread *td, struct ktr_request *req) vn_start_write(vp, &mp, V_WAIT); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + td->td_ktr_io_lim = lim; #ifdef MAC error = mac_vnode_check_write(cred, NOCRED, vp); if (error == 0) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 69da69da19d4..9c309c83f805 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -2359,18 +2359,20 @@ int vn_rlimit_fsize(const struct vnode *vp, const struct uio *uio, struct thread *td) { + off_t lim; if (vp->v_type != VREG || td == NULL || (td->td_pflags2 & TDP2_ACCT) != 0) return (0); - if ((uoff_t)uio->uio_offset + uio->uio_resid > - lim_cur(td, RLIMIT_FSIZE)) { - PROC_LOCK(td->td_proc); - kern_psignal(td->td_proc, SIGXFSZ); - PROC_UNLOCK(td->td_proc); - return (EFBIG); - } - return (0); + ktr_write = (td->td_pflags & TDP_INKTRACE) != 0; + lim = ktr_write ? td->td_ktr_io_lim : lim_cur(td, RLIMIT_FSIZE); + if ((uoff_t)uio->uio_offset + uio->uio_resid < lim) + return (0); + + PROC_LOCK(td->td_proc); + kern_psignal(td->td_proc, SIGXFSZ); + PROC_UNLOCK(td->td_proc); + return (EFBIG); } int diff --git a/sys/sys/proc.h b/sys/sys/proc.h index c54d4399f948..926f0de14b84 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -378,6 +378,7 @@ struct thread { void *td_lkpi_task; /* LinuxKPI task struct pointer */ int td_pmcpend; void *td_coredump; /* (c) coredump request. */ + off_t td_ktr_io_lim; /* (k) limit for ktrace file size */ #ifdef EPOCH_TRACE SLIST_HEAD(, epoch_tracker) td_epochs; #endif From owner-dev-commits-src-all@freebsd.org Sat May 22 12:16:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2B89A64C9BB; Sat, 22 May 2021 12: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 4FnMsg6Q8vz4Rvy; Sat, 22 May 2021 12:16: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 7075B2439D; Sat, 22 May 2021 12:16: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 14MCGt4Y011739; Sat, 22 May 2021 12:16:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MCGtbO011738; Sat, 22 May 2021 12:16:55 GMT (envelope-from git) Date: Sat, 22 May 2021 12:16:55 GMT Message-Id: <202105221216.14MCGtbO011738@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: a6144f713cee - main - ktrace: do not stop tracing other processes if our cannot write to this vnode 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/main X-Git-Reftype: branch X-Git-Commit: a6144f713cee8f522150b1398b225eedbf4cfef1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 12:16:56 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a6144f713cee8f522150b1398b225eedbf4cfef1 commit a6144f713cee8f522150b1398b225eedbf4cfef1 Author: Konstantin Belousov AuthorDate: 2021-05-15 00:10:05 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 12:16:08 +0000 ktrace: do not stop tracing other processes if our cannot write to this vnode Other processes might still be able to write, make the decision to stop based on the per-process situation. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30257 --- sys/kern/kern_ktrace.c | 53 ++++++++++++++++++-------------------------------- 1 file changed, 19 insertions(+), 34 deletions(-) diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 8728801acdf7..9916022961e9 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -1190,7 +1190,7 @@ ktr_writerequest(struct thread *td, struct ktr_request *req) struct uio auio; struct iovec aiov[3]; struct mount *mp; - int datalen, buflen, vrele_count; + int datalen, buflen; int error; /* @@ -1264,44 +1264,29 @@ ktr_writerequest(struct thread *td, struct ktr_request *req) } /* - * If error encountered, give up tracing on this vnode. We defer - * all the vrele()'s on the vnode until after we are finished walking - * the various lists to avoid needlessly holding locks. - * NB: at this point we still hold the vnode reference that must - * not go away as we need the valid vnode to compare with. Thus let - * vrele_count start at 1 and the reference will be freed - * by the loop at the end after our last use of vp. - */ - log(LOG_NOTICE, "ktrace write failed, errno %d, tracing stopped\n", - error); - vrele_count = 1; - /* - * First, clear this vnode from being used by any processes in the - * system. - * XXX - If one process gets an EPERM writing to the vnode, should - * we really do this? Other processes might have suitable - * credentials for the operation. + * If error encountered, give up tracing on this vnode on this + * process. Other processes might still be suitable for + * writes to this vnode. */ + p = td->td_proc; + log(LOG_NOTICE, + "ktrace write failed, errno %d, tracing stopped for pid %d\n", + error, p->p_pid); cred = NULL; sx_slock(&allproc_lock); - FOREACH_PROC_IN_SYSTEM(p) { - PROC_LOCK(p); - if (p->p_tracevp == vp) { - mtx_lock(&ktrace_mtx); - ktr_freeproc(p, &cred, NULL); - mtx_unlock(&ktrace_mtx); - vrele_count++; - } - PROC_UNLOCK(p); - if (cred != NULL) { - crfree(cred); - cred = NULL; - } + PROC_LOCK(p); + mtx_lock(&ktrace_mtx); + if (p->p_tracevp == vp) + ktr_freeproc(p, &cred, NULL); + mtx_unlock(&ktrace_mtx); + PROC_UNLOCK(p); + if (cred != NULL) { + crfree(cred); + cred = NULL; } sx_sunlock(&allproc_lock); - - while (vrele_count-- > 0) - vrele(vp); + vrele(vp); + vrele(vp); } /* From owner-dev-commits-src-all@freebsd.org Sat May 22 12:17:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A3B2164CB8E; Sat, 22 May 2021 12:17: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 4FnMsm0gSMz4SC4; Sat, 22 May 2021 12:17: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 EF90C244DF; Sat, 22 May 2021 12:16: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 14MCGxJ8011830; Sat, 22 May 2021 12:16:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MCGxZp011829; Sat, 22 May 2021 12:16:59 GMT (envelope-from git) Date: Sat, 22 May 2021 12:16:59 GMT Message-Id: <202105221216.14MCGxZp011829@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: f784da883fd5 - main - Move mnt_maxsymlinklen into appropriate fs mount data structures 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/main X-Git-Reftype: branch X-Git-Commit: f784da883fd5a744fcaf4ccfc550ca497ea5d7a6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 12:17:00 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f784da883fd5a744fcaf4ccfc550ca497ea5d7a6 commit f784da883fd5a744fcaf4ccfc550ca497ea5d7a6 Author: Konstantin Belousov AuthorDate: 2021-05-18 01:42:03 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 12:16:09 +0000 Move mnt_maxsymlinklen into appropriate fs mount data structures Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week X-MFC-Note: struct mount layout Differential revision: https://reviews.freebsd.org/D30325 --- sys/fs/cd9660/cd9660_vfsops.c | 1 - sys/fs/ext2fs/ext2_inode.c | 2 +- sys/fs/ext2fs/ext2_vfsops.c | 2 +- sys/fs/ext2fs/ext2_vnops.c | 7 ++++--- sys/fs/ext2fs/ext2fs.h | 1 + sys/kern/vfs_subr.c | 2 -- sys/sys/mount.h | 1 - sys/ufs/ffs/ffs_inode.c | 2 +- sys/ufs/ffs/ffs_vfsops.c | 4 ++-- sys/ufs/ffs/ffs_vnops.c | 2 +- sys/ufs/ufs/ufs_dirhash.c | 1 - sys/ufs/ufs/ufs_lookup.c | 8 ++------ sys/ufs/ufs/ufs_vnops.c | 14 +++++++------- sys/ufs/ufs/ufsmount.h | 5 +++++ 14 files changed, 25 insertions(+), 27 deletions(-) diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index 21d3c3e13a8f..5d475bec93b8 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -378,7 +378,6 @@ iso_mountfs(devvp, mp) mp->mnt_data = isomp; mp->mnt_stat.f_fsid.val[0] = dev2udev(dev); mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum; - mp->mnt_maxsymlinklen = 0; MNT_ILOCK(mp); if (isverified) mp->mnt_flag |= MNT_VERIFIED; diff --git a/sys/fs/ext2fs/ext2_inode.c b/sys/fs/ext2fs/ext2_inode.c index 1412017b4b3c..b27c0b0ec4ec 100644 --- a/sys/fs/ext2fs/ext2_inode.c +++ b/sys/fs/ext2fs/ext2_inode.c @@ -562,7 +562,7 @@ ext2_truncate(struct vnode *vp, off_t length, int flags, struct ucred *cred, ip = VTOI(vp); if (vp->v_type == VLNK && - ip->i_size < vp->v_mount->mnt_maxsymlinklen) { + ip->i_size < VFSTOEXT2(vp->v_mount)->um_e2fs->e2fs_maxsymlinklen) { #ifdef INVARIANTS if (length != 0) panic("ext2_truncate: partial truncate of symlink"); diff --git a/sys/fs/ext2fs/ext2_vfsops.c b/sys/fs/ext2fs/ext2_vfsops.c index 43cfdf3a1a0b..d15fed3d2913 100644 --- a/sys/fs/ext2fs/ext2_vfsops.c +++ b/sys/fs/ext2fs/ext2_vfsops.c @@ -924,6 +924,7 @@ ext2_mountfs(struct vnode *devvp, struct mount *mp) */ e2fs_maxcontig = MAX(1, maxphys / ump->um_e2fs->e2fs_bsize); ump->um_e2fs->e2fs_contigsumsize = MIN(e2fs_maxcontig, EXT2_MAXCONTIG); + ump->um_e2fs->e2fs_maxsymlinklen = EXT2_MAXSYMLINKLEN; if (ump->um_e2fs->e2fs_contigsumsize > 0) { size = ump->um_e2fs->e2fs_gcount * sizeof(int32_t); ump->um_e2fs->e2fs_maxcluster = malloc(size, M_EXT2MNT, M_WAITOK); @@ -957,7 +958,6 @@ ext2_mountfs(struct vnode *devvp, struct mount *mp) mp->mnt_data = ump; mp->mnt_stat.f_fsid.val[0] = dev2udev(dev); mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum; - mp->mnt_maxsymlinklen = EXT2_MAXSYMLINKLEN; MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; MNT_IUNLOCK(mp); diff --git a/sys/fs/ext2fs/ext2_vnops.c b/sys/fs/ext2fs/ext2_vnops.c index 2721aa535b40..367d48ab68f1 100644 --- a/sys/fs/ext2fs/ext2_vnops.c +++ b/sys/fs/ext2fs/ext2_vnops.c @@ -1533,7 +1533,7 @@ ext2_symlink(struct vop_symlink_args *ap) return (error); vp = *vpp; len = strlen(ap->a_target); - if (len < vp->v_mount->mnt_maxsymlinklen) { + if (len < VFSTOEXT2(vp->v_mount)->um_e2fs->e2fs_maxsymlinklen) { ip = VTOI(vp); bcopy(ap->a_target, (char *)ip->i_shortlink, len); ip->i_size = len; @@ -1558,7 +1558,7 @@ ext2_readlink(struct vop_readlink_args *ap) int isize; isize = ip->i_size; - if (isize < vp->v_mount->mnt_maxsymlinklen) { + if (isize < VFSTOEXT2(vp->v_mount)->um_e2fs->e2fs_maxsymlinklen) { uiomove((char *)ip->i_shortlink, isize, ap->a_uio); return (0); } @@ -2075,7 +2075,8 @@ ext2_read(struct vop_read_args *ap) panic("%s: mode", "ext2_read"); if (vp->v_type == VLNK) { - if ((int)ip->i_size < vp->v_mount->mnt_maxsymlinklen) + if ((int)ip->i_size < + VFSTOEXT2(vp->v_mount)->um_e2fs->e2fs_maxsymlinklen) panic("%s: short symlink", "ext2_read"); } else if (vp->v_type != VREG && vp->v_type != VDIR) panic("%s: type %d", "ext2_read", vp->v_type); diff --git a/sys/fs/ext2fs/ext2fs.h b/sys/fs/ext2fs/ext2fs.h index b11ccc0b5b5a..1761f31454fd 100644 --- a/sys/fs/ext2fs/ext2fs.h +++ b/sys/fs/ext2fs/ext2fs.h @@ -184,6 +184,7 @@ struct m_ext2fs { struct csum *e2fs_clustersum; /* cluster summary in each cyl group */ int32_t e2fs_uhash; /* 3 if hash should be signed, 0 if not */ uint32_t e2fs_csum_seed; /* sb checksum seed */ + uint64_t e2fs_maxsymlinklen; /* max size of short symlink */ }; /* cluster summary information */ diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 620d3e974397..979cccf0e0dc 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -4464,8 +4464,6 @@ DB_SHOW_COMMAND(mount, db_show_mount) mp->mnt_lazyvnodelistsize); db_printf(" mnt_writeopcount = %d (with %d in the struct)\n", vfs_mount_fetch_counter(mp, MNT_COUNT_WRITEOPCOUNT), mp->mnt_writeopcount); - db_printf(" mnt_maxsymlinklen = %jd\n", - (uintmax_t)mp->mnt_maxsymlinklen); db_printf(" mnt_iosize_max = %d\n", mp->mnt_iosize_max); db_printf(" mnt_hashseed = %u\n", mp->mnt_hashseed); db_printf(" mnt_lockref = %d (with %d in the struct)\n", diff --git a/sys/sys/mount.h b/sys/sys/mount.h index f341370ecd86..a1d4bfd15ddb 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -224,7 +224,6 @@ struct mount { int mnt_writeopcount; /* (i) write syscalls pending */ struct vfsoptlist *mnt_opt; /* current mount options */ struct vfsoptlist *mnt_optnew; /* new options passed to fs */ - uint64_t mnt_maxsymlinklen; /* max size of short symlink */ struct statfs mnt_stat; /* cache of filesystem stats */ struct ucred *mnt_cred; /* credentials of mounter */ void * mnt_data; /* private data */ diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 8fe7f7ab97de..b3d41aa023f9 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -329,7 +329,7 @@ ffs_truncate(vp, length, flags, cred) } if ((flags & IO_NORMAL) == 0) return (0); - if (vp->v_type == VLNK && ip->i_size < vp->v_mount->mnt_maxsymlinklen) { + if (vp->v_type == VLNK && ip->i_size < ump->um_maxsymlinklen) { #ifdef INVARIANTS if (length != 0) panic("ffs_truncate: partial truncate of symlink"); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 321ed03f7f67..6b7407eb88f9 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -932,7 +932,7 @@ ffs_reload(struct mount *mp, struct thread *td, int flags) sblockloc = fs->fs_sblockloc; bcopy(newfs, fs, (u_int)fs->fs_sbsize); brelse(bp); - mp->mnt_maxsymlinklen = fs->fs_maxsymlinklen; + ump->um_maxsymlinklen = fs->fs_maxsymlinklen; ffs_oldfscompat_read(fs, VFSTOUFS(mp), sblockloc); UFS_LOCK(ump); if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) { @@ -1192,7 +1192,7 @@ ffs_mountfs(odevvp, mp, td) vfs_rel(nmp); vfs_getnewfsid(mp); } - mp->mnt_maxsymlinklen = fs->fs_maxsymlinklen; + ump->um_maxsymlinklen = fs->fs_maxsymlinklen; MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; MNT_IUNLOCK(mp); diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 05eb19c0ee13..a10afd86f8e6 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -675,7 +675,7 @@ ffs_read(ap) panic("ffs_read: mode"); if (vp->v_type == VLNK) { - if ((int)ip->i_size < vp->v_mount->mnt_maxsymlinklen) + if ((int)ip->i_size < VFSTOUFS(vp->v_mount)->um_maxsymlinklen) panic("ffs_read: short symlink"); } else if (vp->v_type != VREG && vp->v_type != VDIR) panic("ffs_read: type %d", vp->v_type); diff --git a/sys/ufs/ufs/ufs_dirhash.c b/sys/ufs/ufs/ufs_dirhash.c index d1e1bed0bde4..8981ffdfc269 100644 --- a/sys/ufs/ufs/ufs_dirhash.c +++ b/sys/ufs/ufs/ufs_dirhash.c @@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$"); #define WRAPINCR(val, limit) (((val) + 1 == (limit)) ? 0 : ((val) + 1)) #define WRAPDECR(val, limit) (((val) == 0) ? ((limit) - 1) : ((val) - 1)) -#define OFSFMT(vp) ((vp)->v_mount->mnt_maxsymlinklen <= 0) #define BLKFREE2IDX(n) ((n) > DH_NFSTATS ? DH_NFSTATS : (n)) static MALLOC_DEFINE(M_DIRHASH, "ufs_dirhash", "UFS directory hash tables"); diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c index 0509185c4663..b7bf4eb6c86c 100644 --- a/sys/ufs/ufs/ufs_lookup.c +++ b/sys/ufs/ufs/ufs_lookup.c @@ -76,9 +76,6 @@ static int dirchk = 0; SYSCTL_INT(_debug, OID_AUTO, dircheck, CTLFLAG_RW, &dirchk, 0, ""); -/* true if old FS format...*/ -#define OFSFMT(vp) ((vp)->v_mount->mnt_maxsymlinklen <= 0) - static int ufs_delete_denied(struct vnode *vdp, struct vnode *tdp, struct ucred *cred, struct thread *td) @@ -440,8 +437,7 @@ foundentry: * reclen in ndp->ni_ufs area, and release * directory buffer. */ - if (vdp->v_mount->mnt_maxsymlinklen > 0 && - ep->d_type == DT_WHT) { + if (!OFSFMT(vdp) && ep->d_type == DT_WHT) { slotstatus = FOUND; slotoffset = i_offset; slotsize = ep->d_reclen; @@ -854,7 +850,7 @@ ufs_makedirentry(ip, cnp, newdirp) bcopy(cnp->cn_nameptr, newdirp->d_name, namelen); - if (ITOV(ip)->v_mount->mnt_maxsymlinklen > 0) + if (!OFSFMT(ITOV(ip))) newdirp->d_type = IFTODT(ip->i_mode); else { newdirp->d_type = 0; diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 70bf1a1d9036..ef288a32e815 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1155,7 +1155,7 @@ ufs_whiteout(ap) switch (ap->a_flags) { case LOOKUP: /* 4.4 format directories support whiteout operations */ - if (dvp->v_mount->mnt_maxsymlinklen > 0) + if (!OFSFMT(dvp)) return (0); return (EOPNOTSUPP); @@ -1164,7 +1164,7 @@ ufs_whiteout(ap) #ifdef INVARIANTS if ((cnp->cn_flags & SAVENAME) == 0) panic("ufs_whiteout: missing name"); - if (dvp->v_mount->mnt_maxsymlinklen <= 0) + if (OFSFMT(dvp)) panic("ufs_whiteout: old format filesystem"); #endif @@ -1178,7 +1178,7 @@ ufs_whiteout(ap) case DELETE: /* remove an existing directory whiteout */ #ifdef INVARIANTS - if (dvp->v_mount->mnt_maxsymlinklen <= 0) + if (OFSFMT(dvp)) panic("ufs_whiteout: old format filesystem"); #endif @@ -2083,7 +2083,7 @@ ufs_mkdir(ap) /* * Initialize directory with "." and ".." from static template. */ - if (dvp->v_mount->mnt_maxsymlinklen > 0) + if (!OFSFMT(dvp)) dtp = &mastertemplate; else dtp = (struct dirtemplate *)&omastertemplate; @@ -2287,7 +2287,7 @@ ufs_symlink(ap) return (error); vp = *vpp; len = strlen(ap->a_target); - if (len < vp->v_mount->mnt_maxsymlinklen) { + if (len < VFSTOUFS(vp->v_mount)->um_maxsymlinklen) { ip = VTOI(vp); bcopy(ap->a_target, SHORTLINK(ip), len); ip->i_size = len; @@ -2377,7 +2377,7 @@ ufs_readdir(ap) } #if BYTE_ORDER == LITTLE_ENDIAN /* Old filesystem format. */ - if (vp->v_mount->mnt_maxsymlinklen <= 0) { + if (OFSFMT(vp)) { dstdp.d_namlen = dp->d_type; dstdp.d_type = dp->d_namlen; } else @@ -2458,7 +2458,7 @@ ufs_readlink(ap) doff_t isize; isize = ip->i_size; - if (isize < vp->v_mount->mnt_maxsymlinklen) + if (isize < VFSTOUFS(vp->v_mount)->um_maxsymlinklen) return (uiomove(SHORTLINK(ip), isize, ap->a_uio)); return (VOP_READ(vp, ap->a_uio, 0, ap->a_cred)); } diff --git a/sys/ufs/ufs/ufsmount.h b/sys/ufs/ufs/ufsmount.h index 0dfcecb178af..6071faec795c 100644 --- a/sys/ufs/ufs/ufsmount.h +++ b/sys/ufs/ufs/ufsmount.h @@ -100,6 +100,8 @@ struct ufsmount { u_long um_nindir; /* (c) indirect ptrs per blk */ u_long um_bptrtodb; /* (c) indir disk block ptr */ u_long um_seqinc; /* (c) inc between seq blocks */ + uint64_t um_maxsymlinklen; /* (c) max size of short + symlink */ struct mtx um_lock; /* (c) Protects ufsmount & fs */ pid_t um_fsckpid; /* (u) PID can do fsck sysctl */ struct mount_softdeps *um_softdep; /* (c) softdep mgmt structure */ @@ -194,4 +196,7 @@ struct ufsmount { #define blkptrtodb(ump, b) ((b) << (ump)->um_bptrtodb) #define is_sequential(ump, a, b) ((b) == (a) + ump->um_seqinc) +/* true if old FS format...*/ +#define OFSFMT(vp) (VFSTOUFS((vp)->v_mount)->um_maxsymlinklen <= 0) + #endif From owner-dev-commits-src-all@freebsd.org Sat May 22 12:16:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 96D8664CB85; Sat, 22 May 2021 12:16: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 4FnMsl0cbBz4S1M; Sat, 22 May 2021 12:16: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 C43A22439E; Sat, 22 May 2021 12:16: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 14MCGwL0011809; Sat, 22 May 2021 12:16:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MCGw20011808; Sat, 22 May 2021 12:16:58 GMT (envelope-from git) Date: Sat, 22 May 2021 12:16:58 GMT Message-Id: <202105221216.14MCGw20011808@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: ea2b64c24133 - main - ktrace: add a kern.ktrace.filesize_limit_signal knob 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/main X-Git-Reftype: branch X-Git-Commit: ea2b64c2413355ac0d5fc6ff597342e9437a34d4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 12:16:59 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ea2b64c2413355ac0d5fc6ff597342e9437a34d4 commit ea2b64c2413355ac0d5fc6ff597342e9437a34d4 Author: Konstantin Belousov AuthorDate: 2021-05-18 16:05:39 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 12:16:09 +0000 ktrace: add a kern.ktrace.filesize_limit_signal knob When enabled, writes to ktrace.out that exceed the max file size limit cause SIGXFSZ as it should be, but note that the limit is taken from the process that initiated ktrace. When disabled, write is blocked, but signal is not send. Note that in either case ktrace for the affected process is stopped. Requested and reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30257 --- sys/kern/kern_ktrace.c | 10 ++++++++++ sys/kern/vfs_vnops.c | 10 +++++++--- sys/sys/ktrace.h | 1 + 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index b686f2e2717a..8783600df6b1 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -142,6 +142,16 @@ u_int ktr_geniosize = PAGE_SIZE; SYSCTL_UINT(_kern_ktrace, OID_AUTO, genio_size, CTLFLAG_RWTUN, &ktr_geniosize, 0, "Maximum size of genio event payload"); +/* + * Allow to not to send signal to traced process, in which context the + * ktr record is written. The limit is applied from the process that + * set up ktrace, so killing the traced process is not completely fair. + */ +int ktr_filesize_limit_signal = 0; +SYSCTL_INT(_kern_ktrace, OID_AUTO, filesize_limit_signal, CTLFLAG_RWTUN, + &ktr_filesize_limit_signal, 0, + "Send SIGXFSZ to the traced process when the log size limit is exceeded"); + static int print_message = 1; static struct mtx ktrace_mtx; static struct sx ktrace_sx; diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 9c309c83f805..9e45d1820eec 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -2360,6 +2361,7 @@ vn_rlimit_fsize(const struct vnode *vp, const struct uio *uio, struct thread *td) { off_t lim; + bool ktr_write; if (vp->v_type != VREG || td == NULL || (td->td_pflags2 & TDP2_ACCT) != 0) @@ -2369,9 +2371,11 @@ vn_rlimit_fsize(const struct vnode *vp, const struct uio *uio, if ((uoff_t)uio->uio_offset + uio->uio_resid < lim) return (0); - PROC_LOCK(td->td_proc); - kern_psignal(td->td_proc, SIGXFSZ); - PROC_UNLOCK(td->td_proc); + if (!ktr_write || ktr_filesize_limit_signal) { + PROC_LOCK(td->td_proc); + kern_psignal(td->td_proc, SIGXFSZ); + PROC_UNLOCK(td->td_proc); + } return (EFBIG); } diff --git a/sys/sys/ktrace.h b/sys/sys/ktrace.h index c4ab985722c0..50030d002f97 100644 --- a/sys/sys/ktrace.h +++ b/sys/sys/ktrace.h @@ -299,6 +299,7 @@ void ktrcapfail(enum ktr_cap_fail_type, const cap_rights_t *, #define ktrstat_error(s, error) \ ktrstruct_error("stat", (s), sizeof(struct stat), error) extern u_int ktr_geniosize; +extern int ktr_filesize_limit_signal; #else #include From owner-dev-commits-src-all@freebsd.org Sat May 22 12:39:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BC01964D385; Sat, 22 May 2021 12:39: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 4FnNN24xmpz4bnG; Sat, 22 May 2021 12:39: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 91F7124354; Sat, 22 May 2021 12:39: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 14MCdkjh038654; Sat, 22 May 2021 12:39:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MCdkfP038653; Sat, 22 May 2021 12:39:46 GMT (envelope-from git) Date: Sat, 22 May 2021 12:39:46 GMT Message-Id: <202105221239.14MCdkfP038653@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 8923ce630492 - main - tcp: Handle stack switch while processing socket options MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8923ce630492d21ec57c2637757bcc44da9970f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 12:39:46 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=8923ce630492d21ec57c2637757bcc44da9970f8 commit 8923ce630492d21ec57c2637757bcc44da9970f8 Author: Michael Tuexen AuthorDate: 2021-05-22 12:35:09 +0000 Commit: Michael Tuexen CommitDate: 2021-05-22 12:39:36 +0000 tcp: Handle stack switch while processing socket options Handle the case where during socket option processing, the user switches a stack such that processing the stack specific socket option does not make sense anymore. Return an error in this case. MFC after: 1 week Reviewed by: markj Reported by: syzbot+a6e1d91f240ad5d72cd1@syzkaller.appspotmail.com Sponsored by: Netflix, Inc. Differential revision: https://reviews.freebsd.org/D30395 --- sys/netinet/tcp_stacks/bbr.c | 62 ++++++++++++++++++++++++------------------- sys/netinet/tcp_stacks/rack.c | 60 ++++++++++++++++++++++------------------- 2 files changed, 67 insertions(+), 55 deletions(-) diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index dd4cbfd7dc53..56691def6e1d 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -518,6 +518,10 @@ static void bbr_log_pacing_delay_calc(struct tcp_bbr *bbr, uint16_t gain, uint32_t len, uint32_t cts, uint32_t usecs, uint64_t bw, uint32_t override, int mod); +static int +bbr_ctloutput(struct socket *so, struct sockopt *sopt, struct inpcb *inp, + struct tcpcb *tp); + static inline uint8_t bbr_state_val(struct tcp_bbr *bbr) { @@ -14197,6 +14201,33 @@ bbr_mtu_chg(struct tcpcb *tp) } } +static int +bbr_pru_options(struct tcpcb *tp, int flags) +{ + if (flags & PRUS_OOB) + return (EOPNOTSUPP); + return (0); +} + +struct tcp_function_block __tcp_bbr = { + .tfb_tcp_block_name = __XSTRING(STACKNAME), + .tfb_tcp_output = bbr_output, + .tfb_do_queued_segments = ctf_do_queued_segments, + .tfb_do_segment_nounlock = bbr_do_segment_nounlock, + .tfb_tcp_do_segment = bbr_do_segment, + .tfb_tcp_ctloutput = bbr_ctloutput, + .tfb_tcp_fb_init = bbr_init, + .tfb_tcp_fb_fini = bbr_fini, + .tfb_tcp_timer_stop_all = bbr_stopall, + .tfb_tcp_timer_activate = bbr_timer_activate, + .tfb_tcp_timer_active = bbr_timer_active, + .tfb_tcp_timer_stop = bbr_timer_stop, + .tfb_tcp_rexmit_tmr = bbr_remxt_tmr, + .tfb_tcp_handoff_ok = bbr_handoff_ok, + .tfb_tcp_mtu_chg = bbr_mtu_chg, + .tfb_pru_options = bbr_pru_options, +}; + /* * bbr_ctloutput() must drop the inpcb lock before performing copyin on * socket option arguments. When it re-acquires the lock after the copy, it @@ -14269,6 +14300,10 @@ bbr_set_sockopt(struct socket *so, struct sockopt *sopt, return (ECONNRESET); } tp = intotcpcb(inp); + if (tp->t_fb != &__tcp_bbr) { + INP_WUNLOCK(inp); + return (ENOPROTOOPT); + } bbr = (struct tcp_bbr *)tp->t_fb_ptr; switch (sopt->sopt_name) { case TCP_BBR_PACE_PER_SEC: @@ -14772,33 +14807,6 @@ out: return (error); } -static int -bbr_pru_options(struct tcpcb *tp, int flags) -{ - if (flags & PRUS_OOB) - return (EOPNOTSUPP); - return (0); -} - -struct tcp_function_block __tcp_bbr = { - .tfb_tcp_block_name = __XSTRING(STACKNAME), - .tfb_tcp_output = bbr_output, - .tfb_do_queued_segments = ctf_do_queued_segments, - .tfb_do_segment_nounlock = bbr_do_segment_nounlock, - .tfb_tcp_do_segment = bbr_do_segment, - .tfb_tcp_ctloutput = bbr_ctloutput, - .tfb_tcp_fb_init = bbr_init, - .tfb_tcp_fb_fini = bbr_fini, - .tfb_tcp_timer_stop_all = bbr_stopall, - .tfb_tcp_timer_activate = bbr_timer_activate, - .tfb_tcp_timer_active = bbr_timer_active, - .tfb_tcp_timer_stop = bbr_timer_stop, - .tfb_tcp_rexmit_tmr = bbr_remxt_tmr, - .tfb_tcp_handoff_ok = bbr_handoff_ok, - .tfb_tcp_mtu_chg = bbr_mtu_chg, - .tfb_pru_options = bbr_pru_options, -}; - static const char *bbr_stack_names[] = { __XSTRING(STACKNAME), #ifdef STACKALIAS diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 47f4c6835de9..2713554626e9 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -19407,6 +19407,34 @@ rack_apply_deferred_options(struct tcp_rack *rack) } } +static int +rack_pru_options(struct tcpcb *tp, int flags) +{ + if (flags & PRUS_OOB) + return (EOPNOTSUPP); + return (0); +} + +static struct tcp_function_block __tcp_rack = { + .tfb_tcp_block_name = __XSTRING(STACKNAME), + .tfb_tcp_output = rack_output, + .tfb_do_queued_segments = ctf_do_queued_segments, + .tfb_do_segment_nounlock = rack_do_segment_nounlock, + .tfb_tcp_do_segment = rack_do_segment, + .tfb_tcp_ctloutput = rack_ctloutput, + .tfb_tcp_fb_init = rack_init, + .tfb_tcp_fb_fini = rack_fini, + .tfb_tcp_timer_stop_all = rack_stopall, + .tfb_tcp_timer_activate = rack_timer_activate, + .tfb_tcp_timer_active = rack_timer_active, + .tfb_tcp_timer_stop = rack_timer_stop, + .tfb_tcp_rexmit_tmr = rack_remxt_tmr, + .tfb_tcp_handoff_ok = rack_handoff_ok, + .tfb_tcp_mtu_chg = rack_mtu_change, + .tfb_pru_options = rack_pru_options, + +}; + /* * rack_ctloutput() must drop the inpcb lock before performing copyin on * socket option arguments. When it re-acquires the lock after the copy, it @@ -19496,6 +19524,10 @@ rack_set_sockopt(struct socket *so, struct sockopt *sopt, INP_WUNLOCK(inp); return (ECONNRESET); } + if (tp->t_fb != &__tcp_rack) { + INP_WUNLOCK(inp); + return (ENOPROTOOPT); + } if (rack->defer_options && (rack->gp_ready == 0) && (sopt->sopt_name != TCP_DEFER_OPTIONS) && (sopt->sopt_name != TCP_RACK_PACING_BETA) && @@ -19832,34 +19864,6 @@ out: return (error); } -static int -rack_pru_options(struct tcpcb *tp, int flags) -{ - if (flags & PRUS_OOB) - return (EOPNOTSUPP); - return (0); -} - -static struct tcp_function_block __tcp_rack = { - .tfb_tcp_block_name = __XSTRING(STACKNAME), - .tfb_tcp_output = rack_output, - .tfb_do_queued_segments = ctf_do_queued_segments, - .tfb_do_segment_nounlock = rack_do_segment_nounlock, - .tfb_tcp_do_segment = rack_do_segment, - .tfb_tcp_ctloutput = rack_ctloutput, - .tfb_tcp_fb_init = rack_init, - .tfb_tcp_fb_fini = rack_fini, - .tfb_tcp_timer_stop_all = rack_stopall, - .tfb_tcp_timer_activate = rack_timer_activate, - .tfb_tcp_timer_active = rack_timer_active, - .tfb_tcp_timer_stop = rack_timer_stop, - .tfb_tcp_rexmit_tmr = rack_remxt_tmr, - .tfb_tcp_handoff_ok = rack_handoff_ok, - .tfb_tcp_mtu_chg = rack_mtu_change, - .tfb_pru_options = rack_pru_options, - -}; - static const char *rack_stack_names[] = { __XSTRING(STACKNAME), #ifdef STACKALIAS From owner-dev-commits-src-all@freebsd.org Sat May 22 13:37:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 27CA864E0E9; Sat, 22 May 2021 13:37: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 4FnPfL0SKNz3PZS; Sat, 22 May 2021 13:37: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 E5EAC255B8; Sat, 22 May 2021 13:37: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 14MDbDNl019162; Sat, 22 May 2021 13:37:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MDbD2e019161; Sat, 22 May 2021 13:37:13 GMT (envelope-from git) Date: Sat, 22 May 2021 13:37:13 GMT Message-Id: <202105221337.14MDbD2e019161@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: e67ef6ce667d - main - libkvm: Fix build after removeal of p_tracevp 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/main X-Git-Reftype: branch X-Git-Commit: e67ef6ce667d42a235a70914159048e10039145d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 13:37:14 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e67ef6ce667d42a235a70914159048e10039145d commit e67ef6ce667d42a235a70914159048e10039145d Author: Konstantin Belousov AuthorDate: 2021-05-22 12:43:57 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 13:36:54 +0000 libkvm: Fix build after removeal of p_tracevp Sponsored by: The FreeBSD Foundation MFC after: 1 week --- lib/libkvm/kvm_proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c index eed2f3de6075..5058e86a645b 100644 --- a/lib/libkvm/kvm_proc.c +++ b/lib/libkvm/kvm_proc.c @@ -218,7 +218,7 @@ kvm_proclist(kvm_t *kd, int what, int arg, struct proc *p, /* kp->ki_kstack = proc.p_thread.td_kstack; XXXKSE */ kp->ki_args = proc.p_args; kp->ki_numthreads = proc.p_numthreads; - kp->ki_tracep = proc.p_tracevp; + kp->ki_tracep = NULL; /* XXXKIB do not expose ktr_io_params */ kp->ki_textvp = proc.p_textvp; kp->ki_fd = proc.p_fd; kp->ki_pd = proc.p_pd; From owner-dev-commits-src-all@freebsd.org Sat May 22 16:17:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4844D631408; Sat, 22 May 2021 16:17: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 4FnTCf1bZLz4T1q; Sat, 22 May 2021 16:17: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 1DAD62751E; Sat, 22 May 2021 16:17: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 14MGHoIB031562; Sat, 22 May 2021 16:17:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MGHoYk031561; Sat, 22 May 2021 16:17:50 GMT (envelope-from git) Date: Sat, 22 May 2021 16:17:50 GMT Message-Id: <202105221617.14MGHoYk031561@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e4b16f2fb18b - main - ktrace: Avoid recursion in namei() 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/main X-Git-Reftype: branch X-Git-Commit: e4b16f2fb18bcb6ed2592a7b6983d5df04813a70 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 16:17:50 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e4b16f2fb18bcb6ed2592a7b6983d5df04813a70 commit e4b16f2fb18bcb6ed2592a7b6983d5df04813a70 Author: Mark Johnston AuthorDate: 2021-05-22 16:07:32 +0000 Commit: Mark Johnston CommitDate: 2021-05-22 16:07:32 +0000 ktrace: Avoid recursion in namei() sys_ktrace() calls namei(), which may call ktrnamei(). But sys_ktrace() also calls ktrace_enter() first, so if the caller is itself being traced, the assertion in ktrace_enter() is triggered. And, ktrnamei() does not check for recursion like most other ktrace ops do. Fix the bug by simply deferring the ktrace_enter() call. Also make the parameter to ktrnamei() const and convert to ANSI. Reported by: syzbot+d0a4de45e58d3c08af4b@syzkaller.appspotmail.com Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30340 --- sys/kern/kern_ktrace.c | 13 +++++-------- sys/sys/ktrace.h | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 8783600df6b1..875c079df3b9 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -698,8 +698,7 @@ ktruserret(struct thread *td) } void -ktrnamei(path) - char *path; +ktrnamei(const char *path) { struct ktr_request *req; int namelen; @@ -1017,7 +1016,6 @@ sys_ktrace(struct thread *td, struct ktrace_args *uap) return (EINVAL); kiop = NULL; - ktrace_enter(td); if (ops != KTROP_CLEAR) { /* * an operation which requires a file argument. @@ -1025,23 +1023,22 @@ sys_ktrace(struct thread *td, struct ktrace_args *uap) NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->fname, td); flags = FREAD | FWRITE | O_NOFOLLOW; error = vn_open(&nd, &flags, 0, NULL); - if (error) { - ktrace_exit(td); + if (error) return (error); - } NDFREE(&nd, NDF_ONLY_PNBUF); vp = nd.ni_vp; VOP_UNLOCK(vp); if (vp->v_type != VREG) { - (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); - ktrace_exit(td); + (void)vn_close(vp, FREAD|FWRITE, td->td_ucred, td); return (EACCES); } kiop = ktr_io_params_alloc(td, vp); } + /* * Clear all uses of the tracefile. */ + ktrace_enter(td); if (ops == KTROP_CLEARFILE) { restart: sx_slock(&allproc_lock); diff --git a/sys/sys/ktrace.h b/sys/sys/ktrace.h index 50030d002f97..f1f9361f9f82 100644 --- a/sys/sys/ktrace.h +++ b/sys/sys/ktrace.h @@ -269,7 +269,7 @@ struct ktr_io_params; struct vnode *ktr_get_tracevp(struct proc *, bool); void ktr_io_params_free(struct ktr_io_params *); -void ktrnamei(char *); +void ktrnamei(const char *); void ktrcsw(int, int, const char *); void ktrpsig(int, sig_t, sigset_t *, int); void ktrfault(vm_offset_t, int); From owner-dev-commits-src-all@freebsd.org Sat May 22 16:17:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7B5AC63140A; Sat, 22 May 2021 16:17: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 4FnTCg2Xrnz4St2; Sat, 22 May 2021 16:17: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 3DFF9272DD; Sat, 22 May 2021 16:17: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 14MGHpL7031583; Sat, 22 May 2021 16:17:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MGHpbZ031582; Sat, 22 May 2021 16:17:51 GMT (envelope-from git) Date: Sat, 22 May 2021 16:17:51 GMT Message-Id: <202105221617.14MGHpbZ031582@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 5c7ef43e9625 - main - ktls.h: Guard includes behind _KERNEL 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/main X-Git-Reftype: branch X-Git-Commit: 5c7ef43e9625528da93b308a97aab0858f7eaec6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 16:17:51 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5c7ef43e9625528da93b308a97aab0858f7eaec6 commit 5c7ef43e9625528da93b308a97aab0858f7eaec6 Author: Mark Johnston AuthorDate: 2021-05-22 16:12:19 +0000 Commit: Mark Johnston CommitDate: 2021-05-22 16:12:19 +0000 ktls.h: Guard includes behind _KERNEL These are not needed when including ktls.h to get sockopt definitions. Reviewed by: gallatin, jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30392 --- sys/sys/ktls.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h index 3c43a23af04f..bf1e66fab027 100644 --- a/sys/sys/ktls.h +++ b/sys/sys/ktls.h @@ -29,8 +29,10 @@ #ifndef _SYS_KTLS_H_ #define _SYS_KTLS_H_ +#ifdef _KERNEL #include #include +#endif struct tls_record_layer { uint8_t tls_type; From owner-dev-commits-src-all@freebsd.org Sat May 22 16:17:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C3377631483; Sat, 22 May 2021 16:17: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 4FnTCh4253z4SrG; Sat, 22 May 2021 16:17: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 68BE8274A7; Sat, 22 May 2021 16:17: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 14MGHqw8031604; Sat, 22 May 2021 16:17:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MGHqWo031603; Sat, 22 May 2021 16:17:52 GMT (envelope-from git) Date: Sat, 22 May 2021 16:17:52 GMT Message-Id: <202105221617.14MGHqWo031603@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: c235059bb7e6 - main - ktls.4: Remove an obsolete statement 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/main X-Git-Reftype: branch X-Git-Commit: c235059bb7e600b7bb88234836102fa9911addc2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 16:17:52 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c235059bb7e600b7bb88234836102fa9911addc2 commit c235059bb7e600b7bb88234836102fa9911addc2 Author: Mark Johnston AuthorDate: 2021-05-22 16:12:30 +0000 Commit: Mark Johnston CommitDate: 2021-05-22 16:12:30 +0000 ktls.4: Remove an obsolete statement The default mb_use_ext_pgs value was toggled in commit 52cd25eb1aa. Reviewed by: jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30393 --- share/man/man4/ktls.4 | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/share/man/man4/ktls.4 b/share/man/man4/ktls.4 index 648eeaedfa6a..9f01b1e8b1a5 100644 --- a/share/man/man4/ktls.4 +++ b/share/man/man4/ktls.4 @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 8, 2021 +.Dd May 20, 2021 .Dt KTLS 4 .Os .Sh NAME @@ -131,12 +131,6 @@ application data (for example, handshake messages) or to send application data records with specific contents (for example, empty fragments). .Pp -TLS transmit requires the use of unmapped mbufs. -Unmapped mbufs are not enabled by default, but can be enabled by -setting the -.Va kern.ipc.mb_use_ext_pgs -sysctl node to 1. -.Pp The current TLS transmit mode of a socket can be queried via the .Dv TCP_TXTLS_MODE socket option. From owner-dev-commits-src-all@freebsd.org Sat May 22 18:23:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 18:23:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 18:23:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 18:23:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 18:24:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 18:24:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 18:23:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 18:24:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 18:24:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:24:02 -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-all@freebsd.org Sat May 22 18:29:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 18:29:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 18:31:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 18:31:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 18:33:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 18:36:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 18:38:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 18:38:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 18:38:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 18:44:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4F28C6351B4; Sat, 22 May 2021 18:44: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 4FnXSJ053zz4gdk; Sat, 22 May 2021 18:44: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 D73F310F7; Sat, 22 May 2021 18:43: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 14MIhxpA033017; Sat, 22 May 2021 18:43:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MIhx5A033016; Sat, 22 May 2021 18:43:59 GMT (envelope-from git) Date: Sat, 22 May 2021 18:43:59 GMT Message-Id: <202105221843.14MIhx5A033016@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: cf74b2be533f - main - vfs: retire the now unused vnlru_free routine 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/main X-Git-Reftype: branch X-Git-Commit: cf74b2be533f0ed528a6f03af5fbd20d195dc61f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 18:44:00 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=cf74b2be533f0ed528a6f03af5fbd20d195dc61f commit cf74b2be533f0ed528a6f03af5fbd20d195dc61f Author: Mateusz Guzik AuthorDate: 2021-05-22 18:42:30 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 18:42:30 +0000 vfs: retire the now unused vnlru_free routine --- sys/kern/vfs_subr.c | 27 --------------------------- sys/sys/vnode.h | 1 - 2 files changed, 28 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 979cccf0e0dc..6a3cf2aa7505 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1349,33 +1349,6 @@ vnlru_free_vfsops(int count, struct vfsops *mnt_op, struct vnode *mvp) mtx_unlock(&vnode_list_mtx); } -/* - * Temporary binary compat, don't use. Call vnlru_free_vfsops instead. - */ -void -vnlru_free(int count, struct vfsops *mnt_op) -{ - struct vnode *mvp; - - if (count == 0) - return; - mtx_lock(&vnode_list_mtx); - mvp = vnode_list_free_marker; - if (vnlru_free_impl(count, mnt_op, mvp) == 0) { - /* - * It is possible the marker was moved over eligible vnodes by - * callers which filtered by different ops. If so, start from - * scratch. - */ - if (vnlru_read_freevnodes() > 0) { - TAILQ_REMOVE(&vnode_list, mvp, v_vnodelist); - TAILQ_INSERT_HEAD(&vnode_list, mvp, v_vnodelist); - } - vnlru_free_impl(count, mnt_op, mvp); - } - mtx_unlock(&vnode_list_mtx); -} - struct vnode * vnlru_alloc_marker(void) { diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index f45824e3dc89..a61ef2611b0a 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -828,7 +828,6 @@ int vfs_write_suspend(struct mount *mp, int flags); int vfs_write_suspend_umnt(struct mount *mp); struct vnode *vnlru_alloc_marker(void); void vnlru_free_marker(struct vnode *); -void vnlru_free(int, struct vfsops *); void vnlru_free_vfsops(int, struct vfsops *, struct vnode *); int vop_stdbmap(struct vop_bmap_args *); int vop_stdfdatasync_buf(struct vop_fdatasync_args *); From owner-dev-commits-src-all@freebsd.org Sat May 22 19:26:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1D2846359F1; Sat, 22 May 2021 19:26: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 4FnYNr0JSNz3H4H; Sat, 22 May 2021 19:26: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 E28B31DAA; Sat, 22 May 2021 19:26: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 14MJQ3uc087006; Sat, 22 May 2021 19:26:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MJQ3bW087005; Sat, 22 May 2021 19:26:03 GMT (envelope-from git) Date: Sat, 22 May 2021 19:26:03 GMT Message-Id: <202105221926.14MJQ3bW087005@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: 20123b25ee51 - main - fsck_ffs(8): fix divide by zero when debug messages are enabled 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/main X-Git-Reftype: branch X-Git-Commit: 20123b25ee51e9b122676a30d45c21a506bf1461 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 19:26:04 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=20123b25ee51e9b122676a30d45c21a506bf1461 commit 20123b25ee51e9b122676a30d45c21a506bf1461 Author: Robert Wing AuthorDate: 2021-05-20 20:53:52 +0000 Commit: Robert Wing CommitDate: 2021-05-22 19:03:36 +0000 fsck_ffs(8): fix divide by zero when debug messages are enabled Only print buffer cache debug message when a cache lookup has been done. When running `fsck_ffs -d` on a gjournal'ed filesystem, it's possible that totalreads is greater than zero when no cache lookup has been done - causing a divide by zero. This commit fixes the following error: Floating point exception (core dumped) Reviewed by: mckusick Differential Revision: https://reviews.freebsd.org/D30370 --- sbin/fsck_ffs/fsutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c index b13ba4c54bde..db22ee5b20cf 100644 --- a/sbin/fsck_ffs/fsutil.c +++ b/sbin/fsck_ffs/fsutil.c @@ -576,7 +576,7 @@ ckfini(int markclean) rerun = 1; } } - if (debug && totalreads > 0) + if (debug && cachelookups > 0) printf("cache with %d buffers missed %d of %d (%d%%)\n", numbufs, cachereads, cachelookups, (int)(cachereads * 100 / cachelookups)); From owner-dev-commits-src-all@freebsd.org Sat May 22 19:28:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E78F8635CD4; Sat, 22 May 2021 19:28: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 4FnYRs62zkz3Jlr; Sat, 22 May 2021 19:28: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 B05681D1B; Sat, 22 May 2021 19:28: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 14MJSfB5087292; Sat, 22 May 2021 19:28:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MJSfFp087291; Sat, 22 May 2021 19:28:41 GMT (envelope-from git) Date: Sat, 22 May 2021 19:28:41 GMT Message-Id: <202105221928.14MJSfFp087291@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: fca5cfd584d8 - main - lockprof: retire lock_prof_skipcount 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/main X-Git-Reftype: branch X-Git-Commit: fca5cfd584d81ca291dbd898a8ff60c52d8c3c42 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 19:28:42 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=fca5cfd584d81ca291dbd898a8ff60c52d8c3c42 commit fca5cfd584d81ca291dbd898a8ff60c52d8c3c42 Author: Mateusz Guzik AuthorDate: 2021-05-18 19:05:42 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 19:28:37 +0000 lockprof: retire lock_prof_skipcount The implementation uses a global variable for *ALL* calls, defeating the point of sampling in the first place. Remove it as it clearly remains unused. --- sys/kern/subr_lock.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c index 1afaa19302ed..97b880b54ea2 100644 --- a/sys/kern/subr_lock.c +++ b/sys/kern/subr_lock.c @@ -278,7 +278,6 @@ static volatile int lock_prof_resetting; static int lock_prof_rejected; static int lock_prof_skipspin; -static int lock_prof_skipcount; #ifndef USE_CPU_NANOSECONDS uint64_t @@ -597,7 +596,6 @@ void lock_profile_obtain_lock_success(struct lock_object *lo, int contested, uint64_t waittime, const char *file, int line) { - static int lock_prof_count; struct lock_profile_object *l; int spin; @@ -607,9 +605,6 @@ lock_profile_obtain_lock_success(struct lock_object *lo, int contested, /* don't reset the timer when/if recursing */ if (!lock_prof_enable || (lo->lo_flags & LO_NOPROFILE)) return; - if (lock_prof_skipcount && - (++lock_prof_count % lock_prof_skipcount) != 0) - return; spin = (LOCK_CLASS(lo)->lc_flags & LC_SPINLOCK) ? 1 : 0; if (spin && lock_prof_skipspin == 1) return; @@ -732,8 +727,6 @@ static SYSCTL_NODE(_debug_lock, OID_AUTO, prof, "lock profiling"); SYSCTL_INT(_debug_lock_prof, OID_AUTO, skipspin, CTLFLAG_RW, &lock_prof_skipspin, 0, "Skip profiling on spinlocks."); -SYSCTL_INT(_debug_lock_prof, OID_AUTO, skipcount, CTLFLAG_RW, - &lock_prof_skipcount, 0, "Sample approximately every N lock acquisitions."); SYSCTL_INT(_debug_lock_prof, OID_AUTO, rejected, CTLFLAG_RD, &lock_prof_rejected, 0, "Number of rejected profiling records"); SYSCTL_PROC(_debug_lock_prof, OID_AUTO, stats, From owner-dev-commits-src-all@freebsd.org Sat May 22 19:28:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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 62E00636109; Sat, 22 May 2021 19:28: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 4FnYRt6v8Dz3JpN; Sat, 22 May 2021 19:28: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 C0CF31CBE; Sat, 22 May 2021 19:28: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 14MJSgKh087314; Sat, 22 May 2021 19:28:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MJSgEn087313; Sat, 22 May 2021 19:28:42 GMT (envelope-from git) Date: Sat, 22 May 2021 19:28:42 GMT Message-Id: <202105221928.14MJSgEn087313@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: a0842e69aa5f - main - lockprof: add contested-only profiling 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/main X-Git-Reftype: branch X-Git-Commit: a0842e69aa5f86d61c072544b540ef21b2015211 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 19:28:43 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=a0842e69aa5f86d61c072544b540ef21b2015211 commit a0842e69aa5f86d61c072544b540ef21b2015211 Author: Mateusz Guzik AuthorDate: 2021-05-18 19:07:19 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 19:28:37 +0000 lockprof: add contested-only profiling This allows tracking all wait times with much smaller runtime impact. For example when doing -j 104 buildkernel on tmpfs: no profiling: 2921.70s user 282.72s system 6598% cpu 48.562 total all acquires: 2926.87s user 350.53s system 6656% cpu 49.237 total contested only: 2919.64s user 290.31s system 6583% cpu 48.756 total --- sys/kern/subr_lock.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c index 97b880b54ea2..9c433f683bac 100644 --- a/sys/kern/subr_lock.c +++ b/sys/kern/subr_lock.c @@ -272,6 +272,7 @@ DPCPU_DEFINE_STATIC(struct lock_prof_cpu, lp); #define LP_CPU(cpu) (DPCPU_ID_PTR((cpu), lp)) volatile int __read_mostly lock_prof_enable; +int __read_mostly lock_contested_only; static volatile int lock_prof_resetting; #define LPROF_SBUF_SIZE 256 @@ -605,6 +606,8 @@ lock_profile_obtain_lock_success(struct lock_object *lo, int contested, /* don't reset the timer when/if recursing */ if (!lock_prof_enable || (lo->lo_flags & LO_NOPROFILE)) return; + if (lock_contested_only && !contested) + return; spin = (LOCK_CLASS(lo)->lc_flags & LC_SPINLOCK) ? 1 : 0; if (spin && lock_prof_skipspin == 1) return; @@ -729,6 +732,8 @@ SYSCTL_INT(_debug_lock_prof, OID_AUTO, skipspin, CTLFLAG_RW, &lock_prof_skipspin, 0, "Skip profiling on spinlocks."); SYSCTL_INT(_debug_lock_prof, OID_AUTO, rejected, CTLFLAG_RD, &lock_prof_rejected, 0, "Number of rejected profiling records"); +SYSCTL_INT(_debug_lock_prof, OID_AUTO, contested_only, CTLFLAG_RW, + &lock_contested_only, 0, "Only profile contested acquires"); SYSCTL_PROC(_debug_lock_prof, OID_AUTO, stats, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, dump_lock_prof_stats, "A", From owner-dev-commits-src-all@freebsd.org Sat May 22 19:41:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3EA2363631B; Sat, 22 May 2021 19:41: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 4FnYkg1GMXz3QTn; Sat, 22 May 2021 19:41: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 13C74207F; Sat, 22 May 2021 19:41: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 14MJfUE5008730; Sat, 22 May 2021 19:41:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MJfUQ3008729; Sat, 22 May 2021 19:41:30 GMT (envelope-from git) Date: Sat, 22 May 2021 19:41:30 GMT Message-Id: <202105221941.14MJfUQ3008729@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 154f0ecc10ab - main - Fix tinderbox build after 1762f674ccb571e6 ktrace commit. 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/main X-Git-Reftype: branch X-Git-Commit: 154f0ecc10abdd3c23d233bf85e292011a130583 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 19:41:31 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=154f0ecc10abdd3c23d233bf85e292011a130583 commit 154f0ecc10abdd3c23d233bf85e292011a130583 Author: Mateusz Guzik AuthorDate: 2021-05-22 19:37:53 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 19:41:19 +0000 Fix tinderbox build after 1762f674ccb571e6 ktrace commit. --- sys/kern/kern_exec.c | 6 ++++-- sys/kern/vfs_vnops.c | 2 ++ sys/sys/ktrace.h | 9 +++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index d9b9e1ae122b..709c1b0ff28a 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -390,7 +390,9 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p, static const char fexecv_proc_title[] = "(fexecv)"; imgp = &image_params; +#ifdef KTRACE kiop = NULL; +#endif /* * Lock the process and set the P_INEXEC flag to indicate that @@ -780,8 +782,6 @@ interpret: * we do not regain any tracing during a possible block. */ setsugid(p); - kiop = NULL; - #ifdef KTRACE kiop = ktrprocexec(p); #endif @@ -938,7 +938,9 @@ exec_fail: */ if (oldtextvp != NULL) vrele(oldtextvp); +#ifdef KTRACE ktr_io_params_free(kiop); +#endif pargs_drop(oldargs); pargs_drop(newargs); if (oldsigacts != NULL) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 9e45d1820eec..7f5275cf6b28 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -2371,11 +2371,13 @@ vn_rlimit_fsize(const struct vnode *vp, const struct uio *uio, if ((uoff_t)uio->uio_offset + uio->uio_resid < lim) return (0); +#ifdef KTRACE if (!ktr_write || ktr_filesize_limit_signal) { PROC_LOCK(td->td_proc); kern_psignal(td->td_proc, SIGXFSZ); PROC_UNLOCK(td->td_proc); } +#endif return (EFBIG); } diff --git a/sys/sys/ktrace.h b/sys/sys/ktrace.h index f1f9361f9f82..5f8a782cd7e5 100644 --- a/sys/sys/ktrace.h +++ b/sys/sys/ktrace.h @@ -267,7 +267,16 @@ struct ktr_struct_array { #ifdef _KERNEL struct ktr_io_params; +#ifdef KTRACE struct vnode *ktr_get_tracevp(struct proc *, bool); +#else +static inline struct vnode * +ktr_get_tracevp(struct proc *p, bool ref) +{ + + return (NULL); +} +#endif void ktr_io_params_free(struct ktr_io_params *); void ktrnamei(const char *); void ktrcsw(int, int, const char *); From owner-dev-commits-src-all@freebsd.org Sat May 22 19:53:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 675E86366A7; Sat, 22 May 2021 19:53: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 4FnZ0q2Nlhz3kyN; Sat, 22 May 2021 19:53: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 39FEB2506; Sat, 22 May 2021 19:53: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 14MJrl2Q026359; Sat, 22 May 2021 19:53:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MJrlx7026358; Sat, 22 May 2021 19:53:47 GMT (envelope-from git) Date: Sat, 22 May 2021 19:53:47 GMT Message-Id: <202105221953.14MJrlx7026358@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 48235c377f96 - main - Fix a braino in previous. 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/main X-Git-Reftype: branch X-Git-Commit: 48235c377f960050e9129aa847d7d73019561c82 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 19:53:47 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=48235c377f960050e9129aa847d7d73019561c82 commit 48235c377f960050e9129aa847d7d73019561c82 Author: Mateusz Guzik AuthorDate: 2021-05-22 19:48:31 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 19:53:40 +0000 Fix a braino in previous. Instead of trying to partially ifdef out ktrace handling, define the missing identifier to 0. Without this fix lack of ktrace in the kernel also means there is no SIGXFSZ signal delivery. --- sys/kern/vfs_vnops.c | 2 -- sys/sys/ktrace.h | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 7f5275cf6b28..9e45d1820eec 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -2371,13 +2371,11 @@ vn_rlimit_fsize(const struct vnode *vp, const struct uio *uio, if ((uoff_t)uio->uio_offset + uio->uio_resid < lim) return (0); -#ifdef KTRACE if (!ktr_write || ktr_filesize_limit_signal) { PROC_LOCK(td->td_proc); kern_psignal(td->td_proc, SIGXFSZ); PROC_UNLOCK(td->td_proc); } -#endif return (EFBIG); } diff --git a/sys/sys/ktrace.h b/sys/sys/ktrace.h index 5f8a782cd7e5..283a95c36d6c 100644 --- a/sys/sys/ktrace.h +++ b/sys/sys/ktrace.h @@ -308,8 +308,12 @@ void ktrcapfail(enum ktr_cap_fail_type, const cap_rights_t *, #define ktrstat_error(s, error) \ ktrstruct_error("stat", (s), sizeof(struct stat), error) extern u_int ktr_geniosize; +#ifdef KTRACE extern int ktr_filesize_limit_signal; #else +#define ktr_filesize_limit_signal 0 +#endif +#else #include From owner-dev-commits-src-all@freebsd.org Sat May 22 20:14:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1FA8F636CD3; Sat, 22 May 2021 20:14: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 4FnZSb0PTSz3tT4; Sat, 22 May 2021 20:14: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 DC25B23C7; Sat, 22 May 2021 20:14: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 14MKEMQi053219; Sat, 22 May 2021 20:14:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MKEM0W053218; Sat, 22 May 2021 20:14:22 GMT (envelope-from git) Date: Sat, 22 May 2021 20:14:22 GMT Message-Id: <202105222014.14MKEM0W053218@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: fc369a353b5b - main - ktrace: fix a race between writes and close 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/main X-Git-Reftype: branch X-Git-Commit: fc369a353b5b5e0f8046687fcbd78a7cd9ad1810 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 20:14:23 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=fc369a353b5b5e0f8046687fcbd78a7cd9ad1810 commit fc369a353b5b5e0f8046687fcbd78a7cd9ad1810 Author: Konstantin Belousov AuthorDate: 2021-05-22 12:40:00 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 20:14:13 +0000 ktrace: fix a race between writes and close It was possible that termination of ktrace session occured during some record write, in which case write occured after the close of the vnode. Use ktr_io_params refcounting to avoid this situation, by taking the reference on the structure instead of vnode. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30400 --- sys/kern/kern_ktrace.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 875c079df3b9..3a223215a60d 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -1257,7 +1257,7 @@ ktrsetchildren(struct thread *td, struct proc *top, int ops, int facs, static void ktr_writerequest(struct thread *td, struct ktr_request *req) { - struct ktr_io_params *kiop; + struct ktr_io_params *kiop, *kiop1; struct ktr_header *kth; struct vnode *vp; struct proc *p; @@ -1272,14 +1272,10 @@ ktr_writerequest(struct thread *td, struct ktr_request *req) p = td->td_proc; /* - * We hold the vnode and credential for use in I/O in case ktrace is + * We reference the kiop for use in I/O in case ktrace is * disabled on the process as we write out the request. - * - * XXXRW: This is not ideal: we could end up performing a write after - * the vnode has been closed. */ mtx_lock(&ktrace_mtx); - kiop = p->p_ktrioparms; /* @@ -1291,13 +1287,12 @@ ktr_writerequest(struct thread *td, struct ktr_request *req) return; } + ktr_io_params_ref(kiop); vp = kiop->vp; cred = kiop->cr; lim = kiop->lim; - vrefact(vp); KASSERT(cred != NULL, ("ktr_writerequest: cred == NULL")); - crhold(cred); mtx_unlock(&ktrace_mtx); kth = &req->ktr_header; @@ -1339,9 +1334,11 @@ ktr_writerequest(struct thread *td, struct ktr_request *req) error = VOP_WRITE(vp, &auio, IO_UNIT | IO_APPEND, cred); VOP_UNLOCK(vp); vn_finished_write(mp); - crfree(cred); if (error == 0) { - vrele(vp); + mtx_lock(&ktrace_mtx); + kiop = ktr_io_params_rele(kiop); + mtx_unlock(&ktrace_mtx); + ktr_io_params_free(kiop); return; } @@ -1354,12 +1351,15 @@ ktr_writerequest(struct thread *td, struct ktr_request *req) "ktrace write failed, errno %d, tracing stopped for pid %d\n", error, p->p_pid); + kiop1 = NULL; PROC_LOCK(p); mtx_lock(&ktrace_mtx); if (p->p_ktrioparms != NULL && p->p_ktrioparms->vp == vp) - kiop = ktr_freeproc(p); + kiop1 = ktr_freeproc(p); + kiop = ktr_io_params_rele(kiop); mtx_unlock(&ktrace_mtx); PROC_UNLOCK(p); + ktr_io_params_free(kiop1); ktr_io_params_free(kiop); vrele(vp); } From owner-dev-commits-src-all@freebsd.org Sat May 22 20:18:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D8054637085; Sat, 22 May 2021 20:18: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 4FnZYG5bVDz4Rr6; Sat, 22 May 2021 20:18: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 A2171290D; Sat, 22 May 2021 20:18: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 14MKIQeP053625; Sat, 22 May 2021 20:18:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MKIQI8053624; Sat, 22 May 2021 20:18:26 GMT (envelope-from git) Date: Sat, 22 May 2021 20:18:26 GMT Message-Id: <202105222018.14MKIQI8053624@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: e71d5c733170 - main - Fix limit testing after 1762f674ccb571e6 ktrace commit. 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/main X-Git-Reftype: branch X-Git-Commit: e71d5c7331700504e58cf1a35dca529381723e02 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 20:18:26 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=e71d5c7331700504e58cf1a35dca529381723e02 commit e71d5c7331700504e58cf1a35dca529381723e02 Author: Mateusz Guzik AuthorDate: 2021-05-22 20:12:31 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 20:18:21 +0000 Fix limit testing after 1762f674ccb571e6 ktrace commit. The previous: if ((uoff_t)uio->uio_offset + uio->uio_resid > lim) signal(....); was replaced with: if ((uoff_t)uio->uio_offset + uio->uio_resid < lim) return; signal(....); Making (uoff_t)uio->uio_offset + uio->uio_resid == lim trip over the limit, when it did not previously. Unbreaks running 13.0 buildworld. --- sys/kern/vfs_vnops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 9e45d1820eec..34fcef1b7e1f 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -2368,7 +2368,7 @@ vn_rlimit_fsize(const struct vnode *vp, const struct uio *uio, return (0); ktr_write = (td->td_pflags & TDP_INKTRACE) != 0; lim = ktr_write ? td->td_ktr_io_lim : lim_cur(td, RLIMIT_FSIZE); - if ((uoff_t)uio->uio_offset + uio->uio_resid < lim) + if ((uoff_t)uio->uio_offset + uio->uio_resid <= lim) return (0); if (!ktr_write || ktr_filesize_limit_signal) { From owner-dev-commits-src-all@freebsd.org Sat May 22 21:00:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sat May 22 21:05:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 66A5A6379B4; Sat, 22 May 2021 21:05: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 4Fnbbn1FTwz4pdL; Sat, 22 May 2021 21:05: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 E98CB32AB; Sat, 22 May 2021 21:05: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 14ML5ef1021363; Sat, 22 May 2021 21:05:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14ML5eAK021362; Sat, 22 May 2021 21:05:40 GMT (envelope-from git) Date: Sat, 22 May 2021 21:05:40 GMT Message-Id: <202105222105.14ML5eAK021362@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 138f78e94bf8 - main - umtx: convert umtxq_lock to a macro 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/main X-Git-Reftype: branch X-Git-Commit: 138f78e94bf83a8a92987d8be81f1e2c6c277cf8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 21:05:41 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=138f78e94bf83a8a92987d8be81f1e2c6c277cf8 commit 138f78e94bf83a8a92987d8be81f1e2c6c277cf8 Author: Mateusz Guzik AuthorDate: 2021-05-22 20:51:37 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-22 21:01:05 +0000 umtx: convert umtxq_lock to a macro Then LOCK_PROFILING starts reporting callers instead of the inline. --- sys/kern/kern_umtx.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index 784c10cb97ac..a1dca77fe991 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -272,7 +272,6 @@ static void umtx_shm_init(void); static void umtxq_sysinit(void *); static void umtxq_hash(struct umtx_key *key); static struct umtxq_chain *umtxq_getchain(struct umtx_key *key); -static void umtxq_lock(struct umtx_key *key); static void umtxq_unlock(struct umtx_key *key); static void umtxq_busy(struct umtx_key *key); static void umtxq_unbusy(struct umtx_key *key); @@ -501,15 +500,16 @@ umtxq_getchain(struct umtx_key *key) /* * Lock a chain. + * + * The code is a macro so that file/line information is taken from the caller. */ -static inline void -umtxq_lock(struct umtx_key *key) -{ - struct umtxq_chain *uc; - - uc = umtxq_getchain(key); - mtx_lock(&uc->uc_lock); -} +#define umtxq_lock(key) do { \ + struct umtx_key *_key = (key); \ + struct umtxq_chain *_uc; \ + \ + _uc = umtxq_getchain(_key); \ + mtx_lock(&_uc->uc_lock); \ +} while (0) /* * Unlock a chain. From owner-dev-commits-src-all@freebsd.org Sat May 22 21:50:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5AA5763811D; Sat, 22 May 2021 21:50: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 4FncZz1sbTz3hZH; Sat, 22 May 2021 21:50: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 28F083ABC; Sat, 22 May 2021 21:50: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 14MLo3Pm076009; Sat, 22 May 2021 21:50:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MLo3DS076006; Sat, 22 May 2021 21:50:03 GMT (envelope-from git) Date: Sat, 22 May 2021 21:50:03 GMT Message-Id: <202105222150.14MLo3DS076006@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 33c1bdfc3e09 - main - tests/libalias: Add perfomance test utility 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/main X-Git-Reftype: branch X-Git-Commit: 33c1bdfc3e098862100bab7a8dc729d8c78ffa7c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 21:50:03 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=33c1bdfc3e098862100bab7a8dc729d8c78ffa7c commit 33c1bdfc3e098862100bab7a8dc729d8c78ffa7c Author: Lutz Donnerhacke AuthorDate: 2021-05-21 14:54:24 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-22 21:45:42 +0000 tests/libalias: Add perfomance test utility In order to compare upcoming changes for their effectivness, measure performance by counting opertions and the runtime of each operation over the time. Accumulate all tests in a single instance, so make it complicated over the time. If you wait long enough, you will notice the expiry of old flows. Reviewed by: kp (earlier version) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30379 --- tests/sys/netinet/libalias/Makefile | 3 + tests/sys/netinet/libalias/perf.c | 198 ++++++++++++++++++++++++++++++++++++ tests/sys/netinet/libalias/util.c | 17 +++- 3 files changed, 213 insertions(+), 5 deletions(-) diff --git a/tests/sys/netinet/libalias/Makefile b/tests/sys/netinet/libalias/Makefile index 79922d7d4b13..6ee2fc0e0e1f 100644 --- a/tests/sys/netinet/libalias/Makefile +++ b/tests/sys/netinet/libalias/Makefile @@ -8,10 +8,13 @@ BINDIR= ${TESTSDIR} ATF_TESTS_C+= 1_instance \ 2_natout \ +PROGS+= perf + LIBADD+= alias SRCS.1_instance=1_instance.c util.c SRCS.2_natout= 2_natout.c util.c +SRCS.perf= perf.c util.c .include diff --git a/tests/sys/netinet/libalias/perf.c b/tests/sys/netinet/libalias/perf.c new file mode 100644 index 000000000000..ac4796cf9649 --- /dev/null +++ b/tests/sys/netinet/libalias/perf.c @@ -0,0 +1,198 @@ +#include +#include +#include +#include +#include "util.h" +#include + +/* common ip ranges */ +static struct in_addr masq = { htonl(0x01020304) }; +static struct in_addr prv = { htonl(0x0a000000) }; +static struct in_addr ext = { htonl(0x12000000) }; + +#define timevalcmp(tv, uv, cmp) \ + (((tv).tv_sec == (uv).tv_sec) \ + ? ((tv).tv_usec cmp (uv).tv_usec) \ + : ((tv).tv_sec cmp (uv).tv_sec)) + +#define timevaldiff(n, o) \ + (((n).tv_sec - (o).tv_sec)*1000000l + \ + ((n).tv_usec - (o).tv_usec)) + +int main(int argc, char ** argv) +{ + struct libalias *la; + struct timeval timeout; + struct ip *p; + struct udphdr *u; + struct { + struct in_addr src, dst; + uint16_t sport, dport, aport; + } *batch; + struct { + unsigned long ok, fail; + } nat, unnat, random, attack; + int max_seconds, batch_size, random_size, attack_length, round, cnt; + + if(argc != 5 || + 0 > (max_seconds = atoi(argv[1])) || + 0 >= (batch_size = atoi(argv[2])) || + 0 >= (random_size = atoi(argv[3])) || + 0 >= (attack_length = atoi(argv[4]))) { + printf("Usage: %s max_seconds batch_size random_size attack_length\n", argv[0]); + return 1; + } + if (NULL == (la = LibAliasInit(NULL))) { + perror("LibAliasInit"); + return -1; + } + + bzero(&nat, sizeof(nat)); + bzero(&unnat, sizeof(unnat)); + bzero(&random, sizeof(random)); + bzero(&attack, sizeof(attack)); + + LibAliasSetAddress(la, masq); + LibAliasSetMode(la, PKT_ALIAS_DENY_INCOMING, PKT_ALIAS_DENY_INCOMING); + + prv.s_addr &= htonl(0xffff0000); + ext.s_addr &= htonl(0xffff0000); + + p = ip_packet(prv, ext, 0, 64); + u = set_udp(p, 0, 0); + + if (NULL == (batch = calloc(batch_size, sizeof(*batch)))) { + perror("calloc(batch)"); + return -1; + } + + gettimeofday(&timeout, NULL); + timeout.tv_sec += max_seconds; + + printf("RND SEC NAT RND ATT UNA\n"); + for (round = 0; ; round++) { + int i, res; + struct timeval now, start; + + printf("%3d ", round+1); + + gettimeofday(&start, NULL); + printf("%3ld ", max_seconds - (timeout.tv_sec - start.tv_sec)); + for (cnt = i = 0; i < batch_size; i++, cnt++) { + batch[i].src.s_addr = prv.s_addr | htonl(rand_range(0, 0xffff)); + batch[i].dst.s_addr = ext.s_addr | htonl(rand_range(0, 0xffff)); + batch[i].sport = rand_range(1000, 60000); + batch[i].dport = rand_range(1000, 60000); + + p->ip_src = batch[i].src; + p->ip_dst = batch[i].dst; + u = set_udp(p, batch[i].sport, batch[i].dport); + + res = LibAliasOut(la, p, 64); + batch[i].aport = htons(u->uh_sport); + + if (res == PKT_ALIAS_OK && + u->uh_dport == htons(batch[i].dport) && + addr_eq(p->ip_dst, batch[i].dst) && + addr_eq(p->ip_src, masq)) + nat.ok++; + else + nat.fail++; + + gettimeofday(&now, NULL); + if(timevalcmp(now, timeout, >=)) + goto out; + } + if (cnt > 0) + printf("%3lu ", timevaldiff(now, start) / cnt); + + start = now; + for (cnt = i = 0; i < random_size; i++, cnt++) { + p->ip_src.s_addr = ext.s_addr & htonl(0xfff00000); + p->ip_src.s_addr |= htonl(rand_range(0, 0xffff)); + p->ip_dst = masq; + u = set_udp(p, rand_range(1, 0xffff), rand_range(1, 0xffff)); + + res = LibAliasIn(la, p, 64); + + if (res == PKT_ALIAS_OK) + random.ok++; + else + random.fail++; + + gettimeofday(&now, NULL); + if(timevalcmp(now, timeout, >=)) + goto out; + } + if (cnt > 0) + printf("%3lu ", timevaldiff(now, start) / cnt); + + start = now; + p->ip_src.s_addr = ext.s_addr & htonl(0xfff00000); + p->ip_src.s_addr |= htonl(rand_range(0, 0xffff)); + p->ip_dst = masq; + u = set_udp(p, rand_range(1, 0xffff), rand_range(1, 0xffff)); + for (cnt = i = 0; i < attack_length; i++, cnt++) { + res = LibAliasIn(la, p, 64); + + if (res == PKT_ALIAS_OK) + attack.ok++; + else + attack.fail++; + + gettimeofday(&now, NULL); + if(timevalcmp(now, timeout, >=)) + goto out; + } + if (cnt > 0) + printf("%3lu ", timevaldiff(now, start) / cnt); + + qsort(batch, batch_size, sizeof(*batch), randcmp); + + gettimeofday(&start, NULL); + for (cnt = i = 0; i < batch_size; i++, cnt++) { + p->ip_src = batch[i].dst; + p->ip_dst = masq; + u = set_udp(p, batch[i].dport, batch[i].aport); + + res = LibAliasIn(la, p, 64); + batch[i].aport = htons(u->uh_sport); + + if (res == PKT_ALIAS_OK && + u->uh_sport == htons(batch[i].dport) && + u->uh_dport == htons(batch[i].sport) && + addr_eq(p->ip_dst, batch[i].src) && + addr_eq(p->ip_src, batch[i].dst)) + unnat.ok++; + else + unnat.fail++; + + gettimeofday(&now, NULL); + if(timevalcmp(now, timeout, >=)) + goto out; + } + if (cnt > 0) + printf("%3lu\n", timevaldiff(now, start) / cnt); + } +out: + printf("\n\n"); + free(batch); + free(p); + LibAliasUninit(la); + + printf("Results\n"); + printf(" Rounds : %7u\n", round); + printf(" NAT ok : %7lu\n", nat.ok); + printf(" NAT fail: %7lu\n", nat.fail); + printf(" UNNAT ok : %7lu\n", unnat.ok); + printf(" UNNAT fail: %7lu\n", unnat.fail); + printf("RANDOM ok : %7lu\n", random.ok); + printf("RANDOM fail: %7lu\n", random.fail); + printf("ATTACK ok : %7lu\n", attack.ok); + printf("ATTACK fail: %7lu\n", attack.fail); + printf(" -------------------\n"); + printf(" Total: %7lu\n", + nat.ok + nat.fail + unnat.ok + unnat.fail + + random.ok + random.fail + attack.ok + attack.fail); + return (0); +} diff --git a/tests/sys/netinet/libalias/util.c b/tests/sys/netinet/libalias/util.c index e0e5e08eb23e..5e880752d261 100644 --- a/tests/sys/netinet/libalias/util.c +++ b/tests/sys/netinet/libalias/util.c @@ -1,4 +1,3 @@ -#include #include #include @@ -6,6 +5,14 @@ #include "util.h" +#define REQUIRE(x) do { \ + if (!(x)) { \ + fprintf(stderr, "Failed in %s %s:%d.\n",\ + __FUNCTION__, __FILE__, __LINE__); \ + exit(-1); \ + } \ +} while(0) + int randcmp(const void *a, const void *b) { @@ -42,10 +49,10 @@ ip_packet(struct in_addr src, struct in_addr dst, u_char protocol, size_t len) { struct ip * p; - ATF_REQUIRE(len >= 64 && len <= IP_MAXPACKET); + REQUIRE(len >= 64 && len <= IP_MAXPACKET); p = calloc(1, len); - ATF_REQUIRE(p != NULL); + REQUIRE(p != NULL); p->ip_v = IPVERSION; p->ip_hl = sizeof(*p)/4; @@ -54,7 +61,7 @@ ip_packet(struct in_addr src, struct in_addr dst, u_char protocol, size_t len) p->ip_src = src; p->ip_dst = dst; p->ip_p = protocol; - ATF_REQUIRE(p->ip_hl == 5); + REQUIRE(p->ip_hl == 5); return (p); } @@ -65,7 +72,7 @@ set_udp(struct ip *p, u_short sport, u_short dport) { struct udphdr *u = (void *)&(up[p->ip_hl]); int payload = ntohs(p->ip_len) - 4*p->ip_hl; - ATF_REQUIRE(payload >= (int)sizeof(*u)); + REQUIRE(payload >= (int)sizeof(*u)); p->ip_p = IPPROTO_UDP; u->uh_sport = htons(sport); u->uh_dport = htons(dport); From owner-dev-commits-src-all@freebsd.org Sat May 22 21:57:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 878A26384E2; Sat, 22 May 2021 21:57: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 4FnclD2fc2z3kv7; Sat, 22 May 2021 21:57: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 3BB983D8E; Sat, 22 May 2021 21:57: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 14MLvCXK086894; Sat, 22 May 2021 21:57:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MLvCTG086893; Sat, 22 May 2021 21:57:12 GMT (envelope-from git) Date: Sat, 22 May 2021 21:57:12 GMT Message-Id: <202105222157.14MLvCTG086893@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 3f7e14ad9345 - main - nfscl: Add hash lists for the NFSv4 opens 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/main X-Git-Reftype: branch X-Git-Commit: 3f7e14ad93454476bb11b4b8de5b41930d13312e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 21:57:12 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=3f7e14ad93454476bb11b4b8de5b41930d13312e commit 3f7e14ad93454476bb11b4b8de5b41930d13312e Author: Rick Macklem AuthorDate: 2021-05-22 21:51:38 +0000 Commit: Rick Macklem CommitDate: 2021-05-22 21:53:56 +0000 nfscl: Add hash lists for the NFSv4 opens A problem was reported via email, where a large (130000+) accumulation of NFSv4 opens on an NFSv4 mount caused significant lock contention on the mutex used to protect the client mount's open/lock state. Although the root cause for the accumulation of opens was not resolved, it is obvious that the NFSv4 client is not designed to handle 100000+ opens efficiently. When searching for an open, usually for a match by file handle, a linear search of all opens is done. This patch adds a table of hash lists for the opens, hashed on file handle. This table will be used by future commits to search for an open based on file handle more efficiently. MFC after: 2 weeks --- sys/fs/nfs/nfsclstate.h | 7 +++++++ sys/fs/nfsclient/nfs_clstate.c | 15 ++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfs/nfsclstate.h b/sys/fs/nfs/nfsclstate.h index e17be74c5581..898a7de391dc 100644 --- a/sys/fs/nfs/nfsclstate.h +++ b/sys/fs/nfs/nfsclstate.h @@ -42,6 +42,7 @@ LIST_HEAD(nfsclhead, nfsclclient); LIST_HEAD(nfsclownerhead, nfsclowner); TAILQ_HEAD(nfscldeleghead, nfscldeleg); LIST_HEAD(nfscldeleghash, nfscldeleg); +LIST_HEAD(nfsclopenhash, nfsclopen); TAILQ_HEAD(nfscllayouthead, nfscllayout); LIST_HEAD(nfscllayouthash, nfscllayout); LIST_HEAD(nfsclflayouthead, nfsclflayout); @@ -50,6 +51,10 @@ LIST_HEAD(nfsclrecalllayouthead, nfsclrecalllayout); #define NFSCLDELEGHASHSIZE 256 #define NFSCLDELEGHASH(c, f, l) \ (&((c)->nfsc_deleghash[ncl_hash((f), (l)) % NFSCLDELEGHASHSIZE])) +#define NFSCLOPENHASHSIZE 256 +#define NFSCLOPENHASHFUNC(f, l) (ncl_hash((f), (l)) % NFSCLOPENHASHSIZE) +#define NFSCLOPENHASH(c, f, l) \ + (&((c)->nfsc_openhash[NFSCLOPENHASHFUNC((f), (l))])) #define NFSCLLAYOUTHASHSIZE 256 #define NFSCLLAYOUTHASH(c, f, l) \ (&((c)->nfsc_layouthash[ncl_hash((f), (l)) % NFSCLLAYOUTHASHSIZE])) @@ -104,6 +109,7 @@ struct nfsclclient { struct nfsclownerhead nfsc_owner; struct nfscldeleghead nfsc_deleg; struct nfscldeleghash nfsc_deleghash[NFSCLDELEGHASHSIZE]; + struct nfsclopenhash nfsc_openhash[NFSCLOPENHASHSIZE]; struct nfscllayouthead nfsc_layout; struct nfscllayouthash nfsc_layouthash[NFSCLLAYOUTHASHSIZE]; struct nfscldevinfohead nfsc_devinfo; @@ -183,6 +189,7 @@ struct nfscldeleg { */ struct nfsclopen { LIST_ENTRY(nfsclopen) nfso_list; + LIST_ENTRY(nfsclopen) nfso_hash; struct nfscllockownerhead nfso_lock; nfsv4stateid_t nfso_stateid; struct nfsclowner *nfso_own; diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 1ed3630ce6e7..a8eace2ffd0b 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -240,9 +240,11 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t amode, int usedeleg, */ nowp = malloc(sizeof (struct nfsclowner), M_NFSCLOWNER, M_WAITOK); - if (nfhp != NULL) + if (nfhp != NULL) { nop = malloc(sizeof (struct nfsclopen) + fhlen - 1, M_NFSCLOPEN, M_WAITOK); + nop->nfso_hash.le_prev = NULL; + } ret = nfscl_getcl(vp->v_mount, cred, p, 1, &clp); if (ret != 0) { free(nowp, M_NFSCLOWNER); @@ -412,6 +414,8 @@ nfscl_newopen(struct nfsclclient *clp, struct nfscldeleg *dp, dp->nfsdl_timestamp = NFSD_MONOSEC + 120; nfsstatsv1.cllocalopens++; } else { + LIST_INSERT_HEAD(NFSCLOPENHASH(clp, fhp, fhlen), + nop, nfso_hash); nfsstatsv1.clopens++; } LIST_INSERT_HEAD(&owp->nfsow_open, nop, nfso_list); @@ -837,6 +841,8 @@ nfscl_getcl(struct mount *mp, struct ucred *cred, NFSPROC_T *p, LIST_INIT(&clp->nfsc_devinfo); for (i = 0; i < NFSCLDELEGHASHSIZE; i++) LIST_INIT(&clp->nfsc_deleghash[i]); + for (i = 0; i < NFSCLOPENHASHSIZE; i++) + LIST_INIT(&clp->nfsc_openhash[i]); for (i = 0; i < NFSCLLAYOUTHASHSIZE; i++) LIST_INIT(&clp->nfsc_layouthash[i]); clp->nfsc_flags = NFSCLFLAGS_INITED; @@ -1475,6 +1481,8 @@ nfscl_freeopen(struct nfsclopen *op, int local) { LIST_REMOVE(op, nfso_list); + if (op->nfso_hash.le_prev != NULL) + LIST_REMOVE(op, nfso_hash); nfscl_freealllocks(&op->nfso_lock, local); free(op, M_NFSCLOPEN); if (local) @@ -1706,6 +1714,8 @@ nfscl_expireclient(struct nfsclclient *clp, struct nfsmount *nmp, LIST_REMOVE(op, nfso_list); op->nfso_own = towp; LIST_INSERT_HEAD(&towp->nfsow_open, op, nfso_list); + LIST_INSERT_HEAD(NFSCLOPENHASH(clp, op->nfso_fh, + op->nfso_fhlen), op, nfso_hash); nfsstatsv1.cllocalopens--; nfsstatsv1.clopens++; } @@ -1714,6 +1724,8 @@ nfscl_expireclient(struct nfsclclient *clp, struct nfsmount *nmp, LIST_REMOVE(owp, nfsow_list); owp->nfsow_clp = clp; LIST_INSERT_HEAD(&clp->nfsc_owner, owp, nfsow_list); + LIST_INSERT_HEAD(NFSCLOPENHASH(clp, op->nfso_fh, + op->nfso_fhlen), op, nfso_hash); nfsstatsv1.cllocalopenowners--; nfsstatsv1.clopenowners++; nfsstatsv1.cllocalopens--; @@ -4198,6 +4210,7 @@ nfscl_moveopen(vnode_t vp, struct nfsclclient *clp, struct nfsmount *nmp, np = VTONFS(vp); nop = malloc(sizeof (struct nfsclopen) + lop->nfso_fhlen - 1, M_NFSCLOPEN, M_WAITOK); + nop->nfso_hash.le_prev = NULL; newone = 0; nfscl_newopen(clp, NULL, &owp, NULL, &op, &nop, owp->nfsow_owner, lop->nfso_fh, lop->nfso_fhlen, cred, &newone); From owner-dev-commits-src-all@freebsd.org Sat May 22 22:02:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 79D41638A0C; Sat, 22 May 2021 22:02: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 4Fncs92xRKz3mTj; Sat, 22 May 2021 22:02: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 4CA0E3AF3; Sat, 22 May 2021 22:02: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 14MM2LOF000528; Sat, 22 May 2021 22:02:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MM2LM3000527; Sat, 22 May 2021 22:02:21 GMT (envelope-from git) Date: Sat, 22 May 2021 22:02:21 GMT Message-Id: <202105222202.14MM2LM3000527@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 03b0505b8fe8 - main - ip_forward: Restore RFC reference 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/main X-Git-Reftype: branch X-Git-Commit: 03b0505b8fe848f33f2f38fe89dd5538908c847e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 22:02:21 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=03b0505b8fe848f33f2f38fe89dd5538908c847e commit 03b0505b8fe848f33f2f38fe89dd5538908c847e Author: Zhenlei Huang AuthorDate: 2021-05-22 21:53:52 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-22 22:01:37 +0000 ip_forward: Restore RFC reference Add RFC reference lost in 3d846e48227e2e78c1e7b35145f57353ffda56ba PR: 255388 Reviewed By: rgrimes, donner, karels, marcus, emaste MFC after: 27 days Differential Revision: https://reviews.freebsd.org/D30374 --- sys/netinet/ip_input.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 1139e3a5abfa..733cc2901879 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -740,7 +740,10 @@ passin: } if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { MROUTER_RLOCK(); - /* Do not forward packets from IN_LINKLOCAL. */ + /* + * RFC 3927 2.7: Do not forward multicast packets from + * IN_LINKLOCAL. + */ if (V_ip_mrouter && !IN_LINKLOCAL(ntohl(ip->ip_src.s_addr))) { /* * If we are acting as a multicast router, all @@ -780,7 +783,7 @@ passin: goto ours; if (ip->ip_dst.s_addr == INADDR_ANY) goto ours; - /* Do not forward packets to or from IN_LINKLOCAL. */ + /* RFC 3927 2.7: Do not forward packets to or from IN_LINKLOCAL. */ if (IN_LINKLOCAL(ntohl(ip->ip_dst.s_addr)) || IN_LINKLOCAL(ntohl(ip->ip_src.s_addr))) { IPSTAT_INC(ips_cantforward); From owner-dev-commits-src-all@freebsd.org Sat May 22 22:53:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 40EE963958F; Sat, 22 May 2021 22:53: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 4Fndzw19xGz4dTj; Sat, 22 May 2021 22:53: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 115DA4B7D; Sat, 22 May 2021 22:53: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 14MMrFA9066513; Sat, 22 May 2021 22:53:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MMrFlK066512; Sat, 22 May 2021 22:53:15 GMT (envelope-from git) Date: Sat, 22 May 2021 22:53:15 GMT Message-Id: <202105222253.14MMrFlK066512@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 114f4b17d5b6 - main - [ar71xx] During reset, don't spin, just keep trying MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 114f4b17d5b60a5d53ca98f08cc7e8d78c6984de Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 22:53:16 -0000 The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=114f4b17d5b60a5d53ca98f08cc7e8d78c6984de commit 114f4b17d5b60a5d53ca98f08cc7e8d78c6984de Author: Adrian Chadd AuthorDate: 2021-04-19 05:48:13 +0000 Commit: Adrian Chadd CommitDate: 2021-05-22 22:53:00 +0000 [ar71xx] During reset, don't spin, just keep trying I've seen this fail from time to time and just hang during reset. Instead of it just hanging, just poke it again. I've not seen it fail in hundreds of test resets now. Tested: * AR9344 AP/STA configuration --- sys/mips/atheros/ar71xx_machdep.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/mips/atheros/ar71xx_machdep.c b/sys/mips/atheros/ar71xx_machdep.c index 2bb6d5845d16..72beec972de2 100644 --- a/sys/mips/atheros/ar71xx_machdep.c +++ b/sys/mips/atheros/ar71xx_machdep.c @@ -80,10 +80,13 @@ platform_cpu_init() void platform_reset(void) { - ar71xx_device_stop(RST_RESET_FULL_CHIP); - /* Wait for reset */ - while(1) - ; + while(1) { + printf("%s: resetting via AHB FULL_CHIP register...\n", __func__); + ar71xx_device_start(RST_RESET_FULL_CHIP); + DELAY(100 * 1000); + ar71xx_device_stop(RST_RESET_FULL_CHIP); + DELAY(1000 * 1000); + } } /* From owner-dev-commits-src-all@freebsd.org Sat May 22 23:34:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EB80C6398D3; Sat, 22 May 2021 23:34: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 4Fnftx5q1zz3CNj; Sat, 22 May 2021 23:34: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 AFC7F550B; Sat, 22 May 2021 23:34: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 14MNY1pH020471; Sat, 22 May 2021 23:34:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MNY1W1020470; Sat, 22 May 2021 23:34:01 GMT (envelope-from git) Date: Sat, 22 May 2021 23:34:01 GMT Message-Id: <202105222334.14MNY1W1020470@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 1ca399682822 - main - [ath] Add ast_tsfoor to the sysctl statistics array. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1ca39968282266283251f2d3e4c27bcb67bb14f1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 23:34:02 -0000 The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=1ca39968282266283251f2d3e4c27bcb67bb14f1 commit 1ca39968282266283251f2d3e4c27bcb67bb14f1 Author: Adrian Chadd AuthorDate: 2021-03-13 22:16:17 +0000 Commit: Adrian Chadd CommitDate: 2021-05-22 22:54:16 +0000 [ath] Add ast_tsfoor to the sysctl statistics array. --- sys/dev/ath/if_ath_sysctl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/ath/if_ath_sysctl.c b/sys/dev/ath/if_ath_sysctl.c index 3c873d3e8b34..de852158f991 100644 --- a/sys/dev/ath/if_ath_sysctl.c +++ b/sys/dev/ath/if_ath_sysctl.c @@ -1301,6 +1301,10 @@ ath_sysctl_stats_attach(struct ath_softc *sc) CTLFLAG_RD, &sc->sc_stats.ast_tx_ldpc, 0, "Number of LDPC frames transmitted"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tsfoor", + CTLFLAG_RD, &sc->sc_stats.ast_tsfoor, 0, + "Number of TSF out of range interrupts/resets"); + /* Attach the RX phy error array */ ath_sysctl_stats_attach_rxphyerr(sc, child); From owner-dev-commits-src-all@freebsd.org Sat May 22 23:34:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1B73E639D99; Sat, 22 May 2021 23:34: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 4Fnfty6ykDz3ChJ; Sat, 22 May 2021 23:34: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 D23154FD0; Sat, 22 May 2021 23:34: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 14MNY2Gg020498; Sat, 22 May 2021 23:34:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MNY2Y4020497; Sat, 22 May 2021 23:34:02 GMT (envelope-from git) Date: Sat, 22 May 2021 23:34:02 GMT Message-Id: <202105222334.14MNY2Y4020497@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 079bd2e750ad - main - [athstats] Add some (but not all, sigh) missing statistics. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 079bd2e750adae17e0f13cc4e876249fd4c2016e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 23:34:03 -0000 The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=079bd2e750adae17e0f13cc4e876249fd4c2016e commit 079bd2e750adae17e0f13cc4e876249fd4c2016e Author: Adrian Chadd AuthorDate: 2021-03-13 22:16:37 +0000 Commit: Adrian Chadd CommitDate: 2021-05-22 22:54:25 +0000 [athstats] Add some (but not all, sigh) missing statistics. This adds a few recent statistics, including TSFOOR that I just added to the driver. --- tools/tools/ath/athstats/athstats.c | 38 ++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/tools/tools/ath/athstats/athstats.c b/tools/tools/ath/athstats/athstats.c index 911526755ee4..34e95b7c3885 100644 --- a/tools/tools/ath/athstats/athstats.c +++ b/tools/tools/ath/athstats/athstats.c @@ -297,8 +297,23 @@ static const struct fmt athstats[] = { { 4, "txaggrfail", "TXAF", "A-MPDU sub-frame TX attempt failures" }, #define S_TX_AGGR_FAILALL AFTER(S_TX_AGGR_FAIL) { 7, "txaggrfailall", "TXAFALL", "A-MPDU TX frame failures" }, -#ifndef __linux__ -#define S_CABQ_XMIT AFTER(S_TX_AGGR_FAILALL) +#define S_TX_MCASTQ_OVERFLOW AFTER(S_TX_AGGR_FAILALL) + { 8, "txmcastqovf", "TXMCQOVF", "TX multicast queue overflow" }, +#define S_RX_KEYMISS AFTER(S_TX_MCASTQ_OVERFLOW) + { 4, "rxkeymiss", "RXKM", "RX crypto key miss" }, +#define S_TX_SWFILTERED AFTER(S_RX_KEYMISS) + { 7, "txswfilt", "TXSWFLT", "TX frames filtered by hw and retried" }, +#define S_TX_NODE_PSQ_OVERFLOW AFTER(S_TX_SWFILTERED) + { 8, "txpsqovf", "TXPSQOVF", "TX frames overflowed the power save queue" }, +#define S_TX_NODEQ_OVERFLOW AFTER(S_TX_NODE_PSQ_OVERFLOW) + { 8, "txnqovf", "TXNQOVF", "TX frames overflowed the node queue" }, +#define S_TX_LDPC AFTER(S_TX_NODEQ_OVERFLOW) + { 6, "txldpc", "TXLDPC", "TX frames transmitted with LDPC" }, +#define S_TX_STBC AFTER(S_TX_LDPC) + { 6, "txstbc", "TXSTBC", "TX frames transmitted with STBC" }, +#define S_TSFOOR AFTER(S_TX_STBC) + { 6, "tsfoor", "TSFOOR", "TSF overflow interrupt/restarts" }, +#define S_CABQ_XMIT AFTER(S_TSFOOR) { 7, "cabxmit", "cabxmit", "cabq frames transmitted" }, #define S_CABQ_BUSY AFTER(S_CABQ_XMIT) { 8, "cabqbusy", "cabqbusy", "cabq xmit overflowed beacon interval" }, @@ -309,9 +324,6 @@ static const struct fmt athstats[] = { #define S_RX_BUSDMA AFTER(S_TX_BUSDMA) { 8, "rxbusdma", "rxbusdma", "rx setup failed for dma resrcs" }, #define S_FF_TXOK AFTER(S_RX_BUSDMA) -#else -#define S_FF_TXOK AFTER(S_TX_AGGR_FAILALL) -#endif { 5, "fftxok", "fftxok", "fast frames xmit successfully" }, #define S_FF_TXERR AFTER(S_FF_TXOK) { 5, "fftxerr", "fftxerr", "fast frames not xmit due to error" }, @@ -770,6 +782,14 @@ ath_get_curstat(struct bsdstat *sf, int s, char b[], size_t bs) case S_TX_AGGR_OK: STAT(tx_aggr_ok); case S_TX_AGGR_FAIL: STAT(tx_aggr_fail); case S_TX_AGGR_FAILALL: STAT(tx_aggr_failall); + case S_TX_MCASTQ_OVERFLOW: STAT(tx_mcastq_overflow); + case S_RX_KEYMISS: STAT(rx_keymiss); + case S_TX_SWFILTERED: STAT(tx_swfiltered); + case S_TX_NODE_PSQ_OVERFLOW: STAT(tx_node_psq_overflow); + case S_TX_NODEQ_OVERFLOW: STAT(tx_nodeq_overflow); + case S_TX_LDPC: STAT(tx_ldpc); + case S_TX_STBC: STAT(tx_stbc); + case S_TSFOOR: STAT(tsfoor); } b[0] = '\0'; return 0; @@ -1015,6 +1035,14 @@ ath_get_totstat(struct bsdstat *sf, int s, char b[], size_t bs) case S_TX_AGGR_OK: STAT(tx_aggr_ok); case S_TX_AGGR_FAIL: STAT(tx_aggr_fail); case S_TX_AGGR_FAILALL: STAT(tx_aggr_failall); + case S_TX_MCASTQ_OVERFLOW: STAT(tx_mcastq_overflow); + case S_RX_KEYMISS: STAT(rx_keymiss); + case S_TX_SWFILTERED: STAT(tx_swfiltered); + case S_TX_NODE_PSQ_OVERFLOW: STAT(tx_node_psq_overflow); + case S_TX_NODEQ_OVERFLOW: STAT(tx_nodeq_overflow); + case S_TX_LDPC: STAT(tx_ldpc); + case S_TX_STBC: STAT(tx_stbc); + case S_TSFOOR: STAT(tsfoor); } b[0] = '\0'; return 0; From owner-dev-commits-src-all@freebsd.org Sat May 22 23:34:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 76315639D1F; Sat, 22 May 2021 23:34: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 4Fnfv016Nhz3CNr; Sat, 22 May 2021 23:34: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 00C3D550C; Sat, 22 May 2021 23:34: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 14MNY3Q9020520; Sat, 22 May 2021 23:34:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MNY3dE020519; Sat, 22 May 2021 23:34:03 GMT (envelope-from git) Date: Sat, 22 May 2021 23:34:03 GMT Message-Id: <202105222334.14MNY3dE020519@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: da7f6e67901b - main - [athstats] Add a tag to listen for beacon stuff MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: da7f6e67901bddbeee47f8608334d1567ecdce4d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 23:34:04 -0000 The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=da7f6e67901bddbeee47f8608334d1567ecdce4d commit da7f6e67901bddbeee47f8608334d1567ecdce4d Author: Adrian Chadd AuthorDate: 2021-03-31 19:37:47 +0000 Commit: Adrian Chadd CommitDate: 2021-05-22 22:54:44 +0000 [athstats] Add a tag to listen for beacon stuff I'm debugging weird beacon issues and thus here we are. --- tools/tools/ath/athstats/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/tools/ath/athstats/main.c b/tools/tools/ath/athstats/main.c index 29e86365c83b..23bdb25981d5 100644 --- a/tools/tools/ath/athstats/main.c +++ b/tools/tools/ath/athstats/main.c @@ -65,6 +65,9 @@ static struct { { "tdma", "input,output,bexmit,tdmau,tdmadj,crcerr,phyerr,phytor,rssi,noise,rate" }, + { "beacon", + "bstuck,bmiss,bexmit,beacons,bmisscount,reset,ofdm,cck,input,output" + }, }; static const char * From owner-dev-commits-src-all@freebsd.org Sat May 22 23:43:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0A35E639ED3; Sat, 22 May 2021 23:43: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 4Fng676rtBz3GPB; Sat, 22 May 2021 23:43: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 D2C9B571F; Sat, 22 May 2021 23:43: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 14MNhhOt033851; Sat, 22 May 2021 23:43:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14MNhhGL033850; Sat, 22 May 2021 23:43:43 GMT (envelope-from git) Date: Sat, 22 May 2021 23:43:43 GMT Message-Id: <202105222343.14MNhhGL033850@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: f858e9281c60 - main - [ath] Handle STA + AP beacon programming without stomping over HW AP beacon programming MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f858e9281c60d0730ab20ed94eef5c52e66795ee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 23:43:44 -0000 The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=f858e9281c60d0730ab20ed94eef5c52e66795ee commit f858e9281c60d0730ab20ed94eef5c52e66795ee Author: Adrian Chadd AuthorDate: 2021-05-22 23:39:16 +0000 Commit: Adrian Chadd CommitDate: 2021-05-22 23:39:16 +0000 [ath] Handle STA + AP beacon programming without stomping over HW AP beacon programming I've been using STA+AP modes at home for a couple years now and I've been finding and fixing a lot of weird corner cases. This is the eventual patchset I've landed on. * Don't force beacon resync in STA mode if we're using sw beacon tracking. This stops a variety of stomping issues when the STA VAP is reconfigured; the AP hardware beacons were being stomped on! * Use the first AP VAP to configure beacons on, rather than the first VAP. This prevents weird behaviour in ath_beacon_config() when the hardware is being reconfigured and the STA VAP was the first one created. * Ensure the beacon interval / timing programming is within the AR9300 HAL bounds by masking off any flags that may have been there before shifting the value up to 1/8 TUs rather than the 1 TU resolution the previous chips used. Now I don't get weird beacon reprogramming during startup, STA state changes and hardware recovery which showed up as HI-LARIOUS beacon configurations and STAs that would just disconnect from the AP very frequently. Tested: * AR9344/AR9380, STA and AP and STA+AP modes --- sys/dev/ath/if_ath.c | 34 ++++++++++++++++++++------------ sys/dev/ath/if_ath_beacon.c | 48 +++++++++++++++++++++++++++++++++++---------- sys/dev/ath/if_ath_rx.c | 1 + 3 files changed, 61 insertions(+), 22 deletions(-) diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index 698b8d1a2853..4bc5c31812e7 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -2450,13 +2450,15 @@ ath_bmiss_vap(struct ieee80211vap *vap) ath_power_setpower(sc, HAL_PM_AWAKE, 0); ath_power_restore_power_state(sc); ATH_UNLOCK(sc); + DPRINTF(sc, ATH_DEBUG_BEACON, "%s: forced awake; force syncbeacon=1\n", __func__); - - /* - * Attempt to force a beacon resync. - */ - sc->sc_syncbeacon = 1; + if ((vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS) == 0) { + /* + * Attempt to force a beacon resync. + */ + sc->sc_syncbeacon = 1; + } ATH_VAP(vap)->av_bmiss(vap); } @@ -6061,19 +6063,25 @@ ath_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) * In that case, we may not receive an actual * beacon to update the beacon timer and thus we * won't get notified of the missing beacons. + * + * Also, don't do any of this if we're not running + * with hardware beacon support, as that'll interfere + * with an AP VAP. */ if (ostate != IEEE80211_S_RUN && ostate != IEEE80211_S_SLEEP) { - DPRINTF(sc, ATH_DEBUG_BEACON, - "%s: STA; syncbeacon=1\n", __func__); - sc->sc_syncbeacon = 1; + + if ((vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS) == 0) { + DPRINTF(sc, ATH_DEBUG_BEACON, + "%s: STA; syncbeacon=1\n", __func__); + sc->sc_syncbeacon = 1; + if (csa_run_transition) + ath_beacon_config(sc, vap); + } /* Quiet time handling - ensure we resync */ memset(&avp->quiet_ie, 0, sizeof(avp->quiet_ie)); - if (csa_run_transition) - ath_beacon_config(sc, vap); - /* * PR: kern/175227 * @@ -6086,7 +6094,9 @@ ath_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) * timer fires (too often), leading to a STA * disassociation. */ - sc->sc_beacons = 1; + if ((vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS) == 0) { + sc->sc_beacons = 1; + } } break; case IEEE80211_M_MONITOR: diff --git a/sys/dev/ath/if_ath_beacon.c b/sys/dev/ath/if_ath_beacon.c index ac1244c5f8e7..6da36a176319 100644 --- a/sys/dev/ath/if_ath_beacon.c +++ b/sys/dev/ath/if_ath_beacon.c @@ -448,9 +448,11 @@ ath_beacon_proc(void *arg, int pending) * many consecutive beacons reset the device. */ if (ath_hal_numtxpending(ah, sc->sc_bhalq) != 0) { + sc->sc_bmisscount++; sc->sc_stats.ast_be_missed++; ath_beacon_miss(sc); + DPRINTF(sc, ATH_DEBUG_BEACON, "%s: missed %u consecutive beacons\n", __func__, sc->sc_bmisscount); @@ -935,15 +937,33 @@ ath_beacon_config(struct ath_softc *sc, struct ieee80211vap *vap) u_int32_t nexttbtt_u8, intval_u8; u_int64_t tsf, tsf_beacon; - if (vap == NULL) - vap = TAILQ_FIRST(&ic->ic_vaps); /* XXX */ /* - * Just ensure that we aren't being called when the last - * VAP is destroyed. + * Find the first VAP that we /can/ use a beacon configuration for. + * If it's a STA VAP then if it has SWBMISS set we should ignore it. + * + * Yes, ideally we'd not have a STA without SWBMISS followed by an + * AP STA, and yes this isn't ready for P2P/TSF2 logic on AR9300 and + * later chips. */ if (vap == NULL) { - device_printf(sc->sc_dev, "%s: called with no VAPs\n", - __func__); + IEEE80211_LOCK(ic); + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { + /* A STA VAP w/ SWBMISS set can't be used for beaconing */ + if ((vap->iv_opmode == IEEE80211_M_STA) && + ((vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS) != 0)) + continue; + break; + } + IEEE80211_UNLOCK(ic); + } + + if (vap == NULL) { + device_printf(sc->sc_dev, "called with no valid vaps?\n"); + return; + } + + if ((vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS) != 0) { + device_printf(sc->sc_dev, "called on VAP with SWBMISS set?\n"); return; } @@ -1004,8 +1024,7 @@ ath_beacon_config(struct ath_softc *sc, struct ieee80211vap *vap) else nexttbtt = roundup(nexttbtt, intval); - DPRINTF(sc, ATH_DEBUG_BEACON, "%s: nexttbtt %u intval %u (%u)\n", - __func__, nexttbtt, intval, ni->ni_intval); + if (ic->ic_opmode == IEEE80211_M_STA && !sc->sc_swbmiss) { HAL_BEACON_STATE bs; int dtimperiod, dtimcount; @@ -1196,8 +1215,8 @@ ath_beacon_config(struct ath_softc *sc, struct ieee80211vap *vap) * nexttbtt and intval is TU/8. */ if (sc->sc_isedma) { - nexttbtt_u8 = (nexttbtt << 3); - intval_u8 = (intval << 3); + nexttbtt_u8 = (nexttbtt << 3) & HAL_BEACON_PERIOD_TU8; + intval_u8 = (intval << 3) & HAL_BEACON_PERIOD_TU8; if (intval & HAL_BEACON_ENA) intval_u8 |= HAL_BEACON_ENA; if (intval & HAL_BEACON_RESET_TSF) @@ -1216,6 +1235,15 @@ ath_beacon_config(struct ath_softc *sc, struct ieee80211vap *vap) } ieee80211_free_node(ni); + tsf = ath_hal_gettsf64(ah); + DPRINTF(sc, ATH_DEBUG_BEACON, + "%s: nexttbtt %u intval %u (%u), tsf64=%llu tsfbeacon=%llu delta=%lld\n", + __func__, nexttbtt, intval, ni->ni_intval, + (unsigned long long) tsf, + (unsigned long long) tsf_beacon, + (long long) tsf - + (long long) tsf_beacon); + ATH_LOCK(sc); ath_power_restore_power_state(sc); ATH_UNLOCK(sc); diff --git a/sys/dev/ath/if_ath_rx.c b/sys/dev/ath/if_ath_rx.c index 58da21f09638..588194a942db 100644 --- a/sys/dev/ath/if_ath_rx.c +++ b/sys/dev/ath/if_ath_rx.c @@ -463,6 +463,7 @@ ath_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m, sc->sc_syncbeacon && (!sc->sc_swbmiss) && ni == vap->iv_bss && + ((vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS) == 0) && (vap->iv_state == IEEE80211_S_RUN || vap->iv_state == IEEE80211_S_SLEEP)) { DPRINTF(sc, ATH_DEBUG_BEACON, "%s: syncbeacon=1; syncing\n", From owner-dev-commits-src-all@freebsd.org Sun May 23 00:04:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sun May 23 01:06:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sun May 23 03:03:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sun May 23 04:25:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D497363F404; Sun, 23 May 2021 04:25: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 4FnnLx5fytz3smJ; Sun, 23 May 2021 04:25: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 AB89211485; Sun, 23 May 2021 04:25: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 14N4PDvM006220; Sun, 23 May 2021 04:25:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14N4PDXw006219; Sun, 23 May 2021 04:25:13 GMT (envelope-from git) Date: Sun, 23 May 2021 04:25:13 GMT Message-Id: <202105230425.14N4PDXw006219@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: c50346bcf5c5 - main - ath: bump the default node queue size to 128 frames, not 64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c50346bcf5c5ccd0ef65d273edea6143f66c999f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 04:25:13 -0000 The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=c50346bcf5c5ccd0ef65d273edea6143f66c999f commit c50346bcf5c5ccd0ef65d273edea6143f66c999f Author: Adrian Chadd AuthorDate: 2021-05-23 04:23:00 +0000 Commit: Adrian Chadd CommitDate: 2021-05-23 04:23:00 +0000 ath: bump the default node queue size to 128 frames, not 64 It turns out that, silly adrian, setting it to 64 means only two AMPDU frames of 32 subframes each. Thus, whilst those are in-flight, any subsequent queues frames to that node get dropped. This ends up being pretty no bueno for performance if any receive is also going on at that point. Instead, set it to 128 for the time being to ensure that SOME frames get queued in the meantime. This results in some frames being immediately available in the software queue for transmit when the two existing A-MPDU frames have been completely sent, rather than the queue remaining empty until at least one is sent. It's not the best solution - I still think I'm scheduling receive far more often than giving time to schedule transmit work - but at least now I'm not starving the transmit side. Before this, a bidirectional iperf would show receive at ~ 150mbit/sec. but the transmit side at like 10kbit/sec. With it set to 128 it's now 150mbit/sec receive, and ~ 10mbit receive. It's better than 10kbit/sec, but still not as far as I'd like it to be. Tested: * AR9380/QCA934x (TL-WDR4300 AP), Macbook pro test STA + AR9380 test STA --- sys/dev/ath/if_ath.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index 4bc5c31812e7..3675cfc78654 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -1083,9 +1083,16 @@ ath_attach(u_int16_t devid, struct ath_softc *sc) /* * Default the maximum queue to 1/4'th the TX buffers, or - * 64, whichever is smaller. - */ - sc->sc_txq_node_maxdepth = MIN(64, ath_txbuf / 4); + * 128, whichever is smaller. + * + * Set it to 128 instead of the previous default (64) because + * at 64, two full A-MPDU subframes of 32 frames each is + * enough to treat this node queue as full and all subsequent + * traffic is dropped. Setting it to 128 means there'll + * hopefully be another 64 frames in the software queue + * to begin making A-MPDU frames out of. + */ + sc->sc_txq_node_maxdepth = MIN(128, ath_txbuf / 4); /* Enable CABQ by default */ sc->sc_cabq_enable = 1; From owner-dev-commits-src-all@freebsd.org Sun May 23 08:23:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sun May 23 08:55:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 92C4E6433DC; Sun, 23 May 2021 08:55: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 4FnvMH3kDcz4g5s; Sun, 23 May 2021 08:55: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 67CE914ADA; Sun, 23 May 2021 08:55: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 14N8tte1063435; Sun, 23 May 2021 08:55:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14N8ttJM063434; Sun, 23 May 2021 08:55:55 GMT (envelope-from git) Date: Sun, 23 May 2021 08:55:55 GMT Message-Id: <202105230855.14N8ttJM063434@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: ef0f7ae934b0 - main - The old thread priority must be stored as part of the EPOCH(9) tracker. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ef0f7ae934b04a4f90e051d701ba539dd04e7d5b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 08:55:55 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=ef0f7ae934b04a4f90e051d701ba539dd04e7d5b commit ef0f7ae934b04a4f90e051d701ba539dd04e7d5b Author: Hans Petter Selasky AuthorDate: 2021-05-21 08:27:20 +0000 Commit: Hans Petter Selasky CommitDate: 2021-05-23 08:53:25 +0000 The old thread priority must be stored as part of the EPOCH(9) tracker. Else recursive use of EPOCH(9) may cause the wrong priority to be restored. Bump the __FreeBSD_version due to changing the thread and epoch tracker structure. Differential Revision: https://reviews.freebsd.org/D30375 Reviewed by: markj@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/kern/subr_epoch.c | 6 +++--- sys/sys/epoch.h | 1 + sys/sys/param.h | 2 +- sys/sys/proc.h | 1 - 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/kern/subr_epoch.c b/sys/kern/subr_epoch.c index 798dbdc4360e..651fd8b419f0 100644 --- a/sys/kern/subr_epoch.c +++ b/sys/kern/subr_epoch.c @@ -457,7 +457,7 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et EPOCH_FILE_LINE) THREAD_NO_SLEEPING(); critical_enter(); sched_pin(); - td->td_pre_epoch_prio = td->td_priority; + et->et_old_priority = td->td_priority; er = epoch_currecord(epoch); /* Record-level tracking is reserved for non-preemptible epochs. */ MPASS(er->er_td == NULL); @@ -510,8 +510,8 @@ _epoch_exit_preempt(epoch_t epoch, epoch_tracker_t et EPOCH_FILE_LINE) ck_epoch_end(&er->er_record, &et->et_section); TAILQ_REMOVE(&er->er_tdlist, et, et_link); er->er_gen++; - if (__predict_false(td->td_pre_epoch_prio != td->td_priority)) - epoch_adjust_prio(td, td->td_pre_epoch_prio); + if (__predict_false(et->et_old_priority != td->td_priority)) + epoch_adjust_prio(td, et->et_old_priority); critical_exit(); #ifdef EPOCH_TRACE epoch_trace_exit(td, epoch, et, file, line); diff --git a/sys/sys/epoch.h b/sys/sys/epoch.h index 25d2bb3dc6e3..85c791d3df6c 100644 --- a/sys/sys/epoch.h +++ b/sys/sys/epoch.h @@ -55,6 +55,7 @@ struct epoch_tracker { TAILQ_ENTRY(epoch_tracker) et_link; struct thread *et_td; ck_epoch_section_t et_section; + uint8_t et_old_priority; #ifdef EPOCH_TRACE struct epoch *et_epoch; SLIST_ENTRY(epoch_tracker) et_tlink; diff --git a/sys/sys/param.h b/sys/sys/param.h index 68808f3e2185..81971777e87b 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -76,7 +76,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400013 +#define __FreeBSD_version 1400014 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 926f0de14b84..8098bb9468ec 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -325,7 +325,6 @@ struct thread { u_char td_pri_class; /* (t) Scheduling class. */ u_char td_user_pri; /* (t) User pri from estcpu and nice. */ u_char td_base_user_pri; /* (t) Base user pri */ - u_char td_pre_epoch_prio; /* (k) User pri on entry to epoch */ uintptr_t td_rb_list; /* (k) Robust list head. */ uintptr_t td_rbp_list; /* (k) Robust priv list head. */ uintptr_t td_rb_inact; /* (k) Current in-action mutex loc. */ From owner-dev-commits-src-all@freebsd.org Sun May 23 12:46:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 23F2F6476A5; Sun, 23 May 2021 12:46: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 4Fp0T80XWSz3kVJ; Sun, 23 May 2021 12:46: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 EEB4317B4A; Sun, 23 May 2021 12:46: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 14NCkJvU070197; Sun, 23 May 2021 12:46:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NCkJ2Q070196; Sun, 23 May 2021 12:46:19 GMT (envelope-from git) Date: Sun, 23 May 2021 12:46:19 GMT Message-Id: <202105231246.14NCkJ2Q070196@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: ccac04cae538 - main - test/libalias: Fix build errors on various platforms 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/main X-Git-Reftype: branch X-Git-Commit: ccac04cae538a625cbce224e4005360fa85e1b9d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 12:46:20 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=ccac04cae538a625cbce224e4005360fa85e1b9d commit ccac04cae538a625cbce224e4005360fa85e1b9d Author: Lutz Donnerhacke AuthorDate: 2021-05-23 12:43:00 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-23 12:43:00 +0000 test/libalias: Fix build errors on various platforms struct timeval has an unspecified integral type, which needs to be canonfied before beeing usable by printf(3). --- tests/sys/netinet/libalias/perf.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/sys/netinet/libalias/perf.c b/tests/sys/netinet/libalias/perf.c index ac4796cf9649..fadbb439774a 100644 --- a/tests/sys/netinet/libalias/perf.c +++ b/tests/sys/netinet/libalias/perf.c @@ -15,7 +15,7 @@ static struct in_addr ext = { htonl(0x12000000) }; ? ((tv).tv_usec cmp (uv).tv_usec) \ : ((tv).tv_sec cmp (uv).tv_sec)) -#define timevaldiff(n, o) \ +#define timevaldiff(n, o) (float) \ (((n).tv_sec - (o).tv_sec)*1000000l + \ ((n).tv_usec - (o).tv_usec)) @@ -69,7 +69,7 @@ int main(int argc, char ** argv) gettimeofday(&timeout, NULL); timeout.tv_sec += max_seconds; - printf("RND SEC NAT RND ATT UNA\n"); + printf("RND SECND NAT RND ATT UNA\n"); for (round = 0; ; round++) { int i, res; struct timeval now, start; @@ -77,7 +77,7 @@ int main(int argc, char ** argv) printf("%3d ", round+1); gettimeofday(&start, NULL); - printf("%3ld ", max_seconds - (timeout.tv_sec - start.tv_sec)); + printf("%5.1f ", max_seconds - timevaldiff(timeout, start)/1000000.0f); for (cnt = i = 0; i < batch_size; i++, cnt++) { batch[i].src.s_addr = prv.s_addr | htonl(rand_range(0, 0xffff)); batch[i].dst.s_addr = ext.s_addr | htonl(rand_range(0, 0xffff)); @@ -104,7 +104,7 @@ int main(int argc, char ** argv) goto out; } if (cnt > 0) - printf("%3lu ", timevaldiff(now, start) / cnt); + printf("%3.0f ", timevaldiff(now, start) / cnt); start = now; for (cnt = i = 0; i < random_size; i++, cnt++) { @@ -125,7 +125,7 @@ int main(int argc, char ** argv) goto out; } if (cnt > 0) - printf("%3lu ", timevaldiff(now, start) / cnt); + printf("%3.0f ", timevaldiff(now, start) / cnt); start = now; p->ip_src.s_addr = ext.s_addr & htonl(0xfff00000); @@ -145,7 +145,7 @@ int main(int argc, char ** argv) goto out; } if (cnt > 0) - printf("%3lu ", timevaldiff(now, start) / cnt); + printf("%3.0f ", timevaldiff(now, start) / cnt); qsort(batch, batch_size, sizeof(*batch), randcmp); @@ -172,7 +172,7 @@ int main(int argc, char ** argv) goto out; } if (cnt > 0) - printf("%3lu\n", timevaldiff(now, start) / cnt); + printf("%3.0f\n", timevaldiff(now, start) / cnt); } out: printf("\n\n"); From owner-dev-commits-src-all@freebsd.org Sun May 23 12:56:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 12:56:40 -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-all@freebsd.org Sun May 23 12:59:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sun May 23 13:02:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sun May 23 13:32:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sun May 23 13:35:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sun May 23 13:40:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sun May 23 13:40:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sun May 23 15:34:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3164264A019; Sun, 23 May 2021 15:34: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 4Fp4CW0ghrz4fy1; Sun, 23 May 2021 15:34: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 0057019CAA; Sun, 23 May 2021 15:34: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 14NFYktT098079; Sun, 23 May 2021 15:34:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NFYkOp098078; Sun, 23 May 2021 15:34:46 GMT (envelope-from git) Date: Sun, 23 May 2021 15:34:46 GMT Message-Id: <202105231534.14NFYkOp098078@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 43f5d5bf01fd - main - run(4): fix manual after d6fd321ef60d43dce9f437187c94a7de2b91ab69. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 43f5d5bf01fdf821e8037272c636a9be18323e00 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 15:34:47 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=43f5d5bf01fdf821e8037272c636a9be18323e00 commit 43f5d5bf01fdf821e8037272c636a9be18323e00 Author: Dmitry Chagin AuthorDate: 2021-05-23 13:35:31 +0000 Commit: Dmitry Chagin CommitDate: 2021-05-23 13:35:31 +0000 run(4): fix manual after d6fd321ef60d43dce9f437187c94a7de2b91ab69. PR: 255759 MFC After: 2 weeks --- share/man/man4/run.4 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/man/man4/run.4 b/share/man/man4/run.4 index b95a346f9697..ad314ff67011 100644 --- a/share/man/man4/run.4 +++ b/share/man/man4/run.4 @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 16, 2020 +.Dd May 23, 2021 .Dt RUN 4 .Os .Sh NAME @@ -125,6 +125,7 @@ driver supports the following wireless adapters: .It Airlink101 AWLL6090 .It ASUS USB-N11 .It ASUS USB-N13 ver. A1 +.It ASUS USB-N14 .It ASUS USB-N66 .It ASUS WL-160N .It Belkin F5D8051 ver 3000 From owner-dev-commits-src-all@freebsd.org Sun May 23 15:43:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5EE4B64A3F0; Sun, 23 May 2021 15:43: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 4Fp4P42BPQz4jqG; Sun, 23 May 2021 15:43: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 3214419D50; Sun, 23 May 2021 15:43: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 14NFh4UV011079; Sun, 23 May 2021 15:43:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NFh4Ek011078; Sun, 23 May 2021 15:43:04 GMT (envelope-from git) Date: Sun, 23 May 2021 15:43:04 GMT Message-Id: <202105231543.14NFh4Ek011078@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: b595729ccfde - main - rsu(4): add ASUS WL-167G V3 to the list of supported devices. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b595729ccfde8e5d5bac0acf9690de9d437a1afd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 15:43:04 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=b595729ccfde8e5d5bac0acf9690de9d437a1afd commit b595729ccfde8e5d5bac0acf9690de9d437a1afd Author: Dmitry Chagin AuthorDate: 2021-05-23 15:42:29 +0000 Commit: Dmitry Chagin CommitDate: 2021-05-23 15:42:29 +0000 rsu(4): add ASUS WL-167G V3 to the list of supported devices. MFC After: 2 weeks --- share/man/man4/rsu.4 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/man/man4/rsu.4 b/share/man/man4/rsu.4 index 8e875400bc0b..1d38c4a1618d 100644 --- a/share/man/man4/rsu.4 +++ b/share/man/man4/rsu.4 @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd April 4, 2018 +.Dd May 23, 2021 .Dt RSU 4 .Os .Sh NAME @@ -115,6 +115,7 @@ wireless network adapters, including: .Pp .Bl -tag -width Ds -offset indent -compact .It ASUS USB-N10 +.It ASUS WL-167G V3 .It Belkin F7D1101 v1 .It D-Link DWA-131 A1 .It EDUP EP-MS150N(W) From owner-dev-commits-src-all@freebsd.org Sun May 23 16:50:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sun May 23 16:50:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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-all@freebsd.org Sun May 23 17:47:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3F6E464C25E; Sun, 23 May 2021 17:47: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 4Fp78N0h3gz4gjm; Sun, 23 May 2021 17:47: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 EF94A1B246; Sun, 23 May 2021 17:47: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 14NHlFEg069844; Sun, 23 May 2021 17:47:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NHlFSB069843; Sun, 23 May 2021 17:47:15 GMT (envelope-from git) Date: Sun, 23 May 2021 17:47:15 GMT Message-Id: <202105231747.14NHlFSB069843@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: eaf00819bcfa - main - Add support for Gemini Lake LPSS UARTs. 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/main X-Git-Reftype: branch X-Git-Commit: eaf00819bcfa90ab7ac8af324826eb985197d8c8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 17:47:16 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=eaf00819bcfa90ab7ac8af324826eb985197d8c8 commit eaf00819bcfa90ab7ac8af324826eb985197d8c8 Author: Konstantin Belousov AuthorDate: 2021-05-23 16:38:54 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-23 17:46:32 +0000 Add support for Gemini Lake LPSS UARTs. With this patch: % dmesg | grep -i uart uart2: mem 0xa1426000-0xa1426fff,0xa1425000-0xa1425fff irq 4 at device 24.0 on pci0 uart3: mem 0xa1424000-0xa1424fff,0xa1423000-0xa1423fff irq 5 at device 24.1 on pci0 uart4: mem 0xfea10000-0xfea10fff irq 6 at device 24.2 on pci0 uart5: mem 0xa1422000-0xa1422fff,0xa1421000-0xa1421fff irq 7 at device 24.3 on pci0 PR: 256101 Submitted by: Daniel Ponte MFC after: 1 week --- sys/dev/uart/uart_bus_pci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/dev/uart/uart_bus_pci.c b/sys/dev/uart/uart_bus_pci.c index 707b82dc078b..f7e9bd6ac401 100644 --- a/sys/dev/uart/uart_bus_pci.c +++ b/sys/dev/uart/uart_bus_pci.c @@ -145,6 +145,14 @@ static const struct pci_id pci_ns8250_ids[] = { { 0x8086, 0x2a07, 0xffff, 0, "Intel AMT - PM965/GM965 KT Controller", 0x10 }, { 0x8086, 0x2a47, 0xffff, 0, "Mobile 4 Series Chipset KT Controller", 0x10 }, { 0x8086, 0x2e17, 0xffff, 0, "4 Series Chipset Serial KT Controller", 0x10 }, +{ 0x8086, 0x31bc, 0xffff, 0, "Intel Gemini Lake SIO/LPSS UART 0", 0x10, + 24 * DEFAULT_RCLK, 2 }, +{ 0x8086, 0x31be, 0xffff, 0, "Intel Gemini Lake SIO/LPSS UART 1", 0x10, + 24 * DEFAULT_RCLK, 2 }, +{ 0x8086, 0x31c0, 0xffff, 0, "Intel Gemini Lake SIO/LPSS UART 2", 0x10, + 24 * DEFAULT_RCLK, 2 }, +{ 0x8086, 0x31ee, 0xffff, 0, "Intel Gemini Lake SIO/LPSS UART 3", 0x10, + 24 * DEFAULT_RCLK, 2 }, { 0x8086, 0x3b67, 0xffff, 0, "5 Series/3400 Series Chipset KT Controller", 0x10 }, { 0x8086, 0x5abc, 0xffff, 0, "Intel Apollo Lake SIO/LPSS UART 0", 0x10, From owner-dev-commits-src-all@freebsd.org Sun May 23 17:56:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 65D7E64C693; Sun, 23 May 2021 17:56: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 4Fp7MK2RvHz4lWP; Sun, 23 May 2021 17:56: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 36AA01BB12; Sun, 23 May 2021 17:56: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 14NHujl7083405; Sun, 23 May 2021 17:56:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NHujEa083404; Sun, 23 May 2021 17:56:45 GMT (envelope-from git) Date: Sun, 23 May 2021 17:56:45 GMT Message-Id: <202105231756.14NHujEa083404@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 6a467cc5e1f6 - main - lockprof: pass lock type as an argument instead of reading the spin 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/main X-Git-Reftype: branch X-Git-Commit: 6a467cc5e1f673a700f6229e63e9a98ed65264c8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 17:56:45 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=6a467cc5e1f673a700f6229e63e9a98ed65264c8 commit 6a467cc5e1f673a700f6229e63e9a98ed65264c8 Author: Mateusz Guzik AuthorDate: 2021-05-23 15:25:42 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-23 17:55:27 +0000 lockprof: pass lock type as an argument instead of reading the spin flag --- sys/kern/kern_lock.c | 10 +++++----- sys/kern/kern_mutex.c | 20 +++++++++++--------- sys/kern/kern_rwlock.c | 8 ++++---- sys/kern/kern_sx.c | 8 ++++---- sys/kern/sched_4bsd.c | 8 ++++---- sys/kern/subr_lock.c | 30 +++++++++++++++++++++++------- sys/sys/lock_profile.h | 16 ++++++++-------- sys/sys/lockstat.h | 28 ++++++++++++++++++++++------ sys/sys/mutex.h | 6 +++--- 9 files changed, 84 insertions(+), 50 deletions(-) diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 5cefcf7a597b..bec49f29d162 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -639,7 +639,7 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, struct lock_object *ilk, #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); #endif - lock_profile_obtain_lock_failed(&lk->lock_object, + lock_profile_obtain_lock_failed(&lk->lock_object, false, &contested, &waittime); /* @@ -852,7 +852,7 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, struct lock_object *ilk, #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); #endif - lock_profile_obtain_lock_failed(&lk->lock_object, + lock_profile_obtain_lock_failed(&lk->lock_object, false, &contested, &waittime); /* @@ -1442,7 +1442,7 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk, #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); #endif - lock_profile_obtain_lock_failed(&lk->lock_object, + lock_profile_obtain_lock_failed(&lk->lock_object, false, &contested, &waittime); /* @@ -1589,7 +1589,7 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk, if (error == 0) { lock_profile_obtain_lock_success(&lk->lock_object, - contested, waittime, file, line); + false, contested, waittime, file, line); LOCK_LOG_LOCK("DRAIN", &lk->lock_object, 0, lk->lk_recurse, file, line); WITNESS_LOCK(&lk->lock_object, LOP_EXCLUSIVE | @@ -1635,7 +1635,7 @@ _lockmgr_disown(struct lock *lk, const char *file, int line) */ if (LK_HOLDER(lk->lk_lock) != tid) return; - lock_profile_release_lock(&lk->lock_object); + lock_profile_release_lock(&lk->lock_object, false); LOCKSTAT_RECORD1(lockmgr__disown, lk, LOCKSTAT_WRITER); LOCK_LOG_LOCK("XDISOWN", &lk->lock_object, 0, 0, file, line); WITNESS_UNLOCK(&lk->lock_object, LOP_EXCLUSIVE, file, line); diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index 0c384281f711..d9db69e2ac09 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -344,7 +344,7 @@ __mtx_lock_spin_flags(volatile uintptr_t *c, int opts, const char *file, if (!_mtx_obtain_lock_fetch(m, &v, tid)) _mtx_lock_spin(m, v, opts, file, line); else - LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(spin__acquire, + LOCKSTAT_PROFILE_OBTAIN_SPIN_LOCK_SUCCESS(spin__acquire, m, 0, 0, file, line); #else __mtx_lock_spin(m, curthread, opts, file, line); @@ -565,7 +565,7 @@ __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v) #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); #endif - lock_profile_obtain_lock_failed(&m->lock_object, + lock_profile_obtain_lock_failed(&m->lock_object, false, &contested, &waittime); if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR4(KTR_LOCK, @@ -756,7 +756,7 @@ _mtx_lock_spin_cookie(volatile uintptr_t *c, uintptr_t v) #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); #endif - lock_profile_obtain_lock_failed(&m->lock_object, &contested, &waittime); + lock_profile_obtain_lock_failed(&m->lock_object, true, &contested, &waittime); for (;;) { if (v == MTX_UNOWNED) { @@ -792,7 +792,7 @@ _mtx_lock_spin_cookie(volatile uintptr_t *c, uintptr_t v) LOCKSTAT_RECORD1(spin__spin, m, spin_time); out_lockstat: #endif - LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(spin__acquire, m, + LOCKSTAT_PROFILE_OBTAIN_SPIN_LOCK_SUCCESS(spin__acquire, m, contested, waittime, file, line); } #endif /* SMP */ @@ -912,7 +912,7 @@ retry: continue; } MPASS(v != tid); - lock_profile_obtain_lock_failed(&m->lock_object, + lock_profile_obtain_lock_failed(&m->lock_object, true, &contested, &waittime); /* Give interrupts a chance while we spin. */ spinlock_exit(); @@ -945,7 +945,7 @@ retry: #ifdef KDTRACE_HOOKS spin_time += lockstat_nsecs(&m->lock_object); #endif - LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(spin__acquire, m, contested, + LOCKSTAT_PROFILE_OBTAIN_SPIN_LOCK_SUCCESS(spin__acquire, m, contested, waittime, file, line); #ifdef KDTRACE_HOOKS if (lda.spin_cnt != 0) @@ -1183,12 +1183,14 @@ _mtx_destroy(volatile uintptr_t *c) MPASS((m->mtx_lock & (MTX_RECURSED|MTX_CONTESTED)) == 0); /* Perform the non-mtx related part of mtx_unlock_spin(). */ - if (LOCK_CLASS(&m->lock_object) == &lock_class_mtx_spin) + if (LOCK_CLASS(&m->lock_object) == &lock_class_mtx_spin) { + lock_profile_release_lock(&m->lock_object, true); spinlock_exit(); - else + } else { TD_LOCKS_DEC(curthread); + lock_profile_release_lock(&m->lock_object, false); + } - lock_profile_release_lock(&m->lock_object); /* Tell witness this isn't locked to make it happy. */ WITNESS_UNLOCK(&m->lock_object, LOP_EXCLUSIVE, __FILE__, __LINE__); diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c index cf1af0ee7af9..f1c18f952f24 100644 --- a/sys/kern/kern_rwlock.c +++ b/sys/kern/kern_rwlock.c @@ -481,7 +481,7 @@ __rw_rlock_hard(struct rwlock *rw, struct thread *td, uintptr_t v #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); #endif - lock_profile_obtain_lock_failed(&rw->lock_object, + lock_profile_obtain_lock_failed(&rw->lock_object, false, &contested, &waittime); for (;;) { @@ -681,7 +681,7 @@ __rw_rlock_int(struct rwlock *rw LOCK_FILE_LINE_ARG_DEF) !__rw_rlock_try(rw, td, &v, true LOCK_FILE_LINE_ARG))) __rw_rlock_hard(rw, td, v LOCK_FILE_LINE_ARG); else - lock_profile_obtain_lock_success(&rw->lock_object, 0, 0, + lock_profile_obtain_lock_success(&rw->lock_object, false, 0, 0, file, line); LOCK_LOG_LOCK("RLOCK", &rw->lock_object, 0, 0, file, line); @@ -856,7 +856,7 @@ _rw_runlock_cookie_int(struct rwlock *rw LOCK_FILE_LINE_ARG_DEF) !__rw_runlock_try(rw, td, &v))) __rw_runlock_hard(rw, td, v LOCK_FILE_LINE_ARG); else - lock_profile_release_lock(&rw->lock_object); + lock_profile_release_lock(&rw->lock_object, false); TD_LOCKS_DEC(curthread); } @@ -975,7 +975,7 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v LOCK_FILE_LINE_ARG_DEF) #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); #endif - lock_profile_obtain_lock_failed(&rw->lock_object, + lock_profile_obtain_lock_failed(&rw->lock_object, false, &contested, &waittime); for (;;) { diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c index 3296bf50a290..ad1c1a0e8813 100644 --- a/sys/kern/kern_sx.c +++ b/sys/kern/kern_sx.c @@ -648,7 +648,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LOCK_FILE_LINE_ARG_DEF) #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); #endif - lock_profile_obtain_lock_failed(&sx->lock_object, &contested, + lock_profile_obtain_lock_failed(&sx->lock_object, false, &contested, &waittime); #ifndef INVARIANTS @@ -1069,7 +1069,7 @@ _sx_slock_hard(struct sx *sx, int opts, uintptr_t x LOCK_FILE_LINE_ARG_DEF) #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); #endif - lock_profile_obtain_lock_failed(&sx->lock_object, &contested, + lock_profile_obtain_lock_failed(&sx->lock_object, false, &contested, &waittime); #ifndef INVARIANTS @@ -1272,7 +1272,7 @@ _sx_slock_int(struct sx *sx, int opts LOCK_FILE_LINE_ARG_DEF) !__sx_slock_try(sx, td, &x, true LOCK_FILE_LINE_ARG))) error = _sx_slock_hard(sx, opts, x LOCK_FILE_LINE_ARG); else - lock_profile_obtain_lock_success(&sx->lock_object, 0, 0, + lock_profile_obtain_lock_success(&sx->lock_object, false, 0, 0, file, line); if (error == 0) { LOCK_LOG_LOCK("SLOCK", &sx->lock_object, 0, 0, file, line); @@ -1379,7 +1379,7 @@ _sx_sunlock_int(struct sx *sx LOCK_FILE_LINE_ARG_DEF) !_sx_sunlock_try(sx, td, &x))) _sx_sunlock_hard(sx, td, x LOCK_FILE_LINE_ARG); else - lock_profile_release_lock(&sx->lock_object); + lock_profile_release_lock(&sx->lock_object, false); TD_LOCKS_DEC(curthread); } diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index 7ce9bd81704f..7e6123cdcf24 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -1053,7 +1053,7 @@ sched_switch(struct thread *td, int flags) SDT_PROBE2(sched, , , off__cpu, newtd, newtd->td_proc); /* I feel sleepy */ - lock_profile_release_lock(&sched_lock.lock_object); + lock_profile_release_lock(&sched_lock.lock_object, true); #ifdef KDTRACE_HOOKS /* * If DTrace has set the active vtime enum to anything @@ -1065,7 +1065,7 @@ sched_switch(struct thread *td, int flags) #endif cpu_switch(td, newtd, tmtx); - lock_profile_obtain_lock_success(&sched_lock.lock_object, + lock_profile_obtain_lock_success(&sched_lock.lock_object, true, 0, 0, __FILE__, __LINE__); /* * Where am I? What year is it? @@ -1676,7 +1676,7 @@ sched_throw(struct thread *td) PCPU_SET(switchtime, cpu_ticks()); PCPU_SET(switchticks, ticks); } else { - lock_profile_release_lock(&sched_lock.lock_object); + lock_profile_release_lock(&sched_lock.lock_object, true); MPASS(td->td_lock == &sched_lock); td->td_lastcpu = td->td_oncpu; td->td_oncpu = NOCPU; @@ -1696,7 +1696,7 @@ sched_fork_exit(struct thread *td) */ td->td_oncpu = PCPU_GET(cpuid); sched_lock.mtx_lock = (uintptr_t)td; - lock_profile_obtain_lock_success(&sched_lock.lock_object, + lock_profile_obtain_lock_success(&sched_lock.lock_object, true, 0, 0, __FILE__, __LINE__); THREAD_LOCK_ASSERT(td, MA_OWNED | MA_NOTRECURSED); diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c index 9c433f683bac..ca2c6ad32f00 100644 --- a/sys/kern/subr_lock.c +++ b/sys/kern/subr_lock.c @@ -58,6 +58,12 @@ __FBSDID("$FreeBSD$"); #include +/* + * Uncomment to validate that spin argument to acquire/release routines matches + * the flag in the lock + */ +//#define LOCK_PROFILING_DEBUG_SPIN + SDT_PROVIDER_DEFINE(lock); SDT_PROBE_DEFINE1(lock, , , starvation, "u_int"); @@ -594,11 +600,17 @@ lock_profile_object_lookup(struct lock_object *lo, int spin, const char *file, } void -lock_profile_obtain_lock_success(struct lock_object *lo, int contested, - uint64_t waittime, const char *file, int line) +lock_profile_obtain_lock_success(struct lock_object *lo, bool spin, + int contested, uint64_t waittime, const char *file, int line) { struct lock_profile_object *l; - int spin; + +#ifdef LOCK_PROFILING_DEBUG_SPIN + bool is_spin = (LOCK_CLASS(lo)->lc_flags & LC_SPINLOCK); + if ((spin && !is_spin) || (!spin && is_spin)) + printf("%s: lock %s spin mismatch (arg %d, flag %d)\n", __func__, + lo->lo_name, spin, is_spin); +#endif if (SCHEDULER_STOPPED()) return; @@ -608,7 +620,6 @@ lock_profile_obtain_lock_success(struct lock_object *lo, int contested, return; if (lock_contested_only && !contested) return; - spin = (LOCK_CLASS(lo)->lc_flags & LC_SPINLOCK) ? 1 : 0; if (spin && lock_prof_skipspin == 1) return; critical_enter(); @@ -661,20 +672,25 @@ lock_profile_thread_exit(struct thread *td) } void -lock_profile_release_lock(struct lock_object *lo) +lock_profile_release_lock(struct lock_object *lo, bool spin) { struct lock_profile_object *l; struct lock_prof_type *type; struct lock_prof *lp; uint64_t curtime, holdtime; struct lpohead *head; - int spin; + +#ifdef LOCK_PROFILING_DEBUG_SPIN + bool is_spin = (LOCK_CLASS(lo)->lc_flags & LC_SPINLOCK); + if ((spin && !is_spin) || (!spin && is_spin)) + printf("%s: lock %s spin mismatch (arg %d, flag %d)\n", __func__, + lo->lo_name, spin, is_spin); +#endif if (SCHEDULER_STOPPED()) return; if (lo->lo_flags & LO_NOPROFILE) return; - spin = (LOCK_CLASS(lo)->lc_flags & LC_SPINLOCK) ? 1 : 0; head = &curthread->td_lprof[spin]; if (LIST_FIRST(head) == NULL) return; diff --git a/sys/sys/lock_profile.h b/sys/sys/lock_profile.h index 2ace6ef56983..de1a95779254 100644 --- a/sys/sys/lock_profile.h +++ b/sys/sys/lock_profile.h @@ -46,14 +46,14 @@ u_int64_t nanoseconds(void); extern volatile int lock_prof_enable; -void lock_profile_obtain_lock_success(struct lock_object *lo, int contested, - uint64_t waittime, const char *file, int line); -void lock_profile_release_lock(struct lock_object *lo); +void lock_profile_obtain_lock_success(struct lock_object *lo, bool spin, + int contested, uint64_t waittime, const char *file, int line); +void lock_profile_release_lock(struct lock_object *lo, bool spin); void lock_profile_thread_exit(struct thread *td); static inline void -lock_profile_obtain_lock_failed(struct lock_object *lo, int *contested, - uint64_t *waittime) +lock_profile_obtain_lock_failed(struct lock_object *lo, bool spin, + int *contested, uint64_t *waittime) { if (!lock_prof_enable || (lo->lo_flags & LO_NOPROFILE) || *contested) return; @@ -63,9 +63,9 @@ lock_profile_obtain_lock_failed(struct lock_object *lo, int *contested, #else /* !LOCK_PROFILING */ -#define lock_profile_release_lock(lo) (void)0 -#define lock_profile_obtain_lock_failed(lo, contested, waittime) (void)0 -#define lock_profile_obtain_lock_success(lo, contested, waittime, file, line) (void)0 +#define lock_profile_release_lock(lo, spin) (void)0 +#define lock_profile_obtain_lock_failed(lo, spin, contested, waittime) (void)0 +#define lock_profile_obtain_lock_success(lo, spin, contested, waittime, file, line) (void)0 #define lock_profile_thread_exit(td) (void)0 #endif /* !LOCK_PROFILING */ diff --git a/sys/sys/lockstat.h b/sys/sys/lockstat.h index 6a5f79a2f152..76bd97dbafa5 100644 --- a/sys/sys/lockstat.h +++ b/sys/sys/lockstat.h @@ -97,22 +97,32 @@ extern volatile bool lockstat_enabled; SDT_PROBE5(lockstat, , , probe, lp, arg1, arg2, arg3, arg4) #define LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(probe, lp, c, wt, f, l) do { \ - lock_profile_obtain_lock_success(&(lp)->lock_object, c, wt, f, l); \ + lock_profile_obtain_lock_success(&(lp)->lock_object, false, c, wt, f, l); \ + LOCKSTAT_RECORD0(probe, lp); \ +} while (0) + +#define LOCKSTAT_PROFILE_OBTAIN_SPIN_LOCK_SUCCESS(probe, lp, c, wt, f, l) do { \ + lock_profile_obtain_lock_success(&(lp)->lock_object, true, c, wt, f, l); \ LOCKSTAT_RECORD0(probe, lp); \ } while (0) #define LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(probe, lp, c, wt, f, l, a) do { \ - lock_profile_obtain_lock_success(&(lp)->lock_object, c, wt, f, l); \ + lock_profile_obtain_lock_success(&(lp)->lock_object, false, c, wt, f, l); \ LOCKSTAT_RECORD1(probe, lp, a); \ } while (0) #define LOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp) do { \ - lock_profile_release_lock(&(lp)->lock_object); \ + lock_profile_release_lock(&(lp)->lock_object, false); \ + LOCKSTAT_RECORD0(probe, lp); \ +} while (0) + +#define LOCKSTAT_PROFILE_RELEASE_SPIN_LOCK(probe, lp) do { \ + lock_profile_release_lock(&(lp)->lock_object, true); \ LOCKSTAT_RECORD0(probe, lp); \ } while (0) #define LOCKSTAT_PROFILE_RELEASE_RWLOCK(probe, lp, a) do { \ - lock_profile_release_lock(&(lp)->lock_object); \ + lock_profile_release_lock(&(lp)->lock_object, false); \ LOCKSTAT_RECORD1(probe, lp, a); \ } while (0) @@ -130,13 +140,19 @@ uint64_t lockstat_nsecs(struct lock_object *); #define LOCKSTAT_RECORD4(probe, lp, arg1, arg2, arg3, arg4) #define LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(probe, lp, c, wt, f, l) \ - lock_profile_obtain_lock_success(&(lp)->lock_object, c, wt, f, l) + lock_profile_obtain_lock_success(&(lp)->lock_object, false, c, wt, f, l) + +#define LOCKSTAT_PROFILE_OBTAIN_SPIN_LOCK_SUCCESS(probe, lp, c, wt, f, l) \ + lock_profile_obtain_lock_success(&(lp)->lock_object, true, c, wt, f, l) #define LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(probe, lp, c, wt, f, l, a) \ LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(probe, lp, c, wt, f, l) #define LOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp) \ - lock_profile_release_lock(&(lp)->lock_object) + lock_profile_release_lock(&(lp)->lock_object, false) + +#define LOCKSTAT_PROFILE_RELEASE_SPIN_LOCK(probe, lp) \ + lock_profile_release_lock(&(lp)->lock_object, true) #define LOCKSTAT_PROFILE_RELEASE_RWLOCK(probe, lp, a) \ LOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp) diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h index 35257ce97038..f35cdd7413a6 100644 --- a/sys/sys/mutex.h +++ b/sys/sys/mutex.h @@ -270,7 +270,7 @@ void _thread_lock(struct thread *); spinlock_exit(); \ _ret = 0; \ } else { \ - LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(spin__acquire, \ + LOCKSTAT_PROFILE_OBTAIN_SPIN_LOCK_SUCCESS(spin__acquire, \ mp, 0, 0, file, line); \ _ret = 1; \ } \ @@ -328,7 +328,7 @@ void _thread_lock(struct thread *); if (mtx_recursed((mp))) \ (mp)->mtx_recurse--; \ else { \ - LOCKSTAT_PROFILE_RELEASE_LOCK(spin__release, mp); \ + LOCKSTAT_PROFILE_RELEASE_SPIN_LOCK(spin__release, mp); \ _mtx_release_lock_quick((mp)); \ } \ spinlock_exit(); \ @@ -338,7 +338,7 @@ void _thread_lock(struct thread *); if (mtx_recursed((mp))) \ (mp)->mtx_recurse--; \ else { \ - LOCKSTAT_PROFILE_RELEASE_LOCK(spin__release, mp); \ + LOCKSTAT_PROFILE_RELEASE_SPIN_LOCK(spin__release, mp); \ (mp)->mtx_lock = MTX_UNOWNED; \ } \ spinlock_exit(); \ From owner-dev-commits-src-all@freebsd.org Sun May 23 17:56:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B805664C5C3; Sun, 23 May 2021 17:56: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 4Fp7ML388Pz4lk9; Sun, 23 May 2021 17:56: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 51EC01B937; Sun, 23 May 2021 17:56: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 14NHukkg083426; Sun, 23 May 2021 17:56:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NHukce083425; Sun, 23 May 2021 17:56:46 GMT (envelope-from git) Date: Sun, 23 May 2021 17:56:46 GMT Message-Id: <202105231756.14NHukce083425@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: e2ab16b1a6c0 - main - lockprof: move panic check after inspecting the state 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/main X-Git-Reftype: branch X-Git-Commit: e2ab16b1a6c0f556299df21be54f04652ba7169d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 17:56:46 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=e2ab16b1a6c0f556299df21be54f04652ba7169d commit e2ab16b1a6c0f556299df21be54f04652ba7169d Author: Mateusz Guzik AuthorDate: 2021-05-23 16:04:31 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-23 17:55:27 +0000 lockprof: move panic check after inspecting the state --- sys/kern/subr_lock.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c index ca2c6ad32f00..9bea021baac4 100644 --- a/sys/kern/subr_lock.c +++ b/sys/kern/subr_lock.c @@ -612,9 +612,6 @@ lock_profile_obtain_lock_success(struct lock_object *lo, bool spin, lo->lo_name, spin, is_spin); #endif - if (SCHEDULER_STOPPED()) - return; - /* don't reset the timer when/if recursing */ if (!lock_prof_enable || (lo->lo_flags & LO_NOPROFILE)) return; @@ -622,6 +619,10 @@ lock_profile_obtain_lock_success(struct lock_object *lo, bool spin, return; if (spin && lock_prof_skipspin == 1) return; + + if (SCHEDULER_STOPPED()) + return; + critical_enter(); /* Recheck enabled now that we're in a critical section. */ if (lock_prof_enable == 0) @@ -687,13 +688,13 @@ lock_profile_release_lock(struct lock_object *lo, bool spin) lo->lo_name, spin, is_spin); #endif - if (SCHEDULER_STOPPED()) - return; if (lo->lo_flags & LO_NOPROFILE) return; head = &curthread->td_lprof[spin]; if (LIST_FIRST(head) == NULL) return; + if (SCHEDULER_STOPPED()) + return; critical_enter(); /* Recheck enabled now that we're in a critical section. */ if (lock_prof_enable == 0 && lock_prof_resetting == 1) From owner-dev-commits-src-all@freebsd.org Sun May 23 18:02:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C8B6764C92D; Sun, 23 May 2021 18:02:13 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fp7Tc6V1Cz4pPm; Sun, 23 May 2021 18:02:12 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lf1-x134.google.com with SMTP id b26so21217251lfq.4; Sun, 23 May 2021 11:02:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=i4nInJsvvtzIScoKLHgOqm9N6qfDyNOnP7kEzDfoZeU=; b=UkYXrpeTKUUN1vhOmtQCxIN0RHGEa1Osydn63otPHC9Qx6Obqa2ri3Aq2um3NMxPET 6dcvN69UTSk4fhnF74Y4t6gUMDgmv56Ey4XTG7/fcx2wlZ4D7OcKt9QyNg6b4bkHHqiL svUGS+oRcjngPOE6LQuIkE2AwzqPy7lddL+jRfXV/b3W1z6d6e6bsv/nyThB1782YGIQ F0e7ADtgBTMjRSShFQARsCpaMDJJHgxj0D/wyL0AIqSUc6Dd0vJW0lHGVY0n7V+HSP8p RFaimbR/nlbmdnNL47DZFybpn5iU1keQ4uaqqJawb4aB5lUP/izeEIEuIfX0ZY6JyE56 MuXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=i4nInJsvvtzIScoKLHgOqm9N6qfDyNOnP7kEzDfoZeU=; b=Lk6C6ZoxC2TBUulljmT2WA4xWNwGAy8Fbr8CuynoXhpCIIfnpac93GNXvJH9S7mcnl M/ZGhr6MFJ/gFxCc3kODTL/MrHKHnIKIh9CG3nTVf4AtuOzuPu5Zhd5ga7sDKKRyfE/r cZwho1vtaSJ9wgcivmGzaaAKCBMlCc2UPSqcYDD1yDgYXn/gIE5gZVv0to1IPhAflB7l V+64F3Xu38ziRKxkuddbCJ6d5+SAm3YT4l0kfqqW+neGpbqHcIx2Ia+xGzDQoE3xluj7 2chgIgCXf8Ra6g5OgTlxRHikIq9Ca4sUi09igUlJKzeZd4L8B1HhMVPMYEVeIbnnv7DS CFfQ== X-Gm-Message-State: AOAM531HEQoJmmaJiIWM3ItNf4GDGvLNt0t4mk5CW7IuiqGoh6gEFqr+ lDPhQoZldq+MGSjmWbzbM+WCEOAhUP5oJgOLmh7IRGsZ X-Google-Smtp-Source: ABdhPJyXFNg+Jb9VKSJs8rZC+toJS/iDW5+z8yakjsHMfhVAGFngnYCSYKpT51303TYopS73gZmTPVurfLZ/VWzddKg= X-Received: by 2002:ac2:592b:: with SMTP id v11mr8579675lfi.296.1621792930888; Sun, 23 May 2021 11:02:10 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:9746:0:0:0:0:0 with HTTP; Sun, 23 May 2021 11:02:10 -0700 (PDT) In-Reply-To: <202105211604.14LG4EdR005067@gitrepo.freebsd.org> References: <202105211604.14LG4EdR005067@gitrepo.freebsd.org> From: Mateusz Guzik Date: Sun, 23 May 2021 20:02:10 +0200 Message-ID: Subject: Re: git: 5b2a81f58dc7 - main - mmc: Add mmc-pwrseq driver To: Emmanuel Vadot Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4Fp7Tc6V1Cz4pPm X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=UkYXrpeT; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::134 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::134:from]; TO_DN_SOME(0.00)[]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::134:from:127.0.2.255]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::134:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 18:02:13 -0000 This breaks tinderbox, for example buildkernel TARGET_ARCH=armv6 KERNCONF=RPI-B MODULES_OVERRIDE="": ld: error: undefined symbol: mmc_fdt_parse >>> referenced by bcm2835_sdhci.c:320 (/usr/src/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c:320) >>> bcm2835_sdhci.o:(bcm_sdhci_attach) ld: error: undefined symbol: mmc_fdt_parse >>> referenced by bcm2835_sdhci.c:320 (/usr/src/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c:320) >>> bcm2835_sdhci.o:(bcm_sdhci_attach) On 5/21/21, Emmanuel Vadot wrote: > The branch main has been updated by manu: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=5b2a81f58dc722ca76065536f07ba47efd98dc63 > > commit 5b2a81f58dc722ca76065536f07ba47efd98dc63 > Author: Emmanuel Vadot > AuthorDate: 2021-05-16 12:48:56 +0000 > Commit: Emmanuel Vadot > CommitDate: 2021-05-21 15:36:20 +0000 > > mmc: Add mmc-pwrseq driver > > This driver is used to power up sdio card or eMMC. > It handle the reset-gpio, clocks and needed delays for > powerup/powerdown. > > Sponsored by: Diablotin Systems > Differential Revision: https://reviews.freebsd.org/D30288 > --- > sys/conf/files | 2 + > sys/dev/mmc/mmc_pwrseq.c | 194 > ++++++++++++++++++++++++++++++++++++++++++++ > sys/dev/mmc/mmc_pwrseq_if.m | 38 +++++++++ > 3 files changed, 234 insertions(+) > > diff --git a/sys/conf/files b/sys/conf/files > index 22083169bfc7..70cdd9f68dc6 100644 > --- a/sys/conf/files > +++ b/sys/conf/files > @@ -2476,6 +2476,8 @@ dev/mmc/mmcbr_if.m standard > dev/mmc/mmcbus_if.m standard > dev/mmc/mmcsd.c optional mmcsd !mmccam > dev/mmc/mmc_fdt_helpers.c optional mmc fdt | mmccam fdt > +dev/mmc/mmc_pwrseq.c optional mmc fdt | mmccam fdt > +dev/mmc/mmc_pwrseq_if.m optional mmc fdt | mmccam fdt > dev/mmcnull/mmcnull.c optional mmcnull > dev/mpr/mpr.c optional mpr > dev/mpr/mpr_config.c optional mpr > diff --git a/sys/dev/mmc/mmc_pwrseq.c b/sys/dev/mmc/mmc_pwrseq.c > new file mode 100644 > index 000000000000..d4ccf814fe53 > --- /dev/null > +++ b/sys/dev/mmc/mmc_pwrseq.c > @@ -0,0 +1,194 @@ > +/* > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > + * Copyright 2021 Emmanuel Vadot > + * > + * 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 > +__FBSDID("$FreeBSD$"); > + > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > + > +#include > + > +#include "mmc_pwrseq_if.h" > + > +enum pwrseq_type { > + PWRSEQ_SIMPLE = 1, > + PWRSEQ_EMMC, > +}; > + > +static struct ofw_compat_data compat_data[] = { > + { "mmc-pwrseq-simple", PWRSEQ_SIMPLE }, > + { "mmc-pwrseq-emmc", PWRSEQ_EMMC }, > + { NULL, 0 } > +}; > + > +struct mmc_pwrseq_softc { > + enum pwrseq_type type; > + clk_t ext_clock; > + struct gpiobus_pin *reset_gpio; > + > + uint32_t post_power_on_delay_ms; > + uint32_t power_off_delay_us; > +}; > + > +static int > +mmc_pwrseq_probe(device_t dev) > +{ > + enum pwrseq_type type; > + > + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) > + return (ENXIO); > + > + type = (enum pwrseq_type)ofw_bus_search_compatible(dev, > compat_data)->ocd_data; > + switch (type) { > + case PWRSEQ_SIMPLE: > + device_set_desc(dev, "MMC Simple Power sequence"); > + break; > + case PWRSEQ_EMMC: > + device_set_desc(dev, "MMC eMMC Power sequence"); > + break; > + } > + return (BUS_PROBE_DEFAULT); > +} > + > +static int > +mmc_pwrseq_attach(device_t dev) > +{ > + struct mmc_pwrseq_softc *sc; > + phandle_t node; > + int rv; > + > + sc = device_get_softc(dev); > + sc->type = (enum pwrseq_type)ofw_bus_search_compatible(dev, > compat_data)->ocd_data; > + node = ofw_bus_get_node(dev); > + > + if (sc->type == PWRSEQ_SIMPLE) { > + if (OF_hasprop(node, "clocks")) { > + rv = clk_get_by_ofw_name(dev, 0, "ext_clock", &sc->ext_clock); > + if (rv != 0) { > + device_printf(dev, > + "Node have a clocks property but no clocks named > \"ext_clock\"\n"); > + return (ENXIO); > + } > + } > + OF_getencprop(node, "post-power-on-delay-ms", > &sc->post_power_on_delay_ms, sizeof(uint32_t)); > + OF_getencprop(node, "power-off-delay-us", &sc->power_off_delay_us, > sizeof(uint32_t)); > + } > + > + if (OF_hasprop(node, "reset-gpios")) { > + if (gpio_pin_get_by_ofw_property(dev, node, "reset-gpios", > + &sc->reset_gpio) != 0) { > + device_printf(dev, "Cannot get the reset-gpios\n"); > + return (ENXIO); > + } > + gpio_pin_setflags(sc->reset_gpio, GPIO_PIN_OUTPUT); > + gpio_pin_set_active(sc->reset_gpio, true); > + } > + > + OF_device_register_xref(OF_xref_from_node(node), dev); > + return (0); > +} > + > +static int > +mmc_pwrseq_detach(device_t dev) > +{ > + > + return (EBUSY); > +} > + > +static int > +mmv_pwrseq_set_power(device_t dev, bool power_on) > +{ > + struct mmc_pwrseq_softc *sc; > + int rv; > + > + sc = device_get_softc(dev); > + > + if (power_on) { > + if (sc->ext_clock) { > + rv = clk_enable(sc->ext_clock); > + if (rv != 0) > + return (rv); > + } > + > + if (sc->reset_gpio) { > + rv = gpio_pin_set_active(sc->reset_gpio, false); > + if (rv != 0) > + return (rv); > + } > + > + if (sc->post_power_on_delay_ms) > + DELAY(sc->post_power_on_delay_ms * 1000); > + } else { > + if (sc->reset_gpio) { > + rv = gpio_pin_set_active(sc->reset_gpio, true); > + if (rv != 0) > + return (rv); > + } > + > + if (sc->ext_clock) { > + rv = clk_stop(sc->ext_clock); > + if (rv != 0) > + return (rv); > + } > + if (sc->power_off_delay_us) > + DELAY(sc->power_off_delay_us); > + } > + > + return (0); > +} > + > +static device_method_t mmc_pwrseq_methods[] = { > + /* Device interface */ > + DEVMETHOD(device_probe, mmc_pwrseq_probe), > + DEVMETHOD(device_attach, mmc_pwrseq_attach), > + DEVMETHOD(device_detach, mmc_pwrseq_detach), > + > + DEVMETHOD(mmc_pwrseq_set_power, mmv_pwrseq_set_power), > + DEVMETHOD_END > +}; > + > +static driver_t mmc_pwrseq_driver = { > + "mmc_pwrseq", > + mmc_pwrseq_methods, > + sizeof(struct mmc_pwrseq_softc), > +}; > + > +static devclass_t mmc_pwrseq_devclass; > + > +EARLY_DRIVER_MODULE(mmc_pwrseq, simplebus, mmc_pwrseq_driver, > mmc_pwrseq_devclass, 0, 0, > + BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_FIRST); > +MODULE_VERSION(mmc_pwrseq, 1); > +SIMPLEBUS_PNP_INFO(compat_data); > diff --git a/sys/dev/mmc/mmc_pwrseq_if.m b/sys/dev/mmc/mmc_pwrseq_if.m > new file mode 100644 > index 000000000000..e94b44052c20 > --- /dev/null > +++ b/sys/dev/mmc/mmc_pwrseq_if.m > @@ -0,0 +1,38 @@ > +#- > +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD > +# > +# Copyright (c) 2021 Emmanuel Vadot > +# > +# 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. > +# > +# $FreeBSD$ > +# > + > +INTERFACE mmc_pwrseq; > + > +# > +# Power up/down the card > +# > +METHOD int set_power { > + device_t bus; > + bool power_on; > +}; > -- Mateusz Guzik From owner-dev-commits-src-all@freebsd.org Sun May 23 18:13:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D857864C977; Sun, 23 May 2021 18:13: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 4Fp7l55cnYz4t6F; Sun, 23 May 2021 18:13: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 A9B541C001; Sun, 23 May 2021 18:13: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 14NIDr35009999; Sun, 23 May 2021 18:13:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NIDrqp009998; Sun, 23 May 2021 18:13:53 GMT (envelope-from git) Date: Sun, 23 May 2021 18:13:53 GMT Message-Id: <202105231813.14NIDrqp009998@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 6f6cd1e8e8aa - main - ktrace: Remove vrele() at the end of ktr_writerequest() 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/main X-Git-Reftype: branch X-Git-Commit: 6f6cd1e8e8aa3a48b35598992f1b6c21003d35cd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 18:13:53 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6f6cd1e8e8aa3a48b35598992f1b6c21003d35cd commit 6f6cd1e8e8aa3a48b35598992f1b6c21003d35cd Author: Mark Johnston AuthorDate: 2021-05-23 17:20:05 +0000 Commit: Mark Johnston CommitDate: 2021-05-23 18:13:01 +0000 ktrace: Remove vrele() at the end of ktr_writerequest() As of commit fc369a353 we no longer ref the vnode when writing a record. Drop the corresponding vrele() call in the error case. Fixes: fc369a353 ("ktrace: fix a race between writes and close") Reported by: syzbot+9b96ea7a5ff8917d3fe4@syzkaller.appspotmail.com Reported by: syzbot+6120ebbb354cd52e5107@syzkaller.appspotmail.com Reviewed by: kib MFC after: 6 days Differential Revision: https://reviews.freebsd.org/D30404 --- sys/kern/kern_ktrace.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 3a223215a60d..9059a75f571c 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -1361,7 +1361,6 @@ ktr_writerequest(struct thread *td, struct ktr_request *req) PROC_UNLOCK(p); ktr_io_params_free(kiop1); ktr_io_params_free(kiop); - vrele(vp); } /* From owner-dev-commits-src-all@freebsd.org Sun May 23 18:32:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DC45964CD42; Sun, 23 May 2021 18:32: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 4Fp8835rTpz3KH2; Sun, 23 May 2021 18:32: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 B02761C32C; Sun, 23 May 2021 18:32: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 14NIW3f5036483; Sun, 23 May 2021 18:32:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NIW3ag036482; Sun, 23 May 2021 18:32:03 GMT (envelope-from git) Date: Sun, 23 May 2021 18:32:03 GMT Message-Id: <202105231832.14NIW3ag036482@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 8746bc918734 - main - run(4): add support for DLINK DWA-130 rev F1 wireless adaptor. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8746bc91873430d977b09bcc3fbd4d1b417a5a57 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 18:32:03 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=8746bc91873430d977b09bcc3fbd4d1b417a5a57 commit 8746bc91873430d977b09bcc3fbd4d1b417a5a57 Author: Dmitry Chagin AuthorDate: 2021-05-23 18:31:51 +0000 Commit: Dmitry Chagin CommitDate: 2021-05-23 18:31:51 +0000 run(4): add support for DLINK DWA-130 rev F1 wireless adaptor. PR: 256092 Submitted by: Francois Briere MFC After: 2 weeks --- share/man/man4/run.4 | 1 + sys/dev/usb/usbdevs | 1 + sys/dev/usb/wlan/if_run.c | 1 + 3 files changed, 3 insertions(+) diff --git a/share/man/man4/run.4 b/share/man/man4/run.4 index ad314ff67011..0cea7beada77 100644 --- a/share/man/man4/run.4 +++ b/share/man/man4/run.4 @@ -145,6 +145,7 @@ driver supports the following wireless adapters: .It Corega CG-WLUSB300AGN .It Corega CG-WLUSB300GNM .It D-Link DWA-130 rev B1 +.It D-Link DWA-130 rev F1 .It D-Link DWA-140 rev B1, B2, B3, \&D1 .It D-Link DWA-160 rev B2 .It D-Link DWA-162 diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index 91a243e26bac..5613719a2c8b 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -1736,6 +1736,7 @@ product DLINK DWA160B2 0x3c1a DWA-160 rev B2 product DLINK DWA127 0x3c1b DWA-127 Wireless Adapter product DLINK DWA162 0x3c1f DWA-162 Wireless Adapter product DLINK DWA140D1 0x3c20 DWA-140 rev D1 +product DLINK DWA130F1 0x3c25 DWA-130 rev F1 product DLINK DSB650C 0x4000 10Mbps Ethernet product DLINK DSB650TX1 0x4001 10/100 Ethernet product DLINK DSB650TX 0x4002 10/100 Ethernet diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c index c7f0ae40f666..52933a4812dc 100644 --- a/sys/dev/usb/wlan/if_run.c +++ b/sys/dev/usb/wlan/if_run.c @@ -215,6 +215,7 @@ static const STRUCT_USB_HOST_ID run_devs[] = { RUN_DEV(DLINK, DWA140B3), RUN_DEV(DLINK, DWA160B2), RUN_DEV(DLINK, DWA140D1), + RUN_DEV(DLINK, DWA130F1), RUN_DEV(DLINK, DWA162), RUN_DEV(DLINK2, DWA130), RUN_DEV(DLINK2, RT2870_1), From owner-dev-commits-src-all@freebsd.org Sun May 23 19:37:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5796C64DC70; Sun, 23 May 2021 19:37: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 4Fp9bN24Byz4d8l; Sun, 23 May 2021 19:37: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 2FE9A1CEBC; Sun, 23 May 2021 19:37:20 +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 14NJbKsV016484; Sun, 23 May 2021 19:37:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NJbKHL016483; Sun, 23 May 2021 19:37:20 GMT (envelope-from git) Date: Sun, 23 May 2021 19:37:20 GMT Message-Id: <202105231937.14NJbKHL016483@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: a269183875f6 - main - vfs: elide vnode locking when it is only needed for audit if possible 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/main X-Git-Reftype: branch X-Git-Commit: a269183875f6d5141c81277d41b552871e2171e5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 19:37:20 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=a269183875f6d5141c81277d41b552871e2171e5 commit a269183875f6d5141c81277d41b552871e2171e5 Author: Mateusz Guzik AuthorDate: 2021-05-23 19:28:26 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-23 19:37:16 +0000 vfs: elide vnode locking when it is only needed for audit if possible --- sys/kern/vfs_syscalls.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 32e4c8688762..55780b0474ee 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -2802,9 +2802,11 @@ sys_fchflags(struct thread *td, struct fchflags_args *uap) if (error != 0) return (error); #ifdef AUDIT - vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY); - AUDIT_ARG_VNODE1(fp->f_vnode); - VOP_UNLOCK(fp->f_vnode); + if (AUDITING_TD(td)) { + vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY); + AUDIT_ARG_VNODE1(fp->f_vnode); + VOP_UNLOCK(fp->f_vnode); + } #endif error = setfflags(td, fp->f_vnode, uap->flags); fdrop(fp, td); @@ -3303,9 +3305,11 @@ kern_futimes(struct thread *td, int fd, struct timeval *tptr, if (error != 0) return (error); #ifdef AUDIT - vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY); - AUDIT_ARG_VNODE1(fp->f_vnode); - VOP_UNLOCK(fp->f_vnode); + if (AUDITING_TD(td)) { + vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY); + AUDIT_ARG_VNODE1(fp->f_vnode); + VOP_UNLOCK(fp->f_vnode); + } #endif error = setutimes(td, fp->f_vnode, ts, 2, tptr == NULL); fdrop(fp, td); @@ -3337,9 +3341,11 @@ kern_futimens(struct thread *td, int fd, struct timespec *tptr, if (error != 0) return (error); #ifdef AUDIT - vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY); - AUDIT_ARG_VNODE1(fp->f_vnode); - VOP_UNLOCK(fp->f_vnode); + if (AUDITING_TD(td)) { + vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY); + AUDIT_ARG_VNODE1(fp->f_vnode); + VOP_UNLOCK(fp->f_vnode); + } #endif error = setutimes(td, fp->f_vnode, ts, 2, flags & UTIMENS_NULL); fdrop(fp, td); From owner-dev-commits-src-all@freebsd.org Sun May 23 20:49:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 33E7F64F51B; Sun, 23 May 2021 20:49: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 4FpCBS0w6Xz3lNn; Sun, 23 May 2021 20:49: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 0159B1DE05; Sun, 23 May 2021 20:49: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 14NKnJnv010050; Sun, 23 May 2021 20:49:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NKnJhb010049; Sun, 23 May 2021 20:49:19 GMT (envelope-from git) Date: Sun, 23 May 2021 20:49:19 GMT Message-Id: <202105232049.14NKnJhb010049@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: a660948b7b2d - main - tests/libalias: Reduce stress 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/main X-Git-Reftype: branch X-Git-Commit: a660948b7b2d875591aba3713620424c51330038 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 20:49:20 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=a660948b7b2d875591aba3713620424c51330038 commit a660948b7b2d875591aba3713620424c51330038 Author: Lutz Donnerhacke AuthorDate: 2021-05-23 20:41:26 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-23 20:48:28 +0000 tests/libalias: Reduce stress Due to the new, external performance test utility, the regular test suite can reduce the stress test to a fair amount of activity. MFC after: 1 week --- tests/sys/netinet/libalias/2_natout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sys/netinet/libalias/2_natout.c b/tests/sys/netinet/libalias/2_natout.c index 9eb9148f8377..513ff359b1d9 100644 --- a/tests/sys/netinet/libalias/2_natout.c +++ b/tests/sys/netinet/libalias/2_natout.c @@ -311,7 +311,7 @@ ATF_TC_BODY(7_stress, dummy) struct in_addr src, dst; uint16_t sport, dport, aport; } *batch; - size_t const batch_size = 12000; + size_t const batch_size = 1200; size_t const rounds = 25; size_t i, j; From owner-dev-commits-src-all@freebsd.org Sun May 23 22:44:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F22A16510CD; Sun, 23 May 2021 22:44:09 +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 4FpFkx3F9jz3lgN; Sun, 23 May 2021 22:44:09 +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 30DA91F88E; Sun, 23 May 2021 22:44:09 +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 14NMi9WY068163; Sun, 23 May 2021 22:44:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NMi9K8068162; Sun, 23 May 2021 22:44:09 GMT (envelope-from git) Date: Sun, 23 May 2021 22:44:09 GMT Message-Id: <202105232244.14NMi9K8068162@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 05ab03a31798 - main - ums(4): Do not stop USB xfers on FIFO close when evdev is still active 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/main X-Git-Reftype: branch X-Git-Commit: 05ab03a31798d4cc96c22a8f30b1d9a0d7a3dd35 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 22:44:10 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=05ab03a31798d4cc96c22a8f30b1d9a0d7a3dd35 commit 05ab03a31798d4cc96c22a8f30b1d9a0d7a3dd35 Author: Vladimir Kondratyev AuthorDate: 2021-05-23 22:38:53 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-05-23 22:38:53 +0000 ums(4): Do not stop USB xfers on FIFO close when evdev is still active This fixes lose of evdev events after moused has been killed. While here use bitwise operations for UMS_EVDEV_OPENED flag. Reviewed by: hselasky MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30342 --- sys/dev/usb/input/ums.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/dev/usb/input/ums.c b/sys/dev/usb/input/ums.c index 6b7c3d526ad0..b9533221ca8a 100644 --- a/sys/dev/usb/input/ums.c +++ b/sys/dev/usb/input/ums.c @@ -380,7 +380,7 @@ tr_setup: /* check if we can put more data into the FIFO */ if (usb_fifo_put_bytes_max(sc->sc_fifo.fp[USB_FIFO_RX]) == 0) { #ifdef EVDEV_SUPPORT - if (sc->sc_evflags == 0) + if ((sc->sc_evflags & UMS_EVDEV_OPENED) == 0) break; #else break; @@ -858,7 +858,10 @@ ums_fifo_stop_read(struct usb_fifo *fifo) { struct ums_softc *sc = usb_fifo_softc(fifo); - ums_stop_rx(sc); +#ifdef EVDEV_SUPPORT + if ((sc->sc_evflags & UMS_EVDEV_OPENED) == 0) +#endif + ums_stop_rx(sc); } #if ((MOUSE_SYS_PACKETSIZE != 8) || \ @@ -945,7 +948,7 @@ ums_ev_open(struct evdev_dev *evdev) mtx_assert(&sc->sc_mtx, MA_OWNED); - sc->sc_evflags = UMS_EVDEV_OPENED; + sc->sc_evflags |= UMS_EVDEV_OPENED; if (sc->sc_fflags == 0) { ums_reset(sc); @@ -962,7 +965,7 @@ ums_ev_close(struct evdev_dev *evdev) mtx_assert(&sc->sc_mtx, MA_OWNED); - sc->sc_evflags = 0; + sc->sc_evflags &= ~UMS_EVDEV_OPENED; if (sc->sc_fflags == 0) ums_stop_rx(sc); @@ -984,7 +987,7 @@ ums_fifo_open(struct usb_fifo *fifo, int fflags) /* check for first open */ #ifdef EVDEV_SUPPORT - if (sc->sc_fflags == 0 && sc->sc_evflags == 0) + if (sc->sc_fflags == 0 && (sc->sc_evflags & UMS_EVDEV_OPENED) == 0) ums_reset(sc); #else if (sc->sc_fflags == 0) From owner-dev-commits-src-all@freebsd.org Sun May 23 22:44:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A1EE265130E; Sun, 23 May 2021 22:44: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 4FpFky3C3xz3lvC; Sun, 23 May 2021 22:44: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 51AFF1F6AD; Sun, 23 May 2021 22:44: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 14NMiAhB068184; Sun, 23 May 2021 22:44:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NMiAni068183; Sun, 23 May 2021 22:44:10 GMT (envelope-from git) Date: Sun, 23 May 2021 22:44:10 GMT Message-Id: <202105232244.14NMiAni068183@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 47791339f0cf - main - ums(4): Start USB xfers on opening of evdev node unconditionally. 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/main X-Git-Reftype: branch X-Git-Commit: 47791339f0cfe3282a6f64b5607047f7bca968ad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 22:44:10 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=47791339f0cfe3282a6f64b5607047f7bca968ad commit 47791339f0cfe3282a6f64b5607047f7bca968ad Author: Vladimir Kondratyev AuthorDate: 2021-05-23 22:41:17 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-05-23 22:41:17 +0000 ums(4): Start USB xfers on opening of evdev node unconditionally. This fixes inability to start USB xfers in a case when FIFO has been already open()-ed but no read() or poll() calls has been issued yet. MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30343 --- sys/dev/usb/input/ums.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/usb/input/ums.c b/sys/dev/usb/input/ums.c index b9533221ca8a..cce1831287e4 100644 --- a/sys/dev/usb/input/ums.c +++ b/sys/dev/usb/input/ums.c @@ -952,8 +952,8 @@ ums_ev_open(struct evdev_dev *evdev) if (sc->sc_fflags == 0) { ums_reset(sc); - ums_start_rx(sc); } + ums_start_rx(sc); return (0); } From owner-dev-commits-src-all@freebsd.org Sun May 23 22:46:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the 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: From owner-dev-commits-src-all@freebsd.org Sun May 23 23:08:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 16FDA6515E8; Sun, 23 May 2021 23:08: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 4FpGHV736Hz4Qq7; Sun, 23 May 2021 23:08: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 D629D1F8C3; Sun, 23 May 2021 23:08: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 14NN8s3q096559; Sun, 23 May 2021 23:08:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14NN8s1A096558; Sun, 23 May 2021 23:08:54 GMT (envelope-from git) Date: Sun, 23 May 2021 23:08:54 GMT Message-Id: <202105232308.14NN8s1A096558@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 24b98f288d11 - main - cxgbe(4): Overhaul CLIP (Compressed Local IPv6) table management. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 24b98f288d11750f2cdfbfe360be1c92a9c2ee1d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 23:08:55 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=24b98f288d11750f2cdfbfe360be1c92a9c2ee1d commit 24b98f288d11750f2cdfbfe360be1c92a9c2ee1d Author: Navdeep Parhar AuthorDate: 2021-05-23 21:58:29 +0000 Commit: Navdeep Parhar CommitDate: 2021-05-23 23:07:29 +0000 cxgbe(4): Overhaul CLIP (Compressed Local IPv6) table management. - Process the list of local IPs once instead of once per adapter. Add addresses from all VNETs to the driver's list but leave hardware updates for later when the global VNET/IFADDR list locks have been released. - Add address to the hardware table synchronously when a CLIP entry is requested for an address that's not already in there. - Provide ioctls that allow userspace tools to manage addresses in the CLIP table. - Add a knob (hw.cxgbe.clip_db_auto) that controls whether local IPs are automatically added to the CLIP table or not. MFC after: 2 weeks Sponsored by: Chelsio Communications --- sys/dev/cxgbe/adapter.h | 16 +- sys/dev/cxgbe/crypto/t4_kern_tls.c | 4 +- sys/dev/cxgbe/t4_clip.c | 842 ++++++++++++++++++++++++++++--------- sys/dev/cxgbe/t4_clip.h | 15 +- sys/dev/cxgbe/t4_ioctl.h | 10 + sys/dev/cxgbe/t4_main.c | 37 ++ sys/dev/cxgbe/tom/t4_connect.c | 4 +- sys/dev/cxgbe/tom/t4_listen.c | 18 +- sys/dev/cxgbe/tom/t4_tom.c | 2 +- 9 files changed, 735 insertions(+), 213 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index b3b214ce3c96..27655ec2fe59 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -68,6 +69,15 @@ MALLOC_DECLARE(M_CXGBE); #define CXGBE_UNIMPLEMENTED(s) \ panic("%s (%s, line %d) not implemented yet.", s, __FILE__, __LINE__) +/* + * Same as LIST_HEAD from queue.h. This is to avoid conflict with LinuxKPI's + * LIST_HEAD when building iw_cxgbe. + */ +#define CXGBE_LIST_HEAD(name, type) \ +struct name { \ + struct type *lh_first; /* first element */ \ +} + #ifndef SYSCTL_ADD_UQUAD #define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD #define sysctl_handle_64 sysctl_handle_quad @@ -886,9 +896,11 @@ struct adapter { struct port_info *port[MAX_NPORTS]; uint8_t chan_map[MAX_NCHAN]; /* channel -> port */ - struct mtx clip_table_lock; - TAILQ_HEAD(, clip_entry) clip_table; + CXGBE_LIST_HEAD(, clip_entry) *clip_table; + TAILQ_HEAD(, clip_entry) clip_pending; /* these need hw update. */ + u_long clip_mask; int clip_gen; + struct timeout_task clip_task; void *tom_softc; /* (struct tom_data *) */ struct tom_tunables tt; diff --git a/sys/dev/cxgbe/crypto/t4_kern_tls.c b/sys/dev/cxgbe/crypto/t4_kern_tls.c index 957d0202fa3f..99d0d33cf128 100644 --- a/sys/dev/cxgbe/crypto/t4_kern_tls.c +++ b/sys/dev/cxgbe/crypto/t4_kern_tls.c @@ -379,7 +379,7 @@ send_ktls_act_open_req(struct adapter *sc, struct vi_info *vi, isipv6 = (inp->inp_vflag & INP_IPV6) != 0; if (isipv6) { - tlsp->ce = t4_hold_lip(sc, &inp->in6p_laddr, NULL); + tlsp->ce = t4_get_clip_entry(sc, &inp->in6p_laddr, true); if (tlsp->ce == NULL) return (ENOENT); } @@ -2333,7 +2333,7 @@ cxgbe_tls_tag_free(struct m_snd_tag *mst) if (tlsp->tid >= 0) release_tid(sc, tlsp->tid, tlsp->ctrlq); if (tlsp->ce) - t4_release_lip(sc, tlsp->ce); + t4_release_clip_entry(sc, tlsp->ce); if (tlsp->tx_key_addr >= 0) free_keyid(tlsp, tlsp->tx_key_addr); diff --git a/sys/dev/cxgbe/t4_clip.c b/sys/dev/cxgbe/t4_clip.c index ad26d212315e..18d78a9e830b 100644 --- a/sys/dev/cxgbe/t4_clip.c +++ b/sys/dev/cxgbe/t4_clip.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2012 Chelsio Communications, Inc. + * Copyright (c) 2012-2021 Chelsio Communications, Inc. * All rights reserved. * Written by: Navdeep Parhar * @@ -50,112 +50,345 @@ __FBSDID("$FreeBSD$"); #include "common/common.h" #include "t4_clip.h" +/* + * Code to deal with the Compressed Local IPv6 (CLIP) table in the ASIC. + * + * The driver maintains a global CLIP database (clip_db) of IPv6 addresses and a + * per-adapter CLIP table (sc->clip_table) with entries that point to an IPv6 in + * the clip_db. All access is protected by a single global lock (clip_db_lock). + * The correct lock order is clip lock before synchronized op. + * + * By default (hw.cxgbe.clip_db_auto=1) all local IPv6 addresses are added to + * the db. Addresses are also added on-demand when the driver allocates an + * entry for a filter, TOE tid, etc. krn_ref counts the number of times an + * address appears in the system. adp_ref counts the number of adapters that + * have that address in their CLIP table. If both are 0 then the entry is + * evicted from the db. Consumers of the CLIP table entry (filters, TOE tids) + * are tracked in ce->refcount. Driver ioctls let external consumers add/remove + * addresses from the CLIP table. + */ + #if defined(INET6) -static int add_lip(struct adapter *, struct in6_addr *); -static int delete_lip(struct adapter *, struct in6_addr *); -static struct clip_entry *search_lip(struct adapter *, struct in6_addr *); -static void update_clip(struct adapter *, void *); -static void t4_clip_task(void *, int); -static void update_clip_table(struct adapter *); +struct clip_db_entry { + LIST_ENTRY(clip_db_entry) link; /* clip_db hash linkage */ + struct in6_addr lip; + u_int krn_ref; /* # of times this IP6 appears in list of all IP6 */ + u_int adp_ref; /* # of adapters with this IP6 in their CLIP */ + u_int tmp_ref; /* Used only during refresh */ +}; + +struct clip_entry { + LIST_ENTRY(clip_entry) link; /* clip_table hash linkage */ + TAILQ_ENTRY(clip_entry) plink; /* clip_pending linkage */ + struct clip_db_entry *cde; + int16_t clip_idx; /* index in the hw table */ + bool pending; /* in clip_pending list */ + int refcount; +}; -static int in6_ifaddr_gen; static eventhandler_tag ifaddr_evhandler; -static struct timeout_task clip_task; +static struct mtx clip_db_lock; +static LIST_HEAD(, clip_db_entry) *clip_db; +static u_long clip_db_mask; +static int clip_db_gen; +static struct task clip_db_task; + +static int add_lip(struct adapter *, struct in6_addr *, int16_t *); +static int del_lip(struct adapter *, struct in6_addr *); +static void t4_clip_db_task(void *, int); +static void t4_clip_task(void *, int); +static void update_clip_db(void); +static int update_sw_clip_table(struct adapter *); +static int update_hw_clip_table(struct adapter *); +static void update_clip_table(struct adapter *, void *); +static int sysctl_clip_db(SYSCTL_HANDLER_ARGS); +static int sysctl_clip_db_auto(SYSCTL_HANDLER_ARGS); +static struct clip_db_entry *lookup_clip_db_entry(struct in6_addr *, bool); +static struct clip_entry *lookup_clip_entry(struct adapter *, struct in6_addr *, + bool); + +SYSCTL_PROC(_hw_cxgbe, OID_AUTO, clip_db, CTLTYPE_STRING | CTLFLAG_RD | + CTLFLAG_SKIP | CTLFLAG_MPSAFE, NULL, 0, sysctl_clip_db, "A", + "CLIP database"); + +int t4_clip_db_auto = 1; +SYSCTL_PROC(_hw_cxgbe, OID_AUTO, clip_db_auto, CTLTYPE_INT | CTLFLAG_RWTUN | + CTLFLAG_MPSAFE, NULL, 0, sysctl_clip_db_auto, "I", + "Add local IPs to CLIP db automatically (0 = no, 1 = yes)"); + +static inline uint32_t +clip_hashfn(struct in6_addr *addr) +{ + return (fnv_32_buf(addr, sizeof(*addr), FNV1_32_INIT) & clip_db_mask); +} + +static inline struct clip_db_entry * +alloc_clip_db_entry(struct in6_addr *in6) +{ + struct clip_db_entry *cde; + + cde = malloc(sizeof(*cde), M_CXGBE, M_NOWAIT | M_ZERO); + if (__predict_true(cde != NULL)) + memcpy(&cde->lip, in6, sizeof(cde->lip)); + + return (cde); +} + +static inline struct clip_entry * +alloc_clip_entry(struct clip_db_entry *cde) +{ + struct clip_entry *ce; + + mtx_assert(&clip_db_lock, MA_OWNED); + + ce = malloc(sizeof(*ce), M_CXGBE, M_NOWAIT | M_ZERO); + if (__predict_true(ce != NULL)) { + ce->cde = cde; + cde->adp_ref++; + ce->clip_idx = -1; + } + + return (ce); +} + +/* + * Look up the IP6 address in the CLIP db. If add is set then an entry for the + * IP6 will be added to the db. + */ +static struct clip_db_entry * +lookup_clip_db_entry(struct in6_addr *in6, bool add) +{ + struct clip_db_entry *cde; + const int bucket = clip_hashfn(in6); + + mtx_assert(&clip_db_lock, MA_OWNED); + + LIST_FOREACH(cde, &clip_db[bucket], link) { + if (IN6_ARE_ADDR_EQUAL(&cde->lip, in6)) + return (cde); + } + + /* Not found. Create a new entry if requested. */ + if (add) { + cde = alloc_clip_db_entry(in6); + if (cde != NULL) + LIST_INSERT_HEAD(&clip_db[bucket], cde, link); + } + + return (cde); +} + +/* + * Look up the IP6 address in the CLIP db. If add is set then an entry for the + * IP6 will be added to the db. + */ +static struct clip_entry * +lookup_clip_entry(struct adapter *sc, struct in6_addr *in6, bool add) +{ + struct clip_db_entry *cde; + struct clip_entry *ce; + const int bucket = clip_hashfn(in6); + + mtx_assert(&clip_db_lock, MA_OWNED); + + cde = lookup_clip_db_entry(in6, add); + if (cde == NULL) + return (NULL); + + LIST_FOREACH(ce, &sc->clip_table[bucket], link) { + if (ce->cde == cde) + return (ce); + } + + /* Not found. Create a new entry if requested. */ + if (add) { + ce = alloc_clip_entry(cde); + if (ce != NULL) { + LIST_INSERT_HEAD(&sc->clip_table[bucket], ce, link); + TAILQ_INSERT_TAIL(&sc->clip_pending, ce, plink); + ce->pending = true; + } + } + + return (ce); +} static int -add_lip(struct adapter *sc, struct in6_addr *lip) +add_lip(struct adapter *sc, struct in6_addr *lip, int16_t *idx) { - struct fw_clip_cmd c; + struct fw_clip_cmd c; + int rc; ASSERT_SYNCHRONIZED_OP(sc); - mtx_assert(&sc->clip_table_lock, MA_OWNED); - memset(&c, 0, sizeof(c)); + memset(&c, 0, sizeof(c)); c.op_to_write = htonl(V_FW_CMD_OP(FW_CLIP_CMD) | F_FW_CMD_REQUEST | F_FW_CMD_WRITE); - c.alloc_to_len16 = htonl(F_FW_CLIP_CMD_ALLOC | FW_LEN16(c)); - c.ip_hi = *(uint64_t *)&lip->s6_addr[0]; - c.ip_lo = *(uint64_t *)&lip->s6_addr[8]; + c.alloc_to_len16 = htonl(F_FW_CLIP_CMD_ALLOC | FW_LEN16(c)); + c.ip_hi = *(uint64_t *)&lip->s6_addr[0]; + c.ip_lo = *(uint64_t *)&lip->s6_addr[8]; - return (-t4_wr_mbox_ns(sc, sc->mbox, &c, sizeof(c), &c)); + rc = -t4_wr_mbox_ns(sc, sc->mbox, &c, sizeof(c), &c); + if (rc == 0 && idx != NULL) + *idx = G_FW_CLIP_CMD_INDEX(ntohl(c.alloc_to_len16)); + return (rc); } static int -delete_lip(struct adapter *sc, struct in6_addr *lip) +del_lip(struct adapter *sc, struct in6_addr *lip) { struct fw_clip_cmd c; ASSERT_SYNCHRONIZED_OP(sc); - mtx_assert(&sc->clip_table_lock, MA_OWNED); memset(&c, 0, sizeof(c)); c.op_to_write = htonl(V_FW_CMD_OP(FW_CLIP_CMD) | F_FW_CMD_REQUEST | F_FW_CMD_READ); - c.alloc_to_len16 = htonl(F_FW_CLIP_CMD_FREE | FW_LEN16(c)); - c.ip_hi = *(uint64_t *)&lip->s6_addr[0]; - c.ip_lo = *(uint64_t *)&lip->s6_addr[8]; + c.alloc_to_len16 = htonl(F_FW_CLIP_CMD_FREE | FW_LEN16(c)); + c.ip_hi = *(uint64_t *)&lip->s6_addr[0]; + c.ip_lo = *(uint64_t *)&lip->s6_addr[8]; return (-t4_wr_mbox_ns(sc, sc->mbox, &c, sizeof(c), &c)); } +#endif -static struct clip_entry * -search_lip(struct adapter *sc, struct in6_addr *lip) +struct clip_entry * +t4_get_clip_entry(struct adapter *sc, struct in6_addr *in6, bool add) { +#ifdef INET6 struct clip_entry *ce; + bool schedule = false; - mtx_assert(&sc->clip_table_lock, MA_OWNED); - - TAILQ_FOREACH(ce, &sc->clip_table, link) { - if (IN6_ARE_ADDR_EQUAL(&ce->lip, lip)) - return (ce); + mtx_lock(&clip_db_lock); + ce = lookup_clip_entry(sc, in6, add); + if (ce != NULL) { + MPASS(ce->cde->adp_ref > 0); + if (++ce->refcount == 1 && ce->pending && ce->clip_idx != -1) { + /* + * Valid entry that was waiting to be deleted. It is in + * use now so take it off the pending list. + */ + TAILQ_REMOVE(&sc->clip_pending, ce, plink); + ce->pending = false; + } + if (ce->clip_idx == -1 && update_hw_clip_table(sc) != 0) + schedule = true; } + mtx_unlock(&clip_db_lock); + if (schedule) + taskqueue_enqueue_timeout(taskqueue_thread, &sc->clip_task, 0); + return (ce); +#else return (NULL); -} #endif +} -struct clip_entry * -t4_hold_lip(struct adapter *sc, struct in6_addr *lip, struct clip_entry *ce) +void +t4_hold_clip_entry(struct adapter *sc, struct clip_entry *ce) { - #ifdef INET6 - mtx_lock(&sc->clip_table_lock); - if (ce == NULL) - ce = search_lip(sc, lip); - if (ce != NULL) - ce->refcount++; - mtx_unlock(&sc->clip_table_lock); + MPASS(ce != NULL); + MPASS(ce->cde->adp_ref > 0); - return (ce); -#else - return (NULL); + mtx_lock(&clip_db_lock); + MPASS(ce->refcount > 0); /* Caller should already have a reference */ + ce->refcount++; + mtx_unlock(&clip_db_lock); #endif } +#ifdef INET6 +static void +release_clip_entry_locked(struct adapter *sc, struct clip_entry *ce) +{ + struct clip_db_entry *cde; + + mtx_assert(&clip_db_lock, MA_OWNED); + MPASS(ce->refcount > 0); + cde = ce->cde; + MPASS(cde->adp_ref > 0); + if (--ce->refcount == 0 && cde->krn_ref == 0) { + if (ce->clip_idx == -1) { + /* Was never written to the hardware. */ + MPASS(ce->pending); + TAILQ_REMOVE(&sc->clip_pending, ce, plink); + LIST_REMOVE(ce, link); + free(ce, M_CXGBE); + if (--cde->adp_ref == 0) { + LIST_REMOVE(cde, link); + free(cde, M_CXGBE); + } + } else { + /* + * Valid entry is now unused, add to the pending list + * for deletion. Its refcount was 1 on entry so it + * can't already be pending. + */ + MPASS(!ce->pending); + TAILQ_INSERT_HEAD(&sc->clip_pending, ce, plink); + ce->pending = true; + } + } +} +#endif + void -t4_release_lip(struct adapter *sc, struct clip_entry *ce) +t4_release_clip_entry(struct adapter *sc, struct clip_entry *ce) { +#ifdef INET6 + MPASS(ce != NULL); + + mtx_lock(&clip_db_lock); + release_clip_entry_locked(sc, ce); + /* + * This isn't a manual release via the ioctl. No need to update the + * hw right now even if the release resulted in the entry being queued + * for deletion. + */ + mtx_unlock(&clip_db_lock); +#endif +} +int +t4_release_clip_addr(struct adapter *sc, struct in6_addr *in6) +{ + int rc = ENOTSUP; #ifdef INET6 - mtx_lock(&sc->clip_table_lock); - KASSERT(search_lip(sc, &ce->lip) == ce, - ("%s: CLIP entry %p p not in CLIP table.", __func__, ce)); - KASSERT(ce->refcount > 0, - ("%s: CLIP entry %p has refcount 0", __func__, ce)); - --ce->refcount; - mtx_unlock(&sc->clip_table_lock); + struct clip_entry *ce; + bool schedule = false; + + mtx_lock(&clip_db_lock); + ce = lookup_clip_entry(sc, in6, false); + if (ce == NULL) + rc = ENOENT; + else if (ce->refcount == 0) + rc = EIO; + else { + release_clip_entry_locked(sc, ce); + if (update_hw_clip_table(sc) != 0) + schedule = true; + rc = 0; + } + mtx_unlock(&clip_db_lock); + if (schedule) + taskqueue_enqueue_timeout(taskqueue_thread, &sc->clip_task, 0); #endif + return (rc); } #ifdef INET6 void t4_init_clip_table(struct adapter *sc) { - - mtx_init(&sc->clip_table_lock, "CLIP table lock", NULL, MTX_DEF); - TAILQ_INIT(&sc->clip_table); + TAILQ_INIT(&sc->clip_pending); + TIMEOUT_TASK_INIT(taskqueue_thread, &sc->clip_task, 0, t4_clip_task, sc); sc->clip_gen = -1; + sc->clip_table = hashinit(CLIP_HASH_SIZE, M_CXGBE, &sc->clip_mask); + /* Both the hashes must use the same bucket for the same key. */ + if (sc->clip_table != NULL) + MPASS(sc->clip_mask == clip_db_mask); /* * Don't bother forcing an update of the clip table when the * adapter is initialized. Before an interface can be used it @@ -164,194 +397,344 @@ t4_init_clip_table(struct adapter *sc) */ } +/* + * Returns true if any additions or deletions were made to the CLIP DB. + */ static void -update_clip(struct adapter *sc, void *arg __unused) +update_clip_db(void) { + VNET_ITERATOR_DECL(vnet_iter); + struct rm_priotracker in6_ifa_tracker; + struct in6_addr *in6, tin6; + struct in6_ifaddr *ia; + struct clip_db_entry *cde, *cde_tmp; + int i, addel; - if (begin_synchronized_op(sc, NULL, HOLD_LOCK, "t4clip")) - return; + VNET_LIST_RLOCK(); + IN6_IFADDR_RLOCK(&in6_ifa_tracker); + mtx_lock(&clip_db_lock); + VNET_FOREACH(vnet_iter) { + CURVNET_SET_QUIET(vnet_iter); + CK_STAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { + if (ia->ia_ifp->if_flags & IFF_LOOPBACK) + continue; + in6 = &ia->ia_addr.sin6_addr; + KASSERT(!IN6_IS_ADDR_MULTICAST(in6), + ("%s: mcast address in in6_ifaddr list", __func__)); + if (IN6_IS_ADDR_LOOPBACK(in6)) + continue; - if (mtx_initialized(&sc->clip_table_lock) && !hw_off_limits(sc)) - update_clip_table(sc); + if (IN6_IS_SCOPE_EMBED(in6)) { + tin6 = *in6; + in6 = &tin6; + in6_clearscope(in6); + } + cde = lookup_clip_db_entry(in6, true); + if (cde == NULL) + continue; + cde->tmp_ref++; + } + CURVNET_RESTORE(); + } + + addel = 0; + for (i = 0; i <= clip_db_mask; i++) { + LIST_FOREACH_SAFE(cde, &clip_db[i], link, cde_tmp) { + if (cde->krn_ref == 0 && cde->tmp_ref > 0) { + addel++; /* IP6 addr added. */ + } else if (cde->krn_ref > 0 && cde->tmp_ref == 0) { + if (cde->adp_ref == 0) { + LIST_REMOVE(cde, link); + free(cde, M_CXGBE); + continue; + } + addel++; /* IP6 addr deleted. */ + } + cde->krn_ref = cde->tmp_ref; + cde->tmp_ref = 0; + } + } + if (addel > 0) + clip_db_gen++; + mtx_unlock(&clip_db_lock); + IN6_IFADDR_RUNLOCK(&in6_ifa_tracker); + VNET_LIST_RUNLOCK(); - end_synchronized_op(sc, LOCK_HELD); } +/* + * Update the CLIP db and then update the CLIP tables on all the adapters. + */ static void -t4_clip_task(void *arg, int count) +t4_clip_db_task(void *arg, int count) { - - t4_iterate(update_clip, NULL); + update_clip_db(); + t4_iterate(update_clip_table, NULL); } -static void -update_clip_table(struct adapter *sc) +/* + * Refresh the sw CLIP table for this adapter from the global CLIP db. Entries + * that need to be added or deleted from the hardware CLIP table are placed on a + * pending list but the hardware is not touched. The pending list is something + * reasonable even if this fails so it's ok to apply that to the hardware. + */ +static int +update_sw_clip_table(struct adapter *sc) { - struct rm_priotracker in6_ifa_tracker; - struct in6_ifaddr *ia; - struct in6_addr *lip, tlip; - TAILQ_HEAD(, clip_entry) stale; + struct clip_db_entry *cde; struct clip_entry *ce, *ce_temp; - struct vi_info *vi; - int rc, gen, i, j; - uintptr_t last_vnet; - - ASSERT_SYNCHRONIZED_OP(sc); + int i; + bool found; - IN6_IFADDR_RLOCK(&in6_ifa_tracker); - mtx_lock(&sc->clip_table_lock); - - gen = atomic_load_acq_int(&in6_ifaddr_gen); - if (gen == sc->clip_gen) - goto done; - - TAILQ_INIT(&stale); - TAILQ_CONCAT(&stale, &sc->clip_table, link); + mtx_assert(&clip_db_lock, MA_OWNED); /* - * last_vnet optimizes the common cases where all if_vnet = NULL (no - * VIMAGE) or all if_vnet = vnet0. + * We are about to rebuild the pending list from scratch. Deletions are + * placed before additions because that's how we want to submit them to + * the hardware. */ - last_vnet = (uintptr_t)(-1); - for_each_port(sc, i) - for_each_vi(sc->port[i], j, vi) { - if (IS_DOOMED(vi)) - continue; - - if (last_vnet == (uintptr_t)vi->ifp->if_vnet) - continue; + TAILQ_INIT(&sc->clip_pending); - /* XXX: races with if_vmove */ - CURVNET_SET(vi->ifp->if_vnet); - CK_STAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { - lip = &ia->ia_addr.sin6_addr; - - KASSERT(!IN6_IS_ADDR_MULTICAST(lip), - ("%s: mcast address in in6_ifaddr list", __func__)); - - if (IN6_IS_ADDR_LOOPBACK(lip)) + /* + * Walk the sw CLIP table first. We want to reset every entry's pending + * status as we're rebuilding the pending list. + */ + for (i = 0; i <= clip_db_mask; i++) { + LIST_FOREACH_SAFE(ce, &sc->clip_table[i], link, ce_temp) { + cde = ce->cde; + MPASS(cde->adp_ref > 0); + if (ce->refcount != 0 || cde->krn_ref != 0) { + /* + * Entry should stay in the CLIP. + */ + + if (ce->clip_idx != -1) { + ce->pending = false; + } else { + /* Was never added, carry forward. */ + MPASS(ce->pending); + TAILQ_INSERT_TAIL(&sc->clip_pending, ce, + plink); + } continue; - if (IN6_IS_SCOPE_EMBED(lip)) { - /* Remove the embedded scope */ - tlip = *lip; - lip = &tlip; - in6_clearscope(lip); } - /* - * XXX: how to weed out the link local address for the - * loopback interface? It's fe80::1 usually (always?). - */ /* - * If it's in the main list then we already know it's - * not stale. + * Entry should be removed from the CLIP. */ - TAILQ_FOREACH(ce, &sc->clip_table, link) { - if (IN6_ARE_ADDR_EQUAL(&ce->lip, lip)) - goto next; - } - /* - * If it's in the stale list we should move it to the - * main list. - */ - TAILQ_FOREACH(ce, &stale, link) { - if (IN6_ARE_ADDR_EQUAL(&ce->lip, lip)) { - TAILQ_REMOVE(&stale, ce, link); - TAILQ_INSERT_TAIL(&sc->clip_table, ce, - link); - goto next; + if (ce->clip_idx != -1) { + ce->pending = true; + TAILQ_INSERT_HEAD(&sc->clip_pending, ce, plink); + } else { + /* Was never added, free right now. */ + MPASS(ce->pending); + LIST_REMOVE(ce, link); + free(ce, M_CXGBE); + if (--cde->adp_ref == 0) { + LIST_REMOVE(cde, link); + free(cde, M_CXGBE); } } + } + } + + for (i = 0; i <= clip_db_mask; i++) { + LIST_FOREACH(cde, &clip_db[i], link) { + if (cde->krn_ref == 0) + continue; - /* A new IP6 address; add it to the CLIP table */ - ce = malloc(sizeof(*ce), M_CXGBE, M_NOWAIT); - memcpy(&ce->lip, lip, sizeof(ce->lip)); - ce->refcount = 0; - rc = add_lip(sc, lip); - if (rc == 0) - TAILQ_INSERT_TAIL(&sc->clip_table, ce, link); - else { - char ip[INET6_ADDRSTRLEN]; - - inet_ntop(AF_INET6, &ce->lip, &ip[0], - sizeof(ip)); - if (sc->flags & KERN_TLS_ON || - sc->active_ulds != 0) { - log(LOG_ERR, - "%s: could not add %s (%d)\n", - __func__, ip, rc); + found = false; + LIST_FOREACH(ce, &sc->clip_table[i], link) { + if (ce->cde == cde) { + found = true; + break; } - free(ce, M_CXGBE); } -next: - continue; + if (found) + continue; + ce = alloc_clip_entry(cde); + if (ce == NULL) + return (ENOMEM); + LIST_INSERT_HEAD(&sc->clip_table[i], ce, link); + TAILQ_INSERT_TAIL(&sc->clip_pending, ce, plink); + ce->pending = true; } - CURVNET_RESTORE(); - last_vnet = (uintptr_t)vi->ifp->if_vnet; } - /* - * Remove stale addresses (those no longer in V_in6_ifaddrhead) that are - * no longer referenced by the driver. - */ - TAILQ_FOREACH_SAFE(ce, &stale, link, ce_temp) { - if (ce->refcount == 0) { - rc = delete_lip(sc, &ce->lip); - if (rc == 0) { - TAILQ_REMOVE(&stale, ce, link); + sc->clip_gen = clip_db_gen; + return (0); +} + +static int +update_hw_clip_table(struct adapter *sc) +{ + struct clip_db_entry *cde; + struct clip_entry *ce; + int rc; + char ip[INET6_ADDRSTRLEN]; + + mtx_assert(&clip_db_lock, MA_OWNED); + rc = begin_synchronized_op(sc, NULL, HOLD_LOCK, "t4clip"); + if (rc != 0) + return (rc); + if (hw_off_limits(sc)) + goto done; /* with rc = 0, we don't want to reschedule. */ + while (!TAILQ_EMPTY(&sc->clip_pending)) { + ce = TAILQ_FIRST(&sc->clip_pending); + MPASS(ce->pending); + cde = ce->cde; + MPASS(cde->adp_ref > 0); + + if (ce->clip_idx == -1) { + /* + * Entry was queued for addition to the HW CLIP. + */ + + if (ce->refcount == 0 && cde->krn_ref == 0) { + /* No need to add to HW CLIP. */ + TAILQ_REMOVE(&sc->clip_pending, ce, plink); + LIST_REMOVE(ce, link); free(ce, M_CXGBE); + if (--cde->adp_ref == 0) { + LIST_REMOVE(cde, link); + free(cde, M_CXGBE); + } } else { - char ip[INET6_ADDRSTRLEN]; + /* Add to the HW CLIP. */ + rc = add_lip(sc, &cde->lip, &ce->clip_idx); + if (rc == FW_ENOMEM) { + /* CLIP full, no point in retrying. */ + rc = 0; + goto done; + } + if (rc != 0) { + inet_ntop(AF_INET6, &cde->lip, &ip[0], + sizeof(ip)); + CH_ERR(sc, "add_lip(%s) failed: %d\n", + ip, rc); + goto done; + } + MPASS(ce->clip_idx != -1); + TAILQ_REMOVE(&sc->clip_pending, ce, plink); + ce->pending = false; + } + } else { + /* + * Entry was queued for deletion from the HW CLIP. + */ - inet_ntop(AF_INET6, &ce->lip, &ip[0], - sizeof(ip)); - log(LOG_ERR, "%s: could not delete %s (%d)\n", - __func__, ip, rc); + if (ce->refcount == 0 && cde->krn_ref == 0) { + /* + * Delete from the HW CLIP. Delete should never + * fail so we always log an error. But if the + * failure is that the entry wasn't found in the + * CLIP then we carry on as if it was deleted. + */ + rc = del_lip(sc, &cde->lip); + if (rc != 0) + CH_ERR(sc, "del_lip(%s) failed: %d\n", + ip, rc); + if (rc == FW_EPROTO) + rc = 0; + if (rc != 0) + goto done; + + TAILQ_REMOVE(&sc->clip_pending, ce, plink); + LIST_REMOVE(ce, link); + free(ce, M_CXGBE); + if (--cde->adp_ref == 0) { + LIST_REMOVE(cde, link); + free(cde, M_CXGBE); + } + } else { + /* No need to delete from HW CLIP. */ + TAILQ_REMOVE(&sc->clip_pending, ce, plink); + ce->pending = false; } } } - /* The ones that are still referenced need to stay in the CLIP table */ - TAILQ_CONCAT(&sc->clip_table, &stale, link); - - sc->clip_gen = gen; done: - mtx_unlock(&sc->clip_table_lock); - IN6_IFADDR_RUNLOCK(&in6_ifa_tracker); + end_synchronized_op(sc, LOCK_HELD); + return (rc); +} + +static void +update_clip_table(struct adapter *sc, void *arg __unused) +{ + bool reschedule; + + if (sc->clip_table == NULL) + return; + + reschedule = false; + mtx_lock(&clip_db_lock); + if (sc->clip_gen != clip_db_gen && update_sw_clip_table(sc) != 0) + reschedule = true; + if (!TAILQ_EMPTY(&sc->clip_pending) && update_hw_clip_table(sc) != 0) + reschedule = true; + mtx_unlock(&clip_db_lock); + if (reschedule) + taskqueue_enqueue_timeout(taskqueue_thread, &sc->clip_task, + -hz / 4); +} + +/* + * Update the CLIP table of the specified adapter. + */ +static void +t4_clip_task(void *sc, int count) +{ + update_clip_table(sc, NULL); } void t4_destroy_clip_table(struct adapter *sc) { struct clip_entry *ce, *ce_temp; - - if (mtx_initialized(&sc->clip_table_lock)) { - mtx_lock(&sc->clip_table_lock); - TAILQ_FOREACH_SAFE(ce, &sc->clip_table, link, ce_temp) { - KASSERT(ce->refcount == 0, - ("%s: CLIP entry %p still in use (%d)", __func__, - ce, ce->refcount)); - TAILQ_REMOVE(&sc->clip_table, ce, link); + int i; + + mtx_lock(&clip_db_lock); + if (sc->clip_table == NULL) + goto done; /* CLIP was never initialized. */ + for (i = 0; i <= sc->clip_mask; i++) { + LIST_FOREACH_SAFE(ce, &sc->clip_table[i], link, ce_temp) { + MPASS(ce->refcount == 0); + MPASS(ce->cde->adp_ref > 0); #if 0 - delete_lip(sc, &ce->lip); + del_lip(sc, &ce->lip); #endif + LIST_REMOVE(ce, link); + if (--ce->cde->adp_ref == 0 && ce->cde->krn_ref == 0) { + LIST_REMOVE(ce->cde, link); + free(ce->cde, M_CXGBE); + } free(ce, M_CXGBE); } - mtx_unlock(&sc->clip_table_lock); - mtx_destroy(&sc->clip_table_lock); } + hashdestroy(&sc->clip_table, M_CXGBE, sc->clip_mask); + sc->clip_table = NULL; +done: + mtx_unlock(&clip_db_lock); } static void t4_ifaddr_event(void *arg __unused, struct ifnet *ifp, struct ifaddr *ifa, int event) { + struct in6_addr *in6; + if (t4_clip_db_auto == 0) + return; /* Automatic updates not allowed. */ if (ifa->ifa_addr->sa_family != AF_INET6) return; + if (ifp->if_flags & IFF_LOOPBACK) + return; + in6 = &((struct in6_ifaddr *)ifa)->ia_addr.sin6_addr; + if (IN6_IS_ADDR_LOOPBACK(in6) || IN6_IS_ADDR_MULTICAST(in6)) + return; - atomic_add_rel_int(&in6_ifaddr_gen, 1); - taskqueue_enqueue_timeout(taskqueue_thread, &clip_task, -hz / 4); + taskqueue_enqueue(taskqueue_thread, &clip_db_task); } *** 336 LINES SKIPPED ***