From owner-svn-src-head@freebsd.org Sun Jul 7 06:06:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4D9615DCB6C; Sun, 7 Jul 2019 06:06:49 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 613FE6ECBD; Sun, 7 Jul 2019 06:06:49 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3AF2224D57; Sun, 7 Jul 2019 06:06:49 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6766nrU078856; Sun, 7 Jul 2019 06:06:49 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6766nYa078855; Sun, 7 Jul 2019 06:06:49 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201907070606.x6766nYa078855@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 7 Jul 2019 06:06:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349798 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 349798 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 613FE6ECBD X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.919,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 06:06:50 -0000 Author: alc Date: Sun Jul 7 06:06:48 2019 New Revision: 349798 URL: https://svnweb.freebsd.org/changeset/base/349798 Log: Three changes to pmap_enter(): 1. Use _pmap_alloc_l3() instead of pmap_alloc_l3() in order to handle the possibility that a superpage mapping for "va" was created while we slept. (This is derived from the amd64 version.) 2. Eliminate code for allocating kernel page table pages. Kernel page table pages are preallocated by pmap_growkernel(). 3. Eliminate duplicated unlock operations when KERN_RESOURCE_SHORTAGE is returned. MFC after: 2 weeks Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Sun Jul 7 05:30:07 2019 (r349797) +++ head/sys/arm64/arm64/pmap.c Sun Jul 7 06:06:48 2019 (r349798) @@ -3134,8 +3134,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v pt_entry_t new_l3, orig_l3; pt_entry_t *l2, *l3; pv_entry_t pv; - vm_paddr_t opa, pa, l1_pa, l2_pa, l3_pa; - vm_page_t mpte, om, l1_m, l2_m, l3_m; + vm_paddr_t opa, pa; + vm_page_t mpte, om; boolean_t nosleep; int lvl, rv; @@ -3159,7 +3159,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v CTR2(KTR_PMAP, "pmap_enter: %.16lx -> %.16lx", va, pa); lock = NULL; - mpte = NULL; PMAP_LOCK(pmap); if (psind == 1) { /* Assert the required virtual and physical alignment. */ @@ -3169,9 +3168,22 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v flags, m, &lock); goto out; } + mpte = NULL; + /* + * In the case that a page table page is not + * resident, we are creating it here. + */ +retry: pde = pmap_pde(pmap, va, &lvl); - if (pde != NULL && lvl == 1) { + if (pde != NULL && lvl == 2) { + l3 = pmap_l2_to_l3(pde, va); + if (va < VM_MAXUSER_ADDRESS && mpte == NULL) { + mpte = PHYS_TO_VM_PAGE(pmap_load(pde) & ~ATTR_MASK); + mpte->wire_count++; + } + goto havel3; + } else if (pde != NULL && lvl == 1) { l2 = pmap_l1_to_l2(pde, va); if ((pmap_load(l2) & ATTR_DESCR_MASK) == L2_BLOCK && (l3 = pmap_demote_l2_locked(pmap, l2, va, &lock)) != NULL) { @@ -3183,83 +3195,26 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v } goto havel3; } + /* We need to allocate an L3 table. */ } - if (va < VM_MAXUSER_ADDRESS) { nosleep = (flags & PMAP_ENTER_NOSLEEP) != 0; - mpte = pmap_alloc_l3(pmap, va, nosleep ? NULL : &lock); + + /* + * We use _pmap_alloc_l3() instead of pmap_alloc_l3() in order + * to handle the possibility that a superpage mapping for "va" + * was created while we slept. + */ + mpte = _pmap_alloc_l3(pmap, pmap_l2_pindex(va), + nosleep ? NULL : &lock); if (mpte == NULL && nosleep) { CTR0(KTR_PMAP, "pmap_enter: mpte == NULL"); - if (lock != NULL) - rw_wunlock(lock); - PMAP_UNLOCK(pmap); - return (KERN_RESOURCE_SHORTAGE); + rv = KERN_RESOURCE_SHORTAGE; + goto out; } - pde = pmap_pde(pmap, va, &lvl); - KASSERT(pde != NULL, - ("pmap_enter: Invalid page entry, va: 0x%lx", va)); - KASSERT(lvl == 2, - ("pmap_enter: Invalid level %d", lvl)); - } else { - /* - * If we get a level 2 pde it must point to a level 3 entry - * otherwise we will need to create the intermediate tables - */ - if (lvl < 2) { - switch (lvl) { - default: - case -1: - /* Get the l0 pde to update */ - pde = pmap_l0(pmap, va); - KASSERT(pde != NULL, ("...")); - - l1_m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | - VM_ALLOC_ZERO); - if (l1_m == NULL) - panic("pmap_enter: l1 pte_m == NULL"); - if ((l1_m->flags & PG_ZERO) == 0) - pmap_zero_page(l1_m); - - l1_pa = VM_PAGE_TO_PHYS(l1_m); - pmap_load_store(pde, l1_pa | L0_TABLE); - /* FALLTHROUGH */ - case 0: - /* Get the l1 pde to update */ - pde = pmap_l1_to_l2(pde, va); - KASSERT(pde != NULL, ("...")); - - l2_m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | - VM_ALLOC_ZERO); - if (l2_m == NULL) - panic("pmap_enter: l2 pte_m == NULL"); - if ((l2_m->flags & PG_ZERO) == 0) - pmap_zero_page(l2_m); - - l2_pa = VM_PAGE_TO_PHYS(l2_m); - pmap_load_store(pde, l2_pa | L1_TABLE); - /* FALLTHROUGH */ - case 1: - /* Get the l2 pde to update */ - pde = pmap_l1_to_l2(pde, va); - KASSERT(pde != NULL, ("...")); - - l3_m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | - VM_ALLOC_ZERO); - if (l3_m == NULL) - panic("pmap_enter: l3 pte_m == NULL"); - if ((l3_m->flags & PG_ZERO) == 0) - pmap_zero_page(l3_m); - - l3_pa = VM_PAGE_TO_PHYS(l3_m); - pmap_load_store(pde, l3_pa | L2_TABLE); - break; - } - } - } - l3 = pmap_l2_to_l3(pde, va); + goto retry; + } else + panic("pmap_enter: missing L3 table for kernel va %#lx", va); havel3: orig_l3 = pmap_load(l3); From owner-svn-src-head@freebsd.org Sun Jul 7 06:57:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FE2315DD6B2; Sun, 7 Jul 2019 06:57:05 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2D076705E1; Sun, 7 Jul 2019 06:57:05 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 109CF2559F; Sun, 7 Jul 2019 06:57:05 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x676v4oh005444; Sun, 7 Jul 2019 06:57:04 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x676v40s005443; Sun, 7 Jul 2019 06:57:04 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201907070657.x676v40s005443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Sun, 7 Jul 2019 06:57:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349799 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 349799 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2D076705E1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.917,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 06:57:05 -0000 Author: dougm Date: Sun Jul 7 06:57:04 2019 New Revision: 349799 URL: https://svnweb.freebsd.org/changeset/base/349799 Log: A style-related change, r349791, made unclear the meaning of a comment. Rewrite that comment to improve its clarity. Reported by: cem Reviewed by: alc, cem Approved by: kib, markj (mentors, implicit) Differential Revision: https://reviews.freebsd.org/D20871 Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Sun Jul 7 06:06:48 2019 (r349798) +++ head/sys/vm/swap_pager.c Sun Jul 7 06:57:04 2019 (r349799) @@ -523,8 +523,8 @@ swap_pager_swap_init(void) * but it isn't very efficient). * * The nsw_cluster_max is constrained by the bp->b_pages[] - * array MAXPHYS / PAGE_SIZE and our locally defined - * MAX_PAGEOUT_CLUSTER. Also be aware that swap ops are + * array, which has MAXPHYS / PAGE_SIZE entries, and our locally + * defined MAX_PAGEOUT_CLUSTER. Also be aware that swap ops are * constrained by the swap device interleave stripe size. * * Currently we hardwire nsw_wcount_async to 4. This limit is From owner-svn-src-head@freebsd.org Sun Jul 7 08:53:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7018D15DF748; Sun, 7 Jul 2019 08:53:53 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 121D7744D7; Sun, 7 Jul 2019 08:53:53 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DFAE2269DE; Sun, 7 Jul 2019 08:53:52 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x678rqi9066948; Sun, 7 Jul 2019 08:53:52 GMT (envelope-from fsu@FreeBSD.org) Received: (from fsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x678rqRa066947; Sun, 7 Jul 2019 08:53:52 GMT (envelope-from fsu@FreeBSD.org) Message-Id: <201907070853.x678rqRa066947@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fsu set sender to fsu@FreeBSD.org using -f From: Fedor Uporov Date: Sun, 7 Jul 2019 08:53:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349800 - head/sys/fs/ext2fs X-SVN-Group: head X-SVN-Commit-Author: fsu X-SVN-Commit-Paths: head/sys/fs/ext2fs X-SVN-Commit-Revision: 349800 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 121D7744D7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.935,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 08:53:53 -0000 Author: fsu Date: Sun Jul 7 08:53:52 2019 New Revision: 349800 URL: https://svnweb.freebsd.org/changeset/base/349800 Log: Remove unneeded mount point unlock call. Reported by: Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE Reported as: FS-11-EXT2-6: Denial Of Service in write-1 (ext2_balloc) MFC after: 2 weeks Modified: head/sys/fs/ext2fs/ext2_balloc.c Modified: head/sys/fs/ext2fs/ext2_balloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_balloc.c Sun Jul 7 06:57:04 2019 (r349799) +++ head/sys/fs/ext2fs/ext2_balloc.c Sun Jul 7 08:53:52 2019 (r349800) @@ -308,7 +308,6 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size */ if ((error = bwrite(nbp)) != 0) { ext2_blkfree(ip, nb, fs->e2fs_bsize); - EXT2_UNLOCK(ump); brelse(bp); return (error); } From owner-svn-src-head@freebsd.org Sun Jul 7 08:56:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47CAA15DF866; Sun, 7 Jul 2019 08:56:14 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1172C746B6; Sun, 7 Jul 2019 08:56:14 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0855269E6; Sun, 7 Jul 2019 08:56:13 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x678uD9Z067109; Sun, 7 Jul 2019 08:56:13 GMT (envelope-from fsu@FreeBSD.org) Received: (from fsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x678uDeR067108; Sun, 7 Jul 2019 08:56:13 GMT (envelope-from fsu@FreeBSD.org) Message-Id: <201907070856.x678uDeR067108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fsu set sender to fsu@FreeBSD.org using -f From: Fedor Uporov Date: Sun, 7 Jul 2019 08:56:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349801 - head/sys/fs/ext2fs X-SVN-Group: head X-SVN-Commit-Author: fsu X-SVN-Commit-Paths: head/sys/fs/ext2fs X-SVN-Commit-Revision: 349801 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1172C746B6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.937,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 08:56:14 -0000 Author: fsu Date: Sun Jul 7 08:56:13 2019 New Revision: 349801 URL: https://svnweb.freebsd.org/changeset/base/349801 Log: Remove ufs fragments logic. The ext2fs fragments are different from ufs fragments. In case of ext2fs the fragment should be equal or more then block size. The values more than block size are used only in case of bigalloc feature, which is does not supported for now. Reported by: Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE Reported as: FS-22-EXT2-9: Denial of service in ftruncate-0 (ext2_balloc) MFC after: 2 weeks Modified: head/sys/fs/ext2fs/ext2_balloc.c Modified: head/sys/fs/ext2fs/ext2_balloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_balloc.c Sun Jul 7 08:53:52 2019 (r349800) +++ head/sys/fs/ext2fs/ext2_balloc.c Sun Jul 7 08:56:13 2019 (r349801) @@ -62,7 +62,7 @@ ext2_ext_balloc(struct inode *ip, uint32_t lbn, int si struct buf *bp = NULL; struct vnode *vp = ITOV(ip); daddr_t newblk; - int osize, nsize, blks, error, allocated; + int blks, error, allocated; fs = ip->i_e2fs; blks = howmany(size, fs->e2fs_bsize); @@ -72,47 +72,22 @@ ext2_ext_balloc(struct inode *ip, uint32_t lbn, int si return (error); if (allocated) { - if (ip->i_size < (lbn + 1) * fs->e2fs_bsize) - nsize = fragroundup(fs, size); - else - nsize = fs->e2fs_bsize; - - bp = getblk(vp, lbn, nsize, 0, 0, 0); + bp = getblk(vp, lbn, fs->e2fs_bsize, 0, 0, 0); if(!bp) return (EIO); - - bp->b_blkno = fsbtodb(fs, newblk); - if (flags & BA_CLRBUF) - vfs_bio_clrbuf(bp); } else { - if (ip->i_size >= (lbn + 1) * fs->e2fs_bsize) { - - error = bread(vp, lbn, fs->e2fs_bsize, NOCRED, &bp); - if (error) { - brelse(bp); - return (error); - } - bp->b_blkno = fsbtodb(fs, newblk); - *bpp = bp; - return (0); - } - - /* - * Consider need to reallocate a fragment. - */ - osize = fragroundup(fs, blkoff(fs, ip->i_size)); - nsize = fragroundup(fs, size); - if (nsize <= osize) - error = bread(vp, lbn, osize, NOCRED, &bp); - else - error = bread(vp, lbn, fs->e2fs_bsize, NOCRED, &bp); + error = bread(vp, lbn, fs->e2fs_bsize, NOCRED, &bp); if (error) { brelse(bp); return (error); } - bp->b_blkno = fsbtodb(fs, newblk); } + + bp->b_blkno = fsbtodb(fs, newblk); + if (flags & BA_CLRBUF) + vfs_bio_clrbuf(bp); + *bpp = bp; return (error); @@ -134,7 +109,7 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size struct indir indirs[EXT2_NIADDR + 2]; e4fs_daddr_t nb, newb; e2fs_daddr_t *bap, pref; - int osize, nsize, num, i, error; + int num, i, error; *bpp = NULL; if (lbn < 0) @@ -164,53 +139,22 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size * no new block is to be allocated, and no need to expand * the file */ - if (nb != 0 && ip->i_size >= (lbn + 1) * fs->e2fs_bsize) { + if (nb != 0) { error = bread(vp, lbn, fs->e2fs_bsize, NOCRED, &bp); if (error) { brelse(bp); return (error); } bp->b_blkno = fsbtodb(fs, nb); - *bpp = bp; - return (0); - } - if (nb != 0) { - /* - * Consider need to reallocate a fragment. - */ - osize = fragroundup(fs, blkoff(fs, ip->i_size)); - nsize = fragroundup(fs, size); - if (nsize <= osize) { - error = bread(vp, lbn, osize, NOCRED, &bp); - if (error) { - brelse(bp); - return (error); - } - bp->b_blkno = fsbtodb(fs, nb); - } else { - /* - * Godmar thinks: this shouldn't happen w/o - * fragments - */ - printf("nsize %d(%d) > osize %d(%d) nb %d\n", - (int)nsize, (int)size, (int)osize, - (int)ip->i_size, (int)nb); - panic( - "ext2_balloc: Something is terribly wrong"); -/* - * please note there haven't been any changes from here on - - * FFS seems to work. - */ + if (ip->i_size >= (lbn + 1) * fs->e2fs_bsize) { + *bpp = bp; + return (0); } } else { - if (ip->i_size < (lbn + 1) * fs->e2fs_bsize) - nsize = fragroundup(fs, size); - else - nsize = fs->e2fs_bsize; EXT2_LOCK(ump); error = ext2_alloc(ip, lbn, ext2_blkpref(ip, lbn, (int)lbn, &ip->i_db[0], 0), - nsize, cred, &newb); + fs->e2fs_bsize, cred, &newb); if (error) return (error); /* @@ -219,7 +163,7 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size */ if (newb > UINT_MAX) return (EFBIG); - bp = getblk(vp, lbn, nsize, 0, 0, 0); + bp = getblk(vp, lbn, fs->e2fs_bsize, 0, 0, 0); bp->b_blkno = fsbtodb(fs, newb); if (flags & BA_CLRBUF) vfs_bio_clrbuf(bp); From owner-svn-src-head@freebsd.org Sun Jul 7 08:58:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA33515DF991; Sun, 7 Jul 2019 08:58:03 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E5E974885; Sun, 7 Jul 2019 08:58:03 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52ED6269E7; Sun, 7 Jul 2019 08:58:03 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x678w3rY067223; Sun, 7 Jul 2019 08:58:03 GMT (envelope-from fsu@FreeBSD.org) Received: (from fsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x678w3go067222; Sun, 7 Jul 2019 08:58:03 GMT (envelope-from fsu@FreeBSD.org) Message-Id: <201907070858.x678w3go067222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fsu set sender to fsu@FreeBSD.org using -f From: Fedor Uporov Date: Sun, 7 Jul 2019 08:58:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349802 - head/sys/fs/ext2fs X-SVN-Group: head X-SVN-Commit-Author: fsu X-SVN-Commit-Paths: head/sys/fs/ext2fs X-SVN-Commit-Revision: 349802 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7E5E974885 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.936,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 08:58:04 -0000 Author: fsu Date: Sun Jul 7 08:58:02 2019 New Revision: 349802 URL: https://svnweb.freebsd.org/changeset/base/349802 Log: Add additional check for 'blocks per group' and 'fragments per group' superblock fields. These fields will not be equal only in case if bigalloc filesystem feature is turned on. This feature is not supported for now. Reported by: Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE Reported as: FS-27-EXT2-12: Denial of Service in openat-0 (vm_fault_hold/ext2_clusteracct) MFC after: 2 weeks Modified: head/sys/fs/ext2fs/ext2_vfsops.c Modified: head/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vfsops.c Sun Jul 7 08:56:13 2019 (r349801) +++ head/sys/fs/ext2fs/ext2_vfsops.c Sun Jul 7 08:58:02 2019 (r349802) @@ -559,7 +559,12 @@ ext2_compute_sb_data(struct vnode *devvp, struct ext2f SDT_PROBE1(ext2fs, , vfsops, ext2_compute_sb_data_error, "zero blocks/fragments per group"); return (EINVAL); + } else if (fs->e2fs_bpg != fs->e2fs_fpg) { + SDT_PROBE1(ext2fs, , vfsops, ext2_compute_sb_data_error, + "blocks per group not equal fragments per group"); + return (EINVAL); } + if (fs->e2fs_bpg != fs->e2fs_bsize * 8) { SDT_PROBE1(ext2fs, , vfsops, ext2_compute_sb_data_error, "non-standard group size unsupported"); From owner-svn-src-head@freebsd.org Sun Jul 7 12:15:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FB7D15E3979; Sun, 7 Jul 2019 12:15:26 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C5A7384517; Sun, 7 Jul 2019 12:15:25 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 972B4C23; Sun, 7 Jul 2019 12:15:25 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67CFPUe072553; Sun, 7 Jul 2019 12:15:25 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67CFO5a072548; Sun, 7 Jul 2019 12:15:24 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201907071215.x67CFO5a072548@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Sun, 7 Jul 2019 12:15:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349803 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349803 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C5A7384517 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.950,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 12:15:26 -0000 Author: vmaffione Date: Sun Jul 7 12:15:24 2019 New Revision: 349803 URL: https://svnweb.freebsd.org/changeset/base/349803 Log: bhyve: abstraction for network backends Bhyve can currently emulate two virtual NICs, namely virtio-net and e1000, and connect to the host network through two backends, namely tap and netmap. However, there is no interface between virtual NIC functionalities and backend functionalities. As a result, the backend code is duplicated between the two virtual NIC implementations and also within the same virtual NIC. Also, e1000 cannot currently use netmap as a backend. This patch introduces a network backend API between virtio-net/e1000 and tap/netmap, to improve code reuse and add missing functionalities. Virtual NICs and backends can negotiate virtio-net features, such as checksum offload and TSO. If the backend supports the features, it will propagate this information to the guest, so that the latter can make use of them. Currently, only netmap VALE ports support the features, but support should be added to tap in the future. Reviewed by: jhb, bryanv MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20659 Added: head/usr.sbin/bhyve/net_backends.c (contents, props changed) head/usr.sbin/bhyve/net_backends.h (contents, props changed) Modified: head/usr.sbin/bhyve/Makefile head/usr.sbin/bhyve/pci_e82545.c head/usr.sbin/bhyve/pci_virtio_net.c Modified: head/usr.sbin/bhyve/Makefile ============================================================================== --- head/usr.sbin/bhyve/Makefile Sun Jul 7 08:58:02 2019 (r349802) +++ head/usr.sbin/bhyve/Makefile Sun Jul 7 12:15:24 2019 (r349803) @@ -34,6 +34,7 @@ SRCS= \ mem.c \ mevent.c \ mptbl.c \ + net_backends.c \ net_utils.c \ pci_ahci.c \ pci_e82545.c \ Added: head/usr.sbin/bhyve/net_backends.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bhyve/net_backends.c Sun Jul 7 12:15:24 2019 (r349803) @@ -0,0 +1,806 @@ +/*- + * Copyright (c) 2019 Vincenzo Maffione + * + * 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$ + */ + +/* + * This file implements multiple network backends (tap, netmap, ...), + * to be used by network frontends such as virtio-net and e1000. + * The API to access the backend (e.g. send/receive packets, negotiate + * features) is exported by net_backends.h. + */ + +#include /* u_short etc */ +#ifndef WITHOUT_CAPSICUM +#include +#endif +#include +#include +#include +#include + +#include +#include +#include +#define NETMAP_WITH_LIBS +#include + +#ifndef WITHOUT_CAPSICUM +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "iov.h" +#include "mevent.h" +#include "net_backends.h" + +#include + +/* + * Each network backend registers a set of function pointers that are + * used to implement the net backends API. + * This might need to be exposed if we implement backends in separate files. + */ +struct net_backend { + const char *prefix; /* prefix matching this backend */ + + /* + * Routines used to initialize and cleanup the resources needed + * by a backend. The cleanup function is used internally, + * and should not be called by the frontend. + */ + int (*init)(struct net_backend *be, const char *devname, + net_be_rxeof_t cb, void *param); + void (*cleanup)(struct net_backend *be); + + /* + * Called to serve a guest transmit request. The scatter-gather + * vector provided by the caller has 'iovcnt' elements and contains + * the packet to send. + */ + ssize_t (*send)(struct net_backend *be, struct iovec *iov, int iovcnt); + + /* + * Called to receive a packet from the backend. When the function + * returns a positive value 'len', the scatter-gather vector + * provided by the caller contains a packet with such length. + * The function returns 0 if the backend doesn't have a new packet to + * receive. + */ + ssize_t (*recv)(struct net_backend *be, struct iovec *iov, int iovcnt); + + /* + * Ask the backend for the virtio-net features it is able to + * support. Possible features are TSO, UFO and checksum offloading + * in both rx and tx direction and for both IPv4 and IPv6. + */ + uint64_t (*get_cap)(struct net_backend *be); + + /* + * Tell the backend to enable/disable the specified virtio-net + * features (capabilities). + */ + int (*set_cap)(struct net_backend *be, uint64_t features, + unsigned int vnet_hdr_len); + + struct pci_vtnet_softc *sc; + int fd; + + /* + * Length of the virtio-net header used by the backend and the + * frontend, respectively. A zero value means that the header + * is not used. + */ + unsigned int be_vnet_hdr_len; + unsigned int fe_vnet_hdr_len; + + /* Size of backend-specific private data. */ + size_t priv_size; + + /* Room for backend-specific data. */ + char opaque[0]; +}; + +SET_DECLARE(net_backend_set, struct net_backend); + +#define VNET_HDR_LEN sizeof(struct virtio_net_rxhdr) + +#define WPRINTF(params) printf params + +/* + * The tap backend + */ + +struct tap_priv { + struct mevent *mevp; +}; + +static void +tap_cleanup(struct net_backend *be) +{ + struct tap_priv *priv = (struct tap_priv *)be->opaque; + + if (priv->mevp) { + mevent_delete(priv->mevp); + } + if (be->fd != -1) { + close(be->fd); + be->fd = -1; + } +} + +static int +tap_init(struct net_backend *be, const char *devname, + net_be_rxeof_t cb, void *param) +{ + struct tap_priv *priv = (struct tap_priv *)be->opaque; + char tbuf[80]; + int fd; + int opt = 1; +#ifndef WITHOUT_CAPSICUM + cap_rights_t rights; +#endif + + if (cb == NULL) { + WPRINTF(("TAP backend requires non-NULL callback\n")); + return (-1); + } + + strcpy(tbuf, "/dev/"); + strlcat(tbuf, devname, sizeof(tbuf)); + + fd = open(tbuf, O_RDWR); + if (fd == -1) { + WPRINTF(("open of tap device %s failed\n", tbuf)); + goto error; + } + + /* + * Set non-blocking and register for read + * notifications with the event loop + */ + if (ioctl(fd, FIONBIO, &opt) < 0) { + WPRINTF(("tap device O_NONBLOCK failed\n")); + goto error; + } + +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_EVENT, CAP_READ, CAP_WRITE); + if (caph_rights_limit(fd, &rights) == -1) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif + + priv->mevp = mevent_add(fd, EVF_READ, cb, param); + if (priv->mevp == NULL) { + WPRINTF(("Could not register event\n")); + goto error; + } + + be->fd = fd; + + return (0); + +error: + tap_cleanup(be); + return (-1); +} + +/* + * Called to send a buffer chain out to the tap device + */ +static ssize_t +tap_send(struct net_backend *be, struct iovec *iov, int iovcnt) +{ + return (writev(be->fd, iov, iovcnt)); +} + +static ssize_t +tap_recv(struct net_backend *be, struct iovec *iov, int iovcnt) +{ + ssize_t ret; + + /* Should never be called without a valid tap fd */ + assert(be->fd != -1); + + ret = readv(be->fd, iov, iovcnt); + + if (ret < 0 && errno == EWOULDBLOCK) { + return (0); + } + + return (ret); +} + +static uint64_t +tap_get_cap(struct net_backend *be) +{ + + return (0); /* no capabilities for now */ +} + +static int +tap_set_cap(struct net_backend *be, uint64_t features, + unsigned vnet_hdr_len) +{ + + return ((features || vnet_hdr_len) ? -1 : 0); +} + +static struct net_backend tap_backend = { + .prefix = "tap", + .priv_size = sizeof(struct tap_priv), + .init = tap_init, + .cleanup = tap_cleanup, + .send = tap_send, + .recv = tap_recv, + .get_cap = tap_get_cap, + .set_cap = tap_set_cap, +}; + +/* A clone of the tap backend, with a different prefix. */ +static struct net_backend vmnet_backend = { + .prefix = "vmnet", + .priv_size = sizeof(struct tap_priv), + .init = tap_init, + .cleanup = tap_cleanup, + .send = tap_send, + .recv = tap_recv, + .get_cap = tap_get_cap, + .set_cap = tap_set_cap, +}; + +DATA_SET(net_backend_set, tap_backend); +DATA_SET(net_backend_set, vmnet_backend); + +/* + * The netmap backend + */ + +/* The virtio-net features supported by netmap. */ +#define NETMAP_FEATURES (VIRTIO_NET_F_CSUM | VIRTIO_NET_F_HOST_TSO4 | \ + VIRTIO_NET_F_HOST_TSO6 | VIRTIO_NET_F_HOST_UFO | \ + VIRTIO_NET_F_GUEST_CSUM | VIRTIO_NET_F_GUEST_TSO4 | \ + VIRTIO_NET_F_GUEST_TSO6 | VIRTIO_NET_F_GUEST_UFO) + +struct netmap_priv { + char ifname[IFNAMSIZ]; + struct nm_desc *nmd; + uint16_t memid; + struct netmap_ring *rx; + struct netmap_ring *tx; + struct mevent *mevp; + net_be_rxeof_t cb; + void *cb_param; +}; + +static void +nmreq_init(struct nmreq *req, char *ifname) +{ + + memset(req, 0, sizeof(*req)); + strlcpy(req->nr_name, ifname, sizeof(req->nr_name)); + req->nr_version = NETMAP_API; +} + +static int +netmap_set_vnet_hdr_len(struct net_backend *be, int vnet_hdr_len) +{ + int err; + struct nmreq req; + struct netmap_priv *priv = (struct netmap_priv *)be->opaque; + + nmreq_init(&req, priv->ifname); + req.nr_cmd = NETMAP_BDG_VNET_HDR; + req.nr_arg1 = vnet_hdr_len; + err = ioctl(be->fd, NIOCREGIF, &req); + if (err) { + WPRINTF(("Unable to set vnet header length %d\n", + vnet_hdr_len)); + return (err); + } + + be->be_vnet_hdr_len = vnet_hdr_len; + + return (0); +} + +static int +netmap_has_vnet_hdr_len(struct net_backend *be, unsigned vnet_hdr_len) +{ + int prev_hdr_len = be->be_vnet_hdr_len; + int ret; + + if (vnet_hdr_len == prev_hdr_len) { + return (1); + } + + ret = netmap_set_vnet_hdr_len(be, vnet_hdr_len); + if (ret) { + return (0); + } + + netmap_set_vnet_hdr_len(be, prev_hdr_len); + + return (1); +} + +static uint64_t +netmap_get_cap(struct net_backend *be) +{ + + return (netmap_has_vnet_hdr_len(be, VNET_HDR_LEN) ? + NETMAP_FEATURES : 0); +} + +static int +netmap_set_cap(struct net_backend *be, uint64_t features, + unsigned vnet_hdr_len) +{ + + return (netmap_set_vnet_hdr_len(be, vnet_hdr_len)); +} + +static int +netmap_init(struct net_backend *be, const char *devname, + net_be_rxeof_t cb, void *param) +{ + struct netmap_priv *priv = (struct netmap_priv *)be->opaque; + + strlcpy(priv->ifname, devname, sizeof(priv->ifname)); + priv->ifname[sizeof(priv->ifname) - 1] = '\0'; + + priv->nmd = nm_open(priv->ifname, NULL, NETMAP_NO_TX_POLL, NULL); + if (priv->nmd == NULL) { + WPRINTF(("Unable to nm_open(): interface '%s', errno (%s)\n", + devname, strerror(errno))); + free(priv); + return (-1); + } + + priv->memid = priv->nmd->req.nr_arg2; + priv->tx = NETMAP_TXRING(priv->nmd->nifp, 0); + priv->rx = NETMAP_RXRING(priv->nmd->nifp, 0); + priv->cb = cb; + priv->cb_param = param; + be->fd = priv->nmd->fd; + + priv->mevp = mevent_add(be->fd, EVF_READ, cb, param); + if (priv->mevp == NULL) { + WPRINTF(("Could not register event\n")); + return (-1); + } + + return (0); +} + +static void +netmap_cleanup(struct net_backend *be) +{ + struct netmap_priv *priv = (struct netmap_priv *)be->opaque; + + if (priv->mevp) { + mevent_delete(priv->mevp); + } + if (priv->nmd) { + nm_close(priv->nmd); + } + be->fd = -1; +} + +static ssize_t +netmap_send(struct net_backend *be, struct iovec *iov, + int iovcnt) +{ + struct netmap_priv *priv = (struct netmap_priv *)be->opaque; + struct netmap_ring *ring; + ssize_t totlen = 0; + int nm_buf_size; + int nm_buf_len; + uint32_t head; + void *nm_buf; + int j; + + ring = priv->tx; + head = ring->head; + if (head == ring->tail) { + WPRINTF(("No space, drop %zu bytes\n", count_iov(iov, iovcnt))); + goto txsync; + } + nm_buf = NETMAP_BUF(ring, ring->slot[head].buf_idx); + nm_buf_size = ring->nr_buf_size; + nm_buf_len = 0; + + for (j = 0; j < iovcnt; j++) { + int iov_frag_size = iov[j].iov_len; + void *iov_frag_buf = iov[j].iov_base; + + totlen += iov_frag_size; + + /* + * Split each iovec fragment over more netmap slots, if + * necessary. + */ + for (;;) { + int copylen; + + copylen = iov_frag_size < nm_buf_size ? iov_frag_size : nm_buf_size; + memcpy(nm_buf, iov_frag_buf, copylen); + + iov_frag_buf += copylen; + iov_frag_size -= copylen; + nm_buf += copylen; + nm_buf_size -= copylen; + nm_buf_len += copylen; + + if (iov_frag_size == 0) { + break; + } + + ring->slot[head].len = nm_buf_len; + ring->slot[head].flags = NS_MOREFRAG; + head = nm_ring_next(ring, head); + if (head == ring->tail) { + /* + * We ran out of netmap slots while + * splitting the iovec fragments. + */ + WPRINTF(("No space, drop %zu bytes\n", + count_iov(iov, iovcnt))); + goto txsync; + } + nm_buf = NETMAP_BUF(ring, ring->slot[head].buf_idx); + nm_buf_size = ring->nr_buf_size; + nm_buf_len = 0; + } + } + + /* Complete the last slot, which must not have NS_MOREFRAG set. */ + ring->slot[head].len = nm_buf_len; + ring->slot[head].flags = 0; + head = nm_ring_next(ring, head); + + /* Now update ring->head and ring->cur. */ + ring->head = ring->cur = head; +txsync: + ioctl(be->fd, NIOCTXSYNC, NULL); + + return (totlen); +} + +static ssize_t +netmap_recv(struct net_backend *be, struct iovec *iov, int iovcnt) +{ + struct netmap_priv *priv = (struct netmap_priv *)be->opaque; + struct netmap_slot *slot = NULL; + struct netmap_ring *ring; + void *iov_frag_buf; + int iov_frag_size; + ssize_t totlen = 0; + uint32_t head; + + assert(iovcnt); + + ring = priv->rx; + head = ring->head; + iov_frag_buf = iov->iov_base; + iov_frag_size = iov->iov_len; + + do { + int nm_buf_len; + void *nm_buf; + + if (head == ring->tail) { + return (0); + } + + slot = ring->slot + head; + nm_buf = NETMAP_BUF(ring, slot->buf_idx); + nm_buf_len = slot->len; + + for (;;) { + int copylen = nm_buf_len < iov_frag_size ? + nm_buf_len : iov_frag_size; + + memcpy(iov_frag_buf, nm_buf, copylen); + nm_buf += copylen; + nm_buf_len -= copylen; + iov_frag_buf += copylen; + iov_frag_size -= copylen; + totlen += copylen; + + if (nm_buf_len == 0) { + break; + } + + iov++; + iovcnt--; + if (iovcnt == 0) { + /* No space to receive. */ + WPRINTF(("Short iov, drop %zd bytes\n", + totlen)); + return (-ENOSPC); + } + iov_frag_buf = iov->iov_base; + iov_frag_size = iov->iov_len; + } + + head = nm_ring_next(ring, head); + + } while (slot->flags & NS_MOREFRAG); + + /* Release slots to netmap. */ + ring->head = ring->cur = head; + + return (totlen); +} + +static struct net_backend netmap_backend = { + .prefix = "netmap", + .priv_size = sizeof(struct netmap_priv), + .init = netmap_init, + .cleanup = netmap_cleanup, + .send = netmap_send, + .recv = netmap_recv, + .get_cap = netmap_get_cap, + .set_cap = netmap_set_cap, +}; + +/* A clone of the netmap backend, with a different prefix. */ +static struct net_backend vale_backend = { + .prefix = "vale", + .priv_size = sizeof(struct netmap_priv), + .init = netmap_init, + .cleanup = netmap_cleanup, + .send = netmap_send, + .recv = netmap_recv, + .get_cap = netmap_get_cap, + .set_cap = netmap_set_cap, +}; + +DATA_SET(net_backend_set, netmap_backend); +DATA_SET(net_backend_set, vale_backend); + +/* + * Initialize a backend and attach to the frontend. + * This is called during frontend initialization. + * @pbe is a pointer to the backend to be initialized + * @devname is the backend-name as supplied on the command line, + * e.g. -s 2:0,frontend-name,backend-name[,other-args] + * @cb is the receive callback supplied by the frontend, + * and it is invoked in the event loop when a receive + * event is generated in the hypervisor, + * @param is a pointer to the frontend, and normally used as + * the argument for the callback. + */ +int +netbe_init(struct net_backend **ret, const char *devname, net_be_rxeof_t cb, + void *param) +{ + struct net_backend **pbe, *nbe, *tbe = NULL; + int err; + + /* + * Find the network backend that matches the user-provided + * device name. net_backend_set is built using a linker set. + */ + SET_FOREACH(pbe, net_backend_set) { + if (strncmp(devname, (*pbe)->prefix, + strlen((*pbe)->prefix)) == 0) { + tbe = *pbe; + assert(tbe->init != NULL); + assert(tbe->cleanup != NULL); + assert(tbe->send != NULL); + assert(tbe->recv != NULL); + assert(tbe->get_cap != NULL); + assert(tbe->set_cap != NULL); + break; + } + } + + *ret = NULL; + if (tbe == NULL) + return (EINVAL); + nbe = calloc(1, sizeof(*nbe) + tbe->priv_size); + *nbe = *tbe; /* copy the template */ + nbe->fd = -1; + nbe->sc = param; + nbe->be_vnet_hdr_len = 0; + nbe->fe_vnet_hdr_len = 0; + + /* Initialize the backend. */ + err = nbe->init(nbe, devname, cb, param); + if (err) { + free(nbe); + return (err); + } + + *ret = nbe; + + return (0); +} + +void +netbe_cleanup(struct net_backend *be) +{ + + if (be != NULL) { + be->cleanup(be); + free(be); + } +} + +uint64_t +netbe_get_cap(struct net_backend *be) +{ + + assert(be != NULL); + return (be->get_cap(be)); +} + +int +netbe_set_cap(struct net_backend *be, uint64_t features, + unsigned vnet_hdr_len) +{ + int ret; + + assert(be != NULL); + + /* There are only three valid lengths, i.e., 0, 10 and 12. */ + if (vnet_hdr_len && vnet_hdr_len != VNET_HDR_LEN + && vnet_hdr_len != (VNET_HDR_LEN - sizeof(uint16_t))) + return (-1); + + be->fe_vnet_hdr_len = vnet_hdr_len; + + ret = be->set_cap(be, features, vnet_hdr_len); + assert(be->be_vnet_hdr_len == 0 || + be->be_vnet_hdr_len == be->fe_vnet_hdr_len); + + return (ret); +} + +static __inline struct iovec * +iov_trim(struct iovec *iov, int *iovcnt, unsigned int tlen) +{ + struct iovec *riov; + + /* XXX short-cut: assume first segment is >= tlen */ + assert(iov[0].iov_len >= tlen); + + iov[0].iov_len -= tlen; + if (iov[0].iov_len == 0) { + assert(*iovcnt > 1); + *iovcnt -= 1; + riov = &iov[1]; + } else { + iov[0].iov_base = (void *)((uintptr_t)iov[0].iov_base + tlen); + riov = &iov[0]; + } + + return (riov); +} + +ssize_t +netbe_send(struct net_backend *be, struct iovec *iov, int iovcnt) +{ + + assert(be != NULL); + if (be->be_vnet_hdr_len != be->fe_vnet_hdr_len) { + /* + * The frontend uses a virtio-net header, but the backend + * does not. We ignore it (as it must be all zeroes) and + * strip it. + */ + assert(be->be_vnet_hdr_len == 0); + iov = iov_trim(iov, &iovcnt, be->fe_vnet_hdr_len); + } + + return (be->send(be, iov, iovcnt)); +} + +/* + * Try to read a packet from the backend, without blocking. + * If no packets are available, return 0. In case of success, return + * the length of the packet just read. Return -1 in case of errors. + */ +ssize_t +netbe_recv(struct net_backend *be, struct iovec *iov, int iovcnt) +{ + /* Length of prepended virtio-net header. */ + unsigned int hlen = be->fe_vnet_hdr_len; + int ret; + + assert(be != NULL); + + if (hlen && hlen != be->be_vnet_hdr_len) { + /* + * The frontend uses a virtio-net header, but the backend + * does not. We need to prepend a zeroed header. + */ + struct virtio_net_rxhdr *vh; + + assert(be->be_vnet_hdr_len == 0); + + /* + * Get a pointer to the rx header, and use the + * data immediately following it for the packet buffer. + */ + vh = iov[0].iov_base; + iov = iov_trim(iov, &iovcnt, hlen); + + /* + * The only valid field in the rx packet header is the + * number of buffers if merged rx bufs were negotiated. + */ + memset(vh, 0, hlen); + if (hlen == VNET_HDR_LEN) { + vh->vrh_bufs = 1; + } + } + + ret = be->recv(be, iov, iovcnt); + if (ret > 0) { + ret += hlen; + } + + return (ret); +} + +/* + * Read a packet from the backend and discard it. + * Returns the size of the discarded packet or zero if no packet was available. + * A negative error code is returned in case of read error. + */ +ssize_t +netbe_rx_discard(struct net_backend *be) +{ + /* + * MP note: the dummybuf is only used to discard frames, + * so there is no need for it to be per-vtnet or locked. + * We only make it large enough for TSO-sized segment. + */ + static uint8_t dummybuf[65536 + 64]; + struct iovec iov; + + iov.iov_base = dummybuf; + iov.iov_len = sizeof(dummybuf); + + return netbe_recv(be, &iov, 1); +} + Added: head/usr.sbin/bhyve/net_backends.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bhyve/net_backends.h Sun Jul 7 12:15:24 2019 (r349803) @@ -0,0 +1,87 @@ +/*- + * Copyright (c) 2019 Vincenzo Maffione + * + * 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$ + */ + +#ifndef __NET_BACKENDS_H__ +#define __NET_BACKENDS_H__ + +#include + +/* Opaque type representing a network backend. */ +typedef struct net_backend net_backend_t; + +/* Interface between network frontends and the network backends. */ +typedef void (*net_be_rxeof_t)(int, enum ev_type, void *param); +int netbe_init(net_backend_t **be, const char *devname, net_be_rxeof_t cb, + void *param); +void netbe_cleanup(net_backend_t *be); +uint64_t netbe_get_cap(net_backend_t *be); +int netbe_set_cap(net_backend_t *be, uint64_t cap, + unsigned vnet_hdr_len); +ssize_t netbe_send(net_backend_t *be, struct iovec *iov, int iovcnt); +ssize_t netbe_recv(net_backend_t *be, struct iovec *iov, int iovcnt); +ssize_t netbe_rx_discard(net_backend_t *be); + + +/* + * Network device capabilities taken from the VirtIO standard. + * Despite the name, these capabilities can be used by different frontents + * (virtio-net, ptnet) and supported by different backends (netmap, tap, ...). + */ +#define VIRTIO_NET_F_CSUM (1 << 0) /* host handles partial cksum */ +#define VIRTIO_NET_F_GUEST_CSUM (1 << 1) /* guest handles partial cksum */ +#define VIRTIO_NET_F_MAC (1 << 5) /* host supplies MAC */ +#define VIRTIO_NET_F_GSO_DEPREC (1 << 6) /* deprecated: host handles GSO */ +#define VIRTIO_NET_F_GUEST_TSO4 (1 << 7) /* guest can rcv TSOv4 */ +#define VIRTIO_NET_F_GUEST_TSO6 (1 << 8) /* guest can rcv TSOv6 */ +#define VIRTIO_NET_F_GUEST_ECN (1 << 9) /* guest can rcv TSO with ECN */ +#define VIRTIO_NET_F_GUEST_UFO (1 << 10) /* guest can rcv UFO */ +#define VIRTIO_NET_F_HOST_TSO4 (1 << 11) /* host can rcv TSOv4 */ +#define VIRTIO_NET_F_HOST_TSO6 (1 << 12) /* host can rcv TSOv6 */ +#define VIRTIO_NET_F_HOST_ECN (1 << 13) /* host can rcv TSO with ECN */ +#define VIRTIO_NET_F_HOST_UFO (1 << 14) /* host can rcv UFO */ +#define VIRTIO_NET_F_MRG_RXBUF (1 << 15) /* host can merge RX buffers */ +#define VIRTIO_NET_F_STATUS (1 << 16) /* config status field available */ +#define VIRTIO_NET_F_CTRL_VQ (1 << 17) /* control channel available */ +#define VIRTIO_NET_F_CTRL_RX (1 << 18) /* control channel RX mode support */ +#define VIRTIO_NET_F_CTRL_VLAN (1 << 19) /* control channel VLAN filtering */ +#define VIRTIO_NET_F_GUEST_ANNOUNCE \ + (1 << 21) /* guest can send gratuitous pkts */ + +/* + * Fixed network header size + */ +struct virtio_net_rxhdr { + uint8_t vrh_flags; + uint8_t vrh_gso_type; + uint16_t vrh_hdr_len; + uint16_t vrh_gso_size; + uint16_t vrh_csum_start; + uint16_t vrh_csum_offset; + uint16_t vrh_bufs; +} __packed; + +#endif /* __NET_BACKENDS_H__ */ Modified: head/usr.sbin/bhyve/pci_e82545.c ============================================================================== --- head/usr.sbin/bhyve/pci_e82545.c Sun Jul 7 08:58:02 2019 (r349802) +++ head/usr.sbin/bhyve/pci_e82545.c Sun Jul 7 12:15:24 2019 (r349803) @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include "pci_emul.h" #include "mevent.h" #include "net_utils.h" +#include "net_backends.h" /* Hardware/register definitions XXX: move some to common code. */ #define E82545_VENDOR_ID_INTEL 0x8086 @@ -245,11 +246,10 @@ struct eth_uni { struct e82545_softc { struct pci_devinst *esc_pi; struct vmctx *esc_ctx; - struct mevent *esc_mevp; struct mevent *esc_mevpitr; pthread_mutex_t esc_mtx; struct ether_addr esc_mac; - int esc_tapfd; + net_backend_t *esc_be; /* General */ uint32_t esc_CTRL; /* x0000 device ctl */ @@ -355,7 +355,7 @@ struct e82545_softc { static void e82545_reset(struct e82545_softc *sc, int dev); static void e82545_rx_enable(struct e82545_softc *sc); static void e82545_rx_disable(struct e82545_softc *sc); -static void e82545_tap_callback(int fd, enum ev_type type, void *param); +static void e82545_rx_callback(int fd, enum ev_type type, void *param); static void e82545_tx_start(struct e82545_softc *sc); static void e82545_tx_enable(struct e82545_softc *sc); static void e82545_tx_disable(struct e82545_softc *sc); @@ -824,11 +824,9 @@ e82545_bufsz(uint32_t rctl) return (256); /* Forbidden value. */ } -static uint8_t dummybuf[2048]; - /* XXX one packet at a time until this is debugged */ static void -e82545_tap_callback(int fd, enum ev_type type, void *param) +e82545_rx_callback(int fd, enum ev_type type, void *param) { struct e82545_softc *sc = param; struct e1000_rx_desc *rxd; @@ -843,7 +841,7 @@ e82545_tap_callback(int fd, enum ev_type type, void *p if (!sc->esc_rx_enabled || sc->esc_rx_loopback) { DPRINTF("rx disabled (!%d || %d) -- packet(s) dropped\r\n", sc->esc_rx_enabled, sc->esc_rx_loopback); - while (read(sc->esc_tapfd, dummybuf, sizeof(dummybuf)) > 0) { + while (netbe_rx_discard(sc->esc_be) > 0) { } goto done1; } @@ -856,7 +854,7 @@ e82545_tap_callback(int fd, enum ev_type type, void *p if (left < maxpktdesc) { DPRINTF("rx overflow (%d < %d) -- packet(s) dropped\r\n", left, maxpktdesc); - while (read(sc->esc_tapfd, dummybuf, sizeof(dummybuf)) > 0) { + while (netbe_rx_discard(sc->esc_be) > 0) { } goto done1; } @@ -873,9 +871,9 @@ e82545_tap_callback(int fd, enum ev_type type, void *p rxd->buffer_addr, bufsz); vec[i].iov_len = bufsz; } - len = readv(sc->esc_tapfd, vec, maxpktdesc); + len = netbe_recv(sc->esc_be, vec, maxpktdesc); if (len <= 0) { - DPRINTF("tap: readv() returned %d\n", len); + DPRINTF("netbe_recv() returned %d\n", len); goto done; } @@ -1050,10 +1048,10 @@ static void e82545_transmit_backend(struct e82545_softc *sc, struct iovec *iov, int iovcnt) { - if (sc->esc_tapfd == -1) + if (sc->esc_be == NULL) return; - (void) writev(sc->esc_tapfd, iov, iovcnt); + (void) netbe_send(sc->esc_be, iov, iovcnt); } static void @@ -2209,56 +2207,6 @@ e82545_reset(struct e82545_softc *sc, int drvr) sc->esc_TXDCTL = 0; } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Jul 7 13:04:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDD4D15E481D; Sun, 7 Jul 2019 13:04:48 +0000 (UTC) (envelope-from mike@karels.net) Received: from mail.karels.net (mail.karels.net [216.160.39.52]) by mx1.freebsd.org (Postfix) with ESMTP id 64869860DE; Sun, 7 Jul 2019 13:04:42 +0000 (UTC) (envelope-from mike@karels.net) Received: from mail.karels.net (localhost [127.0.0.1]) by mail.karels.net (8.15.2/8.15.2) with ESMTP id x67D4fm6060233; Sun, 7 Jul 2019 08:04:41 -0500 (CDT) (envelope-from mike@karels.net) Message-Id: <201907071304.x67D4fm6060233@mail.karels.net> From: Mike Karels Date: Sun, 07 Jul 2019 08:04:41 -0500 Subject: btoc()/ctob() (was Re: svn commit: r349791 - head/sys/vm) X-Rspamd-Queue-Id: 64869860DE X-Spamd-Bar: +++++ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [5.97 / 15.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(1.00)[0.996,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[karels.net]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(1.00)[0.995,0]; IP_SCORE(-0.01)[asn: 209(-0.02), country: US(-0.06)]; MX_GOOD(-0.01)[mail.karels.net]; NEURAL_SPAM_LONG(1.00)[1.000,0]; MISSING_TO(2.00)[]; R_SPF_NA(0.00)[]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:209, ipnet:216.160.0.0/15, country:US]; RCVD_COUNT_TWO(0.00)[2] X-Mailman-Approved-At: Sun, 07 Jul 2019 16:14:00 +0000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 13:04:49 -0000 ------- Blind-Carbon-Copy To: arch@freebsd.org cc: brde@optusnet.com.au, alc@feeebsd.org From: Mike Karels Reply-to: mike@karels.net Subject: btoc()/ctob() (was Re: svn commit: r349791 - head/sys/vm) In-reply-to: Your message of Sun, 07 Jul 2019 03:48:54 +1000. <20190707023441.B2047@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <60189.1562504486.1@mail.karels.net> Content-Transfer-Encoding: quoted-printable Date: Sun, 07 Jul 2019 08:04:41 -0500 [I moved my reply/new question to arch@, and bcc'd src-committers@ et al, where the interaction started. Excuse the top post, but the previous message is included just for reference; it need not be included in any replies. Followups to arch@, please.] [Sorry if this topic has been covered before; just let me know. Neither my freebsd.org or Google searches located anything, although I didn't try all that hard.] I am astounded to hear that the btoc() macro still lives on, along with ctob() (bytes to clicks, and clicks to bytes). They don't seem to have suitable MI replacements (at least not in ). For those who don't know/remember: these macros were used to convert physical addresses to values for the segment base registers (PARs) on the PDP-11, where there was no actual "page size" analogous to newer hardware. (A click, the 'c' in btoc/ctob, was 64 bytes, the unit of scaling to keep physical addresses in the hardware registers fitting in 16 bits.) Since then, the macros hav= e been subverted to operate in pages, starting with the VAX in 32/V, rather than coming up with a new, more appropriate name. I am wondering whether it is finally time to deprecate PDP-11-based nomenclature. Clicks have not been a "thing" for many years; but pages are nearly universal (modulo superpages, etc). I see that many architectures have architecture-dependent xxx_btop() and xxx_ptob() macros, which are similar but annoyingly different in details like casts. Unlike btoc(), the xxx_btop() versions do not round. I wonde= r, though, whether it is time to hoist *_btop/*_ptob into a new architecture- independent replacement for btoc/ctob. btop() and ptob() come to mind, although I don't know what Linux (etc) does along these lines. I see just over 100 uses of btoc()/ctob() overall, but of course we would need to keep deprecated versions for a while. Thoughts on changing the KPI here? We'd have to agree on details like rounding and casting, but my first reaction would be no to both. Mike > Date: Sun, 7 Jul 2019 03:48:54 +1000 (EST) > From: Bruce Evans > X-X-Sender: bde@besplex.bde.org > To: Doug Moore > cc: src-committers@freebsd.org, svn-src-all@freebsd.org, > svn-src-head@freebsd.org > Subject: Re: svn commit: r349791 - head/sys/vm > In-Reply-To: <201907061555.x66FtGsg025314@repo.freebsd.org> > Message-ID: <20190707023441.B2047@besplex.bde.org> > References: <201907061555.x66FtGsg025314@repo.freebsd.org> > MIME-Version: 1.0 > Content-Type: TEXT/PLAIN; charset=3DUS-ASCII; format=3Dflowed > X-Optus-CM-Score: 0 > X-Optus-CM-Analysis: v=3D2.2 cv=3DP6RKvmIu c=3D1 sm=3D1 tr=3D0 cx=3Da_id= p_d > a=3DPalzARQSbocsUSjMRkwAPg=3D=3D:117 a=3DPalzARQSbocsUSjMRkwAPg=3D=3D:1= 7 > a=3DjpOVt7BSZ2e4Z31A5e1TngXxSK0=3D:19 a=3Dkj9zAlcOel0A:10 > a=3Dk1N1_3MYVckZGDfFxwYA:9 a=3DCjuIK1q_8ugA:10 > Precedence: bulk > X-Loop: FreeBSD.org > Sender: owner-src-committers@freebsd.org > List-Id: FreeBSD mail > X-Rspamd-Queue-Id: 158A46ECA9 > X-Spamd-Bar: ------ > Authentication-Results: mx1.freebsd.org > X-Spamd-Result: default: False [-6.98 / 15.00]; > NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; > NEURAL_HAM_SHORT(-0.98)[-0.982,0]; > REPLY(-4.00)[]; > NEURAL_HAM_LONG(-1.00)[-1.000,0] > X-UID: 364675 > Status: RO > X-Keywords: $NotJunk NonJunk = > Content-Length: 5846 > On Sat, 6 Jul 2019, Doug Moore wrote: > > Log: > > Fix style(9) violations involving division by PAGE_SIZE. > It is style violation to even use an explicit division by PAGE_SIZE > instead of the btoc() conversion macro (*). > > Modified: head/sys/vm/swap_pager.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > > --- head/sys/vm/swap_pager.c Sat Jul 6 15:34:23 2019 (r349790) > > +++ head/sys/vm/swap_pager.c Sat Jul 6 15:55:16 2019 (r349791) > > @@ -523,7 +523,7 @@ swap_pager_swap_init(void) > > * but it isn't very efficient). > > * > > * The nsw_cluster_max is constrained by the bp->b_pages[] > > - * array (MAXPHYS/PAGE_SIZE) and our locally defined > > + * array MAXPHYS / PAGE_SIZE and our locally defined > > * MAX_PAGEOUT_CLUSTER. Also be aware that swap ops are > > * constrained by the swap device interleave stripe size. > > * > The macro is less readable in comments. > > @@ -538,7 +538,7 @@ swap_pager_swap_init(void) > > * have one NFS swap device due to the command/ack latency over NFS. > > * So it all works out pretty well. > > */ > > - nsw_cluster_max =3D min((MAXPHYS/PAGE_SIZE), MAX_PAGEOUT_CLUSTER); > > + nsw_cluster_max =3D min(MAXPHYS / PAGE_SIZE, MAX_PAGEOUT_CLUSTER); > > > > nsw_wcount_async =3D 4; > > nsw_wcount_async_max =3D nsw_wcount_async; > > > > Modified: head/sys/vm/vnode_pager.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > > --- head/sys/vm/vnode_pager.c Sat Jul 6 15:34:23 2019 (r349790) > > +++ head/sys/vm/vnode_pager.c Sat Jul 6 15:55:16 2019 (r349791) > > @@ -544,8 +544,8 @@ vnode_pager_addr(struct vnode *vp, vm_ooffset_t ad= dres > > *rtaddress +=3D voffset / DEV_BSIZE; > > ... > Using explicit division by DEV_BSIZE instead of the btodb() conversion > macro is another style bug. > (*) The macros use shifts while the divisions use division. The hard-co= ded > versions could use shifts too, so there is another set of style bugs fro= m > only using shifts sometimes. Shifts are faster if the type of the divid= end > is signed. > Oops. The macro also rounds up. So hard-coding the division is not jus= t > a style bug. It is wrong unless the dividend is a multiple of the page > size. This shouldn't be assumed for values like MAXBSIZE. > There are many more style bugs involving btoc(): > - 'c' in it means 'click', which might mean a virtual page size while > PAGE_SIZE might mean the physical page size. Or vice versa. dyson > retired from BSD not long after I asked him to clean this up 20+ > years ago. > - btoc() is the only clearly MI macro for this. The better-named macros > amd64_ptob() and i386_ptob() are of course MD. amd64_ptob() is never > used in sys/amd64. i386_ptob() is used 8 times in sys/i386 (all in > pmap.c), and 1 of these uses is in a macro which is used 22 times. > These uses give another set of style bugs. They are just obfuscation= s > if clicks are the same as pages, and probably incomplete otherwise. > However, it is correct for MD code to use physical pages unless it is > implementing virtual pages. > These macros don't round up, so they are not equivalent to btoc() eve= n > if the click size is PAGE_SIZE. > - there is also the better-named macro atop(). This doesn't round up. > I think it is supposed to be MI. It is replicated > for all arches. 'a' in it means 'address', which is less general tha= n > 'b' for 'byte, so it is a worse name than btop(). > - the macro with the best name btop() doesn't exist. > In the opposite direction, there are ctob(), {amd64,i386}_ptob(), > ptoa(), and direct multiplications by PAGE_SIZE and direct shifts by > PAGE_SHIFT. {amd64,i386}_ptob() is not used even on i386. This directi= on > is trickier since the (npages << PAGE_SHIFT) overflows if npages has the > correct type (int). The caller should convert npages to something like > vm_offset_t before using the macro and the need for this is less obvious > than for a direct expression. This is of course undocumented except by > the source code which shows: > - ctob(), ptoa() and i386_ptob() need conversion in the caller, but > amd64_ptob() converts to unsigned long in the macro. Since the last > macro is unused, the caller should convert in all used cases. Covers= ion > is most important on 64-bit arches. On i386, overflow occurs at 2G > starting with int npages but u_int npages works up to 4G which is > enough for i386 addresses but not for amd64 addresses or i386-PAE > byte counts. > I once sprinkled conversions in the macros. btodb() still uses my old > code for this, where the code is sophisticated so as to avoid using > the long long abomination, but which became mostly nonsense when daddr_t > was expanded from 32 bits to 64. Since this macro shifts right, > conversion is not really necessary, and conversion to daddr_t gives > much the same pessimations as conversion to the abomination. dbtodb() > simply converts to daddr_t. I forget if I wrote that. btoc() converts > to vm_offset_t, but since it shifts right conversion is not really > necessary. > Conversions in macros are a wrong way to do this. jake taught me this > in connection with sparc64 i386-PAE work. Conversion in the caller > allows the caller to control the type of the result and to not pessimize > by expanding the type. I think jake intentionally left out conversions > in the sparc64 macros but didn't change the x86 macros much. Other arch= es > use a random mixture. E.g., ptoa() converts to unsigned long on amd64, > arm64, riscv and sparc64 (so jake didn't change this?), to unsigned > on arm, and doesn't convert on i386, mips or powerpc. Always converting > to vm_offset_t would be reasonable, but gives namespace problems. It > is stupid that the MI uses vm_offset_t for btoc() where > conversion is not really needed, while is more careful > about namespace problems so it avoids using even u_long for ptoa(). > Bruce ------- End of Blind-Carbon-Copy From owner-svn-src-head@freebsd.org Sun Jul 7 17:15:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AA8C15E8E40; Sun, 7 Jul 2019 17:15:46 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 11F288EF60; Sun, 7 Jul 2019 17:15:46 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D56994266; Sun, 7 Jul 2019 17:15:45 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67HFjHl027277; Sun, 7 Jul 2019 17:15:45 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67HFjCK027276; Sun, 7 Jul 2019 17:15:45 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907071715.x67HFjCK027276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 7 Jul 2019 17:15:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349807 - head/usr.sbin/periodic/etc/daily X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/usr.sbin/periodic/etc/daily X-SVN-Commit-Revision: 349807 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 11F288EF60 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.936,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 17:15:46 -0000 Author: ian Date: Sun Jul 7 17:15:45 2019 New Revision: 349807 URL: https://svnweb.freebsd.org/changeset/base/349807 Log: Eliminate spurious periodic.daily error message for rotating accounting log. In 2011, r218961 removed local code for rotating logs in favor of using the rotate_log command in etc/rc.d/accounting. If the accounting service is activated then subsequently de-activated in rc.conf but still remains active in periodic.conf, then you get an error message every day in the periodic jobs about being unable to rotate the logs. With this change to use "onerotate_log", the log rotation will happen the first time periodic daily runs after accounting was disabled but periodic accounting was left enabled. After that happens once, the /var/account/acct will no longer exist, which results in a different path through the periodic code and no more error messages will appear (unless daily_show_badconfig is set, in which case the admin will be told that periodic security processing is enabled but the accounting file is not present). This is only a partial fix for the problems reported in PR 202203. PR: 202203 Modified: head/usr.sbin/periodic/etc/daily/310.accounting Modified: head/usr.sbin/periodic/etc/daily/310.accounting ============================================================================== --- head/usr.sbin/periodic/etc/daily/310.accounting Sun Jul 7 14:20:14 2019 (r349806) +++ head/usr.sbin/periodic/etc/daily/310.accounting Sun Jul 7 17:15:45 2019 (r349807) @@ -47,7 +47,7 @@ case "$daily_accounting_enable" in n=$(($n - 1)) done - /etc/rc.d/accounting rotate_log || rc=3 + /etc/rc.d/accounting onerotate_log || rc=3 rm -f acct.merge && cp acct.0 acct.merge || rc=3 sa -s $daily_accounting_flags /var/account/acct.merge || rc=3 From owner-svn-src-head@freebsd.org Mon Jul 8 13:01:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2C6E15DE456; Mon, 8 Jul 2019 13:01:55 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D3956D87A; Mon, 8 Jul 2019 13:01:55 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2857718BB8; Mon, 8 Jul 2019 13:01:55 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68D1s6u045006; Mon, 8 Jul 2019 13:01:54 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68D1sXT045005; Mon, 8 Jul 2019 13:01:54 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201907081301.x68D1sXT045005@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Mon, 8 Jul 2019 13:01:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349833 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 349833 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4D3956D87A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 13:01:55 -0000 Author: luporl Date: Mon Jul 8 13:01:54 2019 New Revision: 349833 URL: https://svnweb.freebsd.org/changeset/base/349833 Log: [PPC] Add missing SLB allocation KASSERT Although PPC SLB code doesn't handle allocation failures, which are rare, in most places it asserts that the pointer returned by uma_zalloc() is not NULL, making it easier to identify the failure and avoiding an invalid pointer dereference. This change simply adds a missing KASSERT in SLB code. Modified: head/sys/powerpc/aim/slb.c Modified: head/sys/powerpc/aim/slb.c ============================================================================== --- head/sys/powerpc/aim/slb.c Mon Jul 8 10:21:38 2019 (r349832) +++ head/sys/powerpc/aim/slb.c Mon Jul 8 13:01:54 2019 (r349833) @@ -416,6 +416,7 @@ slb_alloc_tree(void) struct slbtnode *root; root = uma_zalloc(slbt_zone, M_NOWAIT | M_ZERO); + KASSERT(root != NULL, ("unhandled NULL case")); root->ua_level = UAD_ROOT_LEVEL; return (root); From owner-svn-src-head@freebsd.org Mon Jul 8 13:46:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68E7A15DF184; Mon, 8 Jul 2019 13:46:27 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 002546F3CB; Mon, 8 Jul 2019 13:46:26 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3947193B8; Mon, 8 Jul 2019 13:46:26 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68DkQuS068564; Mon, 8 Jul 2019 13:46:26 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68DkQFF068563; Mon, 8 Jul 2019 13:46:26 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201907081346.x68DkQFF068563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Mon, 8 Jul 2019 13:46:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349834 - head/sys/dev/vt X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/sys/dev/vt X-SVN-Commit-Revision: 349834 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 002546F3CB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 13:46:27 -0000 Author: vangyzen Date: Mon Jul 8 13:46:26 2019 New Revision: 349834 URL: https://svnweb.freebsd.org/changeset/base/349834 Log: Ignore kern.vt.splash_cpu without graphics When the system has no graphical console, such as bhyve in common configurations, ignore kern.vt.splash_cpu, instead of panicking on INVARIANTS kernels. Reviewed by: cem dumbbell MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D20877 Modified: head/sys/dev/vt/vt_cpulogos.c Modified: head/sys/dev/vt/vt_cpulogos.c ============================================================================== --- head/sys/dev/vt/vt_cpulogos.c Mon Jul 8 13:01:54 2019 (r349833) +++ head/sys/dev/vt/vt_cpulogos.c Mon Jul 8 13:46:26 2019 (r349834) @@ -229,9 +229,8 @@ vt_init_logos(void *dummy) return; VT_LOCK(vd); - KASSERT((vd->vd_flags & VDF_INITIALIZED) != 0, - ("vd %p not initialized", vd)); - + if ((vd->vd_flags & VDF_INITIALIZED) == 0) + goto out; if ((vd->vd_flags & (VDF_DEAD | VDF_TEXTMODE)) != 0) goto out; if (vd->vd_height <= vt_logo_sprite_height) From owner-svn-src-head@freebsd.org Mon Jul 8 18:29:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA55015E5F24; Mon, 8 Jul 2019 18:29:38 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FF2084360; Mon, 8 Jul 2019 18:29:38 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3EB741C2F6; Mon, 8 Jul 2019 18:29:38 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68ITcOp041918; Mon, 8 Jul 2019 18:29:38 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68ITc5N041917; Mon, 8 Jul 2019 18:29:38 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907081829.x68ITc5N041917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 8 Jul 2019 18:29:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349839 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 349839 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4FF2084360 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 18:29:38 -0000 Author: ian Date: Mon Jul 8 18:29:37 2019 New Revision: 349839 URL: https://svnweb.freebsd.org/changeset/base/349839 Log: Call device_unbusy() on the error exit path, because if iicbus_request_bus() returns an error, iicbus_release_bus() is not going to be called. Modified: head/sys/dev/iicbus/iiconf.c Modified: head/sys/dev/iicbus/iiconf.c ============================================================================== --- head/sys/dev/iicbus/iiconf.c Mon Jul 8 17:11:51 2019 (r349838) +++ head/sys/dev/iicbus/iiconf.c Mon Jul 8 18:29:37 2019 (r349839) @@ -150,6 +150,7 @@ iicbus_request_bus(device_t bus, device_t dev, int how sc->owner = NULL; sc->owncount = 0; wakeup_one(sc); + device_unbusy(dev); } } } From owner-svn-src-head@freebsd.org Mon Jul 8 18:56:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D27115E6A53; Mon, 8 Jul 2019 18:56:32 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B459985D5E; Mon, 8 Jul 2019 18:56:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 89C3D1C807; Mon, 8 Jul 2019 18:56:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68IuVxd058728; Mon, 8 Jul 2019 18:56:31 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68IuUP2058723; Mon, 8 Jul 2019 18:56:30 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907081856.x68IuUP2058723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 8 Jul 2019 18:56:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349840 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 349840 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B459985D5E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 18:56:32 -0000 Author: markj Date: Mon Jul 8 18:56:30 2019 New Revision: 349840 URL: https://svnweb.freebsd.org/changeset/base/349840 Log: Add a per-CPU page cache per VM free pool. Some workloads benefit from having a per-CPU cache for VM_FREEPOOL_DIRECT pages. Reviewed by: dougm, kib Discussed with: alc, jeff MFC after: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20858 Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_pagequeue.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Jul 8 18:29:37 2019 (r349839) +++ head/sys/vm/vm_page.c Mon Jul 8 18:56:30 2019 (r349840) @@ -192,21 +192,28 @@ static void vm_page_init_cache_zones(void *dummy __unused) { struct vm_domain *vmd; - int i; + struct vm_pgcache *pgcache; + int domain, pool; - for (i = 0; i < vm_ndomains; i++) { - vmd = VM_DOMAIN(i); + for (domain = 0; domain < vm_ndomains; domain++) { + vmd = VM_DOMAIN(domain); + /* - * Don't allow the page cache to take up more than .25% of + * Don't allow the page caches to take up more than .25% of * memory. */ - if (vmd->vmd_page_count / 400 < 256 * mp_ncpus) + if (vmd->vmd_page_count / 400 < 256 * mp_ncpus * VM_NFREEPOOL) continue; - vmd->vmd_pgcache = uma_zcache_create("vm pgcache", - sizeof(struct vm_page), NULL, NULL, NULL, NULL, - vm_page_import, vm_page_release, vmd, - UMA_ZONE_MAXBUCKET | UMA_ZONE_VM); - (void )uma_zone_set_maxcache(vmd->vmd_pgcache, 0); + for (pool = 0; pool < VM_NFREEPOOL; pool++) { + pgcache = &vmd->vmd_pgcache[pool]; + pgcache->domain = domain; + pgcache->pool = pool; + pgcache->zone = uma_zcache_create("vm pgcache", + sizeof(struct vm_page), NULL, NULL, NULL, NULL, + vm_page_import, vm_page_release, pgcache, + UMA_ZONE_MAXBUCKET | UMA_ZONE_VM); + (void)uma_zone_set_maxcache(pgcache->zone, 0); + } } } SYSINIT(vm_page2, SI_SUB_VM_CONF, SI_ORDER_ANY, vm_page_init_cache_zones, NULL); @@ -1797,7 +1804,7 @@ vm_page_alloc_domain_after(vm_object_t object, vm_pind { struct vm_domain *vmd; vm_page_t m; - int flags; + int flags, pool; KASSERT((object != NULL) == ((req & VM_ALLOC_NOOBJ) == 0) && (object != NULL || (req & VM_ALLOC_SBUSY) == 0) && @@ -1814,6 +1821,7 @@ vm_page_alloc_domain_after(vm_object_t object, vm_pind flags = 0; m = NULL; + pool = object != NULL ? VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT; again: #if VM_NRESERVLEVEL > 0 /* @@ -1828,8 +1836,8 @@ again: } #endif vmd = VM_DOMAIN(domain); - if (object != NULL && vmd->vmd_pgcache != NULL) { - m = uma_zalloc(vmd->vmd_pgcache, M_NOWAIT); + if (vmd->vmd_pgcache[pool].zone != NULL) { + m = uma_zalloc(vmd->vmd_pgcache[pool].zone, M_NOWAIT); if (m != NULL) { flags |= PG_PCPU_CACHE; goto found; @@ -1840,8 +1848,7 @@ again: * If not, allocate it from the free page queues. */ vm_domain_free_lock(vmd); - m = vm_phys_alloc_pages(domain, object != NULL ? - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); + m = vm_phys_alloc_pages(domain, pool, 0); vm_domain_free_unlock(vmd); if (m == NULL) { vm_domain_freecnt_inc(vmd, 1); @@ -2231,15 +2238,17 @@ static int vm_page_import(void *arg, void **store, int cnt, int domain, int flags) { struct vm_domain *vmd; + struct vm_pgcache *pgcache; int i; - vmd = arg; + pgcache = arg; + vmd = VM_DOMAIN(pgcache->domain); /* Only import if we can bring in a full bucket. */ if (cnt == 1 || !vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt)) return (0); domain = vmd->vmd_domain; vm_domain_free_lock(vmd); - i = vm_phys_alloc_npages(domain, VM_FREEPOOL_DEFAULT, cnt, + i = vm_phys_alloc_npages(domain, pgcache->pool, cnt, (vm_page_t *)store); vm_domain_free_unlock(vmd); if (cnt != i) @@ -2252,10 +2261,12 @@ static void vm_page_release(void *arg, void **store, int cnt) { struct vm_domain *vmd; + struct vm_pgcache *pgcache; vm_page_t m; int i; - vmd = arg; + pgcache = arg; + vmd = VM_DOMAIN(pgcache->domain); vm_domain_free_lock(vmd); for (i = 0; i < cnt; i++) { m = (vm_page_t)store[i]; @@ -3500,13 +3511,15 @@ void vm_page_free_toq(vm_page_t m) { struct vm_domain *vmd; + uma_zone_t zone; if (!vm_page_free_prep(m)) return; vmd = vm_pagequeue_domain(m); - if ((m->flags & PG_PCPU_CACHE) != 0 && vmd->vmd_pgcache != NULL) { - uma_zfree(vmd->vmd_pgcache, m); + zone = vmd->vmd_pgcache[m->pool].zone; + if ((m->flags & PG_PCPU_CACHE) != 0 && zone != NULL) { + uma_zfree(zone, m); return; } vm_domain_free_lock(vmd); Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Mon Jul 8 18:29:37 2019 (r349839) +++ head/sys/vm/vm_page.h Mon Jul 8 18:56:30 2019 (r349840) @@ -378,6 +378,10 @@ extern struct mtx_padalign pa_lock[]; /* * Page flags. If changed at any other time than page allocation or * freeing, the modification must be protected by the vm_page lock. + * + * The PG_PCPU_CACHE flag is set at allocation time if the page was + * allocated from a per-CPU cache. It is cleared the next time that the + * page is allocated from the physical memory allocator. */ #define PG_PCPU_CACHE 0x0001 /* was allocated from per-CPU caches */ #define PG_FICTITIOUS 0x0004 /* physical page doesn't exist */ Modified: head/sys/vm/vm_pagequeue.h ============================================================================== --- head/sys/vm/vm_pagequeue.h Mon Jul 8 18:29:37 2019 (r349839) +++ head/sys/vm/vm_pagequeue.h Mon Jul 8 18:56:30 2019 (r349840) @@ -103,7 +103,11 @@ struct vm_domain { struct vm_pagequeue vmd_pagequeues[PQ_COUNT]; struct mtx_padalign vmd_free_mtx; struct mtx_padalign vmd_pageout_mtx; - uma_zone_t vmd_pgcache; /* (c) page free cache. */ + struct vm_pgcache { + int domain; + int pool; + uma_zone_t zone; + } vmd_pgcache[VM_NFREEPOOL]; struct vmem *vmd_kernel_arena; /* (c) per-domain kva R/W arena. */ struct vmem *vmd_kernel_rwx_arena; /* (c) per-domain kva R/W/X arena. */ u_int vmd_domain; /* (c) Domain number. */ From owner-svn-src-head@freebsd.org Mon Jul 8 19:02:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BC5F15E6C9F; Mon, 8 Jul 2019 19:02:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 417F98626F; Mon, 8 Jul 2019 19:02:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 194441C9AE; Mon, 8 Jul 2019 19:02:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68J2eeT063495; Mon, 8 Jul 2019 19:02:40 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68J2eOx063494; Mon, 8 Jul 2019 19:02:40 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907081902.x68J2eOx063494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 8 Jul 2019 19:02:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349841 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 349841 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 417F98626F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 19:02:41 -0000 Author: markj Date: Mon Jul 8 19:02:40 2019 New Revision: 349841 URL: https://svnweb.freebsd.org/changeset/base/349841 Log: Elide the vm_reserv_free_page() call when PG_PCPU_CACHE is set. Pages with PG_PCPU_CACHE set cannot have been allocated from a reservation, so as an optimization, skip the call to vm_reserv_free_page() in this case. Otherwise, the access of the corresponding reservation structure often results in a cache miss. Reviewed by: alc, kib Discussed with: jeff MFC after: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20859 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Jul 8 18:56:30 2019 (r349840) +++ head/sys/vm/vm_page.c Mon Jul 8 19:02:40 2019 (r349841) @@ -3491,7 +3491,12 @@ vm_page_free_prep(vm_page_t m) pmap_page_set_memattr(m, VM_MEMATTR_DEFAULT); #if VM_NRESERVLEVEL > 0 - if (vm_reserv_free_page(m)) + /* + * Determine whether the page belongs to a reservation. If the page was + * allocated from a per-CPU cache, it cannot belong to a reservation, so + * as an optimization, we avoid the check in that case. + */ + if ((m->flags & PG_PCPU_CACHE) == 0 && vm_reserv_free_page(m)) return (false); #endif From owner-svn-src-head@freebsd.org Mon Jul 8 19:11:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A67615E713A; Mon, 8 Jul 2019 19:11:37 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E2E9D86A47; Mon, 8 Jul 2019 19:11:36 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71DA21CB30; Mon, 8 Jul 2019 19:11:36 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68JBaqD066890; Mon, 8 Jul 2019 19:11:36 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68JBaS1066889; Mon, 8 Jul 2019 19:11:36 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907081911.x68JBaS1066889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 8 Jul 2019 19:11:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349842 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349842 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E2E9D86A47 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 19:11:37 -0000 Author: cy Date: Mon Jul 8 19:11:35 2019 New Revision: 349842 URL: https://svnweb.freebsd.org/changeset/base/349842 Log: Correct the description for the low port in the port compare struct. Adjust the high port description to match that of the low port description. MFC after: 3 days Modified: head/sys/contrib/ipfilter/netinet/ip_fil.h Modified: head/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil.h Mon Jul 8 19:02:40 2019 (r349841) +++ head/sys/contrib/ipfilter/netinet/ip_fil.h Mon Jul 8 19:11:35 2019 (r349842) @@ -584,8 +584,8 @@ typedef enum fr_ctypes_e { */ typedef struct frpcmp { fr_ctypes_t frp_cmp; /* data for port comparisons */ - u_32_t frp_port; /* top port for <> and >< */ - u_32_t frp_top; /* top port for <> and >< */ + u_32_t frp_port; /* low port for <> and >< */ + u_32_t frp_top; /* high port for <> and >< */ } frpcmp_t; From owner-svn-src-head@freebsd.org Mon Jul 8 19:11:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 714E615E7164; Mon, 8 Jul 2019 19:11:50 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0E9DE86B57; Mon, 8 Jul 2019 19:11:50 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95AF11CB41; Mon, 8 Jul 2019 19:11:49 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68JBnj3067851; Mon, 8 Jul 2019 19:11:49 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68JBnn1067850; Mon, 8 Jul 2019 19:11:49 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907081911.x68JBnn1067850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 8 Jul 2019 19:11:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349843 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349843 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0E9DE86B57 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 19:11:50 -0000 Author: cy Date: Mon Jul 8 19:11:49 2019 New Revision: 349843 URL: https://svnweb.freebsd.org/changeset/base/349843 Log: Update frtuc struct comments. It not only defines TCP things we are interested in but also UDP. While at it document the source and destination port variables. MFC after: 3 days Modified: head/sys/contrib/ipfilter/netinet/ip_fil.h Modified: head/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil.h Mon Jul 8 19:11:35 2019 (r349842) +++ head/sys/contrib/ipfilter/netinet/ip_fil.h Mon Jul 8 19:11:49 2019 (r349843) @@ -590,14 +590,14 @@ typedef struct frpcmp { /* - * Structure containing all the relevant TCP things that can be checked in + * Structure containing all the relevant TCP/UDP things that can be checked in * a filter rule. */ typedef struct frtuc { u_char ftu_tcpfm; /* tcp flags mask */ u_char ftu_tcpf; /* tcp flags */ - frpcmp_t ftu_src; - frpcmp_t ftu_dst; + frpcmp_t ftu_src; /* source port */ + frpcmp_t ftu_dst; /* destination port */ } frtuc_t; #define ftu_scmp ftu_src.frp_cmp From owner-svn-src-head@freebsd.org Mon Jul 8 19:13:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 396A515E7270; Mon, 8 Jul 2019 19:13:12 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (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 4007386DC1; Mon, 8 Jul 2019 19:13:09 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 668A26F2; Mon, 8 Jul 2019 15:13:02 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 08 Jul 2019 15:13:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm3; bh=I qgh2AADiGI3tpyXdwWquI7SL4Wbzppis/u/n4uMVrk=; b=eWqdHb4M2Fzeikoof qwOSvD5DOTm4U9LerLt8drJ482S8fggOgEB3FzLTiTgWE3z459YmA1KQ1R4YNrSd wlwjJrhMfh/YKiJHGWEteC3nuUTtMV8OWqYIPkdB8dLErl1s8ezPXsRsxUQR0uml ketsJbNeFoB+mH94THaVVFp5W4cVpoRMQqdbeRtTHHNjlzU7HELvVglPb4OpqslX pAxx7WDzt7O4C6dvjrrNDUbjmCbjA8n23gVGt7GZrHVwUc0KUZ/pjIBrVNVI9Pme KzvlIbvZXS5mvKzX0vcqYwFLnTRD9p9ajgv35Vyev5orwdP4v01+Qr/VV1DA4u9C oqUPw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=Iqgh2AADiGI3tpyXdwWquI7SL4Wbzppis/u/n4uMV rk=; b=JK0th8rWRVo6mE3u7kLe7YoXfB6n+sqBBjztbH/TIQXVqjdba1oefjvhM NOfdyqnQZ4MCUxA2j6kTFAZOrEwXzvcxfv+Kyi8QhN/XgKtZgTj0SCdZcgJajn5F uhLasvYIJp2EmxPq47+Ai1TZAqhHyD/T33M96sQ0SX45ILKUljusK1Jr21ydNl9B SQpVA1aTnW7c62WzFc9lBs4reYuiJRGXuNxGUjQr7PSctP5XizS1fhWtMjqEoyCa RKON6wDO4dSfH92VzcsgwypAZ5QpgiA+LIABEutXo91jDWH/MKykIP2xhohdpnrN 4XEwvh/ko5Q6QluAhBwgeHNncaQzw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrgedtgddufeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurheptggguffhjgffgffkfhfvofesthhqmhdthhdtjeenucfhrhhomhepufgtohht thcunfhonhhguceoshgtohhtthhlsehsrghmshgtohdrohhrgheqnecukfhppedujeegrd dvtdelrdeffedrudduvdenucfrrghrrghmpehmrghilhhfrhhomhepshgtohhtthhlsehs rghmshgtohdrohhrghenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [172.20.10.2] (112.sub-174-209-33.myvzw.com [174.209.33.112]) by mail.messagingengine.com (Postfix) with ESMTPA id 54E24380075; Mon, 8 Jul 2019 15:13:00 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r349791 - head/sys/vm From: Scott Long In-Reply-To: <20190707023441.B2047@besplex.bde.org> Date: Mon, 8 Jul 2019 13:12:58 -0600 Cc: Doug Moore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <4BC14FB0-F79B-48DA-98E1-40B20552EA11@samsco.org> References: <201907061555.x66FtGsg025314@repo.freebsd.org> <20190707023441.B2047@besplex.bde.org> To: Bruce Evans X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 4007386DC1 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=samsco.org header.s=fm3 header.b=eWqdHb4M; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=JK0th8rW; spf=pass (mx1.freebsd.org: domain of scottl@samsco.org designates 64.147.123.20 as permitted sender) smtp.mailfrom=scottl@samsco.org X-Spamd-Result: default: False [-6.57 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[samsco.org:s=fm3,messagingengine.com:s=fm3]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:64.147.123.20]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[samsco.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[samsco.org:+,messagingengine.com:+]; MX_GOOD(-0.01)[in2-smtp.messagingengine.com,in1-smtp.messagingengine.com,in2-smtp.messagingengine.com,in1-smtp.messagingengine.com,in2-smtp.messagingengine.com,in1-smtp.messagingengine.com,in2-smtp.messagingengine.com,in1-smtp.messagingengine.com]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; IP_SCORE(-3.48)[ip: (-9.46), ipnet: 64.147.123.0/24(-4.87), asn: 11403(-3.01), country: US(-0.06)]; FREEMAIL_TO(0.00)[optusnet.com.au]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:11403, ipnet:64.147.123.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[20.123.147.64.list.dnswl.org : 127.0.5.1] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 19:13:12 -0000 Hi Bruce, This isn=E2=80=99t the first time I=E2=80=99ve witnessed your passion on = this topic. It would help immensely if there was some documentation, maybe in = /sys/sys/param.h, or maybe even in a manual page, on what a =E2=80=9Cclick=E2=80=9D is, = what a =E2=80=9Cdb=E2=80=9D is, why they=E2=80=99re important, and how they should be used. Do you have any documentation tucked away that could be edited and committed? Thanks, Scott > On Jul 6, 2019, at 11:48 AM, Bruce Evans wrote: >=20 > On Sat, 6 Jul 2019, Doug Moore wrote: >=20 >> Log: >> Fix style(9) violations involving division by PAGE_SIZE. >=20 > It is style violation to even use an explicit division by PAGE_SIZE > instead of the btoc() conversion macro (*). From owner-svn-src-head@freebsd.org Mon Jul 8 19:26:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA71315E7B14; Mon, 8 Jul 2019 19:26:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F77387867; Mon, 8 Jul 2019 19:26:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 636491CD14; Mon, 8 Jul 2019 19:26:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68JQ6SB074094; Mon, 8 Jul 2019 19:26:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68JQ6f9074093; Mon, 8 Jul 2019 19:26:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201907081926.x68JQ6f9074093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 8 Jul 2019 19:26:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349844 - head/sys/dev/usb X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/usb X-SVN-Commit-Revision: 349844 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8F77387867 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 19:26:07 -0000 Author: hselasky Date: Mon Jul 8 19:26:05 2019 New Revision: 349844 URL: https://svnweb.freebsd.org/changeset/base/349844 Log: Minor code cleanup of USB ACPI code after r349161. While at it fix an invalid memory access issue when attaching external USB HUBs, which are not mapped by ACPI, due to missing status check when calling AcpiGetObjectInfo() from acpi_usb_hub_port_probe_cb(). Sponsored by: Mellanox Technologies Modified: head/sys/dev/usb/usb_hub_acpi.c Modified: head/sys/dev/usb/usb_hub_acpi.c ============================================================================== --- head/sys/dev/usb/usb_hub_acpi.c Mon Jul 8 19:11:49 2019 (r349843) +++ head/sys/dev/usb/usb_hub_acpi.c Mon Jul 8 19:26:05 2019 (r349844) @@ -80,51 +80,31 @@ #include #include -static UINT32 acpi_uhub_find_rh_cb(ACPI_HANDLE ah, UINT32 nl, void *ctx, void **status); -static ACPI_STATUS acpi_uhub_find_rh(device_t dev, ACPI_HANDLE * ah); -static ACPI_STATUS -acpi_usb_hub_port_probe_cb(ACPI_HANDLE ah, UINT32 lv, void *ctx, void **rv); -static ACPI_STATUS acpi_usb_hub_port_probe(device_t dev, ACPI_HANDLE ah); -static int acpi_uhub_root_probe(device_t dev); -static int acpi_uhub_probe(device_t dev); -static int acpi_uhub_root_attach(device_t dev); -static int acpi_uhub_attach(device_t dev); -static int acpi_uhub_detach(device_t dev); -static int -acpi_uhub_read_ivar(device_t dev, device_t child, int idx, - uintptr_t *res); -static int -acpi_uhub_child_location_string(device_t parent, device_t child, - char *buf, size_t buflen); -static int acpi_uhub_parse_upc(device_t dev, unsigned int port, ACPI_HANDLE ah); - struct acpi_uhub_softc { struct uhub_softc usc; uint8_t nports; ACPI_HANDLE *porthandle; }; -UINT32 -acpi_uhub_find_rh_cb(ACPI_HANDLE ah, UINT32 nl, void *ctx, void **status){ +static UINT32 +acpi_uhub_find_rh_cb(ACPI_HANDLE ah, UINT32 nl, void *ctx, void **status) +{ ACPI_DEVICE_INFO *devinfo; - UINT32 ret = AE_OK; + UINT32 ret; *status = NULL; devinfo = NULL; ret = AcpiGetObjectInfo(ah, &devinfo); - - if (ACPI_FAILURE(ret)) { - return ret; + if (ACPI_SUCCESS(ret)) { + if ((devinfo->Valid & ACPI_VALID_ADR) && + (devinfo->Address == 0)) { + ret = AE_CTRL_TERMINATE; + *status = ah; + } + AcpiOsFree(devinfo); } - if ((devinfo->Valid & ACPI_VALID_ADR) && - (devinfo->Address == 0)) { - ret = AE_CTRL_TERMINATE; - *status = ah; - } - AcpiOsFree(devinfo); - - return ret; + return (ret); } static int @@ -134,14 +114,17 @@ acpi_uhub_parse_upc(device_t dev, unsigned int port, A buf.Pointer = NULL; buf.Length = ACPI_ALLOCATE_BUFFER; + if (AcpiEvaluateObject(ah, "_UPC", NULL, &buf) == AE_OK) { UINT64 porttypenum, conn; const char *connectable; - const char *typelist[] = {"TypeA", "MiniAB", "Express", + const char *typelist[] = { + "TypeA", "MiniAB", "Express", "USB3-A", "USB3-B", "USB-MicroB", "USB3-MicroAB", "USB3-PowerB", "TypeC-USB2", "TypeC-Switch", - "TypeC-nonSwitch"}; + "TypeC-nonSwitch" + }; const char *porttype; const int last = sizeof(typelist) / sizeof(typelist[0]); ACPI_OBJECT *obj = buf.Pointer; @@ -162,7 +145,7 @@ acpi_uhub_parse_upc(device_t dev, unsigned int port, A } AcpiOsFree(buf.Pointer); - return 0; + return (0); } static int @@ -172,6 +155,7 @@ acpi_uhub_parse_pld(device_t dev, unsigned int port, A buf.Pointer = NULL; buf.Length = ACPI_ALLOCATE_BUFFER; + if (AcpiEvaluateObject(ah, "_PLD", NULL, &buf) == AE_OK) { ACPI_OBJECT *obj; unsigned char *resbuf; @@ -235,145 +219,145 @@ acpi_uhub_parse_pld(device_t dev, unsigned int port, A } skip: AcpiOsFree(buf.Pointer); - } - - - return 0; + return (0); } -ACPI_STATUS -acpi_uhub_find_rh(device_t dev, ACPI_HANDLE * ah) +static ACPI_STATUS +acpi_uhub_find_rh(device_t dev, ACPI_HANDLE *ah) { device_t grand; ACPI_HANDLE gah; *ah = NULL; grand = device_get_parent(device_get_parent(dev)); - if ((gah = acpi_get_handle(grand)) == NULL) { - return AE_ERROR; - } - return AcpiWalkNamespace(ACPI_TYPE_DEVICE, gah, 1, - acpi_uhub_find_rh_cb, NULL, dev, ah); + + if ((gah = acpi_get_handle(grand)) == NULL) + return (AE_ERROR); + + return (AcpiWalkNamespace(ACPI_TYPE_DEVICE, gah, 1, + acpi_uhub_find_rh_cb, NULL, dev, ah)); } -ACPI_STATUS +static ACPI_STATUS acpi_usb_hub_port_probe_cb(ACPI_HANDLE ah, UINT32 lv, void *ctx, void **rv) { ACPI_DEVICE_INFO *devinfo; device_t dev = ctx; struct acpi_uhub_softc *sc = device_get_softc(dev); + UINT32 ret; - if (usb_debug) - device_printf(dev, "%s\n", acpi_name(ah)); - - AcpiGetObjectInfo(ah, &devinfo); - if ((devinfo->Valid & ACPI_VALID_ADR) && - (devinfo->Address > 0) && - (devinfo->Address <= (uint64_t)sc->nports)) { - sc->porthandle[devinfo->Address - 1] = ah; - acpi_uhub_parse_upc(dev, devinfo->Address, ah); - acpi_uhub_parse_pld(dev, devinfo->Address, ah); - } else { - device_printf(dev, "Skiping invalid devobj %s\n", - acpi_name(ah)); + ret = AcpiGetObjectInfo(ah, &devinfo); + if (ACPI_SUCCESS(ret)) { + if ((devinfo->Valid & ACPI_VALID_ADR) && + (devinfo->Address > 0) && + (devinfo->Address <= (uint64_t)sc->nports)) { + sc->porthandle[devinfo->Address - 1] = ah; + acpi_uhub_parse_upc(dev, devinfo->Address, ah); + acpi_uhub_parse_pld(dev, devinfo->Address, ah); + } + AcpiOsFree(devinfo); } - AcpiOsFree(devinfo); - return AE_OK; + return (AE_OK); } -ACPI_STATUS +static ACPI_STATUS acpi_usb_hub_port_probe(device_t dev, ACPI_HANDLE ah) { - return AcpiWalkNamespace(ACPI_TYPE_DEVICE, + return (AcpiWalkNamespace(ACPI_TYPE_DEVICE, ah, 1, acpi_usb_hub_port_probe_cb, - NULL, dev, NULL); + NULL, dev, NULL)); } -int + +static int acpi_uhub_root_probe(device_t dev) { - ACPI_HANDLE ah; ACPI_STATUS status; + ACPI_HANDLE ah; - if(acpi_disabled("usb")) { - return ENXIO; - } + if (acpi_disabled("usb")) + return (ENXIO); + status = acpi_uhub_find_rh(dev, &ah); - if (ACPI_SUCCESS(status) - && ah != NULL - && (uhub_probe(dev) <= 0)) { - /* success prior than non - acpi hub */ + if (ACPI_SUCCESS(status) && ah != NULL && + uhub_probe(dev) <= 0) { + /* success prior than non-ACPI USB HUB */ return (BUS_PROBE_DEFAULT + 1); } - return ENXIO; + return (ENXIO); } -int +static int acpi_uhub_probe(device_t dev) { - ACPI_HANDLE ah = acpi_get_handle(dev); + ACPI_HANDLE ah; - if (!acpi_disabled("usb") && ah && (uhub_probe(dev) <= 0)) { - /*success prior than non - acpi hub*/ - return (BUS_PROBE_DEFAULT + 1); + if (acpi_disabled("usb")) + return (ENXIO); + + ah = acpi_get_handle(dev); + if (ah == NULL) + return (ENXIO); + + if (uhub_probe(dev) <= 0) { + /* success prior than non-ACPI USB HUB */ + return (BUS_PROBE_DEFAULT + 1); } return (ENXIO); } -int + +static int acpi_uhub_root_attach(device_t dev) { - ACPI_HANDLE devhandle; - struct usb_hub *uh; struct acpi_uhub_softc *sc = device_get_softc(dev); + ACPI_STATUS status; + ACPI_HANDLE ah; int ret; - if ((ret = uhub_attach(dev)) != 0) { - return (ret); - } - uh = sc->usc.sc_udev->hub; + ret = uhub_attach(dev); + if (ret != 0) + goto done; - if (ACPI_FAILURE(acpi_uhub_find_rh(dev, &devhandle)) || - (devhandle == NULL)) { - return ENXIO; - } + status = acpi_uhub_find_rh(dev, &ah); + if (ACPI_SUCCESS(status) && ah != NULL) { + struct usb_hub *uh = sc->usc.sc_udev->hub; - sc->nports = uh->nports; - sc->porthandle = malloc(sizeof(ACPI_HANDLE) * uh->nports, - M_USBDEV, M_WAITOK | M_ZERO); - acpi_usb_hub_port_probe(dev, devhandle); - - return 0; + sc->nports = uh->nports; + sc->porthandle = malloc(sizeof(ACPI_HANDLE) * uh->nports, + M_USBDEV, M_WAITOK | M_ZERO); + acpi_usb_hub_port_probe(dev, ah); + } +done: + return (ret); } -int +static int acpi_uhub_attach(device_t dev) { - struct usb_hub *uh; struct acpi_uhub_softc *sc = device_get_softc(dev); - ACPI_HANDLE devhandle; + ACPI_HANDLE ah; int ret; - if ((ret = uhub_attach(dev)) != 0) { - return (ret); - } - uh = sc->usc.sc_udev->hub; - devhandle = acpi_get_handle(dev); + ret = uhub_attach(dev); + if (ret != 0) + goto done; - if (devhandle == NULL) { - return ENXIO; - } + ah = acpi_get_handle(dev); + if (ah != NULL) { + struct usb_hub *uh = sc->usc.sc_udev->hub; - sc->nports = uh->nports; - sc->porthandle = malloc(sizeof(ACPI_HANDLE) * uh->nports, - M_USBDEV, M_WAITOK | M_ZERO); - acpi_usb_hub_port_probe(dev, acpi_get_handle(dev)); - return 0; + sc->nports = uh->nports; + sc->porthandle = malloc(sizeof(ACPI_HANDLE) * uh->nports, + M_USBDEV, M_WAITOK | M_ZERO); + acpi_usb_hub_port_probe(dev, ah); + } +done: + return (ret); } -int -acpi_uhub_read_ivar(device_t dev, device_t child, int idx, - uintptr_t *res) +static int +acpi_uhub_read_ivar(device_t dev, device_t child, int idx, uintptr_t *res) { struct hub_result hres; struct acpi_uhub_softc *sc = device_get_softc(dev); @@ -382,6 +366,7 @@ acpi_uhub_read_ivar(device_t dev, device_t child, int mtx_lock(&Giant); uhub_find_iface_index(sc->usc.sc_udev->hub, child, &hres); mtx_unlock(&Giant); + if ((idx == ACPI_IVAR_HANDLE) && (hres.portno > 0) && (hres.portno <= sc->nports) && @@ -391,29 +376,31 @@ acpi_uhub_read_ivar(device_t dev, device_t child, int } return (ENXIO); } + static int acpi_uhub_child_location_string(device_t parent, device_t child, char *buf, size_t buflen) { - ACPI_HANDLE ah; uhub_child_location_string(parent, child, buf, buflen); + ah = acpi_get_handle(child); - if (ah) { + if (ah != NULL) { strlcat(buf, " handle=", buflen); strlcat(buf, acpi_name(ah), buflen); } return (0); } -int +static int acpi_uhub_detach(device_t dev) { struct acpi_uhub_softc *sc = device_get_softc(dev); free(sc->porthandle, M_USBDEV); - return uhub_detach(dev); + + return (uhub_detach(dev)); } static device_method_t acpi_uhub_methods[] = { @@ -438,12 +425,14 @@ static device_method_t acpi_uhub_root_methods[] = { static devclass_t uhub_devclass; extern driver_t uhub_driver; static kobj_class_t uhub_baseclasses[] = {&uhub_driver, NULL}; + static driver_t acpi_uhub_driver = { .name = "uhub", .methods = acpi_uhub_methods, .size = sizeof(struct acpi_uhub_softc), .baseclasses = uhub_baseclasses, }; + static driver_t acpi_uhub_root_driver = { .name = "uhub", .methods = acpi_uhub_root_methods, From owner-svn-src-head@freebsd.org Mon Jul 8 19:38:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC84515E7F71; Mon, 8 Jul 2019 19:38:50 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 53D3B884F3; Mon, 8 Jul 2019 19:38:50 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2704D1CEB6; Mon, 8 Jul 2019 19:38:50 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68JcneQ079353; Mon, 8 Jul 2019 19:38:49 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68JcnMw079352; Mon, 8 Jul 2019 19:38:49 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907081938.x68JcnMw079352@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 8 Jul 2019 19:38:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349845 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 349845 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 53D3B884F3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 19:38:51 -0000 Author: imp Date: Mon Jul 8 19:38:49 2019 New Revision: 349845 URL: https://svnweb.freebsd.org/changeset/base/349845 Log: Work around devices which return all zeros for reads of existing MSI-X table VCTRL registers. Unconditionally program the MSI-X vector control Mask field for MSI-X table entries without regarud for Mask's previous value. Some devices return all zeros on reads of the VCTRL registers, which would cause us to skip disabling interrupts. This fixes the Samsung SM961/PM961 SSDs which are return zero starting from offset 0x3084 within the memory region specified by BAR0, even when they are active MSI-X vectors. The Illumos kernel writes these unconditionally to 0 or 1. However, section 6.8.2.9 of the PCI Local Bus 3.0 spec (dated Feb 3, 2004) states for bits 31::01: After reset, the state of these bits must be 0. However, for potential future use, software must preserve the value of these reserved bits when modifying the value of other Vector Control bits. If software modifies the value of these reserved bits, the result is undefined." so we always set or clear the Mask bit, but otherwise preserves the old value. PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211713 Reviewed By: imp, jhb Submitted by: Ka Ho Ng MFC After: 1 week Differential Revision: https://reviews.freebsd.org/D20873 Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Mon Jul 8 19:26:05 2019 (r349844) +++ head/sys/dev/pci/pci.c Mon Jul 8 19:38:49 2019 (r349845) @@ -1671,10 +1671,13 @@ pci_mask_msix(device_t dev, u_int index) KASSERT(msix->msix_msgnum > index, ("bogus index")); offset = msix->msix_table_offset + index * 16 + 12; val = bus_read_4(msix->msix_table_res, offset); - if (!(val & PCIM_MSIX_VCTRL_MASK)) { - val |= PCIM_MSIX_VCTRL_MASK; - bus_write_4(msix->msix_table_res, offset, val); - } + val |= PCIM_MSIX_VCTRL_MASK; + + /* + * Some devices (e.g. Samsung PM961) do not support reads of this + * register, so always write the new value. + */ + bus_write_4(msix->msix_table_res, offset, val); } void @@ -1687,10 +1690,13 @@ pci_unmask_msix(device_t dev, u_int index) KASSERT(msix->msix_table_len > index, ("bogus index")); offset = msix->msix_table_offset + index * 16 + 12; val = bus_read_4(msix->msix_table_res, offset); - if (val & PCIM_MSIX_VCTRL_MASK) { - val &= ~PCIM_MSIX_VCTRL_MASK; - bus_write_4(msix->msix_table_res, offset, val); - } + val &= ~PCIM_MSIX_VCTRL_MASK; + + /* + * Some devices (e.g. Samsung PM961) do not support reads of this + * register, so always write the new value. + */ + bus_write_4(msix->msix_table_res, offset, val); } int From owner-svn-src-head@freebsd.org Mon Jul 8 19:46:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A787015E829D; Mon, 8 Jul 2019 19:46:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5677988B7B; Mon, 8 Jul 2019 19:46:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27FCF1D067; Mon, 8 Jul 2019 19:46:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68JkRBE084272; Mon, 8 Jul 2019 19:46:27 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68JkKYV084236; Mon, 8 Jul 2019 19:46:20 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907081946.x68JkKYV084236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 8 Jul 2019 19:46:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349846 - in head: share/man/man9 sys/amd64/amd64 sys/amd64/vmm sys/arm/arm sys/arm64/arm64 sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linuxkpi/common/src sys/contrib/vch... X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: share/man/man9 sys/amd64/amd64 sys/amd64/vmm sys/arm/arm sys/arm64/arm64 sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linuxkpi/common/src sys/contrib/vchiq/interface/vchiq_arm sy... X-SVN-Commit-Revision: 349846 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5677988B7B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 19:46:28 -0000 Author: markj Date: Mon Jul 8 19:46:20 2019 New Revision: 349846 URL: https://svnweb.freebsd.org/changeset/base/349846 Log: Merge the vm_page hold and wire mechanisms. The hold_count and wire_count fields of struct vm_page are separate reference counters with similar semantics. The remaining essential differences are that holds are not counted as a reference with respect to LRU, and holds have an implicit free-on-last unhold semantic whereas vm_page_unwire() callers must explicitly determine whether to free the page once the last reference to the page is released. This change removes the KPIs which directly manipulate hold_count. Functions such as vm_fault_quick_hold_pages() now return wired pages instead. Since r328977 the overhead of maintaining LRU for wired pages is lower, and in many cases vm_fault_quick_hold_pages() callers would swap holds for wirings on the returned pages anyway, so with this change we remove a number of page lock acquisitions. No functional change is intended. __FreeBSD_version is bumped. Reviewed by: alc, kib Discussed with: jeff Discussed with: jhb, np (cxgbe) Tested by: pho (previous version) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D19247 Deleted: head/share/man/man9/vm_page_hold.9 Modified: head/share/man/man9/Makefile head/sys/amd64/amd64/pmap.c head/sys/amd64/vmm/vmm.c head/sys/arm/arm/pmap-v4.c head/sys/arm/arm/pmap-v6.c head/sys/arm64/arm64/pmap.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/compat/linuxkpi/common/src/linux_page.c head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_ddp.c head/sys/dev/cxgbe/tom/t4_tom.h head/sys/i386/i386/pmap.c head/sys/kern/kern_exec.c head/sys/kern/sys_process.c head/sys/kern/uipc_shm.c head/sys/mips/mips/pmap.c head/sys/net/bpf_zerocopy.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/booke/pmap.c head/sys/riscv/riscv/pmap.c head/sys/sparc64/sparc64/pmap.c head/sys/sys/param.h head/sys/vm/vm_fault.c head/sys/vm/vm_glue.c head/sys/vm/vm_object.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_pageout.c head/sys/vm/vm_swapout.c Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Mon Jul 8 19:38:49 2019 (r349845) +++ head/share/man/man9/Makefile Mon Jul 8 19:46:20 2019 (r349846) @@ -381,7 +381,6 @@ MAN= accept_filter.9 \ vm_page_aflag.9 \ vm_page_free.9 \ vm_page_grab.9 \ - vm_page_hold.9 \ vm_page_insert.9 \ vm_page_lookup.9 \ vm_page_rename.9 \ @@ -2248,7 +2247,6 @@ MLINKS+=vm_page_aflag.9 vm_page_aflag_clear.9 \ MLINKS+=vm_page_free.9 vm_page_free_toq.9 \ vm_page_free.9 vm_page_free_zero.9 \ vm_page_free.9 vm_page_try_to_free.9 -MLINKS+=vm_page_hold.9 vm_page_unhold.9 MLINKS+=vm_page_insert.9 vm_page_remove.9 MLINKS+=vm_page_wire.9 vm_page_unwire.9 MLINKS+=VOP_ACCESS.9 VOP_ACCESSX.9 Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/amd64/amd64/pmap.c Mon Jul 8 19:46:20 2019 (r349846) @@ -3035,7 +3035,7 @@ retry: } } if (m != NULL) - vm_page_hold(m); + vm_page_wire(m); } PA_UNLOCK_COND(pa); PMAP_UNLOCK(pmap); Modified: head/sys/amd64/vmm/vmm.c ============================================================================== --- head/sys/amd64/vmm/vmm.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/amd64/vmm/vmm.c Mon Jul 8 19:46:20 2019 (r349846) @@ -1003,7 +1003,7 @@ vm_gpa_release(void *cookie) vm_page_t m = cookie; vm_page_lock(m); - vm_page_unhold(m); + vm_page_unwire(m, PQ_ACTIVE); vm_page_unlock(m); } Modified: head/sys/arm/arm/pmap-v4.c ============================================================================== --- head/sys/arm/arm/pmap-v4.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/arm/arm/pmap-v4.c Mon Jul 8 19:46:20 2019 (r349846) @@ -3438,9 +3438,8 @@ retry: goto retry; if (l1pd & L1_S_PROT_W || (prot & VM_PROT_WRITE) == 0) { m = PHYS_TO_VM_PAGE(pa); - vm_page_hold(m); + vm_page_wire(m); } - } else { /* * Note that we can't rely on the validity of the L1 @@ -3470,7 +3469,7 @@ retry: if (vm_page_pa_tryrelock(pmap, pa & PG_FRAME, &paddr)) goto retry; m = PHYS_TO_VM_PAGE(pa); - vm_page_hold(m); + vm_page_wire(m); } } Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/arm/arm/pmap-v6.c Mon Jul 8 19:46:20 2019 (r349846) @@ -2002,7 +2002,7 @@ retry: if (vm_page_pa_tryrelock(pmap, pa, &lockpa)) goto retry; m = PHYS_TO_VM_PAGE(pa); - vm_page_hold(m); + vm_page_wire(m); } } else if (pte1_is_link(pte1)) { pte2p = pmap_pte2(pmap, va); @@ -2014,7 +2014,7 @@ retry: if (vm_page_pa_tryrelock(pmap, pa, &lockpa)) goto retry; m = PHYS_TO_VM_PAGE(pa); - vm_page_hold(m); + vm_page_wire(m); } } PA_UNLOCK_COND(lockpa); @@ -6710,10 +6710,9 @@ pmap_pid_dump(int pid) pa = pte2_pa(pte2); m = PHYS_TO_VM_PAGE(pa); - printf("va: 0x%x, pa: 0x%x, h: %d, w:" - " %d, f: 0x%x", va, pa, - m->hold_count, m->wire_count, - m->flags); + printf("va: 0x%x, pa: 0x%x, w: %d, " + "f: 0x%x", va, pa, + m->wire_count, m->flags); npte2++; index++; if (index >= 2) { @@ -6823,8 +6822,8 @@ dump_link(pmap_t pmap, uint32_t pte1_idx, boolean_t in printf(" 0x%08X: 0x%08X, TEX%d, s:%d, g:%d, m:%p", va , pte2, pte2_class(pte2), !!(pte2 & PTE2_S), !(pte2 & PTE2_NG), m); if (m != NULL) { - printf(" v:%d h:%d w:%d f:0x%04X\n", m->valid, - m->hold_count, m->wire_count, m->flags); + printf(" v:%d w:%d f:0x%04X\n", m->valid, + m->wire_count, m->flags); } else { printf("\n"); } @@ -6933,8 +6932,8 @@ dump_pt2tab(pmap_t pmap) printf(" 0x%08X: 0x%08X, TEX%d, s:%d, m:%p", va, pte2, pte2_class(pte2), !!(pte2 & PTE2_S), m); if (m != NULL) - printf(" , h: %d, w: %d, f: 0x%04X pidx: %lld", - m->hold_count, m->wire_count, m->flags, m->pindex); + printf(" , w: %d, f: 0x%04X pidx: %lld", + m->wire_count, m->flags, m->pindex); printf("\n"); } } Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/arm64/arm64/pmap.c Mon Jul 8 19:46:20 2019 (r349846) @@ -1100,7 +1100,7 @@ retry: (tpte & ~ATTR_MASK) | off, &pa)) goto retry; m = PHYS_TO_VM_PAGE((tpte & ~ATTR_MASK) | off); - vm_page_hold(m); + vm_page_wire(m); } } PA_UNLOCK_COND(pa); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Jul 8 19:46:20 2019 (r349846) @@ -455,7 +455,7 @@ page_unbusy(vm_page_t pp) } static vm_page_t -page_hold(vnode_t *vp, int64_t start) +page_wire(vnode_t *vp, int64_t start) { vm_object_t obj; vm_page_t pp; @@ -482,9 +482,8 @@ page_hold(vnode_t *vp, int64_t start) ASSERT3U(pp->valid, ==, VM_PAGE_BITS_ALL); vm_page_lock(pp); - vm_page_hold(pp); + vm_page_wire(pp); vm_page_unlock(pp); - } else pp = NULL; break; @@ -493,11 +492,11 @@ page_hold(vnode_t *vp, int64_t start) } static void -page_unhold(vm_page_t pp) +page_unwire(vm_page_t pp) { vm_page_lock(pp); - vm_page_unhold(pp); + vm_page_unwire(pp, PQ_ACTIVE); vm_page_unlock(pp); } @@ -647,7 +646,7 @@ mappedread(vnode_t *vp, int nbytes, uio_t *uio) vm_page_t pp; uint64_t bytes = MIN(PAGESIZE - off, len); - if (pp = page_hold(vp, start)) { + if (pp = page_wire(vp, start)) { struct sf_buf *sf; caddr_t va; @@ -660,7 +659,7 @@ mappedread(vnode_t *vp, int nbytes, uio_t *uio) #endif zfs_unmap_page(sf); zfs_vmobject_wlock(obj); - page_unhold(pp); + page_unwire(pp); } else { zfs_vmobject_wunlock(obj); error = dmu_read_uio_dbuf(sa_get_db(zp->z_sa_hdl), Modified: head/sys/compat/linuxkpi/common/src/linux_page.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_page.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/compat/linuxkpi/common/src/linux_page.c Mon Jul 8 19:46:20 2019 (r349846) @@ -198,23 +198,11 @@ linux_get_user_pages_internal(vm_map_t map, unsigned l vm_prot_t prot; size_t len; int count; - int i; prot = write ? (VM_PROT_READ | VM_PROT_WRITE) : VM_PROT_READ; len = ((size_t)nr_pages) << PAGE_SHIFT; count = vm_fault_quick_hold_pages(map, start, len, prot, pages, nr_pages); - if (count == -1) - return (-EFAULT); - - for (i = 0; i != nr_pages; i++) { - struct page *pg = pages[i]; - - vm_page_lock(pg); - vm_page_wire(pg); - vm_page_unhold(pg); - vm_page_unlock(pg); - } - return (nr_pages); + return (count == -1 ? -EFAULT : nr_pages); } int @@ -243,11 +231,6 @@ __get_user_pages_fast(unsigned long start, int nr_page *mp = pmap_extract_and_hold(map->pmap, va, prot); if (*mp == NULL) break; - - vm_page_lock(*mp); - vm_page_wire(*mp); - vm_page_unhold(*mp); - vm_page_unlock(*mp); if ((prot & VM_PROT_WRITE) != 0 && (*mp)->dirty != VM_PAGE_BITS_ALL) { Modified: head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c ============================================================================== --- head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c Mon Jul 8 19:46:20 2019 (r349846) @@ -474,13 +474,6 @@ create_pagelist(char __user *buf, size_t count, unsign return (-ENOMEM); } - for (i = 0; i < actual_pages; i++) { - vm_page_lock(pages[i]); - vm_page_wire(pages[i]); - vm_page_unhold(pages[i]); - vm_page_unlock(pages[i]); - } - pagelist->length = count; pagelist->type = type; pagelist->offset = offset; Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Mon Jul 8 19:46:20 2019 (r349846) @@ -1944,7 +1944,7 @@ aiotx_free_pgs(struct mbuf *m) for (int i = 0; i < ext_pgs->npgs; i++) { pg = PHYS_TO_VM_PAGE(ext_pgs->pa[i]); vm_page_change_lock(pg, &mtx); - vm_page_unhold(pg); + vm_page_unwire(pg, PQ_ACTIVE); } if (mtx != NULL) mtx_unlock(mtx); Modified: head/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_ddp.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/dev/cxgbe/tom/t4_ddp.c Mon Jul 8 19:46:20 2019 (r349846) @@ -112,15 +112,12 @@ free_pageset(struct tom_data *td, struct pageset *ps) if (ps->prsv.prsv_nppods > 0) t4_free_page_pods(&ps->prsv); - if (ps->flags & PS_WIRED) { - for (i = 0; i < ps->npages; i++) { - p = ps->pages[i]; - vm_page_lock(p); - vm_page_unwire(p, PQ_INACTIVE); - vm_page_unlock(p); - } - } else - vm_page_unhold_pages(ps->pages, ps->npages); + for (i = 0; i < ps->npages; i++) { + p = ps->pages[i]; + vm_page_lock(p); + vm_page_unwire(p, PQ_INACTIVE); + vm_page_unlock(p); + } mtx_lock(&ddp_orphan_pagesets_lock); TAILQ_INSERT_TAIL(&ddp_orphan_pagesets, ps, link); taskqueue_enqueue(taskqueue_thread, &ddp_orphan_task); @@ -150,7 +147,7 @@ recycle_pageset(struct toepcb *toep, struct pageset *p { DDP_ASSERT_LOCKED(toep); - if (!(toep->ddp.flags & DDP_DEAD) && ps->flags & PS_WIRED) { + if (!(toep->ddp.flags & DDP_DEAD)) { KASSERT(toep->ddp.cached_count + toep->ddp.active_count < nitems(toep->ddp.db), ("too many wired pagesets")); TAILQ_INSERT_HEAD(&toep->ddp.cached_pagesets, ps, link); @@ -1179,35 +1176,14 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct return (0); } -static void -wire_pageset(struct pageset *ps) -{ - vm_page_t p; - int i; - - KASSERT(!(ps->flags & PS_WIRED), ("pageset already wired")); - - for (i = 0; i < ps->npages; i++) { - p = ps->pages[i]; - vm_page_lock(p); - vm_page_wire(p); - vm_page_unhold(p); - vm_page_unlock(p); - } - ps->flags |= PS_WIRED; -} - /* - * Prepare a pageset for DDP. This wires the pageset and sets up page - * pods. + * Prepare a pageset for DDP. This sets up page pods. */ static int prep_pageset(struct adapter *sc, struct toepcb *toep, struct pageset *ps) { struct tom_data *td = sc->tom_softc; - if (!(ps->flags & PS_WIRED)) - wire_pageset(ps); if (ps->prsv.prsv_nppods == 0 && !t4_alloc_page_pods_for_ps(&td->pr, ps)) { return (0); Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/dev/cxgbe/tom/t4_tom.h Mon Jul 8 19:46:20 2019 (r349846) @@ -124,8 +124,7 @@ struct pageset { TAILQ_HEAD(pagesetq, pageset); -#define PS_WIRED 0x0001 /* Pages wired rather than held. */ -#define PS_PPODS_WRITTEN 0x0002 /* Page pods written to the card. */ +#define PS_PPODS_WRITTEN 0x0001 /* Page pods written to the card. */ struct ddp_buffer { struct pageset *ps; Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/i386/i386/pmap.c Mon Jul 8 19:46:20 2019 (r349846) @@ -1716,7 +1716,7 @@ retry: } } if (m != NULL) - vm_page_hold(m); + vm_page_wire(m); } PA_UNLOCK_COND(pa); PMAP_UNLOCK(pmap); Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/kern/kern_exec.c Mon Jul 8 19:46:20 2019 (r349846) @@ -1015,8 +1015,7 @@ exec_map_first_page(struct image_params *imgp) vm_page_readahead_finish(ma[i]); } vm_page_lock(ma[0]); - vm_page_hold(ma[0]); - vm_page_activate(ma[0]); + vm_page_wire(ma[0]); vm_page_unlock(ma[0]); VM_OBJECT_WUNLOCK(object); @@ -1036,7 +1035,7 @@ exec_unmap_first_page(struct image_params *imgp) sf_buf_free(imgp->firstpage); imgp->firstpage = NULL; vm_page_lock(m); - vm_page_unhold(m); + vm_page_unwire(m, PQ_ACTIVE); vm_page_unlock(m); } } Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/kern/sys_process.c Mon Jul 8 19:46:20 2019 (r349846) @@ -307,7 +307,8 @@ proc_rwmem(struct proc *p, struct uio *uio) * Release the page. */ vm_page_lock(m); - vm_page_unhold(m); + if (vm_page_unwire(m, PQ_ACTIVE) && m->object == NULL) + vm_page_free(m); vm_page_unlock(m); } while (error == 0 && uio->uio_resid > 0); Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/kern/uipc_shm.c Mon Jul 8 19:46:20 2019 (r349846) @@ -207,11 +207,7 @@ uiomove_object_page(vm_object_t obj, size_t len, struc vm_page_xunbusy(m); } vm_page_lock(m); - vm_page_hold(m); - if (vm_page_active(m)) - vm_page_reference(m); - else - vm_page_activate(m); + vm_page_wire(m); vm_page_unlock(m); VM_OBJECT_WUNLOCK(obj); error = uiomove_fromphys(&m, offset, tlen, uio); @@ -222,7 +218,7 @@ uiomove_object_page(vm_object_t obj, size_t len, struc VM_OBJECT_WUNLOCK(obj); } vm_page_lock(m); - vm_page_unhold(m); + vm_page_unwire(m, PQ_ACTIVE); vm_page_unlock(m); return (error); Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/mips/mips/pmap.c Mon Jul 8 19:46:20 2019 (r349846) @@ -811,7 +811,7 @@ retry: if (vm_page_pa_tryrelock(pmap, pte_pa, &pa)) goto retry; m = PHYS_TO_VM_PAGE(pte_pa); - vm_page_hold(m); + vm_page_wire(m); } } PA_UNLOCK_COND(pa); Modified: head/sys/net/bpf_zerocopy.c ============================================================================== --- head/sys/net/bpf_zerocopy.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/net/bpf_zerocopy.c Mon Jul 8 19:46:20 2019 (r349846) @@ -166,10 +166,6 @@ zbuf_sfbuf_get(struct vm_map *map, vm_offset_t uaddr) if (vm_fault_quick_hold_pages(map, uaddr, PAGE_SIZE, VM_PROT_READ | VM_PROT_WRITE, &pp, 1) < 0) return (NULL); - vm_page_lock(pp); - vm_page_wire(pp); - vm_page_unhold(pp); - vm_page_unlock(pp); sf = sf_buf_alloc(pp, SFB_NOWAIT); if (sf == NULL) { zbuf_page_free(pp); Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/powerpc/aim/mmu_oea.c Mon Jul 8 19:46:20 2019 (r349846) @@ -1275,7 +1275,7 @@ retry: if (vm_page_pa_tryrelock(pmap, pvo->pvo_pte.pte.pte_lo & PTE_RPGN, &pa)) goto retry; m = PHYS_TO_VM_PAGE(pvo->pvo_pte.pte.pte_lo & PTE_RPGN); - vm_page_hold(m); + vm_page_wire(m); } PA_UNLOCK_COND(pa); PMAP_UNLOCK(pmap); Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/powerpc/aim/mmu_oea64.c Mon Jul 8 19:46:20 2019 (r349846) @@ -1595,7 +1595,7 @@ retry: pvo->pvo_pte.pa & LPTE_RPGN, &pa)) goto retry; m = PHYS_TO_VM_PAGE(pvo->pvo_pte.pa & LPTE_RPGN); - vm_page_hold(m); + vm_page_wire(m); } PA_UNLOCK_COND(pa); PMAP_UNLOCK(pmap); Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/powerpc/booke/pmap.c Mon Jul 8 19:46:20 2019 (r349846) @@ -2951,7 +2951,7 @@ retry: if (vm_page_pa_tryrelock(pmap, PTE_PA(pte), &pa)) goto retry; m = PHYS_TO_VM_PAGE(PTE_PA(pte)); - vm_page_hold(m); + vm_page_wire(m); } } Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/riscv/riscv/pmap.c Mon Jul 8 19:46:20 2019 (r349846) @@ -884,7 +884,7 @@ retry: if (vm_page_pa_tryrelock(pmap, phys, &pa)) goto retry; m = PHYS_TO_VM_PAGE(phys); - vm_page_hold(m); + vm_page_wire(m); } } PA_UNLOCK_COND(pa); Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/sparc64/sparc64/pmap.c Mon Jul 8 19:46:20 2019 (r349846) @@ -859,7 +859,7 @@ retry: m = PHYS_TO_VM_PAGE(TLB_DIRECT_TO_PHYS(va)); (void)vm_page_pa_tryrelock(pm, TLB_DIRECT_TO_PHYS(va), &pa); - vm_page_hold(m); + vm_page_wire(m); } else { tp = tsb_kvtotte(va); if ((tp->tte_data & TD_V) == 0) @@ -872,7 +872,7 @@ retry: if (vm_page_pa_tryrelock(pm, TTE_GET_PA(tp), &pa)) goto retry; m = PHYS_TO_VM_PAGE(TTE_GET_PA(tp)); - vm_page_hold(m); + vm_page_wire(m); } PA_UNLOCK_COND(pa); PMAP_UNLOCK(pm); Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/sys/param.h Mon Jul 8 19:46:20 2019 (r349846) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300034 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300035 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/vm/vm_fault.c Mon Jul 8 19:46:20 2019 (r349846) @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -257,7 +258,7 @@ vm_fault_fill_hold(vm_page_t *m_hold, vm_page_t m) if (m_hold != NULL) { *m_hold = m; vm_page_lock(m); - vm_page_hold(m); + vm_page_wire(m); vm_page_unlock(m); } } @@ -505,7 +506,7 @@ vm_fault_populate(struct faultstate *fs, vm_prot_t pro vm_page_activate(&m[i]); if (m_hold != NULL && m[i].pindex == fs->first_pindex) { *m_hold = &m[i]; - vm_page_hold(&m[i]); + vm_page_wire(&m[i]); } vm_page_xunbusy_maybelocked(&m[i]); } @@ -563,6 +564,7 @@ vm_fault_hold(vm_map_t map, vm_offset_t vaddr, vm_prot struct faultstate fs; struct vnode *vp; struct domainset *dset; + struct mtx *mtx; vm_object_t next_object, retry_object; vm_offset_t e_end, e_start; vm_pindex_t retry_pindex; @@ -1142,15 +1144,23 @@ readrest: * We don't chase down the shadow chain */ fs.object == fs.first_object->backing_object) { - vm_page_lock(fs.m); - vm_page_dequeue(fs.m); + /* + * Keep the page wired to ensure that it is not + * freed by another thread, such as the page + * daemon, while it is disassociated from an + * object. + */ + mtx = NULL; + vm_page_change_lock(fs.m, &mtx); + vm_page_wire(fs.m); (void)vm_page_remove(fs.m); - vm_page_unlock(fs.m); - vm_page_lock(fs.first_m); + vm_page_change_lock(fs.first_m, &mtx); vm_page_replace_checked(fs.m, fs.first_object, fs.first_pindex, fs.first_m); vm_page_free(fs.first_m); - vm_page_unlock(fs.first_m); + vm_page_change_lock(fs.m, &mtx); + vm_page_unwire(fs.m, PQ_ACTIVE); + mtx_unlock(mtx); vm_page_dirty(fs.m); #if VM_NRESERVLEVEL > 0 /* @@ -1327,7 +1337,7 @@ readrest: vm_page_activate(fs.m); if (m_hold != NULL) { *m_hold = fs.m; - vm_page_hold(fs.m); + vm_page_wire(fs.m); } vm_page_unlock(fs.m); vm_page_xunbusy(fs.m); @@ -1600,7 +1610,9 @@ error: for (mp = ma; mp < ma + count; mp++) if (*mp != NULL) { vm_page_lock(*mp); - vm_page_unhold(*mp); + if (vm_page_unwire(*mp, PQ_INACTIVE) && + (*mp)->object == NULL) + vm_page_free(*mp); vm_page_unlock(*mp); } return (-1); Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/vm/vm_glue.c Mon Jul 8 19:46:20 2019 (r349846) @@ -223,12 +223,14 @@ vm_imgact_hold_page(vm_object_t object, vm_ooffset_t o VM_OBJECT_WLOCK(object); pindex = OFF_TO_IDX(offset); - m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY); + m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | + VM_ALLOC_WIRED); if (m->valid != VM_PAGE_BITS_ALL) { vm_page_xbusy(m); rv = vm_pager_get_pages(object, &m, 1, NULL, NULL); if (rv != VM_PAGER_OK) { vm_page_lock(m); + vm_page_unwire(m, PQ_NONE); vm_page_free(m); vm_page_unlock(m); m = NULL; @@ -236,10 +238,6 @@ vm_imgact_hold_page(vm_object_t object, vm_ooffset_t o } vm_page_xunbusy(m); } - vm_page_lock(m); - vm_page_hold(m); - vm_page_activate(m); - vm_page_unlock(m); out: VM_OBJECT_WUNLOCK(object); return (m); @@ -273,7 +271,7 @@ vm_imgact_unmap_page(struct sf_buf *sf) sf_buf_free(sf); sched_unpin(); vm_page_lock(m); - vm_page_unhold(m); + vm_page_unwire(m, PQ_ACTIVE); vm_page_unlock(m); } Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/vm/vm_object.c Mon Jul 8 19:46:20 2019 (r349846) @@ -1212,7 +1212,7 @@ next_page: if (tm->valid != VM_PAGE_BITS_ALL) goto next_pindex; vm_page_lock(tm); - if (vm_page_held(tm)) { + if (vm_page_wired(tm)) { vm_page_unlock(tm); goto next_pindex; } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/vm/vm_page.c Mon Jul 8 19:46:20 2019 (r349846) @@ -431,8 +431,7 @@ sysctl_vm_page_blacklist(SYSCTL_HANDLER_ARGS) /* * Initialize a dummy page for use in scans of the specified paging queue. * In principle, this function only needs to set the flag PG_MARKER. - * Nonetheless, it write busies and initializes the hold count to one as - * safety precautions. + * Nonetheless, it write busies the page as a safety precaution. */ static void vm_page_init_marker(vm_page_t marker, int queue, uint8_t aflags) @@ -443,7 +442,6 @@ vm_page_init_marker(vm_page_t marker, int queue, uint8 marker->aflags = aflags; marker->busy_lock = VPB_SINGLE_EXCLUSIVER; marker->queue = queue; - marker->hold_count = 1; } static void @@ -513,7 +511,6 @@ vm_page_init_page(vm_page_t m, vm_paddr_t pa, int segi m->object = NULL; m->wire_count = 0; m->busy_lock = VPB_UNBUSIED; - m->hold_count = 0; m->flags = m->aflags = 0; m->phys_addr = pa; m->queue = PQ_NONE; @@ -1096,31 +1093,6 @@ vm_page_change_lock(vm_page_t m, struct mtx **mtx) } /* - * Keep page from being freed by the page daemon - * much of the same effect as wiring, except much lower - * overhead and should be used only for *very* temporary - * holding ("wiring"). - */ -void -vm_page_hold(vm_page_t mem) -{ - - vm_page_lock_assert(mem, MA_OWNED); - mem->hold_count++; -} - -void -vm_page_unhold(vm_page_t mem) -{ - - vm_page_lock_assert(mem, MA_OWNED); - KASSERT(mem->hold_count >= 1, ("vm_page_unhold: hold count < 0!!!")); - --mem->hold_count; - if (mem->hold_count == 0 && (mem->flags & PG_UNHOLDFREE) != 0) - vm_page_free_toq(mem); -} - -/* * vm_page_unhold_pages: * * Unhold each of the pages that is referenced by the given array. @@ -1133,7 +1105,8 @@ vm_page_unhold_pages(vm_page_t *ma, int count) mtx = NULL; for (; count != 0; count--) { vm_page_change_lock(*ma, &mtx); - vm_page_unhold(*ma); + if (vm_page_unwire(*ma, PQ_ACTIVE) && (*ma)->object == NULL) + vm_page_free(*ma); ma++; } if (mtx != NULL) @@ -1595,7 +1568,7 @@ vm_page_replace(vm_page_t mnew, vm_object_t object, vm VM_OBJECT_ASSERT_WLOCKED(object); KASSERT(mnew->object == NULL, ("vm_page_replace: page %p already in object", mnew)); - KASSERT(mnew->queue == PQ_NONE, + KASSERT(mnew->queue == PQ_NONE || vm_page_wired(mnew), ("vm_page_replace: new page %p is on a paging queue", mnew)); /* @@ -2143,7 +2116,7 @@ vm_page_alloc_check(vm_page_t m) KASSERT(m->queue == PQ_NONE && (m->aflags & PGA_QUEUE_STATE_MASK) == 0, ("page %p has unexpected queue %d, flags %#x", m, m->queue, (m->aflags & PGA_QUEUE_STATE_MASK))); - KASSERT(!vm_page_held(m), ("page %p is held", m)); + KASSERT(!vm_page_wired(m), ("page %p is wired", m)); KASSERT(!vm_page_busied(m), ("page %p is busy", m)); KASSERT(m->dirty == 0, ("page %p is dirty", m)); KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, @@ -2350,7 +2323,7 @@ vm_page_scan_contig(u_long npages, vm_page_t m_start, vm_page_change_lock(m, &m_mtx); m_inc = 1; retry: - if (vm_page_held(m)) + if (vm_page_wired(m)) run_ext = 0; #if VM_NRESERVLEVEL > 0 else if ((level = vm_reserv_level(m)) >= 0 && @@ -2378,13 +2351,11 @@ retry: */ VM_OBJECT_RUNLOCK(object); goto retry; - } else if (vm_page_held(m)) { + } else if (vm_page_wired(m)) { run_ext = 0; goto unlock; } } - KASSERT((m->flags & PG_UNHOLDFREE) == 0, - ("page %p is PG_UNHOLDFREE", m)); /* Don't care: PG_NODUMP, PG_ZERO. */ if (object->type != OBJT_DEFAULT && object->type != OBJT_SWAP && @@ -2520,7 +2491,7 @@ vm_page_reclaim_run(int req_class, int domain, u_long */ vm_page_change_lock(m, &m_mtx); retry: - if (vm_page_held(m)) + if (vm_page_wired(m)) error = EBUSY; else if ((object = m->object) != NULL) { /* @@ -2537,13 +2508,11 @@ retry: */ VM_OBJECT_WUNLOCK(object); goto retry; - } else if (vm_page_held(m)) { + } else if (vm_page_wired(m)) { error = EBUSY; goto unlock; } } - KASSERT((m->flags & PG_UNHOLDFREE) == 0, - ("page %p is PG_UNHOLDFREE", m)); /* Don't care: PG_NODUMP, PG_ZERO. */ if (object->type != OBJT_DEFAULT && object->type != OBJT_SWAP && @@ -3476,13 +3445,6 @@ vm_page_free_prep(vm_page_t m) if (vm_page_wired(m) != 0) panic("vm_page_free_prep: freeing wired page %p", m); - if (m->hold_count != 0) { - m->flags &= ~PG_ZERO; - KASSERT((m->flags & PG_UNHOLDFREE) == 0, - ("vm_page_free_prep: freeing PG_UNHOLDFREE page %p", m)); - m->flags |= PG_UNHOLDFREE; - return (false); - } /* * Restore the default memory attribute to the page. @@ -3799,7 +3761,7 @@ vm_page_try_to_free(vm_page_t m) vm_page_assert_locked(m); VM_OBJECT_ASSERT_WLOCKED(m->object); KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("page %p is unmanaged", m)); - if (m->dirty != 0 || vm_page_held(m) || vm_page_busied(m)) + if (m->dirty != 0 || vm_page_wired(m) || vm_page_busied(m)) return (false); if (m->object->ref_count != 0) { pmap_remove_all(m); @@ -4539,10 +4501,10 @@ DB_SHOW_COMMAND(pginfo, vm_page_print_pginfo) else m = (vm_page_t)addr; db_printf( - "page %p obj %p pidx 0x%jx phys 0x%jx q %d hold %d wire %d\n" + "page %p obj %p pidx 0x%jx phys 0x%jx q %d wire %d\n" " af 0x%x of 0x%x f 0x%x act %d busy %x valid 0x%x dirty 0x%x\n", m, m->object, (uintmax_t)m->pindex, (uintmax_t)m->phys_addr, - m->queue, m->hold_count, m->wire_count, m->aflags, m->oflags, + m->queue, m->wire_count, m->aflags, m->oflags, m->flags, m->act_count, m->busy_lock, m->valid, m->dirty); } #endif /* DDB */ Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/vm/vm_page.h Mon Jul 8 19:46:20 2019 (r349846) @@ -204,15 +204,14 @@ struct vm_page { struct md_page md; /* machine dependent stuff */ u_int wire_count; /* wired down maps refs (P) */ volatile u_int busy_lock; /* busy owners lock */ - uint16_t hold_count; /* page hold count (P) */ uint16_t flags; /* page PG_* flags (P) */ + uint8_t order; /* index of the buddy queue (F) */ + uint8_t pool; /* vm_phys freepool index (F) */ uint8_t aflags; /* access is atomic */ uint8_t oflags; /* page VPO_* flags (O) */ uint8_t queue; /* page queue index (Q) */ int8_t psind; /* pagesizes[] index (O) */ int8_t segind; /* vm_phys segment index (C) */ - uint8_t order; /* index of the buddy queue (F) */ - uint8_t pool; /* vm_phys freepool index (F) */ u_char act_count; /* page usage count (P) */ /* NOTE that these must support one bit per DEV_BSIZE in a page */ /* so, on normal X86 kernels, they must be at least 8 bits wide */ @@ -388,7 +387,6 @@ extern struct mtx_padalign pa_lock[]; #define PG_ZERO 0x0008 /* page is zeroed */ #define PG_MARKER 0x0010 /* special queue marker page */ #define PG_NODUMP 0x0080 /* don't include this page in a dump */ -#define PG_UNHOLDFREE 0x0100 /* delayed free of a held page */ /* * Misc constants. @@ -516,8 +514,6 @@ malloc2vm_flags(int malloc_flags) void vm_page_busy_downgrade(vm_page_t m); void vm_page_busy_sleep(vm_page_t m, const char *msg, bool nonshared); void vm_page_flash(vm_page_t m); -void vm_page_hold(vm_page_t mem); -void vm_page_unhold(vm_page_t mem); void vm_page_free(vm_page_t m); void vm_page_free_zero(vm_page_t m); @@ -816,17 +812,10 @@ vm_page_in_laundry(vm_page_t m) } /* - * vm_page_held: + * vm_page_wired: * * Return true if a reference prevents the page from being reclaimable. */ -static inline bool -vm_page_held(vm_page_t m) -{ - - return (m->hold_count > 0 || m->wire_count > 0); -} - static inline bool vm_page_wired(vm_page_t m) { Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/vm/vm_pageout.c Mon Jul 8 19:46:20 2019 (r349846) @@ -334,7 +334,7 @@ vm_pageout_cluster(vm_page_t m) pindex = m->pindex; vm_page_assert_unbusied(m); - KASSERT(!vm_page_held(m), ("page %p is held", m)); + KASSERT(!vm_page_wired(m), ("page %p is wired", m)); pmap_remove_write(m); vm_page_unlock(m); @@ -373,7 +373,7 @@ more: break; } vm_page_lock(p); - if (vm_page_held(p) || !vm_page_in_laundry(p)) { + if (vm_page_wired(p) || !vm_page_in_laundry(p)) { vm_page_unlock(p); ib = 0; break; @@ -399,7 +399,7 @@ more: if (p->dirty == 0) break; vm_page_lock(p); - if (vm_page_held(p) || !vm_page_in_laundry(p)) { + if (vm_page_wired(p) || !vm_page_in_laundry(p)) { vm_page_unlock(p); break; } @@ -651,7 +651,7 @@ vm_pageout_clean(vm_page_t m, int *numpagedout) * The page may have been busied or referenced while the object * and page locks were released. */ - if (vm_page_busied(m) || vm_page_held(m)) { + if (vm_page_busied(m) || vm_page_wired(m)) { vm_page_unlock(m); error = EBUSY; goto unlock_all; @@ -747,14 +747,10 @@ recheck: } /* - * Held pages are essentially stuck in the queue. - * * Wired pages may not be freed. Complete their removal * from the queue now to avoid needless revisits during * future scans. */ - if (m->hold_count != 0) - continue; if (vm_page_wired(m)) { vm_page_dequeue_deferred(m); continue; @@ -1419,18 +1415,10 @@ recheck: goto reinsert; /* - * Held pages are essentially stuck in the queue. So, - * they ought to be discounted from the inactive count. - * See the description of addl_page_shortage above. - * * Wired pages may not be freed. Complete their removal * from the queue now to avoid needless revisits during * future scans. */ - if (m->hold_count != 0) { - addl_page_shortage++; - goto reinsert; - } if (vm_page_wired(m)) { vm_page_dequeue_deferred(m); continue; Modified: head/sys/vm/vm_swapout.c ============================================================================== --- head/sys/vm/vm_swapout.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/vm/vm_swapout.c Mon Jul 8 19:46:20 2019 (r349846) @@ -212,7 +212,7 @@ vm_swapout_object_deactivate_pages(pmap_t pmap, vm_obj continue; VM_CNT_INC(v_pdpages); vm_page_lock(p); - if (vm_page_held(p) || + if (vm_page_wired(p) || !pmap_page_exists_quick(pmap, p)) { vm_page_unlock(p); continue; From owner-svn-src-head@freebsd.org Mon Jul 8 19:59:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4E5015E8614; Mon, 8 Jul 2019 19:59:16 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6BB5089312; Mon, 8 Jul 2019 19:59:16 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EBB6C1D22A; Mon, 8 Jul 2019 19:59:15 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68JxFwb089686; Mon, 8 Jul 2019 19:59:15 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68JxF4u089685; Mon, 8 Jul 2019 19:59:15 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201907081959.x68JxF4u089685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Mon, 8 Jul 2019 19:59:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349847 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 349847 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6BB5089312 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 19:59:16 -0000 Author: lwhsu Date: Mon Jul 8 19:59:15 2019 New Revision: 349847 URL: https://svnweb.freebsd.org/changeset/base/349847 Log: Fix gcc build for cxgbe(4) Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20879 Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Mon Jul 8 19:46:20 2019 (r349846) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Mon Jul 8 19:59:15 2019 (r349847) @@ -1985,7 +1985,7 @@ alloc_aiotx_mbuf(struct kaiocb *job, int len) last = NULL; while (len > 0) { mlen = imin(len, MBUF_PEXT_MAX_PGS * PAGE_SIZE - pgoff); - KASSERT(mlen == len || (start + mlen & PAGE_MASK) == 0, + KASSERT(mlen == len || ((start + mlen) & PAGE_MASK) == 0, ("%s: next start (%#jx + %#x) is not page aligned", __func__, (uintmax_t)start, mlen)); From owner-svn-src-head@freebsd.org Mon Jul 8 20:01:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7789415E87F3; Mon, 8 Jul 2019 20:01:29 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1DD0F896BC; Mon, 8 Jul 2019 20:01:29 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BFF691D379; Mon, 8 Jul 2019 20:01:28 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68K1Sa6090668; Mon, 8 Jul 2019 20:01:28 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68K1SM6090667; Mon, 8 Jul 2019 20:01:28 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201907082001.x68K1SM6090667@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Mon, 8 Jul 2019 20:01:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349848 - head/sys/dev/superio X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/sys/dev/superio X-SVN-Commit-Revision: 349848 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1DD0F896BC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 20:01:29 -0000 Author: lwhsu Date: Mon Jul 8 20:01:28 2019 New Revision: 349848 URL: https://svnweb.freebsd.org/changeset/base/349848 Log: - Fix gcc build for superio(4) - Change string mapping of SUPERIO_DEV_NONE to distinguish from SUPERIO_DEV_MAX Reviewed by: imp Discussed with: avg, imp, jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20880 Modified: head/sys/dev/superio/superio.c Modified: head/sys/dev/superio/superio.c ============================================================================== --- head/sys/dev/superio/superio.c Mon Jul 8 19:59:15 2019 (r349847) +++ head/sys/dev/superio/superio.c Mon Jul 8 20:01:28 2019 (r349848) @@ -405,7 +405,7 @@ devtype_to_str(superio_dev_type_t type) { switch (type) { case SUPERIO_DEV_NONE: - return ("invalid"); + return ("none"); case SUPERIO_DEV_HWM: return ("HWM"); case SUPERIO_DEV_WDT: @@ -415,6 +415,7 @@ devtype_to_str(superio_dev_type_t type) case SUPERIO_DEV_MAX: return ("invalid"); } + return ("invalid"); } static int From owner-svn-src-head@freebsd.org Mon Jul 8 20:20:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3ADE215E8C72; Mon, 8 Jul 2019 20:20:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D4FEC8A444; Mon, 8 Jul 2019 20:20:03 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEC6B1D577; Mon, 8 Jul 2019 20:20:03 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68KK3in000437; Mon, 8 Jul 2019 20:20:03 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68KK2WE000426; Mon, 8 Jul 2019 20:20:02 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907082020.x68KK2WE000426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 8 Jul 2019 20:20:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349849 - in head/sys/dev: mpr mps X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/dev: mpr mps X-SVN-Commit-Revision: 349849 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D4FEC8A444 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 20:20:04 -0000 Author: imp Date: Mon Jul 8 20:20:01 2019 New Revision: 349849 URL: https://svnweb.freebsd.org/changeset/base/349849 Log: Fix bugs in recovery path and improve cm tracking Eliminate the TIMEDOUT state. This state really conveyed two different concepts: I timed out during recovery (and my command got put on the recovery queue), and I timed out diring discovery (which doesn't). Separate those two concepts into two flags. Use the TIMEDOUT flag to fail requests as timed out. Use the on queue flag to remove them from the queue. In mps_intr_locked for MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY message type, when completing commands, ignore the ones that are not in state INQUEUE. They were already completed as part of the recovery process. When we complete them twice, we wind up with entries on the free queue that are marked as busy, trigging asserts. Reviewed by: scottl (earlier version, just for mpr) Differential Revision: https://reviews.freebsd.org/D20785 Modified: head/sys/dev/mpr/mpr.c head/sys/dev/mpr/mpr_sas.c head/sys/dev/mpr/mpr_sas_lsi.c head/sys/dev/mpr/mprvar.h head/sys/dev/mps/mps.c head/sys/dev/mps/mps_sas.c head/sys/dev/mps/mps_sas_lsi.c head/sys/dev/mps/mpsvar.h Modified: head/sys/dev/mpr/mpr.c ============================================================================== --- head/sys/dev/mpr/mpr.c Mon Jul 8 20:01:28 2019 (r349848) +++ head/sys/dev/mpr/mpr.c Mon Jul 8 20:20:01 2019 (r349849) @@ -2617,12 +2617,17 @@ mpr_intr_locked(void *data) } else { cm = &sc->commands[ le16toh(desc->AddressReply.SMID)]; - if (cm->cm_state != MPR_CM_STATE_TIMEDOUT) - cm->cm_state = MPR_CM_STATE_BUSY; - cm->cm_reply = reply; - cm->cm_reply_data = - le32toh(desc->AddressReply. - ReplyFrameAddress); + if (cm->cm_state == MPR_CM_STATE_INQUEUE) { + cm->cm_reply = reply; + cm->cm_reply_data = + le32toh(desc->AddressReply. + ReplyFrameAddress); + } else { + mpr_dprint(sc, MPR_RECOVERY, + "Bad state for ADDRESS_REPLY status," + " ignoring state %d cm %p\n", + cm->cm_state, cm); + } } break; } Modified: head/sys/dev/mpr/mpr_sas.c ============================================================================== --- head/sys/dev/mpr/mpr_sas.c Mon Jul 8 20:01:28 2019 (r349848) +++ head/sys/dev/mpr/mpr_sas.c Mon Jul 8 20:20:01 2019 (r349849) @@ -1692,7 +1692,7 @@ mprsas_scsiio_timeout(void *data) * and been re-used, though this is unlikely. */ mpr_intr_locked(sc); - if (cm->cm_state != MPR_CM_STATE_INQUEUE) { + if (cm->cm_flags & MPR_CM_FLAGS_ON_RECOVERY) { mprsas_log_command(cm, MPR_XINFO, "SCSI command %p almost timed out\n", cm); return; @@ -1721,7 +1721,7 @@ mprsas_scsiio_timeout(void *data) * operational. if not, do a diag reset. */ mprsas_set_ccbstatus(cm->cm_ccb, CAM_CMD_TIMEOUT); - cm->cm_state = MPR_CM_STATE_TIMEDOUT; + cm->cm_flags |= MPR_CM_FLAGS_ON_RECOVERY | MPR_CM_FLAGS_TIMEDOUT; TAILQ_INSERT_TAIL(&targ->timedout_commands, cm, cm_recovery); if (targ->tm != NULL) { @@ -2529,9 +2529,11 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mp TAILQ_REMOVE(&cm->cm_targ->commands, cm, cm_link); ccb->ccb_h.status &= ~(CAM_STATUS_MASK | CAM_SIM_QUEUED); - if (cm->cm_state == MPR_CM_STATE_TIMEDOUT) { + if (cm->cm_flags & MPR_CM_FLAGS_ON_RECOVERY) { TAILQ_REMOVE(&cm->cm_targ->timedout_commands, cm, cm_recovery); - cm->cm_state = MPR_CM_STATE_BUSY; + KASSERT(cm->cm_state == MPR_CM_STATE_BUSY, + ("Not busy for CM_FLAGS_TIMEDOUT: %d\n", cm->cm_state)); + cm->cm_flags &= ~MPR_CM_FLAGS_ON_RECOVERY; if (cm->cm_reply != NULL) mprsas_log_command(cm, MPR_RECOVERY, "completed timedout cm %p ccb %p during recovery " @@ -2817,7 +2819,7 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mp * retry counter), the only difference is what gets printed * on the console. */ - if (cm->cm_state == MPR_CM_STATE_TIMEDOUT) + if (cm->cm_flags & MPR_CM_FLAGS_TIMEDOUT) mprsas_set_ccbstatus(ccb, CAM_CMD_TIMEOUT); else mprsas_set_ccbstatus(ccb, CAM_REQ_ABORTED); Modified: head/sys/dev/mpr/mpr_sas_lsi.c ============================================================================== --- head/sys/dev/mpr/mpr_sas_lsi.c Mon Jul 8 20:01:28 2019 (r349848) +++ head/sys/dev/mpr/mpr_sas_lsi.c Mon Jul 8 20:20:01 2019 (r349849) @@ -1017,7 +1017,7 @@ mprsas_add_device(struct mpr_softc *sc, u16 handle, u8 cm = &sc->commands[i]; if (cm->cm_flags & MPR_CM_FLAGS_SATA_ID_TIMEOUT) { targ->timeouts++; - cm->cm_state = MPR_CM_STATE_TIMEDOUT; + cm->cm_flags |= MPR_CM_FLAGS_TIMEDOUT; if ((targ->tm = mprsas_alloc_tm(sc)) != NULL) { mpr_dprint(sc, MPR_INFO, "%s: sending Target " @@ -1244,9 +1244,11 @@ mprsas_ata_id_timeout(struct mpr_softc *sc, struct mpr /* * The Abort Task cannot be sent from here because the driver has not * completed setting up targets. Instead, the command is flagged so - * that special handling will be used to send the abort. + * that special handling will be used to send the abort. Now that + * this command has timed out, it's no longer in the queue. */ cm->cm_flags |= MPR_CM_FLAGS_SATA_ID_TIMEOUT; + cm->cm_state = MPR_CM_STATE_BUSY; } static int Modified: head/sys/dev/mpr/mprvar.h ============================================================================== --- head/sys/dev/mpr/mprvar.h Mon Jul 8 20:01:28 2019 (r349848) +++ head/sys/dev/mpr/mprvar.h Mon Jul 8 20:20:01 2019 (r349849) @@ -275,11 +275,12 @@ struct mpr_command { #define MPR_CM_FLAGS_ERROR_MASK MPR_CM_FLAGS_CHAIN_FAILED #define MPR_CM_FLAGS_USE_CCB (1 << 9) #define MPR_CM_FLAGS_SATA_ID_TIMEOUT (1 << 10) +#define MPR_CM_FLAGS_ON_RECOVERY (1 << 12) +#define MPR_CM_FLAGS_TIMEDOUT (1 << 13) u_int cm_state; #define MPR_CM_STATE_FREE 0 #define MPR_CM_STATE_BUSY 1 -#define MPR_CM_STATE_TIMEDOUT 2 -#define MPR_CM_STATE_INQUEUE 3 +#define MPR_CM_STATE_INQUEUE 2 bus_dmamap_t cm_dmamap; struct scsi_sense_data *cm_sense; uint64_t *nvme_error_response; Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Mon Jul 8 20:01:28 2019 (r349848) +++ head/sys/dev/mps/mps.c Mon Jul 8 20:20:01 2019 (r349849) @@ -2479,13 +2479,24 @@ mps_intr_locked(void *data) (MPI2_EVENT_NOTIFICATION_REPLY *) reply); } else { + /* + * Ignore commands not in INQUEUE state + * since they've already been completed + * via another path. + */ cm = &sc->commands[ le16toh(desc->AddressReply.SMID)]; - if (cm->cm_state != MPS_CM_STATE_TIMEDOUT) + if (cm->cm_state == MPS_CM_STATE_INQUEUE) { cm->cm_state = MPS_CM_STATE_BUSY; - cm->cm_reply = reply; - cm->cm_reply_data = le32toh( - desc->AddressReply.ReplyFrameAddress); + cm->cm_reply = reply; + cm->cm_reply_data = le32toh( + desc->AddressReply.ReplyFrameAddress); + } else { + mps_dprint(sc, MPS_RECOVERY, + "Bad state for ADDRESS_REPLY status," + " ignoring state %d cm %p\n", + cm->cm_state, cm); + } } break; } Modified: head/sys/dev/mps/mps_sas.c ============================================================================== --- head/sys/dev/mps/mps_sas.c Mon Jul 8 20:01:28 2019 (r349848) +++ head/sys/dev/mps/mps_sas.c Mon Jul 8 20:20:01 2019 (r349849) @@ -1602,7 +1602,7 @@ mpssas_scsiio_timeout(void *data) * and been re-used, though this is unlikely. */ mps_intr_locked(sc); - if (cm->cm_state != MPS_CM_STATE_INQUEUE) { + if (cm->cm_flags & MPS_CM_FLAGS_ON_RECOVERY) { mpssas_log_command(cm, MPS_XINFO, "SCSI command %p almost timed out\n", cm); return; @@ -1626,7 +1626,7 @@ mpssas_scsiio_timeout(void *data) * operational. if not, do a diag reset. */ mpssas_set_ccbstatus(cm->cm_ccb, CAM_CMD_TIMEOUT); - cm->cm_state = MPS_CM_STATE_TIMEDOUT; + cm->cm_flags |= MPS_CM_FLAGS_ON_RECOVERY | MPS_CM_FLAGS_TIMEDOUT; TAILQ_INSERT_TAIL(&targ->timedout_commands, cm, cm_recovery); if (targ->tm != NULL) { @@ -2040,9 +2040,11 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mp biotrack(ccb->csio.bio, __func__); #endif - if (cm->cm_state == MPS_CM_STATE_TIMEDOUT) { + if (cm->cm_flags & MPS_CM_FLAGS_ON_RECOVERY) { TAILQ_REMOVE(&cm->cm_targ->timedout_commands, cm, cm_recovery); - cm->cm_state = MPS_CM_STATE_BUSY; + KASSERT(cm->cm_state == MPS_CM_STATE_BUSY, + ("Not busy for CM_FLAGS_TIMEDOUT: %d\n", cm->cm_state)); + cm->cm_flags &= ~MPS_CM_FLAGS_ON_RECOVERY; if (cm->cm_reply != NULL) mpssas_log_command(cm, MPS_RECOVERY, "completed timedout cm %p ccb %p during recovery " @@ -2325,7 +2327,7 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mp * retry counter), the only difference is what gets printed * on the console. */ - if (cm->cm_state == MPS_CM_STATE_TIMEDOUT) + if (cm->cm_flags & MPS_CM_FLAGS_TIMEDOUT) mpssas_set_ccbstatus(ccb, CAM_CMD_TIMEOUT); else mpssas_set_ccbstatus(ccb, CAM_REQ_ABORTED); Modified: head/sys/dev/mps/mps_sas_lsi.c ============================================================================== --- head/sys/dev/mps/mps_sas_lsi.c Mon Jul 8 20:01:28 2019 (r349848) +++ head/sys/dev/mps/mps_sas_lsi.c Mon Jul 8 20:20:01 2019 (r349849) @@ -790,7 +790,7 @@ mpssas_add_device(struct mps_softc *sc, u16 handle, u8 cm = &sc->commands[i]; if (cm->cm_flags & MPS_CM_FLAGS_SATA_ID_TIMEOUT) { targ->timeouts++; - cm->cm_state = MPS_CM_STATE_TIMEDOUT; + cm->cm_flags |= MPS_CM_FLAGS_TIMEDOUT; if ((targ->tm = mpssas_alloc_tm(sc)) != NULL) { mps_dprint(sc, MPS_INFO, "%s: sending Target " @@ -1017,9 +1017,11 @@ mpssas_ata_id_timeout(struct mps_softc *sc, struct mps /* * The Abort Task cannot be sent from here because the driver has not * completed setting up targets. Instead, the command is flagged so - * that special handling will be used to send the abort. + * that special handling will be used to send the abort. Now that + * this command has timed out, it's no longer in the queue. */ cm->cm_flags |= MPS_CM_FLAGS_SATA_ID_TIMEOUT; + cm->cm_state = MPS_CM_STATE_BUSY; } static int Modified: head/sys/dev/mps/mpsvar.h ============================================================================== --- head/sys/dev/mps/mpsvar.h Mon Jul 8 20:01:28 2019 (r349848) +++ head/sys/dev/mps/mpsvar.h Mon Jul 8 20:20:01 2019 (r349849) @@ -242,11 +242,12 @@ struct mps_command { #define MPS_CM_FLAGS_ERROR_MASK MPS_CM_FLAGS_CHAIN_FAILED #define MPS_CM_FLAGS_USE_CCB (1 << 10) #define MPS_CM_FLAGS_SATA_ID_TIMEOUT (1 << 11) +#define MPS_CM_FLAGS_ON_RECOVERY (1 << 12) +#define MPS_CM_FLAGS_TIMEDOUT (1 << 13) u_int cm_state; #define MPS_CM_STATE_FREE 0 #define MPS_CM_STATE_BUSY 1 -#define MPS_CM_STATE_TIMEDOUT 2 -#define MPS_CM_STATE_INQUEUE 3 +#define MPS_CM_STATE_INQUEUE 2 bus_dmamap_t cm_dmamap; struct scsi_sense_data *cm_sense; TAILQ_HEAD(, mps_chain) cm_chain_list; @@ -545,7 +546,8 @@ mps_free_command(struct mps_softc *sc, struct mps_comm { struct mps_chain *chain, *chain_temp; - KASSERT(cm->cm_state == MPS_CM_STATE_BUSY, ("state not busy\n")); + KASSERT(cm->cm_state == MPS_CM_STATE_BUSY, + ("state not busy: %d\n", cm->cm_state)); if (cm->cm_reply != NULL) mps_free_reply(sc, cm->cm_reply_data); @@ -581,7 +583,7 @@ mps_alloc_command(struct mps_softc *sc) return (NULL); KASSERT(cm->cm_state == MPS_CM_STATE_FREE, - ("mps: Allocating busy command\n")); + ("mps: Allocating busy command: %d\n", cm->cm_state)); TAILQ_REMOVE(&sc->req_list, cm, cm_link); cm->cm_state = MPS_CM_STATE_BUSY; @@ -594,7 +596,8 @@ mps_free_high_priority_command(struct mps_softc *sc, s { struct mps_chain *chain, *chain_temp; - KASSERT(cm->cm_state == MPS_CM_STATE_BUSY, ("state not busy\n")); + KASSERT(cm->cm_state == MPS_CM_STATE_BUSY, + ("state not busy: %d\n", cm->cm_state)); if (cm->cm_reply != NULL) mps_free_reply(sc, cm->cm_reply_data); @@ -623,7 +626,7 @@ mps_alloc_high_priority_command(struct mps_softc *sc) return (NULL); KASSERT(cm->cm_state == MPS_CM_STATE_FREE, - ("mps: Allocating busy command\n")); + ("mps: Allocating high priority busy command: %d\n", cm->cm_state)); TAILQ_REMOVE(&sc->high_priority_req_list, cm, cm_link); cm->cm_state = MPS_CM_STATE_BUSY; From owner-svn-src-head@freebsd.org Mon Jul 8 20:26:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8355315E8F24; Mon, 8 Jul 2019 20:26:58 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D17618AA65; Mon, 8 Jul 2019 20:26:57 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F01A1D73A; Mon, 8 Jul 2019 20:26:57 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68KQvaY005336; Mon, 8 Jul 2019 20:26:57 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68KQvAL005334; Mon, 8 Jul 2019 20:26:57 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907082026.x68KQvAL005334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 8 Jul 2019 20:26:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349850 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 349850 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D17618AA65 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 20:26:58 -0000 Author: ian Date: Mon Jul 8 20:26:56 2019 New Revision: 349850 URL: https://svnweb.freebsd.org/changeset/base/349850 Log: Restore the ability for i2c slave devices to do IO from their probe method. r348164 added code to iicbus_request_bus/iicbus_release_bus to automatically call device_busy()/device_unbusy() as part of aquiring exclusive use of the bus (so modules can't be unloaded while the bus is exclusively owned and/or IO is in progress). That broke the ability to do i2c IO from a slave device probe method, because the slave isn't attached yet, so calling device_busy() triggers a sanity-check panic for trying to busy a non-attached device. Now we check whether the device status is < DS_ATTACHING, and if so we busy the iicbus rather than the slave device. I think this leaves a small window where a module could be unloaded while probing is in progress. But I think that's true of all devices, and probably should be fixed by introducing a DS_PROBING state for devices, and handling that at various points in the newbus code. Modified: head/sys/dev/iicbus/iicbus.h head/sys/dev/iicbus/iiconf.c Modified: head/sys/dev/iicbus/iicbus.h ============================================================================== --- head/sys/dev/iicbus/iicbus.h Mon Jul 8 20:20:01 2019 (r349849) +++ head/sys/dev/iicbus/iicbus.h Mon Jul 8 20:26:56 2019 (r349850) @@ -41,6 +41,7 @@ struct iicbus_softc { device_t dev; /* Myself */ device_t owner; /* iicbus owner device structure */ + device_t busydev; /* iicbus_release_bus calls unbusy on this */ u_int owncount; /* iicbus ownership nesting count */ u_char started; /* address of the 'started' slave * 0 if no start condition succeeded */ Modified: head/sys/dev/iicbus/iiconf.c ============================================================================== --- head/sys/dev/iicbus/iiconf.c Mon Jul 8 20:20:01 2019 (r349849) +++ head/sys/dev/iicbus/iiconf.c Mon Jul 8 20:26:56 2019 (r349850) @@ -131,9 +131,15 @@ iicbus_request_bus(device_t bus, device_t dev, int how /* * Mark the device busy while it owns the bus, to * prevent detaching the device, bus, or hardware - * controller, until ownership is relinquished. + * controller, until ownership is relinquished. If the + * device is doing IO from its probe method before + * attaching, it cannot be busied; mark the bus busy. */ - device_busy(dev); + if (device_get_state(dev) < DS_ATTACHING) + sc->busydev = bus; + else + sc->busydev = dev; + device_busy(sc->busydev); /* * Drop the lock around the call to the bus driver, it * should be allowed to sleep in the IIC_WAIT case. @@ -150,7 +156,7 @@ iicbus_request_bus(device_t bus, device_t dev, int how sc->owner = NULL; sc->owncount = 0; wakeup_one(sc); - device_unbusy(dev); + device_unbusy(sc->busydev); } } } @@ -184,7 +190,7 @@ iicbus_release_bus(device_t bus, device_t dev) IICBUS_LOCK(sc); sc->owner = NULL; wakeup_one(sc); - device_unbusy(dev); + device_unbusy(sc->busydev); } IICBUS_UNLOCK(sc); return (0); From owner-svn-src-head@freebsd.org Mon Jul 8 20:53:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 626DA15E9999; Mon, 8 Jul 2019 20:53:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 03F518BC91; Mon, 8 Jul 2019 20:53:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DEE551DC1D; Mon, 8 Jul 2019 20:53:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68KrQx1020653; Mon, 8 Jul 2019 20:53:26 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68KrPtm020649; Mon, 8 Jul 2019 20:53:25 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201907082053.x68KrPtm020649@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 8 Jul 2019 20:53:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349851 - in head/sys: conf dev/usb modules/usb modules/usb/uacpi modules/usb/usb X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: conf dev/usb modules/usb modules/usb/uacpi modules/usb/usb X-SVN-Commit-Revision: 349851 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 03F518BC91 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 20:53:27 -0000 Author: hselasky Date: Mon Jul 8 20:53:25 2019 New Revision: 349851 URL: https://svnweb.freebsd.org/changeset/base/349851 Log: Put USB ACPI code into own module, uacpi.ko. The code needs more testing before being enabled by default. Sponsored by: Mellanox Technologies Added: head/sys/modules/usb/uacpi/ head/sys/modules/usb/uacpi/Makefile (contents, props changed) Modified: head/sys/conf/files head/sys/dev/usb/usb_hub_acpi.c head/sys/modules/usb/Makefile head/sys/modules/usb/usb/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Jul 8 20:26:56 2019 (r349850) +++ head/sys/conf/files Mon Jul 8 20:53:25 2019 (r349851) @@ -3221,7 +3221,7 @@ dev/usb/usb_generic.c optional usb dev/usb/usb_handle_request.c optional usb dev/usb/usb_hid.c optional usb dev/usb/usb_hub.c optional usb -dev/usb/usb_hub_acpi.c optional usb acpi +dev/usb/usb_hub_acpi.c optional uacpi acpi dev/usb/usb_if.m optional usb dev/usb/usb_lookup.c optional usb dev/usb/usb_mbuf.c optional usb Modified: head/sys/dev/usb/usb_hub_acpi.c ============================================================================== --- head/sys/dev/usb/usb_hub_acpi.c Mon Jul 8 20:26:56 2019 (r349850) +++ head/sys/dev/usb/usb_hub_acpi.c Mon Jul 8 20:53:25 2019 (r349851) @@ -440,6 +440,10 @@ static driver_t acpi_uhub_root_driver = { .baseclasses = uhub_baseclasses, }; -DRIVER_MODULE(acpi_uhub, uhub, acpi_uhub_driver, uhub_devclass, 0, 0); -MODULE_DEPEND(acpi_uhub, acpi, 1, 1, 1); -DRIVER_MODULE(acpi_uhub, usbus, acpi_uhub_root_driver, uhub_devclass, 0, 0); +DRIVER_MODULE(uacpi, uhub, acpi_uhub_driver, uhub_devclass, 0, 0); +DRIVER_MODULE(uacpi, usbus, acpi_uhub_root_driver, uhub_devclass, 0, 0); + +MODULE_DEPEND(uacpi, acpi, 1, 1, 1); +MODULE_DEPEND(uacpi, usb, 1, 1, 1); + +MODULE_VERSION(uacpi, 1); Modified: head/sys/modules/usb/Makefile ============================================================================== --- head/sys/modules/usb/Makefile Mon Jul 8 20:26:56 2019 (r349850) +++ head/sys/modules/usb/Makefile Mon Jul 8 20:53:25 2019 (r349851) @@ -55,6 +55,7 @@ SUBDIR += uether aue axe axge cdce cue ${_kue} mos rue SUBDIR += muge SUBDIR += ure urndis SUBDIR += usfs umass urio +SUBDIR += ${_uacpi} SUBDIR += quirk template SUBDIR += ${_g_audio} ${_g_keyboard} ${_g_modem} ${_g_mouse} @@ -100,6 +101,11 @@ _avr32dci= avr32dci .if ${MACHINE_CPUARCH} == "mips" _saf1761otg= saf1761otg +.endif + +.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ + ${MACHINE_CPUARCH} == "i386" +_uacpi= uacpi .endif .include Added: head/sys/modules/usb/uacpi/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/usb/uacpi/Makefile Mon Jul 8 20:53:25 2019 (r349851) @@ -0,0 +1,36 @@ +# +# $FreeBSD$ +# +# Copyright (c) 2019 Hans Petter Selasky. 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. +# + +.PATH: ${SRCTOP}/sys/dev/usb + +KMOD= uacpi +SRCS= bus_if.h device_if.h usb_if.h usb_if.c vnode_if.h \ + opt_usb.h opt_bus.h opt_ddb.h \ + opt_acpi.h acpi_if.h \ + usb_hub_acpi.c + +.include Modified: head/sys/modules/usb/usb/Makefile ============================================================================== --- head/sys/modules/usb/usb/Makefile Mon Jul 8 20:26:56 2019 (r349850) +++ head/sys/modules/usb/usb/Makefile Mon Jul 8 20:53:25 2019 (r349851) @@ -25,10 +25,8 @@ # SUCH DAMAGE. # -S= ${SRCTOP}/sys +.PATH: ${SRCTOP}/sys/dev/usb ${SRCTOP}/sys/dev/usb/controller -.PATH: $S/dev/usb $S/dev/usb/controller - KMOD= usb SRCS= bus_if.h device_if.h usb_if.h usb_if.c vnode_if.h \ opt_usb.h opt_bus.h opt_ddb.h \ @@ -38,11 +36,6 @@ SRCS= bus_if.h device_if.h usb_if.h usb_if.c vnode_if. usb_handle_request.c usb_hid.c usb_hub.c usb_lookup.c usb_mbuf.c \ usb_msctest.c usb_parse.c usb_pf.c usb_process.c usb_request.c \ usb_transfer.c usb_util.c - -.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ - ${MACHINE_CPUARCH} == "i386" -SRCS += opt_acpi.h usb_hub_acpi.c acpi_if.h -.endif .if !empty(OPT_FDT) SRCS+= usb_fdt_support.c ofw_bus_if.h From owner-svn-src-head@freebsd.org Mon Jul 8 22:20:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC04315EB088; Mon, 8 Jul 2019 22:20:26 +0000 (UTC) (envelope-from meta@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 70F068EE6B; Mon, 8 Jul 2019 22:20:26 +0000 (UTC) (envelope-from meta@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46DA31EA4A; Mon, 8 Jul 2019 22:20:26 +0000 (UTC) (envelope-from meta@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68MKQRO061859; Mon, 8 Jul 2019 22:20:26 GMT (envelope-from meta@FreeBSD.org) Received: (from meta@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68MKQri061858; Mon, 8 Jul 2019 22:20:26 GMT (envelope-from meta@FreeBSD.org) Message-Id: <201907082220.x68MKQri061858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: meta set sender to meta@FreeBSD.org using -f From: Koichiro Iwao Date: Mon, 8 Jul 2019 22:20:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349853 - head/usr.sbin/mld6query X-SVN-Group: head X-SVN-Commit-Author: meta X-SVN-Commit-Paths: head/usr.sbin/mld6query X-SVN-Commit-Revision: 349853 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 70F068EE6B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.935,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 22:20:27 -0000 Author: meta (ports committer) Date: Mon Jul 8 22:20:25 2019 New Revision: 349853 URL: https://svnweb.freebsd.org/changeset/base/349853 Log: mld6query: Fix typo s/linkocal/linklocal/ PR: 239039 Approved by: markj Modified: head/usr.sbin/mld6query/mld6.c Modified: head/usr.sbin/mld6query/mld6.c ============================================================================== --- head/usr.sbin/mld6query/mld6.c Mon Jul 8 21:33:14 2019 (r349852) +++ head/usr.sbin/mld6query/mld6.c Mon Jul 8 22:20:25 2019 (r349853) @@ -244,7 +244,7 @@ make_msg(int index, struct in6_addr *addr, u_int type, break; } if (ifap == NULL) - errx(1, "no linkocal address is available"); + errx(1, "no linklocal address is available"); memcpy(&src, &((struct sockaddr_in6 *)ifap->ifa_addr)->sin6_addr, sizeof(src)); freeifaddrs(ifa); From owner-svn-src-head@freebsd.org Tue Jul 9 07:24:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B8FE15D2501; Tue, 9 Jul 2019 07:24:20 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E6E7283D39; Tue, 9 Jul 2019 07:24:19 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4C4624777; Tue, 9 Jul 2019 07:24:19 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x697OJtn045858; Tue, 9 Jul 2019 07:24:19 GMT (envelope-from whu@FreeBSD.org) Received: (from whu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x697OIGR045853; Tue, 9 Jul 2019 07:24:18 GMT (envelope-from whu@FreeBSD.org) Message-Id: <201907090724.x697OIGR045853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: whu set sender to whu@FreeBSD.org using -f From: Wei Hu Date: Tue, 9 Jul 2019 07:24:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349856 - in head/sys/dev/hyperv: include netvsc vmbus X-SVN-Group: head X-SVN-Commit-Author: whu X-SVN-Commit-Paths: in head/sys/dev/hyperv: include netvsc vmbus X-SVN-Commit-Revision: 349856 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E6E7283D39 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.955,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 07:24:20 -0000 Author: whu Date: Tue Jul 9 07:24:18 2019 New Revision: 349856 URL: https://svnweb.freebsd.org/changeset/base/349856 Log: hyperv/vmbus: Update VMBus version 4.0 and 5.0 support. Add VMBus protocol version 4.0. and 5.0 to support Windows 10 and newer HyperV hosts. For VMBus 4.0 and newer HyperV, the netvsc gpadl teardown must be done after vmbus close. Submitted by: whu MFC after: 2 weeks Sponsored by: Microsoft Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/netvsc/hn_nvs.c head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Tue Jul 9 07:21:33 2019 (r349855) +++ head/sys/dev/hyperv/include/hyperv.h Tue Jul 9 07:24:18 2019 (r349856) @@ -94,6 +94,11 @@ extern hyperv_tc64_t hyperv_tc64; extern u_int hyperv_features; /* CPUID_HV_MSR_ */ extern u_int hyperv_ver_major; +/* + * Vmbus version after negotiation with host. + */ +extern uint32_t vmbus_current_version; + #endif /* _KERNEL */ #endif /* _HYPERV_H_ */ Modified: head/sys/dev/hyperv/include/vmbus.h ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Tue Jul 9 07:21:33 2019 (r349855) +++ head/sys/dev/hyperv/include/vmbus.h Tue Jul 9 07:24:18 2019 (r349856) @@ -40,11 +40,15 @@ * 1.1 -- Windows 7 * 2.4 -- Windows 8 * 3.0 -- Windows 8.1 + * 4.0 -- Windows 10 + * 5.0 -- Newer Windows 10 */ #define VMBUS_VERSION_WS2008 ((0 << 16) | (13)) #define VMBUS_VERSION_WIN7 ((1 << 16) | (1)) #define VMBUS_VERSION_WIN8 ((2 << 16) | (4)) #define VMBUS_VERSION_WIN8_1 ((3 << 16) | (0)) +#define VMBUS_VERSION_WIN10 ((4 << 16) | (0)) +#define VMBUS_VERSION_WIN10_V5 ((5 << 16) | (0)) #define VMBUS_VERSION_MAJOR(ver) (((uint32_t)(ver)) >> 16) #define VMBUS_VERSION_MINOR(ver) (((uint32_t)(ver)) & 0xffff) Modified: head/sys/dev/hyperv/netvsc/hn_nvs.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hn_nvs.c Tue Jul 9 07:21:33 2019 (r349855) +++ head/sys/dev/hyperv/netvsc/hn_nvs.c Tue Jul 9 07:24:18 2019 (r349856) @@ -365,7 +365,7 @@ hn_nvs_disconn_rxbuf(struct hn_softc *sc) pause("lingtx", (200 * hz) / 1000); } - if (sc->hn_rxbuf_gpadl != 0) { + if (vmbus_current_version < VMBUS_VERSION_WIN10 && sc->hn_rxbuf_gpadl != 0) { /* * Disconnect RXBUF from primary channel. */ @@ -426,7 +426,7 @@ hn_nvs_disconn_chim(struct hn_softc *sc) pause("lingtx", (200 * hz) / 1000); } - if (sc->hn_chim_gpadl != 0) { + if (vmbus_current_version < VMBUS_VERSION_WIN10 && sc->hn_chim_gpadl != 0) { /* * Disconnect chimney sending buffer from primary channel. */ Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Tue Jul 9 07:21:33 2019 (r349855) +++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Jul 9 07:24:18 2019 (r349856) @@ -6630,6 +6630,38 @@ hn_synth_detach(struct hn_softc *sc) /* Detach all of the channels. */ hn_detach_allchans(sc); + if (vmbus_current_version >= VMBUS_VERSION_WIN10 && sc->hn_rxbuf_gpadl != 0) { + /* + * Host is post-Win2016, disconnect RXBUF from primary channel here. + */ + int error; + + error = vmbus_chan_gpadl_disconnect(sc->hn_prichan, + sc->hn_rxbuf_gpadl); + if (error) { + if_printf(sc->hn_ifp, + "rxbuf gpadl disconn failed: %d\n", error); + sc->hn_flags |= HN_FLAG_RXBUF_REF; + } + sc->hn_rxbuf_gpadl = 0; + } + + if (vmbus_current_version >= VMBUS_VERSION_WIN10 && sc->hn_chim_gpadl != 0) { + /* + * Host is post-Win2016, disconnect chimney sending buffer from + * primary channel here. + */ + int error; + + error = vmbus_chan_gpadl_disconnect(sc->hn_prichan, + sc->hn_chim_gpadl); + if (error) { + if_printf(sc->hn_ifp, + "chim gpadl disconn failed: %d\n", error); + sc->hn_flags |= HN_FLAG_CHIM_REF; + } + sc->hn_chim_gpadl = 0; + } sc->hn_flags &= ~HN_FLAG_SYNTH_ATTACHED; } Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 9 07:21:33 2019 (r349855) +++ head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 9 07:24:18 2019 (r349856) @@ -138,7 +138,10 @@ SYSCTL_INT(_hw_vmbus, OID_AUTO, pin_evttask, CTLFLAG_R extern inthand_t IDTVEC(vmbus_isr), IDTVEC(vmbus_isr_pti); +uint32_t vmbus_current_version; + static const uint32_t vmbus_version[] = { + VMBUS_VERSION_WIN10, VMBUS_VERSION_WIN8_1, VMBUS_VERSION_WIN8, VMBUS_VERSION_WIN7, @@ -412,6 +415,7 @@ vmbus_init(struct vmbus_softc *sc) error = vmbus_connect(sc, vmbus_version[i]); if (!error) { + vmbus_current_version = vmbus_version[i]; sc->vmbus_version = vmbus_version[i]; device_printf(sc->vmbus_dev, "version %u.%u\n", VMBUS_VERSION_MAJOR(sc->vmbus_version), From owner-svn-src-head@freebsd.org Tue Jul 9 08:21:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B855F15D381A; Tue, 9 Jul 2019 08:21:15 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5AF9385B74; Tue, 9 Jul 2019 08:21:15 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 368B725135; Tue, 9 Jul 2019 08:21:15 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x698LF7J074061; Tue, 9 Jul 2019 08:21:15 GMT (envelope-from whu@FreeBSD.org) Received: (from whu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x698LFJS074060; Tue, 9 Jul 2019 08:21:15 GMT (envelope-from whu@FreeBSD.org) Message-Id: <201907090821.x698LFJS074060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: whu set sender to whu@FreeBSD.org using -f From: Wei Hu Date: Tue, 9 Jul 2019 08:21:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349857 - head/sys/dev/hyperv/netvsc X-SVN-Group: head X-SVN-Commit-Author: whu X-SVN-Commit-Paths: head/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 349857 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5AF9385B74 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.934,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 08:21:15 -0000 Author: whu Date: Tue Jul 9 08:21:14 2019 New Revision: 349857 URL: https://svnweb.freebsd.org/changeset/base/349857 Log: hyperv/vmbus: Fix the wrong size in ndis_offload structure Submitted by: whu MFC after: 2 weeks Sponsored by: Microsoft Modified: head/sys/dev/hyperv/netvsc/ndis.h Modified: head/sys/dev/hyperv/netvsc/ndis.h ============================================================================== --- head/sys/dev/hyperv/netvsc/ndis.h Tue Jul 9 07:24:18 2019 (r349856) +++ head/sys/dev/hyperv/netvsc/ndis.h Tue Jul 9 08:21:14 2019 (r349857) @@ -115,8 +115,8 @@ struct ndis_offload_params { /* NDIS >= 6.30 */ uint8_t ndis_rsc_ip4; /* NDIS_OFFLOAD_RSC_ */ uint8_t ndis_rsc_ip6; /* NDIS_OFFLOAD_RSC_ */ - uint8_t ndis_encap; /* NDIS_OFFLOAD_SET_ */ - uint8_t ndis_encap_types;/* NDIS_ENCAP_TYPE_ */ + uint32_t ndis_encap; /* NDIS_OFFLOAD_SET_ */ + uint32_t ndis_encap_types;/* NDIS_ENCAP_TYPE_ */ }; #define NDIS_OFFLOAD_PARAMS_SIZE sizeof(struct ndis_offload_params) From owner-svn-src-head@freebsd.org Tue Jul 9 15:48:09 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D9C215DD5EC; Tue, 9 Jul 2019 15:48:09 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id AA4DA6F1E4; Tue, 9 Jul 2019 15:48:08 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 8CF2714A4AB; Wed, 10 Jul 2019 01:47:55 +1000 (AEST) Date: Wed, 10 Jul 2019 01:47:53 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Scott Long cc: Bruce Evans , Doug Moore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349791 - head/sys/vm In-Reply-To: <4BC14FB0-F79B-48DA-98E1-40B20552EA11@samsco.org> Message-ID: <20190709235218.N1412@besplex.bde.org> References: <201907061555.x66FtGsg025314@repo.freebsd.org> <20190707023441.B2047@besplex.bde.org> <4BC14FB0-F79B-48DA-98E1-40B20552EA11@samsco.org> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=D+Q3ErZj c=1 sm=1 tr=0 cx=a_idp_d a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=nlC_4_pT8q9DhB4Ho9EA:9 a=q1NqS2nZEG050URDlaAA:9 a=PRXq6q6k_7zjf5kn:21 a=TWJIdX50S6YODk6M:21 a=45ClL6m2LaAA:10 X-Rspamd-Queue-Id: AA4DA6F1E4 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.93 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.933,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 15:48:09 -0000 On Mon, 8 Jul 2019, Scott Long wrote: > This isn=E2=80=99t the first time I=E2=80=99ve witnessed your passion on = this topic. It would > help immensely if there was some documentation, maybe in /sys/sys/param.h= , > or maybe even in a manual page, on what a =E2=80=9Cclick=E2=80=9D is, wha= t a =E2=80=9Cdb=E2=80=9D is, why > they=E2=80=99re important, and how they should be used. Do you have any > documentation tucked away that could be edited and committed? I don't have any extra documentation. I learned about clicks because Minix had them and actually used them in a nontrivial way (1 click =3D 16 bytes =3D real mode segment granularity, and 16-bit ints could could represent the final click address in the real-mode address space of 1MB but not the size of the whole address space). Mike Karels gave more details about this. PDP-11's had 64-bit clicks. I think this was also to extend the 16-bit address space in a less bad way that x86 real mode segments. Google says that NetBSD has dbtob(9). This is a link to ctod(9). This man page does little more than say "The ctod family of macros can be used to convert between bytes, pages (''clicks'') and disk blocks" and expand the abbreviations. 'c' is expanded to 'pages', and there are no documented macros where 'pages' is abbreviated to 'p'. The full list is: - ctod (spelled ctodb() in FreeBSD), - dtoc (similarly), - ctob, - btoc, - dbtob (same spelling as in FreeBSD). - btodb. One detail is interesting: that the macros make no assumption about the type of the input parameter (this is clearly wrong since signed types with negative values don't work when the implementation uses shifts, floating-point types are further from working, and non-arithmetic types can't work), and that the caller must ensure that integer overflow and integer underflow do not occur (here "integer underflow" is nonsense" -- it means integer overflow to a negative value). 4.4BSD-Lite2 has these macros with the NetBSD spellings, and also on i386, tahoe and vax: - ctos, stoc: core clicks to segments. All do the identity conversion. None are used on any arch. FreeBSD-1.0 has similar or the same macros as 4.4BSD-Lite2, including implementation and comments. FreeBSD-3 doesn't have ctos or stoc, and abbreviates 'disk block' to 'db' consistently, and improves some of the implementations and comments. FreeBSD-current is similar to FreeBSD-3, except most of the macros are now MI and it has lost better comments which were only in the alpha version. FreeBSD's actually documents most of these macros reasonably well in comments. It just uses different styles and random grouping. Only btodb and dbtob end up without a comment giving a hint about what b and db are. The comments for dbtoc and ctodb tell you that a db is a devblk and a c is a page. Other comments tell you that a c is a click. Bruce From owner-svn-src-head@freebsd.org Tue Jul 9 18:02:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC07715E08B0; Tue, 9 Jul 2019 18:02:42 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 579E775326; Tue, 9 Jul 2019 18:02:42 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCFD4339D; Tue, 9 Jul 2019 18:02:41 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69I2fxR076817; Tue, 9 Jul 2019 18:02:41 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69I2bWv076792; Tue, 9 Jul 2019 18:02:37 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201907091802.x69I2bWv076792@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Tue, 9 Jul 2019 18:02:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349863 - in head/sys/contrib/dev/acpica: . compiler components/dispatcher components/events components/executer components/namespace components/tables components/utilities include X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in head/sys/contrib/dev/acpica: . compiler components/dispatcher components/events components/executer components/namespace components/tables components/utilities include X-SVN-Commit-Revision: 349863 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 579E775326 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 18:02:43 -0000 Author: jkim Date: Tue Jul 9 18:02:36 2019 New Revision: 349863 URL: https://svnweb.freebsd.org/changeset/base/349863 Log: MFV: r349861 Import ACPICA 20190703. Modified: head/sys/contrib/dev/acpica/changes.txt head/sys/contrib/dev/acpica/compiler/asldefine.h head/sys/contrib/dev/acpica/compiler/aslglobal.h head/sys/contrib/dev/acpica/compiler/aslload.c head/sys/contrib/dev/acpica/compiler/aslmessages.c head/sys/contrib/dev/acpica/compiler/aslmessages.h head/sys/contrib/dev/acpica/compiler/aslstubs.c head/sys/contrib/dev/acpica/compiler/aslsupport.l head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c head/sys/contrib/dev/acpica/components/events/evgpe.c head/sys/contrib/dev/acpica/components/events/evgpeblk.c head/sys/contrib/dev/acpica/components/events/evxface.c head/sys/contrib/dev/acpica/components/events/evxfgpe.c head/sys/contrib/dev/acpica/components/executer/exconfig.c head/sys/contrib/dev/acpica/components/namespace/nsaccess.c head/sys/contrib/dev/acpica/components/namespace/nseval.c head/sys/contrib/dev/acpica/components/namespace/nsinit.c head/sys/contrib/dev/acpica/components/namespace/nsload.c head/sys/contrib/dev/acpica/components/namespace/nsutils.c head/sys/contrib/dev/acpica/components/tables/tbdata.c head/sys/contrib/dev/acpica/components/tables/tbxfload.c head/sys/contrib/dev/acpica/components/utilities/utinit.c head/sys/contrib/dev/acpica/components/utilities/utxfinit.c head/sys/contrib/dev/acpica/include/acevents.h head/sys/contrib/dev/acpica/include/acglobal.h head/sys/contrib/dev/acpica/include/acnamesp.h head/sys/contrib/dev/acpica/include/acpixf.h Directory Properties: head/sys/contrib/dev/acpica/ (props changed) Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/changes.txt Tue Jul 9 18:02:36 2019 (r349863) @@ -1,4 +1,53 @@ ---------------------------------------- +03 July 2019. Summary of changes for version 20190703: + + +1) ACPICA kernel-resident subsystem: + +Remove legacy module-level support code. There were still some remnants +of the legacy module-level code executions. Since we no longer support +this option, this is essentially dead code and has been removed from the +ACPICA source. + +iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only at the root +scope. If these named objects are declared outside the root scope, they +will not be invoked by any host Operating System. + +Clear status of GPEs on first direct enable. ACPI GPEs (other than the EC +one) can be enabled in two situations. First, the GPEs with existing _Lxx +and _Exx methods are enabled implicitly by ACPICA during system +initialization. Second, the GPEs without these methods (like GPEs listed +by _PRW objects for wakeup devices) need to be enabled directly by the +code that is going to use them (e.g. ACPI power management or device +drivers). + +In the former case, if the status of a given GPE is set to start with, +its handler method (either _Lxx or _Exx) needs to be invoked to take care +of the events (possibly) signaled before the GPE was enabled. In the +latter case, however, the first caller of AcpiEnableGpe() for a given GPE +should not be expected to care about any events that might be signaled +through it earlier. In that case, it is better to clear the status of +the GPE before enabling it, to prevent stale events from triggering +unwanted actions (like spurious system resume, for example). + +For this reason, modify AcpiEvAddGpeReference() to take an additional +boolean argument indicating whether or not the GPE status needs to be +cleared when its reference counter changes from zero to one and make +AcpiEnableGpe() pass TRUE to it through that new argument. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +The tool generation process has been migrated to MSVC 2017, and all +project files have been upgraded. The new project files appear in the +directory \acpica\generate\msvc2017. This change effectively deprecates +the older project files in \acpica\generate\msvc9. + +iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only at the root +scope. If these named objects are declared outside the root scope, they +will not be invoked by any host Operating System + +---------------------------------------- 09 May 2019. Summary of changes for version 20190509: Modified: head/sys/contrib/dev/acpica/compiler/asldefine.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asldefine.h Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/compiler/asldefine.h Tue Jul 9 18:02:36 2019 (r349863) @@ -298,4 +298,20 @@ #define COMMENT_CAPTURE_ON AslGbl_CommentState.CaptureComments = TRUE; #define COMMENT_CAPTURE_OFF AslGbl_CommentState.CaptureComments = FALSE; +/* + * Special name segments - these must only be declared at the root scope + */ +#define NAMESEG__PTS "_PTS" +#define NAMESEG__WAK "_WAK" +#define NAMESEG__S0 "_S0_" +#define NAMESEG__S1 "_S1_" +#define NAMESEG__S2 "_S2_" +#define NAMESEG__S3 "_S3_" +#define NAMESEG__S4 "_S4_" +#define NAMESEG__S5 "_S5_" +#define NAMESEG__TTS "_TTS" + +#define MAX_SPECIAL_NAMES 9 + + #endif /* ASLDEFINE.H */ Modified: head/sys/contrib/dev/acpica/compiler/aslglobal.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslglobal.h Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/compiler/aslglobal.h Tue Jul 9 18:02:36 2019 (r349863) @@ -223,11 +223,26 @@ const char *AslGbl_OpFlagName "OP_NOT_FOUND_DURING_LOAD" }; +const char *AslGbl_SpecialNamedObjects [MAX_SPECIAL_NAMES] = +{ + NAMESEG__PTS, + NAMESEG__WAK, + NAMESEG__S0, + NAMESEG__S1, + NAMESEG__S2, + NAMESEG__S3, + NAMESEG__S4, + NAMESEG__S5, + NAMESEG__TTS +}; + #else extern ASL_FILE_DESC AslGbl_FileDescs [ASL_NUM_FILES]; extern UINT32 AslGbl_ExceptionCount[ASL_NUM_REPORT_LEVELS]; extern const char *AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS]; +extern const char *AslGbl_SpecialNamedObjects[MAX_SPECIAL_NAMES]; #endif + /* Modified: head/sys/contrib/dev/acpica/compiler/aslload.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslload.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/compiler/aslload.c Tue Jul 9 18:02:36 2019 (r349863) @@ -164,6 +164,7 @@ static ACPI_STATUS LdLoadFieldElements ( + UINT32 AmlType, ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState); @@ -190,6 +191,10 @@ LdCommonNamespaceEnd ( UINT32 Level, void *Context); +static void +LdCheckSpecialNames ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op); /******************************************************************************* * @@ -247,7 +252,8 @@ LdLoadNamespace ( * * FUNCTION: LdLoadFieldElements * - * PARAMETERS: Op - Parent node (Field) + * PARAMETERS: AmlType - Type to search + * Op - Parent node (Field) * WalkState - Current walk state * * RETURN: Status @@ -259,6 +265,7 @@ LdLoadNamespace ( static ACPI_STATUS LdLoadFieldElements ( + UINT32 AmlType, ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState) { @@ -274,7 +281,7 @@ LdLoadFieldElements ( { Status = AcpiNsLookup (WalkState->ScopeInfo, SourceRegion->Asl.Value.String, - ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, + AmlType, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); if (Status == AE_NOT_FOUND) { @@ -507,11 +514,15 @@ LdNamespace1Begin ( */ switch (Op->Asl.AmlOpcode) { - case AML_BANK_FIELD_OP: case AML_INDEX_FIELD_OP: + + Status = LdLoadFieldElements (ACPI_TYPE_LOCAL_REGION_FIELD, Op, WalkState); + return (Status); + + case AML_BANK_FIELD_OP: case AML_FIELD_OP: - Status = LdLoadFieldElements (Op, WalkState); + Status = LdLoadFieldElements (ACPI_TYPE_REGION, Op, WalkState); return (Status); case AML_INT_CONNECTION_OP: @@ -966,6 +977,10 @@ LdNamespace1Begin ( } } + /* Check special names like _WAK and _PTS */ + + LdCheckSpecialNames (Node, Op); + if (ForceNewScope) { Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); @@ -1001,6 +1016,42 @@ FinishNode: } return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: LdCheckSpecialNames + * + * PARAMETERS: Node - Node that represents the named object + * Op - Named object declaring this named object + * + * RETURN: None + * + * DESCRIPTION: Check if certain named objects are declared in the incorrect + * scope. Special named objects are listed in + * AslGbl_SpecialNamedObjects and can only be declared at the root + * scope. + * + ******************************************************************************/ + +static void +LdCheckSpecialNames ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op) +{ + UINT32 i; + + + for (i = 0; i < MAX_SPECIAL_NAMES; i++) + { + if (ACPI_COMPARE_NAMESEG(Node->Name.Ascii, AslGbl_SpecialNamedObjects[i]) && + Node->Parent != AcpiGbl_RootNode) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_SPECIAL_NAME, Op, Op->Asl.ExternalName); + return; + } + } } Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmessages.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/compiler/aslmessages.c Tue Jul 9 18:02:36 2019 (r349863) @@ -365,7 +365,8 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_REGION_LENGTH */ "Operation Region declared with zero length", /* ASL_MSG_TEMPORARY_OBJECT */ "Object is created temporarily in another method and cannot be accessed", /* ASL_MSG_UNDEFINED_EXTERNAL */ "Named object was declared external but the actual definition does not exist", -/* ASL_MSG_BUFFER_FIELD_OVERFLOW */ "Buffer field extends beyond end of target buffer" +/* ASL_MSG_BUFFER_FIELD_OVERFLOW */ "Buffer field extends beyond end of target buffer", +/* ASL_MSG_INVALID_SPECIAL_NAME */ "declaration of this named object outside root scope is illegal" }; /* Table compiler */ Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmessages.h Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/compiler/aslmessages.h Tue Jul 9 18:02:36 2019 (r349863) @@ -368,6 +368,7 @@ typedef enum ASL_MSG_TEMPORARY_OBJECT, ASL_MSG_UNDEFINED_EXTERNAL, ASL_MSG_BUFFER_FIELD_OVERFLOW, + ASL_MSG_INVALID_SPECIAL_NAME, /* These messages are used by the Data Table compiler only */ Modified: head/sys/contrib/dev/acpica/compiler/aslstubs.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslstubs.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/compiler/aslstubs.c Tue Jul 9 18:02:36 2019 (r349863) @@ -166,12 +166,6 @@ * Things like Events, Global Lock, etc. are not used * by the compiler, so they are stubbed out here. */ -void -AcpiNsExecModuleCodeList ( - void) -{ -} - ACPI_STATUS AcpiNsInitializeObjects ( void) Modified: head/sys/contrib/dev/acpica/compiler/aslsupport.l ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslsupport.l Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/compiler/aslsupport.l Tue Jul 9 18:02:36 2019 (r349863) @@ -220,7 +220,7 @@ AslDoLineDirective ( while ((c = input()) != '\n' && c != EOF) { - *AslGbl_LineBufPtr = c; + *AslGbl_LineBufPtr = (char) c; AslGbl_LineBufPtr++; } *AslGbl_LineBufPtr = 0; @@ -498,7 +498,7 @@ AslInsertLineBuffer ( if (AcpiGbl_CaptureComments) { - CvProcessCommentState (SourceChar); + CvProcessCommentState ((char) SourceChar); } } } @@ -601,7 +601,7 @@ loop: AslInsertLineBuffer (c); if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { - *StringBuffer = c; + *StringBuffer = (char) c; ++StringBuffer; } c1 = c; @@ -629,7 +629,7 @@ loop: AslInsertLineBuffer (c); if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { - *StringBuffer = c; + *StringBuffer = (char) c; ++StringBuffer; } @@ -720,7 +720,7 @@ AslDoCommentType2 ( AslInsertLineBuffer (c); if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { - *StringBuffer = c; + *StringBuffer = (char) c; ++StringBuffer; } } @@ -878,7 +878,7 @@ DoCharacter: if (ACPI_IS_OCTAL_DIGIT (StringChar)) { State = ASL_OCTAL_CONSTANT; - ConvertBuffer[0] = StringChar; + ConvertBuffer[0] = (char) StringChar; i = 1; continue; } @@ -934,7 +934,7 @@ DoCharacter: /* Append another digit of the constant */ - ConvertBuffer[i] = StringChar; + ConvertBuffer[i] = (char) StringChar; i++; continue; @@ -978,7 +978,7 @@ DoCharacter: /* Append another digit of the constant */ - ConvertBuffer[i] = StringChar; + ConvertBuffer[i] = (char) StringChar; i++; continue; @@ -989,7 +989,7 @@ DoCharacter: /* Save the finished character */ - *StringBuffer = StringChar; + *StringBuffer = (char) StringChar; StringBuffer++; if (StringBuffer >= EndBuffer) { Modified: head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c ============================================================================== --- head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c Tue Jul 9 18:02:36 2019 (r349863) @@ -362,7 +362,7 @@ AcpiDsInitializeObjects ( if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT)) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "\nInitializing Namespace objects:\n")); + "\nACPI table initialization:\n")); } /* Summary of objects initialized */ Modified: head/sys/contrib/dev/acpica/components/events/evgpe.c ============================================================================== --- head/sys/contrib/dev/acpica/components/events/evgpe.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/events/evgpe.c Tue Jul 9 18:02:36 2019 (r349863) @@ -316,6 +316,7 @@ AcpiEvMaskGpe ( * FUNCTION: AcpiEvAddGpeReference * * PARAMETERS: GpeEventInfo - Add a reference to this GPE + * ClearOnEnable - Clear GPE status before enabling it * * RETURN: Status * @@ -326,7 +327,8 @@ AcpiEvMaskGpe ( ACPI_STATUS AcpiEvAddGpeReference ( - ACPI_GPE_EVENT_INFO *GpeEventInfo) + ACPI_GPE_EVENT_INFO *GpeEventInfo, + BOOLEAN ClearOnEnable) { ACPI_STATUS Status = AE_OK; @@ -343,6 +345,11 @@ AcpiEvAddGpeReference ( if (GpeEventInfo->RuntimeCount == 1) { /* Enable on first reference */ + + if (ClearOnEnable) + { + (void) AcpiHwClearGpe (GpeEventInfo); + } Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo); if (ACPI_SUCCESS (Status)) Modified: head/sys/contrib/dev/acpica/components/events/evgpeblk.c ============================================================================== --- head/sys/contrib/dev/acpica/components/events/evgpeblk.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/events/evgpeblk.c Tue Jul 9 18:02:36 2019 (r349863) @@ -637,7 +637,7 @@ AcpiEvInitializeGpeBlock ( continue; } - Status = AcpiEvAddGpeReference (GpeEventInfo); + Status = AcpiEvAddGpeReference (GpeEventInfo, FALSE); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, Modified: head/sys/contrib/dev/acpica/components/events/evxface.c ============================================================================== --- head/sys/contrib/dev/acpica/components/events/evxface.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/events/evxface.c Tue Jul 9 18:02:36 2019 (r349863) @@ -1256,7 +1256,7 @@ AcpiRemoveGpeHandler ( ACPI_GPE_DISPATCH_NOTIFY)) && Handler->OriginallyEnabled) { - (void) AcpiEvAddGpeReference (GpeEventInfo); + (void) AcpiEvAddGpeReference (GpeEventInfo, FALSE); if (ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo)) { /* Poll edge triggered GPEs to handle existing events */ Modified: head/sys/contrib/dev/acpica/components/events/evxfgpe.c ============================================================================== --- head/sys/contrib/dev/acpica/components/events/evxfgpe.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/events/evxfgpe.c Tue Jul 9 18:02:36 2019 (r349863) @@ -267,7 +267,7 @@ AcpiEnableGpe ( if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) != ACPI_GPE_DISPATCH_NONE) { - Status = AcpiEvAddGpeReference (GpeEventInfo); + Status = AcpiEvAddGpeReference (GpeEventInfo, TRUE); if (ACPI_SUCCESS (Status) && ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo)) { Modified: head/sys/contrib/dev/acpica/components/executer/exconfig.c ============================================================================== --- head/sys/contrib/dev/acpica/components/executer/exconfig.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/executer/exconfig.c Tue Jul 9 18:02:36 2019 (r349863) @@ -342,10 +342,9 @@ AcpiExLoadTableOp ( return_ACPI_STATUS (Status); } - /* Complete the initialization/resolution of package objects */ + /* Complete the initialization/resolution of new objects */ - Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL); + AcpiNsInitializeObjects (); /* Parameter Data (optional) */ @@ -620,10 +619,11 @@ AcpiExLoadOp ( return_ACPI_STATUS (Status); } - /* Complete the initialization/resolution of package objects */ + /* Complete the initialization/resolution of new objects */ - Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL); + AcpiExExitInterpreter (); + AcpiNsInitializeObjects (); + AcpiExEnterInterpreter (); /* Store the DdbHandle into the Target operand */ Modified: head/sys/contrib/dev/acpica/components/namespace/nsaccess.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nsaccess.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/namespace/nsaccess.c Tue Jul 9 18:02:36 2019 (r349863) @@ -184,6 +184,7 @@ AcpiNsRootInitialize ( ACPI_STATUS Status; const ACPI_PREDEFINED_NAMES *InitVal = NULL; ACPI_NAMESPACE_NODE *NewNode; + ACPI_NAMESPACE_NODE *PrevNode = NULL; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STRING Val = NULL; @@ -213,13 +214,30 @@ AcpiNsRootInitialize ( */ AcpiGbl_RootNode = &AcpiGbl_RootNodeStruct; - /* Enter the pre-defined names in the name table */ + /* Enter the predefined names in the name table */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Entering predefined entries into namespace\n")); + /* + * Create the initial (default) namespace. + * This namespace looks like something similar to this: + * + * ACPI Namespace (from Namespace Root): + * 0 _GPE Scope 00203160 00 + * 0 _PR_ Scope 002031D0 00 + * 0 _SB_ Device 00203240 00 Notify Object: 0020ADD8 + * 0 _SI_ Scope 002032B0 00 + * 0 _TZ_ Device 00203320 00 + * 0 _REV Integer 00203390 00 = 0000000000000002 + * 0 _OS_ String 00203488 00 Len 14 "Microsoft Windows NT" + * 0 _GL_ Mutex 00203580 00 Object 002035F0 + * 0 _OSI Method 00203678 00 Args 1 Len 0000 Aml 00000000 + */ for (InitVal = AcpiGbl_PreDefinedNames; InitVal->Name; InitVal++) { + Status = AE_OK; + /* _OSI is optional for now, will be permanent later */ if (!strcmp (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod) @@ -227,17 +245,35 @@ AcpiNsRootInitialize ( continue; } - Status = AcpiNsLookup (NULL, ACPI_CAST_PTR (char, InitVal->Name), - InitVal->Type, ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, - NULL, &NewNode); - if (ACPI_FAILURE (Status)) + /* + * Create, init, and link the new predefined name + * Note: No need to use AcpiNsLookup here because all the + * predefined names are at the root level. It is much easier to + * just create and link the new node(s) here. + */ + NewNode = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_NAMESPACE_NODE)); + if (!NewNode) { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not create predefined name %s", - InitVal->Name)); - continue; + Status = AE_NO_MEMORY; + goto UnlockAndExit; } + ACPI_COPY_NAMESEG (NewNode->Name.Ascii, InitVal->Name); + NewNode->DescriptorType = ACPI_DESC_TYPE_NAMED; + NewNode->Type = InitVal->Type; + + if (!PrevNode) + { + AcpiGbl_RootNodeStruct.Child = NewNode; + } + else + { + PrevNode->Peer = NewNode; + } + + NewNode->Parent = &AcpiGbl_RootNodeStruct; + PrevNode = NewNode; + /* * Name entered successfully. If entry in PreDefinedNames[] specifies * an initial value, create the initial value. @@ -286,7 +322,7 @@ AcpiNsRootInitialize ( NewNode->Value = ObjDesc->Method.ParamCount; #else - /* Mark this as a very SPECIAL method */ + /* Mark this as a very SPECIAL method (_OSI) */ ObjDesc->Method.InfoFlags = ACPI_METHOD_INTERNAL_ONLY; ObjDesc->Method.Dispatch.Implementation = AcpiUtOsiImplementation; @@ -358,7 +394,6 @@ AcpiNsRootInitialize ( AcpiUtRemoveReference (ObjDesc); } } - UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); Modified: head/sys/contrib/dev/acpica/components/namespace/nseval.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nseval.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/namespace/nseval.c Tue Jul 9 18:02:36 2019 (r349863) @@ -160,14 +160,7 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nseval") -/* Local prototypes */ -static void -AcpiNsExecModuleCode ( - ACPI_OPERAND_OBJECT *MethodObj, - ACPI_EVALUATE_INFO *Info); - - /******************************************************************************* * * FUNCTION: AcpiNsEvaluate @@ -464,207 +457,4 @@ Cleanup: ACPI_FREE (Info->FullPathname); Info->FullPathname = NULL; return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsExecModuleCodeList - * - * PARAMETERS: None - * - * RETURN: None. Exceptions during method execution are ignored, since - * we cannot abort a table load. - * - * DESCRIPTION: Execute all elements of the global module-level code list. - * Each element is executed as a single control method. - * - * NOTE: With this option enabled, each block of detected executable AML - * code that is outside of any control method is wrapped with a temporary - * control method object and placed on a global list. The methods on this - * list are executed below. - * - * This function executes the module-level code for all tables only after - * all of the tables have been loaded. It is a legacy option and is - * not compatible with other ACPI implementations. See AcpiNsLoadTable. - * - * This function will be removed when the legacy option is removed. - * - ******************************************************************************/ - -void -AcpiNsExecModuleCodeList ( - void) -{ - ACPI_OPERAND_OBJECT *Prev; - ACPI_OPERAND_OBJECT *Next; - ACPI_EVALUATE_INFO *Info; - UINT32 MethodCount = 0; - - - ACPI_FUNCTION_TRACE (NsExecModuleCodeList); - - - /* Exit now if the list is empty */ - - Next = AcpiGbl_ModuleCodeList; - if (!Next) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES, - "Legacy MLC block list is empty\n")); - - return_VOID; - } - - /* Allocate the evaluation information block */ - - Info = ACPI_ALLOCATE (sizeof (ACPI_EVALUATE_INFO)); - if (!Info) - { - return_VOID; - } - - /* Walk the list, executing each "method" */ - - while (Next) - { - Prev = Next; - Next = Next->Method.Mutex; - - /* Clear the link field and execute the method */ - - Prev->Method.Mutex = NULL; - AcpiNsExecModuleCode (Prev, Info); - MethodCount++; - - /* Delete the (temporary) method object */ - - AcpiUtRemoveReference (Prev); - } - - ACPI_INFO (( - "Executed %u blocks of module-level executable AML code", - MethodCount)); - - ACPI_FREE (Info); - AcpiGbl_ModuleCodeList = NULL; - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsExecModuleCode - * - * PARAMETERS: MethodObj - Object container for the module-level code - * Info - Info block for method evaluation - * - * RETURN: None. Exceptions during method execution are ignored, since - * we cannot abort a table load. - * - * DESCRIPTION: Execute a control method containing a block of module-level - * executable AML code. The control method is temporarily - * installed to the root node, then evaluated. - * - ******************************************************************************/ - -static void -AcpiNsExecModuleCode ( - ACPI_OPERAND_OBJECT *MethodObj, - ACPI_EVALUATE_INFO *Info) -{ - ACPI_OPERAND_OBJECT *ParentObj; - ACPI_NAMESPACE_NODE *ParentNode; - ACPI_OBJECT_TYPE Type; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (NsExecModuleCode); - - - /* - * Get the parent node. We cheat by using the NextObject field - * of the method object descriptor. - */ - ParentNode = ACPI_CAST_PTR ( - ACPI_NAMESPACE_NODE, MethodObj->Method.NextObject); - Type = AcpiNsGetType (ParentNode); - - /* - * Get the region handler and save it in the method object. We may need - * this if an operation region declaration causes a _REG method to be run. - * - * We can't do this in AcpiPsLinkModuleCode because - * AcpiGbl_RootNode->Object is NULL at PASS1. - */ - if ((Type == ACPI_TYPE_DEVICE) && ParentNode->Object) - { - MethodObj->Method.Dispatch.Handler = - ParentNode->Object->Device.Handler; - } - - /* Must clear NextObject (AcpiNsAttachObject needs the field) */ - - MethodObj->Method.NextObject = NULL; - - /* Initialize the evaluation information block */ - - memset (Info, 0, sizeof (ACPI_EVALUATE_INFO)); - Info->PrefixNode = ParentNode; - - /* - * Get the currently attached parent object. Add a reference, - * because the ref count will be decreased when the method object - * is installed to the parent node. - */ - ParentObj = AcpiNsGetAttachedObject (ParentNode); - if (ParentObj) - { - AcpiUtAddReference (ParentObj); - } - - /* Install the method (module-level code) in the parent node */ - - Status = AcpiNsAttachObject (ParentNode, MethodObj, ACPI_TYPE_METHOD); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - /* Execute the parent node as a control method */ - - Status = AcpiNsEvaluate (Info); - - ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES, - "Executed module-level code at %p\n", - MethodObj->Method.AmlStart)); - - /* Delete a possible implicit return value (in slack mode) */ - - if (Info->ReturnObject) - { - AcpiUtRemoveReference (Info->ReturnObject); - } - - /* Detach the temporary method object */ - - AcpiNsDetachObject (ParentNode); - - /* Restore the original parent object */ - - if (ParentObj) - { - Status = AcpiNsAttachObject (ParentNode, ParentObj, Type); - } - else - { - ParentNode->Type = (UINT8) Type; - } - -Exit: - if (ParentObj) - { - AcpiUtRemoveReference (ParentObj); - } - return_VOID; } Modified: head/sys/contrib/dev/acpica/components/namespace/nsinit.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nsinit.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/namespace/nsinit.c Tue Jul 9 18:02:36 2019 (r349863) @@ -212,29 +212,30 @@ AcpiNsInitializeObjects ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "**** Starting initialization of namespace objects ****\n")); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "Completing Region/Field/Buffer/Package initialization:\n")); + "Final data object initialization: ")); - /* Set all init info to zero */ + /* Clear the info block */ memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO)); /* Walk entire namespace from the supplied root */ + /* + * TBD: will become ACPI_TYPE_PACKAGE as this type object + * is now the only one that supports deferred initialization + * (forward references). + */ Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, - &Info, NULL); + ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, &Info, NULL); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace")); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - " Initialized %u/%u Regions %u/%u Fields %u/%u " - "Buffers %u/%u Packages (%u nodes)\n", - Info.OpRegionInit, Info.OpRegionCount, - Info.FieldInit, Info.FieldCount, - Info.BufferInit, Info.BufferCount, - Info.PackageInit, Info.PackageCount, Info.ObjectCount)); + "Namespace contains %u (0x%X) objects\n", + Info.ObjectCount, + Info.ObjectCount)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "%u Control Methods found\n%u Op Regions found\n", @@ -561,35 +562,19 @@ AcpiNsInitOneObject ( AcpiExEnterInterpreter (); /* - * Each of these types can contain executable AML code within the - * declaration. + * Only initialization of Package objects can be deferred, in order + * to support forward references. */ switch (Type) { - case ACPI_TYPE_REGION: + case ACPI_TYPE_LOCAL_BANK_FIELD: - Info->OpRegionInit++; - Status = AcpiDsGetRegionArguments (ObjDesc); - break; + /* TBD: BankFields do not require deferred init, remove this code */ - case ACPI_TYPE_BUFFER_FIELD: - Info->FieldInit++; - Status = AcpiDsGetBufferFieldArguments (ObjDesc); - break; - - case ACPI_TYPE_LOCAL_BANK_FIELD: - - Info->FieldInit++; Status = AcpiDsGetBankFieldArguments (ObjDesc); break; - case ACPI_TYPE_BUFFER: - - Info->BufferInit++; - Status = AcpiDsGetBufferArguments (ObjDesc); - break; - case ACPI_TYPE_PACKAGE: /* Complete the initialization/resolution of the package object */ @@ -600,8 +585,12 @@ AcpiNsInitOneObject ( default: - /* No other types can get here */ + /* No other types should get here */ + Status = AE_TYPE; + ACPI_EXCEPTION ((AE_INFO, Status, + "Opcode is not deferred [%4.4s] (%s)", + AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type))); break; } Modified: head/sys/contrib/dev/acpica/components/namespace/nsload.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nsload.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/namespace/nsload.c Tue Jul 9 18:02:36 2019 (r349863) @@ -268,18 +268,6 @@ Unlock: ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Completed Table Object Initialization\n")); - /* - * This case handles the legacy option that groups all module-level - * code blocks together and defers execution until all of the tables - * are loaded. Execute all of these blocks at this time. - * Execute any module-level code that was detected during the table - * load phase. - * - * Note: this option is deprecated and will be eliminated in the - * future. Use of this option can cause problems with AML code that - * depends upon in-order immediate execution of module-level code. - */ - AcpiNsExecModuleCodeList (); return_ACPI_STATUS (Status); } Modified: head/sys/contrib/dev/acpica/components/namespace/nsutils.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nsutils.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/namespace/nsutils.c Tue Jul 9 18:02:36 2019 (r349863) @@ -802,23 +802,10 @@ AcpiNsTerminate ( void) { ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *Prev; - ACPI_OPERAND_OBJECT *Next; ACPI_FUNCTION_TRACE (NsTerminate); - - /* Delete any module-level code blocks */ - - Next = AcpiGbl_ModuleCodeList; - while (Next) - { - Prev = Next; - Next = Next->Method.Mutex; - Prev->Method.Mutex = NULL; /* Clear the Mutex (cheated) field */ - AcpiUtRemoveReference (Prev); - } /* * Free the entire namespace -- all nodes and all objects Modified: head/sys/contrib/dev/acpica/components/tables/tbdata.c ============================================================================== --- head/sys/contrib/dev/acpica/components/tables/tbdata.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/tables/tbdata.c Tue Jul 9 18:02:36 2019 (r349863) @@ -1191,19 +1191,6 @@ AcpiTbLoadTable ( Status = AcpiNsLoadTable (TableIndex, ParentNode); /* - * This case handles the legacy option that groups all module-level - * code blocks together and defers execution until all of the tables - * are loaded. Execute all of these blocks at this time. - * Execute any module-level code that was detected during the table - * load phase. - * - * Note: this option is deprecated and will be eliminated in the - * future. Use of this option can cause problems with AML code that - * depends upon in-order immediate execution of module-level code. - */ - AcpiNsExecModuleCodeList (); - - /* * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is * responsible for discovering any new wake GPEs by running _PRW methods * that may have been loaded by this table. Modified: head/sys/contrib/dev/acpica/components/tables/tbxfload.c ============================================================================== --- head/sys/contrib/dev/acpica/components/tables/tbxfload.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/tables/tbxfload.c Tue Jul 9 18:02:36 2019 (r349863) @@ -479,6 +479,13 @@ AcpiLoadTable ( ACPI_INFO (("Host-directed Dynamic ACPI Table Load:")); Status = AcpiTbInstallAndLoadTable (ACPI_PTR_TO_PHYSADDR (Table), ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, FALSE, &TableIndex); + if (ACPI_SUCCESS (Status)) + { + /* Complete the initialization/resolution of new objects */ + + AcpiNsInitializeObjects (); + } + return_ACPI_STATUS (Status); } Modified: head/sys/contrib/dev/acpica/components/utilities/utinit.c ============================================================================== --- head/sys/contrib/dev/acpica/components/utilities/utinit.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/utilities/utinit.c Tue Jul 9 18:02:36 2019 (r349863) @@ -342,7 +342,6 @@ AcpiUtInitGlobals ( /* Namespace */ - AcpiGbl_ModuleCodeList = NULL; AcpiGbl_RootNode = NULL; AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED; Modified: head/sys/contrib/dev/acpica/components/utilities/utxfinit.c ============================================================================== --- head/sys/contrib/dev/acpica/components/utilities/utxfinit.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/utilities/utxfinit.c Tue Jul 9 18:02:36 2019 (r349863) @@ -381,24 +381,17 @@ AcpiInitializeObjects ( ACPI_FUNCTION_TRACE (AcpiInitializeObjects); +#ifdef ACPI_OBSOLETE_BEHAVIOR /* - * This case handles the legacy option that groups all module-level - * code blocks together and defers execution until all of the tables - * are loaded. Execute all of these blocks at this time. - * Execute any module-level code that was detected during the table - * load phase. - * - * Note: this option is deprecated and will be eliminated in the - * future. Use of this option can cause problems with AML code that - * depends upon in-order immediate execution of module-level code. + * 05/2019: Removed, initialization now happens at both object + * creation and table load time */ - AcpiNsExecModuleCodeList (); /* * Initialize the objects that remain uninitialized. This * runs the executable AML that may be part of the - * declaration of these objects: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Jul 9 19:32:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B29AD15E36E8; Tue, 9 Jul 2019 19:32:32 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 583F1823FD; Tue, 9 Jul 2019 19:32:32 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 289584588; Tue, 9 Jul 2019 19:32:32 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69JWWTs025541; Tue, 9 Jul 2019 19:32:32 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69JWWGU025540; Tue, 9 Jul 2019 19:32:32 GMT (envelope-from np@FreeBSD.org) Message-Id: <201907091932.x69JWWGU025540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 9 Jul 2019 19:32:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349865 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 349865 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 583F1823FD X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 19:32:32 -0000 Author: np Date: Tue Jul 9 19:32:31 2019 New Revision: 349865 URL: https://svnweb.freebsd.org/changeset/base/349865 Log: cxgbe(4): Use the simplest configuration possible when falling back from the default configuration. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue Jul 9 18:33:01 2019 (r349864) +++ head/sys/dev/cxgbe/t4_main.c Tue Jul 9 19:32:31 2019 (r349865) @@ -4009,10 +4009,8 @@ retry: rc, cfg_file); snprintf(cfg_file, sizeof(cfg_file), "%s", BUILTIN_CF); bzero(&caps_allowed, sizeof(caps_allowed)); - COPY_CAPS(nbm); - COPY_CAPS(link); COPY_CAPS(switch); - COPY_CAPS(nic); + caps_allowed.niccaps = FW_CAPS_CONFIG_NIC; fallback = false; goto retry; } From owner-svn-src-head@freebsd.org Tue Jul 9 20:28:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DFE9415E573F; Tue, 9 Jul 2019 20:28:54 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 81F45855EC; Tue, 9 Jul 2019 20:28:54 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C6914DE5; Tue, 9 Jul 2019 20:28:54 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69KSsMZ051841; Tue, 9 Jul 2019 20:28:54 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69KSsx1051840; Tue, 9 Jul 2019 20:28:54 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201907092028.x69KSsx1051840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Tue, 9 Jul 2019 20:28:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349866 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 349866 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 81F45855EC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 20:28:55 -0000 Author: alc Date: Tue Jul 9 20:28:53 2019 New Revision: 349866 URL: https://svnweb.freebsd.org/changeset/base/349866 Log: Introduce pmap_clear(), which zeroes a page table entry, and use it, instead of pmap_load_clear(), in places where we don't care about the page table entry's prior contents. Eliminate an unnecessary pmap_load() from pmap_remove_all(). Instead, use the value returned by the pmap_load_clear() on the very next line. (In the future, when we support "hardware dirty bit management", using the value from the pmap_load() rather than the pmap_load_clear() would have actually been an error because the dirty bit could potentially change between the pmap_load() and the pmap_load_clear().) A KASSERT() in pmap_enter(), which originated in the amd64 pmap, was meant to check the value returned by the pmap_load_clear() on the previous line. However, we were ignoring the value returned by the pmap_load_clear(), and so the KASSERT() was not serving its intended purpose. Use the value returned by the pmap_load_clear() in the KASSERT(). MFC after: 2 weeks Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Tue Jul 9 19:32:31 2019 (r349865) +++ head/sys/arm64/arm64/pmap.c Tue Jul 9 20:28:53 2019 (r349866) @@ -315,6 +315,7 @@ static __inline vm_page_t pmap_remove_pt_page(pmap_t p * They need to be atomic as the System MMU may write to the table at * the same time as the CPU. */ +#define pmap_clear(table) atomic_store_64(table, 0) #define pmap_load_store(table, entry) atomic_swap_64(table, entry) #define pmap_set(table, mask) atomic_set_64(table, mask) #define pmap_load_clear(table) atomic_swap_64(table, 0) @@ -1208,7 +1209,7 @@ pmap_kremove(vm_offset_t va) KASSERT(pte != NULL, ("pmap_kremove: Invalid address")); KASSERT(lvl == 3, ("pmap_kremove: Invalid pte level %d", lvl)); - pmap_load_clear(pte); + pmap_clear(pte); pmap_invalidate_page(kernel_pmap, va); } @@ -1230,7 +1231,7 @@ pmap_kremove_device(vm_offset_t sva, vm_size_t size) KASSERT(pte != NULL, ("Invalid page table, va: 0x%lx", va)); KASSERT(lvl == 3, ("Invalid device pagetable level: %d != 3", lvl)); - pmap_load_clear(pte); + pmap_clear(pte); va += PAGE_SIZE; size -= PAGE_SIZE; @@ -1315,7 +1316,7 @@ pmap_qremove(vm_offset_t sva, int count) KASSERT(lvl == 3, ("Invalid device pagetable level: %d != 3", lvl)); if (pte != NULL) { - pmap_load_clear(pte); + pmap_clear(pte); } va += PAGE_SIZE; @@ -1374,19 +1375,19 @@ _pmap_unwire_l3(pmap_t pmap, vm_offset_t va, vm_page_t pd_entry_t *l0; l0 = pmap_l0(pmap, va); - pmap_load_clear(l0); + pmap_clear(l0); } else if (m->pindex >= NUL2E) { /* l2 page */ pd_entry_t *l1; l1 = pmap_l1(pmap, va); - pmap_load_clear(l1); + pmap_clear(l1); } else { /* l3 page */ pd_entry_t *l2; l2 = pmap_l2(pmap, va); - pmap_load_clear(l2); + pmap_clear(l2); } pmap_resident_count_dec(pmap, 1); if (m->pindex < NUL2E) { @@ -2760,8 +2761,7 @@ retry: tpde = pmap_load(pde); pte = pmap_l2_to_l3(pde, pv->pv_va); - tpte = pmap_load(pte); - pmap_load_clear(pte); + tpte = pmap_load_clear(pte); pmap_invalidate_page(pmap, pv->pv_va); if (tpte & ATTR_SW_WIRED) pmap->pm_stats.wired_count--; @@ -2986,7 +2986,7 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_ent critical_enter(); /* Clear the old mapping */ - pmap_load_clear(pte); + pmap_clear(pte); pmap_invalidate_range_nopin(pmap, va, va + size); /* Create the new mapping */ @@ -3265,9 +3265,10 @@ havel3: } /* - * The physical page has changed. + * The physical page has changed. Temporarily invalidate + * the mapping. */ - (void)pmap_load_clear(l3); + orig_l3 = pmap_load_clear(l3); KASSERT((orig_l3 & ~ATTR_MASK) == opa, ("pmap_enter: unexpected pa update for %#lx", va)); if ((orig_l3 & ATTR_SW_MANAGED) != 0) { @@ -4282,7 +4283,12 @@ pmap_remove_pages(pmap_t pmap) ("pmap_remove_pages: bad pte %#jx", (uintmax_t)tpte)); - pmap_load_clear(pte); + /* + * Because this pmap is not active on other + * processors, the dirty bit cannot have + * changed state since we last loaded pte. + */ + pmap_clear(pte); /* * Update the vm_page_t clean/reference bits. @@ -5002,7 +5008,7 @@ pmap_unmapbios(vm_offset_t va, vm_size_t size) ("pmap_unmapbios: Invalid page entry, va: 0x%lx", va_trunc)); l2 = pmap_l1_to_l2(pde, va_trunc); - pmap_load_clear(l2); + pmap_clear(l2); if (block == (l2_blocks - 1)) break; From owner-svn-src-head@freebsd.org Tue Jul 9 22:04:35 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C54D15E71A6; Tue, 9 Jul 2019 22:04:35 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D85889021; Tue, 9 Jul 2019 22:04:34 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 581BD5EBD; Tue, 9 Jul 2019 22:04:34 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69M4Ylj004302; Tue, 9 Jul 2019 22:04:34 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69M4Xwu004298; Tue, 9 Jul 2019 22:04:33 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201907092204.x69M4Xwu004298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 9 Jul 2019 22:04:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349867 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349867 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9D85889021 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 22:04:35 -0000 Author: vmaffione Date: Tue Jul 9 22:04:33 2019 New Revision: 349867 URL: https://svnweb.freebsd.org/changeset/base/349867 Log: bhyve: add missing license identifiers in net_utils and net_backend Reviewed by: jhb, markj, imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20874 Modified: head/usr.sbin/bhyve/net_backends.c head/usr.sbin/bhyve/net_backends.h head/usr.sbin/bhyve/net_utils.c head/usr.sbin/bhyve/net_utils.h Modified: head/usr.sbin/bhyve/net_backends.c ============================================================================== --- head/usr.sbin/bhyve/net_backends.c Tue Jul 9 20:28:53 2019 (r349866) +++ head/usr.sbin/bhyve/net_backends.c Tue Jul 9 22:04:33 2019 (r349867) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2019 Vincenzo Maffione * * Redistribution and use in source and binary forms, with or without Modified: head/usr.sbin/bhyve/net_backends.h ============================================================================== --- head/usr.sbin/bhyve/net_backends.h Tue Jul 9 20:28:53 2019 (r349866) +++ head/usr.sbin/bhyve/net_backends.h Tue Jul 9 22:04:33 2019 (r349867) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2019 Vincenzo Maffione * * Redistribution and use in source and binary forms, with or without Modified: head/usr.sbin/bhyve/net_utils.c ============================================================================== --- head/usr.sbin/bhyve/net_utils.c Tue Jul 9 20:28:53 2019 (r349866) +++ head/usr.sbin/bhyve/net_utils.c Tue Jul 9 22:04:33 2019 (r349867) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2011 NetApp, Inc. * * Redistribution and use in source and binary forms, with or without Modified: head/usr.sbin/bhyve/net_utils.h ============================================================================== --- head/usr.sbin/bhyve/net_utils.h Tue Jul 9 20:28:53 2019 (r349866) +++ head/usr.sbin/bhyve/net_utils.h Tue Jul 9 22:04:33 2019 (r349867) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2019 Vincenzo Maffione * * Redistribution and use in source and binary forms, with or without From owner-svn-src-head@freebsd.org Tue Jul 9 22:05:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2BB015E7271; Tue, 9 Jul 2019 22:05:59 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 643CD8924A; Tue, 9 Jul 2019 22:05:59 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E3925ED2; Tue, 9 Jul 2019 22:05:59 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69M5xRI004410; Tue, 9 Jul 2019 22:05:59 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69M5xJN004409; Tue, 9 Jul 2019 22:05:59 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201907092205.x69M5xJN004409@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 9 Jul 2019 22:05:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349868 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349868 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 643CD8924A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 22:05:59 -0000 Author: vmaffione Date: Tue Jul 9 22:05:58 2019 New Revision: 349868 URL: https://svnweb.freebsd.org/changeset/base/349868 Log: bhyve: net_backends.c: add missing __FBSDID Reviewed by: jhb MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20883 Modified: head/usr.sbin/bhyve/net_backends.c Modified: head/usr.sbin/bhyve/net_backends.c ============================================================================== --- head/usr.sbin/bhyve/net_backends.c Tue Jul 9 22:04:33 2019 (r349867) +++ head/usr.sbin/bhyve/net_backends.c Tue Jul 9 22:05:58 2019 (r349868) @@ -34,11 +34,13 @@ * features) is exported by net_backends.h. */ +#include +__FBSDID("$FreeBSD$"); + #include /* u_short etc */ #ifndef WITHOUT_CAPSICUM #include #endif -#include #include #include #include From owner-svn-src-head@freebsd.org Tue Jul 9 22:11:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F98C15E74B1; Tue, 9 Jul 2019 22:11:16 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CAF1D89658; Tue, 9 Jul 2019 22:11:15 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3D165F24; Tue, 9 Jul 2019 22:11:15 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69MBFJ0006986; Tue, 9 Jul 2019 22:11:15 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69MBFhV006985; Tue, 9 Jul 2019 22:11:15 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201907092211.x69MBFhV006985@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 9 Jul 2019 22:11:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349869 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 349869 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CAF1D89658 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 22:11:16 -0000 Author: vmaffione Date: Tue Jul 9 22:11:15 2019 New Revision: 349869 URL: https://svnweb.freebsd.org/changeset/base/349869 Log: update calendar.freebsd MFC after: 1 week Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Tue Jul 9 22:05:58 2019 (r349868) +++ head/usr.bin/calendar/calendars/calendar.freebsd Tue Jul 9 22:11:15 2019 (r349869) @@ -387,7 +387,6 @@ 10/05 Hiroki Sato born in Yamagata, Japan, 1977 10/05 Chris Costello born in Houston, Texas, United States, 1985 10/09 Stefan Walter born in Werne, Nordrhein-Westfalen, Germany, 1978 -10/09 Vincenzo Maffione born in Foggia, Italy, 1988 10/11 Rick Macklem born in Ontario, Canada, 1955 10/12 Pawel Jakub Dawidek born in Radzyn Podlaski, Poland, 1980 10/15 Maxim Konovalov born in Khabarovsk, USSR, 1973 From owner-svn-src-head@freebsd.org Tue Jul 9 22:24:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1333715E7870; Tue, 9 Jul 2019 22:24:24 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9C9BE89F80; Tue, 9 Jul 2019 22:24:23 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E3996229; Tue, 9 Jul 2019 22:24:23 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69MONat014741; Tue, 9 Jul 2019 22:24:23 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69MONmM014740; Tue, 9 Jul 2019 22:24:23 GMT (envelope-from np@FreeBSD.org) Message-Id: <201907092224.x69MONmM014740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 9 Jul 2019 22:24:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349870 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 349870 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9C9BE89F80 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 22:24:24 -0000 Author: np Date: Tue Jul 9 22:24:22 2019 New Revision: 349870 URL: https://svnweb.freebsd.org/changeset/base/349870 Log: cxgbe(4): Clear the freelist statistics in the clearstats ioctl. Move all clearstats code into its own function while here. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue Jul 9 22:11:15 2019 (r349869) +++ head/sys/dev/cxgbe/t4_main.c Tue Jul 9 22:24:22 2019 (r349870) @@ -694,6 +694,7 @@ static void free_offload_policy(struct t4_offload_poli static int set_offload_policy(struct adapter *, struct t4_offload_policy *); static int read_card_mem(struct adapter *, int, struct t4_mem_range *); static int read_i2c(struct adapter *, struct t4_i2c_data *); +static int clear_stats(struct adapter *, u_int); #ifdef TCP_OFFLOAD static int toe_capability(struct vi_info *, int); #endif @@ -9841,6 +9842,108 @@ read_i2c(struct adapter *sc, struct t4_i2c_data *i2cd) return (rc); } +static int +clear_stats(struct adapter *sc, u_int port_id) +{ + int i, v, bg_map; + struct port_info *pi; + struct vi_info *vi; + struct sge_rxq *rxq; + struct sge_txq *txq; + struct sge_wrq *wrq; +#ifdef TCP_OFFLOAD + struct sge_ofld_rxq *ofld_rxq; +#endif + + if (port_id >= sc->params.nports) + return (EINVAL); + pi = sc->port[port_id]; + if (pi == NULL) + return (EIO); + + /* MAC stats */ + t4_clr_port_stats(sc, pi->tx_chan); + pi->tx_parse_error = 0; + pi->tnl_cong_drops = 0; + mtx_lock(&sc->reg_lock); + for_each_vi(pi, v, vi) { + if (vi->flags & VI_INIT_DONE) + t4_clr_vi_stats(sc, vi->vin); + } + bg_map = pi->mps_bg_map; + v = 0; /* reuse */ + while (bg_map) { + i = ffs(bg_map) - 1; + t4_write_indirect(sc, A_TP_MIB_INDEX, A_TP_MIB_DATA, &v, + 1, A_TP_MIB_TNL_CNG_DROP_0 + i); + bg_map &= ~(1 << i); + } + mtx_unlock(&sc->reg_lock); + + /* + * Since this command accepts a port, clear stats for + * all VIs on this port. + */ + for_each_vi(pi, v, vi) { + if (vi->flags & VI_INIT_DONE) { + + for_each_rxq(vi, i, rxq) { +#if defined(INET) || defined(INET6) + rxq->lro.lro_queued = 0; + rxq->lro.lro_flushed = 0; +#endif + rxq->rxcsum = 0; + rxq->vlan_extraction = 0; + + rxq->fl.mbuf_allocated = 0; + rxq->fl.mbuf_inlined = 0; + rxq->fl.cl_allocated = 0; + rxq->fl.cl_recycled = 0; + rxq->fl.cl_fast_recycled = 0; + } + + for_each_txq(vi, i, txq) { + txq->txcsum = 0; + txq->tso_wrs = 0; + txq->vlan_insertion = 0; + txq->imm_wrs = 0; + txq->sgl_wrs = 0; + txq->txpkt_wrs = 0; + txq->txpkts0_wrs = 0; + txq->txpkts1_wrs = 0; + txq->txpkts0_pkts = 0; + txq->txpkts1_pkts = 0; + txq->raw_wrs = 0; + mp_ring_reset_stats(txq->r); + } + +#if defined(TCP_OFFLOAD) || defined(RATELIMIT) + for_each_ofld_txq(vi, i, wrq) { + wrq->tx_wrs_direct = 0; + wrq->tx_wrs_copied = 0; + } +#endif +#ifdef TCP_OFFLOAD + for_each_ofld_rxq(vi, i, ofld_rxq) { + ofld_rxq->fl.mbuf_allocated = 0; + ofld_rxq->fl.mbuf_inlined = 0; + ofld_rxq->fl.cl_allocated = 0; + ofld_rxq->fl.cl_recycled = 0; + ofld_rxq->fl.cl_fast_recycled = 0; + } +#endif + + if (IS_MAIN_VI(vi)) { + wrq = &sc->sge.ctrlq[pi->port_id]; + wrq->tx_wrs_direct = 0; + wrq->tx_wrs_copied = 0; + } + } + } + + return (0); +} + int t4_os_find_pci_capability(struct adapter *sc, int cap) { @@ -10044,89 +10147,9 @@ t4_ioctl(struct cdev *dev, unsigned long cmd, caddr_t case CHELSIO_T4_GET_I2C: rc = read_i2c(sc, (struct t4_i2c_data *)data); break; - case CHELSIO_T4_CLEAR_STATS: { - int i, v, bg_map; - u_int port_id = *(uint32_t *)data; - struct port_info *pi; - struct vi_info *vi; - - if (port_id >= sc->params.nports) - return (EINVAL); - pi = sc->port[port_id]; - if (pi == NULL) - return (EIO); - - /* MAC stats */ - t4_clr_port_stats(sc, pi->tx_chan); - pi->tx_parse_error = 0; - pi->tnl_cong_drops = 0; - mtx_lock(&sc->reg_lock); - for_each_vi(pi, v, vi) { - if (vi->flags & VI_INIT_DONE) - t4_clr_vi_stats(sc, vi->vin); - } - bg_map = pi->mps_bg_map; - v = 0; /* reuse */ - while (bg_map) { - i = ffs(bg_map) - 1; - t4_write_indirect(sc, A_TP_MIB_INDEX, A_TP_MIB_DATA, &v, - 1, A_TP_MIB_TNL_CNG_DROP_0 + i); - bg_map &= ~(1 << i); - } - mtx_unlock(&sc->reg_lock); - - /* - * Since this command accepts a port, clear stats for - * all VIs on this port. - */ - for_each_vi(pi, v, vi) { - if (vi->flags & VI_INIT_DONE) { - struct sge_rxq *rxq; - struct sge_txq *txq; - struct sge_wrq *wrq; - - for_each_rxq(vi, i, rxq) { -#if defined(INET) || defined(INET6) - rxq->lro.lro_queued = 0; - rxq->lro.lro_flushed = 0; -#endif - rxq->rxcsum = 0; - rxq->vlan_extraction = 0; - } - - for_each_txq(vi, i, txq) { - txq->txcsum = 0; - txq->tso_wrs = 0; - txq->vlan_insertion = 0; - txq->imm_wrs = 0; - txq->sgl_wrs = 0; - txq->txpkt_wrs = 0; - txq->txpkts0_wrs = 0; - txq->txpkts1_wrs = 0; - txq->txpkts0_pkts = 0; - txq->txpkts1_pkts = 0; - txq->raw_wrs = 0; - mp_ring_reset_stats(txq->r); - } - -#if defined(TCP_OFFLOAD) || defined(RATELIMIT) - /* nothing to clear for each ofld_rxq */ - - for_each_ofld_txq(vi, i, wrq) { - wrq->tx_wrs_direct = 0; - wrq->tx_wrs_copied = 0; - } -#endif - - if (IS_MAIN_VI(vi)) { - wrq = &sc->sge.ctrlq[pi->port_id]; - wrq->tx_wrs_direct = 0; - wrq->tx_wrs_copied = 0; - } - } - } + case CHELSIO_T4_CLEAR_STATS: + rc = clear_stats(sc, *(uint32_t *)data); break; - } case CHELSIO_T4_SCHED_CLASS: rc = t4_set_sched_class(sc, (struct t4_sched_params *)data); break; From owner-svn-src-head@freebsd.org Tue Jul 9 23:58:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D6BE15E938D; Tue, 9 Jul 2019 23:58:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E4D3E8CF3F; Tue, 9 Jul 2019 23:58:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA51A7156; Tue, 9 Jul 2019 23:58:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69NwCQd061167; Tue, 9 Jul 2019 23:58:12 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69NwC7C061166; Tue, 9 Jul 2019 23:58:12 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201907092358.x69NwC7C061166@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 9 Jul 2019 23:58:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349871 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 349871 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E4D3E8CF3F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.91 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.91)[-0.908,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 23:58:13 -0000 Author: jhb Date: Tue Jul 9 23:58:12 2019 New Revision: 349871 URL: https://svnweb.freebsd.org/changeset/base/349871 Log: Use 'retval' label for first error in syscallenter(). This is more consistent with the rest of the function and lets us unindent most of the function. Reviewed by: kib MFC after: 1 month Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D20897 Modified: head/sys/kern/subr_syscall.c Modified: head/sys/kern/subr_syscall.c ============================================================================== --- head/sys/kern/subr_syscall.c Tue Jul 9 22:24:22 2019 (r349870) +++ head/sys/kern/subr_syscall.c Tue Jul 9 23:58:12 2019 (r349871) @@ -85,69 +85,68 @@ syscallenter(struct thread *td) (uintptr_t)td, "pid:%d", td->td_proc->p_pid, "arg0:%p", sa->args[0], "arg1:%p", sa->args[1], "arg2:%p", sa->args[2]); - if (error == 0) { + if (error != 0) + goto retval; - STOPEVENT(p, S_SCE, sa->narg); - if (p->p_flag & P_TRACED) { - PROC_LOCK(p); - if (p->p_ptevents & PTRACE_SCE) - ptracestop((td), SIGTRAP, NULL); - PROC_UNLOCK(p); - } - if (td->td_dbgflags & TDB_USERWR) { - /* - * Reread syscall number and arguments if - * debugger modified registers or memory. - */ - error = (p->p_sysent->sv_fetch_syscall_args)(td); + STOPEVENT(p, S_SCE, sa->narg); + if ((p->p_flag & P_TRACED) != 0) { + PROC_LOCK(p); + if (p->p_ptevents & PTRACE_SCE) + ptracestop((td), SIGTRAP, NULL); + PROC_UNLOCK(p); + } + if ((td->td_dbgflags & TDB_USERWR) != 0) { + /* + * Reread syscall number and arguments if debugger + * modified registers or memory. + */ + error = (p->p_sysent->sv_fetch_syscall_args)(td); #ifdef KTRACE - if (KTRPOINT(td, KTR_SYSCALL)) - ktrsyscall(sa->code, sa->narg, sa->args); + if (KTRPOINT(td, KTR_SYSCALL)) + ktrsyscall(sa->code, sa->narg, sa->args); #endif - if (error != 0) - goto retval; - } + if (error != 0) + goto retval; + } #ifdef CAPABILITY_MODE - /* - * In capability mode, we only allow access to system calls - * flagged with SYF_CAPENABLED. - */ - if (IN_CAPABILITY_MODE(td) && - !(sa->callp->sy_flags & SYF_CAPENABLED)) { - error = ECAPMODE; - goto retval; - } + /* + * In capability mode, we only allow access to system calls + * flagged with SYF_CAPENABLED. + */ + if (IN_CAPABILITY_MODE(td) && + !(sa->callp->sy_flags & SYF_CAPENABLED)) { + error = ECAPMODE; + goto retval; + } #endif - error = syscall_thread_enter(td, sa->callp); - if (error != 0) - goto retval; + error = syscall_thread_enter(td, sa->callp); + if (error != 0) + goto retval; #ifdef KDTRACE_HOOKS - /* Give the syscall:::entry DTrace probe a chance to fire. */ - if (__predict_false(systrace_enabled && - sa->callp->sy_entry != 0)) - (*systrace_probe_func)(sa, SYSTRACE_ENTRY, 0); + /* Give the syscall:::entry DTrace probe a chance to fire. */ + if (__predict_false(systrace_enabled && sa->callp->sy_entry != 0)) + (*systrace_probe_func)(sa, SYSTRACE_ENTRY, 0); #endif - AUDIT_SYSCALL_ENTER(sa->code, td); - error = (sa->callp->sy_call)(td, sa->args); - AUDIT_SYSCALL_EXIT(error, td); + AUDIT_SYSCALL_ENTER(sa->code, td); + error = (sa->callp->sy_call)(td, sa->args); + AUDIT_SYSCALL_EXIT(error, td); - /* Save the latest error return value. */ - if ((td->td_pflags & TDP_NERRNO) == 0) - td->td_errno = error; + /* Save the latest error return value. */ + if ((td->td_pflags & TDP_NERRNO) == 0) + td->td_errno = error; #ifdef KDTRACE_HOOKS - /* Give the syscall:::return DTrace probe a chance to fire. */ - if (__predict_false(systrace_enabled && - sa->callp->sy_return != 0)) - (*systrace_probe_func)(sa, SYSTRACE_RETURN, - error ? -1 : td->td_retval[0]); + /* Give the syscall:::return DTrace probe a chance to fire. */ + if (__predict_false(systrace_enabled && sa->callp->sy_return != 0)) + (*systrace_probe_func)(sa, SYSTRACE_RETURN, + error ? -1 : td->td_retval[0]); #endif - syscall_thread_exit(td, sa->callp); - } + syscall_thread_exit(td, sa->callp); + retval: KTR_STOP4(KTR_SYSC, "syscall", syscallname(p, sa->code), (uintptr_t)td, "pid:%d", td->td_proc->p_pid, "error:%d", error, From owner-svn-src-head@freebsd.org Wed Jul 10 01:08:09 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D36DD15EA81C; Wed, 10 Jul 2019 01:08:09 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 71F9C8F57C; Wed, 10 Jul 2019 01:08:09 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 198827D26; Wed, 10 Jul 2019 01:08:09 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6A188oc097397; Wed, 10 Jul 2019 01:08:08 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6A188bl097396; Wed, 10 Jul 2019 01:08:08 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201907100108.x6A188bl097396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Wed, 10 Jul 2019 01:08:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349872 - head/tests/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/tests/sys/opencrypto X-SVN-Commit-Revision: 349872 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 71F9C8F57C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 01:08:10 -0000 Author: lwhsu Date: Wed Jul 10 01:08:08 2019 New Revision: 349872 URL: https://svnweb.freebsd.org/changeset/base/349872 Log: Correct definitions in sys.opencrypto.runtests.main for 32bit platform Reviewed by: cem, jhb MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20894 Modified: head/tests/sys/opencrypto/cryptodev.py Modified: head/tests/sys/opencrypto/cryptodev.py ============================================================================== --- head/tests/sys/opencrypto/cryptodev.py Tue Jul 9 23:58:12 2019 (r349871) +++ head/tests/sys/opencrypto/cryptodev.py Wed Jul 10 01:08:08 2019 (r349872) @@ -36,6 +36,7 @@ import array import binascii from fcntl import ioctl import os +import platform import random import signal from struct import pack as _pack @@ -116,14 +117,19 @@ class CryptAEAD(dpkt.Packet): # h2py.py can't handle multiarg macros CRIOGET = 3221513060 CIOCGSESSION = 3224396645 -CIOCGSESSION2 = 3225445226 CIOCFSESSION = 2147771238 -CIOCCRYPT = 3224396647 CIOCKEY = 3230688104 CIOCASYMFEAT = 1074029417 CIOCKEY2 = 3230688107 CIOCFINDDEV = 3223610220 -CIOCCRYPTAEAD = 3225445229 +if platform.architecture()[0] == '64bit': + CIOCGSESSION2 = 3225445226 + CIOCCRYPT = 3224396647 + CIOCCRYPTAEAD = 3225445229 +else: + CIOCGSESSION2 = 3224396650 + CIOCCRYPT = 3223085927 + CIOCCRYPTAEAD = 3223872365 def _getdev(): buf = array.array('I', [0]) From owner-svn-src-head@freebsd.org Wed Jul 10 03:45:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B03F615ED456; Wed, 10 Jul 2019 03:45:24 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2917B6DFCA; Wed, 10 Jul 2019 03:45:24 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD96D9876; Wed, 10 Jul 2019 03:45:23 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6A3jNan080955; Wed, 10 Jul 2019 03:45:23 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6A3jNvj080954; Wed, 10 Jul 2019 03:45:23 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907100345.x6A3jNvj080954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 10 Jul 2019 03:45:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349873 - head X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 349873 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2917B6DFCA X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.922,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 03:45:24 -0000 Author: ian Date: Wed Jul 10 03:45:23 2019 New Revision: 349873 URL: https://svnweb.freebsd.org/changeset/base/349873 Log: Add pwm.9, it was also deleted during the big round of pwm changes. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Jul 10 01:08:08 2019 (r349872) +++ head/ObsoleteFiles.inc Wed Jul 10 03:45:23 2019 (r349873) @@ -40,8 +40,8 @@ # 20190618: sys/capability.h removed (sys/capsicum.h is the one to use) OLD_FILES+=usr/include/sys/capability.h -# 20190615: sys/pwm.h renamed to dev/pwmc.h -OLD_FILES+=usr/include/sys/pwm.h +# 20190615: sys/pwm.h renamed to dev/pwmc.h and pwm(9) removed +OLD_FILES+=usr/include/sys/pwm.h usr/share/man/man9/pwm.9 # 20190612: new clang import which bumps version from 8.0.0 to 8.0.1. OLD_FILES+=usr/lib/clang/8.0.0/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/8.0.0/include/sanitizer/asan_interface.h From owner-svn-src-head@freebsd.org Wed Jul 10 04:09:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D49E15ED833; Wed, 10 Jul 2019 04:09:16 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 436636EA1F; Wed, 10 Jul 2019 04:09:16 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1CD6F9BE3; Wed, 10 Jul 2019 04:09:16 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6A49FBn090906; Wed, 10 Jul 2019 04:09:15 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6A49FFQ090905; Wed, 10 Jul 2019 04:09:15 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201907100409.x6A49FFQ090905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 10 Jul 2019 04:09:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349874 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 349874 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 436636EA1F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.92)[-0.922,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 04:09:16 -0000 Author: jhibbits Date: Wed Jul 10 04:09:15 2019 New Revision: 349874 URL: https://svnweb.freebsd.org/changeset/base/349874 Log: powerpc: Clamp 32-bit binaries to 32-bit MAXUSER sv_maxuser specifies the maximum addressable space for user space. Presently this is all 64-bits worth, which is impossible for a 32-bit process. This bug has existed since the initial import of powerpc64 in 2010. MFC after: 2 weeks Modified: head/sys/powerpc/powerpc/elf32_machdep.c Modified: head/sys/powerpc/powerpc/elf32_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf32_machdep.c Wed Jul 10 03:45:23 2019 (r349873) +++ head/sys/powerpc/powerpc/elf32_machdep.c Wed Jul 10 04:09:15 2019 (r349874) @@ -97,7 +97,7 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_minuser = VM_MIN_ADDRESS, .sv_stackprot = VM_PROT_ALL, #ifdef __powerpc64__ - .sv_maxuser = VM_MAXUSER_ADDRESS, + .sv_maxuser = VM_MAXUSER_ADDRESS32, .sv_usrstack = FREEBSD32_USRSTACK, .sv_psstrings = FREEBSD32_PS_STRINGS, .sv_copyout_strings = freebsd32_copyout_strings, From owner-svn-src-head@freebsd.org Wed Jul 10 05:45:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FF8815CAFE9; Wed, 10 Jul 2019 05:45:52 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F120A716EF; Wed, 10 Jul 2019 05:45:51 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B88A1ACA3; Wed, 10 Jul 2019 05:45:51 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6A5jp3h042887; Wed, 10 Jul 2019 05:45:51 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6A5joIX042882; Wed, 10 Jul 2019 05:45:50 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201907100545.x6A5joIX042882@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Wed, 10 Jul 2019 05:45:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349875 - in head: share/man/man4 sys/dev/usb sys/dev/usb/net sys/dev/usb/quirk X-SVN-Group: head X-SVN-Commit-Author: hrs X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/usb sys/dev/usb/net sys/dev/usb/quirk X-SVN-Commit-Revision: 349875 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F120A716EF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.92)[-0.924,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 05:45:52 -0000 Author: hrs Date: Wed Jul 10 05:45:50 2019 New Revision: 349875 URL: https://svnweb.freebsd.org/changeset/base/349875 Log: Add support for RTL8156, 2.5GbE USB network controller, to if_cdce(4). This chip can be found in Planex USB-LAN2500R. Modified: head/share/man/man4/cdce.4 head/sys/dev/usb/net/if_cdce.c head/sys/dev/usb/quirk/usb_quirk.c head/sys/dev/usb/usbdevs Modified: head/share/man/man4/cdce.4 ============================================================================== --- head/share/man/man4/cdce.4 Wed Jul 10 04:09:15 2019 (r349874) +++ head/share/man/man4/cdce.4 Wed Jul 10 05:45:50 2019 (r349875) @@ -28,7 +28,7 @@ .\" $NetBSD: cdce.4,v 1.4 2004/12/08 18:35:56 peter Exp $ .\" $FreeBSD$ .\" -.Dd May 21, 2018 +.Dd July 10, 2019 .Dt CDCE 4 .Os .Sh NAME @@ -89,6 +89,10 @@ Prolific PL-2501 Host-to-Host Bridge Controller Sharp Zaurus PDA .It Terayon TJ-715 DOCSIS Cable Modem +.It +Realtek RTL8156 USB GBE/2.5G Ethernet Family Controller +.It +Planex USB-LAN2500R .El .Sh DIAGNOSTICS .Bl -diag Modified: head/sys/dev/usb/net/if_cdce.c ============================================================================== --- head/sys/dev/usb/net/if_cdce.c Wed Jul 10 04:09:15 2019 (r349874) +++ head/sys/dev/usb/net/if_cdce.c Wed Jul 10 05:45:50 2019 (r349875) @@ -276,6 +276,7 @@ static const STRUCT_USB_HOST_ID cdce_host_devs[] = { {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLA300, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLC700, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLC750, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, + {USB_VPI(USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8156, 0)}, {USB_VENDOR(USB_VENDOR_HUAWEI), USB_IFACE_CLASS(UICLASS_VENDOR), USB_IFACE_SUBCLASS(0x02), USB_IFACE_PROTOCOL(0x16), Modified: head/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- head/sys/dev/usb/quirk/usb_quirk.c Wed Jul 10 04:09:15 2019 (r349874) +++ head/sys/dev/usb/quirk/usb_quirk.c Wed Jul 10 05:45:50 2019 (r349875) @@ -101,6 +101,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK USB_QUIRK(ELSA, MODEM1, 0x0000, 0xffff, UQ_CFG_INDEX_1), USB_QUIRK(PLANEX2, MZKUE150N, 0x0000, 0xffff, UQ_CFG_INDEX_1), USB_QUIRK(CISCOLINKSYS, USB3GIGV1, 0x0000, 0xffff, UQ_CFG_INDEX_1), + USB_QUIRK(REALTEK, RTL8156, 0x0000, 0xffff, UQ_CFG_INDEX_2), /* Quirks for printer devices */ USB_QUIRK(HP, 895C, 0x0000, 0xffff, UQ_BROKEN_BIDIR), USB_QUIRK(HP, 880C, 0x0000, 0xffff, UQ_BROKEN_BIDIR), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Wed Jul 10 04:09:15 2019 (r349874) +++ head/sys/dev/usb/usbdevs Wed Jul 10 05:45:50 2019 (r349875) @@ -3962,6 +3962,7 @@ product REALTEK RTL8188RU_2 0x317f RTL8188RU product REALTEK USBKR100 0x8150 USBKR100 USB Ethernet product REALTEK RTL8152 0x8152 RTL8152 USB Ethernet product REALTEK RTL8153 0x8153 RTL8153 USB Ethernet +product REALTEK RTL8156 0x8156 RTL8156 USB Ethernet product REALTEK RTL8188CE_0 0x8170 RTL8188CE product REALTEK RTL8171 0x8171 RTL8171 product REALTEK RTL8172 0x8172 RTL8172 From owner-svn-src-head@freebsd.org Wed Jul 10 05:57:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D023915CB2AD; Wed, 10 Jul 2019 05:57:38 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7242871CC2; Wed, 10 Jul 2019 05:57:38 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 519C1AE45; Wed, 10 Jul 2019 05:57:38 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6A5vcjW047855; Wed, 10 Jul 2019 05:57:38 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6A5vbeE047853; Wed, 10 Jul 2019 05:57:37 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201907100557.x6A5vbeE047853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 10 Jul 2019 05:57:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349876 - head/contrib/llvm/tools/clang/include/clang/AST X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/tools/clang/include/clang/AST X-SVN-Commit-Revision: 349876 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7242871CC2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.93)[-0.926,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 05:57:39 -0000 Author: dim Date: Wed Jul 10 05:57:37 2019 New Revision: 349876 URL: https://svnweb.freebsd.org/changeset/base/349876 Log: Apply a workaround to be able to build clang 8.0.0 headers with clang 3.4.1, which is still in the stable/10 branch. It looks like clang 3.4.1 implements static_asserts by instantiating a temporary static object, and if those are in an anonymous union, it results in "error: anonymous union can only contain non-static data members". To work around this implementation limitation, move the static_asserts in question out of the anonymous unions. This should make building the latest stable/11 from stable/10 possible again. Reported by: Mike Tancsa MFC after: 3 days Modified: head/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h head/contrib/llvm/tools/clang/include/clang/AST/Type.h Modified: head/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h Wed Jul 10 05:45:50 2019 (r349875) +++ head/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h Wed Jul 10 05:57:37 2019 (r349876) @@ -1696,30 +1696,30 @@ class DeclContext { (protected) ObjCContainerDeclBitfields ObjCContainerDeclBits; LinkageSpecDeclBitfields LinkageSpecDeclBits; BlockDeclBitfields BlockDeclBits; - - static_assert(sizeof(DeclContextBitfields) <= 8, - "DeclContextBitfields is larger than 8 bytes!"); - static_assert(sizeof(TagDeclBitfields) <= 8, - "TagDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(EnumDeclBitfields) <= 8, - "EnumDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(RecordDeclBitfields) <= 8, - "RecordDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(OMPDeclareReductionDeclBitfields) <= 8, - "OMPDeclareReductionDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(FunctionDeclBitfields) <= 8, - "FunctionDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(CXXConstructorDeclBitfields) <= 8, - "CXXConstructorDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(ObjCMethodDeclBitfields) <= 8, - "ObjCMethodDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(ObjCContainerDeclBitfields) <= 8, - "ObjCContainerDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(LinkageSpecDeclBitfields) <= 8, - "LinkageSpecDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(BlockDeclBitfields) <= 8, - "BlockDeclBitfields is larger than 8 bytes!"); }; + + static_assert(sizeof(DeclContextBitfields) <= 8, + "DeclContextBitfields is larger than 8 bytes!"); + static_assert(sizeof(TagDeclBitfields) <= 8, + "TagDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(EnumDeclBitfields) <= 8, + "EnumDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(RecordDeclBitfields) <= 8, + "RecordDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(OMPDeclareReductionDeclBitfields) <= 8, + "OMPDeclareReductionDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(FunctionDeclBitfields) <= 8, + "FunctionDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(CXXConstructorDeclBitfields) <= 8, + "CXXConstructorDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(ObjCMethodDeclBitfields) <= 8, + "ObjCMethodDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(ObjCContainerDeclBitfields) <= 8, + "ObjCContainerDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(LinkageSpecDeclBitfields) <= 8, + "LinkageSpecDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(BlockDeclBitfields) <= 8, + "BlockDeclBitfields is larger than 8 bytes!"); /// FirstDecl - The first declaration stored within this declaration /// context. Modified: head/contrib/llvm/tools/clang/include/clang/AST/Type.h ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/AST/Type.h Wed Jul 10 05:45:50 2019 (r349875) +++ head/contrib/llvm/tools/clang/include/clang/AST/Type.h Wed Jul 10 05:57:37 2019 (r349876) @@ -1720,41 +1720,41 @@ class Type : public ExtQualsTypeCommonBase { (protecte DependentTemplateSpecializationTypeBitfields DependentTemplateSpecializationTypeBits; PackExpansionTypeBitfields PackExpansionTypeBits; - - static_assert(sizeof(TypeBitfields) <= 8, - "TypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(ArrayTypeBitfields) <= 8, - "ArrayTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(AttributedTypeBitfields) <= 8, - "AttributedTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(AutoTypeBitfields) <= 8, - "AutoTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(BuiltinTypeBitfields) <= 8, - "BuiltinTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(FunctionTypeBitfields) <= 8, - "FunctionTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(ObjCObjectTypeBitfields) <= 8, - "ObjCObjectTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(ReferenceTypeBitfields) <= 8, - "ReferenceTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(TypeWithKeywordBitfields) <= 8, - "TypeWithKeywordBitfields is larger than 8 bytes!"); - static_assert(sizeof(ElaboratedTypeBitfields) <= 8, - "ElaboratedTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(VectorTypeBitfields) <= 8, - "VectorTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(SubstTemplateTypeParmPackTypeBitfields) <= 8, - "SubstTemplateTypeParmPackTypeBitfields is larger" - " than 8 bytes!"); - static_assert(sizeof(TemplateSpecializationTypeBitfields) <= 8, - "TemplateSpecializationTypeBitfields is larger" - " than 8 bytes!"); - static_assert(sizeof(DependentTemplateSpecializationTypeBitfields) <= 8, - "DependentTemplateSpecializationTypeBitfields is larger" - " than 8 bytes!"); - static_assert(sizeof(PackExpansionTypeBitfields) <= 8, - "PackExpansionTypeBitfields is larger than 8 bytes"); }; + + static_assert(sizeof(TypeBitfields) <= 8, + "TypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(ArrayTypeBitfields) <= 8, + "ArrayTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(AttributedTypeBitfields) <= 8, + "AttributedTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(AutoTypeBitfields) <= 8, + "AutoTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(BuiltinTypeBitfields) <= 8, + "BuiltinTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(FunctionTypeBitfields) <= 8, + "FunctionTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(ObjCObjectTypeBitfields) <= 8, + "ObjCObjectTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(ReferenceTypeBitfields) <= 8, + "ReferenceTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(TypeWithKeywordBitfields) <= 8, + "TypeWithKeywordBitfields is larger than 8 bytes!"); + static_assert(sizeof(ElaboratedTypeBitfields) <= 8, + "ElaboratedTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(VectorTypeBitfields) <= 8, + "VectorTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(SubstTemplateTypeParmPackTypeBitfields) <= 8, + "SubstTemplateTypeParmPackTypeBitfields is larger" + " than 8 bytes!"); + static_assert(sizeof(TemplateSpecializationTypeBitfields) <= 8, + "TemplateSpecializationTypeBitfields is larger" + " than 8 bytes!"); + static_assert(sizeof(DependentTemplateSpecializationTypeBitfields) <= 8, + "DependentTemplateSpecializationTypeBitfields is larger" + " than 8 bytes!"); + static_assert(sizeof(PackExpansionTypeBitfields) <= 8, + "PackExpansionTypeBitfields is larger than 8 bytes"); private: template friend class TypePropertyCache; From owner-svn-src-head@freebsd.org Wed Jul 10 08:19:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5853115CEA9D; Wed, 10 Jul 2019 08:19:34 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EED417733D; Wed, 10 Jul 2019 08:19:33 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9854C74A; Wed, 10 Jul 2019 08:19:33 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6A8JXNZ020464; Wed, 10 Jul 2019 08:19:33 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6A8JXHe020462; Wed, 10 Jul 2019 08:19:33 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201907100819.x6A8JXHe020462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Wed, 10 Jul 2019 08:19:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349880 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: tijl X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 349880 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EED417733D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 08:19:34 -0000 Author: tijl Date: Wed Jul 10 08:19:33 2019 New Revision: 349880 URL: https://svnweb.freebsd.org/changeset/base/349880 Log: Let linuxulator mprotect mask unsupported bits before calling kern_mprotect. After r349240 kern_mprotect returns EINVAL for unsupported bits in the prot argument. Linux rtld uses PROT_GROWSDOWN and PROT_GROWS_UP when marking the stack executable. Mask these bits like kern_mprotect used to do. For other unsupported bits EINVAL is returned like Linux does. Reviewed by: trasz, brooks MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20864 Modified: head/sys/compat/linux/linux_mmap.c head/sys/compat/linux/linux_mmap.h Modified: head/sys/compat/linux/linux_mmap.c ============================================================================== --- head/sys/compat/linux/linux_mmap.c Wed Jul 10 08:08:14 2019 (r349879) +++ head/sys/compat/linux/linux_mmap.c Wed Jul 10 08:19:33 2019 (r349880) @@ -228,6 +228,11 @@ int linux_mprotect_common(struct thread *td, uintptr_t addr, size_t len, int prot) { + /* XXX Ignore PROT_GROWSDOWN and PROT_GROWSUP for now. */ + prot &= ~(LINUX_PROT_GROWSDOWN | LINUX_PROT_GROWSUP); + if ((prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) != 0) + return (EINVAL); + #if defined(__amd64__) linux_fixup_prot(td, &prot); #endif Modified: head/sys/compat/linux/linux_mmap.h ============================================================================== --- head/sys/compat/linux/linux_mmap.h Wed Jul 10 08:08:14 2019 (r349879) +++ head/sys/compat/linux/linux_mmap.h Wed Jul 10 08:19:33 2019 (r349880) @@ -41,6 +41,8 @@ #define LINUX_MAP_ANON 0x0020 #define LINUX_MAP_GROWSDOWN 0x0100 +#define LINUX_PROT_GROWSDOWN 0x01000000 +#define LINUX_PROT_GROWSUP 0x02000000 int linux_mmap_common(struct thread *, uintptr_t, size_t, int, int, int, off_t); From owner-svn-src-head@freebsd.org Wed Jul 10 12:40:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4EC0815D5F74; Wed, 10 Jul 2019 12:40:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E335389F46; Wed, 10 Jul 2019 12:40:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07577F35D; Wed, 10 Jul 2019 12:40:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6ACe7F2055369; Wed, 10 Jul 2019 12:40:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6ACe7pp055368; Wed, 10 Jul 2019 12:40:07 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201907101240.x6ACe7pp055368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 10 Jul 2019 12:40:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349883 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 349883 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E335389F46 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 12:40:11 -0000 Author: avg Date: Wed Jul 10 12:40:07 2019 New Revision: 349883 URL: https://svnweb.freebsd.org/changeset/base/349883 Log: owc_gpiobus: small formatting cleanup MFC after: 1 week Modified: head/sys/dev/ow/owc_gpiobus.c Modified: head/sys/dev/ow/owc_gpiobus.c ============================================================================== --- head/sys/dev/ow/owc_gpiobus.c Wed Jul 10 12:15:07 2019 (r349882) +++ head/sys/dev/ow/owc_gpiobus.c Wed Jul 10 12:40:07 2019 (r349883) @@ -191,7 +191,7 @@ owc_gpiobus_write_one(device_t dev, struct ow_timing * sc = device_get_softc(dev); error = GETBUS(sc); if (error != 0) - return error; + return (error); critical_enter(); @@ -205,10 +205,10 @@ owc_gpiobus_write_one(device_t dev, struct ow_timing * DELAY(t->t_slot - t->t_low1 + t->t_rec); critical_exit(); - + RELBUS(sc); - - return 0; + + return (0); } /* @@ -232,7 +232,7 @@ owc_gpiobus_write_zero(device_t dev, struct ow_timing sc = device_get_softc(dev); error = GETBUS(sc); if (error != 0) - return error; + return (error); critical_enter(); @@ -248,8 +248,8 @@ owc_gpiobus_write_zero(device_t dev, struct ow_timing critical_exit(); RELBUS(sc); - - return 0; + + return (0); } /* @@ -277,7 +277,7 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * sc = device_get_softc(dev); error = GETBUS(sc); if (error != 0) - return error; + return (error); /* Force low for t_lowr microseconds */ then = sbinuptime(); @@ -309,8 +309,8 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * } while ((now - then) / SBT_1US < t->t_slot); RELBUS(sc); - - return 0; + + return (error); } /* @@ -338,10 +338,9 @@ owc_gpiobus_reset_and_presence(device_t dev, struct ow sc = device_get_softc(dev); error = GETBUS(sc); if (error != 0) - return error; - + return (error); - /* + /* * Read the current state of the bus. The steady state of an idle bus is * high. Badly wired buses that are missing the required pull up, or * that have a short circuit to ground cause all kinds of mischief when @@ -353,7 +352,7 @@ owc_gpiobus_reset_and_presence(device_t dev, struct ow if (buf == 0) { *bit = -1; RELBUS(sc); - return EIO; + return (EIO); } critical_enter(); @@ -384,12 +383,12 @@ owc_gpiobus_reset_and_presence(device_t dev, struct ow if (buf == 0) { *bit = -1; RELBUS(sc); - return EIO; + return (EIO); } RELBUS(sc); - return 0; + return (0); } static devclass_t owc_gpiobus_devclass; From owner-svn-src-head@freebsd.org Wed Jul 10 13:36:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55DCC15D7667; Wed, 10 Jul 2019 13:36:18 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F0D8C8C256; Wed, 10 Jul 2019 13:36:17 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3D5DFD58; Wed, 10 Jul 2019 13:36:17 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6ADaH61085636; Wed, 10 Jul 2019 13:36:17 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6ADaH84085635; Wed, 10 Jul 2019 13:36:17 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201907101336.x6ADaH84085635@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Wed, 10 Jul 2019 13:36:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349885 - head/sys/powerpc/pseries X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/sys/powerpc/pseries X-SVN-Commit-Revision: 349885 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F0D8C8C256 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.941,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 13:36:18 -0000 Author: luporl Date: Wed Jul 10 13:36:17 2019 New Revision: 349885 URL: https://svnweb.freebsd.org/changeset/base/349885 Log: [PPC64] pseries: fix realmaxaddr calculation On POWER9/pseries, QEMU passes several regions of memory, instead of a single region containing all memory, as the code was expecting. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D20857 Modified: head/sys/powerpc/pseries/platform_chrp.c Modified: head/sys/powerpc/pseries/platform_chrp.c ============================================================================== --- head/sys/powerpc/pseries/platform_chrp.c Wed Jul 10 13:35:01 2019 (r349884) +++ head/sys/powerpc/pseries/platform_chrp.c Wed Jul 10 13:36:17 2019 (r349885) @@ -140,8 +140,15 @@ chrp_attach(platform_t plat) if (!(mfmsr() & PSL_HV)) { struct mem_region *phys, *avail; int nphys, navail; + vm_offset_t off; + mem_regions(&phys, &nphys, &avail, &navail); - realmaxaddr = phys[0].mr_size; + + realmaxaddr = 0; + for (i = 0; i < nphys; i++) { + off = phys[i].mr_start + phys[i].mr_size; + realmaxaddr = MAX(off, realmaxaddr); + } pmap_mmu_install("mmu_phyp", BUS_PROBE_SPECIFIC); cpu_idle_hook = phyp_cpu_idle; From owner-svn-src-head@freebsd.org Wed Jul 10 13:47:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E714615D79F6; Wed, 10 Jul 2019 13:47:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 85B5C8C8A6; Wed, 10 Jul 2019 13:47:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 581F5FF12; Wed, 10 Jul 2019 13:47:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6ADlB74090818; Wed, 10 Jul 2019 13:47:11 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6ADlBU8090817; Wed, 10 Jul 2019 13:47:11 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201907101347.x6ADlBU8090817@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 10 Jul 2019 13:47:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349886 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 349886 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 85B5C8C8A6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.939,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 13:47:12 -0000 Author: avg Date: Wed Jul 10 13:47:10 2019 New Revision: 349886 URL: https://svnweb.freebsd.org/changeset/base/349886 Log: linuxcommon: add module version MFC after: 2 weeks Modified: head/sys/compat/linux/linux_common.c Modified: head/sys/compat/linux/linux_common.c ============================================================================== --- head/sys/compat/linux/linux_common.c Wed Jul 10 13:36:17 2019 (r349885) +++ head/sys/compat/linux/linux_common.c Wed Jul 10 13:47:10 2019 (r349886) @@ -98,3 +98,4 @@ static moduledata_t linux_common_mod = { }; DECLARE_MODULE(linuxcommon, linux_common_mod, SI_SUB_EXEC, SI_ORDER_ANY); +MODULE_VERSION(linuxcommon, 1); From owner-svn-src-head@freebsd.org Wed Jul 10 14:34:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9EFE115D8771; Wed, 10 Jul 2019 14:34:53 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 422888E248; Wed, 10 Jul 2019 14:34:53 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1AC2B187B3; Wed, 10 Jul 2019 14:34:53 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AEYqY9016440; Wed, 10 Jul 2019 14:34:52 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AEYqIh016439; Wed, 10 Jul 2019 14:34:52 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907101434.x6AEYqIh016439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 10 Jul 2019 14:34:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349887 - head/sys/arm/include X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/include X-SVN-Commit-Revision: 349887 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 422888E248 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 14:34:53 -0000 Author: ian Date: Wed Jul 10 14:34:52 2019 New Revision: 349887 URL: https://svnweb.freebsd.org/changeset/base/349887 Log: De-pollute arm's sysarch.h. Instead of including stdint.h for uintptr_t, include sys/_types.h and use __types for everything that isn't a native C keyword type. Remove the #include of cdefs.h. It appears after the include of armreg.h which has a precondition of cdefs.h being included before it, so everyone including sysarch.h is already including cdefs.h. (When armv5 support goes away, there will be no need include armreg.h here either.) Unfortunately, the unprefixed struct member names "addr" and "len" cannot be changed, because 3rd-party software is relying on them (libcompiler_rt is one known consumer). Modified: head/sys/arm/include/sysarch.h Modified: head/sys/arm/include/sysarch.h ============================================================================== --- head/sys/arm/include/sysarch.h Wed Jul 10 13:47:10 2019 (r349886) +++ head/sys/arm/include/sysarch.h Wed Jul 10 14:34:52 2019 (r349887) @@ -65,12 +65,10 @@ #ifndef LOCORE #ifndef __ASSEMBLER__ -#include - /* - * Pickup definition of uintptr_t + * Pickup definition of various __types. */ -#include +#include /* * Architecture specific syscalls (arm) @@ -83,19 +81,19 @@ #define ARM_GET_VFPSTATE 4 struct arm_sync_icache_args { - uintptr_t addr; /* Virtual start address */ - size_t len; /* Region size */ + __uintptr_t addr; /* Virtual start address */ + __size_t len; /* Region size */ }; struct arm_get_vfpstate_args { - size_t mc_vfp_size; + __size_t mc_vfp_size; void *mc_vfp; }; #ifndef _KERNEL __BEGIN_DECLS -int arm_sync_icache (u_int addr, int len); -int arm_drain_writebuf (void); +int arm_sync_icache(unsigned int, int); +int arm_drain_writebuf(void); int sysarch(int, void *); __END_DECLS #endif From owner-svn-src-head@freebsd.org Wed Jul 10 17:22:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DA8B15DD809; Wed, 10 Jul 2019 17:22:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F64C968DE; Wed, 10 Jul 2019 17:22:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00CA61A379; Wed, 10 Jul 2019 17:22:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AHLxLP005785; Wed, 10 Jul 2019 17:21:59 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AHLxKH005783; Wed, 10 Jul 2019 17:21:59 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907101721.x6AHLxKH005783@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 10 Jul 2019 17:21:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349889 - head/sys/mips/ingenic X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/mips/ingenic X-SVN-Commit-Revision: 349889 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2F64C968DE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 17:22:00 -0000 Author: imp Date: Wed Jul 10 17:21:59 2019 New Revision: 349889 URL: https://svnweb.freebsd.org/changeset/base/349889 Log: Fix compile errors with the CI20 Fix mutex includes and fix a typo. The CI20 kernel is not built as part of universe. PR: 239115 Submitted by: Kai Nacke Modified: head/sys/mips/ingenic/jz4780_machdep.c head/sys/mips/ingenic/jz4780_mmc.c head/sys/mips/ingenic/jz4780_smb.c Modified: head/sys/mips/ingenic/jz4780_machdep.c ============================================================================== --- head/sys/mips/ingenic/jz4780_machdep.c Wed Jul 10 14:46:18 2019 (r349888) +++ head/sys/mips/ingenic/jz4780_machdep.c Wed Jul 10 17:21:59 2019 (r349889) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #ifdef FDT Modified: head/sys/mips/ingenic/jz4780_mmc.c ============================================================================== --- head/sys/mips/ingenic/jz4780_mmc.c Wed Jul 10 14:46:18 2019 (r349888) +++ head/sys/mips/ingenic/jz4780_mmc.c Wed Jul 10 17:21:59 2019 (r349889) @@ -775,7 +775,7 @@ jz4780_mmc_read_ivar(device_t bus, device_t child, int *(int *)result = sc->sc_host.ios.power_mode; break; case MMCBR_IVAR_RETUNE_REQ: - *(int *)result = return_req_none; + *(int *)result = retune_req_none; break; case MMCBR_IVAR_VDD: *(int *)result = sc->sc_host.ios.vdd; Modified: head/sys/mips/ingenic/jz4780_smb.c ============================================================================== --- head/sys/mips/ingenic/jz4780_smb.c Wed Jul 10 14:46:18 2019 (r349888) +++ head/sys/mips/ingenic/jz4780_smb.c Wed Jul 10 17:21:59 2019 (r349889) @@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include From owner-svn-src-head@freebsd.org Wed Jul 10 17:42:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2A0115DE328; Wed, 10 Jul 2019 17:42:05 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 718AB979BE; Wed, 10 Jul 2019 17:42:05 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3847D1A7D7; Wed, 10 Jul 2019 17:42:05 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AHg5dq016755; Wed, 10 Jul 2019 17:42:05 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AHg4os016752; Wed, 10 Jul 2019 17:42:04 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201907101742.x6AHg4os016752@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Wed, 10 Jul 2019 17:42:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349890 - head/contrib/telnet/telnet X-SVN-Group: head X-SVN-Commit-Author: philip X-SVN-Commit-Paths: head/contrib/telnet/telnet X-SVN-Commit-Revision: 349890 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 718AB979BE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 17:42:06 -0000 Author: philip Date: Wed Jul 10 17:42:04 2019 New Revision: 349890 URL: https://svnweb.freebsd.org/changeset/base/349890 Log: telnet: fix a couple of snprintf() buffer overflows Obtained from: Juniper Networks MFC after: 1 week Modified: head/contrib/telnet/telnet/commands.c head/contrib/telnet/telnet/telnet.c head/contrib/telnet/telnet/utilities.c Modified: head/contrib/telnet/telnet/commands.c ============================================================================== --- head/contrib/telnet/telnet/commands.c Wed Jul 10 17:21:59 2019 (r349889) +++ head/contrib/telnet/telnet/commands.c Wed Jul 10 17:42:04 2019 (r349890) @@ -1655,10 +1655,11 @@ env_init(void) char hbuf[256+1]; char *cp2 = strchr((char *)ep->value, ':'); - gethostname(hbuf, 256); - hbuf[256] = '\0'; - cp = (char *)malloc(strlen(hbuf) + strlen(cp2) + 1); - sprintf((char *)cp, "%s%s", hbuf, cp2); + gethostname(hbuf, sizeof(hbuf)); + hbuf[sizeof(hbuf)-1] = '\0'; + unsigned int buflen = strlen(hbuf) + strlen(cp2) + 1; + cp = (char *)malloc(sizeof(char)*buflen); + snprintf((char *)cp, buflen, "%s%s", hbuf, cp2); free(ep->value); ep->value = (unsigned char *)cp; } Modified: head/contrib/telnet/telnet/telnet.c ============================================================================== --- head/contrib/telnet/telnet/telnet.c Wed Jul 10 17:21:59 2019 (r349889) +++ head/contrib/telnet/telnet/telnet.c Wed Jul 10 17:42:04 2019 (r349890) @@ -785,7 +785,7 @@ suboption(void) name = gettermname(); len = strlen(name) + 4 + 2; if (len < NETROOM()) { - sprintf(temp, "%c%c%c%c%s%c%c", IAC, SB, TELOPT_TTYPE, + snprintf(temp, sizeof(temp), "%c%c%c%c%s%c%c", IAC, SB, TELOPT_TTYPE, TELQUAL_IS, name, IAC, SE); ring_supply_data(&netoring, temp, len); printsub('>', &temp[2], len-2); @@ -807,7 +807,7 @@ suboption(void) TerminalSpeeds(&ispeed, &ospeed); - sprintf((char *)temp, "%c%c%c%c%ld,%ld%c%c", IAC, SB, TELOPT_TSPEED, + snprintf((char *)temp, sizeof(temp), "%c%c%c%c%ld,%ld%c%c", IAC, SB, TELOPT_TSPEED, TELQUAL_IS, ospeed, ispeed, IAC, SE); len = strlen((char *)temp+4) + 4; /* temp[3] is 0 ... */ Modified: head/contrib/telnet/telnet/utilities.c ============================================================================== --- head/contrib/telnet/telnet/utilities.c Wed Jul 10 17:21:59 2019 (r349889) +++ head/contrib/telnet/telnet/utilities.c Wed Jul 10 17:42:04 2019 (r349890) @@ -629,7 +629,7 @@ printsub(char direction, unsigned char *pointer, int l } { char tbuf[64]; - sprintf(tbuf, "%s%s%s%s%s", + snprintf(tbuf, sizeof(tbuf), "%s%s%s%s%s", pointer[2]&MODE_EDIT ? "|EDIT" : "", pointer[2]&MODE_TRAPSIG ? "|TRAPSIG" : "", pointer[2]&MODE_SOFT_TAB ? "|SOFT_TAB" : "", From owner-svn-src-head@freebsd.org Wed Jul 10 19:32:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A76A15E1B85; Wed, 10 Jul 2019 19:32:51 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2B07A6E554; Wed, 10 Jul 2019 19:32:51 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0488C1BB09; Wed, 10 Jul 2019 19:32:51 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AJWon7074545; Wed, 10 Jul 2019 19:32:50 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AJWo5r074544; Wed, 10 Jul 2019 19:32:50 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907101932.x6AJWo5r074544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 10 Jul 2019 19:32:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349891 - head/lib/libc/arm/gen X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/lib/libc/arm/gen X-SVN-Commit-Revision: 349891 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2B07A6E554 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.92)[-0.920,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 19:32:51 -0000 Author: ian Date: Wed Jul 10 19:32:50 2019 New Revision: 349891 URL: https://svnweb.freebsd.org/changeset/base/349891 Log: Reorganize the SRCS lists as one file per line, and then alphabetize them. No functional changes. Modified: head/lib/libc/arm/gen/Makefile.inc Modified: head/lib/libc/arm/gen/Makefile.inc ============================================================================== --- head/lib/libc/arm/gen/Makefile.inc Wed Jul 10 17:42:04 2019 (r349890) +++ head/lib/libc/arm/gen/Makefile.inc Wed Jul 10 19:32:50 2019 (r349891) @@ -1,13 +1,31 @@ # @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 # $FreeBSD$ -SRCS+= _ctx_start.S _setjmp.S _set_tp.c alloca.S fabs.c \ - infinity.c ldexp.c makecontext.c \ - __aeabi_read_tp.S setjmp.S signalcontext.c sigsetjmp.S flt_rounds.c \ +SRCS+= \ + __aeabi_read_tp.S \ + _ctx_start.S \ + _set_tp.c \ + _setjmp.S \ + alloca.S \ arm_initfini.c \ - getcontextx.c + fabs.c \ + flt_rounds.c \ + getcontextx.c \ + infinity.c \ + ldexp.c \ + makecontext.c \ + setjmp.S \ + signalcontext.c \ + sigsetjmp.S \ .if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") -SRCS+= fpgetmask_vfp.c fpgetround_vfp.c fpgetsticky_vfp.c fpsetmask_vfp.c \ - fpsetround_vfp.c fpsetsticky_vfp.c + +SRCS+= \ + fpgetmask_vfp.c \ + fpgetround_vfp.c \ + fpgetsticky_vfp.c \ + fpsetmask_vfp.c \ + fpsetround_vfp.c \ + fpsetsticky_vfp.c \ + .endif From owner-svn-src-head@freebsd.org Wed Jul 10 19:55:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37B7715E2156 for ; Wed, 10 Jul 2019 19:55:54 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 2222E6F2C5 for ; Wed, 10 Jul 2019 19:55:53 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x833.google.com with SMTP id y26so3831171qto.4 for ; Wed, 10 Jul 2019 12:55:53 -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:user-agent; bh=7NvUZXl9XAbn21ceC+wrjNVMtPTHxMqWu4vA3S6x0HI=; b=g+7C8JwNJjAMcb/TvEpGRTdgLY8NLMCywa9IY49+z65v1v575H3ellypZuBclEgyan GHnwYdo2RNxpzVgVFdutKlHjAvuhikQkmWRgqemF8bVHJdVSVX4WUUj7Af6DEkf6LO3t abIAFwjyJT0CVfRyOBGR7IQrcXKePSQh/YKLKIitAFv1JHGrxr9yvsHRwtftTMDefT7T /0iIVXdewiCI9H1PdySz9EzsW0hxNu2LUYEx6T4L6seCvSV3KHyaCH9HbZu/SexAUsXs ddLb+oPkpY/h2u9D/mv+yZRqYS2X79b6OiZNMjVXrX3lBCATEkDzGMZ0Hfi9cPmhZmA4 uEwQ== 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:user-agent; bh=7NvUZXl9XAbn21ceC+wrjNVMtPTHxMqWu4vA3S6x0HI=; b=LylB9iK1fJXsBFG0MxGvLd4nLKruiJ17CzE7M3nbOcfoYje1nTP6IwrIwtt+4JH0dN NrT82k6343Eff/llLr+pvF3T5mawU3Z34fO3NU/RdSREurL5ulL/uaVKVUiBeZIT2YJh aFJkMgBh2FivKtKgKV7Z72BH4Dz8XUTN2UPyGlZvvCpFALxdVzvJKEeslhpC3tw/plY1 ouVxFgzXG/ZcF6OrcIyl9IbaEhqz0YFkaC0anxBJNQ4JFsTHatqR39HH4Z0s/TXZS4BR NncIpcla2ungUlUglBklp00u8EQw6u2VQGPAfyN57atFN+vjNeM2vLo/ByjdbqhOcA4q y9BA== X-Gm-Message-State: APjAAAU6P97En9Uj8SuxgETugTdRMGO+7RKODBQSKF0DfFzT8xvIwZvb CJmXfOco2KNQ/nQXT5vxz3skew== X-Google-Smtp-Source: APXvYqy4PjIXosf+TQ9hGnOD+5zGJnfN9zPhJnWmv3vdCM5U4JS+6z5lILa8XrIBNIpDN/4tmfSAAg== X-Received: by 2002:ac8:37b8:: with SMTP id d53mr25302514qtc.227.1562788551189; Wed, 10 Jul 2019 12:55:51 -0700 (PDT) Received: from mutt-hbsd ([151.196.118.239]) by smtp.gmail.com with ESMTPSA id p13sm1289774qkj.4.2019.07.10.12.55.49 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 10 Jul 2019 12:55:50 -0700 (PDT) Date: Wed, 10 Jul 2019 15:55:48 -0400 From: Shawn Webb To: Philip Paeps Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet Message-ID: <20190710195548.kdftfemj3icarcxo@mutt-hbsd> References: <201907101742.x6AHg4os016752@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2ecdm7fv5dibptma" Content-Disposition: inline In-Reply-To: <201907101742.x6AHg4os016752@repo.freebsd.org> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA User-Agent: NeoMutt/20180716 X-Rspamd-Queue-Id: 2222E6F2C5 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 19:55:54 -0000 --2ecdm7fv5dibptma Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: > Author: philip > Date: Wed Jul 10 17:42:04 2019 > New Revision: 349890 > URL: https://svnweb.freebsd.org/changeset/base/349890 >=20 > Log: > telnet: fix a couple of snprintf() buffer overflows > =20 > Obtained from: Juniper Networks > MFC after: 1 week >=20 > Modified: > head/contrib/telnet/telnet/commands.c > head/contrib/telnet/telnet/telnet.c > head/contrib/telnet/telnet/utilities.c >=20 > Modified: head/contrib/telnet/telnet/commands.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 17:21:59 2019 (r3498= 89) > +++ head/contrib/telnet/telnet/commands.c Wed Jul 10 17:42:04 2019 (r3498= 90) > @@ -1655,10 +1655,11 @@ env_init(void) > char hbuf[256+1]; > char *cp2 =3D strchr((char *)ep->value, ':'); > =20 > - gethostname(hbuf, 256); > - hbuf[256] =3D '\0'; > - cp =3D (char *)malloc(strlen(hbuf) + strlen(cp2) + 1); > - sprintf((char *)cp, "%s%s", hbuf, cp2); > + gethostname(hbuf, sizeof(hbuf)); > + hbuf[sizeof(hbuf)-1] =3D '\0'; > + unsigned int buflen =3D strlen(hbuf) + strlen(cp2) + 1; buflen should be defined with the rest of the variables in the code block above this one. > + cp =3D (char *)malloc(sizeof(char)*buflen); Lack of NULL check here leads to > + snprintf((char *)cp, buflen, "%s%s", hbuf, cp2); potential NULL pointer deref here. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 --2ecdm7fv5dibptma Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl0mQrsACgkQ/y5nonf4 4foXOQ/9ELBZEj5TmLFUfNXJdo50Sm6Q6Bf6B4UG4SwK+aAKZImvRclY0XS9GmdC HIj6XXzRTtX+6MKrWFteJhsXM1EyBIrry2SK5f/BbBHGK6pXhzTlFeIAexfFGiGR z1qO6Rz7WeKQNgR11zMIPZardNRtotlAm4maUw5q4Nvr7LMley+BtxpdhlJ3Guv3 0GZdbmxaQZDJnWW7AJ9F+JXWMXdnIPlsR2g8nZts7GnFQ4IGvox4j7O4BA8ZoIfG E4yzQapVkBYKtmg9nrLkhNALJeit/CY2DDYTBJhcecALiJbpXrn2ZFlTH6lDnZN5 4REXybTlzhXeUQpwIEESHd8cIkTG2HjX155GwozBDIomdy1nHtHSWmKmHeyEq6gh 7qVtk4lfClmyazcCkcgK7Gx8fADzFT607Z4wNWLY0arZ+WGTUNVT4K0y+s8DYHTy hW3D5/sfNLPmPRPCz/uvTd+XGloaSUPgoHCB6SHLY+cFvMwuI5UpLjH0055o9FSN UZ8/y+oR2ITcZFVv9PEp440AKExnhqONMQ03M1Xan+GN4HQ61Px8lPxP+VRo7U2E xzCz1QMHfwWURBHW07kc8mZiEzrgYBIBx0WMs0PZnLvRXpXqtsNTGGy+3n+yA9DO ncJmY+A2nD9lg2CHvimC2/e/a1hrE8Z5KBW10zA9AqpyMrZPfpI= =2JuV -----END PGP SIGNATURE----- --2ecdm7fv5dibptma-- From owner-svn-src-head@freebsd.org Wed Jul 10 19:57:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE8F115E21F4; Wed, 10 Jul 2019 19:57:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 747A56F460; Wed, 10 Jul 2019 19:57:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61B011BE64; Wed, 10 Jul 2019 19:57:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AJvnxc085023; Wed, 10 Jul 2019 19:57:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AJvnXa085022; Wed, 10 Jul 2019 19:57:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907101957.x6AJvnXa085022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 10 Jul 2019 19:57:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349892 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 349892 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 747A56F460 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.947,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 19:57:50 -0000 Author: markj Date: Wed Jul 10 19:57:48 2019 New Revision: 349892 URL: https://svnweb.freebsd.org/changeset/base/349892 Log: Inherit P2_PROTMAX_{ENABLE,DISABLE} across fork(). Thus, when using proccontrol(1) to disable implicit application of PROT_MAX within a process, child processes will inherit this setting. Discussed with: kib MFC with: r349609 Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_fork.c Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Wed Jul 10 19:32:50 2019 (r349891) +++ head/sys/kern/kern_fork.c Wed Jul 10 19:57:48 2019 (r349892) @@ -465,7 +465,8 @@ do_fork(struct thread *td, struct fork_req *fr, struct */ p2->p_flag = P_INMEM; p2->p_flag2 = p1->p_flag2 & (P2_ASLR_DISABLE | P2_ASLR_ENABLE | - P2_ASLR_IGNSTART | P2_NOTRACE | P2_NOTRACE_EXEC | P2_TRAPCAP); + P2_ASLR_IGNSTART | P2_NOTRACE | P2_NOTRACE_EXEC | + P2_PROTMAX_ENABLE | P2_PROTMAX_DISABLE | P2_TRAPCAP); p2->p_swtick = ticks; if (p1->p_flag & P_PROFIL) startprofclock(p2); From owner-svn-src-head@freebsd.org Wed Jul 10 20:19:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB07815E2B1E; Wed, 10 Jul 2019 20:19:49 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 2F98A704CE; Wed, 10 Jul 2019 20:19:49 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-io1-xd41.google.com with SMTP id k20so7518481ios.10; Wed, 10 Jul 2019 13:19:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MADvUaTXnTL2CQclZJxayupcXhlNjEDq9DzbE7a/uRI=; b=SET9N6lhHMkU0KIVXrmTrat8B73VTjknA9QBZLa86ZL6sYAlRYDM473BAZkvfO6kyC /YdEZ0pLm6Xxh/gnNGDJqIDnPrHvDyrfQyYGoRnBi4RvxM5v/yWIBbJv1br+bGSLazbj 9xRq1NeeELvyYGBf16xM7YWkhSHDhMZDo6RwWPE51juB80qAT/V8dbj7YsiJiE4B8evd vTjI/1izzfR02klnLXV0jOCDKYReVMY+6iwOraaZ+edz5vapQPBOnql/AMRHVNYVCogH qG3vasA4h3vIPYuvTAR2xvzxCiDwJZnCIczG9DXipQlbZl7Fbf8/NorlTnn66UBLNi/b +7ew== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=MADvUaTXnTL2CQclZJxayupcXhlNjEDq9DzbE7a/uRI=; b=QmHTgUViwnviv41yHziFb3dkJpeo4r/enM17PpQn8oZ1n52I9fzW1qwsXzdX/OR9wF kzr8XqHTFAwJz/xcY08ANyhLOwAF0d0EnYdcESrdV6xHAe9eXjU6V84/xeC8xpIozlCZ 2zM3j0iKJBJWhvYbzoyJaagB2CPqkw7OrT0PViaWRpQ2zNV4Vcw6lGpgv+68BDEeP7ng oxdZW1cDg2oJquw4ASbrnqbwQTNk7bhaD581WaUWmPXvUtKXkEEyYiNOlEzCSrrtca48 e85l6sLidLvNHAJHXWxPLLd7rlkFKC/RPGOPIaI5qDLzfmECs8gH/fzwkiYb1TzgsKi4 p9Tg== X-Gm-Message-State: APjAAAXBkASlmjxSGUyg3+vyxB/U9qW45v72oXMVTWCwwAAOiOoZ2CFv s21nRJDgVczTmnsSLpe14t9NNs34EjI= X-Google-Smtp-Source: APXvYqy5duge4xWNnlX8nrApte+canjQEKUDrUwXwlY1OLaos5QnaLFWgd5PJsnNtLb6t6SVMpehiA== X-Received: by 2002:a5e:a708:: with SMTP id b8mr35081665iod.25.1562789988228; Wed, 10 Jul 2019 13:19:48 -0700 (PDT) Received: from titan.knownspace (173-25-245-129.client.mchsi.com. [173.25.245.129]) by smtp.gmail.com with ESMTPSA id b8sm2519885ioj.16.2019.07.10.13.19.47 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 10 Jul 2019 13:19:48 -0700 (PDT) Date: Wed, 10 Jul 2019 15:19:44 -0500 From: Justin Hibbits To: Shawn Webb Cc: Philip Paeps , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet Message-ID: <20190710151944.0fd94ec3@titan.knownspace> In-Reply-To: <20190710195548.kdftfemj3icarcxo@mutt-hbsd> References: <201907101742.x6AHg4os016752@repo.freebsd.org> <20190710195548.kdftfemj3icarcxo@mutt-hbsd> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; powerpc64-portbld-freebsd13.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 2F98A704CE X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 20:19:50 -0000 On Wed, 10 Jul 2019 15:55:48 -0400 Shawn Webb wrote: > On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: > > Author: philip > > Date: Wed Jul 10 17:42:04 2019 > > New Revision: 349890 > > URL: https://svnweb.freebsd.org/changeset/base/349890 > > > > Log: > > telnet: fix a couple of snprintf() buffer overflows > > > > Obtained from: Juniper Networks > > MFC after: 1 week > > > > Modified: > > head/contrib/telnet/telnet/commands.c > > head/contrib/telnet/telnet/telnet.c > > head/contrib/telnet/telnet/utilities.c > > > > Modified: head/contrib/telnet/telnet/commands.c > > ============================================================================== > > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 > > 17:21:59 2019 (r349889) +++ > > head/contrib/telnet/telnet/commands.c Wed Jul 10 17:42:04 > > 2019 (r349890) @@ -1655,10 +1655,11 @@ env_init(void) char > > hbuf[256+1]; char *cp2 = strchr((char *)ep->value, ':'); > > > > - gethostname(hbuf, 256); > > - hbuf[256] = '\0'; > > - cp = (char *)malloc(strlen(hbuf) + strlen(cp2) + > > 1); > > - sprintf((char *)cp, "%s%s", hbuf, cp2); > > + gethostname(hbuf, sizeof(hbuf)); > > + hbuf[sizeof(hbuf)-1] = '\0'; > > + unsigned int buflen = strlen(hbuf) + strlen(cp2) + > > 1; > > buflen should be defined with the rest of the variables in the code > block above this one. Agreed. > > > + cp = (char *)malloc(sizeof(char)*buflen); > > Lack of NULL check here leads to > > > + snprintf((char *)cp, buflen, "%s%s", hbuf, cp2); > > potential NULL pointer deref here. I'm not sure if this is actually a problem. env_init() is called exactly once, at the beginning of main(), and the environment size is fully constrained by the OS. That said, this file it the only one in this component that does not check the return value of malloc(). All other uses, outside of this file, check and error. > > Thanks, > - Justin From owner-svn-src-head@freebsd.org Wed Jul 10 20:22:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A34F15E2D64 for ; Wed, 10 Jul 2019 20:22:22 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 176E670904 for ; Wed, 10 Jul 2019 20:22:22 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x743.google.com with SMTP id a27so2999248qkk.5 for ; Wed, 10 Jul 2019 13:22:22 -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:user-agent; bh=GE3Y0oRaMIibdHwfIAHAVvfwttW47sNPZaDKmkYvTbQ=; b=kKVFv7U3pVeN2HORVOKWb88nMt+sug+qgHxPtuL7d66JeRGt2wqz8HXyrlIhSz3Bpq b/znf+LcHd4DyvtWxd4sar3W9o3XeMrO9UH4bpI5ohp0GgfUctFtqt993+ntNDRSxu1l XvYBwkY/O2Nmy8dPHYvNOUR3NVqbUOc3Ki2BDshxD+r0RxH65D3UEZuNEORjpk1LBRin utIBkoDdcSmSuLElBIJnAdReaDGzQJdhYiVgBmWKdP+bR9SDCYWNc1g264nK+n6pN7do 280uDvmrb1odCYW5rSgT7zPRczY+Vm7Rzvq7ljPHFcLwdkKE639nWaMtgjNFn0BFh2cz RMyg== 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:user-agent; bh=GE3Y0oRaMIibdHwfIAHAVvfwttW47sNPZaDKmkYvTbQ=; b=TvPBP49zJPfMcEvE+916jJiHfk7q6GYidbxmFreA5WgrbsE7iBhNs3J81JLcdUF75H DY1EuLXFnf/x/BK39vbdSNzpDpHx2IEfK13tbC8vIoImgu2K5DsDpYfqW4PDPlGqWSyt +AmbuMVIe+R7iSDrTi5y7mdt8o3SZluAY5vzFxqMVl+Oed+kFICFctlEuPoSKUPmbzEk wcwzo40bHQh4yubfTCB5fT0J4XkRJQ+2DBx+totq1e9edE/5PYT0Ou8mPXB7I5LK5jz3 LW25D6ckZgooEAa83HMMV8pkhvo0TEanccubvL2F710xyFVz0Rp59u6cWmJa0GjZ5x1q RUMQ== X-Gm-Message-State: APjAAAV99Qh3Sdi0pTdFAGJBnQrVd5qJ4GJXx42HDYk19F8JHkTg/YCa SR6wxVa7RM/WvtRY2ToVV/6v6g== X-Google-Smtp-Source: APXvYqx8TuUO6yXvDkRWhJ8doD+5gS7UGZnDNZeQEhDd3EBjRPT9DKxGiVpSijeoKGj93q1GwkCbHQ== X-Received: by 2002:a37:7a84:: with SMTP id v126mr24105370qkc.439.1562790141051; Wed, 10 Jul 2019 13:22:21 -0700 (PDT) Received: from mutt-hbsd ([151.196.118.239]) by smtp.gmail.com with ESMTPSA id b7sm1404820qtt.38.2019.07.10.13.22.19 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 10 Jul 2019 13:22:20 -0700 (PDT) Date: Wed, 10 Jul 2019 16:22:18 -0400 From: Shawn Webb To: Justin Hibbits Cc: Philip Paeps , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet Message-ID: <20190710202218.yc3lcd6tsql3zkyr@mutt-hbsd> References: <201907101742.x6AHg4os016752@repo.freebsd.org> <20190710195548.kdftfemj3icarcxo@mutt-hbsd> <20190710151944.0fd94ec3@titan.knownspace> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="amaqwuyn6xpvcs6j" Content-Disposition: inline In-Reply-To: <20190710151944.0fd94ec3@titan.knownspace> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA User-Agent: NeoMutt/20180716 X-Rspamd-Queue-Id: 176E670904 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.984,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 20:22:22 -0000 --amaqwuyn6xpvcs6j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 10, 2019 at 03:19:44PM -0500, Justin Hibbits wrote: > On Wed, 10 Jul 2019 15:55:48 -0400 > Shawn Webb wrote: >=20 > > On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: > > > Author: philip > > > Date: Wed Jul 10 17:42:04 2019 > > > New Revision: 349890 > > > URL: https://svnweb.freebsd.org/changeset/base/349890 > > >=20 > > > Log: > > > telnet: fix a couple of snprintf() buffer overflows > > > =20 > > > Obtained from: Juniper Networks > > > MFC after: 1 week > > >=20 > > > Modified: > > > head/contrib/telnet/telnet/commands.c > > > head/contrib/telnet/telnet/telnet.c > > > head/contrib/telnet/telnet/utilities.c > > >=20 > > > Modified: head/contrib/telnet/telnet/commands.c > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 > > > 17:21:59 2019 (r349889) +++ > > > head/contrib/telnet/telnet/commands.c Wed Jul 10 17:42:04 > > > 2019 (r349890) @@ -1655,10 +1655,11 @@ env_init(void) char > > > hbuf[256+1]; char *cp2 =3D strchr((char *)ep->value, ':'); > > > =20 > > > - gethostname(hbuf, 256); > > > - hbuf[256] =3D '\0'; > > > - cp =3D (char *)malloc(strlen(hbuf) + strlen(cp2) + > > > 1); > > > - sprintf((char *)cp, "%s%s", hbuf, cp2); > > > + gethostname(hbuf, sizeof(hbuf)); > > > + hbuf[sizeof(hbuf)-1] =3D '\0'; > > > + unsigned int buflen =3D strlen(hbuf) + strlen(cp2) + > > > 1; =20 > >=20 > > buflen should be defined with the rest of the variables in the code > > block above this one. >=20 > Agreed. >=20 > >=20 > > > + cp =3D (char *)malloc(sizeof(char)*buflen); =20 > >=20 > > Lack of NULL check here leads to > >=20 > > > + snprintf((char *)cp, buflen, "%s%s", hbuf, cp2); =20 > >=20 > > potential NULL pointer deref here. >=20 > I'm not sure if this is actually a problem. env_init() is called > exactly once, at the beginning of main(), and the environment size is > fully constrained by the OS. >=20 > That said, this file it the only one in this component that does not > check the return value of malloc(). All other uses, outside of this > file, check and error. While fixing the style(9) violation above, we could still take care of the potential NULL deref at the same time. If anything, just for code correctness reasons? Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 --amaqwuyn6xpvcs6j Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl0mSPUACgkQ/y5nonf4 4frvKBAAivH1YeBwZUNG74MEdAj1APyfWpZnoJ//ReAdq/KhULPB3r9KSx2kjj3K GOkigEDKoRYNgIEVAhKBG6oyI3BBdnJJfHdF4Kl+OfmB/ORuGuUQOjWA7ddcFYRH +09PsOTnKckD2NpthTf1/CDzLtmYERIl7v1b9okUb9s2df5jYZGFwBMoKcccA8fP GwZaqmOuc1tc3fALVRqi3Xd0jV4750g+pkE36ggfMxgo1srlBCc1L9jiNqOwYjiK 7a3ccsfqcJoG/hGqjcGPUzR2xtTYCZ8crMTXebhtXYq+qH1Djx9lZX14LQXroQLO EQSL53KdfP7ZzH/M+Zyp5p2xHX8MnHiuGmdr0smYpT9m6db9WDN0/tDfSN8/xdys qmWWHR7CjWIxWitwTPz2VMFRrf08i3f5PYyxn64IhUUE5tAHdThMtn0OZTrXVKRk WFFw994IX7zOucJogiJrhfeyhX+fKe1JjkIyGDigzZJwFxIfslm47YJzcmZMn124 z/WG2iO17rbtYaaCvRRJnEeUMmCHhKJSqbKw0r3j4ehpPEvjZqjLS1EKL9Hw9BoV vM2unh2GM/g9ygREf9dwKSBk5BxSHLb88g9dDgR9eb7ZAaTODWpH1Z0L78tm9uNf pdm2ag7zNkfjOvN906TV83OHGL4cH8dtnqNQU5QUTcrFBljIQOY= =WE9C -----END PGP SIGNATURE----- --amaqwuyn6xpvcs6j-- From owner-svn-src-head@freebsd.org Wed Jul 10 20:40:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3631A15E3257; Wed, 10 Jul 2019 20:40:41 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D7B8C712B3; Wed, 10 Jul 2019 20:40:40 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A7E3D1C550; Wed, 10 Jul 2019 20:40:40 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AKeeQA006735; Wed, 10 Jul 2019 20:40:40 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AKeern006731; Wed, 10 Jul 2019 20:40:40 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <201907102040.x6AKeern006731@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Wed, 10 Jul 2019 20:40:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349893 - in head/sys: modules/tcp/rack netinet netinet/tcp_stacks sys X-SVN-Group: head X-SVN-Commit-Author: rrs X-SVN-Commit-Paths: in head/sys: modules/tcp/rack netinet netinet/tcp_stacks sys X-SVN-Commit-Revision: 349893 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D7B8C712B3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.930,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 20:40:41 -0000 Author: rrs Date: Wed Jul 10 20:40:39 2019 New Revision: 349893 URL: https://svnweb.freebsd.org/changeset/base/349893 Log: This commit updates rack to what is basically being used at NF as well as sets in some of the groundwork for committing BBR. The hpts system is updated as well as some other needed utilities for the entrance of BBR. This is actually part 1 of 3 more needed commits which will finally complete with BBRv1 being added as a new tcp stack. Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D20834 Added: head/sys/netinet/tcp_stacks/rack_bbr_common.c (contents, props changed) Modified: head/sys/modules/tcp/rack/Makefile head/sys/netinet/in_pcb.h head/sys/netinet/tcp.h head/sys/netinet/tcp_hpts.c head/sys/netinet/tcp_hpts.h head/sys/netinet/tcp_log_buf.h head/sys/netinet/tcp_stacks/rack.c head/sys/netinet/tcp_stacks/rack_bbr_common.h head/sys/netinet/tcp_var.h head/sys/sys/mbuf.h Modified: head/sys/modules/tcp/rack/Makefile ============================================================================== --- head/sys/modules/tcp/rack/Makefile Wed Jul 10 19:57:48 2019 (r349892) +++ head/sys/modules/tcp/rack/Makefile Wed Jul 10 20:40:39 2019 (r349893) @@ -6,7 +6,7 @@ STACKNAME= rack KMOD= tcp_${STACKNAME} -SRCS= rack.c sack_filter.c +SRCS= rack.c sack_filter.c rack_bbr_common.c SRCS+= opt_inet.h opt_inet6.h opt_ipsec.h SRCS+= opt_tcpdebug.h Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Wed Jul 10 19:57:48 2019 (r349892) +++ head/sys/netinet/in_pcb.h Wed Jul 10 20:40:39 2019 (r349893) @@ -759,7 +759,9 @@ int inp_so_options(const struct inpcb *inp); #define INP_ORIGDSTADDR 0x00000800 /* receive IP dst address/port */ #define INP_CANNOT_DO_ECN 0x00001000 /* The stack does not do ECN */ #define INP_REUSEPORT_LB 0x00002000 /* SO_REUSEPORT_LB option is set */ - +#define INP_SUPPORTS_MBUFQ 0x00004000 /* Supports the mbuf queue method of LRO */ +#define INP_MBUF_QUEUE_READY 0x00008000 /* The transport is pacing, inputs can be queued */ +#define INP_DONT_SACK_QUEUE 0x00010000 /* If a sack arrives do not wake me */ /* * Flags passed to in_pcblookup*() functions. */ Modified: head/sys/netinet/tcp.h ============================================================================== --- head/sys/netinet/tcp.h Wed Jul 10 19:57:48 2019 (r349892) +++ head/sys/netinet/tcp.h Wed Jul 10 20:40:39 2019 (r349893) @@ -201,9 +201,8 @@ struct tcphdr { #define TCP_RACK_TLP_THRESH 1063 /* RACK TLP theshold i.e. srtt+(srtt/N) */ #define TCP_RACK_PKT_DELAY 1064 /* RACK added ms i.e. rack-rtt + reord + N */ #define TCP_RACK_TLP_INC_VAR 1065 /* Does TLP include rtt variance in t-o */ -#define TCP_RACK_SESS_CWV 1066 /* Enable RFC7611 cwnd validation on sess */ #define TCP_BBR_IWINTSO 1067 /* Initial TSO window for BBRs first sends */ -#define TCP_BBR_RECFORCE 1068 /* Enter recovery force out a segment disregard pacer */ +#define TCP_BBR_RECFORCE 1068 /* Enter recovery force out a segment disregard pacer no longer valid */ #define TCP_BBR_STARTUP_PG 1069 /* Startup pacing gain */ #define TCP_BBR_DRAIN_PG 1070 /* Drain pacing gain */ #define TCP_BBR_RWND_IS_APP 1071 /* Rwnd limited is considered app limited */ @@ -211,14 +210,18 @@ struct tcphdr { #define TCP_BBR_ONE_RETRAN 1073 /* Is only one segment allowed out during retran */ #define TCP_BBR_STARTUP_LOSS_EXIT 1074 /* Do we exit a loss during startup if not 20% incr */ #define TCP_BBR_USE_LOWGAIN 1075 /* lower the gain in PROBE_BW enable */ -#define TCP_BBR_LOWGAIN_THRESH 1076 /* How many cycles do we stay in lowgain */ -#define TCP_BBR_LOWGAIN_HALF 1077 /* Do we halfstep lowgain down */ -#define TCP_BBR_LOWGAIN_FD 1078 /* Do we force a drain when lowgain in place */ +#define TCP_BBR_LOWGAIN_THRESH 1076 /* Unused after 2.3 morphs to TSLIMITS >= 2.3 */ +#define TCP_BBR_TSLIMITS 1076 /* Do we use experimental Timestamp limiting for our algo */ +#define TCP_BBR_LOWGAIN_HALF 1077 /* Unused after 2.3 */ +#define TCP_BBR_PACE_OH 1077 /* Reused in 4.2 for pacing overhead setting */ +#define TCP_BBR_LOWGAIN_FD 1078 /* Unused after 2.3 */ +#define TCP_BBR_HOLD_TARGET 1078 /* For 4.3 on */ #define TCP_BBR_USEDEL_RATE 1079 /* Enable use of delivery rate for loss recovery */ #define TCP_BBR_MIN_RTO 1080 /* Min RTO in milliseconds */ #define TCP_BBR_MAX_RTO 1081 /* Max RTO in milliseconds */ #define TCP_BBR_REC_OVER_HPTS 1082 /* Recovery override htps settings 0/1/3 */ -#define TCP_BBR_UNLIMITED 1083 /* Does BBR, in non-recovery not use cwnd */ +#define TCP_BBR_UNLIMITED 1083 /* Not used before 2.3 and morphs to algorithm >= 2.3 */ +#define TCP_BBR_ALGORITHM 1083 /* What measurement algo does BBR use netflix=0, google=1 */ #define TCP_BBR_DRAIN_INC_EXTRA 1084 /* Does the 3/4 drain target include the extra gain */ #define TCP_BBR_STARTUP_EXIT_EPOCH 1085 /* what epoch gets us out of startup */ #define TCP_BBR_PACE_PER_SEC 1086 @@ -227,17 +230,27 @@ struct tcphdr { #define TCP_BBR_PACE_SEG_MIN 1089 #define TCP_BBR_PACE_CROSS 1090 #define TCP_RACK_IDLE_REDUCE_HIGH 1092 /* Reduce the highest cwnd seen to IW on idle */ -#define TCP_RACK_IDLE_REDUCE_HIGH 1092 /* Reduce the highest cwnd seen to IW on idle */ #define TCP_RACK_MIN_PACE 1093 /* Do we enforce rack min pace time */ #define TCP_RACK_MIN_PACE_SEG 1094 /* If so what is the seg threshould */ +#define TCP_RACK_GP_INCREASE 1094 /* After 4.1 its the GP increase */ #define TCP_RACK_TLP_USE 1095 #define TCP_BBR_ACK_COMP_ALG 1096 /* Not used */ +#define TCP_BBR_TMR_PACE_OH 1096 /* Recycled in 4.2 */ #define TCP_BBR_EXTRA_GAIN 1097 #define TCP_BBR_RACK_RTT_USE 1098 /* what RTT should we use 0, 1, or 2? */ #define TCP_BBR_RETRAN_WTSO 1099 #define TCP_DATA_AFTER_CLOSE 1100 #define TCP_BBR_PROBE_RTT_GAIN 1101 #define TCP_BBR_PROBE_RTT_LEN 1102 +#define TCP_BBR_SEND_IWND_IN_TSO 1103 /* Do we burst out whole iwin size chunks at start? */ +#define TCP_BBR_USE_RACK_CHEAT 1104 /* Do we use the rack cheat for pacing rxt's */ +#define TCP_BBR_HDWR_PACE 1105 /* Enable/disable hardware pacing */ +#define TCP_BBR_UTTER_MAX_TSO 1106 /* Do we enforce an utter max TSO size */ +#define TCP_BBR_EXTRA_STATE 1107 /* Special exit-persist catch up */ +#define TCP_BBR_FLOOR_MIN_TSO 1108 /* The min tso size */ +#define TCP_BBR_MIN_TOPACEOUT 1109 /* Do we suspend pacing until */ +#define TCP_BBR_TSTMP_RAISES 1110 /* Can a timestamp measurement raise the b/w */ +#define TCP_BBR_POLICER_DETECT 1111 /* Turn on/off google mode policer detection */ /* Start of reserved space for third-party user-settable options. */ Modified: head/sys/netinet/tcp_hpts.c ============================================================================== --- head/sys/netinet/tcp_hpts.c Wed Jul 10 19:57:48 2019 (r349892) +++ head/sys/netinet/tcp_hpts.c Wed Jul 10 20:40:39 2019 (r349893) @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); * pacing packets out onto the wire. It can be used in two ways * by a given TCP stack (and those two methods can be used simultaneously). * - * First, and probably the main thing its used by Rack and BBR for, it can + * First, and probably the main thing its used by Rack and BBR, it can * be used to call tcp_output() of a transport stack at some time in the future. * The normal way this is done is that tcp_output() of the stack schedules * itself to be called again by calling tcp_hpts_insert(tcpcb, slot). The @@ -59,42 +59,57 @@ __FBSDID("$FreeBSD$"); * to prevent output processing until the time alotted has gone by. * Of course this is a bare bones example and the stack will probably * have more consideration then just the above. - * - * Now the tcp_hpts system will call tcp_output in one of two forms, - * it will first check to see if the stack as defined a - * tfb_tcp_output_wtime() function, if so that is the routine it - * will call, if that function is not defined then it will call the - * tfb_tcp_output() function. The only difference between these - * two calls is that the former passes the time in to the function - * so the function does not have to access the time (which tcp_hpts - * already has). What these functions do is of course totally up - * to the individual tcp stack. - * + * * Now the second function (actually two functions I guess :D) * the tcp_hpts system provides is the ability to either abort - * a connection (later) or process input on a connection. - * Why would you want to do this? To keep processor locality. + * a connection (later) or process input on a connection. + * Why would you want to do this? To keep processor locality + * and or not have to worry about untangling any recursive + * locks. The input function now is hooked to the new LRO + * system as well. * - * So in order to use the input redirection function the - * stack changes its tcp_do_segment() routine to instead - * of process the data call the function: + * In order to use the input redirection function the + * tcp stack must define an input function for + * tfb_do_queued_segments(). This function understands + * how to dequeue a array of packets that were input and + * knows how to call the correct processing routine. * - * tcp_queue_pkt_to_input() - * - * You will note that the arguments to this function look - * a lot like tcp_do_segments's arguments. This function - * will assure that the tcp_hpts system will - * call the functions tfb_tcp_hpts_do_segment() from the - * correct CPU. Note that multiple calls can get pushed - * into the tcp_hpts system this will be indicated by - * the next to last argument to tfb_tcp_hpts_do_segment() - * (nxt_pkt). If nxt_pkt is a 1 then another packet is - * coming. If nxt_pkt is a 0 then this is the last call - * that the tcp_hpts system has available for the tcp stack. + * Locking in this is important as well so most likely the + * stack will need to define the tfb_do_segment_nounlock() + * splitting tfb_do_segment() into two parts. The main processing + * part that does not unlock the INP and returns a value of 1 or 0. + * It returns 0 if all is well and the lock was not released. It + * returns 1 if we had to destroy the TCB (a reset received etc). + * The remains of tfb_do_segment() then become just a simple call + * to the tfb_do_segment_nounlock() function and check the return + * code and possibly unlock. * - * The other point of the input system is to be able to safely - * drop a tcp connection without worrying about the recursive - * locking that may be occuring on the INP_WLOCK. So if + * The stack must also set the flag on the INP that it supports this + * feature i.e. INP_SUPPORTS_MBUFQ. The LRO code recoginizes + * this flag as well and will queue packets when it is set. + * There are other flags as well INP_MBUF_QUEUE_READY and + * INP_DONT_SACK_QUEUE. The first flag tells the LRO code + * that we are in the pacer for output so there is no + * need to wake up the hpts system to get immediate + * input. The second tells the LRO code that its okay + * if a SACK arrives you can still defer input and let + * the current hpts timer run (this is usually set when + * a rack timer is up so we know SACK's are happening + * on the connection already and don't want to wakeup yet). + * + * There is a common functions within the rack_bbr_common code + * version i.e. ctf_do_queued_segments(). This function + * knows how to take the input queue of packets from + * tp->t_in_pkts and process them digging out + * all the arguments, calling any bpf tap and + * calling into tfb_do_segment_nounlock(). The common + * function (ctf_do_queued_segments()) requires that + * you have defined the tfb_do_segment_nounlock() as + * described above. + * + * The second feature of the input side of hpts is the + * dropping of a connection. This is due to the way that + * locking may have occured on the INP_WLOCK. So if * a stack wants to drop a connection it calls: * * tcp_set_inp_to_drop(tp, ETIMEDOUT) @@ -156,6 +171,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef tcpdebug #include @@ -168,24 +184,19 @@ __FBSDID("$FreeBSD$"); MALLOC_DEFINE(M_TCPHPTS, "tcp_hpts", "TCP hpts"); #ifdef RSS -#include -#include static int tcp_bind_threads = 1; #else static int tcp_bind_threads = 2; #endif TUNABLE_INT("net.inet.tcp.bind_hptss", &tcp_bind_threads); -static uint32_t tcp_hpts_logging_size = DEFAULT_HPTS_LOG; - -TUNABLE_INT("net.inet.tcp.hpts_logging_sz", &tcp_hpts_logging_size); - static struct tcp_hptsi tcp_pace; +static int hpts_does_tp_logging = 0; static void tcp_wakehpts(struct tcp_hpts_entry *p); static void tcp_wakeinput(struct tcp_hpts_entry *p); static void tcp_input_data(struct tcp_hpts_entry *hpts, struct timeval *tv); -static void tcp_hptsi(struct tcp_hpts_entry *hpts, struct timeval *ctick); +static void tcp_hptsi(struct tcp_hpts_entry *hpts); static void tcp_hpts_thread(void *ctx); static void tcp_init_hptsi(void *st); @@ -204,8 +215,6 @@ SYSCTL_NODE(_net_inet_tcp, OID_AUTO, hpts, CTLFLAG_RW, } \ } while (0) -static int32_t logging_on = 0; -static int32_t hpts_sleep_max = (NUM_OF_HPTSI_SLOTS - 2); static int32_t tcp_hpts_precision = 120; struct hpts_domain_info { @@ -219,44 +228,75 @@ SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, precision, CT &tcp_hpts_precision, 120, "Value for PRE() precision of callout"); -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, logging, CTLFLAG_RW, - &logging_on, 0, - "Turn on logging if compiled in"); +counter_u64_t hpts_hopelessly_behind; +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, hopeless, CTLFLAG_RD, + &hpts_hopelessly_behind, + "Number of times hpts could not catch up and was behind hopelessly"); + counter_u64_t hpts_loops; SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, loops, CTLFLAG_RD, &hpts_loops, "Number of times hpts had to loop to catch up"); + counter_u64_t back_tosleep; SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, no_tcbsfound, CTLFLAG_RD, &back_tosleep, "Number of times hpts found no tcbs"); -static int32_t in_newts_every_tcb = 0; +counter_u64_t combined_wheel_wrap; -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, in_tsperpcb, CTLFLAG_RW, - &in_newts_every_tcb, 0, - "Do we have a new cts every tcb we process for input"); -static int32_t in_ts_percision = 0; +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, comb_wheel_wrap, CTLFLAG_RD, + &combined_wheel_wrap, "Number of times the wheel lagged enough to have an insert see wrap"); -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, in_tspercision, CTLFLAG_RW, - &in_ts_percision, 0, - "Do we use percise timestamp for clients on input"); -static int32_t out_newts_every_tcb = 0; +counter_u64_t wheel_wrap; -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, out_tsperpcb, CTLFLAG_RW, - &out_newts_every_tcb, 0, - "Do we have a new cts every tcb we process for output"); +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, wheel_wrap, CTLFLAG_RD, + &wheel_wrap, "Number of times the wheel lagged enough to have an insert see wrap"); + static int32_t out_ts_percision = 0; SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, out_tspercision, CTLFLAG_RW, &out_ts_percision, 0, "Do we use a percise timestamp for every output cts"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, logging, CTLFLAG_RW, + &hpts_does_tp_logging, 0, + "Do we add to any tp that has logging on pacer logs"); -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, maxsleep, CTLFLAG_RW, +static int32_t max_pacer_loops = 10; +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, loopmax, CTLFLAG_RW, + &max_pacer_loops, 10, + "What is the maximum number of times the pacer will loop trying to catch up"); + +#define HPTS_MAX_SLEEP_ALLOWED (NUM_OF_HPTSI_SLOTS/2) + +static uint32_t hpts_sleep_max = HPTS_MAX_SLEEP_ALLOWED; + + +static int +sysctl_net_inet_tcp_hpts_max_sleep(SYSCTL_HANDLER_ARGS) +{ + int error; + uint32_t new; + + new = hpts_sleep_max; + error = sysctl_handle_int(oidp, &new, 0, req); + if (error == 0 && req->newptr) { + if ((new < (NUM_OF_HPTSI_SLOTS / 4)) || + (new > HPTS_MAX_SLEEP_ALLOWED)) + error = EINVAL; + else + hpts_sleep_max = new; + } + return (error); +} + +SYSCTL_PROC(_net_inet_tcp_hpts, OID_AUTO, maxsleep, + CTLTYPE_UINT | CTLFLAG_RW, &hpts_sleep_max, 0, - "The maximum time the hpts will sleep <1 - 254>"); + &sysctl_net_inet_tcp_hpts_max_sleep, "IU", + "Maximum time hpts will sleep"); SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, minsleep, CTLFLAG_RW, &tcp_min_hptsi_time, 0, @@ -267,55 +307,35 @@ SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, skip_swi, CTL "Do we have the callout call directly to the hpts?"); static void -__tcp_hpts_log_it(struct tcp_hpts_entry *hpts, struct inpcb *inp, int event, uint32_t slot, - uint32_t ticknow, int32_t line) +tcp_hpts_log(struct tcp_hpts_entry *hpts, struct tcpcb *tp, struct timeval *tv, + int ticks_to_run, int idx) { - struct hpts_log *pl; - - HPTS_MTX_ASSERT(hpts); - if (hpts->p_log == NULL) - return; - pl = &hpts->p_log[hpts->p_log_at]; - hpts->p_log_at++; - if (hpts->p_log_at >= hpts->p_logsize) { - hpts->p_log_at = 0; - hpts->p_log_wrapped = 1; - } - pl->inp = inp; - if (inp) { - pl->t_paceslot = inp->inp_hptsslot; - pl->t_hptsreq = inp->inp_hpts_request; - pl->p_onhpts = inp->inp_in_hpts; - pl->p_oninput = inp->inp_in_input; - } else { - pl->t_paceslot = 0; - pl->t_hptsreq = 0; - pl->p_onhpts = 0; - pl->p_oninput = 0; - } - pl->is_notempty = 1; - pl->event = event; - pl->line = line; - pl->cts = tcp_get_usecs(NULL); - pl->p_curtick = hpts->p_curtick; - pl->p_prevtick = hpts->p_prevtick; - pl->p_on_queue_cnt = hpts->p_on_queue_cnt; - pl->ticknow = ticknow; - pl->slot_req = slot; - pl->p_nxt_slot = hpts->p_nxt_slot; - pl->p_cur_slot = hpts->p_cur_slot; - pl->p_hpts_sleep_time = hpts->p_hpts_sleep_time; - pl->p_flags = (hpts->p_cpu & 0x7f); - pl->p_flags <<= 7; - pl->p_flags |= (hpts->p_num & 0x7f); - pl->p_flags <<= 2; - if (hpts->p_hpts_active) { - pl->p_flags |= HPTS_HPTS_ACTIVE; - } + union tcp_log_stackspecific log; + + memset(&log.u_bbr, 0, sizeof(log.u_bbr)); + log.u_bbr.flex1 = hpts->p_nxt_slot; + log.u_bbr.flex2 = hpts->p_cur_slot; + log.u_bbr.flex3 = hpts->p_prev_slot; + log.u_bbr.flex4 = idx; + log.u_bbr.flex5 = hpts->p_curtick; + log.u_bbr.flex6 = hpts->p_on_queue_cnt; + log.u_bbr.use_lt_bw = 1; + log.u_bbr.inflight = ticks_to_run; + log.u_bbr.applimited = hpts->overidden_sleep; + log.u_bbr.delivered = hpts->saved_curtick; + log.u_bbr.timeStamp = tcp_tv_to_usectick(tv); + log.u_bbr.epoch = hpts->saved_curslot; + log.u_bbr.lt_epoch = hpts->saved_prev_slot; + log.u_bbr.pkts_out = hpts->p_delayed_by; + log.u_bbr.lost = hpts->p_hpts_sleep_time; + log.u_bbr.cur_del_rate = hpts->p_runningtick; + TCP_LOG_EVENTP(tp, NULL, + &tp->t_inpcb->inp_socket->so_rcv, + &tp->t_inpcb->inp_socket->so_snd, + BBR_LOG_HPTSDIAG, 0, + 0, &log, false, tv); } -#define tcp_hpts_log_it(a, b, c, d, e) __tcp_hpts_log_it(a, b, c, d, e, __LINE__) - static void hpts_timeout_swi(void *arg) { @@ -347,12 +367,6 @@ hpts_sane_pace_remove(struct tcp_hpts_entry *hpts, str /* We are not on the hpts? */ panic("%s: hpts:%p inp:%p not on the hpts?", __FUNCTION__, hpts, inp); } - if (TAILQ_EMPTY(head) && - (hpts->p_on_queue_cnt != 0)) { - /* We should not be empty with a queue count */ - panic("%s hpts:%p hpts bucket empty but cnt:%d", - __FUNCTION__, hpts, hpts->p_on_queue_cnt); - } #endif TAILQ_REMOVE(head, inp, inp_hpts); hpts->p_on_queue_cnt--; @@ -456,58 +470,13 @@ hpts_sane_input_insert(struct tcp_hpts_entry *hpts, st in_pcbref(inp); } -static int -sysctl_tcp_hpts_log(SYSCTL_HANDLER_ARGS) -{ - struct tcp_hpts_entry *hpts; - size_t sz; - int32_t logging_was, i; - int32_t error = 0; - - /* - * HACK: Turn off logging so no locks are required this really needs - * a memory barrier :) - */ - logging_was = logging_on; - logging_on = 0; - if (!req->oldptr) { - /* How much? */ - sz = 0; - for (i = 0; i < tcp_pace.rp_num_hptss; i++) { - hpts = tcp_pace.rp_ent[i]; - if (hpts->p_log == NULL) - continue; - sz += (sizeof(struct hpts_log) * hpts->p_logsize); - } - error = SYSCTL_OUT(req, 0, sz); - } else { - for (i = 0; i < tcp_pace.rp_num_hptss; i++) { - hpts = tcp_pace.rp_ent[i]; - if (hpts->p_log == NULL) - continue; - if (hpts->p_log_wrapped) - sz = (sizeof(struct hpts_log) * hpts->p_logsize); - else - sz = (sizeof(struct hpts_log) * hpts->p_log_at); - error = SYSCTL_OUT(req, hpts->p_log, sz); - } - } - logging_on = logging_was; - return error; -} - -SYSCTL_PROC(_net_inet_tcp_hpts, OID_AUTO, log, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, - 0, 0, sysctl_tcp_hpts_log, "A", "tcp hptsi log"); - - static void tcp_wakehpts(struct tcp_hpts_entry *hpts) { HPTS_MTX_ASSERT(hpts); - swi_sched(hpts->ie_cookie, 0); - if (hpts->p_hpts_active == 2) { - /* Rare sleeping on a ENOBUF */ - wakeup_one(hpts); + if (hpts->p_hpts_wake_scheduled == 0) { + hpts->p_hpts_wake_scheduled = 1; + swi_sched(hpts->ie_cookie, 0); } } @@ -515,10 +484,9 @@ static void tcp_wakeinput(struct tcp_hpts_entry *hpts) { HPTS_MTX_ASSERT(hpts); - swi_sched(hpts->ie_cookie, 0); - if (hpts->p_hpts_active == 2) { - /* Rare sleeping on a ENOBUF */ - wakeup_one(hpts); + if (hpts->p_hpts_wake_scheduled == 0) { + hpts->p_hpts_wake_scheduled = 1; + swi_sched(hpts->ie_cookie, 0); } } @@ -648,8 +616,8 @@ tcp_hpts_remove_locked_input(struct tcp_hpts_entry *hp * Valid values in the flags are * HPTS_REMOVE_OUTPUT - remove from the output of the hpts. * HPTS_REMOVE_INPUT - remove from the input of the hpts. - * Note that you can or both values together and get two - * actions. + * Note that you can use one or both values together + * and get two actions. */ void __tcp_hpts_remove(struct inpcb *inp, int32_t flags, int32_t line) @@ -670,53 +638,198 @@ __tcp_hpts_remove(struct inpcb *inp, int32_t flags, in } static inline int -hpts_tick(struct tcp_hpts_entry *hpts, int32_t plus) +hpts_tick(uint32_t wheel_tick, uint32_t plus) { - return ((hpts->p_prevtick + plus) % NUM_OF_HPTSI_SLOTS); + /* + * Given a slot on the wheel, what slot + * is that plus ticks out? + */ + KASSERT(wheel_tick < NUM_OF_HPTSI_SLOTS, ("Invalid tick %u not on wheel", wheel_tick)); + return ((wheel_tick + plus) % NUM_OF_HPTSI_SLOTS); } +static inline int +tick_to_wheel(uint32_t cts_in_wticks) +{ + /* + * Given a timestamp in wheel ticks (10usec inc's) + * map it to our limited space wheel. + */ + return (cts_in_wticks % NUM_OF_HPTSI_SLOTS); +} + +static inline int +hpts_ticks_diff(int prev_tick, int tick_now) +{ + /* + * Given two ticks that are someplace + * on our wheel. How far are they apart? + */ + if (tick_now > prev_tick) + return (tick_now - prev_tick); + else if (tick_now == prev_tick) + /* + * Special case, same means we can go all of our + * wheel less one slot. + */ + return (NUM_OF_HPTSI_SLOTS - 1); + else + return ((NUM_OF_HPTSI_SLOTS - prev_tick) + tick_now); +} + +/* + * Given a tick on the wheel that is the current time + * mapped to the wheel (wheel_tick), what is the maximum + * distance forward that can be obtained without + * wrapping past either prev_tick or running_tick + * depending on the htps state? Also if passed + * a uint32_t *, fill it with the tick location. + * + * Note if you do not give this function the current + * time (that you think it is) mapped to the wheel + * then the results will not be what you expect and + * could lead to invalid inserts. + */ +static inline int32_t +max_ticks_available(struct tcp_hpts_entry *hpts, uint32_t wheel_tick, uint32_t *target_tick) +{ + uint32_t dis_to_travel, end_tick, pacer_to_now, avail_on_wheel; + + if ((hpts->p_hpts_active == 1) && + (hpts->p_wheel_complete == 0)) { + end_tick = hpts->p_runningtick; + /* Back up one tick */ + if (end_tick == 0) + end_tick = NUM_OF_HPTSI_SLOTS - 1; + else + end_tick--; + if (target_tick) + *target_tick = end_tick; + } else { + /* + * For the case where we are + * not active, or we have + * completed the pass over + * the wheel, we can use the + * prev tick and subtract one from it. This puts us + * as far out as possible on the wheel. + */ + end_tick = hpts->p_prev_slot; + if (end_tick == 0) + end_tick = NUM_OF_HPTSI_SLOTS - 1; + else + end_tick--; + if (target_tick) + *target_tick = end_tick; + /* + * Now we have close to the full wheel left minus the + * time it has been since the pacer went to sleep. Note + * that wheel_tick, passed in, should be the current time + * from the perspective of the caller, mapped to the wheel. + */ + if (hpts->p_prev_slot != wheel_tick) + dis_to_travel = hpts_ticks_diff(hpts->p_prev_slot, wheel_tick); + else + dis_to_travel = 1; + /* + * dis_to_travel in this case is the space from when the + * pacer stopped (p_prev_slot) and where our wheel_tick + * is now. To know how many slots we can put it in we + * subtract from the wheel size. We would not want + * to place something after p_prev_slot or it will + * get ran too soon. + */ + return (NUM_OF_HPTSI_SLOTS - dis_to_travel); + } + /* + * So how many slots are open between p_runningtick -> p_cur_slot + * that is what is currently un-available for insertion. Special + * case when we are at the last slot, this gets 1, so that + * the answer to how many slots are available is all but 1. + */ + if (hpts->p_runningtick == hpts->p_cur_slot) + dis_to_travel = 1; + else + dis_to_travel = hpts_ticks_diff(hpts->p_runningtick, hpts->p_cur_slot); + /* + * How long has the pacer been running? + */ + if (hpts->p_cur_slot != wheel_tick) { + /* The pacer is a bit late */ + pacer_to_now = hpts_ticks_diff(hpts->p_cur_slot, wheel_tick); + } else { + /* The pacer is right on time, now == pacers start time */ + pacer_to_now = 0; + } + /* + * To get the number left we can insert into we simply + * subract the distance the pacer has to run from how + * many slots there are. + */ + avail_on_wheel = NUM_OF_HPTSI_SLOTS - dis_to_travel; + /* + * Now how many of those we will eat due to the pacer's + * time (p_cur_slot) of start being behind the + * real time (wheel_tick)? + */ + if (avail_on_wheel <= pacer_to_now) { + /* + * Wheel wrap, we can't fit on the wheel, that + * is unusual the system must be way overloaded! + * Insert into the assured tick, and return special + * "0". + */ + counter_u64_add(combined_wheel_wrap, 1); + *target_tick = hpts->p_nxt_slot; + return (0); + } else { + /* + * We know how many slots are open + * on the wheel (the reverse of what + * is left to run. Take away the time + * the pacer started to now (wheel_tick) + * and that tells you how many slots are + * open that can be inserted into that won't + * be touched by the pacer until later. + */ + return (avail_on_wheel - pacer_to_now); + } +} + static int tcp_queue_to_hpts_immediate_locked(struct inpcb *inp, struct tcp_hpts_entry *hpts, int32_t line, int32_t noref) { - int32_t need_wake = 0; - uint32_t ticknow = 0; - + uint32_t need_wake = 0; + HPTS_MTX_ASSERT(hpts); if (inp->inp_in_hpts == 0) { /* Ok we need to set it on the hpts in the current slot */ - if (hpts->p_hpts_active == 0) { - /* A sleeping hpts we want in next slot to run */ - if (logging_on) { - tcp_hpts_log_it(hpts, inp, HPTSLOG_INSERT_SLEEPER, 0, - hpts_tick(hpts, 1)); - } - inp->inp_hptsslot = hpts_tick(hpts, 1); - inp->inp_hpts_request = 0; - if (logging_on) { - tcp_hpts_log_it(hpts, inp, HPTSLOG_SLEEP_BEFORE, 1, ticknow); - } - need_wake = 1; + inp->inp_hpts_request = 0; + if ((hpts->p_hpts_active == 0) || + (hpts->p_wheel_complete)) { + /* + * A sleeping hpts we want in next slot to run + * note that in this state p_prev_slot == p_cur_slot + */ + inp->inp_hptsslot = hpts_tick(hpts->p_prev_slot, 1); + if ((hpts->p_on_min_sleep == 0) && (hpts->p_hpts_active == 0)) + need_wake = 1; } else if ((void *)inp == hpts->p_inp) { /* + * The hpts system is running and the caller + * was awoken by the hpts system. * We can't allow you to go into the same slot we - * are in. We must put you out. + * are in (we don't want a loop :-D). */ inp->inp_hptsslot = hpts->p_nxt_slot; } else - inp->inp_hptsslot = hpts->p_cur_slot; + inp->inp_hptsslot = hpts->p_runningtick; hpts_sane_pace_insert(hpts, inp, &hpts->p_hptss[inp->inp_hptsslot], line, noref); - inp->inp_hpts_request = 0; - if (logging_on) { - tcp_hpts_log_it(hpts, inp, HPTSLOG_IMMEDIATE, 0, 0); - } if (need_wake) { /* * Activate the hpts if it is sleeping and its * timeout is not 1. */ - if (logging_on) { - tcp_hpts_log_it(hpts, inp, HPTSLOG_WAKEUP_HPTS, 0, ticknow); - } hpts->p_direct_wake = 1; tcp_wakehpts(hpts); } @@ -737,141 +850,129 @@ __tcp_queue_to_hpts_immediate(struct inpcb *inp, int32 return (ret); } +#ifdef INVARIANTS static void -tcp_hpts_insert_locked(struct tcp_hpts_entry *hpts, struct inpcb *inp, uint32_t slot, uint32_t cts, int32_t line, - struct hpts_diag *diag, int32_t noref) +check_if_slot_would_be_wrong(struct tcp_hpts_entry *hpts, struct inpcb *inp, uint32_t inp_hptsslot, int line) { - int32_t need_new_to = 0; - int32_t need_wakeup = 0; - uint32_t largest_slot; - uint32_t ticknow = 0; - uint32_t slot_calc; + /* + * Sanity checks for the pacer with invariants + * on insert. + */ + if (inp_hptsslot >= NUM_OF_HPTSI_SLOTS) + panic("hpts:%p inp:%p slot:%d > max", + hpts, inp, inp_hptsslot); + if ((hpts->p_hpts_active) && + (hpts->p_wheel_complete == 0)) { + /* + * If the pacer is processing a arc + * of the wheel, we need to make + * sure we are not inserting within + * that arc. + */ + int distance, yet_to_run; + distance = hpts_ticks_diff(hpts->p_runningtick, inp_hptsslot); + if (hpts->p_runningtick != hpts->p_cur_slot) + yet_to_run = hpts_ticks_diff(hpts->p_runningtick, hpts->p_cur_slot); + else + yet_to_run = 0; /* processing last slot */ + if (yet_to_run > distance) { + panic("hpts:%p inp:%p slot:%d distance:%d yet_to_run:%d rs:%d cs:%d", + hpts, inp, inp_hptsslot, + distance, yet_to_run, + hpts->p_runningtick, hpts->p_cur_slot); + } + } +} +#endif + +static void +tcp_hpts_insert_locked(struct tcp_hpts_entry *hpts, struct inpcb *inp, uint32_t slot, int32_t line, + struct hpts_diag *diag, struct timeval *tv) +{ + uint32_t need_new_to = 0; + uint32_t wheel_cts, last_tick; + int32_t wheel_tick, maxticks; + int8_t need_wakeup = 0; + HPTS_MTX_ASSERT(hpts); if (diag) { memset(diag, 0, sizeof(struct hpts_diag)); diag->p_hpts_active = hpts->p_hpts_active; + diag->p_prev_slot = hpts->p_prev_slot; + diag->p_runningtick = hpts->p_runningtick; diag->p_nxt_slot = hpts->p_nxt_slot; diag->p_cur_slot = hpts->p_cur_slot; + diag->p_curtick = hpts->p_curtick; + diag->p_lasttick = hpts->p_lasttick; diag->slot_req = slot; + diag->p_on_min_sleep = hpts->p_on_min_sleep; + diag->hpts_sleep_time = hpts->p_hpts_sleep_time; } - if ((inp->inp_in_hpts == 0) || noref) { - inp->inp_hpts_request = slot; + if (inp->inp_in_hpts == 0) { if (slot == 0) { /* Immediate */ - tcp_queue_to_hpts_immediate_locked(inp, hpts, line, noref); + tcp_queue_to_hpts_immediate_locked(inp, hpts, line, 0); return; } - if (hpts->p_hpts_active) { - /* - * Its slot - 1 since nxt_slot is the next tick that - * will go off since the hpts is awake - */ - if (logging_on) { - tcp_hpts_log_it(hpts, inp, HPTSLOG_INSERT_NORMAL, slot, 0); - } - /* - * We want to make sure that we don't place a inp in - * the range of p_cur_slot <-> p_nxt_slot. If we - * take from p_nxt_slot to the end, plus p_cur_slot - * and then take away 2, we will know how many is - * the max slots we can use. - */ - if (hpts->p_nxt_slot > hpts->p_cur_slot) { - /* - * Non-wrap case nxt_slot <-> cur_slot we - * don't want to land in. So the diff gives - * us what is taken away from the number of - * slots. + /* Get the current time relative to the wheel */ + wheel_cts = tcp_tv_to_hptstick(tv); + /* Map it onto the wheel */ + wheel_tick = tick_to_wheel(wheel_cts); + /* Now what's the max we can place it at? */ + maxticks = max_ticks_available(hpts, wheel_tick, &last_tick); + if (diag) { + diag->wheel_tick = wheel_tick; + diag->maxticks = maxticks; + diag->wheel_cts = wheel_cts; + } + if (maxticks == 0) { + /* The pacer is in a wheel wrap behind, yikes! */ + if (slot > 1) { + /* + * Reduce by 1 to prevent a forever loop in + * case something else is wrong. Note this + * probably does not hurt because the pacer + * if its true is so far behind we will be + * > 1second late calling anyway. */ - largest_slot = NUM_OF_HPTSI_SLOTS - (hpts->p_nxt_slot - hpts->p_cur_slot); - } else if (hpts->p_nxt_slot == hpts->p_cur_slot) { - largest_slot = NUM_OF_HPTSI_SLOTS - 2; - } else { - /* - * Wrap case so the diff gives us the number - * of slots that we can land in. - */ - largest_slot = hpts->p_cur_slot - hpts->p_nxt_slot; + slot--; } - /* - * We take away two so we never have a problem (20 - * usec's) out of 1024000 usecs - */ - largest_slot -= 2; - if (inp->inp_hpts_request > largest_slot) { - /* - * Restrict max jump of slots and remember - * leftover - */ - slot = largest_slot; - inp->inp_hpts_request -= largest_slot; - } else { - /* This one will run when we hit it */ - inp->inp_hpts_request = 0; - } - if (hpts->p_nxt_slot == hpts->p_cur_slot) - slot_calc = (hpts->p_nxt_slot + slot) % NUM_OF_HPTSI_SLOTS; - else - slot_calc = (hpts->p_nxt_slot + slot - 1) % NUM_OF_HPTSI_SLOTS; - if (slot_calc == hpts->p_cur_slot) { + inp->inp_hptsslot = last_tick; + inp->inp_hpts_request = slot; + } else if (maxticks >= slot) { + /* It all fits on the wheel */ + inp->inp_hpts_request = 0; + inp->inp_hptsslot = hpts_tick(wheel_tick, slot); + } else { + /* It does not fit */ + inp->inp_hpts_request = slot - maxticks; + inp->inp_hptsslot = last_tick; + } + if (diag) { + diag->slot_remaining = inp->inp_hpts_request; + diag->inp_hptsslot = inp->inp_hptsslot; + } #ifdef INVARIANTS - /* TSNH */ - panic("Hpts:%p impossible slot calculation slot_calc:%u slot:%u largest:%u\n", - hpts, slot_calc, slot, largest_slot); + check_if_slot_would_be_wrong(hpts, inp, inp->inp_hptsslot, line); #endif - if (slot_calc) - slot_calc--; - else - slot_calc = NUM_OF_HPTSI_SLOTS - 1; - } - inp->inp_hptsslot = slot_calc; - if (diag) { - diag->inp_hptsslot = inp->inp_hptsslot; - } - } else { + hpts_sane_pace_insert(hpts, inp, &hpts->p_hptss[inp->inp_hptsslot], line, 0); + if ((hpts->p_hpts_active == 0) && + (inp->inp_hpts_request == 0) && + (hpts->p_on_min_sleep == 0)) { /* - * The hpts is sleeping, we need to figure out where + * The hpts is sleeping and not on a minimum + * sleep time, we need to figure out where * it will wake up at and if we need to reschedule * its time-out. */ uint32_t have_slept, yet_to_sleep; - uint32_t slot_now; - struct timeval tv; - ticknow = tcp_gethptstick(&tv); - slot_now = ticknow % NUM_OF_HPTSI_SLOTS; - /* - * The user wants to be inserted at (slot_now + - * slot) % NUM_OF_HPTSI_SLOTS, so lets set that up. - */ - largest_slot = NUM_OF_HPTSI_SLOTS - 2; - if (inp->inp_hpts_request > largest_slot) { - /* Adjust the residual in inp_hpts_request */ - slot = largest_slot; - inp->inp_hpts_request -= largest_slot; - } else { - /* No residual it all fits */ - inp->inp_hpts_request = 0; - } - inp->inp_hptsslot = (slot_now + slot) % NUM_OF_HPTSI_SLOTS; - if (diag) { - diag->slot_now = slot_now; - diag->inp_hptsslot = inp->inp_hptsslot; - diag->p_on_min_sleep = hpts->p_on_min_sleep; - } - if (logging_on) { - tcp_hpts_log_it(hpts, inp, HPTSLOG_INSERT_SLEEPER, slot, ticknow); - } /* Now do we need to restart the hpts's timer? */ - if (TSTMP_GT(ticknow, hpts->p_curtick)) - have_slept = ticknow - hpts->p_curtick; - else - have_slept = 0; - if (have_slept < hpts->p_hpts_sleep_time) { - /* This should be what happens */ + have_slept = hpts_ticks_diff(hpts->p_prev_slot, wheel_tick); + if (have_slept < hpts->p_hpts_sleep_time) yet_to_sleep = hpts->p_hpts_sleep_time - have_slept; - } else { + else { /* We are over-due */ yet_to_sleep = 0; need_wakeup = 1; @@ -879,29 +980,22 @@ tcp_hpts_insert_locked(struct tcp_hpts_entry *hpts, st if (diag) { diag->have_slept = have_slept; diag->yet_to_sleep = yet_to_sleep; - diag->hpts_sleep_time = hpts->p_hpts_sleep_time; } - if ((hpts->p_on_min_sleep == 0) && (yet_to_sleep > slot)) { + if (yet_to_sleep && + (yet_to_sleep > slot)) { /* - * We need to reschedule the hptss time-out. + * We need to reschedule the hpts's time-out. */ hpts->p_hpts_sleep_time = slot; need_new_to = slot * HPTS_TICKS_PER_USEC; } } - hpts_sane_pace_insert(hpts, inp, &hpts->p_hptss[inp->inp_hptsslot], line, noref); - if (logging_on) { - tcp_hpts_log_it(hpts, inp, HPTSLOG_INSERTED, slot, ticknow); - } /* * Now how far is the hpts sleeping to? if active is 1, its * up and ticking we do nothing, otherwise we may need to * reschedule its callout if need_new_to is set from above. */ if (need_wakeup) { - if (logging_on) { - tcp_hpts_log_it(hpts, inp, HPTSLOG_RESCHEDULE, 1, 0); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Jul 10 22:24:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3CAD15E4DB7; Wed, 10 Jul 2019 22:24:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 72DCA7501B; Wed, 10 Jul 2019 22:24:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B9721D827; Wed, 10 Jul 2019 22:24:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AMO0X7062091; Wed, 10 Jul 2019 22:24:00 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AMNxHo062084; Wed, 10 Jul 2019 22:23:59 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907102223.x6AMNxHo062084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 10 Jul 2019 22:23:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349895 - head/sys/dev/isci X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/isci X-SVN-Commit-Revision: 349895 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 72DCA7501B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 22:24:01 -0000 Author: imp Date: Wed Jul 10 22:23:59 2019 New Revision: 349895 URL: https://svnweb.freebsd.org/changeset/base/349895 Log: Enforce a 4GB DMA boundary on isci(4) This device cannot cross a 4GB boundary with DMA. Removing the boundary in r346386 resulted in low frequency memory corruption on machines with isci(4) controllers. Submitted by: gallatin@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20910 Modified: head/sys/dev/isci/isci.c head/sys/dev/isci/isci.h head/sys/dev/isci/isci_controller.c Modified: head/sys/dev/isci/isci.c ============================================================================== --- head/sys/dev/isci/isci.c Wed Jul 10 21:35:55 2019 (r349894) +++ head/sys/dev/isci/isci.c Wed Jul 10 22:23:59 2019 (r349895) @@ -414,7 +414,8 @@ isci_allocate_dma_buffer(device_t device, struct ISCI_ uint32_t status; status = bus_dma_tag_create(bus_get_dma_tag(device), - 0x40 /* cacheline alignment */, 0x0, BUS_SPACE_MAXADDR, + 0x40 /* cacheline alignment */, + ISCI_DMA_BOUNDARY, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, memory->size, 0x1 /* we want physically contiguous */, memory->size, 0, busdma_lock_mutex, &controller->lock, Modified: head/sys/dev/isci/isci.h ============================================================================== --- head/sys/dev/isci/isci.h Wed Jul 10 21:35:55 2019 (r349894) +++ head/sys/dev/isci/isci.h Wed Jul 10 22:23:59 2019 (r349895) @@ -75,6 +75,9 @@ #define ISCI_NUM_PCI_BARS 2 #define ISCI_MAX_LUN 8 +/* This device cannot DMA across a 4GB boundary */ +#define ISCI_DMA_BOUNDARY ((bus_addr_t)((uint64_t)1 << 32)) + MALLOC_DECLARE(M_ISCI); struct ISCI_TIMER { Modified: head/sys/dev/isci/isci_controller.c ============================================================================== --- head/sys/dev/isci/isci_controller.c Wed Jul 10 21:35:55 2019 (r349894) +++ head/sys/dev/isci/isci_controller.c Wed Jul 10 22:23:59 2019 (r349895) @@ -477,9 +477,9 @@ int isci_controller_allocate_memory(struct ISCI_CONTRO * will enable better performance than creating the DMA maps every time we get * an I/O. */ - status = bus_dma_tag_create(bus_get_dma_tag(device), 0x1, 0x0, - BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, - isci_io_request_get_max_io_size(), + status = bus_dma_tag_create(bus_get_dma_tag(device), 0x1, + ISCI_DMA_BOUNDARY, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, + NULL, NULL, isci_io_request_get_max_io_size(), SCI_MAX_SCATTER_GATHER_ELEMENTS, max_segment_size, 0, busdma_lock_mutex, &controller->lock, &controller->buffer_dma_tag); From owner-svn-src-head@freebsd.org Wed Jul 10 22:29:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D095815E4F2A for ; Wed, 10 Jul 2019 22:29:21 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 61EFA752BC for ; Wed, 10 Jul 2019 22:29:21 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x743.google.com with SMTP id r21so3278809qke.2 for ; Wed, 10 Jul 2019 15:29:21 -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:user-agent; bh=fnXYi2L8bu4DtFWgPbY0xIrmDLl+2QQA+YahJfT6/Kw=; b=XgzsvZtDRNMD0itkh7v0FDzohrXbsWHEyJkjj25pD4ighAytOYuEsbny0VUOjMZ2bo dnFHGe2m5LXfiPt26LWVu6PmSYdtpHeSAJeTIio/PmFa82wrG2FHMrjXgABdrwsf+/AV 6fCNkA/z0z+1YJl6Iucs/2DnrczaBj5gEXL/OYQ3BMzz0ZAn50GnNUgEXTdUl41yc549 RviYcXkQffKHEDyS4xnEdfRWGtpHbQbHamLgFIQ3B1E2nGaHPxRSht2o9Ys3VhcyPi1e BNa//u8DV37D3yWgYHgz6/vTbKYj8ISbWljJbehg0gZqfT/NeDsnP85Qvafz6wcDdJco ptbw== 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:user-agent; bh=fnXYi2L8bu4DtFWgPbY0xIrmDLl+2QQA+YahJfT6/Kw=; b=S6dI8+Vu/1xFpR/wAFiXpNHLujykHYIK0PC5LLPYeCfCViwhV3/C441S5t/inzO+rv Y4bczZA2VD/gUVxzxImPzRM19hXmLUC1Af3PlJbgUHQaNytOURl1YzGPm07DcI1YEOWt HoDcibqRFlASK+rdb7XW+vO94+GJlkvR24FdyIRrl6OnGZFggTyJQl7XktyOZICwLbOc zb2T1hWGAvZS1omZk8vnMd+engxtbNOinuZ0V2u5nfvlaSZQWrjE2o5bFPgFH7iDbDtr 2pBmfJmpRlXhmZQJCn8lQ8SJWm3WYJABl6cfasqNNVhSCVNbIkHIB1htMUdcnrC+Cxjy x1mA== X-Gm-Message-State: APjAAAV+ELLuMt2YpnfN1YJXoB3rW6DyHqLQSz/pOOZ11CprYh72k7ji 8B6RdpxOCwMgm9xIKclCNVVKYA== X-Google-Smtp-Source: APXvYqybTsfGTWXPmGM8w+29x6SZiIHtby0NhHegp4rWAZyYPbgyuExk6nqmJJ+KTaf1MD8rqIWxgg== X-Received: by 2002:a37:4714:: with SMTP id u20mr484167qka.162.1562797760432; Wed, 10 Jul 2019 15:29:20 -0700 (PDT) Received: from mutt-hbsd ([151.196.118.239]) by smtp.gmail.com with ESMTPSA id o26sm1420409qtp.11.2019.07.10.15.29.19 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 10 Jul 2019 15:29:19 -0700 (PDT) Date: Wed, 10 Jul 2019 18:29:18 -0400 From: Shawn Webb To: Justin Hibbits Cc: Philip Paeps , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet Message-ID: <20190710222918.vj4creizlubdzgw3@mutt-hbsd> References: <201907101742.x6AHg4os016752@repo.freebsd.org> <20190710195548.kdftfemj3icarcxo@mutt-hbsd> <20190710151944.0fd94ec3@titan.knownspace> <20190710202218.yc3lcd6tsql3zkyr@mutt-hbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="azbhwo34trcfg3f5" Content-Disposition: inline In-Reply-To: <20190710202218.yc3lcd6tsql3zkyr@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA User-Agent: NeoMutt/20180716 X-Rspamd-Queue-Id: 61EFA752BC X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.991,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 22:29:22 -0000 --azbhwo34trcfg3f5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 10, 2019 at 04:22:18PM -0400, Shawn Webb wrote: > On Wed, Jul 10, 2019 at 03:19:44PM -0500, Justin Hibbits wrote: > > On Wed, 10 Jul 2019 15:55:48 -0400 > > Shawn Webb wrote: > >=20 > > > On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: > > > > Author: philip > > > > Date: Wed Jul 10 17:42:04 2019 > > > > New Revision: 349890 > > > > URL: https://svnweb.freebsd.org/changeset/base/349890 > > > >=20 > > > > Log: > > > > telnet: fix a couple of snprintf() buffer overflows > > > > =20 > > > > Obtained from: Juniper Networks > > > > MFC after: 1 week > > > >=20 > > > > Modified: > > > > head/contrib/telnet/telnet/commands.c > > > > head/contrib/telnet/telnet/telnet.c > > > > head/contrib/telnet/telnet/utilities.c > > > >=20 > > > > Modified: head/contrib/telnet/telnet/commands.c > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > > > > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 > > > > 17:21:59 2019 (r349889) +++ > > > > head/contrib/telnet/telnet/commands.c Wed Jul 10 17:42:04 > > > > 2019 (r349890) @@ -1655,10 +1655,11 @@ env_init(void) char > > > > hbuf[256+1]; char *cp2 =3D strchr((char *)ep->value, ':'); > > > > =20 > > > > - gethostname(hbuf, 256); > > > > - hbuf[256] =3D '\0'; > > > > - cp =3D (char *)malloc(strlen(hbuf) + strlen(cp2) + > > > > 1); > > > > - sprintf((char *)cp, "%s%s", hbuf, cp2); > > > > + gethostname(hbuf, sizeof(hbuf)); > > > > + hbuf[sizeof(hbuf)-1] =3D '\0'; > > > > + unsigned int buflen =3D strlen(hbuf) + strlen(cp2)= + > > > > 1; =20 > > >=20 > > > buflen should be defined with the rest of the variables in the code > > > block above this one. > >=20 > > Agreed. > >=20 > > >=20 > > > > + cp =3D (char *)malloc(sizeof(char)*buflen); =20 > > >=20 > > > Lack of NULL check here leads to > > >=20 > > > > + snprintf((char *)cp, buflen, "%s%s", hbuf, cp2); =20 > > >=20 > > > potential NULL pointer deref here. > >=20 > > I'm not sure if this is actually a problem. env_init() is called > > exactly once, at the beginning of main(), and the environment size is > > fully constrained by the OS. > >=20 > > That said, this file it the only one in this component that does not > > check the return value of malloc(). All other uses, outside of this > > file, check and error. >=20 > While fixing the style(9) violation above, we could still take care of > the potential NULL deref at the same time. If anything, just for code > correctness reasons? Here's a patch: https://gist.github.com/579685c0252673c3ad92d2536c3486c7 Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 --azbhwo34trcfg3f5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl0mZrkACgkQ/y5nonf4 4fonOxAAkkmmFdwEviglOgj8Odg8L+UEkbyDxTdH/auvBTfZTAQxMyr/tRaX8n5Q y0mIDhVnWIY1hyMOKtnaH2JvE1sDmLMuYiLY44nIBOzUS5bT2UylhyF3e7r7w9uJ LsMi5Ky0Ap313mhYZwyP0mGsWgU0U+uFwfCdfatV0BZMOX9G1jHXQyMIG/KGWO+Z cErCpJoNhOankh6IFZh5Z0WY8XtKhWwMXDT1AfRse8jHvjTbwmMCMph0bFBOaci2 OauFWvr0zax1dWoWO2EJeDPh2dOF8o0HKfFUkC0RINsKQMxG7sSsfceODl0ORb7k HTJEJXz9TItJC5xlHWkpCVo+UoaL5VFRDaPpEX8i/WYFXj8YKW1P4ah6J5osfVqG ky1BRnJOoRtc7S+EmdQuFZkSv0V1uSKzgp4hH2nDvxRd0xcu5cVJqhJmoCodQCXX nrdiM1cPhwUMgtJlDBZVp1EjRnd290+jRjR5bsoU+XdzkJCE+TiDf5HZw0gDD8Ui Zqcs5ZkiUpKBnsdkya4YI0AWqmtFdCqMqh57452aFwRE7oxxBWBkjJXYnMpwpVvS +ql/areAGV4HxsNz5bZEBv7TwNeYsvNKyEojdUmRfDjdmNOtROQNgYFKzVZO7Qn1 38Uqz/wR/7ymdeiRrSKNq5DlzWsJl8nFSskrSQ9lkMeYCAprYWw= =pPlH -----END PGP SIGNATURE----- --azbhwo34trcfg3f5-- From owner-svn-src-head@freebsd.org Wed Jul 10 22:36:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0D4015E51AB; Wed, 10 Jul 2019 22:36:15 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74FC4757F1; Wed, 10 Jul 2019 22:36:15 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C21C1D9E9; Wed, 10 Jul 2019 22:36:15 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AMaFJG067551; Wed, 10 Jul 2019 22:36:15 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AMaFLI067550; Wed, 10 Jul 2019 22:36:15 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201907102236.x6AMaFLI067550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Wed, 10 Jul 2019 22:36:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349896 - head/contrib/telnet/telnet X-SVN-Group: head X-SVN-Commit-Author: philip X-SVN-Commit-Paths: head/contrib/telnet/telnet X-SVN-Commit-Revision: 349896 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 74FC4757F1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 22:36:16 -0000 Author: philip Date: Wed Jul 10 22:36:14 2019 New Revision: 349896 URL: https://svnweb.freebsd.org/changeset/base/349896 Log: telnet: fix minor style violation While here also fix a very unlikely NULL pointer dereference. Submitted by: Shawn Webb Modified: head/contrib/telnet/telnet/commands.c Modified: head/contrib/telnet/telnet/commands.c ============================================================================== --- head/contrib/telnet/telnet/commands.c Wed Jul 10 22:23:59 2019 (r349895) +++ head/contrib/telnet/telnet/commands.c Wed Jul 10 22:36:14 2019 (r349896) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -1654,11 +1655,13 @@ env_init(void) || (strncmp((char *)ep->value, "unix:", 5) == 0))) { char hbuf[256+1]; char *cp2 = strchr((char *)ep->value, ':'); + size_t buflen; gethostname(hbuf, sizeof(hbuf)); hbuf[sizeof(hbuf)-1] = '\0'; - unsigned int buflen = strlen(hbuf) + strlen(cp2) + 1; + buflen = strlen(hbuf) + strlen(cp2) + 1; cp = (char *)malloc(sizeof(char)*buflen); + assert(cp != NULL); snprintf((char *)cp, buflen, "%s%s", hbuf, cp2); free(ep->value); ep->value = (unsigned char *)cp; From owner-svn-src-head@freebsd.org Wed Jul 10 22:40:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C149215E5290 for ; Wed, 10 Jul 2019 22:40:38 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 4CC15759FF for ; Wed, 10 Jul 2019 22:40:38 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x830.google.com with SMTP id n11so4298761qtl.5 for ; Wed, 10 Jul 2019 15:40:38 -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=RfqsVjdvsLWnDPnqUaU5U8Hp+bcrFaYO8yKMAQ8bzlI=; b=RDGDHR6XiHVLmyQ1WNR1bCCYoAcyzjrEPnC//1Fmg2oEkd9vuLq2P7pkYMufMYkJEm 92HQjQzCVQNjITz2woE97EtH1LQVTjeCgbua8Hg/U7xhgEiXPap7oI1eUCti/ykUPu12 WlHE65+duStmZ//6yuOTdaYSyM+LoRhrcaGEI7RhCogj8nIE/fCi96xRRR7NaXjf59I+ /C4vXlr718hO7yKl1vk6bJjZSTo5IZwQvpIOuHuPG78bTMPe3FVb2xi4DAb49apDAISP IqpuvtUGiflyA3qLCU2GZ0TK/hqAnlDtuwpqGzQbHtRRgYlqB4K9djBI/xCCRDjEbJqK lRzA== 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=RfqsVjdvsLWnDPnqUaU5U8Hp+bcrFaYO8yKMAQ8bzlI=; b=SzoE66Vr68jDiHX5bgnk2c3DyTw66kD4F1G499Sr2bapWMlrKGra2BiyXRBHxpMo35 IvG/CPgCWXzU+UWGS9Yf9CLnXto1A0/soXCPLSyUUXeMwzDZIcBCMwr9UcrJ3665IlXA Vh6tnxT3SXtO8/WmRcuBROVugNr98bOgRTiZtzM2nyughhsr3j8iWk9nyq6605CR3z7s 63WEgV/NGauVKLY41mKt+jOKintqHYC1h4RV/ujJMaH352oHadoNGUrhZlNShugtcmH+ qw8inPrH4VEILFQEf7eLH11l7vZ9o2O9UA7OIo2yTRXDffwyO9ESq2kbXdSf2Zd26PBT PQoQ== X-Gm-Message-State: APjAAAUQzP3ZfNbySIIg216EGcnxKCHC/Cr//OcyV4Ac1ohwuPPAL5uo ixQZHCXJrRw5iAwbNIhPKl/aY5oaBV7igyxZ0S0= X-Google-Smtp-Source: APXvYqyx6rFgWia53Pcg9R3t0/nosEAdHrUREYM/sAKaWRF5p8k/OXVztBkT8rPJeD+zaibAirUjgHb+6PrNC4Cq4yw= X-Received: by 2002:ac8:2baa:: with SMTP id m39mr355136qtm.242.1562798436769; Wed, 10 Jul 2019 15:40:36 -0700 (PDT) MIME-Version: 1.0 References: <201907101742.x6AHg4os016752@repo.freebsd.org> <20190710195548.kdftfemj3icarcxo@mutt-hbsd> <20190710151944.0fd94ec3@titan.knownspace> <20190710202218.yc3lcd6tsql3zkyr@mutt-hbsd> <20190710222918.vj4creizlubdzgw3@mutt-hbsd> In-Reply-To: <20190710222918.vj4creizlubdzgw3@mutt-hbsd> From: Warner Losh Date: Wed, 10 Jul 2019 16:40:25 -0600 Message-ID: Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet To: Shawn Webb Cc: Justin Hibbits , Philip Paeps , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 4CC15759FF X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.955,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 22:40:39 -0000 On Wed, Jul 10, 2019 at 4:29 PM Shawn Webb wrote: > On Wed, Jul 10, 2019 at 04:22:18PM -0400, Shawn Webb wrote: > > On Wed, Jul 10, 2019 at 03:19:44PM -0500, Justin Hibbits wrote: > > > On Wed, 10 Jul 2019 15:55:48 -0400 > > > Shawn Webb wrote: > > > > > > > On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: > > > > > Author: philip > > > > > Date: Wed Jul 10 17:42:04 2019 > > > > > New Revision: 349890 > > > > > URL: https://svnweb.freebsd.org/changeset/base/349890 > > > > > > > > > > Log: > > > > > telnet: fix a couple of snprintf() buffer overflows > > > > > > > > > > Obtained from: Juniper Networks > > > > > MFC after: 1 week > > > > > > > > > > Modified: > > > > > head/contrib/telnet/telnet/commands.c > > > > > head/contrib/telnet/telnet/telnet.c > > > > > head/contrib/telnet/telnet/utilities.c > > > > > > > > > > Modified: head/contrib/telnet/telnet/commands.c > > > > > > ============================================================================== > > > > > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 > > > > > 17:21:59 2019 (r349889) +++ > > > > > head/contrib/telnet/telnet/commands.c Wed Jul 10 17:42:04 > > > > > 2019 (r349890) @@ -1655,10 +1655,11 @@ env_init(void) char > > > > > hbuf[256+1]; char *cp2 = strchr((char *)ep->value, ':'); > > > > > > > > > > - gethostname(hbuf, 256); > > > > > - hbuf[256] = '\0'; > > > > > - cp = (char *)malloc(strlen(hbuf) + strlen(cp2) + > > > > > 1); > > > > > - sprintf((char *)cp, "%s%s", hbuf, cp2); > > > > > + gethostname(hbuf, sizeof(hbuf)); > > > > > + hbuf[sizeof(hbuf)-1] = '\0'; > > > > > + unsigned int buflen = strlen(hbuf) + strlen(cp2) + > > > > > 1; > > > > > > > > buflen should be defined with the rest of the variables in the code > > > > block above this one. > > > > > > Agreed. > > > > > > > > > > > > + cp = (char *)malloc(sizeof(char)*buflen); > > > > > > > > Lack of NULL check here leads to > > > > > > > > > + snprintf((char *)cp, buflen, "%s%s", hbuf, cp2); > > > > > > > > potential NULL pointer deref here. > > > > > > I'm not sure if this is actually a problem. env_init() is called > > > exactly once, at the beginning of main(), and the environment size is > > > fully constrained by the OS. > > > > > > That said, this file it the only one in this component that does not > > > check the return value of malloc(). All other uses, outside of this > > > file, check and error. > > > > While fixing the style(9) violation above, we could still take care of > > the potential NULL deref at the same time. If anything, just for code > > correctness reasons? > > Here's a patch: > > https://gist.github.com/579685c0252673c3ad92d2536c3486c7 Any reason to not use asprintf instead of malloc + snprintf? Warner From owner-svn-src-head@freebsd.org Wed Jul 10 22:43:45 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F271215E5481 for ; Wed, 10 Jul 2019 22:43:44 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 6963675E70 for ; Wed, 10 Jul 2019 22:43:44 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x744.google.com with SMTP id v22so3265762qkj.8 for ; Wed, 10 Jul 2019 15:43:44 -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:user-agent; bh=KgZFzH1i+QylvYKNXWozjp50iP59a407g+mtKDPZH9Y=; b=DasIPif16NijjRZ/ceRzRCZ+h8ArS5YonGPafxeol6d5A/fWLqIZdgC9FTg+6c0KX7 9+4F+JFcyTOj+2nukmuR0dSUHGwk4vSCy0q1676GzmLVLqfDP2LttreUZQ8wQbfdtohf 5LL4vzXWzg9eplYEXWlxkZtur0iI6hnGriUJEG75AYf1fxayIy2GpCDuZSGuFwnYqQ4n +R7Dqe0Qc5MqFVxWoBP5ArMo4N/cEyE3Yyze8j8JrJQghIdc8XFNSD50p+4YL2TzbYVG rIK9zQyct+kuOksFWpfTmBkbF5toR8Z01i0+kCOqIJMG6hnkvL9gst7gc1lBMOXaypdV QNRw== 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:user-agent; bh=KgZFzH1i+QylvYKNXWozjp50iP59a407g+mtKDPZH9Y=; b=GocxgZJi+f+Rjx5n8zu8l6f4f0UgfAR+fkGTTErssjnM+oIm6VB2DUGtEk/vyKsSHq 1lIj6pFSDsI0TbimG7HNPYTXL+gukCLdYbLHPJ96F7w9FduHFQFTn9BCmJVA0z9hpAf0 XGUZyqnHXNRHuy8ZRqAZ4TFlbwNaNVZaIWcFnuLMASCGsd3BBvTPpu5aJzhgUiRj99BN u6kSXnNSIjSQswrXTGxGstuXfBqNFCsNM2niBapLnV1AIq1bBmzoimggsFABNiTCPrX0 FX+3JIy7gzLlve9VzNs5Szp1OSMklZx2sRoYDZEi4C0sHPJlZVpz4vbDkppEpdGie34y fsOQ== X-Gm-Message-State: APjAAAVMSaGxxtb61L+ntgowoImnkDYBdc5SVmLYvS6WSrtHRCgd5Y+h yc7LCrVElA71apWFXHA9RvD1cA== X-Google-Smtp-Source: APXvYqzJnWvkHDl0H3ZOec8Su/ADyHsyA88ltHX1xEn5JcoAfXd22fNe57+zAsHE+kdUClcSd4vkgw== X-Received: by 2002:a37:6944:: with SMTP id e65mr463062qkc.119.1562798623150; Wed, 10 Jul 2019 15:43:43 -0700 (PDT) Received: from mutt-hbsd ([151.196.118.239]) by smtp.gmail.com with ESMTPSA id n184sm1635739qkc.114.2019.07.10.15.43.41 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 10 Jul 2019 15:43:42 -0700 (PDT) Date: Wed, 10 Jul 2019 18:43:41 -0400 From: Shawn Webb To: Warner Losh Cc: Justin Hibbits , Philip Paeps , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet Message-ID: <20190710224341.i3rbhapmpdw6gkbd@mutt-hbsd> References: <201907101742.x6AHg4os016752@repo.freebsd.org> <20190710195548.kdftfemj3icarcxo@mutt-hbsd> <20190710151944.0fd94ec3@titan.knownspace> <20190710202218.yc3lcd6tsql3zkyr@mutt-hbsd> <20190710222918.vj4creizlubdzgw3@mutt-hbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ac2c4ewsv4bdieh7" Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA User-Agent: NeoMutt/20180716 X-Rspamd-Queue-Id: 6963675E70 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.991,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 22:43:45 -0000 --ac2c4ewsv4bdieh7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 10, 2019 at 04:40:25PM -0600, Warner Losh wrote: > On Wed, Jul 10, 2019 at 4:29 PM Shawn Webb > wrote: >=20 > > On Wed, Jul 10, 2019 at 04:22:18PM -0400, Shawn Webb wrote: > > > On Wed, Jul 10, 2019 at 03:19:44PM -0500, Justin Hibbits wrote: > > > > On Wed, 10 Jul 2019 15:55:48 -0400 > > > > Shawn Webb wrote: > > > > > > > > > On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: > > > > > > Author: philip > > > > > > Date: Wed Jul 10 17:42:04 2019 > > > > > > New Revision: 349890 > > > > > > URL: https://svnweb.freebsd.org/changeset/base/349890 > > > > > > > > > > > > Log: > > > > > > telnet: fix a couple of snprintf() buffer overflows > > > > > > > > > > > > Obtained from: Juniper Networks > > > > > > MFC after: 1 week > > > > > > > > > > > > Modified: > > > > > > head/contrib/telnet/telnet/commands.c > > > > > > head/contrib/telnet/telnet/telnet.c > > > > > > head/contrib/telnet/telnet/utilities.c > > > > > > > > > > > > Modified: head/contrib/telnet/telnet/commands.c > > > > > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > > > > > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 > > > > > > 17:21:59 2019 (r349889) +++ > > > > > > head/contrib/telnet/telnet/commands.c Wed Jul 10 17:42:04 > > > > > > 2019 (r349890) @@ -1655,10 +1655,11 @@ env_init(void) char > > > > > > hbuf[256+1]; char *cp2 =3D strchr((char *)ep->value, ':'); > > > > > > > > > > > > - gethostname(hbuf, 256); > > > > > > - hbuf[256] =3D '\0'; > > > > > > - cp =3D (char *)malloc(strlen(hbuf) + strlen(cp2= ) + > > > > > > 1); > > > > > > - sprintf((char *)cp, "%s%s", hbuf, cp2); > > > > > > + gethostname(hbuf, sizeof(hbuf)); > > > > > > + hbuf[sizeof(hbuf)-1] =3D '\0'; > > > > > > + unsigned int buflen =3D strlen(hbuf) + strlen(= cp2) + > > > > > > 1; > > > > > > > > > > buflen should be defined with the rest of the variables in the co= de > > > > > block above this one. > > > > > > > > Agreed. > > > > > > > > > > > > > > > + cp =3D (char *)malloc(sizeof(char)*buflen); > > > > > > > > > > Lack of NULL check here leads to > > > > > > > > > > > + snprintf((char *)cp, buflen, "%s%s", hbuf, cp2); > > > > > > > > > > potential NULL pointer deref here. > > > > > > > > I'm not sure if this is actually a problem. env_init() is called > > > > exactly once, at the beginning of main(), and the environment size = is > > > > fully constrained by the OS. > > > > > > > > That said, this file it the only one in this component that does not > > > > check the return value of malloc(). All other uses, outside of this > > > > file, check and error. > > > > > > While fixing the style(9) violation above, we could still take care of > > > the potential NULL deref at the same time. If anything, just for code > > > correctness reasons? > > > > Here's a patch: > > > > https://gist.github.com/579685c0252673c3ad92d2536c3486c7 >=20 >=20 > Any reason to not use asprintf instead of malloc + snprintf? Because the existing code already used malloc + snprintf. And this is contrib/telnet/telnet, which arguably should be `rm -rf`ed. ;) The bike shed is now glow-in-the-dark neon green. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 --ac2c4ewsv4bdieh7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl0mahcACgkQ/y5nonf4 4fr/jA//RimSOU70RBT1Nd1RxIDlTLZGfwXvN8F8SL3OW+H2FhP+J0UvCzNghszj 8ox5RnWFsZa2WZckTd3zz3FSqUvt5WjNWD1JLSvCBJtTg4alfLkP6MUmCwVeHM/I JZVaOCzHcTr0W+hIq/QrkVcPMZJEm78INuDtn8rRtqp01foh5Wtea0hB5xaPC+DG CIvT2fhOue0eRkKSpc6xaeOSvaH3xHoOWLHRMniY4Moy3EoPpgRL/99ID+0ihaOA 4iD/ynMbJH9ClaKtkjgYi3Zy75vbmF+oNCMIIdHbG9+O0djtJ+xdJkXIzD1XIqoA YbUPE54svJ/Lk5jHKMtF+6b6bAdVbOGOrTedPTKW0y6CEIfB7KWz1dCYtNwltKQG /728n1AP6xQjySy8T5NwxSb7bQyC+FD0OeBOK4kgBSWQQIGonBKFCh4IswPP4RBk x8kShM5ILAClMhSZHYXMCoQEAY6Ia0zlRf2pAvYf08aGcNtsc0Qrg8X4ShHdBFEG 3SXNii9O7ikKNOl4oWOSISiXprzSTEm84OzJ3BiEdfl6QVqkipUrYmfm5lL3ZyI8 XSFjzlZ8hTwZ/KXtV/O46q+ZD/9BN35qIN1Jo+33P3tZ2h4ZEcf44ygDgstkGwel pdw3HTjvTDSWyUCY1NNhdiMqGvDm5nlQIPC0HeyUtjKMDK0GIAE= =j5EO -----END PGP SIGNATURE----- --ac2c4ewsv4bdieh7-- From owner-svn-src-head@freebsd.org Wed Jul 10 22:45:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6431115E550E for ; Wed, 10 Jul 2019 22:45:19 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 E72F376005 for ; Wed, 10 Jul 2019 22:45:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x743.google.com with SMTP id s22so3254770qkj.12 for ; Wed, 10 Jul 2019 15:45:18 -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=ykoT1uMDs4NCvfO3taegKBo8/Qv5V7f3JtqTSl4DiFU=; b=aS+QYpInjXTiu9fQz1DjdIrlsNjQuTrSrumfU649g7Twv0rUf4WN86ARZzogJKWhjE 6o/M64xrf5el7RU+B/K/LJlfpp0LYvwWHvMUwlF69lOxSmU6AhkfQ8WFfIiftt6rrxmR g2rDi4PNJRXt+QCn5+mzwMedmdgaSM8N9+rTMmvznb2m2v53vPtlt5FYzTY7lXzbf0BY CaEXXvlOggGWELSN03ShcSmOF66UR1bH55BWClVPr3hS03n1m2AHhIyB3KX5QRQZYQDh iGPl1BDGAQtjkVUtl6Hb5vZwWTKRliuE+TVuHrIYcvgvuKO/9W/Xdg8TYKlWDDPlQ7ML MdeA== 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=ykoT1uMDs4NCvfO3taegKBo8/Qv5V7f3JtqTSl4DiFU=; b=DlHzHAU9ngCg/yqjcbnp5Q7dgcxEomeSKXqpeQS8enLcCuwzQ5f8n7tF7gxh1og5ze 0hZCw8WWPtqK3qQJaHcLmD0tOC/rBg/vU7DNlk1gK28S6YJ+pH46MEtU+xM83mT0Xxmq 93dPAHwrSa9kjI5DbGZGJW3qC7DJG6ojPc+lH5Eq2DwKxmZr3Kw+yoA+4SOhg2Bsaxxy fTCDvxGWuAhA81f5r9KguQwbgZlmL1qP3shmfobT6ZLc86wmbBOxCvBY01tpyjCBUV80 A+HEIkIG/Q3ijwVanOm4cXYxy5t3DH7G0axUAx/bgN4QAGyRAVJ55+N1WnsaWtQLPe7C BFmg== X-Gm-Message-State: APjAAAWYYl6qRgBf+wXZmzrWf65/l74yf3A4WvYAjUAAhdQKMWjF0Nq9 MNgzPbU+xysxvkux9fnCOqnauNFjEKLG3FxnlZs= X-Google-Smtp-Source: APXvYqztVah2TMPb2Pr/wDD+QiWsTEH4SLMN9FZc7dZIJRnRxt9CM+ek+JlIcjiXhe6+BmcAXXMhzjLFb77MCcVLKTU= X-Received: by 2002:a05:620a:1017:: with SMTP id z23mr547301qkj.60.1562798718040; Wed, 10 Jul 2019 15:45:18 -0700 (PDT) MIME-Version: 1.0 References: <201907101742.x6AHg4os016752@repo.freebsd.org> <20190710195548.kdftfemj3icarcxo@mutt-hbsd> <20190710151944.0fd94ec3@titan.knownspace> <20190710202218.yc3lcd6tsql3zkyr@mutt-hbsd> <20190710222918.vj4creizlubdzgw3@mutt-hbsd> <20190710224341.i3rbhapmpdw6gkbd@mutt-hbsd> In-Reply-To: <20190710224341.i3rbhapmpdw6gkbd@mutt-hbsd> From: Warner Losh Date: Wed, 10 Jul 2019 16:45:06 -0600 Message-ID: Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet To: Shawn Webb Cc: Justin Hibbits , Philip Paeps , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: E72F376005 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.955,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 22:45:19 -0000 On Wed, Jul 10, 2019 at 4:43 PM Shawn Webb wrote: > On Wed, Jul 10, 2019 at 04:40:25PM -0600, Warner Losh wrote: > > On Wed, Jul 10, 2019 at 4:29 PM Shawn Webb > > wrote: > > > > > On Wed, Jul 10, 2019 at 04:22:18PM -0400, Shawn Webb wrote: > > > > On Wed, Jul 10, 2019 at 03:19:44PM -0500, Justin Hibbits wrote: > > > > > On Wed, 10 Jul 2019 15:55:48 -0400 > > > > > Shawn Webb wrote: > > > > > > > > > > > On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: > > > > > > > Author: philip > > > > > > > Date: Wed Jul 10 17:42:04 2019 > > > > > > > New Revision: 349890 > > > > > > > URL: https://svnweb.freebsd.org/changeset/base/349890 > > > > > > > > > > > > > > Log: > > > > > > > telnet: fix a couple of snprintf() buffer overflows > > > > > > > > > > > > > > Obtained from: Juniper Networks > > > > > > > MFC after: 1 week > > > > > > > > > > > > > > Modified: > > > > > > > head/contrib/telnet/telnet/commands.c > > > > > > > head/contrib/telnet/telnet/telnet.c > > > > > > > head/contrib/telnet/telnet/utilities.c > > > > > > > > > > > > > > Modified: head/contrib/telnet/telnet/commands.c > > > > > > > > > > > ============================================================================== > > > > > > > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 > > > > > > > 17:21:59 2019 (r349889) +++ > > > > > > > head/contrib/telnet/telnet/commands.c Wed Jul 10 17:42:04 > > > > > > > 2019 (r349890) @@ -1655,10 +1655,11 @@ env_init(void) char > > > > > > > hbuf[256+1]; char *cp2 = strchr((char *)ep->value, ':'); > > > > > > > > > > > > > > - gethostname(hbuf, 256); > > > > > > > - hbuf[256] = '\0'; > > > > > > > - cp = (char *)malloc(strlen(hbuf) + strlen(cp2) > + > > > > > > > 1); > > > > > > > - sprintf((char *)cp, "%s%s", hbuf, cp2); > > > > > > > + gethostname(hbuf, sizeof(hbuf)); > > > > > > > + hbuf[sizeof(hbuf)-1] = '\0'; > > > > > > > + unsigned int buflen = strlen(hbuf) + > strlen(cp2) + > > > > > > > 1; > > > > > > > > > > > > buflen should be defined with the rest of the variables in the > code > > > > > > block above this one. > > > > > > > > > > Agreed. > > > > > > > > > > > > > > > > > > + cp = (char *)malloc(sizeof(char)*buflen); > > > > > > > > > > > > Lack of NULL check here leads to > > > > > > > > > > > > > + snprintf((char *)cp, buflen, "%s%s", hbuf, > cp2); > > > > > > > > > > > > potential NULL pointer deref here. > > > > > > > > > > I'm not sure if this is actually a problem. env_init() is called > > > > > exactly once, at the beginning of main(), and the environment size > is > > > > > fully constrained by the OS. > > > > > > > > > > That said, this file it the only one in this component that does > not > > > > > check the return value of malloc(). All other uses, outside of > this > > > > > file, check and error. > > > > > > > > While fixing the style(9) violation above, we could still take care > of > > > > the potential NULL deref at the same time. If anything, just for code > > > > correctness reasons? > > > > > > Here's a patch: > > > > > > https://gist.github.com/579685c0252673c3ad92d2536c3486c7 > > > > > > Any reason to not use asprintf instead of malloc + snprintf? > > Because the existing code already used malloc + snprintf. And this is > contrib/telnet/telnet, which arguably should be `rm -rf`ed. ;) > > The bike shed is now glow-in-the-dark neon green. > I'm not in the rm-rf telnet camp... I use it far too often to connect to a port with good terminal support to want to do that... Warner From owner-svn-src-head@freebsd.org Wed Jul 10 22:52:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFA6715E598A; Wed, 10 Jul 2019 22:52:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 930D776600; Wed, 10 Jul 2019 22:52:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C60C1DD2A; Wed, 10 Jul 2019 22:52:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AMqR8N077488; Wed, 10 Jul 2019 22:52:27 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AMqRfb077487; Wed, 10 Jul 2019 22:52:27 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907102252.x6AMqRfb077487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 10 Jul 2019 22:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349897 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 349897 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 930D776600 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 22:52:28 -0000 Author: markj Date: Wed Jul 10 22:52:26 2019 New Revision: 349897 URL: https://svnweb.freebsd.org/changeset/base/349897 Log: Rename pmap_page_dirty() to pmap_pte_dirty(). This is a precursor to implementing dirty bit management. Discussed with: alc MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Wed Jul 10 22:36:14 2019 (r349896) +++ head/sys/arm64/arm64/pmap.c Wed Jul 10 22:52:26 2019 (r349897) @@ -536,7 +536,7 @@ CTASSERT(L1_BLOCK == L2_BLOCK); * arm64 so for now assume is a page mapped as rw was accessed it is. */ static inline int -pmap_page_dirty(pt_entry_t pte) +pmap_pte_dirty(pt_entry_t pte) { return ((pte & (ATTR_AF | ATTR_AP_RW_BIT)) == @@ -1952,7 +1952,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l tpte = pmap_load_clear(pte); pmap_invalidate_page(pmap, va); m = PHYS_TO_VM_PAGE(tpte & ~ATTR_MASK); - if (pmap_page_dirty(tpte)) + if (pmap_pte_dirty(tpte)) vm_page_dirty(m); if ((tpte & ATTR_AF) != 0) vm_page_aflag_set(m, PGA_REFERENCED); @@ -2449,7 +2449,7 @@ pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_ eva = sva + L2_SIZE; for (va = sva, m = PHYS_TO_VM_PAGE(old_l2 & ~ATTR_MASK); va < eva; va += PAGE_SIZE, m++) { - if (pmap_page_dirty(old_l2)) + if (pmap_pte_dirty(old_l2)) vm_page_dirty(m); if (old_l2 & ATTR_AF) vm_page_aflag_set(m, PGA_REFERENCED); @@ -2494,7 +2494,7 @@ pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_ pmap_resident_count_dec(pmap, 1); if (old_l3 & ATTR_SW_MANAGED) { m = PHYS_TO_VM_PAGE(old_l3 & ~ATTR_MASK); - if (pmap_page_dirty(old_l3)) + if (pmap_pte_dirty(old_l3)) vm_page_dirty(m); if (old_l3 & ATTR_AF) vm_page_aflag_set(m, PGA_REFERENCED); @@ -2542,7 +2542,7 @@ pmap_remove_l3_range(pmap_t pmap, pd_entry_t l2e, vm_o pmap_resident_count_dec(pmap, 1); if ((old_l3 & ATTR_SW_MANAGED) != 0) { m = PHYS_TO_VM_PAGE(old_l3 & ~ATTR_MASK); - if (pmap_page_dirty(old_l3)) + if (pmap_pte_dirty(old_l3)) vm_page_dirty(m); if ((old_l3 & ATTR_AF) != 0) vm_page_aflag_set(m, PGA_REFERENCED); @@ -2771,7 +2771,7 @@ retry: /* * Update the vm_page_t clean and reference bits. */ - if (pmap_page_dirty(tpte)) + if (pmap_pte_dirty(tpte)) vm_page_dirty(m); pmap_unuse_pt(pmap, pv->pv_va, tpde, &free); TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); @@ -2814,7 +2814,7 @@ pmap_protect_l2(pmap_t pmap, pt_entry_t *l2, vm_offset */ if ((nbits & ATTR_AP(ATTR_AP_RO)) != 0 && (old_l2 & ATTR_SW_MANAGED) != 0 && - pmap_page_dirty(old_l2)) { + pmap_pte_dirty(old_l2)) { m = PHYS_TO_VM_PAGE(old_l2 & ~ATTR_MASK); for (mt = m; mt < &m[L2_SIZE / PAGE_SIZE]; mt++) vm_page_dirty(mt); @@ -2922,7 +2922,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t */ if ((nbits & ATTR_AP(ATTR_AP_RO)) != 0 && (l3 & ATTR_SW_MANAGED) != 0 && - pmap_page_dirty(l3)) + pmap_pte_dirty(l3)) vm_page_dirty(PHYS_TO_VM_PAGE(l3 & ~ATTR_MASK)); pmap_set(l3p, nbits); @@ -3279,7 +3279,7 @@ havel3: * concurrent calls to pmap_page_test_mappings() and * pmap_ts_referenced(). */ - if (pmap_page_dirty(orig_l3)) + if (pmap_pte_dirty(orig_l3)) vm_page_dirty(om); if ((orig_l3 & ATTR_AF) != 0) vm_page_aflag_set(om, PGA_REFERENCED); @@ -3344,7 +3344,7 @@ validate: /* same PA, different attributes */ pmap_load_store(l3, new_l3); pmap_invalidate_page(pmap, va); - if (pmap_page_dirty(orig_l3) && + if (pmap_pte_dirty(orig_l3) && (orig_l3 & ATTR_SW_MANAGED) != 0) vm_page_dirty(m); } else { @@ -4684,7 +4684,7 @@ retry: ("pmap_ts_referenced: found an invalid l1 table")); pte = pmap_l1_to_l2(pde, pv->pv_va); tpte = pmap_load(pte); - if (pmap_page_dirty(tpte)) { + if (pmap_pte_dirty(tpte)) { /* * Although "tpte" is mapping a 2MB page, because * this function is called at a 4KB page granularity, @@ -4788,7 +4788,7 @@ small_mappings: ("pmap_ts_referenced: found an invalid l2 table")); pte = pmap_l2_to_l3(pde, pv->pv_va); tpte = pmap_load(pte); - if (pmap_page_dirty(tpte)) + if (pmap_pte_dirty(tpte)) vm_page_dirty(m); if ((tpte & ATTR_AF) != 0) { if (safe_to_clear_referenced(pmap, tpte)) { @@ -5454,7 +5454,7 @@ retry: val = MINCORE_INCORE; if (lvl != 3) val |= MINCORE_SUPER; - if (pmap_page_dirty(tpte)) + if (pmap_pte_dirty(tpte)) val |= MINCORE_MODIFIED | MINCORE_MODIFIED_OTHER; if ((tpte & ATTR_AF) == ATTR_AF) val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; From owner-svn-src-head@freebsd.org Wed Jul 10 23:29:02 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B1D115E605A; Wed, 10 Jul 2019 23:29:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 11FF377710; Wed, 10 Jul 2019 23:29:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 2DFFF108BC; Wed, 10 Jul 2019 23:29:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r349893 - in head/sys: modules/tcp/rack netinet netinet/tcp_stacks sys To: Randall Stewart , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201907102040.x6AKeern006731@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <4cdc824e-7e71-731d-50d4-c3f6231f9858@FreeBSD.org> Date: Wed, 10 Jul 2019 16:28:58 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <201907102040.x6AKeern006731@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 11FF377710 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.983,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 23:29:02 -0000 On 7/10/19 1:40 PM, Randall Stewart wrote: > Author: rrs > Date: Wed Jul 10 20:40:39 2019 > New Revision: 349893 > URL: https://svnweb.freebsd.org/changeset/base/349893 > > Log: > This commit updates rack to what is basically being used at NF as > well as sets in some of the groundwork for committing BBR. The > hpts system is updated as well as some other needed utilities > for the entrance of BBR. This is actually part 1 of 3 more > needed commits which will finally complete with BBRv1 being > added as a new tcp stack. > > Sponsored by: Netflix Inc. > Differential Revision: https://reviews.freebsd.org/D20834 Is it safe for M_TSTMP_LRO to conflict with M_PROTO1? Also, it seems you changed the copyright range on rack.c from 2016-2019 to just 2016 which I suspect is an accident. I would suggest using #error here: #ifndef TCPHPTS fatal error missing option TCPHSTS in the build; #endif -- John Baldwin From owner-svn-src-head@freebsd.org Thu Jul 11 00:08:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5DC8815E6C95; Thu, 11 Jul 2019 00:08:47 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F26A680BC0; Thu, 11 Jul 2019 00:08:46 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB1A41E8FD; Thu, 11 Jul 2019 00:08:46 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B08kKP013547; Thu, 11 Jul 2019 00:08:46 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B08kuB013546; Thu, 11 Jul 2019 00:08:46 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907110008.x6B08kuB013546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 11 Jul 2019 00:08:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349898 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349898 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F26A680BC0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 00:08:47 -0000 Author: cy Date: Thu Jul 11 00:08:46 2019 New Revision: 349898 URL: https://svnweb.freebsd.org/changeset/base/349898 Log: ipfilter commands, in this case ipf(8), passes its operations and rules via an ioctl interface. Rules can be added or removed and stats and counters can be zeroed out. As the ipfilter interprets these instructions or operations they are stored in an integer called addrem (add/remove). 1 is add, 2 is remove, and 3 is clear stats and counters. Much of this is not documented. This commit documents these operations by replacing simple integers with a self documenting enum along with a few basic comments. MFC after: 1 week Modified: head/sys/contrib/ipfilter/netinet/fil.c Modified: head/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/fil.c Wed Jul 10 22:52:26 2019 (r349897) +++ head/sys/contrib/ipfilter/netinet/fil.c Thu Jul 11 00:08:46 2019 (r349898) @@ -4472,7 +4472,12 @@ frrequest(softc, unit, req, data, set, makecopy) int set, makecopy; caddr_t data; { - int error = 0, in, family, addrem, need_free = 0; + int error = 0, in, family, need_free = 0; + enum { OP_UNDEF, /* undefined */ + OP_ADD, /* add rule */ + OP_REM, /* remove rule */ + OP_ZERO /* zero statistics and counters */ } + addrem = OP_UNDEF; frentry_t frd, *fp, *f, **fprev, **ftail; void *ptr, *uptr, *cptr; u_int *p, *pp; @@ -4540,11 +4545,11 @@ frrequest(softc, unit, req, data, set, makecopy) if (req == (ioctlcmd_t)SIOCINAFR || req == (ioctlcmd_t)SIOCINIFR || req == (ioctlcmd_t)SIOCADAFR || req == (ioctlcmd_t)SIOCADIFR) - addrem = 0; + addrem = OP_ADD; /* Add rule */ else if (req == (ioctlcmd_t)SIOCRMAFR || req == (ioctlcmd_t)SIOCRMIFR) - addrem = 1; + addrem = OP_REM; /* Remove rule */ else if (req == (ioctlcmd_t)SIOCZRLST) - addrem = 2; + addrem = OP_ZERO; /* Zero statistics and counters */ else { IPFERROR(9); error = EINVAL; @@ -4578,7 +4583,7 @@ frrequest(softc, unit, req, data, set, makecopy) goto donenolock; } - if (addrem == 0) { + if (addrem == OP_UNDEF) { error = ipf_funcinit(softc, fp); if (error != 0) goto donenolock; @@ -4642,7 +4647,7 @@ frrequest(softc, unit, req, data, set, makecopy) * them to be created if they don't already exit. */ group = FR_NAME(fp, fr_group); - if (addrem == 0) { + if (addrem == OP_UNDEF) { fg = ipf_group_add(softc, group, NULL, fp->fr_flags, unit, set); fp->fr_grp = fg; @@ -4947,7 +4952,7 @@ frrequest(softc, unit, req, data, set, makecopy) /* * If zero'ing statistics, copy current to caller and zero. */ - if (addrem == 2) { + if (addrem == OP_ZERO) { if (f == NULL) { IPFERROR(27); error = ESRCH; @@ -5040,7 +5045,7 @@ frrequest(softc, unit, req, data, set, makecopy) /* * Request to remove a rule. */ - if (addrem == 1) { + if (addrem == OP_REM) { if (f == NULL) { IPFERROR(29); error = ESRCH; @@ -5106,7 +5111,7 @@ frrequest(softc, unit, req, data, set, makecopy) if (fp->fr_next != NULL) fp->fr_next->fr_pnext = &fp->fr_next; *ftail = fp; - if (addrem == 0) + if (addrem == OP_UNDEF) ipf_fixskip(ftail, fp, 1); fp->fr_icmpgrp = NULL; From owner-svn-src-head@freebsd.org Thu Jul 11 01:41:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 236EC15E8F19; Thu, 11 Jul 2019 01:41:31 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BB39085004; Thu, 11 Jul 2019 01:41:30 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id AD21314767; Thu, 11 Jul 2019 01:41:30 +0000 (UTC) Date: Thu, 11 Jul 2019 01:41:30 +0000 From: Alexey Dokuchaev To: Warner Losh Cc: Shawn Webb , svn-src-head , svn-src-all , src-committers , Justin Hibbits , Philip Paeps Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet Message-ID: <20190711014130.GA23621@FreeBSD.org> References: <201907101742.x6AHg4os016752@repo.freebsd.org> <20190710195548.kdftfemj3icarcxo@mutt-hbsd> <20190710151944.0fd94ec3@titan.knownspace> <20190710202218.yc3lcd6tsql3zkyr@mutt-hbsd> <20190710222918.vj4creizlubdzgw3@mutt-hbsd> <20190710224341.i3rbhapmpdw6gkbd@mutt-hbsd> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) X-Rspamd-Queue-Id: BB39085004 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.90 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.90)[-0.898,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 01:41:31 -0000 On Wed, Jul 10, 2019 at 04:45:06PM -0600, Warner Losh wrote: > On Wed, Jul 10, 2019 at 4:43 PM Shawn Webb > > ... > > Because the existing code already used malloc + snprintf. And this is > > contrib/telnet/telnet, which arguably should be `rm -rf`ed. ;) > > > > The bike shed is now glow-in-the-dark neon green. > > I'm not in the rm-rf telnet camp... I use it far too often to connect > to a port with good terminal support to want to do that... Seconded. Having telnet(1) in the base is so fucking convenient compared to GNU/Linux or Windoze where they've removed it from the default install. ./danfe From owner-svn-src-head@freebsd.org Thu Jul 11 01:47:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD8C215E91AD; Thu, 11 Jul 2019 01:47:29 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ECB3854F4; Thu, 11 Jul 2019 01:47:29 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 1A6C214A3F; Thu, 11 Jul 2019 01:47:29 +0000 (UTC) Date: Thu, 11 Jul 2019 01:47:29 +0000 From: Alexey Dokuchaev To: Philip Paeps Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet Message-ID: <20190711014729.GB23621@FreeBSD.org> References: <201907101742.x6AHg4os016752@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201907101742.x6AHg4os016752@repo.freebsd.org> User-Agent: Mutt/1.11.4 (2019-03-13) X-Rspamd-Queue-Id: 4ECB3854F4 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.90 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.90)[-0.900,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 01:47:29 -0000 On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: > New Revision: 349890 > URL: https://svnweb.freebsd.org/changeset/base/349890 > > Log: > telnet: fix a couple of snprintf() buffer overflows > > Modified: head/contrib/telnet/telnet/commands.c > @@ -1655,10 +1655,11 @@ env_init(void) > char hbuf[256+1]; > char *cp2 = strchr((char *)ep->value, ':'); > > - gethostname(hbuf, 256); > - hbuf[256] = '\0'; > - cp = (char *)malloc(strlen(hbuf) + strlen(cp2) + 1); > - sprintf((char *)cp, "%s%s", hbuf, cp2); Would it make sense to add something like __attribute__ ((deprecated)) to those unsafe functions like gets(), sprintf(), etc.? Or it would cause too much PITA? ./danfe From owner-svn-src-head@freebsd.org Thu Jul 11 02:06:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5845415E9639; Thu, 11 Jul 2019 02:06:51 +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 C8DA885F85; Thu, 11 Jul 2019 02:06:49 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id lOTuhhY8nSrVclOTvhRbDQ; Wed, 10 Jul 2019 20:06:47 -0600 X-Authority-Analysis: v=2.3 cv=L5ZjvNb8 c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=0o9FgrsRnhwA:10 a=6I5d2MoRAAAA:8 a=2QSLavsyAAAA:8 a=YxBL1-UpAAAA:8 a=3YDKmzK5xmxd0qjhx50A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=9H_80fVQ3bbXSWzY4Kdq:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy8 [10.2.2.6]) by spqr.komquats.com (Postfix) with ESMTPS id 0BD931188; Wed, 10 Jul 2019 19:06:44 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x6B26PJj013176; Wed, 10 Jul 2019 19:06:25 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x6B26PUu013164; Wed, 10 Jul 2019 19:06:25 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201907110206.x6B26PUu013164@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs 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: Alexey Dokuchaev cc: Philip Paeps , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet In-Reply-To: Message from Alexey Dokuchaev of "Thu, 11 Jul 2019 01:47:29 -0000." <20190711014729.GB23621@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 10 Jul 2019 19:06:25 -0700 X-CMAE-Envelope: MS4wfLYjaVx0R6CKiaY/yEwQrWMtfnAGKDFQTXUiWTJj3iIDlgCIq2FpGVrDM166ZfrioFEQERhdMy7WuidmEYp2c38hHbbASkadViEJW6QzcN3LJ4HqdThn wPs7yH/OyKp0r/NxPKD14JDeT6BxZmtFZ5Vyn8Db4jK7AGoC0xrAoBdHwQbyezPHcxfCAVq8cT47Kz2yXsV0wJaAA0s+v3ZCn4+MMQodux91gGnUo9wnJBS7 jhNtNu6H6yAwzdlzqC1Jif9E3AgcDCcV9e9f1jdisbz5J+Jm/amwT7PDBe65bvP9Aa4pOv/CTTlhcYiMokL43A== X-Rspamd-Queue-Id: C8DA885F85 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-4.80 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; IP_SCORE(-2.38)[ip: (-6.00), ipnet: 64.59.128.0/20(-3.26), asn: 6327(-2.53), country: CA(-0.09)]; MX_GOOD(-0.01)[cached: spqr.komquats.com]; NEURAL_HAM_SHORT(-0.82)[-0.818,0]; RCVD_IN_DNSWL_NONE(0.00)[139.136.59.64.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_SPF_NA(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.zen.spamhaus.org : 127.0.0.11]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 02:06:51 -0000 In message <20190711014729.GB23621@FreeBSD.org>, Alexey Dokuchaev writes: > On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: > > New Revision: 349890 > > URL: https://svnweb.freebsd.org/changeset/base/349890 > > > > Log: > > telnet: fix a couple of snprintf() buffer overflows > > > > Modified: head/contrib/telnet/telnet/commands.c > > @@ -1655,10 +1655,11 @@ env_init(void) > > char hbuf[256+1]; > > char *cp2 = strchr((char *)ep->value, ':'); > > > > - gethostname(hbuf, 256); > > - hbuf[256] = '\0'; > > - cp = (char *)malloc(strlen(hbuf) + strlen(cp2) + 1); > > - sprintf((char *)cp, "%s%s", hbuf, cp2); > > Would it make sense to add something like __attribute__ ((deprecated)) > to those unsafe functions like gets(), sprintf(), etc.? Or it would > cause too much PITA? sprintf() is not deprecated (https://en.cppreference.com/w/c/io/fprintf) . gets() is removed in C11 (https://en.cppreference.com/w/c/io/gets), replaced by gets_s(). We already have gets_s(). We need printf_s(), sprintf_s() and snprintf_s(). -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Thu Jul 11 02:15:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4557115E9839; Thu, 11 Jul 2019 02:15:51 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D9F4886472; Thu, 11 Jul 2019 02:15:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2EFB1FEEA; Thu, 11 Jul 2019 02:15:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B2FoKk082300; Thu, 11 Jul 2019 02:15:50 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B2FofK082299; Thu, 11 Jul 2019 02:15:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907110215.x6B2FofK082299@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 11 Jul 2019 02:15:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349904 - head X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 349904 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D9F4886472 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 02:15:51 -0000 Author: markj Date: Thu Jul 11 02:15:50 2019 New Revision: 349904 URL: https://svnweb.freebsd.org/changeset/base/349904 Log: Add vm_page_hold.9 to ObsoleteFiles.inc. Add a missing .gz suffix to pwm.9 while here. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Thu Jul 11 00:44:09 2019 (r349903) +++ head/ObsoleteFiles.inc Thu Jul 11 02:15:50 2019 (r349904) @@ -38,10 +38,12 @@ # xargs -n1 | sort | uniq -d; # done +# 20190708: vm_page_hold() and _unhold() removed +OLD_FILES+=usr/share/man/man9/vm_page_hold.9.gz # 20190618: sys/capability.h removed (sys/capsicum.h is the one to use) OLD_FILES+=usr/include/sys/capability.h # 20190615: sys/pwm.h renamed to dev/pwmc.h and pwm(9) removed -OLD_FILES+=usr/include/sys/pwm.h usr/share/man/man9/pwm.9 +OLD_FILES+=usr/include/sys/pwm.h usr/share/man/man9/pwm.9.gz # 20190612: new clang import which bumps version from 8.0.0 to 8.0.1. OLD_FILES+=usr/lib/clang/8.0.0/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/8.0.0/include/sanitizer/asan_interface.h From owner-svn-src-head@freebsd.org Thu Jul 11 02:43:25 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E718915E9E8F; Thu, 11 Jul 2019 02:43:24 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7ECD087185; Thu, 11 Jul 2019 02:43:24 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6AEE2203CB; Thu, 11 Jul 2019 02:43:24 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B2hOHL097144; Thu, 11 Jul 2019 02:43:24 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B2hOKW097142; Thu, 11 Jul 2019 02:43:24 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201907110243.x6B2hOKW097142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Thu, 11 Jul 2019 02:43:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349905 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 349905 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7ECD087185 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 02:43:25 -0000 Author: alc Date: Thu Jul 11 02:43:23 2019 New Revision: 349905 URL: https://svnweb.freebsd.org/changeset/base/349905 Log: According to Section D5.10.3 "Maintenance requirements on changing System register values" of the architecture manual, an isb instruction should be executed after updating ttbr0_el1 and before invalidating the TLB. The lack of this instruction in pmap_activate() appears to be the reason why andrew@ and I have observed an unexpected TLB entry for an invalid PTE on entry to pmap_enter_quick_locked(). Thus, we should now be able to revert the workaround committed in r349442. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D20904 Modified: head/sys/arm64/arm64/efirt_machdep.c head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/efirt_machdep.c ============================================================================== --- head/sys/arm64/arm64/efirt_machdep.c Thu Jul 11 02:15:50 2019 (r349904) +++ head/sys/arm64/arm64/efirt_machdep.c Thu Jul 11 02:43:23 2019 (r349905) @@ -239,6 +239,7 @@ efi_arch_enter(void) __asm __volatile( "msr ttbr0_el1, %0 \n" + "isb \n" "dsb ishst \n" "tlbi vmalle1is \n" "dsb ish \n" @@ -266,6 +267,7 @@ efi_arch_leave(void) td = curthread; __asm __volatile( "msr ttbr0_el1, %0 \n" + "isb \n" "dsb ishst \n" "tlbi vmalle1is \n" "dsb ish \n" Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Thu Jul 11 02:15:50 2019 (r349904) +++ head/sys/arm64/arm64/pmap.c Thu Jul 11 02:43:23 2019 (r349905) @@ -5484,8 +5484,10 @@ pmap_activate(struct thread *td) critical_enter(); pmap = vmspace_pmap(td->td_proc->p_vmspace); td->td_proc->p_md.md_l0addr = vtophys(pmap->pm_l0); - __asm __volatile("msr ttbr0_el1, %0" : : - "r"(td->td_proc->p_md.md_l0addr)); + __asm __volatile( + "msr ttbr0_el1, %0 \n" + "isb \n" + : : "r"(td->td_proc->p_md.md_l0addr)); pmap_invalidate_all(pmap); critical_exit(); } From owner-svn-src-head@freebsd.org Thu Jul 11 03:29:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 334B815EAD3E; Thu, 11 Jul 2019 03:29:26 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BC57688DDE; Thu, 11 Jul 2019 03:29:25 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90A4D20B5B; Thu, 11 Jul 2019 03:29:25 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B3TPB2019036; Thu, 11 Jul 2019 03:29:25 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B3TPvv019035; Thu, 11 Jul 2019 03:29:25 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201907110329.x6B3TPvv019035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Thu, 11 Jul 2019 03:29:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349906 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 349906 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BC57688DDE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 03:29:26 -0000 Author: jhibbits Date: Thu Jul 11 03:29:25 2019 New Revision: 349906 URL: https://svnweb.freebsd.org/changeset/base/349906 Log: powerpc: Only worry about the lower 32 bits of SP in a 32-bit process Summary: Running a 32-bit process on a 64-bit POWER CPU may still use all 64-bits in calculations, while ignoring the upper 32 bits for addressing storage. It so happens that some processes end up with r1 (SP) having bit 31 set in some cases (33-bit address). Writing out to this 33-bit address obviosly fails. Since the CPU ignores the upper bits, we should as well. sendsig() and cpu_fetch_syscall_args() appear to be the only functions that actually rely on userspace register values for copy in/out, and cpu_fetch_syscall_args() doesn't seem to be bitten in practice yet. Reviewed By: luporl Differential Revision: https://reviews.freebsd.org/D20896 Modified: head/sys/powerpc/powerpc/exec_machdep.c Modified: head/sys/powerpc/powerpc/exec_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/exec_machdep.c Thu Jul 11 02:43:23 2019 (r349905) +++ head/sys/powerpc/powerpc/exec_machdep.c Thu Jul 11 03:29:25 2019 (r349906) @@ -144,6 +144,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask #endif size_t sfpsize; caddr_t sfp, usfp; + register_t sp; int oonstack, rndfsize; int sig; int code; @@ -155,7 +156,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask psp = p->p_sigacts; mtx_assert(&psp->ps_mtx, MA_OWNED); tf = td->td_frame; - oonstack = sigonstack(tf->fixreg[1]); /* * Fill siginfo structure. @@ -173,6 +173,8 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask sfp = (caddr_t)&sf32; sfpsize = sizeof(sf32); rndfsize = roundup(sizeof(sf32), 16); + sp = (uint32_t)tf->fixreg[1]; + oonstack = sigonstack(sp); /* * Save user context @@ -203,6 +205,8 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask #else rndfsize = roundup(sizeof(sf), 16); #endif + sp = tf->fixreg[1]; + oonstack = sigonstack(sp); /* * Save user context @@ -232,7 +236,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask usfp = (void *)(((uintptr_t)td->td_sigstk.ss_sp + td->td_sigstk.ss_size - rndfsize) & ~0xFul); } else { - usfp = (void *)((tf->fixreg[1] - rndfsize) & ~0xFul); + usfp = (void *)((sp - rndfsize) & ~0xFul); } /* From owner-svn-src-head@freebsd.org Thu Jul 11 04:38:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2261F15EBCA1; Thu, 11 Jul 2019 04:38:34 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A9BE98B04A; Thu, 11 Jul 2019 04:38:33 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82BA821768; Thu, 11 Jul 2019 04:38:33 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B4cXmt054796; Thu, 11 Jul 2019 04:38:33 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B4cXX1054795; Thu, 11 Jul 2019 04:38:33 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <201907110438.x6B4cXX1054795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Thu, 11 Jul 2019 04:38:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349907 - head/sys/netinet/tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: rrs X-SVN-Commit-Paths: head/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 349907 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A9BE98B04A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.932,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 04:38:34 -0000 Author: rrs Date: Thu Jul 11 04:38:33 2019 New Revision: 349907 URL: https://svnweb.freebsd.org/changeset/base/349907 Log: Update copyright per JBH's suggestions.. thanks. Modified: head/sys/netinet/tcp_stacks/rack.c Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 03:29:25 2019 (r349906) +++ head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 04:38:33 2019 (r349907) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 + * Copyright (c) 2016-2019 * Netflix Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -8537,10 +8537,10 @@ out: * retransmit. In persist state, just set snd_max. */ if (error == 0) { -/* if (TCPS_HAVEESTABLISHED(tp->t_state) && + if (TCPS_HAVEESTABLISHED(tp->t_state) && (tp->t_flags & TF_SACK_PERMIT) && tp->rcv_numsacks > 0) - tcp_clean_dsack_blocks(tp);*/ + tcp_clean_dsack_blocks(tp); if (len == 0) counter_u64_add(rack_out_size[TCP_MSS_ACCT_SNDACK], 1); else if (len == 1) { From owner-svn-src-head@freebsd.org Thu Jul 11 04:40:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED6B015EBDB8; Thu, 11 Jul 2019 04:40:58 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9411F8B2C7; Thu, 11 Jul 2019 04:40:58 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6EBCF2178D; Thu, 11 Jul 2019 04:40:58 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B4ewEo056801; Thu, 11 Jul 2019 04:40:58 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B4ewJH056800; Thu, 11 Jul 2019 04:40:58 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <201907110440.x6B4ewJH056800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Thu, 11 Jul 2019 04:40:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349908 - head/sys/netinet/tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: rrs X-SVN-Commit-Paths: head/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 349908 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9411F8B2C7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.932,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 04:40:59 -0000 Author: rrs Date: Thu Jul 11 04:40:58 2019 New Revision: 349908 URL: https://svnweb.freebsd.org/changeset/base/349908 Log: Update to jhb's other suggestion, use #error when we are missing HPTS. Modified: head/sys/netinet/tcp_stacks/rack.c Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 04:38:33 2019 (r349907) +++ head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 04:40:58 2019 (r349908) @@ -129,7 +129,7 @@ struct sysctl_ctx_list rack_sysctl_ctx; struct sysctl_oid *rack_sysctl_root; #ifndef TCPHPTS -fatal error missing option TCPHSTS in the build; +#error "fatal error missing option TCPHSTS in the build" #endif #define CUM_ACKED 1 From owner-svn-src-head@freebsd.org Thu Jul 11 04:48:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4E6015EC181 for ; Thu, 11 Jul 2019 04:48:43 +0000 (UTC) (envelope-from rrs@netflix.com) Received: from mail-vs1-xe43.google.com (mail-vs1-xe43.google.com [IPv6:2607:f8b0:4864:20::e43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 329318B8AA for ; Thu, 11 Jul 2019 04:48:43 +0000 (UTC) (envelope-from rrs@netflix.com) Received: by mail-vs1-xe43.google.com with SMTP id y16so3072789vsc.3 for ; Wed, 10 Jul 2019 21:48:43 -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=DsJqhKklihTqGHjZRjvsZMbn6SVYL6vj8sP7JCbsRb8=; b=oVo9fRpxPLI0oFvCL6FjfBIyqLlTyEKPCxZYwWTw/pQULHW2Jhd3TIDdTiSY2vFBBY h4Tr4bMo2xQt/AeAarC5//JHAReEjUjt7ifdjcL3HeNx45iP5yXW6QFYZSsahA/YbKNQ 30v+eBXJeOldaK80H1H47Mu9OWLd24pxmjp2BRmh5ftEN99GBflPtutwuisvL2EiJxWr MRF9s57XYiOGqnMYnOXiUWpSN6XRmK4hJXVoN2W/ztWaRnnKHScFYDI1al/rxqjUTzbH TzbixUk6P/jG9s0ByNogyDZRaQRtLVEdsHWAauFv5dFIiOL4EpML1clSZMRrrSPlzBvG 1jQA== X-Gm-Message-State: APjAAAX6VCDZOZqooudwdS63r62pUoYcYupleIXCO1gaaELzLNnlBtQN ML7RD+MdasqzNumKNayQ70Xobw== X-Google-Smtp-Source: APXvYqzSrgPMrmoWZpLGhZTl7L9fLdPBP29faGVRCk/+HjlGDVe58EKmrse4RdYrqF1HdbZJa2WCwg== X-Received: by 2002:a67:f116:: with SMTP id n22mr1149424vsk.73.1562820521300; Wed, 10 Jul 2019 21:48:41 -0700 (PDT) Received: from ?IPv6:2607:fb10:7061:7fd::15b5? ([2607:fb10:7061:7fd::15b5]) by smtp.gmail.com with ESMTPSA id i137sm1888993vkd.24.2019.07.10.21.48.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jul 2019 21:48:40 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: svn commit: r349893 - in head/sys: modules/tcp/rack netinet netinet/tcp_stacks sys From: Randall Stewart In-Reply-To: <4cdc824e-7e71-731d-50d4-c3f6231f9858@FreeBSD.org> Date: Thu, 11 Jul 2019 00:48:38 -0400 Cc: Randall Ray Stewart , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <7695E2FC-406D-46CE-88F2-0690B9AAA36D@netflix.com> References: <201907102040.x6AKeern006731@repo.freebsd.org> <4cdc824e-7e71-731d-50d4-c3f6231f9858@FreeBSD.org> To: John Baldwin X-Mailer: Apple Mail (2.3445.9.1) X-Rspamd-Queue-Id: 329318B8AA X-Spamd-Bar: ------ X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 04:48:44 -0000 John: Thanks for the suggestions.. I have committed changes to the two nits. As to M_PROTO1, I see that in the NF world we have removed M_PROTO12 and moved the M_PROTO=E2=80=99s up 1 i.e. M_PROTO1 =3D=3D = 0x2000 So for now it is safe, since the M_TSTMP_LRO is not yet used.. but in my up and coming commits I will have to address this i.e. either do the same thing or just make it use M_PROTO12. There are a couple of places M_PROTO1 is used on the receive path so that would not work there :o After I get the DSACK fixes in my next change to get BBR in will be the LRO work=E2=80=A6 So maybe I should just settle on using M_PROTO12 for that=20 what do you think? R > On Jul 10, 2019, at 7:28 PM, John Baldwin wrote: >=20 > On 7/10/19 1:40 PM, Randall Stewart wrote: >> Author: rrs >> Date: Wed Jul 10 20:40:39 2019 >> New Revision: 349893 >> URL: https://svnweb.freebsd.org/changeset/base/349893 >>=20 >> Log: >> This commit updates rack to what is basically being used at NF as >> well as sets in some of the groundwork for committing BBR. The >> hpts system is updated as well as some other needed utilities >> for the entrance of BBR. This is actually part 1 of 3 more >> needed commits which will finally complete with BBRv1 being >> added as a new tcp stack. >>=20 >> Sponsored by: Netflix Inc. >> Differential Revision: https://reviews.freebsd.org/D20834 >=20 > Is it safe for M_TSTMP_LRO to conflict with M_PROTO1? >=20 > Also, it seems you changed the copyright range on rack.c from > 2016-2019 to just 2016 which I suspect is an accident. >=20 > I would suggest using #error here: >=20 > #ifndef TCPHPTS > fatal error missing option TCPHSTS in the build; > #endif >=20 > --=20 > John Baldwin ------ Randall Stewart rrs@netflix.com From owner-svn-src-head@freebsd.org Thu Jul 11 06:22:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 096B815ED485; Thu, 11 Jul 2019 06:22:16 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A0BD38E697; Thu, 11 Jul 2019 06:22:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79B8E22ACA; Thu, 11 Jul 2019 06:22:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B6MFgn008562; Thu, 11 Jul 2019 06:22:15 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B6MF5S008561; Thu, 11 Jul 2019 06:22:15 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907110622.x6B6MF5S008561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 11 Jul 2019 06:22:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349909 - head/sys/dev/mpr X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/mpr X-SVN-Commit-Revision: 349909 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A0BD38E697 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 06:22:16 -0000 Author: imp Date: Thu Jul 11 06:22:15 2019 New Revision: 349909 URL: https://svnweb.freebsd.org/changeset/base/349909 Log: More fully implement the state machine. When a command is finished running, we must transition it from INQUEUE to busy state. We were failing to do that, so we hit a panic when the commands were freed. This only affects mpr, mps already did simmilar things. Now both the polling and interrupt paths properly set BUSY as appropriate. Modified: head/sys/dev/mpr/mpr.c Modified: head/sys/dev/mpr/mpr.c ============================================================================== --- head/sys/dev/mpr/mpr.c Thu Jul 11 04:40:58 2019 (r349908) +++ head/sys/dev/mpr/mpr.c Thu Jul 11 06:22:15 2019 (r349909) @@ -2367,6 +2367,7 @@ mpr_complete_command(struct mpr_softc *sc, struct mpr_ return; } + cm->cm_state = MPR_CM_STATE_BUSY; if (cm->cm_flags & MPR_CM_FLAGS_POLLED) cm->cm_flags |= MPR_CM_FLAGS_COMPLETE; @@ -3879,7 +3880,7 @@ mpr_request_polled(struct mpr_softc *sc, struct mpr_co break; } } - + cm->cm_state = MPR_CM_STATE_BUSY; if (error) { mpr_dprint(sc, MPR_FAULT, "Calling Reinit from %s\n", __func__); rc = mpr_reinit(sc); From owner-svn-src-head@freebsd.org Thu Jul 11 07:57:56 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A16515CA61D for ; Thu, 11 Jul 2019 07:57:56 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-yb1-xb31.google.com (mail-yb1-xb31.google.com [IPv6:2607:f8b0:4864:20::b31]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 6E2C56B43A for ; Thu, 11 Jul 2019 07:57:55 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: by mail-yb1-xb31.google.com with SMTP id f195so1891724ybg.9 for ; Thu, 11 Jul 2019 00:57:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UHis9ExlhtJ8Qh1gem2LPNGXL4WxSi65eb6HoqemXFk=; b=fvhf4rOiqMBbbTnJHP3uQ2QDzVIW+A59VRvwfOOxnaLpOKklR+18EKBAOxc0pDf2F4 V5KN7zmHdls8PMDk/f06hX+fPHfQITrgEWTEdnJMly6Gd4KQKbYMqVH4oDZu+AXscuWC fIADMDZVKYsYcYgKVh22KwWPcKzvP0BdYNOwI= 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=UHis9ExlhtJ8Qh1gem2LPNGXL4WxSi65eb6HoqemXFk=; b=I04ABq8n89H7EIgjwlajP4KdBhkQL6A7joeO8+PoQJwaDgRyrfWZVIwJP39QrM5Lh5 QGrl0/jEMlQo+fx6NI5cUfsKhNHxroA531gqpXkEpW8jSSWujjEZfxBC2gLtFDlhQ00A lKMKDJseG86m+7rLYLPvlhZEKAUUDeI8gTDZbvZlh7bPowFeW3dkk7tkleMtevYTJUc7 ytfM+acQ/iZQ9MfZ7s6L7RYcR9zAbUToJ/J8Bx8bdr1U04KgrYDDk8rHZrw6hbNVlvfN 60WY3/xhsAvOwlVrU9FIKDbBLDSbWzdaNN3SJFQVIHGHrAialjFXEjXuXgAb0eAceR6R A6ag== X-Gm-Message-State: APjAAAWmobTHwjTKr4gYJNrzzRh9I5kO0pRrtouPEBWMy6ZSRAEVj1iT 3h+iVftyh4oacVS2GfKIPCYkpJrQM+FgWK5KPm8= X-Google-Smtp-Source: APXvYqzfOr8fA3VGDhSHsLPrqc/voU0Ktag2aoy2qVEViny9LGIblkXQTUuuyexamYeBCIyAc7N1Ri59lOI7dk7AYxE= X-Received: by 2002:a25:99c2:: with SMTP id q2mr1309536ybo.133.1562831874119; Thu, 11 Jul 2019 00:57:54 -0700 (PDT) MIME-Version: 1.0 References: <201907101742.x6AHg4os016752@repo.freebsd.org> In-Reply-To: <201907101742.x6AHg4os016752@repo.freebsd.org> From: Eitan Adler Date: Thu, 11 Jul 2019 00:57:27 -0700 Message-ID: Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet To: Philip Paeps Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 6E2C56B43A X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.93 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.929,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 07:57:56 -0000 On Wed, 10 Jul 2019 at 10:42, Philip Paeps wrote: > Author: philip > Date: Wed Jul 10 17:42:04 2019 > New Revision: 349890 > URL: https://svnweb.freebsd.org/changeset/base/349890 > > Log: > telnet: fix a couple of snprintf() buffer overflows > > Obtained from: Juniper Networks > MFC after: 1 week > > Modified: > head/contrib/telnet/telnet/commands.c > head/contrib/telnet/telnet/telnet.c > head/contrib/telnet/telnet/utilities.c > > Modified: head/contrib/telnet/telnet/commands.c > > ============================================================================== > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 17:21:59 2019 > (r349889) > +++ head/contrib/telnet/telnet/commands.c Wed Jul 10 17:42:04 2019 > (r349890) > @@ -1655,10 +1655,11 @@ env_init(void) > char hbuf[256+1]; > char *cp2 = strchr((char *)ep->value, ':'); > > - gethostname(hbuf, 256); > - hbuf[256] = '\0'; > - cp = (char *)malloc(strlen(hbuf) + strlen(cp2) + 1); > - sprintf((char *)cp, "%s%s", hbuf, cp2); > + gethostname(hbuf, sizeof(hbuf)); > + hbuf[sizeof(hbuf)-1] = '\0'; > + unsigned int buflen = strlen(hbuf) + strlen(cp2) + 1; > Shouldn't this be `size_t` ? > + cp = (char *)malloc(sizeof(char)*buflen); > sizeof(char) is always 1 and is odd to see. Don't cast the return value of `malloc`. > + snprintf((char *)cp, buflen, "%s%s", hbuf, cp2); > Is the cast of `cp` here required? Also couldn't this be replaced with asprintf? free(ep->value); > ep->value = (unsigned char *)cp; > } > > Modified: head/contrib/telnet/telnet/telnet.c > > ============================================================================== > --- head/contrib/telnet/telnet/telnet.c Wed Jul 10 17:21:59 2019 > (r349889) > +++ head/contrib/telnet/telnet/telnet.c Wed Jul 10 17:42:04 2019 > (r349890) > @@ -785,7 +785,7 @@ suboption(void) > name = gettermname(); > len = strlen(name) + 4 + 2; > if (len < NETROOM()) { > - sprintf(temp, "%c%c%c%c%s%c%c", IAC, SB, TELOPT_TTYPE, > + snprintf(temp, sizeof(temp), "%c%c%c%c%s%c%c", IAC, SB, > TELOPT_TTYPE, > TELQUAL_IS, name, IAC, SE); > ring_supply_data(&netoring, temp, len); > printsub('>', &temp[2], len-2); > @@ -807,7 +807,7 @@ suboption(void) > > TerminalSpeeds(&ispeed, &ospeed); > > - sprintf((char *)temp, "%c%c%c%c%ld,%ld%c%c", IAC, SB, > TELOPT_TSPEED, > + snprintf((char *)temp, sizeof(temp), "%c%c%c%c%ld,%ld%c%c", > IAC, SB, TELOPT_TSPEED, > TELQUAL_IS, ospeed, ispeed, IAC, SE); > len = strlen((char *)temp+4) + 4; /* temp[3] is 0 ... */ > > > Modified: head/contrib/telnet/telnet/utilities.c > > ============================================================================== > --- head/contrib/telnet/telnet/utilities.c Wed Jul 10 17:21:59 2019 > (r349889) > +++ head/contrib/telnet/telnet/utilities.c Wed Jul 10 17:42:04 2019 > (r349890) > @@ -629,7 +629,7 @@ printsub(char direction, unsigned char *pointer, int l > } > { > char tbuf[64]; > - sprintf(tbuf, "%s%s%s%s%s", > + snprintf(tbuf, sizeof(tbuf), "%s%s%s%s%s", > pointer[2]&MODE_EDIT ? "|EDIT" : "", > pointer[2]&MODE_TRAPSIG ? "|TRAPSIG" : "", > pointer[2]&MODE_SOFT_TAB ? "|SOFT_TAB" : "", > > -- Eitan Adler From owner-svn-src-head@freebsd.org Thu Jul 11 08:02:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B2D415CAC96; Thu, 11 Jul 2019 08:02:20 +0000 (UTC) (envelope-from yaneurabeya@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) server-signature RSA-PSS (4096 bits) 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 D4E286BA81; Thu, 11 Jul 2019 08:02:19 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg1-x52e.google.com with SMTP id w10so2537711pgj.7; Thu, 11 Jul 2019 01:02:19 -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=2L+wyxSDhU1swICrUvbYRgi18tHZL7GALfpWn6mo/eo=; b=DAN4MPNQrW1/Eb3xcrV2i0petOVsM8kk6B2xhmvSBD45OxD4emWoYuYW744bHMQU47 ODp8mg01KvJTBds/su342jrB20L2c4KAZbdelKBkNpI5vg9xEG4iNIRrYNwtvePbwLi3 b8rwzLXbYBXXhkHa3tOcPLhijO7daN301NKGJCoZg4IxXzCZvaR6z3qVAkVJFiQKvvcR EblYjKfbv7mKbpbUMhydU1zBFTE2JGKcAqz0d+6XwiGIF3qtO/mXZeN7dsZQCSaLIncY Ym21QoYH3sqebnZU9Tv2hcAn8k5u+4m4byNxLJt4eEVjeeVfq+TEpwStP5F4KhheuxPV hi4A== 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=2L+wyxSDhU1swICrUvbYRgi18tHZL7GALfpWn6mo/eo=; b=I9BIbeiWWO+2Cre8+I+9zLLuc1hLlGXNvSum7X4oE7F1KHAEzTPpsFAOKbT37v3/kX PefP8HDLJuitO+OwhRGLsPSylAsiCtJZJwDY7Z+JuVaPXjzxJ4bWgVewDJlOEA8e+s4A icaIBBXDs6eesBO1Ls1LUCVG/VlhEH3mVpqUmdONoZnvCoa1ly93O9fReLBt1h3zjWc7 twc5XF62W+Y4mrL7EJGy/KEa0SsUlQkGItfy0I21WgeQ3FGePAvEvm2l+PJszPMRmB+7 oXvRyfS+55picFfCJ1OPeU4IO3eG8Kj2JWBWUlYElrnEbtEVNrMT/YmgpKNLaJAcI02h Papg== X-Gm-Message-State: APjAAAUrqw5aGYHsr2zUzavYNHFVm8gboTEeXWA5C1Rtq6HZCbuxx4Zy gRqGkzAjSqKm+waiTUFJOaKiDQYqZq4= X-Google-Smtp-Source: APXvYqy2cj76h5c3hxFHlOnIss9JC47oxYdjQmzcPyBfBU973MaF+lK8OW+zX5m5ZaHQj2FpSlSqzw== X-Received: by 2002:a63:6981:: with SMTP id e123mr2970713pgc.136.1562832137234; Thu, 11 Jul 2019 01:02:17 -0700 (PDT) Received: from [192.168.20.7] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id j21sm4257444pfh.86.2019.07.11.01.02.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jul 2019 01:02:16 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r349896 - head/contrib/telnet/telnet From: Enji Cooper In-Reply-To: <201907102236.x6AMaFLI067550@repo.freebsd.org> Date: Thu, 11 Jul 2019 01:02:15 -0700 Cc: src-committers , svn-src-all , svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <6031EBD8-84D7-46D4-A3E5-D78427D084B1@gmail.com> References: <201907102236.x6AMaFLI067550@repo.freebsd.org> To: Philip Paeps X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: D4E286BA81 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.92 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.92)[-0.922,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 08:02:20 -0000 > On Jul 10, 2019, at 3:36 PM, Philip Paeps wrote: >=20 > Author: philip > Date: Wed Jul 10 22:36:14 2019 > New Revision: 349896 > URL: https://svnweb.freebsd.org/changeset/base/349896 >=20 > Log: > telnet: fix minor style violation >=20 > While here also fix a very unlikely NULL pointer dereference. >=20 > Submitted by: Shawn Webb >=20 > Modified: > head/contrib/telnet/telnet/commands.c >=20 > Modified: head/contrib/telnet/telnet/commands.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 22:23:59 2019 = (r349895) > +++ head/contrib/telnet/telnet/commands.c Wed Jul 10 22:36:14 2019 = (r349896) > @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); > #include > #include >=20 > +#include > #include > #include > #include > @@ -1654,11 +1655,13 @@ env_init(void) > || (strncmp((char *)ep->value, "unix:", 5) =3D=3D 0))) { > char hbuf[256+1]; > char *cp2 =3D strchr((char *)ep->value, ':'); > + size_t buflen; >=20 > gethostname(hbuf, sizeof(hbuf)); > hbuf[sizeof(hbuf)-1] =3D '\0'; > - unsigned int buflen =3D strlen(hbuf) + strlen(cp2) + = 1; > + buflen =3D strlen(hbuf) + strlen(cp2) + 1; > cp =3D (char *)malloc(sizeof(char)*buflen); > + assert(cp !=3D NULL); This will unfortunately still segfault if assert is compiled out of the = system as a no-op (-DNDEBUG). I genuinely think using asprintf instead is the way to go, as Eitan and = Warner brought up, since it reduces complexity in the program. Thank you, -Enji= From owner-svn-src-head@freebsd.org Thu Jul 11 08:38:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2994215CB99B; Thu, 11 Jul 2019 08:38:01 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 9EDE76CD39; Thu, 11 Jul 2019 08:38:00 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf1-x42d.google.com with SMTP id j2so2413676pfe.6; Thu, 11 Jul 2019 01:38:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=3UBZ/7kHrc8s5iB6X/AAff4ovemHn3/8xhPdX8yVFCc=; b=YlfYSiArDe50XgI/QwABeJlNLmIYfho/EB0nsvg1wLWJrKsURLdiYWq5gACT7CV24j M/gGLbMh2N1Tt89IDzQfULny8TRfXa+cjQM49DO/60Ms+PJFrLv98mla6pgoyai0Wpul WtqTRkioMPTCPwP5apY1bQBTBjw2fl8Q4mTAHjnn1JIsOXVRIs7DnqGf7oG7PpvYxKPo pJSstEoni6Vtq+cU4g31HRDHj9k19ThXlTjAeJo2CXbRmOCp4s6rxp7t8KGAh/ayDoW1 yHRfaPw+tW93guRVOnGYo3pYhgMGENvVU9CP6plnUnjN27p0Cj7w+zw1Nx6v8FUoFbUE Yibg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=3UBZ/7kHrc8s5iB6X/AAff4ovemHn3/8xhPdX8yVFCc=; b=St7BZspXw7QgChSNgNr56JCwx0N4ZX6dH8SeyHUyC9QGwC/psjkvJuyGdhguPgsLDD GOqFD1IKDwoYgnGKWUdeArYXufEGMHPVMS7V2zlhp17VXrru2KzHOJbjhLqg1Z6eA//C jSiy8RPKhXti8ly88lV3doZGcq3oinG0FpNYrZ8N531+aaWPto6nmpC9sLNXBZ+Q7hzF aEjjnpnLfq92GVEdLKg1BSLmwQcjMidBJvHj74DWFFkOvjXXncDGwQxmfLKo1GYOMuoY MDmvi1Axu4r+1zyPKTVvDFxywRpNt2YUn1zAvlKkKAl2yUX0rW9Cov3naUnTfEqAcL1I EDaA== X-Gm-Message-State: APjAAAUId/0B+DpibEdAn5WQzbhAIACvsS+SrzV2isWARa+0ILgVBnLb QMHJv3JjuWNV2jnjHBze/lGG5I61bXo= X-Google-Smtp-Source: APXvYqyAjnYIhABMpm/GB7VFZbAFG8XlyM/5M2/oM05UtYDz0lvtOc6AdP4GWsjOAcEj1+9vIsvQ3Q== X-Received: by 2002:a65:62ca:: with SMTP id m10mr3122365pgv.57.1562834278293; Thu, 11 Jul 2019 01:37:58 -0700 (PDT) Received: from [192.168.20.7] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id 131sm6756956pfx.57.2019.07.11.01.37.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jul 2019 01:37:57 -0700 (PDT) From: Enji Cooper Message-Id: <6AC34953-52FC-48FC-B83F-CFFB6A48EC84@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r349907 - head/sys/netinet/tcp_stacks Date: Thu, 11 Jul 2019 01:37:56 -0700 In-Reply-To: <201907110438.x6B4cXX1054795@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Randall Stewart References: <201907110438.x6B4cXX1054795@repo.freebsd.org> X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 9EDE76CD39 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.93 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.933,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 08:38:01 -0000 > On Jul 10, 2019, at 9:38 PM, Randall Stewart wrote: >=20 > Author: rrs > Date: Thu Jul 11 04:38:33 2019 > New Revision: 349907 > URL: https://svnweb.freebsd.org/changeset/base/349907 >=20 > Log: > Update copyright per JBH's suggestions.. thanks. >=20 > Modified: > head/sys/netinet/tcp_stacks/rack.c >=20 > Modified: head/sys/netinet/tcp_stacks/rack.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 03:29:25 2019 = (r349906) > +++ head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 04:38:33 2019 = (r349907) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2016 > + * Copyright (c) 2016-2019 > * Netflix Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > @@ -8537,10 +8537,10 @@ out: > * retransmit. In persist state, just set snd_max. > */ > if (error =3D=3D 0) { > -/* if (TCPS_HAVEESTABLISHED(tp->t_state) && > + if (TCPS_HAVEESTABLISHED(tp->t_state) && > (tp->t_flags & TF_SACK_PERMIT) && > tp->rcv_numsacks > 0) > - tcp_clean_dsack_blocks(tp);*/ > + tcp_clean_dsack_blocks(tp); Removing this commented out code unfortunately broke the build: = https://ci.freebsd.org/job/FreeBSD-head-amd64-LINT/12934/console = . Thanks, -Enji From owner-svn-src-head@freebsd.org Thu Jul 11 11:50:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA0D715CFC5C; Thu, 11 Jul 2019 11:50:14 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (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 8E0EE735E8; Thu, 11 Jul 2019 11:50:13 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id lXaOhJyiyUIS2lXaPhaTn7; Thu, 11 Jul 2019 05:50:06 -0600 X-Authority-Analysis: v=2.3 cv=N41X6F1B c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=0o9FgrsRnhwA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=SQCxYW1kktpyUpVo5akA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 8176E64B; Thu, 11 Jul 2019 04:50:03 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x6BBo3QI009399; Thu, 11 Jul 2019 04:50:03 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x6BBo3YA009396; Thu, 11 Jul 2019 04:50:03 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201907111150.x6BBo3YA009396@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs 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: Randall Stewart cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349907 - head/sys/netinet/tcp_stacks In-Reply-To: Message from Randall Stewart of "Thu, 11 Jul 2019 04:38:33 -0000." <201907110438.x6B4cXX1054795@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 11 Jul 2019 04:50:03 -0700 X-CMAE-Envelope: MS4wfNcC15S+wst+a8nn/j4/R45govZRPfnQFvJHfozHgExSW3XI0SzBH9oWda9PaGJDDmCI62c9+nf5Dv24KHEGpp9U/ZwAWOxMBILlnGm90EOTbcSa0+ln 4Ij/sJ20x8i0UJ18elyCGmRtyWYyZ9qb/wib99J/mpKiretBNY6PsK3S691kYLlYhKaCbsFL7QTbIdTRdDRr1sNl3kyMkQT6ynWAd1RJ0wHp2TDOESyRQdxP hPxxKQeD3xLLS/GNdok1yoJCjDxGjPfjh73Kz4v5ywfckes6TaENS0FN46pvjlMA X-Rspamd-Queue-Id: 8E0EE735E8 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-5.01 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; MV_CASE(0.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; REPLYTO_EQ_FROM(0.00)[]; IP_SCORE(-2.51)[ip: (-6.69), ipnet: 64.59.128.0/20(-3.25), asn: 6327(-2.53), country: CA(-0.09)]; MX_GOOD(-0.01)[cached: spqr.komquats.com]; NEURAL_HAM_SHORT(-0.89)[-0.888,0]; RCVD_IN_DNSWL_NONE(0.00)[9.134.59.64.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_SPF_NA(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.zen.spamhaus.org : 127.0.0.11]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 11:50:15 -0000 In message <201907110438.x6B4cXX1054795@repo.freebsd.org>, Randall Stewart writ es: > Author: rrs > Date: Thu Jul 11 04:38:33 2019 > New Revision: 349907 > URL: https://svnweb.freebsd.org/changeset/base/349907 > > Log: > Update copyright per JBH's suggestions.. thanks. > > Modified: > head/sys/netinet/tcp_stacks/rack.c > > Modified: head/sys/netinet/tcp_stacks/rack.c > ============================================================================= > = > --- head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 03:29:25 2019 > (r349906) > +++ head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 04:38:33 2019 > (r349907) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2016 > + * Copyright (c) 2016-2019 > * Netflix Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > @@ -8537,10 +8537,10 @@ out: > * retransmit. In persist state, just set snd_max. > */ > if (error == 0) { > -/* if (TCPS_HAVEESTABLISHED(tp->t_state) && > + if (TCPS_HAVEESTABLISHED(tp->t_state) && > (tp->t_flags & TF_SACK_PERMIT) && > tp->rcv_numsacks > 0) > - tcp_clean_dsack_blocks(tp);*/ > + tcp_clean_dsack_blocks(tp); > if (len == 0) > counter_u64_add(rack_out_size[TCP_MSS_ACCT_SNDACK], 1); > else if (len == 1) { > This commit updates more than just the copyright. Were the other changes intended? If yes, a) Removing the */ at the other end of the commented block is also needed. b) The commit log is incorrect. Let's revert this and try again. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Thu Jul 11 12:12:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0D2015D1222; Thu, 11 Jul 2019 12:12:48 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (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 A420D74C67; Thu, 11 Jul 2019 12:12:47 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id lXwKhK78lUIS2lXwLhaWA1; Thu, 11 Jul 2019 06:12:46 -0600 X-Authority-Analysis: v=2.3 cv=N41X6F1B c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=0o9FgrsRnhwA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=XDP4Czh_GyGxbl_F4qQA:9 a=CjuIK1q_8ugA:10 a=rtGtfcxtKB4A:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 0FAF2689; Thu, 11 Jul 2019 05:12:44 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x6BCCh7c009611; Thu, 11 Jul 2019 05:12:43 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x6BCChgp009608; Thu, 11 Jul 2019 05:12:43 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201907111212.x6BCChgp009608@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs 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: Randall Stewart cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Cy Schubert Subject: Re: svn commit: r349907 - head/sys/netinet/tcp_stacks In-Reply-To: Message from Cy Schubert of "Thu, 11 Jul 2019 04:50:03 -0700." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 11 Jul 2019 05:12:43 -0700 X-CMAE-Envelope: MS4wfKNQigXcT89M9MnpviT68M0OWxwsbgy9Slj3VJZUO7iutiflFsqlckO7aClh63XFrWF5s3IxuIGDN5Lce98SvtXf4FTIMtvwVa2k/sGiXq9m07o4jHcy gcw38qVFMptaU8HosBlwQfgibA9Nv+b9iSnOda5M6J13MACIY6SaKqYQ5qJmSW4h4VKnYpCqFShfRdjl71vDbPtM6GOpMtMWhJK2A9ndwmq5bQ0JyHeewpBk YqtAK+07Q9QP9xvK0OXTKWSk8kTX95LkCc1UxO0IGpPgLnRTGIvLpAHsLYmVQ0Ou X-Rspamd-Queue-Id: A420D74C67 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-5.06 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[cached: spqr.komquats.com]; NEURAL_HAM_SHORT(-0.94)[-0.940,0]; RCVD_IN_DNSWL_NONE(0.00)[9.134.59.64.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-2.51)[ip: (-6.67), ipnet: 64.59.128.0/20(-3.25), asn: 6327(-2.53), country: CA(-0.09)]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.zen.spamhaus.org : 127.0.0.11] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 12:12:48 -0000 Cy Schubert writes: > In message <201907110438.x6B4cXX1054795@repo.freebsd.org>, Randall > Stewart writ > es: > > Author: rrs > > Date: Thu Jul 11 04:38:33 2019 > > New Revision: 349907 > > URL: https://svnweb.freebsd.org/changeset/base/349907 > > > > Log: > > Update copyright per JBH's suggestions.. thanks. > > > > Modified: > > head/sys/netinet/tcp_stacks/rack.c > > > > Modified: head/sys/netinet/tcp_stacks/rack.c > > =========================================================================== > == > > = > > --- head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 03:29:25 2019 > > (r349906) > > +++ head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 04:38:33 2019 > > (r349907) > > @@ -1,5 +1,5 @@ > > /*- > > - * Copyright (c) 2016 > > + * Copyright (c) 2016-2019 > > * Netflix Inc. All rights reserved. > > * > > * Redistribution and use in source and binary forms, with or without > > @@ -8537,10 +8537,10 @@ out: > > * retransmit. In persist state, just set snd_max. > > */ > > if (error == 0) { > > -/* if (TCPS_HAVEESTABLISHED(tp->t_state) && > > + if (TCPS_HAVEESTABLISHED(tp->t_state) && > > (tp->t_flags & TF_SACK_PERMIT) && > > tp->rcv_numsacks > 0) > > - tcp_clean_dsack_blocks(tp);*/ > > + tcp_clean_dsack_blocks(tp); > > if (len == 0) > > counter_u64_add(rack_out_size[TCP_MSS_ACCT_SNDACK], 1); > > else if (len == 1) { > > > > This commit updates more than just the copyright. Were the other > changes intended? If yes, > > a) Removing the */ at the other end of the commented block is also > needed. My mistake. I missed the */. Sorry. > b) The commit log is incorrect. This is still a problem. > > Let's revert this and try again. For the sake of the log, probably. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Thu Jul 11 13:25:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40ABE15D28D1; Thu, 11 Jul 2019 13:25:38 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 89E6B76F09; Thu, 11 Jul 2019 13:25:37 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id F1BDF3607A7; Thu, 11 Jul 2019 23:25:26 +1000 (AEST) Date: Thu, 11 Jul 2019 23:25:24 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alexey Dokuchaev cc: Philip Paeps , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet In-Reply-To: <20190711014729.GB23621@FreeBSD.org> Message-ID: <20190711221158.N1533@besplex.bde.org> References: <201907101742.x6AHg4os016752@repo.freebsd.org> <20190711014729.GB23621@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 cx=a_idp_d a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=EprUL-5I6KnjuIzbal4A:9 a=YoCYy-C6q4L7z-oV:21 a=y7qSRRag8CzNf-xG:21 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-Rspamd-Queue-Id: 89E6B76F09 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.94 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.94)[-0.937,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 13:25:38 -0000 On Thu, 11 Jul 2019, Alexey Dokuchaev wrote: > On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: >> New Revision: 349890 >> URL: https://svnweb.freebsd.org/changeset/base/349890 >> >> Log: >> telnet: fix a couple of snprintf() buffer overflows I see few fixes in this fix. I see even more style bugs than before. >> Modified: head/contrib/telnet/telnet/commands.c >> @@ -1655,10 +1655,11 @@ env_init(void) >> char hbuf[256+1]; >> char *cp2 = strchr((char *)ep->value, ':'); >> >> - gethostname(hbuf, 256); >> - hbuf[256] = '\0'; >> - cp = (char *)malloc(strlen(hbuf) + strlen(cp2) + 1); >> - sprintf((char *)cp, "%s%s", hbuf, cp2); > > Would it make sense to add something like __attribute__ ((deprecated)) > to those unsafe functions like gets(), sprintf(), etc.? Or it would > cause too much PITA? sprintf() is safe to use and was used perfectly correctly (except for not not checking the validity of most of its args: no check of the result of gethostname() or malloc(), and no check for overflow in 'strlen(hbuf) + strlen(cp2) + 1'. malloc() is used to provide a buffer just large enough for sprintf() to not overflow the buffer, modulo the missing error checking. Blindly changing to snprintf() does little to improve this. It gives a garbage buffer instead of buffer overrun in some of the error cases. It is missing error checking. The bugs visible in the above are: - hard-coded size for hbuf. The correct size is {HOST_NAME_MAX} + 1. HOST_NAME_MAX is intentionally not defined in FreeBSD's , so even unportable POSIX applications have to deal with the full complexity of POSIX limits (they can't simply hard-code HOST_NAME_MAX). POSIX requires using sysconf(_SC_HOST_NAME_MAX) and dealing with errors and indeterminate values reported by it. Unfortunately, FreeBSD also has MAXHOSTNAMELEN. sysconf(_SC_HOST_NAME_MAX) just returns this minus 1. This is is 256. The hard-coded 256 in the above is essentially this, and adding 1 to this is nonsense. telnet uses MAXHOSTNAMELEN for global variables. It also #defines MAXHOSTNAMELEN as 256 if it is not defined in an included header. So if the extra 1 were actually used, then the global variables couldn't hold hostnames and there would be bugs elswhere. Honestly unportable code would use MAXHOSTNAME everywhere, and not add 1 to it, and depend on this being large enough. gethostname() guarantees to nul-terminated if it succeeds and the buffer is large enough. telnet uses gethostname() in 1 other place. In telnet.c, it initializes the global local_host which has size MAXHOSTNAME. Of course it doesn't check for errors. It does force nul-termination. - missing spaces around binary operator in '256+1' - initialization in declaration of cp2 - bogus cast to char * in declaration of cp2. This breaks the warning that ep->value has the bogus type unsigned char *. Not many character arrays actually need to have type unsigned char *, and if they do then it might be an error to pass them to str*() functions since str*() functions are only guaranteed to work right for plain char *. - no error check for gethostname(), bogus dishonestly unportable size for hbuf, and partial fixup for these bugs by forcing nul-termination (see above) - bogus cast of malloc() to char *. This was more needed 30-40 years ago for bad code that doesn't declare malloc() in a standard header or doesn't include that header. Telnet is that old, so this wasn't bogus originally. - no check for overflow in 'strlen(hbuf) + strlen(cp2) + 1'. Checking this would be silly, but not much sillier than forcing nul-termination after not trusting gethostname() and/or our buffer size. strlen(hbuf) is known to be small, and strlen(cp2) must be known to be non-preposterous, else overflow is possible. However, cp2 is a substring of an environment variable, so it can be almost as large as the address space if a malicious environment can be created. Perhaps it is limited to ARG_MAX. Practical code could limit its size to 256 or so and statically allocate the whole buffer on the stack. Or don't limit it, and use alloca() or a VLA to allocate the whole buffer on the stack. Paranoid code of course can't even have a stack, unless the C runtime checks for stack overflow and the program can handle exceptions from that. - bogus cast of cp arg to char * in sprintf() call. cp doesn't suffer from unsigned poisoning, so already has type char *. - no cast of cp2 arg in sprintf() call. Such a cast can only break the warning. It is unclear if %s format can handle args of type unsigned char *. Even if the behaviour is defined, then I think it ends up converting unsigned char to char via a type pun. The string concatenation can be done even more easily and correctly using strcat(), but style(9) says to use printf() instead of special methods and that is a good rule for sprintf() too. Bruce From owner-svn-src-head@freebsd.org Thu Jul 11 15:05:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8FE415D5F1A for ; Thu, 11 Jul 2019 15:05:14 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-vs1-xe41.google.com (mail-vs1-xe41.google.com [IPv6:2607:f8b0:4864:20::e41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 7740983251 for ; Thu, 11 Jul 2019 15:05:14 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-vs1-xe41.google.com with SMTP id u3so4412321vsh.6 for ; Thu, 11 Jul 2019 08:05:14 -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:user-agent; bh=QDsqdGOsdtsjbY16Uppg0T6oGBbyELyB94B16o7HVUk=; b=UpGtA/U4IzVa1NxBWbsIq+edC1eGFb2i2k2BgmU5ODVp9bPI8GN0Z1g63iiSBkQCGB l1MAcXbtyHStWJIvnw29TVgFdiBA+TsHoPyZJTgmO/pnxj8aQQ27MD+/WA/+SPcHBBzH m6aMIVLGTXGpccix/xOVcemCaUnSqMDB/FLUJCYYS8KO8IK+XXldp9APNW0/CvETnDxo xN51kKrGLtSP6J+WK1xa+9pz/cQ6Sdp1Z4PCWsHLbAZcGCsFDCkxlRoyKsYMScL3e+FV mjfZ5kd5rJPeg7sXGANTToeaOLY9FB3Y5y6zLjkn3SrBgTBehwfuIQB0+NkVUthwHfPE zt1Q== 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:user-agent; bh=QDsqdGOsdtsjbY16Uppg0T6oGBbyELyB94B16o7HVUk=; b=hWx59Xf1hKyRedQuHVHcPB4Pa+JDjOtps7tPg+E0w47WlD40KykavU6Tgm0vH5JmRQ MZfiEugwBebcIJhKZU7vytHu7nhWuD8VQP3w/6ahoqbRZny7/pqXT03+P/sy8PmAtouF CtdsYLgo3F447ET2oGiGgVb76lBgbl3gw4HWhkQriFqrefsEiyBSUCsl03E4IvhDDVlR 5wT+tcQsOwzms/5/H/3Glup7T8qGInEk4PkdJNIcSrZ7crWcCoqWYDhHM/LvYzIrime+ MU8GSJlsq/IvNoV/mFipUQeKgL0DFi6MBjclWv1xwAiPVf3TR4hJa+WRHdvZyHqiaLy8 B25w== X-Gm-Message-State: APjAAAVZVOI+/JLqW21CY4qHO2FV1YC3Msq50cxp3zS3sJM3YvFDCKzY bmKmI31cxocs/q2Bb8R6EdshCQ== X-Google-Smtp-Source: APXvYqxcFgHfCfAskJoeb651WV2fqJ2nV0DXcTNLOpHCSLNnDskxQ3v3quUjoFcuyIl2cd8JRgFk5w== X-Received: by 2002:a67:d410:: with SMTP id c16mr5197251vsj.61.1562857513852; Thu, 11 Jul 2019 08:05:13 -0700 (PDT) Received: from mutt-hbsd ([63.88.83.108]) by smtp.gmail.com with ESMTPSA id d134sm1409319vsc.26.2019.07.11.08.05.12 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 11 Jul 2019 08:05:13 -0700 (PDT) Date: Thu, 11 Jul 2019 11:05:12 -0400 From: Shawn Webb To: Enji Cooper Cc: Philip Paeps , svn-src-head@freebsd.org, svn-src-all , src-committers Subject: Re: svn commit: r349896 - head/contrib/telnet/telnet Message-ID: <20190711150512.usrjdmg4fcoobshr@mutt-hbsd> References: <201907102236.x6AMaFLI067550@repo.freebsd.org> <6031EBD8-84D7-46D4-A3E5-D78427D084B1@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qakgcoku6qo52req" Content-Disposition: inline In-Reply-To: <6031EBD8-84D7-46D4-A3E5-D78427D084B1@gmail.com> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA User-Agent: NeoMutt/20180716 X-Rspamd-Queue-Id: 7740983251 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 15:05:15 -0000 --qakgcoku6qo52req Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 11, 2019 at 01:02:15AM -0700, Enji Cooper wrote: >=20 > > On Jul 10, 2019, at 3:36 PM, Philip Paeps wrote: > >=20 > > Author: philip > > Date: Wed Jul 10 22:36:14 2019 > > New Revision: 349896 > > URL: https://svnweb.freebsd.org/changeset/base/349896 > >=20 > > Log: > > telnet: fix minor style violation > >=20 > > While here also fix a very unlikely NULL pointer dereference. > >=20 > > Submitted by: Shawn Webb > >=20 > > Modified: > > head/contrib/telnet/telnet/commands.c > >=20 > > Modified: head/contrib/telnet/telnet/commands.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 22:23:59 2019 (r34= 9895) > > +++ head/contrib/telnet/telnet/commands.c Wed Jul 10 22:36:14 2019 (r34= 9896) > > @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > >=20 > > +#include > > #include > > #include > > #include > > @@ -1654,11 +1655,13 @@ env_init(void) > > || (strncmp((char *)ep->value, "unix:", 5) =3D=3D 0))) { > > char hbuf[256+1]; > > char *cp2 =3D strchr((char *)ep->value, ':'); > > + size_t buflen; > >=20 > > gethostname(hbuf, sizeof(hbuf)); > > hbuf[sizeof(hbuf)-1] =3D '\0'; > > - unsigned int buflen =3D strlen(hbuf) + strlen(cp2) + 1; > > + buflen =3D strlen(hbuf) + strlen(cp2) + 1; > > cp =3D (char *)malloc(sizeof(char)*buflen); > > + assert(cp !=3D NULL); >=20 > This will unfortunately still segfault if assert is compiled out of the s= ystem as a no-op (-DNDEBUG). >=20 > I genuinely think using asprintf instead is the way to go, as Eitan and W= arner brought up, since it reduces complexity in the program. https://gist.github.com/d49121a3e9a14b93868360edf32673f1 Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 --qakgcoku6qo52req Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl0nUCIACgkQ/y5nonf4 4fpJ7w/+NrzKkVZS9+LTrSIKC2EfdLI9eRmxMgejmz4zEkOH89CZszNeL8dGHrjV yd6STzisox8agg/EH/cYVVFSfHRmxS9mwZUzVOh3/kkcLj4cZ5KYnNWVJXrim7Zk vMAmrxway/X/XftwnVNFrFUAdSagfO9z7N6o+wy4npiAlam8llpNPF57REZs+Ymm xvp/LC0qJa5tOdQFUTe7MtUDlZcYGAaxb6w2tU2h8t86fI33jvLCe/NVrnKja2In d0Ej7x/bD07i9hBRB9iOLL8EHuH3RosLItSXwijaK0tChs2V9cxVc+G5mGBKf8OB 9XDqgugxh3dDek3UBjjua/7ZTk8GTz9W/Duc4G1Irp8oTbxYmHL0kJUZJS8P+DVZ pwB0vgebpiU13BLFVQv5G6LiychvpPV/acgnO1pkuQBlHSibyEP7vDS1icUKRAbN CldN8Svi/PnLQf+tPoOqOVSgwpeQRdtfBQi4i/cLbtQTSbMOjGBkUq8Tu4xy3707 falDgksqLZw/N5RqhdI3mH9u+7/TjCeqaClY1shFKmgnH1/wbdp6IDc29UZvyhHT IH2gma0Eiiz/ADr+oy+eoixHp/P4rOddYkd6DUyTJ6OE9l9R0qFNNWXwAExs4giE lws7yvW1y9XWf0y2jHLBToWKKryv3jHZ+Z6touYOqcbzyGEjkJk= =MU7h -----END PGP SIGNATURE----- --qakgcoku6qo52req-- From owner-svn-src-head@freebsd.org Thu Jul 11 15:30:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 800B415D668A; Thu, 11 Jul 2019 15:30:32 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id CA505841E5; Thu, 11 Jul 2019 15:30:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 2DEBE3606C7; Fri, 12 Jul 2019 01:30:27 +1000 (AEST) Date: Fri, 12 Jul 2019 01:30:25 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Enji Cooper cc: Philip Paeps , src-committers , svn-src-all , svn-src-head@freebsd.org Subject: Re: svn commit: r349896 - head/contrib/telnet/telnet In-Reply-To: <6031EBD8-84D7-46D4-A3E5-D78427D084B1@gmail.com> Message-ID: <20190712004934.Y1991@besplex.bde.org> References: <201907102236.x6AMaFLI067550@repo.freebsd.org> <6031EBD8-84D7-46D4-A3E5-D78427D084B1@gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=P6RKvmIu c=1 sm=1 tr=0 cx=a_idp_d a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=h6Ce3YiGc5IcDynMt-8A:9 a=wO83ShaMlpQIR83E:21 a=xOYv55zVvwvZlDf4:21 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-Rspamd-Queue-Id: CA505841E5 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 15:30:32 -0000 On Thu, 11 Jul 2019, Enji Cooper wrote: >> On Jul 10, 2019, at 3:36 PM, Philip Paeps wrote: >> >> Author: philip >> Date: Wed Jul 10 22:36:14 2019 >> New Revision: 349896 >> URL: https://svnweb.freebsd.org/changeset/base/349896 >> >> Log: >> telnet: fix minor style violation >> >> While here also fix a very unlikely NULL pointer dereference. I see no fix here. >> Modified: head/contrib/telnet/telnet/commands.c >> ============================================================================== >> --- head/contrib/telnet/telnet/commands.c Wed Jul 10 22:23:59 2019 (r349895) >> +++ head/contrib/telnet/telnet/commands.c Wed Jul 10 22:36:14 2019 (r349896) >> @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> >> +#include >> #include >> #include >> #include >> @@ -1654,11 +1655,13 @@ env_init(void) >> || (strncmp((char *)ep->value, "unix:", 5) == 0))) { >> char hbuf[256+1]; >> char *cp2 = strchr((char *)ep->value, ':'); >> + size_t buflen; This adds a different type of style bug (indentation via spaces instead of tabs). >> >> gethostname(hbuf, sizeof(hbuf)); >> hbuf[sizeof(hbuf)-1] = '\0'; >> - unsigned int buflen = strlen(hbuf) + strlen(cp2) + 1; >> + buflen = strlen(hbuf) + strlen(cp2) + 1; >> cp = (char *)malloc(sizeof(char)*buflen); >> + assert(cp != NULL); > > This will unfortunately still segfault if assert is compiled out of the system as a no-op (-DNDEBUG). telnet is unlikely to be compiled with -DNDEBUG, since it didn't use assert() before and this commit doesn't change its Makefile to control its new use of assert(). Any it doesn't fix the error either. On must arches, it turns a nice restartable null pointer trap into an unrestartable abort(). The program crashes in both cases. > I genuinely think using asprintf instead is the way to go, as Eitan and Warner brought up, since it reduces complexity in the program. asprintf() is only slightly easier to use. You still have to check if it succeeded, and free the storage that it allocates. It increases the complexity of the program compared with static allocation and strcat(). Example of a simple method: char buf[MAXHOSTNAMELEN + 256]; ... cp2 = ...; /* * Must bound cp2's length if we are paranoid, since cp2 * is in the environment. Use 256 for the bound, for * simple portable allocation above (don't use unportable * alloca() or newfangled VLAs to try to support much * larger sizes. Since we are paranoid, we are reluctant * to even allocate 1-byte buffers as local variables. */ if (strlen(cp2) > 256) abort(); /* sloppy, like assert() ... */ /* * Although MAXHOSTNAMELEN is undocumented, we assume that * it equals the documented {HOST_NAME_MAX} + 1 elsewhere * so may as well assume this here. We trust gethostname() * to work as documented and nul-terminate what it returns * provided it succeeds and the buffer is large enough. */ if (gethostname(buf, MAXHOSTNAMELEN) != 0) abort(); /* sloppy, but better than nothing */ #ifdef TRUE_PARANOID buf[MAXHOSTNAMELEN] = '\0'; assert(strlen(buf) < MAXHOSTNAMELEN); #endif /* The buffer is large enough, by construction. */ strcat(buf, cp2); The above is much more readable without any comments or error checking. I can't quite make it fail nicely with null pointer traps then: buf = alloca(MAXHOSTNAMELEN + strlen(cp2)); gethostname(buf, MAXHOSTNAMELEN); strcat(buf, cp2); Using alloca() is better than a VLA, since it its possible in principle for it to fail and return a null pointer giving a nice trap. Using asprintf(): /* Minor unportabilities, as above: */ char hbuf[MAXHOSTNAMELEN]; /* * Only needs error checking if TRUE_PARANOID, as above * (might be better to order the initialization so as to * use out global hostname variable): */ gethostname(hbuf, MAXHOSTNAMELEN); /* Remove cp2 above; expression for cp2 moved here: */ asprintf(&buf, "%s%s", buf, strchr((char *)ep->value, ':')); if (buf == NULL) abort(); /* sloppy, like assert() ... */ ... free(buf); /* more messes to free it */ xasprintfa() (asprintf() to an alloca()ed buffer with internal abort() of the allocation is impossible) would be most convenient here. Bruce From owner-svn-src-head@freebsd.org Thu Jul 11 15:37:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FFAB15D6B24; Thu, 11 Jul 2019 15:37:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D9CF78475A; Thu, 11 Jul 2019 15:36:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B0DA78E3; Thu, 11 Jul 2019 15:36:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BFaxwW093299; Thu, 11 Jul 2019 15:36:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BFaxCX093298; Thu, 11 Jul 2019 15:36:59 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907111536.x6BFaxCX093298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 11 Jul 2019 15:36:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349910 - head/sys/arm64/include X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/arm64/include X-SVN-Commit-Revision: 349910 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D9CF78475A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 15:37:00 -0000 Author: markj Date: Thu Jul 11 15:36:59 2019 New Revision: 349910 URL: https://svnweb.freebsd.org/changeset/base/349910 Log: Fix some ISS bit definitions for data aborts. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/include/armreg.h Modified: head/sys/arm64/include/armreg.h ============================================================================== --- head/sys/arm64/include/armreg.h Thu Jul 11 06:22:15 2019 (r349909) +++ head/sys/arm64/include/armreg.h Thu Jul 11 15:36:59 2019 (r349910) @@ -91,10 +91,10 @@ #define ISS_DATA_SF (0x01 << 15) #define ISS_DATA_AR (0x01 << 14) #define ISS_DATA_FnV (0x01 << 10) -#define ISS_DATa_EA (0x01 << 9) -#define ISS_DATa_CM (0x01 << 8) -#define ISS_INSN_S1PTW (0x01 << 7) -#define ISS_DATa_WnR (0x01 << 6) +#define ISS_DATA_EA (0x01 << 9) +#define ISS_DATA_CM (0x01 << 8) +#define ISS_DATA_S1PTW (0x01 << 7) +#define ISS_DATA_WnR (0x01 << 6) #define ISS_DATA_DFSC_MASK (0x3f << 0) #define ISS_DATA_DFSC_ASF_L0 (0x00 << 0) #define ISS_DATA_DFSC_ASF_L1 (0x01 << 0) From owner-svn-src-head@freebsd.org Thu Jul 11 15:43:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AB0815D6F74 for ; Thu, 11 Jul 2019 15:43:51 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-vs1-xe43.google.com (mail-vs1-xe43.google.com [IPv6:2607:f8b0:4864:20::e43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 BD90184E63 for ; Thu, 11 Jul 2019 15:43:50 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-vs1-xe43.google.com with SMTP id h28so4521218vsl.12 for ; Thu, 11 Jul 2019 08:43:50 -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:user-agent; bh=bsVkA+MXjLWNwM1jvGg2JecalO0cc3ZNjBjRRAMgihM=; b=MXJv/uXACmIsNo9zMGF4+DvnLjKe16uSB2OIN4AXLBMso0wSxURKy/Pg6a8JCJ95/r RflOCfeUOI9qyzoWAJvrZsxKZo04uFI/u+tOBoAYJz1NDYq0pf2nHjO+5//tjYfAr3ef uwt5VnkJt+GIu78+W1t2FMw6BOWKBVRpQZf50hfHlnrySnTQ36AdhR5jhUHNx7SSNRTo 796rE5aD9subf9BlD9xP/AQg16lnCCAhxW0KXaVJn6uuG2AAgx9pwOYvtfg4vf0wWUFD VMYqxmO5T0AWOurgsdKwJOJDP/fSmtkhDpaB/hPgD/aRDNahEmrhmuxUurG0qEuolJPL DC+w== 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:user-agent; bh=bsVkA+MXjLWNwM1jvGg2JecalO0cc3ZNjBjRRAMgihM=; b=A6YKtr9h4+zgkM4vAi+YlNQkUHW94HmrdPq33VRdb4l02TxGVdfXuYHWoX2mnihyu6 aPZd16uH6oRbH5fcvQXWQW1LM243HfVStr/TKV+T/uo5MYq2EnVzUfpCEVm8OKo6rfaY +EdZetyjYHve4FzvnjxHylkrrLRglJ+16dVnS8G78V+/vUlEShPStBU/NnufbZdMauom XT8HvEoxjlh+wIvnF77GXXiFY5QAjxXZ6JPcFxTURZmNdtaW9SIxqy1S4fZqOX7w5v3A 2Uc0Rf1BetAuo8759Vj8fPPO/e5PDcydVtQDUBFtiKYXcz1iTJqSb05O935/gOrMPQxa 5iYw== X-Gm-Message-State: APjAAAXrqd2vBYarZvR+Hr35k9axD4m2xBHzld4xU1UoslBTP9JU6sXZ hsazNpjcDp9lqFk5YpI25zfj1A== X-Google-Smtp-Source: APXvYqzDZf7vJ2I5q7eOgY04+qmhM5TlvXqOc4S0PeKHDC/4iANf/2ohkZIRx7cN1JDwqTcF5AGsIg== X-Received: by 2002:a67:1e44:: with SMTP id e65mr5379085vse.45.1562859830168; Thu, 11 Jul 2019 08:43:50 -0700 (PDT) Received: from mutt-hbsd ([63.88.83.108]) by smtp.gmail.com with ESMTPSA id s67sm2990340vkb.30.2019.07.11.08.43.49 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 11 Jul 2019 08:43:49 -0700 (PDT) Date: Thu, 11 Jul 2019 11:43:48 -0400 From: Shawn Webb To: Bruce Evans Cc: Enji Cooper , svn-src-head@freebsd.org, svn-src-all , src-committers , Philip Paeps Subject: Re: svn commit: r349896 - head/contrib/telnet/telnet Message-ID: <20190711154348.oss6ec5ysgfsiln4@mutt-hbsd> References: <201907102236.x6AMaFLI067550@repo.freebsd.org> <6031EBD8-84D7-46D4-A3E5-D78427D084B1@gmail.com> <20190712004934.Y1991@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bjd2hj7ltmlg53jw" Content-Disposition: inline In-Reply-To: <20190712004934.Y1991@besplex.bde.org> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA User-Agent: NeoMutt/20180716 X-Rspamd-Queue-Id: BD90184E63 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.995,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 15:43:51 -0000 --bjd2hj7ltmlg53jw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 12, 2019 at 01:30:25AM +1000, Bruce Evans wrote: > On Thu, 11 Jul 2019, Enji Cooper wrote: >=20 > > > On Jul 10, 2019, at 3:36 PM, Philip Paeps wrote: > > >=20 > > > Author: philip > > > Date: Wed Jul 10 22:36:14 2019 > > > New Revision: 349896 > > > URL: https://svnweb.freebsd.org/changeset/base/349896 > > >=20 > > > Log: > > > telnet: fix minor style violation > > >=20 > > > While here also fix a very unlikely NULL pointer dereference. >=20 > I see no fix here. >=20 > > > Modified: head/contrib/telnet/telnet/commands.c > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 22:23:59 2019 (r= 349895) > > > +++ head/contrib/telnet/telnet/commands.c Wed Jul 10 22:36:14 2019 (r= 349896) > > > @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); > > > #include > > > #include > > >=20 > > > +#include > > > #include > > > #include > > > #include > > > @@ -1654,11 +1655,13 @@ env_init(void) > > > || (strncmp((char *)ep->value, "unix:", 5) =3D=3D 0))) { > > > char hbuf[256+1]; > > > char *cp2 =3D strchr((char *)ep->value, ':'); > > > + size_t buflen; >=20 > This adds a different type of style bug (indentation via spaces instead of > tabs). >=20 > > >=20 > > > gethostname(hbuf, sizeof(hbuf)); > > > hbuf[sizeof(hbuf)-1] =3D '\0'; > > > - unsigned int buflen =3D strlen(hbuf) + strlen(cp2) += 1; > > > + buflen =3D strlen(hbuf) + strlen(cp2) + 1; > > > cp =3D (char *)malloc(sizeof(char)*buflen); > > > + assert(cp !=3D NULL); > >=20 > > This will unfortunately still segfault if assert is compiled out of the= system as a no-op (-DNDEBUG). >=20 > telnet is unlikely to be compiled with -DNDEBUG, since it didn't use asse= rt() > before and this commit doesn't change its Makefile to control its new use > of assert(). >=20 > Any it doesn't fix the error either. On must arches, it turns a nice > restartable null pointer trap into an unrestartable abort(). The program > crashes in both cases. We're getting into theory, since this particular bug isn't vulnerable to this particular issue I'm about to bring up, but it is possible to map at NULL on FreeBSD, given a sysctl has been explicitly toggled by an administrative user. I've found it's best to adhere to good defensive programming techniques, even in cases where doing so may not make immediate sense. Future developers, even the code's original author(s), may be grateful later as they make changes. Thus, even if this particular potential NULL pointer dereference isn't exploitable in any meaningful way, adherence to defensive programming practices will help both now and later. One thing I love about FreeBSD is how it strives to deliver high quality, correct code. It seems strange that more characters have been written in emails about the lack of asprintf usage than it would've taken to actually write the patch to fix it. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 --bjd2hj7ltmlg53jw Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl0nWS8ACgkQ/y5nonf4 4foCHxAAhWZrDCMz2kCTfUsZkJ9640CThBYZOcNu4kVo3wQdjei1P/YgEL1s+Ge+ rkNlRDrq+BoID1z4iEtXAAP3T9RPX0RDb/rJh1z0HsXQwVT2gQt1ClBVoJSnir5e 138uDOckI2L8as6HMEFkqfexFIfcXj2gmTKl6WEEHJcs/tpuwu5myZ3+G8LWbjed 0igr3CF4PoUrTMlguAvr0FU9V1QYO+HN49BZTjtY2/tmAc03/q05hUxU8tZSPp/P k3bY6r1agRlUOW/vax+iIE2QQYPeeqDeHSan+tX1hLvTEJBEesf2QBIZItskDDHV uMRPUQZLnqNXIeoenzXt5mrnDhr7OqgFubkAWIC0LTL5EGpBqttQ+9/sjjGUGbZP j0x98pQRf8yZkOEt1ffP/scYNL9vn8anf6UqBV5XFuDV2KZQrpYSilnW49JjNZ7S vDNUiCGjk7IcFgRXr07qhqzkkEH+lYJxcmJB9FfyYAug3gm62tjpAP+FyzO1qBT0 JZ9C0TcnacXBn5nxG3gjkwQo8qISWlq/3YGnCrVqMYfVJ0Qqrz/DvV4NhN+a2hzv S4awe1aEKYzY6DYsUuDMfXiWe5tPFswAFFwgnEsZqhy0GpohG/UQmLyA5pKs+f8e stYcZkfWXbNXEB0LR1y/B6kbjDfpMhDnNwo4tJ9IpSFsVuvmNak= =lax/ -----END PGP SIGNATURE----- --bjd2hj7ltmlg53jw-- From owner-svn-src-head@freebsd.org Thu Jul 11 16:19:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02D3715D80A3; Thu, 11 Jul 2019 16:19:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9F8F3865D6; Thu, 11 Jul 2019 16:19:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7BCC3FB7; Thu, 11 Jul 2019 16:19:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BGJX8X014178; Thu, 11 Jul 2019 16:19:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BGJXtc014177; Thu, 11 Jul 2019 16:19:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201907111619.x6BGJXtc014177@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 11 Jul 2019 16:19:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349912 - head/lib/libthr/thread X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libthr/thread X-SVN-Commit-Revision: 349912 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9F8F3865D6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 16:19:34 -0000 Author: kib Date: Thu Jul 11 16:19:33 2019 New Revision: 349912 URL: https://svnweb.freebsd.org/changeset/base/349912 Log: Restore ability to pass NULL name argument to pthread_set_name_np(3) to clear the thread name. PR: 239142 Submitted by: Lewis Donzis MFC after: 3 days Modified: head/lib/libthr/thread/thr_info.c Modified: head/lib/libthr/thread/thr_info.c ============================================================================== --- head/lib/libthr/thread/thr_info.c Thu Jul 11 15:38:40 2019 (r349911) +++ head/lib/libthr/thread/thr_info.c Thu Jul 11 16:19:33 2019 (r349912) @@ -52,7 +52,7 @@ thr_set_name_np(struct pthread *thread, const char *na { free(thread->name); - thread->name = strdup(name); + thread->name = name != NULL ? strdup(name) : NULL; } /* Set the thread name for debug. */ From owner-svn-src-head@freebsd.org Thu Jul 11 16:22:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D29A015D844A; Thu, 11 Jul 2019 16:22:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7555586C10; Thu, 11 Jul 2019 16:22:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48A36115C; Thu, 11 Jul 2019 16:22:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BGMofW019247; Thu, 11 Jul 2019 16:22:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BGMoZ3019246; Thu, 11 Jul 2019 16:22:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201907111622.x6BGMoZ3019246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 11 Jul 2019 16:22:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349913 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 349913 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7555586C10 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 16:22:51 -0000 Author: kib Date: Thu Jul 11 16:22:49 2019 New Revision: 349913 URL: https://svnweb.freebsd.org/changeset/base/349913 Log: Ensure that mds_handler always points to a valid method. Depending on system configuration, version, and architecture, mds_handler might be dereferenced from doreti before hw_mds_recalculate_boot() initialized it. Statically assign void method to cover all cases. Reported by: "Schuendehuette, Matthias (LDA IT PLM)" Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/x86/x86/cpu_machdep.c Modified: head/sys/x86/x86/cpu_machdep.c ============================================================================== --- head/sys/x86/x86/cpu_machdep.c Thu Jul 11 16:19:33 2019 (r349912) +++ head/sys/x86/x86/cpu_machdep.c Thu Jul 11 16:22:49 2019 (r349913) @@ -939,7 +939,6 @@ int hw_mds_disable; * architectural state except possibly %rflags. Also, it is always * called with interrupts disabled. */ -void (*mds_handler)(void); void mds_handler_void(void); void mds_handler_verw(void); void mds_handler_ivb(void); @@ -948,6 +947,7 @@ void mds_handler_skl_sse(void); void mds_handler_skl_avx(void); void mds_handler_skl_avx512(void); void mds_handler_silvermont(void); +void (*mds_handler)(void) = mds_handler_void; static int sysctl_hw_mds_disable_state_handler(SYSCTL_HANDLER_ARGS) From owner-svn-src-head@freebsd.org Thu Jul 11 17:35:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D346315D9990; Thu, 11 Jul 2019 17:35:20 +0000 (UTC) (envelope-from jhb@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7696E8977A; Thu, 11 Jul 2019 17:35:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id BF3311891F; Thu, 11 Jul 2019 17:35:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r349893 - in head/sys: modules/tcp/rack netinet netinet/tcp_stacks sys To: Randall Stewart Cc: Randall Ray Stewart , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201907102040.x6AKeern006731@repo.freebsd.org> <4cdc824e-7e71-731d-50d4-c3f6231f9858@FreeBSD.org> <7695E2FC-406D-46CE-88F2-0690B9AAA36D@netflix.com> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Thu, 11 Jul 2019 10:35:18 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <7695E2FC-406D-46CE-88F2-0690B9AAA36D@netflix.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7696E8977A X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.92 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.92)[-0.915,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 17:35:21 -0000 On 7/10/19 9:48 PM, Randall Stewart wrote: > John: > > Thanks for the suggestions.. I have committed changes to the two > nits. As to M_PROTO1, I see that in the NF world we have removed > M_PROTO12 and moved the M_PROTO’s up 1 i.e. M_PROTO1 == 0x2000 > > So for now it is safe, since the M_TSTMP_LRO is not yet used.. but in > my up and coming commits I will have to address this i.e. either do > the same thing or just make it use M_PROTO12. > > There are a couple of places M_PROTO1 is used on the receive path > so that would not work there :o > > After I get the DSACK fixes in my next change to get BBR in will > be the LRO work… > > So maybe I should just settle on using M_PROTO12 for that > what do you think? If M_PROTO12 isn't used in the tree, then the approach we've used in the past is to bump up the M_PROTO values by one as in the NF tree. -- John Baldwin From owner-svn-src-head@freebsd.org Thu Jul 11 19:07:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C095A15DB772; Thu, 11 Jul 2019 19:07:46 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 614078CFDC; Thu, 11 Jul 2019 19:07:46 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 351152F9B; Thu, 11 Jul 2019 19:07:46 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BJ7kff002651; Thu, 11 Jul 2019 19:07:46 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BJ7jG8002650; Thu, 11 Jul 2019 19:07:45 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907111907.x6BJ7jG8002650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Thu, 11 Jul 2019 19:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349914 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349914 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 614078CFDC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 19:07:47 -0000 Author: seanc (ports committer) Date: Thu Jul 11 19:07:45 2019 New Revision: 349914 URL: https://svnweb.freebsd.org/changeset/base/349914 Log: usr.sbin/bhyve: free resources if there is an initialization error in rfb Coverity CID: 1357335 Approved by: markj, jhb Differential Revision: https://reviews.freebsd.org/D20919 Modified: head/usr.sbin/bhyve/pci_fbuf.c head/usr.sbin/bhyve/rfb.c Modified: head/usr.sbin/bhyve/pci_fbuf.c ============================================================================== --- head/usr.sbin/bhyve/pci_fbuf.c Thu Jul 11 16:22:49 2019 (r349913) +++ head/usr.sbin/bhyve/pci_fbuf.c Thu Jul 11 19:07:45 2019 (r349914) @@ -231,9 +231,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o ret = 0; uopts = strdup(opts); - for (xopts = strtok(uopts, ","); - xopts != NULL; - xopts = strtok(NULL, ",")) { + while ((xopts = strsep(&uopts, ",")) != NULL) { if (strcmp(xopts, "wait") == 0) { sc->rfb_wait = 1; continue; @@ -260,7 +258,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o if (config) { if (tmpstr[0] == '[') tmpstr++; - sc->rfb_host = tmpstr; + sc->rfb_host = strdup(tmpstr); if (config[0] == ':') config++; else { @@ -276,7 +274,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o sc->rfb_port = atoi(tmpstr); else { sc->rfb_port = atoi(config); - sc->rfb_host = tmpstr; + sc->rfb_host = strdup(tmpstr); } } } else if (!strcmp(xopts, "vga")) { @@ -310,7 +308,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o } else if (sc->memregs.height == 0) sc->memregs.height = 1080; } else if (!strcmp(xopts, "password")) { - sc->rfb_password = config; + sc->rfb_password = strdup(config); } else { pci_fbuf_usage(xopts); ret = -1; @@ -319,6 +317,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o } done: + free(uopts); return (ret); } Modified: head/usr.sbin/bhyve/rfb.c ============================================================================== --- head/usr.sbin/bhyve/rfb.c Thu Jul 11 16:22:49 2019 (r349913) +++ head/usr.sbin/bhyve/rfb.c Thu Jul 11 19:07:45 2019 (r349914) @@ -969,7 +969,7 @@ rfb_init(char *hostname, int port, int wait, char *pas int e; char servname[6]; struct rfb_softc *rc; - struct addrinfo *ai; + struct addrinfo *ai = NULL; struct addrinfo hints; int on = 1; #ifndef WITHOUT_CAPSICUM @@ -984,6 +984,7 @@ rfb_init(char *hostname, int port, int wait, char *pas sizeof(uint32_t)); rc->crc_width = RFB_MAX_WIDTH; rc->crc_height = RFB_MAX_HEIGHT; + rc->sfd = -1; rc->password = password; @@ -1003,28 +1004,25 @@ rfb_init(char *hostname, int port, int wait, char *pas if ((e = getaddrinfo(hostname, servname, &hints, &ai)) != 0) { fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(e)); - return(-1); + goto error; } rc->sfd = socket(ai->ai_family, ai->ai_socktype, 0); if (rc->sfd < 0) { perror("socket"); - freeaddrinfo(ai); - return (-1); + goto error; } setsockopt(rc->sfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); if (bind(rc->sfd, ai->ai_addr, ai->ai_addrlen) < 0) { perror("bind"); - freeaddrinfo(ai); - return (-1); + goto error; } if (listen(rc->sfd, 1) < 0) { perror("listen"); - freeaddrinfo(ai); - return (-1); + goto error; } #ifndef WITHOUT_CAPSICUM @@ -1053,4 +1051,14 @@ rfb_init(char *hostname, int port, int wait, char *pas freeaddrinfo(ai); return (0); + + error: + if (ai != NULL) + freeaddrinfo(ai); + if (rc->sfd != -1) + close(rc->sfd); + free(rc->crc); + free(rc->crc_tmp); + free(rc); + return (-1); } From owner-svn-src-head@freebsd.org Thu Jul 11 19:26:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C3F815DC002; Thu, 11 Jul 2019 19:26:36 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0DD648DC89; Thu, 11 Jul 2019 19:26:36 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D164D3366; Thu, 11 Jul 2019 19:26:35 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BJQZ2Z012737; Thu, 11 Jul 2019 19:26:35 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BJQZca012736; Thu, 11 Jul 2019 19:26:35 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907111926.x6BJQZca012736@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Thu, 11 Jul 2019 19:26:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349915 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349915 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0DD648DC89 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.937,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 19:26:36 -0000 Author: seanc (ports committer) Date: Thu Jul 11 19:26:35 2019 New Revision: 349915 URL: https://svnweb.freebsd.org/changeset/base/349915 Log: usr.sbin/bhyve: initialize return value in xhci device interrupt handler Coverity CID: 1357340 Approved by: scottl, markj Differential Revision: https://reviews.freebsd.org/D20917 Modified: head/usr.sbin/bhyve/pci_xhci.c Modified: head/usr.sbin/bhyve/pci_xhci.c ============================================================================== --- head/usr.sbin/bhyve/pci_xhci.c Thu Jul 11 19:07:45 2019 (r349914) +++ head/usr.sbin/bhyve/pci_xhci.c Thu Jul 11 19:26:35 2019 (r349915) @@ -2544,7 +2544,7 @@ pci_xhci_dev_intr(struct usb_hci *hci, int epctx) struct pci_xhci_softc *sc; struct pci_xhci_portregs *p; struct xhci_endp_ctx *ep_ctx; - int error; + int error = 0; int dir_in; int epid; From owner-svn-src-head@freebsd.org Thu Jul 11 19:36:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE81115DC306; Thu, 11 Jul 2019 19:36:15 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 84F8B8E262; Thu, 11 Jul 2019 19:36:15 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C3EE36E8; Thu, 11 Jul 2019 19:36:15 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BJaFLF018086; Thu, 11 Jul 2019 19:36:15 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BJaFCl018085; Thu, 11 Jul 2019 19:36:15 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907111936.x6BJaFCl018085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 11 Jul 2019 19:36:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349916 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349916 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 84F8B8E262 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.937,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 19:36:16 -0000 Author: cy Date: Thu Jul 11 19:36:14 2019 New Revision: 349916 URL: https://svnweb.freebsd.org/changeset/base/349916 Log: Correct r349898. The default is add a rule. MFC after: 1 week X-MFC with: r349898 Modified: head/sys/contrib/ipfilter/netinet/fil.c Modified: head/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/fil.c Thu Jul 11 19:26:35 2019 (r349915) +++ head/sys/contrib/ipfilter/netinet/fil.c Thu Jul 11 19:36:14 2019 (r349916) @@ -4473,11 +4473,10 @@ frrequest(softc, unit, req, data, set, makecopy) caddr_t data; { int error = 0, in, family, need_free = 0; - enum { OP_UNDEF, /* undefined */ - OP_ADD, /* add rule */ - OP_REM, /* remove rule */ - OP_ZERO /* zero statistics and counters */ } - addrem = OP_UNDEF; + enum { OP_ADD, /* add rule */ + OP_REM, /* remove rule */ + OP_ZERO /* zero statistics and counters */ } + addrem = OP_ADD; frentry_t frd, *fp, *f, **fprev, **ftail; void *ptr, *uptr, *cptr; u_int *p, *pp; @@ -4583,7 +4582,7 @@ frrequest(softc, unit, req, data, set, makecopy) goto donenolock; } - if (addrem == OP_UNDEF) { + if (addrem == OP_ADD) { error = ipf_funcinit(softc, fp); if (error != 0) goto donenolock; @@ -4647,7 +4646,7 @@ frrequest(softc, unit, req, data, set, makecopy) * them to be created if they don't already exit. */ group = FR_NAME(fp, fr_group); - if (addrem == OP_UNDEF) { + if (addrem == OP_ADD) { fg = ipf_group_add(softc, group, NULL, fp->fr_flags, unit, set); fp->fr_grp = fg; @@ -5111,7 +5110,7 @@ frrequest(softc, unit, req, data, set, makecopy) if (fp->fr_next != NULL) fp->fr_next->fr_pnext = &fp->fr_next; *ftail = fp; - if (addrem == OP_UNDEF) + if (addrem == OP_ADD) ipf_fixskip(ftail, fp, 1); fp->fr_icmpgrp = NULL; From owner-svn-src-head@freebsd.org Thu Jul 11 19:36:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32DD015DC344; Thu, 11 Jul 2019 19:36:19 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C84C48E26D; Thu, 11 Jul 2019 19:36:18 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 977F736E9; Thu, 11 Jul 2019 19:36:18 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BJaIZI018134; Thu, 11 Jul 2019 19:36:18 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BJaIPU018133; Thu, 11 Jul 2019 19:36:18 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907111936.x6BJaIPU018133@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 11 Jul 2019 19:36:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349917 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349917 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C84C48E26D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.937,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 19:36:19 -0000 Author: cy Date: Thu Jul 11 19:36:18 2019 New Revision: 349917 URL: https://svnweb.freebsd.org/changeset/base/349917 Log: Remove a tautological test for adding a rule in the block that adds rules. MFC after: 1 week Modified: head/sys/contrib/ipfilter/netinet/fil.c Modified: head/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/fil.c Thu Jul 11 19:36:14 2019 (r349916) +++ head/sys/contrib/ipfilter/netinet/fil.c Thu Jul 11 19:36:18 2019 (r349917) @@ -5110,8 +5110,7 @@ frrequest(softc, unit, req, data, set, makecopy) if (fp->fr_next != NULL) fp->fr_next->fr_pnext = &fp->fr_next; *ftail = fp; - if (addrem == OP_ADD) - ipf_fixskip(ftail, fp, 1); + ipf_fixskip(ftail, fp, 1); fp->fr_icmpgrp = NULL; if (fp->fr_icmphead != -1) { From owner-svn-src-head@freebsd.org Thu Jul 11 19:41:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8A2615DC530; Thu, 11 Jul 2019 19:41:15 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8A43A8E6A7; Thu, 11 Jul 2019 19:41:15 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5ED0C3724; Thu, 11 Jul 2019 19:41:15 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BJfFK0019092; Thu, 11 Jul 2019 19:41:15 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BJfFpA019091; Thu, 11 Jul 2019 19:41:15 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907111941.x6BJfFpA019091@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Thu, 11 Jul 2019 19:41:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349918 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349918 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8A43A8E6A7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.937,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 19:41:16 -0000 Author: seanc (ports committer) Date: Thu Jul 11 19:41:14 2019 New Revision: 349918 URL: https://svnweb.freebsd.org/changeset/base/349918 Log: usr.sbin/bhyve: free leaked memory during option parsing Also update to use strsep(3) instead of strtok(3). Most of this commit inadvertently ended up in r349914. Coverity CID: 1357337 Approved by: markj PR: 233038 Differential Revision: https://reviews.freebsd.org/D20918 Modified: head/usr.sbin/bhyve/pci_fbuf.c Modified: head/usr.sbin/bhyve/pci_fbuf.c ============================================================================== --- head/usr.sbin/bhyve/pci_fbuf.c Thu Jul 11 19:36:18 2019 (r349917) +++ head/usr.sbin/bhyve/pci_fbuf.c Thu Jul 11 19:41:14 2019 (r349918) @@ -317,7 +317,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o } done: - free(uopts); + free(uoptsbak); return (ret); } From owner-svn-src-head@freebsd.org Thu Jul 11 19:51:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C09415DC9A6; Thu, 11 Jul 2019 19:51:34 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2CF1E8ED95; Thu, 11 Jul 2019 19:51:34 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 070B23AB5; Thu, 11 Jul 2019 19:51:34 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BJpXU7025908; Thu, 11 Jul 2019 19:51:33 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BJpXFu025907; Thu, 11 Jul 2019 19:51:33 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907111951.x6BJpXFu025907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Thu, 11 Jul 2019 19:51:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349919 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349919 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2CF1E8ED95 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.937,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 19:51:34 -0000 Author: seanc (ports committer) Date: Thu Jul 11 19:51:33 2019 New Revision: 349919 URL: https://svnweb.freebsd.org/changeset/base/349919 Log: usr.sbin/bhyve: commit miss from r349918 Submitted by: markj Approved by: markj Differential Revision: https://reviews.freebsd.org/D20918 Modified: head/usr.sbin/bhyve/pci_fbuf.c Modified: head/usr.sbin/bhyve/pci_fbuf.c ============================================================================== --- head/usr.sbin/bhyve/pci_fbuf.c Thu Jul 11 19:41:14 2019 (r349918) +++ head/usr.sbin/bhyve/pci_fbuf.c Thu Jul 11 19:51:33 2019 (r349919) @@ -225,12 +225,12 @@ pci_fbuf_read(struct vmctx *ctx, int vcpu, struct pci_ static int pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *opts) { - char *uopts, *xopts, *config; + char *uopts, *uoptsbak, *xopts, *config; char *tmpstr; int ret; ret = 0; - uopts = strdup(opts); + uoptsbak = uopts = strdup(opts); while ((xopts = strsep(&uopts, ",")) != NULL) { if (strcmp(xopts, "wait") == 0) { sc->rfb_wait = 1; From owner-svn-src-head@freebsd.org Thu Jul 11 20:52:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3422215DDBA5; Thu, 11 Jul 2019 20:52:40 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CCC596A917; Thu, 11 Jul 2019 20:52:39 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C11645B9; Thu, 11 Jul 2019 20:52:39 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BKqdUD059193; Thu, 11 Jul 2019 20:52:39 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BKqdFX059192; Thu, 11 Jul 2019 20:52:39 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201907112052.x6BKqdFX059192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Thu, 11 Jul 2019 20:52:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349923 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 349923 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CCC596A917 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 20:52:40 -0000 Author: dougm Date: Thu Jul 11 20:52:39 2019 New Revision: 349923 URL: https://svnweb.freebsd.org/changeset/base/349923 Log: Address problems in blist_alloc introduced in r349777. The swap block allocator could become corrupted if a retry to allocate swap space, after a larger allocation attempt failed, allocated a smaller set of free blocks that ended on a 32- or 64-block boundary. Add tests to detect this kind of failure-to-extend-at-boundary and prevent the associated accounting screwup. Reported by: pho Tested by: pho Reviewed by: alc Approved by: markj (mentor) Discussed with: kib Differential Revision: https://reviews.freebsd.org/D20893 Modified: head/sys/kern/subr_blist.c Modified: head/sys/kern/subr_blist.c ============================================================================== --- head/sys/kern/subr_blist.c Thu Jul 11 20:29:50 2019 (r349922) +++ head/sys/kern/subr_blist.c Thu Jul 11 20:52:39 2019 (r349923) @@ -639,15 +639,27 @@ blst_next_leaf_alloc(blmeta_t *scan, daddr_t start, in * bitpos() returns zero here. */ avail = blk - start + bitpos(~scan->bm_bitmap); - if (avail < count) { + if (avail < count || avail == 0) { /* * There isn't a next leaf with enough free - * blocks at its beginning to complete the - * spanning allocation. + * blocks at its beginning to bother + * allocating. */ return (avail); } maxcount = imin(avail, maxcount); + if (maxcount % BLIST_BMAP_RADIX == 0) { + /* + * There was no next leaf. Back scan up to + * last leaf. + */ + --scan; + while (radix != BLIST_BMAP_RADIX) { + radix /= BLIST_META_RADIX; + --scan; + } + blk -= BLIST_BMAP_RADIX; + } } } From owner-svn-src-head@freebsd.org Thu Jul 11 22:07:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA26815DF33B; Thu, 11 Jul 2019 22:07:00 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6D0256D4E4; Thu, 11 Jul 2019 22:07:00 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C4C95190; Thu, 11 Jul 2019 22:07:00 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BM70wa095494; Thu, 11 Jul 2019 22:07:00 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BM6xrI095488; Thu, 11 Jul 2019 22:06:59 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201907112206.x6BM6xrI095488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Thu, 11 Jul 2019 22:06:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349924 - in head/lib/libsecureboot: . openpgp X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in head/lib/libsecureboot: . openpgp X-SVN-Commit-Revision: 349924 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6D0256D4E4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 22:07:01 -0000 Author: sjg Date: Thu Jul 11 22:06:59 2019 New Revision: 349924 URL: https://svnweb.freebsd.org/changeset/base/349924 Log: libsecureboot: avoid recusion in ve_trust_init set our guard value immediately. also replace call to ve_trust_init in opgp_sig.c:initialize with call to openpgp_trust_init. Reported by: mindal@semihalf.com Reviewed by: jhibbits obrien MFC after: 1 week Modified: head/lib/libsecureboot/openpgp/opgp_sig.c head/lib/libsecureboot/vets.c Modified: head/lib/libsecureboot/openpgp/opgp_sig.c ============================================================================== --- head/lib/libsecureboot/openpgp/opgp_sig.c Thu Jul 11 20:52:39 2019 (r349923) +++ head/lib/libsecureboot/openpgp/opgp_sig.c Thu Jul 11 22:06:59 2019 (r349924) @@ -67,9 +67,7 @@ __FBSDID("$FreeBSD$"); void initialize (void) { -#ifdef _STANDALONE - ve_trust_init(); -#endif + openpgp_trust_init(); } #else Modified: head/lib/libsecureboot/vets.c ============================================================================== --- head/lib/libsecureboot/vets.c Thu Jul 11 20:52:39 2019 (r349923) +++ head/lib/libsecureboot/vets.c Thu Jul 11 22:06:59 2019 (r349924) @@ -345,7 +345,7 @@ ve_trust_init(void) if (once >= 0) return (once); - + once = 0; /* to be sure */ ve_utc_set(time(NULL)); #ifdef BUILD_UTC ve_utc_set(BUILD_UTC); /* just in case */ From owner-svn-src-head@freebsd.org Thu Jul 11 23:54:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4545815E14E6; Thu, 11 Jul 2019 23:54:51 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CD7B3715E0; Thu, 11 Jul 2019 23:54:50 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A83636468; Thu, 11 Jul 2019 23:54:50 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BNsoLc051471; Thu, 11 Jul 2019 23:54:50 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BNsoNP051470; Thu, 11 Jul 2019 23:54:50 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907112354.x6BNsoNP051470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Thu, 11 Jul 2019 23:54:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349925 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349925 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CD7B3715E0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 23:54:51 -0000 Author: seanc (ports committer) Date: Thu Jul 11 23:54:50 2019 New Revision: 349925 URL: https://svnweb.freebsd.org/changeset/base/349925 Log: usr.sbin/bhyve: send an initialized value to wake up blocking kqueue This is a no-op initialization because nothing reads this value. "This wasn't wrong previously, but this is more correct now." -imp Coverity CID: 1194307 Approved by: markj, imp, scottl Differential Revision: https://reviews.freebsd.org/D20921 Modified: head/usr.sbin/bhyve/mevent.c Modified: head/usr.sbin/bhyve/mevent.c ============================================================================== --- head/usr.sbin/bhyve/mevent.c Thu Jul 11 22:06:59 2019 (r349924) +++ head/usr.sbin/bhyve/mevent.c Thu Jul 11 23:54:50 2019 (r349925) @@ -119,7 +119,7 @@ mevent_pipe_read(int fd, enum ev_type type, void *para static void mevent_notify(void) { - char c; + char c = '\0'; /* * If calling from outside the i/o thread, write a byte on the From owner-svn-src-head@freebsd.org Fri Jul 12 00:54:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78C4715E2869; Fri, 12 Jul 2019 00:54:21 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1AC4A738BF; Fri, 12 Jul 2019 00:54:21 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E4636E98; Fri, 12 Jul 2019 00:54:21 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C0sKmB082458; Fri, 12 Jul 2019 00:54:20 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C0sK8F082457; Fri, 12 Jul 2019 00:54:20 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201907120054.x6C0sK8F082457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 12 Jul 2019 00:54:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349928 - in head/stand: efi/libefi libsa X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/stand: efi/libefi libsa X-SVN-Commit-Revision: 349928 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1AC4A738BF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.929,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 00:54:21 -0000 Author: jhibbits Date: Fri Jul 12 00:54:20 2019 New Revision: 349928 URL: https://svnweb.freebsd.org/changeset/base/349928 Log: Allow efi loader to get network params from uboot Summary: efi loader does not work with static network parameters. It always uses BOOTP/DHCP and also uses RARP as a fallback. Problems with DHCP servers can cause the loader to fail to populate network parameters. Submitted by: Siddharth Tuli Reviewed by: imp Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D20811 Modified: head/stand/efi/libefi/efinet.c head/stand/libsa/net.h Modified: head/stand/efi/libefi/efinet.c ============================================================================== --- head/stand/efi/libefi/efinet.c Fri Jul 12 00:50:33 2019 (r349927) +++ head/stand/efi/libefi/efinet.c Fri Jul 12 00:54:20 2019 (r349928) @@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "dev_net.h" + static EFI_GUID sn_guid = EFI_SIMPLE_NETWORK_PROTOCOL; static void efinet_end(struct netif *); @@ -198,7 +200,75 @@ efinet_get(struct iodesc *desc, void **pkt, time_t tim return (ret); } +/* + * Loader uses BOOTP/DHCP and also uses RARP as a fallback to populate + * network parameters and problems with DHCP servers can cause the loader + * to fail to populate them. Allow the device to ask about the basic + * network parameters and if present use them. + */ static void +efi_env_net_params(struct iodesc *desc) +{ + char *envstr; + in_addr_t ipaddr, mask, gwaddr, serveraddr; + n_long rootaddr; + + if ((envstr = getenv("rootpath")) != NULL) + strlcpy(rootpath, envstr, sizeof(rootpath)); + + /* + * Get network parameters. + */ + envstr = getenv("ipaddr"); + ipaddr = (envstr != NULL) ? inet_addr(envstr) : 0; + + envstr = getenv("netmask"); + mask = (envstr != NULL) ? inet_addr(envstr) : 0; + + envstr = getenv("gatewayip"); + gwaddr = (envstr != NULL) ? inet_addr(envstr) : 0; + + envstr = getenv("serverip"); + serveraddr = (envstr != NULL) ? inet_addr(envstr) : 0; + + /* No network params. */ + if (ipaddr == 0 && mask == 0 && gwaddr == 0 && serveraddr == 0) + return; + + /* Partial network params. */ + if (ipaddr == 0 || mask == 0 || gwaddr == 0 || serveraddr == 0) { + printf("Incomplete network settings from U-Boot\n"); + return; + } + + /* + * Set network parameters. + */ + myip.s_addr = ipaddr; + netmask = mask; + gateip.s_addr = gwaddr; + servip.s_addr = serveraddr; + + /* + * There must be a rootpath. It may be ip:/path or it may be just the + * path in which case the ip needs to be serverip. + */ + rootaddr = net_parse_rootpath(); + if (rootaddr == INADDR_NONE) + rootaddr = serveraddr; + rootip.s_addr = rootaddr; + +#ifdef EFINET_DEBUG + printf("%s: ip=%s\n", __func__, inet_ntoa(myip)); + printf("%s: mask=%s\n", __func__, intoa(netmask)); + printf("%s: gateway=%s\n", __func__, inet_ntoa(gateip)); + printf("%s: server=%s\n", __func__, inet_ntoa(servip)); +#endif + + desc->myip = myip; +} + +static void efinet_init(struct iodesc *desc, void *machdep_hint) { struct netif *nif = desc->io_netif; @@ -206,6 +276,9 @@ efinet_init(struct iodesc *desc, void *machdep_hint) EFI_HANDLE h; EFI_STATUS status; UINT32 mask; + + /* Attempt to get netboot params from env */ + efi_env_net_params(desc); if (nif->nif_driver->netif_ifs[nif->nif_unit].dif_unit < 0) { printf("Invalid network interface %d\n", nif->nif_unit); Modified: head/stand/libsa/net.h ============================================================================== --- head/stand/libsa/net.h Fri Jul 12 00:50:33 2019 (r349927) +++ head/stand/libsa/net.h Fri Jul 12 00:54:20 2019 (r349928) @@ -91,6 +91,7 @@ extern struct in_addr rootip; extern struct in_addr swapip; extern struct in_addr gateip; extern struct in_addr nameip; +extern struct in_addr servip; extern n_long netmask; extern u_int intf_mtu; From owner-svn-src-head@freebsd.org Fri Jul 12 01:59:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4108015E397D; Fri, 12 Jul 2019 01:59:10 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D729B75BA3; Fri, 12 Jul 2019 01:59:09 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1DFB78CA; Fri, 12 Jul 2019 01:59:09 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C1x9ee013301; Fri, 12 Jul 2019 01:59:09 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C1x9go013298; Fri, 12 Jul 2019 01:59:09 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907120159.x6C1x9go013298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 12 Jul 2019 01:59:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349929 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349929 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D729B75BA3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.929,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 01:59:10 -0000 Author: cy Date: Fri Jul 12 01:59:08 2019 New Revision: 349929 URL: https://svnweb.freebsd.org/changeset/base/349929 Log: Move the new ipf_pcksum6() function from ip_fil_freebsd.c to fil.c. The reason for this is that ipftest(8), which still works on FreeBSD-11, fails to link to it, breaking stable/11 builds. ipftest(8) was broken (segfault) sometime during the FreeBSD-12 cycle. glebius@ suggested we disable building it until I can get around to fixing it. Hence this was not caught in -current. The intention is to fix ipftest(8) as it is used by the netbsd-tests (imported by ngie@ many moons ago) for regression testing. MFC after: immediately Modified: head/sys/contrib/ipfilter/netinet/fil.c head/sys/contrib/ipfilter/netinet/ip_fil.h head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Modified: head/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/fil.c Fri Jul 12 00:54:20 2019 (r349928) +++ head/sys/contrib/ipfilter/netinet/fil.c Fri Jul 12 01:59:08 2019 (r349929) @@ -179,6 +179,10 @@ static int ipf_updateipid __P((fr_info_t *)); static int ipf_settimeout __P((struct ipf_main_softc_s *, struct ipftuneable *, ipftuneval_t *)); +#ifdef USE_INET6 +static u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, + u_int32_t, u_int32_t)); +#endif #if !defined(_KERNEL) || SOLARIS static int ppsratecheck(struct timeval *, int *, int); #endif @@ -10226,4 +10230,55 @@ ipf_inet6_mask_del(bits, mask, mtab) mtab->imt6_max--; ASSERT(mtab->imt6_max >= 0); } + +#ifdef _KERNEL +static u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ + struct mbuf *m; + int sum; + + m = fin->fin_m; + if (m->m_len < sizeof(struct ip6_hdr)) { + return 0xffff; + } + + sum = in6_cksum(m, ip6->ip6_nxt, off, len); + return(sum); +} +#else +static u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ + u_short *sp; + u_int sum; + + sp = (u_short *)&ip6->ip6_src; + sum = *sp++; /* ip6_src */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; /* ip6_dst */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + return(ipf_pcksum(fin, off, sum)); +} +#endif #endif Modified: head/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil.h Fri Jul 12 00:54:20 2019 (r349928) +++ head/sys/contrib/ipfilter/netinet/ip_fil.h Fri Jul 12 01:59:08 2019 (r349929) @@ -1835,10 +1835,6 @@ extern int ipf_matchicmpqueryreply __P((int, icmpinfo struct icmp *, int)); extern u_32_t ipf_newisn __P((fr_info_t *)); extern u_int ipf_pcksum __P((fr_info_t *, int, u_int)); -#ifdef USE_INET6 -extern u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, - u_int32_t, u_int32_t)); -#endif extern void ipf_rule_expire __P((ipf_main_softc_t *)); extern int ipf_scanlist __P((fr_info_t *, u_32_t)); extern frentry_t *ipf_srcgrpmap __P((fr_info_t *, u_32_t *)); Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Jul 12 00:54:20 2019 (r349928) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Jul 12 01:59:08 2019 (r349929) @@ -1446,56 +1446,3 @@ ipf_pcksum(fin, hlen, sum) sum2 = ~sum & 0xffff; return sum2; } - -#ifdef USE_INET6 -#ifdef _KERNEL -u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ - struct mbuf *m; - int sum; - - m = fin->fin_m; - if (m->m_len < sizeof(struct ip6_hdr)) { - return 0xffff; - } - - sum = in6_cksum(m, ip6->ip6_nxt, off, len); - return(sum); -} -#else -u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ - u_short *sp; - u_int sum; - - sp = (u_short *)&ip6->ip6_src; - sum = *sp++; /* ip6_src */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; /* ip6_dst */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - return(ipf_pcksum(fin, off, sum)); -} -#endif -#endif From owner-svn-src-head@freebsd.org Fri Jul 12 04:44:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45D8015E61DD; Fri, 12 Jul 2019 04:44:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D006C834E7; Fri, 12 Jul 2019 04:44:50 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99A0895A7; Fri, 12 Jul 2019 04:44:50 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C4iojD002038; Fri, 12 Jul 2019 04:44:50 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C4ioil002037; Fri, 12 Jul 2019 04:44:50 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907120444.x6C4ioil002037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 12 Jul 2019 04:44:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349933 - head/rescue/rescue X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/rescue/rescue X-SVN-Commit-Revision: 349933 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D006C834E7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 04:44:51 -0000 Author: imp Date: Fri Jul 12 04:44:50 2019 New Revision: 349933 URL: https://svnweb.freebsd.org/changeset/base/349933 Log: Remove unused defines since r147075 When the OpenBSD dhclient was brought in 14 years ago, we stopped supporting building a reduced sized dhclient, yet retained the options here. Also, the OpenBSD dhclient doesn't need lint defined, so it can go too. Modified: head/rescue/rescue/Makefile Modified: head/rescue/rescue/Makefile ============================================================================== --- head/rescue/rescue/Makefile Fri Jul 12 02:15:06 2019 (r349932) +++ head/rescue/rescue/Makefile Fri Jul 12 04:44:50 2019 (r349933) @@ -172,7 +172,6 @@ CRUNCH_ALIAS_shutdown= poweroff # dhclient has historically been troublesome... CRUNCH_PROGS_sbin+= dhclient -CRUNCH_BUILDOPTS_dhclient= -DRELEASE_CRUNCH -Dlint ################################################################## # Programs from stock /usr/bin From owner-svn-src-head@freebsd.org Fri Jul 12 05:19:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFD2215E67E9; Fri, 12 Jul 2019 05:19:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A4EA842A0; Fri, 12 Jul 2019 05:19:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 441DF9AC3; Fri, 12 Jul 2019 05:19:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C5J7U8017485; Fri, 12 Jul 2019 05:19:07 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C5J7va017484; Fri, 12 Jul 2019 05:19:07 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907120519.x6C5J7va017484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 12 Jul 2019 05:19:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349934 - head/usr.bin/cpio X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/usr.bin/cpio X-SVN-Commit-Revision: 349934 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6A4EA842A0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 05:19:08 -0000 Author: imp Date: Fri Jul 12 05:19:06 2019 New Revision: 349934 URL: https://svnweb.freebsd.org/changeset/base/349934 Log: There is no SMALLER define anymore here Stop defining SMALLER. Since we replaced cpio with libarchive version, there's no options to make it smaller. Also, the comment about the FreeBSD installer is obsolete. Remove them both. Modified: head/usr.bin/cpio/Makefile Modified: head/usr.bin/cpio/Makefile ============================================================================== --- head/usr.bin/cpio/Makefile Fri Jul 12 04:44:50 2019 (r349933) +++ head/usr.bin/cpio/Makefile Fri Jul 12 05:19:06 2019 (r349934) @@ -18,11 +18,6 @@ CFLAGS+= -DBSDCPIO_VERSION_STRING=\"${BSDCPIO_VERSION_ CFLAGS+= -DPLATFORM_CONFIG_H=\"${_LIBARCHIVECONFDIR}/config_freebsd.h\" CFLAGS+= -I${_LIBARCHIVEDIR}/cpio -I${_LIBARCHIVEDIR}/libarchive_fe -.ifdef RELEASE_CRUNCH -# FreeBSD's installer uses cpio in crunched binaries that are -# statically linked, cannot use -lcrypto, and are size sensitive. -CFLAGS+= -DSMALLER -.endif LIBADD= archive .if ${MK_ICONV} != "no" From owner-svn-src-head@freebsd.org Fri Jul 12 05:19:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CF6815E6818; Fri, 12 Jul 2019 05:19:38 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E960843B3; Fri, 12 Jul 2019 05:19:38 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E74049AC4; Fri, 12 Jul 2019 05:19:37 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C5JbiI017555; Fri, 12 Jul 2019 05:19:37 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C5JbFS017554; Fri, 12 Jul 2019 05:19:37 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907120519.x6C5JbFS017554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Fri, 12 Jul 2019 05:19:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349935 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349935 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1E960843B3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 05:19:38 -0000 Author: seanc (ports committer) Date: Fri Jul 12 05:19:37 2019 New Revision: 349935 URL: https://svnweb.freebsd.org/changeset/base/349935 Log: usr.sbin/bhyve: free resources when erroring out of pci_vtnet_init() Coverity CID: 1402978 Approved by: vmaffione Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D20912 Modified: head/usr.sbin/bhyve/pci_virtio_net.c Modified: head/usr.sbin/bhyve/pci_virtio_net.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_net.c Fri Jul 12 05:19:06 2019 (r349934) +++ head/usr.sbin/bhyve/pci_virtio_net.c Fri Jul 12 05:19:37 2019 (r349935) @@ -411,6 +411,7 @@ pci_vtnet_init(struct vmctx *ctx, struct pci_devinst * err = net_parsemac(vtopts, sc->vsc_config.mac); if (err != 0) { free(devname); + free(sc); return (err); } mac_provided = 1; @@ -419,8 +420,10 @@ pci_vtnet_init(struct vmctx *ctx, struct pci_devinst * err = netbe_init(&sc->vsc_be, devname, pci_vtnet_rx_callback, sc); free(devname); - if (err) + if (err) { + free(sc); return (err); + } sc->vsc_consts.vc_hv_caps |= netbe_get_cap(sc->vsc_be); } @@ -442,8 +445,10 @@ pci_vtnet_init(struct vmctx *ctx, struct pci_devinst * sc->vsc_vs.vs_mtx = &sc->vsc_mtx; /* use BAR 1 to map MSI-X table and PBA, if we're using MSI-X */ - if (vi_intr_init(&sc->vsc_vs, 1, fbsdrun_virtio_msix())) + if (vi_intr_init(&sc->vsc_vs, 1, fbsdrun_virtio_msix())) { + free(sc); return (1); + } /* use BAR 0 to map config regs in IO space */ vi_set_io_bar(&sc->vsc_vs, 0); From owner-svn-src-head@freebsd.org Fri Jul 12 05:35:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB3D915E6D8B; Fri, 12 Jul 2019 05:35:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 747A284EF2; Fri, 12 Jul 2019 05:35:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 41B5D9E38; Fri, 12 Jul 2019 05:35:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C5Zks2032023; Fri, 12 Jul 2019 05:35:46 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C5ZjXT032022; Fri, 12 Jul 2019 05:35:45 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907120535.x6C5ZjXT032022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 12 Jul 2019 05:35:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349936 - head/sbin/camcontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/camcontrol X-SVN-Commit-Revision: 349936 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 747A284EF2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.946,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 05:35:47 -0000 Author: imp Date: Fri Jul 12 05:35:45 2019 New Revision: 349936 URL: https://svnweb.freebsd.org/changeset/base/349936 Log: Retire support for -DMINIMALISTIC We've not used this in years since we retired sysinstall, and it hasn't compiled in at least a year. A full camcontrol is only 180k, so making it smaller is not as important as it once was. OK'd by: ken@, scottl@ Modified: head/sbin/camcontrol/Makefile head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/Makefile ============================================================================== --- head/sbin/camcontrol/Makefile Fri Jul 12 05:19:37 2019 (r349935) +++ head/sbin/camcontrol/Makefile Fri Jul 12 05:35:45 2019 (r349936) @@ -5,11 +5,7 @@ PACKAGE=runtime PROG= camcontrol SRCS= camcontrol.c util.c -.if !defined(RELEASE_CRUNCH) SRCS+= attrib.c epc.c fwdownload.c modeedit.c persist.c progress.c timestamp.c zone.c -.else -CFLAGS+= -DMINIMALISTIC -.endif .if ${MK_NVME} != "no" .PATH: ${SRCTOP}/sbin/nvmecontrol CFLAGS+= -I${SRCTOP}/sbin/nvmecontrol -DWITH_NVME Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Fri Jul 12 05:19:37 2019 (r349935) +++ head/sbin/camcontrol/camcontrol.c Fri Jul 12 05:35:45 2019 (r349936) @@ -46,10 +46,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifndef MINIMALISTIC #include #include -#endif #include #include @@ -153,7 +151,6 @@ struct camcontrol_opts { const char *subopt; }; -#ifndef MINIMALISTIC struct ata_res_pass16 { u_int16_t reserved[5]; u_int8_t flags; @@ -192,10 +189,8 @@ static const char smprg_opts[] = "l"; static const char smppc_opts[] = "a:A:d:lm:M:o:p:s:S:T:"; static const char smpphylist_opts[] = "lq"; static char pwd_opt; -#endif static struct camcontrol_opts option_table[] = { -#ifndef MINIMALISTIC {"tur", CAM_CMD_TUR, CAM_ARG_NONE, NULL}, {"inquiry", CAM_CMD_INQUIRY, CAM_ARG_NONE, "DSR"}, {"identify", CAM_CMD_IDENTIFY, CAM_ARG_NONE, NULL}, @@ -206,10 +201,8 @@ static struct camcontrol_opts option_table[] = { {"reportluns", CAM_CMD_REPORTLUNS, CAM_ARG_NONE, "clr:"}, {"readcapacity", CAM_CMD_READCAP, CAM_ARG_NONE, "bhHlNqs"}, {"reprobe", CAM_CMD_REPROBE, CAM_ARG_NONE, NULL}, -#endif /* MINIMALISTIC */ {"rescan", CAM_CMD_RESCAN, CAM_ARG_NONE, NULL}, {"reset", CAM_CMD_RESET, CAM_ARG_NONE, NULL}, -#ifndef MINIMALISTIC {"cmd", CAM_CMD_SCSI_CMD, CAM_ARG_NONE, scsicmd_opts}, {"mmcsdcmd", CAM_CMD_MMCSD_CMD, CAM_ARG_NONE, "c:a:f:Wb:l:41S:I"}, {"command", CAM_CMD_SCSI_CMD, CAM_ARG_NONE, scsicmd_opts}, @@ -223,9 +216,7 @@ static struct camcontrol_opts option_table[] = { {"smpmaninfo", CAM_CMD_SMP_MANINFO, CAM_ARG_NONE, "l"}, {"defects", CAM_CMD_READ_DEFECTS, CAM_ARG_NONE, readdefect_opts}, {"defectlist", CAM_CMD_READ_DEFECTS, CAM_ARG_NONE, readdefect_opts}, -#endif /* MINIMALISTIC */ {"devlist", CAM_CMD_DEVTREE, CAM_ARG_NONE, "-b"}, -#ifndef MINIMALISTIC {"periphlist", CAM_CMD_DEVLIST, CAM_ARG_NONE, NULL}, {"modepage", CAM_CMD_MODE_PAGE, CAM_ARG_NONE, "bdelm:P:"}, {"tags", CAM_CMD_TAG, CAM_ARG_NONE, "N:q"}, @@ -249,7 +240,6 @@ static struct camcontrol_opts option_table[] = { {"zone", CAM_CMD_ZONE, CAM_ARG_NONE, "ac:l:No:P:"}, {"epc", CAM_CMD_EPC, CAM_ARG_NONE, "c:dDeHp:Pr:sS:T:"}, {"timestamp", CAM_CMD_TIMESTAMP, CAM_ARG_NONE, "f:mrsUT:"}, -#endif /* MINIMALISTIC */ {"help", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, {"-?", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, {"-h", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, @@ -276,9 +266,7 @@ static cam_argmask arglist; camcontrol_optret getoption(struct camcontrol_opts *table, char *arg, uint32_t *cmdnum, cam_argmask *argnum, const char **subopt); -#ifndef MINIMALISTIC static int getdevlist(struct cam_device *device); -#endif /* MINIMALISTIC */ static int getdevtree(int argc, char **argv, char *combinedopt); static int print_dev_scsi(struct device_match_result *dev_result, char *tmpstr); static int print_dev_ata(struct device_match_result *dev_result, char *tmpstr); @@ -288,7 +276,6 @@ static int print_dev_mmcsd(struct device_match_result #ifdef WITH_NVME static int print_dev_nvme(struct device_match_result *dev_result, char *tmpstr); #endif -#ifndef MINIMALISTIC static int testunitready(struct cam_device *device, int task_attr, int retry_count, int timeout, int quiet); static int scsistart(struct cam_device *device, int startstop, int loadeject, @@ -297,14 +284,12 @@ static int scsiinquiry(struct cam_device *device, int int retry_count, int timeout); static int scsiserial(struct cam_device *device, int task_attr, int retry_count, int timeout); -#endif /* MINIMALISTIC */ static int parse_btl(char *tstr, path_id_t *bus, target_id_t *target, lun_id_t *lun, cam_argmask *arglst); static int dorescan_or_reset(int argc, char **argv, int rescan); static int rescan_or_reset_bus(path_id_t bus, int rescan); static int scanlun_or_reset_dev(path_id_t bus, target_id_t target, lun_id_t lun, int scan); -#ifndef MINIMALISTIC static int readdefects(struct cam_device *device, int argc, char **argv, char *combinedopt, int task_attr, int retry_count, int timeout); @@ -371,7 +356,6 @@ static int scsiopcodes(struct cam_device *device, int int timeout, int verbose); static int scsireprobe(struct cam_device *device); -#endif /* MINIMALISTIC */ #ifndef min #define min(a,b) (((a)<(b))?(a):(b)) #endif @@ -403,7 +387,6 @@ getoption(struct camcontrol_opts *table, char *arg, ui return (CC_OR_NOT_FOUND); } -#ifndef MINIMALISTIC static int getdevlist(struct cam_device *device) { @@ -462,7 +445,6 @@ getdevlist(struct cam_device *device) return (error); } -#endif /* MINIMALISTIC */ static int getdevtree(int argc, char **argv, char *combinedopt) @@ -835,7 +817,6 @@ print_dev_nvme(struct device_match_result *dev_result, } #endif -#ifndef MINIMALISTIC static int testunitready(struct cam_device *device, int task_attr, int retry_count, int timeout, int quiet) @@ -2424,10 +2405,8 @@ identify(struct cam_device *device, int retry_count, i #endif return (ataidentify(device, retry_count, timeout)); } -#endif /* MINIMALISTIC */ -#ifndef MINIMALISTIC enum { ATA_SECURITY_ACTION_PRINT, ATA_SECURITY_ACTION_FREEZE, @@ -3260,7 +3239,6 @@ atasecurity(struct cam_device *device, int retry_count return (error); } -#endif /* MINIMALISTIC */ /* * Parse out a bus, or a bus, target and lun in the following @@ -3708,7 +3686,6 @@ scanlun_or_reset_dev(path_id_t bus, target_id_t target } } -#ifndef MINIMALISTIC static struct scsi_nv defect_list_type_map[] = { { "block", SRDD10_BLOCK_FORMAT }, @@ -4284,7 +4261,6 @@ defect_bailout: return (error); } -#endif /* MINIMALISTIC */ #if 0 void @@ -4298,7 +4274,6 @@ reassignblocks(struct cam_device *device, u_int32_t *b } #endif -#ifndef MINIMALISTIC void mode_sense(struct cam_device *device, int dbd, int pc, int page, int subpage, int task_attr, int retry_count, int timeout, u_int8_t *data, @@ -9522,7 +9497,6 @@ bailout: return (retval); } -#endif /* MINIMALISTIC */ static int scsireprobe(struct cam_device *device) @@ -9566,7 +9540,6 @@ usage(int printlong) fprintf(printlong ? stdout : stderr, "usage: camcontrol [device id][generic args][command args]\n" " camcontrol devlist [-b] [-v]\n" -#ifndef MINIMALISTIC " camcontrol periphlist [dev_id][-n dev_name] [-u unit]\n" " camcontrol tur [dev_id][generic args]\n" " camcontrol inquiry [dev_id][generic args] [-D] [-S] [-R]\n" @@ -9579,10 +9552,8 @@ usage(int printlong) " camcontrol load [dev_id][generic args]\n" " camcontrol eject [dev_id][generic args]\n" " camcontrol reprobe [dev_id][generic args]\n" -#endif /* MINIMALISTIC */ " camcontrol rescan \n" " camcontrol reset \n" -#ifndef MINIMALISTIC " camcontrol defects [dev_id][generic args] <-f format> [-P][-G]\n" " [-q][-s][-S offset][-X]\n" " camcontrol modepage [dev_id][generic args] <-m page | -l>\n" @@ -9642,11 +9613,9 @@ usage(int printlong) " camcontrol timestamp [dev_id][generic_args] <-r [-f format|-m|-U]>|\n" " <-s <-f format -T time | -U >>\n" " \n" -#endif /* MINIMALISTIC */ " camcontrol help\n"); if (!printlong) return; -#ifndef MINIMALISTIC fprintf(stdout, "Specify one of the following options:\n" "devlist list all CAM devices\n" @@ -9892,7 +9861,6 @@ usage(int printlong) "-T time the time value passed into strptime(3)\n" "-U set the timestamp of the device to UTC time\n" ); -#endif /* MINIMALISTIC */ } int @@ -9911,11 +9879,9 @@ main(int argc, char **argv) int error = 0, optstart = 2; int task_attr = MSG_SIMPLE_Q_TAG; int devopen = 1; -#ifndef MINIMALISTIC path_id_t bus; target_id_t target; lun_id_t lun; -#endif /* MINIMALISTIC */ cmdlist = CAM_CMD_NONE; arglist = CAM_ARG_NONE; @@ -10003,7 +9969,6 @@ main(int argc, char **argv) || (cmdlist == CAM_CMD_DEBUG)) devopen = 0; -#ifndef MINIMALISTIC if ((devopen == 1) && (argc > 2 && argv[2][0] != '-')) { char name[30]; @@ -10031,7 +9996,6 @@ main(int argc, char **argv) optstart++; } } -#endif /* MINIMALISTIC */ /* * Start getopt processing at argv[2/3], since we've already * accepted argv[1..2] as the command name, and as a possible @@ -10117,7 +10081,6 @@ main(int argc, char **argv) } } -#ifndef MINIMALISTIC /* * For most commands we'll want to open the passthrough device * associated with the specified device. In the case of the rescan @@ -10138,7 +10101,6 @@ main(int argc, char **argv) == NULL) errx(1,"%s", cam_errbuf); } -#endif /* MINIMALISTIC */ /* * Reset optind to 2, and reset getopt, so these routines can parse @@ -10148,7 +10110,6 @@ main(int argc, char **argv) optreset = 1; switch(cmdlist) { -#ifndef MINIMALISTIC case CAM_CMD_DEVLIST: error = getdevlist(cam_dev); break; @@ -10156,11 +10117,9 @@ main(int argc, char **argv) error = atahpa(cam_dev, retry_count, timeout, argc, argv, combinedopt); break; -#endif /* MINIMALISTIC */ case CAM_CMD_DEVTREE: error = getdevtree(argc, argv, combinedopt); break; -#ifndef MINIMALISTIC case CAM_CMD_TUR: error = testunitready(cam_dev, task_attr, retry_count, timeout, 0); @@ -10177,14 +10136,12 @@ main(int argc, char **argv) arglist & CAM_ARG_EJECT, task_attr, retry_count, timeout); break; -#endif /* MINIMALISTIC */ case CAM_CMD_RESCAN: error = dorescan_or_reset(argc, argv, 1); break; case CAM_CMD_RESET: error = dorescan_or_reset(argc, argv, 0); break; -#ifndef MINIMALISTIC case CAM_CMD_READ_DEFECTS: error = readdefects(cam_dev, argc, argv, combinedopt, task_attr, retry_count, timeout); @@ -10307,7 +10264,6 @@ main(int argc, char **argv) task_attr, retry_count, timeout, arglist & CAM_ARG_VERBOSE); break; -#endif /* MINIMALISTIC */ case CAM_CMD_USAGE: usage(1); break; From owner-svn-src-head@freebsd.org Fri Jul 12 05:53:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6BBA015E722A; Fri, 12 Jul 2019 05:53:14 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0A84D8587E; Fri, 12 Jul 2019 05:53:14 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB375A1CE; Fri, 12 Jul 2019 05:53:13 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C5rDnv042067; Fri, 12 Jul 2019 05:53:13 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C5rDxE042066; Fri, 12 Jul 2019 05:53:13 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907120553.x6C5rDxE042066@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Fri, 12 Jul 2019 05:53:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349937 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349937 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0A84D8587E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 05:53:14 -0000 Author: seanc (ports committer) Date: Fri Jul 12 05:53:13 2019 New Revision: 349937 URL: https://svnweb.freebsd.org/changeset/base/349937 Log: usr.sbin/bhyve: unconditionally initialize the NVMe completion status Follow-up work to improve the handling of unsupported/invalid opcodes is being developed by chuck@. Coverity CID: 1398928 Reviewed by: chuck Approved by: araujo, imp Differential Revision: https://reviews.freebsd.org/D20914 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Fri Jul 12 05:35:45 2019 (r349936) +++ head/usr.sbin/bhyve/pci_nvme.c Fri Jul 12 05:53:13 2019 (r349937) @@ -978,6 +978,7 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u while (sqhead != atomic_load_acq_short(&sq->tail)) { cmd = &(sq->qbase)[sqhead]; + compl.cdw0 = 0; compl.status = 0; switch (cmd->opc) { From owner-svn-src-head@freebsd.org Fri Jul 12 06:19:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9362815E773A; Fri, 12 Jul 2019 06:19:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A84286597; Fri, 12 Jul 2019 06:19:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 14D1DA568; Fri, 12 Jul 2019 06:19:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C6JPIs052757; Fri, 12 Jul 2019 06:19:25 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C6JP2f052753; Fri, 12 Jul 2019 06:19:25 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907120619.x6C6JP2f052753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 12 Jul 2019 06:19:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349938 - head/usr.sbin/ppp X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/usr.sbin/ppp X-SVN-Commit-Revision: 349938 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3A84286597 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.967,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 06:19:26 -0000 Author: imp Date: Fri Jul 12 06:19:25 2019 New Revision: 349938 URL: https://svnweb.freebsd.org/changeset/base/349938 Log: Retire the -DRELEASE_CRUNCH define. The RELEASE_CRUNCH ifdefs save about 100 bytes of text space. The complexity is not worth it as they eliminate error messages. Left the RELEASE_CRUNCH ifdef to eliminate a lot of stuff in place. That saves an interesting amount of space and change some behaviors, so absent a more detailed analysis, maintain the status quo. Modified: head/usr.sbin/ppp/Makefile head/usr.sbin/ppp/bundle.c head/usr.sbin/ppp/physical.c Modified: head/usr.sbin/ppp/Makefile ============================================================================== --- head/usr.sbin/ppp/Makefile Fri Jul 12 05:53:13 2019 (r349937) +++ head/usr.sbin/ppp/Makefile Fri Jul 12 06:19:25 2019 (r349938) @@ -12,7 +12,6 @@ SRCS= acf.c arp.c async.c auth.c bundle.c cbcp.c ccp.c tcpmss.c throughput.c timer.c tty.c tun.c udp.c vjcomp.c WARNS?= 3 .if defined(RELEASE_CRUNCH) -CFLAGS+=-DRELEASE_CRUNCH PPP_NO_DES= PPP_NO_KLDLOAD= PPP_NO_NAT= Modified: head/usr.sbin/ppp/bundle.c ============================================================================== --- head/usr.sbin/ppp/bundle.c Fri Jul 12 05:53:13 2019 (r349937) +++ head/usr.sbin/ppp/bundle.c Fri Jul 12 06:19:25 2019 (r349938) @@ -678,12 +678,9 @@ bundle_LockTun(struct bundle *bundle) if (lockfile != NULL) { fprintf(lockfile, "%d\n", (int)getpid()); fclose(lockfile); - } -#ifndef RELEASE_CRUNCH - else + } else log_Printf(LogERROR, "Warning: Can't create %s: %s\n", pidfile, strerror(errno)); -#endif } static void Modified: head/usr.sbin/ppp/physical.c ============================================================================== --- head/usr.sbin/ppp/physical.c Fri Jul 12 05:53:13 2019 (r349937) +++ head/usr.sbin/ppp/physical.c Fri Jul 12 06:19:25 2019 (r349938) @@ -364,13 +364,9 @@ physical_Close(struct physical *p) if (*p->name.full == '/') { snprintf(fn, sizeof fn, "%s%s.if", _PATH_VARRUN, p->name.base); -#ifndef RELEASE_CRUNCH if (ID0unlink(fn) == -1) log_Printf(LogALERT, "%s: Can't remove %s: %s\n", p->link.name, fn, strerror(errno)); -#else - ID0unlink(fn); -#endif } physical_Unlock(p); if (p->handler && p->handler->destroy) @@ -978,12 +974,9 @@ physical_Found(struct physical *p) if (lockfile != NULL) { fprintf(lockfile, "%s%d\n", TUN_NAME, p->dl->bundle->unit); fclose(lockfile); - } -#ifndef RELEASE_CRUNCH - else + } else log_Printf(LogALERT, "%s: Can't create %s: %s\n", p->link.name, fn, strerror(errno)); -#endif } throughput_start(&p->link.stats.total, "physical throughput", From owner-svn-src-head@freebsd.org Fri Jul 12 09:02:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33CAC15EA67D; Fri, 12 Jul 2019 09:02:13 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C97968BB18; Fri, 12 Jul 2019 09:02:12 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3FD9C370; Fri, 12 Jul 2019 09:02:12 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C92Cw3038183; Fri, 12 Jul 2019 09:02:12 GMT (envelope-from phk@FreeBSD.org) Received: (from phk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C92CpB038182; Fri, 12 Jul 2019 09:02:12 GMT (envelope-from phk@FreeBSD.org) Message-Id: <201907120902.x6C92CpB038182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phk set sender to phk@FreeBSD.org using -f From: Poul-Henning Kamp Date: Fri, 12 Jul 2019 09:02:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349939 - head/sys/dev/usb/serial X-SVN-Group: head X-SVN-Commit-Author: phk X-SVN-Commit-Paths: head/sys/dev/usb/serial X-SVN-Commit-Revision: 349939 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C97968BB18 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 09:02:13 -0000 Author: phk Date: Fri Jul 12 09:02:12 2019 New Revision: 349939 URL: https://svnweb.freebsd.org/changeset/base/349939 Log: Support multiple serial ports per device. Enable this for the NovAtel OEMv2 GPS receiver. Not fixed: The receiver shows up as "" in the device tree, because that is literally what the descriptor-string is. Reviewed by: hselasky@ Modified: head/sys/dev/usb/serial/ugensa.c Modified: head/sys/dev/usb/serial/ugensa.c ============================================================================== --- head/sys/dev/usb/serial/ugensa.c Fri Jul 12 06:19:25 2019 (r349938) +++ head/sys/dev/usb/serial/ugensa.c Fri Jul 12 09:02:12 2019 (r349939) @@ -70,6 +70,7 @@ #define UGENSA_CONFIG_INDEX 0 #define UGENSA_IFACE_INDEX 0 #define UGENSA_IFACE_MAX 8 /* exclusivly */ +#define UGENSA_PORT_MAX 8 /* exclusivly */ enum { UGENSA_BULK_DT_WR, @@ -84,11 +85,11 @@ struct ugensa_sub_softc { struct ugensa_softc { struct ucom_super_softc sc_super_ucom; - struct ucom_softc sc_ucom[UGENSA_IFACE_MAX]; - struct ugensa_sub_softc sc_sub[UGENSA_IFACE_MAX]; + struct ucom_softc sc_ucom[UGENSA_PORT_MAX]; + struct ugensa_sub_softc sc_sub[UGENSA_PORT_MAX]; struct mtx sc_mtx; - uint8_t sc_niface; + uint8_t sc_nports; }; /* prototypes */ @@ -154,12 +155,13 @@ static driver_t ugensa_driver = { .size = sizeof(struct ugensa_softc), }; +/* Driver-info is max number of serial ports per interface */ static const STRUCT_USB_HOST_ID ugensa_devs[] = { - {USB_VPI(USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_PC5220, 0)}, - {USB_VPI(USB_VENDOR_CMOTECH, USB_PRODUCT_CMOTECH_CDMA_MODEM1, 0)}, - {USB_VPI(USB_VENDOR_KYOCERA2, USB_PRODUCT_KYOCERA2_CDMA_MSM_K, 0)}, - {USB_VPI(USB_VENDOR_HP, USB_PRODUCT_HP_49GPLUS, 0)}, - {USB_VPI(USB_VENDOR_NOVATEL2, USB_PRODUCT_NOVATEL2_FLEXPACKGPS, 0)}, + {USB_VPI(USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_PC5220, 1)}, + {USB_VPI(USB_VENDOR_CMOTECH, USB_PRODUCT_CMOTECH_CDMA_MODEM1, 1)}, + {USB_VPI(USB_VENDOR_KYOCERA2, USB_PRODUCT_KYOCERA2_CDMA_MSM_K, 1)}, + {USB_VPI(USB_VENDOR_HP, USB_PRODUCT_HP_49GPLUS, 1)}, + {USB_VPI(USB_VENDOR_NOVATEL2, USB_PRODUCT_NOVATEL2_FLEXPACKGPS, 3)}, }; DRIVER_MODULE(ugensa, uhub, ugensa_driver, ugensa_devclass, NULL, 0); @@ -192,65 +194,68 @@ ugensa_attach(device_t dev) struct ugensa_softc *sc = device_get_softc(dev); struct ugensa_sub_softc *ssc; struct usb_interface *iface; + struct usb_config xfer_config[UGENSA_N_TRANSFER]; int32_t error; uint8_t iface_index; - int x, cnt; + int x, maxports; + maxports = USB_GET_DRIVER_INFO(uaa); device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "ugensa", NULL, MTX_DEF); ucom_ref(&sc->sc_super_ucom); - /* Figure out how many interfaces this device has got */ - for (cnt = 0; cnt < UGENSA_IFACE_MAX; cnt++) { - if ((usbd_get_endpoint(uaa->device, cnt, ugensa_xfer_config + 0) == NULL) || - (usbd_get_endpoint(uaa->device, cnt, ugensa_xfer_config + 1) == NULL)) { - /* we have reached the end */ - break; - } - } + for (iface_index = UGENSA_IFACE_INDEX; iface_index < UGENSA_IFACE_MAX; iface_index++) { - if (cnt == 0) { - device_printf(dev, "No interfaces\n"); - goto detach; - } - for (x = 0; x < cnt; x++) { - iface = usbd_get_iface(uaa->device, x); - if (iface->idesc->bInterfaceClass != UICLASS_VENDOR) + iface = usbd_get_iface(uaa->device, iface_index); + if (iface == NULL || iface->idesc->bInterfaceClass != UICLASS_VENDOR) /* Not a serial port, most likely a SD reader */ continue; - ssc = sc->sc_sub + sc->sc_niface; - ssc->sc_ucom_ptr = sc->sc_ucom + sc->sc_niface; + /* Loop over all endpoints pairwise */ + for (x = 0; x < maxports && sc->sc_nports < UGENSA_PORT_MAX; x++) { - iface_index = (UGENSA_IFACE_INDEX + x); - error = usbd_transfer_setup(uaa->device, - &iface_index, ssc->sc_xfer, ugensa_xfer_config, - UGENSA_N_TRANSFER, ssc, &sc->sc_mtx); + ssc = sc->sc_sub + sc->sc_nports; + ssc->sc_ucom_ptr = sc->sc_ucom + sc->sc_nports; - if (error) { - device_printf(dev, "allocating USB " - "transfers failed\n"); - goto detach; - } - /* clear stall at first run */ - mtx_lock(&sc->sc_mtx); - usbd_xfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_WR]); - usbd_xfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_RD]); - mtx_unlock(&sc->sc_mtx); + memcpy(xfer_config, ugensa_xfer_config, sizeof ugensa_xfer_config); + xfer_config[UGENSA_BULK_DT_RD].ep_index = x; + xfer_config[UGENSA_BULK_DT_WR].ep_index = x; - /* initialize port number */ - ssc->sc_ucom_ptr->sc_portno = sc->sc_niface; - sc->sc_niface++; - if (x != uaa->info.bIfaceIndex) - usbd_set_parent_iface(uaa->device, x, - uaa->info.bIfaceIndex); + error = usbd_transfer_setup(uaa->device, + &iface_index, ssc->sc_xfer, xfer_config, + UGENSA_N_TRANSFER, ssc, &sc->sc_mtx); + + if (error) { + if (x == 0) { + device_printf(dev, "allocating USB " + "transfers failed (%d)\n", error); + goto detach; + } + break; + } + + /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); + usbd_xfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_WR]); + usbd_xfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); + + /* initialize port number */ + ssc->sc_ucom_ptr->sc_portno = sc->sc_nports; + if (iface_index != uaa->info.bIfaceIndex) { + usbd_set_parent_iface(uaa->device, iface_index, + uaa->info.bIfaceIndex); + } + sc->sc_nports++; + } } - device_printf(dev, "Found %d interfaces.\n", sc->sc_niface); + device_printf(dev, "Found %d serial ports.\n", sc->sc_nports); - error = ucom_attach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_niface, sc, + error = ucom_attach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_nports, sc, &ugensa_callback, &sc->sc_mtx); + if (error) { - DPRINTF("attach failed\n"); + DPRINTF("ucom attach failed\n"); goto detach; } ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); @@ -270,7 +275,7 @@ ugensa_detach(device_t dev) ucom_detach(&sc->sc_super_ucom, sc->sc_ucom); - for (x = 0; x < sc->sc_niface; x++) { + for (x = 0; x < sc->sc_nports; x++) { usbd_transfer_unsetup(sc->sc_sub[x].sc_xfer, UGENSA_N_TRANSFER); } From owner-svn-src-head@freebsd.org Fri Jul 12 09:48:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B17CA15EB168; Fri, 12 Jul 2019 09:48:43 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D48B8EDD9; Fri, 12 Jul 2019 09:48:43 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17601CA64; Fri, 12 Jul 2019 09:48:43 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C9mgga061666; Fri, 12 Jul 2019 09:48:42 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C9mg0q061665; Fri, 12 Jul 2019 09:48:42 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201907120948.x6C9mg0q061665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 12 Jul 2019 09:48:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349940 - head/sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netpfil/ipfw X-SVN-Commit-Revision: 349940 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4D48B8EDD9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 09:48:43 -0000 Author: ae Date: Fri Jul 12 09:48:42 2019 New Revision: 349940 URL: https://svnweb.freebsd.org/changeset/base/349940 Log: Correctly truncate the rule in case when it has several action opcodes. It is possible, that opcode at the ACTION_PTR() location is not real action, but action modificator like "log", "tag" etc. In this case we need to check for each opcode in the loop to find O_EXTERNAL_ACTION. Obtained from: Yandex LLC MFC after: 1 week Sponsored by: Yandex LLC Modified: head/sys/netpfil/ipfw/ip_fw_eaction.c Modified: head/sys/netpfil/ipfw/ip_fw_eaction.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_eaction.c Fri Jul 12 09:02:12 2019 (r349939) +++ head/sys/netpfil/ipfw/ip_fw_eaction.c Fri Jul 12 09:48:42 2019 (r349940) @@ -377,35 +377,51 @@ ipfw_reset_eaction(struct ip_fw_chain *ch, struct ip_f uint16_t eaction_id, uint16_t default_id, uint16_t instance_id) { ipfw_insn *cmd, *icmd; + int l, cmdlen; IPFW_UH_WLOCK_ASSERT(ch); IPFW_WLOCK_ASSERT(ch); cmd = ACTION_PTR(rule); + l = rule->cmd_len - rule->act_ofs; + while (l > 0) { + cmdlen = F_LEN(cmd); + l -= cmdlen; + if (cmd->opcode == O_EXTERNAL_ACTION) + break; + cmd += cmdlen; + } + /* + * Return if there is not O_EXTERNAL_ACTION or its id is + * different. + */ if (cmd->opcode != O_EXTERNAL_ACTION || cmd->arg1 != eaction_id) return (0); - - if (instance_id != 0 && rule->act_ofs < rule->cmd_len - 1) { + /* + * If instance_id is specified, we need to truncate the + * rule length. Check if there is O_EXTERNAL_INSTANCE opcode. + */ + if (instance_id != 0 && l > 0) { + MPASS(cmdlen == 1); icmd = cmd + 1; if (icmd->opcode != O_EXTERNAL_INSTANCE || icmd->arg1 != instance_id) return (0); - /* FALLTHROUGH */ + /* + * Since named_object related to this instance will be + * destroyed, truncate the chain of opcodes to remove + * the rest of cmd chain just after O_EXTERNAL_ACTION + * opcode. + */ + EACTION_DEBUG("truncate rule %d: len %u -> %u", + rule->rulenum, rule->cmd_len, rule->cmd_len - l); + rule->cmd_len -= l; + MPASS(((uint32_t *)icmd - + (uint32_t *)rule->cmd) == rule->cmd_len); } cmd->arg1 = default_id; /* Set to default id */ - /* - * Since named_object related to this instance will be - * also destroyed, truncate the chain of opcodes to - * remove the rest of cmd chain just after O_EXTERNAL_ACTION - * opcode. - */ - if (rule->act_ofs < rule->cmd_len - 1) { - EACTION_DEBUG("truncate rule %d: len %u -> %u", - rule->rulenum, rule->cmd_len, rule->act_ofs + 1); - rule->cmd_len = rule->act_ofs + 1; - } /* * Return 1 when reset successfully happened. */ From owner-svn-src-head@freebsd.org Fri Jul 12 09:59:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 281AB15EB435; Fri, 12 Jul 2019 09:59:23 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BEB138F515; Fri, 12 Jul 2019 09:59:22 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F6DCCC06; Fri, 12 Jul 2019 09:59:22 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C9xMm4067043; Fri, 12 Jul 2019 09:59:22 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C9xM1Z067042; Fri, 12 Jul 2019 09:59:22 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201907120959.x6C9xM1Z067042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 12 Jul 2019 09:59:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349941 - head/sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netpfil/ipfw X-SVN-Commit-Revision: 349941 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BEB138F515 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.935,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 09:59:23 -0000 Author: ae Date: Fri Jul 12 09:59:21 2019 New Revision: 349941 URL: https://svnweb.freebsd.org/changeset/base/349941 Log: Do not modify cmd pointer if it is already last opcode in the rule. MFC after: 1 week Modified: head/sys/netpfil/ipfw/ip_fw_eaction.c Modified: head/sys/netpfil/ipfw/ip_fw_eaction.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_eaction.c Fri Jul 12 09:48:42 2019 (r349940) +++ head/sys/netpfil/ipfw/ip_fw_eaction.c Fri Jul 12 09:59:21 2019 (r349941) @@ -387,7 +387,7 @@ ipfw_reset_eaction(struct ip_fw_chain *ch, struct ip_f while (l > 0) { cmdlen = F_LEN(cmd); l -= cmdlen; - if (cmd->opcode == O_EXTERNAL_ACTION) + if (cmd->opcode == O_EXTERNAL_ACTION || l <= 0) break; cmd += cmdlen; } From owner-svn-src-head@freebsd.org Fri Jul 12 11:44:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6255315ED4D6 for ; Fri, 12 Jul 2019 11:44:21 +0000 (UTC) (envelope-from rrs@netflix.com) Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 309916C63B for ; Fri, 12 Jul 2019 11:44:19 +0000 (UTC) (envelope-from rrs@netflix.com) Received: by mail-qt1-x82f.google.com with SMTP id l9so7708074qtu.6 for ; Fri, 12 Jul 2019 04:44:19 -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=72dHoLVLuh4p5whkGaIaWBtSQVtJvl+XjXrUFVeI8Ms=; b=IgAJd80PvnGb1rEAwaPiGcR/QbAHTHxDwT+LEsBenM7R9h9CP6vMf1R4FtwyR1rJMl jB4IozPBNU/8WLjlPEIOy5tPZi1/EFYebWIW6sb0Q49Ys7ACLNDr0zqZLKGKkPdB9+12 7yUDU9y1BN7phkZsch7PE0gVynBVWWGOjbBh3paLUYhISV1utViXCy1pMtJQ/Hrs7Q8q 9+pKHarKv+Sky/BY/6BdI/dT/zfm950L5mfjBcrCThH7lSUK2XqiOD3Zf4e181H8PTtN P+sflrQEp+KgBawfw/1ktfqEqKaAUfk6AkXqd6RLJrY5HGt0qeDOdJ95TCL2Qko9t6dE UrXw== X-Gm-Message-State: APjAAAUBnY/cJSE9x77NfVCJBdQor6rr5p3PIR/gxSuoZ4jVppxolZ57 yx+egwuKT/8mVnogoEsobfLPWhKuzDE= X-Google-Smtp-Source: APXvYqyX+El7ZAJhfA+puyyOcNdMhKgSz9R/cMRcYEOSGoF5N9jK/7zWZGy0ckq4ApAysrtnoAunrg== X-Received: by 2002:a0c:adef:: with SMTP id x44mr6286426qvc.153.1562931858417; Fri, 12 Jul 2019 04:44:18 -0700 (PDT) Received: from ?IPv6:2607:fb10:7061:7fd::19c4? ([2607:fb10:7061:7fd::19c4]) by smtp.gmail.com with ESMTPSA id z8sm3502552qki.23.2019.07.12.04.44.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jul 2019 04:44:17 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: svn commit: r349907 - head/sys/netinet/tcp_stacks From: Randall Stewart In-Reply-To: <6AC34953-52FC-48FC-B83F-CFFB6A48EC84@gmail.com> Date: Fri, 12 Jul 2019 07:44:16 -0400 Cc: Randall Ray Stewart , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <9849A15D-6934-4076-9FE9-80AF28F8376C@netflix.com> References: <201907110438.x6B4cXX1054795@repo.freebsd.org> <6AC34953-52FC-48FC-B83F-CFFB6A48EC84@gmail.com> To: Enji Cooper X-Mailer: Apple Mail (2.3445.9.1) X-Rspamd-Queue-Id: 309916C63B X-Spamd-Bar: ---------------- X-Spamd-Result: default: False [-16.47 / 15.00]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; MV_CASE(0.50)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; MX_GOOD(-0.01)[alt1.aspmx.l.google.com,aspmx.l.google.com,aspmx2.googlemail.com,alt2.aspmx.l.google.com,aspmx3.googlemail.com]; DKIM_TRACE(0.00)[netflix.com:+]; DMARC_POLICY_ALLOW(-0.50)[netflix.com,reject]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(-3.02)[ip: (-9.40), ipnet: 2607:f8b0::/32(-3.18), asn: 15169(-2.44), country: US(-0.06)]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_LAST(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[netflix.com:s=google]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; WHITELIST_DMARC(-7.00)[netflix.com:D:+]; RCVD_IN_DNSWL_NONE(0.00)[f.2.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; WHITELIST_SPF_DKIM(-3.00)[netflix.com:d:+,netflix.com:s:+] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 11:44:21 -0000 opps.. that was a error on my part I will fix it :) > On Jul 11, 2019, at 4:37 AM, Enji Cooper = wrote: >=20 >=20 >> On Jul 10, 2019, at 9:38 PM, Randall Stewart wrote: >>=20 >> Author: rrs >> Date: Thu Jul 11 04:38:33 2019 >> New Revision: 349907 >> URL: https://svnweb.freebsd.org/changeset/base/349907 >>=20 >> Log: >> Update copyright per JBH's suggestions.. thanks. >>=20 >> Modified: >> head/sys/netinet/tcp_stacks/rack.c >>=20 >> Modified: head/sys/netinet/tcp_stacks/rack.c >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 03:29:25 2019 = (r349906) >> +++ head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 04:38:33 2019 = (r349907) >> @@ -1,5 +1,5 @@ >> /*- >> - * Copyright (c) 2016 >> + * Copyright (c) 2016-2019 >> * Netflix Inc. All rights reserved. >> * >> * Redistribution and use in source and binary forms, with or without >> @@ -8537,10 +8537,10 @@ out: >> * retransmit. In persist state, just set snd_max. >> */ >> if (error =3D=3D 0) { >> -/* if (TCPS_HAVEESTABLISHED(tp->t_state) && >> + if (TCPS_HAVEESTABLISHED(tp->t_state) && >> (tp->t_flags & TF_SACK_PERMIT) && >> tp->rcv_numsacks > 0) >> - tcp_clean_dsack_blocks(tp);*/ >> + tcp_clean_dsack_blocks(tp); >=20 > Removing this commented out code unfortunately broke the build: = https://ci.freebsd.org/job/FreeBSD-head-amd64-LINT/12934/console . > Thanks, > -Enji >=20 ------ Randall Stewart rrs@netflix.com From owner-svn-src-head@freebsd.org Fri Jul 12 11:45:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B67115ED581; Fri, 12 Jul 2019 11:45:43 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DEDB66C7CE; Fri, 12 Jul 2019 11:45:42 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC3D7DEA7; Fri, 12 Jul 2019 11:45:42 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CBjgRi024138; Fri, 12 Jul 2019 11:45:42 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CBjgBn024137; Fri, 12 Jul 2019 11:45:42 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <201907121145.x6CBjgBn024137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Fri, 12 Jul 2019 11:45:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349942 - head/sys/netinet/tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: rrs X-SVN-Commit-Paths: head/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 349942 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DEDB66C7CE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.947,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 11:45:43 -0000 Author: rrs Date: Fri Jul 12 11:45:42 2019 New Revision: 349942 URL: https://svnweb.freebsd.org/changeset/base/349942 Log: add back the comment around the pending DSACK fixes. Modified: head/sys/netinet/tcp_stacks/rack.c Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Fri Jul 12 09:59:21 2019 (r349941) +++ head/sys/netinet/tcp_stacks/rack.c Fri Jul 12 11:45:42 2019 (r349942) @@ -8537,10 +8537,10 @@ out: * retransmit. In persist state, just set snd_max. */ if (error == 0) { - if (TCPS_HAVEESTABLISHED(tp->t_state) && +/* if (TCPS_HAVEESTABLISHED(tp->t_state) && (tp->t_flags & TF_SACK_PERMIT) && tp->rcv_numsacks > 0) - tcp_clean_dsack_blocks(tp); + tcp_clean_dsack_blocks(tp);*/ if (len == 0) counter_u64_add(rack_out_size[TCP_MSS_ACCT_SNDACK], 1); else if (len == 1) { From owner-svn-src-head@freebsd.org Fri Jul 12 15:24:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 649C315CD2BB; Fri, 12 Jul 2019 15:24:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0557174BC1; Fri, 12 Jul 2019 15:24:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D0A76184C6; Fri, 12 Jul 2019 15:24:25 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CFOPG8038584; Fri, 12 Jul 2019 15:24:25 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CFOPqq038583; Fri, 12 Jul 2019 15:24:25 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907121524.x6CFOPqq038583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 12 Jul 2019 15:24:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349943 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 349943 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0557174BC1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 15:24:26 -0000 Author: markj Date: Fri Jul 12 15:24:25 2019 New Revision: 349943 URL: https://svnweb.freebsd.org/changeset/base/349943 Log: Apply some light cleanup to uses of pmap_pte_dirty(). - Check for ATTR_SW_MANAGED before anything else. - Use pmap_pte_dirty() in pmap_remove_pages(). No functional change intended. Reviewed by: alc MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Fri Jul 12 11:45:42 2019 (r349942) +++ head/sys/arm64/arm64/pmap.c Fri Jul 12 15:24:25 2019 (r349943) @@ -2812,9 +2812,8 @@ pmap_protect_l2(pmap_t pmap, pt_entry_t *l2, vm_offset * update the dirty field of each of the superpage's constituent 4KB * pages. */ - if ((nbits & ATTR_AP(ATTR_AP_RO)) != 0 && - (old_l2 & ATTR_SW_MANAGED) != 0 && - pmap_pte_dirty(old_l2)) { + if ((old_l2 & ATTR_SW_MANAGED) != 0 && + (nbits & ATTR_AP(ATTR_AP_RO)) != 0 && pmap_pte_dirty(old_l2)) { m = PHYS_TO_VM_PAGE(old_l2 & ~ATTR_MASK); for (mt = m; mt < &m[L2_SIZE / PAGE_SIZE]; mt++) vm_page_dirty(mt); @@ -2920,8 +2919,8 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t * When a dirty read/write mapping is write protected, * update the page's dirty field. */ - if ((nbits & ATTR_AP(ATTR_AP_RO)) != 0 && - (l3 & ATTR_SW_MANAGED) != 0 && + if ((l3 & ATTR_SW_MANAGED) != 0 && + (nbits & ATTR_AP(ATTR_AP_RO)) != 0 && pmap_pte_dirty(l3)) vm_page_dirty(PHYS_TO_VM_PAGE(l3 & ~ATTR_MASK)); @@ -3344,8 +3343,8 @@ validate: /* same PA, different attributes */ pmap_load_store(l3, new_l3); pmap_invalidate_page(pmap, va); - if (pmap_pte_dirty(orig_l3) && - (orig_l3 & ATTR_SW_MANAGED) != 0) + if ((orig_l3 & ATTR_SW_MANAGED) != 0 && + pmap_pte_dirty(orig_l3)) vm_page_dirty(m); } else { /* @@ -4293,8 +4292,7 @@ pmap_remove_pages(pmap_t pmap) /* * Update the vm_page_t clean/reference bits. */ - if ((tpte & ATTR_AP_RW_BIT) == - ATTR_AP(ATTR_AP_RW)) { + if (pmap_pte_dirty(tpte)) { switch (lvl) { case 1: for (mt = m; mt < &m[L2_SIZE / PAGE_SIZE]; mt++) From owner-svn-src-head@freebsd.org Fri Jul 12 18:13:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02E3A15D1EF0; Fri, 12 Jul 2019 18:13:59 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9E65F84B8C; Fri, 12 Jul 2019 18:13:58 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79A871A386; Fri, 12 Jul 2019 18:13:58 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CIDw1f028711; Fri, 12 Jul 2019 18:13:58 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CIDwFY028710; Fri, 12 Jul 2019 18:13:58 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907121813.x6CIDwFY028710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Fri, 12 Jul 2019 18:13:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349944 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349944 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9E65F84B8C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 18:13:59 -0000 Author: seanc (ports committer) Date: Fri Jul 12 18:13:58 2019 New Revision: 349944 URL: https://svnweb.freebsd.org/changeset/base/349944 Log: usr.sbin/bhyve: don't leak a FD if the device is not a tty Coverity CID: 1194193 Approved by: markj, jhb Differential Revision: https://reviews.freebsd.org/D20934 Modified: head/usr.sbin/bhyve/uart_emul.c Modified: head/usr.sbin/bhyve/uart_emul.c ============================================================================== --- head/usr.sbin/bhyve/uart_emul.c Fri Jul 12 15:24:25 2019 (r349943) +++ head/usr.sbin/bhyve/uart_emul.c Fri Jul 12 18:13:58 2019 (r349944) @@ -678,8 +678,13 @@ uart_tty_backend(struct uart_softc *sc, const char *op int fd; fd = open(opts, O_RDWR | O_NONBLOCK); - if (fd < 0 || !isatty(fd)) + if (fd < 0) return (-1); + + if (!isatty(fd)) { + close(fd); + return (-1); + } sc->tty.rfd = sc->tty.wfd = fd; sc->tty.opened = true; From owner-svn-src-head@freebsd.org Fri Jul 12 18:17:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE16D15D20A9; Fri, 12 Jul 2019 18:17:36 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 937C484EC3; Fri, 12 Jul 2019 18:17:36 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6050C1A3B3; Fri, 12 Jul 2019 18:17:36 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CIHaY5028895; Fri, 12 Jul 2019 18:17:36 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CIHa03028894; Fri, 12 Jul 2019 18:17:36 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907121817.x6CIHa03028894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Fri, 12 Jul 2019 18:17:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349945 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349945 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 937C484EC3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 18:17:37 -0000 Author: seanc (ports committer) Date: Fri Jul 12 18:17:35 2019 New Revision: 349945 URL: https://svnweb.freebsd.org/changeset/base/349945 Log: usr.sbin/bhyve: prevent use-after-free in virtio scsi request handling Coverity CID: 1393377 Approved by: araujo, jhb Differential Revision: https://reviews.freebsd.org/D20915 Modified: head/usr.sbin/bhyve/pci_virtio_scsi.c Modified: head/usr.sbin/bhyve/pci_virtio_scsi.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_scsi.c Fri Jul 12 18:13:58 2019 (r349944) +++ head/usr.sbin/bhyve/pci_virtio_scsi.c Fri Jul 12 18:17:35 2019 (r349945) @@ -465,7 +465,7 @@ pci_vtscsi_request_handle(struct pci_vtscsi_queue *q, int data_niov_in, data_niov_out; void *ext_data_ptr = NULL; uint32_t ext_data_len = 0, ext_sg_entries = 0; - int err; + int err, nxferred; seek_iov(iov_in, niov_in, data_iov_in, &data_niov_in, VTSCSI_IN_HEADER_LEN(sc)); @@ -544,10 +544,11 @@ pci_vtscsi_request_handle(struct pci_vtscsi_queue *q, } buf_to_iov(cmd_wr, VTSCSI_OUT_HEADER_LEN(sc), iov_out, niov_out, 0); + nxferred = VTSCSI_OUT_HEADER_LEN(sc) + io->scsiio.ext_data_filled; free(cmd_rd); free(cmd_wr); ctl_scsi_free_io(io); - return (VTSCSI_OUT_HEADER_LEN(sc) + io->scsiio.ext_data_filled); + return (nxferred); } static void From owner-svn-src-head@freebsd.org Fri Jul 12 18:20:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CCFC15D21E8; Fri, 12 Jul 2019 18:20:57 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9F403851A4; Fri, 12 Jul 2019 18:20:56 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 78CB71A419; Fri, 12 Jul 2019 18:20:56 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CIKu6g030705; Fri, 12 Jul 2019 18:20:56 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CIKu1c030704; Fri, 12 Jul 2019 18:20:56 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907121820.x6CIKu1c030704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Fri, 12 Jul 2019 18:20:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349946 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349946 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9F403851A4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 18:20:57 -0000 Author: seanc (ports committer) Date: Fri Jul 12 18:20:56 2019 New Revision: 349946 URL: https://svnweb.freebsd.org/changeset/base/349946 Log: usr.sbin/bhyve: free resources when erroring out of pci_vtcon_sock_add() Coverity CID: 1362880 Approved by: markj, jhb Differential Revision: https://reviews.freebsd.org/D20916 Modified: head/usr.sbin/bhyve/pci_virtio_console.c Modified: head/usr.sbin/bhyve/pci_virtio_console.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_console.c Fri Jul 12 18:17:35 2019 (r349945) +++ head/usr.sbin/bhyve/pci_virtio_console.c Fri Jul 12 18:20:56 2019 (r349946) @@ -356,8 +356,11 @@ out: if (fd != -1) close(fd); - if (error != 0 && s != -1) - close(s); + if (error != 0) { + if (s != -1) + close(s); + free(sock); + } return (error); } From owner-svn-src-head@freebsd.org Fri Jul 12 18:33:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10E1F15D2834; Fri, 12 Jul 2019 18:33:59 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A560385CE4; Fri, 12 Jul 2019 18:33:58 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F0DA1A7A4; Fri, 12 Jul 2019 18:33:58 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CIXwpJ039193; Fri, 12 Jul 2019 18:33:58 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CIXwnA039192; Fri, 12 Jul 2019 18:33:58 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907121833.x6CIXwnA039192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Fri, 12 Jul 2019 18:33:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349947 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349947 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A560385CE4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 18:33:59 -0000 Author: seanc (ports committer) Date: Fri Jul 12 18:33:58 2019 New Revision: 349947 URL: https://svnweb.freebsd.org/changeset/base/349947 Log: usr.sbin/bhyve: only unassign a pt device after obtaining bus/slot/func Coverity CID: 1194302, 1194303, 1194304 Approved by: jhb, markj Differential Revision: https://reviews.freebsd.org/D20933 Modified: head/usr.sbin/bhyve/pci_passthru.c Modified: head/usr.sbin/bhyve/pci_passthru.c ============================================================================== --- head/usr.sbin/bhyve/pci_passthru.c Fri Jul 12 18:20:56 2019 (r349946) +++ head/usr.sbin/bhyve/pci_passthru.c Fri Jul 12 18:33:58 2019 (r349947) @@ -668,14 +668,14 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p memflags = vm_get_memflags(ctx); if (!(memflags & VM_MEM_F_WIRED)) { warnx("passthru requires guest memory to be wired"); - goto done; + return (error); } if (pcifd < 0) { pcifd = open(_PATH_DEVPCI, O_RDWR, 0); if (pcifd < 0) { warn("failed to open %s", _PATH_DEVPCI); - goto done; + return (error); } } @@ -690,7 +690,7 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p iofd = open(_PATH_DEVIO, O_RDWR, 0); if (iofd < 0) { warn("failed to open %s", _PATH_DEVIO); - goto done; + return (error); } } @@ -705,7 +705,7 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p memfd = open(_PATH_MEM, O_RDWR, 0); if (memfd < 0) { warn("failed to open %s", _PATH_MEM); - goto done; + return (error); } } @@ -719,7 +719,7 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p if (opts == NULL || sscanf(opts, "%d/%d/%d", &bus, &slot, &func) != 3) { warnx("invalid passthru options"); - goto done; + return (error); } if (vm_assign_pptdev(ctx, bus, slot, func) != 0) { @@ -734,10 +734,7 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p sc->psc_pi = pi; /* initialize config space */ - if ((error = cfginit(ctx, pi, bus, slot, func)) != 0) - goto done; - - error = 0; /* success */ + error = cfginit(ctx, pi, bus, slot, func); done: if (error) { free(sc); From owner-svn-src-head@freebsd.org Fri Jul 12 18:37:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B08B15D28FB; Fri, 12 Jul 2019 18:37:58 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CFE1885EFB; Fri, 12 Jul 2019 18:37:57 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A57CC1A7BA; Fri, 12 Jul 2019 18:37:57 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CIbvph039409; Fri, 12 Jul 2019 18:37:57 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CIbugC039406; Fri, 12 Jul 2019 18:37:56 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201907121837.x6CIbugC039406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 12 Jul 2019 18:37:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349948 - in head/sys/amd64: include vmm X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in head/sys/amd64: include vmm X-SVN-Commit-Revision: 349948 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CFE1885EFB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 18:37:58 -0000 Author: scottl Date: Fri Jul 12 18:37:56 2019 New Revision: 349948 URL: https://svnweb.freebsd.org/changeset/base/349948 Log: Tie the name limit of a VM to SPECNAMELEN from devfs instead of a hard-coded value. Don't allocate space for it from the kernel stack. Account for prefix, suffix, and separator space in the name. This takes the effective length up to 229 bytes on 13-current, and 37 bytes on 12-stable. 37 bytes is enough to hold a full GUID string. PR: 234134 MFC after: 1 week Differential Revision: http://reviews.freebsd.org/D20924 Modified: head/sys/amd64/include/vmm.h head/sys/amd64/include/vmm_dev.h head/sys/amd64/vmm/vmm_dev.c Modified: head/sys/amd64/include/vmm.h ============================================================================== --- head/sys/amd64/include/vmm.h Fri Jul 12 18:33:58 2019 (r349947) +++ head/sys/amd64/include/vmm.h Fri Jul 12 18:37:56 2019 (r349948) @@ -114,9 +114,30 @@ enum x2apic_state { #define VM_INTINFO_HWEXCEPTION (3 << 8) #define VM_INTINFO_SWINTR (4 << 8) -#ifdef _KERNEL +/* + * The VM name has to fit into the pathname length constraints of devfs, + * governed primarily by SPECNAMELEN. The length is the total number of + * characters in the full path, relative to the mount point and not + * including any leading '/' characters. + * A prefix and a suffix are added to the name specified by the user. + * The prefix is usually "vmm/" or "vmm.io/", but can be a few characters + * longer for future use. + * The suffix is a string that identifies a bootrom image or some similar + * image that is attached to the VM. A separator character gets added to + * the suffix automatically when generating the full path, so it must be + * accounted for, reducing the effective length by 1. + * The effective length of a VM name is 229 bytes for FreeBSD 13 and 37 + * bytes for FreeBSD 12. A minimum length is set for safety and supports + * a SPECNAMELEN as small as 32 on old systems. + */ +#define VM_MAX_PREFIXLEN 10 +#define VM_MAX_SUFFIXLEN 15 +#define VM_MIN_NAMELEN 6 +#define VM_MAX_NAMELEN \ + (SPECNAMELEN - VM_MAX_PREFIXLEN - VM_MAX_SUFFIXLEN - 1) -#define VM_MAX_NAMELEN 32 +#ifdef _KERNEL +CTASSERT(VM_MAX_NAMELEN >= VM_MIN_NAMELEN); struct vm; struct vm_exception; Modified: head/sys/amd64/include/vmm_dev.h ============================================================================== --- head/sys/amd64/include/vmm_dev.h Fri Jul 12 18:33:58 2019 (r349947) +++ head/sys/amd64/include/vmm_dev.h Fri Jul 12 18:37:56 2019 (r349948) @@ -51,7 +51,7 @@ struct vm_memmap { struct vm_memseg { int segid; size_t len; - char name[SPECNAMELEN + 1]; + char name[VM_MAX_SUFFIXLEN + 1]; }; struct vm_register { Modified: head/sys/amd64/vmm/vmm_dev.c ============================================================================== --- head/sys/amd64/vmm/vmm_dev.c Fri Jul 12 18:33:58 2019 (r349947) +++ head/sys/amd64/vmm/vmm_dev.c Fri Jul 12 18:37:56 2019 (r349948) @@ -245,7 +245,7 @@ vmmdev_rw(struct cdev *cdev, struct uio *uio, int flag return (error); } -CTASSERT(sizeof(((struct vm_memseg *)0)->name) >= SPECNAMELEN + 1); +CTASSERT(sizeof(((struct vm_memseg *)0)->name) >= VM_MAX_SUFFIXLEN + 1); static int get_memseg(struct vmmdev_softc *sc, struct vm_memseg *mseg) @@ -265,7 +265,8 @@ get_memseg(struct vmmdev_softc *sc, struct vm_memseg * } KASSERT(dsc != NULL, ("%s: devmem segment %d not found", __func__, mseg->segid)); - error = copystr(dsc->name, mseg->name, SPECNAMELEN + 1, NULL); + error = copystr(dsc->name, mseg->name, sizeof(mseg->name), + NULL); } else { bzero(mseg->name, sizeof(mseg->name)); } @@ -284,10 +285,14 @@ alloc_memseg(struct vmmdev_softc *sc, struct vm_memseg name = NULL; sysmem = true; + /* + * The allocation is lengthened by 1 to hold a terminating NUL. It'll + * by stripped off when devfs processes the full string. + */ if (VM_MEMSEG_NAME(mseg)) { sysmem = false; - name = malloc(SPECNAMELEN + 1, M_VMMDEV, M_WAITOK); - error = copystr(mseg->name, name, SPECNAMELEN + 1, 0); + name = malloc(sizeof(mseg->name) M_VMMDEV, M_WAITOK); + error = copystr(mseg->name, name, sizeof(mseg->name), NULL); if (error) goto done; } @@ -894,26 +899,29 @@ vmmdev_destroy(void *arg) static int sysctl_vmm_destroy(SYSCTL_HANDLER_ARGS) { - int error; - char buf[VM_MAX_NAMELEN]; struct devmem_softc *dsc; struct vmmdev_softc *sc; struct cdev *cdev; + char *buf; + int error, buflen; error = vmm_priv_check(req->td->td_ucred); if (error) return (error); - strlcpy(buf, "beavis", sizeof(buf)); - error = sysctl_handle_string(oidp, buf, sizeof(buf), req); + buflen = VM_MAX_NAMELEN + 1; + buf = malloc(buflen, M_VMMDEV, M_WAITOK | M_ZERO); + strlcpy(buf, "beavis", buflen); + error = sysctl_handle_string(oidp, buf, buflen, req); if (error != 0 || req->newptr == NULL) - return (error); + goto out; mtx_lock(&vmmdev_mtx); sc = vmmdev_lookup(buf); if (sc == NULL || sc->cdev == NULL) { mtx_unlock(&vmmdev_mtx); - return (EINVAL); + error = EINVAL; + goto out; } /* @@ -943,7 +951,11 @@ sysctl_vmm_destroy(SYSCTL_HANDLER_ARGS) destroy_dev_sched_cb(dsc->cdev, devmem_destroy, dsc); } destroy_dev_sched_cb(cdev, vmmdev_destroy, sc); - return (0); + error = 0; + +out: + free(buf, M_VMMDEV); + return (error); } SYSCTL_PROC(_hw_vmm, OID_AUTO, destroy, CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON, @@ -961,30 +973,34 @@ static struct cdevsw vmmdevsw = { static int sysctl_vmm_create(SYSCTL_HANDLER_ARGS) { - int error; struct vm *vm; struct cdev *cdev; struct vmmdev_softc *sc, *sc2; - char buf[VM_MAX_NAMELEN]; + char *buf; + int error, buflen; error = vmm_priv_check(req->td->td_ucred); if (error) return (error); - strlcpy(buf, "beavis", sizeof(buf)); - error = sysctl_handle_string(oidp, buf, sizeof(buf), req); + buflen = VM_MAX_NAMELEN + 1; + buf = malloc(buflen, M_VMMDEV, M_WAITOK | M_ZERO); + strlcpy(buf, "beavis", buflen); + error = sysctl_handle_string(oidp, buf, buflen, req); if (error != 0 || req->newptr == NULL) - return (error); + goto out; mtx_lock(&vmmdev_mtx); sc = vmmdev_lookup(buf); mtx_unlock(&vmmdev_mtx); - if (sc != NULL) - return (EEXIST); + if (sc != NULL) { + error = EEXIST; + goto out; + } error = vm_create(buf, &vm); if (error != 0) - return (error); + goto out; sc = malloc(sizeof(struct vmmdev_softc), M_VMMDEV, M_WAITOK | M_ZERO); sc->vm = vm; @@ -1004,14 +1020,15 @@ sysctl_vmm_create(SYSCTL_HANDLER_ARGS) if (sc2 != NULL) { vmmdev_destroy(sc); - return (EEXIST); + error = EEXIST; + goto out; } error = make_dev_p(MAKEDEV_CHECKNAME, &cdev, &vmmdevsw, NULL, UID_ROOT, GID_WHEEL, 0600, "vmm/%s", buf); if (error != 0) { vmmdev_destroy(sc); - return (error); + goto out; } mtx_lock(&vmmdev_mtx); @@ -1019,7 +1036,9 @@ sysctl_vmm_create(SYSCTL_HANDLER_ARGS) sc->cdev->si_drv1 = sc; mtx_unlock(&vmmdev_mtx); - return (0); +out: + free(buf, M_VMMDEV); + return (error); } SYSCTL_PROC(_hw_vmm, OID_AUTO, create, CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON, From owner-svn-src-head@freebsd.org Fri Jul 12 18:38:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0A2415D2929; Fri, 12 Jul 2019 18:38:19 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 54C868601F; Fri, 12 Jul 2019 18:38:19 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36ACC1A7BD; Fri, 12 Jul 2019 18:38:19 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CIcJEx039480; Fri, 12 Jul 2019 18:38:19 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CIcJ3K039479; Fri, 12 Jul 2019 18:38:19 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907121838.x6CIcJ3K039479@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Fri, 12 Jul 2019 18:38:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349949 - head/usr.sbin/bhyveload X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyveload X-SVN-Commit-Revision: 349949 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 54C868601F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 18:38:19 -0000 Author: seanc (ports committer) Date: Fri Jul 12 18:38:18 2019 New Revision: 349949 URL: https://svnweb.freebsd.org/changeset/base/349949 Log: usr.sbin/bhyveload: don't leak an fd if a device can't be opened Coverity CID: 1194167 Approved by: markj, jhb Differential Revision: https://reviews.freebsd.org/D20935 Modified: head/usr.sbin/bhyveload/bhyveload.c Modified: head/usr.sbin/bhyveload/bhyveload.c ============================================================================== --- head/usr.sbin/bhyveload/bhyveload.c Fri Jul 12 18:37:56 2019 (r349948) +++ head/usr.sbin/bhyveload/bhyveload.c Fri Jul 12 18:38:18 2019 (r349949) @@ -664,21 +664,19 @@ altcons_open(char *path) static int disk_open(char *path) { - int err, fd; + int fd; if (ndisks >= NDISKS) return (ERANGE); - err = 0; fd = open(path, O_RDONLY); + if (fd < 0) + return (errno); - if (fd > 0) { - disk_fd[ndisks] = fd; - ndisks++; - } else - err = errno; + disk_fd[ndisks] = fd; + ndisks++; - return (err); + return (0); } static void From owner-svn-src-head@freebsd.org Fri Jul 12 18:39:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DE4C15D2A5C; Fri, 12 Jul 2019 18:39:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B6B6A86270; Fri, 12 Jul 2019 18:39:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 943921A7E8; Fri, 12 Jul 2019 18:39:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CIdfb9039573; Fri, 12 Jul 2019 18:39:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CIdfhb039572; Fri, 12 Jul 2019 18:39:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201907121839.x6CIdfhb039572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 12 Jul 2019 18:39:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349950 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 349950 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B6B6A86270 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 18:39:42 -0000 Author: kib Date: Fri Jul 12 18:39:41 2019 New Revision: 349950 URL: https://svnweb.freebsd.org/changeset/base/349950 Log: Style: avoid long lines by using .Fo instead of .Fn. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/share/man/man9/casuword.9 Modified: head/share/man/man9/casuword.9 ============================================================================== --- head/share/man/man9/casuword.9 Fri Jul 12 18:38:18 2019 (r349949) +++ head/share/man/man9/casuword.9 Fri Jul 12 18:39:41 2019 (r349950) @@ -41,13 +41,31 @@ .In sys/types.h .In sys/systm.h .Ft int -.Fn casueword "volatile u_long *base" "u_long oldval" "u_long *oldvalp" "u_long newval" +.Fo casueword +.Fa "volatile u_long *base" +.Fa "u_long oldval" +.Fa "u_long *oldvalp" +.Fa "u_long newval" +.Fc .Ft int -.Fn casueword32 "volatile uint32_t *base" "uint32_t oldval" "uint32_t *oldvalp" "uint32_t newval" +.Fo casueword32 +.Fa "volatile uint32_t *base" +.Fa "uint32_t oldval" +.Fa "uint32_t *oldvalp" +.Fa "uint32_t newval" +.Fc .Ft u_long -.Fn casuword "volatile u_long *base" "u_long oldval" "u_long newval" +.Fo casuword +.Fa "volatile u_long *base" +.Fa "u_long oldval" +.Fa "u_long newval" +.Fc .Ft uint32_t -.Fn casuword32 "volatile uint32_t *base" "uint32_t oldval" "uint32_t newval" +.Fo casuword32 +.Fa "volatile uint32_t *base" +.Fa "uint32_t oldval" +.Fa "uint32_t newval" +.Fc .Sh DESCRIPTION The .Nm From owner-svn-src-head@freebsd.org Fri Jul 12 18:43:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC1C015D2D82; Fri, 12 Jul 2019 18:43:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8EB3D86741; Fri, 12 Jul 2019 18:43:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 795D81A99A; Fri, 12 Jul 2019 18:43:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CIhPhm044241; Fri, 12 Jul 2019 18:43:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CIhOPG044234; Fri, 12 Jul 2019 18:43:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201907121843.x6CIhOPG044234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 12 Jul 2019 18:43:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349951 - in head: share/man/man9 sys/amd64/amd64 sys/arm/arm sys/arm64/arm64 sys/i386/i386 sys/kern sys/mips/mips sys/powerpc/powerpc sys/riscv/riscv sys/sparc64/sparc64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head: share/man/man9 sys/amd64/amd64 sys/arm/arm sys/arm64/arm64 sys/i386/i386 sys/kern sys/mips/mips sys/powerpc/powerpc sys/riscv/riscv sys/sparc64/sparc64 X-SVN-Commit-Revision: 349951 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8EB3D86741 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 18:43:26 -0000 Author: kib Date: Fri Jul 12 18:43:24 2019 New Revision: 349951 URL: https://svnweb.freebsd.org/changeset/base/349951 Log: Provide protection against starvation of the ll/sc loops when accessing userpace. Casueword(9) on ll/sc architectures must be prepared for userspace constantly modifying the same cache line as containing the CAS word, and not loop infinitely. Otherwise, rogue userspace livelocks the kernel. To fix the issue, change casueword(9) interface to return new value 1 indicating that either comparision or store failed, instead of relying on the oldval == *oldvalp comparison. The primitive no longer retries the operation if it failed spuriously. Modify callers of casueword(9), all in kern_umtx.c, to handle retries, and react to stops and requests to terminate between retries. On x86, despite cmpxchg should not return spurious failures, we can take advantage of the new interface and just return PSL.ZF. Reviewed by: andrew (arm64, previous version), markj Tested by: pho Reported by: https://xenbits.xen.org/xsa/advisory-295.txt Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D20772 Modified: head/share/man/man9/casuword.9 head/sys/amd64/amd64/support.S head/sys/arm/arm/fusu.S head/sys/arm64/arm64/support.S head/sys/i386/i386/copyout.c head/sys/kern/kern_umtx.c head/sys/mips/mips/support.S head/sys/powerpc/powerpc/copyinout.c head/sys/riscv/riscv/support.S head/sys/sparc64/sparc64/support.S head/sys/sparc64/sparc64/vm_machdep.c Modified: head/share/man/man9/casuword.9 ============================================================================== --- head/share/man/man9/casuword.9 Fri Jul 12 18:39:41 2019 (r349950) +++ head/share/man/man9/casuword.9 Fri Jul 12 18:43:24 2019 (r349951) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2014 The FreeBSD Foundation +.\" Copyright (c) 2014, 2019 The FreeBSD Foundation .\" All rights reserved. .\" .\" Part of this documentation was written by @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 21, 2014 +.Dd April 19, 2019 .Dt CASU 9 .Os .Sh NAME @@ -106,7 +106,9 @@ The .Fn casueword and .Fn casueword32 -functions return 0 on success and -1 on failure. +functions return 0 on success, -1 on failure to access memory, +and 1 when comparison or store failed. +The store can fail on load-linked/store-conditional architectures. .Sh SEE ALSO .Xr atomic 9 , .Xr fetch 9 , Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Fri Jul 12 18:39:41 2019 (r349950) +++ head/sys/amd64/amd64/support.S Fri Jul 12 18:43:24 2019 (r349951) @@ -811,6 +811,7 @@ ENTRY(casueword32_nosmap) lock #endif cmpxchgl %ecx,(%rdi) /* new = %ecx */ + setne %cl /* * The old value is in %eax. If the store succeeded it will be the @@ -828,6 +829,7 @@ ENTRY(casueword32_nosmap) */ movl %esi,(%rdx) /* oldp = %rdx */ POP_FRAME_POINTER + movzbl %cl, %eax ret END(casueword32_nosmap) @@ -847,6 +849,7 @@ ENTRY(casueword32_smap) #endif cmpxchgl %ecx,(%rdi) /* new = %ecx */ clac + setne %cl /* * The old value is in %eax. If the store succeeded it will be the @@ -864,6 +867,7 @@ ENTRY(casueword32_smap) */ movl %esi,(%rdx) /* oldp = %rdx */ POP_FRAME_POINTER + movzbl %cl, %eax ret END(casueword32_smap) @@ -886,6 +890,7 @@ ENTRY(casueword_nosmap) lock #endif cmpxchgq %rcx,(%rdi) /* new = %rcx */ + setne %cl /* * The old value is in %rax. If the store succeeded it will be the @@ -897,6 +902,7 @@ ENTRY(casueword_nosmap) movq %rax,PCB_ONFAULT(%r8) movq %rsi,(%rdx) POP_FRAME_POINTER + movzbl %cl, %eax ret END(casueword_nosmap) @@ -916,6 +922,7 @@ ENTRY(casueword_smap) #endif cmpxchgq %rcx,(%rdi) /* new = %rcx */ clac + setne %cl /* * The old value is in %rax. If the store succeeded it will be the @@ -927,6 +934,7 @@ ENTRY(casueword_smap) movq %rax,PCB_ONFAULT(%r8) movq %rsi,(%rdx) POP_FRAME_POINTER + movzbl %cl, %eax ret END(casueword_smap) Modified: head/sys/arm/arm/fusu.S ============================================================================== --- head/sys/arm/arm/fusu.S Fri Jul 12 18:39:41 2019 (r349950) +++ head/sys/arm/arm/fusu.S Fri Jul 12 18:43:24 2019 (r349951) @@ -63,7 +63,7 @@ EENTRY_NP(casueword32) ldr r4, =(VM_MAXUSER_ADDRESS-3) cmp r0, r4 mvncs r0, #0 - bcs 2f + bcs 1f GET_PCB(r6) ldr r6, [r6] @@ -78,12 +78,10 @@ EENTRY_NP(casueword32) str r4, [r6, #PCB_ONFAULT] #if __ARM_ARCH >= 6 -1: + mov r5, #1 ldrex r4, [r0] cmp r4, r1 strexeq r5, r3, [r0] - cmpeq r5, #1 - beq 1b #else ldrt r4, [r0] cmp r4, r1 @@ -92,7 +90,10 @@ EENTRY_NP(casueword32) str r4, [r2] mov r0, #0 str r0, [r6, #PCB_ONFAULT] -2: +#if __ARM_ARCH >= 6 + mov r0, r5 +#endif +1: ldmfd sp!, {r4, r5, r6} RET EEND(casueword32) Modified: head/sys/arm64/arm64/support.S ============================================================================== --- head/sys/arm64/arm64/support.S Fri Jul 12 18:39:41 2019 (r349950) +++ head/sys/arm64/arm64/support.S Fri Jul 12 18:43:24 2019 (r349951) @@ -57,17 +57,17 @@ ENTRY(casueword32) cmp x0, x4 b.cs fsu_fault_nopcb adr x6, fsu_fault /* Load the fault handler */ + mov w5, #1 SET_FAULT_HANDLER(x6, x4) /* And set it */ ENTER_USER_ACCESS(w6, x4) 1: ldxr w4, [x0] /* Load-exclusive the data */ cmp w4, w1 /* Compare */ b.ne 2f /* Not equal, exit */ stxr w5, w3, [x0] /* Store the new data */ - cbnz w5, 1b /* Retry on failure */ 2: EXIT_USER_ACCESS(w6) - SET_FAULT_HANDLER(xzr, x5) /* Reset the fault handler */ + SET_FAULT_HANDLER(xzr, x6) /* Reset the fault handler */ str w4, [x2] /* Store the read data */ - mov x0, #0 /* Success */ + mov w0, w5 /* Result same as store status */ ret /* Return */ END(casueword32) @@ -79,17 +79,17 @@ ENTRY(casueword) cmp x0, x4 b.cs fsu_fault_nopcb adr x6, fsu_fault /* Load the fault handler */ + mov w5, #1 SET_FAULT_HANDLER(x6, x4) /* And set it */ ENTER_USER_ACCESS(w6, x4) 1: ldxr x4, [x0] /* Load-exclusive the data */ cmp x4, x1 /* Compare */ b.ne 2f /* Not equal, exit */ stxr w5, x3, [x0] /* Store the new data */ - cbnz w5, 1b /* Retry on failure */ 2: EXIT_USER_ACCESS(w6) - SET_FAULT_HANDLER(xzr, x5) /* Reset the fault handler */ + SET_FAULT_HANDLER(xzr, x6) /* Reset the fault handler */ str x4, [x2] /* Store the read data */ - mov x0, #0 /* Success */ + mov w0, w5 /* Result same as store status */ ret /* Return */ END(casueword) Modified: head/sys/i386/i386/copyout.c ============================================================================== --- head/sys/i386/i386/copyout.c Fri Jul 12 18:39:41 2019 (r349950) +++ head/sys/i386/i386/copyout.c Fri Jul 12 18:43:24 2019 (r349951) @@ -428,6 +428,7 @@ suword32(volatile void *base, int32_t word) struct casueword_arg0 { uint32_t oldval; uint32_t newval; + int res; }; static void @@ -436,7 +437,8 @@ casueword_slow0(vm_offset_t kva, void *arg) struct casueword_arg0 *ca; ca = arg; - atomic_fcmpset_int((u_int *)kva, &ca->oldval, ca->newval); + ca->res = 1 - atomic_fcmpset_int((u_int *)kva, &ca->oldval, + ca->newval); } int @@ -452,7 +454,7 @@ casueword32(volatile uint32_t *base, uint32_t oldval, casueword_slow0, &ca); if (res == 0) { *oldvalp = ca.oldval; - return (0); + return (ca.res); } return (-1); } @@ -469,7 +471,7 @@ casueword(volatile u_long *base, u_long oldval, u_long casueword_slow0, &ca); if (res == 0) { *oldvalp = ca.oldval; - return (0); + return (ca.res); } return (-1); } Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Fri Jul 12 18:39:41 2019 (r349950) +++ head/sys/kern/kern_umtx.c Fri Jul 12 18:43:24 2019 (r349951) @@ -690,8 +690,26 @@ umtxq_count_pi(struct umtx_key *key, struct umtx_q **f return (0); } +/* + * Check for possible stops and suspensions while executing a umtx + * locking operation. + * + * The sleep argument controls whether the function can handle a stop + * request itself or it should return ERESTART and the request is + * proceed at the kernel/user boundary in ast. + * + * Typically, when retrying due to casueword(9) failure (rv == 1), we + * should handle the stop requests there, with exception of cases when + * the thread busied the umtx key, or when functions return + * immediately if umtxq_check_susp() returned non-zero. On the other + * hand, retrying the whole lock operation, we better not stop there + * but delegate the handling to ast. + * + * If the request is for thread termination P_SINGLE_EXIT, we cannot + * handle it at all, and simply return EINTR. + */ static int -umtxq_check_susp(struct thread *td) +umtxq_check_susp(struct thread *td, bool sleep) { struct proc *p; int error; @@ -710,7 +728,7 @@ umtxq_check_susp(struct thread *td) if (p->p_flag & P_SINGLE_EXIT) error = EINTR; else - error = ERESTART; + error = sleep ? thread_suspend_check(0) : ERESTART; } PROC_UNLOCK(p); return (error); @@ -1049,9 +1067,12 @@ do_lock_normal(struct thread *td, struct umutex *m, ui id | UMUTEX_CONTESTED); if (rv == -1) return (EFAULT); - if (owner == UMUTEX_RB_OWNERDEAD) + if (rv == 0) { + MPASS(owner == UMUTEX_RB_OWNERDEAD); return (EOWNERDEAD); /* success */ - rv = umtxq_check_susp(td); + } + MPASS(rv == 1); + rv = umtxq_check_susp(td, false); if (rv != 0) return (rv); continue; @@ -1070,13 +1091,16 @@ do_lock_normal(struct thread *td, struct umutex *m, ui return (EFAULT); /* The acquire succeeded. */ - if (owner == UMUTEX_UNOWNED) + if (rv == 0) { + MPASS(owner == UMUTEX_UNOWNED); return (0); + } /* * If no one owns it but it is contested try * to acquire it. */ + MPASS(rv == 1); if (owner == UMUTEX_CONTESTED) { rv = casueword32(&m->m_owner, UMUTEX_CONTESTED, &owner, @@ -1084,20 +1108,27 @@ do_lock_normal(struct thread *td, struct umutex *m, ui /* The address was invalid. */ if (rv == -1) return (EFAULT); - - if (owner == UMUTEX_CONTESTED) + if (rv == 0) { + MPASS(owner == UMUTEX_CONTESTED); return (0); + } + if (rv == 1) { + rv = umtxq_check_susp(td, false); + if (rv != 0) + return (rv); + } - rv = umtxq_check_susp(td); - if (rv != 0) - return (rv); - /* * If this failed the lock has * changed, restart. */ continue; } + + /* rv == 1 but not contested, likely store failure */ + rv = umtxq_check_susp(td, false); + if (rv != 0) + return (rv); } if (mode == _UMUTEX_TRY) @@ -1128,14 +1159,21 @@ do_lock_normal(struct thread *td, struct umutex *m, ui rv = casueword32(&m->m_owner, owner, &old, owner | UMUTEX_CONTESTED); - /* The address was invalid. */ - if (rv == -1) { + /* The address was invalid or casueword failed to store. */ + if (rv == -1 || rv == 1) { umtxq_lock(&uq->uq_key); umtxq_remove(uq); umtxq_unbusy(&uq->uq_key); umtxq_unlock(&uq->uq_key); umtx_key_release(&uq->uq_key); - return (EFAULT); + if (rv == -1) + return (EFAULT); + if (rv == 1) { + rv = umtxq_check_susp(td, false); + if (rv != 0) + return (rv); + } + continue; } /* @@ -1145,15 +1183,15 @@ do_lock_normal(struct thread *td, struct umutex *m, ui */ umtxq_lock(&uq->uq_key); umtxq_unbusy(&uq->uq_key); - if (old == owner) - error = umtxq_sleep(uq, "umtxn", timeout == NULL ? - NULL : &timo); + MPASS(old == owner); + error = umtxq_sleep(uq, "umtxn", timeout == NULL ? + NULL : &timo); umtxq_remove(uq); umtxq_unlock(&uq->uq_key); umtx_key_release(&uq->uq_key); if (error == 0) - error = umtxq_check_susp(td); + error = umtxq_check_susp(td, false); } return (0); @@ -1170,6 +1208,8 @@ do_unlock_normal(struct thread *td, struct umutex *m, int error, count; id = td->td_tid; + +again: /* * Make sure we own this mtx. */ @@ -1185,9 +1225,14 @@ do_unlock_normal(struct thread *td, struct umutex *m, error = casueword32(&m->m_owner, owner, &old, newlock); if (error == -1) return (EFAULT); - if (old == owner) - return (0); - owner = old; + if (error == 1) { + error = umtxq_check_susp(td, false); + if (error != 0) + return (error); + goto again; + } + MPASS(old == owner); + return (0); } /* We should only ever be in here for contested locks */ @@ -1215,8 +1260,14 @@ do_unlock_normal(struct thread *td, struct umutex *m, umtx_key_release(&key); if (error == -1) return (EFAULT); - if (old != owner) - return (EINVAL); + if (error == 1) { + if (old != owner) + return (EINVAL); + error = umtxq_check_susp(td, false); + if (error != 0) + return (error); + goto again; + } return (0); } @@ -1233,6 +1284,7 @@ do_wake_umutex(struct thread *td, struct umutex *m) int error; int count; +again: error = fueword32(&m->m_owner, &owner); if (error == -1) return (EFAULT); @@ -1259,14 +1311,27 @@ do_wake_umutex(struct thread *td, struct umutex *m) owner != UMUTEX_RB_NOTRECOV) { error = casueword32(&m->m_owner, UMUTEX_CONTESTED, &owner, UMUTEX_UNOWNED); - if (error == -1) + if (error == -1) { error = EFAULT; + } else if (error == 1) { + umtxq_lock(&key); + umtxq_unbusy(&key); + umtxq_unlock(&key); + umtx_key_release(&key); + error = umtxq_check_susp(td, false); + if (error != 0) + return (error); + goto again; + } } umtxq_lock(&key); - if (error == 0 && count != 0 && ((owner & ~UMUTEX_CONTESTED) == 0 || - owner == UMUTEX_RB_OWNERDEAD || owner == UMUTEX_RB_NOTRECOV)) + if (error == 0 && count != 0) { + MPASS((owner & ~UMUTEX_CONTESTED) == 0 || + owner == UMUTEX_RB_OWNERDEAD || + owner == UMUTEX_RB_NOTRECOV); umtxq_signal(&key, 1); + } umtxq_unbusy(&key); umtxq_unlock(&key); umtx_key_release(&key); @@ -1314,49 +1379,32 @@ do_wake2_umutex(struct thread *td, struct umutex *m, u umtxq_busy(&key); count = umtxq_count(&key); umtxq_unlock(&key); + + error = fueword32(&m->m_owner, &owner); + if (error == -1) + error = EFAULT; + /* - * Only repair contention bit if there is a waiter, this means the mutex - * is still being referenced by userland code, otherwise don't update - * any memory. + * Only repair contention bit if there is a waiter, this means + * the mutex is still being referenced by userland code, + * otherwise don't update any memory. */ - if (count > 1) { - error = fueword32(&m->m_owner, &owner); - if (error == -1) + while (error == 0 && (owner & UMUTEX_CONTESTED) == 0 && + (count > 1 || (count == 1 && (owner & ~UMUTEX_CONTESTED) != 0))) { + error = casueword32(&m->m_owner, owner, &old, + owner | UMUTEX_CONTESTED); + if (error == -1) { error = EFAULT; - while (error == 0 && (owner & UMUTEX_CONTESTED) == 0) { - error = casueword32(&m->m_owner, owner, &old, - owner | UMUTEX_CONTESTED); - if (error == -1) { - error = EFAULT; - break; - } - if (old == owner) - break; - owner = old; - error = umtxq_check_susp(td); - if (error != 0) - break; + break; } - } else if (count == 1) { - error = fueword32(&m->m_owner, &owner); - if (error == -1) - error = EFAULT; - while (error == 0 && (owner & ~UMUTEX_CONTESTED) != 0 && - (owner & UMUTEX_CONTESTED) == 0) { - error = casueword32(&m->m_owner, owner, &old, - owner | UMUTEX_CONTESTED); - if (error == -1) { - error = EFAULT; - break; - } - if (old == owner) - break; - owner = old; - error = umtxq_check_susp(td); - if (error != 0) - break; + if (error == 0) { + MPASS(old == owner); + break; } + owner = old; + error = umtxq_check_susp(td, false); } + umtxq_lock(&key); if (error == EFAULT) { umtxq_signal(&key, INT_MAX); @@ -1842,9 +1890,9 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32 error = EFAULT; break; } - /* The acquire succeeded. */ - if (owner == UMUTEX_UNOWNED) { + if (rv == 0) { + MPASS(owner == UMUTEX_UNOWNED); error = 0; break; } @@ -1854,6 +1902,16 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32 break; } + /* + * Avoid overwriting a possible error from sleep due + * to the pending signal with suspension check result. + */ + if (error == 0) { + error = umtxq_check_susp(td, true); + if (error != 0) + break; + } + /* If no one owns it but it is contested try to acquire it. */ if (owner == UMUTEX_CONTESTED || owner == UMUTEX_RB_OWNERDEAD) { old_owner = owner; @@ -1864,36 +1922,40 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32 error = EFAULT; break; } - - if (owner == old_owner) { - umtxq_lock(&uq->uq_key); - umtxq_busy(&uq->uq_key); - error = umtx_pi_claim(pi, td); - umtxq_unbusy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); - if (error != 0) { - /* - * Since we're going to return an - * error, restore the m_owner to its - * previous, unowned state to avoid - * compounding the problem. - */ - (void)casuword32(&m->m_owner, - id | UMUTEX_CONTESTED, - old_owner); + if (rv == 1) { + if (error == 0) { + error = umtxq_check_susp(td, true); + if (error != 0) + return (error); } - if (error == 0 && - old_owner == UMUTEX_RB_OWNERDEAD) - error = EOWNERDEAD; - break; + + /* + * If this failed the lock could + * changed, restart. + */ + continue; } - error = umtxq_check_susp(td); - if (error != 0) - break; - - /* If this failed the lock has changed, restart. */ - continue; + MPASS(rv == 0); + MPASS(owner == old_owner); + umtxq_lock(&uq->uq_key); + umtxq_busy(&uq->uq_key); + error = umtx_pi_claim(pi, td); + umtxq_unbusy(&uq->uq_key); + umtxq_unlock(&uq->uq_key); + if (error != 0) { + /* + * Since we're going to return an + * error, restore the m_owner to its + * previous, unowned state to avoid + * compounding the problem. + */ + (void)casuword32(&m->m_owner, + id | UMUTEX_CONTESTED, old_owner); + } + if (error == 0 && old_owner == UMUTEX_RB_OWNERDEAD) + error = EOWNERDEAD; + break; } if ((owner & ~UMUTEX_CONTESTED) == id) { @@ -1932,28 +1994,33 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32 error = EFAULT; break; } - - umtxq_lock(&uq->uq_key); - /* - * We set the contested bit, sleep. Otherwise the lock changed - * and we need to retry or we lost a race to the thread - * unlocking the umtx. Note that the UMUTEX_RB_OWNERDEAD - * value for owner is impossible there. - */ - if (old == owner) { - error = umtxq_sleep_pi(uq, pi, - owner & ~UMUTEX_CONTESTED, - "umtxpi", timeout == NULL ? NULL : &timo, - (flags & USYNC_PROCESS_SHARED) != 0); + if (rv == 1) { + umtxq_unbusy_unlocked(&uq->uq_key); + error = umtxq_check_susp(td, true); if (error != 0) - continue; - } else { - umtxq_unbusy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + break; + + /* + * The lock changed and we need to retry or we + * lost a race to the thread unlocking the + * umtx. Note that the UMUTEX_RB_OWNERDEAD + * value for owner is impossible there. + */ + continue; } - error = umtxq_check_susp(td); + umtxq_lock(&uq->uq_key); + + /* We set the contested bit, sleep. */ + MPASS(old == owner); + error = umtxq_sleep_pi(uq, pi, owner & ~UMUTEX_CONTESTED, + "umtxpi", timeout == NULL ? NULL : &timo, + (flags & USYNC_PROCESS_SHARED) != 0); if (error != 0) + continue; + + error = umtxq_check_susp(td, false); + if (error != 0) break; } @@ -1978,6 +2045,8 @@ do_unlock_pi(struct thread *td, struct umutex *m, uint int count, error, pri; id = td->td_tid; + +usrloop: /* * Make sure we own this mtx. */ @@ -1995,6 +2064,12 @@ do_unlock_pi(struct thread *td, struct umutex *m, uint error = casueword32(&m->m_owner, owner, &old, new_owner); if (error == -1) return (EFAULT); + if (error == 1) { + error = umtxq_check_susp(td, true); + if (error != 0) + return (error); + goto usrloop; + } if (old == owner) return (0); owner = old; @@ -2074,15 +2149,20 @@ do_unlock_pi(struct thread *td, struct umutex *m, uint if (count > 1) new_owner |= UMUTEX_CONTESTED; +again: error = casueword32(&m->m_owner, owner, &old, new_owner); - + if (error == 1) { + error = umtxq_check_susp(td, false); + if (error == 0) + goto again; + } umtxq_unbusy_unlocked(&key); umtx_key_release(&key); if (error == -1) return (EFAULT); - if (old != owner) + if (error == 0 && old != owner) return (EINVAL); - return (0); + return (error); } /* @@ -2149,31 +2229,49 @@ do_lock_pp(struct thread *td, struct umutex *m, uint32 error = EFAULT; break; } - - if (owner == UMUTEX_CONTESTED) { + if (rv == 0) { + MPASS(owner == UMUTEX_CONTESTED); error = 0; break; - } else if (owner == UMUTEX_RB_OWNERDEAD) { + } + /* rv == 1 */ + if (owner == UMUTEX_RB_OWNERDEAD) { rv = casueword32(&m->m_owner, UMUTEX_RB_OWNERDEAD, &owner, id | UMUTEX_CONTESTED); if (rv == -1) { error = EFAULT; break; } - if (owner == UMUTEX_RB_OWNERDEAD) { + if (rv == 0) { + MPASS(owner == UMUTEX_RB_OWNERDEAD); error = EOWNERDEAD; /* success */ break; } - error = 0; + + /* + * rv == 1, only check for suspension if we + * did not already catched a signal. If we + * get an error from the check, the same + * condition is checked by the umtxq_sleep() + * call below, so we should obliterate the + * error to not skip the last loop iteration. + */ + if (error == 0) { + error = umtxq_check_susp(td, false); + if (error == 0) { + if (try != 0) + error = EBUSY; + else + continue; + } + error = 0; + } } else if (owner == UMUTEX_RB_NOTRECOV) { error = ENOTRECOVERABLE; - break; } - if (try != 0) { + if (try != 0) error = EBUSY; - break; - } /* * If we caught a signal, we have retried and now @@ -2668,11 +2766,12 @@ do_rw_rdlock(struct thread *td, struct urwlock *rwlock umtx_key_release(&uq->uq_key); return (EFAULT); } - if (oldstate == state) { + if (rv == 0) { + MPASS(oldstate == state); umtx_key_release(&uq->uq_key); return (0); } - error = umtxq_check_susp(td); + error = umtxq_check_susp(td, true); if (error != 0) break; state = oldstate; @@ -2703,10 +2802,12 @@ do_rw_rdlock(struct thread *td, struct urwlock *rwlock error = EFAULT; break; } - if (oldstate == state) + if (rv == 0) { + MPASS(oldstate == state); goto sleep; + } state = oldstate; - error = umtxq_check_susp(td); + error = umtxq_check_susp(td, false); if (error != 0) break; } @@ -2718,7 +2819,7 @@ do_rw_rdlock(struct thread *td, struct urwlock *rwlock /* state is changed while setting flags, restart */ if (!(state & wrflags)) { umtxq_unbusy_unlocked(&uq->uq_key); - error = umtxq_check_susp(td); + error = umtxq_check_susp(td, true); if (error != 0) break; continue; @@ -2781,10 +2882,12 @@ sleep: error = EFAULT; break; } - if (oldstate == state) + if (rv == 0) { + MPASS(oldstate == state); break; + } state = oldstate; - error1 = umtxq_check_susp(td); + error1 = umtxq_check_susp(td, false); if (error1 != 0) { if (error == 0) error = error1; @@ -2840,22 +2943,25 @@ do_rw_wrlock(struct thread *td, struct urwlock *rwlock umtx_key_release(&uq->uq_key); return (EFAULT); } - if (oldstate == state) { + if (rv == 0) { + MPASS(oldstate == state); umtx_key_release(&uq->uq_key); return (0); } state = oldstate; - error = umtxq_check_susp(td); + error = umtxq_check_susp(td, true); if (error != 0) break; } if (error) { - if (!(state & (URWLOCK_WRITE_OWNER|URWLOCK_WRITE_WAITERS)) && + if ((state & (URWLOCK_WRITE_OWNER | + URWLOCK_WRITE_WAITERS)) == 0 && blocked_readers != 0) { umtxq_lock(&uq->uq_key); umtxq_busy(&uq->uq_key); - umtxq_signal_queue(&uq->uq_key, INT_MAX, UMTX_SHARED_QUEUE); + umtxq_signal_queue(&uq->uq_key, INT_MAX, + UMTX_SHARED_QUEUE); umtxq_unbusy(&uq->uq_key); umtxq_unlock(&uq->uq_key); } @@ -2885,10 +2991,12 @@ do_rw_wrlock(struct thread *td, struct urwlock *rwlock error = EFAULT; break; } - if (oldstate == state) + if (rv == 0) { + MPASS(oldstate == state); goto sleep; + } state = oldstate; - error = umtxq_check_susp(td); + error = umtxq_check_susp(td, false); if (error != 0) break; } @@ -2900,7 +3008,7 @@ do_rw_wrlock(struct thread *td, struct urwlock *rwlock if ((state & URWLOCK_WRITE_OWNER) == 0 && URWLOCK_READER_COUNT(state) == 0) { umtxq_unbusy_unlocked(&uq->uq_key); - error = umtxq_check_susp(td); + error = umtxq_check_susp(td, false); if (error != 0) break; continue; @@ -2958,10 +3066,12 @@ sleep: error = EFAULT; break; } - if (oldstate == state) + if (rv == 0) { + MPASS(oldstate == state); break; + } state = oldstate; - error1 = umtxq_check_susp(td); + error1 = umtxq_check_susp(td, false); /* * We are leaving the URWLOCK_WRITE_WAITERS * behind, but this should not harm the @@ -3021,13 +3131,13 @@ do_rw_unlock(struct thread *td, struct urwlock *rwlock error = EFAULT; goto out; } - if (oldstate != state) { + if (rv == 1) { state = oldstate; if (!(oldstate & URWLOCK_WRITE_OWNER)) { error = EPERM; goto out; } - error = umtxq_check_susp(td); + error = umtxq_check_susp(td, true); if (error != 0) goto out; } else @@ -3041,13 +3151,13 @@ do_rw_unlock(struct thread *td, struct urwlock *rwlock error = EFAULT; goto out; } - if (oldstate != state) { + if (rv == 1) { state = oldstate; if (URWLOCK_READER_COUNT(oldstate) == 0) { error = EPERM; goto out; } - error = umtxq_check_susp(td); + error = umtxq_check_susp(td, true); if (error != 0) goto out; } else @@ -3097,7 +3207,7 @@ do_sem_wait(struct thread *td, struct _usem *sem, stru struct abs_timeout timo; struct umtx_q *uq; uint32_t flags, count, count1; - int error, rv; + int error, rv, rv1; uq = td->td_umtxq; error = fueword32(&sem->_flags, &flags); @@ -3110,20 +3220,30 @@ do_sem_wait(struct thread *td, struct _usem *sem, stru if (timeout != NULL) abs_timeout_init2(&timo, timeout); +again: umtxq_lock(&uq->uq_key); umtxq_busy(&uq->uq_key); umtxq_insert(uq); umtxq_unlock(&uq->uq_key); rv = casueword32(&sem->_has_waiters, 0, &count1, 1); if (rv == 0) - rv = fueword32(&sem->_count, &count); - if (rv == -1 || count != 0) { + rv1 = fueword32(&sem->_count, &count); + if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) || rv == 1) { umtxq_lock(&uq->uq_key); umtxq_unbusy(&uq->uq_key); umtxq_remove(uq); umtxq_unlock(&uq->uq_key); - umtx_key_release(&uq->uq_key); - return (rv == -1 ? EFAULT : 0); + if (rv == 1) { + rv = umtxq_check_susp(td, true); + if (rv == 0) + goto again; + error = rv; + goto out; + } + if (rv == 0) + rv = rv1; + error = rv == -1 ? EFAULT : 0; + goto out; } umtxq_lock(&uq->uq_key); umtxq_unbusy(&uq->uq_key); @@ -3140,6 +3260,7 @@ do_sem_wait(struct thread *td, struct _usem *sem, stru error = EINTR; } umtxq_unlock(&uq->uq_key); +out: umtx_key_release(&uq->uq_key); return (error); } @@ -3201,6 +3322,7 @@ do_sem2_wait(struct thread *td, struct _usem2 *sem, st if (timeout != NULL) abs_timeout_init2(&timo, timeout); +again: umtxq_lock(&uq->uq_key); umtxq_busy(&uq->uq_key); umtxq_insert(uq); @@ -3226,16 +3348,19 @@ do_sem2_wait(struct thread *td, struct _usem2 *sem, st if (count == USEM_HAS_WAITERS) break; rv = casueword32(&sem->_count, 0, &count, USEM_HAS_WAITERS); - if (rv == -1) { - umtxq_lock(&uq->uq_key); - umtxq_unbusy(&uq->uq_key); - umtxq_remove(uq); - umtxq_unlock(&uq->uq_key); - umtx_key_release(&uq->uq_key); - return (EFAULT); - } - if (count == 0) + if (rv == 0) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Jul 12 18:50:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09E6B15D2FBC; Fri, 12 Jul 2019 18:50:47 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A191C86C64; Fri, 12 Jul 2019 18:50:46 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 717201AA1C; Fri, 12 Jul 2019 18:50:46 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CIokN7045347; Fri, 12 Jul 2019 18:50:46 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CIokN8045346; Fri, 12 Jul 2019 18:50:46 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907121850.x6CIokN8045346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Fri, 12 Jul 2019 18:50:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349952 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349952 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A191C86C64 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 18:50:47 -0000 Author: seanc (ports committer) Date: Fri Jul 12 18:50:46 2019 New Revision: 349952 URL: https://svnweb.freebsd.org/changeset/base/349952 Log: usr.sbin/bhyve: close backend file descriptor during tap init error Coverity CID: 1402953 Reviewed by: scottl, markj, aleksandr.fedorov -at- itglobal.com Approved by: vmaffione, jhb Differential Revision: https://reviews.freebsd.org/D20913 Modified: head/usr.sbin/bhyve/net_backends.c Modified: head/usr.sbin/bhyve/net_backends.c ============================================================================== --- head/usr.sbin/bhyve/net_backends.c Fri Jul 12 18:43:24 2019 (r349951) +++ head/usr.sbin/bhyve/net_backends.c Fri Jul 12 18:50:46 2019 (r349952) @@ -175,7 +175,6 @@ tap_init(struct net_backend *be, const char *devname, { struct tap_priv *priv = (struct tap_priv *)be->opaque; char tbuf[80]; - int fd; int opt = 1; #ifndef WITHOUT_CAPSICUM cap_rights_t rights; @@ -189,8 +188,8 @@ tap_init(struct net_backend *be, const char *devname, strcpy(tbuf, "/dev/"); strlcat(tbuf, devname, sizeof(tbuf)); - fd = open(tbuf, O_RDWR); - if (fd == -1) { + be->fd = open(tbuf, O_RDWR); + if (be->fd == -1) { WPRINTF(("open of tap device %s failed\n", tbuf)); goto error; } @@ -199,24 +198,22 @@ tap_init(struct net_backend *be, const char *devname, * Set non-blocking and register for read * notifications with the event loop */ - if (ioctl(fd, FIONBIO, &opt) < 0) { + if (ioctl(be->fd, FIONBIO, &opt) < 0) { WPRINTF(("tap device O_NONBLOCK failed\n")); goto error; } #ifndef WITHOUT_CAPSICUM cap_rights_init(&rights, CAP_EVENT, CAP_READ, CAP_WRITE); - if (caph_rights_limit(fd, &rights) == -1) + if (caph_rights_limit(be->fd, &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif - priv->mevp = mevent_add(fd, EVF_READ, cb, param); + priv->mevp = mevent_add(be->fd, EVF_READ, cb, param); if (priv->mevp == NULL) { WPRINTF(("Could not register event\n")); goto error; } - - be->fd = fd; return (0); From owner-svn-src-head@freebsd.org Fri Jul 12 19:14:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 457FA15D3CEF; Fri, 12 Jul 2019 19:14:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE71E87FA2; Fri, 12 Jul 2019 19:14:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2DF91AF38; Fri, 12 Jul 2019 19:14:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CJEq3N059858; Fri, 12 Jul 2019 19:14:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CJEqa6059857; Fri, 12 Jul 2019 19:14:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201907121914.x6CJEqa6059857@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 12 Jul 2019 19:14:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349953 - head/sys/amd64/vmm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/vmm X-SVN-Commit-Revision: 349953 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DE71E87FA2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.929,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 19:14:53 -0000 Author: kib Date: Fri Jul 12 19:14:52 2019 New Revision: 349953 URL: https://svnweb.freebsd.org/changeset/base/349953 Log: Fix syntax. Nod from: jhb Sponsored by: The FreeBSD Foundation Modified: head/sys/amd64/vmm/vmm_dev.c Modified: head/sys/amd64/vmm/vmm_dev.c ============================================================================== --- head/sys/amd64/vmm/vmm_dev.c Fri Jul 12 18:50:46 2019 (r349952) +++ head/sys/amd64/vmm/vmm_dev.c Fri Jul 12 19:14:52 2019 (r349953) @@ -291,7 +291,7 @@ alloc_memseg(struct vmmdev_softc *sc, struct vm_memseg */ if (VM_MEMSEG_NAME(mseg)) { sysmem = false; - name = malloc(sizeof(mseg->name) M_VMMDEV, M_WAITOK); + name = malloc(sizeof(mseg->name), M_VMMDEV, M_WAITOK); error = copystr(mseg->name, name, sizeof(mseg->name), NULL); if (error) goto done; From owner-svn-src-head@freebsd.org Fri Jul 12 19:28:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A242015D47D3; Fri, 12 Jul 2019 19:28:42 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.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 3A76388BF3; Fri, 12 Jul 2019 19:28:42 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 0F99F2BD; Fri, 12 Jul 2019 15:28:39 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 12 Jul 2019 15:28:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm3; bh=H Z2Q0OpgJqfOd6/pAPhVWpvDuwb7Ex2DiBOgSk/iJH4=; b=Fyu2tk5d0zHE+Cdhk zqxnakltfD6XojjF3REUQe70KB5shIziCD+avVSlUrMa4vDc+Zc5mflutvruWj3A nOg+xtxecytOdMuFUNwfiBui/rzHyr/+8Pbke8xC5ESkrpAPkmspY78MJhbB3Vf/ CM2wr1Vytc3v4fMxe8hiURuRNr2fzgn4MWXilZL6c+ZP5oktLQF78HI3JjLFuqdC VIVzVmgFnfVr1EHDM/+tIj2u3qvDJGAsOuDD1d5U2ShdBacJahE1C6CIi21aE0Xr L7V5dVk6CYvtPO1n/LY8FAWRu3AiA/yhiihtqvDkBh8KwmRNN7gw7SpMsRGBi1gS E8h/Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=HZ2Q0OpgJqfOd6/pAPhVWpvDuwb7Ex2DiBOgSk/iJ H4=; b=OmmYv+hMYAahwIkpKQJnGsFFIm56L8vqzTPby4J3ch6vgy/HxHoZ9AOjC ILkHCtZ8arijb34Ag0vealsZqQvUY5+aCIMDFWz6wnpfOBapdqgd5brl8Kf9/7S6 VJrvI1iRoeQ19feWuGTM0+2pyHMdJNuBGBWkxkkE/fLl28rs7UHJ2lZITGupYuvX N4uR3vqp2fuAJsPwRz7sqIt9ceo7Z/qG1vtF6eFSJmlZuWs2WrVJ1TELvWThHLge S9bJB8NUCk2wwxZdUL++l+XdgRc+WcwcnYBF1SN7eoU+Lm57ZZF+zD/5eBFio0DW Cv1mOlJRldvAzkLhlYNQyoI3URGlw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrhedtgddufeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpegtggfuhfgjfffgkfhfvffosehtqh hmtdhhtddvnecuhfhrohhmpefutghothhtucfnohhnghcuoehstghothhtlhesshgrmhhs tghordhorhhgqeenucffohhmrghinhepfhhrvggvsghsugdrohhrghenucfkphepkedrge eirdekledrvddufeenucfrrghrrghmpehmrghilhhfrhhomhepshgtohhtthhlsehsrghm shgtohdrohhrghenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.0.146] (unknown [8.46.89.213]) by mail.messagingengine.com (Postfix) with ESMTPA id C4D63380075; Fri, 12 Jul 2019 15:28:38 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r349953 - head/sys/amd64/vmm From: Scott Long In-Reply-To: <201907121914.x6CJEqa6059857@repo.freebsd.org> Date: Fri, 12 Jul 2019 13:28:38 -0600 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201907121914.x6CJEqa6059857@repo.freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 3A76388BF3 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.95)[-0.948,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 19:28:42 -0000 Thanks, sorry about that, I had compiled and tested this a dozen times = before committing, not sure how this crept in. Scott > On Jul 12, 2019, at 1:14 PM, Konstantin Belousov = wrote: >=20 > Author: kib > Date: Fri Jul 12 19:14:52 2019 > New Revision: 349953 > URL: https://svnweb.freebsd.org/changeset/base/349953 >=20 > Log: > Fix syntax. >=20 > Nod from: jhb > Sponsored by: The FreeBSD Foundation >=20 > Modified: > head/sys/amd64/vmm/vmm_dev.c >=20 > Modified: head/sys/amd64/vmm/vmm_dev.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/amd64/vmm/vmm_dev.c Fri Jul 12 18:50:46 2019 = (r349952) > +++ head/sys/amd64/vmm/vmm_dev.c Fri Jul 12 19:14:52 2019 = (r349953) > @@ -291,7 +291,7 @@ alloc_memseg(struct vmmdev_softc *sc, struct = vm_memseg > */ > if (VM_MEMSEG_NAME(mseg)) { > sysmem =3D false; > - name =3D malloc(sizeof(mseg->name) M_VMMDEV, M_WAITOK); > + name =3D malloc(sizeof(mseg->name), M_VMMDEV, M_WAITOK); > error =3D copystr(mseg->name, name, sizeof(mseg->name), = NULL); > if (error) > goto done; >=20 From owner-svn-src-head@freebsd.org Fri Jul 12 20:59:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C6B215D6380; Fri, 12 Jul 2019 20:59:11 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0EBB58BFD0; Fri, 12 Jul 2019 20:59:11 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA7481C0B5; Fri, 12 Jul 2019 20:59:10 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CKxAQi012111; Fri, 12 Jul 2019 20:59:10 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CKxAoY012110; Fri, 12 Jul 2019 20:59:10 GMT (envelope-from np@FreeBSD.org) Message-Id: <201907122059.x6CKxAoY012110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 12 Jul 2019 20:59:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349956 - head/sys/dev/cxgbe/common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/common X-SVN-Commit-Revision: 349956 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0EBB58BFD0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 20:59:11 -0000 Author: np Date: Fri Jul 12 20:59:10 2019 New Revision: 349956 URL: https://svnweb.freebsd.org/changeset/base/349956 Log: cxgbe(4): Completely ignore all top level interrupts that are not enabled. The driver used to log any non-zero cause and when running with a single line interrupt it would spam the console/logs with reports of interrupts that are of no interest to anyone. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Fri Jul 12 20:05:30 2019 (r349955) +++ head/sys/dev/cxgbe/common/t4_hw.c Fri Jul 12 20:59:10 2019 (r349956) @@ -4023,17 +4023,16 @@ t4_handle_intr(struct adapter *adap, const struct intr bool rc; const struct intr_action *action; - /* read and display cause. */ - cause = t4_read_reg(adap, ii->cause_reg); - if (verbose || cause != 0) - t4_show_intr_info(adap, ii, cause); /* - * The top level interrupt cause is a bit special and we need to ignore - * the bits that are not in the enable. Note that we did display them - * above in t4_show_intr_info but will not clear them. + * Read and display cause. Note that the top level PL_INT_CAUSE is a + * bit special and we need to completely ignore the bits that are not in + * PL_INT_ENABLE. */ + cause = t4_read_reg(adap, ii->cause_reg); if (ii->cause_reg == A_PL_INT_CAUSE) cause &= t4_read_reg(adap, ii->enable_reg); + if (verbose || cause != 0) + t4_show_intr_info(adap, ii, cause); fatal = cause & ii->fatal; if (fatal != 0 && ii->flags & NONFATAL_IF_DISABLED) fatal &= t4_read_reg(adap, ii->enable_reg); From owner-svn-src-head@freebsd.org Fri Jul 12 21:19:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 701C015D6BDE; Fri, 12 Jul 2019 21:19:48 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 134C48CBF9; Fri, 12 Jul 2019 21:19:48 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DBA7A1C417; Fri, 12 Jul 2019 21:19:47 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CLJl1Q022278; Fri, 12 Jul 2019 21:19:47 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CLJlrw022277; Fri, 12 Jul 2019 21:19:47 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201907122119.x6CLJlrw022277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Fri, 12 Jul 2019 21:19:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349957 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: tijl X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 349957 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 134C48CBF9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 21:19:48 -0000 Author: tijl Date: Fri Jul 12 21:19:47 2019 New Revision: 349957 URL: https://svnweb.freebsd.org/changeset/base/349957 Log: Fix layout. -C needs to be styled as a flag here, not as a new list item. MFC after: 2 weeks Modified: head/usr.bin/top/top.1 Modified: head/usr.bin/top/top.1 ============================================================================== --- head/usr.bin/top/top.1 Fri Jul 12 20:59:10 2019 (r349956) +++ head/usr.bin/top/top.1 Fri Jul 12 21:19:47 2019 (r349957) @@ -51,7 +51,7 @@ By default top displays the weighted CPU percentage in .Xr ps 1 displays as CPU). Each time -.It Fl C +.Fl C flag is passed it toggles between \*(lqraw cpu\*(rq mode and \*(lqweighted cpu\*(rq mode, showing the \*(lqCPU\*(rq or the \*(lqWCPU\*(rq column respectively. From owner-svn-src-head@freebsd.org Sat Jul 13 00:19:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E67CD15DADA1; Sat, 13 Jul 2019 00:19:58 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8837B9304E; Sat, 13 Jul 2019 00:19:58 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58F921E255; Sat, 13 Jul 2019 00:19:58 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6D0Jw4K015754; Sat, 13 Jul 2019 00:19:58 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6D0JwlU015753; Sat, 13 Jul 2019 00:19:58 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201907130019.x6D0JwlU015753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 13 Jul 2019 00:19:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349960 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 349960 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8837B9304E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 00:19:59 -0000 Author: jhibbits Date: Sat Jul 13 00:19:57 2019 New Revision: 349960 URL: https://svnweb.freebsd.org/changeset/base/349960 Log: Set pcpu curpmap for powerpc64 Summary: If an illegal instruction is encountered on a process running on a powerpc64 kernel it would attempt to sync the cache before retrying the instruction "just in case". However, since curpmap is not set, when moea64_sync_icache() attempts to lock the pmap, it's locking on a NULL pointer, triggering a panic. Fix this by adding a (assumed unnecessary) fallback to curthread's pmap in moea64_sync_icache(). Reported by: alfredo.junior_eldorado.org.br Reviewed by: luporl, alfredo.junior_eldorado.org.br Differential Revision: https://reviews.freebsd.org/D20911 Modified: head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Sat Jul 13 00:12:35 2019 (r349959) +++ head/sys/powerpc/aim/mmu_oea64.c Sat Jul 13 00:19:57 2019 (r349960) @@ -2838,6 +2838,9 @@ moea64_sync_icache(mmu_t mmu, pmap_t pm, vm_offset_t v vm_paddr_t pa; vm_size_t len; + if (__predict_false(pm == NULL)) + pm = &curthread->td_proc->p_vmspace->vm_pmap; + PMAP_LOCK(pm); while (sz > 0) { lim = round_page(va+1); From owner-svn-src-head@freebsd.org Sat Jul 13 03:02:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D36E15DDF8D; Sat, 13 Jul 2019 03:02:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C770368561; Sat, 13 Jul 2019 03:02:12 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2BFC1FF0F; Sat, 13 Jul 2019 03:02:12 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6D32CBw007468; Sat, 13 Jul 2019 03:02:12 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6D32CEE007467; Sat, 13 Jul 2019 03:02:12 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201907130302.x6D32CEE007467@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 13 Jul 2019 03:02:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349963 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 349963 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C770368561 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 03:02:13 -0000 Author: jhibbits Date: Sat Jul 13 03:02:11 2019 New Revision: 349963 URL: https://svnweb.freebsd.org/changeset/base/349963 Log: powerpc64/pmap: Reduce scope of PV_LOCK in remove path Summary: Since the 'page pv' lock is one of the most highly contended locks, we need to try to do as much work outside of the lock as we can. The moea64_pvo_remove_from_page() path is a low hanging fruit, where we can do some heavy work (PHYS_TO_VM_PAGE()) outside of the lock if needed. In one path, moea64_remove_all(), the PV lock is already held and can't be swizzled, so we provide two ways to perform the locked operation, one that can call PHYS_TO_VM_PAGE outside the lock, and one that calls with the lock already held. Reviewed By: luporl Differential Revision: https://reviews.freebsd.org/D20694 Modified: head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Sat Jul 13 00:51:11 2019 (r349962) +++ head/sys/powerpc/aim/mmu_oea64.c Sat Jul 13 03:02:11 2019 (r349963) @@ -234,6 +234,8 @@ static int moea64_pvo_enter(mmu_t mmu, struct pvo_entr struct pvo_head *pvo_head); static void moea64_pvo_remove_from_pmap(mmu_t mmu, struct pvo_entry *pvo); static void moea64_pvo_remove_from_page(mmu_t mmu, struct pvo_entry *pvo); +static void moea64_pvo_remove_from_page_locked(mmu_t mmu, + struct pvo_entry *pvo); static struct pvo_entry *moea64_pvo_find_va(pmap_t, vm_offset_t); /* @@ -1454,9 +1456,7 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_offset_t va, v /* Free any dead pages */ if (oldpvo != NULL) { - PV_LOCK(oldpvo->pvo_pte.pa & LPTE_RPGN); moea64_pvo_remove_from_page(mmu, oldpvo); - PV_UNLOCK(oldpvo->pvo_pte.pa & LPTE_RPGN); free_pvo_entry(oldpvo); } @@ -1877,9 +1877,7 @@ moea64_kenter_attr(mmu_t mmu, vm_offset_t va, vm_paddr /* Free any dead pages */ if (oldpvo != NULL) { - PV_LOCK(oldpvo->pvo_pte.pa & LPTE_RPGN); moea64_pvo_remove_from_page(mmu, oldpvo); - PV_UNLOCK(oldpvo->pvo_pte.pa & LPTE_RPGN); free_pvo_entry(oldpvo); } @@ -2386,9 +2384,7 @@ moea64_remove_pages(mmu_t mmu, pmap_t pm) PMAP_UNLOCK(pm); RB_FOREACH_SAFE(pvo, pvo_tree, &tofree, tpvo) { - PV_LOCK(pvo->pvo_pte.pa & LPTE_RPGN); moea64_pvo_remove_from_page(mmu, pvo); - PV_UNLOCK(pvo->pvo_pte.pa & LPTE_RPGN); RB_REMOVE(pvo_tree, &tofree, pvo); free_pvo_entry(pvo); } @@ -2429,9 +2425,7 @@ moea64_remove(mmu_t mmu, pmap_t pm, vm_offset_t sva, v PMAP_UNLOCK(pm); RB_FOREACH_SAFE(pvo, pvo_tree, &tofree, tpvo) { - PV_LOCK(pvo->pvo_pte.pa & LPTE_RPGN); moea64_pvo_remove_from_page(mmu, pvo); - PV_UNLOCK(pvo->pvo_pte.pa & LPTE_RPGN); RB_REMOVE(pvo_tree, &tofree, pvo); free_pvo_entry(pvo); } @@ -2458,7 +2452,7 @@ moea64_remove_all(mmu_t mmu, vm_page_t m) wasdead = (pvo->pvo_vaddr & PVO_DEAD); if (!wasdead) moea64_pvo_remove_from_pmap(mmu, pvo); - moea64_pvo_remove_from_page(mmu, pvo); + moea64_pvo_remove_from_page_locked(mmu, pvo); if (!wasdead) LIST_INSERT_HEAD(&freequeue, pvo, pvo_vlink); PMAP_UNLOCK(pmap); @@ -2631,10 +2625,10 @@ moea64_pvo_remove_from_pmap(mmu_t mmu, struct pvo_entr } } -static void -moea64_pvo_remove_from_page(mmu_t mmu, struct pvo_entry *pvo) +static inline void +_moea64_pvo_remove_from_page_locked(mmu_t mmu, struct pvo_entry *pvo, + vm_page_t m) { - struct vm_page *pg; KASSERT(pvo->pvo_vaddr & PVO_DEAD, ("Trying to delink live page")); @@ -2648,18 +2642,40 @@ moea64_pvo_remove_from_page(mmu_t mmu, struct pvo_entr */ PV_LOCKASSERT(pvo->pvo_pte.pa & LPTE_RPGN); if (pvo->pvo_vaddr & PVO_MANAGED) { - pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.pa & LPTE_RPGN); - - if (pg != NULL) { + if (m != NULL) { LIST_REMOVE(pvo, pvo_vlink); - if (LIST_EMPTY(vm_page_to_pvoh(pg))) - vm_page_aflag_clear(pg, + if (LIST_EMPTY(vm_page_to_pvoh(m))) + vm_page_aflag_clear(m, PGA_WRITEABLE | PGA_EXECUTABLE); } } moea64_pvo_entries--; moea64_pvo_remove_calls++; +} + +static void +moea64_pvo_remove_from_page_locked(mmu_t mmu, struct pvo_entry *pvo) +{ + vm_page_t pg = NULL; + + if (pvo->pvo_vaddr & PVO_MANAGED) + pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.pa & LPTE_RPGN); + + _moea64_pvo_remove_from_page_locked(mmu, pvo, pg); +} + +static void +moea64_pvo_remove_from_page(mmu_t mmu, struct pvo_entry *pvo) +{ + vm_page_t pg = NULL; + + if (pvo->pvo_vaddr & PVO_MANAGED) + pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.pa & LPTE_RPGN); + + PV_LOCK(pvo->pvo_pte.pa & LPTE_RPGN); + _moea64_pvo_remove_from_page_locked(mmu, pvo, pg); + PV_UNLOCK(pvo->pvo_pte.pa & LPTE_RPGN); } static struct pvo_entry * From owner-svn-src-head@freebsd.org Sat Jul 13 03:22:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 054AB15DE5A6; Sat, 13 Jul 2019 03:22:30 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9CAE76A509; Sat, 13 Jul 2019 03:22:29 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 782A5202BC; Sat, 13 Jul 2019 03:22:29 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6D3MTsj020110; Sat, 13 Jul 2019 03:22:29 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6D3MT0R020108; Sat, 13 Jul 2019 03:22:29 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907130322.x6D3MT0R020108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 13 Jul 2019 03:22:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349964 - head/sbin/camcontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/camcontrol X-SVN-Commit-Revision: 349964 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9CAE76A509 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 03:22:30 -0000 Author: imp Date: Sat Jul 13 03:22:28 2019 New Revision: 349964 URL: https://svnweb.freebsd.org/changeset/base/349964 Log: Add device type NVME and device type MMCSD to get_device_type For completeness, add nvme and mmc/sd devices to the list of device types we know. Modified: head/sbin/camcontrol/camcontrol.c head/sbin/camcontrol/camcontrol.h Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Sat Jul 13 03:02:11 2019 (r349963) +++ head/sbin/camcontrol/camcontrol.c Sat Jul 13 03:22:28 2019 (r349964) @@ -5366,6 +5366,14 @@ get_device_type(struct cam_device *dev, int retry_coun *devtype = CC_DT_ATA; goto bailout; break; /*NOTREACHED*/ + case PROTO_NVME: + *devtype = CC_DT_NVME; + goto bailout; + break; /*NOTREACHED*/ + case PROTO_MMCSD: + *devtype = CC_DT_MMCSD; + goto bailout; + break; /*NOTREACHED*/ default: *devtype = CC_DT_UNKNOWN; goto bailout; Modified: head/sbin/camcontrol/camcontrol.h ============================================================================== --- head/sbin/camcontrol/camcontrol.h Sat Jul 13 03:02:11 2019 (r349963) +++ head/sbin/camcontrol/camcontrol.h Sat Jul 13 03:22:28 2019 (r349964) @@ -44,6 +44,8 @@ typedef enum { CC_DT_SCSI, CC_DT_ATA_BEHIND_SCSI, CC_DT_ATA, + CC_DT_NVME, + CC_DT_MMCSD, CC_DT_UNKNOWN } camcontrol_devtype; From owner-svn-src-head@freebsd.org Sat Jul 13 03:39:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC34D15DE94E; Sat, 13 Jul 2019 03:39:47 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4065E6AC62; Sat, 13 Jul 2019 03:39:47 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F167720475; Sat, 13 Jul 2019 03:39:46 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6D3dkg0026075; Sat, 13 Jul 2019 03:39:46 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6D3dk6N026074; Sat, 13 Jul 2019 03:39:46 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201907130339.x6D3dk6N026074@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 13 Jul 2019 03:39:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349965 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 349965 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4065E6AC62 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 03:39:47 -0000 Author: jhibbits Date: Sat Jul 13 03:39:46 2019 New Revision: 349965 URL: https://svnweb.freebsd.org/changeset/base/349965 Log: powerpc64/pmap: No need for moea64_pvo_remove_from_page_locked() wrapper The only consumer of moea64_pvo_remove_from_page_locked() already has the page in hand, so there is no need to search for the page while holding the lock. Drop the wrapper, and rename _moea64_pvo_remove_from_page_locked(). Reported by: alc Modified: head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Sat Jul 13 03:22:28 2019 (r349964) +++ head/sys/powerpc/aim/mmu_oea64.c Sat Jul 13 03:39:46 2019 (r349965) @@ -235,7 +235,7 @@ static int moea64_pvo_enter(mmu_t mmu, struct pvo_entr static void moea64_pvo_remove_from_pmap(mmu_t mmu, struct pvo_entry *pvo); static void moea64_pvo_remove_from_page(mmu_t mmu, struct pvo_entry *pvo); static void moea64_pvo_remove_from_page_locked(mmu_t mmu, - struct pvo_entry *pvo); + struct pvo_entry *pvo, vm_page_t m); static struct pvo_entry *moea64_pvo_find_va(pmap_t, vm_offset_t); /* @@ -2452,7 +2452,7 @@ moea64_remove_all(mmu_t mmu, vm_page_t m) wasdead = (pvo->pvo_vaddr & PVO_DEAD); if (!wasdead) moea64_pvo_remove_from_pmap(mmu, pvo); - moea64_pvo_remove_from_page_locked(mmu, pvo); + moea64_pvo_remove_from_page_locked(mmu, pvo, m); if (!wasdead) LIST_INSERT_HEAD(&freequeue, pvo, pvo_vlink); PMAP_UNLOCK(pmap); @@ -2626,7 +2626,7 @@ moea64_pvo_remove_from_pmap(mmu_t mmu, struct pvo_entr } static inline void -_moea64_pvo_remove_from_page_locked(mmu_t mmu, struct pvo_entry *pvo, +moea64_pvo_remove_from_page_locked(mmu_t mmu, struct pvo_entry *pvo, vm_page_t m) { @@ -2655,17 +2655,6 @@ _moea64_pvo_remove_from_page_locked(mmu_t mmu, struct } static void -moea64_pvo_remove_from_page_locked(mmu_t mmu, struct pvo_entry *pvo) -{ - vm_page_t pg = NULL; - - if (pvo->pvo_vaddr & PVO_MANAGED) - pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.pa & LPTE_RPGN); - - _moea64_pvo_remove_from_page_locked(mmu, pvo, pg); -} - -static void moea64_pvo_remove_from_page(mmu_t mmu, struct pvo_entry *pvo) { vm_page_t pg = NULL; @@ -2674,7 +2663,7 @@ moea64_pvo_remove_from_page(mmu_t mmu, struct pvo_entr pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.pa & LPTE_RPGN); PV_LOCK(pvo->pvo_pte.pa & LPTE_RPGN); - _moea64_pvo_remove_from_page_locked(mmu, pvo, pg); + moea64_pvo_remove_from_page_locked(mmu, pvo, pg); PV_UNLOCK(pvo->pvo_pte.pa & LPTE_RPGN); } From owner-svn-src-head@freebsd.org Sat Jul 13 08:08:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9378615E3342; Sat, 13 Jul 2019 08:08:26 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 244B973668; Sat, 13 Jul 2019 08:08:26 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F2709231BB; Sat, 13 Jul 2019 08:08:25 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6D88Pte085343; Sat, 13 Jul 2019 08:08:25 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6D88PH2085342; Sat, 13 Jul 2019 08:08:25 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201907130808.x6D88PH2085342@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Sat, 13 Jul 2019 08:08:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349966 - head/sys/dev/netmap X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/sys/dev/netmap X-SVN-Commit-Revision: 349966 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 244B973668 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.90 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.90)[-0.899,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 08:08:26 -0000 Author: vmaffione Date: Sat Jul 13 08:08:25 2019 New Revision: 349966 URL: https://svnweb.freebsd.org/changeset/base/349966 Log: netmap: fix bug introduced by r349752 r349752 introduced a NULL pointer reference bug in the emulated netmap code. Reported by: lwhsu MFC after: 3 days Modified: head/sys/dev/netmap/netmap_generic.c Modified: head/sys/dev/netmap/netmap_generic.c ============================================================================== --- head/sys/dev/netmap/netmap_generic.c Sat Jul 13 03:39:46 2019 (r349965) +++ head/sys/dev/netmap/netmap_generic.c Sat Jul 13 08:08:25 2019 (r349966) @@ -1126,7 +1126,8 @@ generic_netmap_attach(struct ifnet *ifp) nm_os_generic_set_features(gna); - nm_prinf("Emulated adapter for %s created (prev was %s)", na->name, gna->prev->name); + nm_prinf("Emulated adapter for %s created (prev was %s)", na->name, + gna->prev ? gna->prev->name : "NULL"); return retval; } From owner-svn-src-head@freebsd.org Sat Jul 13 12:45:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26DAE15E8998; Sat, 13 Jul 2019 12:45:10 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BBFFB850A2; Sat, 13 Jul 2019 12:45:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 57A1625FF7; Sat, 13 Jul 2019 12:45:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6DCj90d050355; Sat, 13 Jul 2019 12:45:09 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6DCj9iK050354; Sat, 13 Jul 2019 12:45:09 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201907131245.x6DCj9iK050354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 13 Jul 2019 12:45:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349968 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 349968 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BBFFB850A2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 12:45:10 -0000 Author: tuexen Date: Sat Jul 13 12:45:08 2019 New Revision: 349968 URL: https://svnweb.freebsd.org/changeset/base/349968 Log: r348494 fixes a race in udp_output(). The same race exists in udp_output6(), therefore apply a similar patch to IPv6. Reported by: syzbot+c5ffbc8f14294c7b0e54@syzkaller.appspotmail.com Reviewed by: bz@, markj@ MFC after: 2 weeks Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D20936 Modified: head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Sat Jul 13 10:46:01 2019 (r349967) +++ head/sys/netinet6/udp6_usrreq.c Sat Jul 13 12:45:08 2019 (r349968) @@ -742,9 +742,24 @@ udp6_output(struct socket *so, int flags_arg, struct m * - when we are not bound to an address and source port (it is * in6_pcbsetport() which will require the write lock). */ +retry: if (sin6 == NULL || (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) && inp->inp_lport == 0)) { INP_WLOCK(inp); + /* + * In case we lost a race and another thread bound addr/port + * on the inp we cannot keep the wlock (which still would be + * fine) as further down, based on these values we make + * decisions for the pcbinfo lock. If the locks are not in + * synch the assertions on unlock will fire, hence we go for + * one retry loop. + */ + if (sin6 != NULL && + (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) || + inp->inp_lport != 0)) { + INP_WUNLOCK(inp); + goto retry; + } unlock_inp = UH_WLOCKED; } else { INP_RLOCK(inp); From owner-svn-src-head@freebsd.org Sat Jul 13 12:48:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C2C715E8A38; Sat, 13 Jul 2019 12:48:30 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9F33385273; Sat, 13 Jul 2019 12:48:29 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F6BE25FFF; Sat, 13 Jul 2019 12:48:29 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6DCmTT8050523; Sat, 13 Jul 2019 12:48:29 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6DCmTgG050521; Sat, 13 Jul 2019 12:48:29 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <201907131248.x6DCmTgG050521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Sat, 13 Jul 2019 12:48:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349969 - in head: sys/net usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: in head: sys/net usr.sbin/bhyve X-SVN-Commit-Revision: 349969 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9F33385273 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 12:48:30 -0000 Author: chuck Date: Sat Jul 13 12:48:28 2019 New Revision: 349969 URL: https://svnweb.freebsd.org/changeset/base/349969 Log: bhyve: Create EUI64 for NVMe namespaces Accept an IEEE Extended Unique Identifier (EUI-64) from the command line for each NVMe namespace. If one isn't provided, it will create one based on the CRC16 of: - the FreeBSD IEEE OUI - PCI bus, device/slot, function values - Namespace ID Reviewed by: imp, araujo, jhb, rgrimes Approved by: imp (mentor), jhb (maintainer) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D19905 Modified: head/sys/net/ieee_oui.h head/usr.sbin/bhyve/pci_nvme.c Modified: head/sys/net/ieee_oui.h ============================================================================== --- head/sys/net/ieee_oui.h Sat Jul 13 12:45:08 2019 (r349968) +++ head/sys/net/ieee_oui.h Sat Jul 13 12:48:28 2019 (r349969) @@ -77,4 +77,9 @@ */ #define OUI_FREEBSD_GENERATED_MASK 0x10ffff #define OUI_FREEBSD_GENERATED_LOW OUI_FREEBSD(0x100000) -#define OUI_FREEBSD_GENERATED_HIGH OUI_FREEBSD(OU_FREEBSD_GENERATED_MASK) +#define OUI_FREEBSD_GENERATED_HIGH OUI_FREEBSD(OUI_FREEBSD_GENERATED_MASK) + +/* Allocate 16 bits for emulated NVMe devices */ +#define OUI_FREEBSD_NVME_MASK 0x20ffff +#define OUI_FREEBSD_NVME_LOW OUI_FREEBSD(0x200000) +#define OUI_FRREBSD_NVME_HIGH OUI_FREEBSD(OUI_FREEBSD_NVME_MASK) Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Sat Jul 13 12:45:08 2019 (r349968) +++ head/usr.sbin/bhyve/pci_nvme.c Sat Jul 13 12:48:28 2019 (r349969) @@ -4,6 +4,9 @@ * Copyright (c) 2017 Shunsuke Mie * Copyright (c) 2018 Leon Dang * + * Function crc16 Copyright (c) 2017, Fedor Uporov + * Obtained from function ext2_crc16() in sys/fs/ext2fs/ext2_csum.c + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -30,7 +33,7 @@ * bhyve PCIe-NVMe device emulation. * * options: - * -s ,nvme,devpath,maxq=#,qsz=#,ioslots=#,sectsz=#,ser=A-Z + * -s ,nvme,devpath,maxq=#,qsz=#,ioslots=#,sectsz=#,ser=A-Z,eui64=# * * accepted devpath: * /dev/blockdev @@ -42,6 +45,7 @@ * ioslots = max number of concurrent io requests * sectsz = sector size (defaults to blockif sector size) * ser = serial number (20-chars max) + * eui64 = IEEE Extended Unique Identifier (8 byte value) * */ @@ -54,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include @@ -164,6 +169,7 @@ struct pci_nvme_blockstore { uint64_t size; uint32_t sectsz; uint32_t sectsz_bits; + uint64_t eui64; }; struct pci_nvme_ioreq { @@ -352,23 +358,87 @@ pci_nvme_init_ctrldata(struct pci_nvme_softc *sc) cd->power_state[0].mp = 10; } -static void -pci_nvme_init_nsdata(struct pci_nvme_softc *sc) +/* + * Calculate the CRC-16 of the given buffer + * See copyright attribution at top of file + */ +static uint16_t +crc16(uint16_t crc, const void *buffer, unsigned int len) { - struct nvme_namespace_data *nd; + const unsigned char *cp = buffer; + /* CRC table for the CRC-16. The poly is 0x8005 (x16 + x15 + x2 + 1). */ + static uint16_t const crc16_table[256] = { + 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, + 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440, + 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40, + 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841, + 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40, + 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41, + 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641, + 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040, + 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240, + 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441, + 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41, + 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840, + 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41, + 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40, + 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640, + 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041, + 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240, + 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441, + 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41, + 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840, + 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41, + 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40, + 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640, + 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041, + 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241, + 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440, + 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40, + 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841, + 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40, + 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41, + 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, + 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040 + }; - nd = &sc->nsdata; + while (len--) + crc = (((crc >> 8) & 0xffU) ^ + crc16_table[(crc ^ *cp++) & 0xffU]) & 0x0000ffffU; + return crc; +} +static void +pci_nvme_init_nsdata(struct pci_nvme_softc *sc, + struct nvme_namespace_data *nd, uint32_t nsid, + uint64_t eui64) +{ + nd->nsze = sc->nvstore.size / sc->nvstore.sectsz; nd->ncap = nd->nsze; nd->nuse = nd->nsze; /* Get LBA and backstore information from backing store */ nd->nlbaf = 0; /* NLBAF is a 0's based value (i.e. 1 LBA Format) */ + nd->flbas = 0; + + /* Create an EUI-64 if user did not provide one */ + if (eui64 == 0) { + char *data = NULL; + + asprintf(&data, "%s%u%u%u", vmname, sc->nsc_pi->pi_bus, + sc->nsc_pi->pi_slot, sc->nsc_pi->pi_func); + + if (data != NULL) { + eui64 = OUI_FREEBSD_NVME_LOW | crc16(0, data, strlen(data)); + free(data); + } + eui64 = (eui64 << 16) | (nsid & 0xffff); + } + be64enc(nd->eui64, eui64); + /* LBA data-sz = 2^lbads */ nd->lbaf[0] = sc->nvstore.sectsz_bits << NVME_NS_DATA_LBAF_LBADS_SHIFT; - - nd->flbas = 0; } static void @@ -1817,6 +1887,8 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *o free(uopt); return (-1); } + } else if (!strcmp("eui64", xopts)) { + sc->nvstore.eui64 = htobe64(strtoull(config, NULL, 0)); } else if (optidx == 0) { snprintf(bident, sizeof(bident), "%d:%d", sc->nsc_pi->pi_slot, sc->nsc_pi->pi_func); @@ -1937,7 +2009,7 @@ pci_nvme_init(struct vmctx *ctx, struct pci_devinst *p pci_nvme_reset(sc); pci_nvme_init_ctrldata(sc); - pci_nvme_init_nsdata(sc); + pci_nvme_init_nsdata(sc, &sc->nsdata, 1, sc->nvstore.eui64); pci_nvme_init_logpages(sc); pci_lintr_request(pi); From owner-svn-src-head@freebsd.org Sat Jul 13 13:08:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8F0915E8EFA; Sat, 13 Jul 2019 13:08:22 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 3013885DD5; Sat, 13 Jul 2019 13:08:22 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: by mail-ed1-x536.google.com with SMTP id v15so11503543eds.9; Sat, 13 Jul 2019 06:08:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=7GyKwOp/lmGL6X2F1ftFXVgc11O4S5xTHnsCGV4biDA=; b=WXVl2RosCb2Vfup91Jad4jMRZXgoS33XfoW4cG+gIfZYPT3CMt1s/XEP06VVmdKX43 IWHyopiN++Xh7HfEpWODugstvV8nXjepHRU5c0/1PWz9H+0I6qft1y7LQ6WdmiF1KjK4 6vEcrAOUE10o6R/iWpuhffx+t3BHyEMGWE6x0EkT0G2olrfmqXCyAncRjLXbrET4njq6 9rw/yDNEfDPVapdMmzglk71ZoSZhf022DKS5nFne8LDDXBdKHdEcaFsugIgFtI0hA6/K 0ZlPHB5pkhIJ9quEJnKgP/mAhzJi6mq4oPT3P7YnRRlNq9Da9Jh5J8dqAO6tmh5U7ogm wDHg== 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:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=7GyKwOp/lmGL6X2F1ftFXVgc11O4S5xTHnsCGV4biDA=; b=UiX342pzXC51n3zT/c9Z7mCfjIhDjqR/z/67CY/P1pr+pRjLf5nVRJogrBWsZ1Wzr4 xGKOFc7VFnjeBKKPQILEZNfLrlOIlmtTRd09vleJGA3f1QdznFgqogu7HEIB1dCVQKs7 qgQt5mGdAP3pSEm8C6xsvgxspi+bGt6DEHk2X2INTQZFJLsprJdLQq28SooMHH75QQ5T QNWVKjZ4Ioiouvl6BuDXuGcmKsw64bgGvtRFehChZ+awGwIHV/g+mY8wvNlV9L6xJu4X mvBFyo4uphGmAvoX55y5LXGubOU6nB4eo4kgCd/+BDACOKma1cyY9B8xMmAqyAXZQvUc i61A== X-Gm-Message-State: APjAAAW13p75CRg2X+D41ADL09hn+fuNmo7zgXiRoADlxJ4FSXpPdOkU RxOTK//zmVzevAv9U0Mv0IITJD+W X-Google-Smtp-Source: APXvYqxDPS6AKO9tuCACPiPj08XbYAmW2ogfTwrid/lMmp4GIUtZYehzsg84nw6ntZFP/VGGo/JRHg== X-Received: by 2002:aa7:d30d:: with SMTP id p13mr14496044edq.292.1563023300968; Sat, 13 Jul 2019 06:08:20 -0700 (PDT) Received: from ernst.home (p5B3BE885.dip0.t-ipconnect.de. [91.59.232.133]) by smtp.gmail.com with ESMTPSA id w27sm3628672edw.63.2019.07.13.06.08.19 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 13 Jul 2019 06:08:20 -0700 (PDT) Date: Sat, 13 Jul 2019 15:08:18 +0200 From: Gary Jennejohn To: Chuck Tuffli Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349969 - in head: sys/net usr.sbin/bhyve Message-ID: <20190713150818.11ba99f8@ernst.home> In-Reply-To: <201907131248.x6DCmTgG050521@repo.freebsd.org> References: <201907131248.x6DCmTgG050521@repo.freebsd.org> Reply-To: gljennjohn@gmail.com X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; amd64-portbld-freebsd12.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 3013885DD5 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 13:08:23 -0000 On Sat, 13 Jul 2019 12:48:29 +0000 (UTC) Chuck Tuffli wrote: > Author: chuck > Date: Sat Jul 13 12:48:28 2019 > New Revision: 349969 > URL: https://svnweb.freebsd.org/changeset/base/349969 > > Log: > bhyve: Create EUI64 for NVMe namespaces > > Accept an IEEE Extended Unique Identifier (EUI-64) from the command > line for each NVMe namespace. If one isn't provided, it will create one > based on the CRC16 of: > - the FreeBSD IEEE OUI > - PCI bus, device/slot, function values > - Namespace ID > > Reviewed by: imp, araujo, jhb, rgrimes > Approved by: imp (mentor), jhb (maintainer) > MFC after: 2 weeks > Differential Revision: https://reviews.freebsd.org/D19905 > > Modified: > head/sys/net/ieee_oui.h > head/usr.sbin/bhyve/pci_nvme.c > > Modified: head/sys/net/ieee_oui.h > ============================================================================== > --- head/sys/net/ieee_oui.h Sat Jul 13 12:45:08 2019 (r349968) > +++ head/sys/net/ieee_oui.h Sat Jul 13 12:48:28 2019 (r349969) > @@ -77,4 +77,9 @@ > */ > #define OUI_FREEBSD_GENERATED_MASK 0x10ffff > #define OUI_FREEBSD_GENERATED_LOW OUI_FREEBSD(0x100000) > -#define OUI_FREEBSD_GENERATED_HIGH OUI_FREEBSD(OU_FREEBSD_GENERATED_MASK) > +#define OUI_FREEBSD_GENERATED_HIGH OUI_FREEBSD(OUI_FREEBSD_GENERATED_MASK) > + > +/* Allocate 16 bits for emulated NVMe devices */ > +#define OUI_FREEBSD_NVME_MASK 0x20ffff > +#define OUI_FREEBSD_NVME_LOW OUI_FREEBSD(0x200000) > +#define OUI_FRREBSD_NVME_HIGH OUI_FREEBSD(OUI_FREEBSD_NVME_MASK) TYPO (FRRE instead of FREE) - this works because the macro isn't used anywhere. > > Modified: head/usr.sbin/bhyve/pci_nvme.c > ============================================================================== > --- head/usr.sbin/bhyve/pci_nvme.c Sat Jul 13 12:45:08 2019 (r349968) > +++ head/usr.sbin/bhyve/pci_nvme.c Sat Jul 13 12:48:28 2019 (r349969) > @@ -4,6 +4,9 @@ > * Copyright (c) 2017 Shunsuke Mie > * Copyright (c) 2018 Leon Dang > * > + * Function crc16 Copyright (c) 2017, Fedor Uporov > + * Obtained from function ext2_crc16() in sys/fs/ext2fs/ext2_csum.c > + * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > * are met: > @@ -30,7 +33,7 @@ > * bhyve PCIe-NVMe device emulation. > * > * options: > - * -s ,nvme,devpath,maxq=#,qsz=#,ioslots=#,sectsz=#,ser=A-Z > + * -s ,nvme,devpath,maxq=#,qsz=#,ioslots=#,sectsz=#,ser=A-Z,eui64=# > * > * accepted devpath: > * /dev/blockdev > @@ -42,6 +45,7 @@ > * ioslots = max number of concurrent io requests > * sectsz = sector size (defaults to blockif sector size) > * ser = serial number (20-chars max) > + * eui64 = IEEE Extended Unique Identifier (8 byte value) > * > */ > > @@ -54,6 +58,7 @@ > __FBSDID("$FreeBSD$"); > > #include > +#include > > #include > #include > @@ -164,6 +169,7 @@ struct pci_nvme_blockstore { > uint64_t size; > uint32_t sectsz; > uint32_t sectsz_bits; > + uint64_t eui64; > }; > > struct pci_nvme_ioreq { > @@ -352,23 +358,87 @@ pci_nvme_init_ctrldata(struct pci_nvme_softc *sc) > cd->power_state[0].mp = 10; > } > > -static void > -pci_nvme_init_nsdata(struct pci_nvme_softc *sc) > +/* > + * Calculate the CRC-16 of the given buffer > + * See copyright attribution at top of file > + */ > +static uint16_t > +crc16(uint16_t crc, const void *buffer, unsigned int len) > { > - struct nvme_namespace_data *nd; > + const unsigned char *cp = buffer; > + /* CRC table for the CRC-16. The poly is 0x8005 (x16 + x15 + x2 + 1). */ > + static uint16_t const crc16_table[256] = { > + 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, > + 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440, > + 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40, > + 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841, > + 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40, > + 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41, > + 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641, > + 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040, > + 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240, > + 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441, > + 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41, > + 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840, > + 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41, > + 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40, > + 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640, > + 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041, > + 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240, > + 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441, > + 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41, > + 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840, > + 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41, > + 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40, > + 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640, > + 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041, > + 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241, > + 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440, > + 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40, > + 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841, > + 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40, > + 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41, > + 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, > + 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040 > + }; > > - nd = &sc->nsdata; > + while (len--) > + crc = (((crc >> 8) & 0xffU) ^ > + crc16_table[(crc ^ *cp++) & 0xffU]) & 0x0000ffffU; > + return crc; > +} > > +static void > +pci_nvme_init_nsdata(struct pci_nvme_softc *sc, > + struct nvme_namespace_data *nd, uint32_t nsid, > + uint64_t eui64) > +{ > + > nd->nsze = sc->nvstore.size / sc->nvstore.sectsz; > nd->ncap = nd->nsze; > nd->nuse = nd->nsze; > > /* Get LBA and backstore information from backing store */ > nd->nlbaf = 0; /* NLBAF is a 0's based value (i.e. 1 LBA Format) */ > + nd->flbas = 0; > + > + /* Create an EUI-64 if user did not provide one */ > + if (eui64 == 0) { > + char *data = NULL; > + > + asprintf(&data, "%s%u%u%u", vmname, sc->nsc_pi->pi_bus, > + sc->nsc_pi->pi_slot, sc->nsc_pi->pi_func); > + > + if (data != NULL) { > + eui64 = OUI_FREEBSD_NVME_LOW | crc16(0, data, strlen(data)); > + free(data); > + } > + eui64 = (eui64 << 16) | (nsid & 0xffff); > + } > + be64enc(nd->eui64, eui64); > + > /* LBA data-sz = 2^lbads */ > nd->lbaf[0] = sc->nvstore.sectsz_bits << NVME_NS_DATA_LBAF_LBADS_SHIFT; > - > - nd->flbas = 0; > } > > static void > @@ -1817,6 +1887,8 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *o > free(uopt); > return (-1); > } > + } else if (!strcmp("eui64", xopts)) { > + sc->nvstore.eui64 = htobe64(strtoull(config, NULL, 0)); > } else if (optidx == 0) { > snprintf(bident, sizeof(bident), "%d:%d", > sc->nsc_pi->pi_slot, sc->nsc_pi->pi_func); > @@ -1937,7 +2009,7 @@ pci_nvme_init(struct vmctx *ctx, struct pci_devinst *p > > pci_nvme_reset(sc); > pci_nvme_init_ctrldata(sc); > - pci_nvme_init_nsdata(sc); > + pci_nvme_init_nsdata(sc, &sc->nsdata, 1, sc->nvstore.eui64); > pci_nvme_init_logpages(sc); > > pci_lintr_request(pi); > _______________________________________________ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" -- Gary Jennejohn From owner-svn-src-head@freebsd.org Sat Jul 13 15:04:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E33A15EADD8; Sat, 13 Jul 2019 15:04:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED45B895A8; Sat, 13 Jul 2019 15:04:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BEBDC27791; Sat, 13 Jul 2019 15:04:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6DF4UIg031722; Sat, 13 Jul 2019 15:04:30 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6DF4UKU031720; Sat, 13 Jul 2019 15:04:30 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201907131504.x6DF4UKU031720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 13 Jul 2019 15:04:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349971 - head/contrib/llvm/tools/lld/ELF X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/tools/lld/ELF X-SVN-Commit-Revision: 349971 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ED45B895A8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 15:04:31 -0000 Author: dim Date: Sat Jul 13 15:04:30 2019 New Revision: 349971 URL: https://svnweb.freebsd.org/changeset/base/349971 Log: Pull in r365760 from upstream lld trunk (by Fangrui Song): [ELF] Handle non-glob patterns before glob patterns in version scripts & fix a corner case of --dynamic-list This fixes PR38549, which is silently accepted by ld.bfd. This seems correct because it makes sense to let non-glob patterns take precedence over glob patterns. lld issues an error because `assignWildcardVersion(ver, VER_NDX_LOCAL);` is processed before `assignExactVersion(ver, v.id, v.name);`. Move all assignWildcardVersion() calls after assignExactVersion() calls to fix this. Also, move handleDynamicList() to the bottom. computeBinding() called by includeInDynsym() has this cryptic rule: if (versionId == VER_NDX_LOCAL && isDefined() && !isPreemptible) return STB_LOCAL; Before the change: * foo's version is set to VER_NDX_LOCAL due to `local: *` * handleDynamicList() is called - foo.computeBinding() is STB_LOCAL - foo.includeInDynsym() is false - foo.isPreemptible is not set (wrong) * foo's version is set to V1 After the change: * foo's version is set to VER_NDX_LOCAL due to `local: *` * foo's version is set to V1 * handleDynamicList() is called - foo.computeBinding() is STB_GLOBAL - foo.includeInDynsym() is true - foo.isPreemptible is set (correct) Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D64550 This makes it longer necessary to patch the version scripts for the samba ports, to avoid "duplicate symbol 'pdb_search_init' in version script" errors. PR: 230602 MFC after: 3 days Modified: head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp head/contrib/llvm/tools/lld/ELF/SymbolTable.h Modified: head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp Sat Jul 13 14:42:09 2019 (r349970) +++ head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp Sat Jul 13 15:04:30 2019 (r349971) @@ -654,20 +654,6 @@ std::vector SymbolTable::findAllByVersion(Sy return Res; } -// If there's only one anonymous version definition in a version -// script file, the script does not actually define any symbol version, -// but just specifies symbols visibilities. -void SymbolTable::handleAnonymousVersion() { - for (SymbolVersion &Ver : Config->VersionScriptGlobals) - assignExactVersion(Ver, VER_NDX_GLOBAL, "global"); - for (SymbolVersion &Ver : Config->VersionScriptGlobals) - assignWildcardVersion(Ver, VER_NDX_GLOBAL); - for (SymbolVersion &Ver : Config->VersionScriptLocals) - assignExactVersion(Ver, VER_NDX_LOCAL, "local"); - for (SymbolVersion &Ver : Config->VersionScriptLocals) - assignWildcardVersion(Ver, VER_NDX_LOCAL); -} - // Handles -dynamic-list. void SymbolTable::handleDynamicList() { for (SymbolVersion &Ver : Config->DynamicList) { @@ -731,23 +717,27 @@ void SymbolTable::assignWildcardVersion(SymbolVersion // This function processes version scripts by updating VersionId // member of symbols. +// If there's only one anonymous version definition in a version +// script file, the script does not actually define any symbol version, +// but just specifies symbols visibilities. void SymbolTable::scanVersionScript() { - // Handle edge cases first. - handleAnonymousVersion(); - handleDynamicList(); - - // Now we have version definitions, so we need to set version ids to symbols. - // Each version definition has a glob pattern, and all symbols that match - // with the pattern get that version. - // First, we assign versions to exact matching symbols, // i.e. version definitions not containing any glob meta-characters. + for (SymbolVersion &Ver : Config->VersionScriptGlobals) + assignExactVersion(Ver, VER_NDX_GLOBAL, "global"); + for (SymbolVersion &Ver : Config->VersionScriptLocals) + assignExactVersion(Ver, VER_NDX_LOCAL, "local"); for (VersionDefinition &V : Config->VersionDefinitions) for (SymbolVersion &Ver : V.Globals) assignExactVersion(Ver, V.Id, V.Name); // Next, we assign versions to fuzzy matching symbols, // i.e. version definitions containing glob meta-characters. + for (SymbolVersion &Ver : Config->VersionScriptGlobals) + assignWildcardVersion(Ver, VER_NDX_GLOBAL); + for (SymbolVersion &Ver : Config->VersionScriptLocals) + assignWildcardVersion(Ver, VER_NDX_LOCAL); + // Note that because the last match takes precedence over previous matches, // we iterate over the definitions in the reverse order. for (VersionDefinition &V : llvm::reverse(Config->VersionDefinitions)) @@ -759,6 +749,12 @@ void SymbolTable::scanVersionScript() { // Let them parse and update their names to exclude version suffix. for (Symbol *Sym : SymVector) Sym->parseSymbolVersion(); + + // isPreemptible is false at this point. To correctly compute the binding of a + // Defined (which is used by includeInDynsym()), we need to know if it is + // VER_NDX_LOCAL or not. If defaultSymbolVersion is VER_NDX_LOCAL, we should + // compute symbol versions before handling --dynamic-list. + handleDynamicList(); } template void SymbolTable::addFile(InputFile *); Modified: head/contrib/llvm/tools/lld/ELF/SymbolTable.h ============================================================================== --- head/contrib/llvm/tools/lld/ELF/SymbolTable.h Sat Jul 13 14:42:09 2019 (r349970) +++ head/contrib/llvm/tools/lld/ELF/SymbolTable.h Sat Jul 13 15:04:30 2019 (r349971) @@ -90,7 +90,6 @@ class SymbolTable { (private) std::vector findAllByVersion(SymbolVersion Ver); llvm::StringMap> &getDemangledSyms(); - void handleAnonymousVersion(); void assignExactVersion(SymbolVersion Ver, uint16_t VersionId, StringRef VersionName); void assignWildcardVersion(SymbolVersion Ver, uint16_t VersionId); From owner-svn-src-head@freebsd.org Sat Jul 13 15:34:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 221B415EB527; Sat, 13 Jul 2019 15:34:32 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ACCD48A3A3; Sat, 13 Jul 2019 15:34:31 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E6C027C92; Sat, 13 Jul 2019 15:34:31 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6DFYVtb049269; Sat, 13 Jul 2019 15:34:31 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6DFYUa2049263; Sat, 13 Jul 2019 15:34:30 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907131534.x6DFYUa2049263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 13 Jul 2019 15:34:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349972 - in head: lib/libc/arm lib/libc/arm/gen sys/sys X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head: lib/libc/arm lib/libc/arm/gen sys/sys X-SVN-Commit-Revision: 349972 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ACCD48A3A3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.950,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 15:34:32 -0000 Author: ian Date: Sat Jul 13 15:34:29 2019 New Revision: 349972 URL: https://svnweb.freebsd.org/changeset/base/349972 Log: Add arm_sync_icache() and arm_drain_writebuf() sysarch syscall wrappers. NetBSD and OpenBSD have libc wrapper functions for the ARM_SYNC_ICACHE and ARM_DRAIN_WRITEBUF sysarch operations. This change adds compatible functions to our library. This should make it easier for various upstream sources to support *BSD operating systems with a single variation of cache maintence code in tools like interpreters and JIT compilers. I consider the argument types passed to arm_sync_icache() to be especially unfortunate, but this is intended to match the other BSDs. Differential Revision: https://reviews.freebsd.org/D20906 Added: head/lib/libc/arm/gen/arm_drain_writebuf.2 (contents, props changed) head/lib/libc/arm/gen/arm_drain_writebuf.c (contents, props changed) head/lib/libc/arm/gen/arm_sync_icache.2 (contents, props changed) head/lib/libc/arm/gen/arm_sync_icache.c (contents, props changed) Modified: head/lib/libc/arm/Symbol.map head/lib/libc/arm/gen/Makefile.inc head/sys/sys/param.h Modified: head/lib/libc/arm/Symbol.map ============================================================================== --- head/lib/libc/arm/Symbol.map Sat Jul 13 15:04:30 2019 (r349971) +++ head/lib/libc/arm/Symbol.map Sat Jul 13 15:34:29 2019 (r349972) @@ -41,6 +41,11 @@ FBSD_1.4 { dl_unwind_find_exidx; }; +FBSD_1.6 { + arm_drain_writebuf; + arm_sync_icache; +}; + FBSDprivate_1.0 { /* PSEUDO syscalls */ _getlogin; Modified: head/lib/libc/arm/gen/Makefile.inc ============================================================================== --- head/lib/libc/arm/gen/Makefile.inc Sat Jul 13 15:04:30 2019 (r349971) +++ head/lib/libc/arm/gen/Makefile.inc Sat Jul 13 15:34:29 2019 (r349972) @@ -8,6 +8,8 @@ SRCS+= \ _setjmp.S \ alloca.S \ arm_initfini.c \ + arm_drain_writebuf.c \ + arm_sync_icache.c \ fabs.c \ flt_rounds.c \ getcontextx.c \ @@ -17,6 +19,10 @@ SRCS+= \ setjmp.S \ signalcontext.c \ sigsetjmp.S \ + +MAN+= \ + arm_drain_writebuf.2 \ + arm_sync_icache.2 \ .if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") Added: head/lib/libc/arm/gen/arm_drain_writebuf.2 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/arm/gen/arm_drain_writebuf.2 Sat Jul 13 15:34:29 2019 (r349972) @@ -0,0 +1,77 @@ +.\" Copyright (c) 2019 Ian Lepore +.\" +.\" 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 AUTHORS 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 AUTHORS 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$ +.\" +.Dd July 10, 2019 +.Dt ARM_DRAIN_WRITEBUF 2 +.Os +.Sh NAME +.Nm arm_drain_writebuf +.Nd drain pending writes from cores and caches +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In machine/sysarch.h +.Ft int +.Fn arm_drain_writebuf void +.Sh DESCRIPTION +The +.Nm +system call causes all pending writes from ARM cores and caches to be +written out to main memory or memory-mapped I/O registers. +Not all hardware supports buffered writes; on such systems the +.Nm +function is a no-op. +.Pp +On ARMv5 systems, this executes a cp15 coprocessor +.Dq drain write buffer +operation. +On ARMv6 and ARMv7 systems, this executes a +.Dq DSB SY +synchronization barrier, followed by an L2 cache drain on +systems where the DSB does not include L2 automatically. +.Pp +.Nm +attempts to wait for the drain operation to complete, but cannot +guarantee the writes have reached their ultimate destination on all hardware. +For example, on an ARMv7 system, +.Nm +tells the L2 cache controller to drain its buffers, and it waits until +the controller indicates that operation is complete. +However, all the L2 controller knows is that the data was accepted for +delivery by the AXI bus. +If the ultimate destination of the write is a device on a subordinate +bus connected to the AXI bus, more buffering or other delays may occur +on that subordinate bus. +The only way to be certain a pending write has reached its +ultimate destination is to issue a read from that destination after +.Nm +returns. +.Sh RETURN VALUES +The +.Nm +system call cannot fail, and always returns 0. +.Sh AUTHORS +This man page was written by +.An Ian Lepore . Added: head/lib/libc/arm/gen/arm_drain_writebuf.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/arm/gen/arm_drain_writebuf.c Sat Jul 13 15:34:29 2019 (r349972) @@ -0,0 +1,39 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019 Ian Lepore + * + * 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 + +int +arm_drain_writebuf(void) +{ + sysarch(ARM_DRAIN_WRITEBUF, NULL); + return (0); +} Added: head/lib/libc/arm/gen/arm_sync_icache.2 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/arm/gen/arm_sync_icache.2 Sat Jul 13 15:34:29 2019 (r349972) @@ -0,0 +1,79 @@ +.\" Copyright (c) 2019 Ian Lepore +.\" +.\" 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 AUTHORS 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 AUTHORS 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$ +.\" +.Dd July 10, 2019 +.Dt ARM_sync_icache 2 +.Os +.Sh NAME +.Nm arm_sync_icache +.Nd synchronize the data and instruction caches +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In machine/sysarch.h +.Ft int +.Fn arm_sync_icache "u_int addr" "int len" +.Sh DESCRIPTION +The +.Nm +system call synchronizes the contents of any data and instructions caches +with the contents of main memory for the given range. +Use this after loading executable code or modifying existing code in memory, +before attempting to execute that code. +.Pp +The +.Va addr +and +.Va len +arguments do not need to be aligned to any particular boundary, but +cache operations will affect entire cache lines, even those which are only +partially overlapped by the given range. +.Pp +This takes one or more of the following actions, depending on the requirements +of the hardware: +.Bl -bullet +.It +Write dirty data cache lines within the range back to main memory. +.It +Invalidate existing instruction cache contents for the range. +.It +Invalidate branch prediction caches for the range. +.El +.Pp +On hardware which supports multiple synchronization points for cache +operations, the caches are maintained to the point of unification, +making the data in the range coherent amongst all cores. +.Sh RETURN VALUES +The +.Nm +system call always returns 0. +.Sh ERRORS +If a call refers to memory which the calling process does not have rights +to access, or if the +.Va len +argument is negative, a SIGSEGV signal is delivered to the calling thread. +.Sh AUTHORS +This man page was written by +.An Ian Lepore . Added: head/lib/libc/arm/gen/arm_sync_icache.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/arm/gen/arm_sync_icache.c Sat Jul 13 15:34:29 2019 (r349972) @@ -0,0 +1,44 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019 Ian Lepore + * + * 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 + +int +arm_sync_icache(u_int addr, int len) +{ + struct arm_sync_icache_args args; + + args.addr = addr; + args.len = len; + sysarch(ARM_SYNC_ICACHE, &args); + return (0); +} Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Sat Jul 13 15:04:30 2019 (r349971) +++ head/sys/sys/param.h Sat Jul 13 15:34:29 2019 (r349972) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300035 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300036 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Sat Jul 13 15:53:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BB5E15EBB9A; Sat, 13 Jul 2019 15:53:29 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BE7678AF19; Sat, 13 Jul 2019 15:53:28 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C87228019; Sat, 13 Jul 2019 15:53:28 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6DFrSI2060951; Sat, 13 Jul 2019 15:53:28 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6DFrS34060950; Sat, 13 Jul 2019 15:53:28 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201907131553.x6DFrS34060950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 13 Jul 2019 15:53:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349973 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 349973 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BE7678AF19 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.946,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 15:53:29 -0000 Author: alc Date: Sat Jul 13 15:53:28 2019 New Revision: 349973 URL: https://svnweb.freebsd.org/changeset/base/349973 Log: Remove a stale comment. Reported by: markj MFC after: 1 week Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Sat Jul 13 15:34:29 2019 (r349972) +++ head/sys/i386/i386/pmap.c Sat Jul 13 15:53:28 2019 (r349973) @@ -5096,13 +5096,6 @@ __CONCAT(PMTYPE, ts_referenced)(vm_page_t m) * reference bit will result in clearing that bit. * This function is designed to avoid the selection of * the same 4KB page for every 2- or 4MB page mapping. - * - * On demotion, a mapping that hasn't been referenced - * is simply destroyed. To avoid the possibility of a - * subsequent page fault on a demoted wired mapping, - * always leave its reference bit set. Moreover, - * since the superpage is wired, the current state of - * its reference bit won't affect page replacement. */ if ((((pa >> PAGE_SHIFT) ^ (pv->pv_va >> PDRSHIFT) ^ (uintptr_t)pmap) & (NPTEPG - 1)) == 0 && From owner-svn-src-head@freebsd.org Sat Jul 13 16:07:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D04B15EBF02; Sat, 13 Jul 2019 16:07:39 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 119C48B63B; Sat, 13 Jul 2019 16:07:39 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0269281C1; Sat, 13 Jul 2019 16:07:38 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6DG7cg3067203; Sat, 13 Jul 2019 16:07:38 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6DG7cTR067202; Sat, 13 Jul 2019 16:07:38 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907131607.x6DG7cTR067202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 13 Jul 2019 16:07:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349974 - head/libexec/rc/rc.d X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/libexec/rc/rc.d X-SVN-Commit-Revision: 349974 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 119C48B63B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.948,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 16:07:39 -0000 Author: ian Date: Sat Jul 13 16:07:38 2019 New Revision: 349974 URL: https://svnweb.freebsd.org/changeset/base/349974 Log: Limit access to system accounting files. In 2013 the security chapter of the Handbook was updated in r42501 to suggest limiting access to the system accounting file [*1] by creating the initial file with a mode of 0600. This was in part based on a discussion in the forums [*2]. Unfortunately, this advice is overridden by the fact that a new file is created as part of periodic daily processing, and the file mode is set by the rc.d/accounting script. These changes update the accounting script to create the directory with mode 0750 if it doesn't already exist, and to create the daily file with mode 0640. This limits write access to root only, read access to root and members of wheel, and eliminates world access completely. For admins who want to prevent even members of wheel from accessing the files, the mode of the /var/account directory can be manually changed to 0700, because the script never creates or changes that directory if it already exists. The accounting_rotate_log() function now also handles the error cases of no existing log file to rotate, and attempting to rotate the file multiple times (.0 file already exists). Another small change here eliminates the complexity of the mktemp/chmod/mv sequence for creating a new acct file by using install(1) with the flags needed to directly create the file with the desired ownership and modes. That allows coalescing two separate if checkyesno accounting_enable blocks into one. These changes were inspired by my investigation of PR 202203. [1] https://www.freebsd.org/doc/handbook/security-accounting.html [2] http://forums.freebsd.org/showthread.php?t=41059 PR: 202203 Differential Revision: https://reviews.freebsd.org/D20876 Modified: head/libexec/rc/rc.d/accounting Modified: head/libexec/rc/rc.d/accounting ============================================================================== --- head/libexec/rc/rc.d/accounting Sat Jul 13 15:53:28 2019 (r349973) +++ head/libexec/rc/rc.d/accounting Sat Jul 13 16:07:38 2019 (r349974) @@ -21,23 +21,27 @@ start_cmd="accounting_start" stop_cmd="accounting_stop" rotate_log_cmd="accounting_rotate_log" +create_accounting_file() +{ + install -o root -g wheel -m 0640 /dev/null "${accounting_file}" +} + accounting_start() { local _dir _dir="${accounting_file%/*}" if [ ! -d "$_dir" ]; then - if ! mkdir -p "$_dir"; then + if ! mkdir -p -m 0750 "$_dir"; then err 1 "Could not create $_dir." fi fi if [ ! -e "$accounting_file" ]; then echo -n "Creating accounting file ${accounting_file}" - touch "$accounting_file" + create_accounting_file echo '.' fi - chmod 644 "$accounting_file" echo "Turning on accounting." ${accounting_command} ${accounting_file} @@ -51,21 +55,24 @@ accounting_stop() accounting_rotate_log() { - local _dir _file + # Note that this function must handle being called as "onerotate_log" + # (by the periodic scripts) when accounting is disabled, and handle + # being called multiple times (by an admin making mistakes) without + # anything having actually rotated the old .0 file out of the way. - _dir="${accounting_file%/*}" - cd $_dir + if [ -e "${accounting_file}.0" ]; then + err 1 "Cannot rotate accounting log, ${accounting_file}.0 already exists." + fi - if checkyesno accounting_enable; then - _file=`mktemp newacct-XXXXX` - chmod 644 $_file - ${accounting_command} ${_dir}/${_file} + if [ ! -e "${accounting_file}" ]; then + err 1 "Cannot rotate accounting log, ${accounting_file} does not exist." fi mv ${accounting_file} ${accounting_file}.0 if checkyesno accounting_enable; then - mv $_file ${accounting_file} + create_accounting_file + ${accounting_command} "${accounting_file}" fi } From owner-svn-src-head@freebsd.org Sat Jul 13 16:32:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3802C15EC4CF; Sat, 13 Jul 2019 16:32:20 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C2B438C334; Sat, 13 Jul 2019 16:32:19 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E3D8286D8; Sat, 13 Jul 2019 16:32:19 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6DGWJHh084050; Sat, 13 Jul 2019 16:32:19 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6DGWJqZ084049; Sat, 13 Jul 2019 16:32:19 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201907131632.x6DGWJqZ084049@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 13 Jul 2019 16:32:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349975 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 349975 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C2B438C334 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.92)[-0.920,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 16:32:20 -0000 Author: alc Date: Sat Jul 13 16:32:19 2019 New Revision: 349975 URL: https://svnweb.freebsd.org/changeset/base/349975 Log: Revert r349442, which was a workaround for bus errors caused by an errant TLB entry. Specifically, at the start of pmap_enter_quick_locked(), we would sometimes have a TLB entry for an invalid PTE, and we would need to issue a TLB invalidation before exiting pmap_enter_quick_locked(). However, we should never have a TLB entry for an invalid PTE. r349905 has addressed the root cause of the problem, and so we no longer need this workaround. X-MFC after: r349905 Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Sat Jul 13 16:07:38 2019 (r349974) +++ head/sys/arm64/arm64/pmap.c Sat Jul 13 16:32:19 2019 (r349975) @@ -3713,14 +3713,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v cpu_icache_sync_range(PHYS_TO_DMAP(pa), PAGE_SIZE); pmap_load_store(l3, l3_val); - - /* - * XXX In principle, because this L3 entry was invalid, we should not - * need to perform a TLB invalidation here. However, in practice, - * when simply performing a "dsb ishst" here, processes are being - * terminated due to bus errors and segmentation violations. - */ - pmap_invalidate_page(pmap, va); + dsb(ishst); return (mpte); } From owner-svn-src-head@freebsd.org Sat Jul 13 16:48:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7071C15EC743; Sat, 13 Jul 2019 16:48:28 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 05F848C8EA; Sat, 13 Jul 2019 16:48:28 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E8E352888B; Sat, 13 Jul 2019 16:48:27 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6DGmR08090396; Sat, 13 Jul 2019 16:48:27 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6DGmRc4090395; Sat, 13 Jul 2019 16:48:27 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907131648.x6DGmRc4090395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 13 Jul 2019 16:48:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349976 - head X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 349976 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 05F848C8EA X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.92)[-0.920,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 16:48:28 -0000 Author: ian Date: Sat Jul 13 16:48:27 2019 New Revision: 349976 URL: https://svnweb.freebsd.org/changeset/base/349976 Log: Add an entry mentioning the permission/mode change to daily accounting files. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sat Jul 13 16:32:19 2019 (r349975) +++ head/UPDATING Sat Jul 13 16:48:27 2019 (r349976) @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20190713: + Default permissions on the /var/account/acct file (and copies of it rotated + by periodic daily scripts) are changed from 0644 to 0640 because the file + contains sensitive information that should not be world-readable. If the + /var/account directory must be created by rc.d/accounting, the mode used is + now 0750. Admins who use the accounting feature are encouraged to change + the mode of an existing /var/account directory to 0750 or 0700. + 20190620: Entropy collection and the /dev/random device are no longer optional components. The "device random" option has been removed. From owner-svn-src-head@freebsd.org Sat Jul 13 22:42:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3785715CF13B; Sat, 13 Jul 2019 22:42:58 +0000 (UTC) (envelope-from ctuffli@gmail.com) Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 BB79072B02; Sat, 13 Jul 2019 22:42:57 +0000 (UTC) (envelope-from ctuffli@gmail.com) Received: by mail-ot1-f52.google.com with SMTP id r6so13063581oti.3; Sat, 13 Jul 2019 15:42:57 -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:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qcUiuYDU6gCKXRVpdLbRqXa6XzMSUNV/h4Q2WqxYT6I=; b=kRxW0RzcX/jU22jKbA7MvVPw8QwFy5ELOhjc7p2qCwWnN+eptwUSgV/gDt4QrekF2K oTQJX6D2JYfC+njFqnJiSdIvSOW0SXp/y3IME/VfJLr7Y5WUAnd08Q7AN6w69yjhCGbc Ai9LzRbaVQx/0oTdMb+fjSXT93LWiMNjR+mjLShgC7umNx7aJY1m+Ov6hJY6RkVg7xIQ vdmPNW/jP+3MwPorwoXN9II8VzGrN9Z8fgM1BWSKaw0nCFViWxfLPnER2NwDOpC+W9Tv dgC2riGM0AMtna11e9zFDcQoTyEh1j7L9e99+6u3s6SJYMUy1zxG3a/RGY7ehjadlwf0 ngQg== X-Gm-Message-State: APjAAAXvHuiyX2lncBX/O03qiS1Ik3yBavt1Rst4GwdZtA7g1rz+veZl 933gq7GhN0G+EOB+B1wJa2+/5xI/ X-Google-Smtp-Source: APXvYqweW9gRpJEMDiN+1DwSD9lcCy899vPXeMsnYgtlC+VN/7M0coUfq/hYIWW5gqurtAcMYrqZvg== X-Received: by 2002:a05:6830:157:: with SMTP id j23mr14228563otp.198.1563051008204; Sat, 13 Jul 2019 13:50:08 -0700 (PDT) Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com. [209.85.167.179]) by smtp.gmail.com with ESMTPSA id l5sm4444284otf.53.2019.07.13.13.50.07 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Sat, 13 Jul 2019 13:50:07 -0700 (PDT) Received: by mail-oi1-f179.google.com with SMTP id t76so9896802oih.4; Sat, 13 Jul 2019 13:50:07 -0700 (PDT) X-Received: by 2002:aca:3a04:: with SMTP id h4mr8560720oia.90.1563051007267; Sat, 13 Jul 2019 13:50:07 -0700 (PDT) MIME-Version: 1.0 References: <201907131248.x6DCmTgG050521@repo.freebsd.org> <20190713150818.11ba99f8@ernst.home> In-Reply-To: <20190713150818.11ba99f8@ernst.home> From: Chuck Tuffli Date: Sat, 13 Jul 2019 13:49:53 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r349969 - in head: sys/net usr.sbin/bhyve To: gljennjohn@gmail.com Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: BB79072B02 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.90 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.90)[-0.901,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 22:42:58 -0000 On Sat, Jul 13, 2019 at 6:08 AM Gary Jennejohn wrote: > > On Sat, 13 Jul 2019 12:48:29 +0000 (UTC) > Chuck Tuffli wrote: > > > Author: chuck > > Date: Sat Jul 13 12:48:28 2019 > > New Revision: 349969 > > URL: https://svnweb.freebsd.org/changeset/base/349969 ... > > +#define OUI_FREEBSD_NVME_MASK 0x20ffff > > +#define OUI_FREEBSD_NVME_LOW OUI_FREEBSD(0x200000) > > +#define OUI_FRREBSD_NVME_HIGH OUI_FREEBSD(OUI_FREEBSD_NVME_MASK) > > TYPO (FRRE instead of FREE) - this works because the macro isn't used > anywhere. Duh-oh! Good catch. Much appreciated. --chuck