From owner-svn-src-head@freebsd.org  Sun Jul 21 03:19:55 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 17A89A7A77;
 Sun, 21 Jul 2019 03:19:55 +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 EDEC869D41;
 Sun, 21 Jul 2019 03:19:54 +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 C920B1CA90;
 Sun, 21 Jul 2019 03:19:54 +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 x6L3Jsxa035763;
 Sun, 21 Jul 2019 03:19:54 GMT (envelope-from jhibbits@FreeBSD.org)
Received: (from jhibbits@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6L3Js75035762;
 Sun, 21 Jul 2019 03:19:54 GMT (envelope-from jhibbits@FreeBSD.org)
Message-Id: <201907210319.x6L3Js75035762@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to
 jhibbits@FreeBSD.org using -f
From: Justin Hibbits <jhibbits@FreeBSD.org>
Date: Sun, 21 Jul 2019 03:19:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350190 - 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: 350190
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: EDEC869D41
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_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.98)[-0.979,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 21 Jul 2019 03:19:55 -0000

Author: jhibbits
Date: Sun Jul 21 03:19:54 2019
New Revision: 350190
URL: https://svnweb.freebsd.org/changeset/base/350190

Log:
  powerpc: Remove an unnecessary #ifdef guard from slb.c
  
  slb.c is only compiled for powerpc64, so no need for the #ifdef in this block.

Modified:
  head/sys/powerpc/aim/slb.c

Modified: head/sys/powerpc/aim/slb.c
==============================================================================
--- head/sys/powerpc/aim/slb.c	Sun Jul 21 00:47:06 2019	(r350189)
+++ head/sys/powerpc/aim/slb.c	Sun Jul 21 03:19:54 2019	(r350190)
@@ -545,7 +545,6 @@ slb_free_user_cache(struct slb **slb)
 	uma_zfree(slb_cache_zone, slb);
 }
 
-#if defined(__powerpc64__)
 /* Handle kernel SLB faults -- runs in real mode, all seat belts off */
 void
 handle_kernel_slb_spill(int type, register_t dar, register_t srr0)
@@ -626,4 +625,3 @@ handle_user_slb_spill(pmap_t pm, vm_offset_t addr)
 
 	return (0);
 }
-#endif

From owner-svn-src-head@freebsd.org  Sun Jul 21 03:26:27 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2149AA7DE0;
 Sun, 21 Jul 2019 03:26:27 +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 032476A23C;
 Sun, 21 Jul 2019 03:26:27 +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 D20CC1CC7A;
 Sun, 21 Jul 2019 03:26:26 +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 x6L3QQgL041475;
 Sun, 21 Jul 2019 03:26:26 GMT (envelope-from alc@FreeBSD.org)
Received: (from alc@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6L3QQ4H041474;
 Sun, 21 Jul 2019 03:26:26 GMT (envelope-from alc@FreeBSD.org)
Message-Id: <201907210326.x6L3QQ4H041474@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org
 using -f
From: Alan Cox <alc@FreeBSD.org>
Date: Sun, 21 Jul 2019 03:26:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350191 - 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: 350191
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 032476A23C
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_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.98)[-0.981,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 21 Jul 2019 03:26:27 -0000

Author: alc
Date: Sun Jul 21 03:26:26 2019
New Revision: 350191
URL: https://svnweb.freebsd.org/changeset/base/350191

Log:
  Introduce pmap_store(), and use it to replace pmap_load_store() in places
  where the page table entry was previously invalid.  (Note that I did not
  replace pmap_load_store() when it was followed by a TLB invalidation, even
  if we are not using the return value from pmap_load_store().)
  
  Correct an error in pmap_enter().  A test for determining when to set
  PGA_WRITEABLE was always true, even if the mapping was read only.
  
  In pmap_enter_l2(), when replacing an empty kernel page table page by a
  superpage mapping, clear the old l2 entry and issue a TLB invalidation.  My
  reading of the ARM architecture manual leads me to believe that the TLB
  could hold an intermediate entry referencing the empty kernel page table
  page even though it contains no valid mappings.
  
  Replace a couple direct uses of atomic_clear_64() by the new
  pmap_clear_bits().
  
  In a couple comments, replace the term "paging-structure caches", which is
  an Intel-specific term for the caches that hold intermediate entries in the
  page table, with wording that is more consistent with the ARM architecture
  manual.
  
  Reviewed by:	markj
  X-MFC after:	r350004
  Differential Revision:	https://reviews.freebsd.org/D20998

Modified:
  head/sys/arm64/arm64/pmap.c

Modified: head/sys/arm64/arm64/pmap.c
==============================================================================
--- head/sys/arm64/arm64/pmap.c	Sun Jul 21 03:19:54 2019	(r350190)
+++ head/sys/arm64/arm64/pmap.c	Sun Jul 21 03:26:26 2019	(r350191)
@@ -328,6 +328,7 @@ static __inline vm_page_t pmap_remove_pt_page(pmap_t p
 #define	pmap_load_clear(table)		atomic_swap_64(table, 0)
 #define	pmap_load_store(table, entry)	atomic_swap_64(table, entry)
 #define	pmap_set_bits(table, bits)	atomic_set_64(table, bits)
+#define	pmap_store(table, entry)	atomic_store_64(table, entry)
 
 /********************/
 /* Inline functions */
@@ -637,7 +638,7 @@ pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t mi
 				    (vm_offset_t)l2);
 				freemempos += PAGE_SIZE;
 
-				pmap_load_store(&pagetable_dmap[l1_slot],
+				pmap_store(&pagetable_dmap[l1_slot],
 				    (l2_pa & ~Ln_TABLE_MASK) | L1_TABLE);
 
 				memset(l2, 0, PAGE_SIZE);
@@ -655,7 +656,7 @@ pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t mi
 
 				l2_slot = pmap_l2_index(va);
 				KASSERT(l2_slot != 0, ("..."));
-				pmap_load_store(&l2[l2_slot],
+				pmap_store(&l2[l2_slot],
 				    (pa & ~L2_OFFSET) | ATTR_DEFAULT | ATTR_XN |
 				    ATTR_IDX(CACHED_MEMORY) | L2_BLOCK);
 			}
@@ -667,7 +668,7 @@ pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t mi
 		    (physmap[i + 1] - pa) >= L1_SIZE;
 		    pa += L1_SIZE, va += L1_SIZE) {
 			l1_slot = ((va - DMAP_MIN_ADDRESS) >> L1_SHIFT);
-			pmap_load_store(&pagetable_dmap[l1_slot],
+			pmap_store(&pagetable_dmap[l1_slot],
 			    (pa & ~L1_OFFSET) | ATTR_DEFAULT | ATTR_XN |
 			    ATTR_IDX(CACHED_MEMORY) | L1_BLOCK);
 		}
@@ -682,7 +683,7 @@ pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t mi
 				    (vm_offset_t)l2);
 				freemempos += PAGE_SIZE;
 
-				pmap_load_store(&pagetable_dmap[l1_slot],
+				pmap_store(&pagetable_dmap[l1_slot],
 				    (l2_pa & ~Ln_TABLE_MASK) | L1_TABLE);
 
 				memset(l2, 0, PAGE_SIZE);
@@ -692,7 +693,7 @@ pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t mi
 			for (; va < DMAP_MAX_ADDRESS && pa < physmap[i + 1];
 			    pa += L2_SIZE, va += L2_SIZE) {
 				l2_slot = pmap_l2_index(va);
-				pmap_load_store(&l2[l2_slot],
+				pmap_store(&l2[l2_slot],
 				    (pa & ~L2_OFFSET) | ATTR_DEFAULT | ATTR_XN |
 				    ATTR_IDX(CACHED_MEMORY) | L2_BLOCK);
 			}
@@ -727,7 +728,7 @@ pmap_bootstrap_l2(vm_offset_t l1pt, vm_offset_t va, vm
 		KASSERT(l1_slot < Ln_ENTRIES, ("Invalid L1 index"));
 
 		pa = pmap_early_vtophys(l1pt, l2pt);
-		pmap_load_store(&l1[l1_slot],
+		pmap_store(&l1[l1_slot],
 		    (pa & ~Ln_TABLE_MASK) | L1_TABLE);
 		l2pt += PAGE_SIZE;
 	}
@@ -757,7 +758,7 @@ pmap_bootstrap_l3(vm_offset_t l1pt, vm_offset_t va, vm
 		KASSERT(l2_slot < Ln_ENTRIES, ("Invalid L2 index"));
 
 		pa = pmap_early_vtophys(l1pt, l3pt);
-		pmap_load_store(&l2[l2_slot],
+		pmap_store(&l2[l2_slot],
 		    (pa & ~Ln_TABLE_MASK) | L2_TABLE);
 		l3pt += PAGE_SIZE;
 	}
@@ -1540,7 +1541,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, str
 
 		l0index = ptepindex - (NUL2E + NUL1E);
 		l0 = &pmap->pm_l0[l0index];
-		pmap_load_store(l0, VM_PAGE_TO_PHYS(m) | L0_TABLE);
+		pmap_store(l0, VM_PAGE_TO_PHYS(m) | L0_TABLE);
 	} else if (ptepindex >= NUL2E) {
 		vm_pindex_t l0index, l1index;
 		pd_entry_t *l0, *l1;
@@ -1566,7 +1567,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, str
 
 		l1 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l0) & ~ATTR_MASK);
 		l1 = &l1[ptepindex & Ln_ADDR_MASK];
-		pmap_load_store(l1, VM_PAGE_TO_PHYS(m) | L1_TABLE);
+		pmap_store(l1, VM_PAGE_TO_PHYS(m) | L1_TABLE);
 	} else {
 		vm_pindex_t l0index, l1index;
 		pd_entry_t *l0, *l1, *l2;
@@ -1608,7 +1609,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, str
 
 		l2 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l1) & ~ATTR_MASK);
 		l2 = &l2[ptepindex & Ln_ADDR_MASK];
-		pmap_load_store(l2, VM_PAGE_TO_PHYS(m) | L2_TABLE);
+		pmap_store(l2, VM_PAGE_TO_PHYS(m) | L2_TABLE);
 	}
 
 	pmap_resident_count_inc(pmap, 1);
@@ -1781,7 +1782,7 @@ pmap_growkernel(vm_offset_t addr)
 			if ((nkpg->flags & PG_ZERO) == 0)
 				pmap_zero_page(nkpg);
 			paddr = VM_PAGE_TO_PHYS(nkpg);
-			pmap_load_store(l1, paddr | L1_TABLE);
+			pmap_store(l1, paddr | L1_TABLE);
 			continue; /* try again */
 		}
 		l2 = pmap_l1_to_l2(l1, kernel_vm_end);
@@ -3018,7 +3019,7 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_ent
 	pmap_invalidate_range_nopin(pmap, va, va + size);
 
 	/* Create the new mapping */
-	pmap_load_store(pte, newpte);
+	pmap_store(pte, newpte);
 	dsb(ishst);
 
 	critical_exit();
@@ -3304,12 +3305,9 @@ havel3:
 			/*
 			 * No, might be a protection or wiring change.
 			 */
-			if ((orig_l3 & ATTR_SW_MANAGED) != 0) {
-				if ((new_l3 & ATTR_AP(ATTR_AP_RW)) ==
-				    ATTR_AP(ATTR_AP_RW)) {
-					vm_page_aflag_set(m, PGA_WRITEABLE);
-				}
-			}
+			if ((orig_l3 & ATTR_SW_MANAGED) != 0 &&
+			    (new_l3 & ATTR_SW_DBM) != 0)
+				vm_page_aflag_set(m, PGA_WRITEABLE);
 			goto validate;
 		}
 
@@ -3415,7 +3413,7 @@ validate:
 		}
 	} else {
 		/* New mapping */
-		pmap_load_store(l3, new_l3);
+		pmap_store(l3, new_l3);
 		dsb(ishst);
 	}
 
@@ -3517,12 +3515,16 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t 
 		vm_page_free_pages_toq(&free, true);
 		if (va >= VM_MAXUSER_ADDRESS) {
 			/*
-			 * Both pmap_remove_l2() and pmap_remove_l3() will
-			 * leave the kernel page table page zero filled.
+			 * Both pmap_remove_l2() and pmap_remove_l3_range()
+			 * will leave the kernel page table page zero filled.
+			 * Nonetheless, the TLB could have an intermediate
+			 * entry for the kernel page table page.
 			 */
 			mt = PHYS_TO_VM_PAGE(pmap_load(l2) & ~ATTR_MASK);
 			if (pmap_insert_pt_page(pmap, mt, false))
 				panic("pmap_enter_l2: trie insert failed");
+			pmap_clear(l2);
+			pmap_invalidate_page(pmap, va);
 		} else
 			KASSERT(pmap_load(l2) == 0,
 			    ("pmap_enter_l2: non-zero L2 entry %p", l2));
@@ -3536,10 +3538,13 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t 
 			SLIST_INIT(&free);
 			if (pmap_unwire_l3(pmap, va, l2pg, &free)) {
 				/*
-				 * Although "va" is not mapped, paging-structure
-				 * caches could nonetheless have entries that
+				 * Although "va" is not mapped, the TLB could
+				 * nonetheless have intermediate entries that
 				 * refer to the freed page table pages.
 				 * Invalidate those entries.
+				 *
+				 * XXX redundant invalidation (See
+				 * _pmap_unwire_l3().)
 				 */
 				pmap_invalidate_page(pmap, va);
 				vm_page_free_pages_toq(&free, true);
@@ -3564,7 +3569,7 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t 
 	/*
 	 * Map the superpage.
 	 */
-	(void)pmap_load_store(l2, new_l2);
+	pmap_store(l2, new_l2);
 	dsb(ishst);
 
 	atomic_add_long(&pmap_l2_mappings, 1);
@@ -3767,7 +3772,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v
 	    m->md.pv_memattr == VM_MEMATTR_WRITE_BACK)
 		cpu_icache_sync_range(PHYS_TO_DMAP(pa), PAGE_SIZE);
 
-	pmap_load_store(l3, l3_val);
+	pmap_store(l3, l3_val);
 	dsb(ishst);
 
 	return (mpte);
@@ -3840,7 +3845,7 @@ pmap_unwire(pmap_t pmap, vm_offset_t sva, vm_offset_t 
 			 * demote the mapping and fall through.
 			 */
 			if (sva + L2_SIZE == va_next && eva >= va_next) {
-				atomic_clear_64(l2, ATTR_SW_WIRED);
+				pmap_clear_bits(l2, ATTR_SW_WIRED);
 				pmap->pm_stats.wired_count -= L2_SIZE /
 				    PAGE_SIZE;
 				continue;
@@ -3865,7 +3870,7 @@ pmap_unwire(pmap_t pmap, vm_offset_t sva, vm_offset_t 
 			 * the pmap lock synchronizes access to ATTR_SW_WIRED,
 			 * the System MMU may write to the entry concurrently.
 			 */
-			atomic_clear_64(l3, ATTR_SW_WIRED);
+			pmap_clear_bits(l3, ATTR_SW_WIRED);
 			pmap->pm_stats.wired_count--;
 		}
 	}
@@ -3944,8 +3949,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_
 				nbits = 0;
 				if ((srcptepaddr & ATTR_SW_DBM) != 0)
 					nbits |= ATTR_AP_RW_BIT;
-				(void)pmap_load_store(l2,
-				    (srcptepaddr & ~mask) | nbits);
+				pmap_store(l2, (srcptepaddr & ~mask) | nbits);
 				pmap_resident_count_inc(dst_pmap, L2_SIZE /
 				    PAGE_SIZE);
 				atomic_add_long(&pmap_l2_mappings, 1);
@@ -3994,8 +3998,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_
 				nbits = 0;
 				if ((ptetemp & ATTR_SW_DBM) != 0)
 					nbits |= ATTR_AP_RW_BIT;
-				(void)pmap_load_store(dst_pte,
-				    (ptetemp & ~mask) | nbits);
+				pmap_store(dst_pte, (ptetemp & ~mask) | nbits);
 				pmap_resident_count_inc(dst_pmap, 1);
 			} else {
 				SLIST_INIT(&free);
@@ -4003,8 +4006,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_
 				    &free)) {
 					/*
 					 * Although "addr" is not mapped,
-					 * paging-structure caches could
-					 * nonetheless have entries that refer
+					 * the TLB could nonetheless have
+					 * intermediate entries that refer
 					 * to the freed page table pages.
 					 * Invalidate those entries.
 					 *

From owner-svn-src-head@freebsd.org  Sun Jul 21 10:52:14 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F677B0434;
 Sun, 21 Jul 2019 10:52:14 +0000 (UTC) (envelope-from dim@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 E397374901;
 Sun, 21 Jul 2019 10:52:13 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from tensor.andric.com (tensor.andric.com [87.251.56.140])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "tensor.andric.com",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 (Authenticated sender: dim)
 by smtp.freebsd.org (Postfix) with ESMTPSA id A40952874;
 Sun, 21 Jul 2019 10:52:13 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from [IPv6:2001:470:7a58::104b:b8b8:f8:c359] (unknown
 [IPv6:2001:470:7a58:0:104b:b8b8:f8:c359])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by tensor.andric.com (Postfix) with ESMTPSA id C48103F464;
 Sun, 21 Jul 2019 12:52:11 +0200 (CEST)
From: Dimitry Andric <dim@FreeBSD.org>
Message-Id: <DB9BB770-69E1-4C26-9FB6-F89FAB86E48F@FreeBSD.org>
Content-Type: multipart/signed;
 boundary="Apple-Mail=_7E1D2CF0-5A3A-4F02-9BAF-3E13608C51FA";
 protocol="application/pgp-signature"; micalg=pgp-sha1
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\))
Subject: Re: svn commit: r350184 - in head: libexec/rc/rc.d
 release/picobsd/tinyware/login share/man/man5 usr.bin/login
Date: Sun, 21 Jul 2019 12:52:11 +0200
In-Reply-To: <201907202056.x6KKuWsF011171@repo.freebsd.org>
Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
To: Conrad Meyer <cem@FreeBSD.org>
References: <201907202056.x6KKuWsF011171@repo.freebsd.org>
X-Mailer: Apple Mail (2.3445.104.11)
X-Rspamd-Queue-Id: E397374901
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 21 Jul 2019 10:52:14 -0000


--Apple-Mail=_7E1D2CF0-5A3A-4F02-9BAF-3E13608C51FA
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii

On 20 Jul 2019, at 22:56, Conrad Meyer <cem@FreeBSD.org> wrote:
> 
> Author: cem
> Date: Sat Jul 20 20:56:31 2019
> New Revision: 350184
> URL: https://svnweb.freebsd.org/changeset/base/350184
> 
> Log:
>  motd: Generate from template to /var/run

And the "why?" is probably: "to avoid writing in /etc"?

-Dimitry


--Apple-Mail=_7E1D2CF0-5A3A-4F02-9BAF-3E13608C51FA
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.2

iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXTRD2wAKCRCwXqMKLiCW
o7otAKDVlomyZfABREjfzd2gb44Vw/P13wCg/O+JGO+w3TL8RkzkgRFt3juPLZA=
=ObSF
-----END PGP SIGNATURE-----

--Apple-Mail=_7E1D2CF0-5A3A-4F02-9BAF-3E13608C51FA--

From owner-svn-src-head@freebsd.org  Sun Jul 21 11:07:40 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F1A6B0B6B;
 Sun, 21 Jul 2019 11:07:40 +0000 (UTC)
 (envelope-from rene@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 4246C75209;
 Sun, 21 Jul 2019 11:07:40 +0000 (UTC)
 (envelope-from rene@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 1BDED2229F;
 Sun, 21 Jul 2019 11:07:40 +0000 (UTC)
 (envelope-from rene@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6LB7d5Z011479;
 Sun, 21 Jul 2019 11:07:39 GMT (envelope-from rene@FreeBSD.org)
Received: (from rene@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6LB7dNp011478;
 Sun, 21 Jul 2019 11:07:39 GMT (envelope-from rene@FreeBSD.org)
Message-Id: <201907211107.x6LB7dNp011478@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rene set sender to
 rene@FreeBSD.org using -f
From: Rene Ladan <rene@FreeBSD.org>
Date: Sun, 21 Jul 2019 11:07:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350194 - head/share/misc
X-SVN-Group: head
X-SVN-Commit-Author: rene
X-SVN-Commit-Paths: head/share/misc
X-SVN-Commit-Revision: 350194
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 4246C75209
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_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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 21 Jul 2019 11:07:40 -0000

Author: rene (doc,ports committer)
Date: Sun Jul 21 11:07:39 2019
New Revision: 350194
URL: https://svnweb.freebsd.org/changeset/base/350194

Log:
  Mark Felder has stepped down from portmgr and ports-secteam

Modified:
  head/share/misc/organization.dot

Modified: head/share/misc/organization.dot
==============================================================================
--- head/share/misc/organization.dot	Sun Jul 21 10:58:25 2019	(r350193)
+++ head/share/misc/organization.dot	Sun Jul 21 11:07:39 2019	(r350194)
@@ -30,11 +30,11 @@ coresecretary [label="Core Team Secretary\ncore-secret
 doccommitters [label="Doc/www Committers\ndoc-committers@FreeBSD.org"]
 doceng [label="Documentation Engineering Team\ndoceng@FreeBSD.org\nbcr, gabor, gjb, hrs,\nblackend, ryusuke, wblock"]
 portscommitters [label="Ports Committers\nports-committers@FreeBSD.org"]
-portmgr [label="Port Management Team\nportmgr@FreeBSD.org\nadamw, antoine, bapt, bdrewery\nfeld, mat, rene, swills"]
+portmgr [label="Port Management Team\nportmgr@FreeBSD.org\nadamw, antoine, bapt, bdrewery\nmat, rene, swills"]
 portmgrsecretary [label="Port Management Team Secretary\nportmgr-secretary@FreeBSD.org\nrene"]
 re [label="Primary Release Engineering Team\nre@FreeBSD.org\ngjb, kib,\nbdrewery, blackend,\nrgrimes, delphij,\nhrs, glebius,\nmarius"]
 secteam [label="Security Team\nsecteam@FreeBSD.org\nbenno, delphij,\ndes, emaste,\ngjb, gordon,\nremko"]
-portssecteam [label="Ports Security Team\nports-secteam@FreeBSD.org\ndelphij, amdmi3, eadler, feld, jgh, rea, riggs, sbz, simon, swills, zi"]
+portssecteam [label="Ports Security Team\nports-secteam@FreeBSD.org\ndelphij, amdmi3, eadler, jgh, rea, riggs, sbz, simon, swills, zi"]
 secteamsecretary [label="Security Team Secretary\nsecteam-secretary@FreeBSD.org\nremko"]
 securityofficer [label="Security Officer Team\nsecurity-officer@FreeBSD.org\nbenno, delphij,\ndes, emaste,\ngjb, gordon,\nremko"]
 srccommitters [label="Src Committers\nsrc-committers@FreeBSD.org"]

From owner-svn-src-head@freebsd.org  Sun Jul 21 15:07:14 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 20CF0B5920;
 Sun, 21 Jul 2019 15:07:14 +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 F155883A5E;
 Sun, 21 Jul 2019 15:07:13 +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 C8A3424FAE;
 Sun, 21 Jul 2019 15:07:13 +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 x6LF7Dll053556;
 Sun, 21 Jul 2019 15:07:13 GMT (envelope-from kib@FreeBSD.org)
Received: (from kib@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6LF7C7G053552;
 Sun, 21 Jul 2019 15:07:12 GMT (envelope-from kib@FreeBSD.org)
Message-Id: <201907211507.x6LF7C7G053552@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org
 using -f
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Sun, 21 Jul 2019 15:07:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350199 - in head/sys: kern sys
X-SVN-Group: head
X-SVN-Commit-Author: kib
X-SVN-Commit-Paths: in head/sys: kern sys
X-SVN-Commit-Revision: 350199
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: F155883A5E
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_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.98)[-0.984,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 21 Jul 2019 15:07:14 -0000

Author: kib
Date: Sun Jul 21 15:07:12 2019
New Revision: 350199
URL: https://svnweb.freebsd.org/changeset/base/350199

Log:
  Check and avoid overflow when incrementing fp->f_count in
  fget_unlocked() and fhold().
  
  On sufficiently large machine, f_count can be legitimately very large,
  e.g. malicious code can dup same fd up to the per-process
  filedescriptors limit, and then fork as much as it can.
  On some smaller machine, I see
  	kern.maxfilesperproc: 939132
  	kern.maxprocperuid: 34203
  which already overflows u_int.  More, the malicious code can create
  transient references by sending fds over unix sockets.
  
  I realized that this check is missed after reading
  https://secfault-security.com/blog/FreeBSD-SA-1902.fd.html
  
  Reviewed by:	markj (previous version), mjg
  Tested by:	pho (previous version)
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D20947

Modified:
  head/sys/kern/kern_descrip.c
  head/sys/kern/sys_generic.c
  head/sys/kern/uipc_usrreq.c
  head/sys/sys/file.h
  head/sys/sys/refcount.h

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Sun Jul 21 11:40:00 2019	(r350198)
+++ head/sys/kern/kern_descrip.c	Sun Jul 21 15:07:12 2019	(r350199)
@@ -853,6 +853,10 @@ kern_dup(struct thread *td, u_int mode, int flags, int
 		goto unlock;
 	}
 
+	oldfde = &fdp->fd_ofiles[old];
+	if (!fhold(oldfde->fde_file))
+		goto unlock;
+
 	/*
 	 * If the caller specified a file descriptor, make sure the file
 	 * table is large enough to hold it, and grab it.  Otherwise, just
@@ -861,13 +865,17 @@ kern_dup(struct thread *td, u_int mode, int flags, int
 	switch (mode) {
 	case FDDUP_NORMAL:
 	case FDDUP_FCNTL:
-		if ((error = fdalloc(td, new, &new)) != 0)
+		if ((error = fdalloc(td, new, &new)) != 0) {
+			fdrop(oldfde->fde_file, td);
 			goto unlock;
+		}
 		break;
 	case FDDUP_MUSTREPLACE:
 		/* Target file descriptor must exist. */
-		if (fget_locked(fdp, new) == NULL)
+		if (fget_locked(fdp, new) == NULL) {
+			fdrop(oldfde->fde_file, td);
 			goto unlock;
+		}
 		break;
 	case FDDUP_FIXED:
 		if (new >= fdp->fd_nfiles) {
@@ -884,6 +892,7 @@ kern_dup(struct thread *td, u_int mode, int flags, int
 				error = racct_set_unlocked(p, RACCT_NOFILE, new + 1);
 				if (error != 0) {
 					error = EMFILE;
+					fdrop(oldfde->fde_file, td);
 					goto unlock;
 				}
 			}
@@ -899,8 +908,6 @@ kern_dup(struct thread *td, u_int mode, int flags, int
 
 	KASSERT(old != new, ("new fd is same as old"));
 
-	oldfde = &fdp->fd_ofiles[old];
-	fhold(oldfde->fde_file);
 	newfde = &fdp->fd_ofiles[new];
 	delfp = newfde->fde_file;
 
@@ -1901,12 +1908,14 @@ finstall(struct thread *td, struct file *fp, int *fd, 
 
 	MPASS(fd != NULL);
 
+	if (!fhold(fp))
+		return (EBADF);
 	FILEDESC_XLOCK(fdp);
 	if ((error = fdalloc(td, 0, fd))) {
 		FILEDESC_XUNLOCK(fdp);
+		fdrop(fp, td);
 		return (error);
 	}
-	fhold(fp);
 	_finstall(fdp, fp, *fd, flags, fcaps);
 	FILEDESC_XUNLOCK(fdp);
 	return (0);
@@ -2047,7 +2056,8 @@ fdcopy(struct filedesc *fdp)
 	for (i = 0; i <= fdp->fd_lastfile; ++i) {
 		ofde = &fdp->fd_ofiles[i];
 		if (ofde->fde_file == NULL ||
-		    (ofde->fde_file->f_ops->fo_flags & DFLAG_PASSABLE) == 0) {
+		    (ofde->fde_file->f_ops->fo_flags & DFLAG_PASSABLE) == 0 ||
+		    !fhold(ofde->fde_file)) {
 			if (newfdp->fd_freefile == -1)
 				newfdp->fd_freefile = i;
 			continue;
@@ -2055,7 +2065,6 @@ fdcopy(struct filedesc *fdp)
 		nfde = &newfdp->fd_ofiles[i];
 		*nfde = *ofde;
 		filecaps_copy(&ofde->fde_caps, &nfde->fde_caps, true);
-		fhold(nfde->fde_file);
 		fdused_init(newfdp, i);
 		newfdp->fd_lastfile = i;
 	}
@@ -2108,10 +2117,13 @@ fdcopy_remapped(struct filedesc *fdp, const int *fds, 
 			error = EINVAL;
 			goto bad;
 		}
+		if (!fhold(nfde->fde_file)) {
+			error = EBADF;
+			goto bad;
+		}
 		nfde = &newfdp->fd_ofiles[i];
 		*nfde = *ofde;
 		filecaps_copy(&ofde->fde_caps, &nfde->fde_caps, true);
-		fhold(nfde->fde_file);
 		fdused_init(newfdp, i);
 		newfdp->fd_lastfile = i;
 	}
@@ -2153,9 +2165,9 @@ fdclearlocks(struct thread *td)
 	    (p->p_leader->p_flag & P_ADVLOCK) != 0) {
 		for (i = 0; i <= fdp->fd_lastfile; i++) {
 			fp = fdp->fd_ofiles[i].fde_file;
-			if (fp == NULL || fp->f_type != DTYPE_VNODE)
+			if (fp == NULL || fp->f_type != DTYPE_VNODE ||
+			    !fhold(fp))
 				continue;
-			fhold(fp);
 			FILEDESC_XUNLOCK(fdp);
 			lf.l_whence = SEEK_SET;
 			lf.l_start = 0;
@@ -2596,8 +2608,8 @@ fget_cap(struct thread *td, int fd, cap_rights_t *need
 get_locked:
 	FILEDESC_SLOCK(fdp);
 	error = fget_cap_locked(fdp, fd, needrightsp, fpp, havecapsp);
-	if (error == 0)
-		fhold(*fpp);
+	if (error == 0 && !fhold(*fpp))
+		error = EBADF;
 	FILEDESC_SUNLOCK(fdp);
 #endif
 	return (error);
@@ -2656,14 +2668,19 @@ fget_unlocked(struct filedesc *fdp, int fd, cap_rights
 			 * table before this fd was closed, so it possible that
 			 * there is a stale fp pointer in cached version.
 			 */
-			fdt = *(const struct fdescenttbl * const volatile *)&(fdp->fd_files);
+			fdt = *(const struct fdescenttbl * const volatile *)
+			    &(fdp->fd_files);
 			continue;
 		}
+		if (__predict_false(count + 1 < count))
+			return (EBADF);
+
 		/*
 		 * Use an acquire barrier to force re-reading of fdt so it is
 		 * refreshed for verification.
 		 */
-		if (atomic_fcmpset_acq_int(&fp->f_count, &count, count + 1) == 0)
+		if (__predict_false(atomic_fcmpset_acq_int(&fp->f_count,
+		    &count, count + 1) == 0))
 			goto retry;
 		fdt = fdp->fd_files;
 #ifdef	CAPABILITIES
@@ -3048,7 +3065,11 @@ dupfdopen(struct thread *td, struct filedesc *fdp, int
 			FILEDESC_XUNLOCK(fdp);
 			return (EACCES);
 		}
-		fhold(fp);
+		if (!fhold(fp)) {
+			fdunused(fdp, indx);
+			FILEDESC_XUNLOCK(fdp);
+			return (EBADF);
+		}
 		newfde = &fdp->fd_ofiles[indx];
 		oldfde = &fdp->fd_ofiles[dfd];
 		ioctls = filecaps_copy_prep(&oldfde->fde_caps);

Modified: head/sys/kern/sys_generic.c
==============================================================================
--- head/sys/kern/sys_generic.c	Sun Jul 21 11:40:00 2019	(r350198)
+++ head/sys/kern/sys_generic.c	Sun Jul 21 15:07:12 2019	(r350199)
@@ -757,7 +757,11 @@ kern_ioctl(struct thread *td, int fd, u_long com, cadd
 		fp = NULL;	/* fhold() was not called yet */
 		goto out;
 	}
-	fhold(fp);
+	if (!fhold(fp)) {
+		error = EBADF;
+		fp = NULL;
+		goto out;
+	}
 	if (locked == LA_SLOCKED) {
 		FILEDESC_SUNLOCK(fdp);
 		locked = LA_UNLOCKED;

Modified: head/sys/kern/uipc_usrreq.c
==============================================================================
--- head/sys/kern/uipc_usrreq.c	Sun Jul 21 11:40:00 2019	(r350198)
+++ head/sys/kern/uipc_usrreq.c	Sun Jul 21 15:07:12 2019	(r350199)
@@ -2154,7 +2154,7 @@ unp_internalize(struct mbuf **controlp, struct thread 
 	struct timespec *ts;
 	void *data;
 	socklen_t clen, datalen;
-	int i, error, *fdp, oldfds;
+	int i, j, error, *fdp, oldfds;
 	u_int newlen;
 
 	UNP_LINK_UNLOCK_ASSERT();
@@ -2237,6 +2237,19 @@ unp_internalize(struct mbuf **controlp, struct thread 
 				goto out;
 			}
 			fdp = data;
+			for (i = 0; i < oldfds; i++, fdp++) {
+				if (!fhold(fdesc->fd_ofiles[*fdp].fde_file)) {
+					fdp = data;
+					for (j = 0; j < i; j++, fdp++) {
+						fdrop(fdesc->fd_ofiles[*fdp].
+						    fde_file, td);
+					}
+					FILEDESC_SUNLOCK(fdesc);
+					error = EBADF;
+					goto out;
+				}
+			}
+			fdp = data;
 			fdep = (struct filedescent **)
 			    CMSG_DATA(mtod(*controlp, struct cmsghdr *));
 			fdev = malloc(sizeof(*fdev) * oldfds, M_FILECAPS,
@@ -2440,7 +2453,6 @@ unp_internalize_fp(struct file *fp)
 		unp->unp_file = fp;
 		unp->unp_msgcount++;
 	}
-	fhold(fp);
 	unp_rights++;
 	UNP_LINK_WUNLOCK();
 }
@@ -2601,10 +2613,10 @@ unp_gc(__unused void *arg, int pending)
 			if ((unp->unp_gcflag & UNPGC_DEAD) != 0) {
 				f = unp->unp_file;
 				if (unp->unp_msgcount == 0 || f == NULL ||
-				    f->f_count != unp->unp_msgcount)
+				    f->f_count != unp->unp_msgcount ||
+				    !fhold(f))
 					continue;
 				unref[total++] = f;
-				fhold(f);
 				KASSERT(total <= unp_unreachable,
 				    ("unp_gc: incorrect unreachable count."));
 			}

Modified: head/sys/sys/file.h
==============================================================================
--- head/sys/sys/file.h	Sun Jul 21 11:40:00 2019	(r350198)
+++ head/sys/sys/file.h	Sun Jul 21 15:07:12 2019	(r350199)
@@ -284,8 +284,12 @@ _fnoop(void)
 	return (0);
 }
 
-#define	fhold(fp)							\
-	(refcount_acquire(&(fp)->f_count))
+static __inline __result_use_check bool
+fhold(struct file *fp)
+{
+	return (refcount_acquire_checked(&fp->f_count));
+}
+
 #define	fdrop(fp, td)							\
 	(refcount_release(&(fp)->f_count) ? _fdrop((fp), (td)) : _fnoop())
 

Modified: head/sys/sys/refcount.h
==============================================================================
--- head/sys/sys/refcount.h	Sun Jul 21 11:40:00 2019	(r350198)
+++ head/sys/sys/refcount.h	Sun Jul 21 15:07:12 2019	(r350199)
@@ -54,6 +54,20 @@ refcount_acquire(volatile u_int *count)
 	atomic_add_int(count, 1);
 }
 
+static __inline __result_use_check bool
+refcount_acquire_checked(volatile u_int *count)
+{
+	u_int lcount;
+
+	for (lcount = *count;;) {
+		if (__predict_false(lcount + 1 < lcount))
+			return (false);
+		if (__predict_true(atomic_fcmpset_int(count, &lcount,
+		    lcount + 1) == 1))
+			return (true);
+	}
+}
+
 static __inline int
 refcount_release(volatile u_int *count)
 {

From owner-svn-src-head@freebsd.org  Sun Jul 21 16:24:40 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id DFBAEB78FB;
 Sun, 21 Jul 2019 16:24:40 +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 C1E978617C;
 Sun, 21 Jul 2019 16:24:40 +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 B244925EF4;
 Sun, 21 Jul 2019 16:24:40 +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 x6LGOess000225;
 Sun, 21 Jul 2019 16:24:40 GMT (envelope-from kib@FreeBSD.org)
Received: (from kib@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6LGOeSj000224;
 Sun, 21 Jul 2019 16:24:40 GMT (envelope-from kib@FreeBSD.org)
Message-Id: <201907211624.x6LGOeSj000224@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org
 using -f
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Sun, 21 Jul 2019 16:24:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350200 - head/sys/sys
X-SVN-Group: head
X-SVN-Commit-Author: kib
X-SVN-Commit-Paths: head/sys/sys
X-SVN-Commit-Revision: 350200
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: C1E978617C
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.935,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 21 Jul 2019 16:24:40 -0000

Author: kib
Date: Sun Jul 21 16:24:40 2019
New Revision: 350200
URL: https://svnweb.freebsd.org/changeset/base/350200

Log:
  Fix userspace build after r350199.
  
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/sys/refcount.h

Modified: head/sys/sys/refcount.h
==============================================================================
--- head/sys/sys/refcount.h	Sun Jul 21 15:07:12 2019	(r350199)
+++ head/sys/sys/refcount.h	Sun Jul 21 16:24:40 2019	(r350200)
@@ -36,6 +36,7 @@
 #ifdef _KERNEL
 #include <sys/systm.h>
 #else
+#include <stdbool.h>
 #define	KASSERT(exp, msg)	/* */
 #endif
 

From owner-svn-src-head@freebsd.org  Sun Jul 21 16:35:50 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05188B7CF2;
 Sun, 21 Jul 2019 16:35: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 DBCF0867C1;
 Sun, 21 Jul 2019 16:35: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 B2A3C2610E;
 Sun, 21 Jul 2019 16:35: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 x6LGZnTX006326;
 Sun, 21 Jul 2019 16:35:49 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6LGZn8P006325;
 Sun, 21 Jul 2019 16:35:49 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201907211635.x6LGZn8P006325@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Sun, 21 Jul 2019 16:35:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350201 - head/lib/libcasper/services/cap_fileargs
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: head/lib/libcasper/services/cap_fileargs
X-SVN-Commit-Revision: 350201
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: DBCF0867C1
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.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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 21 Jul 2019 16:35:50 -0000

Author: markj
Date: Sun Jul 21 16:35:49 2019
New Revision: 350201
URL: https://svnweb.freebsd.org/changeset/base/350201

Log:
  Link fileargs_lstat.3.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/lib/libcasper/services/cap_fileargs/Makefile

Modified: head/lib/libcasper/services/cap_fileargs/Makefile
==============================================================================
--- head/lib/libcasper/services/cap_fileargs/Makefile	Sun Jul 21 16:24:40 2019	(r350200)
+++ head/lib/libcasper/services/cap_fileargs/Makefile	Sun Jul 21 16:35:49 2019	(r350201)
@@ -30,6 +30,7 @@ MLINKS+=cap_fileargs.3 fileargs_fopen.3
 MLINKS+=cap_fileargs.3 fileargs_free.3
 MLINKS+=cap_fileargs.3 fileargs_init.3
 MLINKS+=cap_fileargs.3 fileargs_initnv.3
+MLINKS+=cap_fileargs.3 fileargs_lstat.3
 MLINKS+=cap_fileargs.3 fileargs_open.3
 
 .include <bsd.lib.mk>

From owner-svn-src-head@freebsd.org  Sun Jul 21 16:39:26 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 359FCB7DB1;
 Sun, 21 Jul 2019 16:39:26 +0000 (UTC)
 (envelope-from cse.cem@gmail.com)
Received: from mail-io1-f53.google.com (mail-io1-f53.google.com
 [209.85.166.53])
 (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 614E886937;
 Sun, 21 Jul 2019 16:39:24 +0000 (UTC)
 (envelope-from cse.cem@gmail.com)
Received: by mail-io1-f53.google.com with SMTP id q22so68749230iog.4;
 Sun, 21 Jul 2019 09:39:24 -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:reply-to
 :from:date:message-id:subject:to:cc;
 bh=JWpC9SGXYUeZ6BhWNRDVDBOWBV7McCftT/cuawQzqQE=;
 b=BkLMMtKMM2E8Ujg0EfwiXmshz9TtYiAgLu396G2nzTxrrC1yLcONH0+ghP1Ph/l7hL
 vN7H/hH8fPYeCmIx+z4rQKSED704UIZ6o2I5xl6B6SYPPFq14gkggdkU73kswKNM+Hqi
 cQFQojVNMq4IuRnSNw9pLMMcZl8HIcYECkXWembJAR495wj7Okk8026VjEun1qcRbnH+
 IvWVRPfMad4gAdBFkNwj4JBky76bo7BzYuCJLrducV56B/453bGkLoEU+Lff7nb08Fb3
 oVt54zt5tv0aC2KUf2n0cgm6MUfKAe9dZ42ymDMTTeCBIpvoEnRn8nucCL8LueTjTTYf
 LUjg==
X-Gm-Message-State: APjAAAUxLh/GKkzUZ9JXGRU5wtj+Fn3AQTkY+8Yp9RqO/qhwZk5Ndwr9
 1EaeG0RGD4wUtbTI/onh+9xy97oi
X-Google-Smtp-Source: APXvYqwA9gCWKnGv2FbSgTjNOUAoABUFTRKGnc8jK/naQUsLRc7bmsZ1rCuTaRYitJtW1e3VOwq+cw==
X-Received: by 2002:a02:a595:: with SMTP id b21mr14258799jam.28.1563726665653; 
 Sun, 21 Jul 2019 09:31:05 -0700 (PDT)
Received: from mail-io1-f49.google.com (mail-io1-f49.google.com.
 [209.85.166.49])
 by smtp.gmail.com with ESMTPSA id t4sm29050866iop.0.2019.07.21.09.31.05
 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128);
 Sun, 21 Jul 2019 09:31:05 -0700 (PDT)
Received: by mail-io1-f49.google.com with SMTP id q22so68723169iog.4;
 Sun, 21 Jul 2019 09:31:05 -0700 (PDT)
X-Received: by 2002:a02:6016:: with SMTP id i22mr43480844jac.56.1563726665114; 
 Sun, 21 Jul 2019 09:31:05 -0700 (PDT)
MIME-Version: 1.0
References: <201907202056.x6KKuWsF011171@repo.freebsd.org>
 <DB9BB770-69E1-4C26-9FB6-F89FAB86E48F@FreeBSD.org>
In-Reply-To: <DB9BB770-69E1-4C26-9FB6-F89FAB86E48F@FreeBSD.org>
Reply-To: cem@freebsd.org
From: Conrad Meyer <cem@freebsd.org>
Date: Sun, 21 Jul 2019 09:30:54 -0700
X-Gmail-Original-Message-ID: <CAG6CVpX2KSsZYzeSkXCZH4LP6=fKGYLYor9mDd_zb1RirtRRKw@mail.gmail.com>
Message-ID: <CAG6CVpX2KSsZYzeSkXCZH4LP6=fKGYLYor9mDd_zb1RirtRRKw@mail.gmail.com>
Subject: Re: svn commit: r350184 - in head: libexec/rc/rc.d
 release/picobsd/tinyware/login share/man/man5 usr.bin/login
To: Dimitry Andric <dim@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>, 
 svn-src-head <svn-src-head@freebsd.org>
Content-Type: text/plain; charset="UTF-8"
X-Rspamd-Queue-Id: 614E886937
X-Spamd-Bar: ----
Authentication-Results: mx1.freebsd.org;
 spf=pass (mx1.freebsd.org: domain of csecem@gmail.com designates 209.85.166.53
 as permitted sender) smtp.mailfrom=csecem@gmail.com
X-Spamd-Result: default: False [-4.70 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[];
 HAS_REPLYTO(0.00)[cem@freebsd.org];
 R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17];
 REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[4];
 TO_DN_ALL(0.00)[];
 MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com];
 NEURAL_HAM_SHORT(-0.86)[-0.855,0];
 FORGED_SENDER(0.30)[cem@freebsd.org,csecem@gmail.com];
 R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com];
 ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US];
 TAGGED_FROM(0.00)[];
 FROM_NEQ_ENVFROM(0.00)[cem@freebsd.org,csecem@gmail.com];
 ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0];
 FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4];
 TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0];
 MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+];
 DMARC_NA(0.00)[freebsd.org]; RCVD_TLS_LAST(0.00)[];
 RCVD_IN_DNSWL_NONE(0.00)[53.166.85.209.list.dnswl.org : 127.0.5.0];
 IP_SCORE(-1.83)[ip: (-3.24), ipnet: 209.85.128.0/17(-3.44), asn: 15169(-2.43),
 country: US(-0.05)]; 
 RWL_MAILSPIKE_POSSIBLE(0.00)[53.166.85.209.rep.mailspike.net : 127.0.0.17]
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 21 Jul 2019 16:39:26 -0000

On Sun, Jul 21, 2019 at 3:52 AM Dimitry Andric <dim@freebsd.org> wrote:
> On 20 Jul 2019, at 22:56, Conrad Meyer <cem@FreeBSD.org> wrote:
> > Author: cem
> > Date: Sat Jul 20 20:56:31 2019
> > New Revision: 350184
> > URL: https://svnweb.freebsd.org/changeset/base/350184
> >
> > Log:
> >  motd: Generate from template to /var/run
>
> And the "why?" is probably: "to avoid writing in /etc"?

Yep.  I could have done a better job of summarizing the issues brought
up in discussion in response to r349256.  Templated formatting works
for both ends: syncs and other writes are mostly elided, and the
possibility of corrupting the source template is removed.

Cheers,
Conrad

From owner-svn-src-head@freebsd.org  Sun Jul 21 16:59:01 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3754B8221
 for <svn-src-head@mailman.nyi.freebsd.org>;
 Sun, 21 Jul 2019 16:59:01 +0000 (UTC) (envelope-from ian@freebsd.org)
Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org
 [54.186.57.195])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 490A98708C
 for <svn-src-head@freebsd.org>; Sun, 21 Jul 2019 16:59:01 +0000 (UTC)
 (envelope-from ian@freebsd.org)
ARC-Seal: i=1; a=rsa-sha256; t=1563728333; cv=none;
 d=outbound.mailhop.org; s=arc-outbound20181012;
 b=WvN4zCzVHZsAPL3IbK7AZGzlCNvE494rQKYSaqgGbwo15/4tgXE1OgJE/Wx6SPgyj5du0t/gh8hqh
 GinRuS0Lr66RTNXmocxHB7/ZeynDSwIh5S0JP5kXNAJ9/aIJkKQ4j+qUDRl9fifNn49q/GvaHwPgzQ
 vji6Rrc2pNa6snIflmRmBhI9BOckHb8MuijlzOIuEhd4HsbANTBKmaXM1Ay2wqGEYEaIetOiPT54is
 KhDMwOW6uNd50gWKUE7ZBeJg2hq+lM1ukTlAXa603oui57coPsB2Ospcg1h3EDw4BMFKU3B9swGQJ5
 +llhuoMViLCcM3JOkA9JgwxeqoEhKxw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
 d=outbound.mailhop.org; s=arc-outbound20181012;
 h=content-transfer-encoding:mime-version:content-type:references:in-reply-to:
 date:to:from:subject:message-id:dkim-signature:from;
 bh=mw6yQv8J4XQOm7WZ6ETnqjS5yXJZDWKv/aSqN7OzDgQ=;
 b=mCnX4inmtU7g58aetAG3W13CGdCWy4RbwnJ58POsANFEs/HusY9ocmGHRPCVUKg13mjrZWXKUG/35
 cJSZBarPFz3lee25SK/YuCy7hi6bwNessxB6uAC+HzkhlcLWtWxBL/Y0MgBSBJzxmRqWrlvQSli479
 n0d5D/FF5y9mxBizg9Zj2JyHwhtUUZU4dhuVPZuz85ygCciDXD/Iie8662rjvjkpkLIO4VwOVWAKUS
 thmJXjOFk+8lY3lZ8LOUiPR/ljaqLa4bXlF8Cld4eqWAFxf5Ny/duG9cs8rkVm2xFVjHl98q5H/wAp
 swMm+U6ZsRa0z4mb+nj4fZ0o5VW1blw==
ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org;
 spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60;
 dmarc=none header.from=freebsd.org;
 arc=none header.oldest-pass=0;
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=outbound.mailhop.org; s=dkim-high;
 h=content-transfer-encoding:mime-version:content-type:references:in-reply-to:
 date:to:from:subject:message-id:from;
 bh=mw6yQv8J4XQOm7WZ6ETnqjS5yXJZDWKv/aSqN7OzDgQ=;
 b=FIfrwlzElV3VRePvvqKJZkGVshQgII4KtdfF7o2maX6XI6dJbKOcrDtMU42YPcnFhlgXDfj9zEYl6
 dWjSYyMdqfK6vorju5NDd+KKO6H4k9BbfMw34Jy5Pbzu439zByjDjcLUhgJrshoW393d67gEMSPVDR
 yXceYvSyVxGzSn+ihXe6Q4+TPrs9CuF+4xdxl8m4E/AKZzTaksf5yiBen7S77aLcBr5WUvRBo8bJqY
 svJD/3Cx29Qm1y+J536rwfvB02nuuIS6Cl9Iss0OpXGOHSbvoNji9Cmydzeop6nItMKrFqnNFzvZos
 7l+QD5dIhsY2L8fZHnCeGgQKmq2nu2w==
X-MHO-RoutePath: aGlwcGll
X-MHO-User: cfc61ec5-abd8-11e9-90e8-c17e0c9f2e02
X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information
X-Originating-IP: 67.177.211.60
X-Mail-Handler: DuoCircle Outbound SMTP
Received: from ilsoft.org (unknown [67.177.211.60])
 by outbound3.ore.mailhop.org (Halon) with ESMTPSA
 id cfc61ec5-abd8-11e9-90e8-c17e0c9f2e02;
 Sun, 21 Jul 2019 16:58:51 +0000 (UTC)
Received: from rev (rev [172.22.42.240])
 by ilsoft.org (8.15.2/8.15.2) with ESMTP id x6LGwnaH057414;
 Sun, 21 Jul 2019 10:58:49 -0600 (MDT) (envelope-from ian@freebsd.org)
Message-ID: <dfd32070a3816545796f6b0e6b3e366bc71d3652.camel@freebsd.org>
Subject: Re: svn commit: r350184 - in head: libexec/rc/rc.d
 release/picobsd/tinyware/login share/man/man5 usr.bin/login
From: Ian Lepore <ian@freebsd.org>
To: Conrad Meyer <cem@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
Date: Sun, 21 Jul 2019 10:58:49 -0600
In-Reply-To: <201907202056.x6KKuWsF011171@repo.freebsd.org>
References: <201907202056.x6KKuWsF011171@repo.freebsd.org>
Content-Type: text/plain; charset="UTF-8"
X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Rspamd-Queue-Id: 490A98708C
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.99 / 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.99)[-0.994,0];
 ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 21 Jul 2019 16:59:01 -0000

On Sat, 2019-07-20 at 20:56 +0000, Conrad Meyer wrote:
> Author: cem
> Date: Sat Jul 20 20:56:31 2019
> New Revision: 350184
> URL: https://svnweb.freebsd.org/changeset/base/350184
> 
> Log:
>   motd: Generate from template to /var/run
>   
>   Update login(1), its manual pages, similar utilities, and motd.5 to
> refer to
>   the new location.
>   
>   Suggested by:	delphij@ (re: r349256)
>   Reviewed by:	bcr (manpages), delphij
>   Differential Revision:	https://reviews.freebsd.org/D20721
> 
> Added:
>   head/usr.bin/login/motd.template
>      - copied, changed from r350183, head/usr.bin/login/motd
> Deleted:
>   head/usr.bin/login/motd
> Modified:
>   head/libexec/rc/rc.d/motd
>   head/release/picobsd/tinyware/login/pathnames.h
>   head/share/man/man5/motd.5
>   head/usr.bin/login/Makefile
>   head/usr.bin/login/login.1
>   head/usr.bin/login/login.conf
>   head/usr.bin/login/pathnames.h
> 
> Modified: head/libexec/rc/rc.d/motd
> =====================================================================
> =========
> --- head/libexec/rc/rc.d/motd	Sat Jul 20 20:47:07 2019	(r350183)
> +++ head/libexec/rc/rc.d/motd	Sat Jul 20 20:56:31 2019	(r350184)
> @@ -4,48 +4,52 @@
>  #
>  
>  # PROVIDE: motd
> -# REQUIRE: mountcritremote
> +# REQUIRE: mountcritremote FILESYSTEMS
>  # BEFORE:  LOGIN
>  
>  . /etc/rc.subr
>  
>  name="motd"
> -desc="Update /etc/motd"
> +desc="Update /var/run/motd"
>  rcvar="update_motd"
>  start_cmd="motd_start"
>  stop_cmd=":"
>  
> +COMPAT_MOTD="/etc/motd"
> +TARGET="/var/run/motd"
> +TEMPLATE="/etc/motd.template"
>  PERMS="644"
>  
>  motd_start()
>  {
> -	#	Update kernel info in /etc/motd
> +	#	Update kernel info in /var/run/motd
>  	#	Must be done *before* interactive logins are possible
>  	#	to prevent possible race conditions.
>  	#
>  	check_startmsgs && echo -n 'Updating motd:'
> -	if [ ! -f /etc/motd ]; then
> -		install -c -o root -g wheel -m ${PERMS} /dev/null
> /etc/motd
> +	if [ ! -f "${TEMPLATE}" ]; then
> +		# Create missing template from existing regular motd
> file, if
> +		# one exists.
> +		if [ -f "${COMPAT_MOTD}" ]; then
> +			sed '1{/^FreeBSD.*/{d;};};' "${COMPAT_MOTD}" >
> "${TEMPLATE}"
> +			chmod $PERMS "${TEMPLATE}"
> +			rm -f "${COMPAT_MOTD}"
> +		else
> +			# Otherwise, create an empty template file.
> +			install -c -o root -g wheel -m ${PERMS}
> /dev/null "${TEMPLATE}"
> +		fi
> +		# Provide compatibility symlink:
> +		if [ ! -h "${COMPAT_MOTD}" ]; then
> +			ln -sF "${TARGET}" "${COMPAT_MOTD}"
> +		fi
>  	fi
>  
> -	if [ ! -w /etc/motd ]; then
> -		echo ' /etc/motd is not writable, update failed.'
> -		return
> -	fi
> -
>  	T=`mktemp -t motd`
>  	uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-
> 9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T}
> -	awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print
> "\n"$0}} else {print}}' < /etc/motd >> ${T}
> +	cat "${TEMPLATE}" >> ${T}
>  
> -	if ! cmp -s $T /etc/motd; then
> -		mv -f $T /etc/.motd.tmp
> -		fsync /etc/.motd.tmp
> -		mv -f /etc/.motd.tmp /etc/motd
> -		chmod ${PERMS} /etc/motd
> -		fsync /etc
> -	else
> -		rm -f $T
> -	fi
> +	install -C -o root -g wheel -m "${PERMS}" "$T" "${TARGET}"
> +	rm -f "$T"
>  
>  	check_startmsgs && echo '.'
>  }
> 
> Modified: head/release/picobsd/tinyware/login/pathnames.h
> =====================================================================
> =========
> --- head/release/picobsd/tinyware/login/pathnames.h	Sat Jul 20
> 20:47:07 2019	(r350183)
> +++ head/release/picobsd/tinyware/login/pathnames.h	Sat Jul 20
> 20:56:31 2019	(r350184)
> @@ -39,7 +39,7 @@
>  #include <paths.h>
>  
>  #define	_PATH_HUSHLOGIN		".hushlogin"
> -#define	_PATH_MOTDFILE		"/etc/motd"
> +#define	_PATH_MOTDFILE		"/var/run/motd"
>  #define _PATH_LOGACCESS		"/etc/login.access"
>  #define _PATH_FBTAB		"/etc/fbtab"
>  #define _PATH_LOGINDEVPERM	"/etc/logindevperm"
> 
> Modified: head/share/man/man5/motd.5
> =====================================================================
> =========
> --- head/share/man/man5/motd.5	Sat Jul 20 20:47:07 2019	(r350
> 183)
> +++ head/share/man/man5/motd.5	Sat Jul 20 20:56:31 2019	(r350
> 184)
> @@ -3,7 +3,7 @@
>  .\" This file is in the public domain.
>  .\" $FreeBSD$
>  .\"
> -.Dd February 13, 1997
> +.Dd July 20, 2019
>  .Dt MOTD 5
>  .Os
>  .Sh NAME
> @@ -11,13 +11,16 @@
>  .Nd file containing message(s) of the day
>  .Sh DESCRIPTION
>  The file
> -.Pa /etc/motd
> +.Pa /var/run/motd
>  is normally displayed by
>  .Xr login 1
>  after a user has logged in but before the shell is run.
>  It is generally used for important system-wide announcements.
>  During system startup, a line containing the kernel version string
> is
> -prepended to this file.
> +prepended to
> +.Pa /etc/motd.template
> +and the contents are written to
> +.Pa /var/run/motd .
>  .Pp
>  Individual users may suppress the display of this file by
>  creating a file named
> @@ -26,11 +29,13 @@ in their home directories or through
>  .Xr login.conf 5 .
>  .Sh FILES
>  .Bl -tag -width $HOME/.hushlogin -compact
> -.It Pa /etc/motd
> +.It Pa /etc/motd.template
> +The template file that system administrators can edit.
> +.It Pa /var/run/motd
>  The message of the day.
>  .It Pa $HOME/.hushlogin
>  Suppresses output of
> -.Pa /etc/motd .
> +.Pa /var/run/motd .
>  .El
>  .Sh EXAMPLES
>  .Bd -literal
> @@ -41,3 +46,9 @@ FreeBSD 2.1.6.1-RELEASE (GENERIC) #0: Sun Dec 29
> 03:08
>  .Sh SEE ALSO
>  .Xr login 1 ,
>  .Xr login.conf 5
> +.Sh HISTORY
> +Prior to
> +.Fx 13.0 ,
> +.Nm
> +lived in
> +.Pa /etc .
> 
> Modified: head/usr.bin/login/Makefile
> =====================================================================
> =========
> --- head/usr.bin/login/Makefile	Sat Jul 20 20:47:07 2019	(r350
> 183)
> +++ head/usr.bin/login/Makefile	Sat Jul 20 20:56:31 2019	(r350
> 184)
> @@ -3,7 +3,7 @@
>  
>  .include <src.opts.mk>
>  
> -CONFS=	fbtab login.conf motd login.access
> +CONFS=	fbtab login.conf motd.template login.access
>  PROG=	login
>  SRCS=	login.c login_fbtab.c
>  CFLAGS+=-DLOGALL
> 
> Modified: head/usr.bin/login/login.1
> =====================================================================
> =========
> --- head/usr.bin/login/login.1	Sat Jul 20 20:47:07 2019	(r350
> 183)
> +++ head/usr.bin/login/login.1	Sat Jul 20 20:56:31 2019	(r350
> 184)
> @@ -28,7 +28,7 @@
>  .\"	@(#)login.1	8.2 (Berkeley) 5/5/94
>  .\" $FreeBSD$
>  .\"
> -.Dd September 13, 2006
> +.Dd July 20, 2019
>  .Dt LOGIN 1
>  .Os
>  .Sh NAME
> @@ -131,7 +131,7 @@ result in an error exit from
>  changes device protections
>  .It Pa /etc/login.conf
>  login class capabilities database
> -.It Pa /etc/motd
> +.It Pa /var/run/motd
>  message-of-the-day
>  .It Pa /var/mail/user
>  system mailboxes
> 
> Modified: head/usr.bin/login/login.conf
> =====================================================================
> =========
> --- head/usr.bin/login/login.conf	Sat Jul 20 20:47:07 2019	(r350
> 183)
> +++ head/usr.bin/login/login.conf	Sat Jul 20 20:56:31 2019	(r350
> 184)
> @@ -25,7 +25,7 @@
>  default:\
>  	:passwd_format=sha512:\
>  	:copyright=/etc/COPYRIGHT:\
> -	:welcome=/etc/motd:\
> +	:welcome=/var/run/motd:\
>  	:setenv=MAIL=/var/mail/$,BLOCKSIZE=K:\
>  	:path=/sbin /bin /usr/sbin /usr/bin /usr/local/sbin
> /usr/local/bin ~/bin:\
>  	:nologin=/var/run/nologin:\
> @@ -120,7 +120,7 @@ russian|Russian Users Accounts:\
>  ##
>  #standard:\
>  #	:copyright=/etc/COPYRIGHT:\
> -#	:welcome=/etc/motd:\
> +#	:welcome=/var/run/motd:\
>  #	:setenv=MAIL=/var/mail/$,BLOCKSIZE=K:\
>  #	:path=~/bin /bin /usr/bin /usr/local/bin:\
>  #	:manpath=/usr/share/man /usr/local/man:\
> 
> Copied and modified: head/usr.bin/login/motd.template (from r350183,
> head/usr.bin/login/motd)
> =====================================================================
> =========
> --- head/usr.bin/login/motd	Sat Jul 20 20:47:07 2019	(r350183,
> copy source)
> +++ head/usr.bin/login/motd.template	Sat Jul 20 20:56:31 2019	(r350
> 184)
> @@ -1,4 +1,3 @@
> -FreeBSD ?.?.?  (UNKNOWN)
>  
>  Welcome to FreeBSD!
>  
> @@ -18,4 +17,4 @@ Please include that output and any error messages
> when
>  Introduction to manual pages:  man man
>  FreeBSD directory layout:      man hier
>  
> -Edit /etc/motd to change this login announcement.
> +Edit /etc/motd.template to change this login announcement.
> 
> Modified: head/usr.bin/login/pathnames.h
> =====================================================================
> =========
> --- head/usr.bin/login/pathnames.h	Sat Jul 20 20:47:07 2019	(r350
> 183)
> +++ head/usr.bin/login/pathnames.h	Sat Jul 20 20:56:31 2019	(r350
> 184)
> @@ -35,6 +35,6 @@
>  #include <paths.h>
>  
>  #define	_PATH_HUSHLOGIN		".hushlogin"
> -#define	_PATH_MOTDFILE		"/etc/motd"
> +#define	_PATH_MOTDFILE		"/var/run/motd"
>  #define _PATH_FBTAB		"/etc/fbtab"
>  #define _PATH_LOGINDEVPERM	"/etc/logindevperm"
> 

This change doesn't appear to provide any mechanism for maintaining
historic behavior of having an immutable /etc/motd file that gets
presented to the user.  If you set motd_enable=false there will be
nothing in /var/run/motd so nothing will be presented to the user at
login.  Otherwise you end up with the user seeing a modified copy of
the motd file.

We have products that are mandated by the customer (and I believe by
law in some cases) to provide specific exact text at login, and now I
think there is no straighforward way to achieve that.

-- Ian


From owner-svn-src-head@freebsd.org  Sun Jul 21 17:00:19 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id BAC57B82A9;
 Sun, 21 Jul 2019 17:00:19 +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 9C3CC8723F;
 Sun, 21 Jul 2019 17:00: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 7554C264D0;
 Sun, 21 Jul 2019 17:00: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 x6LH0Jcf018264;
 Sun, 21 Jul 2019 17:00:19 GMT (envelope-from alc@FreeBSD.org)
Received: (from alc@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6LH0J4H018263;
 Sun, 21 Jul 2019 17:00:19 GMT (envelope-from alc@FreeBSD.org)
Message-Id: <201907211700.x6LH0J4H018263@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org
 using -f
From: Alan Cox <alc@FreeBSD.org>
Date: Sun, 21 Jul 2019 17:00:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350202 - 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: 350202
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 9C3CC8723F
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.974,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 21 Jul 2019 17:00:19 -0000

Author: alc
Date: Sun Jul 21 17:00:19 2019
New Revision: 350202
URL: https://svnweb.freebsd.org/changeset/base/350202

Log:
  With the introduction of software dirty bit emulation for managed mappings,
  we should test ATTR_SW_DBM, not ATTR_AP_RW, to determine whether to set
  PGA_WRITEABLE.  In effect, we are currently setting PGA_WRITEABLE based on
  whether the dirty bit is preset, not whether the mapping is writeable.
  Correct this mistake.
  
  Reviewed by:	markj
  X-MFC with:	r350004
  Differential Revision:	https://reviews.freebsd.org/D21013

Modified:
  head/sys/arm64/arm64/pmap.c

Modified: head/sys/arm64/arm64/pmap.c
==============================================================================
--- head/sys/arm64/arm64/pmap.c	Sun Jul 21 16:35:49 2019	(r350201)
+++ head/sys/arm64/arm64/pmap.c	Sun Jul 21 17:00:19 2019	(r350202)
@@ -3361,7 +3361,7 @@ havel3:
 		CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, pa);
 		TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next);
 		m->md.pv_gen++;
-		if ((new_l3 & ATTR_AP_RW_BIT) == ATTR_AP(ATTR_AP_RW))
+		if ((new_l3 & ATTR_SW_DBM) != 0)
 			vm_page_aflag_set(m, PGA_WRITEABLE);
 	}
 
@@ -3554,7 +3554,7 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t 
 			    va, pmap);
 			return (KERN_RESOURCE_SHORTAGE);
 		}
-		if ((new_l2 & ATTR_AP_RW_BIT) == ATTR_AP(ATTR_AP_RW))
+		if ((new_l2 & ATTR_SW_DBM) != 0)
 			for (mt = m; mt < &m[L2_SIZE / PAGE_SIZE]; mt++)
 				vm_page_aflag_set(mt, PGA_WRITEABLE);
 	}

From owner-svn-src-head@freebsd.org  Sun Jul 21 17:14:40 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3CACB89CF;
 Sun, 21 Jul 2019 17:14:40 +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 84C5D880B5;
 Sun, 21 Jul 2019 17:14:40 +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 5FC28268B6;
 Sun, 21 Jul 2019 17:14:40 +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 x6LHEe5P029809;
 Sun, 21 Jul 2019 17:14:40 GMT (envelope-from ian@FreeBSD.org)
Received: (from ian@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6LHEesk029808;
 Sun, 21 Jul 2019 17:14:40 GMT (envelope-from ian@FreeBSD.org)
Message-Id: <201907211714.x6LHEesk029808@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org
 using -f
From: Ian Lepore <ian@FreeBSD.org>
Date: Sun, 21 Jul 2019 17:14:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350203 - 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: 350203
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 84C5D880B5
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.958,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 21 Jul 2019 17:14:40 -0000

Author: ian
Date: Sun Jul 21 17:14:39 2019
New Revision: 350203
URL: https://svnweb.freebsd.org/changeset/base/350203

Log:
  Add support for setting the aging/frequency-offset register via sysctl.
  
  The 2127 and 2129 chips support a frequency tuning value in the range of
  -7 through +8 PPM; add a sysctl handler to read and set the value.

Modified:
  head/sys/dev/iicbus/nxprtc.c

Modified: head/sys/dev/iicbus/nxprtc.c
==============================================================================
--- head/sys/dev/iicbus/nxprtc.c	Sun Jul 21 17:00:19 2019	(r350202)
+++ head/sys/dev/iicbus/nxprtc.c	Sun Jul 21 17:14:39 2019	(r350203)
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/kernel.h>
 #include <sys/libkern.h>
 #include <sys/module.h>
+#include <sys/sysctl.h>
 
 #include <dev/iicbus/iicbus.h>
 #include <dev/iicbus/iiconf.h>
@@ -109,6 +110,8 @@ __FBSDID("$FreeBSD$");
 #define	PCF2127_R_TS_CTL	0x12	/* Timestamp control */
 #define	PCF2127_B_TSOFF		0x40	/* Turn off timestamp function */
 
+#define	PCF2127_R_AGING_OFFSET	0x19	/* Frequency aging offset in PPM */
+
 /*
  * PCA/PCF2129-specific registers, bits, and masks.
  */
@@ -204,6 +207,7 @@ struct nxprtc_softc {
 	u_int		flags;		/* SC_F_* flags */
 	u_int		chiptype;	/* Type of PCF85xx chip */
 	time_t		bat_time;	/* Next time to check battery */
+	int		freqadj;	/* Current freq adj in PPM */
 	uint8_t		secaddr;	/* Address of seconds register */
 	uint8_t		tmcaddr;	/* Address of timer count register */
 	bool		use_timer;	/* Use timer for fractional sec */
@@ -356,6 +360,30 @@ write_timeregs(struct nxprtc_softc *sc, struct time_re
 }
 
 static int
+freqadj_sysctl(SYSCTL_HANDLER_ARGS)
+{
+	struct nxprtc_softc *sc;
+	int err, freqppm, newppm;
+
+	sc = arg1;
+
+	/* PPM range [-7,8] maps to reg value range [0,15] */
+	freqppm = newppm = 8 - sc->freqadj;
+
+	err = sysctl_handle_int(oidp, &newppm, 0, req);
+	if (err != 0 || req->newptr == NULL)
+		return (err);
+	if (freqppm != newppm) {
+		if (newppm < -7 || newppm > 8)
+			return (EINVAL);
+		sc->freqadj = 8 - newppm;
+		err = write_reg(sc, PCF2127_R_AGING_OFFSET, sc->freqadj);
+	}
+
+	return (err);
+}
+
+static int
 pcf8523_battery_check(struct nxprtc_softc *sc)
 {
 	struct timespec ts;
@@ -409,6 +437,8 @@ pcf8523_battery_check(struct nxprtc_softc *sc)
 static int
 pcf8523_start(struct nxprtc_softc *sc)
 {
+	struct sysctl_ctx_list *ctx;
+	struct sysctl_oid_list *tree;
 	struct csr {
 		uint8_t	cs1;
 		uint8_t	cs2;
@@ -416,7 +446,7 @@ pcf8523_start(struct nxprtc_softc *sc)
 		uint8_t sec;
 	} csr;
 	int err;
-	uint8_t clkout;
+	uint8_t clkout, freqadj;
 
 	/* Read the control and status registers. */
 	if ((err = nxprtc_readfrom(sc->dev, PCF85xx_R_CS1, &csr,
@@ -492,10 +522,28 @@ pcf8523_start(struct nxprtc_softc *sc)
 	 * Remember whether we're running in AM/PM mode.  The chip default is
 	 * 24-hour mode, but if we're co-existing with some other OS that
 	 * prefers AM/PM we can run that way too.
+	 *
+	 * Also, for 212x chips, retrieve the current frequency aging offset,
+	 * and set up the sysctl handler for reading/setting it.
 	 */
 	if (sc->is212x) {
 		if (csr.cs1 & PCF2129_B_CS1_12HR)
 			sc->use_ampm = true;
+
+		err = read_reg(sc, PCF2127_R_AGING_OFFSET, &freqadj);
+		if (err != 0) {
+			device_printf(sc->dev,
+			    "cannot read AGINGOFFSET register\n");
+			return (err);
+		}
+		sc->freqadj = (int8_t)freqadj;
+
+		ctx = device_get_sysctl_ctx(sc->dev);
+		tree = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev));
+
+		SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "freqadj",
+		    CTLFLAG_RWTUN | CTLTYPE_INT | CTLFLAG_MPSAFE, sc, 0,
+		    freqadj_sysctl, "I", "Frequency adjust in PPM, range [-7,+8]");
 	} else {
 		if (csr.cs1 & PCF8523_B_CS1_12HR)
 			sc->use_ampm = true;

From owner-svn-src-head@freebsd.org  Sun Jul 21 20:16:49 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id D175ABC77A;
 Sun, 21 Jul 2019 20:16:49 +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 B4A3E8E8E5;
 Sun, 21 Jul 2019 20:16:49 +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 90F21BB1;
 Sun, 21 Jul 2019 20:16:49 +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 x6LKGnF7036433;
 Sun, 21 Jul 2019 20:16:49 GMT (envelope-from kib@FreeBSD.org)
Received: (from kib@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6LKGnjH036431;
 Sun, 21 Jul 2019 20:16:49 GMT (envelope-from kib@FreeBSD.org)
Message-Id: <201907212016.x6LKGnjH036431@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org
 using -f
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Sun, 21 Jul 2019 20:16:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350204 - in head: share/man/man9 sys/sys
X-SVN-Group: head
X-SVN-Commit-Author: kib
X-SVN-Commit-Paths: in head: share/man/man9 sys/sys
X-SVN-Commit-Revision: 350204
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: B4A3E8E8E5
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.960,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 21 Jul 2019 20:16:49 -0000

Author: kib
Date: Sun Jul 21 20:16:48 2019
New Revision: 350204
URL: https://svnweb.freebsd.org/changeset/base/350204

Log:
  Switch the rest of the refcount(9) functions to bool return type.
  
  There are some explicit comparisions of refcount_release(9) result
  with 0/1, which are fine.
  
  Reviewed by:	markj, mjg
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D21014

Modified:
  head/share/man/man9/refcount.9
  head/sys/sys/refcount.h

Modified: head/share/man/man9/refcount.9
==============================================================================
--- head/share/man/man9/refcount.9	Sun Jul 21 17:14:39 2019	(r350203)
+++ head/share/man/man9/refcount.9	Sun Jul 21 20:16:48 2019	(r350204)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 20, 2009
+.Dd July 21, 2019
 .Dt REFCOUNT 9
 .Os
 .Sh NAME
@@ -42,7 +42,7 @@
 .Fn refcount_init "volatile u_int *count" "u_int value"
 .Ft void
 .Fn refcount_acquire "volatile u_int *count"
-.Ft int
+.Ft bool
 .Fn refcount_release "volatile u_int *count"
 .Sh DESCRIPTION
 The
@@ -73,9 +73,9 @@ protection for acquiring a new reference.
 The
 .Fn refcount_release
 function is used to release an existing reference.
-The function returns a non-zero value if the reference being released was
+The function returns true if the reference being released was
 the last reference;
-otherwise, it returns zero.
+otherwise, it returns false.
 .Pp
 Note that these routines do not provide any inter-CPU synchronization,
 data protection,
@@ -89,7 +89,7 @@ is released.
 .Sh RETURN VALUES
 The
 .Nm refcount_release
-function returns non-zero when releasing the last reference and zero when
+function returns true when releasing the last reference and false when
 releasing any other reference.
 .Sh HISTORY
 These functions were introduced in

Modified: head/sys/sys/refcount.h
==============================================================================
--- head/sys/sys/refcount.h	Sun Jul 21 17:14:39 2019	(r350203)
+++ head/sys/sys/refcount.h	Sun Jul 21 20:16:48 2019	(r350204)
@@ -69,7 +69,7 @@ refcount_acquire_checked(volatile u_int *count)
 	}
 }
 
-static __inline int
+static __inline bool
 refcount_release(volatile u_int *count)
 {
 	u_int old;
@@ -78,7 +78,7 @@ refcount_release(volatile u_int *count)
 	old = atomic_fetchadd_int(count, -1);
 	KASSERT(old > 0, ("refcount %p is zero", count));
 	if (old > 1)
-		return (0);
+		return (false);
 
 	/*
 	 * Last reference.  Signal the user to call the destructor.
@@ -87,14 +87,14 @@ refcount_release(volatile u_int *count)
 	 * at the start of the function synchronized with this fence.
 	 */
 	atomic_thread_fence_acq();
-	return (1);
+	return (true);
 }
 
 /*
  * This functions returns non-zero if the refcount was
  * incremented. Else zero is returned.
  */
-static __inline __result_use_check int
+static __inline __result_use_check bool
 refcount_acquire_if_not_zero(volatile u_int *count)
 {
 	u_int old;
@@ -103,13 +103,13 @@ refcount_acquire_if_not_zero(volatile u_int *count)
 	for (;;) {
 		KASSERT(old < UINT_MAX, ("refcount %p overflowed", count));
 		if (old == 0)
-			return (0);
+			return (false);
 		if (atomic_fcmpset_int(count, &old, old + 1))
-			return (1);
+			return (true);
 	}
 }
 
-static __inline __result_use_check int
+static __inline __result_use_check bool
 refcount_release_if_not_last(volatile u_int *count)
 {
 	u_int old;
@@ -118,9 +118,9 @@ refcount_release_if_not_last(volatile u_int *count)
 	for (;;) {
 		KASSERT(old > 0, ("refcount %p is zero", count));
 		if (old == 1)
-			return (0);
+			return (false);
 		if (atomic_fcmpset_int(count, &old, old - 1))
-			return (1);
+			return (true);
 	}
 }
 

From owner-svn-src-head@freebsd.org  Mon Jul 22 03:14:48 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB668A65F5;
 Mon, 22 Jul 2019 03:14:48 +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 680F476AA2;
 Mon, 22 Jul 2019 03:13:22 +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 577E462CE;
 Mon, 22 Jul 2019 03:11:55 +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 x6M3BtL5086407;
 Mon, 22 Jul 2019 03:11:55 GMT (envelope-from jhibbits@FreeBSD.org)
Received: (from jhibbits@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6M3Bto3086406;
 Mon, 22 Jul 2019 03:11:55 GMT (envelope-from jhibbits@FreeBSD.org)
Message-Id: <201907220311.x6M3Bto3086406@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to
 jhibbits@FreeBSD.org using -f
From: Justin Hibbits <jhibbits@FreeBSD.org>
Date: Mon, 22 Jul 2019 03:11:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350206 - 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: 350206
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 680F476AA2
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 03:14:48 -0000

Author: jhibbits
Date: Mon Jul 22 03:11:54 2019
New Revision: 350206
URL: https://svnweb.freebsd.org/changeset/base/350206

Log:
  powerpc64/mmu: Make moea64_pvo_enter() return if an entry already exists
  
  Summary:
  Instead of searching for a PVO entry before adding, take advantage of
  the fact that RB_INSERT() returns NULL if it inserts, and the existing entry if
  an entry exists, without inserting a new entry.  This saves an extra tree
  traversal in the cases where the PVO does not exist.
  
  Reviewed by:	luporl
  Differential Revision: https://reviews.freebsd.org/D20944

Modified:
  head/sys/powerpc/aim/mmu_oea64.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c	Mon Jul 22 01:06:06 2019	(r350205)
+++ head/sys/powerpc/aim/mmu_oea64.c	Mon Jul 22 03:11:54 2019	(r350206)
@@ -231,7 +231,7 @@ int		moea64_large_page_shift = 0;
  * PVO calls.
  */
 static int	moea64_pvo_enter(mmu_t mmu, struct pvo_entry *pvo,
-		    struct pvo_head *pvo_head);
+		    struct pvo_head *pvo_head, struct pvo_entry **oldpvo);
 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,
@@ -675,7 +675,7 @@ moea64_setup_direct_map(mmu_t mmup, vm_offset_t kernel
 			pvo->pvo_pte.prot = VM_PROT_READ | VM_PROT_WRITE |
 			    VM_PROT_EXECUTE;
 			pvo->pvo_pte.pa = pa | pte_lo;
-			moea64_pvo_enter(mmup, pvo, NULL);
+			moea64_pvo_enter(mmup, pvo, NULL, NULL);
 		  }
 		}
 		PMAP_UNLOCK(kernel_pmap);
@@ -1424,8 +1424,8 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_offset_t va, v
 			    (m->oflags & VPO_UNMANAGED) == 0)
 				vm_page_aflag_set(m, PGA_WRITEABLE);
 
-		oldpvo = moea64_pvo_find_va(pmap, va);
-		if (oldpvo != NULL) {
+		error = moea64_pvo_enter(mmu, pvo, pvo_head, &oldpvo);
+		if (error == EEXIST) {
 			if (oldpvo->pvo_vaddr == pvo->pvo_vaddr &&
 			    oldpvo->pvo_pte.pa == pvo->pvo_pte.pa &&
 			    oldpvo->pvo_pte.prot == prot) {
@@ -1449,8 +1449,8 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_offset_t va, v
 			KASSERT(oldpvo->pvo_pmap == pmap, ("pmap of old "
 			    "mapping does not match new mapping"));
 			moea64_pvo_remove_from_pmap(mmu, oldpvo);
+			error = moea64_pvo_enter(mmu, pvo, pvo_head, NULL);
 		}
-		error = moea64_pvo_enter(mmu, pvo, pvo_head);
 		PV_PAGE_UNLOCK(m);
 		PMAP_UNLOCK(pmap);
 
@@ -1641,7 +1641,7 @@ moea64_uma_page_alloc(uma_zone_t zone, vm_size_t bytes
 	init_pvo_entry(pvo, kernel_pmap, va);
 	pvo->pvo_vaddr |= PVO_WIRED;
 
-	moea64_pvo_enter(installed_mmu, pvo, NULL);
+	moea64_pvo_enter(installed_mmu, pvo, NULL, NULL);
 
 	if (needed_lock)
 		PMAP_UNLOCK(kernel_pmap);
@@ -1872,7 +1872,7 @@ moea64_kenter_attr(mmu_t mmu, vm_offset_t va, vm_paddr
 	if (oldpvo != NULL)
 		moea64_pvo_remove_from_pmap(mmu, oldpvo);
 	init_pvo_entry(pvo, kernel_pmap, va);
-	error = moea64_pvo_enter(mmu, pvo, NULL);
+	error = moea64_pvo_enter(mmu, pvo, NULL, NULL);
 	PMAP_UNLOCK(kernel_pmap);
 
 	/* Free any dead pages */
@@ -2514,9 +2514,11 @@ moea64_bootstrap_alloc(vm_size_t size, vm_size_t align
 }
 
 static int
-moea64_pvo_enter(mmu_t mmu, struct pvo_entry *pvo, struct pvo_head *pvo_head)
+moea64_pvo_enter(mmu_t mmu, struct pvo_entry *pvo, struct pvo_head *pvo_head,
+    struct pvo_entry **oldpvop)
 {
 	int first, err;
+	struct pvo_entry *old_pvo;
 
 	PMAP_LOCK_ASSERT(pvo->pvo_pmap, MA_OWNED);
 	KASSERT(moea64_pvo_find_va(pvo->pvo_pmap, PVO_VADDR(pvo)) == NULL,
@@ -2527,7 +2529,13 @@ moea64_pvo_enter(mmu_t mmu, struct pvo_entry *pvo, str
 	/*
 	 * Add to pmap list
 	 */
-	RB_INSERT(pvo_tree, &pvo->pvo_pmap->pmap_pvo, pvo);
+	old_pvo = RB_INSERT(pvo_tree, &pvo->pvo_pmap->pmap_pvo, pvo);
+
+	if (old_pvo != NULL) {
+		if (oldpvop != NULL)
+			*oldpvop = old_pvo;
+		return (EEXIST);
+	}
 
 	/*
 	 * Remember if the list was empty and therefore will be the first

From owner-svn-src-head@freebsd.org  Mon Jul 22 04:14:55 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15224A7366;
 Mon, 22 Jul 2019 04:14:55 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id BC4458251A;
 Mon, 22 Jul 2019 04:14:54 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 288E471E6;
 Mon, 22 Jul 2019 04:14:54 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6M4EsZ9025533;
 Mon, 22 Jul 2019 04:14:54 GMT (envelope-from asomers@FreeBSD.org)
Received: (from asomers@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6M4EsF5025532;
 Mon, 22 Jul 2019 04:14:54 GMT (envelope-from asomers@FreeBSD.org)
Message-Id: <201907220414.x6M4EsF5025532@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: asomers set sender to
 asomers@FreeBSD.org using -f
From: Alan Somers <asomers@FreeBSD.org>
Date: Mon, 22 Jul 2019 04:14:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350207 - head/share/man/man9
X-SVN-Group: head
X-SVN-Commit-Author: asomers
X-SVN-Commit-Paths: head/share/man/man9
X-SVN-Commit-Revision: 350207
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: BC4458251A
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_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.95)[-0.951,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 04:14:55 -0000

Author: asomers
Date: Mon Jul 22 04:14:53 2019
New Revision: 350207
URL: https://svnweb.freebsd.org/changeset/base/350207

Log:
  VOP_PATHCONF.9: correct the type of the retval argument
  
  It was changed from int to register_t in r22521 and from register_t to long
  in r328099, but the man page wasn't updated either time.
  
  MFC after:	2 weeks

Modified:
  head/share/man/man9/VOP_PATHCONF.9

Modified: head/share/man/man9/VOP_PATHCONF.9
==============================================================================
--- head/share/man/man9/VOP_PATHCONF.9	Mon Jul 22 03:11:54 2019	(r350206)
+++ head/share/man/man9/VOP_PATHCONF.9	Mon Jul 22 04:14:53 2019	(r350207)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 24, 1996
+.Dd July 21, 2019
 .Dt VOP_PATHCONF 9
 .Os
 .Sh NAME
@@ -39,7 +39,7 @@
 .In sys/vnode.h
 .In sys/unistd.h
 .Ft int
-.Fn VOP_PATHCONF "struct vnode *vp" "int name" "int *retval"
+.Fn VOP_PATHCONF "struct vnode *vp" "int name" "long *retval"
 .Sh DESCRIPTION
 The arguments are:
 .Bl -tag -width retval

From owner-svn-src-head@freebsd.org  Mon Jul 22 10:18:00 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id BBD24AD970;
 Mon, 22 Jul 2019 10:18:00 +0000 (UTC)
 (envelope-from manu@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 976F88E3FB;
 Mon, 22 Jul 2019 10:18:00 +0000 (UTC)
 (envelope-from manu@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 6C8B8B51D;
 Mon, 22 Jul 2019 10:18:00 +0000 (UTC)
 (envelope-from manu@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6MAI0F8037146;
 Mon, 22 Jul 2019 10:18:00 GMT (envelope-from manu@FreeBSD.org)
Received: (from manu@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6MAI0IZ037145;
 Mon, 22 Jul 2019 10:18:00 GMT (envelope-from manu@FreeBSD.org)
Message-Id: <201907221018.x6MAI0IZ037145@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: manu set sender to
 manu@FreeBSD.org using -f
From: Emmanuel Vadot <manu@FreeBSD.org>
Date: Mon, 22 Jul 2019 10:18:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350210 - head/share/mk
X-SVN-Group: head
X-SVN-Commit-Author: manu
X-SVN-Commit-Paths: head/share/mk
X-SVN-Commit-Revision: 350210
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 976F88E3FB
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.975,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 10:18:00 -0000

Author: manu
Date: Mon Jul 22 10:17:59 2019
New Revision: 350210
URL: https://svnweb.freebsd.org/changeset/base/350210

Log:
  arm: Use -O2 instead of -O as optimization flag
  
  When using Clang -O is equivalent to -O2, change it -O2 to make it
  consistent with other platforms.
  
  Reference: https://clang.llvm.org/docs/ClangCommandLineReference.html#optimization-level
  
  Submitted by:	Daniel Engberg (daniel.engberg.lists@pyret.net)
  Reviewed by:	emaste
  Differential Revision:	https://reviews.freebsd.org/D21021

Modified:
  head/share/mk/sys.mk

Modified: head/share/mk/sys.mk
==============================================================================
--- head/share/mk/sys.mk	Mon Jul 22 08:27:44 2019	(r350209)
+++ head/share/mk/sys.mk	Mon Jul 22 10:17:59 2019	(r350210)
@@ -166,7 +166,7 @@ CC		?=	c89
 CFLAGS		?=	-O
 .else
 CC		?=	cc
-.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips"
+.if ${MACHINE_CPUARCH} == "mips"
 CFLAGS		?=	-O -pipe
 .else
 CFLAGS		?=	-O2 -pipe

From owner-svn-src-head@freebsd.org  Mon Jul 22 10:37:57 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id A914BAE1A2;
 Mon, 22 Jul 2019 10:37:57 +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 8AAB58F99C;
 Mon, 22 Jul 2019 10:37:57 +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 645A3B8F8;
 Mon, 22 Jul 2019 10:37:57 +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 x6MAbvKt049182;
 Mon, 22 Jul 2019 10:37:57 GMT (envelope-from lwhsu@FreeBSD.org)
Received: (from lwhsu@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6MAbvNo049181;
 Mon, 22 Jul 2019 10:37:57 GMT (envelope-from lwhsu@FreeBSD.org)
Message-Id: <201907221037.x6MAbvNo049181@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to
 lwhsu@FreeBSD.org using -f
From: Li-Wen Hsu <lwhsu@FreeBSD.org>
Date: Mon, 22 Jul 2019 10:37:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350211 - head/tests/sys/kern
X-SVN-Group: head
X-SVN-Commit-Author: lwhsu
X-SVN-Commit-Paths: head/tests/sys/kern
X-SVN-Commit-Revision: 350211
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 8AAB58F99C
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 10:37:57 -0000

Author: lwhsu
Date: Mon Jul 22 10:37:56 2019
New Revision: 350211
URL: https://svnweb.freebsd.org/changeset/base/350211

Log:
  Temporarily skip flakey test case
  sys.kern.ptrace_test.ptrace__follow_fork_child_detached_unrelated_debugger
  
  PR:		239292
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/tests/sys/kern/ptrace_test.c

Modified: head/tests/sys/kern/ptrace_test.c
==============================================================================
--- head/tests/sys/kern/ptrace_test.c	Mon Jul 22 10:17:59 2019	(r350210)
+++ head/tests/sys/kern/ptrace_test.c	Mon Jul 22 10:37:56 2019	(r350211)
@@ -867,6 +867,8 @@ ATF_TC_BODY(ptrace__follow_fork_child_detached_unrelat
 	pid_t children[2], fpid, wpid;
 	int cpipe[2], status;
 
+	atf_tc_skip("https://bugs.freebsd.org/bug239292");
+
 	ATF_REQUIRE(pipe(cpipe) == 0);
 	ATF_REQUIRE((fpid = fork()) != -1);
 	if (fpid == 0) {

From owner-svn-src-head@freebsd.org  Mon Jul 22 12:58:44 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id B65FFB1486;
 Mon, 22 Jul 2019 12:58:44 +0000 (UTC)
 (envelope-from cy.schubert@cschubert.com)
Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12])
 (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 649A26E16B;
 Mon, 22 Jul 2019 12:58:43 +0000 (UTC)
 (envelope-from cy.schubert@cschubert.com)
Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA
 id pXtmht09hUIS2pXtnh6xpP; Mon, 22 Jul 2019 06:58:40 -0600
X-Authority-Analysis: v=2.3 cv=N41X6F1B c=1 sm=1 tr=0
 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17
 a=8nJEP1OIZ-IA:10 a=0o9FgrsRnhwA:10 a=6I5d2MoRAAAA:8 a=pGLkceISAAAA:8
 a=YxBL1-UpAAAA:8 a=dtX7w2-E1j9ObSnXGssA:9 a=AqDxhjTVg04_zwjF:21
 a=7yibKyhn37eTI5BM:21 a=wPNLvfGTeEIA: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 A84E77D6;
 Mon, 22 Jul 2019 05:58:37 -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 x6MCwbPf011530;
 Mon, 22 Jul 2019 05:58:37 -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 x6MCwbZj011527;
 Mon, 22 Jul 2019 05:58:37 -0700 (PDT)
 (envelope-from Cy.Schubert@cschubert.com)
Message-Id: <201907221258.x6MCwbZj011527@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 <Cy.Schubert@cschubert.com>
From: Cy Schubert <Cy.Schubert@cschubert.com>
X-os: FreeBSD
X-Sender: cy@cwsent.com
X-URL: http://www.cschubert.com/
To: Conrad Meyer <cem@FreeBSD.org>
cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: Re: svn commit: r342977 - in head/sys/dev: amdsmn amdtemp
In-reply-to: <201901122236.x0CMaXsK017117@repo.freebsd.org>
References: <201901122236.x0CMaXsK017117@repo.freebsd.org>
Comments: In-reply-to Conrad Meyer <cem@FreeBSD.org>
 message dated "Sat, 12 Jan 2019 22:36:33 +0000."
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Date: Mon, 22 Jul 2019 05:58:37 -0700
X-CMAE-Envelope: MS4wfFw+gF1qVf8Ytz/Vkzt523bHszdosLhoj4G9CGDuFLGKr1Nlv8egF79muNCEyXqUZQD/CDEEwV/1uItAFSzykLnrj2CDPHSRcU1+VIdfQ1iNbRTf/IIR
 1JPdsa1KYQZFo3cPL5GUqJwg96VdDk5tkbP1wfHOg6S90HQ0R8cpl2zKFHQGIh/a+et8zzsN1fAo0WUqZFjDaZLGnsTm/ew9VtqoWNbs04OBqgKAzLpYVYqa
 Osvqw7xCxGDHN8r3nTv+c4BJaeoRV2XG3wNNazZMYUd8Pf7mBeKH+6uijcd+fHIW
X-Rspamd-Queue-Id: 649A26E16B
X-Spamd-Bar: ----
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-4.58 / 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.70), ipnet: 64.59.128.0/20(-3.23), asn: 6327(-2.51),
 country: CA(-0.09)]; 
 MX_GOOD(-0.01)[cached: spqr.komquats.com];
 NEURAL_HAM_SHORT(-0.47)[-0.465,0];
 RCVD_IN_DNSWL_NONE(0.00)[12.134.59.64.list.dnswl.org : 127.0.5.0];
 NEURAL_HAM_MEDIUM(-1.00)[-0.999,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)[];
 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 12:58:44 -0000

In message <201901122236.x0CMaXsK017117@repo.freebsd.org>, Conrad Meyer 
writes:
> Author: cem
> Date: Sat Jan 12 22:36:33 2019
> New Revision: 342977
> URL: https://svnweb.freebsd.org/changeset/base/342977
>
> Log:
>   amdtemp(4): Add support for Family 15h, Model >=60h
>   
>   Family 15h is a bit of an oddball.  Early models used the same temperature
>   register and spec (mostly[1]) as earlier CPU families.
>   
>   Model 60h-6Fh and 70-7Fh use something more like Family 17h's Service
>   Management Network, communicating with it in a similar fashion.  To support
>   them, add support for their version of SMU indirection to amdsmn(4) and use
>   it in amdtemp(4) on these models.
>   
>   While here, clarify some of the deviceid macros in amdtemp(4) that were
>   added with arbitrary, incorrect family numbers, and remove ones that were
>   not used.  Additionally, clarify intent and condition of heterogenous
>   multi-socket system detection.
>   
>   [1]: 15h adds the "adjust range by -49°C if a certain condition is met,"
>   which previous families did not have.
>   
>   Reported by:	D. C. <tjoard AT gmail.com>
>   PR:		234657
>   Tested by:	D. C. <tjoard AT gmail.com>
>
> Modified:
>   head/sys/dev/amdsmn/amdsmn.c
>   head/sys/dev/amdtemp/amdtemp.c
>
> Modified: head/sys/dev/amdsmn/amdsmn.c
> =============================================================================
> =
> --- head/sys/dev/amdsmn/amdsmn.c	Sat Jan 12 22:10:31 2019	(r34297
> 6)
> +++ head/sys/dev/amdsmn/amdsmn.c	Sat Jan 12 22:36:33 2019	(r34297
> 7)
> @@ -1,5 +1,5 @@
>  /*-
> - * Copyright (c) 2017 Conrad Meyer <cem@FreeBSD.org>
> + * Copyright (c) 2017-2019 Conrad Meyer <cem@FreeBSD.org>
>   * All rights reserved.
>   *
>   * Redistribution and use in source and binary forms, with or without
> @@ -25,7 +25,7 @@
>   */
>  
>  /*
> - * Driver for the AMD Family 17h CPU System Management Network.
> + * Driver for the AMD Family 15h and 17h CPU System Management Network.
>   */
>  
>  #include <sys/cdefs.h>
> @@ -51,24 +51,45 @@ __FBSDID("$FreeBSD$");
>  
>  #include <dev/amdsmn/amdsmn.h>
>  
> -#define	SMN_ADDR_REG	0x60
> -#define	SMN_DATA_REG	0x64
> +#define	F15H_SMN_ADDR_REG	0xb8
> +#define	F15H_SMN_DATA_REG	0xbc
> +#define	F17H_SMN_ADDR_REG	0x60
> +#define	F17H_SMN_DATA_REG	0x64
>  
> +#define	PCI_DEVICE_ID_AMD_15H_M60H_ROOT		0x1576
>  #define	PCI_DEVICE_ID_AMD_17H_ROOT		0x1450
> -#define	PCI_DEVICE_ID_AMD_17H_ROOT_DF_F3	0x1463
>  #define	PCI_DEVICE_ID_AMD_17H_M10H_ROOT		0x15d0
> -#define	PCI_DEVICE_ID_AMD_17H_M10H_ROOT_DF_F3	0x15eb
>  
> +struct pciid;
>  struct amdsmn_softc {
>  	struct mtx smn_lock;
> +	const struct pciid *smn_pciid;
>  };
>  
> -static struct pciid {
> +static const struct pciid {
>  	uint16_t	amdsmn_vendorid;
>  	uint16_t	amdsmn_deviceid;
> +	uint8_t		amdsmn_addr_reg;
> +	uint8_t		amdsmn_data_reg;
>  } amdsmn_ids[] = {
> -	{ CPU_VENDOR_AMD, PCI_DEVICE_ID_AMD_17H_ROOT },
> -	{ CPU_VENDOR_AMD, PCI_DEVICE_ID_AMD_17H_M10H_ROOT },
> +	{
> +		.amdsmn_vendorid = CPU_VENDOR_AMD,
> +		.amdsmn_deviceid = PCI_DEVICE_ID_AMD_15H_M60H_ROOT,
> +		.amdsmn_addr_reg = F15H_SMN_ADDR_REG,
> +		.amdsmn_data_reg = F15H_SMN_DATA_REG,
> +	},
> +	{
> +		.amdsmn_vendorid = CPU_VENDOR_AMD,
> +		.amdsmn_deviceid = PCI_DEVICE_ID_AMD_17H_ROOT,
> +		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
> +		.amdsmn_data_reg = F17H_SMN_DATA_REG,
> +	},
> +	{
> +		.amdsmn_vendorid = CPU_VENDOR_AMD,
> +		.amdsmn_deviceid = PCI_DEVICE_ID_AMD_17H_M10H_ROOT,
> +		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
> +		.amdsmn_data_reg = F17H_SMN_DATA_REG,
> +	},
>  };
>  
>  /*
> @@ -101,7 +122,7 @@ MODULE_PNP_INFO("U16:vendor;U16:device", pci, amdsmn, 
>      nitems(amdsmn_ids));
>  
>  static bool
> -amdsmn_match(device_t parent)
> +amdsmn_match(device_t parent, const struct pciid **pciid_out)
>  {
>  	uint16_t vendor, device;
>  	size_t i;
> @@ -109,10 +130,14 @@ amdsmn_match(device_t parent)
>  	vendor = pci_get_vendor(parent);
>  	device = pci_get_device(parent);
>  
> -	for (i = 0; i < nitems(amdsmn_ids); i++)
> +	for (i = 0; i < nitems(amdsmn_ids); i++) {
>  		if (vendor == amdsmn_ids[i].amdsmn_vendorid &&
> -		    device == amdsmn_ids[i].amdsmn_deviceid)
> +		    device == amdsmn_ids[i].amdsmn_deviceid) {
> +			if (pciid_out != NULL)
> +				*pciid_out = &amdsmn_ids[i];
>  			return (true);
> +		}
> +	}
>  	return (false);
>  }
>  
> @@ -124,7 +149,7 @@ amdsmn_identify(driver_t *driver, device_t parent)
>  	/* Make sure we're not being doubly invoked. */
>  	if (device_find_child(parent, "amdsmn", -1) != NULL)
>  		return;
> -	if (!amdsmn_match(parent))
> +	if (!amdsmn_match(parent, NULL))
>  		return;
>  
>  	child = device_add_child(parent, "amdsmn", -1);
> @@ -136,21 +161,25 @@ static int
>  amdsmn_probe(device_t dev)
>  {
>  	uint32_t family;
> +	char buf[64];
>  
>  	if (resource_disabled("amdsmn", 0))
>  		return (ENXIO);
> -	if (!amdsmn_match(device_get_parent(dev)))
> +	if (!amdsmn_match(device_get_parent(dev), NULL))
>  		return (ENXIO);
>  
>  	family = CPUID_TO_FAMILY(cpu_id);
>  
>  	switch (family) {
> +	case 0x15:
>  	case 0x17:
>  		break;
>  	default:
>  		return (ENXIO);
>  	}
> -	device_set_desc(dev, "AMD Family 17h System Management Network");
> +	snprintf(buf, sizeof(buf), "AMD Family %xh System Management Network",
> +	    family);
> +	device_set_desc_copy(dev, buf);
>  
>  	return (BUS_PROBE_GENERIC);
>  }
> @@ -160,6 +189,9 @@ amdsmn_attach(device_t dev)
>  {
>  	struct amdsmn_softc *sc = device_get_softc(dev);
>  
> +	if (!amdsmn_match(device_get_parent(dev), &sc->smn_pciid))
> +		return (ENXIO);
> +
>  	mtx_init(&sc->smn_lock, "SMN mtx", "SMN", MTX_DEF);
>  	return (0);
>  }
> @@ -182,8 +214,8 @@ amdsmn_read(device_t dev, uint32_t addr, uint32_t *val
>  	parent = device_get_parent(dev);
>  
>  	mtx_lock(&sc->smn_lock);
> -	pci_write_config(parent, SMN_ADDR_REG, addr, 4);
> -	*value = pci_read_config(parent, SMN_DATA_REG, 4);
> +	pci_write_config(parent, sc->smn_pciid->amdsmn_addr_reg, addr, 4);
> +	*value = pci_read_config(parent, sc->smn_pciid->amdsmn_data_reg, 4);
>  	mtx_unlock(&sc->smn_lock);
>  
>  	return (0);
> @@ -198,8 +230,8 @@ amdsmn_write(device_t dev, uint32_t addr, uint32_t val
>  	parent = device_get_parent(dev);
>  
>  	mtx_lock(&sc->smn_lock);
> -	pci_write_config(parent, SMN_ADDR_REG, addr, 4);
> -	pci_write_config(parent, SMN_DATA_REG, value, 4);
> +	pci_write_config(parent, sc->smn_pciid->amdsmn_addr_reg, addr, 4);
> +	pci_write_config(parent, sc->smn_pciid->amdsmn_data_reg, value, 4);
>  	mtx_unlock(&sc->smn_lock);
>  
>  	return (0);
>
> Modified: head/sys/dev/amdtemp/amdtemp.c
> =============================================================================
> =
> --- head/sys/dev/amdtemp/amdtemp.c	Sat Jan 12 22:10:31 2019	(r34297
> 6)
> +++ head/sys/dev/amdtemp/amdtemp.c	Sat Jan 12 22:36:33 2019	(r34297
> 7)
> @@ -5,6 +5,8 @@
>   * Copyright (c) 2009 Norikatsu Shigemura <nork@FreeBSD.org>
>   * Copyright (c) 2009-2012 Jung-uk Kim <jkim@FreeBSD.org>
>   * All rights reserved.
> + * Copyright (c) 2017-2019 Conrad Meyer <cem@FreeBSD.org>
> + * All rights reserved.
>   *
>   * Redistribution and use in source and binary forms, with or without
>   * modification, are permitted provided that the following conditions
> @@ -76,44 +78,67 @@ struct amdtemp_softc {
>  	device_t	sc_smn;
>  };
>  
> +/*
> + * N.B. The numbers in macro names below are significant and represent CPU
> + * family and model numbers.  Do not make up fictitious family or model numb
> ers
> + * when adding support for new devices.
> + */
>  #define	VENDORID_AMD		0x1022
>  #define	DEVICEID_AMD_MISC0F	0x1103
>  #define	DEVICEID_AMD_MISC10	0x1203
>  #define	DEVICEID_AMD_MISC11	0x1303
> -#define	DEVICEID_AMD_MISC12	0x1403
>  #define	DEVICEID_AMD_MISC14	0x1703
>  #define	DEVICEID_AMD_MISC15	0x1603
> +#define	DEVICEID_AMD_MISC15_M10H	0x1403
> +#define	DEVICEID_AMD_MISC15_M30H	0x141d
> +#define	DEVICEID_AMD_MISC15_M60H_ROOT	0x1576
>  #define	DEVICEID_AMD_MISC16	0x1533
>  #define	DEVICEID_AMD_MISC16_M30H	0x1583
> -#define	DEVICEID_AMD_MISC17	0x141d
>  #define	DEVICEID_AMD_HOSTB17H_ROOT	0x1450
> -#define	DEVICEID_AMD_HOSTB17H_DF_F3	0x1463
>  #define	DEVICEID_AMD_HOSTB17H_M10H_ROOT	0x15d0
> -#define	DEVICEID_AMD_HOSTB17H_M10H_DF_F3 0x15eb
>  
> -static struct amdtemp_product {
> +static const struct amdtemp_product {
>  	uint16_t	amdtemp_vendorid;
>  	uint16_t	amdtemp_deviceid;
> +	/*
> +	 * 0xFC register is only valid on the D18F3 PCI device; SMN temp
> +	 * drivers do not attach to that device.
> +	 */
> +	bool		amdtemp_has_cpuid;
>  } amdtemp_products[] = {
> -	{ VENDORID_AMD,	DEVICEID_AMD_MISC0F },
> -	{ VENDORID_AMD,	DEVICEID_AMD_MISC10 },
> -	{ VENDORID_AMD,	DEVICEID_AMD_MISC11 },
> -	{ VENDORID_AMD,	DEVICEID_AMD_MISC12 },
> -	{ VENDORID_AMD,	DEVICEID_AMD_MISC14 },
> -	{ VENDORID_AMD,	DEVICEID_AMD_MISC15 },
> -	{ VENDORID_AMD,	DEVICEID_AMD_MISC16 },
> -	{ VENDORID_AMD,	DEVICEID_AMD_MISC16_M30H },
> -	{ VENDORID_AMD,	DEVICEID_AMD_MISC17 },
> -	{ VENDORID_AMD,	DEVICEID_AMD_HOSTB17H_ROOT },
> -	{ VENDORID_AMD,	DEVICEID_AMD_HOSTB17H_M10H_ROOT },
> +	{ VENDORID_AMD,	DEVICEID_AMD_MISC0F, true },
> +	{ VENDORID_AMD,	DEVICEID_AMD_MISC10, true },
> +	{ VENDORID_AMD,	DEVICEID_AMD_MISC11, true },
> +	{ VENDORID_AMD,	DEVICEID_AMD_MISC14, true },
> +	{ VENDORID_AMD,	DEVICEID_AMD_MISC15, true },
> +	{ VENDORID_AMD,	DEVICEID_AMD_MISC15_M10H, true },
> +	{ VENDORID_AMD,	DEVICEID_AMD_MISC15_M30H, true },
> +	{ VENDORID_AMD,	DEVICEID_AMD_MISC15_M60H_ROOT, false },
> +	{ VENDORID_AMD,	DEVICEID_AMD_MISC16, true },
> +	{ VENDORID_AMD,	DEVICEID_AMD_MISC16_M30H, true },
> +	{ VENDORID_AMD,	DEVICEID_AMD_HOSTB17H_ROOT, false },
> +	{ VENDORID_AMD,	DEVICEID_AMD_HOSTB17H_M10H_ROOT, false },
>  };
>  
>  /*
> - * Reported Temperature Control Register
> + * Reported Temperature Control Register, family 0Fh-15h (some models), 16h.
>   */
>  #define	AMDTEMP_REPTMP_CTRL	0xa4
>  
> +#define	AMDTEMP_REPTMP10H_CURTMP_MASK	0x7ff
> +#define	AMDTEMP_REPTMP10H_CURTMP_SHIFT	21
> +#define	AMDTEMP_REPTMP10H_TJSEL_MASK	0x3
> +#define	AMDTEMP_REPTMP10H_TJSEL_SHIFT	16
> +
>  /*
> + * Reported Temperature, Family 15h, M60+
> + *
> + * Same register bit definitions as other Family 15h CPUs, but access is
> + * indirect via SMN, like Family 17h.
> + */
> +#define	AMDTEMP_15H_M60H_REPTMP_CTRL	0xd8200ca4
> +
> +/*
>   * Reported Temperature, Family 17h
>   *
>   * According to AMD OSRR for 17H, section 4.2.1, bits 31-21 of this register
> @@ -123,9 +148,13 @@ static struct amdtemp_product {
>   */
>  #define	AMDTEMP_17H_CUR_TMP		0x59800
>  #define	AMDTEMP_17H_CUR_TMP_RANGE_SEL	(1 << 19)
> -#define	AMDTEMP_17H_CUR_TMP_RANGE_OFF	490
>  
>  /*
> + * AMD temperature range adjustment, in deciKelvins (i.e., 49.0 Celsius).
> + */
> +#define	AMDTEMP_CURTMP_RANGE_ADJUST	490
> +
> +/*
>   * Thermaltrip Status Register (Family 0Fh only)
>   */
>  #define	AMDTEMP_THERMTP_STAT	0xe4
> @@ -151,9 +180,9 @@ static int	amdtemp_probe(device_t dev);
>  static int	amdtemp_attach(device_t dev);
>  static void	amdtemp_intrhook(void *arg);
>  static int	amdtemp_detach(device_t dev);
> -static int 	amdtemp_match(device_t dev);
>  static int32_t	amdtemp_gettemp0f(device_t dev, amdsensor_t sensor);
>  static int32_t	amdtemp_gettemp(device_t dev, amdsensor_t sensor);
> +static int32_t	amdtemp_gettemp15hm60h(device_t dev, amdsensor_t sensor
> );
>  static int32_t	amdtemp_gettemp17h(device_t dev, amdsensor_t sensor);
>  static int	amdtemp_sysctl(SYSCTL_HANDLER_ARGS);
>  
> @@ -180,8 +209,8 @@ MODULE_DEPEND(amdtemp, amdsmn, 1, 1, 1);
>  MODULE_PNP_INFO("U16:vendor;U16:device", pci, amdtemp, amdtemp_products,
>      nitems(amdtemp_products));
>  
> -static int
> -amdtemp_match(device_t dev)
> +static bool
> +amdtemp_match(device_t dev, const struct amdtemp_product **product_out)
>  {
>  	int i;
>  	uint16_t vendor, devid;
> @@ -191,11 +220,13 @@ amdtemp_match(device_t dev)
>  
>  	for (i = 0; i < nitems(amdtemp_products); i++) {
>  		if (vendor == amdtemp_products[i].amdtemp_vendorid &&
> -		    devid == amdtemp_products[i].amdtemp_deviceid)
> -			return (1);
> +		    devid == amdtemp_products[i].amdtemp_deviceid) {
> +			if (product_out != NULL)
> +				*product_out = &amdtemp_products[i];
> +			return (true);
> +		}
>  	}
> -
> -	return (0);
> +	return (false);
>  }
>  
>  static void
> @@ -207,7 +238,7 @@ amdtemp_identify(driver_t *driver, device_t parent)
>  	if (device_find_child(parent, "amdtemp", -1) != NULL)
>  		return;
>  
> -	if (amdtemp_match(parent)) {
> +	if (amdtemp_match(parent, NULL)) {
>  		child = device_add_child(parent, "amdtemp", -1);
>  		if (child == NULL)
>  			device_printf(parent, "add amdtemp child failed\n");
> @@ -221,7 +252,7 @@ amdtemp_probe(device_t dev)
>  
>  	if (resource_disabled("amdtemp", 0))
>  		return (ENXIO);
> -	if (!amdtemp_match(device_get_parent(dev)))
> +	if (!amdtemp_match(device_get_parent(dev), NULL))
>  		return (ENXIO);
>  
>  	family = CPUID_TO_FAMILY(cpu_id);
> @@ -254,23 +285,42 @@ amdtemp_attach(device_t dev)
>  {
>  	char tn[32];
>  	u_int regs[4];
> -	struct amdtemp_softc *sc = device_get_softc(dev);
> +	const struct amdtemp_product *product;
> +	struct amdtemp_softc *sc;
>  	struct sysctl_ctx_list *sysctlctx;
>  	struct sysctl_oid *sysctlnode;
>  	uint32_t cpuid, family, model;
>  	u_int bid;
>  	int erratum319, unit;
> +	bool needsmn;
>  
> +	sc = device_get_softc(dev);
>  	erratum319 = 0;
> +	needsmn = false;
>  
> -	/*
> -	 * CPUID Register is available from Revision F.
> -	 */
> +	if (!amdtemp_match(device_get_parent(dev), &product))
> +		return (ENXIO);
> +
>  	cpuid = cpu_id;
>  	family = CPUID_TO_FAMILY(cpuid);
>  	model = CPUID_TO_MODEL(cpuid);
> -	if ((family != 0x0f || model >= 0x40) && family != 0x17) {
> -		cpuid = pci_read_config(dev, AMDTEMP_CPUID, 4);
> +
> +	/*
> +	 * This checks for the byzantine condition of running a heterogenous
> +	 * revision multi-socket system where the attach thread is potentially
> +	 * probing a remote socket's PCI device.
> +	 *
> +	 * Currently, such scenarios are unsupported on models using the SMN
> +	 * (because on those models, amdtemp(4) attaches to a different PCI
> +	 * device than the one that contains AMDTEMP_CPUID).
> +	 *
> +	 * The ancient 0x0F family of devices only supports this register from
> +	 * models 40h+.
> +	 */
> +	if (product->amdtemp_has_cpuid && (family > 0x0f ||
> +	    (family == 0x0f && model >= 0x40))) {
> +		cpuid = pci_read_config(device_get_parent(dev), AMDTEMP_CPUID,
> +		    4);
>  		family = CPUID_TO_FAMILY(cpuid);
>  		model = CPUID_TO_MODEL(cpuid);
>  	}
> @@ -364,16 +414,30 @@ amdtemp_attach(device_t dev)
>  	case 0x14:
>  	case 0x15:
>  	case 0x16:
> +		sc->sc_ntemps = 1;
>  		/*
> -		 * There is only one sensor per package.
> +		 * Some later (60h+) models of family 15h use a similar SMN
> +		 * network as family 17h.  (However, the register index differs
> +		 * from 17h and the decoding matches other 10h-15h models,
> +		 * which differ from 17h.)
>  		 */
> -		sc->sc_ntemps = 1;
> -
> -		sc->sc_gettemp = amdtemp_gettemp;
> +		if (family == 0x15 && model >= 0x60) {
> +			sc->sc_gettemp = amdtemp_gettemp15hm60h;
> +			needsmn = true;
> +		} else
> +			sc->sc_gettemp = amdtemp_gettemp;
>  		break;
>  	case 0x17:
>  		sc->sc_ntemps = 1;
>  		sc->sc_gettemp = amdtemp_gettemp17h;
> +		needsmn = true;
> +		break;
> +	default:
> +		device_printf(dev, "Bogus family 0x%x\n", family);
> +		return (ENXIO);
> +	}
> +
> +	if (needsmn) {
>  		sc->sc_smn = device_find_child(
>  		    device_get_parent(dev), "amdsmn", -1);
>  		if (sc->sc_smn == NULL) {
> @@ -381,7 +445,6 @@ amdtemp_attach(device_t dev)
>  				device_printf(dev, "No SMN device found\n");
>  			return (ENXIO);
>  		}
> -		break;
>  	}
>  
>  	/* Find number of cores per package. */
> @@ -585,6 +648,29 @@ amdtemp_gettemp0f(device_t dev, amdsensor_t sensor)
>  	return (temp);
>  }
>  
> +static uint32_t
> +amdtemp_decode_fam10h_to_16h(int32_t sc_offset, uint32_t val)
> +{
> +	uint32_t temp;
> +
> +	/* Convert raw register subfield units (0.125C) to units of 0.1C. */
> +	temp = ((val >> AMDTEMP_REPTMP10H_CURTMP_SHIFT) &
> +	    AMDTEMP_REPTMP10H_CURTMP_MASK) * 5 / 4;
> +
> +	/*
> +	 * On Family 15h and higher, if CurTmpTjSel is 11b, the range is
> +	 * adjusted down by 49.0 degrees Celsius.  (This adjustment is not
> +	 * documented in BKDGs prior to family 15h model 00h.)
> +	 */
> +	if (CPUID_TO_FAMILY(cpu_id) >= 0x15 &&
> +	    ((val >> AMDTEMP_REPTMP10H_TJSEL_SHIFT) &
> +	    AMDTEMP_REPTMP10H_TJSEL_MASK) == 0x3)
> +		temp -= AMDTEMP_CURTMP_RANGE_ADJUST;
> +
> +	temp += AMDTEMP_ZERO_C_TO_K + sc_offset * 10;
> +	return (temp);
> +}
> +
>  static int32_t
>  amdtemp_gettemp(device_t dev, amdsensor_t sensor)
>  {
> @@ -592,10 +678,19 @@ amdtemp_gettemp(device_t dev, amdsensor_t sensor)
>  	uint32_t temp;
>  
>  	temp = pci_read_config(dev, AMDTEMP_REPTMP_CTRL, 4);
> -	temp = ((temp >> 21) & 0x7ff) * 5 / 4;
> -	temp += AMDTEMP_ZERO_C_TO_K + sc->sc_offset * 10;
> +	return (amdtemp_decode_fam10h_to_16h(sc->sc_offset, temp));
> +}
>  
> -	return (temp);
> +static int32_t
> +amdtemp_gettemp15hm60h(device_t dev, amdsensor_t sensor)
> +{
> +	struct amdtemp_softc *sc = device_get_softc(dev);
> +	uint32_t val;
> +	int error;
> +
> +	error = amdsmn_read(sc->sc_smn, AMDTEMP_15H_M60H_REPTMP_CTRL, &val);
> +	KASSERT(error == 0, ("amdsmn_read"));
> +	return (amdtemp_decode_fam10h_to_16h(sc->sc_offset, val));
>  }
>  
>  static int32_t
> @@ -610,7 +705,7 @@ amdtemp_gettemp17h(device_t dev, amdsensor_t sensor)
>  
>  	temp = ((val >> 21) & 0x7ff) * 5 / 4;
>  	if ((val & AMDTEMP_17H_CUR_TMP_RANGE_SEL) != 0)
> -		temp -= AMDTEMP_17H_CUR_TMP_RANGE_OFF;
> +		temp -= AMDTEMP_CURTMP_RANGE_ADJUST;
>  	temp += AMDTEMP_ZERO_C_TO_K + sc->sc_offset * 10;
>  
>  	return (temp);
>

This broke/removed support for family 0fh. I'm seeing strange 
temperatures and negative on one machine.


-- 
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  http://www.FreeBSD.org

	The need of the many outweighs the greed of the few.




From owner-svn-src-head@freebsd.org  Mon Jul 22 16:01:22 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id CAEF5B4D26;
 Mon, 22 Jul 2019 16:01:22 +0000 (UTC) (envelope-from br@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 B093675658;
 Mon, 22 Jul 2019 16:01:22 +0000 (UTC) (envelope-from br@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 8A7C1F97E;
 Mon, 22 Jul 2019 16:01:22 +0000 (UTC) (envelope-from br@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6MG1Mto067720;
 Mon, 22 Jul 2019 16:01:22 GMT (envelope-from br@FreeBSD.org)
Received: (from br@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6MG1KJb067708;
 Mon, 22 Jul 2019 16:01:20 GMT (envelope-from br@FreeBSD.org)
Message-Id: <201907221601.x6MG1KJb067708@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org
 using -f
From: Ruslan Bukin <br@FreeBSD.org>
Date: Mon, 22 Jul 2019 16:01:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350212 - in head/sys: conf dev/altera/msgdma dev/xdma
 mips/beri
X-SVN-Group: head
X-SVN-Commit-Author: br
X-SVN-Commit-Paths: in head/sys: conf dev/altera/msgdma dev/xdma mips/beri
X-SVN-Commit-Revision: 350212
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: B093675658
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.934,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 16:01:22 -0000

Author: br
Date: Mon Jul 22 16:01:20 2019
New Revision: 350212
URL: https://svnweb.freebsd.org/changeset/base/350212

Log:
  o Add support for BERI IOMMU device
  o Add an experimental IOMMU support to xDMA framework
  
  The BERI IOMMU device is the part of CHERI device-model project [1]. It
  translates memory addresses for various BERI peripherals modelled in
  software. It accepts FreeBSD/mips64 page directories format and manages
  BERI TLB.
  
  1. https://github.com/CTSRD-CHERI/device-model
  
  Sponsored by:	DARPA, AFRL

Added:
  head/sys/dev/xdma/xdma_iommu.c   (contents, props changed)
  head/sys/mips/beri/beri_iommu.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/altera/msgdma/msgdma.c
  head/sys/dev/xdma/xdma.c
  head/sys/dev/xdma/xdma.h
  head/sys/dev/xdma/xdma_if.m
  head/sys/dev/xdma/xdma_sg.c
  head/sys/mips/beri/files.beri

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Mon Jul 22 10:37:56 2019	(r350211)
+++ head/sys/conf/files	Mon Jul 22 16:01:20 2019	(r350212)
@@ -3431,6 +3431,7 @@ dev/xdma/xdma_bank.c		optional xdma
 dev/xdma/xdma_bio.c		optional xdma
 dev/xdma/xdma_fdt_test.c	optional xdma xdma_test fdt
 dev/xdma/xdma_if.m		optional xdma
+dev/xdma/xdma_iommu.c		optional xdma
 dev/xdma/xdma_mbuf.c		optional xdma
 dev/xdma/xdma_queue.c		optional xdma
 dev/xdma/xdma_sg.c		optional xdma

Modified: head/sys/dev/altera/msgdma/msgdma.c
==============================================================================
--- head/sys/dev/altera/msgdma/msgdma.c	Mon Jul 22 10:37:56 2019	(r350211)
+++ head/sys/dev/altera/msgdma/msgdma.c	Mon Jul 22 16:01:20 2019	(r350212)
@@ -414,7 +414,8 @@ msgdma_channel_alloc(device_t dev, struct xdma_channel
 		if (chan->used == 0) {
 			chan->xchan = xchan;
 			xchan->chan = (void *)chan;
-			xchan->caps |= XCHAN_CAP_BUSDMA;
+			if ((xchan->caps & XCHAN_CAP_IOMMU) == 0)
+				xchan->caps |= XCHAN_CAP_BUSDMA;
 			chan->index = i;
 			chan->sc = sc;
 			chan->used = 1;

Modified: head/sys/dev/xdma/xdma.c
==============================================================================
--- head/sys/dev/xdma/xdma.c	Mon Jul 22 10:37:56 2019	(r350211)
+++ head/sys/dev/xdma/xdma.c	Mon Jul 22 16:01:20 2019	(r350212)
@@ -70,6 +70,39 @@ static struct mtx xdma_mtx;
 
 #define	FDT_REG_CELLS	4
 
+#ifdef FDT
+static int
+xdma_get_iommu_fdt(xdma_controller_t *xdma, xdma_channel_t *xchan)
+{
+	struct xdma_iommu *xio;
+	phandle_t node;
+	pcell_t prop;
+	size_t len;
+
+	node = ofw_bus_get_node(xdma->dma_dev);
+	if (OF_getproplen(node, "xdma,iommu") <= 0)
+		return (0);
+
+	len = OF_getencprop(node, "xdma,iommu", &prop, sizeof(prop));
+	if (len != sizeof(prop)) {
+		device_printf(xdma->dev,
+		    "%s: Can't get iommu device node\n", __func__);
+		return (0);
+	}
+
+	xio = &xchan->xio;
+	xio->dev = OF_device_from_xref(prop);
+	if (xio->dev == NULL) {
+		device_printf(xdma->dev,
+		    "%s: Can't get iommu device\n", __func__);
+		return (0);
+	}
+
+	/* Found */
+	return (1);
+}
+#endif
+
 /*
  * Allocate virtual xDMA channel.
  */
@@ -81,6 +114,13 @@ xdma_channel_alloc(xdma_controller_t *xdma, uint32_t c
 
 	xchan = malloc(sizeof(xdma_channel_t), M_XDMA, M_WAITOK | M_ZERO);
 	xchan->xdma = xdma;
+
+#ifdef FDT
+	/* Check if this DMA controller supports IOMMU. */
+	if (xdma_get_iommu_fdt(xdma, xchan))
+		caps |= XCHAN_CAP_IOMMU | XCHAN_CAP_NOSEG;
+#endif
+
 	xchan->caps = caps;
 
 	XDMA_LOCK();
@@ -109,6 +149,9 @@ xdma_channel_alloc(xdma_controller_t *xdma, uint32_t c
 	TAILQ_INIT(&xchan->queue_out);
 	TAILQ_INIT(&xchan->processing);
 
+	if (xchan->caps & XCHAN_CAP_IOMMU)
+		xdma_iommu_init(&xchan->xio);
+
 	TAILQ_INSERT_TAIL(&xdma->channels, xchan, xchan_next);
 
 	XDMA_UNLOCK();
@@ -139,6 +182,9 @@ xdma_channel_free(xdma_channel_t *xchan)
 	if (xchan->flags & XCHAN_TYPE_SG)
 		xdma_channel_free_sg(xchan);
 
+	if (xchan->caps & XCHAN_CAP_IOMMU)
+		xdma_iommu_release(&xchan->xio);
+
 	xdma_teardown_all_intr(xchan);
 
 	mtx_destroy(&xchan->mtx_lock);
@@ -306,7 +352,7 @@ xdma_ofw_md_data(xdma_controller_t *xdma, pcell_t *cel
 	return (ret);
 }
 
-static int
+int
 xdma_handle_mem_node(vmem_t *vmem, phandle_t memory)
 {
 	pcell_t reg[FDT_REG_CELLS * FDT_MEM_REGIONS];

Modified: head/sys/dev/xdma/xdma.h
==============================================================================
--- head/sys/dev/xdma/xdma.h	Mon Jul 22 10:37:56 2019	(r350211)
+++ head/sys/dev/xdma/xdma.h	Mon Jul 22 16:01:20 2019	(r350212)
@@ -37,6 +37,14 @@
 #include <sys/proc.h>
 #include <sys/vmem.h>
 
+#ifdef FDT
+#include <dev/fdt/fdt_common.h>
+#include <dev/ofw/openfirm.h>
+#endif
+
+#include <vm/vm.h>
+#include <vm/pmap.h>
+
 enum xdma_direction {
 	XDMA_MEM_TO_MEM,
 	XDMA_MEM_TO_DEV,
@@ -121,6 +129,12 @@ struct xdma_sglist {
 	bool				last;
 };
 
+struct xdma_iommu {
+	struct pmap p;
+	vmem_t *vmem;		/* VA space */
+	device_t dev;		/* IOMMU device */
+};
+
 struct xdma_channel {
 	xdma_controller_t		*xdma;
 	vmem_t				*vmem;
@@ -138,6 +152,7 @@ struct xdma_channel {
 #define	XCHAN_CAP_BUSDMA		(1 << 0)
 #define	XCHAN_CAP_NOSEG			(1 << 1)
 #define	XCHAN_CAP_BOUNCE		(1 << 2)
+#define	XCHAN_CAP_IOMMU			(1 << 3)
 
 	/* A real hardware driver channel. */
 	void				*chan;
@@ -171,6 +186,9 @@ struct xdma_channel {
 	TAILQ_HEAD(, xdma_request)	queue_in;
 	TAILQ_HEAD(, xdma_request)	queue_out;
 	TAILQ_HEAD(, xdma_request)	processing;
+
+	/* iommu */
+	struct xdma_iommu		xio;
 };
 
 typedef struct xdma_channel xdma_channel_t;
@@ -216,6 +234,9 @@ xdma_controller_t *xdma_ofw_get(device_t dev, const ch
 int xdma_put(xdma_controller_t *xdma);
 vmem_t * xdma_get_memory(device_t dev);
 void xdma_put_memory(vmem_t *vmem);
+#ifdef FDT
+int xdma_handle_mem_node(vmem_t *vmem, phandle_t memory);
+#endif
 
 /* xDMA channel ops */
 xdma_channel_t * xdma_channel_alloc(xdma_controller_t *, uint32_t caps);
@@ -270,5 +291,12 @@ void xchan_bank_init(xdma_channel_t *xchan);
 int xchan_bank_free(xdma_channel_t *xchan);
 struct xdma_request * xchan_bank_get(xdma_channel_t *xchan);
 int xchan_bank_put(xdma_channel_t *xchan, struct xdma_request *xr);
+
+/* IOMMU */
+void xdma_iommu_add_entry(xdma_channel_t *xchan, vm_offset_t *va,
+    vm_paddr_t pa, vm_size_t size, vm_prot_t prot);
+void xdma_iommu_remove_entry(xdma_channel_t *xchan, vm_offset_t va);
+int xdma_iommu_init(struct xdma_iommu *xio);
+int xdma_iommu_release(struct xdma_iommu *xio);
 
 #endif /* !_DEV_XDMA_XDMA_H_ */

Modified: head/sys/dev/xdma/xdma_if.m
==============================================================================
--- head/sys/dev/xdma/xdma_if.m	Mon Jul 22 10:37:56 2019	(r350211)
+++ head/sys/dev/xdma/xdma_if.m	Mon Jul 22 16:01:20 2019	(r350212)
@@ -1,5 +1,5 @@
 #-
-# Copyright (c) 2016-2018 Ruslan Bukin <br@bsdpad.com>
+# Copyright (c) 2016-2019 Ruslan Bukin <br@bsdpad.com>
 # All rights reserved.
 #
 # This software was developed by SRI International and the University of
@@ -112,4 +112,41 @@ METHOD int channel_control {
 	device_t dev;
 	struct xdma_channel *xchan;
 	int cmd;
+};
+
+# IOMMU interface
+
+#
+# pmap is initialized
+#
+METHOD int iommu_init {
+	device_t dev;
+	struct xdma_iommu *xio;
+};
+
+#
+# pmap is released
+#
+METHOD int iommu_release {
+	device_t dev;
+	struct xdma_iommu *xio;
+};
+
+#
+# Mapping entered
+#
+METHOD int iommu_enter {
+	device_t dev;
+	struct xdma_iommu *xio;
+	vm_offset_t va;
+	vm_offset_t pa;
+};
+
+#
+# Mapping removed
+#
+METHOD int iommu_remove {
+	device_t dev;
+	struct xdma_iommu *xio;
+	vm_offset_t va;
 };

Added: head/sys/dev/xdma/xdma_iommu.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/xdma/xdma_iommu.c	Mon Jul 22 16:01:20 2019	(r350212)
@@ -0,0 +1,174 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2019 Ruslan Bukin <br@bsdpad.com>
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory (Department of Computer Science and
+ * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
+ * DARPA SSITH research programme.
+ *
+ * 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 <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "opt_platform.h"
+#include <sys/param.h>
+#include <sys/conf.h>
+#include <sys/bus.h>
+#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/mbuf.h>
+#include <sys/mutex.h>
+#include <sys/rwlock.h>
+
+#include <machine/cache.h>
+#include <machine/bus.h>
+
+#include <vm/vm.h>
+#include <vm/pmap.h>
+#include <vm/vm_extern.h>
+#include <vm/vm_page.h>
+
+#ifdef FDT
+#include <dev/fdt/fdt_common.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+#endif
+
+#include <dev/xdma/xdma.h>
+#include "xdma_if.h"
+
+void
+xdma_iommu_remove_entry(xdma_channel_t *xchan, vm_offset_t va)
+{
+	struct xdma_iommu *xio;
+
+	xio = &xchan->xio;
+
+	va &= ~(PAGE_SIZE - 1);
+	pmap_remove(&xio->p, va, va + PAGE_SIZE);
+
+	XDMA_IOMMU_REMOVE(xio->dev, xio, va);
+
+	vmem_free(xio->vmem, va, PAGE_SIZE);
+}
+
+static void
+xdma_iommu_enter(struct xdma_iommu *xio, vm_offset_t va,
+    vm_paddr_t pa, vm_size_t size, vm_prot_t prot)
+{
+	vm_page_t m;
+	pmap_t p;
+
+	p = &xio->p;
+
+	KASSERT((size & PAGE_MASK) == 0,
+	    ("%s: device mapping not page-sized", __func__));
+
+	for (; size > 0; size -= PAGE_SIZE) {
+		m = PHYS_TO_VM_PAGE(pa);
+		pmap_enter(p, va, m, prot, prot | PMAP_ENTER_WIRED, 0);
+
+		XDMA_IOMMU_ENTER(xio->dev, xio, va, pa);
+
+		va += PAGE_SIZE;
+		pa += PAGE_SIZE;
+	}
+}
+
+void
+xdma_iommu_add_entry(xdma_channel_t *xchan, vm_offset_t *va,
+    vm_paddr_t pa, vm_size_t size, vm_prot_t prot)
+{
+	struct xdma_iommu *xio;
+	vm_offset_t addr;
+
+	size = roundup2(size, PAGE_SIZE);
+	xio = &xchan->xio;
+
+	if (vmem_alloc(xio->vmem, size,
+	    M_FIRSTFIT | M_NOWAIT, &addr)) {
+		panic("Could not allocate virtual address.\n");
+	}
+
+	addr |= pa & (PAGE_SIZE - 1);
+
+	if (va)
+		*va = addr;
+
+	xdma_iommu_enter(xio, addr, pa, size, prot);
+}
+
+int
+xdma_iommu_init(struct xdma_iommu *xio)
+{
+#ifdef FDT
+	phandle_t mem_node, node;
+	pcell_t mem_handle;
+#endif
+
+	pmap_pinit(&xio->p);
+
+#ifdef FDT
+	node = ofw_bus_get_node(xio->dev);
+	if (!OF_hasprop(node, "va-region"))
+		return (ENXIO);
+
+	if (OF_getencprop(node, "va-region", (void *)&mem_handle,
+	    sizeof(mem_handle)) <= 0)
+		return (ENXIO);
+#endif
+
+	xio->vmem = vmem_create("xDMA vmem", 0, 0, PAGE_SIZE,
+	    PAGE_SIZE, M_FIRSTFIT | M_WAITOK);
+	if (xio->vmem == NULL)
+		return (ENXIO);
+
+#ifdef FDT
+	mem_node = OF_node_from_xref(mem_handle);
+	if (xdma_handle_mem_node(xio->vmem, mem_node) != 0) {
+		vmem_destroy(xio->vmem);
+		return (ENXIO);
+	}
+#endif
+
+	XDMA_IOMMU_INIT(xio->dev, xio);
+
+	return (0);
+}
+
+int
+xdma_iommu_release(struct xdma_iommu *xio)
+{
+
+	pmap_release(&xio->p);
+
+	vmem_destroy(xio->vmem);
+
+	XDMA_IOMMU_RELEASE(xio->dev, xio);
+
+	return (0);
+}

Modified: head/sys/dev/xdma/xdma_sg.c
==============================================================================
--- head/sys/dev/xdma/xdma_sg.c	Mon Jul 22 10:37:56 2019	(r350211)
+++ head/sys/dev/xdma/xdma_sg.c	Mon Jul 22 16:01:20 2019	(r350212)
@@ -327,6 +327,7 @@ xchan_seg_done(xdma_channel_t *xchan,
 	struct xdma_request *xr;
 	xdma_controller_t *xdma;
 	struct xchan_buf *b;
+	bus_addr_t addr;
 
 	xdma = xchan->xdma;
 
@@ -352,6 +353,12 @@ xchan_seg_done(xdma_channel_t *xchan,
 			    xr->direction == XDMA_DEV_TO_MEM)
 				m_copyback(xr->m, 0, st->transferred,
 				    (void *)xr->buf.vaddr);
+		} else if (xchan->caps & XCHAN_CAP_IOMMU) {
+			if (xr->direction == XDMA_MEM_TO_DEV)
+				addr = xr->src_addr;
+			else
+				addr = xr->dst_addr;
+			xdma_iommu_remove_entry(xchan, addr);
 		}
 		xr->status.error = st->error;
 		xr->status.transferred = st->transferred;
@@ -484,11 +491,17 @@ _xdma_load_data(xdma_channel_t *xchan, struct xdma_req
 	xdma_controller_t *xdma;
 	struct mbuf *m;
 	uint32_t nsegs;
+	vm_offset_t va, addr;
+	bus_addr_t pa;
+	vm_prot_t prot;
 
 	xdma = xchan->xdma;
 
 	m = xr->m;
 
+	KASSERT(xchan->caps & XCHAN_CAP_NOSEG,
+	    ("Handling segmented data is not implemented here."));
+
 	nsegs = 1;
 
 	switch (xr->req_type) {
@@ -498,6 +511,27 @@ _xdma_load_data(xdma_channel_t *xchan, struct xdma_req
 				m_copydata(m, 0, m->m_pkthdr.len,
 				    (void *)xr->buf.vaddr);
 			seg[0].ds_addr = (bus_addr_t)xr->buf.paddr;
+		} else if (xchan->caps & XCHAN_CAP_IOMMU) {
+			addr = mtod(m, bus_addr_t);
+			pa = vtophys(addr);
+
+			if (xr->direction == XDMA_MEM_TO_DEV)
+				prot = VM_PROT_READ;
+			else
+				prot = VM_PROT_WRITE;
+
+			xdma_iommu_add_entry(xchan, &va,
+			    pa, m->m_pkthdr.len, prot);
+
+			/*
+			 * Save VA so we can unload data later
+			 * after completion of this transfer.
+			 */
+			if (xr->direction == XDMA_MEM_TO_DEV)
+				xr->src_addr = va;
+			else
+				xr->dst_addr = va;
+			seg[0].ds_addr = va;
 		} else
 			seg[0].ds_addr = mtod(m, bus_addr_t);
 		seg[0].ds_len = m->m_pkthdr.len;

Added: head/sys/mips/beri/beri_iommu.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/mips/beri/beri_iommu.c	Mon Jul 22 16:01:20 2019	(r350212)
@@ -0,0 +1,237 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2019 Ruslan Bukin <br@bsdpad.com>
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory (Department of Computer Science and
+ * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
+ * DARPA SSITH research programme.
+ *
+ * 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 <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/malloc.h>
+#include <sys/rman.h>
+#include <sys/timeet.h>
+#include <sys/timetc.h>
+#include <sys/conf.h>
+#include <sys/uio.h>
+#include <sys/endian.h>
+
+#include <dev/ofw/openfirm.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+
+#include <machine/cache.h>
+#include <machine/bus.h>
+#include <machine/cpu.h>
+#include <machine/intr.h>
+
+#include <dev/xdma/xdma.h>
+
+#include "xdma_if.h"
+
+#define	IOMMU_INVALIDATE	0x00
+#define	IOMMU_SET_BASE		0x08
+
+struct beri_iommu_softc {
+	struct resource		*res[1];
+	device_t		dev;
+	bus_space_tag_t		bst_data;
+	bus_space_handle_t	bsh_data;
+	uint32_t		offs;
+};
+
+static struct resource_spec beri_iommu_spec[] = {
+	{ SYS_RES_MEMORY,	0,	RF_ACTIVE },
+	{ -1, 0 }
+};
+
+static void
+beri_iommu_invalidate(struct beri_iommu_softc *sc, vm_offset_t addr)
+{
+
+	bus_write_8(sc->res[0], IOMMU_INVALIDATE, htole64(addr));
+}
+
+static void
+beri_iommu_set_base(struct beri_iommu_softc *sc, vm_offset_t addr)
+{
+
+	bus_write_8(sc->res[0], IOMMU_SET_BASE, htole64(addr));
+}
+
+static int
+beri_iommu_release(device_t dev, struct xdma_iommu *xio)
+{
+	struct beri_iommu_softc *sc;
+
+	sc = device_get_softc(dev);
+
+	beri_iommu_set_base(sc, 0);
+
+	return (0);
+}
+
+static int
+beri_iommu_init(device_t dev, struct xdma_iommu *xio)
+{
+	struct beri_iommu_softc *sc;
+
+	sc = device_get_softc(dev);
+
+	beri_iommu_set_base(sc, (uintptr_t)xio->p.pm_segtab);
+
+	return (0);
+}
+
+static int
+beri_iommu_remove(device_t dev, struct xdma_iommu *xio, vm_offset_t va)
+{
+	struct beri_iommu_softc *sc;
+
+	sc = device_get_softc(dev);
+
+	beri_iommu_invalidate(sc, va);
+
+	return (0);
+}
+
+static int
+beri_iommu_enter(device_t dev, struct xdma_iommu *xio, vm_offset_t va,
+    vm_paddr_t pa)
+{
+	struct beri_iommu_softc *sc;
+	pt_entry_t opte, npte;
+	pt_entry_t *pte;
+	pmap_t p;
+
+	sc = device_get_softc(dev);
+	p = &xio->p;
+
+	pte = pmap_pte(p, va);
+	if (pte == NULL)
+		panic("pte is NULL\n");
+
+	/* Make pte uncacheable. */
+	opte = *pte;
+	npte = opte & ~PTE_C_MASK;
+	npte |= PTE_C(VM_MEMATTR_UNCACHEABLE);
+	*pte = npte;
+
+	/* Write back, invalidate pte. */
+	mips_dcache_wbinv_range((vm_offset_t)pte, sizeof(vm_offset_t));
+
+	/* Invalidate the entry. */
+	if (pte_test(&opte, PTE_V) && opte != npte)
+		beri_iommu_invalidate(sc, va);
+
+	return (0);
+}
+
+static int
+beri_iommu_probe(device_t dev)
+{
+
+	if (!ofw_bus_status_okay(dev))
+		return (ENXIO);
+
+	if (!ofw_bus_is_compatible(dev, "beri,iommu"))
+		return (ENXIO);
+
+	device_set_desc(dev, "BERI IOMMU");
+
+	return (BUS_PROBE_DEFAULT);
+}
+
+static int
+beri_iommu_attach(device_t dev)
+{
+	struct beri_iommu_softc *sc;
+	phandle_t xref, node;
+
+	sc = device_get_softc(dev);
+	sc->dev = dev;
+
+	if (bus_alloc_resources(dev, beri_iommu_spec, sc->res)) {
+		device_printf(dev, "could not allocate resources\n");
+		return (ENXIO);
+	}
+
+	/* Memory interface */
+	sc->bst_data = rman_get_bustag(sc->res[0]);
+	sc->bsh_data = rman_get_bushandle(sc->res[0]);
+
+	node = ofw_bus_get_node(dev);
+	xref = OF_xref_from_node(node);
+	OF_device_register_xref(xref, dev);
+
+	return (0);
+}
+
+static int
+beri_iommu_detach(device_t dev)
+{
+	struct beri_iommu_softc *sc;
+
+	sc = device_get_softc(dev);
+
+	bus_release_resources(dev, beri_iommu_spec, sc->res);
+
+	return (0);
+}
+
+static device_method_t beri_iommu_methods[] = {
+
+	/* xDMA IOMMU interface */
+	DEVMETHOD(xdma_iommu_init,	beri_iommu_init),
+	DEVMETHOD(xdma_iommu_release,	beri_iommu_release),
+	DEVMETHOD(xdma_iommu_enter,	beri_iommu_enter),
+	DEVMETHOD(xdma_iommu_remove,	beri_iommu_remove),
+
+	/* Device interface */
+	DEVMETHOD(device_probe,		beri_iommu_probe),
+	DEVMETHOD(device_attach,	beri_iommu_attach),
+	DEVMETHOD(device_detach,	beri_iommu_detach),
+
+	{ 0, 0 }
+};
+
+static driver_t beri_iommu_driver = {
+	"beri_iommu",
+	beri_iommu_methods,
+	sizeof(struct beri_iommu_softc),
+};
+
+static devclass_t beri_iommu_devclass;
+
+DRIVER_MODULE(beri_iommu, simplebus, beri_iommu_driver,
+    beri_iommu_devclass, 0, 0);

Modified: head/sys/mips/beri/files.beri
==============================================================================
--- head/sys/mips/beri/files.beri	Mon Jul 22 10:37:56 2019	(r350211)
+++ head/sys/mips/beri/files.beri	Mon Jul 22 16:01:20 2019	(r350212)
@@ -20,6 +20,7 @@ dev/terasic/mtl/terasic_mtl_reg.c	optional terasic_mtl
 dev/terasic/mtl/terasic_mtl_syscons.c	optional terasic_mtl sc
 dev/terasic/mtl/terasic_mtl_text.c	optional terasic_mtl
 dev/terasic/mtl/terasic_mtl_vt.c	optional terasic_mtl vt
+mips/beri/beri_iommu.c			optional xdma
 mips/beri/beri_machdep.c		standard
 mips/beri/beri_mp.c			optional smp
 mips/beri/beri_pic.c			optional fdt

From owner-svn-src-head@freebsd.org  Mon Jul 22 16:50:38 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8422DB59E7;
 Mon, 22 Jul 2019 16:50:38 +0000 (UTC) (envelope-from br@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 647E577214;
 Mon, 22 Jul 2019 16:50:38 +0000 (UTC) (envelope-from br@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 3E38F1822E;
 Mon, 22 Jul 2019 16:50:38 +0000 (UTC) (envelope-from br@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6MGocvm095482;
 Mon, 22 Jul 2019 16:50:38 GMT (envelope-from br@FreeBSD.org)
Received: (from br@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6MGocxL095481;
 Mon, 22 Jul 2019 16:50:38 GMT (envelope-from br@FreeBSD.org)
Message-Id: <201907221650.x6MGocxL095481@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org
 using -f
From: Ruslan Bukin <br@FreeBSD.org>
Date: Mon, 22 Jul 2019 16:50:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350213 - head/sys/dev/xdma
X-SVN-Group: head
X-SVN-Commit-Author: br
X-SVN-Commit-Paths: head/sys/dev/xdma
X-SVN-Commit-Revision: 350213
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 647E577214
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];
 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 16:50:38 -0000

Author: br
Date: Mon Jul 22 16:50:37 2019
New Revision: 350213
URL: https://svnweb.freebsd.org/changeset/base/350213

Log:
  Remove unused header.
  
  Sponsored by:	DARPA, AFRL

Modified:
  head/sys/dev/xdma/xdma_iommu.c

Modified: head/sys/dev/xdma/xdma_iommu.c
==============================================================================
--- head/sys/dev/xdma/xdma_iommu.c	Mon Jul 22 16:01:20 2019	(r350212)
+++ head/sys/dev/xdma/xdma_iommu.c	Mon Jul 22 16:50:37 2019	(r350213)
@@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/mutex.h>
 #include <sys/rwlock.h>
 
-#include <machine/cache.h>
 #include <machine/bus.h>
 
 #include <vm/vm.h>

From owner-svn-src-head@freebsd.org  Mon Jul 22 17:08:20 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 532EFB647E;
 Mon, 22 Jul 2019 17:08:20 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 2CA0F800DA;
 Mon, 22 Jul 2019 17:08:20 +0000 (UTC) (envelope-from mav@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 4FAF51859A;
 Mon, 22 Jul 2019 17:08:19 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6MH8Jm7007483;
 Mon, 22 Jul 2019 17:08:19 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6MH8IEu007481;
 Mon, 22 Jul 2019 17:08:18 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201907221708.x6MH8IEu007481@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Mon, 22 Jul 2019 17:08:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350214 - head/sbin/camcontrol
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: head/sbin/camcontrol
X-SVN-Commit-Revision: 350214
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 2CA0F800DA
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.928,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 17:08:20 -0000

Author: mav
Date: Mon Jul 22 17:08:18 2019
New Revision: 350214
URL: https://svnweb.freebsd.org/changeset/base/350214

Log:
  Unify BTL parsing for `camcontrol debug` and `reset`.
  
  This makes `camcontrol debug` also allow peripheral device specification.
  
  While there, make BTL parser more strict and switch from strtok() to
  strsep().
  
  MFC after:	2 weeks

Modified:
  head/sbin/camcontrol/camcontrol.8
  head/sbin/camcontrol/camcontrol.c

Modified: head/sbin/camcontrol/camcontrol.8
==============================================================================
--- head/sbin/camcontrol/camcontrol.8	Mon Jul 22 16:50:37 2019	(r350213)
+++ head/sbin/camcontrol/camcontrol.8	Mon Jul 22 17:08:18 2019	(r350214)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 19, 2019
+.Dd July 22, 2019
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -185,7 +185,7 @@
 .Op Fl X
 .Op Fl c
 .Op Fl p
-.Aq all|off|bus Ns Op :target Ns Op :lun
+.Aq all | off | device id | bus Ns Op :target Ns Op :lun
 .Nm
 .Ic tags
 .Op device id

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c	Mon Jul 22 16:50:37 2019	(r350213)
+++ head/sbin/camcontrol/camcontrol.c	Mon Jul 22 17:08:18 2019	(r350214)
@@ -3535,6 +3535,66 @@ atasecurity(struct cam_device *device, int retry_count
 }
 
 /*
+ * Convert periph name into a bus, target and lun.
+ *
+ * Returns the number of parsed components, or 0.
+ */
+static int
+parse_btl_name(char *tstr, path_id_t *bus, target_id_t *target, lun_id_t *lun,
+    cam_argmask *arglst)
+{
+	int fd;
+	union ccb ccb;
+
+	bzero(&ccb, sizeof(ccb));
+	ccb.ccb_h.func_code = XPT_GDEVLIST;
+	if (cam_get_device(tstr, ccb.cgdl.periph_name,
+	    sizeof(ccb.cgdl.periph_name), &ccb.cgdl.unit_number) == -1) {
+		warnx("%s", cam_errbuf);
+		return (0);
+	}
+
+	/*
+	 * Attempt to get the passthrough device.  This ioctl will
+	 * fail if the device name is null, if the device doesn't
+	 * exist, or if the passthrough driver isn't in the kernel.
+	 */
+	if ((fd = open(XPT_DEVICE, O_RDWR)) == -1) {
+		warn("Unable to open %s", XPT_DEVICE);
+		return (0);
+	}
+	if (ioctl(fd, CAMGETPASSTHRU, &ccb) == -1) {
+		warn("Unable to find bus:target:lun for device %s%d",
+		    ccb.cgdl.periph_name, ccb.cgdl.unit_number);
+		close(fd);
+		return (0);
+	}
+	close(fd);
+	if ((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+		const struct cam_status_entry *entry;
+
+		entry = cam_fetch_status_entry(ccb.ccb_h.status);
+		warnx("Unable to find bus:target_lun for device %s%d, "
+		    "CAM status: %s (%#x)",
+		    ccb.cgdl.periph_name, ccb.cgdl.unit_number,
+		    entry ? entry->status_text : "Unknown",
+		    ccb.ccb_h.status);
+		return (0);
+	}
+
+	/*
+	 * The kernel fills in the bus/target/lun.  We don't
+	 * need the passthrough device name and unit number since
+	 * we aren't going to open it.
+	 */
+	*bus = ccb.ccb_h.path_id;
+	*target = ccb.ccb_h.target_id;
+	*lun = ccb.ccb_h.target_lun;
+	*arglst |= CAM_ARG_BUS | CAM_ARG_TARGET | CAM_ARG_LUN;
+	return (3);
+}
+
+/*
  * Parse out a bus, or a bus, target and lun in the following
  * format:
  * bus
@@ -3547,25 +3607,43 @@ static int
 parse_btl(char *tstr, path_id_t *bus, target_id_t *target, lun_id_t *lun,
     cam_argmask *arglst)
 {
-	char *tmpstr;
+	char *tmpstr, *end;
 	int convs = 0;
 
+	*bus = CAM_BUS_WILDCARD;
+	*target = CAM_TARGET_WILDCARD;
+	*lun = CAM_LUN_WILDCARD;
+
 	while (isspace(*tstr) && (*tstr != '\0'))
 		tstr++;
 
-	tmpstr = (char *)strtok(tstr, ":");
+	if (strncasecmp(tstr, "all", strlen("all")) == 0) {
+		arglist |= CAM_ARG_BUS;
+		return (1);
+	}
+
+	if (!isdigit(*tstr))
+		return (parse_btl_name(tstr, bus, target, lun, arglst));
+
+	tmpstr = strsep(&tstr, ":");
 	if ((tmpstr != NULL) && (*tmpstr != '\0')) {
-		*bus = strtol(tmpstr, NULL, 0);
+		*bus = strtol(tmpstr, &end, 0);
+		if (*end != '\0')
+			return (0);
 		*arglst |= CAM_ARG_BUS;
 		convs++;
-		tmpstr = (char *)strtok(NULL, ":");
+		tmpstr = strsep(&tstr, ":");
 		if ((tmpstr != NULL) && (*tmpstr != '\0')) {
-			*target = strtol(tmpstr, NULL, 0);
+			*target = strtol(tmpstr, &end, 0);
+			if (*end != '\0')
+				return (0);
 			*arglst |= CAM_ARG_TARGET;
 			convs++;
-			tmpstr = (char *)strtok(NULL, ":");
+			tmpstr = strsep(&tstr, ":");
 			if ((tmpstr != NULL) && (*tmpstr != '\0')) {
-				*lun = strtol(tmpstr, NULL, 0);
+				*lun = strtoll(tmpstr, &end, 0);
+				if (*end != '\0')
+					return (0);
 				*arglst |= CAM_ARG_LUN;
 				convs++;
 			}
@@ -3579,7 +3657,7 @@ static int
 dorescan_or_reset(int argc, char **argv, int rescan)
 {
 	static const char must[] =
-		"you must specify \"all\", a bus, or a bus:target:lun to %s";
+	    "you must specify \"all\", a bus, a bus:target:lun or periph to %s";
 	int rv, error = 0;
 	path_id_t bus = CAM_BUS_WILDCARD;
 	target_id_t target = CAM_TARGET_WILDCARD;
@@ -3596,118 +3674,19 @@ dorescan_or_reset(int argc, char **argv, int rescan)
 		tstr++;
 	if (strncasecmp(tstr, "all", strlen("all")) == 0)
 		arglist |= CAM_ARG_BUS;
-	else if (isdigit(*tstr)) {
+	else {
 		rv = parse_btl(argv[optind], &bus, &target, &lun, &arglist);
 		if (rv != 1 && rv != 3) {
-			warnx(must, rescan? "rescan" : "reset");
+			warnx(must, rescan ? "rescan" : "reset");
 			return (1);
 		}
-	} else {
-		char name[30];
-		int unit;
-		int fd = -1;
-		union ccb ccb;
-
-		/*
-		 * Note that resetting or rescanning a device used to
-		 * require a bus or bus:target:lun.  This is because the
-		 * device in question may not exist and you're trying to
-		 * get the controller to rescan to find it.  It may also be
-		 * because the device is hung / unresponsive, and opening
-		 * an unresponsive device is not desireable.
-		 *
-		 * It can be more convenient to reference a device by
-		 * peripheral name and unit number, though, and it is
-		 * possible to get the bus:target:lun for devices that
-		 * currently exist in the EDT.  So this can work for
-		 * devices that we want to reset, or devices that exist
-		 * that we want to rescan, but not devices that do not
-		 * exist yet.
-		 *
-		 * So, we are careful here to look up the bus/target/lun
-		 * for the device the user wants to operate on, specified
-		 * by peripheral instance (e.g. da0, pass32) without
-		 * actually opening that device.  The process is similar to
-		 * what cam_lookup_pass() does, except that we don't
-		 * actually open the passthrough driver instance in the end.
-		 */
-
-		if (cam_get_device(tstr, name, sizeof(name), &unit) == -1) {
-			warnx("%s", cam_errbuf);
-			error = 1;
-			goto bailout;
-		}
-
-		if ((fd = open(XPT_DEVICE, O_RDWR)) == -1) {
-			warn("Unable to open %s", XPT_DEVICE);
-			error = 1;
-			goto bailout;
-		}
-
-		bzero(&ccb, sizeof(ccb));
-
-		/*
-		 * The function code isn't strictly necessary for the
-		 * GETPASSTHRU ioctl.
-		 */
-		ccb.ccb_h.func_code = XPT_GDEVLIST;
-
-		/*
-		 * These two are necessary for the GETPASSTHRU ioctl to
-		 * work.
-		 */
-		strlcpy(ccb.cgdl.periph_name, name,
-			sizeof(ccb.cgdl.periph_name));
-		ccb.cgdl.unit_number = unit;
-
-		/*
-		 * Attempt to get the passthrough device.  This ioctl will
-		 * fail if the device name is null, if the device doesn't
-		 * exist, or if the passthrough driver isn't in the kernel.
-		 */
-		if (ioctl(fd, CAMGETPASSTHRU, &ccb) == -1) {
-			warn("Unable to find bus:target:lun for device %s%d",
-			    name, unit);
-			error = 1;
-			close(fd);
-			goto bailout;
-		}
-		if ((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
-			const struct cam_status_entry *entry;
-
-			entry = cam_fetch_status_entry(ccb.ccb_h.status);
-			warnx("Unable to find bus:target_lun for device %s%d, "
-			    "CAM status: %s (%#x)", name, unit,
-			    entry ? entry->status_text : "Unknown",
-			    ccb.ccb_h.status);
-			error = 1;
-			close(fd);
-			goto bailout;
-		}
-
-		/*
-		 * The kernel fills in the bus/target/lun.  We don't
-		 * need the passthrough device name and unit number since
-		 * we aren't going to open it.
-		 */
-		bus = ccb.ccb_h.path_id;
-		target = ccb.ccb_h.target_id;
-		lun = ccb.ccb_h.target_lun;
-
-		arglist |= CAM_ARG_BUS | CAM_ARG_TARGET | CAM_ARG_LUN;
-
-		close(fd);
 	}
 
-	if ((arglist & CAM_ARG_BUS)
-	    && (arglist & CAM_ARG_TARGET)
-	    && (arglist & CAM_ARG_LUN))
+	if (arglist & CAM_ARG_LUN)
 		error = scanlun_or_reset_dev(bus, target, lun, rescan);
 	else
 		error = rescan_or_reset_bus(bus, rescan);
 
-bailout:
-
 	return (error);
 }
 
@@ -5091,9 +5070,9 @@ camdebug(int argc, char **argv, char *combinedopt)
 	path_id_t bus = CAM_BUS_WILDCARD;
 	target_id_t target = CAM_TARGET_WILDCARD;
 	lun_id_t lun = CAM_LUN_WILDCARD;
-	char *tstr, *tmpstr = NULL;
+	char *tstr;
 	union ccb ccb;
-	int error = 0;
+	int error = 0, rv;
 
 	bzero(&ccb, sizeof(union ccb));
 
@@ -5132,23 +5111,16 @@ camdebug(int argc, char **argv, char *combinedopt)
 		}
 	}
 
-	if ((fd = open(XPT_DEVICE, O_RDWR)) < 0) {
-		warnx("error opening transport layer device %s", XPT_DEVICE);
-		warn("%s", XPT_DEVICE);
-		return (1);
-	}
 	argc -= optind;
 	argv += optind;
 
 	if (argc <= 0) {
 		warnx("you must specify \"off\", \"all\" or a bus,");
-		warnx("bus:target, or bus:target:lun");
-		close(fd);
+		warnx("bus:target, bus:target:lun or periph");
 		return (1);
 	}
 
 	tstr = *argv;
-
 	while (isspace(*tstr) && (*tstr != '\0'))
 		tstr++;
 
@@ -5157,66 +5129,54 @@ camdebug(int argc, char **argv, char *combinedopt)
 		arglist &= ~(CAM_ARG_DEBUG_INFO|CAM_ARG_DEBUG_PERIPH|
 			     CAM_ARG_DEBUG_TRACE|CAM_ARG_DEBUG_SUBTRACE|
 			     CAM_ARG_DEBUG_XPT|CAM_ARG_DEBUG_PROBE);
-	} else if (strncmp(tstr, "all", 3) != 0) {
-		tmpstr = (char *)strtok(tstr, ":");
-		if ((tmpstr != NULL) && (*tmpstr != '\0')){
-			bus = strtol(tmpstr, NULL, 0);
-			arglist |= CAM_ARG_BUS;
-			tmpstr = (char *)strtok(NULL, ":");
-			if ((tmpstr != NULL) && (*tmpstr != '\0')){
-				target = strtol(tmpstr, NULL, 0);
-				arglist |= CAM_ARG_TARGET;
-				tmpstr = (char *)strtok(NULL, ":");
-				if ((tmpstr != NULL) && (*tmpstr != '\0')){
-					lun = strtol(tmpstr, NULL, 0);
-					arglist |= CAM_ARG_LUN;
-				}
-			}
-		} else {
-			error = 1;
+	} else {
+		rv = parse_btl(tstr, &bus, &target, &lun, &arglist);
+		if (rv < 1) {
 			warnx("you must specify \"all\", \"off\", or a bus,");
-			warnx("bus:target, or bus:target:lun to debug");
+			warnx("bus:target, bus:target:lun or periph to debug");
+			return (1);
 		}
 	}
 
-	if (error == 0) {
+	if ((fd = open(XPT_DEVICE, O_RDWR)) < 0) {
+		warnx("error opening transport layer device %s", XPT_DEVICE);
+		warn("%s", XPT_DEVICE);
+		return (1);
+	}
 
-		ccb.ccb_h.func_code = XPT_DEBUG;
-		ccb.ccb_h.path_id = bus;
-		ccb.ccb_h.target_id = target;
-		ccb.ccb_h.target_lun = lun;
+	ccb.ccb_h.func_code = XPT_DEBUG;
+	ccb.ccb_h.path_id = bus;
+	ccb.ccb_h.target_id = target;
+	ccb.ccb_h.target_lun = lun;
 
-		if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) {
-			warn("CAMIOCOMMAND ioctl failed");
+	if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) {
+		warn("CAMIOCOMMAND ioctl failed");
+		error = 1;
+	} else {
+		if ((ccb.ccb_h.status & CAM_STATUS_MASK) ==
+		     CAM_FUNC_NOTAVAIL) {
+			warnx("CAM debugging not available");
+			warnx("you need to put options CAMDEBUG in"
+			      " your kernel config file!");
 			error = 1;
-		}
-
-		if (error == 0) {
-			if ((ccb.ccb_h.status & CAM_STATUS_MASK) ==
-			     CAM_FUNC_NOTAVAIL) {
-				warnx("CAM debugging not available");
-				warnx("you need to put options CAMDEBUG in"
-				      " your kernel config file!");
-				error = 1;
-			} else if ((ccb.ccb_h.status & CAM_STATUS_MASK) !=
-				    CAM_REQ_CMP) {
-				warnx("XPT_DEBUG CCB failed with status %#x",
-				      ccb.ccb_h.status);
-				error = 1;
+		} else if ((ccb.ccb_h.status & CAM_STATUS_MASK) !=
+			    CAM_REQ_CMP) {
+			warnx("XPT_DEBUG CCB failed with status %#x",
+			      ccb.ccb_h.status);
+			error = 1;
+		} else {
+			if (ccb.cdbg.flags == CAM_DEBUG_NONE) {
+				fprintf(stderr,
+					"Debugging turned off\n");
 			} else {
-				if (ccb.cdbg.flags == CAM_DEBUG_NONE) {
-					fprintf(stderr,
-						"Debugging turned off\n");
-				} else {
-					fprintf(stderr,
-						"Debugging enabled for "
-						"%d:%d:%jx\n",
-						bus, target, (uintmax_t)lun);
-				}
+				fprintf(stderr,
+					"Debugging enabled for "
+					"%d:%d:%jx\n",
+					bus, target, (uintmax_t)lun);
 			}
 		}
-		close(fd);
 	}
+	close(fd);
 
 	return (error);
 }
@@ -9887,7 +9847,7 @@ usage(int printlong)
 "        camcontrol smpphylist [dev_id][generic args][-l][-q]\n"
 "        camcontrol smpmaninfo [dev_id][generic args][-l]\n"
 "        camcontrol debug      [-I][-P][-T][-S][-X][-c]\n"
-"                              <all|bus[:target[:lun]]|off>\n"
+"                              <all|dev_id|bus[:target[:lun]]|off>\n"
 "        camcontrol tags       [dev_id][generic args] [-N tags] [-q] [-v]\n"
 "        camcontrol negotiate  [dev_id][generic args] [-a][-c]\n"
 "                              [-D <enable|disable>][-M mode][-O offset]\n"

From owner-svn-src-head@freebsd.org  Mon Jul 22 17:25:36 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88041B6E1C;
 Mon, 22 Jul 2019 17:25:36 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 6B4028120D;
 Mon, 22 Jul 2019 17:25:36 +0000 (UTC)
 (envelope-from emaste@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 4616418930;
 Mon, 22 Jul 2019 17:25:36 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6MHPa2T019622;
 Mon, 22 Jul 2019 17:25:36 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6MHPapH019621;
 Mon, 22 Jul 2019 17:25:36 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201907221725.x6MHPapH019621@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Mon, 22 Jul 2019 17:25:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350215 - head/usr.sbin/mptutil
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: head/usr.sbin/mptutil
X-SVN-Commit-Revision: 350215
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 6B4028120D
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.925,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 17:25:36 -0000

Author: emaste
Date: Mon Jul 22 17:25:35 2019
New Revision: 350215
URL: https://svnweb.freebsd.org/changeset/base/350215

Log:
  mptutil: emit a warning on big-endian architectures
  
  It is known to be broken.
  
  PR:		162513
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.sbin/mptutil/mptutil.c

Modified: head/usr.sbin/mptutil/mptutil.c
==============================================================================
--- head/usr.sbin/mptutil/mptutil.c	Mon Jul 22 17:08:18 2019	(r350214)
+++ head/usr.sbin/mptutil/mptutil.c	Mon Jul 22 17:25:35 2019	(r350215)
@@ -114,6 +114,10 @@ main(int ac, char **av)
 	if (ac == 0)
 		usage();
 
+#if BYTE_ORDER == BIG_ENDIAN
+	warnx("mptutil is known to be broken on big-endian architectures");
+#endif
+
 	SET_FOREACH(cmd, MPT_DATASET(top)) {
 		if (strcmp((*cmd)->name, av[0]) == 0) {
 			if ((*cmd)->handler(ac, av))

From owner-svn-src-head@freebsd.org  Mon Jul 22 18:11:36 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8DE0DB7D57;
 Mon, 22 Jul 2019 18:11:36 +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 6FDEE831A3;
 Mon, 22 Jul 2019 18:11:36 +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 4B7FF1908F;
 Mon, 22 Jul 2019 18:11:36 +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 x6MIBaHv046413;
 Mon, 22 Jul 2019 18:11:36 GMT (envelope-from tuexen@FreeBSD.org)
Received: (from tuexen@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6MIBaXe046412;
 Mon, 22 Jul 2019 18:11:36 GMT (envelope-from tuexen@FreeBSD.org)
Message-Id: <201907221811.x6MIBaXe046412@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: tuexen set sender to
 tuexen@FreeBSD.org using -f
From: Michael Tuexen <tuexen@FreeBSD.org>
Date: Mon, 22 Jul 2019 18:11:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350216 - head/sys/netinet
X-SVN-Group: head
X-SVN-Commit-Author: tuexen
X-SVN-Commit-Paths: head/sys/netinet
X-SVN-Commit-Revision: 350216
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 6FDEE831A3
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_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.95)[-0.946,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 18:11:36 -0000

Author: tuexen
Date: Mon Jul 22 18:11:35 2019
New Revision: 350216
URL: https://svnweb.freebsd.org/changeset/base/350216

Log:
  Wakeup the application when doing PD-API for unordered DATA chunks.
  Work done with rrs@.
  
  MFC after:		1 week

Modified:
  head/sys/netinet/sctp_indata.c

Modified: head/sys/netinet/sctp_indata.c
==============================================================================
--- head/sys/netinet/sctp_indata.c	Mon Jul 22 17:25:35 2019	(r350215)
+++ head/sys/netinet/sctp_indata.c	Mon Jul 22 18:11:35 2019	(r350216)
@@ -915,6 +915,9 @@ restart:
 			break;
 		}
 	}
+	if (cnt_added && strm->pd_api_started) {
+		sctp_wakeup_the_read_socket(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED);
+	}
 	if ((control->length > pd_point) && (strm->pd_api_started == 0)) {
 		strm->pd_api_started = 1;
 		control->pdapi_started = 1;

From owner-svn-src-head@freebsd.org  Mon Jul 22 18:27:18 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 392C0B8686;
 Mon, 22 Jul 2019 18:27:18 +0000 (UTC)
 (envelope-from brooks@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 1AAFA83EE9;
 Mon, 22 Jul 2019 18:27:18 +0000 (UTC)
 (envelope-from brooks@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E8AAB193E6;
 Mon, 22 Jul 2019 18:27:17 +0000 (UTC)
 (envelope-from brooks@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6MIRH2D055740;
 Mon, 22 Jul 2019 18:27:17 GMT (envelope-from brooks@FreeBSD.org)
Received: (from brooks@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6MIRH79055739;
 Mon, 22 Jul 2019 18:27:17 GMT (envelope-from brooks@FreeBSD.org)
Message-Id: <201907221827.x6MIRH79055739@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: brooks set sender to
 brooks@FreeBSD.org using -f
From: Brooks Davis <brooks@FreeBSD.org>
Date: Mon, 22 Jul 2019 18:27:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350218 - head/lib/libproc
X-SVN-Group: head
X-SVN-Commit-Author: brooks
X-SVN-Commit-Paths: head/lib/libproc
X-SVN-Commit-Revision: 350218
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 1AAFA83EE9
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 18:27:18 -0000

Author: brooks
Date: Mon Jul 22 18:27:17 2019
New Revision: 350218
URL: https://svnweb.freebsd.org/changeset/base/350218

Log:
  Be consistent about temporary variable use in adjacent loops.
  
  Obtained from:	CheriBSD
  MFC after:	1 week
  Sponsored by:	DARPA, AFRL

Modified:
  head/lib/libproc/proc_sym.c

Modified: head/lib/libproc/proc_sym.c
==============================================================================
--- head/lib/libproc/proc_sym.c	Mon Jul 22 18:14:34 2019	(r350217)
+++ head/lib/libproc/proc_sym.c	Mon Jul 22 18:27:17 2019	(r350218)
@@ -559,10 +559,11 @@ _proc_name2map(struct proc_handle *p, const char *name
 	}
 	/* If we didn't find a match, try matching prefixes of the basename. */
 	for (i = 0; i < p->nmappings; i++) {
-		strlcpy(path, p->mappings[i].map.pr_mapname, sizeof(path));
+		mapping = &p->mappings[i];
+		strlcpy(path, mapping->map.pr_mapname, sizeof(path));
 		base = basename(path);
 		if (strncmp(base, name, len) == 0)
-			return (&p->mappings[i]);
+			return (mapping);
 	}
 	if (strcmp(name, "a.out") == 0)
 		return (_proc_addr2map(p,

From owner-svn-src-head@freebsd.org  Mon Jul 22 18:42:56 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 24846B8BB3;
 Mon, 22 Jul 2019 18:42:56 +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 050608490A;
 Mon, 22 Jul 2019 18:42:56 +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 D189F1976F;
 Mon, 22 Jul 2019 18:42:55 +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 x6MIgtni067645;
 Mon, 22 Jul 2019 18:42:55 GMT (envelope-from lwhsu@FreeBSD.org)
Received: (from lwhsu@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6MIgtLx067644;
 Mon, 22 Jul 2019 18:42:55 GMT (envelope-from lwhsu@FreeBSD.org)
Message-Id: <201907221842.x6MIgtLx067644@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to
 lwhsu@FreeBSD.org using -f
From: Li-Wen Hsu <lwhsu@FreeBSD.org>
Date: Mon, 22 Jul 2019 18:42:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350219 - head/contrib/netbsd-tests/lib/libc/regex
X-SVN-Group: head
X-SVN-Commit-Author: lwhsu
X-SVN-Commit-Paths: head/contrib/netbsd-tests/lib/libc/regex
X-SVN-Commit-Revision: 350219
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 050608490A
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.974,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 18:42:56 -0000

Author: lwhsu
Date: Mon Jul 22 18:42:55 2019
New Revision: 350219
URL: https://svnweb.freebsd.org/changeset/base/350219

Log:
  Temporarily skip lib.libc.regex.exhaust_test.regcomp_too_big and
  lib.libregex.exhaust_test.regcomp_too_big on i386 as they are flakey on it
  
  PR:		237450
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/contrib/netbsd-tests/lib/libc/regex/t_exhaust.c

Modified: head/contrib/netbsd-tests/lib/libc/regex/t_exhaust.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/regex/t_exhaust.c	Mon Jul 22 18:27:17 2019	(r350218)
+++ head/contrib/netbsd-tests/lib/libc/regex/t_exhaust.c	Mon Jul 22 18:42:55 2019	(r350219)
@@ -186,6 +186,10 @@ ATF_TC_BODY(regcomp_too_big, tc)
 	int e;
 	struct rlimit limit;
 
+#if defined(__i386__)
+	atf_tc_skip("https://bugs.freebsd.org/237450");
+#endif
+
 	limit.rlim_cur = limit.rlim_max = 256 * 1024 * 1024;
 	ATF_REQUIRE(setrlimit(RLIMIT_VMEM, &limit) != -1);
 

From owner-svn-src-head@freebsd.org  Mon Jul 22 18:43:47 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id CFB9FB8C34;
 Mon, 22 Jul 2019 18:43:47 +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 A667A84A67;
 Mon, 22 Jul 2019 18:43:47 +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 4CF7D19774;
 Mon, 22 Jul 2019 18:43:47 +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 x6MIhlwD067746;
 Mon, 22 Jul 2019 18:43:47 GMT (envelope-from lwhsu@FreeBSD.org)
Received: (from lwhsu@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6MIhlXM067745;
 Mon, 22 Jul 2019 18:43:47 GMT (envelope-from lwhsu@FreeBSD.org)
Message-Id: <201907221843.x6MIhlXM067745@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to
 lwhsu@FreeBSD.org using -f
From: Li-Wen Hsu <lwhsu@FreeBSD.org>
Date: Mon, 22 Jul 2019 18:43:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350220 - head/tests/sys/kern
X-SVN-Group: head
X-SVN-Commit-Author: lwhsu
X-SVN-Commit-Paths: head/tests/sys/kern
X-SVN-Commit-Revision: 350220
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: A667A84A67
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.974,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 18:43:47 -0000

Author: lwhsu
Date: Mon Jul 22 18:43:46 2019
New Revision: 350220
URL: https://svnweb.freebsd.org/changeset/base/350220

Log:
  Fix URL.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/tests/sys/kern/ptrace_test.c

Modified: head/tests/sys/kern/ptrace_test.c
==============================================================================
--- head/tests/sys/kern/ptrace_test.c	Mon Jul 22 18:42:55 2019	(r350219)
+++ head/tests/sys/kern/ptrace_test.c	Mon Jul 22 18:43:46 2019	(r350220)
@@ -867,7 +867,7 @@ ATF_TC_BODY(ptrace__follow_fork_child_detached_unrelat
 	pid_t children[2], fpid, wpid;
 	int cpipe[2], status;
 
-	atf_tc_skip("https://bugs.freebsd.org/bug239292");
+	atf_tc_skip("https://bugs.freebsd.org/239292");
 
 	ATF_REQUIRE(pipe(cpipe) == 0);
 	ATF_REQUIRE((fpid = fork()) != -1);

From owner-svn-src-head@freebsd.org  Mon Jul 22 18:54:27 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 278DCB8E48;
 Mon, 22 Jul 2019 18:54:27 +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 018E484FFC;
 Mon, 22 Jul 2019 18:54:27 +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 CC57B19928;
 Mon, 22 Jul 2019 18:54:26 +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 x6MIsQGK073463;
 Mon, 22 Jul 2019 18:54:26 GMT (envelope-from lwhsu@FreeBSD.org)
Received: (from lwhsu@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6MIsQHB073461;
 Mon, 22 Jul 2019 18:54:26 GMT (envelope-from lwhsu@FreeBSD.org)
Message-Id: <201907221854.x6MIsQHB073461@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to
 lwhsu@FreeBSD.org using -f
From: Li-Wen Hsu <lwhsu@FreeBSD.org>
Date: Mon, 22 Jul 2019 18:54:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350221 - head/tests/sys/netpfil/pf
X-SVN-Group: head
X-SVN-Commit-Author: lwhsu
X-SVN-Commit-Paths: head/tests/sys/netpfil/pf
X-SVN-Commit-Revision: 350221
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 018E484FFC
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 18:54:27 -0000

Author: lwhsu
Date: Mon Jul 22 18:54:26 2019
New Revision: 350221
URL: https://svnweb.freebsd.org/changeset/base/350221

Log:
  Temporarily skip sys.netpfil.pf.forward.{v4,v6} and sys.netpfil.pf.set_tos.v4
  on i386 as they are flakey on it
  
  PR:		239380
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/tests/sys/netpfil/pf/forward.sh
  head/tests/sys/netpfil/pf/set_tos.sh

Modified: head/tests/sys/netpfil/pf/forward.sh
==============================================================================
--- head/tests/sys/netpfil/pf/forward.sh	Mon Jul 22 18:43:46 2019	(r350220)
+++ head/tests/sys/netpfil/pf/forward.sh	Mon Jul 22 18:54:26 2019	(r350221)
@@ -14,6 +14,10 @@ v4_head()
 
 v4_body()
 {
+	if [ `uname -p` = "i386" ]; then
+		atf_skip "https://bugs.freebsd.org/239380"
+	fi
+
 	pft_init
 
 	epair_send=$(vnet_mkepair)
@@ -73,6 +77,10 @@ v6_head()
 
 v6_body()
 {
+	if [ `uname -p` = "i386" ]; then
+		atf_skip "https://bugs.freebsd.org/239380"
+	fi
+
 	pft_init
 
 	epair_send=$(vnet_mkepair)

Modified: head/tests/sys/netpfil/pf/set_tos.sh
==============================================================================
--- head/tests/sys/netpfil/pf/set_tos.sh	Mon Jul 22 18:43:46 2019	(r350220)
+++ head/tests/sys/netpfil/pf/set_tos.sh	Mon Jul 22 18:54:26 2019	(r350221)
@@ -14,6 +14,10 @@ v4_head()
 
 v4_body()
 {
+	if [ `uname -p` = "i386" ]; then
+		atf_skip "https://bugs.freebsd.org/239380"
+	fi
+
 	pft_init
 
 	epair_send=$(vnet_mkepair)

From owner-svn-src-head@freebsd.org  Mon Jul 22 20:04:56 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82A7BBAB1A;
 Mon, 22 Jul 2019 20:04:56 +0000 (UTC)
 (envelope-from sobomax@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 64D8088B61;
 Mon, 22 Jul 2019 20:04:56 +0000 (UTC)
 (envelope-from sobomax@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 3BB561A691;
 Mon, 22 Jul 2019 20:04:56 +0000 (UTC)
 (envelope-from sobomax@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6MK4uek016966;
 Mon, 22 Jul 2019 20:04:56 GMT (envelope-from sobomax@FreeBSD.org)
Received: (from sobomax@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6MK4tUH016964;
 Mon, 22 Jul 2019 20:04:55 GMT (envelope-from sobomax@FreeBSD.org)
Message-Id: <201907222004.x6MK4tUH016964@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: sobomax set sender to
 sobomax@FreeBSD.org using -f
From: Maxim Sobolev <sobomax@FreeBSD.org>
Date: Mon, 22 Jul 2019 20:04:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350224 - in head: sbin/mount share/man/man5
X-SVN-Group: head
X-SVN-Commit-Author: sobomax
X-SVN-Commit-Paths: in head: sbin/mount share/man/man5
X-SVN-Commit-Revision: 350224
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 64D8088B61
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 20:04:56 -0000

Author: sobomax
Date: Mon Jul 22 20:04:55 2019
New Revision: 350224
URL: https://svnweb.freebsd.org/changeset/base/350224

Log:
  Allow "update" option to be used in the fstab(5). Document possible use case.
  
  Approved by:	mckusick
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D18586

Modified:
  head/sbin/mount/mount.c
  head/share/man/man5/fstab.5

Modified: head/sbin/mount/mount.c
==============================================================================
--- head/sbin/mount/mount.c	Mon Jul 22 19:27:23 2019	(r350223)
+++ head/sbin/mount/mount.c	Mon Jul 22 20:04:55 2019	(r350224)
@@ -361,6 +361,7 @@ main(int argc, char *argv[])
 				else
 					failok = 0;
 				if (!(init_flags & MNT_UPDATE) &&
+				    !hasopt(fs->fs_mntops, "update") &&
 				    ismounted(fs, mntbuf, mntsize))
 					continue;
 				options = update_options(options, fs->fs_mntops,

Modified: head/share/man/man5/fstab.5
==============================================================================
--- head/share/man/man5/fstab.5	Mon Jul 22 19:27:23 2019	(r350223)
+++ head/share/man/man5/fstab.5	Mon Jul 22 20:04:55 2019	(r350224)
@@ -190,6 +190,32 @@ see the
 .Xr mount 8
 manual page.
 .Pp
+If the option
+.Dq update
+is specified, it indicates that the status of an already mounted file
+system should be changed accordingly.
+This allows, for example, file systems mounted read-only to be upgraded
+read-write and vice-versa.
+By default, an entry corresponding to a file systems that is already
+mounted is going to be skipped over when processing
+.Nm ,
+unless it's a root file system, in which case logic similar to
+.Dq update
+is applied automatically.
+.Pp
+The
+.Dq update
+option is typically used in conjuction with two
+.Nm
+files.
+The first
+.Nm
+file is used to set up the initial set of file systems.
+The second
+.Nm
+file is then run to update the initial set of file systems and
+to add additional file systems.
+.Pp
 The type of the mount is extracted from the
 .Fa fs_mntops
 field and stored separately in the

From owner-svn-src-head@freebsd.org  Mon Jul 22 20:11:35 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9796BAD16;
 Mon, 22 Jul 2019 20:11:35 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 9BA4789159;
 Mon, 22 Jul 2019 20:11:35 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3778A1A816;
 Mon, 22 Jul 2019 20:11:35 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6MKBZS0019558;
 Mon, 22 Jul 2019 20:11:35 GMT (envelope-from asomers@FreeBSD.org)
Received: (from asomers@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6MKBYqW019551;
 Mon, 22 Jul 2019 20:11:34 GMT (envelope-from asomers@FreeBSD.org)
Message-Id: <201907222011.x6MKBYqW019551@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: asomers set sender to
 asomers@FreeBSD.org using -f
From: Alan Somers <asomers@FreeBSD.org>
Date: Mon, 22 Jul 2019 20:11:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350225 - in head: sbin/ping6 usr.sbin/mld6query
 usr.sbin/traceroute6
X-SVN-Group: head
X-SVN-Commit-Author: asomers
X-SVN-Commit-Paths: in head: sbin/ping6 usr.sbin/mld6query usr.sbin/traceroute6
X-SVN-Commit-Revision: 350225
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 9BA4789159
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];
 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 20:11:35 -0000

Author: asomers
Date: Mon Jul 22 20:11:33 2019
New Revision: 350225
URL: https://svnweb.freebsd.org/changeset/base/350225

Log:
  Remove the USE_RFC2292BIS option and reap dead code
  
  This option was imported as part of the KAME project in r62627 (in 2000).
  It was turned on unconditionally in r121472 (in 2003) and has been on ever
  since. The old alternative code has bitrotted. Reap the dead code.
  
  Reported by:	Ján Sučan <jansucan@gmail.com>
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D20938

Modified:
  head/sbin/ping6/Makefile
  head/sbin/ping6/ping6.c
  head/usr.sbin/mld6query/Makefile
  head/usr.sbin/mld6query/mld6.c
  head/usr.sbin/traceroute6/Makefile
  head/usr.sbin/traceroute6/traceroute6.c

Modified: head/sbin/ping6/Makefile
==============================================================================
--- head/sbin/ping6/Makefile	Mon Jul 22 20:04:55 2019	(r350224)
+++ head/sbin/ping6/Makefile	Mon Jul 22 20:11:33 2019	(r350225)
@@ -4,7 +4,7 @@ PACKAGE=runtime
 PROG=	ping6
 MAN=	ping6.8
 
-CFLAGS+=-DIPSEC -DKAME_SCOPEID -DUSE_RFC2292BIS
+CFLAGS+=-DIPSEC -DKAME_SCOPEID
 WARNS?=	3
 
 BINOWN=	root

Modified: head/sbin/ping6/ping6.c
==============================================================================
--- head/sbin/ping6/ping6.c	Mon Jul 22 20:04:55 2019	(r350224)
+++ head/sbin/ping6/ping6.c	Mon Jul 22 20:11:33 2019	(r350225)
@@ -307,9 +307,7 @@ main(int argc, char *argv[])
 #endif
 	int usepktinfo = 0;
 	struct in6_pktinfo *pktinfo = NULL;
-#ifdef USE_RFC2292BIS
 	struct ip6_rthdr *rthdr = NULL;
-#endif
 #ifdef IPSEC_POLICY_IPSEC
 	char *policy_in = NULL;
 	char *policy_out = NULL;
@@ -902,11 +900,8 @@ main(int argc, char *argv[])
 
 	if (argc > 1) {	/* some intermediate addrs are specified */
 		int hops;
-#ifdef USE_RFC2292BIS
 		int rthdrlen;
-#endif
 
-#ifdef USE_RFC2292BIS
 		rthdrlen = inet6_rth_space(IPV6_RTHDR_TYPE_0, argc - 1);
 		scmsgp->cmsg_len = CMSG_LEN(rthdrlen);
 		scmsgp->cmsg_level = IPPROTO_IPV6;
@@ -916,11 +911,6 @@ main(int argc, char *argv[])
 		    IPV6_RTHDR_TYPE_0, argc - 1);
 		if (rthdr == NULL)
 			errx(1, "can't initialize rthdr");
-#else  /* old advanced API */
-		if ((scmsgp = (struct cmsghdr *)inet6_rthdr_init(scmsgp,
-		    IPV6_RTHDR_TYPE_0)) == NULL)
-			errx(1, "can't initialize rthdr");
-#endif /* USE_RFC2292BIS */
 
 		for (hops = 0; hops < argc - 1; hops++) {
 			memset(&hints, 0, sizeof(hints));
@@ -933,22 +923,11 @@ main(int argc, char *argv[])
 				errx(1,
 				    "bad addr family of an intermediate addr");
 			sin6 = (struct sockaddr_in6 *)(void *)res->ai_addr;
-#ifdef USE_RFC2292BIS
 			if (inet6_rth_add(rthdr, &sin6->sin6_addr))
 				errx(1, "can't add an intermediate node");
-#else  /* old advanced API */
-			if (inet6_rthdr_add(scmsg, &sin6->sin6_addr,
-			    IPV6_RTHDR_LOOSE))
-				errx(1, "can't add an intermediate node");
-#endif /* USE_RFC2292BIS */
 			freeaddrinfo(res);
 		}
 
-#ifndef USE_RFC2292BIS
-		if (inet6_rthdr_lasthop(scmsgp, IPV6_RTHDR_LOOSE))
-			errx(1, "can't set the last flag");
-#endif
-
 		scmsgp = CMSG_NXTHDR(&smsghdr, scmsgp);
 	}
 
@@ -968,7 +947,6 @@ main(int argc, char *argv[])
 		src.sin6_port = ntohs(DUMMY_PORT);
 		src.sin6_scope_id = dst.sin6_scope_id;
 
-#ifdef USE_RFC2292BIS
 		if (pktinfo &&
 		    setsockopt(dummy, IPPROTO_IPV6, IPV6_PKTINFO,
 		    (void *)pktinfo, sizeof(*pktinfo)))
@@ -988,12 +966,6 @@ main(int argc, char *argv[])
 		    setsockopt(dummy, IPPROTO_IPV6, IPV6_RTHDR,
 		    (void *)rthdr, (rthdr->ip6r_len + 1) << 3))
 			err(1, "UDP setsockopt(IPV6_RTHDR)");
-#else  /* old advanced API */
-		if (smsghdr.msg_control &&
-		    setsockopt(dummy, IPPROTO_IPV6, IPV6_PKTOPTIONS,
-		    (void *)smsghdr.msg_control, smsghdr.msg_controllen))
-			err(1, "UDP setsockopt(IPV6_PKTOPTIONS)");
-#endif
 
 		if (connect(dummy, (struct sockaddr *)&src, len) < 0)
 			err(1, "UDP connect");
@@ -1785,7 +1757,6 @@ pr_exthdrs(struct msghdr *mhdr)
 	}
 }
 
-#ifdef USE_RFC2292BIS
 static void
 pr_ip6opt(void *extbuf, size_t bufsize)
 {
@@ -1847,17 +1818,7 @@ pr_ip6opt(void *extbuf, size_t bufsize)
 	}
 	return;
 }
-#else  /* !USE_RFC2292BIS */
-/* ARGSUSED */
-static void
-pr_ip6opt(void *extbuf, size_t bufsize __unused)
-{
-	putchar('\n');
-	return;
-}
-#endif /* USE_RFC2292BIS */
 
-#ifdef USE_RFC2292BIS
 static void
 pr_rthdr(void *extbuf, size_t bufsize)
 {
@@ -1912,16 +1873,6 @@ pr_rthdr(void *extbuf, size_t bufsize)
 	return;
 
 }
-
-#else  /* !USE_RFC2292BIS */
-/* ARGSUSED */
-static void
-pr_rthdr(void *extbuf, size_t bufsize __unused)
-{
-	putchar('\n');
-	return;
-}
-#endif /* USE_RFC2292BIS */
 
 static int
 pr_bitrange(u_int32_t v, int soff, int ii)

Modified: head/usr.sbin/mld6query/Makefile
==============================================================================
--- head/usr.sbin/mld6query/Makefile	Mon Jul 22 20:04:55 2019	(r350224)
+++ head/usr.sbin/mld6query/Makefile	Mon Jul 22 20:11:33 2019	(r350225)
@@ -18,7 +18,7 @@ PROG=	mld6query
 MAN=	mld6query.8
 SRCS=	mld6.c
 
-CFLAGS+= -DIPSEC -DUSE_RFC2292BIS
+CFLAGS+= -DIPSEC
 
 WARNS?=	2
 

Modified: head/usr.sbin/mld6query/mld6.c
==============================================================================
--- head/usr.sbin/mld6query/mld6.c	Mon Jul 22 20:04:55 2019	(r350224)
+++ head/usr.sbin/mld6query/mld6.c	Mon Jul 22 20:11:33 2019	(r350225)
@@ -203,12 +203,8 @@ make_msg(int index, struct in6_addr *addr, u_int type,
 	static struct iovec iov[2];
 	static u_char *cmsgbuf;
 	int cmsglen, hbhlen = 0;
-#ifdef USE_RFC2292BIS
 	void *hbhbuf = NULL, *optp = NULL;
 	int currentlen;
-#else
-	u_int8_t raopt[IP6OPT_RTALERT_LEN];
-#endif 
 	struct in6_pktinfo *pi;
 	struct cmsghdr *cmsgp;
 	u_short rtalert_code = htons(IP6OPT_RTALERT_MLD);
@@ -253,7 +249,6 @@ make_msg(int index, struct in6_addr *addr, u_int type,
 	src.s6_addr[2] = src.s6_addr[3] = 0;
 #endif
 
-#ifdef USE_RFC2292BIS
 	if ((hbhlen = inet6_opt_init(NULL, 0)) == -1)
 		errx(1, "inet6_opt_init(0) failed");
 	if ((hbhlen = inet6_opt_append(NULL, 0, hbhlen, IP6OPT_ROUTER_ALERT, 2,
@@ -262,11 +257,6 @@ make_msg(int index, struct in6_addr *addr, u_int type,
 	if ((hbhlen = inet6_opt_finish(NULL, 0, hbhlen)) == -1)
 		errx(1, "inet6_opt_finish(0) failed");
 	cmsglen = CMSG_SPACE(sizeof(struct in6_pktinfo)) + CMSG_SPACE(hbhlen);
-#else
-	hbhlen = sizeof(raopt); 
-	cmsglen = CMSG_SPACE(sizeof(struct in6_pktinfo)) +
-	    inet6_option_space(hbhlen);
-#endif 
 
 	if ((cmsgbuf = malloc(cmsglen)) == NULL)
 		errx(1, "can't allocate enough memory for cmsg");
@@ -282,7 +272,6 @@ make_msg(int index, struct in6_addr *addr, u_int type,
 	memcpy(&pi->ipi6_addr, &src, sizeof(pi->ipi6_addr));
 	/* specifiy to insert router alert option in a hop-by-hop opt hdr. */
 	cmsgp = CMSG_NXTHDR(&m, cmsgp);
-#ifdef USE_RFC2292BIS
 	cmsgp->cmsg_len = CMSG_LEN(hbhlen);
 	cmsgp->cmsg_level = IPPROTO_IPV6;
 	cmsgp->cmsg_type = IPV6_HOPOPTS;
@@ -297,15 +286,6 @@ make_msg(int index, struct in6_addr *addr, u_int type,
 	(void)inet6_opt_set_val(optp, 0, &rtalert_code, sizeof(rtalert_code));
 	if ((currentlen = inet6_opt_finish(hbhbuf, hbhlen, currentlen)) == -1)
 		errx(1, "inet6_opt_finish(buf) failed");
-#else  /* old advanced API */
-	if (inet6_option_init((void *)cmsgp, &cmsgp, IPV6_HOPOPTS))
-		errx(1, "inet6_option_init failed\n");
-	raopt[0] = IP6OPT_ROUTER_ALERT;
-	raopt[1] = IP6OPT_RTALERT_LEN - 2;
-	memcpy(&raopt[2], (caddr_t)&rtalert_code, sizeof(u_short));
-	if (inet6_option_append(cmsgp, raopt, 4, 0))
-		errx(1, "inet6_option_append failed\n");
-#endif 
 }
 
 void

Modified: head/usr.sbin/traceroute6/Makefile
==============================================================================
--- head/usr.sbin/traceroute6/Makefile	Mon Jul 22 20:04:55 2019	(r350224)
+++ head/usr.sbin/traceroute6/Makefile	Mon Jul 22 20:11:33 2019	(r350225)
@@ -22,7 +22,7 @@ SRCS=	as.c traceroute6.c
 BINOWN=	root
 BINMODE= 4555
 
-CFLAGS+= -DIPSEC -DUSE_RFC2292BIS -DHAVE_POLL
+CFLAGS+= -DIPSEC -DHAVE_POLL
 CFLAGS+= -I${.CURDIR} -I${TRACEROUTE_DISTDIR} -I.
 
 WARNS?=	3

Modified: head/usr.sbin/traceroute6/traceroute6.c
==============================================================================
--- head/usr.sbin/traceroute6/traceroute6.c	Mon Jul 22 20:04:55 2019	(r350224)
+++ head/usr.sbin/traceroute6/traceroute6.c	Mon Jul 22 20:11:33 2019	(r350225)
@@ -331,9 +331,7 @@ u_long datalen = 20;			/* How much data */
 #define	ICMP6ECHOLEN	8
 /* XXX: 2064 = 127(max hops in type 0 rthdr) * sizeof(ip6_hdr) + 16(margin) */
 char rtbuf[2064];
-#ifdef USE_RFC2292BIS
 struct ip6_rthdr *rth;
-#endif
 struct cmsghdr *cmsg;
 
 char *source = NULL;
@@ -435,7 +433,6 @@ main(int argc, char *argv[])
 				    "traceroute6: unknown host %s\n", optarg);
 				exit(1);
 			}
-#ifdef USE_RFC2292BIS
 			if (rth == NULL) {
 				/*
 				 * XXX: We can't detect the number of
@@ -456,12 +453,6 @@ main(int argc, char *argv[])
 				    optarg);
 				exit(1);
 			}
-#else  /* old advanced API */
-			if (cmsg == NULL)
-				cmsg = inet6_rthdr_init(rtbuf, IPV6_RTHDR_TYPE_0);
-			inet6_rthdr_add(cmsg, (struct in6_addr *)hp->h_addr,
-			    IPV6_RTHDR_LOOSE);
-#endif
 			freehostent(hp);
 			break;
 		case 'I':
@@ -763,7 +754,6 @@ main(int argc, char *argv[])
 	if (options & SO_DONTROUTE)
 		(void) setsockopt(sndsock, SOL_SOCKET, SO_DONTROUTE,
 		    (char *)&on, sizeof(on));
-#ifdef USE_RFC2292BIS
 	if (rth) {/* XXX: there is no library to finalize the header... */
 		rth->ip6r_len = rth->ip6r_segleft * 2;
 		if (setsockopt(sndsock, IPPROTO_IPV6, IPV6_RTHDR,
@@ -773,17 +763,6 @@ main(int argc, char *argv[])
 			exit(1);
 		}
 	}
-#else  /* old advanced API */
-	if (cmsg != NULL) {
-		inet6_rthdr_lasthop(cmsg, IPV6_RTHDR_LOOSE);
-		if (setsockopt(sndsock, IPPROTO_IPV6, IPV6_PKTOPTIONS,
-		    rtbuf, cmsg->cmsg_len) < 0) {
-			fprintf(stderr, "setsockopt(IPV6_PKTOPTIONS): %s\n",
-			    strerror(errno));
-			exit(1);
-		}
-	}
-#endif /* USE_RFC2292BIS */
 #ifdef IPSEC
 #ifdef IPSEC_POLICY_IPSEC
 	/*

From owner-svn-src-head@freebsd.org  Mon Jul 22 21:03:53 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59AB4BBE69;
 Mon, 22 Jul 2019 21:03:53 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 3A2518B292;
 Mon, 22 Jul 2019 21:03:53 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 150171B1C6;
 Mon, 22 Jul 2019 21:03:53 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6ML3qPZ052522;
 Mon, 22 Jul 2019 21:03:52 GMT (envelope-from asomers@FreeBSD.org)
Received: (from asomers@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6ML3qbL052521;
 Mon, 22 Jul 2019 21:03:52 GMT (envelope-from asomers@FreeBSD.org)
Message-Id: <201907222103.x6ML3qbL052521@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: asomers set sender to
 asomers@FreeBSD.org using -f
From: Alan Somers <asomers@FreeBSD.org>
Date: Mon, 22 Jul 2019 21:03:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350227 - head/sys/kern
X-SVN-Group: head
X-SVN-Commit-Author: asomers
X-SVN-Commit-Paths: head/sys/kern
X-SVN-Commit-Revision: 350227
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 3A2518B292
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.961,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 21:03:53 -0000

Author: asomers
Date: Mon Jul 22 21:03:52 2019
New Revision: 350227
URL: https://svnweb.freebsd.org/changeset/base/350227

Log:
  [skip ci] Fix the comment for cache_purge(9)
  
  This is a merge of r348738 from projects/fuse2
  
  Reviewed by:	kib
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==============================================================================
--- head/sys/kern/vfs_cache.c	Mon Jul 22 20:33:19 2019	(r350226)
+++ head/sys/kern/vfs_cache.c	Mon Jul 22 21:03:52 2019	(r350227)
@@ -1964,7 +1964,7 @@ cache_changesize(int newmaxvnodes)
 }
 
 /*
- * Invalidate all entries to a particular vnode.
+ * Invalidate all entries from and to a particular vnode.
  */
 void
 cache_purge(struct vnode *vp)

From owner-svn-src-head@freebsd.org  Mon Jul 22 21:07:59 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E382BBF75;
 Mon, 22 Jul 2019 21:07:59 +0000 (UTC)
 (envelope-from brooks@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 602AA8B4DB;
 Mon, 22 Jul 2019 21:07:59 +0000 (UTC)
 (envelope-from brooks@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 360F31B1C8;
 Mon, 22 Jul 2019 21:07:59 +0000 (UTC)
 (envelope-from brooks@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6ML7xk2052780;
 Mon, 22 Jul 2019 21:07:59 GMT (envelope-from brooks@FreeBSD.org)
Received: (from brooks@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6ML7xdL052779;
 Mon, 22 Jul 2019 21:07:59 GMT (envelope-from brooks@FreeBSD.org)
Message-Id: <201907222107.x6ML7xdL052779@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: brooks set sender to
 brooks@FreeBSD.org using -f
From: Brooks Davis <brooks@FreeBSD.org>
Date: Mon, 22 Jul 2019 21:07:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350228 - head/sys/cam/ata
X-SVN-Group: head
X-SVN-Commit-Author: brooks
X-SVN-Commit-Paths: head/sys/cam/ata
X-SVN-Commit-Revision: 350228
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 602AA8B4DB
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.961,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 21:07:59 -0000

Author: brooks
Date: Mon Jul 22 21:07:58 2019
New Revision: 350228
URL: https://svnweb.freebsd.org/changeset/base/350228

Log:
  ata_xpt: Use the correct union member when accessing valid.
  
  In principle this should not matter as it's a union and they point to
  the same memory location but based on the code above we should be
  accessing .sata and not .ata.
  
  Submitted by:	arichardson
  Reviewed by:	scottl, imp
  Obtained from:	CheriBSD
  MFC after:	1 week
  Sponsored by:	DARPA, AFRL
  Differential Revision:	https://reviews.freebsd.org/D21002

Modified:
  head/sys/cam/ata/ata_xpt.c

Modified: head/sys/cam/ata/ata_xpt.c
==============================================================================
--- head/sys/cam/ata/ata_xpt.c	Mon Jul 22 21:03:52 2019	(r350227)
+++ head/sys/cam/ata/ata_xpt.c	Mon Jul 22 21:07:58 2019	(r350228)
@@ -452,7 +452,7 @@ negotiate:
 			if (cts.xport_specific.ata.valid & CTS_ATA_VALID_MODE)
 				mode = cts.xport_specific.ata.mode;
 		} else {
-			if (cts.xport_specific.ata.valid & CTS_SATA_VALID_MODE)
+			if (cts.xport_specific.sata.valid & CTS_SATA_VALID_MODE)
 				mode = cts.xport_specific.sata.mode;
 		}
 		/* If SIM disagree - renegotiate. */

From owner-svn-src-head@freebsd.org  Mon Jul 22 21:53:59 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 81DA7BD707;
 Mon, 22 Jul 2019 21:53:59 +0000 (UTC)
 (envelope-from manu@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 63E298D553;
 Mon, 22 Jul 2019 21:53:59 +0000 (UTC)
 (envelope-from manu@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 3E5981BA9E;
 Mon, 22 Jul 2019 21:53:59 +0000 (UTC)
 (envelope-from manu@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6MLrxEG082200;
 Mon, 22 Jul 2019 21:53:59 GMT (envelope-from manu@FreeBSD.org)
Received: (from manu@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6MLrxDk082199;
 Mon, 22 Jul 2019 21:53:59 GMT (envelope-from manu@FreeBSD.org)
Message-Id: <201907222153.x6MLrxDk082199@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: manu set sender to
 manu@FreeBSD.org using -f
From: Emmanuel Vadot <manu@FreeBSD.org>
Date: Mon, 22 Jul 2019 21:53:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350229 - head/sys/arm/ti
X-SVN-Group: head
X-SVN-Commit-Author: manu
X-SVN-Commit-Paths: head/sys/arm/ti
X-SVN-Commit-Revision: 350229
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 63E298D553
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.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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 21:53:59 -0000

Author: manu
Date: Mon Jul 22 21:53:58 2019
New Revision: 350229
URL: https://svnweb.freebsd.org/changeset/base/350229

Log:
  arm: ti: Get the hwmods property from the parent node
  
  Since the Linux 5.0 dts the ti,hwmods property is on the parent
  ti.sysc node.

Modified:
  head/sys/arm/ti/ti_hwmods.c

Modified: head/sys/arm/ti/ti_hwmods.c
==============================================================================
--- head/sys/arm/ti/ti_hwmods.c	Mon Jul 22 21:07:58 2019	(r350228)
+++ head/sys/arm/ti/ti_hwmods.c	Mon Jul 22 21:53:58 2019	(r350229)
@@ -110,7 +110,7 @@ ti_hwmods_get_clock(device_t dev)
 	if ((node = ofw_bus_get_node(dev)) == 0)
 		return (INVALID_CLK_IDENT);
 
-	if ((len = OF_getprop_alloc(node, "ti,hwmods", (void**)&name)) <= 0)
+	if ((len = OF_getprop_alloc(OF_parent(node), "ti,hwmods", (void**)&name)) <= 0)
 		return (INVALID_CLK_IDENT);
 
 	buf = name;
@@ -148,7 +148,7 @@ int ti_hwmods_contains(device_t dev, const char *hwmod
 	if ((node = ofw_bus_get_node(dev)) == 0)
 		return (0);
 
-	if ((len = OF_getprop_alloc(node, "ti,hwmods", (void**)&name)) <= 0)
+	if ((len = OF_getprop_alloc(OF_parent(node), "ti,hwmods", (void**)&name)) <= 0)
 		return (0);
 
 	buf = name;
@@ -182,7 +182,7 @@ ti_hwmods_get_unit(device_t dev, const char *hwmod)
 	if ((node = ofw_bus_get_node(dev)) == 0)
 		return (0);
 
-	if ((len = OF_getprop_alloc(node, "ti,hwmods", (void**)&name)) <= 0)
+	if ((len = OF_getprop_alloc(OF_parent(node), "ti,hwmods", (void**)&name)) <= 0)
 		return (0);
 
 	buf = name;

From owner-svn-src-head@freebsd.org  Mon Jul 22 21:55:34 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7DF25BD7B1;
 Mon, 22 Jul 2019 21:55:34 +0000 (UTC)
 (envelope-from manu@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 578418D6F3;
 Mon, 22 Jul 2019 21:55:34 +0000 (UTC)
 (envelope-from manu@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 2A4141BAA2;
 Mon, 22 Jul 2019 21:55:34 +0000 (UTC)
 (envelope-from manu@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6MLtYlZ082355;
 Mon, 22 Jul 2019 21:55:34 GMT (envelope-from manu@FreeBSD.org)
Received: (from manu@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6MLtXpR082353;
 Mon, 22 Jul 2019 21:55:33 GMT (envelope-from manu@FreeBSD.org)
Message-Id: <201907222155.x6MLtXpR082353@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: manu set sender to
 manu@FreeBSD.org using -f
From: Emmanuel Vadot <manu@FreeBSD.org>
Date: Mon, 22 Jul 2019 21:55:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350230 - head/sys/arm/ti
X-SVN-Group: head
X-SVN-Commit-Author: manu
X-SVN-Commit-Paths: head/sys/arm/ti
X-SVN-Commit-Revision: 350230
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 578418D6F3
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 21:55:34 -0000

Author: manu
Date: Mon Jul 22 21:55:33 2019
New Revision: 350230
URL: https://svnweb.freebsd.org/changeset/base/350230

Log:
  arm: ti: Add a driver for ti,sysc bus
  
  ti,sysc is a simple-bus like driver.
  Add a driver for it so child nodes can attach.

Added:
  head/sys/arm/ti/ti_sysc.c   (contents, props changed)
Modified:
  head/sys/arm/ti/files.ti

Modified: head/sys/arm/ti/files.ti
==============================================================================
--- head/sys/arm/ti/files.ti	Mon Jul 22 21:53:58 2019	(r350229)
+++ head/sys/arm/ti/files.ti	Mon Jul 22 21:55:33 2019	(r350230)
@@ -16,6 +16,7 @@ arm/ti/ti_gpio_if.m				optional	gpio
 arm/ti/ti_i2c.c					optional	ti_i2c
 arm/ti/ti_sdhci.c	 			optional	sdhci
 arm/ti/ti_spi.c		 			optional	ti_spi
+arm/ti/ti_sysc.c	 			standard
 
 dev/uart/uart_dev_ti8250.c			optional	uart
 dev/uart/uart_dev_ns8250.c			optional	uart

Added: head/sys/arm/ti/ti_sysc.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/arm/ti/ti_sysc.c	Mon Jul 22 21:55:33 2019	(r350230)
@@ -0,0 +1,125 @@
+/*-
+ * Copyright (c) 2019 Emmanuel Vadot <manu@FreeBSD.org>
+ *
+ * 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 ``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 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$
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/fbio.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/rman.h>
+#include <sys/resource.h>
+#include <machine/bus.h>
+#include <vm/vm.h>
+#include <vm/vm_extern.h>
+#include <vm/vm_kern.h>
+#include <vm/pmap.h>
+
+#include <dev/fdt/simplebus.h>
+
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+
+static struct ofw_compat_data compat_data[] = {
+	{ "ti,sysc",	1 },
+	{ NULL,				0 }
+};
+
+struct ti_sysc_softc {
+	struct simplebus_softc	sc;
+	device_t		dev;
+};
+
+static int ti_sysc_probe(device_t dev);
+static int ti_sysc_attach(device_t dev);
+static int ti_sysc_detach(device_t dev);
+
+static int
+ti_sysc_probe(device_t dev)
+{
+	if (!ofw_bus_status_okay(dev))
+		return (ENXIO);
+
+	if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
+		return (ENXIO);
+
+	device_set_desc(dev, "TI SYSC Interconnect");
+	return (BUS_PROBE_DEFAULT);
+}
+
+static int
+ti_sysc_attach(device_t dev)
+{
+	struct ti_sysc_softc *sc;
+	device_t cdev;
+	phandle_t node, child;
+
+	sc = device_get_softc(dev);
+	sc->dev = dev;
+	node = ofw_bus_get_node(dev);
+
+	simplebus_init(dev, node);
+	if (simplebus_fill_ranges(node, &sc->sc) < 0) {
+		device_printf(dev, "could not get ranges\n");
+		return (ENXIO);
+	}
+
+	for (child = OF_child(node); child > 0; child = OF_peer(child)) {
+		cdev = simplebus_add_device(dev, child, 0, NULL, -1, NULL);
+		if (cdev != NULL)
+			device_probe_and_attach(cdev);
+	}
+
+	return (bus_generic_attach(dev));
+}
+
+static int
+ti_sysc_detach(device_t dev)
+{
+
+	return (EBUSY);
+}
+
+static device_method_t ti_sysc_methods[] = {
+	/* Device interface */
+	DEVMETHOD(device_probe,		ti_sysc_probe),
+	DEVMETHOD(device_attach,	ti_sysc_attach),
+	DEVMETHOD(device_detach,	ti_sysc_detach),
+
+	DEVMETHOD_END
+};
+
+DEFINE_CLASS_1(ti_sysc, ti_sysc_driver, ti_sysc_methods,
+    sizeof(struct ti_sysc_softc), simplebus_driver);
+
+static devclass_t ti_sysc_devclass;
+
+EARLY_DRIVER_MODULE(ti_sysc, simplebus, ti_sysc_driver,
+ti_sysc_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_FIRST);

From owner-svn-src-head@freebsd.org  Mon Jul 22 22:41:45 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85CB1BE353;
 Mon, 22 Jul 2019 22:41:45 +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 651B68EF7A;
 Mon, 22 Jul 2019 22:41:45 +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 36C281C32D;
 Mon, 22 Jul 2019 22:41: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 x6MMfipZ010233;
 Mon, 22 Jul 2019 22:41:44 GMT (envelope-from ian@FreeBSD.org)
Received: (from ian@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6MMfiOk010232;
 Mon, 22 Jul 2019 22:41:44 GMT (envelope-from ian@FreeBSD.org)
Message-Id: <201907222241.x6MMfiOk010232@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org
 using -f
From: Ian Lepore <ian@FreeBSD.org>
Date: Mon, 22 Jul 2019 22:41:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350231 - head/sys/dev/mmc
X-SVN-Group: head
X-SVN-Commit-Author: ian
X-SVN-Commit-Paths: head/sys/dev/mmc
X-SVN-Commit-Revision: 350231
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 651B68EF7A
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 22:41:45 -0000

Author: ian
Date: Mon Jul 22 22:41:44 2019
New Revision: 350231
URL: https://svnweb.freebsd.org/changeset/base/350231

Log:
  Correct spelling, partion -> partition.

Modified:
  head/sys/dev/mmc/mmcsd.c

Modified: head/sys/dev/mmc/mmcsd.c
==============================================================================
--- head/sys/dev/mmc/mmcsd.c	Mon Jul 22 21:55:33 2019	(r350230)
+++ head/sys/dev/mmc/mmcsd.c	Mon Jul 22 22:41:44 2019	(r350231)
@@ -575,7 +575,7 @@ mmcsd_add_part(struct mmcsd_softc *sc, u_int type, con
 		    speed / 1000000, (speed / 100000) % 10,
 		    mmcsd_bus_bit_width(dev), sc->max_data);
 	} else if (type == EXT_CSD_PART_CONFIG_ACC_RPMB) {
-		printf("%s: %ju%sB partion %d%s at %s\n", part->name, bytes,
+		printf("%s: %ju%sB partition %d%s at %s\n", part->name, bytes,
 		    unit, type, ro ? " (read-only)" : "",
 		    device_get_nameunit(dev));
 	} else {
@@ -611,12 +611,12 @@ mmcsd_add_part(struct mmcsd_softc *sc, u_int type, con
 			}
 		}
 		if (ext == NULL)
-			printf("%s%d: %ju%sB partion %d%s%s at %s\n",
+			printf("%s%d: %ju%sB partition %d%s%s at %s\n",
 			    part->name, cnt, bytes, unit, type, enh ?
 			    " enhanced" : "", ro ? " (read-only)" : "",
 			    device_get_nameunit(dev));
 		else
-			printf("%s%d: %ju%sB partion %d extended 0x%x "
+			printf("%s%d: %ju%sB partition %d extended 0x%x "
 			    "(%s)%s at %s\n", part->name, cnt, bytes, unit,
 			    type, extattr, ext, ro ? " (read-only)" : "",
 			    device_get_nameunit(dev));

From owner-svn-src-head@freebsd.org  Mon Jul 22 22:59:51 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9ED2BE9CF;
 Mon, 22 Jul 2019 22:59:51 +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 988AF8FA88;
 Mon, 22 Jul 2019 22:59:51 +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 611921C558;
 Mon, 22 Jul 2019 22:59:51 +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 x6MMxpnH017952;
 Mon, 22 Jul 2019 22:59:51 GMT (envelope-from jhibbits@FreeBSD.org)
Received: (from jhibbits@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6MMxpJP017951;
 Mon, 22 Jul 2019 22:59:51 GMT (envelope-from jhibbits@FreeBSD.org)
Message-Id: <201907222259.x6MMxpJP017951@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to
 jhibbits@FreeBSD.org using -f
From: Justin Hibbits <jhibbits@FreeBSD.org>
Date: Mon, 22 Jul 2019 22:59:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350232 - 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: 350232
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 988AF8FA88
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jul 2019 22:59:51 -0000

Author: jhibbits
Date: Mon Jul 22 22:59:50 2019
New Revision: 350232
URL: https://svnweb.freebsd.org/changeset/base/350232

Log:
  powerpc: Unbreak 64-bit pmap from 350206
  
  oldpvo is never explicitly NULL'd by moea64_pvo_enter(), so don't check for
  NULL to do anything, only check error.
  
  PR:		239372
  Reported by:	Francis Little

Modified:
  head/sys/powerpc/aim/mmu_oea64.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c	Mon Jul 22 22:41:44 2019	(r350231)
+++ head/sys/powerpc/aim/mmu_oea64.c	Mon Jul 22 22:59:50 2019	(r350232)
@@ -1449,13 +1449,13 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_offset_t va, v
 			KASSERT(oldpvo->pvo_pmap == pmap, ("pmap of old "
 			    "mapping does not match new mapping"));
 			moea64_pvo_remove_from_pmap(mmu, oldpvo);
-			error = moea64_pvo_enter(mmu, pvo, pvo_head, NULL);
+			moea64_pvo_enter(mmu, pvo, pvo_head, NULL);
 		}
 		PV_PAGE_UNLOCK(m);
 		PMAP_UNLOCK(pmap);
 
 		/* Free any dead pages */
-		if (oldpvo != NULL) {
+		if (error == EEXIST) {
 			moea64_pvo_remove_from_page(mmu, oldpvo);
 			free_pvo_entry(oldpvo);
 		}
@@ -2521,8 +2521,6 @@ moea64_pvo_enter(mmu_t mmu, struct pvo_entry *pvo, str
 	struct pvo_entry *old_pvo;
 
 	PMAP_LOCK_ASSERT(pvo->pvo_pmap, MA_OWNED);
-	KASSERT(moea64_pvo_find_va(pvo->pvo_pmap, PVO_VADDR(pvo)) == NULL,
-	    ("Existing mapping for VA %#jx", (uintmax_t)PVO_VADDR(pvo)));
 
 	moea64_pvo_enter_calls++;
 

From owner-svn-src-head@freebsd.org  Tue Jul 23 02:11:15 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7CA8CC1BE6;
 Tue, 23 Jul 2019 02:11:15 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 5FBF66F5C0;
 Tue, 23 Jul 2019 02:11:15 +0000 (UTC) (envelope-from mav@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 39A5C1E809;
 Tue, 23 Jul 2019 02:11:15 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6N2BFwK035844;
 Tue, 23 Jul 2019 02:11:15 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6N2BECT035841;
 Tue, 23 Jul 2019 02:11:14 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201907230211.x6N2BECT035841@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Tue, 23 Jul 2019 02:11:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350233 - head/sys/cam/ata
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: head/sys/cam/ata
X-SVN-Commit-Revision: 350233
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 5FBF66F5C0
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Jul 2019 02:11:15 -0000

Author: mav
Date: Tue Jul 23 02:11:14 2019
New Revision: 350233
URL: https://svnweb.freebsd.org/changeset/base/350233

Log:
  Make CAM ATA stack handle disk resizes.
  
  While for ATA disks resize is even more rare situation than for SCSI, it
  may happen in case of HPA or AMA being used.  Make ATA XPT report minor
  IDENTIFY DATA change to upper layers with AC_GETDEV_CHANGED, and ada(4)
  periph driver handle that event, recalculating all the disk properties and
  signalling resize to GEOM.  Since ATA has no mechanism of UNIT ATTENTIONs,
  like SCSI, it has no way to detect that something has changed.  That is why
  this functionality depends on explicit reprobe via XPT_REPROBE_LUN call.
  
  MFC after:	2 weeks
  Relnotes:	yes
  Sponsored by:	iXsystems, Inc.

Modified:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/ata/ata_xpt.c

Modified: head/sys/cam/ata/ata_da.c
==============================================================================
--- head/sys/cam/ata/ata_da.c	Mon Jul 22 22:59:50 2019	(r350232)
+++ head/sys/cam/ata/ata_da.c	Tue Jul 23 02:11:14 2019	(r350233)
@@ -248,8 +248,9 @@ struct ada_softc {
 	int      periodic_read_error;
 	int      periodic_read_count;
 #endif
-	struct	 disk_params params;
-	struct	 disk *disk;
+	struct ccb_pathinq	cpi;
+	struct disk_params	params;
+	struct disk		*disk;
 	struct task		sysctl_task;
 	struct sysctl_ctx_list	sysctl_ctx;
 	struct sysctl_oid	*sysctl_tree;
@@ -807,6 +808,8 @@ static	void		adasysctlinit(void *context, int pending)
 static	int		adagetattr(struct bio *bp);
 static	void		adasetflags(struct ada_softc *softc,
 				    struct ccb_getdev *cgd);
+static void		adasetgeom(struct ada_softc *softc,
+				   struct ccb_getdev *cgd);
 static	periph_ctor_t	adaregister;
 static	void		ada_dsmtrim(struct ada_softc *softc, struct bio *bp,
 				    struct ccb_ataio *ataio);
@@ -822,8 +825,6 @@ static	void		adadone(struct cam_periph *periph,
 			       union ccb *done_ccb);
 static  int		adaerror(union ccb *ccb, u_int32_t cam_flags,
 				u_int32_t sense_flags);
-static void		adagetparams(struct cam_periph *periph,
-				struct ccb_getdev *cgd);
 static timeout_t	adasendorderedtag;
 static void		adashutdown(void *arg, int howto);
 static void		adasuspend(void *arg);
@@ -1307,9 +1308,11 @@ adaasync(void *callback_arg, u_int32_t code,
 		xpt_action((union ccb *)&cgd);
 
 		/*
-		 * Set/clear support flags based on the new Identify data.
+		 * Update our information based on the new Identify data.
 		 */
 		adasetflags(softc, &cgd);
+		adasetgeom(softc, &cgd);
+		disk_resize(softc->disk, M_NOWAIT);
 
 		cam_periph_async(periph, code, path, arg);
 		break;
@@ -1645,7 +1648,8 @@ adasetflags(struct ada_softc *softc, struct ccb_getdev
 		softc->flags &= ~ADA_FLAG_CAN_NCQ;
 
 	if ((cgd->ident_data.support_dsm & ATA_SUPPORT_DSM_TRIM) &&
-	    (cgd->inq_flags & SID_DMA)) {
+	    (cgd->inq_flags & SID_DMA) &&
+	    (softc->quirks & ADA_Q_NO_TRIM) == 0) {
 		softc->flags |= ADA_FLAG_CAN_TRIM;
 		softc->trim_max_ranges = TRIM_MAX_RANGES;
 		if (cgd->ident_data.max_dsm_blocks != 0) {
@@ -1713,13 +1717,11 @@ static cam_status
 adaregister(struct cam_periph *periph, void *arg)
 {
 	struct ada_softc *softc;
-	struct ccb_pathinq cpi;
 	struct ccb_getdev *cgd;
 	struct disk_params *dp;
 	struct sbuf sb;
 	char   *announce_buf;
 	caddr_t match;
-	u_int maxio;
 	int quirks;
 
 	cgd = (struct ccb_getdev *)arg;
@@ -1748,6 +1750,7 @@ adaregister(struct cam_periph *periph, void *arg)
 	}
 
 	periph->softc = softc;
+	xpt_path_inq(&softc->cpi, periph->path);
 
 	/*
 	 * See if this device has any quirks.
@@ -1761,8 +1764,6 @@ adaregister(struct cam_periph *periph, void *arg)
 	else
 		softc->quirks = ADA_Q_NONE;
 
-	xpt_path_inq(&cpi, periph->path);
-
 	TASK_INIT(&softc->sysctl_task, 0, adasysctlinit, periph);
 
 	/*
@@ -1788,6 +1789,8 @@ adaregister(struct cam_periph *periph, void *arg)
 	 * Set support flags based on the Identify data and quirks.
 	 */
 	adasetflags(softc, cgd);
+	if (softc->cpi.hba_misc & PIM_ATA_EXT)
+		softc->flags |= ADA_FLAG_PIM_ATA_EXT;
 
 	/* Disable queue sorting for non-rotational media by default. */
 	if (cgd->ident_data.media_rotation_rate == ATA_RATE_NON_ROTATING) {
@@ -1796,14 +1799,13 @@ adaregister(struct cam_periph *periph, void *arg)
 		softc->rotating = 1;
 	}
 	cam_iosched_set_sort_queue(softc->cam_iosched,  softc->rotating ? -1 : 0);
-	adagetparams(periph, cgd);
 	softc->disk = disk_alloc();
-	softc->disk->d_rotation_rate = cgd->ident_data.media_rotation_rate;
+	adasetgeom(softc, cgd);
 	softc->disk->d_devstat = devstat_new_entry(periph->periph_name,
 			  periph->unit_number, softc->params.secsize,
 			  DEVSTAT_ALL_SUPPORTED,
 			  DEVSTAT_TYPE_DIRECT |
-			  XPORT_DEVSTAT_TYPE(cpi.transport),
+			  XPORT_DEVSTAT_TYPE(softc->cpi.transport),
 			  DEVSTAT_PRIORITY_DISK);
 	softc->disk->d_open = adaopen;
 	softc->disk->d_close = adaclose;
@@ -1813,70 +1815,8 @@ adaregister(struct cam_periph *periph, void *arg)
 	softc->disk->d_gone = adadiskgonecb;
 	softc->disk->d_name = "ada";
 	softc->disk->d_drv1 = periph;
-	maxio = cpi.maxio;		/* Honor max I/O size of SIM */
-	if (maxio == 0)
-		maxio = DFLTPHYS;	/* traditional default */
-	else if (maxio > MAXPHYS)
-		maxio = MAXPHYS;	/* for safety */
-	if (softc->flags & ADA_FLAG_CAN_48BIT)
-		maxio = min(maxio, 65536 * softc->params.secsize);
-	else					/* 28bit ATA command limit */
-		maxio = min(maxio, 256 * softc->params.secsize);
-	if (softc->quirks & ADA_Q_128KB)
-		maxio = min(maxio, 128 * 1024);
-	softc->disk->d_maxsize = maxio;
 	softc->disk->d_unit = periph->unit_number;
-	softc->disk->d_flags = DISKFLAG_DIRECT_COMPLETION | DISKFLAG_CANZONE;
-	if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE)
-		softc->disk->d_flags |= DISKFLAG_CANFLUSHCACHE;
-	/* Device lies about TRIM capability. */
-	if ((softc->quirks & ADA_Q_NO_TRIM) &&
-	    (softc->flags & ADA_FLAG_CAN_TRIM))
-		softc->flags &= ~ADA_FLAG_CAN_TRIM;
-	if (softc->flags & ADA_FLAG_CAN_TRIM) {
-		softc->disk->d_flags |= DISKFLAG_CANDELETE;
-		softc->disk->d_delmaxsize = softc->params.secsize *
-					    ATA_DSM_RANGE_MAX *
-					    softc->trim_max_ranges;
-	} else if ((softc->flags & ADA_FLAG_CAN_CFA) &&
-	    !(softc->flags & ADA_FLAG_CAN_48BIT)) {
-		softc->disk->d_flags |= DISKFLAG_CANDELETE;
-		softc->disk->d_delmaxsize = 256 * softc->params.secsize;
-	} else
-		softc->disk->d_delmaxsize = maxio;
-	if ((cpi.hba_misc & PIM_UNMAPPED) != 0) {
-		softc->disk->d_flags |= DISKFLAG_UNMAPPED_BIO;
-		softc->unmappedio = 1;
-	}
-	if (cpi.hba_misc & PIM_ATA_EXT)
-		softc->flags |= ADA_FLAG_PIM_ATA_EXT;
-	strlcpy(softc->disk->d_descr, cgd->ident_data.model,
-	    MIN(sizeof(softc->disk->d_descr), sizeof(cgd->ident_data.model)));
-	strlcpy(softc->disk->d_ident, cgd->ident_data.serial,
-	    MIN(sizeof(softc->disk->d_ident), sizeof(cgd->ident_data.serial)));
-	softc->disk->d_hba_vendor = cpi.hba_vendor;
-	softc->disk->d_hba_device = cpi.hba_device;
-	softc->disk->d_hba_subvendor = cpi.hba_subvendor;
-	softc->disk->d_hba_subdevice = cpi.hba_subdevice;
 
-	softc->disk->d_sectorsize = softc->params.secsize;
-	softc->disk->d_mediasize = (off_t)softc->params.sectors *
-	    softc->params.secsize;
-	if (ata_physical_sector_size(&cgd->ident_data) !=
-	    softc->params.secsize) {
-		softc->disk->d_stripesize =
-		    ata_physical_sector_size(&cgd->ident_data);
-		softc->disk->d_stripeoffset = (softc->disk->d_stripesize -
-		    ata_logical_sector_offset(&cgd->ident_data)) %
-		    softc->disk->d_stripesize;
-	} else if (softc->quirks & ADA_Q_4K) {
-		softc->disk->d_stripesize = 4096;
-		softc->disk->d_stripeoffset = 0;
-	}
-	softc->disk->d_fwsectors = softc->params.secs_per_track;
-	softc->disk->d_fwheads = softc->params.heads;
-	ata_disk_firmware_geom_adjust(softc->disk);
-
 	/*
 	 * Acquire a reference to the periph before we register with GEOM.
 	 * We'll release this reference once GEOM calls us back (via
@@ -3388,16 +3328,17 @@ adaerror(union ccb *ccb, u_int32_t cam_flags, u_int32_
 }
 
 static void
-adagetparams(struct cam_periph *periph, struct ccb_getdev *cgd)
+adasetgeom(struct ada_softc *softc, struct ccb_getdev *cgd)
 {
-	struct ada_softc *softc = (struct ada_softc *)periph->softc;
 	struct disk_params *dp = &softc->params;
 	u_int64_t lbasize48;
 	u_int32_t lbasize;
+	u_int maxio, d_flags;
 
 	dp->secsize = ata_logical_sector_size(&cgd->ident_data);
 	if ((cgd->ident_data.atavalid & ATA_FLAG_54_58) &&
-		cgd->ident_data.current_heads && cgd->ident_data.current_sectors) {
+	    cgd->ident_data.current_heads != 0 &&
+	    cgd->ident_data.current_sectors != 0) {
 		dp->heads = cgd->ident_data.current_heads;
 		dp->secs_per_track = cgd->ident_data.current_sectors;
 		dp->cylinders = cgd->ident_data.cylinders;
@@ -3425,6 +3366,60 @@ adagetparams(struct cam_periph *periph, struct ccb_get
 	if ((cgd->ident_data.support.command2 & ATA_SUPPORT_ADDRESS48) &&
 	    lbasize48 > ATA_MAX_28BIT_LBA)
 		dp->sectors = lbasize48;
+
+	maxio = softc->cpi.maxio;		/* Honor max I/O size of SIM */
+	if (maxio == 0)
+		maxio = DFLTPHYS;	/* traditional default */
+	else if (maxio > MAXPHYS)
+		maxio = MAXPHYS;	/* for safety */
+	if (softc->flags & ADA_FLAG_CAN_48BIT)
+		maxio = min(maxio, 65536 * softc->params.secsize);
+	else					/* 28bit ATA command limit */
+		maxio = min(maxio, 256 * softc->params.secsize);
+	if (softc->quirks & ADA_Q_128KB)
+		maxio = min(maxio, 128 * 1024);
+	softc->disk->d_maxsize = maxio;
+	d_flags = DISKFLAG_DIRECT_COMPLETION | DISKFLAG_CANZONE;
+	if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE)
+		d_flags |= DISKFLAG_CANFLUSHCACHE;
+	if (softc->flags & ADA_FLAG_CAN_TRIM) {
+		d_flags |= DISKFLAG_CANDELETE;
+		softc->disk->d_delmaxsize = softc->params.secsize *
+		    ATA_DSM_RANGE_MAX * softc->trim_max_ranges;
+	} else if ((softc->flags & ADA_FLAG_CAN_CFA) &&
+	    !(softc->flags & ADA_FLAG_CAN_48BIT)) {
+		d_flags |= DISKFLAG_CANDELETE;
+		softc->disk->d_delmaxsize = 256 * softc->params.secsize;
+	} else
+		softc->disk->d_delmaxsize = maxio;
+	if ((softc->cpi.hba_misc & PIM_UNMAPPED) != 0) {
+		d_flags |= DISKFLAG_UNMAPPED_BIO;
+		softc->unmappedio = 1;
+	}
+	softc->disk->d_flags = d_flags;
+	strlcpy(softc->disk->d_descr, cgd->ident_data.model,
+	    MIN(sizeof(softc->disk->d_descr), sizeof(cgd->ident_data.model)));
+	strlcpy(softc->disk->d_ident, cgd->ident_data.serial,
+	    MIN(sizeof(softc->disk->d_ident), sizeof(cgd->ident_data.serial)));
+
+	softc->disk->d_sectorsize = softc->params.secsize;
+	softc->disk->d_mediasize = (off_t)softc->params.sectors *
+	    softc->params.secsize;
+	if (ata_physical_sector_size(&cgd->ident_data) !=
+	    softc->params.secsize) {
+		softc->disk->d_stripesize =
+		    ata_physical_sector_size(&cgd->ident_data);
+		softc->disk->d_stripeoffset = (softc->disk->d_stripesize -
+		    ata_logical_sector_offset(&cgd->ident_data)) %
+		    softc->disk->d_stripesize;
+	} else if (softc->quirks & ADA_Q_4K) {
+		softc->disk->d_stripesize = 4096;
+		softc->disk->d_stripeoffset = 0;
+	}
+	softc->disk->d_fwsectors = softc->params.secs_per_track;
+	softc->disk->d_fwheads = softc->params.heads;
+	ata_disk_firmware_geom_adjust(softc->disk);
+	softc->disk->d_rotation_rate = cgd->ident_data.media_rotation_rate;
 }
 
 static void

Modified: head/sys/cam/ata/ata_xpt.c
==============================================================================
--- head/sys/cam/ata/ata_xpt.c	Mon Jul 22 22:59:50 2019	(r350232)
+++ head/sys/cam/ata/ata_xpt.c	Tue Jul 23 02:11:14 2019	(r350233)
@@ -344,6 +344,7 @@ probestart(struct cam_periph *periph, union ccb *start
 	probe_softc *softc;
 	struct cam_path *path;
 	struct ata_params *ident_buf;
+	u_int oif;
 
 	CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("probestart\n"));
 
@@ -383,7 +384,7 @@ probestart(struct cam_periph *periph, union ccb *start
 		      /*data_ptr*/(u_int8_t *)&softc->ident_data,
 		      /*dxfer_len*/sizeof(softc->ident_data),
 		      30 * 1000);
-		if (periph->path->device->protocol == PROTO_ATA)
+		if (path->device->protocol == PROTO_ATA)
 			ata_28bit_cmd(ataio, ATA_ATA_IDENTIFY, 0, 0, 0);
 		else
 			ata_28bit_cmd(ataio, ATA_ATAPI_IDENTIFY, 0, 0, 0);
@@ -419,7 +420,7 @@ probestart(struct cam_periph *periph, union ccb *start
 			if (cts.xport_specific.sata.valid & CTS_SATA_VALID_MODE)
 				mode = cts.xport_specific.sata.mode;
 		}
-		if (periph->path->device->protocol == PROTO_ATA) {
+		if (path->device->protocol == PROTO_ATA) {
 			if (ata_dma == 0 && (mode == 0 || mode > ATA_PIO_MAX))
 				mode = ATA_PIO_MAX;
 		} else {
@@ -459,11 +460,13 @@ negotiate:
 		if (mode != wantmode)
 			goto negotiate;
 		/* Remember what transport thinks about DMA. */
+		oif = path->device->inq_flags;
 		if (mode < ATA_DMA)
 			path->device->inq_flags &= ~SID_DMA;
 		else
 			path->device->inq_flags |= SID_DMA;
-		xpt_async(AC_GETDEV_CHANGED, path, NULL);
+		if (path->device->inq_flags != oif)
+			xpt_async(AC_GETDEV_CHANGED, path, NULL);
 		cam_fill_ataio(ataio,
 		      1,
 		      probedone,
@@ -516,11 +519,13 @@ negotiate:
 		break;
 	case PROBE_SETAN:
 		/* Remember what transport thinks about AEN. */
+		oif = path->device->inq_flags;
 		if (softc->caps & CTS_SATA_CAPS_H_AN)
 			path->device->inq_flags |= SID_AEN;
 		else
 			path->device->inq_flags &= ~SID_AEN;
-		xpt_async(AC_GETDEV_CHANGED, path, NULL);
+		if (path->device->inq_flags != oif)
+			xpt_async(AC_GETDEV_CHANGED, path, NULL);
 		cam_fill_ataio(ataio,
 		    1,
 		    probedone,
@@ -639,7 +644,7 @@ negotiate:
 	{
 		u_int inquiry_len;
 		struct scsi_inquiry_data *inq_buf =
-		    &periph->path->device->inq_data;
+		    &path->device->inq_data;
 
 		if (softc->action == PROBE_INQUIRY)
 			inquiry_len = SHORT_INQUIRY_LENGTH;
@@ -744,8 +749,8 @@ probedone(struct cam_periph *periph, union ccb *done_c
 	struct cam_path *path;
 	cam_status status;
 	u_int32_t  priority;
-	u_int caps;
-	int changed = 1, found = 1;
+	u_int caps, oif;
+	int changed, found = 1;
 	static const uint8_t fake_device_id_hdr[8] =
 	    {0, SVPD_DEVICE_ID, 0, 12,
 	     SVPD_ID_CODESET_BINARY, SVPD_ID_TYPE_NAA, 0, 8};
@@ -922,23 +927,32 @@ noerror:
 			goto out;
 		}
 		ident_buf = &path->device->ident_data;
+
+		/* Check that it is the same device as we know. */
 		if ((periph->path->device->flags & CAM_DEV_UNCONFIGURED) == 0) {
-			/* Check that it is the same device. */
 			if (bcmp(softc->ident_data.model, ident_buf->model,
 			     sizeof(ident_buf->model)) ||
-			    bcmp(softc->ident_data.revision, ident_buf->revision,
-			     sizeof(ident_buf->revision)) ||
 			    bcmp(softc->ident_data.serial, ident_buf->serial,
 			     sizeof(ident_buf->serial))) {
-				/* Device changed. */
+				/* The device was replaced. */
+				changed = 2;
 				xpt_async(AC_LOST_DEVICE, path, NULL);
+			} else if (bcmp(&softc->ident_data, ident_buf,
+			     sizeof(*ident_buf))) {
+				/* The device is the same, but has changed. */
+				changed = 1;
 			} else {
-				bcopy(&softc->ident_data, ident_buf, sizeof(struct ata_params));
+				/* Nothing has changed. */
 				changed = 0;
 			}
+		} else {
+			/* This is a new device. */
+			changed = 2;
 		}
-		if (changed) {
+
+		if (changed != 0)
 			bcopy(&softc->ident_data, ident_buf, sizeof(struct ata_params));
+		if (changed == 2) {
 			/* Clean up from previous instance of this device */
 			if (path->device->serial_num != NULL) {
 				free(path->device->serial_num, M_CAMXPT);
@@ -975,10 +989,10 @@ noerror:
 					ata_bswap(path->device->device_id + 8, 8);
 				}
 			}
-
 			path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID;
-			xpt_async(AC_GETDEV_CHANGED, path, NULL);
 		}
+		if (changed == 1)
+			xpt_async(AC_GETDEV_CHANGED, path, NULL);
 		if (ident_buf->satacapabilities & ATA_SUPPORT_NCQ) {
 			path->device->mintags = 2;
 			path->device->maxtags =
@@ -1002,7 +1016,7 @@ noerror:
 			}
 		}
 		ata_device_transport(path);
-		if (changed)
+		if (changed == 2)
 			proberequestdefaultnegotiation(periph);
 		PROBE_SET_ACTION(softc, PROBE_SETMODE);
 		xpt_release_ccb(done_ccb);
@@ -1058,6 +1072,7 @@ noerror:
 		 * capability information is not provided or transport is
 		 * SATA, we take support for granted.
 		 */
+		oif = path->device->inq_flags;
 		if (!(path->device->inq_flags & SID_DMA) ||
 		    (path->device->transport == XPORT_ATA &&
 		    (cts.xport_specific.ata.valid & CTS_ATA_VALID_CAPS) &&
@@ -1065,6 +1080,8 @@ noerror:
 			path->device->inq_flags &= ~SID_DMA48;
 		else
 			path->device->inq_flags |= SID_DMA48;
+		if (path->device->inq_flags != oif)
+			xpt_async(AC_GETDEV_CHANGED, path, NULL);
 		/* Store result to SIM. */
 		bzero(&cts, sizeof(cts));
 		xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE);
@@ -1235,6 +1252,7 @@ notsata:
 		else
 			caps = 0;
 		/* Remember what transport thinks about AEN. */
+		oif = path->device->inq_flags;
 		if ((caps & CTS_SATA_CAPS_H_AN) && path->device->protocol != PROTO_ATA)
 			path->device->inq_flags |= SID_AEN;
 		else
@@ -1248,7 +1266,6 @@ notsata:
 		cts.xport_specific.sata.valid = CTS_SATA_VALID_CAPS;
 		xpt_action((union ccb *)&cts);
 		softc->caps = caps;
-		xpt_async(AC_GETDEV_CHANGED, path, NULL);
 		if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) {
 			path->device->flags &= ~CAM_DEV_UNCONFIGURED;
 			xpt_acquire_device(path->device);
@@ -1256,6 +1273,8 @@ notsata:
 			xpt_action(done_ccb);
 			xpt_async(AC_FOUND_DEVICE, path, done_ccb);
 		} else {
+			if (path->device->inq_flags != oif)
+				xpt_async(AC_GETDEV_CHANGED, path, NULL);
 			done_ccb->ccb_h.func_code = XPT_GDEV_TYPE;
 			xpt_action(done_ccb);
 			xpt_async(AC_SCSI_AEN, path, done_ccb);
@@ -1268,12 +1287,14 @@ notsata:
 			/* Check that it is the same device. */
 			if (bcmp(&softc->ident_data, ident_buf, 53)) {
 				/* Device changed. */
+				changed = 2;
 				xpt_async(AC_LOST_DEVICE, path, NULL);
 			} else {
 				bcopy(&softc->ident_data, ident_buf, sizeof(struct ata_params));
 				changed = 0;
 			}
-		}
+		} else
+			changed = 2;
 		if (changed) {
 			bcopy(&softc->ident_data, ident_buf, sizeof(struct ata_params));
 			/* Clean up from previous instance of this device */

From owner-svn-src-head@freebsd.org  Tue Jul 23 07:56:43 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B069A264D;
 Tue, 23 Jul 2019 07:56:43 +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 7359284993;
 Tue, 23 Jul 2019 07:56:43 +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 4D44522866;
 Tue, 23 Jul 2019 07:56:43 +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 x6N7uhhO041320;
 Tue, 23 Jul 2019 07:56:43 GMT (envelope-from lwhsu@FreeBSD.org)
Received: (from lwhsu@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6N7uhW8041319;
 Tue, 23 Jul 2019 07:56:43 GMT (envelope-from lwhsu@FreeBSD.org)
Message-Id: <201907230756.x6N7uhW8041319@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to
 lwhsu@FreeBSD.org using -f
From: Li-Wen Hsu <lwhsu@FreeBSD.org>
Date: Tue, 23 Jul 2019 07:56:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350235 - head/tests/sys/kern
X-SVN-Group: head
X-SVN-Commit-Author: lwhsu
X-SVN-Commit-Paths: head/tests/sys/kern
X-SVN-Commit-Revision: 350235
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 7359284993
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.930,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Jul 2019 07:56:43 -0000

Author: lwhsu
Date: Tue Jul 23 07:56:42 2019
New Revision: 350235
URL: https://svnweb.freebsd.org/changeset/base/350235

Log:
  Temporarily skip flakey test case
  sys.kern.ptrace_test.ptrace__PT_KILL_competing_stop
  
  PR:		220841
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/tests/sys/kern/ptrace_test.c

Modified: head/tests/sys/kern/ptrace_test.c
==============================================================================
--- head/tests/sys/kern/ptrace_test.c	Tue Jul 23 02:30:24 2019	(r350234)
+++ head/tests/sys/kern/ptrace_test.c	Tue Jul 23 07:56:42 2019	(r350235)
@@ -2078,6 +2078,8 @@ ATF_TC_BODY(ptrace__PT_KILL_competing_stop, tc)
 	struct ptrace_lwpinfo pl;
 	struct sched_param sched_param;
 
+	atf_tc_skip("https://bugs.freebsd.org/220841");
+
 	ATF_REQUIRE((fpid = fork()) != -1);
 	if (fpid == 0) {
 		trace_me();

From owner-svn-src-head@freebsd.org  Tue Jul 23 09:19:59 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 19951A4AA3;
 Tue, 23 Jul 2019 09:19:59 +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 EF58F8830B;
 Tue, 23 Jul 2019 09:19:58 +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 C78E223710;
 Tue, 23 Jul 2019 09:19:58 +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 x6N9JwNn089936;
 Tue, 23 Jul 2019 09:19:58 GMT (envelope-from lwhsu@FreeBSD.org)
Received: (from lwhsu@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6N9Jwt2089935;
 Tue, 23 Jul 2019 09:19:58 GMT (envelope-from lwhsu@FreeBSD.org)
Message-Id: <201907230919.x6N9Jwt2089935@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to
 lwhsu@FreeBSD.org using -f
From: Li-Wen Hsu <lwhsu@FreeBSD.org>
Date: Tue, 23 Jul 2019 09:19:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350238 - head/tests/sys/kern
X-SVN-Group: head
X-SVN-Commit-Author: lwhsu
X-SVN-Commit-Paths: head/tests/sys/kern
X-SVN-Commit-Revision: 350238
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: EF58F8830B
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.976,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Jul 2019 09:19:59 -0000

Author: lwhsu
Date: Tue Jul 23 09:19:58 2019
New Revision: 350238
URL: https://svnweb.freebsd.org/changeset/base/350238

Log:
  Temporarily skip flakey test case
  sys.kern.ptrace_test.ptrace__follow_fork_both_attached_unrelated_debugger
  
  PR:		239397
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/tests/sys/kern/ptrace_test.c

Modified: head/tests/sys/kern/ptrace_test.c
==============================================================================
--- head/tests/sys/kern/ptrace_test.c	Tue Jul 23 08:20:52 2019	(r350237)
+++ head/tests/sys/kern/ptrace_test.c	Tue Jul 23 09:19:58 2019	(r350238)
@@ -799,6 +799,8 @@ ATF_TC_BODY(ptrace__follow_fork_both_attached_unrelate
 	pid_t children[2], fpid, wpid;
 	int cpipe[2], status;
 
+	atf_tc_skip("https://bugs.freebsd.org/239397");
+
 	ATF_REQUIRE(pipe(cpipe) == 0);
 	ATF_REQUIRE((fpid = fork()) != -1);
 	if (fpid == 0) {

From owner-svn-src-head@freebsd.org  Tue Jul 23 09:39:28 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0961DA502C;
 Tue, 23 Jul 2019 09:39:28 +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 DE92188D4B;
 Tue, 23 Jul 2019 09:39:27 +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 B3BAB23A8C;
 Tue, 23 Jul 2019 09:39:27 +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 x6N9dRbj001634;
 Tue, 23 Jul 2019 09:39:27 GMT (envelope-from lwhsu@FreeBSD.org)
Received: (from lwhsu@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6N9dRGM001633;
 Tue, 23 Jul 2019 09:39:27 GMT (envelope-from lwhsu@FreeBSD.org)
Message-Id: <201907230939.x6N9dRGM001633@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to
 lwhsu@FreeBSD.org using -f
From: Li-Wen Hsu <lwhsu@FreeBSD.org>
Date: Tue, 23 Jul 2019 09:39:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350239 - head/tests/sys/kern
X-SVN-Group: head
X-SVN-Commit-Author: lwhsu
X-SVN-Commit-Paths: head/tests/sys/kern
X-SVN-Commit-Revision: 350239
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: DE92188D4B
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.976,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Jul 2019 09:39:28 -0000

Author: lwhsu
Date: Tue Jul 23 09:39:27 2019
New Revision: 350239
URL: https://svnweb.freebsd.org/changeset/base/350239

Log:
  Temporarily skip flakey test case
  sys.kern.ptrace_test.ptrace__parent_sees_exit_after_child_debugger
  
  PR:		239399
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/tests/sys/kern/ptrace_test.c

Modified: head/tests/sys/kern/ptrace_test.c
==============================================================================
--- head/tests/sys/kern/ptrace_test.c	Tue Jul 23 09:19:58 2019	(r350238)
+++ head/tests/sys/kern/ptrace_test.c	Tue Jul 23 09:39:27 2019	(r350239)
@@ -258,6 +258,8 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_child_debug
 	int cpipe[2], dpipe[2], status;
 	char c;
 
+	atf_tc_skip("https://bugs.freebsd.org/239399");
+
 	ATF_REQUIRE(pipe(cpipe) == 0);
 	ATF_REQUIRE((child = fork()) != -1);
 

From owner-svn-src-head@freebsd.org  Tue Jul 23 12:52:36 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id EAE36A931C;
 Tue, 23 Jul 2019 12:52:36 +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 CCF708F743;
 Tue, 23 Jul 2019 12:52:36 +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 A4DA725E48;
 Tue, 23 Jul 2019 12:52:36 +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 x6NCqaJv018883;
 Tue, 23 Jul 2019 12:52:36 GMT (envelope-from ae@FreeBSD.org)
Received: (from ae@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6NCqaS9018882;
 Tue, 23 Jul 2019 12:52:36 GMT (envelope-from ae@FreeBSD.org)
Message-Id: <201907231252.x6NCqaS9018882@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org
 using -f
From: "Andrey V. Elsukov" <ae@FreeBSD.org>
Date: Tue, 23 Jul 2019 12:52:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350240 - 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: 350240
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: CCF708F743
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];
 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Jul 2019 12:52:37 -0000

Author: ae
Date: Tue Jul 23 12:52:36 2019
New Revision: 350240
URL: https://svnweb.freebsd.org/changeset/base/350240

Log:
  Eliminate rmlock from ipfw's BPF code.
  
  After r343631 pfil hooks are invoked in net_epoch_preempt section,
  this allows to avoid extra locking. Add NET_EPOCH_ASSER() assertion
  to each ipfw_bpf_*tap*() call to require to be called from inside
  epoch section.
  
  Use NET_EPOCH_WAIT() in ipfw_clone_destroy() to wait until it becomes
  safe to free() ifnet. And use on-stack ifnet pointer in each
  ipfw_bpf_*tap*() call to avoid NULL pointer dereference in case when
  V_*log_if global variable will become NULL during ipfw_bpf_*tap*() call.
  
  Sponsored by:	Yandex LLC

Modified:
  head/sys/netpfil/ipfw/ip_fw_bpf.c

Modified: head/sys/netpfil/ipfw/ip_fw_bpf.c
==============================================================================
--- head/sys/netpfil/ipfw/ip_fw_bpf.c	Tue Jul 23 09:39:27 2019	(r350239)
+++ head/sys/netpfil/ipfw/ip_fw_bpf.c	Tue Jul 23 12:52:36 2019	(r350240)
@@ -32,7 +32,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/mbuf.h>
 #include <sys/kernel.h>
 #include <sys/lock.h>
-#include <sys/rmlock.h>
 #include <sys/socket.h>
 #include <net/ethernet.h>
 #include <net/if.h>
@@ -57,15 +56,6 @@ VNET_DEFINE_STATIC(struct if_clone *, ipfwlog_cloner);
 #define	V_log_if		VNET(log_if)
 #define	V_pflog_if		VNET(pflog_if)
 
-static struct rmlock log_if_lock;
-#define	LOGIF_LOCK_INIT(x)	rm_init(&log_if_lock, "ipfw log_if lock")
-#define	LOGIF_LOCK_DESTROY(x)	rm_destroy(&log_if_lock)
-#define	LOGIF_RLOCK_TRACKER	struct rm_priotracker _log_tracker
-#define	LOGIF_RLOCK(x)		rm_rlock(&log_if_lock, &_log_tracker)
-#define	LOGIF_RUNLOCK(x)	rm_runlock(&log_if_lock, &_log_tracker)
-#define	LOGIF_WLOCK(x)		rm_wlock(&log_if_lock)
-#define	LOGIF_WUNLOCK(x)	rm_wunlock(&log_if_lock)
-
 static const char ipfwname[] = "ipfw";
 static const char ipfwlogname[] = "ipfwlog";
 
@@ -90,13 +80,12 @@ static void
 ipfw_clone_destroy(struct ifnet *ifp)
 {
 
-	LOGIF_WLOCK();
 	if (ifp->if_hdrlen == ETHER_HDR_LEN)
 		V_log_if = NULL;
 	else
 		V_pflog_if = NULL;
-	LOGIF_WUNLOCK();
 
+	NET_EPOCH_WAIT();
 	bpfdetach(ifp);
 	if_detach(ifp);
 	if_free(ifp);
@@ -118,16 +107,13 @@ ipfw_clone_create(struct if_clone *ifc, int unit, cadd
 	ifp->if_hdrlen = ETHER_HDR_LEN;
 	if_attach(ifp);
 	bpfattach(ifp, DLT_EN10MB, ETHER_HDR_LEN);
-	LOGIF_WLOCK();
 	if (V_log_if != NULL) {
-		LOGIF_WUNLOCK();
 		bpfdetach(ifp);
 		if_detach(ifp);
 		if_free(ifp);
 		return (EEXIST);
 	}
 	V_log_if = ifp;
-	LOGIF_WUNLOCK();
 	return (0);
 }
 
@@ -147,48 +133,42 @@ ipfwlog_clone_create(struct if_clone *ifc, int unit, c
 	ifp->if_hdrlen = PFLOG_HDRLEN;
 	if_attach(ifp);
 	bpfattach(ifp, DLT_PFLOG, PFLOG_HDRLEN);
-	LOGIF_WLOCK();
 	if (V_pflog_if != NULL) {
-		LOGIF_WUNLOCK();
 		bpfdetach(ifp);
 		if_detach(ifp);
 		if_free(ifp);
 		return (EEXIST);
 	}
 	V_pflog_if = ifp;
-	LOGIF_WUNLOCK();
 	return (0);
 }
 
 void
 ipfw_bpf_tap(u_char *pkt, u_int pktlen)
 {
-	LOGIF_RLOCK_TRACKER;
+	struct ifnet *ifp = V_log_if;
 
-	LOGIF_RLOCK();
-	if (V_log_if != NULL)
-		BPF_TAP(V_log_if, pkt, pktlen);
-	LOGIF_RUNLOCK();
+	NET_EPOCH_ASSERT();
+	if (ifp != NULL)
+		BPF_TAP(ifp, pkt, pktlen);
 }
 
 void
 ipfw_bpf_mtap(struct mbuf *m)
 {
-	LOGIF_RLOCK_TRACKER;
+	struct ifnet *ifp = V_log_if;
 
-	LOGIF_RLOCK();
-	if (V_log_if != NULL)
-		BPF_MTAP(V_log_if, m);
-	LOGIF_RUNLOCK();
+	NET_EPOCH_ASSERT();
+	if (ifp != NULL)
+		BPF_MTAP(ifp, m);
 }
 
 void
 ipfw_bpf_mtap2(void *data, u_int dlen, struct mbuf *m)
 {
 	struct ifnet *logif;
-	LOGIF_RLOCK_TRACKER;
 
-	LOGIF_RLOCK();
+	NET_EPOCH_ASSERT();
 	switch (dlen) {
 	case (ETHER_HDR_LEN):
 		logif = V_log_if;
@@ -205,19 +185,14 @@ ipfw_bpf_mtap2(void *data, u_int dlen, struct mbuf *m)
 
 	if (logif != NULL)
 		BPF_MTAP2(logif, data, dlen, m);
-
-	LOGIF_RUNLOCK();
 }
 
 void
-ipfw_bpf_init(int first)
+ipfw_bpf_init(int first __unused)
 {
 
-	if (first) {
-		LOGIF_LOCK_INIT();
-		V_log_if = NULL;
-		V_pflog_if = NULL;
-	}
+	V_log_if = NULL;
+	V_pflog_if = NULL;
 	V_ipfw_cloner = if_clone_simple(ipfwname, ipfw_clone_create,
 	    ipfw_clone_destroy, 0);
 	V_ipfwlog_cloner = if_clone_simple(ipfwlogname, ipfwlog_clone_create,
@@ -225,12 +200,10 @@ ipfw_bpf_init(int first)
 }
 
 void
-ipfw_bpf_uninit(int last)
+ipfw_bpf_uninit(int last __unused)
 {
 
 	if_clone_detach(V_ipfw_cloner);
 	if_clone_detach(V_ipfwlog_cloner);
-	if (last)
-		LOGIF_LOCK_DESTROY();
 }
 

From owner-svn-src-head@freebsd.org  Tue Jul 23 14:40:39 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id D51D6AB113;
 Tue, 23 Jul 2019 14:40:39 +0000 (UTC)
 (envelope-from andrew@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 BE89093DA2;
 Tue, 23 Jul 2019 14:40:39 +0000 (UTC)
 (envelope-from andrew@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 B3AE5270DD;
 Tue, 23 Jul 2019 14:40:37 +0000 (UTC)
 (envelope-from andrew@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6NEebhj078949;
 Tue, 23 Jul 2019 14:40:37 GMT (envelope-from andrew@FreeBSD.org)
Received: (from andrew@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6NEebtL078948;
 Tue, 23 Jul 2019 14:40:37 GMT (envelope-from andrew@FreeBSD.org)
Message-Id: <201907231440.x6NEebtL078948@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: andrew set sender to
 andrew@FreeBSD.org using -f
From: Andrew Turner <andrew@FreeBSD.org>
Date: Tue, 23 Jul 2019 14:40:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350241 - head/sys/arm64/include
X-SVN-Group: head
X-SVN-Commit-Author: andrew
X-SVN-Commit-Paths: head/sys/arm64/include
X-SVN-Commit-Revision: 350241
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: BE89093DA2
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.968,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Jul 2019 14:40:39 -0000

Author: andrew
Date: Tue Jul 23 14:40:37 2019
New Revision: 350241
URL: https://svnweb.freebsd.org/changeset/base/350241

Log:
  Ensure the arm64 ID register fields are 64 bit types.
  
  Previously only some of the ID register fields were 64 bit. To allow
  for a script to generate these mark them all 64 bit. To allow for their
  use in assembly we need to use the UINT64_C macro via a new UL macro
  to stop the lines from being too long.
  
  MFC after:	1 week
  Sponsored by:	DARPA, AFRL
  Differential Revision:	https://reviews.freebsd.org/D20977

Modified:
  head/sys/arm64/include/armreg.h

Modified: head/sys/arm64/include/armreg.h
==============================================================================
--- head/sys/arm64/include/armreg.h	Tue Jul 23 12:52:36 2019	(r350240)
+++ head/sys/arm64/include/armreg.h	Tue Jul 23 14:40:37 2019	(r350241)
@@ -43,6 +43,8 @@
 #define	WRITE_SPECIALREG(reg, _val)					\
 	__asm __volatile("msr	" __STRING(reg) ", %0" : : "r"((uint64_t)_val))
 
+#define	UL(x)	UINT64_C(x)
+
 /* CNTHCTL_EL2 - Counter-timer Hypervisor Control register */
 #define	CNTHCTL_EVNTI_MASK	(0xf << 4) /* Bit to trigger event stream */
 #define	CNTHCTL_EVNTDIR		(1 << 3) /* Control transition trigger bit */
@@ -176,324 +178,324 @@
 /* ID_AA64DFR0_EL1 */
 #define	ID_AA64DFR0_MASK		0x0000000ff0f0fffful
 #define	ID_AA64DFR0_DebugVer_SHIFT	0
-#define	ID_AA64DFR0_DebugVer_MASK	(0xf << ID_AA64DFR0_DebugVer_SHIFT)
+#define	ID_AA64DFR0_DebugVer_MASK	(UL(0xf) << ID_AA64DFR0_DebugVer_SHIFT)
 #define	ID_AA64DFR0_DebugVer(x)		((x) & ID_AA64DFR0_DebugVer_MASK)
-#define	 ID_AA64DFR0_DebugVer_8		(0x6 << ID_AA64DFR0_DebugVer_SHIFT)
-#define	 ID_AA64DFR0_DebugVer_8_VHE	(0x7 << ID_AA64DFR0_DebugVer_SHIFT)
-#define	 ID_AA64DFR0_DebugVer_8_2	(0x8 << ID_AA64DFR0_DebugVer_SHIFT)
+#define	 ID_AA64DFR0_DebugVer_8		(UL(0x6) << ID_AA64DFR0_DebugVer_SHIFT)
+#define	 ID_AA64DFR0_DebugVer_8_VHE	(UL(0x7) << ID_AA64DFR0_DebugVer_SHIFT)
+#define	 ID_AA64DFR0_DebugVer_8_2	(UL(0x8) << ID_AA64DFR0_DebugVer_SHIFT)
 #define	ID_AA64DFR0_TraceVer_SHIFT	4
-#define	ID_AA64DFR0_TraceVer_MASK	(0xf << ID_AA64DFR0_TraceVer_SHIFT)
+#define	ID_AA64DFR0_TraceVer_MASK	(UL(0xf) << ID_AA64DFR0_TraceVer_SHIFT)
 #define	ID_AA64DFR0_TraceVer(x)		((x) & ID_AA64DFR0_TraceVer_MASK)
-#define	 ID_AA64DFR0_TraceVer_NONE	(0x0 << ID_AA64DFR0_TraceVer_SHIFT)
-#define	 ID_AA64DFR0_TraceVer_IMPL	(0x1 << ID_AA64DFR0_TraceVer_SHIFT)
+#define	 ID_AA64DFR0_TraceVer_NONE	(UL(0x0) << ID_AA64DFR0_TraceVer_SHIFT)
+#define	 ID_AA64DFR0_TraceVer_IMPL	(UL(0x1) << ID_AA64DFR0_TraceVer_SHIFT)
 #define	ID_AA64DFR0_PMUVer_SHIFT	8
-#define	ID_AA64DFR0_PMUVer_MASK		(0xf << ID_AA64DFR0_PMUVer_SHIFT)
+#define	ID_AA64DFR0_PMUVer_MASK		(UL(0xf) << ID_AA64DFR0_PMUVer_SHIFT)
 #define	ID_AA64DFR0_PMUVer(x)		((x) & ID_AA64DFR0_PMUVer_MASK)
-#define	 ID_AA64DFR0_PMUVer_NONE	(0x0 << ID_AA64DFR0_PMUVer_SHIFT)
-#define	 ID_AA64DFR0_PMUVer_3		(0x1 << ID_AA64DFR0_PMUVer_SHIFT)
-#define	 ID_AA64DFR0_PMUVer_3_1		(0x4 << ID_AA64DFR0_PMUVer_SHIFT)
-#define	 ID_AA64DFR0_PMUVer_IMPL	(0xf << ID_AA64DFR0_PMUVer_SHIFT)
+#define	 ID_AA64DFR0_PMUVer_NONE	(UL(0x0) << ID_AA64DFR0_PMUVer_SHIFT)
+#define	 ID_AA64DFR0_PMUVer_3		(UL(0x1) << ID_AA64DFR0_PMUVer_SHIFT)
+#define	 ID_AA64DFR0_PMUVer_3_1		(UL(0x4) << ID_AA64DFR0_PMUVer_SHIFT)
+#define	 ID_AA64DFR0_PMUVer_IMPL	(UL(0xf) << ID_AA64DFR0_PMUVer_SHIFT)
 #define	ID_AA64DFR0_BRPs_SHIFT		12
-#define	ID_AA64DFR0_BRPs_MASK		(0xf << ID_AA64DFR0_BRPs_SHIFT)
+#define	ID_AA64DFR0_BRPs_MASK		(UL(0xf) << ID_AA64DFR0_BRPs_SHIFT)
 #define	ID_AA64DFR0_BRPs(x)		\
     ((((x) >> ID_AA64DFR0_BRPs_SHIFT) & 0xf) + 1)
 #define	ID_AA64DFR0_WRPs_SHIFT		20
-#define	ID_AA64DFR0_WRPs_MASK		(0xf << ID_AA64DFR0_WRPs_SHIFT)
+#define	ID_AA64DFR0_WRPs_MASK		(UL(0xf) << ID_AA64DFR0_WRPs_SHIFT)
 #define	ID_AA64DFR0_WRPs(x)		\
     ((((x) >> ID_AA64DFR0_WRPs_SHIFT) & 0xf) + 1)
 #define	ID_AA64DFR0_CTX_CMPs_SHIFT	28
-#define	ID_AA64DFR0_CTX_CMPs_MASK	(0xf << ID_AA64DFR0_CTX_CMPs_SHIFT)
+#define	ID_AA64DFR0_CTX_CMPs_MASK	(UL(0xf) << ID_AA64DFR0_CTX_CMPs_SHIFT)
 #define	ID_AA64DFR0_CTX_CMPs(x)		\
     ((((x) >> ID_AA64DFR0_CTX_CMPs_SHIFT) & 0xf) + 1)
 #define	ID_AA64DFR0_PMSVer_SHIFT	32
-#define	ID_AA64DFR0_PMSVer_MASK		(0xful << ID_AA64DFR0_PMSVer_SHIFT)
+#define	ID_AA64DFR0_PMSVer_MASK		(UL(0xf) << ID_AA64DFR0_PMSVer_SHIFT)
 #define	ID_AA64DFR0_PMSVer(x)		((x) & ID_AA64DFR0_PMSVer_MASK)
-#define	 ID_AA64DFR0_PMSVer_NONE	(0x0ul << ID_AA64DFR0_PMSVer_SHIFT)
-#define	 ID_AA64DFR0_PMSVer_V1		(0x1ul << ID_AA64DFR0_PMSVer_SHIFT)
+#define	 ID_AA64DFR0_PMSVer_NONE	(UL(0x0) << ID_AA64DFR0_PMSVer_SHIFT)
+#define	 ID_AA64DFR0_PMSVer_V1		(UL(0x1) << ID_AA64DFR0_PMSVer_SHIFT)
 
 /* ID_AA64ISAR0_EL1 */
 #define	ID_AA64ISAR0_MASK		0x0000fffff0fffff0ul
 #define	ID_AA64ISAR0_AES_SHIFT		4
-#define	ID_AA64ISAR0_AES_MASK		(0xf << ID_AA64ISAR0_AES_SHIFT)
+#define	ID_AA64ISAR0_AES_MASK		(UL(0xf) << ID_AA64ISAR0_AES_SHIFT)
 #define	ID_AA64ISAR0_AES(x)		((x) & ID_AA64ISAR0_AES_MASK)
-#define	 ID_AA64ISAR0_AES_NONE		(0x0 << ID_AA64ISAR0_AES_SHIFT)
-#define	 ID_AA64ISAR0_AES_BASE		(0x1 << ID_AA64ISAR0_AES_SHIFT)
-#define	 ID_AA64ISAR0_AES_PMULL		(0x2 << ID_AA64ISAR0_AES_SHIFT)
+#define	 ID_AA64ISAR0_AES_NONE		(UL(0x0) << ID_AA64ISAR0_AES_SHIFT)
+#define	 ID_AA64ISAR0_AES_BASE		(UL(0x1) << ID_AA64ISAR0_AES_SHIFT)
+#define	 ID_AA64ISAR0_AES_PMULL		(UL(0x2) << ID_AA64ISAR0_AES_SHIFT)
 #define	ID_AA64ISAR0_SHA1_SHIFT		8
-#define	ID_AA64ISAR0_SHA1_MASK		(0xf << ID_AA64ISAR0_SHA1_SHIFT)
+#define	ID_AA64ISAR0_SHA1_MASK		(UL(0xf) << ID_AA64ISAR0_SHA1_SHIFT)
 #define	ID_AA64ISAR0_SHA1(x)		((x) & ID_AA64ISAR0_SHA1_MASK)
-#define	 ID_AA64ISAR0_SHA1_NONE		(0x0 << ID_AA64ISAR0_SHA1_SHIFT)
-#define	 ID_AA64ISAR0_SHA1_BASE		(0x1 << ID_AA64ISAR0_SHA1_SHIFT)
+#define	 ID_AA64ISAR0_SHA1_NONE		(UL(0x0) << ID_AA64ISAR0_SHA1_SHIFT)
+#define	 ID_AA64ISAR0_SHA1_BASE		(UL(0x1) << ID_AA64ISAR0_SHA1_SHIFT)
 #define	ID_AA64ISAR0_SHA2_SHIFT		12
-#define	ID_AA64ISAR0_SHA2_MASK		(0xf << ID_AA64ISAR0_SHA2_SHIFT)
+#define	ID_AA64ISAR0_SHA2_MASK		(UL(0xf) << ID_AA64ISAR0_SHA2_SHIFT)
 #define	ID_AA64ISAR0_SHA2(x)		((x) & ID_AA64ISAR0_SHA2_MASK)
-#define	 ID_AA64ISAR0_SHA2_NONE		(0x0 << ID_AA64ISAR0_SHA2_SHIFT)
-#define	 ID_AA64ISAR0_SHA2_BASE		(0x1 << ID_AA64ISAR0_SHA2_SHIFT)
-#define	 ID_AA64ISAR0_SHA2_512		(0x2 << ID_AA64ISAR0_SHA2_SHIFT)
+#define	 ID_AA64ISAR0_SHA2_NONE		(UL(0x0) << ID_AA64ISAR0_SHA2_SHIFT)
+#define	 ID_AA64ISAR0_SHA2_BASE		(UL(0x1) << ID_AA64ISAR0_SHA2_SHIFT)
+#define	 ID_AA64ISAR0_SHA2_512		(UL(0x2) << ID_AA64ISAR0_SHA2_SHIFT)
 #define	ID_AA64ISAR0_CRC32_SHIFT	16
-#define	ID_AA64ISAR0_CRC32_MASK		(0xf << ID_AA64ISAR0_CRC32_SHIFT)
+#define	ID_AA64ISAR0_CRC32_MASK		(UL(0xf) << ID_AA64ISAR0_CRC32_SHIFT)
 #define	ID_AA64ISAR0_CRC32(x)		((x) & ID_AA64ISAR0_CRC32_MASK)
-#define	 ID_AA64ISAR0_CRC32_NONE	(0x0 << ID_AA64ISAR0_CRC32_SHIFT)
-#define	 ID_AA64ISAR0_CRC32_BASE	(0x1 << ID_AA64ISAR0_CRC32_SHIFT)
+#define	 ID_AA64ISAR0_CRC32_NONE	(UL(0x0) << ID_AA64ISAR0_CRC32_SHIFT)
+#define	 ID_AA64ISAR0_CRC32_BASE	(UL(0x1) << ID_AA64ISAR0_CRC32_SHIFT)
 #define	ID_AA64ISAR0_Atomic_SHIFT	20
-#define	ID_AA64ISAR0_Atomic_MASK	(0xf << ID_AA64ISAR0_Atomic_SHIFT)
+#define	ID_AA64ISAR0_Atomic_MASK	(UL(0xf) << ID_AA64ISAR0_Atomic_SHIFT)
 #define	ID_AA64ISAR0_Atomic(x)		((x) & ID_AA64ISAR0_Atomic_MASK)
-#define	 ID_AA64ISAR0_Atomic_NONE	(0x0 << ID_AA64ISAR0_Atomic_SHIFT)
-#define	 ID_AA64ISAR0_Atomic_IMPL	(0x2 << ID_AA64ISAR0_Atomic_SHIFT)
+#define	 ID_AA64ISAR0_Atomic_NONE	(UL(0x0) << ID_AA64ISAR0_Atomic_SHIFT)
+#define	 ID_AA64ISAR0_Atomic_IMPL	(UL(0x2) << ID_AA64ISAR0_Atomic_SHIFT)
 #define	ID_AA64ISAR0_RDM_SHIFT		28
-#define	ID_AA64ISAR0_RDM_MASK		(0xf << ID_AA64ISAR0_RDM_SHIFT)
+#define	ID_AA64ISAR0_RDM_MASK		(UL(0xf) << ID_AA64ISAR0_RDM_SHIFT)
 #define	ID_AA64ISAR0_RDM(x)		((x) & ID_AA64ISAR0_RDM_MASK)
-#define	 ID_AA64ISAR0_RDM_NONE		(0x0 << ID_AA64ISAR0_RDM_SHIFT)
-#define	 ID_AA64ISAR0_RDM_IMPL		(0x1 << ID_AA64ISAR0_RDM_SHIFT)
+#define	 ID_AA64ISAR0_RDM_NONE		(UL(0x0) << ID_AA64ISAR0_RDM_SHIFT)
+#define	 ID_AA64ISAR0_RDM_IMPL		(UL(0x1) << ID_AA64ISAR0_RDM_SHIFT)
 #define	ID_AA64ISAR0_SHA3_SHIFT		32
-#define	ID_AA64ISAR0_SHA3_MASK		(0xful << ID_AA64ISAR0_SHA3_SHIFT)
+#define	ID_AA64ISAR0_SHA3_MASK		(UL(0xf) << ID_AA64ISAR0_SHA3_SHIFT)
 #define	ID_AA64ISAR0_SHA3(x)		((x) & ID_AA64ISAR0_SHA3_MASK)
-#define	 ID_AA64ISAR0_SHA3_NONE		(0x0ul << ID_AA64ISAR0_SHA3_SHIFT)
-#define	 ID_AA64ISAR0_SHA3_IMPL		(0x1ul << ID_AA64ISAR0_SHA3_SHIFT)
+#define	 ID_AA64ISAR0_SHA3_NONE		(UL(0x0) << ID_AA64ISAR0_SHA3_SHIFT)
+#define	 ID_AA64ISAR0_SHA3_IMPL		(UL(0x1) << ID_AA64ISAR0_SHA3_SHIFT)
 #define	ID_AA64ISAR0_SM3_SHIFT		36
-#define	ID_AA64ISAR0_SM3_MASK		(0xful << ID_AA64ISAR0_SM3_SHIFT)
+#define	ID_AA64ISAR0_SM3_MASK		(UL(0xf) << ID_AA64ISAR0_SM3_SHIFT)
 #define	ID_AA64ISAR0_SM3(x)		((x) & ID_AA64ISAR0_SM3_MASK)
-#define	 ID_AA64ISAR0_SM3_NONE		(0x0ul << ID_AA64ISAR0_SM3_SHIFT)
-#define	 ID_AA64ISAR0_SM3_IMPL		(0x1ul << ID_AA64ISAR0_SM3_SHIFT)
+#define	 ID_AA64ISAR0_SM3_NONE		(UL(0x0) << ID_AA64ISAR0_SM3_SHIFT)
+#define	 ID_AA64ISAR0_SM3_IMPL		(UL(0x1) << ID_AA64ISAR0_SM3_SHIFT)
 #define	ID_AA64ISAR0_SM4_SHIFT		40
-#define	ID_AA64ISAR0_SM4_MASK		(0xful << ID_AA64ISAR0_SM4_SHIFT)
+#define	ID_AA64ISAR0_SM4_MASK		(UL(0xf) << ID_AA64ISAR0_SM4_SHIFT)
 #define	ID_AA64ISAR0_SM4(x)		((x) & ID_AA64ISAR0_SM4_MASK)
-#define	 ID_AA64ISAR0_SM4_NONE		(0x0ul << ID_AA64ISAR0_SM4_SHIFT)
-#define	 ID_AA64ISAR0_SM4_IMPL		(0x1ul << ID_AA64ISAR0_SM4_SHIFT)
+#define	 ID_AA64ISAR0_SM4_NONE		(UL(0x0) << ID_AA64ISAR0_SM4_SHIFT)
+#define	 ID_AA64ISAR0_SM4_IMPL		(UL(0x1) << ID_AA64ISAR0_SM4_SHIFT)
 #define	ID_AA64ISAR0_DP_SHIFT		44
-#define	ID_AA64ISAR0_DP_MASK		(0xful << ID_AA64ISAR0_DP_SHIFT)
+#define	ID_AA64ISAR0_DP_MASK		(UL(0xf) << ID_AA64ISAR0_DP_SHIFT)
 #define	ID_AA64ISAR0_DP(x)		((x) & ID_AA64ISAR0_DP_MASK)
-#define	 ID_AA64ISAR0_DP_NONE		(0x0ul << ID_AA64ISAR0_DP_SHIFT)
-#define	 ID_AA64ISAR0_DP_IMPL		(0x1ul << ID_AA64ISAR0_DP_SHIFT)
+#define	 ID_AA64ISAR0_DP_NONE		(UL(0x0) << ID_AA64ISAR0_DP_SHIFT)
+#define	 ID_AA64ISAR0_DP_IMPL		(UL(0x1) << ID_AA64ISAR0_DP_SHIFT)
 
 /* ID_AA64ISAR1_EL1 */
 #define	ID_AA64ISAR1_MASK		0xffffffff
 #define	ID_AA64ISAR1_DPB_SHIFT		0
-#define	ID_AA64ISAR1_DPB_MASK		(0xf << ID_AA64ISAR1_DPB_SHIFT)
+#define	ID_AA64ISAR1_DPB_MASK		(UL(0xf) << ID_AA64ISAR1_DPB_SHIFT)
 #define	ID_AA64ISAR1_DPB(x)		((x) & ID_AA64ISAR1_DPB_MASK)
-#define	 ID_AA64ISAR1_DPB_NONE		(0x0 << ID_AA64ISAR1_DPB_SHIFT)
-#define	 ID_AA64ISAR1_DPB_IMPL		(0x1 << ID_AA64ISAR1_DPB_SHIFT)
+#define	 ID_AA64ISAR1_DPB_NONE		(UL(0x0) << ID_AA64ISAR1_DPB_SHIFT)
+#define	 ID_AA64ISAR1_DPB_IMPL		(UL(0x1) << ID_AA64ISAR1_DPB_SHIFT)
 #define	ID_AA64ISAR1_APA_SHIFT		4
-#define	ID_AA64ISAR1_APA_MASK		(0xf << ID_AA64ISAR1_APA_SHIFT)
+#define	ID_AA64ISAR1_APA_MASK		(UL(0xf) << ID_AA64ISAR1_APA_SHIFT)
 #define	ID_AA64ISAR1_APA(x)		((x) & ID_AA64ISAR1_APA_MASK)
-#define	 ID_AA64ISAR1_APA_NONE		(0x0 << ID_AA64ISAR1_APA_SHIFT)
-#define	 ID_AA64ISAR1_APA_IMPL		(0x1 << ID_AA64ISAR1_APA_SHIFT)
+#define	 ID_AA64ISAR1_APA_NONE		(UL(0x0) << ID_AA64ISAR1_APA_SHIFT)
+#define	 ID_AA64ISAR1_APA_IMPL		(UL(0x1) << ID_AA64ISAR1_APA_SHIFT)
 #define	ID_AA64ISAR1_API_SHIFT		8
-#define	ID_AA64ISAR1_API_MASK		(0xf << ID_AA64ISAR1_API_SHIFT)
+#define	ID_AA64ISAR1_API_MASK		(UL(0xf) << ID_AA64ISAR1_API_SHIFT)
 #define	ID_AA64ISAR1_API(x)		((x) & ID_AA64ISAR1_API_MASK)
-#define	 ID_AA64ISAR1_API_NONE		(0x0 << ID_AA64ISAR1_API_SHIFT)
-#define	 ID_AA64ISAR1_API_IMPL		(0x1 << ID_AA64ISAR1_API_SHIFT)
+#define	 ID_AA64ISAR1_API_NONE		(UL(0x0) << ID_AA64ISAR1_API_SHIFT)
+#define	 ID_AA64ISAR1_API_IMPL		(UL(0x1) << ID_AA64ISAR1_API_SHIFT)
 #define	ID_AA64ISAR1_JSCVT_SHIFT	12
-#define	ID_AA64ISAR1_JSCVT_MASK		(0xf << ID_AA64ISAR1_JSCVT_SHIFT)
+#define	ID_AA64ISAR1_JSCVT_MASK		(UL(0xf) << ID_AA64ISAR1_JSCVT_SHIFT)
 #define	ID_AA64ISAR1_JSCVT(x)		((x) & ID_AA64ISAR1_JSCVT_MASK)
-#define	 ID_AA64ISAR1_JSCVT_NONE	(0x0 << ID_AA64ISAR1_JSCVT_SHIFT)
-#define	 ID_AA64ISAR1_JSCVT_IMPL	(0x1 << ID_AA64ISAR1_JSCVT_SHIFT)
+#define	 ID_AA64ISAR1_JSCVT_NONE	(UL(0x0) << ID_AA64ISAR1_JSCVT_SHIFT)
+#define	 ID_AA64ISAR1_JSCVT_IMPL	(UL(0x1) << ID_AA64ISAR1_JSCVT_SHIFT)
 #define	ID_AA64ISAR1_FCMA_SHIFT		16
-#define	ID_AA64ISAR1_FCMA_MASK		(0xf << ID_AA64ISAR1_FCMA_SHIFT)
+#define	ID_AA64ISAR1_FCMA_MASK		(UL(0xf) << ID_AA64ISAR1_FCMA_SHIFT)
 #define	ID_AA64ISAR1_FCMA(x)		((x) & ID_AA64ISAR1_FCMA_MASK)
-#define	 ID_AA64ISAR1_FCMA_NONE		(0x0 << ID_AA64ISAR1_FCMA_SHIFT)
-#define	 ID_AA64ISAR1_FCMA_IMPL		(0x1 << ID_AA64ISAR1_FCMA_SHIFT)
+#define	 ID_AA64ISAR1_FCMA_NONE		(UL(0x0) << ID_AA64ISAR1_FCMA_SHIFT)
+#define	 ID_AA64ISAR1_FCMA_IMPL		(UL(0x1) << ID_AA64ISAR1_FCMA_SHIFT)
 #define	ID_AA64ISAR1_LRCPC_SHIFT	20
-#define	ID_AA64ISAR1_LRCPC_MASK		(0xf << ID_AA64ISAR1_LRCPC_SHIFT)
+#define	ID_AA64ISAR1_LRCPC_MASK		(UL(0xf) << ID_AA64ISAR1_LRCPC_SHIFT)
 #define	ID_AA64ISAR1_LRCPC(x)		((x) & ID_AA64ISAR1_LRCPC_MASK)
-#define	 ID_AA64ISAR1_LRCPC_NONE	(0x0 << ID_AA64ISAR1_LRCPC_SHIFT)
-#define	 ID_AA64ISAR1_LRCPC_IMPL	(0x1 << ID_AA64ISAR1_LRCPC_SHIFT)
+#define	 ID_AA64ISAR1_LRCPC_NONE	(UL(0x0) << ID_AA64ISAR1_LRCPC_SHIFT)
+#define	 ID_AA64ISAR1_LRCPC_IMPL	(UL(0x1) << ID_AA64ISAR1_LRCPC_SHIFT)
 #define	ID_AA64ISAR1_GPA_SHIFT		24
-#define	ID_AA64ISAR1_GPA_MASK		(0xf << ID_AA64ISAR1_GPA_SHIFT)
+#define	ID_AA64ISAR1_GPA_MASK		(UL(0xf) << ID_AA64ISAR1_GPA_SHIFT)
 #define	ID_AA64ISAR1_GPA(x)		((x) & ID_AA64ISAR1_GPA_MASK)
-#define	 ID_AA64ISAR1_GPA_NONE		(0x0 << ID_AA64ISAR1_GPA_SHIFT)
-#define	 ID_AA64ISAR1_GPA_IMPL		(0x1 << ID_AA64ISAR1_GPA_SHIFT)
+#define	 ID_AA64ISAR1_GPA_NONE		(UL(0x0) << ID_AA64ISAR1_GPA_SHIFT)
+#define	 ID_AA64ISAR1_GPA_IMPL		(UL(0x1) << ID_AA64ISAR1_GPA_SHIFT)
 #define	ID_AA64ISAR1_GPI_SHIFT		28
-#define	ID_AA64ISAR1_GPI_MASK		(0xf << ID_AA64ISAR1_GPI_SHIFT)
+#define	ID_AA64ISAR1_GPI_MASK		(UL(0xf) << ID_AA64ISAR1_GPI_SHIFT)
 #define	ID_AA64ISAR1_GPI(x)		((x) & ID_AA64ISAR1_GPI_MASK)
-#define	 ID_AA64ISAR1_GPI_NONE		(0x0 << ID_AA64ISAR1_GPI_SHIFT)
-#define	 ID_AA64ISAR1_GPI_IMPL		(0x1 << ID_AA64ISAR1_GPI_SHIFT)
+#define	 ID_AA64ISAR1_GPI_NONE		(UL(0x0) << ID_AA64ISAR1_GPI_SHIFT)
+#define	 ID_AA64ISAR1_GPI_IMPL		(UL(0x1) << ID_AA64ISAR1_GPI_SHIFT)
 
 /* ID_AA64MMFR0_EL1 */
 #define	ID_AA64MMFR0_MASK		0xffffffff
 #define	ID_AA64MMFR0_PARange_SHIFT	0
-#define	ID_AA64MMFR0_PARange_MASK	(0xf << ID_AA64MMFR0_PARange_SHIFT)
+#define	ID_AA64MMFR0_PARange_MASK	(UL(0xf) << ID_AA64MMFR0_PARange_SHIFT)
 #define	ID_AA64MMFR0_PARange(x)		((x) & ID_AA64MMFR0_PARange_MASK)
-#define	 ID_AA64MMFR0_PARange_4G	(0x0 << ID_AA64MMFR0_PARange_SHIFT)
-#define	 ID_AA64MMFR0_PARange_64G	(0x1 << ID_AA64MMFR0_PARange_SHIFT)
-#define	 ID_AA64MMFR0_PARange_1T	(0x2 << ID_AA64MMFR0_PARange_SHIFT)
-#define	 ID_AA64MMFR0_PARange_4T	(0x3 << ID_AA64MMFR0_PARange_SHIFT)
-#define	 ID_AA64MMFR0_PARange_16T	(0x4 << ID_AA64MMFR0_PARange_SHIFT)
-#define	 ID_AA64MMFR0_PARange_256T	(0x5 << ID_AA64MMFR0_PARange_SHIFT)
-#define	 ID_AA64MMFR0_PARange_4P	(0x6 << ID_AA64MMFR0_PARange_SHIFT)
+#define	 ID_AA64MMFR0_PARange_4G	(UL(0x0) << ID_AA64MMFR0_PARange_SHIFT)
+#define	 ID_AA64MMFR0_PARange_64G	(UL(0x1) << ID_AA64MMFR0_PARange_SHIFT)
+#define	 ID_AA64MMFR0_PARange_1T	(UL(0x2) << ID_AA64MMFR0_PARange_SHIFT)
+#define	 ID_AA64MMFR0_PARange_4T	(UL(0x3) << ID_AA64MMFR0_PARange_SHIFT)
+#define	 ID_AA64MMFR0_PARange_16T	(UL(0x4) << ID_AA64MMFR0_PARange_SHIFT)
+#define	 ID_AA64MMFR0_PARange_256T	(UL(0x5) << ID_AA64MMFR0_PARange_SHIFT)
+#define	 ID_AA64MMFR0_PARange_4P	(UL(0x6) << ID_AA64MMFR0_PARange_SHIFT)
 #define	ID_AA64MMFR0_ASIDBits_SHIFT	4
-#define	ID_AA64MMFR0_ASIDBits_MASK	(0xf << ID_AA64MMFR0_ASIDBits_SHIFT)
+#define	ID_AA64MMFR0_ASIDBits_MASK	(UL(0xf) << ID_AA64MMFR0_ASIDBits_SHIFT)
 #define	ID_AA64MMFR0_ASIDBits(x)	((x) & ID_AA64MMFR0_ASIDBits_MASK)
-#define	 ID_AA64MMFR0_ASIDBits_8	(0x0 << ID_AA64MMFR0_ASIDBits_SHIFT)
-#define	 ID_AA64MMFR0_ASIDBits_16	(0x2 << ID_AA64MMFR0_ASIDBits_SHIFT)
+#define	 ID_AA64MMFR0_ASIDBits_8	(UL(0x0) << ID_AA64MMFR0_ASIDBits_SHIFT)
+#define	 ID_AA64MMFR0_ASIDBits_16	(UL(0x2) << ID_AA64MMFR0_ASIDBits_SHIFT)
 #define	ID_AA64MMFR0_BigEnd_SHIFT	8
-#define	ID_AA64MMFR0_BigEnd_MASK	(0xf << ID_AA64MMFR0_BigEnd_SHIFT)
+#define	ID_AA64MMFR0_BigEnd_MASK	(UL(0xf) << ID_AA64MMFR0_BigEnd_SHIFT)
 #define	ID_AA64MMFR0_BigEnd(x)		((x) & ID_AA64MMFR0_BigEnd_MASK)
-#define	 ID_AA64MMFR0_BigEnd_FIXED	(0x0 << ID_AA64MMFR0_BigEnd_SHIFT)
-#define	 ID_AA64MMFR0_BigEnd_MIXED	(0x1 << ID_AA64MMFR0_BigEnd_SHIFT)
+#define	 ID_AA64MMFR0_BigEnd_FIXED	(UL(0x0) << ID_AA64MMFR0_BigEnd_SHIFT)
+#define	 ID_AA64MMFR0_BigEnd_MIXED	(UL(0x1) << ID_AA64MMFR0_BigEnd_SHIFT)
 #define	ID_AA64MMFR0_SNSMem_SHIFT	12
-#define	ID_AA64MMFR0_SNSMem_MASK	(0xf << ID_AA64MMFR0_SNSMem_SHIFT)
+#define	ID_AA64MMFR0_SNSMem_MASK	(UL(0xf) << ID_AA64MMFR0_SNSMem_SHIFT)
 #define	ID_AA64MMFR0_SNSMem(x)		((x) & ID_AA64MMFR0_SNSMem_MASK)
-#define	 ID_AA64MMFR0_SNSMem_NONE	(0x0 << ID_AA64MMFR0_SNSMem_SHIFT)
-#define	 ID_AA64MMFR0_SNSMem_DISTINCT	(0x1 << ID_AA64MMFR0_SNSMem_SHIFT)
+#define	 ID_AA64MMFR0_SNSMem_NONE	(UL(0x0) << ID_AA64MMFR0_SNSMem_SHIFT)
+#define	 ID_AA64MMFR0_SNSMem_DISTINCT	(UL(0x1) << ID_AA64MMFR0_SNSMem_SHIFT)
 #define	ID_AA64MMFR0_BigEndEL0_SHIFT	16
-#define	ID_AA64MMFR0_BigEndEL0_MASK	(0xf << ID_AA64MMFR0_BigEndEL0_SHIFT)
+#define	ID_AA64MMFR0_BigEndEL0_MASK	(UL(0xf) << ID_AA64MMFR0_BigEndEL0_SHIFT)
 #define	ID_AA64MMFR0_BigEndEL0(x)	((x) & ID_AA64MMFR0_BigEndEL0_MASK)
-#define	 ID_AA64MMFR0_BigEndEL0_FIXED	(0x0 << ID_AA64MMFR0_BigEndEL0_SHIFT)
-#define	 ID_AA64MMFR0_BigEndEL0_MIXED	(0x1 << ID_AA64MMFR0_BigEndEL0_SHIFT)
+#define	 ID_AA64MMFR0_BigEndEL0_FIXED	(UL(0x0) << ID_AA64MMFR0_BigEndEL0_SHIFT)
+#define	 ID_AA64MMFR0_BigEndEL0_MIXED	(UL(0x1) << ID_AA64MMFR0_BigEndEL0_SHIFT)
 #define	ID_AA64MMFR0_TGran16_SHIFT	20
-#define	ID_AA64MMFR0_TGran16_MASK	(0xf << ID_AA64MMFR0_TGran16_SHIFT)
+#define	ID_AA64MMFR0_TGran16_MASK	(UL(0xf) << ID_AA64MMFR0_TGran16_SHIFT)
 #define	ID_AA64MMFR0_TGran16(x)		((x) & ID_AA64MMFR0_TGran16_MASK)
-#define	 ID_AA64MMFR0_TGran16_NONE	(0x0 << ID_AA64MMFR0_TGran16_SHIFT)
-#define	 ID_AA64MMFR0_TGran16_IMPL	(0x1 << ID_AA64MMFR0_TGran16_SHIFT)
+#define	 ID_AA64MMFR0_TGran16_NONE	(UL(0x0) << ID_AA64MMFR0_TGran16_SHIFT)
+#define	 ID_AA64MMFR0_TGran16_IMPL	(UL(0x1) << ID_AA64MMFR0_TGran16_SHIFT)
 #define	ID_AA64MMFR0_TGran64_SHIFT	24
-#define	ID_AA64MMFR0_TGran64_MASK	(0xf << ID_AA64MMFR0_TGran64_SHIFT)
+#define	ID_AA64MMFR0_TGran64_MASK	(UL(0xf) << ID_AA64MMFR0_TGran64_SHIFT)
 #define	ID_AA64MMFR0_TGran64(x)		((x) & ID_AA64MMFR0_TGran64_MASK)
-#define	 ID_AA64MMFR0_TGran64_IMPL	(0x0 << ID_AA64MMFR0_TGran64_SHIFT)
-#define	 ID_AA64MMFR0_TGran64_NONE	(0xf << ID_AA64MMFR0_TGran64_SHIFT)
+#define	 ID_AA64MMFR0_TGran64_IMPL	(UL(0x0) << ID_AA64MMFR0_TGran64_SHIFT)
+#define	 ID_AA64MMFR0_TGran64_NONE	(UL(0xf) << ID_AA64MMFR0_TGran64_SHIFT)
 #define	ID_AA64MMFR0_TGran4_SHIFT	28
-#define	ID_AA64MMFR0_TGran4_MASK	(0xf << ID_AA64MMFR0_TGran4_SHIFT)
+#define	ID_AA64MMFR0_TGran4_MASK	(UL(0xf) << ID_AA64MMFR0_TGran4_SHIFT)
 #define	ID_AA64MMFR0_TGran4(x)		((x) & ID_AA64MMFR0_TGran4_MASK)
-#define	 ID_AA64MMFR0_TGran4_IMPL	(0x0 << ID_AA64MMFR0_TGran4_SHIFT)
-#define	 ID_AA64MMFR0_TGran4_NONE	(0xf << ID_AA64MMFR0_TGran4_SHIFT)
+#define	 ID_AA64MMFR0_TGran4_IMPL	(UL(0x0) << ID_AA64MMFR0_TGran4_SHIFT)
+#define	 ID_AA64MMFR0_TGran4_NONE	(UL(0xf) << ID_AA64MMFR0_TGran4_SHIFT)
 
 /* ID_AA64MMFR1_EL1 */
 #define	ID_AA64MMFR1_MASK		0xffffffff
 #define	ID_AA64MMFR1_HAFDBS_SHIFT	0
-#define	ID_AA64MMFR1_HAFDBS_MASK	(0xf << ID_AA64MMFR1_HAFDBS_SHIFT)
+#define	ID_AA64MMFR1_HAFDBS_MASK	(UL(0xf) << ID_AA64MMFR1_HAFDBS_SHIFT)
 #define	ID_AA64MMFR1_HAFDBS(x)		((x) & ID_AA64MMFR1_HAFDBS_MASK)
-#define	 ID_AA64MMFR1_HAFDBS_NONE	(0x0 << ID_AA64MMFR1_HAFDBS_SHIFT)
-#define	 ID_AA64MMFR1_HAFDBS_AF		(0x1 << ID_AA64MMFR1_HAFDBS_SHIFT)
-#define	 ID_AA64MMFR1_HAFDBS_AF_DBS	(0x2 << ID_AA64MMFR1_HAFDBS_SHIFT)
+#define	 ID_AA64MMFR1_HAFDBS_NONE	(UL(0x0) << ID_AA64MMFR1_HAFDBS_SHIFT)
+#define	 ID_AA64MMFR1_HAFDBS_AF		(UL(0x1) << ID_AA64MMFR1_HAFDBS_SHIFT)
+#define	 ID_AA64MMFR1_HAFDBS_AF_DBS	(UL(0x2) << ID_AA64MMFR1_HAFDBS_SHIFT)
 #define	ID_AA64MMFR1_VMIDBits_SHIFT	4
-#define	ID_AA64MMFR1_VMIDBits_MASK	(0xf << ID_AA64MMFR1_VMIDBits_SHIFT)
+#define	ID_AA64MMFR1_VMIDBits_MASK	(UL(0xf) << ID_AA64MMFR1_VMIDBits_SHIFT)
 #define	ID_AA64MMFR1_VMIDBits(x)	((x) & ID_AA64MMFR1_VMIDBits_MASK)
-#define	 ID_AA64MMFR1_VMIDBits_8	(0x0 << ID_AA64MMFR1_VMIDBits_SHIFT)
-#define	 ID_AA64MMFR1_VMIDBits_16	(0x2 << ID_AA64MMFR1_VMIDBits_SHIFT)
+#define	 ID_AA64MMFR1_VMIDBits_8	(UL(0x0) << ID_AA64MMFR1_VMIDBits_SHIFT)
+#define	 ID_AA64MMFR1_VMIDBits_16	(UL(0x2) << ID_AA64MMFR1_VMIDBits_SHIFT)
 #define	ID_AA64MMFR1_VH_SHIFT		8
-#define	ID_AA64MMFR1_VH_MASK		(0xf << ID_AA64MMFR1_VH_SHIFT)
+#define	ID_AA64MMFR1_VH_MASK		(UL(0xf) << ID_AA64MMFR1_VH_SHIFT)
 #define	ID_AA64MMFR1_VH(x)		((x) & ID_AA64MMFR1_VH_MASK)
-#define	 ID_AA64MMFR1_VH_NONE		(0x0 << ID_AA64MMFR1_VH_SHIFT)
-#define	 ID_AA64MMFR1_VH_IMPL		(0x1 << ID_AA64MMFR1_VH_SHIFT)
+#define	 ID_AA64MMFR1_VH_NONE		(UL(0x0) << ID_AA64MMFR1_VH_SHIFT)
+#define	 ID_AA64MMFR1_VH_IMPL		(UL(0x1) << ID_AA64MMFR1_VH_SHIFT)
 #define	ID_AA64MMFR1_HPDS_SHIFT		12
-#define	ID_AA64MMFR1_HPDS_MASK		(0xf << ID_AA64MMFR1_HPDS_SHIFT)
+#define	ID_AA64MMFR1_HPDS_MASK		(UL(0xf) << ID_AA64MMFR1_HPDS_SHIFT)
 #define	ID_AA64MMFR1_HPDS(x)		((x) & ID_AA64MMFR1_HPDS_MASK)
-#define	 ID_AA64MMFR1_HPDS_NONE		(0x0 << ID_AA64MMFR1_HPDS_SHIFT)
-#define	 ID_AA64MMFR1_HPDS_HPD		(0x1 << ID_AA64MMFR1_HPDS_SHIFT)
-#define	 ID_AA64MMFR1_HPDS_TTPBHA	(0x2 << ID_AA64MMFR1_HPDS_SHIFT)
+#define	 ID_AA64MMFR1_HPDS_NONE		(UL(0x0) << ID_AA64MMFR1_HPDS_SHIFT)
+#define	 ID_AA64MMFR1_HPDS_HPD		(UL(0x1) << ID_AA64MMFR1_HPDS_SHIFT)
+#define	 ID_AA64MMFR1_HPDS_TTPBHA	(UL(0x2) << ID_AA64MMFR1_HPDS_SHIFT)
 #define	ID_AA64MMFR1_LO_SHIFT		16
-#define	ID_AA64MMFR1_LO_MASK		(0xf << ID_AA64MMFR1_LO_SHIFT)
+#define	ID_AA64MMFR1_LO_MASK		(UL(0xf) << ID_AA64MMFR1_LO_SHIFT)
 #define	ID_AA64MMFR1_LO(x)		((x) & ID_AA64MMFR1_LO_MASK)
-#define	 ID_AA64MMFR1_LO_NONE		(0x0 << ID_AA64MMFR1_LO_SHIFT)
-#define	 ID_AA64MMFR1_LO_IMPL		(0x1 << ID_AA64MMFR1_LO_SHIFT)
+#define	 ID_AA64MMFR1_LO_NONE		(UL(0x0) << ID_AA64MMFR1_LO_SHIFT)
+#define	 ID_AA64MMFR1_LO_IMPL		(UL(0x1) << ID_AA64MMFR1_LO_SHIFT)
 #define	ID_AA64MMFR1_PAN_SHIFT		20
-#define	ID_AA64MMFR1_PAN_MASK		(0xf << ID_AA64MMFR1_PAN_SHIFT)
+#define	ID_AA64MMFR1_PAN_MASK		(UL(0xf) << ID_AA64MMFR1_PAN_SHIFT)
 #define	ID_AA64MMFR1_PAN(x)		((x) & ID_AA64MMFR1_PAN_MASK)
-#define	 ID_AA64MMFR1_PAN_NONE		(0x0 << ID_AA64MMFR1_PAN_SHIFT)
-#define	 ID_AA64MMFR1_PAN_IMPL		(0x1 << ID_AA64MMFR1_PAN_SHIFT)
-#define	 ID_AA64MMFR1_PAN_ATS1E1	(0x2 << ID_AA64MMFR1_PAN_SHIFT)
+#define	 ID_AA64MMFR1_PAN_NONE		(UL(0x0) << ID_AA64MMFR1_PAN_SHIFT)
+#define	 ID_AA64MMFR1_PAN_IMPL		(UL(0x1) << ID_AA64MMFR1_PAN_SHIFT)
+#define	 ID_AA64MMFR1_PAN_ATS1E1	(UL(0x2) << ID_AA64MMFR1_PAN_SHIFT)
 #define	ID_AA64MMFR1_SpecSEI_SHIFT	24
-#define	ID_AA64MMFR1_SpecSEI_MASK	(0xf << ID_AA64MMFR1_SpecSEI_SHIFT)
+#define	ID_AA64MMFR1_SpecSEI_MASK	(UL(0xf) << ID_AA64MMFR1_SpecSEI_SHIFT)
 #define	ID_AA64MMFR1_SpecSEI(x)		((x) & ID_AA64MMFR1_SpecSEI_MASK)
-#define	 ID_AA64MMFR1_SpecSEI_NONE	(0x0 << ID_AA64MMFR1_SpecSEI_SHIFT)
-#define	 ID_AA64MMFR1_SpecSEI_IMPL	(0x1 << ID_AA64MMFR1_SpecSEI_SHIFT)
+#define	 ID_AA64MMFR1_SpecSEI_NONE	(UL(0x0) << ID_AA64MMFR1_SpecSEI_SHIFT)
+#define	 ID_AA64MMFR1_SpecSEI_IMPL	(UL(0x1) << ID_AA64MMFR1_SpecSEI_SHIFT)
 #define	ID_AA64MMFR1_XNX_SHIFT		28
-#define	ID_AA64MMFR1_XNX_MASK		(0xf << ID_AA64MMFR1_XNX_SHIFT)
+#define	ID_AA64MMFR1_XNX_MASK		(UL(0xf) << ID_AA64MMFR1_XNX_SHIFT)
 #define	ID_AA64MMFR1_XNX(x)		((x) & ID_AA64MMFR1_XNX_MASK)
-#define	 ID_AA64MMFR1_XNX_NONE		(0x0 << ID_AA64MMFR1_XNX_SHIFT)
-#define	 ID_AA64MMFR1_XNX_IMPL		(0x1 << ID_AA64MMFR1_XNX_SHIFT)
+#define	 ID_AA64MMFR1_XNX_NONE		(UL(0x0) << ID_AA64MMFR1_XNX_SHIFT)
+#define	 ID_AA64MMFR1_XNX_IMPL		(UL(0x1) << ID_AA64MMFR1_XNX_SHIFT)
 
 /* ID_AA64MMFR2_EL1 */
 #define	ID_AA64MMFR2_EL1		S3_0_C0_C7_2
 #define	ID_AA64MMFR2_MASK		0x0fffffff
 #define	ID_AA64MMFR2_CnP_SHIFT		0
-#define	ID_AA64MMFR2_CnP_MASK		(0xf << ID_AA64MMFR2_CnP_SHIFT)
+#define	ID_AA64MMFR2_CnP_MASK		(UL(0xf) << ID_AA64MMFR2_CnP_SHIFT)
 #define	ID_AA64MMFR2_CnP(x)		((x) & ID_AA64MMFR2_CnP_MASK)
-#define	 ID_AA64MMFR2_CnP_NONE		(0x0 << ID_AA64MMFR2_CnP_SHIFT)
-#define	 ID_AA64MMFR2_CnP_IMPL		(0x1 << ID_AA64MMFR2_CnP_SHIFT)
+#define	 ID_AA64MMFR2_CnP_NONE		(UL(0x0) << ID_AA64MMFR2_CnP_SHIFT)
+#define	 ID_AA64MMFR2_CnP_IMPL		(UL(0x1) << ID_AA64MMFR2_CnP_SHIFT)
 #define	ID_AA64MMFR2_UAO_SHIFT		4
-#define	ID_AA64MMFR2_UAO_MASK		(0xf << ID_AA64MMFR2_UAO_SHIFT)
+#define	ID_AA64MMFR2_UAO_MASK		(UL(0xf) << ID_AA64MMFR2_UAO_SHIFT)
 #define	ID_AA64MMFR2_UAO(x)		((x) & ID_AA64MMFR2_UAO_MASK)
-#define	 ID_AA64MMFR2_UAO_NONE		(0x0 << ID_AA64MMFR2_UAO_SHIFT)
-#define	 ID_AA64MMFR2_UAO_IMPL		(0x1 << ID_AA64MMFR2_UAO_SHIFT)
+#define	 ID_AA64MMFR2_UAO_NONE		(UL(0x0) << ID_AA64MMFR2_UAO_SHIFT)
+#define	 ID_AA64MMFR2_UAO_IMPL		(UL(0x1) << ID_AA64MMFR2_UAO_SHIFT)
 #define	ID_AA64MMFR2_LSM_SHIFT		8
-#define	ID_AA64MMFR2_LSM_MASK		(0xf << ID_AA64MMFR2_LSM_SHIFT)
+#define	ID_AA64MMFR2_LSM_MASK		(UL(0xf) << ID_AA64MMFR2_LSM_SHIFT)
 #define	ID_AA64MMFR2_LSM(x)		((x) & ID_AA64MMFR2_LSM_MASK)
-#define	 ID_AA64MMFR2_LSM_NONE		(0x0 << ID_AA64MMFR2_LSM_SHIFT)
-#define	 ID_AA64MMFR2_LSM_IMPL		(0x1 << ID_AA64MMFR2_LSM_SHIFT)
+#define	 ID_AA64MMFR2_LSM_NONE		(UL(0x0) << ID_AA64MMFR2_LSM_SHIFT)
+#define	 ID_AA64MMFR2_LSM_IMPL		(UL(0x1) << ID_AA64MMFR2_LSM_SHIFT)
 #define	ID_AA64MMFR2_IESB_SHIFT		12
-#define	ID_AA64MMFR2_IESB_MASK		(0xf << ID_AA64MMFR2_IESB_SHIFT)
+#define	ID_AA64MMFR2_IESB_MASK		(UL(0xf) << ID_AA64MMFR2_IESB_SHIFT)
 #define	ID_AA64MMFR2_IESB(x)		((x) & ID_AA64MMFR2_IESB_MASK)
-#define	 ID_AA64MMFR2_IESB_NONE		(0x0 << ID_AA64MMFR2_IESB_SHIFT)
-#define	 ID_AA64MMFR2_IESB_IMPL		(0x1 << ID_AA64MMFR2_IESB_SHIFT)
+#define	 ID_AA64MMFR2_IESB_NONE		(UL(0x0) << ID_AA64MMFR2_IESB_SHIFT)
+#define	 ID_AA64MMFR2_IESB_IMPL		(UL(0x1) << ID_AA64MMFR2_IESB_SHIFT)
 #define	ID_AA64MMFR2_VARange_SHIFT	16
-#define	ID_AA64MMFR2_VARange_MASK	(0xf << ID_AA64MMFR2_VARange_SHIFT)
+#define	ID_AA64MMFR2_VARange_MASK	(UL(0xf) << ID_AA64MMFR2_VARange_SHIFT)
 #define	ID_AA64MMFR2_VARange(x)		((x) & ID_AA64MMFR2_VARange_MASK)
-#define	 ID_AA64MMFR2_VARange_48	(0x0 << ID_AA64MMFR2_VARange_SHIFT)
-#define	 ID_AA64MMFR2_VARange_52	(0x1 << ID_AA64MMFR2_VARange_SHIFT)
+#define	 ID_AA64MMFR2_VARange_48	(UL(0x0) << ID_AA64MMFR2_VARange_SHIFT)
+#define	 ID_AA64MMFR2_VARange_52	(UL(0x1) << ID_AA64MMFR2_VARange_SHIFT)
 #define	ID_AA64MMFR2_CCIDX_SHIFT	20
-#define	ID_AA64MMFR2_CCIDX_MASK		(0xf << ID_AA64MMFR2_CCIDX_SHIFT)
+#define	ID_AA64MMFR2_CCIDX_MASK		(UL(0xf) << ID_AA64MMFR2_CCIDX_SHIFT)
 #define	ID_AA64MMFR2_CCIDX(x)		((x) & ID_AA64MMFR2_CCIDX_MASK)
-#define	 ID_AA64MMFR2_CCIDX_32		(0x0 << ID_AA64MMFR2_CCIDX_SHIFT)
-#define	 ID_AA64MMFR2_CCIDX_64		(0x1 << ID_AA64MMFR2_CCIDX_SHIFT)
+#define	 ID_AA64MMFR2_CCIDX_32		(UL(0x0) << ID_AA64MMFR2_CCIDX_SHIFT)
+#define	 ID_AA64MMFR2_CCIDX_64		(UL(0x1) << ID_AA64MMFR2_CCIDX_SHIFT)
 #define	ID_AA64MMFR2_NV_SHIFT		24
-#define	ID_AA64MMFR2_NV_MASK		(0xf << ID_AA64MMFR2_NV_SHIFT)
+#define	ID_AA64MMFR2_NV_MASK		(UL(0xf) << ID_AA64MMFR2_NV_SHIFT)
 #define	ID_AA64MMFR2_NV(x)		((x) & ID_AA64MMFR2_NV_MASK)
-#define	 ID_AA64MMFR2_NV_NONE		(0x0 << ID_AA64MMFR2_NV_SHIFT)
-#define	 ID_AA64MMFR2_NV_IMPL		(0x1 << ID_AA64MMFR2_NV_SHIFT)
+#define	 ID_AA64MMFR2_NV_NONE		(UL(0x0) << ID_AA64MMFR2_NV_SHIFT)
+#define	 ID_AA64MMFR2_NV_IMPL		(UL(0x1) << ID_AA64MMFR2_NV_SHIFT)
 
 /* ID_AA64PFR0_EL1 */
 #define	ID_AA64PFR0_MASK		0x0000000ffffffffful
 #define	ID_AA64PFR0_EL0_SHIFT		0
-#define	ID_AA64PFR0_EL0_MASK		(0xf << ID_AA64PFR0_EL0_SHIFT)
+#define	ID_AA64PFR0_EL0_MASK		(UL(0xf) << ID_AA64PFR0_EL0_SHIFT)
 #define	ID_AA64PFR0_EL0(x)		((x) & ID_AA64PFR0_EL0_MASK)
-#define	 ID_AA64PFR0_EL0_64		(1 << ID_AA64PFR0_EL0_SHIFT)
-#define	 ID_AA64PFR0_EL0_64_32		(2 << ID_AA64PFR0_EL0_SHIFT)
+#define	 ID_AA64PFR0_EL0_64		(UL(0x1) << ID_AA64PFR0_EL0_SHIFT)
+#define	 ID_AA64PFR0_EL0_64_32		(UL(0x2) << ID_AA64PFR0_EL0_SHIFT)
 #define	ID_AA64PFR0_EL1_SHIFT		4
-#define	ID_AA64PFR0_EL1_MASK		(0xf << ID_AA64PFR0_EL1_SHIFT)
+#define	ID_AA64PFR0_EL1_MASK		(UL(0xf) << ID_AA64PFR0_EL1_SHIFT)
 #define	ID_AA64PFR0_EL1(x)		((x) & ID_AA64PFR0_EL1_MASK)
-#define	 ID_AA64PFR0_EL1_64		(1 << ID_AA64PFR0_EL1_SHIFT)
-#define	 ID_AA64PFR0_EL1_64_32		(2 << ID_AA64PFR0_EL1_SHIFT)
+#define	 ID_AA64PFR0_EL1_64		(UL(0x1) << ID_AA64PFR0_EL1_SHIFT)
+#define	 ID_AA64PFR0_EL1_64_32		(UL(0x2) << ID_AA64PFR0_EL1_SHIFT)
 #define	ID_AA64PFR0_EL2_SHIFT		8
-#define	ID_AA64PFR0_EL2_MASK		(0xf << ID_AA64PFR0_EL2_SHIFT)
+#define	ID_AA64PFR0_EL2_MASK		(UL(0xf) << ID_AA64PFR0_EL2_SHIFT)
 #define	ID_AA64PFR0_EL2(x)		((x) & ID_AA64PFR0_EL2_MASK)
-#define	 ID_AA64PFR0_EL2_NONE		(0 << ID_AA64PFR0_EL2_SHIFT)
-#define	 ID_AA64PFR0_EL2_64		(1 << ID_AA64PFR0_EL2_SHIFT)
-#define	 ID_AA64PFR0_EL2_64_32		(2 << ID_AA64PFR0_EL2_SHIFT)
+#define	 ID_AA64PFR0_EL2_NONE		(UL(0x0) << ID_AA64PFR0_EL2_SHIFT)
+#define	 ID_AA64PFR0_EL2_64		(UL(0x1) << ID_AA64PFR0_EL2_SHIFT)
+#define	 ID_AA64PFR0_EL2_64_32		(UL(0x2) << ID_AA64PFR0_EL2_SHIFT)
 #define	ID_AA64PFR0_EL3_SHIFT		12
-#define	ID_AA64PFR0_EL3_MASK		(0xf << ID_AA64PFR0_EL3_SHIFT)
+#define	ID_AA64PFR0_EL3_MASK		(UL(0xf) << ID_AA64PFR0_EL3_SHIFT)
 #define	ID_AA64PFR0_EL3(x)		((x) & ID_AA64PFR0_EL3_MASK)
-#define	 ID_AA64PFR0_EL3_NONE		(0 << ID_AA64PFR0_EL3_SHIFT)
-#define	 ID_AA64PFR0_EL3_64		(1 << ID_AA64PFR0_EL3_SHIFT)
-#define	 ID_AA64PFR0_EL3_64_32		(2 << ID_AA64PFR0_EL3_SHIFT)
+#define	 ID_AA64PFR0_EL3_NONE		(UL(0x0) << ID_AA64PFR0_EL3_SHIFT)
+#define	 ID_AA64PFR0_EL3_64		(UL(0x1) << ID_AA64PFR0_EL3_SHIFT)
+#define	 ID_AA64PFR0_EL3_64_32		(UL(0x2) << ID_AA64PFR0_EL3_SHIFT)
 #define	ID_AA64PFR0_FP_SHIFT		16
-#define	ID_AA64PFR0_FP_MASK		(0xf << ID_AA64PFR0_FP_SHIFT)
+#define	ID_AA64PFR0_FP_MASK		(UL(0xf) << ID_AA64PFR0_FP_SHIFT)
 #define	ID_AA64PFR0_FP(x)		((x) & ID_AA64PFR0_FP_MASK)
-#define	 ID_AA64PFR0_FP_IMPL		(0x0 << ID_AA64PFR0_FP_SHIFT)
-#define	 ID_AA64PFR0_FP_HP		(0x1 << ID_AA64PFR0_FP_SHIFT)
-#define	 ID_AA64PFR0_FP_NONE		(0xf << ID_AA64PFR0_FP_SHIFT)
+#define	 ID_AA64PFR0_FP_IMPL		(UL(0x0) << ID_AA64PFR0_FP_SHIFT)
+#define	 ID_AA64PFR0_FP_HP		(UL(0x1) << ID_AA64PFR0_FP_SHIFT)
+#define	 ID_AA64PFR0_FP_NONE		(UL(0xf) << ID_AA64PFR0_FP_SHIFT)
 #define	ID_AA64PFR0_AdvSIMD_SHIFT	20
-#define	ID_AA64PFR0_AdvSIMD_MASK	(0xf << ID_AA64PFR0_AdvSIMD_SHIFT)
+#define	ID_AA64PFR0_AdvSIMD_MASK	(UL(0xf) << ID_AA64PFR0_AdvSIMD_SHIFT)
 #define	ID_AA64PFR0_AdvSIMD(x)		((x) & ID_AA64PFR0_AdvSIMD_MASK)
-#define	 ID_AA64PFR0_AdvSIMD_IMPL	(0x0 << ID_AA64PFR0_AdvSIMD_SHIFT)
-#define	 ID_AA64PFR0_AdvSIMD_HP		(0x1 << ID_AA64PFR0_AdvSIMD_SHIFT)
-#define	 ID_AA64PFR0_AdvSIMD_NONE	(0xf << ID_AA64PFR0_AdvSIMD_SHIFT)
+#define	 ID_AA64PFR0_AdvSIMD_IMPL	(UL(0x0) << ID_AA64PFR0_AdvSIMD_SHIFT)
+#define	 ID_AA64PFR0_AdvSIMD_HP		(UL(0x1) << ID_AA64PFR0_AdvSIMD_SHIFT)
+#define	 ID_AA64PFR0_AdvSIMD_NONE	(UL(0xf) << ID_AA64PFR0_AdvSIMD_SHIFT)
 #define	ID_AA64PFR0_GIC_BITS		0x4 /* Number of bits in GIC field */
 #define	ID_AA64PFR0_GIC_SHIFT		24
-#define	ID_AA64PFR0_GIC_MASK		(0xf << ID_AA64PFR0_GIC_SHIFT)
+#define	ID_AA64PFR0_GIC_MASK		(UL(0xf) << ID_AA64PFR0_GIC_SHIFT)
 #define	ID_AA64PFR0_GIC(x)		((x) & ID_AA64PFR0_GIC_MASK)
-#define	 ID_AA64PFR0_GIC_CPUIF_NONE	(0x0 << ID_AA64PFR0_GIC_SHIFT)
-#define	 ID_AA64PFR0_GIC_CPUIF_EN	(0x1 << ID_AA64PFR0_GIC_SHIFT)
+#define	 ID_AA64PFR0_GIC_CPUIF_NONE	(UL(0x0) << ID_AA64PFR0_GIC_SHIFT)
+#define	 ID_AA64PFR0_GIC_CPUIF_EN	(UL(0x1) << ID_AA64PFR0_GIC_SHIFT)
 #define	ID_AA64PFR0_RAS_SHIFT		28
-#define	ID_AA64PFR0_RAS_MASK		(0xf << ID_AA64PFR0_RAS_SHIFT)
+#define	ID_AA64PFR0_RAS_MASK		(UL(0xf) << ID_AA64PFR0_RAS_SHIFT)
 #define	ID_AA64PFR0_RAS(x)		((x) & ID_AA64PFR0_RAS_MASK)
-#define	 ID_AA64PFR0_RAS_NONE		(0x0 << ID_AA64PFR0_RAS_SHIFT)
-#define	 ID_AA64PFR0_RAS_V1		(0x1 << ID_AA64PFR0_RAS_SHIFT)
+#define	 ID_AA64PFR0_RAS_NONE		(UL(0x0) << ID_AA64PFR0_RAS_SHIFT)
+#define	 ID_AA64PFR0_RAS_V1		(UL(0x1) << ID_AA64PFR0_RAS_SHIFT)
 #define	ID_AA64PFR0_SVE_SHIFT		32
-#define	ID_AA64PFR0_SVE_MASK		(0xful << ID_AA64PFR0_SVE_SHIFT)
+#define	ID_AA64PFR0_SVE_MASK		(UL(0xf) << ID_AA64PFR0_SVE_SHIFT)
 #define	ID_AA64PFR0_SVE(x)		((x) & ID_AA64PFR0_SVE_MASK)
-#define	 ID_AA64PFR0_SVE_NONE		(0x0ul << ID_AA64PFR0_SVE_SHIFT)
-#define	 ID_AA64PFR0_SVE_IMPL		(0x1ul << ID_AA64PFR0_SVE_SHIFT)
+#define	 ID_AA64PFR0_SVE_NONE		(UL(0x0) << ID_AA64PFR0_SVE_SHIFT)
+#define	 ID_AA64PFR0_SVE_IMPL		(UL(0x1) << ID_AA64PFR0_SVE_SHIFT)
 
 /* MAIR_EL1 - Memory Attribute Indirection Register */
 #define	MAIR_ATTR_MASK(idx)	(0xff << ((n)* 8))

From owner-svn-src-head@freebsd.org  Tue Jul 23 14:52:47 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62BEAAB7EC;
 Tue, 23 Jul 2019 14:52:47 +0000 (UTC)
 (envelope-from andrew@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 45C00949D8;
 Tue, 23 Jul 2019 14:52:47 +0000 (UTC)
 (envelope-from andrew@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 05899274BF;
 Tue, 23 Jul 2019 14:52:47 +0000 (UTC)
 (envelope-from andrew@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6NEqkbj091014;
 Tue, 23 Jul 2019 14:52:46 GMT (envelope-from andrew@FreeBSD.org)
Received: (from andrew@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6NEqkWK091013;
 Tue, 23 Jul 2019 14:52:46 GMT (envelope-from andrew@FreeBSD.org)
Message-Id: <201907231452.x6NEqkWK091013@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: andrew set sender to
 andrew@FreeBSD.org using -f
From: Andrew Turner <andrew@FreeBSD.org>
Date: Tue, 23 Jul 2019 14:52:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350242 - head/sys/arm64/include
X-SVN-Group: head
X-SVN-Commit-Author: andrew
X-SVN-Commit-Paths: head/sys/arm64/include
X-SVN-Commit-Revision: 350242
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45C00949D8
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_LONG(-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]
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Jul 2019 14:52:47 -0000

Author: andrew
Date: Tue Jul 23 14:52:46 2019
New Revision: 350242
URL: https://svnweb.freebsd.org/changeset/base/350242

Log:
  As with r350241 use the new UL macro on the main register mask.
  
  MFC after:	1 week
  Sponsored by:	DARPA, AFRL

Modified:
  head/sys/arm64/include/armreg.h

Modified: head/sys/arm64/include/armreg.h
==============================================================================
--- head/sys/arm64/include/armreg.h	Tue Jul 23 14:40:37 2019	(r350241)
+++ head/sys/arm64/include/armreg.h	Tue Jul 23 14:52:46 2019	(r350242)
@@ -176,7 +176,7 @@
 #define	ICC_SRE_EL2_EN		(1U << 3)
 
 /* ID_AA64DFR0_EL1 */
-#define	ID_AA64DFR0_MASK		0x0000000ff0f0fffful
+#define	ID_AA64DFR0_MASK		UL(0x0000000ff0f0ffff)
 #define	ID_AA64DFR0_DebugVer_SHIFT	0
 #define	ID_AA64DFR0_DebugVer_MASK	(UL(0xf) << ID_AA64DFR0_DebugVer_SHIFT)
 #define	ID_AA64DFR0_DebugVer(x)		((x) & ID_AA64DFR0_DebugVer_MASK)
@@ -214,7 +214,7 @@
 #define	 ID_AA64DFR0_PMSVer_V1		(UL(0x1) << ID_AA64DFR0_PMSVer_SHIFT)
 
 /* ID_AA64ISAR0_EL1 */
-#define	ID_AA64ISAR0_MASK		0x0000fffff0fffff0ul
+#define	ID_AA64ISAR0_MASK		UL(0x0000fffff0fffff0)
 #define	ID_AA64ISAR0_AES_SHIFT		4
 #define	ID_AA64ISAR0_AES_MASK		(UL(0xf) << ID_AA64ISAR0_AES_SHIFT)
 #define	ID_AA64ISAR0_AES(x)		((x) & ID_AA64ISAR0_AES_MASK)
@@ -269,7 +269,7 @@
 #define	 ID_AA64ISAR0_DP_IMPL		(UL(0x1) << ID_AA64ISAR0_DP_SHIFT)
 
 /* ID_AA64ISAR1_EL1 */
-#define	ID_AA64ISAR1_MASK		0xffffffff
+#define	ID_AA64ISAR1_MASK		UL(0x00000000ffffffff)
 #define	ID_AA64ISAR1_DPB_SHIFT		0
 #define	ID_AA64ISAR1_DPB_MASK		(UL(0xf) << ID_AA64ISAR1_DPB_SHIFT)
 #define	ID_AA64ISAR1_DPB(x)		((x) & ID_AA64ISAR1_DPB_MASK)
@@ -312,7 +312,7 @@
 #define	 ID_AA64ISAR1_GPI_IMPL		(UL(0x1) << ID_AA64ISAR1_GPI_SHIFT)
 
 /* ID_AA64MMFR0_EL1 */
-#define	ID_AA64MMFR0_MASK		0xffffffff
+#define	ID_AA64MMFR0_MASK		UL(0x00000000ffffffff)
 #define	ID_AA64MMFR0_PARange_SHIFT	0
 #define	ID_AA64MMFR0_PARange_MASK	(UL(0xf) << ID_AA64MMFR0_PARange_SHIFT)
 #define	ID_AA64MMFR0_PARange(x)		((x) & ID_AA64MMFR0_PARange_MASK)
@@ -360,7 +360,7 @@
 #define	 ID_AA64MMFR0_TGran4_NONE	(UL(0xf) << ID_AA64MMFR0_TGran4_SHIFT)
 
 /* ID_AA64MMFR1_EL1 */
-#define	ID_AA64MMFR1_MASK		0xffffffff
+#define	ID_AA64MMFR1_MASK		UL(0x00000000ffffffff)
 #define	ID_AA64MMFR1_HAFDBS_SHIFT	0
 #define	ID_AA64MMFR1_HAFDBS_MASK	(UL(0xf) << ID_AA64MMFR1_HAFDBS_SHIFT)
 #define	ID_AA64MMFR1_HAFDBS(x)		((x) & ID_AA64MMFR1_HAFDBS_MASK)
@@ -407,7 +407,7 @@
 
 /* ID_AA64MMFR2_EL1 */
 #define	ID_AA64MMFR2_EL1		S3_0_C0_C7_2
-#define	ID_AA64MMFR2_MASK		0x0fffffff
+#define	ID_AA64MMFR2_MASK		UL(0x000000000fffffff)
 #define	ID_AA64MMFR2_CnP_SHIFT		0
 #define	ID_AA64MMFR2_CnP_MASK		(UL(0xf) << ID_AA64MMFR2_CnP_SHIFT)
 #define	ID_AA64MMFR2_CnP(x)		((x) & ID_AA64MMFR2_CnP_MASK)
@@ -445,7 +445,7 @@
 #define	 ID_AA64MMFR2_NV_IMPL		(UL(0x1) << ID_AA64MMFR2_NV_SHIFT)
 
 /* ID_AA64PFR0_EL1 */
-#define	ID_AA64PFR0_MASK		0x0000000ffffffffful
+#define	ID_AA64PFR0_MASK		UL(0x0000000fffffffff)
 #define	ID_AA64PFR0_EL0_SHIFT		0
 #define	ID_AA64PFR0_EL0_MASK		(UL(0xf) << ID_AA64PFR0_EL0_SHIFT)
 #define	ID_AA64PFR0_EL0(x)		((x) & ID_AA64PFR0_EL0_MASK)

From owner-svn-src-head@freebsd.org  Tue Jul 23 16:11:39 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F0B8AD3A6;
 Tue, 23 Jul 2019 16:11:39 +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 3FACF977E4;
 Tue, 23 Jul 2019 16:11:39 +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 14A723D0;
 Tue, 23 Jul 2019 16:11:39 +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 x6NGBc9J034131;
 Tue, 23 Jul 2019 16:11:38 GMT (envelope-from kib@FreeBSD.org)
Received: (from kib@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6NGBcqU034130;
 Tue, 23 Jul 2019 16:11:38 GMT (envelope-from kib@FreeBSD.org)
Message-Id: <201907231611.x6NGBcqU034130@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org
 using -f
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Tue, 23 Jul 2019 16:11:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350243 - 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: 350243
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 3FACF977E4
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];
 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Jul 2019 16:11:39 -0000

Author: kib
Date: Tue Jul 23 16:11:38 2019
New Revision: 350243
URL: https://svnweb.freebsd.org/changeset/base/350243

Log:
  Update refcount(9).
  
  Describe missed functions.
  Give some hint about refcount_release(9) memory ordering guarantees.
  
  Reviewed by:	markj
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D21020

Modified:
  head/share/man/man9/refcount.9

Modified: head/share/man/man9/refcount.9
==============================================================================
--- head/share/man/man9/refcount.9	Tue Jul 23 14:52:46 2019	(r350242)
+++ head/share/man/man9/refcount.9	Tue Jul 23 16:11:38 2019	(r350243)
@@ -3,6 +3,12 @@
 .\" Written by: John H. Baldwin <jhb@FreeBSD.org>
 .\" All rights reserved.
 .\"
+.\" Copyright (c) 2019 The FreeBSD Foundation, Inc.
+.\"
+.\" Parts of this documentation was written by
+.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
+.\" from the FreeBSD Foundation.
+.\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
@@ -26,7 +32,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 21, 2019
+.Dd July 23, 2019
 .Dt REFCOUNT 9
 .Os
 .Sh NAME
@@ -43,7 +49,13 @@
 .Ft void
 .Fn refcount_acquire "volatile u_int *count"
 .Ft bool
+.Fn refcount_acquire_checked "volatile u_int *count"
+.Ft bool
+.Fn refcount_acquire_if_not_zero "volatile u_int *count"
+.Ft bool
 .Fn refcount_release "volatile u_int *count"
+.Ft bool
+.Fn refcount_release_if_not_last "volatile u_int *count"
 .Sh DESCRIPTION
 The
 .Nm
@@ -54,6 +66,8 @@ A pointer to this integer is passed via
 Usually the counter is used to manage the lifetime of an object and is
 stored as a member of the object.
 .Pp
+Currently all functions are implemented as static inline.
+.Pp
 The
 .Fn refcount_init
 function is used to set the initial value of the counter to
@@ -71,21 +85,75 @@ object, then holding a lock that protects the list pro
 protection for acquiring a new reference.
 .Pp
 The
+.Fn refcount_acquire_checked
+variant performs the same operation as
+.Fn refcount_acquire ,
+but additionally checks that the
+.Fa count
+value does not overflow as result of the operation.
+It returns
+.Dv true
+if the reference was sucessfully obtained, and
+.Dv false
+if it was not, due to the overflow.
+.Pp
+The
+.Fn refcount_acquire_if_not_zero
+function is yet another variant of
+.Fn refcount_acquire ,
+which only obtains the reference when some reference already exists.
+In other words,
+.Fa *count
+must be already greater than zero for the function to succeed, in which
+case the return value is
+.Dv true ,
+otherwise
+.Dv false
+is returned.
+.Pp
+The
 .Fn refcount_release
 function is used to release an existing reference.
 The function returns true if the reference being released was
 the last reference;
 otherwise, it returns false.
 .Pp
-Note that these routines do not provide any inter-CPU synchronization,
-data protection,
-or memory ordering guarantees except for managing the counter.
+The
+.Fn refcount_release_if_not_last
+is a variant of
+.Fn refcount_release
+which only drops the reference when it is not the last reference.
+In other words, the function returns
+.Dv true
+when
+.Fa *count
+is greater than one, in which case
+.Fa *count is decremented.
+Otherwise, if
+.Fa *count
+is equal to one, the reference is not released and the function returns
+.Dv false .
+.Pp
+Note that these routines do not provide any inter-CPU synchronization or
+data protection for managing the counter.
 The caller is responsible for any additional synchronization needed by
 consumers of any containing objects.
 In addition,
 the caller is also responsible for managing the life cycle of any containing
 objects including explicitly releasing any resources when the last reference
 is released.
+.Pp
+The
+.Fn refcount_release
+unconditionally executes a release fence (see
+.Xr atomic 9 ) before releasing the reference, which
+synchronizes with an acquire fence executed right before
+returning the
+.Dv true
+value.
+This ensures that the destructor, supposedly executed by the caller after
+the last reference was dropped, sees all updates done during the lifetime
+of the object.
 .Sh RETURN VALUES
 The
 .Nm refcount_release

From owner-svn-src-head@freebsd.org  Tue Jul 23 16:27:37 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56F17ADB5C;
 Tue, 23 Jul 2019 16:27:37 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 381A06A1D9;
 Tue, 23 Jul 2019 16:27:37 +0000 (UTC)
 (envelope-from emaste@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 13342628;
 Tue, 23 Jul 2019 16:27:37 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6NGRa55046543;
 Tue, 23 Jul 2019 16:27:36 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6NGRa1C046542;
 Tue, 23 Jul 2019 16:27:36 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201907231627.x6NGRa1C046542@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Tue, 23 Jul 2019 16:27:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350244 - head/usr.sbin/bhyve
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: head/usr.sbin/bhyve
X-SVN-Commit-Revision: 350244
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 381A06A1D9
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.973,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Jul 2019 16:27:37 -0000

Author: emaste
Date: Tue Jul 23 16:27:36 2019
New Revision: 350244
URL: https://svnweb.freebsd.org/changeset/base/350244

Log:
  bhyve: correct out-of-bounds read in XHCI device emulation
  
  Add appropriate bounds checks on the epid and streamid fields in the
  device doorbell registers.
  
  admbugs:	919
  Submitted by:	jhb
  Reported by:	Reno Robert <renorobert@gmail.com>
  Reviewed by:	markj
  Approved by:	so
  Security:	out-of-bounds read

Modified:
  head/usr.sbin/bhyve/pci_xhci.c

Modified: head/usr.sbin/bhyve/pci_xhci.c
==============================================================================
--- head/usr.sbin/bhyve/pci_xhci.c	Tue Jul 23 16:11:38 2019	(r350243)
+++ head/usr.sbin/bhyve/pci_xhci.c	Tue Jul 23 16:27:36 2019	(r350244)
@@ -1900,6 +1900,11 @@ pci_xhci_device_doorbell(struct pci_xhci_softc *sc, ui
 		return;
 	}
 
+	if (epid == 0 || epid >= XHCI_MAX_ENDPOINTS) {
+		DPRINTF(("pci_xhci: invalid endpoint %u\r\n", epid));
+		return;
+	}
+
 	dev = XHCI_SLOTDEV_PTR(sc, slot);
 	devep = &dev->eps[epid];
 	dev_ctx = pci_xhci_get_dev_ctx(sc, slot);
@@ -1925,6 +1930,23 @@ pci_xhci_device_doorbell(struct pci_xhci_softc *sc, ui
 
 	/* get next trb work item */
 	if (XHCI_EPCTX_0_MAXP_STREAMS_GET(ep_ctx->dwEpCtx0) != 0) {
+		struct xhci_stream_ctx *sctx;
+
+		/*
+		 * Stream IDs of 0, 65535 (any stream), and 65534
+		 * (prime) are invalid.
+		 */
+		if (streamid == 0 || streamid == 65534 || streamid == 65535) {
+			DPRINTF(("pci_xhci: invalid stream %u\r\n", streamid));
+			return;
+		}
+
+		sctx = NULL;
+		pci_xhci_find_stream(sc, ep_ctx, streamid, &sctx);
+		if (sctx == NULL) {
+			DPRINTF(("pci_xhci: invalid stream %u\r\n", streamid));
+			return;
+		}
 		sctx_tr = &devep->ep_sctx_trbs[streamid];
 		ringaddr = sctx_tr->ringaddr;
 		ccs = sctx_tr->ccs;
@@ -1933,6 +1955,10 @@ pci_xhci_device_doorbell(struct pci_xhci_softc *sc, ui
 		        streamid, ep_ctx->qwEpCtx2 & XHCI_TRB_3_CYCLE_BIT,
 		        trb->dwTrb3 & XHCI_TRB_3_CYCLE_BIT));
 	} else {
+		if (streamid != 0) {
+			DPRINTF(("pci_xhci: invalid stream %u\r\n", streamid));
+			return;
+		}
 		ringaddr = devep->ep_ringaddr;
 		ccs = devep->ep_ccs;
 		trb = devep->ep_tr;

From owner-svn-src-head@freebsd.org  Tue Jul 23 16:28:18 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 021CFADBB8;
 Tue, 23 Jul 2019 16:28:18 +0000 (UTC)
 (envelope-from gallatin@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 A68776A34B;
 Tue, 23 Jul 2019 16:28:17 +0000 (UTC)
 (envelope-from gallatin@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 81C0462F;
 Tue, 23 Jul 2019 16:28:17 +0000 (UTC)
 (envelope-from gallatin@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6NGSHmO046621;
 Tue, 23 Jul 2019 16:28:17 GMT (envelope-from gallatin@FreeBSD.org)
Received: (from gallatin@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6NGSHvc046620;
 Tue, 23 Jul 2019 16:28:17 GMT (envelope-from gallatin@FreeBSD.org)
Message-Id: <201907231628.x6NGSHvc046620@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: gallatin set sender to
 gallatin@FreeBSD.org using -f
From: Andrew Gallatin <gallatin@FreeBSD.org>
Date: Tue, 23 Jul 2019 16:28:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350245 - head/usr.sbin/pciconf
X-SVN-Group: head
X-SVN-Commit-Author: gallatin
X-SVN-Commit-Paths: head/usr.sbin/pciconf
X-SVN-Commit-Revision: 350245
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: A68776A34B
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Jul 2019 16:28:18 -0000

Author: gallatin
Date: Tue Jul 23 16:28:17 2019
New Revision: 350245
URL: https://svnweb.freebsd.org/changeset/base/350245

Log:
  pciconf: report PCI Gen4 speeds
  
  PCIe gen4 runs at 16GT/s.  Report this as
  the speed of Gen4 links.
  
  Reviewed by:	imp
  MFC after:	7 days
  Sponsored by:	Netflix

Modified:
  head/usr.sbin/pciconf/cap.c

Modified: head/usr.sbin/pciconf/cap.c
==============================================================================
--- head/usr.sbin/pciconf/cap.c	Tue Jul 23 16:27:36 2019	(r350244)
+++ head/usr.sbin/pciconf/cap.c	Tue Jul 23 16:28:17 2019	(r350245)
@@ -389,6 +389,8 @@ link_speed_string(uint8_t speed)
 		return ("5.0");
 	case 3:
 		return ("8.0");
+	case 4:
+		return ("16.0");
 	default:
 		return ("undef");
 	}

From owner-svn-src-head@freebsd.org  Tue Jul 23 18:07:37 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 587C7AF594;
 Tue, 23 Jul 2019 18:07:37 +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 3AD616DD17;
 Tue, 23 Jul 2019 18:07:37 +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 0BE4B1849;
 Tue, 23 Jul 2019 18:07:37 +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 x6NI7aoR006768;
 Tue, 23 Jul 2019 18:07:36 GMT (envelope-from tuexen@FreeBSD.org)
Received: (from tuexen@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6NI7aP9006767;
 Tue, 23 Jul 2019 18:07:36 GMT (envelope-from tuexen@FreeBSD.org)
Message-Id: <201907231807.x6NI7aP9006767@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: tuexen set sender to
 tuexen@FreeBSD.org using -f
From: Michael Tuexen <tuexen@FreeBSD.org>
Date: Tue, 23 Jul 2019 18:07:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350248 - head/sys/netinet
X-SVN-Group: head
X-SVN-Commit-Author: tuexen
X-SVN-Commit-Paths: head/sys/netinet
X-SVN-Commit-Revision: 350248
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 3AD616DD17
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.951,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Jul 2019 18:07:37 -0000

Author: tuexen
Date: Tue Jul 23 18:07:36 2019
New Revision: 350248
URL: https://svnweb.freebsd.org/changeset/base/350248

Log:
  Fix a LOR in SCTP which was found by running syzkaller.
  
  Submitted by:		rrs@
  Reported by:		markj@
  MFC after:		1 week

Modified:
  head/sys/netinet/sctp_usrreq.c

Modified: head/sys/netinet/sctp_usrreq.c
==============================================================================
--- head/sys/netinet/sctp_usrreq.c	Tue Jul 23 17:48:37 2019	(r350247)
+++ head/sys/netinet/sctp_usrreq.c	Tue Jul 23 18:07:36 2019	(r350248)
@@ -965,9 +965,9 @@ sctp_shutdown(struct socket *so)
 		abort_anyway:
 				op_err = sctp_generate_cause(SCTP_CAUSE_USER_INITIATED_ABT, "");
 				stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6;
+				SCTP_INP_RUNLOCK(inp);
 				sctp_abort_an_association(stcb->sctp_ep, stcb,
 				    op_err, SCTP_SO_LOCKED);
-				SCTP_INP_RUNLOCK(inp);
 				return (0);
 			}
 		}

From owner-svn-src-head@freebsd.org  Tue Jul 23 18:14:33 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id C27CAAFAFA;
 Tue, 23 Jul 2019 18:14:33 +0000 (UTC) (envelope-from erj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 A30F86E705;
 Tue, 23 Jul 2019 18:14:33 +0000 (UTC) (envelope-from erj@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 7C00C1A16;
 Tue, 23 Jul 2019 18:14:33 +0000 (UTC) (envelope-from erj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6NIEX20012541;
 Tue, 23 Jul 2019 18:14:33 GMT (envelope-from erj@FreeBSD.org)
Received: (from erj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6NIEWLG012538;
 Tue, 23 Jul 2019 18:14:32 GMT (envelope-from erj@FreeBSD.org)
Message-Id: <201907231814.x6NIEWLG012538@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org
 using -f
From: Eric Joyner <erj@FreeBSD.org>
Date: Tue, 23 Jul 2019 18:14:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350253 - head/sys/dev/ixgbe
X-SVN-Group: head
X-SVN-Commit-Author: erj
X-SVN-Commit-Paths: head/sys/dev/ixgbe
X-SVN-Commit-Revision: 350253
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: A30F86E705
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.952,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Jul 2019 18:14:33 -0000

Author: erj
Date: Tue Jul 23 18:14:32 2019
New Revision: 350253
URL: https://svnweb.freebsd.org/changeset/base/350253

Log:
  ixgbe(4): Fix enabling/disabling and reconfiguration of queues
  
  - Wrong order of casting and bit shift caused that enabling and disabling
    queues didn't work properly for queues number larger than 32. Use literals
    with right suffix instead.
  
  - TX ring tail address was not updated during reinitiailzation of TX
    structures. It could block sending traffic.
  
  - Also remove unused variables 'eims' and 'active_queues'.
  
  Submitted by:	Krzysztof Galazka <krzysztof.galazka@intel.com>
  Reviewed by:	erj@
  Sponsored by:	Intel Corporation
  Differential Revision:	https://reviews.freebsd.org/D20826

Modified:
  head/sys/dev/ixgbe/if_ix.c
  head/sys/dev/ixgbe/if_ixv.c
  head/sys/dev/ixgbe/ixgbe.h

Modified: head/sys/dev/ixgbe/if_ix.c
==============================================================================
--- head/sys/dev/ixgbe/if_ix.c	Tue Jul 23 18:12:44 2019	(r350252)
+++ head/sys/dev/ixgbe/if_ix.c	Tue Jul 23 18:14:32 2019	(r350253)
@@ -425,7 +425,6 @@ ixgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs
 		    i);
 
 		txr->adapter = que->adapter = adapter;
-		adapter->active_queues |= (u64)1 << txr->me;
 
 		/* Allocate report status array */
 		txr->tx_rsq = (qidx_t *)malloc(sizeof(qidx_t) * scctx->isc_ntxd[0], M_IXGBE, M_NOWAIT | M_ZERO);
@@ -796,6 +795,8 @@ ixgbe_initialize_transmit_units(if_ctx_t ctx)
 		IXGBE_WRITE_REG(hw, IXGBE_TDT(j), 0);
 
 		/* Cache the tail address */
+		txr->tail = IXGBE_TDT(txr->me);
+
 		txr->tx_rs_cidx = txr->tx_rs_pidx;
 		txr->tx_cidx_processed = scctx->isc_ntxd[0] - 1;
 		for (int k = 0; k < scctx->isc_ntxd[0]; k++)
@@ -2002,7 +2003,6 @@ ixgbe_if_msix_intr_assign(if_ctx_t ctx, int msix)
 		}
 
 		rx_que->msix = vector;
-		adapter->active_queues |= (u64)(1 << rx_que->msix);
 		if (adapter->feat_en & IXGBE_FEATURE_RSS) {
 			/*
 			 * The queue ID is used as the RSS layer bucket ID.
@@ -3687,7 +3687,7 @@ ixgbe_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t r
 	struct adapter     *adapter = iflib_get_softc(ctx);
 	struct ix_rx_queue *que = &adapter->rx_queues[rxqid];
 
-	ixgbe_enable_queue(adapter, que->rxr.me);
+	ixgbe_enable_queue(adapter, que->msix);
 
 	return (0);
 } /* ixgbe_if_rx_queue_intr_enable */
@@ -3699,7 +3699,7 @@ static void
 ixgbe_enable_queue(struct adapter *adapter, u32 vector)
 {
 	struct ixgbe_hw *hw = &adapter->hw;
-	u64             queue = (u64)(1 << vector);
+	u64             queue = 1ULL << vector;
 	u32             mask;
 
 	if (hw->mac.type == ixgbe_mac_82598EB) {
@@ -3722,7 +3722,7 @@ static void
 ixgbe_disable_queue(struct adapter *adapter, u32 vector)
 {
 	struct ixgbe_hw *hw = &adapter->hw;
-	u64             queue = (u64)(1 << vector);
+	u64             queue = 1ULL << vector;
 	u32             mask;
 
 	if (hw->mac.type == ixgbe_mac_82598EB) {

Modified: head/sys/dev/ixgbe/if_ixv.c
==============================================================================
--- head/sys/dev/ixgbe/if_ixv.c	Tue Jul 23 18:12:44 2019	(r350252)
+++ head/sys/dev/ixgbe/if_ixv.c	Tue Jul 23 18:14:32 2019	(r350253)
@@ -268,7 +268,6 @@ ixv_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, 
 
 		txr->me = i;
 		txr->adapter =  que->adapter = adapter;
-		adapter->active_queues |= (u64)1 << txr->me;
 
 		/* Allocate report status array */
 		if (!(txr->tx_rsq = (qidx_t *)malloc(sizeof(qidx_t) * scctx->isc_ntxd[0], M_DEVBUF, M_NOWAIT | M_ZERO))) {
@@ -1038,8 +1037,6 @@ ixv_if_msix_intr_assign(if_ctx_t ctx, int msix)
 		}
 
 		rx_que->msix = vector;
-		adapter->active_queues |= (u64)(1 << rx_que->msix);
-
 	}
 
 	for (int i = 0; i < adapter->num_tx_queues; i++) {

Modified: head/sys/dev/ixgbe/ixgbe.h
==============================================================================
--- head/sys/dev/ixgbe/ixgbe.h	Tue Jul 23 18:12:44 2019	(r350252)
+++ head/sys/dev/ixgbe/ixgbe.h	Tue Jul 23 18:14:32 2019	(r350253)
@@ -339,7 +339,6 @@ struct rx_ring {
 struct ix_rx_queue {
 	struct adapter		*adapter;
 	u32			msix;           /* This queue's MSIX vector */
-	u32			eims;           /* This queue's EIMS bit */
 	u32			eitr_setting;
 	struct resource		*res;
 	void			*tag;
@@ -442,7 +441,6 @@ struct adapter {
 	 */
 	struct ix_tx_queue	*tx_queues;
 	struct ix_rx_queue	*rx_queues;
-	u64			active_queues;
 
 	/* Multicast array memory */
 	struct ixgbe_mc_addr    *mta;

From owner-svn-src-head@freebsd.org  Tue Jul 23 18:31:08 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73D99AFF77;
 Tue, 23 Jul 2019 18:31:08 +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 4BCB46F120;
 Tue, 23 Jul 2019 18:31:08 +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 269FF1C21;
 Tue, 23 Jul 2019 18:31:08 +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 x6NIV82j018589;
 Tue, 23 Jul 2019 18:31:08 GMT (envelope-from tuexen@FreeBSD.org)
Received: (from tuexen@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6NIV8bu018588;
 Tue, 23 Jul 2019 18:31:08 GMT (envelope-from tuexen@FreeBSD.org)
Message-Id: <201907231831.x6NIV8bu018588@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: tuexen set sender to
 tuexen@FreeBSD.org using -f
From: Michael Tuexen <tuexen@FreeBSD.org>
Date: Tue, 23 Jul 2019 18:31:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350254 - head/sys/netinet
X-SVN-Group: head
X-SVN-Commit-Author: tuexen
X-SVN-Commit-Paths: head/sys/netinet
X-SVN-Commit-Revision: 350254
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 4BCB46F120
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.951,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Jul 2019 18:31:08 -0000

Author: tuexen
Date: Tue Jul 23 18:31:07 2019
New Revision: 350254
URL: https://svnweb.freebsd.org/changeset/base/350254

Log:
  Don't hold a mutex while calling sbwait. This was found by syzkaller.
  
  Submitted by:		rrs@
  Reported by:		markj@
  MFC after:		1 week

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Tue Jul 23 18:14:32 2019	(r350253)
+++ head/sys/netinet/sctp_output.c	Tue Jul 23 18:31:07 2019	(r350254)
@@ -13409,10 +13409,10 @@ skip_preblock:
 					    stcb,
 					    SCTP_OUTPUT_FROM_USR_SEND, SCTP_SO_LOCKED);
 				}
-				if (hold_tcblock == 1) {
-					SCTP_TCB_UNLOCK(stcb);
-					hold_tcblock = 0;
-				}
+			}
+			if (hold_tcblock == 1) {
+				SCTP_TCB_UNLOCK(stcb);
+				hold_tcblock = 0;
 			}
 			SOCKBUF_LOCK(&so->so_snd);
 			/*-

From owner-svn-src-head@freebsd.org  Tue Jul 23 18:40:08 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A706B0270;
 Tue, 23 Jul 2019 18:40:08 +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 EC46E6F5C2;
 Tue, 23 Jul 2019 18:40:07 +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 BE8A61DCA;
 Tue, 23 Jul 2019 18:40:07 +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 x6NIe7jD024814;
 Tue, 23 Jul 2019 18:40:07 GMT (envelope-from scottl@FreeBSD.org)
Received: (from scottl@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6NIe77a024813;
 Tue, 23 Jul 2019 18:40:07 GMT (envelope-from scottl@FreeBSD.org)
Message-Id: <201907231840.x6NIe77a024813@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: scottl set sender to
 scottl@FreeBSD.org using -f
From: Scott Long <scottl@FreeBSD.org>
Date: Tue, 23 Jul 2019 18:40:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350255 - head/usr.sbin/bhyve
X-SVN-Group: head
X-SVN-Commit-Author: scottl
X-SVN-Commit-Paths: head/usr.sbin/bhyve
X-SVN-Commit-Revision: 350255
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: EC46E6F5C2
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.951,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Jul 2019 18:40:08 -0000

Author: scottl
Date: Tue Jul 23 18:40:07 2019
New Revision: 350255
URL: https://svnweb.freebsd.org/changeset/base/350255

Log:
  Fix the register layout for the Buffer Descript List Entry.  It
  got jumbled around during some other cleanups and was causing
  audio failures on some guests.
  
  PR:		239341
  Reported by:	shamaz.mazum@gmail.com

Modified:
  head/usr.sbin/bhyve/pci_hda.c

Modified: head/usr.sbin/bhyve/pci_hda.c
==============================================================================
--- head/usr.sbin/bhyve/pci_hda.c	Tue Jul 23 18:31:07 2019	(r350254)
+++ head/usr.sbin/bhyve/pci_hda.c	Tue Jul 23 18:40:07 2019	(r350255)
@@ -80,10 +80,10 @@ typedef void (*hda_set_reg_handler)(struct hda_softc *
 		uint32_t old);
 
 struct hda_bdle {
-	uint32_t addrh;
 	uint32_t addrl;
-	uint32_t ioc;
+	uint32_t addrh;
 	uint32_t len;
+	uint32_t ioc;
 } __packed;
 
 struct hda_bdle_desc {

From owner-svn-src-head@freebsd.org  Tue Jul 23 19:42:04 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 858B8B152B;
 Tue, 23 Jul 2019 19:42:04 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 635BF71BDF;
 Tue, 23 Jul 2019 19:42:04 +0000 (UTC) (envelope-from mav@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 458072A3E;
 Tue, 23 Jul 2019 19:42:04 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6NJg4Zs064966;
 Tue, 23 Jul 2019 19:42:04 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6NJg4NK064965;
 Tue, 23 Jul 2019 19:42:04 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201907231942.x6NJg4NK064965@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Tue, 23 Jul 2019 19:42:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350257 - head/sbin/camcontrol
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: head/sbin/camcontrol
X-SVN-Commit-Revision: 350257
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 635BF71BDF
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];
 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Jul 2019 19:42:04 -0000

Author: mav
Date: Tue Jul 23 19:42:03 2019
New Revision: 350257
URL: https://svnweb.freebsd.org/changeset/base/350257

Log:
  Make `camcontrol hpa` and `camcontrol ama` trigger reprobe.
  
  This makes OS automatically see the disk's new disk size.
  
  MFC after:	2 weeks
  Sponsored by:	iXsystems, Inc.

Modified:
  head/sbin/camcontrol/camcontrol.c

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c	Tue Jul 23 18:40:32 2019	(r350256)
+++ head/sbin/camcontrol/camcontrol.c	Tue Jul 23 19:42:03 2019	(r350257)
@@ -301,6 +301,7 @@ static int scsiserial(struct cam_device *device, int t
 		      int retry_count, int timeout);
 static int parse_btl(char *tstr, path_id_t *bus, target_id_t *target,
 		     lun_id_t *lun, cam_argmask *arglst);
+static int reprobe(struct cam_device *device);
 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,
@@ -371,7 +372,6 @@ static int scsiprintopcodes(struct cam_device *device,
 static int scsiopcodes(struct cam_device *device, int argc, char **argv,
 		       char *combinedopt, int task_attr, int retry_count,
 		       int timeout, int verbose);
-static int scsireprobe(struct cam_device *device);
 
 #ifndef min
 #define min(a,b) (((a)<(b))?(a):(b))
@@ -3094,6 +3094,8 @@ atahpa(struct cam_device *device, int retry_count, int
 							timeout, ccb,
 							&ident_buf);
 				atahpa_print(ident_buf, hpasize, 1);
+				/* Hint CAM to reprobe the device. */
+				reprobe(device);
 			}
 		}
 		break;
@@ -3236,6 +3238,8 @@ ataama(struct cam_device *device, int retry_count, int
 				error = ata_do_identify(device, retry_count,
 				    timeout, ccb, &ident_buf);
 				ataama_print(ident_buf, nativesize, 1);
+				/* Hint CAM to reprobe the device. */
+				reprobe(device);
 			}
 		}
 		break;
@@ -9774,7 +9778,7 @@ bailout:
 
 
 static int
-scsireprobe(struct cam_device *device)
+reprobe(struct cam_device *device)
 {
 	union ccb *ccb;
 	int retval = 0;
@@ -9786,7 +9790,7 @@ scsireprobe(struct cam_device *device)
 		return (1);
 	}
 
-	CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
+	CCB_CLEAR_ALL_EXCEPT_HDR(ccb);
 
 	ccb->ccb_h.func_code = XPT_REPROBE_LUN;
 
@@ -10538,7 +10542,7 @@ main(int argc, char **argv)
 		    arglist & CAM_ARG_VERBOSE);
 		break;
 	case CAM_CMD_REPROBE:
-		error = scsireprobe(cam_dev);
+		error = reprobe(cam_dev);
 		break;
 	case CAM_CMD_ZONE:
 		error = zone(cam_dev, argc, argv, combinedopt,

From owner-svn-src-head@freebsd.org  Tue Jul 23 20:59:37 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id D8C1DB35A6;
 Tue, 23 Jul 2019 20:59:37 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 AB026752EA;
 Tue, 23 Jul 2019 20:59:37 +0000 (UTC)
 (envelope-from emaste@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 87C3F3957;
 Tue, 23 Jul 2019 20:59:37 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6NKxbOO008327;
 Tue, 23 Jul 2019 20:59:37 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6NKxb9J008326;
 Tue, 23 Jul 2019 20:59:37 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201907232059.x6NKxb9J008326@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Tue, 23 Jul 2019 20:59:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350260 - head/sys/kern
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: head/sys/kern
X-SVN-Commit-Revision: 350260
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: AB026752EA
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];
 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Jul 2019 20:59:37 -0000

Author: emaste
Date: Tue Jul 23 20:59:36 2019
New Revision: 350260
URL: https://svnweb.freebsd.org/changeset/base/350260

Log:
  mqueuefs: fix struct file leak
  
  In some error cases we previously leaked a stuct file.
  
  Submitted by:	mjg, markj

Modified:
  head/sys/kern/uipc_mqueue.c

Modified: head/sys/kern/uipc_mqueue.c
==============================================================================
--- head/sys/kern/uipc_mqueue.c	Tue Jul 23 20:31:54 2019	(r350259)
+++ head/sys/kern/uipc_mqueue.c	Tue Jul 23 20:59:36 2019	(r350260)
@@ -2283,13 +2283,14 @@ sys_kmq_timedreceive(struct thread *td, struct kmq_tim
 	if (uap->abs_timeout != NULL) {
 		error = copyin(uap->abs_timeout, &ets, sizeof(ets));
 		if (error != 0)
-			return (error);
+			goto out;
 		abs_timeout = &ets;
 	} else
 		abs_timeout = NULL;
 	waitok = !(fp->f_flag & O_NONBLOCK);
 	error = mqueue_receive(mq, uap->msg_ptr, uap->msg_len,
 		uap->msg_prio, waitok, abs_timeout);
+out:
 	fdrop(fp, td);
 	return (error);
 }
@@ -2309,13 +2310,14 @@ sys_kmq_timedsend(struct thread *td, struct kmq_timeds
 	if (uap->abs_timeout != NULL) {
 		error = copyin(uap->abs_timeout, &ets, sizeof(ets));
 		if (error != 0)
-			return (error);
+			goto out;
 		abs_timeout = &ets;
 	} else
 		abs_timeout = NULL;
 	waitok = !(fp->f_flag & O_NONBLOCK);
 	error = mqueue_send(mq, uap->msg_ptr, uap->msg_len,
 		uap->msg_prio, waitok, abs_timeout);
+out:
 	fdrop(fp, td);
 	return (error);
 }
@@ -2834,7 +2836,7 @@ freebsd32_kmq_timedreceive(struct thread *td,
 	if (uap->abs_timeout != NULL) {
 		error = copyin(uap->abs_timeout, &ets32, sizeof(ets32));
 		if (error != 0)
-			return (error);
+			goto out;
 		CP(ets32, ets, tv_sec);
 		CP(ets32, ets, tv_nsec);
 		abs_timeout = &ets;
@@ -2843,6 +2845,7 @@ freebsd32_kmq_timedreceive(struct thread *td,
 	waitok = !(fp->f_flag & O_NONBLOCK);
 	error = mqueue_receive(mq, uap->msg_ptr, uap->msg_len,
 		uap->msg_prio, waitok, abs_timeout);
+out:
 	fdrop(fp, td);
 	return (error);
 }

From owner-svn-src-head@freebsd.org  Tue Jul 23 21:28:21 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 729CEB42A3;
 Tue, 23 Jul 2019 21:28:21 +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 540B676993;
 Tue, 23 Jul 2019 21:28:21 +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 2E05C3F65;
 Tue, 23 Jul 2019 21:28:21 +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 x6NLSLlh026243;
 Tue, 23 Jul 2019 21:28:21 GMT (envelope-from tuexen@FreeBSD.org)
Received: (from tuexen@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6NLSKuW026240;
 Tue, 23 Jul 2019 21:28:20 GMT (envelope-from tuexen@FreeBSD.org)
Message-Id: <201907232128.x6NLSKuW026240@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: tuexen set sender to
 tuexen@FreeBSD.org using -f
From: Michael Tuexen <tuexen@FreeBSD.org>
Date: Tue, 23 Jul 2019 21:28:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350265 - in head: share/man/man4 sys/netinet
X-SVN-Group: head
X-SVN-Commit-Author: tuexen
X-SVN-Commit-Paths: in head: share/man/man4 sys/netinet
X-SVN-Commit-Revision: 350265
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 540B676993
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.970,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Jul 2019 21:28:21 -0000

Author: tuexen
Date: Tue Jul 23 21:28:20 2019
New Revision: 350265
URL: https://svnweb.freebsd.org/changeset/base/350265

Log:
  Add a sysctl variable ts_offset_per_conn to change the computation
  of the TCP TS offset from taking the IP addresses and the TCP port
  numbers into account to a version just taking only the IP addresses
  into account. This works around broken middleboxes or endpoints.
  The default is to keep the behaviour, which is also the behaviour
  recommended in RFC 7323.
  
  Reported by:		devgs@ukr.net
  Reviewed by:		rrs@
  MFC after:		2 weeks
  Sponsored by:		Netflix, Inc.
  Differential Revision:	https://reviews.freebsd.org/D20980

Modified:
  head/share/man/man4/tcp.4
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_var.h

Modified: head/share/man/man4/tcp.4
==============================================================================
--- head/share/man/man4/tcp.4	Tue Jul 23 21:26:03 2019	(r350264)
+++ head/share/man/man4/tcp.4	Tue Jul 23 21:28:20 2019	(r350265)
@@ -34,7 +34,7 @@
 .\"     From: @(#)tcp.4	8.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd March 23, 2019
+.Dd July 23, 2019
 .Dt TCP 4
 .Os
 .Sh NAME
@@ -606,6 +606,10 @@ Default is false.
 .It Va insecure_syn
 Use criteria defined in RFC793 instead of RFC5961 for accepting SYN segments.
 Default is false.
+.It Va ts_offset_per_conn
+When initializing the TCP timestamps, use a per connection offset instead of a
+per host pair offset.
+Default is to use per connection offsets as recommended in RFC 7323.
 .El
 .Sh ERRORS
 A socket operation may fail with one of the following errors returned:

Modified: head/sys/netinet/tcp_subr.c
==============================================================================
--- head/sys/netinet/tcp_subr.c	Tue Jul 23 21:26:03 2019	(r350264)
+++ head/sys/netinet/tcp_subr.c	Tue Jul 23 21:28:20 2019	(r350265)
@@ -195,6 +195,11 @@ SYSCTL_INT(_net_inet_tcp, TCPCTL_DO_RFC1323, rfc1323, 
     &VNET_NAME(tcp_do_rfc1323), 0,
     "Enable rfc1323 (high performance TCP) extensions");
 
+VNET_DEFINE(int, tcp_ts_offset_per_conn) = 1;
+SYSCTL_INT(_net_inet_tcp, OID_AUTO, ts_offset_per_conn, CTLFLAG_VNET | CTLFLAG_RW,
+    &VNET_NAME(tcp_ts_offset_per_conn), 0,
+    "Initialize TCP timestamps per connection instead of per host pair");
+
 static int	tcp_log_debug = 0;
 SYSCTL_INT(_net_inet_tcp, OID_AUTO, log_debug, CTLFLAG_RW,
     &tcp_log_debug, 0, "Log errors caused by incoming TCP segments");
@@ -2634,7 +2639,17 @@ tcp_keyed_hash(struct in_conninfo *inc, u_char *key, u
 uint32_t
 tcp_new_ts_offset(struct in_conninfo *inc)
 {
-	return (tcp_keyed_hash(inc, V_ts_offset_secret,
+	struct in_conninfo inc_store, *local_inc;
+
+	if (!V_tcp_ts_offset_per_conn) {
+		memcpy(&inc_store, inc, sizeof(struct in_conninfo));
+		inc_store.inc_lport = 0;
+		inc_store.inc_fport = 0;
+		local_inc = &inc_store;
+	} else {
+		local_inc = inc;
+	}
+	return (tcp_keyed_hash(local_inc, V_ts_offset_secret,
 	    sizeof(V_ts_offset_secret)));
 }
 

Modified: head/sys/netinet/tcp_var.h
==============================================================================
--- head/sys/netinet/tcp_var.h	Tue Jul 23 21:26:03 2019	(r350264)
+++ head/sys/netinet/tcp_var.h	Tue Jul 23 21:28:20 2019	(r350265)
@@ -802,6 +802,7 @@ VNET_DECLARE(struct inpcbinfo, tcbinfo);
 #define	V_tcp_do_autosndbuf		VNET(tcp_do_autosndbuf)
 #define	V_tcp_do_ecn			VNET(tcp_do_ecn)
 #define	V_tcp_do_rfc1323		VNET(tcp_do_rfc1323)
+#define V_tcp_ts_offset_per_conn	VNET(tcp_ts_offset_per_conn)
 #define	V_tcp_do_rfc3042		VNET(tcp_do_rfc3042)
 #define	V_tcp_do_rfc3390		VNET(tcp_do_rfc3390)
 #define	V_tcp_do_rfc3465		VNET(tcp_do_rfc3465)

From owner-svn-src-head@freebsd.org  Tue Jul 23 23:14:58 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 090FAB6AB8;
 Tue, 23 Jul 2019 23:14:58 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id DCDE0835C3;
 Tue, 23 Jul 2019 23:14:57 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B7594545E;
 Tue, 23 Jul 2019 23:14:57 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6NNEvb8092524;
 Tue, 23 Jul 2019 23:14:57 GMT (envelope-from asomers@FreeBSD.org)
Received: (from asomers@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6NNEvS2092523;
 Tue, 23 Jul 2019 23:14:57 GMT (envelope-from asomers@FreeBSD.org)
Message-Id: <201907232314.x6NNEvS2092523@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: asomers set sender to
 asomers@FreeBSD.org using -f
From: Alan Somers <asomers@FreeBSD.org>
Date: Tue, 23 Jul 2019 23:14:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350268 - head/share/man/man9
X-SVN-Group: head
X-SVN-Commit-Author: asomers
X-SVN-Commit-Paths: head/share/man/man9
X-SVN-Commit-Revision: 350268
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: DCDE0835C3
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.948,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Jul 2019 23:14:58 -0000

Author: asomers
Date: Tue Jul 23 23:14:57 2019
New Revision: 350268
URL: https://svnweb.freebsd.org/changeset/base/350268

Log:
  VOP_FSYNC.9: update copyright after r345677
  
  MFC after:	2 weeks
  MFC-With:	r345677
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/share/man/man9/VOP_FSYNC.9

Modified: head/share/man/man9/VOP_FSYNC.9
==============================================================================
--- head/share/man/man9/VOP_FSYNC.9	Tue Jul 23 22:18:09 2019	(r350267)
+++ head/share/man/man9/VOP_FSYNC.9	Tue Jul 23 23:14:57 2019	(r350268)
@@ -4,6 +4,11 @@
 .\"
 .\" All rights reserved.
 .\"
+.\" Copyright (c) 2019 The FreeBSD Foundation
+.\"
+.\" Portions of this documentation were written by BFF Storage Systems under
+.\" sponsorship from the FreeBSD Foundation.
+.\"
 .\" This program is free software.
 .\"
 .\" Redistribution and use in source and binary forms, with or without

From owner-svn-src-head@freebsd.org  Wed Jul 24 07:07:47 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD59CBEC62;
 Wed, 24 Jul 2019 07:07:47 +0000 (UTC)
 (envelope-from kevlo@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 BEF6F6C0A5;
 Wed, 24 Jul 2019 07:07:47 +0000 (UTC)
 (envelope-from kevlo@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 8D563A92B;
 Wed, 24 Jul 2019 07:07:47 +0000 (UTC)
 (envelope-from kevlo@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6O77lYP070150;
 Wed, 24 Jul 2019 07:07:47 GMT (envelope-from kevlo@FreeBSD.org)
Received: (from kevlo@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6O77kh4070147;
 Wed, 24 Jul 2019 07:07:46 GMT (envelope-from kevlo@FreeBSD.org)
Message-Id: <201907240707.x6O77kh4070147@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kevlo set sender to
 kevlo@FreeBSD.org using -f
From: Kevin Lo <kevlo@FreeBSD.org>
Date: Wed, 24 Jul 2019 07:07:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350274 - head/share/man/man4
X-SVN-Group: head
X-SVN-Commit-Author: kevlo
X-SVN-Commit-Paths: head/share/man/man4
X-SVN-Commit-Revision: 350274
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: BEF6F6C0A5
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jul 2019 07:07:47 -0000

Author: kevlo
Date: Wed Jul 24 07:07:46 2019
New Revision: 350274
URL: https://svnweb.freebsd.org/changeset/base/350274

Log:
  Don't use .Xr for things that have no man page.

Modified:
  head/share/man/man4/cue.4
  head/share/man/man4/kue.4
  head/share/man/man4/rgephy.4

Modified: head/share/man/man4/cue.4
==============================================================================
--- head/share/man/man4/cue.4	Wed Jul 24 06:32:21 2019	(r350273)
+++ head/share/man/man4/cue.4	Wed Jul 24 07:07:46 2019	(r350274)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 24, 2015
+.Dd July 24, 2019
 .Dt CUE 4
 .Os
 .Sh NAME
@@ -68,7 +68,7 @@ received and transmitted over separate USB bulk transf
 .Pp
 The CATC chipset supports only 10Mbps half-duplex mode, hence there
 are no
-.Xr ifmedia 4
+.Fn ifmedia
 modes to select.
 .Pp
 For more information on configuring this device, see

Modified: head/share/man/man4/kue.4
==============================================================================
--- head/share/man/man4/kue.4	Wed Jul 24 06:32:21 2019	(r350273)
+++ head/share/man/man4/kue.4	Wed Jul 24 07:07:46 2019	(r350274)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 24, 2015
+.Dd July 24, 2019
 .Dt KUE 4
 .Os
 .Sh NAME
@@ -68,7 +68,7 @@ received and transmitted over separate USB bulk transf
 .Pp
 The Kawasaki chipset supports only 10Mbps half-duplex mode, hence there
 are no
-.Xr ifmedia 4
+.Fn ifmedia
 modes to select.
 .Pp
 For more information on configuring this device, see

Modified: head/share/man/man4/rgephy.4
==============================================================================
--- head/share/man/man4/rgephy.4	Wed Jul 24 06:32:21 2019	(r350273)
+++ head/share/man/man4/rgephy.4	Wed Jul 24 07:07:46 2019	(r350274)
@@ -90,7 +90,6 @@ autonegotiation:
 .Pp
 .Dl "ifconfig re0 media 100baseTX mediaopt full-duplex,flag0"
 .Sh SEE ALSO
-.\".Xr ifmedia 4 ,
 .Xr intro 4 ,
 .Xr miibus 4 ,
 .Xr ifconfig 8

From owner-svn-src-head@freebsd.org  Wed Jul 24 08:00:01 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A095A162D;
 Wed, 24 Jul 2019 08:00:01 +0000 (UTC)
 (envelope-from manu@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 7992B6E24C;
 Wed, 24 Jul 2019 08:00:01 +0000 (UTC)
 (envelope-from manu@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 66709B28E;
 Wed, 24 Jul 2019 08:00:01 +0000 (UTC)
 (envelope-from manu@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6O801ni000311;
 Wed, 24 Jul 2019 08:00:01 GMT (envelope-from manu@FreeBSD.org)
Received: (from manu@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6O801nr000310;
 Wed, 24 Jul 2019 08:00:01 GMT (envelope-from manu@FreeBSD.org)
Message-Id: <201907240800.x6O801nr000310@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: manu set sender to
 manu@FreeBSD.org using -f
From: Emmanuel Vadot <manu@FreeBSD.org>
Date: Wed, 24 Jul 2019 08:00:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350275 - head
X-SVN-Group: head
X-SVN-Commit-Author: manu
X-SVN-Commit-Paths: head
X-SVN-Commit-Revision: 350275
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 7992B6E24C
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jul 2019 08:00:01 -0000

Author: manu
Date: Wed Jul 24 08:00:00 2019
New Revision: 350275
URL: https://svnweb.freebsd.org/changeset/base/350275

Log:
  pkgbase: Add the sub stage-packages targets to TGTS
  
  This helps when you don't want to run the dependencies targets.
  
  Reviewed by:	bapt
  Differential Revision:	https://reviews.freebsd.org/D20955

Modified:
  head/Makefile

Modified: head/Makefile
==============================================================================
--- head/Makefile	Wed Jul 24 07:07:46 2019	(r350274)
+++ head/Makefile	Wed Jul 24 08:00:00 2019	(r350275)
@@ -138,7 +138,7 @@ TGTS=	all all-man buildenv buildenvvars buildkernel bu
 	build32 distribute32 install32 buildsoft distributesoft installsoft \
 	builddtb xdev xdev-build xdev-install \
 	xdev-links native-xtools native-xtools-install stageworld stagekernel \
-	stage-packages \
+	stage-packages stage-packages-kernel stage-packages-world \
 	create-packages-world create-packages-kernel create-packages \
 	packages installconfig real-packages sign-packages package-pkg \
 	print-dir test-system-compiler test-system-linker

From owner-svn-src-head@freebsd.org  Wed Jul 24 15:09:16 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05597AF265;
 Wed, 24 Jul 2019 15:09:16 +0000 (UTC)
 (envelope-from carpeddiem@gmail.com)
Received: from mail-io1-f41.google.com (mail-io1-f41.google.com
 [209.85.166.41])
 (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 53BEF8A654;
 Wed, 24 Jul 2019 15:09:15 +0000 (UTC)
 (envelope-from carpeddiem@gmail.com)
Received: by mail-io1-f41.google.com with SMTP id m24so90358246ioo.2;
 Wed, 24 Jul 2019 08:09:15 -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=Ocfh8a7hTjOFnS4YRaFIfLJKhPN6VUsFOSfcF9MI8kk=;
 b=lGm9WGWL3Hrpck2xf++4k19g/LjvuNNHrarP1Tntmo2m9XeYN1KG8q7k1spbkCkTVT
 2sPoHhFQFE+qHADGy04GUAo5zoJHRd0jSr7x/49VBCRI+MrjKSZnaNZUEW6dZQaiBXKp
 atJXiGh5jJHhDoVgG6vc9jz1P7Nf2hdCWNr4kE0+C2J7Mo6H7tzOPxZwSSskL9n0HjP4
 LiS0V4zCkHkRPv8ZL+UGqMPN8pAGxBxaKjvJm+SgD6MttvNM8cvioDQr4AeGp1cQrDHi
 /1EuKVj/pJMeA9vhAQ05GevNDmqFYjpWrHOlqSiDBOjQsslZm2pqY7H/IHPUdjDQSdh2
 fXrw==
X-Gm-Message-State: APjAAAVJA/lrrr1UG+R5uGe9WB19JH2NlZu5HW4aMhFOKrV3UZlYtFWH
 1toC4Wca+5ToJhADsnL4kdOFP+0Jqofwd14E436o1w==
X-Google-Smtp-Source: APXvYqzaTrB/CnMTl1cqqOyYO04RqXZ6zDqWnHFGwZdIJpMsZiM5ceMGJkmpuGfV6dEhLZr3KDWMCM2kkgdGbV8NXog=
X-Received: by 2002:a5d:9d42:: with SMTP id k2mr28195724iok.45.1563980473819; 
 Wed, 24 Jul 2019 08:01:13 -0700 (PDT)
MIME-Version: 1.0
References: <201907070858.x678w3go067222@repo.freebsd.org>
In-Reply-To: <201907070858.x678w3go067222@repo.freebsd.org>
From: Ed Maste <emaste@freebsd.org>
Date: Wed, 24 Jul 2019 09:21:32 -0400
Message-ID: <CAPyFy2B8bDaLFq5bOWBhCBr4xhN=uEWpj1qgU4=tGkx8Deipig@mail.gmail.com>
Subject: Re: svn commit: r349802 - head/sys/fs/ext2fs
To: Fedor Uporov <fsu@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>, 
 svn-src-head <svn-src-head@freebsd.org>
Content-Type: text/plain; charset="UTF-8"
X-Rspamd-Queue-Id: 53BEF8A654
X-Spamd-Bar: -----
Authentication-Results: mx1.freebsd.org;
 spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates
 209.85.166.41 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com
X-Spamd-Result: default: False [-5.26 / 15.00]; ARC_NA(0.00)[];
 NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[];
 RCPT_COUNT_THREE(0.00)[4];
 R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17];
 TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain];
 MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[freebsd.org];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_TLS_LAST(0.00)[];
 TO_DN_ALL(0.00)[];
 MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com];
 NEURAL_HAM_SHORT(-0.93)[-0.930,0];
 RCVD_IN_DNSWL_NONE(0.00)[41.166.85.209.list.dnswl.org : 127.0.5.0];
 IP_SCORE(-2.32)[ip: (-5.67), ipnet: 209.85.128.0/17(-3.44), asn: 15169(-2.43),
 country: US(-0.05)]; 
 FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com];
 R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com];
 ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US];
 FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com];
 RCVD_COUNT_TWO(0.00)[2]
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jul 2019 15:09:16 -0000

On Sun, 7 Jul 2019 at 04:58, Fedor Uporov <fsu@freebsd.org> wrote:
>
> 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.

Will you MFC this to stable/12 and stable/11?

From owner-svn-src-head@freebsd.org  Wed Jul 24 15:10:10 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 329E0AF32E;
 Wed, 24 Jul 2019 15:10:10 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 13ECD8A7D2;
 Wed, 24 Jul 2019 15:10:10 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E431118241;
 Wed, 24 Jul 2019 15:10:09 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6OFA9Ix053622;
 Wed, 24 Jul 2019 15:10:09 GMT (envelope-from asomers@FreeBSD.org)
Received: (from asomers@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6OFA9QP053621;
 Wed, 24 Jul 2019 15:10:09 GMT (envelope-from asomers@FreeBSD.org)
Message-Id: <201907241510.x6OFA9QP053621@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: asomers set sender to
 asomers@FreeBSD.org using -f
From: Alan Somers <asomers@FreeBSD.org>
Date: Wed, 24 Jul 2019 15:10:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350291 - head/share/mk
X-SVN-Group: head
X-SVN-Commit-Author: asomers
X-SVN-Commit-Paths: head/share/mk
X-SVN-Commit-Revision: 350291
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 13ECD8A7D2
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_LONG(-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]
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jul 2019 15:10:10 -0000

Author: asomers
Date: Wed Jul 24 15:10:09 2019
New Revision: 350291
URL: https://svnweb.freebsd.org/changeset/base/350291

Log:
  Add c++14 and c++17 to COMPILER_FEATURES
  
  This will be used to gate the fusefs tests. It's a partial merge of r348281
  from projects/fuse2.
  
  Reviewed by:	kib, emaste
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21044

Modified:
  head/share/mk/bsd.compiler.mk

Modified: head/share/mk/bsd.compiler.mk
==============================================================================
--- head/share/mk/bsd.compiler.mk	Wed Jul 24 14:39:52 2019	(r350290)
+++ head/share/mk/bsd.compiler.mk	Wed Jul 24 15:10:09 2019	(r350291)
@@ -19,6 +19,8 @@
 # COMPILER_FEATURES will contain one or more of the following, based on
 # compiler support for that feature:
 #
+# - c++17:     supports full (or nearly full) C++17 programming environment.
+# - c++14:     supports full (or nearly full) C++14 programming environment.
 # - c++11:     supports full (or nearly full) C++11 programming environment.
 # - retpoline: supports the retpoline speculative execution vulnerability
 #              mitigation.
@@ -200,9 +202,17 @@ ${X_}COMPILER_FREEBSD_VERSION=	unknown
 .endif
 
 ${X_}COMPILER_FEATURES=
-.if ${${X_}COMPILER_TYPE} == "clang" || \
+.if (${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 30300) || \
 	(${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 40800)
 ${X_}COMPILER_FEATURES+=	c++11
+.endif
+.if (${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 30400) || \
+	(${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 50000)
+${X_}COMPILER_FEATURES+=	c++14
+.endif
+.if (${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 50000) || \
+	(${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 70000)
+${X_}COMPILER_FEATURES+=	c++17
 .endif
 .if ${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 60000
 ${X_}COMPILER_FEATURES+=	retpoline

From owner-svn-src-head@freebsd.org  Wed Jul 24 15:18:06 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 286A6AF84A;
 Wed, 24 Jul 2019 15:18:06 +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 097AA8AEEB;
 Wed, 24 Jul 2019 15:18:06 +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 C5DFA18415;
 Wed, 24 Jul 2019 15:18:05 +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 x6OFI5bD059139;
 Wed, 24 Jul 2019 15:18:05 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6OFI5OV059138;
 Wed, 24 Jul 2019 15:18:05 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201907241518.x6OFI5OV059138@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Wed, 24 Jul 2019 15:18:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350292 - head/sys/kern
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: head/sys/kern
X-SVN-Commit-Revision: 350292
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 097AA8AEEB
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_LONG(-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]
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jul 2019 15:18:06 -0000

Author: markj
Date: Wed Jul 24 15:18:05 2019
New Revision: 350292
URL: https://svnweb.freebsd.org/changeset/base/350292

Log:
  Remove a redundant offset computation in elf_load_section().
  
  With r344705 the offset is always zero.
  
  Submitted by:	Wuyang Chung <wuyang.chung1@gmail.com>

Modified:
  head/sys/kern/imgact_elf.c

Modified: head/sys/kern/imgact_elf.c
==============================================================================
--- head/sys/kern/imgact_elf.c	Wed Jul 24 15:10:09 2019	(r350291)
+++ head/sys/kern/imgact_elf.c	Wed Jul 24 15:18:05 2019	(r350292)
@@ -550,7 +550,7 @@ __elfN(load_section)(struct image_params *imgp, vm_oof
 	size_t map_len;
 	vm_map_t map;
 	vm_object_t object;
-	vm_offset_t off, map_addr;
+	vm_offset_t map_addr;
 	int error, rv, cow;
 	size_t copy_len;
 	vm_ooffset_t file_addr;
@@ -629,9 +629,8 @@ __elfN(load_section)(struct image_params *imgp, vm_oof
 			return (EIO);
 
 		/* send the page fragment to user space */
-		off = trunc_page(offset + filsz) - trunc_page(offset + filsz);
-		error = copyout((caddr_t)sf_buf_kva(sf) + off,
-		    (caddr_t)map_addr, copy_len);
+		error = copyout((caddr_t)sf_buf_kva(sf), (caddr_t)map_addr,
+		    copy_len);
 		vm_imgact_unmap_page(sf);
 		if (error != 0)
 			return (error);

From owner-svn-src-head@freebsd.org  Wed Jul 24 16:10:21 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7BA3BB0CAF;
 Wed, 24 Jul 2019 16:10:21 +0000 (UTC)
 (envelope-from krion@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 5D33E8C6B9;
 Wed, 24 Jul 2019 16:10:21 +0000 (UTC)
 (envelope-from krion@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 3430A18D5F;
 Wed, 24 Jul 2019 16:10:21 +0000 (UTC)
 (envelope-from krion@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6OGALFA088983;
 Wed, 24 Jul 2019 16:10:21 GMT (envelope-from krion@FreeBSD.org)
Received: (from krion@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6OGALkO088982;
 Wed, 24 Jul 2019 16:10:21 GMT (envelope-from krion@FreeBSD.org)
Message-Id: <201907241610.x6OGALkO088982@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: krion set sender to
 krion@FreeBSD.org using -f
From: Kirill Ponomarev <krion@FreeBSD.org>
Date: Wed, 24 Jul 2019 16:10:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350293 - head/sys/net
X-SVN-Group: head
X-SVN-Commit-Author: krion
X-SVN-Commit-Paths: head/sys/net
X-SVN-Commit-Revision: 350293
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 5D33E8C6B9
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jul 2019 16:10:21 -0000

Author: krion (ports committer)
Date: Wed Jul 24 16:10:20 2019
New Revision: 350293
URL: https://svnweb.freebsd.org/changeset/base/350293

Log:
  Allow set MTU more than 1500 bytes.
  
  Submitted by:	Alexandr Fedorov <aleksandr.fedorov_itglobal_dot_com>
  Approved by:	jhb, rgrimes
  Sponsored by:	ITGlobal.com
  Differential Revision:	https://reviews.freebsd.org/D19422

Modified:
  head/sys/net/if_vxlan.c

Modified: head/sys/net/if_vxlan.c
==============================================================================
--- head/sys/net/if_vxlan.c	Wed Jul 24 15:18:05 2019	(r350292)
+++ head/sys/net/if_vxlan.c	Wed Jul 24 16:10:20 2019	(r350293)
@@ -84,6 +84,15 @@ struct vxlan_socket_mc_info {
 	int				 vxlsomc_users;
 };
 
+/*
+ * The maximum MTU of encapsulated ethernet frame within IPv4/UDP packet.
+ */
+#define VXLAN_MAX_MTU	(IP_MAXPACKET - \
+		60 /* Maximum IPv4 header len */ - \
+		sizeof(struct udphdr) - \
+		sizeof(struct vxlan_header) - \
+		ETHER_HDR_LEN - ETHER_CRC_LEN - ETHER_VLAN_ENCAP_LEN)
+
 #define VXLAN_SO_MC_MAX_GROUPS		32
 
 #define VXLAN_SO_VNI_HASH_SHIFT		6
@@ -2247,10 +2256,11 @@ vxlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t dat
 	ifr = (struct ifreq *) data;
 	ifd = (struct ifdrv *) data;
 
+	error = 0;
+
 	switch (cmd) {
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
-		error = 0;
 		break;
 
 	case SIOCGDRVSPEC:
@@ -2267,6 +2277,13 @@ vxlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t dat
 		error = ifmedia_ioctl(ifp, ifr, &sc->vxl_media, cmd);
 		break;
 
+	case SIOCSIFMTU:
+		if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > VXLAN_MAX_MTU)
+			error = EINVAL;
+		else
+			ifp->if_mtu = ifr->ifr_mtu;
+		break;
+
 	default:
 		error = ether_ioctl(ifp, cmd, data);
 		break;
@@ -2747,8 +2764,8 @@ vxlan_clone_create(struct if_clone *ifc, int unit, cad
 	ifp->if_ioctl = vxlan_ioctl;
 	ifp->if_transmit = vxlan_transmit;
 	ifp->if_qflush = vxlan_qflush;
-	ifp->if_capabilities |= IFCAP_LINKSTATE;
-	ifp->if_capenable |= IFCAP_LINKSTATE;
+	ifp->if_capabilities |= IFCAP_LINKSTATE | IFCAP_JUMBO_MTU;
+	ifp->if_capenable |= IFCAP_LINKSTATE | IFCAP_JUMBO_MTU;
 
 	ifmedia_init(&sc->vxl_media, 0, vxlan_media_change, vxlan_media_status);
 	ifmedia_add(&sc->vxl_media, IFM_ETHER | IFM_AUTO, 0, NULL);

From owner-svn-src-head@freebsd.org  Wed Jul 24 16:51:15 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 809D7B1E14;
 Wed, 24 Jul 2019 16:51:15 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 614B48E014;
 Wed, 24 Jul 2019 16:51:15 +0000 (UTC)
 (envelope-from emaste@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 2E90019561;
 Wed, 24 Jul 2019 16:51:15 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6OGpFsH016250;
 Wed, 24 Jul 2019 16:51:15 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6OGpFDr016249;
 Wed, 24 Jul 2019 16:51:15 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201907241651.x6OGpFDr016249@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Wed, 24 Jul 2019 16:51:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350294 - head/sys/netpfil/pf
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: head/sys/netpfil/pf
X-SVN-Commit-Revision: 350294
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 614B48E014
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];
 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jul 2019 16:51:15 -0000

Author: emaste
Date: Wed Jul 24 16:51:14 2019
New Revision: 350294
URL: https://svnweb.freebsd.org/changeset/base/350294

Log:
  pf: zero output buffer in pfioctl
  
  Avoid potential structure padding leak.
  
  Reported by:	Vlad Tsyrklevich <vlad@tsyrklevich.net>
  Reviewed by:	kp
  MFC after:	3 days
  Security:	Potential kernel memory disclosure
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/netpfil/pf/pf_ioctl.c

Modified: head/sys/netpfil/pf/pf_ioctl.c
==============================================================================
--- head/sys/netpfil/pf/pf_ioctl.c	Wed Jul 24 16:10:20 2019	(r350293)
+++ head/sys/netpfil/pf/pf_ioctl.c	Wed Jul 24 16:51:14 2019	(r350294)
@@ -2169,7 +2169,7 @@ relock_DIOCKILLSTATES:
 			break;
 		}
 
-		p = pstore = malloc(ps->ps_len, M_TEMP, M_WAITOK);
+		p = pstore = malloc(ps->ps_len, M_TEMP, M_WAITOK | M_ZERO);
 		nr = 0;
 
 		for (i = 0; i <= pf_hashmask; i++) {

From owner-svn-src-head@freebsd.org  Wed Jul 24 17:41:41 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CE1AB3628;
 Wed, 24 Jul 2019 17:41:41 +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 1F5216A36B;
 Wed, 24 Jul 2019 17:41:41 +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 BAAF419F97;
 Wed, 24 Jul 2019 17:41:40 +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 x6OHfeY4045829;
 Wed, 24 Jul 2019 17:41:40 GMT (envelope-from lwhsu@FreeBSD.org)
Received: (from lwhsu@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6OHfehO045809;
 Wed, 24 Jul 2019 17:41:40 GMT (envelope-from lwhsu@FreeBSD.org)
Message-Id: <201907241741.x6OHfehO045809@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to
 lwhsu@FreeBSD.org using -f
From: Li-Wen Hsu <lwhsu@FreeBSD.org>
Date: Wed, 24 Jul 2019 17:41:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350295 - head/tests/sys/kern
X-SVN-Group: head
X-SVN-Commit-Author: lwhsu
X-SVN-Commit-Paths: head/tests/sys/kern
X-SVN-Commit-Revision: 350295
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 1F5216A36B
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];
 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jul 2019 17:41:41 -0000

Author: lwhsu
Date: Wed Jul 24 17:41:40 2019
New Revision: 350295
URL: https://svnweb.freebsd.org/changeset/base/350295

Log:
  Temporarily skip flakey test case
  sys.kern.ptrace_test.ptrace__follow_fork_parent_detached_unrelated_debugger
  
  PR:		239425
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/tests/sys/kern/ptrace_test.c

Modified: head/tests/sys/kern/ptrace_test.c
==============================================================================
--- head/tests/sys/kern/ptrace_test.c	Wed Jul 24 16:51:14 2019	(r350294)
+++ head/tests/sys/kern/ptrace_test.c	Wed Jul 24 17:41:40 2019	(r350295)
@@ -936,6 +936,8 @@ ATF_TC_BODY(ptrace__follow_fork_parent_detached_unrela
 	pid_t children[2], fpid, wpid;
 	int cpipe[2], status;
 
+	atf_tc_skip("https://bugs.freebsd.org/239425");
+
 	ATF_REQUIRE(pipe(cpipe) == 0);
 	ATF_REQUIRE((fpid = fork()) != -1);
 	if (fpid == 0) {

From owner-svn-src-head@freebsd.org  Wed Jul 24 21:06:20 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E56CB8D26;
 Wed, 24 Jul 2019 21:06:20 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 41A0C74A90;
 Wed, 24 Jul 2019 21:06:20 +0000 (UTC)
 (envelope-from emaste@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 314661C4BF;
 Wed, 24 Jul 2019 21:06:20 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6OL6Ko2068072;
 Wed, 24 Jul 2019 21:06:20 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6OL6KaM068071;
 Wed, 24 Jul 2019 21:06:20 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201907242106.x6OL6KaM068071@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Wed, 24 Jul 2019 21:06:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350301 - head/lib/libsysdecode
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: head/lib/libsysdecode
X-SVN-Commit-Revision: 350301
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 41A0C74A90
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.977,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jul 2019 21:06:20 -0000

Author: emaste
Date: Wed Jul 24 21:06:19 2019
New Revision: 350301
URL: https://svnweb.freebsd.org/changeset/base/350301

Log:
  libsysdecode: add explicit dependencies on recently changed headers
  
  r349369 removed IP_MIN_MEMBERSHIPS and IPV6_MIN_MEMBERSHIPS, and r349893
  removed TCP_RACK_SESS_CWV. libsysdecode lacked dependencies to trigger a
  rebuild of tables.h.
  
  Add explicit dependencies as a workaround to address these specific
  cases; a holistic solution is still needed.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/lib/libsysdecode/Makefile

Modified: head/lib/libsysdecode/Makefile
==============================================================================
--- head/lib/libsysdecode/Makefile	Wed Jul 24 20:17:39 2019	(r350300)
+++ head/lib/libsysdecode/Makefile	Wed Jul 24 21:06:19 2019	(r350301)
@@ -123,7 +123,8 @@ CFLAGS.gcc.ioctl.c+= -Wno-redundant-decls
 CFLAGS.gcc+=	${CFLAGS.gcc.${.IMPSRC}}
 
 DEPENDOBJS+=	tables.h
-tables.h: mktables
+tables.h: mktables ${SYSROOT}/sys/netinet/in.h ${SYSROOT}/sys/netinet/tcp.h \
+    ${SYSROOT}/sys/netinet6/in6.h
 	sh ${.CURDIR}/mktables ${SYSROOT:U${DESTDIR}}${INCLUDEDIR} ${.TARGET}.tmp && \
 	    mv -f ${.TARGET}.tmp ${.TARGET}
 

From owner-svn-src-head@freebsd.org  Wed Jul 24 21:08:31 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A9D8B8DE7;
 Wed, 24 Jul 2019 21:08:31 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 4CE5574C4E;
 Wed, 24 Jul 2019 21:08:31 +0000 (UTC)
 (envelope-from emaste@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 3D4F71C4C0;
 Wed, 24 Jul 2019 21:08:31 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6OL8UrO068216;
 Wed, 24 Jul 2019 21:08:30 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6OL8Uwg068215;
 Wed, 24 Jul 2019 21:08:30 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201907242108.x6OL8Uwg068215@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Wed, 24 Jul 2019 21:08:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350302 - head
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: head
X-SVN-Commit-Revision: 350302
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 4CE5574C4E
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.977,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jul 2019 21:08:31 -0000

Author: emaste
Date: Wed Jul 24 21:08:30 2019
New Revision: 350302
URL: https://svnweb.freebsd.org/changeset/base/350302

Log:
  cirrus.yml: use OVMF.fd from uefi-edk2-qemu-x86_64 package
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/.cirrus.yml

Modified: head/.cirrus.yml
==============================================================================
--- head/.cirrus.yml	Wed Jul 24 21:06:19 2019	(r350301)
+++ head/.cirrus.yml	Wed Jul 24 21:08:30 2019	(r350302)
@@ -11,9 +11,9 @@ env:
 task:
   timeout_in: 90m
   install_script:
-  - pkg install -y qemu-devel
+  - pkg install -y qemu-devel uefi-edk2-qemu-x86_64
   - fetch https://people.freebsd.org/~emaste/OVMF.fd
   script:
   - make -j$(sysctl -n hw.ncpu) WITHOUT_TOOLCHAIN=yes buildworld buildkernel
   test_script:
-  - OVMF=$(pwd)/OVMF.fd sh tools/boot/ci-qemu-test.sh
+  - sh tools/boot/ci-qemu-test.sh

From owner-svn-src-head@freebsd.org  Wed Jul 24 21:26:18 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9440EB95C6;
 Wed, 24 Jul 2019 21:26:18 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 7653D759B2;
 Wed, 24 Jul 2019 21:26:18 +0000 (UTC)
 (envelope-from emaste@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 672881C848;
 Wed, 24 Jul 2019 21:26:18 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6OLQI0X080124;
 Wed, 24 Jul 2019 21:26:18 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6OLQIwo080123;
 Wed, 24 Jul 2019 21:26:18 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201907242126.x6OLQIwo080123@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Wed, 24 Jul 2019 21:26:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350303 - head/sys/modules/i2c/controllers/ichiic
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: head/sys/modules/i2c/controllers/ichiic
X-SVN-Commit-Revision: 350303
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 7653D759B2
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jul 2019 21:26:18 -0000

Author: emaste
Date: Wed Jul 24 21:26:17 2019
New Revision: 350303
URL: https://svnweb.freebsd.org/changeset/base/350303

Log:
  enable ig4_acpi on aarch64
  
  The already-listed APMC0D0F ID belongs to the Ampere eMAG aarch64
  platform, but ACPI support was not even built on aarch64.
  
  Submitted by:	Greg V <greg_unrelenting.technology>
  Differential Revision:	https://reviews.freebsd.org/D21059

Modified:
  head/sys/modules/i2c/controllers/ichiic/Makefile

Modified: head/sys/modules/i2c/controllers/ichiic/Makefile
==============================================================================
--- head/sys/modules/i2c/controllers/ichiic/Makefile	Wed Jul 24 21:08:30 2019	(r350302)
+++ head/sys/modules/i2c/controllers/ichiic/Makefile	Wed Jul 24 21:26:17 2019	(r350303)
@@ -6,7 +6,8 @@ SRCS		= acpi_if.h device_if.h bus_if.h iicbus_if.h pci
 		  smbus_if.h ${ig4_acpi} ig4_iic.c ig4_pci.c ig4_reg.h \
 		  ig4_var.h opt_acpi.h
 
-.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
+.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
+    ${MACHINE_CPUARCH} == "i386"
 ig4_acpi=	ig4_acpi.c
 .endif
 

From owner-svn-src-head@freebsd.org  Wed Jul 24 21:43:42 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B2E4B9D1A;
 Wed, 24 Jul 2019 21:43:42 +0000 (UTC) (envelope-from erj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 350557696C;
 Wed, 24 Jul 2019 21:43:42 +0000 (UTC) (envelope-from erj@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 C19D31CC03;
 Wed, 24 Jul 2019 21:43:41 +0000 (UTC) (envelope-from erj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6OLhfSW092080;
 Wed, 24 Jul 2019 21:43:41 GMT (envelope-from erj@FreeBSD.org)
Received: (from erj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6OLhfWI092079;
 Wed, 24 Jul 2019 21:43:41 GMT (envelope-from erj@FreeBSD.org)
Message-Id: <201907242143.x6OLhfWI092079@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org
 using -f
From: Eric Joyner <erj@FreeBSD.org>
Date: Wed, 24 Jul 2019 21:43:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350306 - head/sys/net
X-SVN-Group: head
X-SVN-Commit-Author: erj
X-SVN-Commit-Paths: head/sys/net
X-SVN-Commit-Revision: 350306
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 350557696C
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jul 2019 21:43:42 -0000

Author: erj
Date: Wed Jul 24 21:43:41 2019
New Revision: 350306
URL: https://svnweb.freebsd.org/changeset/base/350306

Log:
  iflib: fix dangling device softc pointer
  
  Commit text by Jake:
  If a driver's IFDI_ATTACH_PRE function fails, the iflib_device_register
  function will free the ctx pointer. However, it does not reset the
  device softc pointer to NULL.
  
  This will result in memory corruption as a future access to the now
  invalid pointer will corrupt memory that is later allocated on top of
  the same memory location.
  
  The iflib_device_deregister function correctly resets the softc pointer
  by using device_set_softc().
  
  This clears up the invalid dangling pointer and prevents memory
  corruption that could lead to a panic or undefined behavior if the
  device's driver failed to attach.
  
  Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
  
  Submitted by:	Jacob Keller <jacob.e.keller@intel.com>
  Reviewed by:	erj@, gallatin@
  MFC after:	1 week
  Sponsored by:	Intel Corporation
  Differential Revision:	https://reviews.freebsd.org/D21003

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==============================================================================
--- head/sys/net/iflib.c	Wed Jul 24 21:40:34 2019	(r350305)
+++ head/sys/net/iflib.c	Wed Jul 24 21:43:41 2019	(r350306)
@@ -4785,6 +4785,7 @@ fail_queues:
 fail_unlock:
 	CTX_UNLOCK(ctx);
 fail_ctx_free:
+	device_set_softc(ctx->ifc_dev, NULL);
         if (ctx->ifc_flags & IFC_SC_ALLOCATED)
                 free(ctx->ifc_softc, M_IFLIB);
         free(ctx, M_IFLIB);

From owner-svn-src-head@freebsd.org  Wed Jul 24 22:15:00 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id C2430BA828;
 Wed, 24 Jul 2019 22:15:00 +0000 (UTC)
 (envelope-from madpilot@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 A29C480044;
 Wed, 24 Jul 2019 22:15:00 +0000 (UTC)
 (envelope-from madpilot@FreeBSD.org)
Received: from tommy.madpilot.net (78-134-115-11.v4.ngi.it [78.134.115.11])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client did not present a certificate)
 (Authenticated sender: madpilot/mail)
 by smtp.freebsd.org (Postfix) with ESMTPSA id D17612AD;
 Wed, 24 Jul 2019 22:14:59 +0000 (UTC)
 (envelope-from madpilot@FreeBSD.org)
Subject: Re: svn commit: r350135 - head/share/mk
To: Emmanuel Vadot <manu@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
References: <201907191511.x6JFBWVi053537@repo.freebsd.org>
From: Guido Falsi <madpilot@FreeBSD.org>
Openpgp: preference=signencrypt
Autocrypt: addr=madpilot@FreeBSD.org; prefer-encrypt=mutual; keydata=
 mQENBE+G+l0BCADi/WBQ0aRJfnE7LBPsM0G3m/m3Yx7OPu4iYFvS84xawmRHtCNjWIntsxuX
 fptkmEo3Rsw816WUrek8dxoUAYdHd+EcpBcnnDzfDH5LW/TZ4gbrFezrHPdRp7wdxi23GN80
 qPwHEwXuF0X4Wy5V0OO8B6VT/nA0ADYnBDhXS52HGIJ/GCUjgqJn+phDTdCFLvrSFdmgx4Wl
 c0W5Z1p5cmDF9l8L/hc959AeyNf7I9dXnjekGM9gVv7UDUYzCifR3U8T0fnfdMmS8NeI9NC+
 wuREpRO4lKOkTnj9TtQJRiptlhcHQiAlG1cFqs7EQo57Tqq6cxD1FycZJLuC32bGbgalABEB
 AAG0Ikd1aWRvIEZhbHNpIDxtYWRwaWxvdEBGcmVlQlNELm9yZz6JATYEEwEIACACGwMCHgEC
 F4AFAlLvzwUFCwkIBwMFFQoJCAsEFgIDAQAKCRAa5oYOVsvSk6EzCAC4ovSo6XF4x0spuKmp
 RzVuZ5ywqCJAfRIrJHpW8HjSPkcUYwmXVOE3zjul9j2C2eHPPGobEDN5FqovAtzb7HdYGGcU
 aUdhDApUMMRVkzflwb23C/CI1RBcZxjC0noajSKgbIHx4+Afg6CFMgpngq+NJwEaaVrKlYzq
 G+KcfeVKAdwlWHJOgQJIEylUtwtBqXx/iJDrGwKO5A6a1uSEZrZfuwjSh8cBqoUfIwLZUIFE
 HBjHa8pUkp8mWx7JaZ19vBF6pDpPVZSoLSg8stWd1DPesn/qySYgtSGSY6hpWABVF98HRsBG
 +VXlHtqCaB0j0cGCDhCpHQUI10oGGc8k4zcvuQINBFMQe0EBEAChYaw3HqD3SvyBw0pqI+kk
 GIrLzO1XYXJXkuxPQ6BAFbe8jG3+h22zFU02OnJL8E1kLLMsCwVzVasYHOFiyY831IYHn/lh
 O+TN/lhWJTlUCxmWP8xFYJmta2mJzhzQDs3hyw5hF422T+rxgHg8gWxn0D6RO6hmGe7m3k91
 8EDvj5JXAq7zj49mT3AMRjUtsVVPy8zjagqyaizCUiHAnbG4kj+BuT5wxR7TKJGk2OjhK/Dh
 EHzgHq4XB1Gv8+1LvGLZmqih/kBpBP1hIGkakok579CTkw/g8XoWqr6Cjz2fvtjaQmTBwdou
 gP8Yn5kMBIiIxF7XLngUc5DVEJMYamcktd0q4aHC/cnbWlTwc2WrQBI1AwxCZgDC1RbOOan8
 oTIjWqRyaNp9zFvxOaJqgrxJA3Vl/3p9z+witk3pnmg4ITLIJDSmsf89MDaOVGQpDjzs9MaT
 YlIpTlW5Lns2WTYOue+NanntpX14UCGmeusk+4aYXPzf89zyALS3s3uLtVUdhFwLmdrFgHZS
 gjU5STLGlP8e9AVddVnf8qZ1czOvHX3UCCAI9YjBQA/5VxpRFJil4OTr9lUA5U57UKGpwmKw
 IPvArbT8468nYC2Rat4a7UJn3NLHucr9Vh0uvfgbFDhtPUb72sFA2cVI1tfZMnjfUx2jUYKM
 N5ErgK1Kes0piQARAQABiQEfBBgBCAAJBQJTEHtBAhsMAAoJEBrmhg5Wy9KTDecIAOGwpF/6
 sBFQtOk6HkegtqbrZklkDIKQ2qq7+uR7m6PkBpoNj+HsE2EEOIOqGFktN6h8alVVoSs+xY36
 1fnR/Kmwi30oCHL3QYWu2shmVa7IrjCyhm8N+n3JpGT6Ugznx3D9Fx/GfrvQlo9MVJE8QJWf
 +4uoGElKRtiVjbXZhP1/FVRMl7rAi8MtCtASOtAP+HUUyF9wuECqyd2W1F3oM+9Mp4x3/pUD
 GfSGSgEqETLkuRaMz0Iemm75sGRD3X+SPa4lBJc7x66ifAcdLdz7o3aLYfsjR6Zwca7TvC5E
 Ha0OfD9EsHGiF9909lPaRvG4buWFUfPBUPDkNHBLDwaQ53I=
Message-ID: <37944eff-6e00-df14-59d3-beae3fa89b6a@FreeBSD.org>
Date: Thu, 25 Jul 2019 00:14:56 +0200
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101
 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <201907191511.x6JFBWVi053537@repo.freebsd.org>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Rspamd-Queue-Id: A29C480044
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_SHORT(-0.98)[-0.978,0];
 ASN(0.00)[asn:11403, ipnet:96.47.64.0/20, country:US];
 NEURAL_HAM_MEDIUM(-1.00)[-1.000,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jul 2019 22:15:00 -0000

On 19/07/19 17:11, Emmanuel Vadot wrote:
> Author: manu
> Date: Fri Jul 19 15:11:32 2019
> New Revision: 350135
> URL: https://svnweb.freebsd.org/changeset/base/350135
> 
> Log:
>   bsd.confs.mk: Test the correct value for the destination package
>   
>   Reviewed by:	bapt, gjb
>   Differential Revision:	https://reviews.freebsd.org/D20961
> 

Hello,

I don't know the actual workings of this file and have not checked it in
depth, but this change is causing "make package" to not package
/etc/rc.d/sshd (and others, all the ones being defined in
${group}PACKAGE variables), which are then missing when upgrading machines.

Reverting this change makes packaging things work again. I think this
change is actually wrong and the previous version was correct.

-- 
Guido Falsi <madpilot@FreeBSD.org>

From owner-svn-src-head@freebsd.org  Wed Jul 24 22:17:33 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2281EBA8D2;
 Wed, 24 Jul 2019 22:17:33 +0000 (UTC)
 (envelope-from madpilot@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 048CF8021C;
 Wed, 24 Jul 2019 22:17:33 +0000 (UTC)
 (envelope-from madpilot@FreeBSD.org)
Received: from tommy.madpilot.net (78-134-115-11.v4.ngi.it [78.134.115.11])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client did not present a certificate)
 (Authenticated sender: madpilot/mail)
 by smtp.freebsd.org (Postfix) with ESMTPSA id 363542AE;
 Wed, 24 Jul 2019 22:17:32 +0000 (UTC)
 (envelope-from madpilot@FreeBSD.org)
Subject: Re: svn commit: r350135 - head/share/mk
From: Guido Falsi <madpilot@FreeBSD.org>
To: Emmanuel Vadot <manu@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
References: <201907191511.x6JFBWVi053537@repo.freebsd.org>
 <37944eff-6e00-df14-59d3-beae3fa89b6a@FreeBSD.org>
Openpgp: preference=signencrypt
Autocrypt: addr=madpilot@FreeBSD.org; prefer-encrypt=mutual; keydata=
 mQENBE+G+l0BCADi/WBQ0aRJfnE7LBPsM0G3m/m3Yx7OPu4iYFvS84xawmRHtCNjWIntsxuX
 fptkmEo3Rsw816WUrek8dxoUAYdHd+EcpBcnnDzfDH5LW/TZ4gbrFezrHPdRp7wdxi23GN80
 qPwHEwXuF0X4Wy5V0OO8B6VT/nA0ADYnBDhXS52HGIJ/GCUjgqJn+phDTdCFLvrSFdmgx4Wl
 c0W5Z1p5cmDF9l8L/hc959AeyNf7I9dXnjekGM9gVv7UDUYzCifR3U8T0fnfdMmS8NeI9NC+
 wuREpRO4lKOkTnj9TtQJRiptlhcHQiAlG1cFqs7EQo57Tqq6cxD1FycZJLuC32bGbgalABEB
 AAG0Ikd1aWRvIEZhbHNpIDxtYWRwaWxvdEBGcmVlQlNELm9yZz6JATYEEwEIACACGwMCHgEC
 F4AFAlLvzwUFCwkIBwMFFQoJCAsEFgIDAQAKCRAa5oYOVsvSk6EzCAC4ovSo6XF4x0spuKmp
 RzVuZ5ywqCJAfRIrJHpW8HjSPkcUYwmXVOE3zjul9j2C2eHPPGobEDN5FqovAtzb7HdYGGcU
 aUdhDApUMMRVkzflwb23C/CI1RBcZxjC0noajSKgbIHx4+Afg6CFMgpngq+NJwEaaVrKlYzq
 G+KcfeVKAdwlWHJOgQJIEylUtwtBqXx/iJDrGwKO5A6a1uSEZrZfuwjSh8cBqoUfIwLZUIFE
 HBjHa8pUkp8mWx7JaZ19vBF6pDpPVZSoLSg8stWd1DPesn/qySYgtSGSY6hpWABVF98HRsBG
 +VXlHtqCaB0j0cGCDhCpHQUI10oGGc8k4zcvuQINBFMQe0EBEAChYaw3HqD3SvyBw0pqI+kk
 GIrLzO1XYXJXkuxPQ6BAFbe8jG3+h22zFU02OnJL8E1kLLMsCwVzVasYHOFiyY831IYHn/lh
 O+TN/lhWJTlUCxmWP8xFYJmta2mJzhzQDs3hyw5hF422T+rxgHg8gWxn0D6RO6hmGe7m3k91
 8EDvj5JXAq7zj49mT3AMRjUtsVVPy8zjagqyaizCUiHAnbG4kj+BuT5wxR7TKJGk2OjhK/Dh
 EHzgHq4XB1Gv8+1LvGLZmqih/kBpBP1hIGkakok579CTkw/g8XoWqr6Cjz2fvtjaQmTBwdou
 gP8Yn5kMBIiIxF7XLngUc5DVEJMYamcktd0q4aHC/cnbWlTwc2WrQBI1AwxCZgDC1RbOOan8
 oTIjWqRyaNp9zFvxOaJqgrxJA3Vl/3p9z+witk3pnmg4ITLIJDSmsf89MDaOVGQpDjzs9MaT
 YlIpTlW5Lns2WTYOue+NanntpX14UCGmeusk+4aYXPzf89zyALS3s3uLtVUdhFwLmdrFgHZS
 gjU5STLGlP8e9AVddVnf8qZ1czOvHX3UCCAI9YjBQA/5VxpRFJil4OTr9lUA5U57UKGpwmKw
 IPvArbT8468nYC2Rat4a7UJn3NLHucr9Vh0uvfgbFDhtPUb72sFA2cVI1tfZMnjfUx2jUYKM
 N5ErgK1Kes0piQARAQABiQEfBBgBCAAJBQJTEHtBAhsMAAoJEBrmhg5Wy9KTDecIAOGwpF/6
 sBFQtOk6HkegtqbrZklkDIKQ2qq7+uR7m6PkBpoNj+HsE2EEOIOqGFktN6h8alVVoSs+xY36
 1fnR/Kmwi30oCHL3QYWu2shmVa7IrjCyhm8N+n3JpGT6Ugznx3D9Fx/GfrvQlo9MVJE8QJWf
 +4uoGElKRtiVjbXZhP1/FVRMl7rAi8MtCtASOtAP+HUUyF9wuECqyd2W1F3oM+9Mp4x3/pUD
 GfSGSgEqETLkuRaMz0Iemm75sGRD3X+SPa4lBJc7x66ifAcdLdz7o3aLYfsjR6Zwca7TvC5E
 Ha0OfD9EsHGiF9909lPaRvG4buWFUfPBUPDkNHBLDwaQ53I=
Message-ID: <28eb9717-533e-3d87-0e30-f60317ed97cb@FreeBSD.org>
Date: Thu, 25 Jul 2019 00:17:31 +0200
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101
 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <37944eff-6e00-df14-59d3-beae3fa89b6a@FreeBSD.org>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Rspamd-Queue-Id: 048CF8021C
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:96.47.64.0/20, 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jul 2019 22:17:33 -0000

On 25/07/19 00:14, Guido Falsi wrote:
> On 19/07/19 17:11, Emmanuel Vadot wrote:
>> Author: manu
>> Date: Fri Jul 19 15:11:32 2019
>> New Revision: 350135
>> URL: https://svnweb.freebsd.org/changeset/base/350135
>>
>> Log:
>>   bsd.confs.mk: Test the correct value for the destination package
>>   
>>   Reviewed by:	bapt, gjb
>>   Differential Revision:	https://reviews.freebsd.org/D20961
>>
> 
> Hello,
> 
> I don't know the actual workings of this file and have not checked it in
> depth, but this change is causing "make package" to not package
> /etc/rc.d/sshd (and others, all the ones being defined in
> ${group}PACKAGE variables), which are then missing when upgrading machines.
> 
> Reverting this change makes packaging things work again. I think this
> change is actually wrong and the previous version was correct.
> 

After sending this message I also noticed, it causes the spurious
"FreeBSD-zfs" package to be generated again.

-- 
Guido Falsi <madpilot@FreeBSD.org>

From owner-svn-src-head@freebsd.org  Wed Jul 24 22:50:45 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA481BB77C;
 Wed, 24 Jul 2019 22:50:45 +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 AD2D1819C3;
 Wed, 24 Jul 2019 22:50:45 +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 84B781D7A3;
 Wed, 24 Jul 2019 22:50:45 +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 x6OMojud029435;
 Wed, 24 Jul 2019 22:50:45 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6OMoidw029429;
 Wed, 24 Jul 2019 22:50:44 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201907242250.x6OMoidw029429@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Wed, 24 Jul 2019 22:50:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350307 - in head: . lib/libcasper/libcasper
 lib/libcasper/services lib/libcasper/services/cap_random share/mk sys/sys
 targets/pseudo/userland/lib
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: in head: . lib/libcasper/libcasper lib/libcasper/services
 lib/libcasper/services/cap_random share/mk sys/sys
 targets/pseudo/userland/lib
X-SVN-Commit-Revision: 350307
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: AD2D1819C3
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jul 2019 22:50:45 -0000

Author: markj
Date: Wed Jul 24 22:50:43 2019
New Revision: 350307
URL: https://svnweb.freebsd.org/changeset/base/350307

Log:
  Remove cap_random(3).
  
  Now that we have a way to obtain entropy in capability mode
  (getrandom(2)), libcap_random is obsolete.  Remove it.
  
  Bump __FreeBSD_version in case anything happens to use it, though I've
  found no consumers.
  
  Reviewed by:	delphij, emaste, oshogbo
  Relnotes:	yes
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21033

Deleted:
  head/lib/libcasper/services/cap_random/
Modified:
  head/ObsoleteFiles.inc
  head/lib/libcasper/libcasper/libcasper.3
  head/lib/libcasper/services/Makefile
  head/share/mk/src.libnames.mk
  head/sys/sys/param.h
  head/targets/pseudo/userland/lib/Makefile.depend

Modified: head/ObsoleteFiles.inc
==============================================================================
--- head/ObsoleteFiles.inc	Wed Jul 24 21:43:41 2019	(r350306)
+++ head/ObsoleteFiles.inc	Wed Jul 24 22:50:43 2019	(r350307)
@@ -38,6 +38,11 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20190722: cap_random(3) removed
+OLD_FILES+=lib/casper/libcap_random.so.1
+OLD_FILES+=usr/include/casper/cap_random.h
+OLD_FILES+=usr/share/man/man3/cap_random.3.gz
+OLD_FILES+=usr/share/man/man3/cap_random_buf.3.gz
 # 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)

Modified: head/lib/libcasper/libcasper/libcasper.3
==============================================================================
--- head/lib/libcasper/libcasper/libcasper.3	Wed Jul 24 21:43:41 2019	(r350306)
+++ head/lib/libcasper/libcasper/libcasper.3	Wed Jul 24 22:50:43 2019	(r350307)
@@ -264,7 +264,6 @@ functions always succeed.
 .Xr cap_dns 3 ,
 .Xr cap_grp 3 ,
 .Xr cap_pwd 3 ,
-.Xr cap_random 3 ,
 .Xr cap_sysctl 3 ,
 .Xr cap_syslog 3 ,
 .Xr libcasper_service 3 ,

Modified: head/lib/libcasper/services/Makefile
==============================================================================
--- head/lib/libcasper/services/Makefile	Wed Jul 24 21:43:41 2019	(r350306)
+++ head/lib/libcasper/services/Makefile	Wed Jul 24 22:50:43 2019	(r350307)
@@ -6,7 +6,6 @@ SUBDIR=		cap_dns
 SUBDIR+=	cap_fileargs
 SUBDIR+=	cap_grp
 SUBDIR+=	cap_pwd
-SUBDIR+=	cap_random
 SUBDIR+=	cap_sysctl
 SUBDIR+=	cap_syslog
 

Modified: head/share/mk/src.libnames.mk
==============================================================================
--- head/share/mk/src.libnames.mk	Wed Jul 24 21:43:41 2019	(r350306)
+++ head/share/mk/src.libnames.mk	Wed Jul 24 22:50:43 2019	(r350307)
@@ -82,7 +82,6 @@ _LIBRARIES=	\
 		cap_fileargs \
 		cap_grp \
 		cap_pwd \
-		cap_random \
 		cap_sysctl \
 		cap_syslog \
 		com_err \
@@ -260,7 +259,6 @@ _DP_cap_dns=	nv
 _DP_cap_fileargs=	nv
 _DP_cap_grp=	nv
 _DP_cap_pwd=	nv
-_DP_cap_random=	nv
 _DP_cap_sysctl=	nv
 _DP_cap_syslog=	nv
 .if ${MK_OFED} != "no"
@@ -599,7 +597,6 @@ LIBCASPERDIR=	${OBJTOP}/lib/libcasper/libcasper
 LIBCAP_DNSDIR=	${OBJTOP}/lib/libcasper/services/cap_dns
 LIBCAP_GRPDIR=	${OBJTOP}/lib/libcasper/services/cap_grp
 LIBCAP_PWDDIR=	${OBJTOP}/lib/libcasper/services/cap_pwd
-LIBCAP_RANDOMDIR=	${OBJTOP}/lib/libcasper/services/cap_random
 LIBCAP_SYSCTLDIR=	${OBJTOP}/lib/libcasper/services/cap_sysctl
 LIBCAP_SYSLOGDIR=	${OBJTOP}/lib/libcasper/services/cap_syslog
 LIBBSDXMLDIR=	${OBJTOP}/lib/libexpat

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h	Wed Jul 24 21:43:41 2019	(r350306)
+++ head/sys/sys/param.h	Wed Jul 24 22:50:43 2019	(r350307)
@@ -60,7 +60,7 @@
  *		in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1300036	/* Master, propagated to newvers */
+#define __FreeBSD_version 1300037	/* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,

Modified: head/targets/pseudo/userland/lib/Makefile.depend
==============================================================================
--- head/targets/pseudo/userland/lib/Makefile.depend	Wed Jul 24 21:43:41 2019	(r350306)
+++ head/targets/pseudo/userland/lib/Makefile.depend	Wed Jul 24 22:50:43 2019	(r350307)
@@ -221,7 +221,6 @@ DIRDEPS+= \
 	lib/libcasper/services/cap_dns \
 	lib/libcasper/services/cap_grp \
 	lib/libcasper/services/cap_pwd \
-	lib/libcasper/services/cap_random \
 	lib/libcasper/services/cap_sysctl \
 
 .endif

From owner-svn-src-head@freebsd.org  Wed Jul 24 22:57:18 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 94964BBA3E;
 Wed, 24 Jul 2019 22:57:18 +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 75B83821E7;
 Wed, 24 Jul 2019 22:57:18 +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 4656D1D985;
 Wed, 24 Jul 2019 22:57:18 +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 x6OMvI16033548;
 Wed, 24 Jul 2019 22:57:18 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6OMvIve033547;
 Wed, 24 Jul 2019 22:57:18 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201907242257.x6OMvIve033547@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Wed, 24 Jul 2019 22:57:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350308 - head
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: head
X-SVN-Commit-Revision: 350308
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 75B83821E7
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.89 / 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.89)[-0.895,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jul 2019 22:57:18 -0000

Author: markj
Date: Wed Jul 24 22:57:17 2019
New Revision: 350308
URL: https://svnweb.freebsd.org/changeset/base/350308

Log:
  Document r350307.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/RELNOTES

Modified: head/RELNOTES
==============================================================================
--- head/RELNOTES	Wed Jul 24 22:50:43 2019	(r350307)
+++ head/RELNOTES	Wed Jul 24 22:57:17 2019	(r350308)
@@ -10,6 +10,10 @@ newline.  Entries should be separated by a newline.
 
 Changes to this file should not be MFCed.
 
+r350307:
+	libcap_random(3) has been removed.  Applications can use native
+	APIs to get random data in capability mode.
+
 r349352:
 	nand(4) and related components have been removed.
 

From owner-svn-src-head@freebsd.org  Wed Jul 24 23:04:27 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 55014BBC87;
 Wed, 24 Jul 2019 23:04:27 +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 3564A82776;
 Wed, 24 Jul 2019 23:04:27 +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 103821DB44;
 Wed, 24 Jul 2019 23:04:27 +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 x6ON4QnW039733;
 Wed, 24 Jul 2019 23:04:26 GMT (envelope-from imp@FreeBSD.org)
Received: (from imp@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6ON4Q3d039732;
 Wed, 24 Jul 2019 23:04:26 GMT (envelope-from imp@FreeBSD.org)
Message-Id: <201907242304.x6ON4Q3d039732@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org
 using -f
From: Warner Losh <imp@FreeBSD.org>
Date: Wed, 24 Jul 2019 23:04:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350309 - head/sbin/nvmecontrol
X-SVN-Group: head
X-SVN-Commit-Author: imp
X-SVN-Commit-Paths: head/sbin/nvmecontrol
X-SVN-Commit-Revision: 350309
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 3564A82776
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.89 / 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.89)[-0.895,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jul 2019 23:04:27 -0000

Author: imp
Date: Wed Jul 24 23:04:26 2019
New Revision: 350309
URL: https://svnweb.freebsd.org/changeset/base/350309

Log:
  Fix several related coverity issues:
  
  Make sure to always free shortopts and lopts when returning.
  Fix minor logic bug to guard against NULLs properly.
  
  CID: 1403654, 1403656, 1403658

Modified:
  head/sbin/nvmecontrol/comnd.c
  head/sbin/nvmecontrol/logpage.c

Modified: head/sbin/nvmecontrol/comnd.c
==============================================================================
--- head/sbin/nvmecontrol/comnd.c	Wed Jul 24 22:57:17 2019	(r350308)
+++ head/sbin/nvmecontrol/comnd.c	Wed Jul 24 23:04:26 2019	(r350309)
@@ -155,7 +155,7 @@ find_long(struct option *lopts, int ch)
 
 	for (i = 0; lopts[i].val != ch && lopts[i].name != NULL; i++)
 		continue;
-	return i;
+	return (i);
 }
 
 int
@@ -251,6 +251,8 @@ arg_parse(int argc, char * const * argv, const struct 
 			if (optind >= argc) {
 				fprintf(stderr, "Missing arg %s\n", args->descr);
 				arg_help(argc, argv, f);
+				free(lopts);
+				free(shortopts);
 				return (1);
 			}
 			*(char **)args->ptr = argv[optind++];
@@ -258,10 +260,12 @@ arg_parse(int argc, char * const * argv, const struct 
 		}
 	}
 	free(lopts);
+	free(shortopts);
 	return (0);
 bad_arg:
 	fprintf(stderr, "Bad value to --%s: %s\n", opts[idx].long_arg, optarg);
 	free(lopts);
+	free(shortopts);
 	exit(1);
 }
 

Modified: head/sbin/nvmecontrol/logpage.c
==============================================================================
--- head/sbin/nvmecontrol/logpage.c	Wed Jul 24 22:57:17 2019	(r350308)
+++ head/sbin/nvmecontrol/logpage.c	Wed Jul 24 23:04:26 2019	(r350309)
@@ -465,7 +465,7 @@ logpage(const struct cmd *f, int argc, char *argv[])
 		 * unless the vendors match.
 		 */
 		SLIST_FOREACH(lpf, &logpages, link) {
-			if (lpf->vendor != NULL && vendor != NULL &&
+			if (lpf->vendor == NULL || vendor == NULL ||
 			    strcmp(lpf->vendor, vendor) != 0)
 				continue;
 			if (opt.page != lpf->log_page)

From owner-svn-src-head@freebsd.org  Wed Jul 24 23:05:00 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44CC5BBCED;
 Wed, 24 Jul 2019 23:05: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 24786828DA;
 Wed, 24 Jul 2019 23:05:00 +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 F377A1DB45;
 Wed, 24 Jul 2019 23:04: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 x6ON4xf7039801;
 Wed, 24 Jul 2019 23:04:59 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6ON4xX1039797;
 Wed, 24 Jul 2019 23:04:59 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201907242304.x6ON4xX1039797@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Wed, 24 Jul 2019 23:04:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350310 - in head/sys: kern sys
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: in head/sys: kern sys
X-SVN-Commit-Revision: 350310
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 24786828DA
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jul 2019 23:05:00 -0000

Author: markj
Date: Wed Jul 24 23:04:59 2019
New Revision: 350310
URL: https://svnweb.freebsd.org/changeset/base/350310

Log:
  Fix the turnstile_lock() KPI.
  
  turnstile_{lock,unlock}() were added for use in epoch.  turnstile_lock()
  returned NULL to indicate that the calling thread had lost a race and
  the turnstile was no longer associated with the given lock, or the lock
  owner.  However, reader-writer locks may not have a designated owner,
  in which case turnstile_lock() would return NULL and
  epoch_block_handler_preempt() would leak spinlocks as a result.
  
  Apply a minimal fix: return the lock owner as a separate return value.
  
  Reviewed by:	kib
  MFC after:	3 days
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21048

Modified:
  head/sys/kern/subr_epoch.c
  head/sys/kern/subr_turnstile.c
  head/sys/sys/turnstile.h

Modified: head/sys/kern/subr_epoch.c
==============================================================================
--- head/sys/kern/subr_epoch.c	Wed Jul 24 23:04:26 2019	(r350309)
+++ head/sys/kern/subr_epoch.c	Wed Jul 24 23:04:59 2019	(r350310)
@@ -438,26 +438,20 @@ epoch_block_handler_preempt(struct ck_epoch *global __
 			 */
 			critical_enter();
 			thread_unlock(td);
-			owner = turnstile_lock(ts, &lock);
-			/*
-			 * The owner pointer indicates that the lock succeeded.
-			 * Only in case we hold the lock and the turnstile we
-			 * locked is still the one that curwaittd is blocked on
-			 * can we continue. Otherwise the turnstile pointer has
-			 * been changed out from underneath us, as in the case
-			 * where the lock holder has signalled curwaittd,
-			 * and we need to continue.
-			 */
-			if (owner != NULL && ts == curwaittd->td_blocked) {
-				MPASS(TD_IS_INHIBITED(curwaittd) &&
-				    TD_ON_LOCK(curwaittd));
-				critical_exit();
-				turnstile_wait(ts, owner, curwaittd->td_tsqueue);
-				counter_u64_add(turnstile_count, 1);
-				thread_lock(td);
-				return;
-			} else if (owner != NULL)
+
+			if (turnstile_lock(ts, &lock, &owner)) {
+				if (ts == curwaittd->td_blocked) {
+					MPASS(TD_IS_INHIBITED(curwaittd) &&
+					    TD_ON_LOCK(curwaittd));
+					critical_exit();
+					turnstile_wait(ts, owner,
+					    curwaittd->td_tsqueue);
+					counter_u64_add(turnstile_count, 1);
+					thread_lock(td);
+					return;
+				}
 				turnstile_unlock(ts, lock);
+			}
 			thread_lock(td);
 			critical_exit();
 			KASSERT(td->td_locks == locksheld,

Modified: head/sys/kern/subr_turnstile.c
==============================================================================
--- head/sys/kern/subr_turnstile.c	Wed Jul 24 23:04:26 2019	(r350309)
+++ head/sys/kern/subr_turnstile.c	Wed Jul 24 23:04:59 2019	(r350310)
@@ -566,24 +566,26 @@ turnstile_trywait(struct lock_object *lock)
 	return (ts);
 }
 
-struct thread *
-turnstile_lock(struct turnstile *ts, struct lock_object **lockp)
+bool
+turnstile_lock(struct turnstile *ts, struct lock_object **lockp,
+    struct thread **tdp)
 {
 	struct turnstile_chain *tc;
 	struct lock_object *lock;
 
 	if ((lock = ts->ts_lockobj) == NULL)
-		return (NULL);
+		return (false);
 	tc = TC_LOOKUP(lock);
 	mtx_lock_spin(&tc->tc_lock);
 	mtx_lock_spin(&ts->ts_lock);
 	if (__predict_false(lock != ts->ts_lockobj)) {
 		mtx_unlock_spin(&tc->tc_lock);
 		mtx_unlock_spin(&ts->ts_lock);
-		return (NULL);
+		return (false);
 	}
 	*lockp = lock;
-	return (ts->ts_owner);
+	*tdp = ts->ts_owner;
+	return (true);
 }
 
 void

Modified: head/sys/sys/turnstile.h
==============================================================================
--- head/sys/sys/turnstile.h	Wed Jul 24 23:04:26 2019	(r350309)
+++ head/sys/sys/turnstile.h	Wed Jul 24 23:04:59 2019	(r350310)
@@ -99,7 +99,8 @@ int	turnstile_signal(struct turnstile *, int);
 struct turnstile *turnstile_trywait(struct lock_object *);
 void	turnstile_unpend(struct turnstile *);
 void	turnstile_wait(struct turnstile *, struct thread *, int);
-struct thread *turnstile_lock(struct turnstile *, struct lock_object **);
+bool	turnstile_lock(struct turnstile *, struct lock_object **,
+	    struct thread **);
 void	turnstile_unlock(struct turnstile *, struct lock_object *);
 void	turnstile_assert(struct turnstile *);
 #endif	/* _KERNEL */

From owner-svn-src-head@freebsd.org  Wed Jul 24 23:08:50 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 32F31BBDAD;
 Wed, 24 Jul 2019 23:08: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 13BA382B06;
 Wed, 24 Jul 2019 23:08: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 017DD1DB4A;
 Wed, 24 Jul 2019 23:08: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 x6ON8nPd040029;
 Wed, 24 Jul 2019 23:08:49 GMT (envelope-from imp@FreeBSD.org)
Received: (from imp@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6ON8nRg040028;
 Wed, 24 Jul 2019 23:08:49 GMT (envelope-from imp@FreeBSD.org)
Message-Id: <201907242308.x6ON8nRg040028@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org
 using -f
From: Warner Losh <imp@FreeBSD.org>
Date: Wed, 24 Jul 2019 23:08:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350311 - head/sbin/nvmecontrol
X-SVN-Group: head
X-SVN-Commit-Author: imp
X-SVN-Commit-Paths: head/sbin/nvmecontrol
X-SVN-Commit-Revision: 350311
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 13BA382B06
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.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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jul 2019 23:08:50 -0000

Author: imp
Date: Wed Jul 24 23:08:49 2019
New Revision: 350311
URL: https://svnweb.freebsd.org/changeset/base/350311

Log:
  Fix the fix to the logic bug. Upon further testing, the bug is that we shadoow
  opt.vendor with vendor. We shouldn't. Delete the latter and use the former
  everywhere and restore the prior logic which is now correct.

Modified:
  head/sbin/nvmecontrol/logpage.c

Modified: head/sbin/nvmecontrol/logpage.c
==============================================================================
--- head/sbin/nvmecontrol/logpage.c	Wed Jul 24 23:04:59 2019	(r350310)
+++ head/sbin/nvmecontrol/logpage.c	Wed Jul 24 23:08:49 2019	(r350311)
@@ -403,7 +403,6 @@ logpage(const struct cmd *f, int argc, char *argv[])
 	char				cname[64];
 	uint32_t			nsid, size;
 	void				*buf;
-	const char			*vendor = NULL;
 	const struct logpage_function	*lpf;
 	struct nvme_controller_data	cdata;
 	print_fn_t			print_fn;
@@ -465,8 +464,8 @@ logpage(const struct cmd *f, int argc, char *argv[])
 		 * unless the vendors match.
 		 */
 		SLIST_FOREACH(lpf, &logpages, link) {
-			if (lpf->vendor == NULL || vendor == NULL ||
-			    strcmp(lpf->vendor, vendor) != 0)
+			if (lpf->vendor != NULL && opt.vendor != NULL &&
+			    strcmp(lpf->vendor, opt.vendor) != 0)
 				continue;
 			if (opt.page != lpf->log_page)
 				continue;

From owner-svn-src-head@freebsd.org  Thu Jul 25 01:57:00 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0EB1BBFCF2;
 Thu, 25 Jul 2019 01:57:00 +0000 (UTC)
 (envelope-from cse.cem@gmail.com)
Received: from mail-io1-f67.google.com (mail-io1-f67.google.com
 [209.85.166.67])
 (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 ECAED88DDA;
 Thu, 25 Jul 2019 01:56:57 +0000 (UTC)
 (envelope-from cse.cem@gmail.com)
Received: by mail-io1-f67.google.com with SMTP id i10so93763576iol.13;
 Wed, 24 Jul 2019 18:56: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:reply-to
 :from:date:message-id:subject:to:cc;
 bh=mYhSleMh0kX4qcI4pHUXwHl0jbw4yu48cFnyNukh5Jo=;
 b=qy+3QFr2Tvbomx7iVQabDiaGVo8rmzV0q3at+hs0Pz6sZYL+U9bi7xLVbmsN459g/c
 l0MxG0NNsDXBi2//rkztJj6B2LuC9Y+qT8JPykIEhYVGKHnPK0IHxNEEDvj89KEET1Zm
 Y2rFAYL2CNZuPcK2+OX14NmNCZmJ4LdldyrB/DP5Mx8hmc/qyWl2t7/cXyrTNE0U3kmM
 n+uY+o1Espgusl8BKH2FvPlxk9JFF44vvXcvJ+ZoNqA0PuEJddWaoN+EA/4s1zfiib1A
 FoOEb6E7lIzfWARdL9VzH4EA9lm6waKPlCoqn+O3o7JuSbkeMAg2URL7BVdOQHdfCTlC
 SGfQ==
X-Gm-Message-State: APjAAAVMgjj/QNs6We5PpvTRyWh9WMeQDvQdjdNjCGRK0+it6WBvbYkT
 LiZPLI9egEy2+BKDZq/aTKyKfEbO
X-Google-Smtp-Source: APXvYqy3qZGqJ4XC0DckebikwJM1C7f4eaXF9U11FyTY5Gsp1+vFg0y4IqzV5XGYAI3jjUiTuAG2rw==
X-Received: by 2002:a02:c550:: with SMTP id g16mr86349353jaj.49.1564019466723; 
 Wed, 24 Jul 2019 18:51:06 -0700 (PDT)
Received: from mail-io1-f47.google.com (mail-io1-f47.google.com.
 [209.85.166.47])
 by smtp.gmail.com with ESMTPSA id u17sm45264149iob.57.2019.07.24.18.51.05
 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128);
 Wed, 24 Jul 2019 18:51:06 -0700 (PDT)
Received: by mail-io1-f47.google.com with SMTP id j6so18655940ioa.5;
 Wed, 24 Jul 2019 18:51:05 -0700 (PDT)
X-Received: by 2002:a02:6d24:: with SMTP id m36mr89865171jac.87.1564019465491; 
 Wed, 24 Jul 2019 18:51:05 -0700 (PDT)
MIME-Version: 1.0
References: <201907101742.x6AHg4os016752@repo.freebsd.org>
In-Reply-To: <201907101742.x6AHg4os016752@repo.freebsd.org>
Reply-To: cem@freebsd.org
From: Conrad Meyer <cem@freebsd.org>
Date: Wed, 24 Jul 2019 18:50:54 -0700
X-Gmail-Original-Message-ID: <CAG6CVpXj_QayDQvLvSi29QHDfesoPuSaA+TRdV6RXEUAPZmagA@mail.gmail.com>
Message-ID: <CAG6CVpXj_QayDQvLvSi29QHDfesoPuSaA+TRdV6RXEUAPZmagA@mail.gmail.com>
Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet
To: Philip Paeps <philip@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>, 
 svn-src-head <svn-src-head@freebsd.org>
Content-Type: text/plain; charset="UTF-8"
X-Rspamd-Queue-Id: ECAED88DDA
X-Spamd-Bar: ----
Authentication-Results: mx1.freebsd.org;
 spf=pass (mx1.freebsd.org: domain of csecem@gmail.com designates 209.85.166.67
 as permitted sender) smtp.mailfrom=csecem@gmail.com
X-Spamd-Result: default: False [-4.33 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[];
 HAS_REPLYTO(0.00)[cem@freebsd.org];
 R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17];
 REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[4];
 TO_DN_ALL(0.00)[];
 MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com];
 NEURAL_HAM_SHORT(-0.74)[-0.737,0];
 FORGED_SENDER(0.30)[cem@freebsd.org,csecem@gmail.com];
 MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[];
 FREEMAIL_ENVFROM(0.00)[gmail.com];
 ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US];
 TAGGED_FROM(0.00)[]; ARC_NA(0.00)[];
 NEURAL_HAM_MEDIUM(-1.00)[-1.000,0];
 FROM_NEQ_ENVFROM(0.00)[cem@freebsd.org,csecem@gmail.com];
 FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4];
 TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0];
 MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org];
 RCVD_TLS_LAST(0.00)[];
 RCVD_IN_DNSWL_NONE(0.00)[67.166.85.209.list.dnswl.org : 127.0.5.0];
 IP_SCORE(-1.59)[ip: (-2.01), ipnet: 209.85.128.0/17(-3.44), asn: 15169(-2.43),
 country: US(-0.05)]
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 01:57:00 -0000

Hi Philip,

Sorry I'm late to the party.  Unless I am mistaken, most of these are
*not* overflows or vulnerabilities of any sort.

On Wed, Jul 10, 2019 at 10:42 AM Philip Paeps <philip@freebsd.org> 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
>...
> --- 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);

This patch makes no functional change, except gethostname()'s 2nd
parameter is now 257 instead of 256.  It was not an overflow before
and the formatted malloc contents are identical.

> 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);

This one actually overflowed before.  But the new behavior isn't much
better.  Truncating the formatted string arbitrarily is still wrong;
it would be better to errx() or assert() or abort().

> @@ -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 ... */

Unless I'm miscounting, this could not overflow (on any FreeBSD system
with 64-bit or smaller long)...

> 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" : "",

This one could not overflow before either.

I think most of this change is an unnecessary regression, and the
actual overflow should be fixed in a better way anyway.

Thanks,
Conrad

From owner-svn-src-head@freebsd.org  Thu Jul 25 02:03:21 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id B77CCC001F;
 Thu, 25 Jul 2019 02:03:21 +0000 (UTC)
 (envelope-from cy.schubert@cschubert.com)
Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.138])
 (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 65B008933A;
 Thu, 25 Jul 2019 02:03:20 +0000 (UTC)
 (envelope-from cy.schubert@cschubert.com)
Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA
 id qT6Dh4RqoSrVcqT6Eh8fyM; Wed, 24 Jul 2019 20:03:18 -0600
X-Authority-Analysis: v=2.3 cv=L5ZjvNb8 c=1 sm=1 tr=0
 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17
 a=kj9zAlcOel0A:10 a=0o9FgrsRnhwA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8
 a=syWdyGADkbmwRjC54sMA: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 8BD4E21C;
 Wed, 24 Jul 2019 19:03:16 -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 x6P23G2K076821;
 Wed, 24 Jul 2019 19:03:16 -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 x6P23GeQ076818;
 Wed, 24 Jul 2019 19:03:16 -0700 (PDT)
 (envelope-from Cy.Schubert@cschubert.com)
Message-Id: <201907250203.x6P23GeQ076818@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 <Cy.Schubert@cschubert.com>
From: Cy Schubert <Cy.Schubert@cschubert.com>
X-os: FreeBSD
X-Sender: cy@cwsent.com
X-URL: http://www.cschubert.com/
To: Ed Maste <emaste@FreeBSD.org>
cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: Re: svn commit: r350301 - head/lib/libsysdecode
In-reply-to: <201907242106.x6OL6KaM068071@repo.freebsd.org>
References: <201907242106.x6OL6KaM068071@repo.freebsd.org>
Comments: In-reply-to Ed Maste <emaste@FreeBSD.org>
 message dated "Wed, 24 Jul 2019 21:06:20 -0000."
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Wed, 24 Jul 2019 19:03:16 -0700
X-CMAE-Envelope: MS4wfIWkKP+oCORx6rJ2Kf9lt8Qc+4lSdlEtOSa0q6ncpWCarnvkwVfxLoSa7vqT3Y7ooVEZkxjauKYkgDujozD0D0I8qoR6JQhnBjvvBduaggnBNkQACwaU
 7DvwmjqcsAAEbU2Fnhnv7Ba4rVOOAArcrZm9QbeusNXy3GvpcUXPsH9KjagmhvE9mvVh5nNauq2lm+Ozhe6BIfQbkfHjWDqIsGDgyO1uG4k6nBXxoYBnsKgv
 mf6WAMQKOE6KPykOHaHmLE1fn7xdYO4K1qTTCXf01cycp6jUL/eTXmzTPNL003fW
X-Rspamd-Queue-Id: 65B008933A
X-Spamd-Bar: ----
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-4.92 / 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.44)[ip: (-6.42), ipnet: 64.59.128.0/20(-3.21), asn: 6327(-2.50),
 country: CA(-0.09)]; 
 MX_GOOD(-0.01)[cached: spqr.komquats.com];
 NEURAL_HAM_SHORT(-0.87)[-0.867,0];
 RCVD_IN_DNSWL_NONE(0.00)[138.136.59.64.list.dnswl.org : 127.0.5.0];
 NEURAL_HAM_MEDIUM(-1.00)[-1.000,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)[];
 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 02:03:21 -0000

In message <201907242106.x6OL6KaM068071@repo.freebsd.org>, Ed Maste 
writes:
> Author: emaste
> Date: Wed Jul 24 21:06:19 2019
> New Revision: 350301
> URL: https://svnweb.freebsd.org/changeset/base/350301
>
> Log:
>   libsysdecode: add explicit dependencies on recently changed headers
>   
>   r349369 removed IP_MIN_MEMBERSHIPS and IPV6_MIN_MEMBERSHIPS, and r349893
>   removed TCP_RACK_SESS_CWV. libsysdecode lacked dependencies to trigger a
>   rebuild of tables.h.
>   
>   Add explicit dependencies as a workaround to address these specific
>   cases; a holistic solution is still needed.
>   
>   Sponsored by:	The FreeBSD Foundation
>
> Modified:
>   head/lib/libsysdecode/Makefile
>
> Modified: head/lib/libsysdecode/Makefile
> =============================================================================
> =
> --- head/lib/libsysdecode/Makefile	Wed Jul 24 20:17:39 2019	(r35030
> 0)
> +++ head/lib/libsysdecode/Makefile	Wed Jul 24 21:06:19 2019	(r35030
> 1)
> @@ -123,7 +123,8 @@ CFLAGS.gcc.ioctl.c+= -Wno-redundant-decls
>  CFLAGS.gcc+=	${CFLAGS.gcc.${.IMPSRC}}
>  
>  DEPENDOBJS+=	tables.h
> -tables.h: mktables
> +tables.h: mktables ${SYSROOT}/sys/netinet/in.h ${SYSROOT}/sys/netinet/tcp.h 
> \
> +    ${SYSROOT}/sys/netinet6/in6.h
>  	sh ${.CURDIR}/mktables ${SYSROOT:U${DESTDIR}}${INCLUDEDIR} ${.TARGET}.t
> mp && \
>  	    mv -f ${.TARGET}.tmp ${.TARGET}
>  
>

Hi Ed,

This breaks 32-bit compatibility builds on amd64.

--- all_subdir_lib/libsysdecode ---
===> lib/libsysdecode (all)
make[5]: make[5]: don't know how to make /export/obj/opt/src/svn-current
/amd64.amd64/obj-lib32/tmp/sys/netinet/in.h. Stop

make[5]: stopped in /opt/src/svn-current/lib/libsysdecode


-- 
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   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 25 03:47:29 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 523D1C1C4A;
 Thu, 25 Jul 2019 03:47:29 +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 0CF598CA17;
 Thu, 25 Jul 2019 03:47:29 +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 96A5F20DDB;
 Thu, 25 Jul 2019 03:47:28 +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 x6P3lSUZ006283;
 Thu, 25 Jul 2019 03:47:28 GMT (envelope-from jhibbits@FreeBSD.org)
Received: (from jhibbits@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6P3lRpT006278;
 Thu, 25 Jul 2019 03:47:27 GMT (envelope-from jhibbits@FreeBSD.org)
Message-Id: <201907250347.x6P3lRpT006278@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to
 jhibbits@FreeBSD.org using -f
From: Justin Hibbits <jhibbits@FreeBSD.org>
Date: Thu, 25 Jul 2019 03:47:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350313 - in head/sys: conf powerpc/aim powerpc/ps3
 powerpc/pseries
X-SVN-Group: head
X-SVN-Commit-Author: jhibbits
X-SVN-Commit-Paths: in head/sys: conf powerpc/aim powerpc/ps3 powerpc/pseries
X-SVN-Commit-Revision: 350313
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 0CF598CA17
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.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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 03:47:29 -0000

Author: jhibbits
Date: Thu Jul 25 03:47:27 2019
New Revision: 350313
URL: https://svnweb.freebsd.org/changeset/base/350313

Log:
  powerpc/pmap64: Make moea64 statistics optional
  
  Summary:
  It turns out statistics accounting is very expensive in the pmap driver,
  and doesn't seem necessary in the common case.  Make this optional
  behind a MOEA64_STATS #define, which one can set if they really need
  statistics.
  
  This saves ~7-8% on buildworld time on a POWER9.
  
  Found by bdragon.
  
  Reviewed by:	luporl
  Differential Revision: https://reviews.freebsd.org/D20903

Modified:
  head/sys/conf/options.powerpc
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/aim/mmu_oea64.h
  head/sys/powerpc/aim/moea64_native.c
  head/sys/powerpc/ps3/mmu_ps3.c
  head/sys/powerpc/pseries/mmu_phyp.c

Modified: head/sys/conf/options.powerpc
==============================================================================
--- head/sys/conf/options.powerpc	Thu Jul 25 00:07:10 2019	(r350312)
+++ head/sys/conf/options.powerpc	Thu Jul 25 03:47:27 2019	(r350313)
@@ -19,6 +19,7 @@ GFB_DEBUG		opt_gfb.h
 GFB_NO_FONT_LOADING	opt_gfb.h
 GFB_NO_MODE_CHANGE	opt_gfb.h
 
+MOEA64_STATS		opt_pmap.h
 MPC85XX			opt_platform.h
 POWERMAC		opt_platform.h
 PS3			opt_platform.h

Modified: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c	Thu Jul 25 00:07:10 2019	(r350312)
+++ head/sys/powerpc/aim/mmu_oea64.c	Thu Jul 25 03:47:27 2019	(r350313)
@@ -200,6 +200,7 @@ static u_int	moea64_vsid_bitmap[NVSIDS / VSID_NBPW];
 
 static boolean_t moea64_initialized = FALSE;
 
+#ifdef MOEA64_STATS
 /*
  * Statistics.
  */
@@ -218,6 +219,7 @@ SYSCTL_INT(_machdep, OID_AUTO, moea64_pvo_enter_calls,
     &moea64_pvo_enter_calls, 0, "");
 SYSCTL_INT(_machdep, OID_AUTO, moea64_pvo_remove_calls, CTLFLAG_RD,
     &moea64_pvo_remove_calls, 0, "");
+#endif
 
 vm_offset_t	moea64_scratchpage_va[2];
 struct pvo_entry *moea64_scratchpage_pvo[2];
@@ -1434,7 +1436,7 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_offset_t va, v
 
 				/* If not in page table, reinsert it */
 				if (MOEA64_PTE_SYNCH(mmu, oldpvo) < 0) {
-					moea64_pte_overflow--;
+					STAT_MOEA64(moea64_pte_overflow--);
 					MOEA64_PTE_INSERT(mmu, oldpvo);
 				}
 
@@ -2522,7 +2524,7 @@ moea64_pvo_enter(mmu_t mmu, struct pvo_entry *pvo, str
 
 	PMAP_LOCK_ASSERT(pvo->pvo_pmap, MA_OWNED);
 
-	moea64_pvo_enter_calls++;
+	STAT_MOEA64(moea64_pvo_enter_calls++);
 
 	/*
 	 * Add to pmap list
@@ -2557,7 +2559,7 @@ moea64_pvo_enter(mmu_t mmu, struct pvo_entry *pvo, str
 		panic("moea64_pvo_enter: overflow");
 	}
 
-	moea64_pvo_entries++;
+	STAT_MOEA64(moea64_pvo_entries++);
 
 	if (pvo->pvo_pmap == kernel_pmap)
 		isync();
@@ -2656,8 +2658,8 @@ moea64_pvo_remove_from_page_locked(mmu_t mmu, struct p
 		}
 	}
 
-	moea64_pvo_entries--;
-	moea64_pvo_remove_calls++;
+	STAT_MOEA64(moea64_pvo_entries--);
+	STAT_MOEA64(moea64_pvo_remove_calls++);
 }
 
 static void

Modified: head/sys/powerpc/aim/mmu_oea64.h
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.h	Thu Jul 25 00:07:10 2019	(r350312)
+++ head/sys/powerpc/aim/mmu_oea64.h	Thu Jul 25 03:47:27 2019	(r350313)
@@ -30,6 +30,8 @@
 #ifndef _POWERPC_AIM_MMU_OEA64_H
 #define _POWERPC_AIM_MMU_OEA64_H
 
+#include "opt_pmap.h"
+
 #include <machine/mmuvar.h>
 
 extern mmu_def_t oea64_mmu;
@@ -72,8 +74,13 @@ void		moea64_late_bootstrap(mmu_t mmup, vm_offset_t ke
  * Statistics
  */
 
+#ifdef MOEA64_STATS
 extern u_int	moea64_pte_valid;
 extern u_int	moea64_pte_overflow;
+#define STAT_MOEA64(x)	x
+#else
+#define	STAT_MOEA64(x) ((void)0)
+#endif
 
 /*
  * State variables

Modified: head/sys/powerpc/aim/moea64_native.c
==============================================================================
--- head/sys/powerpc/aim/moea64_native.c	Thu Jul 25 00:07:10 2019	(r350312)
+++ head/sys/powerpc/aim/moea64_native.c	Thu Jul 25 03:47:27 2019	(r350313)
@@ -332,7 +332,7 @@ moea64_pte_unset_native(mmu_t mmu, struct pvo_entry *p
 	if ((be64toh(pt->pte_hi & LPTE_AVPN_MASK)) !=
 	    (properpt.pte_hi & LPTE_AVPN_MASK)) {
 		/* Evicted */
-		moea64_pte_overflow--;
+		STAT_MOEA64(moea64_pte_overflow--);
 		rw_runlock(&moea64_eviction_lock);
 		return (-1);
 	}
@@ -352,7 +352,7 @@ moea64_pte_unset_native(mmu_t mmu, struct pvo_entry *p
 	rw_runlock(&moea64_eviction_lock);
 
 	/* Keep statistics */
-	moea64_pte_valid--;
+	STAT_MOEA64(moea64_pte_valid--);
 
 	return (ptelo & (LPTE_CHG | LPTE_REF));
 }
@@ -656,8 +656,8 @@ moea64_insert_to_pteg_native(struct lpte *pvo_pt, uint
 		    (ADDR_API_SHFT64 - ADDR_PIDX_SHFT);
 		PTESYNC();
 		TLBIE(va);
-		moea64_pte_valid--;
-		moea64_pte_overflow++;
+		STAT_MOEA64(moea64_pte_valid--);
+		STAT_MOEA64(moea64_pte_overflow++);
 	}
 
 	/*
@@ -670,7 +670,7 @@ moea64_insert_to_pteg_native(struct lpte *pvo_pt, uint
 	PTESYNC();
 
 	/* Keep statistics */
-	moea64_pte_valid++;
+	STAT_MOEA64(moea64_pte_valid++);
 
 	return (k);
 }

Modified: head/sys/powerpc/ps3/mmu_ps3.c
==============================================================================
--- head/sys/powerpc/ps3/mmu_ps3.c	Thu Jul 25 00:07:10 2019	(r350312)
+++ head/sys/powerpc/ps3/mmu_ps3.c	Thu Jul 25 03:47:27 2019	(r350313)
@@ -224,14 +224,14 @@ mps3_pte_unset(mmu_t mmu, struct pvo_entry *pvo)
 	mtx_lock(&mps3_table_lock);
 	refchg = mps3_pte_synch_locked(pvo);
 	if (refchg < 0) {
-		moea64_pte_overflow--;
+		STAT_MOEA64(moea64_pte_overflow--);
 		mtx_unlock(&mps3_table_lock);
 		return (-1);
 	}
 	/* XXX: race on RC bits between unset and sync. Anything to do? */
 	lv1_write_htab_entry(mps3_vas_id, pvo->pvo_pte.slot, 0, 0);
 	mtx_unlock(&mps3_table_lock);
-	moea64_pte_valid--;
+	STAT_MOEA64(moea64_pte_valid--);
 
 	return (refchg & (LPTE_REF | LPTE_CHG));
 }
@@ -272,13 +272,13 @@ mps3_pte_insert(mmu_t mmu, struct pvo_entry *pvo)
 		pvo->pvo_vaddr |= PVO_HID;
 	pvo->pvo_pte.slot = index;
 
-	moea64_pte_valid++;
+	STAT_MOEA64(moea64_pte_valid++);
 
 	if (evicted.pte_hi) {
 		KASSERT((evicted.pte_hi & (LPTE_WIRED | LPTE_LOCKED)) == 0,
 		    ("Evicted a wired PTE"));
-		moea64_pte_valid--;
-		moea64_pte_overflow++;
+		STAT_MOEA64(moea64_pte_valid--);
+		STAT_MOEA64(moea64_pte_overflow++);
 	}
 
 	return (0);

Modified: head/sys/powerpc/pseries/mmu_phyp.c
==============================================================================
--- head/sys/powerpc/pseries/mmu_phyp.c	Thu Jul 25 00:07:10 2019	(r350312)
+++ head/sys/powerpc/pseries/mmu_phyp.c	Thu Jul 25 03:47:27 2019	(r350313)
@@ -364,7 +364,7 @@ mphyp_pte_unset(mmu_t mmu, struct pvo_entry *pvo)
 	    ("Error removing page: %d", err));
 
 	if (err == H_NOT_FOUND) {
-		moea64_pte_overflow--;
+		STAT_MOEA64(moea64_pte_overflow--);
 		return (-1);
 	}
 
@@ -485,7 +485,7 @@ mphyp_pte_insert(mmu_t mmu, struct pvo_entry *pvo)
 		result = phyp_pft_hcall(H_REMOVE, H_AVPN, index,
 		    evicted.pte_hi & LPTE_AVPN_MASK, 0, &junk, &lastptelo,
 		    &junk);
-		moea64_pte_overflow++;
+		STAT_MOEA64(moea64_pte_overflow++);
 		KASSERT(result == H_SUCCESS || result == H_NOT_FOUND,
 		    ("Error evicting page: %d", (int)result));
 	}

From owner-svn-src-head@freebsd.org  Thu Jul 25 03:55:06 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 120AEC1E1D;
 Thu, 25 Jul 2019 03:55:06 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id E766C8CEE7;
 Thu, 25 Jul 2019 03:55:05 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3F5720FB4;
 Thu, 25 Jul 2019 03:55:05 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6P3t5dU012004;
 Thu, 25 Jul 2019 03:55:05 GMT (envelope-from asomers@FreeBSD.org)
Received: (from asomers@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6P3t55p012003;
 Thu, 25 Jul 2019 03:55:05 GMT (envelope-from asomers@FreeBSD.org)
Message-Id: <201907250355.x6P3t55p012003@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: asomers set sender to
 asomers@FreeBSD.org using -f
From: Alan Somers <asomers@FreeBSD.org>
Date: Thu, 25 Jul 2019 03:55:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350314 - head/lib/libc/gen
X-SVN-Group: head
X-SVN-Commit-Author: asomers
X-SVN-Commit-Paths: head/lib/libc/gen
X-SVN-Commit-Revision: 350314
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: E766C8CEE7
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.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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 03:55:06 -0000

Author: asomers
Date: Thu Jul 25 03:55:05 2019
New Revision: 350314
URL: https://svnweb.freebsd.org/changeset/base/350314

Log:
  special-case getvfsbyname(3) for fusefs(5)
  
  fusefs file systems may have a fsname subtype (set by mount_fusefs's "-o
  subtype" option) that gets appended to the fsname as returned by statfs(2).
  The subtype is set on a per-mount basis so it isn't part of the struct
  vfsconf. Special-case getvfsbyname to match either the full "fusefs.foobar"
  or short "fusefs" fsname.
  
  This is a merge of r348007, r348054, and r350093 from projects/fuse2
  
  Reviewed by:	kib
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21043

Modified:
  head/lib/libc/gen/getvfsbyname.c
Directory Properties:
  head/   (props changed)

Modified: head/lib/libc/gen/getvfsbyname.c
==============================================================================
--- head/lib/libc/gen/getvfsbyname.c	Thu Jul 25 03:47:27 2019	(r350313)
+++ head/lib/libc/gen/getvfsbyname.c	Thu Jul 25 03:55:05 2019	(r350314)
@@ -37,10 +37,26 @@ __FBSDID("$FreeBSD$");
 #include <sys/mount.h>
 #include <sys/sysctl.h>
 #include <errno.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
 
 /*
+ * fusefs(5) file systems may have a "subtype" which gets appended to
+ * statfs(2)'s f_fstypename field on a per-mount basis.  Allow getvfsbyname to
+ * match either the full "fusefs.foobar" or the more general "fusefs".
+ */
+static bool
+are_fusefs(const char *fsname, const char *vfc_name)
+{
+	const static char fusefs[] = "fusefs";
+	const static char fusefs_dot[] = "fusefs.";
+
+	return (strncmp(fsname, fusefs_dot, sizeof(fusefs_dot) - 1) == 0 &&
+	    strcmp(fusefs, vfc_name) == 0);
+}
+
+/*
  * Given a filesystem name, determine if it is resident in the kernel,
  * and if it is resident, return its xvfsconf structure.
  */
@@ -62,7 +78,8 @@ getvfsbyname(const char *fsname, struct xvfsconf *vfcp
 	}
 	cnt = buflen / sizeof(struct xvfsconf);
 	for (i = 0; i < cnt; i++) {
-		if (strcmp(fsname, xvfsp[i].vfc_name) == 0) {
+		if (strcmp(fsname, xvfsp[i].vfc_name) == 0 ||
+		    are_fusefs(fsname, xvfsp[i].vfc_name)) {
 			memcpy(vfcp, xvfsp + i, sizeof(struct xvfsconf));
 			free(xvfsp);
 			return (0);

From owner-svn-src-head@freebsd.org  Thu Jul 25 05:46:18 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEB1AC3443;
 Thu, 25 Jul 2019 05:46:18 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 AE13668582;
 Thu, 25 Jul 2019 05:46:18 +0000 (UTC)
 (envelope-from rmacklem@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 8A38C22347;
 Thu, 25 Jul 2019 05:46:18 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6P5kIJK076763;
 Thu, 25 Jul 2019 05:46:18 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6P5kHWq076756;
 Thu, 25 Jul 2019 05:46:17 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201907250546.x6P5kHWq076756@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Thu, 25 Jul 2019 05:46:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350315 - in head/sys: kern sys
X-SVN-Group: head
X-SVN-Commit-Author: rmacklem
X-SVN-Commit-Paths: in head/sys: kern sys
X-SVN-Commit-Revision: 350315
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: AE13668582
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 05:46:18 -0000

Author: rmacklem
Date: Thu Jul 25 05:46:16 2019
New Revision: 350315
URL: https://svnweb.freebsd.org/changeset/base/350315

Log:
  Add kernel support for a Linux compatible copy_file_range(2) syscall.
  
  This patch adds support to the kernel for a Linux compatible
  copy_file_range(2) syscall and the related VOP_COPY_FILE_RANGE(9).
  This syscall/VOP can be used by the NFSv4.2 client to implement the
  Copy operation against an NFSv4.2 server to do file copies locally on
  the server.
  The vn_generic_copy_file_range() function in this patch can be used
  by the NFSv4.2 server to implement the Copy operation.
  Fuse may also me able to use the VOP_COPY_FILE_RANGE() method.
  
  vn_generic_copy_file_range() attempts to maintain holes in the output
  file in the range to be copied, but may fail to do so if the input and
  output files are on different file systems with different _PC_MIN_HOLE_SIZE
  values.
  
  Separate commits will be done for the generated syscall files and userland
  changes. A commit for a compat32 syscall will be done later.
  
  Reviewed by:	kib, asomers (plus comments by brooks, jilles)
  Relnotes:	yes
  Differential Revision:	https://reviews.freebsd.org/D20584

Modified:
  head/sys/kern/syscalls.master
  head/sys/kern/vfs_default.c
  head/sys/kern/vfs_syscalls.c
  head/sys/kern/vfs_vnops.c
  head/sys/kern/vnode_if.src
  head/sys/sys/syscallsubr.h
  head/sys/sys/vnode.h

Modified: head/sys/kern/syscalls.master
==============================================================================
--- head/sys/kern/syscalls.master	Thu Jul 25 03:55:05 2019	(r350314)
+++ head/sys/kern/syscalls.master	Thu Jul 25 05:46:16 2019	(r350315)
@@ -3175,6 +3175,16 @@
 		    int flag
 		);
 	}
+569	AUE_NULL	STD {
+		ssize_t copy_file_range(
+		    int infd,
+		    _Inout_opt_ off_t *inoffp,
+		    int outfd,
+		    _Inout_opt_ off_t *outoffp,
+		    size_t len,
+		    unsigned int flags
+		);
+	}
 
 ; Please copy any additions and changes to the following compatability tables:
 ; sys/compat/freebsd32/syscalls.master

Modified: head/sys/kern/vfs_default.c
==============================================================================
--- head/sys/kern/vfs_default.c	Thu Jul 25 03:55:05 2019	(r350314)
+++ head/sys/kern/vfs_default.c	Thu Jul 25 05:46:16 2019	(r350315)
@@ -83,6 +83,7 @@ static int	dirent_exists(struct vnode *vp, const char 
 static int vop_stdis_text(struct vop_is_text_args *ap);
 static int vop_stdunset_text(struct vop_unset_text_args *ap);
 static int vop_stdadd_writecount(struct vop_add_writecount_args *ap);
+static int vop_stdcopy_file_range(struct vop_copy_file_range_args *ap);
 static int vop_stdfdatasync(struct vop_fdatasync_args *ap);
 static int vop_stdgetpages_async(struct vop_getpages_async_args *ap);
 
@@ -140,6 +141,7 @@ struct vop_vector default_vnodeops = {
 	.vop_set_text =		vop_stdset_text,
 	.vop_unset_text =	vop_stdunset_text,
 	.vop_add_writecount =	vop_stdadd_writecount,
+	.vop_copy_file_range =	vop_stdcopy_file_range,
 };
 
 /*
@@ -1210,6 +1212,17 @@ vfs_stdnosync (mp, waitfor)
 {
 
 	return (0);
+}
+
+static int
+vop_stdcopy_file_range(struct vop_copy_file_range_args *ap)
+{
+	int error;
+
+	error = vn_generic_copy_file_range(ap->a_invp, ap->a_inoffp,
+	    ap->a_outvp, ap->a_outoffp, ap->a_lenp, ap->a_flags, ap->a_incred,
+	    ap->a_outcred, ap->a_fsizetd);
+	return (error);
 }
 
 int

Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c	Thu Jul 25 03:55:05 2019	(r350314)
+++ head/sys/kern/vfs_syscalls.c	Thu Jul 25 05:46:16 2019	(r350315)
@@ -4814,3 +4814,122 @@ sys_posix_fadvise(struct thread *td, struct posix_fadv
 	    uap->advice);
 	return (kern_posix_error(td, error));
 }
+
+int
+kern_copy_file_range(struct thread *td, int infd, off_t *inoffp, int outfd,
+    off_t *outoffp, size_t len, unsigned int flags)
+{
+	struct file *infp, *outfp;
+	struct vnode *invp, *outvp;
+	int error;
+	size_t retlen;
+	void *rl_rcookie, *rl_wcookie;
+	off_t savinoff, savoutoff;
+
+	infp = outfp = NULL;
+	rl_rcookie = rl_wcookie = NULL;
+	savinoff = -1;
+	error = 0;
+	retlen = 0;
+
+	if (flags != 0) {
+		error = EINVAL;
+		goto out;
+	}
+	if (len > SSIZE_MAX)
+		/*
+		 * Although the len argument is size_t, the return argument
+		 * is ssize_t (which is signed).  Therefore a size that won't
+		 * fit in ssize_t can't be returned.
+		 */
+		len = SSIZE_MAX;
+
+	/* Get the file structures for the file descriptors. */
+	error = fget_read(td, infd, &cap_read_rights, &infp);
+	if (error != 0)
+		goto out;
+	error = fget_write(td, outfd, &cap_write_rights, &outfp);
+	if (error != 0)
+		goto out;
+
+	/* Set the offset pointers to the correct place. */
+	if (inoffp == NULL)
+		inoffp = &infp->f_offset;
+	if (outoffp == NULL)
+		outoffp = &outfp->f_offset;
+	savinoff = *inoffp;
+	savoutoff = *outoffp;
+
+	invp = infp->f_vnode;
+	outvp = outfp->f_vnode;
+	/* Sanity check the f_flag bits. */
+	if ((outfp->f_flag & (FWRITE | FAPPEND)) != FWRITE ||
+	    (infp->f_flag & FREAD) == 0 || invp == outvp) {
+		error = EBADF;
+		goto out;
+	}
+
+	/* If len == 0, just return 0. */
+	if (len == 0)
+		goto out;
+
+	/* Range lock the byte ranges for both invp and outvp. */
+	for (;;) {
+		rl_wcookie = vn_rangelock_wlock(outvp, *outoffp, *outoffp +
+		    len);
+		rl_rcookie = vn_rangelock_tryrlock(invp, *inoffp, *inoffp +
+		    len);
+		if (rl_rcookie != NULL)
+			break;
+		vn_rangelock_unlock(outvp, rl_wcookie);
+		rl_rcookie = vn_rangelock_rlock(invp, *inoffp, *inoffp + len);
+		vn_rangelock_unlock(invp, rl_rcookie);
+	}
+
+	retlen = len;
+	error = vn_copy_file_range(invp, inoffp, outvp, outoffp, &retlen,
+	    flags, infp->f_cred, outfp->f_cred, td);
+out:
+	if (rl_rcookie != NULL)
+		vn_rangelock_unlock(invp, rl_rcookie);
+	if (rl_wcookie != NULL)
+		vn_rangelock_unlock(outvp, rl_wcookie);
+	if (savinoff != -1 && (error == EINTR || error == ERESTART)) {
+		*inoffp = savinoff;
+		*outoffp = savoutoff;
+	}
+	if (outfp != NULL)
+		fdrop(outfp, td);
+	if (infp != NULL)
+		fdrop(infp, td);
+	td->td_retval[0] = retlen;
+	return (error);
+}
+
+int
+sys_copy_file_range(struct thread *td, struct copy_file_range_args *uap)
+{
+	off_t inoff, outoff, *inoffp, *outoffp;
+	int error;
+
+	inoffp = outoffp = NULL;
+	if (uap->inoffp != NULL) {
+		error = copyin(uap->inoffp, &inoff, sizeof(off_t));
+		if (error != 0)
+			return (error);
+		inoffp = &inoff;
+	}
+	if (uap->outoffp != NULL) {
+		error = copyin(uap->outoffp, &outoff, sizeof(off_t));
+		if (error != 0)
+			return (error);
+		outoffp = &outoff;
+	}
+	error = kern_copy_file_range(td, uap->infd, inoffp, uap->outfd,
+	    outoffp, uap->len, uap->flags);
+	if (error == 0 && uap->inoffp != NULL)
+		error = copyout(inoffp, uap->inoffp, sizeof(off_t));
+	if (error == 0 && uap->outoffp != NULL)
+		error = copyout(outoffp, uap->outoffp, sizeof(off_t));
+	return (error);
+}

Modified: head/sys/kern/vfs_vnops.c
==============================================================================
--- head/sys/kern/vfs_vnops.c	Thu Jul 25 03:55:05 2019	(r350314)
+++ head/sys/kern/vfs_vnops.c	Thu Jul 25 05:46:16 2019	(r350315)
@@ -2619,3 +2619,372 @@ loop2:
 
 	return (error);
 }
+
+/*
+ * Copies a byte range from invp to outvp.  Calls VOP_COPY_FILE_RANGE()
+ * or vn_generic_copy_file_range() after rangelocking the byte ranges,
+ * to do the actual copy.
+ * vn_generic_copy_file_range() is factored out, so it can be called
+ * from a VOP_COPY_FILE_RANGE() call as well, but handles vnodes from
+ * different file systems.
+ */
+int
+vn_copy_file_range(struct vnode *invp, off_t *inoffp, struct vnode *outvp,
+    off_t *outoffp, size_t *lenp, unsigned int flags, struct ucred *incred,
+    struct ucred *outcred, struct thread *fsize_td)
+{
+	struct vattr va;
+	int error;
+	size_t len;
+	uint64_t uvalin, uvalout;
+
+	len = *lenp;
+	*lenp = 0;		/* For error returns. */
+	error = 0;
+
+	/* Do some sanity checks on the arguments. */
+	uvalin = *inoffp;
+	uvalin += len;
+	uvalout = *outoffp;
+	uvalout += len;
+	if (invp->v_type == VDIR || outvp->v_type == VDIR)
+		error = EISDIR;
+	else if (*inoffp < 0 || uvalin > INT64_MAX || uvalin <
+	    (uint64_t)*inoffp || *outoffp < 0 || uvalout > INT64_MAX ||
+	    uvalout < (uint64_t)*outoffp || invp->v_type != VREG ||
+	    outvp->v_type != VREG)
+		error = EINVAL;
+	else if (invp == outvp)
+		error = EBADF;
+	if (error != 0)
+		goto out;
+
+	error = vn_lock(invp, LK_SHARED);
+	if (error != 0)
+		goto out;
+	/* Check that the offset + len does not go past EOF of invp. */
+	error = VOP_GETATTR(invp, &va, incred);
+	if (error == 0 && va.va_size < *inoffp + len)
+		error = EINVAL;
+	VOP_UNLOCK(invp, 0);
+	if (error != 0)
+		goto out;
+
+	/*
+	 * If the two vnode are for the same file system, call
+	 * VOP_COPY_FILE_RANGE(), otherwise call vn_generic_copy_file_range()
+	 * which can handle copies across multiple file systems.
+	 */
+	*lenp = len;
+	if (invp->v_mount == outvp->v_mount)
+		error = VOP_COPY_FILE_RANGE(invp, inoffp, outvp, outoffp,
+		    lenp, flags, incred, outcred, fsize_td);
+	else
+		error = vn_generic_copy_file_range(invp, inoffp, outvp,
+		    outoffp, lenp, flags, incred, outcred, fsize_td);
+out:
+	return (error);
+}
+
+/*
+ * Test len bytes of data starting at dat for all bytes == 0.
+ * Return true if all bytes are zero, false otherwise.
+ * Expects dat to be well aligned.
+ */
+static bool
+mem_iszero(void *dat, int len)
+{
+	int i;
+	const u_int *p;
+	const char *cp;
+
+	for (p = dat; len > 0; len -= sizeof(*p), p++) {
+		if (len >= sizeof(*p)) {
+			if (*p != 0)
+				return (false);
+		} else {
+			cp = (const char *)p;
+			for (i = 0; i < len; i++, cp++)
+				if (*cp != '\0')
+					return (false);
+		}
+	}
+	return (true);
+}
+
+/*
+ * Write an xfer sized chunk to outvp in blksize blocks from dat.
+ * dat is a maximum of blksize in length and can be written repeatedly in
+ * the chunk.
+ * If growfile == true, just grow the file via vn_truncate_locked() instead
+ * of doing actual writes.
+ */
+static int
+vn_write_outvp(struct vnode *outvp, char *dat, off_t outoff, off_t xfer,
+    u_long blksize, bool growfile, struct ucred *cred)
+{
+	struct mount *mp;
+	off_t xfer2;
+	int error, lckf;
+
+	/*
+	 * Loop around doing writes of blksize until write has been completed.
+	 * Lock/unlock on each loop iteration so that a bwillwrite() can be
+	 * done for each iteration, since the xfer argument can be very
+	 * large if there is a large hole to punch in the output file.
+	 */
+	do {
+		bwillwrite();
+		mp = NULL;
+		error = vn_start_write(outvp, &mp, V_WAIT);
+		if (error == 0) {
+			if (MNT_SHARED_WRITES(mp))
+				lckf = LK_SHARED;
+			else
+				lckf = LK_EXCLUSIVE;
+			error = vn_lock(outvp, lckf);
+		}
+		if (error == 0) {
+			if (growfile)
+				error = vn_truncate_locked(outvp, outoff + xfer,
+				    false, cred);
+			else {
+				xfer2 = MIN(xfer, blksize);
+				error = vn_rdwr(UIO_WRITE, outvp, dat, xfer2,
+				    outoff, UIO_SYSSPACE, IO_NODELOCKED,
+				    curthread->td_ucred, cred, NULL, curthread);
+				outoff += xfer2;
+				xfer -= xfer2;
+			}
+			VOP_UNLOCK(outvp, 0);
+		}
+		if (mp != NULL)
+			vn_finished_write(mp);
+	} while (!growfile && xfer > 0 && error == 0);
+	return (error);
+}
+
+/*
+ * Copy a byte range of one file to another.  This function can handle the
+ * case where invp and outvp are on different file systems.
+ * It can also be called by a VOP_COPY_FILE_RANGE() to do the work, if there
+ * is no better file system specific way to do it.
+ */
+int
+vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp,
+    struct vnode *outvp, off_t *outoffp, size_t *lenp, unsigned int flags,
+    struct ucred *incred, struct ucred *outcred, struct thread *fsize_td)
+{
+	struct vattr va;
+	struct mount *mp;
+	struct uio io;
+	off_t startoff, endoff, xfer, xfer2;
+	u_long blksize;
+	int error;
+	bool cantseek, readzeros;
+	ssize_t aresid;
+	size_t copylen, len, savlen;
+	char *dat;
+	long holein, holeout;
+
+	holein = holeout = 0;
+	savlen = len = *lenp;
+	error = 0;
+	dat = NULL;
+
+	error = vn_lock(invp, LK_SHARED);
+	if (error != 0)
+		goto out;
+	if (VOP_PATHCONF(invp, _PC_MIN_HOLE_SIZE, &holein) != 0)
+		holein = 0;
+	VOP_UNLOCK(invp, 0);
+	if (error != 0)
+		goto out;
+
+	mp = NULL;
+	error = vn_start_write(outvp, &mp, V_WAIT);
+	if (error == 0)
+		error = vn_lock(outvp, LK_EXCLUSIVE);
+	if (error == 0) {
+		/*
+		 * If fsize_td != NULL, do a vn_rlimit_fsize() call,
+		 * now that outvp is locked.
+		 */
+		if (fsize_td != NULL) {
+			io.uio_offset = *outoffp;
+			io.uio_resid = len;
+			error = vn_rlimit_fsize(outvp, &io, fsize_td);
+			if (error != 0)
+				error = EFBIG;
+		}
+		if (VOP_PATHCONF(outvp, _PC_MIN_HOLE_SIZE, &holeout) != 0)
+			holeout = 0;
+		/*
+		 * Holes that are past EOF do not need to be written as a block
+		 * of zero bytes.  So, truncate the output file as far as
+		 * possible and then use va.va_size to decide if writing 0
+		 * bytes is necessary in the loop below.
+		 */
+		if (error == 0)
+			error = VOP_GETATTR(outvp, &va, outcred);
+		if (error == 0 && va.va_size > *outoffp && va.va_size <=
+		    *outoffp + len) {
+#ifdef MAC
+			error = mac_vnode_check_write(curthread->td_ucred,
+			    outcred, outvp);
+			if (error == 0)
+#endif
+				error = vn_truncate_locked(outvp, *outoffp,
+				    false, outcred);
+			if (error == 0)
+				va.va_size = *outoffp;
+		}
+		VOP_UNLOCK(outvp, 0);
+	}
+	if (mp != NULL)
+		vn_finished_write(mp);
+	if (error != 0)
+		goto out;
+
+	/*
+	 * Set the blksize to the larger of the hole sizes for invp and outvp.
+	 * If hole sizes aren't available, set the blksize to the larger 
+	 * f_iosize of invp and outvp.
+	 * This code expects the hole sizes and f_iosizes to be powers of 2.
+	 * This value is clipped at 4Kbytes and 1Mbyte.
+	 */
+	blksize = MAX(holein, holeout);
+	if (blksize == 0)
+		blksize = MAX(invp->v_mount->mnt_stat.f_iosize,
+		    outvp->v_mount->mnt_stat.f_iosize);
+	if (blksize < 4096)
+		blksize = 4096;
+	else if (blksize > 1024 * 1024)
+		blksize = 1024 * 1024;
+	dat = malloc(blksize, M_TEMP, M_WAITOK);
+
+	/*
+	 * If VOP_IOCTL(FIOSEEKHOLE) works for invp, use it and FIOSEEKDATA
+	 * to find holes.  Otherwise, just scan the read block for all 0s
+	 * in the inner loop where the data copying is done.
+	 * Note that some file systems such as NFSv3, NFSv4.0 and NFSv4.1 may
+	 * support holes on the server, but do not support FIOSEEKHOLE.
+	 */
+	while (len > 0 && error == 0) {
+		endoff = 0;			/* To shut up compilers. */
+		cantseek = true;
+		startoff = *inoffp;
+		copylen = len;
+
+		/*
+		 * Find the next data area.  If there is just a hole to EOF,
+		 * FIOSEEKDATA should fail and then we drop down into the
+		 * inner loop and create the hole on the outvp file.
+		 * (I do not know if any file system will report a hole to
+		 *  EOF via FIOSEEKHOLE, but I am pretty sure FIOSEEKDATA
+		 *  will fail for those file systems.)
+		 *
+		 * For input files that don't support FIOSEEKDATA/FIOSEEKHOLE,
+		 * the code just falls through to the inner copy loop.
+		 */
+		error = EINVAL;
+		if (holein > 0)
+			error = VOP_IOCTL(invp, FIOSEEKDATA, &startoff, 0,
+			    incred, curthread);
+		if (error == 0) {
+			endoff = startoff;
+			error = VOP_IOCTL(invp, FIOSEEKHOLE, &endoff, 0,
+			    incred, curthread);
+		}
+		if (error == 0) {
+			if (startoff > *inoffp) {
+				/* Found hole before data block. */
+				xfer = MIN(startoff - *inoffp, len);
+				if (*outoffp < va.va_size) {
+					/* Must write 0s to punch hole. */
+					xfer2 = MIN(va.va_size - *outoffp,
+					    xfer);
+					memset(dat, 0, MIN(xfer2, blksize));
+					error = vn_write_outvp(outvp, dat,
+					    *outoffp, xfer2, blksize, false,
+					    outcred);
+				}
+
+				if (error == 0 && *outoffp + xfer >
+				    va.va_size && xfer == len)
+					/* Grow last block. */
+					error = vn_write_outvp(outvp, dat,
+					    *outoffp, xfer, blksize, true,
+					    outcred);
+				if (error == 0) {
+					*inoffp += xfer;
+					*outoffp += xfer;
+					len -= xfer;
+				}
+			}
+			copylen = MIN(len, endoff - startoff);
+			cantseek = false;
+		} else {
+			cantseek = true;
+			startoff = *inoffp;
+			copylen = len;
+			error = 0;
+		}
+
+		xfer = blksize;
+		if (cantseek) {
+			/*
+			 * Set first xfer to end at a block boundary, so that
+			 * holes are more likely detected in the loop below via
+			 * the for all bytes 0 method.
+			 */
+			xfer -= (*inoffp % blksize);
+		}
+		/* Loop copying the data block. */
+		while (copylen > 0 && error == 0) {
+			if (copylen < xfer)
+				xfer = copylen;
+			error = vn_lock(invp, LK_SHARED);
+			if (error != 0)
+				goto out;
+			error = vn_rdwr(UIO_READ, invp, dat, xfer,
+			    startoff, UIO_SYSSPACE, IO_NODELOCKED,
+			    curthread->td_ucred, incred, &aresid,
+			    curthread);
+			VOP_UNLOCK(invp, 0);
+			/*
+			 * Linux considers a range that exceeds EOF to
+			 * be an error, so we will too.
+			 */
+			if (error == 0 && aresid > 0)
+				error = EINVAL;
+			if (error == 0) {
+				/*
+				 * Skip the write for holes past the initial EOF
+				 * of the output file, unless this is the last
+				 * write of the output file at EOF.
+				 */
+				readzeros = cantseek ? mem_iszero(dat, xfer) :
+				    false;
+				if (!cantseek || *outoffp < va.va_size ||
+				    xfer == len || !readzeros)
+					error = vn_write_outvp(outvp, dat,
+					    *outoffp, xfer, blksize,
+					    readzeros && xfer == len &&
+					    *outoffp >= va.va_size, outcred);
+				if (error == 0) {
+					*inoffp += xfer;
+					startoff += xfer;
+					*outoffp += xfer;
+					copylen -= xfer;
+					len -= xfer;
+				}
+			}
+			xfer = blksize;
+		}
+	}
+out:
+	*lenp = savlen - len;
+	free(dat, M_TEMP);
+	return (error);
+}

Modified: head/sys/kern/vnode_if.src
==============================================================================
--- head/sys/kern/vnode_if.src	Thu Jul 25 03:55:05 2019	(r350314)
+++ head/sys/kern/vnode_if.src	Thu Jul 25 05:46:16 2019	(r350315)
@@ -718,6 +718,22 @@ vop_fdatasync {
 };
 
 
+%% copy_file_range	invp	U U U
+%% copy_file_range	outvp	U U U
+
+vop_copy_file_range {
+	IN struct vnode *invp;
+	INOUT off_t *inoffp;
+	IN struct vnode *outvp;
+	INOUT off_t *outoffp;
+	INOUT size_t *lenp;
+	IN unsigned int flags;
+	IN struct ucred *incred;
+	IN struct ucred *outcred;
+	IN struct thread *fsizetd;
+};
+
+
 # The VOPs below are spares at the end of the table to allow new VOPs to be
 # added in stable branches without breaking the KBI.  New VOPs in HEAD should
 # be added above these spares.  When merging a new VOP to a stable branch,

Modified: head/sys/sys/syscallsubr.h
==============================================================================
--- head/sys/sys/syscallsubr.h	Thu Jul 25 03:55:05 2019	(r350314)
+++ head/sys/sys/syscallsubr.h	Thu Jul 25 05:46:16 2019	(r350315)
@@ -94,6 +94,8 @@ int	kern_clock_settime(struct thread *td, clockid_t cl
 int	kern_close(struct thread *td, int fd);
 int	kern_connectat(struct thread *td, int dirfd, int fd,
 	    struct sockaddr *sa);
+int	kern_copy_file_range(struct thread *td, int infd, off_t *inoffp,
+	    int outfd, off_t *outoffp, size_t len, unsigned int flags);
 int	kern_cpuset_getaffinity(struct thread *td, cpulevel_t level,
 	    cpuwhich_t which, id_t id, size_t cpusetsize, cpuset_t *maskp);
 int	kern_cpuset_setaffinity(struct thread *td, cpulevel_t level,

Modified: head/sys/sys/vnode.h
==============================================================================
--- head/sys/sys/vnode.h	Thu Jul 25 03:55:05 2019	(r350314)
+++ head/sys/sys/vnode.h	Thu Jul 25 05:46:16 2019	(r350315)
@@ -667,9 +667,17 @@ int	vn_bmap_seekhole(struct vnode *vp, u_long cmd, off
 	    struct ucred *cred);
 int	vn_close(struct vnode *vp,
 	    int flags, struct ucred *file_cred, struct thread *td);
+int	vn_copy_file_range(struct vnode *invp, off_t *inoffp,
+	    struct vnode *outvp, off_t *outoffp, size_t *lenp,
+	    unsigned int flags, struct ucred *incred, struct ucred *outcred,
+	    struct thread *fsize_td);
 void	vn_finished_write(struct mount *mp);
 void	vn_finished_secondary_write(struct mount *mp);
 int	vn_fsync_buf(struct vnode *vp, int waitfor);
+int	vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp,
+	    struct vnode *outvp, off_t *outoffp, size_t *lenp,
+	    unsigned int flags, struct ucred *incred, struct ucred *outcred,
+	    struct thread *fsize_td);
 int	vn_isdisk(struct vnode *vp, int *errp);
 int	_vn_lock(struct vnode *vp, int flags, char *file, int line);
 #define vn_lock(vp, flags) _vn_lock(vp, flags, __FILE__, __LINE__)

From owner-svn-src-head@freebsd.org  Thu Jul 25 05:55:57 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3487C3768;
 Thu, 25 Jul 2019 05:55:57 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 B56466A219;
 Thu, 25 Jul 2019 05:55:57 +0000 (UTC)
 (envelope-from rmacklem@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 71BB72251C;
 Thu, 25 Jul 2019 05:55:57 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6P5tv7n082845;
 Thu, 25 Jul 2019 05:55:57 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6P5tuKZ082840;
 Thu, 25 Jul 2019 05:55:56 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201907250555.x6P5tuKZ082840@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Thu, 25 Jul 2019 05:55:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350316 - in head/sys: kern sys
X-SVN-Group: head
X-SVN-Commit-Author: rmacklem
X-SVN-Commit-Paths: in head/sys: kern sys
X-SVN-Commit-Revision: 350316
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: B56466A219
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 05:55:57 -0000

Author: rmacklem
Date: Thu Jul 25 05:55:55 2019
New Revision: 350316
URL: https://svnweb.freebsd.org/changeset/base/350316

Log:
  Update the generated syscall files for copy_file_range(2) added by
  r350315.

Modified:
  head/sys/kern/init_sysent.c
  head/sys/kern/syscalls.c
  head/sys/kern/systrace_args.c
  head/sys/sys/syscall.h
  head/sys/sys/sysproto.h

Modified: head/sys/kern/init_sysent.c
==============================================================================
--- head/sys/kern/init_sysent.c	Thu Jul 25 05:46:16 2019	(r350315)
+++ head/sys/kern/init_sysent.c	Thu Jul 25 05:55:55 2019	(r350316)
@@ -618,4 +618,5 @@ struct sysent sysent[] = {
 	{ AS(fhlinkat_args), (sy_call_t *)sys_fhlinkat, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 566 = fhlinkat */
 	{ AS(fhreadlink_args), (sy_call_t *)sys_fhreadlink, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 567 = fhreadlink */
 	{ AS(funlinkat_args), (sy_call_t *)sys_funlinkat, AUE_UNLINKAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 568 = funlinkat */
+	{ AS(copy_file_range_args), (sy_call_t *)sys_copy_file_range, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 569 = copy_file_range */
 };

Modified: head/sys/kern/syscalls.c
==============================================================================
--- head/sys/kern/syscalls.c	Thu Jul 25 05:46:16 2019	(r350315)
+++ head/sys/kern/syscalls.c	Thu Jul 25 05:55:55 2019	(r350316)
@@ -575,4 +575,5 @@ const char *syscallnames[] = {
 	"fhlinkat",			/* 566 = fhlinkat */
 	"fhreadlink",			/* 567 = fhreadlink */
 	"funlinkat",			/* 568 = funlinkat */
+	"copy_file_range",			/* 569 = copy_file_range */
 };

Modified: head/sys/kern/systrace_args.c
==============================================================================
--- head/sys/kern/systrace_args.c	Thu Jul 25 05:46:16 2019	(r350315)
+++ head/sys/kern/systrace_args.c	Thu Jul 25 05:55:55 2019	(r350316)
@@ -3312,6 +3312,18 @@ systrace_args(int sysnum, void *params, uint64_t *uarg
 		*n_args = 4;
 		break;
 	}
+	/* copy_file_range */
+	case 569: {
+		struct copy_file_range_args *p = params;
+		iarg[0] = p->infd; /* int */
+		uarg[1] = (intptr_t) p->inoffp; /* off_t * */
+		iarg[2] = p->outfd; /* int */
+		uarg[3] = (intptr_t) p->outoffp; /* off_t * */
+		uarg[4] = p->len; /* size_t */
+		uarg[5] = p->flags; /* unsigned int */
+		*n_args = 6;
+		break;
+	}
 	default:
 		*n_args = 0;
 		break;
@@ -8839,6 +8851,31 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d
 			break;
 		};
 		break;
+	/* copy_file_range */
+	case 569:
+		switch(ndx) {
+		case 0:
+			p = "int";
+			break;
+		case 1:
+			p = "userland off_t *";
+			break;
+		case 2:
+			p = "int";
+			break;
+		case 3:
+			p = "userland off_t *";
+			break;
+		case 4:
+			p = "size_t";
+			break;
+		case 5:
+			p = "unsigned int";
+			break;
+		default:
+			break;
+		};
+		break;
 	default:
 		break;
 	};
@@ -10739,6 +10776,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char *
 	case 568:
 		if (ndx == 0 || ndx == 1)
 			p = "int";
+		break;
+	/* copy_file_range */
+	case 569:
+		if (ndx == 0 || ndx == 1)
+			p = "ssize_t";
 		break;
 	default:
 		break;

Modified: head/sys/sys/syscall.h
==============================================================================
--- head/sys/sys/syscall.h	Thu Jul 25 05:46:16 2019	(r350315)
+++ head/sys/sys/syscall.h	Thu Jul 25 05:55:55 2019	(r350316)
@@ -504,4 +504,5 @@
 #define	SYS_fhlinkat	566
 #define	SYS_fhreadlink	567
 #define	SYS_funlinkat	568
-#define	SYS_MAXSYSCALL	569
+#define	SYS_copy_file_range	569
+#define	SYS_MAXSYSCALL	570

Modified: head/sys/sys/sysproto.h
==============================================================================
--- head/sys/sys/sysproto.h	Thu Jul 25 05:46:16 2019	(r350315)
+++ head/sys/sys/sysproto.h	Thu Jul 25 05:55:55 2019	(r350316)
@@ -1796,6 +1796,14 @@ struct funlinkat_args {
 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
 	char flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)];
 };
+struct copy_file_range_args {
+	char infd_l_[PADL_(int)]; int infd; char infd_r_[PADR_(int)];
+	char inoffp_l_[PADL_(off_t *)]; off_t * inoffp; char inoffp_r_[PADR_(off_t *)];
+	char outfd_l_[PADL_(int)]; int outfd; char outfd_r_[PADR_(int)];
+	char outoffp_l_[PADL_(off_t *)]; off_t * outoffp; char outoffp_r_[PADR_(off_t *)];
+	char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];
+	char flags_l_[PADL_(unsigned int)]; unsigned int flags; char flags_r_[PADR_(unsigned int)];
+};
 int	nosys(struct thread *, struct nosys_args *);
 void	sys_sys_exit(struct thread *, struct sys_exit_args *);
 int	sys_fork(struct thread *, struct fork_args *);
@@ -2181,6 +2189,7 @@ int	sys_fhlink(struct thread *, struct fhlink_args *);
 int	sys_fhlinkat(struct thread *, struct fhlinkat_args *);
 int	sys_fhreadlink(struct thread *, struct fhreadlink_args *);
 int	sys_funlinkat(struct thread *, struct funlinkat_args *);
+int	sys_copy_file_range(struct thread *, struct copy_file_range_args *);
 
 #ifdef COMPAT_43
 
@@ -3088,6 +3097,7 @@ int	freebsd11_mknodat(struct thread *, struct freebsd1
 #define	SYS_AUE_fhlinkat	AUE_NULL
 #define	SYS_AUE_fhreadlink	AUE_NULL
 #define	SYS_AUE_funlinkat	AUE_UNLINKAT
+#define	SYS_AUE_copy_file_range	AUE_NULL
 
 #undef PAD_
 #undef PADL_

From owner-svn-src-head@freebsd.org  Thu Jul 25 06:05:50 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F5C9C398C;
 Thu, 25 Jul 2019 06:05:50 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 2D3C56A847;
 Thu, 25 Jul 2019 06:05:50 +0000 (UTC)
 (envelope-from rmacklem@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 EB819226E1;
 Thu, 25 Jul 2019 06:05:49 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6P65ncp088834;
 Thu, 25 Jul 2019 06:05:49 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6P65nRk088831;
 Thu, 25 Jul 2019 06:05:49 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201907250605.x6P65nRk088831@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Thu, 25 Jul 2019 06:05:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350317 - head/lib/libc/sys
X-SVN-Group: head
X-SVN-Commit-Author: rmacklem
X-SVN-Commit-Paths: head/lib/libc/sys
X-SVN-Commit-Revision: 350317
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 2D3C56A847
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 06:05:50 -0000

Author: rmacklem
Date: Thu Jul 25 06:05:49 2019
New Revision: 350317
URL: https://svnweb.freebsd.org/changeset/base/350317

Log:
  Add libc support for the copy_file_range(2) syscall added by r350315.
  
  copy_file_range.2 is a new man page (content change).
  
  Reviewed by:	kib, asomers
  Relnotes:	yes
  Differential Revision:	https://reviews.freebsd.org/D20584

Added:
  head/lib/libc/sys/copy_file_range.2   (contents, props changed)
Modified:
  head/lib/libc/sys/Makefile.inc
  head/lib/libc/sys/Symbol.map

Modified: head/lib/libc/sys/Makefile.inc
==============================================================================
--- head/lib/libc/sys/Makefile.inc	Thu Jul 25 05:55:55 2019	(r350316)
+++ head/lib/libc/sys/Makefile.inc	Thu Jul 25 06:05:49 2019	(r350317)
@@ -175,6 +175,7 @@ MAN+=	abort2.2 \
 	closefrom.2 \
 	connect.2 \
 	connectat.2 \
+	copy_file_range.2 \
 	cpuset.2 \
 	cpuset_getaffinity.2 \
 	cpuset_getdomain.2 \

Modified: head/lib/libc/sys/Symbol.map
==============================================================================
--- head/lib/libc/sys/Symbol.map	Thu Jul 25 05:55:55 2019	(r350316)
+++ head/lib/libc/sys/Symbol.map	Thu Jul 25 06:05:49 2019	(r350317)
@@ -402,6 +402,7 @@ FBSD_1.5 {
 };
 
 FBSD_1.6 {
+	copy_file_range;
 	fhlink;
 	fhlinkat;
 	fhreadlink;

Added: head/lib/libc/sys/copy_file_range.2
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/sys/copy_file_range.2	Thu Jul 25 06:05:49 2019	(r350317)
@@ -0,0 +1,191 @@
+.\" SPDX-License-Identifier: BSD-2-Clause
+.\"
+.\" Copyright (c) 2019 Rick Macklem
+.\"
+.\" 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$
+.\"
+.Dd July 24, 2019
+.Dt COPY_FILE_RANGE 2
+.Os
+.Sh NAME
+.Nm copy_file_range
+.Nd kernel copy of a byte range from one file to another
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In unistd.h
+.Ft ssize_t
+.Fo copy_file_range
+.Fa "int infd"
+.Fa "off_t *inoffp"
+.Fa "int outfd"
+.Fa "off_t *outoffp"
+.Fa "size_t len"
+.Fa "unsigned int flags"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn copy_file_range
+system call
+copies up to
+.Fa len
+bytes from
+.Fa infd
+to
+.Fa outfd
+in the kernel.
+It may do this using a file system specific technique if
+.Fa infd
+and
+.Fa outfd
+are on the same file system.
+The
+.Fa infd
+argument must be opened for reading and the
+.Fa outfd
+argument must be opened for writing, but not
+.Dv O_APPEND .
+If
+.Fa inoffp
+or
+.Fa outoffp
+is
+.Dv NULL ,
+the file offset for
+.Fa infd
+or
+.Fa outfd
+respectively will be used and updated by
+the number of bytes copied.
+If
+.Fa inoffp
+or
+.Fa outoffp
+is not
+.Dv NULL ,
+the byte offset pointed to by
+.Fa inoffp
+or
+.Fa outoffp
+respectively will be used/updated and the file offset for
+.Fa infd
+or
+.Fa outfd
+respectively will not be affected.
+The
+.Fa flags
+argument must be 0.
+.Pp
+This system call attempts to maintain holes in the output file for
+the byte range being copied.
+However, this does not always work well.
+It is recommended that sparse files be copied in a loop using
+.Xr lseek 2
+with
+.Dv SEEK_HOLE ,
+.Dv SEEK_DATA
+arguments and this system call for the
+data ranges found.
+.Pp
+.Sh RETURN VALUES
+If it succeeds, the call returns the number of bytes copied, which can be less
+than
+.Fa len .
+.Fn copy_file_range
+should be used in a loop until copying of the desired byte range has been
+completed.
+If an error has occurred, a \-1 is returned and the error code is placed in
+the global variable
+.Va errno .
+.Sh ERRORS
+The
+.Fn copy_file_range
+system call
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EBADF
+If
+.Fa
+infd
+is not open for reading or
+.Fa
+outfd
+is not open for writing, or opened for writing with
+.Dv O_APPEND ,
+or if
+.Fa infd
+and
+.Fa outfd
+refer to the same file.
+.It Bq Er EFBIG
+If the copy exceeds the process's file size limit or the maximum file size
+for the file system
+.Fa outfd
+resides on.
+.It Bq Er EINTR
+A signal interrupted the system call
+before it could be completed.
+This may happen for files on some NFS mounts.
+When this happens, the values pointed to by
+.Fa inoffp
+and
+.Fa outoffp
+are reset to the initial values for the system call.
+.It Bq Er EINVAL
+If the initial offset for
+.Fa infd
+plus
+.Fa len
+exceeds EOF for
+.Fa infd
+or
+.Fa
+flags
+is not zero.
+.It Bq Er EIO
+An I/O error occurred while reading/writing the files.
+.It Bq Er EISDIR
+If either
+.Fa infd
+or
+.Fa outfd
+refers to a directory.
+.It Bq Er ENOSPC
+File system that stores
+.Fa outfd
+is full.
+.El
+.Sh SEE ALSO
+.Xr lseek 2
+.Sh STANDARDS
+The
+.Fn copy_file_range
+system call is expected to be compatible with the Linux system call of
+the same name.
+.Sh HISTORY
+The
+.Fn copy_file_range
+function appeared in
+.Fx 13.0 .

From owner-svn-src-head@freebsd.org  Thu Jul 25 06:10:45 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16616C3AF8;
 Thu, 25 Jul 2019 06:10:45 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 DBDCE6AB1B;
 Thu, 25 Jul 2019 06:10:44 +0000 (UTC)
 (envelope-from rmacklem@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 B819D226F7;
 Thu, 25 Jul 2019 06:10:44 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6P6AijE089767;
 Thu, 25 Jul 2019 06:10:44 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6P6AiNe089766;
 Thu, 25 Jul 2019 06:10:44 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201907250610.x6P6AiNe089766@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Thu, 25 Jul 2019 06:10:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350318 - head/include
X-SVN-Group: head
X-SVN-Commit-Author: rmacklem
X-SVN-Commit-Paths: head/include
X-SVN-Commit-Revision: 350318
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: DBDCE6AB1B
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.966,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 06:10:45 -0000

Author: rmacklem
Date: Thu Jul 25 06:10:44 2019
New Revision: 350318
URL: https://svnweb.freebsd.org/changeset/base/350318

Log:
  Add an entry for copy_file_range(2) to unistd.h.
  
  copy_file_range(2) is a Linux compatible syscall created by r350315.
  
  Reviewed by:	kib, asomers
  Relnotes:	yes
  Differential Revision:	https://reviews.freebsd.org/D20584

Modified:
  head/include/unistd.h

Modified: head/include/unistd.h
==============================================================================
--- head/include/unistd.h	Thu Jul 25 06:05:49 2019	(r350317)
+++ head/include/unistd.h	Thu Jul 25 06:10:44 2019	(r350318)
@@ -494,6 +494,7 @@ struct crypt_data {
 int	 acct(const char *);
 int	 async_daemon(void);
 int	 check_utility_compat(const char *);
+ssize_t	 copy_file_range(int, off_t *, int, off_t *, size_t, unsigned int);
 const char *
 	 crypt_get_format(void);
 char	*crypt_r(const char *, const char *, struct crypt_data *);

From owner-svn-src-head@freebsd.org  Thu Jul 25 06:20:00 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED23BC3D48;
 Thu, 25 Jul 2019 06:20:00 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 D05ED6B0A9;
 Thu, 25 Jul 2019 06:20:00 +0000 (UTC)
 (envelope-from rmacklem@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 A9148228CD;
 Thu, 25 Jul 2019 06:20:00 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6P6K0SI094728;
 Thu, 25 Jul 2019 06:20:00 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6P6K05p094727;
 Thu, 25 Jul 2019 06:20:00 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201907250620.x6P6K05p094727@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Thu, 25 Jul 2019 06:20:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350319 - head/share/man/man9
X-SVN-Group: head
X-SVN-Commit-Author: rmacklem
X-SVN-Commit-Paths: head/share/man/man9
X-SVN-Commit-Revision: 350319
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: D05ED6B0A9
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 06:20:01 -0000

Author: rmacklem
Date: Thu Jul 25 06:20:00 2019
New Revision: 350319
URL: https://svnweb.freebsd.org/changeset/base/350319

Log:
  Create a man page for VOP_COPY_FILE_RANGE(9).
  
  r350315 created a Linux compatible copy_file_range(2) syscall.
  It uses a VOP method called VOP_COPY_FILE_RANGE so that file systems,
  such as the NFSv4.2 client can do file system specific copying.
  For NFSv4.2, this allows the copying to be done locally on the NFS server,
  avoiding transferring the data across the wire twice.
  
  This is a new man page (content changed).
  
  Reviewed by:	kib, asomers
  Relnotes:	yes
  Differential Revision:	https://reviews.freebsd.org/D20584

Added:
  head/share/man/man9/VOP_COPY_FILE_RANGE.9   (contents, props changed)
Modified:
  head/share/man/man9/Makefile

Modified: head/share/man/man9/Makefile
==============================================================================
--- head/share/man/man9/Makefile	Thu Jul 25 06:10:44 2019	(r350318)
+++ head/share/man/man9/Makefile	Thu Jul 25 06:20:00 2019	(r350319)
@@ -397,6 +397,7 @@ MAN=	accept_filter.9 \
 	VOP_ATTRIB.9 \
 	VOP_BMAP.9 \
 	VOP_BWRITE.9 \
+	VOP_COPY_FILE_RANGE.9 \
 	VOP_CREATE.9 \
 	VOP_FSYNC.9 \
 	VOP_GETACL.9 \

Added: head/share/man/man9/VOP_COPY_FILE_RANGE.9
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/man/man9/VOP_COPY_FILE_RANGE.9	Thu Jul 25 06:20:00 2019	(r350319)
@@ -0,0 +1,124 @@
+.\" SPDX-License-Identifier: BSD-2-Clause
+.\"
+.\" Copyright (c) 2019 Rick Macklem
+.\"
+.\" 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$
+.\"
+.Dd July 24, 2019
+.Dt VOP_COPY_FILE_RANGE 9
+.Os
+.Sh NAME
+.Nm VOP_COPY_FILE_RANGE
+.Nd copy a byte range from one regular file to another within a file system
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fo VOP_COPY_FILE_RANGE
+.Fa "struct vnode *invp"
+.Fa "off_t *inoff"
+.Fa "struct vnode *outvp"
+.Fa "off_t *outoff"
+.Fa "size_t *len"
+.Fa "unsigned int flags"
+.Fa "struct ucred *incred"
+.Fa "struct ucred *outcred"
+.Fa "struct thread *fsize_td"
+.Sh DESCRIPTION
+This entry point copies a byte range from one regular file to another within a
+file system.
+.Pp
+The arguments are:
+.Bl -tag -width ioflag
+.It Fa invp
+The vnode of the input file.
+.It Fa inoff
+A pointer to the file offset for the input file.
+.It Fa outvp
+The vnode of the output file.
+.It Fa outoff
+A pointer to the file offset for the output file.
+.It Fa len
+A pointer to the number of bytes to be copied.
+.It Fa flags
+Flags, should be set to 0 for now.
+.It Fa incred
+The credentials used to read
+.Fa invp .
+.It Fa outcred
+The credentials used to write
+.Fa outvp .
+.It Fa fsize_td
+The thread pointer to be passed to vn_rlimit_fsize().
+This will be
+.Dv NULL
+for a server thread without limits, such as for the NFS
+server or
+.Dv curthread
+otherwise.
+.El
+.Pp
+On entry and on return, the
+.Fa inoff
+and
+.Fa outoff
+arguments point to the locations of the file offsets.
+These file offsets should be updated by the number of bytes copied.
+The
+.Fa len
+argument points to the location that stores the number of bytes
+to be copied.
+It should be reduced by the number of bytes copied, which implies that
+the value pointed to by
+.Fa len
+will normally be zero for a non-error return.
+However, a copy of less bytes than requested is permitted.
+.Sh LOCKS
+The vnode are unlocked on entry and must be unlocked on return.
+The byte ranges for both
+.Fa invp
+and
+.Fa outvp
+should be range locked when this call is done.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an error code is returned.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EFBIG
+If the copy exceeds the process's file size limit or the maximum file size
+for the file system
+.Fa invp
+and
+.Fa outvp
+reside on.
+.It Bq Er EINTR
+A signal interrupted the VOP call before it could be completed.
+.It Bq Er EIO
+An I/O error occurred while reading/writing the files.
+.It Bq Er ENOSPC
+The file system is full.
+.El
+.Sh SEE ALSO
+.Xr vn_rdwr 9 ,
+.Xr vnode 9

From owner-svn-src-head@freebsd.org  Thu Jul 25 06:35:22 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D098C41F1;
 Thu, 25 Jul 2019 06:35:22 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 5E37A6BAC3;
 Thu, 25 Jul 2019 06:35:22 +0000 (UTC)
 (envelope-from rmacklem@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 367A022C44;
 Thu, 25 Jul 2019 06:35:22 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6P6ZMG9006651;
 Thu, 25 Jul 2019 06:35:22 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6P6ZMlG006650;
 Thu, 25 Jul 2019 06:35:22 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201907250635.x6P6ZMlG006650@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Thu, 25 Jul 2019 06:35:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350320 - head/sys/sys
X-SVN-Group: head
X-SVN-Commit-Author: rmacklem
X-SVN-Commit-Paths: head/sys/sys
X-SVN-Commit-Revision: 350320
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 5E37A6BAC3
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.965,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 06:35:22 -0000

Author: rmacklem
Date: Thu Jul 25 06:35:21 2019
New Revision: 350320
URL: https://svnweb.freebsd.org/changeset/base/350320

Log:
  Update the generated syscall.mk for copy_file_range(2).
  
  I missed this file for commit r350316.

Modified:
  head/sys/sys/syscall.mk

Modified: head/sys/sys/syscall.mk
==============================================================================
--- head/sys/sys/syscall.mk	Thu Jul 25 06:20:00 2019	(r350319)
+++ head/sys/sys/syscall.mk	Thu Jul 25 06:35:21 2019	(r350320)
@@ -409,4 +409,5 @@ MIASM =  \
 	fhlink.o \
 	fhlinkat.o \
 	fhreadlink.o \
+	copy_file_range.o \
 	funlinkat.o

From owner-svn-src-head@freebsd.org  Thu Jul 25 06:48:31 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6FE11C4467;
 Thu, 25 Jul 2019 06:48:31 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 4E9CF6C0CB;
 Thu, 25 Jul 2019 06:48:31 +0000 (UTC)
 (envelope-from rmacklem@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 27CD122E26;
 Thu, 25 Jul 2019 06:48:31 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6P6mUhO012508;
 Thu, 25 Jul 2019 06:48:30 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6P6mUCR012507;
 Thu, 25 Jul 2019 06:48:30 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201907250648.x6P6mUCR012507@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Thu, 25 Jul 2019 06:48:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350321 - head/sys/sys
X-SVN-Group: head
X-SVN-Commit-Author: rmacklem
X-SVN-Commit-Paths: head/sys/sys
X-SVN-Commit-Revision: 350321
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 4E9CF6C0CB
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.919,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 06:48:31 -0000

Author: rmacklem
Date: Thu Jul 25 06:48:30 2019
New Revision: 350321
URL: https://svnweb.freebsd.org/changeset/base/350321

Log:
  r350320 committed the wrong version of generated syscall.mk.
  
  This commit is for the correct version. (The incorrect one had the order
  of the last two entries reversed, due to my testing with copy_file_range
  at 568 instead of 569.) This misordering should not have been a problem,
  but is now fixed.

Modified:
  head/sys/sys/syscall.mk

Modified: head/sys/sys/syscall.mk
==============================================================================
--- head/sys/sys/syscall.mk	Thu Jul 25 06:35:21 2019	(r350320)
+++ head/sys/sys/syscall.mk	Thu Jul 25 06:48:30 2019	(r350321)
@@ -409,5 +409,5 @@ MIASM =  \
 	fhlink.o \
 	fhlinkat.o \
 	fhreadlink.o \
-	copy_file_range.o \
-	funlinkat.o
+	funlinkat.o \
+	copy_file_range.o

From owner-svn-src-head@freebsd.org  Thu Jul 25 07:57:02 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A3EAC56BC;
 Thu, 25 Jul 2019 07:57:02 +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 6C5696E6B4;
 Thu, 25 Jul 2019 07:57:02 +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 40AB223A95;
 Thu, 25 Jul 2019 07:57:02 +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 x6P7v2BP053383;
 Thu, 25 Jul 2019 07:57:02 GMT (envelope-from lwhsu@FreeBSD.org)
Received: (from lwhsu@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6P7v2Xv053382;
 Thu, 25 Jul 2019 07:57:02 GMT (envelope-from lwhsu@FreeBSD.org)
Message-Id: <201907250757.x6P7v2Xv053382@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to
 lwhsu@FreeBSD.org using -f
From: Li-Wen Hsu <lwhsu@FreeBSD.org>
Date: Thu, 25 Jul 2019 07:57:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350322 - head
X-SVN-Group: head
X-SVN-Commit-Author: lwhsu
X-SVN-Commit-Paths: head
X-SVN-Commit-Revision: 350322
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 6C5696E6B4
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 07:57:02 -0000

Author: lwhsu
Date: Thu Jul 25 07:57:01 2019
New Revision: 350322
URL: https://svnweb.freebsd.org/changeset/base/350322

Log:
  Workaround the build failure on platforms have lib32 after r350301
  
  Error message:
  
  make[5]: make[5]: don't know how to make /usr/obj/usr/src/amd64.amd64/obj-lib32/tmp/sys/netinet/in.h. Stop
  
  make[5]: stopped in /usr/src/lib/libsysdecode
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/Makefile.libcompat

Modified: head/Makefile.libcompat
==============================================================================
--- head/Makefile.libcompat	Thu Jul 25 06:48:30 2019	(r350321)
+++ head/Makefile.libcompat	Thu Jul 25 07:57:01 2019	(r350322)
@@ -186,6 +186,7 @@ build${libcompat}: .PHONY
 .endif
 	mkdir -p ${WORLDTMP}
 	ln -sf ${.CURDIR}/sys ${WORLDTMP}
+	ln -sf ${.CURDIR}/sys ${LIBCOMPATTMP}
 .for _t in ${_obj} includes
 .for _dir in ${_LC_INCDIRS}
 	${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATWMAKE} MK_INCLUDES=yes \

From owner-svn-src-head@freebsd.org  Thu Jul 25 13:27:22 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCEE6A4B95;
 Thu, 25 Jul 2019 13:27:22 +0000 (UTC)
 (envelope-from garga.bsd@gmail.com)
Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com
 [IPv6:2607:f8b0:4864:20::730])
 (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 DCEE182C6E;
 Thu, 25 Jul 2019 13:27:21 +0000 (UTC)
 (envelope-from garga.bsd@gmail.com)
Received: by mail-qk1-x730.google.com with SMTP id a27so36396865qkk.5;
 Thu, 25 Jul 2019 06:27:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:to:references:from:openpgp:autocrypt:message-id:date
 :user-agent:mime-version:in-reply-to;
 bh=X/SBIySjs+27ME5tZJPj/rRxGRMrqSBma0PHc4lT2S0=;
 b=jYihUa/tuZe3gPJRJsxC86J/dq4s8VcQE2SUkDPmvyD5aEzCQzPUIqkS8jnuJO3E37
 CspuvKDSoK22EKdbQcavGKyzfKytaJw4qZLjPZ2mvPDQ2ofVfMjnlWRunjSbCr3VW7UU
 xvfy5MI8a5dyGqKQw0G1VgWtz+kWmT/P6P2ut/h3jhbyj5jQfnuBKkWemIMi/e+7ArYQ
 +qaChT5Ga9Nt0Q5ZK07FWvQLt1jj+0iM/178PM4MrOcbitWtQPNtDI9ZlYYcl9OX0Ks6
 jrOZ+CJX0URBicNiJZfEcxtgsN+38GsgXpI27PW0JygzyXuo5IhcS5y9iXGzJIPhKOvo
 PYLw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:to:references:from:openpgp
 :autocrypt:message-id:date:user-agent:mime-version:in-reply-to;
 bh=X/SBIySjs+27ME5tZJPj/rRxGRMrqSBma0PHc4lT2S0=;
 b=MvW6pvDRTlCXH7HT+8ksBrncqoPABYCpu9iPs6/FT6Ov4dpBrDGP38DKYFF09mSatb
 bPkMJGB6kOSHVsT5zkEYIUW29B5wju7l+hFjK+iC32d08vjDilwgVqXOuKGnfjD7pUF7
 HWzxpyAxbscLYWjMZDACaXNGZu+UKLKtUU94FkmoNe3H6o2/MbT7onRI8ocsvbbPkui7
 PdTdWk2+8e+cPziFAtwciMmSzCw88P5oxwDR5ejZ7SM98zRvT2YubYF3CxF1bgU0BXkd
 +nnuqTjSxCMl2lmlfBy5N+0ormo7i9s7ssMAwyAFzCMVEhV6D1U/MYbLTxaPR51fD8Bv
 xDKQ==
X-Gm-Message-State: APjAAAXrhp41l/n8czsWnHfK8B4hsUEZXlgG+kReNYbXJhW80wN+9Zms
 hdojlJCiUgKy6+vHlB0MKvybeeJd
X-Google-Smtp-Source: APXvYqy3dCPpRadaBMKV4KVSlZ6lZm8eFZLlJqF4R2Pmvnz44xZBu6DVJfMihGKIJZG5nrrculLDPQ==
X-Received: by 2002:ae9:ee14:: with SMTP id i20mr52891876qkg.428.1564061241061; 
 Thu, 25 Jul 2019 06:27:21 -0700 (PDT)
Received: from mbp.home ([2804:f1c:800:fc00:3ca5:8f67:2b13:24e7])
 by smtp.gmail.com with ESMTPSA id d25sm20222243qko.96.2019.07.25.06.27.18
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 25 Jul 2019 06:27:19 -0700 (PDT)
Sender: Renato Botelho <garga.bsd@gmail.com>
Subject: Re: svn commit: r349976 - head
To: Ian Lepore <ian@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
References: <201907131648.x6DGmRc4090395@repo.freebsd.org>
From: Renato Botelho <garga@FreeBSD.org>
Openpgp: preference=signencrypt
Autocrypt: addr=garga@FreeBSD.org; prefer-encrypt=mutual; keydata=
 mQENBFn4ZqUBCACxJRWi57JkmsCrSU0gZd/CwB+B90OTUeXmF63lDPETOQ+pBA4+vJgzjW1C
 pv7rR25wxvESJKphxZJOOk9AXTXsg5QrhdP3+KQG/zNcKd2ukbt3ezkhdMx8q81wn4wY2oTl
 WXdGIVdDKvC8sCp1fc6pPKJin71/skb9wg6ThtlRFlv9en4f8QSVmRuzRKQ6VjCbl+yIpiye
 /I5BQ4I99uouPzPhzf9ya3cvp4xbiw5wSo1F3nLsThBT2osYy/nRNz2ciuCYyyX87dGhio0T
 8Pxl37eBbGQvCGwPQBApCcfoiZBN/5F65Tt4p72gIqT+AYuqq5G7Bhj+fGTC7q0QotL/ABEB
 AAG0LFJlbmF0byBCb3RlbGhvIChGcmVlQlNEKSA8Z2FyZ2FARnJlZUJTRC5vcmc+iQFXBBMB
 CgBBAhsDBQkFo5qABQsJCAcDBRUKCQgLBRYDAgEAAh4BAheAFiEExxiLNMqsn7yXmTy7W54E
 w5ZrhhoFAln4aeUCGQEACgkQW54Ew5ZrhhpTIwf+OS+Gv/ITOy7+8D+8SKXNmkfczsTO+Uqz
 6SraXcq32j1C4QcRQCwGPhVJJgKnFSvPm3kbNPFXaQh1zD+mTQ4r/Loc78Rz+fZljYcgNx7n
 aQKhd9pdpXaELOe+Y10jvGUrT0SE06Y10BP/NmQaLplt9qG8VgLAAB9ZcsuZ9pzbBbQjd9In
 OK5VcXQzHT/EBBQ1rHsl1Aq8TYdmjbKl+HKc1c8dJ5OfXrgnTIUwQdN1rauXbmH/YW/CKN7z
 zF59v/sPBTaWfFl2CS/BORhWhe1PBudrVZWFT0oJGNuG6k8dlnssoL/0ojFaN5w5xm8mvMAf
 uAuixGf4bK6C7hcE34D/ULkBDQRZ+GalAQgApiTibUM0OpeCcxf5YUep4F4y853ClU4TMqZO
 +ho38sz0GdshQWuBEBqahOtxapHUMtlmC+wJNCBAav5JYjHHrXXE9pgRm5EgVssDpMvplLB4
 5CFdx5jBu02Bt9Wp5bD21TPH3rsYJUB3rYmxWfVmdRhNBERrCJu49OIsBSKAlIinx8altYrh
 Z7bO2C1hKOG6QHWRr4ml4HTD/gZ6TTfsrR+sktBNv/5ZRkcJNDVM+eOGagXkEUOVFe9KXynD
 3KcZBbBKpwoaW5GK8OglKJt8ggUfc78CG1xk4b5nL8QCk0CBrC6VPPOYvXTpYSTHmx1QkElm
 1iNu1Tc5ccvcyAwTswARAQABiQE8BBgBCgAmFiEExxiLNMqsn7yXmTy7W54Ew5ZrhhoFAln4
 ZqUCGwwFCQWjmoAACgkQW54Ew5ZrhhoH3wf+KuIeDyvIJOui+0C5FD5r44Bwkj/SAUVUerfp
 0qtRktc+BZoSifPs3Rqjh/PpwRvLTuJnSsiqWLz8NCTThogRzVqEcQHqZR3vOjtYM60sjYJ+
 BGQl/bjm1C/YtWEEmKs7mJc+02U8qJA4rbNKSRRRoz6XngnuN6YC0fkeD7c7rxRhOg6OWasZ
 JinB9+dO1IH7eZ5c97v518qSaLRp0T7I+FpEGOp7tTFHaepZWEnuojr5D6jI1MOEywy0EWJu
 3m0TYlh935I8o7gLABqoHEmUeW7JK7r91SZaFnr8zQ6XOAxkPh50uFMTNtNZTnM7k1pRv5Ov
 fms0VzARITYzTwmpDQ==
Message-ID: <a1a7c5e9-4bb4-68a8-9fc6-254b1795a589@FreeBSD.org>
Date: Thu, 25 Jul 2019 10:27:15 -0300
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0)
 Gecko/20100101 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <201907131648.x6DGmRc4090395@repo.freebsd.org>
Content-Type: multipart/signed; micalg=pgp-sha512;
 protocol="application/pgp-signature";
 boundary="ZUwLwEwpkm2LUEDwYaGu47v3RM4YDnA5S"
X-Rspamd-Queue-Id: DCEE182C6E
X-Spamd-Bar: --------
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=gmail.com header.s=20161025 header.b=jYihUa/t;
 spf=pass (mx1.freebsd.org: domain of gargabsd@gmail.com designates
 2607:f8b0:4864:20::730 as permitted sender) smtp.mailfrom=gargabsd@gmail.com
X-Spamd-Result: default: False [-8.26 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[];
 TO_DN_SOME(0.00)[];
 R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36];
 HAS_ATTACHMENT(0.00)[]; RCVD_COUNT_THREE(0.00)[3];
 DKIM_TRACE(0.00)[gmail.com:+];
 MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com];
 NEURAL_HAM_SHORT(-0.95)[-0.947,0]; SIGNED_PGP(-2.00)[];
 FORGED_SENDER(0.30)[garga@FreeBSD.org,gargabsd@gmail.com];
 RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+];
 FREEMAIL_ENVFROM(0.00)[gmail.com];
 FROM_NEQ_ENVFROM(0.00)[garga@FreeBSD.org,gargabsd@gmail.com];
 MID_RHS_MATCH_FROM(0.00)[];
 ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US];
 ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0];
 R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; TAGGED_FROM(0.00)[];
 FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4];
 TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0];
 MIME_GOOD(-0.20)[multipart/signed,multipart/mixed,text/plain];
 DMARC_NA(0.00)[FreeBSD.org];
 IP_SCORE(-3.00)[ip: (-9.44), ipnet: 2607:f8b0::/32(-3.08), asn: 15169(-2.43),
 country: US(-0.05)]; 
 RCVD_IN_DNSWL_NONE(0.00)[0.3.7.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]
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 13:27:22 -0000

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--ZUwLwEwpkm2LUEDwYaGu47v3RM4YDnA5S
Content-Type: multipart/mixed; boundary="DTfhUXHHxHeZL8sKL7ovSFtbSNzUoGCgZ";
 protected-headers="v1"
From: Renato Botelho <garga@FreeBSD.org>
To: Ian Lepore <ian@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
Message-ID: <a1a7c5e9-4bb4-68a8-9fc6-254b1795a589@FreeBSD.org>
Subject: Re: svn commit: r349976 - head
References: <201907131648.x6DGmRc4090395@repo.freebsd.org>
In-Reply-To: <201907131648.x6DGmRc4090395@repo.freebsd.org>

--DTfhUXHHxHeZL8sKL7ovSFtbSNzUoGCgZ
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable

On 13/07/19 13:48, Ian Lepore wrote:
> Author: ian
> Date: Sat Jul 13 16:48:27 2019
> New Revision: 349976
> URL: https://svnweb.freebsd.org/changeset/base/349976
>=20
> Log:
>   Add an entry mentioning the permission/mode change to daily accountin=
g files.
>=20
> Modified:
>   head/UPDATING
>=20
> Modified: head/UPDATING
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=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/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".)
> =20
> +20190713:
> +    Default permissions on the /var/account/acct file (and copies of i=
t rotated=20
> +    by periodic daily scripts) are changed from 0644 to 0640 because t=
he file=20
> +    contains sensitive information that should not be world-readable. =
 If the=20
> +    /var/account directory must be created by rc.d/accounting, the mod=
e used is=20
> +    now 0750.  Admins who use the accounting feature are encouraged to=
 change=20
> +    the mode of an existing /var/account directory to 0750 or 0700. =20

Block is indented with 4 spaces instead of tabs

--=20
Renato Botelho


--DTfhUXHHxHeZL8sKL7ovSFtbSNzUoGCgZ--

--ZUwLwEwpkm2LUEDwYaGu47v3RM4YDnA5S
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQGTBAEBCgB9FiEExxiLNMqsn7yXmTy7W54Ew5ZrhhoFAl05rjRfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEM3
MTg4QjM0Q0FBQzlGQkM5Nzk5M0NCQjVCOUUwNEMzOTY2Qjg2MUEACgkQW54Ew5Zr
hhrkGwf8DQstHIKlEQ9BB8HIBDjwRC6kMcxHOr/eU+IjJi4Rd9op2mG5opfeZ3KI
b9UkLPyfalnxVYmqOwlmvvXQK/ok5r8T4rY28wf3kV+xyNfFE5oZ6XrgeOvb3G8Q
V+jPR4yyNF++bjhVtAP4fSSo9T35iXGKqF5RsiSpWgv3o96hOb7fx8X1wyLR9rpF
fFQ5bKf+uFuBsA+kruKJEBp5i2+92PTT2x61kvuENLinqnF/MVUtdvUQ4RuwN1th
PIGYjqE/VAIvZbr/JsQYow2DDpxs7fXjiA5H2zCA8KJgDG6fQG6hl1LNMjq+8nzE
JErPgoDvwek3pY3nOTAm9/OrLMscJQ==
=5B5C
-----END PGP SIGNATURE-----

--ZUwLwEwpkm2LUEDwYaGu47v3RM4YDnA5S--

From owner-svn-src-head@freebsd.org  Thu Jul 25 15:27:06 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27AB2A7249;
 Thu, 25 Jul 2019 15:27:06 +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 08889873AA;
 Thu, 25 Jul 2019 15:27:06 +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 D2EFEB26;
 Thu, 25 Jul 2019 15:27:05 +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 x6PFR5ug017029;
 Thu, 25 Jul 2019 15:27:05 GMT (envelope-from luporl@FreeBSD.org)
Received: (from luporl@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6PFR59p017028;
 Thu, 25 Jul 2019 15:27:05 GMT (envelope-from luporl@FreeBSD.org)
Message-Id: <201907251527.x6PFR59p017028@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: luporl set sender to
 luporl@FreeBSD.org using -f
From: Leandro Lupori <luporl@FreeBSD.org>
Date: Thu, 25 Jul 2019 15:27:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350323 - 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: 350323
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 08889873AA
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_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.95)[-0.946,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 15:27:06 -0000

Author: luporl
Date: Thu Jul 25 15:27:05 2019
New Revision: 350323
URL: https://svnweb.freebsd.org/changeset/base/350323

Log:
  powerpc: Improve pvo allocation code
  
  Added allocation retry loop in alloc_pvo_entry(), to wait for
  memory to become available if the caller specifies the M_WAITOK flag.
  
  Also, the loop in moa64_enter() was removed, as moea64_pvo_enter()
  never returns ENOMEM. It is alloc_pvo_entry() memory allocation that
  can fail and must be retried.
  
  Reviewed by:	jhibbits
  Differential Revision:	https://reviews.freebsd.org/D21035

Modified:
  head/sys/powerpc/aim/mmu_oea64.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c	Thu Jul 25 07:57:01 2019	(r350322)
+++ head/sys/powerpc/aim/mmu_oea64.c	Thu Jul 25 15:27:05 2019	(r350323)
@@ -373,24 +373,28 @@ vm_page_to_pvoh(vm_page_t m)
 }
 
 static struct pvo_entry *
-alloc_pvo_entry(int bootstrap)
+alloc_pvo_entry(int bootstrap, int flags)
 {
 	struct pvo_entry *pvo;
 
+	KASSERT(bootstrap || (flags & M_WAITOK) || (flags & M_NOWAIT),
+	    ("Either M_WAITOK or M_NOWAIT flag must be specified "
+	     "when bootstrap is 0"));
+	KASSERT(!bootstrap || !(flags & M_WAITOK),
+	    ("M_WAITOK can't be used with bootstrap"));
+
 	if (!moea64_initialized || bootstrap) {
 		if (moea64_bpvo_pool_index >= moea64_bpvo_pool_size) {
 			panic("moea64_enter: bpvo pool exhausted, %d, %d, %zd",
-			      moea64_bpvo_pool_index, moea64_bpvo_pool_size, 
+			      moea64_bpvo_pool_index, moea64_bpvo_pool_size,
 			      moea64_bpvo_pool_size * sizeof(struct pvo_entry));
 		}
 		pvo = &moea64_bpvo_pool[
 		    atomic_fetchadd_int(&moea64_bpvo_pool_index, 1)];
 		bzero(pvo, sizeof(*pvo));
 		pvo->pvo_vaddr = PVO_BOOTSTRAP;
-	} else {
-		pvo = uma_zalloc(moea64_pvo_zone, M_NOWAIT);
-		bzero(pvo, sizeof(*pvo));
-	}
+	} else
+		pvo = uma_zalloc(moea64_pvo_zone, flags | M_ZERO);
 
 	return (pvo);
 }
@@ -658,7 +662,7 @@ moea64_setup_direct_map(mmu_t mmup, vm_offset_t kernel
 		     pregions[i].mr_size; pa += moea64_large_page_size) {
 			pte_lo = LPTE_M;
 
-			pvo = alloc_pvo_entry(1 /* bootstrap */);
+			pvo = alloc_pvo_entry(1 /* bootstrap */, 0);
 			pvo->pvo_vaddr |= PVO_WIRED | PVO_LARGE;
 			init_pvo_entry(pvo, kernel_pmap, PHYS_TO_DMAP(pa));
 
@@ -1399,7 +1403,9 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_offset_t va, v
 	if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m))
 		VM_OBJECT_ASSERT_LOCKED(m->object);
 
-	pvo = alloc_pvo_entry(0);
+	pvo = alloc_pvo_entry(0, M_NOWAIT);
+	if (pvo == NULL)
+		return (KERN_RESOURCE_SHORTAGE);
 	pvo->pvo_pmap = NULL; /* to be filled in later */
 	pvo->pvo_pte.prot = prot;
 
@@ -1415,61 +1421,53 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_offset_t va, v
 		pvo_head = &m->md.mdpg_pvoh;
 		pvo->pvo_vaddr |= PVO_MANAGED;
 	}
-	
-	for (;;) {
-		PV_PAGE_LOCK(m);
-		PMAP_LOCK(pmap);
-		if (pvo->pvo_pmap == NULL)
-			init_pvo_entry(pvo, pmap, va);
-		if (prot & VM_PROT_WRITE)
-			if (pmap_bootstrapped &&
-			    (m->oflags & VPO_UNMANAGED) == 0)
-				vm_page_aflag_set(m, PGA_WRITEABLE);
 
-		error = moea64_pvo_enter(mmu, pvo, pvo_head, &oldpvo);
-		if (error == EEXIST) {
-			if (oldpvo->pvo_vaddr == pvo->pvo_vaddr &&
-			    oldpvo->pvo_pte.pa == pvo->pvo_pte.pa &&
-			    oldpvo->pvo_pte.prot == prot) {
-				/* Identical mapping already exists */
-				error = 0;
+	PV_PAGE_LOCK(m);
+	PMAP_LOCK(pmap);
+	if (pvo->pvo_pmap == NULL)
+		init_pvo_entry(pvo, pmap, va);
+	if (prot & VM_PROT_WRITE)
+		if (pmap_bootstrapped &&
+		    (m->oflags & VPO_UNMANAGED) == 0)
+			vm_page_aflag_set(m, PGA_WRITEABLE);
 
-				/* If not in page table, reinsert it */
-				if (MOEA64_PTE_SYNCH(mmu, oldpvo) < 0) {
-					STAT_MOEA64(moea64_pte_overflow--);
-					MOEA64_PTE_INSERT(mmu, oldpvo);
-				}
+	error = moea64_pvo_enter(mmu, pvo, pvo_head, &oldpvo);
+	if (error == EEXIST) {
+		if (oldpvo->pvo_vaddr == pvo->pvo_vaddr &&
+		    oldpvo->pvo_pte.pa == pvo->pvo_pte.pa &&
+		    oldpvo->pvo_pte.prot == prot) {
+			/* Identical mapping already exists */
+			error = 0;
 
-				/* Then just clean up and go home */
-				PV_PAGE_UNLOCK(m);
-				PMAP_UNLOCK(pmap);
-				free_pvo_entry(pvo);
-				break;
+			/* If not in page table, reinsert it */
+			if (MOEA64_PTE_SYNCH(mmu, oldpvo) < 0) {
+				STAT_MOEA64(moea64_pte_overflow--);
+				MOEA64_PTE_INSERT(mmu, oldpvo);
 			}
 
+			/* Then just clean up and go home */
+			PV_PAGE_UNLOCK(m);
+			PMAP_UNLOCK(pmap);
+			free_pvo_entry(pvo);
+			goto out;
+		} else {
 			/* Otherwise, need to kill it first */
 			KASSERT(oldpvo->pvo_pmap == pmap, ("pmap of old "
 			    "mapping does not match new mapping"));
 			moea64_pvo_remove_from_pmap(mmu, oldpvo);
 			moea64_pvo_enter(mmu, pvo, pvo_head, NULL);
 		}
-		PV_PAGE_UNLOCK(m);
-		PMAP_UNLOCK(pmap);
+	}
+	PV_PAGE_UNLOCK(m);
+	PMAP_UNLOCK(pmap);
 
-		/* Free any dead pages */
-		if (error == EEXIST) {
-			moea64_pvo_remove_from_page(mmu, oldpvo);
-			free_pvo_entry(oldpvo);
-		}
-
-		if (error != ENOMEM)
-			break;
-		if ((flags & PMAP_ENTER_NOSLEEP) != 0)
-			return (KERN_RESOURCE_SHORTAGE);
-		VM_OBJECT_ASSERT_UNLOCKED(m->object);
-		vm_wait(NULL);
+	/* Free any dead pages */
+	if (error == EEXIST) {
+		moea64_pvo_remove_from_page(mmu, oldpvo);
+		free_pvo_entry(oldpvo);
 	}
 
+out:
 	/*
 	 * Flush the page from the instruction cache if this page is
 	 * mapped executable and cacheable.
@@ -1632,7 +1630,7 @@ moea64_uma_page_alloc(uma_zone_t zone, vm_size_t bytes
 
 	va = VM_PAGE_TO_PHYS(m);
 
-	pvo = alloc_pvo_entry(1 /* bootstrap */);
+	pvo = alloc_pvo_entry(1 /* bootstrap */, 0);
 
 	pvo->pvo_pte.prot = VM_PROT_READ | VM_PROT_WRITE;
 	pvo->pvo_pte.pa = VM_PAGE_TO_PHYS(m) | LPTE_M;
@@ -1864,7 +1862,7 @@ moea64_kenter_attr(mmu_t mmu, vm_offset_t va, vm_paddr
 	int		error;	
 	struct pvo_entry *pvo, *oldpvo;
 
-	pvo = alloc_pvo_entry(0);
+	pvo = alloc_pvo_entry(0, M_WAITOK);
 	pvo->pvo_pte.prot = VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE;
 	pvo->pvo_pte.pa = (pa & ~ADDR_POFF) | moea64_calc_wimg(pa, ma);
 	pvo->pvo_vaddr |= PVO_WIRED;

From owner-svn-src-head@freebsd.org  Thu Jul 25 15:31:16 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A588A7353;
 Thu, 25 Jul 2019 15:31:16 +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 4B37B87714;
 Thu, 25 Jul 2019 15:31:16 +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 26F6AB77;
 Thu, 25 Jul 2019 15:31:16 +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 x6PFVGfI019499;
 Thu, 25 Jul 2019 15:31:16 GMT (envelope-from ian@FreeBSD.org)
Received: (from ian@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6PFVGmx019498;
 Thu, 25 Jul 2019 15:31:16 GMT (envelope-from ian@FreeBSD.org)
Message-Id: <201907251531.x6PFVGmx019498@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org
 using -f
From: Ian Lepore <ian@FreeBSD.org>
Date: Thu, 25 Jul 2019 15:31:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350324 - head
X-SVN-Group: head
X-SVN-Commit-Author: ian
X-SVN-Commit-Paths: head
X-SVN-Commit-Revision: 350324
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 4B37B87714
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.95)[-0.945,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 15:31:16 -0000

Author: ian
Date: Thu Jul 25 15:31:15 2019
New Revision: 350324
URL: https://svnweb.freebsd.org/changeset/base/350324

Log:
  Fix indentation (spaces->tab).
  
  Reported by:	garga@

Modified:
  head/UPDATING

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Thu Jul 25 15:27:05 2019	(r350323)
+++ head/UPDATING	Thu Jul 25 15:31:15 2019	(r350324)
@@ -27,12 +27,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
 	"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.  
+	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

From owner-svn-src-head@freebsd.org  Thu Jul 25 15:32:25 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id E900AA7516
 for <svn-src-head@mailman.nyi.freebsd.org>;
 Thu, 25 Jul 2019 15:32:25 +0000 (UTC) (envelope-from ian@freebsd.org)
Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org
 [54.149.155.156])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 85D7687B06
 for <svn-src-head@freebsd.org>; Thu, 25 Jul 2019 15:32:25 +0000 (UTC)
 (envelope-from ian@freebsd.org)
ARC-Seal: i=1; a=rsa-sha256; t=1564068738; cv=none;
 d=outbound.mailhop.org; s=arc-outbound20181012;
 b=f98mCSrMAau86OLgsSX+DEV00emDfy65QS/t7M4InXggvdY6Pw53NeIE1h21iZrDPi//nDQtH6HFv
 mgOI28DT9VXaus8tnfLRf0hV4afBPCLFxYYQGswZGcRQ5ogeN7ofBNxE8ExDAG9Xt591ZjFFTYCDV5
 N2gAQNutLel8DnPL+2wd6IbrklHEstmuWWY5gT7OJLUXSWdXE4dMFpICXnG8GxAK0xZ51PKmeWky80
 5YjMvV0vhsqbc2xAihLsSD2EXroMfgYaQH9GFRuL1WiYD4hJDGIvCveDYaKk99/k2PhkWryhVMSKTr
 rCVilhpaVc3fl9OGNyQvfDmGIyxjKjA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
 d=outbound.mailhop.org; s=arc-outbound20181012;
 h=content-transfer-encoding:mime-version:content-type:references:in-reply-to:
 date:to:from:subject:message-id:dkim-signature:from;
 bh=9TEqOMlXAgZVEdRBzdobe3DPmHEg7Qdw0sjzWw6YpN8=;
 b=al2fLuY+Bu2BaR/ua678GXFacqebssiFR2W5PYavMMgkpA+Wqxe5COlMI+MiaWMwA+P98Dq2pHwar
 G/J/GrIClL6a59+iNx5o0pV8ZlWxtSAJsqNfkD2oplAh7ja+Zx1GVGetRWBfKZabdPKppx819lCHhh
 wbRg0a7eDwuVEWRzehhGu1EIoeqcU+vqY1/iOOM20vEOw8DmegMdGlATooQdErudO+hLcLwJOFkXCD
 yvLF7dStbcs/Ie5dLk7ZltZrtntC+QNimjyPDvmEAprrXCO2mnKMWtMR98/PQDqoNg6x+x0dnnyMMl
 uTXofe3rXdKrUhkAY/Qan1g7XY46QTQ==
ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org;
 spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60;
 dmarc=none header.from=freebsd.org;
 arc=none header.oldest-pass=0;
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=outbound.mailhop.org; s=dkim-high;
 h=content-transfer-encoding:mime-version:content-type:references:in-reply-to:
 date:to:from:subject:message-id:from;
 bh=9TEqOMlXAgZVEdRBzdobe3DPmHEg7Qdw0sjzWw6YpN8=;
 b=HAEFGyObmUkSEhbIg3uckuS1iDxVf+YX7e7ZCyGd4OZT+EfJpk6Oxw/uWMFggXPX0+6jodZlOIMcW
 c0Lr0PIhGp2Vs1jRVkniBs/IMSS2kT7lsYbmDcNOMkLruGjhjJhhn+InDrN2eMZD5Q7isWkobJHt0Q
 krhx+pmaZVIF7hlJIHwqlkuWZ9Qy+C6KTIMhXr+9CuuJYy+0sjmmZ5GnI76lqptuTV5kOrHdL/3kKb
 e3mk3BRFeLvYMORCURE+R0r5tAzE4UZRyfiecwzmX/ML/y5BUaavSY8sTkXlypg5/6zpL3A9Yjh8IB
 ZQZnvNMdyQGr32aYRbgoQs4PLhEpwCw==
X-MHO-RoutePath: aGlwcGll
X-MHO-User: 61b7b4a0-aef1-11e9-b670-c3119635ad0a
X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information
X-Originating-IP: 67.177.211.60
X-Mail-Handler: DuoCircle Outbound SMTP
Received: from ilsoft.org (unknown [67.177.211.60])
 by outbound4.ore.mailhop.org (Halon) with ESMTPSA
 id 61b7b4a0-aef1-11e9-b670-c3119635ad0a;
 Thu, 25 Jul 2019 15:32:17 +0000 (UTC)
Received: from rev (rev [172.22.42.240])
 by ilsoft.org (8.15.2/8.15.2) with ESMTP id x6PFWFRW073383;
 Thu, 25 Jul 2019 09:32:15 -0600 (MDT) (envelope-from ian@freebsd.org)
Message-ID: <62945ba288b96e431b5053167ab8c23f192bcbed.camel@freebsd.org>
Subject: Re: svn commit: r349976 - head
From: Ian Lepore <ian@freebsd.org>
To: Renato Botelho <garga@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
Date: Thu, 25 Jul 2019 09:32:15 -0600
In-Reply-To: <a1a7c5e9-4bb4-68a8-9fc6-254b1795a589@FreeBSD.org>
References: <201907131648.x6DGmRc4090395@repo.freebsd.org>
 <a1a7c5e9-4bb4-68a8-9fc6-254b1795a589@FreeBSD.org>
Content-Type: text/plain; charset="UTF-8"
X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Rspamd-Queue-Id: 85D7687B06
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.99 / 15.00];
 local_wl_from(0.00)[freebsd.org];
 NEURAL_HAM_MEDIUM(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.99)[-0.987,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 15:32:26 -0000

On Thu, 2019-07-25 at 10:27 -0300, Renato Botelho wrote:
> On 13/07/19 13:48, Ian Lepore wrote:
> > 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.  
> 
> Block is indented with 4 spaces instead of tabs
> 

Doh!  Must've still had my editor set for the $work coding standards. 
Fixed in r350324.  Thanks!

-- Ian


From owner-svn-src-head@freebsd.org  Thu Jul 25 15:43:16 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5673A7826;
 Thu, 25 Jul 2019 15:43:16 +0000 (UTC) (envelope-from bjk@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 863A18829D;
 Thu, 25 Jul 2019 15:43:16 +0000 (UTC) (envelope-from bjk@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 5C0BEEC7;
 Thu, 25 Jul 2019 15:43:16 +0000 (UTC) (envelope-from bjk@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6PFhGIG028707;
 Thu, 25 Jul 2019 15:43:16 GMT (envelope-from bjk@FreeBSD.org)
Received: (from bjk@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6PFhGiT028706;
 Thu, 25 Jul 2019 15:43:16 GMT (envelope-from bjk@FreeBSD.org)
Message-Id: <201907251543.x6PFhGiT028706@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: bjk set sender to bjk@FreeBSD.org
 using -f
From: Benjamin Kaduk <bjk@FreeBSD.org>
Date: Thu, 25 Jul 2019 15:43:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350325 - in head: lib/libc/sys share/man/man9
X-SVN-Group: head
X-SVN-Commit-Author: bjk
X-SVN-Commit-Paths: in head: lib/libc/sys share/man/man9
X-SVN-Commit-Revision: 350325
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 863A18829D
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.95)[-0.945,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 15:43:16 -0000

Author: bjk (doc committer)
Date: Thu Jul 25 15:43:15 2019
New Revision: 350325
URL: https://svnweb.freebsd.org/changeset/base/350325

Log:
  Fix grammar nit in copy_file_range docs
  
  Bytes are countable, so we have fewer of them, not less of them.

Modified:
  head/lib/libc/sys/copy_file_range.2
  head/share/man/man9/VOP_COPY_FILE_RANGE.9

Modified: head/lib/libc/sys/copy_file_range.2
==============================================================================
--- head/lib/libc/sys/copy_file_range.2	Thu Jul 25 15:31:15 2019	(r350324)
+++ head/lib/libc/sys/copy_file_range.2	Thu Jul 25 15:43:15 2019	(r350325)
@@ -110,7 +110,7 @@ arguments and this system call for the
 data ranges found.
 .Pp
 .Sh RETURN VALUES
-If it succeeds, the call returns the number of bytes copied, which can be less
+If it succeeds, the call returns the number of bytes copied, which can be fewer
 than
 .Fa len .
 .Fn copy_file_range

Modified: head/share/man/man9/VOP_COPY_FILE_RANGE.9
==============================================================================
--- head/share/man/man9/VOP_COPY_FILE_RANGE.9	Thu Jul 25 15:31:15 2019	(r350324)
+++ head/share/man/man9/VOP_COPY_FILE_RANGE.9	Thu Jul 25 15:43:15 2019	(r350325)
@@ -93,7 +93,7 @@ It should be reduced by the number of bytes copied, wh
 the value pointed to by
 .Fa len
 will normally be zero for a non-error return.
-However, a copy of less bytes than requested is permitted.
+However, a copy of fewer bytes than requested is permitted.
 .Sh LOCKS
 The vnode are unlocked on entry and must be unlocked on return.
 The byte ranges for both

From owner-svn-src-head@freebsd.org  Thu Jul 25 16:46:11 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A38BA8C8D
 for <svn-src-head@mailman.nyi.freebsd.org>;
 Thu, 25 Jul 2019 16:46:11 +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 BA65C8A78F
 for <svn-src-head@freebsd.org>; Thu, 25 Jul 2019 16:46:09 +0000 (UTC)
 (envelope-from shawn.webb@hardenedbsd.org)
Received: by mail-qk1-x743.google.com with SMTP id t8so36940955qkt.1
 for <svn-src-head@freebsd.org>; Thu, 25 Jul 2019 09:46:09 -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=ajC4ZEUau6mzxRhmOThp55SkQuBmuQLo7sBOHljipXU=;
 b=Xhw4eRV8C9P6pPN1zJ86xXOcYgJiOKOJYuZ+UNWvHGq+b2S2segbWxB6o90lRKNRqu
 M19V/COehbKPnwdYqemEXcQ7RQdji3bLlx7U5dF0Op3XwNtas3+Jt2nMorCzOCr1yYPf
 8SGaIZk3dc4VO9v1AdPZHg8D8vX8j3DSuQ/6tHwV3C+yVEYTxxL0bzM7RIBtgVAfcBA+
 Ab5WBLGJjiSdKbaa87+KKKJXg4BlTAU6qcJGgPXjgPrmvuD5mTW89SPqpWrzye7D27be
 dUuJaWBigoUDYRD+0nHaHl6Zk1gqV5OSkMM/vYDAtvcCIM0JJY7kylZ+n30WhNkx9kcH
 FSdg==
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=ajC4ZEUau6mzxRhmOThp55SkQuBmuQLo7sBOHljipXU=;
 b=RjUfXr/yVan8k6WAaOZhejFsFVfx4zUKpPZvqCNzLbN4p8HC63oE8+iyRdJ1XANOcv
 sVFdlfH4HzFotpc+5igAZBPjc6H4t9yd67OaFJu4Y8LhrTeNhMfT86In69QJqEXy/E40
 11vfLZQjXGb7oCu5PqFhY0lMFtWjYpo87gihQQdceYL4ArN5oxsjvssSNXdDv+ApphTh
 R1xO7KdxYWSdt9XdofKdeG7T5hTB/TZfKUDv5a/StaqVCfE7/C2UArsOYN6KFtKdwlNw
 FaUm3QuCu0XGOwu6JhFhdqxjcTYJy2RICGON3eWdBgKjOxd5bEwPDg6oGnr/WQQV59II
 i4DA==
X-Gm-Message-State: APjAAAXWZq3n+qReN5eDjGoaDInsHKIug5pBzswJcgAYVSdyeIOF6OSf
 EXUE+hY5ByOIyIOyrmxMV9L4Ng==
X-Google-Smtp-Source: APXvYqxqkS18jS4Y2TYZX01ensDVWydseZ1qs7ffRUFuj4jXYJYPMcMjerttQ1WXaigk4VzNPQudfQ==
X-Received: by 2002:a37:6085:: with SMTP id u127mr60446865qkb.25.1564073168818; 
 Thu, 25 Jul 2019 09:46:08 -0700 (PDT)
Received: from mutt-hbsd ([63.88.83.108])
 by smtp.gmail.com with ESMTPSA id h19sm19121535qto.3.2019.07.25.09.46.07
 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
 Thu, 25 Jul 2019 09:46:08 -0700 (PDT)
Date: Thu, 25 Jul 2019 12:46:07 -0400
From: Shawn Webb <shawn.webb@hardenedbsd.org>
To: Rick Macklem <rmacklem@FreeBSD.org>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: Re: svn commit: r350315 - in head/sys: kern sys
Message-ID: <20190725164607.zpa7w2pgrnahaxz4@mutt-hbsd>
References: <201907250546.x6P5kHWq076756@repo.freebsd.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature"; boundary="veokz6vwuek33re7"
Content-Disposition: inline
In-Reply-To: <201907250546.x6P5kHWq076756@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: BA65C8A78F
X-Spamd-Bar: -----
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=hardenedbsd.org header.s=google header.b=Xhw4eRV8;
 spf=pass (mx1.freebsd.org: domain of shawn.webb@hardenedbsd.org designates
 2607:f8b0:4864:20::743 as permitted sender)
 smtp.mailfrom=shawn.webb@hardenedbsd.org
X-Spamd-Result: default: False [-5.58 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[];
 TO_DN_SOME(0.00)[];
 R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36];
 RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[hardenedbsd.org:+];
 MX_GOOD(-0.01)[alt1.aspmx.l.google.com,aspmx.l.google.com,aspmx2.googlemail.com,alt2.aspmx.l.google.com,aspmx3.googlemail.com];
 NEURAL_HAM_SHORT(-0.88)[-0.881,0]; SIGNED_PGP(-2.00)[];
 FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+];
 RCVD_TLS_LAST(0.00)[];
 ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US];
 IP_SCORE(-0.59)[ip: (2.64), ipnet: 2607:f8b0::/32(-3.08), asn: 15169(-2.43),
 country: US(-0.05)]; ARC_NA(0.00)[];
 NEURAL_HAM_MEDIUM(-1.00)[-1.000,0];
 R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google];
 URIBL_BLOCKED(0.00)[hardenedbsd.org.multi.uribl.com];
 FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 MIME_GOOD(-0.20)[multipart/signed,text/plain];
 PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org];
 DMARC_NA(0.00)[hardenedbsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[];
 RCVD_IN_DNSWL_NONE(0.00)[3.4.7.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]; MID_RHS_NOT_FQDN(0.50)[]
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 16:46:11 -0000


--veokz6vwuek33re7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hey Rick,

On Thu, Jul 25, 2019 at 05:46:17AM +0000, Rick Macklem wrote:
> Author: rmacklem
> Date: Thu Jul 25 05:46:16 2019
> New Revision: 350315
> URL: https://svnweb.freebsd.org/changeset/base/350315
>=20
> Log:
>   Add kernel support for a Linux compatible copy_file_range(2) syscall.
>  =20
>   This patch adds support to the kernel for a Linux compatible
>   copy_file_range(2) syscall and the related VOP_COPY_FILE_RANGE(9).
>   This syscall/VOP can be used by the NFSv4.2 client to implement the
>   Copy operation against an NFSv4.2 server to do file copies locally on
>   the server.
>   The vn_generic_copy_file_range() function in this patch can be used
>   by the NFSv4.2 server to implement the Copy operation.
>   Fuse may also me able to use the VOP_COPY_FILE_RANGE() method.
>  =20
>   vn_generic_copy_file_range() attempts to maintain holes in the output
>   file in the range to be copied, but may fail to do so if the input and
>   output files are on different file systems with different _PC_MIN_HOLE_=
SIZE
>   values.
>  =20
>   Separate commits will be done for the generated syscall files and userl=
and
>   changes. A commit for a compat32 syscall will be done later.
>  =20
>   Reviewed by:	kib, asomers (plus comments by brooks, jilles)
>   Relnotes:	yes
>   Differential Revision:	https://reviews.freebsd.org/D20584
>=20
> Modified:
>   head/sys/kern/syscalls.master
>   head/sys/kern/vfs_default.c
>   head/sys/kern/vfs_syscalls.c
>   head/sys/kern/vfs_vnops.c
>   head/sys/kern/vnode_if.src
>   head/sys/sys/syscallsubr.h
>   head/sys/sys/vnode.h
>=20
> Modified: head/sys/kern/syscalls.master
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=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/kern/syscalls.master	Thu Jul 25 03:55:05 2019	(r350314)
> +++ head/sys/kern/syscalls.master	Thu Jul 25 05:46:16 2019	(r350315)
> @@ -3175,6 +3175,16 @@
>  		    int flag
>  		);
>  	}
> +569	AUE_NULL	STD {
> +		ssize_t copy_file_range(
> +		    int infd,
> +		    _Inout_opt_ off_t *inoffp,
> +		    int outfd,
> +		    _Inout_opt_ off_t *outoffp,
> +		    size_t len,
> +		    unsigned int flags
> +		);
> +	}
> =20
>  ; Please copy any additions and changes to the following compatability t=
ables:
>  ; sys/compat/freebsd32/syscalls.master
>=20
> Modified: head/sys/kern/vfs_default.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/kern/vfs_default.c	Thu Jul 25 03:55:05 2019	(r350314)
> +++ head/sys/kern/vfs_default.c	Thu Jul 25 05:46:16 2019	(r350315)
> @@ -83,6 +83,7 @@ static int	dirent_exists(struct vnode *vp, const char=
=20
>  static int vop_stdis_text(struct vop_is_text_args *ap);
>  static int vop_stdunset_text(struct vop_unset_text_args *ap);
>  static int vop_stdadd_writecount(struct vop_add_writecount_args *ap);
> +static int vop_stdcopy_file_range(struct vop_copy_file_range_args *ap);
>  static int vop_stdfdatasync(struct vop_fdatasync_args *ap);
>  static int vop_stdgetpages_async(struct vop_getpages_async_args *ap);
> =20
> @@ -140,6 +141,7 @@ struct vop_vector default_vnodeops =3D {
>  	.vop_set_text =3D		vop_stdset_text,
>  	.vop_unset_text =3D	vop_stdunset_text,
>  	.vop_add_writecount =3D	vop_stdadd_writecount,
> +	.vop_copy_file_range =3D	vop_stdcopy_file_range,
>  };
> =20
>  /*
> @@ -1210,6 +1212,17 @@ vfs_stdnosync (mp, waitfor)
>  {
> =20
>  	return (0);
> +}
> +
> +static int
> +vop_stdcopy_file_range(struct vop_copy_file_range_args *ap)
> +{
> +	int error;
> +
> +	error =3D vn_generic_copy_file_range(ap->a_invp, ap->a_inoffp,
> +	    ap->a_outvp, ap->a_outoffp, ap->a_lenp, ap->a_flags, ap->a_incred,
> +	    ap->a_outcred, ap->a_fsizetd);
> +	return (error);
>  }
> =20
>  int
>=20
> Modified: head/sys/kern/vfs_syscalls.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/kern/vfs_syscalls.c	Thu Jul 25 03:55:05 2019	(r350314)
> +++ head/sys/kern/vfs_syscalls.c	Thu Jul 25 05:46:16 2019	(r350315)
> @@ -4814,3 +4814,122 @@ sys_posix_fadvise(struct thread *td, struct posix=
_fadv
>  	    uap->advice);
>  	return (kern_posix_error(td, error));
>  }
> +
> +int
> +kern_copy_file_range(struct thread *td, int infd, off_t *inoffp, int out=
fd,
> +    off_t *outoffp, size_t len, unsigned int flags)
> +{
> +	struct file *infp, *outfp;
> +	struct vnode *invp, *outvp;
> +	int error;
> +	size_t retlen;
> +	void *rl_rcookie, *rl_wcookie;
> +	off_t savinoff, savoutoff;
> +
> +	infp =3D outfp =3D NULL;
> +	rl_rcookie =3D rl_wcookie =3D NULL;
> +	savinoff =3D -1;
> +	error =3D 0;
> +	retlen =3D 0;
> +
> +	if (flags !=3D 0) {
> +		error =3D EINVAL;
> +		goto out;
> +	}
> +	if (len > SSIZE_MAX)
> +		/*
> +		 * Although the len argument is size_t, the return argument
> +		 * is ssize_t (which is signed).  Therefore a size that won't
> +		 * fit in ssize_t can't be returned.
> +		 */
> +		len =3D SSIZE_MAX;
> +
> +	/* Get the file structures for the file descriptors. */
> +	error =3D fget_read(td, infd, &cap_read_rights, &infp);
> +	if (error !=3D 0)
> +		goto out;
> +	error =3D fget_write(td, outfd, &cap_write_rights, &outfp);
> +	if (error !=3D 0)
> +		goto out;
> +
> +	/* Set the offset pointers to the correct place. */
> +	if (inoffp =3D=3D NULL)
> +		inoffp =3D &infp->f_offset;
> +	if (outoffp =3D=3D NULL)
> +		outoffp =3D &outfp->f_offset;
> +	savinoff =3D *inoffp;
> +	savoutoff =3D *outoffp;

Should these two lines, saving the old inoffp and outoffp, be moved
before the two conditionals above?

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

--veokz6vwuek33re7
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl053MkACgkQ/y5nonf4
4fr54Q/+PfcJIexfFFDXCQy43PkVrYpTXmNy6vHHf/c8wjgKespkEc9chaQlTWdi
HifnyWrxlH+zwSH2+1vLlmhh9GVywUGOoXCUQK5NY+EkQ0QrSBOubA/htGDWuBun
GF2GI8o2Fu+cXuy9CkbfwPbSqgv0Bb4VjKkB7v/99A1OcVnbBeZ0grir/xQznazJ
GevbVV6SamdDirCECnlbFleapMCwxVJbO+3WpVrygf5JNvAaP0/mCOYgrJIi2wdz
HZm+McS/9+k5rk+3lNilYQTIRS9/3zH+3epYOk3r3+9naV3IuuvNHGFvcFTxFlJ4
oOxp1mpu06qu2tsGxihfv26givlFAzxkUjboWUdNQ20MAIRs/qMpxpnr+RpQgV/o
UAWtWtct+QhKtK5nY1GwQcYMboseeI+US8l+Qg9/vAuLi+EBCwmBM73Jh0nCBAc+
Ug8RJDb2rUUV2d9kE7updEJkYfWambX7RUXWRKKAtivsFxFzFW5s8izWDrwE6I0l
6OIn9DLtVwZwmlkSlKv71uipuvxcvLpzPoEaWENKhSJF4e4gBRyNF98b10Ea4zx3
X13NE2Y7VNI20+IYuayJ7GpOH4OqnfzaphEtJShvQhFNDK8QbjZSADkMLucRaSOI
xCGgyg08PBAvl+XTNa25P1KsXlFoRDTUFi2Nu54TJKPtsN+aoyU=
=KYRD
-----END PGP SIGNATURE-----

--veokz6vwuek33re7--

From owner-svn-src-head@freebsd.org  Thu Jul 25 16:49:13 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id CAA68A8D2A;
 Thu, 25 Jul 2019 16:49:13 +0000 (UTC)
 (envelope-from kevans@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 7C82D8A985;
 Thu, 25 Jul 2019 16:49:13 +0000 (UTC)
 (envelope-from kevans@freebsd.org)
Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com
 [209.85.128.51])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK))
 (Authenticated sender: kevans)
 by smtp.freebsd.org (Postfix) with ESMTPSA id 287C0888B;
 Thu, 25 Jul 2019 16:49:13 +0000 (UTC)
 (envelope-from kevans@freebsd.org)
Received: by mail-wm1-f51.google.com with SMTP id l2so45337469wmg.0;
 Thu, 25 Jul 2019 09:49:13 -0700 (PDT)
X-Gm-Message-State: APjAAAVufpnQctdcs4vSKIIUBGqrJX2nH/e6WZexVvhuCuZrjw9o+FsS
 Io5odt3dkQiCX++2q8N6MF36RaK52MFDXGEhBhc=
X-Google-Smtp-Source: APXvYqyTipxcHMlygfJCId0nvMzOkYnc+90zTxcpHUDsNLBjmhvRLA41IVVw6fGwWWuwlOgLuWyosPcXUd4t+pMu6wA=
X-Received: by 2002:a05:600c:389:: with SMTP id
 w9mr54900791wmd.139.1564073352135; 
 Thu, 25 Jul 2019 09:49:12 -0700 (PDT)
MIME-Version: 1.0
References: <201907250546.x6P5kHWq076756@repo.freebsd.org>
 <20190725164607.zpa7w2pgrnahaxz4@mutt-hbsd>
In-Reply-To: <20190725164607.zpa7w2pgrnahaxz4@mutt-hbsd>
From: Kyle Evans <kevans@freebsd.org>
Date: Thu, 25 Jul 2019 11:48:39 -0500
X-Gmail-Original-Message-ID: <CACNAnaHVWUGG+09wQ1MKAWVeQFKzww8VSMT09CFPJUKX1fWZwQ@mail.gmail.com>
Message-ID: <CACNAnaHVWUGG+09wQ1MKAWVeQFKzww8VSMT09CFPJUKX1fWZwQ@mail.gmail.com>
Subject: Re: svn commit: r350315 - in head/sys: kern sys
To: Shawn Webb <shawn.webb@hardenedbsd.org>
Cc: Rick Macklem <rmacklem@freebsd.org>,
 svn-src-head <svn-src-head@freebsd.org>, 
 svn-src-all <svn-src-all@freebsd.org>,
 src-committers <src-committers@freebsd.org>
Content-Type: text/plain; charset="UTF-8"
X-Rspamd-Queue-Id: 7C82D8A985
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];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 ASN(0.00)[asn:11403, ipnet:96.47.64.0/20, 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 16:49:13 -0000

On Thu, Jul 25, 2019 at 11:46 AM Shawn Webb <shawn.webb@hardenedbsd.org> wrote:
>
> Hey Rick,
>
> On Thu, Jul 25, 2019 at 05:46:17AM +0000, Rick Macklem wrote:
> > Author: rmacklem
> > Date: Thu Jul 25 05:46:16 2019
> > New Revision: 350315
> > URL: https://svnweb.freebsd.org/changeset/base/350315
> >
> > Log:
> >   Add kernel support for a Linux compatible copy_file_range(2) syscall.
> >
> >   This patch adds support to the kernel for a Linux compatible
> >   copy_file_range(2) syscall and the related VOP_COPY_FILE_RANGE(9).
> >   This syscall/VOP can be used by the NFSv4.2 client to implement the
> >   Copy operation against an NFSv4.2 server to do file copies locally on
> >   the server.
> >   The vn_generic_copy_file_range() function in this patch can be used
> >   by the NFSv4.2 server to implement the Copy operation.
> >   Fuse may also me able to use the VOP_COPY_FILE_RANGE() method.
> >
> >   vn_generic_copy_file_range() attempts to maintain holes in the output
> >   file in the range to be copied, but may fail to do so if the input and
> >   output files are on different file systems with different _PC_MIN_HOLE_SIZE
> >   values.
> >
> >   Separate commits will be done for the generated syscall files and userland
> >   changes. A commit for a compat32 syscall will be done later.
> >
> >   Reviewed by:        kib, asomers (plus comments by brooks, jilles)
> >   Relnotes:   yes
> >   Differential Revision:      https://reviews.freebsd.org/D20584
> >
> > Modified:
> >   head/sys/kern/syscalls.master
> >   head/sys/kern/vfs_default.c
> >   head/sys/kern/vfs_syscalls.c
> >   head/sys/kern/vfs_vnops.c
> >   head/sys/kern/vnode_if.src
> >   head/sys/sys/syscallsubr.h
> >   head/sys/sys/vnode.h
> >
> > Modified: head/sys/kern/syscalls.master
> > ==============================================================================
> > --- head/sys/kern/syscalls.master     Thu Jul 25 03:55:05 2019        (r350314)
> > +++ head/sys/kern/syscalls.master     Thu Jul 25 05:46:16 2019        (r350315)
> > @@ -3175,6 +3175,16 @@
> >                   int flag
> >               );
> >       }
> > +569  AUE_NULL        STD {
> > +             ssize_t copy_file_range(
> > +                 int infd,
> > +                 _Inout_opt_ off_t *inoffp,
> > +                 int outfd,
> > +                 _Inout_opt_ off_t *outoffp,
> > +                 size_t len,
> > +                 unsigned int flags
> > +             );
> > +     }
> >
> >  ; Please copy any additions and changes to the following compatability tables:
> >  ; sys/compat/freebsd32/syscalls.master
> >
> > Modified: head/sys/kern/vfs_default.c
> > ==============================================================================
> > --- head/sys/kern/vfs_default.c       Thu Jul 25 03:55:05 2019        (r350314)
> > +++ head/sys/kern/vfs_default.c       Thu Jul 25 05:46:16 2019        (r350315)
> > @@ -83,6 +83,7 @@ static int  dirent_exists(struct vnode *vp, const char
> >  static int vop_stdis_text(struct vop_is_text_args *ap);
> >  static int vop_stdunset_text(struct vop_unset_text_args *ap);
> >  static int vop_stdadd_writecount(struct vop_add_writecount_args *ap);
> > +static int vop_stdcopy_file_range(struct vop_copy_file_range_args *ap);
> >  static int vop_stdfdatasync(struct vop_fdatasync_args *ap);
> >  static int vop_stdgetpages_async(struct vop_getpages_async_args *ap);
> >
> > @@ -140,6 +141,7 @@ struct vop_vector default_vnodeops = {
> >       .vop_set_text =         vop_stdset_text,
> >       .vop_unset_text =       vop_stdunset_text,
> >       .vop_add_writecount =   vop_stdadd_writecount,
> > +     .vop_copy_file_range =  vop_stdcopy_file_range,
> >  };
> >
> >  /*
> > @@ -1210,6 +1212,17 @@ vfs_stdnosync (mp, waitfor)
> >  {
> >
> >       return (0);
> > +}
> > +
> > +static int
> > +vop_stdcopy_file_range(struct vop_copy_file_range_args *ap)
> > +{
> > +     int error;
> > +
> > +     error = vn_generic_copy_file_range(ap->a_invp, ap->a_inoffp,
> > +         ap->a_outvp, ap->a_outoffp, ap->a_lenp, ap->a_flags, ap->a_incred,
> > +         ap->a_outcred, ap->a_fsizetd);
> > +     return (error);
> >  }
> >
> >  int
> >
> > Modified: head/sys/kern/vfs_syscalls.c
> > ==============================================================================
> > --- head/sys/kern/vfs_syscalls.c      Thu Jul 25 03:55:05 2019        (r350314)
> > +++ head/sys/kern/vfs_syscalls.c      Thu Jul 25 05:46:16 2019        (r350315)
> > @@ -4814,3 +4814,122 @@ sys_posix_fadvise(struct thread *td, struct posix_fadv
> >           uap->advice);
> >       return (kern_posix_error(td, error));
> >  }
> > +
> > +int
> > +kern_copy_file_range(struct thread *td, int infd, off_t *inoffp, int outfd,
> > +    off_t *outoffp, size_t len, unsigned int flags)
> > +{
> > +     struct file *infp, *outfp;
> > +     struct vnode *invp, *outvp;
> > +     int error;
> > +     size_t retlen;
> > +     void *rl_rcookie, *rl_wcookie;
> > +     off_t savinoff, savoutoff;
> > +
> > +     infp = outfp = NULL;
> > +     rl_rcookie = rl_wcookie = NULL;
> > +     savinoff = -1;
> > +     error = 0;
> > +     retlen = 0;
> > +
> > +     if (flags != 0) {
> > +             error = EINVAL;
> > +             goto out;
> > +     }
> > +     if (len > SSIZE_MAX)
> > +             /*
> > +              * Although the len argument is size_t, the return argument
> > +              * is ssize_t (which is signed).  Therefore a size that won't
> > +              * fit in ssize_t can't be returned.
> > +              */
> > +             len = SSIZE_MAX;
> > +
> > +     /* Get the file structures for the file descriptors. */
> > +     error = fget_read(td, infd, &cap_read_rights, &infp);
> > +     if (error != 0)
> > +             goto out;
> > +     error = fget_write(td, outfd, &cap_write_rights, &outfp);
> > +     if (error != 0)
> > +             goto out;
> > +
> > +     /* Set the offset pointers to the correct place. */
> > +     if (inoffp == NULL)
> > +             inoffp = &infp->f_offset;
> > +     if (outoffp == NULL)
> > +             outoffp = &outfp->f_offset;
> > +     savinoff = *inoffp;
> > +     savoutoff = *outoffp;
>
> Should these two lines, saving the old inoffp and outoffp, be moved
> before the two conditionals above?
>

Dereferencing potentially NULL pointers like that seems like a scary
proposition; I think this reads most correctly given the context.

From owner-svn-src-head@freebsd.org  Thu Jul 25 16:52:01 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id B50EFA8F08
 for <svn-src-head@mailman.nyi.freebsd.org>;
 Thu, 25 Jul 2019 16:52:01 +0000 (UTC)
 (envelope-from shawn.webb@hardenedbsd.org)
Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com
 [IPv6:2607:f8b0:4864:20::742])
 (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 37CEF8AD3A
 for <svn-src-head@freebsd.org>; Thu, 25 Jul 2019 16:52:01 +0000 (UTC)
 (envelope-from shawn.webb@hardenedbsd.org)
Received: by mail-qk1-x742.google.com with SMTP id r21so36993289qke.2
 for <svn-src-head@freebsd.org>; Thu, 25 Jul 2019 09:52:01 -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=dWW93oLb+m5qC+W+c9J1aPwS1Hn24+hAvGGcws5Va3A=;
 b=OB7FpbC+3EnvZRmul9cUKCo/kl6yfUx5P0k6e0M7pzStat9W6wNyRzAk4VZ6OWjY1K
 k1cHaSrEbgi/3sF1T5C+soxlBx4xkla5DlM/yw6rXmNYm3od5efUB4nigVCEOg9psQhk
 UAAzToL7rX7pOmgnuG8hymrWtKV1gHPm/Ld62C4FQU3yZtsjPzJXDR2+x+BLQSS1j948
 iSjY8ZJGY7DitMDSpDlGIQUNHPagcKcFxB4dyF2CkEXGzWhgsogzNGrLCNpr4R+wyzKZ
 3WZRJL8WIMmIHXVIprLOu4onODvbqlQLJ30mFPkrlXJdUuVYCYmzqQr0Igi1T9zJ36yt
 IQFw==
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=dWW93oLb+m5qC+W+c9J1aPwS1Hn24+hAvGGcws5Va3A=;
 b=ny/6HzZZDzbUB69cOAhxg9rYVnw1oBnEQCZYV9KGBhPVdzaCez0Ie/4NMq+7ZKUOpr
 wms371uEqXW4pirzjGtqEVz/jGu1S71j2MgxfovBLB++hOZ1x+JFzTEq7gj85Ty/WnO/
 KLM1TduqZygBg2wD32B/havlEWjfZbLKLSO0EJlY9qdh+KcEXGYy+iV3m4BUQI/HdJfT
 GnBtXIb6TA6oNWnTATVLGk4ifywsN7fUD/6dbZqEAiw72lOzVJgSG3E3KZB6LH80tBbj
 LqWOmRn91mpuqIPtZa11pJr1riE7AyrCz8UisPY40zoMHi3P1TNtil2COJo3oYGYvv2B
 hGQA==
X-Gm-Message-State: APjAAAUsorMk4EA8jDsGtFqHmvcsQHm3OVoZifqdSw12d5qjfDmKFS8s
 0vnMtd3wHd9bLTLzL+dC3En6mgawcR9pYQ==
X-Google-Smtp-Source: APXvYqzcWjuaCqI+Gmzf4e+iGl5iMZJdb+6MRbkyuKMf7OxKVb7NNj52I9yRKEIZGuWHG7inTe+DAQ==
X-Received: by 2002:ae9:e50b:: with SMTP id w11mr57832120qkf.419.1564073520602; 
 Thu, 25 Jul 2019 09:52:00 -0700 (PDT)
Received: from mutt-hbsd ([63.88.83.108])
 by smtp.gmail.com with ESMTPSA id r40sm30954116qtk.2.2019.07.25.09.51.59
 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
 Thu, 25 Jul 2019 09:51:59 -0700 (PDT)
Date: Thu, 25 Jul 2019 12:51:59 -0400
From: Shawn Webb <shawn.webb@hardenedbsd.org>
To: Kyle Evans <kevans@freebsd.org>
Cc: Rick Macklem <rmacklem@freebsd.org>,
 svn-src-head <svn-src-head@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>,
 src-committers <src-committers@freebsd.org>
Subject: Re: svn commit: r350315 - in head/sys: kern sys
Message-ID: <20190725165159.y3zhaafdkrundew2@mutt-hbsd>
References: <201907250546.x6P5kHWq076756@repo.freebsd.org>
 <20190725164607.zpa7w2pgrnahaxz4@mutt-hbsd>
 <CACNAnaHVWUGG+09wQ1MKAWVeQFKzww8VSMT09CFPJUKX1fWZwQ@mail.gmail.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature"; boundary="sugm4n5urmhr6ogw"
Content-Disposition: inline
In-Reply-To: <CACNAnaHVWUGG+09wQ1MKAWVeQFKzww8VSMT09CFPJUKX1fWZwQ@mail.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: 37CEF8AD3A
X-Spamd-Bar: -----
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=hardenedbsd.org header.s=google header.b=OB7FpbC+;
 spf=pass (mx1.freebsd.org: domain of shawn.webb@hardenedbsd.org designates
 2607:f8b0:4864:20::742 as permitted sender)
 smtp.mailfrom=shawn.webb@hardenedbsd.org
X-Spamd-Result: default: False [-5.46 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[];
 R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36];
 RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3];
 TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+];
 MX_GOOD(-0.01)[cached: alt1.aspmx.l.google.com];
 NEURAL_HAM_SHORT(-0.82)[-0.823,0]; SIGNED_PGP(-2.00)[];
 FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+];
 RCVD_TLS_LAST(0.00)[];
 ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US];
 IP_SCORE(-0.52)[ip: (2.95), ipnet: 2607:f8b0::/32(-3.08), asn: 15169(-2.43),
 country: US(-0.05)]; ARC_NA(0.00)[];
 NEURAL_HAM_MEDIUM(-1.00)[-1.000,0];
 R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google];
 URIBL_BLOCKED(0.00)[hardenedbsd.org.multi.uribl.com];
 FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0];
 MIME_GOOD(-0.20)[multipart/signed,text/plain];
 PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org];
 DMARC_NA(0.00)[hardenedbsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[];
 RCVD_IN_DNSWL_NONE(0.00)[2.4.7.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]; MID_RHS_NOT_FQDN(0.50)[]
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 16:52:01 -0000


--sugm4n5urmhr6ogw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Jul 25, 2019 at 11:48:39AM -0500, Kyle Evans wrote:
> On Thu, Jul 25, 2019 at 11:46 AM Shawn Webb <shawn.webb@hardenedbsd.org> =
wrote:
> >
> > Hey Rick,
> >
> > On Thu, Jul 25, 2019 at 05:46:17AM +0000, Rick Macklem wrote:
> > > Author: rmacklem
> > > Date: Thu Jul 25 05:46:16 2019
> > > New Revision: 350315
> > > URL: https://svnweb.freebsd.org/changeset/base/350315
> > >
> > > Log:
> > >   Add kernel support for a Linux compatible copy_file_range(2) syscal=
l.
> > >
> > >   This patch adds support to the kernel for a Linux compatible
> > >   copy_file_range(2) syscall and the related VOP_COPY_FILE_RANGE(9).
> > >   This syscall/VOP can be used by the NFSv4.2 client to implement the
> > >   Copy operation against an NFSv4.2 server to do file copies locally =
on
> > >   the server.
> > >   The vn_generic_copy_file_range() function in this patch can be used
> > >   by the NFSv4.2 server to implement the Copy operation.
> > >   Fuse may also me able to use the VOP_COPY_FILE_RANGE() method.
> > >
> > >   vn_generic_copy_file_range() attempts to maintain holes in the outp=
ut
> > >   file in the range to be copied, but may fail to do so if the input =
and
> > >   output files are on different file systems with different _PC_MIN_H=
OLE_SIZE
> > >   values.
> > >
> > >   Separate commits will be done for the generated syscall files and u=
serland
> > >   changes. A commit for a compat32 syscall will be done later.
> > >
> > >   Reviewed by:        kib, asomers (plus comments by brooks, jilles)
> > >   Relnotes:   yes
> > >   Differential Revision:      https://reviews.freebsd.org/D20584
> > >
> > > Modified:
> > >   head/sys/kern/syscalls.master
> > >   head/sys/kern/vfs_default.c
> > >   head/sys/kern/vfs_syscalls.c
> > >   head/sys/kern/vfs_vnops.c
> > >   head/sys/kern/vnode_if.src
> > >   head/sys/sys/syscallsubr.h
> > >   head/sys/sys/vnode.h
> > >
> > > Modified: head/sys/kern/syscalls.master
> > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=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/kern/syscalls.master     Thu Jul 25 03:55:05 2019       =
 (r350314)
> > > +++ head/sys/kern/syscalls.master     Thu Jul 25 05:46:16 2019       =
 (r350315)
> > > @@ -3175,6 +3175,16 @@
> > >                   int flag
> > >               );
> > >       }
> > > +569  AUE_NULL        STD {
> > > +             ssize_t copy_file_range(
> > > +                 int infd,
> > > +                 _Inout_opt_ off_t *inoffp,
> > > +                 int outfd,
> > > +                 _Inout_opt_ off_t *outoffp,
> > > +                 size_t len,
> > > +                 unsigned int flags
> > > +             );
> > > +     }
> > >
> > >  ; Please copy any additions and changes to the following compatabili=
ty tables:
> > >  ; sys/compat/freebsd32/syscalls.master
> > >
> > > Modified: head/sys/kern/vfs_default.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/kern/vfs_default.c       Thu Jul 25 03:55:05 2019       =
 (r350314)
> > > +++ head/sys/kern/vfs_default.c       Thu Jul 25 05:46:16 2019       =
 (r350315)
> > > @@ -83,6 +83,7 @@ static int  dirent_exists(struct vnode *vp, const c=
har
> > >  static int vop_stdis_text(struct vop_is_text_args *ap);
> > >  static int vop_stdunset_text(struct vop_unset_text_args *ap);
> > >  static int vop_stdadd_writecount(struct vop_add_writecount_args *ap);
> > > +static int vop_stdcopy_file_range(struct vop_copy_file_range_args *a=
p);
> > >  static int vop_stdfdatasync(struct vop_fdatasync_args *ap);
> > >  static int vop_stdgetpages_async(struct vop_getpages_async_args *ap);
> > >
> > > @@ -140,6 +141,7 @@ struct vop_vector default_vnodeops =3D {
> > >       .vop_set_text =3D         vop_stdset_text,
> > >       .vop_unset_text =3D       vop_stdunset_text,
> > >       .vop_add_writecount =3D   vop_stdadd_writecount,
> > > +     .vop_copy_file_range =3D  vop_stdcopy_file_range,
> > >  };
> > >
> > >  /*
> > > @@ -1210,6 +1212,17 @@ vfs_stdnosync (mp, waitfor)
> > >  {
> > >
> > >       return (0);
> > > +}
> > > +
> > > +static int
> > > +vop_stdcopy_file_range(struct vop_copy_file_range_args *ap)
> > > +{
> > > +     int error;
> > > +
> > > +     error =3D vn_generic_copy_file_range(ap->a_invp, ap->a_inoffp,
> > > +         ap->a_outvp, ap->a_outoffp, ap->a_lenp, ap->a_flags, ap->a_=
incred,
> > > +         ap->a_outcred, ap->a_fsizetd);
> > > +     return (error);
> > >  }
> > >
> > >  int
> > >
> > > Modified: head/sys/kern/vfs_syscalls.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/kern/vfs_syscalls.c      Thu Jul 25 03:55:05 2019       =
 (r350314)
> > > +++ head/sys/kern/vfs_syscalls.c      Thu Jul 25 05:46:16 2019       =
 (r350315)
> > > @@ -4814,3 +4814,122 @@ sys_posix_fadvise(struct thread *td, struct p=
osix_fadv
> > >           uap->advice);
> > >       return (kern_posix_error(td, error));
> > >  }
> > > +
> > > +int
> > > +kern_copy_file_range(struct thread *td, int infd, off_t *inoffp, int=
 outfd,
> > > +    off_t *outoffp, size_t len, unsigned int flags)
> > > +{
> > > +     struct file *infp, *outfp;
> > > +     struct vnode *invp, *outvp;
> > > +     int error;
> > > +     size_t retlen;
> > > +     void *rl_rcookie, *rl_wcookie;
> > > +     off_t savinoff, savoutoff;
> > > +
> > > +     infp =3D outfp =3D NULL;
> > > +     rl_rcookie =3D rl_wcookie =3D NULL;
> > > +     savinoff =3D -1;
> > > +     error =3D 0;
> > > +     retlen =3D 0;
> > > +
> > > +     if (flags !=3D 0) {
> > > +             error =3D EINVAL;
> > > +             goto out;
> > > +     }
> > > +     if (len > SSIZE_MAX)
> > > +             /*
> > > +              * Although the len argument is size_t, the return argu=
ment
> > > +              * is ssize_t (which is signed).  Therefore a size that=
 won't
> > > +              * fit in ssize_t can't be returned.
> > > +              */
> > > +             len =3D SSIZE_MAX;
> > > +
> > > +     /* Get the file structures for the file descriptors. */
> > > +     error =3D fget_read(td, infd, &cap_read_rights, &infp);
> > > +     if (error !=3D 0)
> > > +             goto out;
> > > +     error =3D fget_write(td, outfd, &cap_write_rights, &outfp);
> > > +     if (error !=3D 0)
> > > +             goto out;
> > > +
> > > +     /* Set the offset pointers to the correct place. */
> > > +     if (inoffp =3D=3D NULL)
> > > +             inoffp =3D &infp->f_offset;
> > > +     if (outoffp =3D=3D NULL)
> > > +             outoffp =3D &outfp->f_offset;
> > > +     savinoff =3D *inoffp;
> > > +     savoutoff =3D *outoffp;
> >
> > Should these two lines, saving the old inoffp and outoffp, be moved
> > before the two conditionals above?
> >
>=20
> Dereferencing potentially NULL pointers like that seems like a scary
> proposition; I think this reads most correctly given the context.

Ah, good catch! I missed reading the dereference.

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

--sugm4n5urmhr6ogw
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl053i4ACgkQ/y5nonf4
4fpiOg//dxMJ0ROFTnnFFQCmdqNGOAxxV6YOi5MToKu4lE2+eVY6uyoXok1IZ0ay
60orsBakPvo38CrtRNjLo1fgkm14GyHo4c4THGY7T9sPPcYL88hBNSuHs1eMMzOW
qSlcwLcpBvRE4xOuAMuHWXF7xLj7iUEnhVYmhaZDYH+sWszElLZ8I7DRctSaF22e
S6tkwoQRq1yj0rY/4mTlYxeBvnAyQCWijLxyjllKjVT+aXUI4m01pDRIMFd8O4Me
D7cbVHRXyTiwC+SkrfKK0QWbPr+GFdaF7IHyI/Nka/LRCNJatctV0Dw6L6WzUmZP
2w9cBFTSDSfQb2yAesbgHtnotVeHJJNilJQn8QAoZLUd7gl5aPhkHgWhijQcXeA6
G32kpwt80DCEji0UxGK9q5tFEjVe3Jz8BKzPo+QS3+BX5Cv2K+2XLJi+LAbfIN8H
E4x7nvmIg/UY7oU/yP2tEB6yKlZjDJr4i1tF8ss7YhXaBAYxFXcv/gm4RJ++141U
sxYJsOGmTG/hOqCHh/BADx3sgjVCUn12fnNMBCDfooSpfVbNxII3DN9Fi6N7zPCG
2No8Q0AczdECvA2XYprXGCkODs8Qy05gyf5pxjMIXIky4tiKV4OiQodjuLIXem+M
Dywx3w3aHIkAeQ7Grp+I6RYRAk/9rah4b3tid+rNpadeVIMzC1Y=
=NzFq
-----END PGP SIGNATURE-----

--sugm4n5urmhr6ogw--

From owner-svn-src-head@freebsd.org  Thu Jul 25 17:10:19 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 214D0A9589;
 Thu, 25 Jul 2019 17:10:19 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 C20998B8C2;
 Thu, 25 Jul 2019 17:10:18 +0000 (UTC)
 (envelope-from emaste@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 90C561D3F;
 Thu, 25 Jul 2019 17:10:18 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6PHAIIe075457;
 Thu, 25 Jul 2019 17:10:18 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6PHAIqX075455;
 Thu, 25 Jul 2019 17:10:18 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201907251710.x6PHAIqX075455@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Thu, 25 Jul 2019 17:10:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350327 - in head: . lib/libsysdecode
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: in head: . lib/libsysdecode
X-SVN-Commit-Revision: 350327
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: C20998B8C2
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.955,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 17:10:19 -0000

Author: emaste
Date: Thu Jul 25 17:10:17 2019
New Revision: 350327
URL: https://svnweb.freebsd.org/changeset/base/350327

Log:
  libsysdecode: use the proper include directory
  
  Reported by:	cy
  Reviewed by:	lwhsu
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21068

Modified:
  head/Makefile.libcompat
  head/lib/libsysdecode/Makefile

Modified: head/Makefile.libcompat
==============================================================================
--- head/Makefile.libcompat	Thu Jul 25 16:22:37 2019	(r350326)
+++ head/Makefile.libcompat	Thu Jul 25 17:10:17 2019	(r350327)
@@ -186,7 +186,6 @@ build${libcompat}: .PHONY
 .endif
 	mkdir -p ${WORLDTMP}
 	ln -sf ${.CURDIR}/sys ${WORLDTMP}
-	ln -sf ${.CURDIR}/sys ${LIBCOMPATTMP}
 .for _t in ${_obj} includes
 .for _dir in ${_LC_INCDIRS}
 	${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATWMAKE} MK_INCLUDES=yes \

Modified: head/lib/libsysdecode/Makefile
==============================================================================
--- head/lib/libsysdecode/Makefile	Thu Jul 25 16:22:37 2019	(r350326)
+++ head/lib/libsysdecode/Makefile	Thu Jul 25 17:10:17 2019	(r350327)
@@ -123,9 +123,10 @@ CFLAGS.gcc.ioctl.c+= -Wno-redundant-decls
 CFLAGS.gcc+=	${CFLAGS.gcc.${.IMPSRC}}
 
 DEPENDOBJS+=	tables.h
-tables.h: mktables ${SYSROOT}/sys/netinet/in.h ${SYSROOT}/sys/netinet/tcp.h \
-    ${SYSROOT}/sys/netinet6/in6.h
-	sh ${.CURDIR}/mktables ${SYSROOT:U${DESTDIR}}${INCLUDEDIR} ${.TARGET}.tmp && \
+incdir=${SYSROOT:U${DESTDIR}}${INCLUDEDIR}
+tables.h: mktables ${incdir}/netinet/in.h ${incdir}/netinet/tcp.h \
+    ${incdir}/netinet6/in6.h
+	sh ${.CURDIR}/mktables ${incdir} ${.TARGET}.tmp && \
 	    mv -f ${.TARGET}.tmp ${.TARGET}
 
 # mkioctls runs find(1) for headers so needs to rebuild every time.  This used

From owner-svn-src-head@freebsd.org  Thu Jul 25 17:20:46 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1937BA98F3;
 Thu, 25 Jul 2019 17:20:46 +0000 (UTC)
 (envelope-from carpeddiem@gmail.com)
Received: from mail-io1-f47.google.com (mail-io1-f47.google.com
 [209.85.166.47])
 (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 18CBF8BFE4;
 Thu, 25 Jul 2019 17:20:45 +0000 (UTC)
 (envelope-from carpeddiem@gmail.com)
Received: by mail-io1-f47.google.com with SMTP id z3so98939068iog.0;
 Thu, 25 Jul 2019 10:20:45 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to;
 bh=cYQ5BlIfFuJuj2AnLH3Ua8MtilrJh7ejzZSvFz8XHPk=;
 b=HbXVHP6u2KB+Vu/+KoNiqU8sgFxIrZDa4bVc0jPAIQ55rXqffSLBU6ilqb1/ZjqUtG
 2ayn/PQ0I/Xi06cCKEcheyg67F3G/avWrrJPN02uBeWA/uZSgliv5n32kMRnB7LaX3hB
 QKYg6jxBlSEDBWGNpY9cWnZgK5AIRbr54cfniP7N6k5DKsbAVfnk2zrfEBox7YZtyotK
 O77C8eHSp6ADEoEagpUgZCC84ifstKPJEUtG/H2DDu1BIEEoSBlOFPib6bCwcOub9hzB
 MBS6E1GIDHTr9V2BLq0/k0G7Y75oJMlBvY47VSl/Kj25K3GrIO1xAi2AjULetPzdyVFg
 nyJw==
X-Gm-Message-State: APjAAAXDtNlC53oD3J9iUfB+u+eCE3jKCI3UHMxISAamPLN5ESM/E+G1
 JTuKgShgfB0bkBD/vIPmFWQkaIcyPQe+xNSgByyy/quF
X-Google-Smtp-Source: APXvYqzUmOs6bh0/pl79XJeXz0NPPF0t+phOEFSvR0FVp4+zdbNBlLhSmbNUFbtBdrCwcIbUiSpoyG1jEv4HkdiyKYA=
X-Received: by 2002:a6b:6d07:: with SMTP id a7mr18289875iod.254.1564075242970; 
 Thu, 25 Jul 2019 10:20:42 -0700 (PDT)
MIME-Version: 1.0
References: <201907251710.x6PHAIqX075455@repo.freebsd.org>
In-Reply-To: <201907251710.x6PHAIqX075455@repo.freebsd.org>
From: Ed Maste <emaste@freebsd.org>
Date: Thu, 25 Jul 2019 11:41:00 -0400
Message-ID: <CAPyFy2Cn8Z_LL=FF0gzDQ1F_Os5znn3LaykiDo84CccRQ_ZxOw@mail.gmail.com>
Subject: Re: svn commit: r350327 - in head: . lib/libsysdecode
To: src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>, 
 svn-src-head <svn-src-head@freebsd.org>
Content-Type: text/plain; charset="UTF-8"
X-Rspamd-Queue-Id: 18CBF8BFE4
X-Spamd-Bar: -----
Authentication-Results: mx1.freebsd.org;
 spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates
 209.85.166.47 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com
X-Spamd-Result: default: False [-5.38 / 15.00]; ARC_NA(0.00)[];
 NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; FROM_HAS_DN(0.00)[];
 RCPT_COUNT_THREE(0.00)[3];
 R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17];
 TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain];
 RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[freebsd.org];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 IP_SCORE(-2.44)[ip: (-6.27), ipnet: 209.85.128.0/17(-3.42), asn: 15169(-2.43),
 country: US(-0.05)]; TO_DN_ALL(0.00)[];
 MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com];
 NEURAL_HAM_SHORT(-0.93)[-0.934,0];
 RCVD_IN_DNSWL_NONE(0.00)[47.166.85.209.list.dnswl.org : 127.0.5.0];
 FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com];
 MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[];
 FREEMAIL_ENVFROM(0.00)[gmail.com];
 ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US];
 FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com];
 RCVD_COUNT_TWO(0.00)[2]
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 17:20:46 -0000

On Thu, 25 Jul 2019 at 13:10, Ed Maste <emaste@freebsd.org> wrote:
>
> Author: emaste
> Date: Thu Jul 25 17:10:17 2019
> New Revision: 350327
> URL: https://svnweb.freebsd.org/changeset/base/350327
>
> Log:
>   libsysdecode: use the proper include directory

I forgot to mention in the commit message that this reverts lwhsu's
initial workaround (r350322).

From owner-svn-src-head@freebsd.org  Thu Jul 25 18:48:33 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D527AB8AA;
 Thu, 25 Jul 2019 18:48:33 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 3AF598FFD6;
 Thu, 25 Jul 2019 18:48:33 +0000 (UTC) (envelope-from mav@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 E78DD2F2A;
 Thu, 25 Jul 2019 18:48:32 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6PImW05034513;
 Thu, 25 Jul 2019 18:48:32 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6PImVsN034508;
 Thu, 25 Jul 2019 18:48:31 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201907251848.x6PImVsN034508@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Thu, 25 Jul 2019 18:48:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350331 - in head: sbin/camcontrol sys/cam/ata
 sys/cam/scsi sys/sys
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: in head: sbin/camcontrol sys/cam/ata sys/cam/scsi sys/sys
X-SVN-Commit-Revision: 350331
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 3AF598FFD6
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 18:48:33 -0000

Author: mav
Date: Thu Jul 25 18:48:31 2019
New Revision: 350331
URL: https://svnweb.freebsd.org/changeset/base/350331

Log:
  Make `camcontrol sanitize` support also ATA devices.
  
  ATA sanitize is functionally identical to SCSI, just uses different
  initiation commands and status reporting mechanism.
  
  While there, make kernel better handle sanitize commands and statuses.
  
  MFC after:	2 weeks
  Sponsored by:	iXsystems, Inc.

Modified:
  head/sbin/camcontrol/camcontrol.8
  head/sbin/camcontrol/camcontrol.c
  head/sys/cam/ata/ata_all.c
  head/sys/cam/scsi/scsi_all.c
  head/sys/sys/ata.h

Modified: head/sbin/camcontrol/camcontrol.8
==============================================================================
--- head/sbin/camcontrol/camcontrol.8	Thu Jul 25 18:15:43 2019	(r350330)
+++ head/sbin/camcontrol/camcontrol.8	Thu Jul 25 18:48:31 2019	(r350331)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 22, 2019
+.Dd July 25, 2019
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -1276,13 +1276,11 @@ will not be asked about the timeout if a timeout is sp
 command line.
 .El
 .It Ic sanitize
-Issue the
-.Tn SCSI
-SANITIZE command to the named device.
+Issue the SANITIZE command to the named device.
 .Pp
 .Em WARNING! WARNING! WARNING!
 .Pp
-ALL data in the cache and on the disk will be destroyed or made inaccessible.
+ALL data on the disk will be destroyed or made inaccessible.
 Recovery of the data is not possible.
 Use extreme caution when issuing this command.
 .Pp

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c	Thu Jul 25 18:15:43 2019	(r350330)
+++ head/sbin/camcontrol/camcontrol.c	Thu Jul 25 18:48:31 2019	(r350331)
@@ -347,7 +347,7 @@ static int ratecontrol(struct cam_device *device, int 
 static int scsiformat(struct cam_device *device, int argc, char **argv,
 		      char *combinedopt, int task_attr, int retry_count,
 		      int timeout);
-static int scsisanitize(struct cam_device *device, int argc, char **argv,
+static int sanitize(struct cam_device *device, int argc, char **argv,
 			char *combinedopt, int task_attr, int retry_count,
 			int timeout);
 static int scsireportluns(struct cam_device *device, int argc, char **argv,
@@ -1743,6 +1743,19 @@ atacapprint(struct ata_params *parm)
 	} else {
 		printf("no\n");
 	}
+	printf("Sanitize                       ");
+	if (parm->multi & ATA_SUPPORT_SANITIZE) {
+		printf("yes\t\t%s%s%s\n",
+		    parm->multi & ATA_SUPPORT_BLOCK_ERASE_EXT ? "block, " : "",
+		    parm->multi & ATA_SUPPORT_OVERWRITE_EXT ? "overwrite, " : "",
+		    parm->multi & ATA_SUPPORT_CRYPTO_SCRAMBLE_EXT ? "crypto" : "");
+		printf("Sanitize - commands allowed    %s\n",
+		    parm->multi & ATA_SUPPORT_SANITIZE_ALLOWED ? "yes" : "no");
+		printf("Sanitize - antifreeze lock     %s\n",
+		    parm->multi & ATA_SUPPORT_ANTIFREEZE_LOCK_EXT ? "yes" : "no");
+	} else {
+		printf("no\n");
+	}
 }
 
 static int
@@ -1989,6 +2002,11 @@ ata_do_cmd(struct cam_device *device, union ccb *ccb, 
 			res->lba_high_exp = res_pass16->lba_high_exp;
 			res->sector_count = res_pass16->sector_count;
 			res->sector_count_exp = res_pass16->sector_count_exp;
+			ccb->ccb_h.status &= ~CAM_STATUS_MASK;
+			if (res->status & ATA_STATUS_ERROR)
+				ccb->ccb_h.status |= CAM_ATA_STATUS_ERROR;
+			else
+				ccb->ccb_h.status |= CAM_REQ_CMP;
 		}
 
 		return (error);
@@ -2479,12 +2497,6 @@ ata_do_identify(struct cam_device *device, int retry_c
 			error = 0;
 	}
 
-	if (arglist & CAM_ARG_VERBOSE) {
-		fprintf(stdout, "%s%d: Raw identify data:\n",
-		    device->device_name, device->dev_unit_num);
-		dump_data(ptr, sizeof(struct ata_params));
-	}
-
 	/* check for invalid (all zero) response */
 	if (error != 0) {
 		warnx("Invalid identify response detected");
@@ -2515,6 +2527,12 @@ ataidentify(struct cam_device *device, int retry_count
 		return (1);
 	}
 
+	if (arglist & CAM_ARG_VERBOSE) {
+		printf("%s%d: Raw identify data:\n",
+		    device->device_name, device->dev_unit_num);
+		dump_data((void*)ident_buf, sizeof(struct ata_params));
+	}
+
 	if (ident_buf->support.command1 & ATA_SUPPORT_PROTECTED) {
 		if (ata_read_native_max(device, retry_count, timeout, ccb,
 					ident_buf, &hpasize) != 0) {
@@ -6744,15 +6762,184 @@ scsiformat_bailout:
 }
 
 static int
-scsisanitize(struct cam_device *device, int argc, char **argv,
+sanitize_wait_ata(struct cam_device *device, union ccb *ccb, int quiet)
+{
+	struct ata_res *res;
+	int retval;
+	cam_status status;
+	u_int val, perc;
+
+	do {
+		retval = ata_do_cmd(device,
+				   ccb,
+				   /*retries*/1,
+				   /*flags*/CAM_DIR_NONE,
+				   /*protocol*/AP_PROTO_NON_DATA | AP_EXTEND,
+				   /*ata_flags*/AP_FLAG_CHK_COND,
+				   /*tag_action*/MSG_SIMPLE_Q_TAG,
+				   /*command*/ATA_SANITIZE,
+				   /*features*/0x00, /* SANITIZE STATUS EXT */
+				   /*lba*/0,
+				   /*sector_count*/0,
+				   /*data_ptr*/NULL,
+				   /*dxfer_len*/0,
+				   /*timeout*/10000,
+				   /*is48bit*/1);
+		if (retval < 0) {
+			warn("error sending CAMIOCOMMAND ioctl");
+			if (arglist & CAM_ARG_VERBOSE) {
+				cam_error_print(device, ccb, CAM_ESF_ALL,
+						CAM_EPF_ALL, stderr);
+			}
+			return (1);
+		}
+
+		status = ccb->ccb_h.status & CAM_STATUS_MASK;
+		if (status == CAM_REQ_CMP) {
+			res = &ccb->ataio.res;
+			if (res->sector_count_exp & 0x40) {
+				if (quiet == 0) {
+					val = (res->lba_mid << 8) + res->lba_low;
+					perc = 10000 * val;
+					fprintf(stdout,
+					    "Sanitizing: %u.%02u%% (%d/%d)\r",
+					    (perc / (0x10000 * 100)),
+					    ((perc / 0x10000) % 100),
+					    val, 0x10000);
+					fflush(stdout);
+				}
+				sleep(1);
+			} else if ((res->sector_count_exp & 0x80) == 0) {
+				warnx("Sanitize complete with an error.     ");
+				return (1);
+			} else
+				break;
+
+		} else if (status != CAM_REQ_CMP && status != CAM_REQUEUE_REQ) {
+			warnx("Unexpected CAM status %#x", status);
+			if (arglist & CAM_ARG_VERBOSE)
+				cam_error_print(device, ccb, CAM_ESF_ALL,
+						CAM_EPF_ALL, stderr);
+			return (1);
+		}
+	} while (1);
+	return (0);
+}
+
+static int
+sanitize_wait_scsi(struct cam_device *device, union ccb *ccb, int task_attr, int quiet)
+{
+	int warnings = 0, retval;
+	cam_status status;
+	u_int val, perc;
+
+	do {
+		CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
+
+		/*
+		 * There's really no need to do error recovery or
+		 * retries here, since we're just going to sit in a
+		 * loop and wait for the device to finish sanitizing.
+		 */
+		scsi_test_unit_ready(&ccb->csio,
+				     /* retries */ 0,
+				     /* cbfcnp */ NULL,
+				     /* tag_action */ task_attr,
+				     /* sense_len */ SSD_FULL_SIZE,
+				     /* timeout */ 5000);
+
+		/* Disable freezing the device queue */
+		ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
+
+		retval = cam_send_ccb(device, ccb);
+
+		/*
+		 * If we get an error from the ioctl, bail out.  SCSI
+		 * errors are expected.
+		 */
+		if (retval < 0) {
+			warn("error sending CAMIOCOMMAND ioctl");
+			if (arglist & CAM_ARG_VERBOSE) {
+				cam_error_print(device, ccb, CAM_ESF_ALL,
+						CAM_EPF_ALL, stderr);
+			}
+			return (1);
+		}
+
+		status = ccb->ccb_h.status & CAM_STATUS_MASK;
+		if ((status == CAM_SCSI_STATUS_ERROR) &&
+		    ((ccb->ccb_h.status & CAM_AUTOSNS_VALID) != 0)) {
+			struct scsi_sense_data *sense;
+			int error_code, sense_key, asc, ascq;
+
+			sense = &ccb->csio.sense_data;
+			scsi_extract_sense_len(sense, ccb->csio.sense_len -
+			    ccb->csio.sense_resid, &error_code, &sense_key,
+			    &asc, &ascq, /*show_errors*/ 1);
+
+			/*
+			 * According to the SCSI-3 spec, a drive that is in the
+			 * middle of a sanitize should return NOT READY with an
+			 * ASC of "logical unit not ready, sanitize in
+			 * progress". The sense key specific bytes will then
+			 * be a progress indicator.
+			 */
+			if ((sense_key == SSD_KEY_NOT_READY)
+			 && (asc == 0x04) && (ascq == 0x1b)) {
+				uint8_t sks[3];
+
+				if ((scsi_get_sks(sense, ccb->csio.sense_len -
+				     ccb->csio.sense_resid, sks) == 0)
+				 && (quiet == 0)) {
+					val = scsi_2btoul(&sks[1]);
+					perc = 10000 * val;
+					fprintf(stdout,
+					    "Sanitizing: %u.%02u%% (%d/%d)\r",
+					    (perc / (0x10000 * 100)),
+					    ((perc / 0x10000) % 100),
+					    val, 0x10000);
+					fflush(stdout);
+				} else if ((quiet == 0) && (++warnings <= 1)) {
+					warnx("Unexpected SCSI Sense Key "
+					      "Specific value returned "
+					      "during sanitize:");
+					scsi_sense_print(device, &ccb->csio,
+							 stderr);
+					warnx("Unable to print status "
+					      "information, but sanitze will "
+					      "proceed.");
+					warnx("will exit when sanitize is "
+					      "complete");
+				}
+				sleep(1);
+			} else {
+				warnx("Unexpected SCSI error during sanitize");
+				cam_error_print(device, ccb, CAM_ESF_ALL,
+						CAM_EPF_ALL, stderr);
+				return (1);
+			}
+
+		} else if (status != CAM_REQ_CMP && status != CAM_REQUEUE_REQ) {
+			warnx("Unexpected CAM status %#x", status);
+			if (arglist & CAM_ARG_VERBOSE)
+				cam_error_print(device, ccb, CAM_ESF_ALL,
+						CAM_EPF_ALL, stderr);
+			return (1);
+		}
+	} while ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP);
+	return (0);
+}
+
+static int
+sanitize(struct cam_device *device, int argc, char **argv,
 	     char *combinedopt, int task_attr, int retry_count, int timeout)
 {
 	union ccb *ccb;
 	u_int8_t action = 0;
 	int c;
 	int ycount = 0, quiet = 0;
-	int error = 0, retval = 0;
-	int use_timeout = 10800 * 1000;
+	int error = 0;
+	int use_timeout;
 	int immediate = 1;
 	int invert = 0;
 	int passes = 0;
@@ -6761,14 +6948,25 @@ scsisanitize(struct cam_device *device, int argc, char
 	const char *pattern = NULL;
 	u_int8_t *data_ptr = NULL;
 	u_int32_t dxfer_len = 0;
-	u_int8_t byte2 = 0;
-	int num_warnings = 0;
+	uint8_t byte2;
+	uint16_t feature, count;
+	uint64_t lba;
 	int reportonly = 0;
+	camcontrol_devtype dt;
 
+	/*
+	 * Get the device type, request no I/O be done to do this.
+	 */
+	error = get_device_type(device, -1, 0, 0, &dt);
+	if (error != 0 || (unsigned)dt > CC_DT_UNKNOWN) {
+		warnx("sanitize: can't get device type");
+		return (1);
+	}
+
 	ccb = cam_getccb(device);
 
 	if (ccb == NULL) {
-		warnx("scsisanitize: error allocating ccb");
+		warnx("sanitize: error allocating ccb");
 		return (1);
 	}
 
@@ -6789,7 +6987,7 @@ scsisanitize(struct cam_device *device, int argc, char
 				warnx("invalid service operation \"%s\"",
 				      optarg);
 				error = 1;
-				goto scsisanitize_bailout;
+				goto sanitize_bailout;
 			}
 			break;
 		case 'c':
@@ -6797,7 +6995,7 @@ scsisanitize(struct cam_device *device, int argc, char
 			if (passes < 1 || passes > 31) {
 				warnx("invalid passes value %d", passes);
 				error = 1;
-				goto scsisanitize_bailout;
+				goto sanitize_bailout;
 			}
 			break;
 		case 'I':
@@ -6816,7 +7014,9 @@ scsisanitize(struct cam_device *device, int argc, char
 			reportonly = 1;
 			break;
 		case 'w':
-			immediate = 0;
+			/* ATA supports only immediate commands. */
+			if (dt == CC_DT_SCSI)
+				immediate = 0;
 			break;
 		case 'y':
 			ycount++;
@@ -6830,7 +7030,7 @@ scsisanitize(struct cam_device *device, int argc, char
 	if (action == 0) {
 		warnx("an action is required");
 		error = 1;
-		goto scsisanitize_bailout;
+		goto sanitize_bailout;
 	} else if (action == SSZ_SERVICE_ACTION_OVERWRITE) {
 		struct scsi_sanitize_parameter_list *pl;
 		struct stat sb;
@@ -6839,43 +7039,43 @@ scsisanitize(struct cam_device *device, int argc, char
 		if (pattern == NULL) {
 			warnx("overwrite action requires -P argument");
 			error = 1;
-			goto scsisanitize_bailout;
+			goto sanitize_bailout;
 		}
 		fd = open(pattern, O_RDONLY);
 		if (fd < 0) {
 			warn("cannot open pattern file %s", pattern);
 			error = 1;
-			goto scsisanitize_bailout;
+			goto sanitize_bailout;
 		}
 		if (fstat(fd, &sb) < 0) {
 			warn("cannot stat pattern file %s", pattern);
 			error = 1;
-			goto scsisanitize_bailout;
+			goto sanitize_bailout;
 		}
 		sz = sb.st_size;
 		if (sz > SSZPL_MAX_PATTERN_LENGTH) {
 			warnx("pattern file size exceeds maximum value %d",
 			      SSZPL_MAX_PATTERN_LENGTH);
 			error = 1;
-			goto scsisanitize_bailout;
+			goto sanitize_bailout;
 		}
 		dxfer_len = sizeof(*pl) + sz;
 		data_ptr = calloc(1, dxfer_len);
 		if (data_ptr == NULL) {
 			warnx("cannot allocate parameter list buffer");
 			error = 1;
-			goto scsisanitize_bailout;
+			goto sanitize_bailout;
 		}
 
 		amt = read(fd, data_ptr + sizeof(*pl), sz);
 		if (amt < 0) {
 			warn("cannot read pattern file");
 			error = 1;
-			goto scsisanitize_bailout;
+			goto sanitize_bailout;
 		} else if (amt != sz) {
 			warnx("short pattern file read");
 			error = 1;
-			goto scsisanitize_bailout;
+			goto sanitize_bailout;
 		}
 
 		pl = (struct scsi_sanitize_parameter_list *)data_ptr;
@@ -6901,7 +7101,7 @@ scsisanitize(struct cam_device *device, int argc, char
 			warnx("%s argument only valid with overwrite "
 			      "operation", arg);
 			error = 1;
-			goto scsisanitize_bailout;
+			goto sanitize_bailout;
 		}
 	}
 
@@ -6909,26 +7109,41 @@ scsisanitize(struct cam_device *device, int argc, char
 		fprintf(stdout, "You are about to REMOVE ALL DATA from the "
 			"following device:\n");
 
-		error = scsidoinquiry(device, argc, argv, combinedopt,
-				      task_attr, retry_count, timeout);
+		if (dt == CC_DT_SCSI) {
+			error = scsidoinquiry(device, argc, argv, combinedopt,
+					      task_attr, retry_count, timeout);
+		} else if (dt == CC_DT_ATA || dt == CC_DT_SATL) {
+			struct ata_params *ident_buf;
+			error = ata_do_identify(device, retry_count, timeout,
+						ccb, &ident_buf);
+			if (error == 0) {
+				printf("%s%d: ", device->device_name,
+				    device->dev_unit_num);
+				ata_print_ident(ident_buf);
+				free(ident_buf);
+			}
+		} else
+			error = 1;
 
 		if (error != 0) {
-			warnx("scsisanitize: error sending inquiry");
-			goto scsisanitize_bailout;
+			warnx("sanitize: error sending inquiry");
+			goto sanitize_bailout;
 		}
 	}
 
 	if (ycount == 0) {
 		if (!get_confirmation()) {
 			error = 1;
-			goto scsisanitize_bailout;
+			goto sanitize_bailout;
 		}
 	}
 
 	if (timeout != 0)
 		use_timeout = timeout;
+	else
+		use_timeout = (immediate ? 10 : 10800) * 1000;
 
-	if (quiet == 0) {
+	if (immediate == 0 && quiet == 0) {
 		fprintf(stdout, "Current sanitize timeout is %d seconds\n",
 			use_timeout / 1000);
 	}
@@ -6938,8 +7153,7 @@ scsisanitize(struct cam_device *device, int argc, char
 	 * timeout on the command line, ask them if they want the current
 	 * timeout.
 	 */
-	if ((ycount == 0)
-	 && (timeout == 0)) {
+	if (immediate == 0 && ycount == 0 && timeout == 0) {
 		char str[1024];
 		int new_timeout = 0;
 
@@ -6959,33 +7173,76 @@ scsisanitize(struct cam_device *device, int argc, char
 		}
 	}
 
-	byte2 = action;
-	if (ause != 0)
-		byte2 |= SSZ_UNRESTRICTED_EXIT;
-	if (immediate != 0)
-		byte2 |= SSZ_IMMED;
+	if (dt == CC_DT_SCSI) {
+		byte2 = action;
+		if (ause != 0)
+			byte2 |= SSZ_UNRESTRICTED_EXIT;
+		if (immediate != 0)
+			byte2 |= SSZ_IMMED;
+		scsi_sanitize(&ccb->csio,
+			      /* retries */ retry_count,
+			      /* cbfcnp */ NULL,
+			      /* tag_action */ task_attr,
+			      /* byte2 */ byte2,
+			      /* control */ 0,
+			      /* data_ptr */ data_ptr,
+			      /* dxfer_len */ dxfer_len,
+			      /* sense_len */ SSD_FULL_SIZE,
+			      /* timeout */ use_timeout);
 
-	scsi_sanitize(&ccb->csio,
-		      /* retries */ retry_count,
-		      /* cbfcnp */ NULL,
-		      /* tag_action */ task_attr,
-		      /* byte2 */ byte2,
-		      /* control */ 0,
-		      /* data_ptr */ data_ptr,
-		      /* dxfer_len */ dxfer_len,
-		      /* sense_len */ SSD_FULL_SIZE,
-		      /* timeout */ use_timeout);
+		ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
+		if (arglist & CAM_ARG_ERR_RECOVER)
+			ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
+		if (cam_send_ccb(device, ccb) < 0) {
+			warn("error sending sanitize command");
+			error = 1;
+			goto sanitize_bailout;
+		}
+	} else if (dt == CC_DT_ATA || dt == CC_DT_SATL) {
+		if (action == SSZ_SERVICE_ACTION_OVERWRITE) {
+			feature = 0x14; /* OVERWRITE EXT */
+			lba = 0x4F5700000000 | scsi_4btoul(data_ptr + 4);
+			count = (passes == 0) ? 1 : (passes >= 16) ? 0 : passes;
+			if (invert)
+				count |= 0x80; /* INVERT PATTERN */
+			if (ause)
+				count |= 0x10; /* FAILURE MODE */
+		} else if (action == SSZ_SERVICE_ACTION_BLOCK_ERASE) {
+			feature = 0x12; /* BLOCK ERASE EXT */
+			lba = 0x0000426B4572;
+			count = 0;
+			if (ause)
+				count |= 0x10; /* FAILURE MODE */
+		} else if (action == SSZ_SERVICE_ACTION_CRYPTO_ERASE) {
+			feature = 0x11; /* CRYPTO SCRAMBLE EXT */
+			lba = 0x000043727970;
+			count = 0;
+			if (ause)
+				count |= 0x10; /* FAILURE MODE */
+		} else if (action == SSZ_SERVICE_ACTION_EXIT_MODE_FAILURE) {
+			feature = 0x00; /* SANITIZE STATUS EXT */
+			lba = 0;
+			count = 1; /* CLEAR SANITIZE OPERATION FAILED */
+		} else {
+			error = 1;
+			goto sanitize_bailout;
+		}
 
-	/* Disable freezing the device queue */
-	ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
-
-	if (arglist & CAM_ARG_ERR_RECOVER)
-		ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
-
-	if (cam_send_ccb(device, ccb) < 0) {
-		warn("error sending sanitize command");
-		error = 1;
-		goto scsisanitize_bailout;
+		error = ata_do_cmd(device,
+				   ccb,
+				   retry_count,
+				   /*flags*/CAM_DIR_NONE,
+				   /*protocol*/AP_PROTO_NON_DATA | AP_EXTEND,
+				   /*ata_flags*/AP_FLAG_CHK_COND,
+				   /*tag_action*/MSG_SIMPLE_Q_TAG,
+				   /*command*/ATA_SANITIZE,
+				   /*features*/feature,
+				   /*lba*/lba,
+				   /*sector_count*/count,
+				   /*data_ptr*/NULL,
+				   /*dxfer_len*/0,
+				   /*timeout*/ use_timeout,
+				   /*is48bit*/1);
 	}
 
 	if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
@@ -7013,7 +7270,7 @@ scsisanitize(struct cam_device *device, int argc, char
 					CAM_EPF_ALL, stderr);
 		}
 		error = 1;
-		goto scsisanitize_bailout;
+		goto sanitize_bailout;
 	}
 
 	/*
@@ -7026,124 +7283,20 @@ scsisanitize(struct cam_device *device, int argc, char
 		if (quiet == 0) {
 			fprintf(stdout, "Sanitize Complete\n");
 		}
-		goto scsisanitize_bailout;
+		goto sanitize_bailout;
 	}
 
 doreport:
-	do {
-		cam_status status;
+	if (dt == CC_DT_SCSI) {
+		error = sanitize_wait_scsi(device, ccb, task_attr, quiet);
+	} else if (dt == CC_DT_ATA || dt == CC_DT_SATL) {
+		error = sanitize_wait_ata(device, ccb, quiet);
+	} else
+		error = 1;
+	if (error == 0 && quiet == 0)
+		fprintf(stdout, "Sanitize Complete                      \n");
 
-		CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
-
-		/*
-		 * There's really no need to do error recovery or
-		 * retries here, since we're just going to sit in a
-		 * loop and wait for the device to finish sanitizing.
-		 */
-		scsi_test_unit_ready(&ccb->csio,
-				     /* retries */ 0,
-				     /* cbfcnp */ NULL,
-				     /* tag_action */ task_attr,
-				     /* sense_len */ SSD_FULL_SIZE,
-				     /* timeout */ 5000);
-
-		/* Disable freezing the device queue */
-		ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
-
-		retval = cam_send_ccb(device, ccb);
-
-		/*
-		 * If we get an error from the ioctl, bail out.  SCSI
-		 * errors are expected.
-		 */
-		if (retval < 0) {
-			warn("error sending CAMIOCOMMAND ioctl");
-			if (arglist & CAM_ARG_VERBOSE) {
-				cam_error_print(device, ccb, CAM_ESF_ALL,
-						CAM_EPF_ALL, stderr);
-			}
-			error = 1;
-			goto scsisanitize_bailout;
-		}
-
-		status = ccb->ccb_h.status & CAM_STATUS_MASK;
-
-		if ((status != CAM_REQ_CMP)
-		 && (status == CAM_SCSI_STATUS_ERROR)
-		 && ((ccb->ccb_h.status & CAM_AUTOSNS_VALID) != 0)) {
-			struct scsi_sense_data *sense;
-			int error_code, sense_key, asc, ascq;
-
-			sense = &ccb->csio.sense_data;
-			scsi_extract_sense_len(sense, ccb->csio.sense_len -
-			    ccb->csio.sense_resid, &error_code, &sense_key,
-			    &asc, &ascq, /*show_errors*/ 1);
-
-			/*
-			 * According to the SCSI-3 spec, a drive that is in the
-			 * middle of a sanitize should return NOT READY with an
-			 * ASC of "logical unit not ready, sanitize in
-			 * progress". The sense key specific bytes will then
-			 * be a progress indicator.
-			 */
-			if ((sense_key == SSD_KEY_NOT_READY)
-			 && (asc == 0x04) && (ascq == 0x1b)) {
-				uint8_t sks[3];
-
-				if ((scsi_get_sks(sense, ccb->csio.sense_len -
-				     ccb->csio.sense_resid, sks) == 0)
-				 && (quiet == 0)) {
-					int val;
-					u_int64_t percentage;
-
-					val = scsi_2btoul(&sks[1]);
-					percentage = 10000 * val;
-
-					fprintf(stdout,
-						"\rSanitizing:  %ju.%02u %% "
-						"(%d/%d) done",
-						(uintmax_t)(percentage /
-						(0x10000 * 100)),
-						(unsigned)((percentage /
-						0x10000) % 100),
-						val, 0x10000);
-					fflush(stdout);
-				} else if ((quiet == 0)
-					&& (++num_warnings <= 1)) {
-					warnx("Unexpected SCSI Sense Key "
-					      "Specific value returned "
-					      "during sanitize:");
-					scsi_sense_print(device, &ccb->csio,
-							 stderr);
-					warnx("Unable to print status "
-					      "information, but sanitze will "
-					      "proceed.");
-					warnx("will exit when sanitize is "
-					      "complete");
-				}
-				sleep(1);
-			} else {
-				warnx("Unexpected SCSI error during sanitize");
-				cam_error_print(device, ccb, CAM_ESF_ALL,
-						CAM_EPF_ALL, stderr);
-				error = 1;
-				goto scsisanitize_bailout;
-			}
-
-		} else if (status != CAM_REQ_CMP) {
-			warnx("Unexpected CAM status %#x", status);
-			if (arglist & CAM_ARG_VERBOSE)
-				cam_error_print(device, ccb, CAM_ESF_ALL,
-						CAM_EPF_ALL, stderr);
-			error = 1;
-			goto scsisanitize_bailout;
-		}
-	} while((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP);
-
-	if (quiet == 0)
-		fprintf(stdout, "\nSanitize Complete\n");
-
-scsisanitize_bailout:
+sanitize_bailout:
 	if (fd >= 0)
 		close(fd);
 	if (data_ptr != NULL)
@@ -10520,9 +10673,8 @@ main(int argc, char **argv)
 		    timeout);
 		break;
 	case CAM_CMD_SANITIZE:
-		error = scsisanitize(cam_dev, argc, argv,
-				     combinedopt, task_attr,
-				     retry_count, timeout);
+		error = sanitize(cam_dev, argc, argv, combinedopt, task_attr,
+				 retry_count, timeout);
 		break;
 	case CAM_CMD_PERSIST:
 		error = scsipersist(cam_dev, argc, argv, combinedopt,

Modified: head/sys/cam/ata/ata_all.c
==============================================================================
--- head/sys/cam/ata/ata_all.c	Thu Jul 25 18:15:43 2019	(r350330)
+++ head/sys/cam/ata/ata_all.c	Thu Jul 25 18:48:31 2019	(r350331)
@@ -215,7 +215,16 @@ ata_op_string(struct ata_cmd *cmd)
 		return ("SMART");
 	case 0xb1: return ("DEVICE CONFIGURATION");
 	case 0xb2: return ("SET_SECTOR_CONFIGURATION_EXT");
-	case 0xb4: return ("SANITIZE_DEVICE");
+	case 0xb4:
+		switch(cmd->features) {
+		case 0x00: return ("SANITIZE_STATUS_EXT");
+		case 0x11: return ("CRYPTO_SCRAMBLE_EXT");
+		case 0x12: return ("BLOCK_ERASE_EXT");
+		case 0x14: return ("OVERWRITE_EXT");
+		case 0x20: return ("SANITIZE_FREEZE_LOCK_EXT");
+		case 0x40: return ("SANITIZE_ANTIFREEZE_LOCK_EXT");
+		}
+		return ("SANITIZE_DEVICE");
 	case 0xc0: return ("CFA_ERASE");
 	case 0xc4: return ("READ_MUL");
 	case 0xc5: return ("WRITE_MUL");

Modified: head/sys/cam/scsi/scsi_all.c
==============================================================================
--- head/sys/cam/scsi/scsi_all.c	Thu Jul 25 18:15:43 2019	(r350330)
+++ head/sys/cam/scsi/scsi_all.c	Thu Jul 25 18:48:31 2019	(r350331)
@@ -379,7 +379,7 @@ static struct op_table_entry scsi_op_codes[] = {
 	{ 0x40,	D | T | L | P | W | R | O | M | S | C, "CHANGE DEFINITION" },
 	/* 41  O               WRITE SAME(10) */
 	{ 0x41,	D, "WRITE SAME(10)" },
-	/* 42       O          UNMAP */
+	/* 42  O               UNMAP */
 	{ 0x42,	D, "UNMAP" },
 	/* 42       O          READ SUB-CHANNEL */
 	{ 0x42,	R, "READ SUB-CHANNEL" },
@@ -394,7 +394,8 @@ static struct op_table_entry scsi_op_codes[] = {
 	{ 0x46,	R, "GET CONFIGURATION" },
 	/* 47       O          PLAY AUDIO MSF */
 	{ 0x47,	R, "PLAY AUDIO MSF" },
-	/* 48 */
+	/* 48  O               SANITIZE */
+	{ 0x48,	D, "SANITIZE" },
 	/* 49 */
 	/* 4A       M          GET EVENT STATUS NOTIFICATION */
 	{ 0x4A,	R, "GET EVENT STATUS NOTIFICATION" },
@@ -1162,7 +1163,7 @@ static struct asc_table_entry asc_table[] = {
 	{ SST(0x04, 0x1A, SS_RDEF,	/* XXX TBD */
 	    "Logical unit not ready, START/STOP UNIT command in progress") },
 	/* D         B    */
-	{ SST(0x04, 0x1B, SS_RDEF,	/* XXX TBD */
+	{ SST(0x04, 0x1B, SS_WAIT | EBUSY,
 	    "Logical unit not ready, sanitize in progress") },
 	/* DT     MAEB    */
 	{ SST(0x04, 0x1C, SS_START | SSQ_DECREMENT_COUNT | ENXIO,
@@ -1453,7 +1454,7 @@ static struct asc_table_entry asc_table[] = {
 	{ SST(0x11, 0x14, SS_RDEF,	/* XXX TBD */
 	    "Read error - LBA marked bad by application client") },
 	/* D              */
-	{ SST(0x11, 0x15, SS_RDEF,	/* XXX TBD */
+	{ SST(0x11, 0x15, SS_FATAL | EIO,
 	    "Write after sanitize required") },
 	/* D   W O   BK   */
 	{ SST(0x12, 0x00, SS_RDEF,
@@ -2064,7 +2065,7 @@ static struct asc_table_entry asc_table[] = {
 	{ SST(0x31, 0x02, SS_RDEF,	/* XXX TBD */
 	    "Zoned formatting failed due to spare linking") },
 	/* D         B    */
-	{ SST(0x31, 0x03, SS_RDEF,	/* XXX TBD */
+	{ SST(0x31, 0x03, SS_FATAL | EIO,
 	    "SANITIZE command failed") },
 	/* D   W O   BK   */
 	{ SST(0x32, 0x00, SS_RDEF,

Modified: head/sys/sys/ata.h
==============================================================================
--- head/sys/sys/ata.h	Thu Jul 25 18:15:43 2019	(r350330)
+++ head/sys/sys/ata.h	Thu Jul 25 18:48:31 2019	(r350331)
@@ -97,6 +97,8 @@ struct ata_params {
 #define ATA_SUPPORT_OVERWRITE_EXT       0x4000
 #define ATA_SUPPORT_CRYPTO_SCRAMBLE_EXT 0x2000
 #define ATA_SUPPORT_SANITIZE            0x1000
+#define	ATA_SUPPORT_SANITIZE_ALLOWED	0x0800
+#define	ATA_SUPPORT_ANTIFREEZE_LOCK_EXT	0x0400
 #define ATA_MULTI_VALID                 0x0100
 
 /*060*/ u_int16_t       lba_size_1;
@@ -454,6 +456,7 @@ struct ata_params {
 #define ATA_ATAPI_IDENTIFY              0xa1    /* get ATAPI params*/
 #define ATA_SERVICE                     0xa2    /* service command */
 #define ATA_SMART_CMD                   0xb0    /* SMART command */
+#define	ATA_SANITIZE			0xb4	/* sanitize device */
 #define ATA_CFA_ERASE                   0xc0    /* CFA erase */
 #define ATA_READ_MUL                    0xc4    /* read multi */
 #define ATA_WRITE_MUL                   0xc5    /* write multi */

From owner-svn-src-head@freebsd.org  Thu Jul 25 20:11:06 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A768AD550;
 Thu, 25 Jul 2019 20:11:06 +0000 (UTC)
 (envelope-from etnapierala@gmail.com)
Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com
 [209.85.210.54])
 (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 1CF9A9336C;
 Thu, 25 Jul 2019 20:11:05 +0000 (UTC)
 (envelope-from etnapierala@gmail.com)
Received: by mail-ot1-f54.google.com with SMTP id r21so46935272otq.6;
 Thu, 25 Jul 2019 13:11:05 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=jZbO4UoQu6IdwXmPMykTg5tyyfiCuooLcH+15Suenl0=;
 b=QGESQ5LDaq68FuftDTs8I3vAW0U6UP5ZTVz8H6e0I3e079IRTUXv6wvdZGEtjgEJQQ
 wwwwpv0YNSd3OryMRtU1niYnJ6ARIWxctDVs/0tGbAj1FbMjkagLP3/15q5mCJ79W/sL
 AZv9eJnN97qplJvPTdU6OznvC+Q4V+PZlsP1o3ZGceptz4cekchODSCOt3Az6w9K1FT8
 3HUpPv/8qi2fXLRH8WJHM95fjs30xTcAS1s0AmkIT0voy+LhWJ0HIXNT4ZCKw+7U+NFa
 N+NPc/j8aq3KmxUG/0bMYepKy/QPCLNApJWJmUOvo/CNGlXJPyT0mUXlBUmZ04eiyEBJ
 4Ygw==
X-Gm-Message-State: APjAAAVeyIGbdQxWC+jqhUdur1k0GW71pBKFBv1kropHAz+d7murTwqV
 KaD8BsGLfJhV7nC7ISt7M5R2qEysEcKoIQDK7UY2fg==
X-Google-Smtp-Source: APXvYqw7wsuj6kj3tzBXmUd6g+ryLYwk9IhPCdG/PtAMfzRIfVYB07BYrNwISOGJN/kVmN03oAS9dbO0n8zgOTbmEMo=
X-Received: by 2002:a9d:61c9:: with SMTP id h9mr2168778otk.102.1564083652420; 
 Thu, 25 Jul 2019 12:40:52 -0700 (PDT)
MIME-Version: 1.0
References: <201907251848.x6PImVsN034508@repo.freebsd.org>
In-Reply-To: <201907251848.x6PImVsN034508@repo.freebsd.org>
From: Edward Napierala <trasz@freebsd.org>
Date: Thu, 25 Jul 2019 20:40:38 +0100
Message-ID: <CAFLM3-q1XECr+TV6gsr80teJE5Tb9EQH7OY-JqBJMLSbjMZ2eQ@mail.gmail.com>
Subject: Re: svn commit: r350331 - in head: sbin/camcontrol sys/cam/ata
 sys/cam/scsi sys/sys
To: Alexander Motin <mav@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>, 
 svn-src-head <svn-src-head@freebsd.org>
Content-Type: text/plain; charset="UTF-8"
X-Rspamd-Queue-Id: 1CF9A9336C
X-Spamd-Bar: ----
Authentication-Results: mx1.freebsd.org;
 spf=pass (mx1.freebsd.org: domain of etnapierala@gmail.com designates
 209.85.210.54 as permitted sender) smtp.mailfrom=etnapierala@gmail.com
X-Spamd-Result: default: False [-4.15 / 15.00]; ARC_NA(0.00)[];
 NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; FROM_HAS_DN(0.00)[];
 RCPT_COUNT_THREE(0.00)[4];
 R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17];
 TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain];
 RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[freebsd.org];
 RWL_MAILSPIKE_GOOD(0.00)[54.210.85.209.rep.mailspike.net : 127.0.0.18];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 IP_SCORE(-1.25)[ip: (-0.33), ipnet: 209.85.128.0/17(-3.42), asn: 15169(-2.44),
 country: US(-0.05)]; TO_DN_ALL(0.00)[];
 MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com];
 NEURAL_HAM_SHORT(-0.90)[-0.899,0];
 RCVD_IN_DNSWL_NONE(0.00)[54.210.85.209.list.dnswl.org : 127.0.5.0];
 FORGED_SENDER(0.30)[trasz@freebsd.org,etnapierala@gmail.com];
 MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[];
 FREEMAIL_ENVFROM(0.00)[gmail.com];
 ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US];
 FROM_NEQ_ENVFROM(0.00)[trasz@freebsd.org,etnapierala@gmail.com];
 RCVD_COUNT_TWO(0.00)[2]
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 20:11:06 -0000

On Thu, 25 Jul 2019 at 19:48, Alexander Motin <mav@freebsd.org> wrote:
>
> Author: mav
> Date: Thu Jul 25 18:48:31 2019
> New Revision: 350331
> URL: https://svnweb.freebsd.org/changeset/base/350331
>
> Log:
>   Make `camcontrol sanitize` support also ATA devices.
>
>   ATA sanitize is functionally identical to SCSI, just uses different
>   initiation commands and status reporting mechanism.
>
>   While there, make kernel better handle sanitize commands and statuses.
>
>   MFC after:    2 weeks
>   Sponsored by: iXsystems, Inc.

Relnotes: yes?

From owner-svn-src-head@freebsd.org  Thu Jul 25 20:14:53 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 571B1AD732;
 Thu, 25 Jul 2019 20:14:53 +0000 (UTC)
 (envelope-from mavbsd@gmail.com)
Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com
 [IPv6:2607:f8b0:4864:20::b35])
 (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 8964F9376C;
 Thu, 25 Jul 2019 20:14:52 +0000 (UTC)
 (envelope-from mavbsd@gmail.com)
Received: by mail-yb1-xb35.google.com with SMTP id d9so12478892ybf.3;
 Thu, 25 Jul 2019 13:14:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:to:cc:references:from:openpgp:autocrypt:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=mHw8X/NDqgHGkY2f7BhW9P7lsDrVAJHIA/OlLYDGtKw=;
 b=eakzfKvrAbX4JSk/sG6NouyEh4O2F11nZ/N0CIwWgiFREHhJqqSTnB4CsADqDkh5km
 BlrCPR7/VsXQNoJJrUNnQ59iw36xsCSxzoBs+VvSNVoIm/aXpJhZvumrbfPT5GjiFzbo
 K2HiojhMSDrDlXsQpFRnFunIniLFtYn/BbMrVN/xlyNxr89+KAYroDTNacguhypDb5fr
 +gHYrW+pR4+SPtdvd9T96s/amp16DsXC9llLv/ncuOk80s7zSy3UTNp/Gl8klfpMLm+V
 1ZhWpAIef0f3ak7XlXRlBPEOw9Q0u44IAmVNbcIpTcCHqDBhPq9l7hTERfaBjKLiQC15
 0QgA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:to:cc:references:from:openpgp
 :autocrypt:message-id:date:user-agent:mime-version:in-reply-to
 :content-language:content-transfer-encoding;
 bh=mHw8X/NDqgHGkY2f7BhW9P7lsDrVAJHIA/OlLYDGtKw=;
 b=OyzrxjLm5kb10XPgEs02JP2lker3M6u/2KeCA4a7s40zD6FFUWnQ0/P4FLQo9FLBbG
 1sCvpdZtCIvRXbyyrN+/F6ksPL9i9Ys1yEv3oGjcH/6LTf4YPltdav55BY5Bb2nNSJs6
 rWKd6j4Mz3Dur7Uz3VVr+dZyaajfnD85dPibnD1SV25Nz0iqr6JhEHRXh3To35H7pSBG
 qpXFmqXRXILwOG3GA75ZSce5DhW+274xy8gN4BW1IvQTFCJFJn2cbaj9SvO76m3MAfwL
 /yqvNzFP/M3zXMkNO9WMWhq5goVjnnoQUIH4h4AZhUtgjdnO2+45hcOtoYPtlU101npl
 wAtw==
X-Gm-Message-State: APjAAAXndp0gOPwgyvPCZKhcV49FzYFViJFfVpCSkqavBPcFi2NrT1p7
 iotKwVDk1sQ7AJRKX/BHtO/RgCS1
X-Google-Smtp-Source: APXvYqwn2ehG3muoLCjv9uDSFhJ3Dq/Y0W0BfZzWNtbhP1h8gx8NtwIHfZzXfIzqpGuppu/Vqy4/4w==
X-Received: by 2002:a25:26cf:: with SMTP id
 m198mr54593586ybm.381.1564085691431; 
 Thu, 25 Jul 2019 13:14:51 -0700 (PDT)
Received: from mavoffice.ixsystems.com ([12.189.233.129])
 by smtp.gmail.com with ESMTPSA id d127sm11581796ywb.27.2019.07.25.13.14.50
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 25 Jul 2019 13:14:50 -0700 (PDT)
Sender: Alexander Motin <mavbsd@gmail.com>
Subject: Re: svn commit: r350331 - in head: sbin/camcontrol sys/cam/ata
 sys/cam/scsi sys/sys
To: Edward Napierala <trasz@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>,
 svn-src-head <svn-src-head@freebsd.org>
References: <201907251848.x6PImVsN034508@repo.freebsd.org>
 <CAFLM3-q1XECr+TV6gsr80teJE5Tb9EQH7OY-JqBJMLSbjMZ2eQ@mail.gmail.com>
From: Alexander Motin <mav@FreeBSD.org>
Openpgp: preference=signencrypt
Autocrypt: addr=mav@FreeBSD.org; prefer-encrypt=mutual; keydata=
 xsBNBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g
 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne
 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP
 g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU
 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB
 AAHNIUFsZXhhbmRlciBNb3RpbiA8bWF2QEZyZWVCU0Qub3JnPsLAlwQTAQoAQQIbAwULCQgH
 AwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMKuBQkN
 McyiAAoJEIMYw5VbqyJ/tuUIAOG3ONOSNYqjK4eTZ1TVh9jdUBAhWk5nhDFnODN49Wj0AbYm
 7aIqy8O1hnCDSZG5LttjSAo3UfXJZDKQM0BLb0gpRMBnAYqO6tdolLNqAbPGJBnGoPjsh24y
 6KcbDaNnis+lD4GwPXwQM+92wZGhCUFElPV9NciZGVS65TNIgk7X+yEjjhD1MSWKKijZ1r9Z
 zIt4OzUTxxNOvzdlABZS88nNRdJkatOQJPmFdd1mpP6UzTNCiLUo1pIqOEtJgvVVDYq5WHY6
 tciWWYdmZG/tIBexJmv2mV2OLVjXR6ZeKmntVH14H72/wRHJuYHQC+r5SVRcWWayrThsY6jZ
 Yr4+raTOwE0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6Z
 AXgDtmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8Flv
 mI/c40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt
 3ytU8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZ
 R1EdEIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm5
 9R8AEQEAAcLAZQQYAQoADwUCU7PEDAIbDAUJBaOagAAKCRCDGMOVW6sif7FRB/4k9y/GaGqU
 fcJiXdQHRAKHCUvbKMFgeEDHOg33qx+POS2Ah85/PXVa2jYBldCZDmYc+zl48aEMd163a7s3
 0gJaB7CYElwxlKUk6c+5gwoYIJuJJzSzW0JzSD5ch7RIRxbfxrKdsiHrUW8AeduZWzlK6VaW
 RmWILgLmxfLdhEVFWxbr99GSeVFZaZwn6tl/8CvBcgYoARvJvl0V5zS1akQfEISYkwL9EfUI
 W44EOHranL5qUXkedXBYp6fRsooGrIimfwYxaC8FbXhk3FMgMjDMRiVq4POHo1iGeYETsUrL
 NM6184E25gPVtX2fb3RhM8Xh6BkwCZ6ZYbQ+AcD4F/cKwsB8BBgBCgAmAhsMFiEE6YzzxOac
 w80OV51VgxjDlVurIn8FAllgwtgFCQ0xzMwACgkQgxjDlVurIn9OqAf9FAcKWS95wTTbraXA
 qg/+bQyHgjlMtGCgkmfxLsbUGeqiFgmSIuoDrF7q6sYPs6p00CXXZRuuNZt0lX7O95re8mgz
 gxm5iJisZpdbHMVepYlw/AxT2wCHwxGCEe64Lm+A9vjlOd+3D3/6fSLwZ9WFCE6p6lQZ1CDg
 09xe+JKSgC+KDqmn0tzGKyfSCuhRAq3XkZyxL1hxBaDeP0eeKlzoy7jXodf3wVvXXc0cmpza
 B5McuRHK4EU6jIioHo30YqPM4AjPHGxV2X1N6/Aayungzj9EXNZtKCxs6dsTvjniWa5VkZ9F
 4SOdSbxEen1DZRYpeWnd7GVmO86n+5USkKCXPg==
Message-ID: <4a44f15e-f3c2-c53d-8a86-35398bf9c4c0@FreeBSD.org>
Date: Thu, 25 Jul 2019 16:14:50 -0400
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101
 Thunderbird/52.7.0
MIME-Version: 1.0
In-Reply-To: <CAFLM3-q1XECr+TV6gsr80teJE5Tb9EQH7OY-JqBJMLSbjMZ2eQ@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Rspamd-Queue-Id: 8964F9376C
X-Spamd-Bar: ------
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=gmail.com header.s=20161025 header.b=eakzfKvr;
 spf=pass (mx1.freebsd.org: domain of mavbsd@gmail.com designates
 2607:f8b0:4864:20::b35 as permitted sender) smtp.mailfrom=mavbsd@gmail.com
X-Spamd-Result: default: False [-6.19 / 15.00]; ARC_NA(0.00)[];
 RCVD_VIA_SMTP_AUTH(0.00)[];
 R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025];
 NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[];
 RCPT_COUNT_THREE(0.00)[4];
 R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36];
 TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain];
 RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[FreeBSD.org];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[3];
 IP_SCORE(-3.01)[ip: (-9.48), ipnet: 2607:f8b0::/32(-3.09), asn: 15169(-2.44),
 country: US(-0.05)]; TO_DN_ALL(0.00)[];
 DKIM_TRACE(0.00)[gmail.com:+];
 MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com];
 RCVD_IN_DNSWL_NONE(0.00)[5.3.b.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]; NEURAL_HAM_SHORT(-0.97)[-0.972,0];
 FORGED_SENDER(0.30)[mav@FreeBSD.org,mavbsd@gmail.com];
 MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com];
 ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US];
 FROM_NEQ_ENVFROM(0.00)[mav@FreeBSD.org,mavbsd@gmail.com];
 MID_RHS_MATCH_FROM(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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 20:14:53 -0000

On 25.07.2019 15:40, Edward Napierala wrote:
> On Thu, 25 Jul 2019 at 19:48, Alexander Motin <mav@freebsd.org> wrote:
>>
>> Author: mav
>> Date: Thu Jul 25 18:48:31 2019
>> New Revision: 350331
>> URL: https://svnweb.freebsd.org/changeset/base/350331
>>
>> Log:
>>   Make `camcontrol sanitize` support also ATA devices.
>>
>>   ATA sanitize is functionally identical to SCSI, just uses different
>>   initiation commands and status reporting mechanism.
>>
>>   While there, make kernel better handle sanitize commands and statuses.
>>
>>   MFC after:    2 weeks
>>   Sponsored by: iXsystems, Inc.
> 
> Relnotes: yes?

Ah. Sure. Why not.

-- 
Alexander Motin

From owner-svn-src-head@freebsd.org  Thu Jul 25 20:26:22 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6EBABADA13;
 Thu, 25 Jul 2019 20:26:22 +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 4D9AE93DBE;
 Thu, 25 Jul 2019 20:26:22 +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 27E7B43BE;
 Thu, 25 Jul 2019 20:26:22 +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 x6PKQM5B092731;
 Thu, 25 Jul 2019 20:26:22 GMT (envelope-from imp@FreeBSD.org)
Received: (from imp@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6PKQMIk092730;
 Thu, 25 Jul 2019 20:26:22 GMT (envelope-from imp@FreeBSD.org)
Message-Id: <201907252026.x6PKQMIk092730@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org
 using -f
From: Warner Losh <imp@FreeBSD.org>
Date: Thu, 25 Jul 2019 20:26:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350333 - head/sys/dev/nvme
X-SVN-Group: head
X-SVN-Commit-Author: imp
X-SVN-Commit-Paths: head/sys/dev/nvme
X-SVN-Commit-Revision: 350333
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 4D9AE93DBE
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];
 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 20:26:22 -0000

Author: imp
Date: Thu Jul 25 20:26:21 2019
New Revision: 350333
URL: https://svnweb.freebsd.org/changeset/base/350333

Log:
  Widen the type for to.
  
  The timeout field in the CAPS register is defined to be 8 bits, so its type was
  uint8_t. We recently started adding 1 to it to cope with rogue devices that
  listed 0 timeout time (which is impossible). However, in so doing, other devices
  that list 0xff (for a 2 minute timeout) were broken when adding 1
  overflowed. Widen the type to be uint32_t like its source register to avoid the
  issue.
  
  Reported by: bapt@

Modified:
  head/sys/dev/nvme/nvme_ctrlr.c

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==============================================================================
--- head/sys/dev/nvme/nvme_ctrlr.c	Thu Jul 25 20:01:24 2019	(r350332)
+++ head/sys/dev/nvme/nvme_ctrlr.c	Thu Jul 25 20:26:21 2019	(r350333)
@@ -1227,7 +1227,7 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de
 	struct make_dev_args	md_args;
 	uint32_t	cap_lo;
 	uint32_t	cap_hi;
-	uint8_t		to;
+	uint32_t	to;
 	uint8_t		dstrd;
 	uint8_t		mpsmin;
 	int		status, timeout_period;

From owner-svn-src-head@freebsd.org  Thu Jul 25 22:02:56 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A3BDAF932;
 Thu, 25 Jul 2019 22:02:56 +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 3D58997873;
 Thu, 25 Jul 2019 22:02:56 +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 17FA355BB;
 Thu, 25 Jul 2019 22:02:56 +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 x6PM2tJx051928;
 Thu, 25 Jul 2019 22:02:55 GMT (envelope-from alc@FreeBSD.org)
Received: (from alc@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6PM2t0i051925;
 Thu, 25 Jul 2019 22:02:55 GMT (envelope-from alc@FreeBSD.org)
Message-Id: <201907252202.x6PM2t0i051925@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org
 using -f
From: Alan Cox <alc@FreeBSD.org>
Date: Thu, 25 Jul 2019 22:02:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350335 - in head/sys: amd64/amd64 arm64/arm64 i386/i386
 riscv/riscv
X-SVN-Group: head
X-SVN-Commit-Author: alc
X-SVN-Commit-Paths: in head/sys: amd64/amd64 arm64/arm64 i386/i386 riscv/riscv
X-SVN-Commit-Revision: 350335
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 3D58997873
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.89 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.89)[-0.893,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 22:02:56 -0000

Author: alc
Date: Thu Jul 25 22:02:55 2019
New Revision: 350335
URL: https://svnweb.freebsd.org/changeset/base/350335

Log:
  Simplify the handling of superpages in pmap_clear_modify().  Specifically,
  if a demotion succeeds, then all of the 4KB page mappings within the
  superpage-sized region must be valid, so there is no point in testing the
  validity of the 4KB page mapping that is going to be write protected.
  
  Deindent the nearby code.
  
  Reviewed by:	kib, markj
  Tested by:	pho (amd64, i386)
  X-MFC after:	r350004 (this change depends on arm64 dirty bit emulation)
  Differential Revision:	https://reviews.freebsd.org/D21027

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/arm64/arm64/pmap.c
  head/sys/i386/i386/pmap.c
  head/sys/riscv/riscv/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==============================================================================
--- head/sys/amd64/amd64/pmap.c	Thu Jul 25 20:34:50 2019	(r350334)
+++ head/sys/amd64/amd64/pmap.c	Thu Jul 25 22:02:55 2019	(r350335)
@@ -7574,7 +7574,7 @@ pmap_clear_modify(vm_page_t m)
 	pmap_t pmap;
 	pv_entry_t next_pv, pv;
 	pd_entry_t oldpde, *pde;
-	pt_entry_t oldpte, *pte, PG_M, PG_RW, PG_V;
+	pt_entry_t *pte, PG_M, PG_RW;
 	struct rwlock *lock;
 	vm_offset_t va;
 	int md_gen, pvh_gen;
@@ -7610,33 +7610,23 @@ restart:
 			}
 		}
 		PG_M = pmap_modified_bit(pmap);
-		PG_V = pmap_valid_bit(pmap);
 		PG_RW = pmap_rw_bit(pmap);
 		va = pv->pv_va;
 		pde = pmap_pde(pmap, va);
 		oldpde = *pde;
-		if ((oldpde & PG_RW) != 0) {
-			if (pmap_demote_pde_locked(pmap, pde, va, &lock)) {
-				if ((oldpde & PG_W) == 0) {
-					/*
-					 * Write protect the mapping to a
-					 * single page so that a subsequent
-					 * write access may repromote.
-					 */
-					va += VM_PAGE_TO_PHYS(m) - (oldpde &
-					    PG_PS_FRAME);
-					pte = pmap_pde_to_pte(pde, va);
-					oldpte = *pte;
-					if ((oldpte & PG_V) != 0) {
-						while (!atomic_cmpset_long(pte,
-						    oldpte,
-						    oldpte & ~(PG_M | PG_RW)))
-							oldpte = *pte;
-						vm_page_dirty(m);
-						pmap_invalidate_page(pmap, va);
-					}
-				}
-			}
+		/* If oldpde has PG_RW set, then it also has PG_M set. */
+		if ((oldpde & PG_RW) != 0 &&
+		    pmap_demote_pde_locked(pmap, pde, va, &lock) &&
+		    (oldpde & PG_W) == 0) {
+			/*
+			 * Write protect the mapping to a single page so that
+			 * a subsequent write access may repromote.
+			 */
+			va += VM_PAGE_TO_PHYS(m) - (oldpde & PG_PS_FRAME);
+			pte = pmap_pde_to_pte(pde, va);
+			atomic_clear_long(pte, PG_M | PG_RW);
+			vm_page_dirty(m);
+			pmap_invalidate_page(pmap, va);
 		}
 		PMAP_UNLOCK(pmap);
 	}

Modified: head/sys/arm64/arm64/pmap.c
==============================================================================
--- head/sys/arm64/arm64/pmap.c	Thu Jul 25 20:34:50 2019	(r350334)
+++ head/sys/arm64/arm64/pmap.c	Thu Jul 25 22:02:55 2019	(r350335)
@@ -4889,28 +4889,22 @@ restart:
 		va = pv->pv_va;
 		l2 = pmap_l2(pmap, va);
 		oldl2 = pmap_load(l2);
-		if ((oldl2 & ATTR_SW_DBM) != 0) {
-			if (pmap_demote_l2_locked(pmap, l2, va, &lock)) {
-				if ((oldl2 & ATTR_SW_WIRED) == 0) {
-					/*
-					 * Write protect the mapping to a
-					 * single page so that a subsequent
-					 * write access may repromote.
-					 */
-					va += VM_PAGE_TO_PHYS(m) -
-					    (oldl2 & ~ATTR_MASK);
-					l3 = pmap_l2_to_l3(l2, va);
-					oldl3 = pmap_load(l3);
-					if (pmap_l3_valid(oldl3)) {
-						while (!atomic_fcmpset_long(l3,
-						    &oldl3, (oldl3 & ~ATTR_SW_DBM) |
-						    ATTR_AP(ATTR_AP_RO)))
-							cpu_spinwait();
-						vm_page_dirty(m);
-						pmap_invalidate_page(pmap, va);
-					}
-				}
-			}
+		/* If oldl2 has ATTR_SW_DBM set, then it is also dirty. */
+		if ((oldl2 & ATTR_SW_DBM) != 0 &&
+		    pmap_demote_l2_locked(pmap, l2, va, &lock) &&
+		    (oldl2 & ATTR_SW_WIRED) == 0) {
+			/*
+			 * Write protect the mapping to a single page so that
+			 * a subsequent write access may repromote.
+			 */
+			va += VM_PAGE_TO_PHYS(m) - (oldl2 & ~ATTR_MASK);
+			l3 = pmap_l2_to_l3(l2, va);
+			oldl3 = pmap_load(l3);
+			while (!atomic_fcmpset_long(l3, &oldl3,
+			    (oldl3 & ~ATTR_SW_DBM) | ATTR_AP(ATTR_AP_RO)))
+				cpu_spinwait();
+			vm_page_dirty(m);
+			pmap_invalidate_page(pmap, va);
 		}
 		PMAP_UNLOCK(pmap);
 	}

Modified: head/sys/i386/i386/pmap.c
==============================================================================
--- head/sys/i386/i386/pmap.c	Thu Jul 25 20:34:50 2019	(r350334)
+++ head/sys/i386/i386/pmap.c	Thu Jul 25 22:02:55 2019	(r350335)
@@ -5280,7 +5280,7 @@ __CONCAT(PMTYPE, clear_modify)(vm_page_t m)
 	pv_entry_t next_pv, pv;
 	pmap_t pmap;
 	pd_entry_t oldpde, *pde;
-	pt_entry_t oldpte, *pte;
+	pt_entry_t *pte;
 	vm_offset_t va;
 
 	KASSERT((m->oflags & VPO_UNMANAGED) == 0,
@@ -5307,34 +5307,24 @@ __CONCAT(PMTYPE, clear_modify)(vm_page_t m)
 		PMAP_LOCK(pmap);
 		pde = pmap_pde(pmap, va);
 		oldpde = *pde;
-		if ((oldpde & PG_RW) != 0) {
-			if (pmap_demote_pde(pmap, pde, va)) {
-				if ((oldpde & PG_W) == 0) {
-					/*
-					 * Write protect the mapping to a
-					 * single page so that a subsequent
-					 * write access may repromote.
-					 */
-					va += VM_PAGE_TO_PHYS(m) - (oldpde &
-					    PG_PS_FRAME);
-					pte = pmap_pte_quick(pmap, va);
-					oldpte = *pte;
-					if ((oldpte & PG_V) != 0) {
-						/*
-						 * Regardless of whether a pte is 32 or 64 bits
-						 * in size, PG_RW and PG_M are among the least
-						 * significant 32 bits.
-						 */
-						while (!atomic_cmpset_int((u_int *)pte,
-						    oldpte,
-						    oldpte & ~(PG_M | PG_RW)))
-							oldpte = *pte;
-						vm_page_dirty(m);
-						pmap_invalidate_page_int(pmap,
-						    va);
-					}
-				}
-			}
+		/* If oldpde has PG_RW set, then it also has PG_M set. */
+		if ((oldpde & PG_RW) != 0 &&
+		    pmap_demote_pde(pmap, pde, va) &&
+		    (oldpde & PG_W) == 0) {
+			/*
+			 * Write protect the mapping to a single page so that
+			 * a subsequent write access may repromote.
+			 */
+			va += VM_PAGE_TO_PHYS(m) - (oldpde & PG_PS_FRAME);
+			pte = pmap_pte_quick(pmap, va);
+			/*
+			 * Regardless of whether a pte is 32 or 64 bits
+			 * in size, PG_RW and PG_M are among the least
+			 * significant 32 bits.
+			 */
+			atomic_clear_int((u_int *)pte, PG_M | PG_RW);
+			vm_page_dirty(m);
+			pmap_invalidate_page_int(pmap, va);
 		}
 		PMAP_UNLOCK(pmap);
 	}

Modified: head/sys/riscv/riscv/pmap.c
==============================================================================
--- head/sys/riscv/riscv/pmap.c	Thu Jul 25 20:34:50 2019	(r350334)
+++ head/sys/riscv/riscv/pmap.c	Thu Jul 25 22:02:55 2019	(r350335)
@@ -4105,7 +4105,7 @@ pmap_clear_modify(vm_page_t m)
 	pmap_t pmap;
 	pv_entry_t next_pv, pv;
 	pd_entry_t *l2, oldl2;
-	pt_entry_t *l3, oldl3;
+	pt_entry_t *l3;
 	vm_offset_t va;
 	int md_gen, pvh_gen;
 
@@ -4143,28 +4143,19 @@ restart:
 		va = pv->pv_va;
 		l2 = pmap_l2(pmap, va);
 		oldl2 = pmap_load(l2);
-		if ((oldl2 & PTE_W) != 0) {
-			if (pmap_demote_l2_locked(pmap, l2, va, &lock)) {
-				if ((oldl2 & PTE_SW_WIRED) == 0) {
-					/*
-					 * Write protect the mapping to a
-					 * single page so that a subsequent
-					 * write access may repromote.
-					 */
-					va += VM_PAGE_TO_PHYS(m) -
-					    PTE_TO_PHYS(oldl2);
-					l3 = pmap_l2_to_l3(l2, va);
-					oldl3 = pmap_load(l3);
-					if ((oldl3 & PTE_V) != 0) {
-						while (!atomic_fcmpset_long(l3,
-						    &oldl3, oldl3 & ~(PTE_D |
-						    PTE_W)))
-							cpu_spinwait();
-						vm_page_dirty(m);
-						pmap_invalidate_page(pmap, va);
-					}
-				}
-			}
+		/* If oldl2 has PTE_W set, then it also has PTE_D set. */
+		if ((oldl2 & PTE_W) != 0 &&
+		    pmap_demote_l2_locked(pmap, l2, va, &lock) &&
+		    (oldl2 & PTE_SW_WIRED) == 0) {
+			/*
+			 * Write protect the mapping to a single page so that
+			 * a subsequent write access may repromote.
+			 */
+			va += VM_PAGE_TO_PHYS(m) - PTE_TO_PHYS(oldl2);
+			l3 = pmap_l2_to_l3(l2, va);
+			pmap_clear_bits(l3, PTE_D | PTE_W);
+			vm_page_dirty(m);
+			pmap_invalidate_page(pmap, va);
 		}
 		PMAP_UNLOCK(pmap);
 	}

From owner-svn-src-head@freebsd.org  Thu Jul 25 22:23:35 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id B5848B008C;
 Thu, 25 Jul 2019 22:23:35 +0000 (UTC)
 (envelope-from kevans@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 98C4E68563;
 Thu, 25 Jul 2019 22:23:35 +0000 (UTC)
 (envelope-from kevans@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 749B75963;
 Thu, 25 Jul 2019 22:23:35 +0000 (UTC)
 (envelope-from kevans@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6PMNZoq063417;
 Thu, 25 Jul 2019 22:23:35 GMT (envelope-from kevans@FreeBSD.org)
Received: (from kevans@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6PMNY9d063415;
 Thu, 25 Jul 2019 22:23:34 GMT (envelope-from kevans@FreeBSD.org)
Message-Id: <201907252223.x6PMNY9d063415@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kevans set sender to
 kevans@FreeBSD.org using -f
From: Kyle Evans <kevans@FreeBSD.org>
Date: Thu, 25 Jul 2019 22:23:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350336 - head/sys/net
X-SVN-Group: head
X-SVN-Commit-Author: kevans
X-SVN-Commit-Paths: head/sys/net
X-SVN-Commit-Revision: 350336
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 98C4E68563
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.89 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.89)[-0.894,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jul 2019 22:23:35 -0000

Author: kevans
Date: Thu Jul 25 22:23:34 2019
New Revision: 350336
URL: https://svnweb.freebsd.org/changeset/base/350336

Log:
  if_tuntap(4): Add TUNGIFNAME
  
  This effectively just moves TAPGIFNAME into common ioctl territory.
  
  MFC after:	3 days

Modified:
  head/sys/net/if_tap.h
  head/sys/net/if_tun.h
  head/sys/net/if_tuntap.c

Modified: head/sys/net/if_tap.h
==============================================================================
--- head/sys/net/if_tap.h	Thu Jul 25 22:02:55 2019	(r350335)
+++ head/sys/net/if_tap.h	Thu Jul 25 22:23:34 2019	(r350336)
@@ -55,7 +55,7 @@
 #define	TAPGDEBUG		TUNGDEBUG
 #define	TAPSIFINFO		TUNSIFINFO
 #define	TAPGIFINFO		TUNGIFINFO
-#define	TAPGIFNAME		_IOR('t', 93, struct ifreq)
+#define	TAPGIFNAME		TUNGIFNAME
 
 /* VMware ioctl's */
 #define VMIO_SIOCSIFFLAGS	_IOWINT('V', 0)

Modified: head/sys/net/if_tun.h
==============================================================================
--- head/sys/net/if_tun.h	Thu Jul 25 22:02:55 2019	(r350335)
+++ head/sys/net/if_tun.h	Thu Jul 25 22:23:34 2019	(r350336)
@@ -40,6 +40,7 @@ struct tuninfo {
 #define	TUNSIFINFO	_IOW('t', 91, struct tuninfo)
 #define	TUNGIFINFO	_IOR('t', 92, struct tuninfo)
 #define	TUNSLMODE	_IOW('t', 93, int)
+#define	TUNGIFNAME	_IOR('t', 93, struct ifreq)
 #define	TUNSIFMODE	_IOW('t', 94, int)
 #define	TUNSIFPID	_IO('t', 95)
 #define	TUNSIFHEAD	_IOW('t', 96, int)

Modified: head/sys/net/if_tuntap.c
==============================================================================
--- head/sys/net/if_tuntap.c	Thu Jul 25 22:02:55 2019	(r350335)
+++ head/sys/net/if_tuntap.c	Thu Jul 25 22:23:34 2019	(r350336)
@@ -1235,12 +1235,6 @@ tunioctl(struct cdev *dev, u_long cmd, caddr_t data, i
 	if (l2tun) {
 		/* tap specific ioctls */
 		switch(cmd) {
-		case TAPGIFNAME:
-			ifrp = (struct ifreq *)data;
-			strlcpy(ifrp->ifr_name, TUN2IFP(tp)->if_xname,
-			    IFNAMSIZ);
-
-			return (0);
 		/* VMware/VMnet port ioctl's */
 #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
     defined(COMPAT_FREEBSD4)
@@ -1337,6 +1331,11 @@ tunioctl(struct cdev *dev, u_long cmd, caddr_t data, i
 	}
 
 	switch (cmd) {
+	case TUNGIFNAME:
+		ifrp = (struct ifreq *)data;
+		strlcpy(ifrp->ifr_name, TUN2IFP(tp)->if_xname, IFNAMSIZ);
+
+		return (0);
 	case TUNSIFINFO:
 		tunp = (struct tuninfo *)data;
 		if (TUN2IFP(tp)->if_type != tunp->type)

From owner-svn-src-head@freebsd.org  Fri Jul 26 01:49:29 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC2ECB3406;
 Fri, 26 Jul 2019 01:49:29 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 BD85A70297;
 Fri, 26 Jul 2019 01:49:29 +0000 (UTC) (envelope-from mav@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 9A0797CD1;
 Fri, 26 Jul 2019 01:49:29 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6Q1nTX7081374;
 Fri, 26 Jul 2019 01:49:29 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6Q1nTZc081372;
 Fri, 26 Jul 2019 01:49:29 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201907260149.x6Q1nTZc081372@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Fri, 26 Jul 2019 01:49:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350343 - in head/sys/cam: ctl scsi
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: in head/sys/cam: ctl scsi
X-SVN-Commit-Revision: 350343
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: BD85A70297
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.927,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jul 2019 01:49:29 -0000

Author: mav
Date: Fri Jul 26 01:49:28 2019
New Revision: 350343
URL: https://svnweb.freebsd.org/changeset/base/350343

Log:
  Add reporting of SCSI Feature Sets VPD page from SPC-5.
  
  CTL implements all defined feature sets except Drive Maintenance 2016,
  which is not very applicable to such a virtual device, and implemented
  only partially now.  But may be it could be fixed later at least for
  completeness.
  
  MFC after:	2 weeks

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/scsi/scsi_all.h

Modified: head/sys/cam/ctl/ctl.c
==============================================================================
--- head/sys/cam/ctl/ctl.c	Fri Jul 26 01:47:20 2019	(r350342)
+++ head/sys/cam/ctl/ctl.c	Fri Jul 26 01:49:28 2019	(r350343)
@@ -448,10 +448,11 @@ SYSCTL_INT(_kern_cam_ctl, OID_AUTO, max_ports, CTLFLAG
 /*
  * Supported pages (0x00), Serial number (0x80), Device ID (0x83),
  * Extended INQUIRY Data (0x86), Mode Page Policy (0x87),
- * SCSI Ports (0x88), Third-party Copy (0x8F), Block limits (0xB0),
- * Block Device Characteristics (0xB1) and Logical Block Provisioning (0xB2)
+ * SCSI Ports (0x88), Third-party Copy (0x8F), SCSI Feature Sets (0x92),
+ * Block limits (0xB0), Block Device Characteristics (0xB1) and
+ * Logical Block Provisioning (0xB2)
  */
-#define SCSI_EVPD_NUM_SUPPORTED_PAGES	10
+#define SCSI_EVPD_NUM_SUPPORTED_PAGES	11
 
 static void ctl_isc_event_handler(ctl_ha_channel chanel, ctl_ha_event event,
 				  int param);
@@ -489,6 +490,7 @@ static int ctl_inquiry_evpd_eid(struct ctl_scsiio *cts
 static int ctl_inquiry_evpd_mpp(struct ctl_scsiio *ctsio, int alloc_len);
 static int ctl_inquiry_evpd_scsi_ports(struct ctl_scsiio *ctsio,
 					 int alloc_len);
+static int ctl_inquiry_evpd_sfs(struct ctl_scsiio *ctsio, int alloc_len);
 static int ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio,
 					 int alloc_len);
 static int ctl_inquiry_evpd_bdc(struct ctl_scsiio *ctsio, int alloc_len);
@@ -9318,6 +9320,8 @@ ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, i
 	pages->page_list[p++] = SVPD_SCSI_PORTS;
 	/* Third-party Copy */
 	pages->page_list[p++] = SVPD_SCSI_TPC;
+	/* SCSI Feature Sets */
+	pages->page_list[p++] = SVPD_SCSI_SFS;
 	if (lun != NULL && lun->be_lun->lun_type == T_DIRECT) {
 		/* Block limits */
 		pages->page_list[p++] = SVPD_BLOCK_LIMITS;
@@ -9699,6 +9703,58 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_scsiio *ctsio, 
 }
 
 static int
+ctl_inquiry_evpd_sfs(struct ctl_scsiio *ctsio, int alloc_len)
+{
+	struct ctl_lun *lun = CTL_LUN(ctsio);
+	struct scsi_vpd_sfs *sfs_ptr;
+	int sfs_page_size, n;
+
+	sfs_page_size = sizeof(*sfs_ptr) + 5 * 2;
+	ctsio->kern_data_ptr = malloc(sfs_page_size, M_CTL, M_WAITOK | M_ZERO);
+	sfs_ptr = (struct scsi_vpd_sfs *)ctsio->kern_data_ptr;
+	ctsio->kern_sg_entries = 0;
+	ctsio->kern_rel_offset = 0;
+	ctsio->kern_sg_entries = 0;
+	ctsio->kern_data_len = min(sfs_page_size, alloc_len);
+	ctsio->kern_total_len = ctsio->kern_data_len;
+
+	/*
+	 * The control device is always connected.  The disk device, on the
+	 * other hand, may not be online all the time.  Need to change this
+	 * to figure out whether the disk device is actually online or not.
+	 */
+	if (lun != NULL)
+		sfs_ptr->device = (SID_QUAL_LU_CONNECTED << 5) |
+				  lun->be_lun->lun_type;
+	else
+		sfs_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT;
+
+	sfs_ptr->page_code = SVPD_SCSI_SFS;
+	n = 0;
+	/* Discovery 2016 */
+	scsi_ulto2b(0x0001, &sfs_ptr->codes[2 * n++]);
+	if (lun != NULL && lun->be_lun->lun_type == T_DIRECT) {
+		 /* SBC Base 2016 */
+		scsi_ulto2b(0x0101, &sfs_ptr->codes[2 * n++]);
+		 /* SBC Base 2010 */
+		scsi_ulto2b(0x0102, &sfs_ptr->codes[2 * n++]);
+		if (lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) {
+			/* Basic Provisioning 2016 */
+			scsi_ulto2b(0x0103, &sfs_ptr->codes[2 * n++]);
+		}
+		/* Drive Maintenance 2016 */
+		//scsi_ulto2b(0x0104, &sfs_ptr->codes[2 * n++]);
+	}
+	scsi_ulto2b(4 + 2 * n, sfs_ptr->page_length);
+
+	ctl_set_success(ctsio);
+	ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED;
+	ctsio->be_move_done = ctl_config_move_done;
+	ctl_datamove((union ctl_io *)ctsio);
+	return (CTL_RETVAL_COMPLETE);
+}
+
+static int
 ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio, int alloc_len)
 {
 	struct ctl_lun *lun = CTL_LUN(ctsio);
@@ -9811,7 +9867,7 @@ ctl_inquiry_evpd_bdc(struct ctl_scsiio *ctsio, int all
 	else
 		i = 0;
 	bdc_ptr->wab_wac_ff = (i & 0x0f);
-	bdc_ptr->flags = SVPD_FUAB | SVPD_VBULS;
+	bdc_ptr->flags = SVPD_RBWZ | SVPD_FUAB | SVPD_VBULS;
 
 	ctl_set_success(ctsio);
 	ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED;
@@ -9903,6 +9959,9 @@ ctl_inquiry_evpd(struct ctl_scsiio *ctsio)
 		break;
 	case SVPD_SCSI_TPC:
 		retval = ctl_inquiry_evpd_tpc(ctsio, alloc_len);
+		break;
+	case SVPD_SCSI_SFS:
+		retval = ctl_inquiry_evpd_sfs(ctsio, alloc_len);
 		break;
 	case SVPD_BLOCK_LIMITS:
 		if (lun == NULL || lun->be_lun->lun_type != T_DIRECT)

Modified: head/sys/cam/scsi/scsi_all.h
==============================================================================
--- head/sys/cam/scsi/scsi_all.h	Fri Jul 26 01:47:20 2019	(r350342)
+++ head/sys/cam/scsi/scsi_all.h	Fri Jul 26 01:49:28 2019	(r350343)
@@ -2763,6 +2763,19 @@ struct scsi_vpd_tpc
 };
 
 /*
+ * SCSI Feature Sets VPD Page
+ */
+struct scsi_vpd_sfs
+{
+	uint8_t device;
+	uint8_t page_code;
+#define	SVPD_SCSI_SFS			0x92
+	uint8_t page_length[2];
+	uint8_t reserved[4];
+	uint8_t codes[];
+};
+
+/*
  * Block Device Characteristics VPD Page based on
  * T10/1799-D Revision 31
  */
@@ -2803,11 +2816,15 @@ struct scsi_vpd_block_device_characteristics
 	uint8_t flags;
 #define	SVPD_VBULS		0x01
 #define	SVPD_FUAB		0x02
+#define	SVPD_BOCS		0x04
+#define	SVPD_RBWZ		0x08
 #define	SVPD_ZBC_NR		0x00	/* Not Reported */
 #define	SVPD_HAW_ZBC		0x10	/* Host Aware */
 #define	SVPD_DM_ZBC		0x20	/* Drive Managed */
 #define	SVPD_ZBC_MASK		0x30	/* Zoned mask */
-	uint8_t reserved[55];
+	uint8_t reserved[3];
+	uint8_t depopulation_time[4];
+	uint8_t reserved2[48];
 };
 
 #define SBDC_IS_PRESENT(bdc, length, field)				   \

From owner-svn-src-head@freebsd.org  Fri Jul 26 03:49:18 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE9B6B5214;
 Fri, 26 Jul 2019 03:49:18 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 87F08746BA;
 Fri, 26 Jul 2019 03:49:18 +0000 (UTC) (envelope-from mav@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 61DD892D3;
 Fri, 26 Jul 2019 03:49:18 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6Q3nI55052662;
 Fri, 26 Jul 2019 03:49:18 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6Q3nHFw052657;
 Fri, 26 Jul 2019 03:49:17 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201907260349.x6Q3nHFw052657@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Fri, 26 Jul 2019 03:49:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350346 - in head: sys/cam/ctl sys/cam/scsi
 usr.sbin/ctladm
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: in head: sys/cam/ctl sys/cam/scsi usr.sbin/ctladm
X-SVN-Commit-Revision: 350346
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 87F08746BA
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];
 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jul 2019 03:49:18 -0000

Author: mav
Date: Fri Jul 26 03:49:16 2019
New Revision: 350346
URL: https://svnweb.freebsd.org/changeset/base/350346

Log:
  Add device temperature reporting into CTL.
  
  The values to report can be set via LUN options.  It can be useful for
  testing, and also required for Drive Maintenance 2016 feature set.
  
  MFC after:	2 weeks

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl.h
  head/sys/cam/ctl/ctl_private.h
  head/sys/cam/scsi/scsi_all.h
  head/usr.sbin/ctladm/ctladm.8

Modified: head/sys/cam/ctl/ctl.c
==============================================================================
--- head/sys/cam/ctl/ctl.c	Fri Jul 26 02:49:34 2019	(r350345)
+++ head/sys/cam/ctl/ctl.c	Fri Jul 26 03:49:16 2019	(r350346)
@@ -4450,12 +4450,14 @@ ctl_init_log_page_index(struct ctl_lun *lun)
 	lun->log_pages.index[0].page_len = j;
 	lun->log_pages.index[1].page_data = &lun->log_pages.subpages_page[0];
 	lun->log_pages.index[1].page_len = k * 2;
-	lun->log_pages.index[2].page_data = &lun->log_pages.lbp_page[0];
-	lun->log_pages.index[2].page_len = 12*CTL_NUM_LBP_PARAMS;
-	lun->log_pages.index[3].page_data = (uint8_t *)&lun->log_pages.stat_page;
-	lun->log_pages.index[3].page_len = sizeof(lun->log_pages.stat_page);
-	lun->log_pages.index[4].page_data = (uint8_t *)&lun->log_pages.ie_page;
-	lun->log_pages.index[4].page_len = sizeof(lun->log_pages.ie_page);
+	lun->log_pages.index[2].page_data = (uint8_t *)&lun->log_pages.temp_page;
+	lun->log_pages.index[2].page_len = sizeof(lun->log_pages.temp_page);
+	lun->log_pages.index[3].page_data = &lun->log_pages.lbp_page[0];
+	lun->log_pages.index[3].page_len = 12*CTL_NUM_LBP_PARAMS;
+	lun->log_pages.index[4].page_data = (uint8_t *)&lun->log_pages.stat_page;
+	lun->log_pages.index[4].page_len = sizeof(lun->log_pages.stat_page);
+	lun->log_pages.index[5].page_data = (uint8_t *)&lun->log_pages.ie_page;
+	lun->log_pages.index[5].page_len = sizeof(lun->log_pages.ie_page);
 
 	return (CTL_RETVAL_COMPLETE);
 }
@@ -6679,6 +6681,40 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
 }
 
 int
+ctl_temp_log_sense_handler(struct ctl_scsiio *ctsio,
+			       struct ctl_page_index *page_index,
+			       int pc)
+{
+	struct ctl_lun *lun = CTL_LUN(ctsio);
+	struct scsi_log_temperature *data;
+	const char *value;
+
+	data = (struct scsi_log_temperature *)page_index->page_data;
+
+	scsi_ulto2b(SLP_TEMPERATURE, data->hdr.param_code);
+	data->hdr.param_control = SLP_LBIN;
+	data->hdr.param_len = sizeof(struct scsi_log_temperature) -
+	    sizeof(struct scsi_log_param_header);
+	if ((value = dnvlist_get_string(lun->be_lun->options, "temperature",
+	    NULL)) != NULL)
+		data->temperature = strtol(value, NULL, 0);
+	else
+		data->temperature = 0xff;
+	data++;
+
+	scsi_ulto2b(SLP_REFTEMPERATURE, data->hdr.param_code);
+	data->hdr.param_control = SLP_LBIN;
+	data->hdr.param_len = sizeof(struct scsi_log_temperature) -
+	    sizeof(struct scsi_log_param_header);
+	if ((value = dnvlist_get_string(lun->be_lun->options, "reftemperature",
+	    NULL)) != NULL)
+		data->temperature = strtol(value, NULL, 0);
+	else
+		data->temperature = 0xff;
+	return (0);
+}
+
+int
 ctl_lbp_log_sense_handler(struct ctl_scsiio *ctsio,
 			       struct ctl_page_index *page_index,
 			       int pc)
@@ -6802,6 +6838,7 @@ ctl_ie_log_sense_handler(struct ctl_scsiio *ctsio,
 {
 	struct ctl_lun *lun = CTL_LUN(ctsio);
 	struct scsi_log_informational_exceptions *data;
+	const char *value;
 
 	data = (struct scsi_log_informational_exceptions *)page_index->page_data;
 
@@ -6811,7 +6848,11 @@ ctl_ie_log_sense_handler(struct ctl_scsiio *ctsio,
 	    sizeof(struct scsi_log_param_header);
 	data->ie_asc = lun->ie_asc;
 	data->ie_ascq = lun->ie_ascq;
-	data->temperature = 0xff;
+	if ((value = dnvlist_get_string(lun->be_lun->options, "temperature",
+	    NULL)) != NULL)
+		data->temperature = strtol(value, NULL, 0);
+	else
+		data->temperature = 0xff;
 	return (0);
 }
 

Modified: head/sys/cam/ctl/ctl.h
==============================================================================
--- head/sys/cam/ctl/ctl.h	Fri Jul 26 02:49:34 2019	(r350345)
+++ head/sys/cam/ctl/ctl.h	Fri Jul 26 03:49:16 2019	(r350346)
@@ -158,6 +158,9 @@ int ctl_default_page_handler(struct ctl_scsiio *ctsio,
 int ctl_ie_page_handler(struct ctl_scsiio *ctsio,
 			struct ctl_page_index *page_index,
 			uint8_t *page_ptr);
+int ctl_temp_log_sense_handler(struct ctl_scsiio *ctsio,
+				   struct ctl_page_index *page_index,
+				   int pc);
 int ctl_lbp_log_sense_handler(struct ctl_scsiio *ctsio,
 				   struct ctl_page_index *page_index,
 				   int pc);

Modified: head/sys/cam/ctl/ctl_private.h
==============================================================================
--- head/sys/cam/ctl/ctl_private.h	Fri Jul 26 02:49:34 2019	(r350345)
+++ head/sys/cam/ctl/ctl_private.h	Fri Jul 26 03:49:16 2019	(r350346)
@@ -331,6 +331,8 @@ static const struct ctl_page_index log_page_index_temp
 	 CTL_PAGE_FLAG_ALL, NULL, NULL},
 	{SLS_SUPPORTED_PAGES_PAGE, SLS_SUPPORTED_SUBPAGES_SUBPAGE, 0, NULL,
 	 CTL_PAGE_FLAG_ALL, NULL, NULL},
+	{SLS_TEMPERATURE, 0, 0, NULL,
+	 CTL_PAGE_FLAG_DIRECT, ctl_temp_log_sense_handler, NULL},
 	{SLS_LOGICAL_BLOCK_PROVISIONING, 0, 0, NULL,
 	 CTL_PAGE_FLAG_DIRECT, ctl_lbp_log_sense_handler, NULL},
 	{SLS_STAT_AND_PERF, 0, 0, NULL,
@@ -351,6 +353,7 @@ struct ctl_log_pages {
 		struct scsi_log_idle_time it;
 		struct scsi_log_time_interval ti;
 	} stat_page;
+	struct scsi_log_temperature	temp_page[2];
 	struct scsi_log_informational_exceptions	ie_page;
 	struct ctl_page_index		index[CTL_NUM_LOG_PAGES];
 };

Modified: head/sys/cam/scsi/scsi_all.h
==============================================================================
--- head/sys/cam/scsi/scsi_all.h	Fri Jul 26 02:49:34 2019	(r350345)
+++ head/sys/cam/scsi/scsi_all.h	Fri Jul 26 03:49:16 2019	(r350346)
@@ -568,6 +568,7 @@ struct scsi_log_sense
 #define	SLS_ERROR_NONMEDIUM_PAGE	0x06
 #define	SLS_ERROR_LASTN_PAGE		0x07
 #define	SLS_LOGICAL_BLOCK_PROVISIONING	0x0c
+#define	SLS_TEMPERATURE			0x0d
 #define	SLS_SELF_TEST_PAGE		0x10
 #define	SLS_SOLID_STATE_MEDIA		0x11
 #define	SLS_STAT_AND_PERF		0x19
@@ -680,6 +681,14 @@ struct scsi_log_informational_exceptions {
 #define	SLP_IE_GEN			0x0000
 	uint8_t	ie_asc;
 	uint8_t	ie_ascq;
+	uint8_t	temperature;
+};
+
+struct scsi_log_temperature {
+	struct scsi_log_param_header hdr;
+#define	SLP_TEMPERATURE			0x0000
+#define	SLP_REFTEMPERATURE		0x0001
+	uint8_t	reserved;
 	uint8_t	temperature;
 };
 

Modified: head/usr.sbin/ctladm/ctladm.8
==============================================================================
--- head/usr.sbin/ctladm/ctladm.8	Fri Jul 26 02:49:34 2019	(r350345)
+++ head/usr.sbin/ctladm/ctladm.8	Fri Jul 26 03:49:16 2019	(r350346)
@@ -36,7 +36,7 @@
 .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $
 .\" $FreeBSD$
 .\"
-.Dd May 10, 2018
+.Dd July 25, 2019
 .Dt CTLADM 8
 .Os
 .Sh NAME
@@ -918,6 +918,9 @@ Specifies medium rotation rate of the device: 0 -- not
 .It Va formfactor
 Specifies nominal form factor of the device: 0 -- not reported, 1 -- 5.25",
 2 -- 3.5", 3 -- 2.5", 4 -- 1.8", 5 -- less then 1.8".
+.It Va temperature
+.It Va reftemperature
+Specify current and reference (maximum) temperatures of the device.
 .It Va provisioning_type
 When UNMAP support is enabled, this option specifies provisioning type:
 "resource", "thin" or "unknown".

From owner-svn-src-head@freebsd.org  Fri Jul 26 05:07:10 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1CB49B6686;
 Fri, 26 Jul 2019 05:07:10 +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 BE67E76D44;
 Fri, 26 Jul 2019 05:07:09 +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 98112A145;
 Fri, 26 Jul 2019 05:07:09 +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 x6Q579II099087;
 Fri, 26 Jul 2019 05:07:09 GMT (envelope-from alc@FreeBSD.org)
Received: (from alc@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6Q579p3099086;
 Fri, 26 Jul 2019 05:07:09 GMT (envelope-from alc@FreeBSD.org)
Message-Id: <201907260507.x6Q579p3099086@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org
 using -f
From: Alan Cox <alc@FreeBSD.org>
Date: Fri, 26 Jul 2019 05:07:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350347 - 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: 350347
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: BE67E76D44
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.961,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jul 2019 05:07:10 -0000

Author: alc
Date: Fri Jul 26 05:07:09 2019
New Revision: 350347
URL: https://svnweb.freebsd.org/changeset/base/350347

Log:
  Implement pmap_advise().  (Without a working pmap_advise() implementation
  madvise(MADV_DONTNEED) and madvise(MADV_FREE) are NOPs.)
  
  Reviewed by:	markj
  X-MFC after:	r350004
  Differential Revision:	https://reviews.freebsd.org/D21062

Modified:
  head/sys/arm64/arm64/pmap.c

Modified: head/sys/arm64/arm64/pmap.c
==============================================================================
--- head/sys/arm64/arm64/pmap.c	Fri Jul 26 03:49:16 2019	(r350346)
+++ head/sys/arm64/arm64/pmap.c	Fri Jul 26 05:07:09 2019	(r350347)
@@ -2499,7 +2499,7 @@ pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_
 /*
  * pmap_remove_l3: do the things to unmap a page in a process
  */
-static int __unused
+static int
 pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_t va,
     pd_entry_t l2e, struct spglist *free, struct rwlock **lockp)
 {
@@ -4839,6 +4839,110 @@ out:
 void
 pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, int advice)
 {
+	struct rwlock *lock;
+	vm_offset_t va, va_next;
+	vm_page_t m;
+	pd_entry_t *l0, *l1, *l2, oldl2;
+	pt_entry_t *l3, oldl3;
+
+	if (advice != MADV_DONTNEED && advice != MADV_FREE)
+		return;
+
+	PMAP_LOCK(pmap);
+	for (; sva < eva; sva = va_next) {
+		l0 = pmap_l0(pmap, sva);
+		if (pmap_load(l0) == 0) {
+			va_next = (sva + L0_SIZE) & ~L0_OFFSET;
+			if (va_next < sva)
+				va_next = eva;
+			continue;
+		}
+		l1 = pmap_l0_to_l1(l0, sva);
+		if (pmap_load(l1) == 0) {
+			va_next = (sva + L1_SIZE) & ~L1_OFFSET;
+			if (va_next < sva)
+				va_next = eva;
+			continue;
+		}
+		va_next = (sva + L2_SIZE) & ~L2_OFFSET;
+		if (va_next < sva)
+			va_next = eva;
+		l2 = pmap_l1_to_l2(l1, sva);
+		oldl2 = pmap_load(l2);
+		if (oldl2 == 0)
+			continue;
+		if ((oldl2 & ATTR_DESCR_MASK) == L2_BLOCK) {
+			if ((oldl2 & ATTR_SW_MANAGED) == 0)
+				continue;
+			lock = NULL;
+			if (!pmap_demote_l2_locked(pmap, l2, sva, &lock)) {
+				if (lock != NULL)
+					rw_wunlock(lock);
+
+				/*
+				 * The 2MB page mapping was destroyed.
+				 */
+				continue;
+			}
+
+			/*
+			 * Unless the page mappings are wired, remove the
+			 * mapping to a single page so that a subsequent
+			 * access may repromote.  Since the underlying page
+			 * table page is fully populated, this removal never
+			 * frees a page table page.
+			 */
+			if ((oldl2 & ATTR_SW_WIRED) == 0) {
+				l3 = pmap_l2_to_l3(l2, sva);
+				KASSERT(pmap_load(l3) != 0,
+				    ("pmap_advise: invalid PTE"));
+				pmap_remove_l3(pmap, l3, sva, pmap_load(l2),
+				    NULL, &lock);
+			}
+			if (lock != NULL)
+				rw_wunlock(lock);
+		}
+		KASSERT((pmap_load(l2) & ATTR_DESCR_MASK) == L2_TABLE,
+		    ("pmap_advise: invalid L2 entry after demotion"));
+		if (va_next > eva)
+			va_next = eva;
+		va = va_next;
+		for (l3 = pmap_l2_to_l3(l2, sva); sva != va_next; l3++,
+		    sva += L3_SIZE) {
+			oldl3 = pmap_load(l3);
+			if ((oldl3 & (ATTR_SW_MANAGED | ATTR_DESCR_MASK)) !=
+			    (ATTR_SW_MANAGED | L3_PAGE))
+				goto maybe_invlrng;
+			else if (pmap_pte_dirty(oldl3)) {
+				if (advice == MADV_DONTNEED) {
+					/*
+					 * Future calls to pmap_is_modified()
+					 * can be avoided by making the page
+					 * dirty now.
+					 */
+					m = PHYS_TO_VM_PAGE(oldl3 & ~ATTR_MASK);
+					vm_page_dirty(m);
+				}
+				while (!atomic_fcmpset_long(l3, &oldl3,
+				    (oldl3 & ~ATTR_AF) | ATTR_AP(ATTR_AP_RO)))
+					cpu_spinwait();
+			} else if ((oldl3 & ATTR_AF) != 0)
+				pmap_clear_bits(l3, ATTR_AF);
+			else
+				goto maybe_invlrng;
+			if (va == va_next)
+				va = sva;
+			continue;
+maybe_invlrng:
+			if (va != va_next) {
+				pmap_invalidate_range(pmap, va, sva);
+				va = va_next;
+			}
+		}
+		if (va != va_next)
+			pmap_invalidate_range(pmap, va, sva);
+	}
+	PMAP_UNLOCK(pmap);
 }
 
 /*

From owner-svn-src-head@freebsd.org  Fri Jul 26 06:55:09 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41509B8255;
 Fri, 26 Jul 2019 06:55:09 +0000 (UTC)
 (envelope-from gljennjohn@gmail.com)
Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com
 [IPv6:2a00:1450:4864:20::32d])
 (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 D3A3D822F7;
 Fri, 26 Jul 2019 06:55:07 +0000 (UTC)
 (envelope-from gljennjohn@gmail.com)
Received: by mail-wm1-x32d.google.com with SMTP id f17so46685915wme.2;
 Thu, 25 Jul 2019 23:55:07 -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=Fl/L4ru8gLrQhoDwYZB052B1kD5il6xk31MNh3Nqxes=;
 b=K8yh1vyFkY0W5a5cuAfyLsPCJjpD3kt/I5tKZGteHZlb1KkOrJv20gdWgNifePaZ6+
 63KcndA8rXQ5YGR+Kq7qM3/G1e2oS5hsfEW5s7rMd4X8HNIetn1P3MTjFFEWoIJP1k8I
 zzVfmbl+7tVkok7C7I5hIdmtG84kmnoCOGK3rXBGHnoTIVDnDzFnO2I/ttnOBWMQu6Cv
 /IHX/A/QDNWTRaw1BYy7OvZT14KAgeEEoJj4LTOgiwub+pcO7FI5iLTkN/qojUQWSqO0
 RPoyjyoawOtwM0KgbMQXxL8pVWsrfnZ7zdLKblVVRSSoOxXVjgWZ78fNXIg3UcFXDPI4
 7MAw==
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=Fl/L4ru8gLrQhoDwYZB052B1kD5il6xk31MNh3Nqxes=;
 b=LZ6M5VwYnyb5COPM5WeCGTvSyttNVrSW3+0bqHHeiI82gqpmZ/GOaN3vecqWJzo7Ef
 dWfWs5UBXAbHniG0O+F1h2jz6ZHQacIx3R3BHaHWpmdIr0k/AZALCERkelGHNCkPp/Ph
 oqtCtP9s6AMp2dsPWvv6PV+yo8i7Mv73wBBgfd0M49cHBPgp2D+Cbkqa7TrP4rqb9QD5
 fD+Hnzfh8gYgMGZ0W75qZR9p3jHjC6awunbn9mLs7s7iA8yKH6JC0+BSsXRDbIEoJL26
 xZx/nbB+WYsWFIr0fqXz2a7mGBn0QPjHQT7xh7/6wJyNaVgMnyAaozjK2yf7km73dOFe
 Docw==
X-Gm-Message-State: APjAAAVNXeyXzWpswLuHQQ3i0AWnTqbmWmuRJ677C9MbslQLUFKZG8Rv
 EbzdtTh5AGCJUj5RQW/yO195zeE3
X-Google-Smtp-Source: APXvYqyk8oUMOlY+m3cNUttc6gg9CBIbSOjs9A9ndfZS13TCs5pdPEtAVtRMwNlWbgOw8KVeTt1JAg==
X-Received: by 2002:a1c:2302:: with SMTP id j2mr80581505wmj.174.1564124106601; 
 Thu, 25 Jul 2019 23:55:06 -0700 (PDT)
Received: from ernst.home (p5B023CEA.dip0.t-ipconnect.de. [91.2.60.234])
 by smtp.gmail.com with ESMTPSA id j17sm79387716wrb.35.2019.07.25.23.55.05
 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
 Thu, 25 Jul 2019 23:55:05 -0700 (PDT)
Date: Fri, 26 Jul 2019 08:55:04 +0200
From: Gary Jennejohn <gljennjohn@gmail.com>
To: Ian Lepore <ian@freebsd.org>
Cc: Renato Botelho <garga@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject: Re: svn commit: r349976 - head
Message-ID: <20190726085504.50e4563c@ernst.home>
In-Reply-To: <62945ba288b96e431b5053167ab8c23f192bcbed.camel@freebsd.org>
References: <201907131648.x6DGmRc4090395@repo.freebsd.org>
 <a1a7c5e9-4bb4-68a8-9fc6-254b1795a589@FreeBSD.org>
 <62945ba288b96e431b5053167ab8c23f192bcbed.camel@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: D3A3D822F7
X-Spamd-Bar: ------
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=gmail.com header.s=20161025 header.b=K8yh1vyF;
 dmarc=pass (policy=none) header.from=gmail.com;
 spf=pass (mx1.freebsd.org: domain of gljennjohn@gmail.com designates
 2a00:1450:4864:20::32d as permitted sender)
 smtp.mailfrom=gljennjohn@gmail.com
X-Spamd-Result: default: False [-6.68 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[];
 HAS_REPLYTO(0.00)[gljennjohn@gmail.com]; TO_DN_SOME(0.00)[];
 R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36];
 FREEMAIL_FROM(0.00)[gmail.com]; REPLYTO_ADDR_EQ_FROM(0.00)[];
 RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3];
 MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com];
 DKIM_TRACE(0.00)[gmail.com:+];
 DMARC_POLICY_ALLOW(-0.50)[gmail.com,none];
 NEURAL_HAM_SHORT(-0.73)[-0.730,0]; FROM_EQ_ENVFROM(0.00)[];
 IP_SCORE(-2.94)[ip: (-9.21), ipnet: 2a00:1450::/32(-3.02), asn: 15169(-2.44),
 country: US(-0.05)]; MIME_TRACE(0.00)[0:+];
 FREEMAIL_ENVFROM(0.00)[gmail.com];
 ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US];
 DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0];
 ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0];
 R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[];
 TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0];
 MIME_GOOD(-0.10)[text/plain];
 FREEMAIL_REPLYTO(0.00)[gmail.com]; RCVD_TLS_LAST(0.00)[];
 RCVD_IN_DNSWL_NONE(0.00)[d.2.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org
 : 127.0.5.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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jul 2019 06:55:09 -0000

On Thu, 25 Jul 2019 09:32:15 -0600
Ian Lepore <ian@freebsd.org> wrote:

> On Thu, 2019-07-25 at 10:27 -0300, Renato Botelho wrote:
> > On 13/07/19 13:48, Ian Lepore wrote:  
> > > 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.    
> > 
> > Block is indented with 4 spaces instead of tabs
> >   
> 
> Doh!  Must've still had my editor set for the $work coding standards. 
> Fixed in r350324.  Thanks!
> 

I just looked at UPDATING (/usr/src is at r350348) and this
is the only entry which wraps on a 80 character wide terminal.

-- 
Gary Jennejohn

From owner-svn-src-head@freebsd.org  Fri Jul 26 10:00:36 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD322BB8E8;
 Fri, 26 Jul 2019 10:00:36 +0000 (UTC)
 (envelope-from bapt@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 C511388874;
 Fri, 26 Jul 2019 10:00:36 +0000 (UTC)
 (envelope-from bapt@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 B6953D6C3;
 Fri, 26 Jul 2019 10:00:36 +0000 (UTC)
 (envelope-from bapt@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6QA0auf070649;
 Fri, 26 Jul 2019 10:00:36 GMT (envelope-from bapt@FreeBSD.org)
Received: (from bapt@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6QA0YSN070635;
 Fri, 26 Jul 2019 10:00:34 GMT (envelope-from bapt@FreeBSD.org)
Message-Id: <201907261000.x6QA0YSN070635@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: bapt set sender to
 bapt@FreeBSD.org using -f
From: Baptiste Daroussin <bapt@FreeBSD.org>
Date: Fri, 26 Jul 2019 10:00:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350351 - head/contrib/mandoc
X-SVN-Group: head
X-SVN-Commit-Author: bapt
X-SVN-Commit-Paths: head/contrib/mandoc
X-SVN-Commit-Revision: 350351
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: C511388874
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.941,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jul 2019 10:00:36 -0000

Author: bapt
Date: Fri Jul 26 10:00:33 2019
New Revision: 350351
URL: https://svnweb.freebsd.org/changeset/base/350351

Log:
  Update mandoc to cvs snapshot 2019-07-23
  
  This snapshot among other things includes a fix for a crash of mandoc with empty
  tbl reported by rea@ (his regression test has been incorporated upstream)
  
  MFC after:	3 weeks

Deleted:
  head/contrib/mandoc/libroff.h
Modified:
  head/contrib/mandoc/Makefile.depend
  head/contrib/mandoc/TODO
  head/contrib/mandoc/arch.c
  head/contrib/mandoc/cgi.c
  head/contrib/mandoc/configure
  head/contrib/mandoc/dbm.c
  head/contrib/mandoc/dbm_map.h
  head/contrib/mandoc/eqn.7
  head/contrib/mandoc/eqn_html.c
  head/contrib/mandoc/html.c
  head/contrib/mandoc/html.h
  head/contrib/mandoc/lib.in
  head/contrib/mandoc/main.c
  head/contrib/mandoc/man.7
  head/contrib/mandoc/man_html.c
  head/contrib/mandoc/man_term.c
  head/contrib/mandoc/man_validate.c
  head/contrib/mandoc/mandoc.1
  head/contrib/mandoc/mandoc.c
  head/contrib/mandoc/mandoc.css
  head/contrib/mandoc/mandoc.h
  head/contrib/mandoc/mandoc_char.7
  head/contrib/mandoc/mandoc_headers.3
  head/contrib/mandoc/mandoc_msg.c
  head/contrib/mandoc/mandocdb.c
  head/contrib/mandoc/manpath.c
  head/contrib/mandoc/mansearch.c
  head/contrib/mandoc/mansearch.h
  head/contrib/mandoc/mdoc.7
  head/contrib/mandoc/mdoc_argv.c
  head/contrib/mandoc/mdoc_markdown.c
  head/contrib/mandoc/mdoc_term.c
  head/contrib/mandoc/mdoc_validate.c
  head/contrib/mandoc/out.c
  head/contrib/mandoc/read.c
  head/contrib/mandoc/roff.7
  head/contrib/mandoc/roff.c
  head/contrib/mandoc/roff_html.c
  head/contrib/mandoc/tag.c
  head/contrib/mandoc/tbl_html.c
  head/contrib/mandoc/tbl_term.c
  head/contrib/mandoc/term.c
Directory Properties:
  head/contrib/mandoc/   (props changed)

Modified: head/contrib/mandoc/Makefile.depend
==============================================================================
--- head/contrib/mandoc/Makefile.depend	Fri Jul 26 09:53:21 2019	(r350350)
+++ head/contrib/mandoc/Makefile.depend	Fri Jul 26 10:00:33 2019	(r350351)
@@ -29,7 +29,7 @@ dbm.o: dbm.c config.h mansearch.h dbm_map.h dbm.h
 dbm_map.o: dbm_map.c config.h mansearch.h dbm_map.h dbm.h
 demandoc.o: demandoc.c config.h mandoc.h roff.h man.h mdoc.h mandoc_parse.h
 eqn.o: eqn.c config.h mandoc_aux.h mandoc.h roff.h eqn.h libmandoc.h eqn_parse.h
-eqn_html.o: eqn_html.c config.h mandoc.h eqn.h out.h html.h
+eqn_html.o: eqn_html.c config.h mandoc.h roff.h eqn.h out.h html.h
 eqn_term.o: eqn_term.c config.h eqn.h out.h term.h
 html.o: html.c config.h mandoc_aux.h mandoc_ohash.h compat_ohash.h mandoc.h roff.h out.h html.h manconf.h main.h
 lib.o: lib.c config.h roff.h libmdoc.h lib.in
@@ -37,16 +37,16 @@ main.o: main.c config.h mandoc_aux.h mandoc.h mandoc_x
 man.o: man.c config.h mandoc_aux.h mandoc.h roff.h man.h libmandoc.h roff_int.h libman.h
 man_html.o: man_html.c config.h mandoc_aux.h mandoc.h roff.h man.h out.h html.h main.h
 man_macro.o: man_macro.c config.h mandoc.h roff.h man.h libmandoc.h roff_int.h libman.h
-man_term.o: man_term.c config.h mandoc_aux.h roff.h man.h out.h term.h main.h
+man_term.o: man_term.c config.h mandoc_aux.h mandoc.h roff.h man.h out.h term.h tag.h main.h
 man_validate.o: man_validate.c config.h mandoc_aux.h mandoc.h roff.h man.h libmandoc.h roff_int.h libman.h
 mandoc.o: mandoc.c config.h mandoc_aux.h mandoc.h roff.h libmandoc.h roff_int.h
 mandoc_aux.o: mandoc_aux.c config.h mandoc.h mandoc_aux.h
-mandoc_msg.o: mandoc_msg.c mandoc.h
+mandoc_msg.o: mandoc_msg.c config.h mandoc.h
 mandoc_ohash.o: mandoc_ohash.c mandoc_aux.h mandoc_ohash.h compat_ohash.h
 mandoc_xr.o: mandoc_xr.c mandoc_aux.h mandoc_ohash.h compat_ohash.h mandoc_xr.h
 mandocd.o: mandocd.c config.h mandoc.h roff.h mdoc.h man.h mandoc_parse.h main.h manconf.h
 mandocdb.o: mandocdb.c config.h compat_fts.h mandoc_aux.h mandoc_ohash.h compat_ohash.h mandoc.h roff.h mdoc.h man.h mandoc_parse.h manconf.h mansearch.h dba_array.h dba.h
-manpath.o: manpath.c config.h mandoc_aux.h manconf.h
+manpath.o: manpath.c config.h mandoc_aux.h mandoc.h manconf.h
 mansearch.o: mansearch.c config.h mandoc_aux.h mandoc_ohash.h compat_ohash.h manconf.h mansearch.h dbm.h
 mdoc.o: mdoc.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h libmandoc.h roff_int.h libmdoc.h
 mdoc_argv.o: mdoc_argv.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h libmandoc.h roff_int.h libmdoc.h
@@ -67,10 +67,10 @@ roff_term.o: roff_term.c mandoc.h roff.h out.h term.h
 roff_validate.o: roff_validate.c mandoc.h roff.h libmandoc.h roff_int.h
 soelim.o: soelim.c config.h compat_stringlist.h
 st.o: st.c config.h mandoc.h roff.h libmdoc.h
-tag.o: tag.c config.h mandoc_aux.h mandoc_ohash.h compat_ohash.h tag.h
+tag.o: tag.c config.h mandoc_aux.h mandoc_ohash.h compat_ohash.h mandoc.h tag.h
 tbl.o: tbl.c config.h mandoc_aux.h mandoc.h tbl.h libmandoc.h tbl_parse.h tbl_int.h
 tbl_data.o: tbl_data.c config.h mandoc_aux.h mandoc.h tbl.h libmandoc.h tbl_int.h
-tbl_html.o: tbl_html.c config.h mandoc.h tbl.h out.h html.h
+tbl_html.o: tbl_html.c config.h mandoc.h roff.h tbl.h out.h html.h
 tbl_layout.o: tbl_layout.c config.h mandoc_aux.h mandoc.h tbl.h libmandoc.h tbl_int.h
 tbl_opts.o: tbl_opts.c config.h mandoc.h tbl.h libmandoc.h tbl_int.h
 tbl_term.o: tbl_term.c config.h mandoc.h tbl.h out.h term.h

Modified: head/contrib/mandoc/TODO
==============================================================================
--- head/contrib/mandoc/TODO	Fri Jul 26 09:53:21 2019	(r350350)
+++ head/contrib/mandoc/TODO	Fri Jul 26 10:00:33 2019	(r350351)
@@ -1,6 +1,6 @@
 ************************************************************************
 * Official mandoc TODO.
-* $Id: TODO,v 1.289 2019/03/04 13:01:57 schwarze Exp $
+* $Id: TODO,v 1.295 2019/06/11 16:04:36 schwarze Exp $
 ************************************************************************
 
 Many issues are annotated for difficulty as follows:
@@ -62,6 +62,27 @@ are mere guesses, and some may be wrong.
   needed for Tcl_NewStringObj(3) via wiz@  Wed, 5 Mar 2014 22:27:43 +0100
   loc **  exist ***  algo ***  size *  imp ***
 
+- .als only works for macros in mandoc, not for user-defined strings.
+  Also, the "val" field in struct roffkv would have to be replaced
+  with a pointer to a reference-counted wrapper, and an alias
+  would have to point to the same wrapper as the original.
+  .als to undefined does nothing; the alias is not created.
+  .rm'ing the original leaves the alias to point to the old value.
+  .de .als .de changes both, but
+  .de .als .rm .de only changes the new value, not the alias.
+  Found in groffer(1) version 1.19
+  Jan Stary 20 Apr 2019 20:16:54 +0200
+  loc *  exist **  algo **  size **  imp *
+
+- roff string condition comparisons fail when vars contain quotes:
+  .ds s '
+  .if '\*s'' \&...
+  hard to fix because of the basic architecture (string replacement
+  happens before roff(7) syntax parsing)
+  Found in groffer(1) version 1.19
+  Jan Stary 20 Apr 2019 20:16:54 +0200
+  loc *  exist ***  algo ***  size **  imp *
+
 --- missing mdoc features ----------------------------------------------
 
 - .Bl -column .Xo support is missing
@@ -263,6 +284,9 @@ are mere guesses, and some may be wrong.
   http://ikiwiki.info/plugins/contrib/mandoc/
   https://github.com/schmonz/ikiwiki/compare/mandoc
   Amitai Schlair  Mon, 19 May 2014 14:05:53 -0400
+
+- check compatibility with
+  https://git.sr.ht/~sircmpwn/scdoc
 
 - check features of the Slackware man.conf(5) format
   Carsten Kunze  Wed, 11 Mar 2015 17:57:24 +0100

Modified: head/contrib/mandoc/arch.c
==============================================================================
--- head/contrib/mandoc/arch.c	Fri Jul 26 09:53:21 2019	(r350350)
+++ head/contrib/mandoc/arch.c	Fri Jul 26 10:00:33 2019	(r350351)
@@ -1,4 +1,4 @@
-/*	$Id: arch.c,v 1.14 2019/03/04 13:01:57 schwarze Exp $ */
+/*	$Id: arch.c,v 1.15 2019/05/21 07:52:00 schwarze Exp $ */
 /*
  * Copyright (c) 2017, 2019 Ingo Schwarze <schwarze@openbsd.org>
  *
@@ -26,7 +26,7 @@ arch_valid(const char *arch, enum mandoc_os os)
 	const char *openbsd_arch[] = {
 		"alpha", "amd64", "arm64", "armv7", "hppa", "i386",
 		"landisk", "loongson", "luna88k", "macppc", "mips64",
-		"octeon", "sgi", "socppc", "sparc64", NULL
+		"octeon", "sgi", "sparc64", NULL
 	};
 	const char *netbsd_arch[] = {
 		"acorn26", "acorn32", "algor", "alpha", "amiga",

Modified: head/contrib/mandoc/cgi.c
==============================================================================
--- head/contrib/mandoc/cgi.c	Fri Jul 26 09:53:21 2019	(r350350)
+++ head/contrib/mandoc/cgi.c	Fri Jul 26 10:00:33 2019	(r350351)
@@ -1,4 +1,4 @@
-/*	$Id: cgi.c,v 1.166 2019/03/06 12:32:41 schwarze Exp $ */
+/*	$Id: cgi.c,v 1.167 2019/07/10 12:49:20 schwarze Exp $ */
 /*
  * Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2014, 2015, 2016, 2017, 2018 Ingo Schwarze <schwarze@usta.de>
@@ -869,7 +869,6 @@ resp_format(const struct req *req, const char *file)
 	memset(&conf, 0, sizeof(conf));
 	conf.fragment = 1;
 	conf.style = mandoc_strdup(CSS_DIR "/mandoc.css");
-	conf.toc = 1;
 	usepath = strcmp(req->q.manpath, req->p[0]);
 	mandoc_asprintf(&conf.man, "/%s%s%s%s%%N.%%S",
 	    scriptname, *scriptname == '\0' ? "" : "/",

Modified: head/contrib/mandoc/configure
==============================================================================
--- head/contrib/mandoc/configure	Fri Jul 26 09:53:21 2019	(r350350)
+++ head/contrib/mandoc/configure	Fri Jul 26 10:00:33 2019	(r350351)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Id: configure,v 1.70 2019/03/06 16:04:31 schwarze Exp $
+# $Id: configure,v 1.71 2019/07/01 22:56:24 schwarze Exp $
 #
 # Copyright (c) 2014-2019 Ingo Schwarze <schwarze@openbsd.org>
 #
@@ -529,7 +529,7 @@ fi
 	echo "extern	char	 *mkdtemp(char *);"
 
 if [ ${HAVE_PROGNAME} -eq 0 ]; then
-	echo "extern 	const char *getprogname(void);"
+	echo "extern	const char *getprogname(void);"
 	echo "extern	void	  setprogname(const char *);"
 fi
 

Modified: head/contrib/mandoc/dbm.c
==============================================================================
--- head/contrib/mandoc/dbm.c	Fri Jul 26 09:53:21 2019	(r350350)
+++ head/contrib/mandoc/dbm.c	Fri Jul 26 10:00:33 2019	(r350351)
@@ -1,4 +1,4 @@
-/*	$Id: dbm.c,v 1.6 2018/11/19 19:22:07 schwarze Exp $ */
+/*	$Id: dbm.c,v 1.7 2019/07/01 22:56:24 schwarze Exp $ */
 /*
  * Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
  *
@@ -233,7 +233,7 @@ static struct dbm_res
 page_bytitle(enum iter arg_iter, const struct dbm_match *arg_match)
 {
 	static const struct dbm_match	*match;
-	static const char		*cp;	
+	static const char		*cp;
 	static int32_t			 ip;
 	struct dbm_res			 res = {-1, 0};
 
@@ -315,7 +315,7 @@ page_byarch(const struct dbm_match *arg_match)
 	static const struct dbm_match	*match;
 	struct dbm_res			 res = {-1, 0};
 	static int32_t			 ip;
-	const char			*cp;	
+	const char			*cp;
 
 	/* Initialize for a new iteration. */
 

Modified: head/contrib/mandoc/dbm_map.h
==============================================================================
--- head/contrib/mandoc/dbm_map.h	Fri Jul 26 09:53:21 2019	(r350350)
+++ head/contrib/mandoc/dbm_map.h	Fri Jul 26 10:00:33 2019	(r350351)
@@ -1,4 +1,4 @@
-/*	$Id: dbm_map.h,v 1.1 2016/07/19 21:31:55 schwarze Exp $ */
+/*	$Id: dbm_map.h,v 1.2 2019/07/01 22:56:24 schwarze Exp $ */
 /*
  * Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
  *
@@ -14,7 +14,7 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * Private interface for low-level routines for the map-based version 
+ * Private interface for low-level routines for the map-based version
  * of the mandoc database, for read-only access.
  * To be used by dbm*.c only.
  */

Modified: head/contrib/mandoc/eqn.7
==============================================================================
--- head/contrib/mandoc/eqn.7	Fri Jul 26 09:53:21 2019	(r350350)
+++ head/contrib/mandoc/eqn.7	Fri Jul 26 10:00:33 2019	(r350351)
@@ -1,4 +1,4 @@
-.\"	$Id: eqn.7,v 1.37 2017/09/04 10:35:27 schwarze Exp $
+.\"	$Id: eqn.7,v 1.38 2019/04/23 17:57:49 schwarze Exp $
 .\"
 .\" Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
 .\" Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd $Mdocdate: September 4 2017 $
+.Dd $Mdocdate: April 23 2019 $
 .Dt EQN 7
 .Os
 .Sh NAME
@@ -470,7 +470,7 @@ commands are also ignored.
 .%T System for Typesetting Mathematics
 .%J Communications of the ACM
 .%V 18
-.%P 151\(en157
+.%P pp. 151\(en157
 .%D March, 1975
 .Re
 .Rs

Modified: head/contrib/mandoc/eqn_html.c
==============================================================================
--- head/contrib/mandoc/eqn_html.c	Fri Jul 26 09:53:21 2019	(r350350)
+++ head/contrib/mandoc/eqn_html.c	Fri Jul 26 10:00:33 2019	(r350351)
@@ -1,4 +1,4 @@
-/*	$Id: eqn_html.c,v 1.18 2018/12/13 05:23:38 schwarze Exp $ */
+/*	$Id: eqn_html.c,v 1.19 2019/03/17 18:21:45 schwarze Exp $ */
 /*
  * Copyright (c) 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -26,6 +26,7 @@
 #include <string.h>
 
 #include "mandoc.h"
+#include "roff.h"
 #include "eqn.h"
 #include "out.h"
 #include "html.h"

Modified: head/contrib/mandoc/html.c
==============================================================================
--- head/contrib/mandoc/html.c	Fri Jul 26 09:53:21 2019	(r350350)
+++ head/contrib/mandoc/html.c	Fri Jul 26 10:00:33 2019	(r350351)
@@ -1,4 +1,4 @@
-/*	$Id: html.c,v 1.254 2019/03/03 13:02:11 schwarze Exp $ */
+/*	$Id: html.c,v 1.255 2019/04/30 15:53:00 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2011-2015, 2017-2019 Ingo Schwarze <schwarze@openbsd.org>
@@ -120,6 +120,7 @@ static	void	 print_ctag(struct html *, struct tag *);
 static	int	 print_escape(struct html *, char);
 static	int	 print_encode(struct html *, const char *, const char *, int);
 static	void	 print_href(struct html *, const char *, const char *, int);
+static	void	 print_metaf(struct html *);
 
 
 void *
@@ -222,55 +223,49 @@ print_gen_head(struct html *h)
 	print_tagq(h, t);
 }
 
-void
-print_metaf(struct html *h, enum mandoc_esc deco)
+int
+html_setfont(struct html *h, enum mandoc_esc font)
 {
-	enum htmlfont	 font;
-
-	switch (deco) {
+	switch (font) {
 	case ESCAPE_FONTPREV:
 		font = h->metal;
 		break;
 	case ESCAPE_FONTITALIC:
-		font = HTMLFONT_ITALIC;
-		break;
 	case ESCAPE_FONTBOLD:
-		font = HTMLFONT_BOLD;
-		break;
 	case ESCAPE_FONTBI:
-		font = HTMLFONT_BI;
-		break;
 	case ESCAPE_FONTCW:
-		font = HTMLFONT_CW;
+	case ESCAPE_FONTROMAN:
 		break;
 	case ESCAPE_FONT:
-	case ESCAPE_FONTROMAN:
-		font = HTMLFONT_NONE;
+		font = ESCAPE_FONTROMAN;
 		break;
 	default:
-		return;
+		return 0;
 	}
+	h->metal = h->metac;
+	h->metac = font;
+	return 1;
+}
 
+static void
+print_metaf(struct html *h)
+{
 	if (h->metaf) {
 		print_tagq(h, h->metaf);
 		h->metaf = NULL;
 	}
-
-	h->metal = h->metac;
-	h->metac = font;
-
-	switch (font) {
-	case HTMLFONT_ITALIC:
+	switch (h->metac) {
+	case ESCAPE_FONTITALIC:
 		h->metaf = print_otag(h, TAG_I, "");
 		break;
-	case HTMLFONT_BOLD:
+	case ESCAPE_FONTBOLD:
 		h->metaf = print_otag(h, TAG_B, "");
 		break;
-	case HTMLFONT_BI:
+	case ESCAPE_FONTBI:
 		h->metaf = print_otag(h, TAG_B, "");
 		print_otag(h, TAG_I, "");
 		break;
-	case HTMLFONT_CW:
+	case ESCAPE_FONTCW:
 		h->metaf = print_otag(h, TAG_SPAN, "c", "Li");
 		break;
 	default:
@@ -479,7 +474,8 @@ print_encode(struct html *h, const char *p, const char
 		case ESCAPE_FONTROMAN:
 			if (0 == norecurse) {
 				h->flags |= HTML_NOSPACE;
-				print_metaf(h, esc);
+				if (html_setfont(h, esc))
+					print_metaf(h);
 				h->flags &= ~HTML_NOSPACE;
 			}
 			continue;
@@ -806,27 +802,9 @@ print_text(struct html *h, const char *word)
 			print_word(h, "&#x00A0;");
 	}
 
-	assert(NULL == h->metaf);
-	switch (h->metac) {
-	case HTMLFONT_ITALIC:
-		h->metaf = print_otag(h, TAG_I, "");
-		break;
-	case HTMLFONT_BOLD:
-		h->metaf = print_otag(h, TAG_B, "");
-		break;
-	case HTMLFONT_BI:
-		h->metaf = print_otag(h, TAG_B, "");
-		print_otag(h, TAG_I, "");
-		break;
-	case HTMLFONT_CW:
-		h->metaf = print_otag(h, TAG_SPAN, "c", "Li");
-		break;
-	default:
-		print_indent(h);
-		break;
-	}
-
-	assert(word);
+	assert(h->metaf == NULL);
+	print_metaf(h);
+	print_indent(h);
 	if ( ! print_encode(h, word, NULL, 0)) {
 		if ( ! (h->flags & HTML_NONOSPACE))
 			h->flags &= ~HTML_NOSPACE;
@@ -834,7 +812,7 @@ print_text(struct html *h, const char *word)
 	} else
 		h->flags |= HTML_NOSPACE | HTML_NONEWLINE;
 
-	if (h->metaf) {
+	if (h->metaf != NULL) {
 		print_tagq(h, h->metaf);
 		h->metaf = NULL;
 	}

Modified: head/contrib/mandoc/html.h
==============================================================================
--- head/contrib/mandoc/html.h	Fri Jul 26 09:53:21 2019	(r350350)
+++ head/contrib/mandoc/html.h	Fri Jul 26 10:00:33 2019	(r350351)
@@ -1,4 +1,4 @@
-/*	$Id: html.h,v 1.102 2019/03/01 10:57:18 schwarze Exp $ */
+/*	$Id: html.h,v 1.103 2019/04/30 15:53:00 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2017, 2018, 2019 Ingo Schwarze <schwarze@openbsd.org>
@@ -69,15 +69,6 @@ enum	htmltag {
 	TAG_MAX
 };
 
-enum	htmlfont {
-	HTMLFONT_NONE = 0,
-	HTMLFONT_BOLD,
-	HTMLFONT_ITALIC,
-	HTMLFONT_BI,
-	HTMLFONT_CW,
-	HTMLFONT_MAX
-};
-
 struct	tag {
 	struct tag	 *next;
 	int		  refcnt;
@@ -111,8 +102,8 @@ struct	html {
 	char		 *base_includes; /* base for include href */
 	char		 *style; /* style-sheet URI */
 	struct tag	 *metaf; /* current open font scope */
-	enum htmlfont	  metal; /* last used font */
-	enum htmlfont	  metac; /* current font mode */
+	enum mandoc_esc	  metal; /* last used font */
+	enum mandoc_esc	  metac; /* current font mode */
 	int		  oflags; /* output options */
 #define	HTML_FRAGMENT	 (1 << 0) /* don't emit HTML/HEAD/BODY */
 #define	HTML_TOC	 (1 << 1) /* emit a table of contents */
@@ -128,7 +119,6 @@ void		  roff_html_pre(struct html *, const struct roff
 void		  print_gen_comment(struct html *, struct roff_node *);
 void		  print_gen_decls(struct html *);
 void		  print_gen_head(struct html *);
-void		  print_metaf(struct html *, enum mandoc_esc);
 struct tag	 *print_otag(struct html *, enum htmltag, const char *, ...);
 void		  print_tagq(struct html *, const struct tag *);
 void		  print_stagq(struct html *, const struct tag *);
@@ -141,3 +131,4 @@ void		  print_endline(struct html *);
 void		  html_close_paragraph(struct html *);
 enum roff_tok	  html_fillmode(struct html *, enum roff_tok);
 char		 *html_make_id(const struct roff_node *, int);
+int		  html_setfont(struct html *, enum mandoc_esc);

Modified: head/contrib/mandoc/lib.in
==============================================================================
--- head/contrib/mandoc/lib.in	Fri Jul 26 09:53:21 2019	(r350350)
+++ head/contrib/mandoc/lib.in	Fri Jul 26 10:00:33 2019	(r350351)
@@ -1,4 +1,4 @@
-/*	$Id: lib.in,v 1.21 2019/03/04 17:35:21 schwarze Exp $ */
+/*	$Id: lib.in,v 1.22 2019/07/01 22:56:24 schwarze Exp $ */
 /*
  * Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2009, 2012 Joerg Sonnenberger <joerg@netbsd.org>
@@ -43,7 +43,7 @@ LINE("libcipher",	"FreeSec Crypt Library (libcipher, \
 LINE("libcompat",	"Compatibility Library (libcompat, \\-lcompat)")
 LINE("libcrypt",	"Crypt Library (libcrypt, \\-lcrypt)")
 LINE("libcurses",	"Curses Library (libcurses, \\-lcurses)")
-LINE("libcuse", 	"Userland Character Device Library (libcuse, \\-lcuse)")
+LINE("libcuse",		"Userland Character Device Library (libcuse, \\-lcuse)")
 LINE("libdevattr",	"Device attribute and event library (libdevattr, \\-ldevattr)")
 LINE("libdevctl",	"Device Control Library (libdevctl, \\-ldevctl)")
 LINE("libdevinfo",	"Device and Resource Information Utility Library (libdevinfo, \\-ldevinfo)")

Modified: head/contrib/mandoc/main.c
==============================================================================
--- head/contrib/mandoc/main.c	Fri Jul 26 09:53:21 2019	(r350350)
+++ head/contrib/mandoc/main.c	Fri Jul 26 10:00:33 2019	(r350351)
@@ -1,4 +1,4 @@
-/*	$Id: main.c,v 1.322 2019/03/06 10:18:58 schwarze Exp $ */
+/*	$Id: main.c,v 1.332 2019/07/19 20:27:25 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010-2012, 2014-2019 Ingo Schwarze <schwarze@openbsd.org>
@@ -21,6 +21,7 @@
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <sys/param.h>	/* MACHINE */
+#include <sys/stat.h>
 #include <sys/wait.h>
 
 #include <assert.h>
@@ -97,13 +98,10 @@ static	int		  fs_lookup(const struct manpaths *,
 static	int		  fs_search(const struct mansearch *,
 				const struct manpaths *, int, char**,
 				struct manpage **, size_t *);
-static	int		  koptions(int *, char *);
-static	void		  moptions(int *, char *);
 static	void		  outdata_alloc(struct curparse *);
 static	void		  parse(struct curparse *, int, const char *);
-static	void		  passthrough(const char *, int, int);
+static	void		  passthrough(int, int);
 static	pid_t		  spawn_pager(struct tag_files *);
-static	int		  toptions(struct curparse *, char *);
 static	void		  usage(enum argmode) __attribute__((__noreturn__));
 static	int		  woptions(struct curparse *, char *);
 
@@ -125,7 +123,7 @@ main(int argc, char *argv[])
 	char		*conf_file, *defpaths, *auxpaths;
 	char		*oarg, *tagarg;
 	unsigned char	*uc;
-	size_t		 i, sz;
+	size_t		 i, sz, ssz;
 	int		 prio, best_prio;
 	enum outmode	 outmode;
 	int		 fd, startdir;
@@ -154,10 +152,11 @@ main(int argc, char *argv[])
 		return mandocdb(argc, argv);
 
 #if HAVE_PLEDGE
-	if (pledge("stdio rpath tmppath tty proc exec", NULL) == -1)
-		err((int)MANDOCLEVEL_SYSERR, "pledge");
+	if (pledge("stdio rpath tmppath tty proc exec", NULL) == -1) {
+		mandoc_msg(MANDOCERR_PLEDGE, 0, 0, "%s", strerror(errno));
+		return mandoc_msg_getrc();
+	}
 #endif
-
 #if HAVE_SANDBOX_INIT
 	if (sandbox_init(kSBXProfileNoInternet, SANDBOX_NAMED, NULL) == -1)
 		errx((int)MANDOCLEVEL_SYSERR, "sandbox_init");
@@ -221,19 +220,29 @@ main(int argc, char *argv[])
 			outmode = OUTMODE_ALL;
 			break;
 		case 'I':
-			if (strncmp(optarg, "os=", 3)) {
-				warnx("-I %s: Bad argument", optarg);
-				return (int)MANDOCLEVEL_BADARG;
+			if (strncmp(optarg, "os=", 3) != 0) {
+				mandoc_msg(MANDOCERR_BADARG_BAD, 0, 0,
+				    "-I %s", optarg);
+				return mandoc_msg_getrc();
 			}
 			if (curp.os_s != NULL) {
-				warnx("-I %s: Duplicate argument", optarg);
-				return (int)MANDOCLEVEL_BADARG;
+				mandoc_msg(MANDOCERR_BADARG_DUPE, 0, 0,
+				    "-I %s", optarg);
+				return mandoc_msg_getrc();
 			}
 			curp.os_s = mandoc_strdup(optarg + 3);
 			break;
 		case 'K':
-			if ( ! koptions(&options, optarg))
-				return (int)MANDOCLEVEL_BADARG;
+			options &= ~(MPARSE_UTF8 | MPARSE_LATIN1);
+			if (strcmp(optarg, "utf-8") == 0)
+				options |=  MPARSE_UTF8;
+			else if (strcmp(optarg, "iso-8859-1") == 0)
+				options |=  MPARSE_LATIN1;
+			else if (strcmp(optarg, "us-ascii") != 0) {
+				mandoc_msg(MANDOCERR_BADARG_BAD, 0, 0,
+				    "-K %s", optarg);
+				return mandoc_msg_getrc();
+			}
 			break;
 		case 'k':
 			search.argmode = ARG_EXPR;
@@ -264,12 +273,37 @@ main(int argc, char *argv[])
 			search.sec = optarg;
 			break;
 		case 'T':
-			if ( ! toptions(&curp, optarg))
-				return (int)MANDOCLEVEL_BADARG;
+			if (strcmp(optarg, "ascii") == 0)
+				curp.outtype = OUTT_ASCII;
+			else if (strcmp(optarg, "lint") == 0) {
+				curp.outtype = OUTT_LINT;
+				mandoc_msg_setoutfile(stdout);
+				mandoc_msg_setmin(MANDOCERR_BASE);
+			} else if (strcmp(optarg, "tree") == 0)
+				curp.outtype = OUTT_TREE;
+			else if (strcmp(optarg, "man") == 0)
+				curp.outtype = OUTT_MAN;
+			else if (strcmp(optarg, "html") == 0)
+				curp.outtype = OUTT_HTML;
+			else if (strcmp(optarg, "markdown") == 0)
+				curp.outtype = OUTT_MARKDOWN;
+			else if (strcmp(optarg, "utf8") == 0)
+				curp.outtype = OUTT_UTF8;
+			else if (strcmp(optarg, "locale") == 0)
+				curp.outtype = OUTT_LOCALE;
+			else if (strcmp(optarg, "ps") == 0)
+				curp.outtype = OUTT_PS;
+			else if (strcmp(optarg, "pdf") == 0)
+				curp.outtype = OUTT_PDF;
+			else {
+				mandoc_msg(MANDOCERR_BADARG_BAD, 0, 0,
+				    "-T %s", optarg);
+				return mandoc_msg_getrc();
+			}
 			break;
 		case 'W':
-			if ( ! woptions(&curp, optarg))
-				return (int)MANDOCLEVEL_BADARG;
+			if (woptions(&curp, optarg) == -1)
+				return mandoc_msg_getrc();
 			break;
 		case 'w':
 			outmode = OUTMODE_FLN;
@@ -305,12 +339,9 @@ main(int argc, char *argv[])
 			search.outkey = oarg;
 		else {
 			while (oarg != NULL) {
-				thisarg = oarg;
 				if (manconf_output(&conf.output,
-				    strsep(&oarg, ","), 0) == 0)
-					continue;
-				warnx("-O %s: Bad argument", thisarg);
-				return (int)MANDOCLEVEL_BADARG;
+				    strsep(&oarg, ","), 0) == -1)
+					return mandoc_msg_getrc();
 			}
 		}
 	}
@@ -334,9 +365,13 @@ main(int argc, char *argv[])
 	}
 
 #if HAVE_PLEDGE
-	if (!use_pager)
-		if (pledge("stdio rpath", NULL) == -1)
-			err((int)MANDOCLEVEL_SYSERR, "pledge");
+	if (use_pager == 0) {
+		if (pledge("stdio rpath", NULL) == -1) {
+			mandoc_msg(MANDOCERR_PLEDGE, 0, 0,
+			    "%s", strerror(errno));
+			return mandoc_msg_getrc();
+		}
+	}
 #endif
 
 	/* Parse arguments. */
@@ -361,7 +396,7 @@ main(int argc, char *argv[])
 		} else if (argc > 1 &&
 		    ((uc = (unsigned char *)argv[0]) != NULL) &&
 		    ((isdigit(uc[0]) && (uc[1] == '\0' ||
-		      (isalpha(uc[1]) && uc[2] == '\0'))) ||
+		      isalpha(uc[1]))) ||
 		     (uc[0] == 'n' && uc[1] == '\0'))) {
 			search.sec = (char *)uc;
 			argv++;
@@ -426,7 +461,7 @@ main(int argc, char *argv[])
 			usage(search.argmode);
 
 		if (sz == 0 && search.argmode == ARG_NAME)
-			fs_search(&search, &conf.manpath,
+			(void)fs_search(&search, &conf.manpath,
 			    argc, argv, &res, &sz);
 
 		if (search.argmode == ARG_NAME) {
@@ -434,7 +469,10 @@ main(int argc, char *argv[])
 				if (strchr(argv[c], '/') == NULL)
 					continue;
 				if (access(argv[c], R_OK) == -1) {
-					warn("%s", argv[c]);
+					mandoc_msg_setinfilename(argv[c]);
+					mandoc_msg(MANDOCERR_BADARG_BAD,
+					    0, 0, "%s", strerror(errno));
+					mandoc_msg_setinfilename(NULL);
 					continue;
 				}
 				res = mandoc_reallocarray(res,
@@ -442,6 +480,7 @@ main(int argc, char *argv[])
 				res[sz].file = mandoc_strdup(argv[c]);
 				res[sz].names = NULL;
 				res[sz].output = NULL;
+				res[sz].bits = 0;
 				res[sz].ipath = SIZE_MAX;
 				res[sz].sec = 10;
 				res[sz].form = FORM_SRC;
@@ -464,7 +503,7 @@ main(int argc, char *argv[])
 
 		if (outmode == OUTMODE_ONE) {
 			argc = 1;
-			best_prio = 20;
+			best_prio = 40;
 		} else if (outmode == OUTMODE_ALL)
 			argc = (int)sz;
 
@@ -483,10 +522,21 @@ main(int argc, char *argv[])
 				sec = res[i].file;
 				sec += strcspn(sec, "123456789");
 				if (sec[0] == '\0')
-					continue;
+					continue; /* No section at all. */
 				prio = sec_prios[sec[0] - '1'];
-				if (sec[1] != '/')
-					prio += 10;
+				if (search.sec != NULL) {
+					ssz = strlen(search.sec);
+					if (strncmp(sec, search.sec, ssz) == 0)
+						sec += ssz;
+				} else
+					sec++; /* Prefer without suffix. */
+				if (*sec != '/')
+					prio += 10; /* Wrong dir name. */
+				if (search.sec != NULL &&
+				    (strlen(sec) <= ssz  + 3 ||
+				     strcmp(sec + strlen(sec) - ssz,
+				      search.sec) != 0))
+					prio += 20; /* Wrong file ext. */
 				if (prio >= best_prio)
 					continue;
 				best_prio = prio;
@@ -508,16 +558,26 @@ main(int argc, char *argv[])
 
 #if HAVE_PLEDGE
 	if (use_pager) {
-		if (pledge("stdio rpath tmppath tty proc exec", NULL) == -1)
-			err((int)MANDOCLEVEL_SYSERR, "pledge");
+		if (pledge("stdio rpath tmppath tty proc exec", NULL) == -1) {
+			mandoc_msg(MANDOCERR_PLEDGE, 0, 0,
+			    "%s", strerror(errno));
+			return mandoc_msg_getrc();
+		}
 	} else {
-		if (pledge("stdio rpath", NULL) == -1)
-			err((int)MANDOCLEVEL_SYSERR, "pledge");
+		if (pledge("stdio rpath", NULL) == -1) {
+			mandoc_msg(MANDOCERR_PLEDGE, 0, 0,
+			    "%s", strerror(errno));
+			return mandoc_msg_getrc();
+		}
 	}
 #endif
 
-	if (search.argmode == ARG_FILE)
-		moptions(&options, auxpaths);
+	if (search.argmode == ARG_FILE && auxpaths != NULL) {
+		if (strcmp(auxpaths, "doc") == 0)
+			options |= MPARSE_MDOC;
+		else if (strcmp(auxpaths, "an") == 0)
+			options |= MPARSE_MAN;
+	}
 
 	mchars_alloc();
 	curp.mp = mparse_alloc(options, curp.os_e, curp.os_s);
@@ -525,7 +585,8 @@ main(int argc, char *argv[])
 	if (argc < 1) {
 		if (use_pager) {
 			tag_files = tag_init();
-			tag_files->tagname = conf.output.tag;
+			if (tag_files != NULL)
+				tag_files->tagname = conf.output.tag;
 		}
 		thisarg = "<stdin>";
 		mandoc_msg_setinfilename(thisarg);
@@ -558,30 +619,31 @@ main(int argc, char *argv[])
 		} else
 			thisarg = *argv;
 
+		mandoc_msg_setinfilename(thisarg);
 		fd = mparse_open(curp.mp, thisarg);
 		if (fd != -1) {
 			if (use_pager) {
 				use_pager = 0;
 				tag_files = tag_init();
-				tag_files->tagname = conf.output.tag;
+				if (tag_files != NULL)
+					tag_files->tagname = conf.output.tag;
 			}
 
-			mandoc_msg_setinfilename(thisarg);
 			if (resp == NULL || resp->form == FORM_SRC)
 				parse(&curp, fd, thisarg);
 			else
-				passthrough(resp->file, fd,
-				    conf.output.synopsisonly);
-			mandoc_msg_setinfilename(NULL);
+				passthrough(fd, conf.output.synopsisonly);
 
 			if (ferror(stdout)) {
 				if (tag_files != NULL) {
-					warn("%s", tag_files->ofn);
+					mandoc_msg(MANDOCERR_WRITE, 0, 0,
+					    "%s: %s", tag_files->ofn,
+					    strerror(errno));
 					tag_unlink();
 					tag_files = NULL;
 				} else
-					warn("stdout");
-				mandoc_msg_setrc(MANDOCLEVEL_SYSERR);
+					mandoc_msg(MANDOCERR_WRITE, 0, 0,
+					    "%s", strerror(errno));
 				break;
 			}
 
@@ -591,9 +653,11 @@ main(int argc, char *argv[])
 				terminal_sepline(curp.outdata);
 			}
 		} else
-			mandoc_msg(MANDOCERR_FILE, 0, 0,
-			    "%s: %s", thisarg, strerror(errno));
+			mandoc_msg(resp == NULL ? MANDOCERR_BADARG_BAD :
+			    MANDOCERR_OPEN, 0, 0, "%s", strerror(errno));
 
+		mandoc_msg_setinfilename(NULL);
+
 		if (curp.wstop && mandoc_msg_getrc() != MANDOCLEVEL_OK)
 			break;
 
@@ -684,8 +748,8 @@ out:
 				continue;
 
 			if (pid == -1) {
-				warn("wait");
-				mandoc_msg_setrc(MANDOCLEVEL_SYSERR);
+				mandoc_msg(MANDOCERR_WAIT, 0, 0,
+				    "%s", strerror(errno));
 				break;
 			}
 			if (!WIFSTOPPED(status))
@@ -694,14 +758,16 @@ out:
 			signum = WSTOPSIG(status);
 		}
 		tag_unlink();
-	}
+	} else if (curp.outtype != OUTT_LINT &&
+	    (search.argmode == ARG_FILE || sz > 0))
+		mandoc_msg_summary();
+
 	return (int)mandoc_msg_getrc();
 }
 
 static void
 usage(enum argmode argmode)
 {
-
 	switch (argmode) {
 	case ARG_FILE:
 		fputs("usage: mandoc [-ac] [-I os=name] "
@@ -732,6 +798,7 @@ fs_lookup(const struct manpaths *paths, size_t ipath,
 	const char *sec, const char *arch, const char *name,
 	struct manpage **res, size_t *ressz)
 {
+	struct stat	 sb;
 	glob_t		 globinfo;
 	struct manpage	*page;
 	char		*file;
@@ -741,13 +808,13 @@ fs_lookup(const struct manpaths *paths, size_t ipath,
 	form = FORM_SRC;
 	mandoc_asprintf(&file, "%s/man%s/%s.%s",
 	    paths->paths[ipath], sec, name, sec);
-	if (access(file, R_OK) != -1)
+	if (stat(file, &sb) != -1)
 		goto found;
 	free(file);
 
 	mandoc_asprintf(&file, "%s/cat%s/%s.0",
 	    paths->paths[ipath], sec, name);
-	if (access(file, R_OK) != -1) {
+	if (stat(file, &sb) != -1) {
 		form = FORM_CAT;
 		goto found;
 	}
@@ -756,7 +823,7 @@ fs_lookup(const struct manpaths *paths, size_t ipath,
 	if (arch != NULL) {
 		mandoc_asprintf(&file, "%s/man%s/%s/%s.%s",
 		    paths->paths[ipath], sec, arch, name, sec);
-		if (access(file, R_OK) != -1)
+		if (stat(file, &sb) != -1)
 			goto found;
 		free(file);
 	}
@@ -765,37 +832,42 @@ fs_lookup(const struct manpaths *paths, size_t ipath,
 	    paths->paths[ipath], sec, name);
 	globres = glob(file, 0, NULL, &globinfo);
 	if (globres != 0 && globres != GLOB_NOMATCH)
-		warn("%s: glob", file);
+		mandoc_msg(MANDOCERR_GLOB, 0, 0,
+		    "%s: %s", file, strerror(errno));
 	free(file);
 	if (globres == 0)
 		file = mandoc_strdup(*globinfo.gl_pathv);
 	globfree(&globinfo);
-	if (globres == 0)
-		goto found;
+	if (globres == 0) {
+		if (stat(file, &sb) != -1)
+			goto found;
+		free(file);
+	}
 	if (res != NULL || ipath + 1 != paths->sz)
-		return 0;
+		return -1;
 
 	mandoc_asprintf(&file, "%s.%s", name, sec);
-	globres = access(file, R_OK);
+	globres = stat(file, &sb);
 	free(file);
-	return globres != -1;
+	return globres;
 
 found:
 	warnx("outdated mandoc.db lacks %s(%s) entry, run %s %s",
 	    name, sec, BINM_MAKEWHATIS, paths->paths[ipath]);
 	if (res == NULL) {
 		free(file);
-		return 1;
+		return 0;
 	}
-	*res = mandoc_reallocarray(*res, ++*ressz, sizeof(struct manpage));
+	*res = mandoc_reallocarray(*res, ++*ressz, sizeof(**res));
 	page = *res + (*ressz - 1);
 	page->file = file;
 	page->names = NULL;
 	page->output = NULL;
+	page->bits = NAME_FILE & NAME_MASK;
 	page->ipath = ipath;
 	page->sec = (*sec >= '1' && *sec <= '9') ? *sec - '1' + 1 : 10;
 	page->form = form;
-	return 1;
+	return 0;
 }
 
 static int
@@ -817,14 +889,14 @@ fs_search(const struct mansearch *cfg, const struct ma
 		for (ipath = 0; ipath < paths->sz; ipath++) {
 			if (cfg->sec != NULL) {
 				if (fs_lookup(paths, ipath, cfg->sec,
-				    cfg->arch, *argv, res, ressz) &&
+				    cfg->arch, *argv, res, ressz) != -1 &&
 				    cfg->firstmatch)
-					return 1;
+					return 0;
 			} else for (isec = 0; isec < nsec; isec++)
 				if (fs_lookup(paths, ipath, sections[isec],
-				    cfg->arch, *argv, res, ressz) &&
+				    cfg->arch, *argv, res, ressz) != -1 &&
 				    cfg->firstmatch)
-					return 1;
+					return 0;
 		}
 		if (res != NULL && *ressz == lastsz &&
 		    strchr(*argv, '/') == NULL) {
@@ -843,7 +915,7 @@ fs_search(const struct mansearch *cfg, const struct ma
 		argv++;
 		argc--;
 	}
-	return 0;
+	return -1;
 }
 
 static void
@@ -950,7 +1022,7 @@ check_xr(void)
 		search.firstmatch = 1;
 		if (mansearch(&search, &paths, 1, &xr->name, NULL, &sz))
 			continue;
-		if (fs_search(&search, &paths, 1, &xr->name, NULL, &sz))
+		if (fs_search(&search, &paths, 1, &xr->name, NULL, &sz) != -1)
 			continue;
 		if (xr->count == 1)
 			mandoc_msg(MANDOCERR_XR_BAD, xr->line,
@@ -990,34 +1062,34 @@ outdata_alloc(struct curparse *curp)
 }
 
 static void
-passthrough(const char *file, int fd, int synopsis_only)
+passthrough(int fd, int synopsis_only)
 {
 	const char	 synb[] = "S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS";
 	const char	 synr[] = "SYNOPSIS";
 
 	FILE		*stream;
-	const char	*syscall;
 	char		*line, *cp;
 	size_t		 linesz;
 	ssize_t		 len, written;
-	int		 print;
+	int		 lno, print;
 
+	stream = NULL;
 	line = NULL;
 	linesz = 0;
 
 	if (fflush(stdout) == EOF) {
-		syscall = "fflush";
-		goto fail;
+		mandoc_msg(MANDOCERR_FFLUSH, 0, 0, "%s", strerror(errno));
+		goto done;
 	}
-
 	if ((stream = fdopen(fd, "r")) == NULL) {
 		close(fd);
-		syscall = "fdopen";
-		goto fail;
+		mandoc_msg(MANDOCERR_FDOPEN, 0, 0, "%s", strerror(errno));
+		goto done;
 	}
 
-	print = 0;
+	lno = print = 0;
 	while ((len = getline(&line, &linesz, stream)) != -1) {
+		lno++;
 		cp = line;
 		if (synopsis_only) {
 			if (print) {
@@ -1035,97 +1107,23 @@ passthrough(const char *file, int fd, int synopsis_onl
 			}
 		}
 		for (; len > 0; len -= written) {
-			if ((written = write(STDOUT_FILENO, cp, len)) != -1)
-				continue;
-			fclose(stream);
-			syscall = "write";
-			goto fail;
+			if ((written = write(STDOUT_FILENO, cp, len)) == -1) {
+				mandoc_msg(MANDOCERR_WRITE, 0, 0,
+				    "%s", strerror(errno));
+				goto done;
+			}
 		}
 	}
+	if (ferror(stream))
+		mandoc_msg(MANDOCERR_GETLINE, lno, 0, "%s", strerror(errno));
 
-	if (ferror(stream)) {
-		fclose(stream);
-		syscall = "getline";
-		goto fail;
-	}
-
 done:
 	free(line);
-	fclose(stream);
-	return;
-
-fail:
-	free(line);
-	warn("%s: SYSERR: %s", file, syscall);
-	mandoc_msg_setrc(MANDOCLEVEL_SYSERR);
+	if (stream != NULL)

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@freebsd.org  Fri Jul 26 12:51:40 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F494BF3D6;
 Fri, 26 Jul 2019 12:51:40 +0000 (UTC)
 (envelope-from manu@bidouilliste.com)
Received: from mail.blih.net (mail.blih.net [212.83.177.182])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified))
 by mx1.freebsd.org (Postfix) with ESMTPS id B37908EE56;
 Fri, 26 Jul 2019 12:51:38 +0000 (UTC)
 (envelope-from manu@bidouilliste.com)
Received: from mail.blih.net (mail.blih.net [212.83.177.182])
 by mail.blih.net (OpenSMTPD) with ESMTP id 0dfa1e63;
 Fri, 26 Jul 2019 14:51:31 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date
 :from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-type:content-transfer-encoding; s=mail;
 bh=ewh0iC8qZs3iP0N5iO29Lz00Qn4=; b=diytNRIsPjzFo2Mhn5Rx9mNhdMGC
 pp+CC6eEVMB8btzNuHT8PkNCtujlrvrXzVOxwEJVsxSaLjACK4vh/yWVSBDUiPiB
 tk9k4CrilkBP4tqolJTjUgVxK5ZjnzYJRyBH9n1kF2QkjU4uuX/Y8sLn14Gfyb11
 TwXdxQpsoXac3vw=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date
 :from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-type:content-transfer-encoding; q=dns; s=
 mail; b=tYa9yTsnRBVEpJrCwPiesjc9XtKRT0RbcoGJBOcrJJxSqvCuvIttFU+/
 syH94y5CCZh8zJgqBKPbTw/1UCDR5cWg2b2XTYTTePU0nk4uqzaTqlWz1tDiikIH
 526NHqWTF1u+h0uuCFHnXpRNZM9mp6jbOCYdoix+HzmZ5GYwoyY=
Received: from knuckles.blih.net (ip-9.net-89-3-105.rev.numericable.fr
 [89.3.105.9]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 06d43836
 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO;
 Fri, 26 Jul 2019 14:51:31 +0200 (CEST)
Date: Fri, 26 Jul 2019 05:10:42 +0200
From: Emmanuel Vadot <manu@bidouilliste.com>
To: Guido Falsi <madpilot@FreeBSD.org>
Cc: Emmanuel Vadot <manu@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject: Re: svn commit: r350135 - head/share/mk
Message-Id: <20190726051042.fcc4f6d969e19fb6f480977b@bidouilliste.com>
In-Reply-To: <28eb9717-533e-3d87-0e30-f60317ed97cb@FreeBSD.org>
References: <201907191511.x6JFBWVi053537@repo.freebsd.org>
 <37944eff-6e00-df14-59d3-beae3fa89b6a@FreeBSD.org>
 <28eb9717-533e-3d87-0e30-f60317ed97cb@FreeBSD.org>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Rspamd-Queue-Id: B37908EE56
X-Spamd-Bar: ++
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=bidouilliste.com header.s=mail header.b=diytNRIs;
 spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates
 212.83.177.182 as permitted sender) smtp.mailfrom=manu@bidouilliste.com
X-Spamd-Result: default: False [2.42 / 15.00]; ARC_NA(0.00)[];
 RCVD_VIA_SMTP_AUTH(0.00)[];
 R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mail];
 URIBL_BLOCKED(0.00)[bidouilliste.com.multi.uribl.com];
 FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[];
 R_SPF_ALLOW(-0.20)[+ip4:212.83.177.182/32]; MV_CASE(0.50)[];
 MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[];
 DMARC_NA(0.00)[bidouilliste.com];
 NEURAL_SPAM_MEDIUM(0.88)[0.879,0]; RCPT_COUNT_FIVE(0.00)[5];
 NEURAL_SPAM_SHORT(0.93)[0.927,0];
 MX_GOOD(-0.01)[mx-backup.blih.net,mail.blih.net];
 DKIM_TRACE(0.00)[bidouilliste.com:+];
 NEURAL_SPAM_LONG(0.18)[0.182,0]; RCVD_NO_TLS_LAST(0.10)[];
 FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+];
 IP_SCORE(0.34)[ip: (-1.00), ipnet: 212.83.160.0/19(2.62), asn: 12876(0.09),
 country: FR(-0.01)]; 
 ASN(0.00)[asn:12876, ipnet:212.83.160.0/19, country:FR];
 MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jul 2019 12:51:40 -0000

On Thu, 25 Jul 2019 00:17:31 +0200
Guido Falsi <madpilot@FreeBSD.org> wrote:

> On 25/07/19 00:14, Guido Falsi wrote:
> > On 19/07/19 17:11, Emmanuel Vadot wrote:
> >> Author: manu
> >> Date: Fri Jul 19 15:11:32 2019
> >> New Revision: 350135
> >> URL: https://svnweb.freebsd.org/changeset/base/350135
> >>
> >> Log:
> >>   bsd.confs.mk: Test the correct value for the destination package
> >>   
> >>   Reviewed by:	bapt, gjb
> >>   Differential Revision:	https://reviews.freebsd.org/D20961
> >>
> > 
> > Hello,
> > 
> > I don't know the actual workings of this file and have not checked it in
> > depth, but this change is causing "make package" to not package
> > /etc/rc.d/sshd (and others, all the ones being defined in
> > ${group}PACKAGE variables), which are then missing when upgrading machines.
> > 
> > Reverting this change makes packaging things work again. I think this
> > change is actually wrong and the previous version was correct.
> > 

 /etc/rc.d/sshd is in the FreeBSD-sshd package, the other ones are also
in their own package now, I'll check them all to see if that make sense.

> After sending this message I also noticed, it causes the spurious
> "FreeBSD-zfs" package to be generated again.

 Not so spurious, it now contains the rc.d zfs related files.
 I think that I'll remove it anyway, it doesn't make sense.

> -- 
> Guido Falsi <madpilot@FreeBSD.org>


-- 
Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org>

From owner-svn-src-head@freebsd.org  Fri Jul 26 12:58:05 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id DFDA1BF7D0;
 Fri, 26 Jul 2019 12:58:05 +0000 (UTC)
 (envelope-from madpilot@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 7736C8F337;
 Fri, 26 Jul 2019 12:58:05 +0000 (UTC)
 (envelope-from madpilot@FreeBSD.org)
Received: from tommy.madpilot.net (78-134-115-11.v4.ngi.it [78.134.115.11])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client did not present a certificate)
 (Authenticated sender: madpilot/mail)
 by smtp.freebsd.org (Postfix) with ESMTPSA id 8408811726;
 Fri, 26 Jul 2019 12:58:04 +0000 (UTC)
 (envelope-from madpilot@FreeBSD.org)
Subject: Re: svn commit: r350135 - head/share/mk
To: Emmanuel Vadot <manu@bidouilliste.com>
Cc: Emmanuel Vadot <manu@FreeBSD.org>, svn-src-head@freebsd.org,
 svn-src-all@freebsd.org, src-committers@freebsd.org
References: <201907191511.x6JFBWVi053537@repo.freebsd.org>
 <37944eff-6e00-df14-59d3-beae3fa89b6a@FreeBSD.org>
 <28eb9717-533e-3d87-0e30-f60317ed97cb@FreeBSD.org>
 <20190726051042.fcc4f6d969e19fb6f480977b@bidouilliste.com>
From: Guido Falsi <madpilot@FreeBSD.org>
Openpgp: preference=signencrypt
Autocrypt: addr=madpilot@FreeBSD.org; prefer-encrypt=mutual; keydata=
 mQENBE+G+l0BCADi/WBQ0aRJfnE7LBPsM0G3m/m3Yx7OPu4iYFvS84xawmRHtCNjWIntsxuX
 fptkmEo3Rsw816WUrek8dxoUAYdHd+EcpBcnnDzfDH5LW/TZ4gbrFezrHPdRp7wdxi23GN80
 qPwHEwXuF0X4Wy5V0OO8B6VT/nA0ADYnBDhXS52HGIJ/GCUjgqJn+phDTdCFLvrSFdmgx4Wl
 c0W5Z1p5cmDF9l8L/hc959AeyNf7I9dXnjekGM9gVv7UDUYzCifR3U8T0fnfdMmS8NeI9NC+
 wuREpRO4lKOkTnj9TtQJRiptlhcHQiAlG1cFqs7EQo57Tqq6cxD1FycZJLuC32bGbgalABEB
 AAG0Ikd1aWRvIEZhbHNpIDxtYWRwaWxvdEBGcmVlQlNELm9yZz6JATYEEwEIACACGwMCHgEC
 F4AFAlLvzwUFCwkIBwMFFQoJCAsEFgIDAQAKCRAa5oYOVsvSk6EzCAC4ovSo6XF4x0spuKmp
 RzVuZ5ywqCJAfRIrJHpW8HjSPkcUYwmXVOE3zjul9j2C2eHPPGobEDN5FqovAtzb7HdYGGcU
 aUdhDApUMMRVkzflwb23C/CI1RBcZxjC0noajSKgbIHx4+Afg6CFMgpngq+NJwEaaVrKlYzq
 G+KcfeVKAdwlWHJOgQJIEylUtwtBqXx/iJDrGwKO5A6a1uSEZrZfuwjSh8cBqoUfIwLZUIFE
 HBjHa8pUkp8mWx7JaZ19vBF6pDpPVZSoLSg8stWd1DPesn/qySYgtSGSY6hpWABVF98HRsBG
 +VXlHtqCaB0j0cGCDhCpHQUI10oGGc8k4zcvuQINBFMQe0EBEAChYaw3HqD3SvyBw0pqI+kk
 GIrLzO1XYXJXkuxPQ6BAFbe8jG3+h22zFU02OnJL8E1kLLMsCwVzVasYHOFiyY831IYHn/lh
 O+TN/lhWJTlUCxmWP8xFYJmta2mJzhzQDs3hyw5hF422T+rxgHg8gWxn0D6RO6hmGe7m3k91
 8EDvj5JXAq7zj49mT3AMRjUtsVVPy8zjagqyaizCUiHAnbG4kj+BuT5wxR7TKJGk2OjhK/Dh
 EHzgHq4XB1Gv8+1LvGLZmqih/kBpBP1hIGkakok579CTkw/g8XoWqr6Cjz2fvtjaQmTBwdou
 gP8Yn5kMBIiIxF7XLngUc5DVEJMYamcktd0q4aHC/cnbWlTwc2WrQBI1AwxCZgDC1RbOOan8
 oTIjWqRyaNp9zFvxOaJqgrxJA3Vl/3p9z+witk3pnmg4ITLIJDSmsf89MDaOVGQpDjzs9MaT
 YlIpTlW5Lns2WTYOue+NanntpX14UCGmeusk+4aYXPzf89zyALS3s3uLtVUdhFwLmdrFgHZS
 gjU5STLGlP8e9AVddVnf8qZ1czOvHX3UCCAI9YjBQA/5VxpRFJil4OTr9lUA5U57UKGpwmKw
 IPvArbT8468nYC2Rat4a7UJn3NLHucr9Vh0uvfgbFDhtPUb72sFA2cVI1tfZMnjfUx2jUYKM
 N5ErgK1Kes0piQARAQABiQEfBBgBCAAJBQJTEHtBAhsMAAoJEBrmhg5Wy9KTDecIAOGwpF/6
 sBFQtOk6HkegtqbrZklkDIKQ2qq7+uR7m6PkBpoNj+HsE2EEOIOqGFktN6h8alVVoSs+xY36
 1fnR/Kmwi30oCHL3QYWu2shmVa7IrjCyhm8N+n3JpGT6Ugznx3D9Fx/GfrvQlo9MVJE8QJWf
 +4uoGElKRtiVjbXZhP1/FVRMl7rAi8MtCtASOtAP+HUUyF9wuECqyd2W1F3oM+9Mp4x3/pUD
 GfSGSgEqETLkuRaMz0Iemm75sGRD3X+SPa4lBJc7x66ifAcdLdz7o3aLYfsjR6Zwca7TvC5E
 Ha0OfD9EsHGiF9909lPaRvG4buWFUfPBUPDkNHBLDwaQ53I=
Message-ID: <0e851350-0967-ee2b-3655-b79d9abd38ed@FreeBSD.org>
Date: Fri, 26 Jul 2019 14:58:01 +0200
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101
 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <20190726051042.fcc4f6d969e19fb6f480977b@bidouilliste.com>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Rspamd-Queue-Id: 7736C8F337
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.965,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jul 2019 12:58:05 -0000

On 26/07/19 05:10, Emmanuel Vadot wrote:
> On Thu, 25 Jul 2019 00:17:31 +0200
> Guido Falsi <madpilot@FreeBSD.org> wrote:
> 
>> On 25/07/19 00:14, Guido Falsi wrote:
>>> On 19/07/19 17:11, Emmanuel Vadot wrote:
>>>> Author: manu
>>>> Date: Fri Jul 19 15:11:32 2019
>>>> New Revision: 350135
>>>> URL: https://svnweb.freebsd.org/changeset/base/350135
>>>>
>>>> Log:
>>>>   bsd.confs.mk: Test the correct value for the destination package
>>>>   
>>>>   Reviewed by:	bapt, gjb
>>>>   Differential Revision:	https://reviews.freebsd.org/D20961
>>>>
>>>
>>> Hello,
>>>
>>> I don't know the actual workings of this file and have not checked it in
>>> depth, but this change is causing "make package" to not package
>>> /etc/rc.d/sshd (and others, all the ones being defined in
>>> ${group}PACKAGE variables), which are then missing when upgrading machines.
>>>
>>> Reverting this change makes packaging things work again. I think this
>>> change is actually wrong and the previous version was correct.
>>>
> 
>  /etc/rc.d/sshd is in the FreeBSD-sshd package, the other ones are also
> in their own package now, I'll check them all to see if that make sense.

It makes perfect sense for that file to be in the FreeBSD-sshd package
and that was my first guess when looking for the missing file, but in my
case it was not present in that package.

By reverting your change it appears to end up in the FreeBSD-runtime
package.

> 
>> After sending this message I also noticed, it causes the spurious
>> "FreeBSD-zfs" package to be generated again.
> 
>  Not so spurious, it now contains the rc.d zfs related files.
>  I think that I'll remove it anyway, it doesn't make sense.

It does, but, again reverting your change, those files end up in the
runtime package.

-- 
Guido Falsi <madpilot@FreeBSD.org>

From owner-svn-src-head@freebsd.org  Fri Jul 26 13:04:34 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28BE3BF9CB;
 Fri, 26 Jul 2019 13:04:34 +0000 (UTC)
 (envelope-from manu@bidouilliste.com)
Received: from mail.blih.net (mail.blih.net [212.83.177.182])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified))
 by mx1.freebsd.org (Postfix) with ESMTPS id 5165B8F7F8;
 Fri, 26 Jul 2019 13:04:33 +0000 (UTC)
 (envelope-from manu@bidouilliste.com)
Received: from mail.blih.net (mail.blih.net [212.83.177.182])
 by mail.blih.net (OpenSMTPD) with ESMTP id ac53f52c;
 Fri, 26 Jul 2019 15:04:31 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date
 :from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-type:content-transfer-encoding; s=mail;
 bh=7COCIE2Q02HrktGvhGJYpRRSTgY=; b=EtGgqnOrzv9nrMvvuDtpnfk9zJ8A
 738DZwzEqi1qbAx5Mt0OYOS3IH0ga9jptoSNrveaCkgmGsCGfHvqQWBGu5hmbGgL
 e7cWjF5S8nKP4vtVHwA3nsfp5f9lLYVIcXtwm6ilsiuFHMJYlj456YHbgzAQDhnb
 2HRfQfpWeq5CQOw=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date
 :from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-type:content-transfer-encoding; q=dns; s=
 mail; b=OLfPR5sMzonZicRZyDxoavJmCZb1AuqMV25E5IodqqxglZzXFT2jvdy2
 iTR8bKwWND0AZYyZiWkKOXl35699z0YZsmzTz9y9LjokYJ5FMHPg48STyCvqcj0L
 ZYZottyQ2KADWZdMXVP1SIDOl3BgUUiOyhgCZqHK6px/wpCJCFg=
Received: from knuckles.blih.net (ip-9.net-89-3-105.rev.numericable.fr
 [89.3.105.9]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 46fea0d5
 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO;
 Fri, 26 Jul 2019 15:04:31 +0200 (CEST)
Date: Fri, 26 Jul 2019 05:23:45 +0200
From: Emmanuel Vadot <manu@bidouilliste.com>
To: Guido Falsi <madpilot@FreeBSD.org>
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
 src-committers@freebsd.org
Subject: Re: svn commit: r350135 - head/share/mk
Message-Id: <20190726052345.560b122cf2714bef73a2bf4f@bidouilliste.com>
In-Reply-To: <0e851350-0967-ee2b-3655-b79d9abd38ed@FreeBSD.org>
References: <201907191511.x6JFBWVi053537@repo.freebsd.org>
 <37944eff-6e00-df14-59d3-beae3fa89b6a@FreeBSD.org>
 <28eb9717-533e-3d87-0e30-f60317ed97cb@FreeBSD.org>
 <20190726051042.fcc4f6d969e19fb6f480977b@bidouilliste.com>
 <0e851350-0967-ee2b-3655-b79d9abd38ed@FreeBSD.org>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Rspamd-Queue-Id: 5165B8F7F8
X-Spamd-Bar: ++
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=bidouilliste.com header.s=mail header.b=EtGgqnOr;
 spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates
 212.83.177.182 as permitted sender) smtp.mailfrom=manu@bidouilliste.com
X-Spamd-Result: default: False [2.38 / 15.00]; ARC_NA(0.00)[];
 RCVD_VIA_SMTP_AUTH(0.00)[];
 R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mail];
 URIBL_BLOCKED(0.00)[bidouilliste.com.multi.uribl.com];
 FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4];
 R_SPF_ALLOW(-0.20)[+ip4:212.83.177.182/32]; MV_CASE(0.50)[];
 MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[];
 DMARC_NA(0.00)[bidouilliste.com]; TO_DN_SOME(0.00)[];
 NEURAL_SPAM_MEDIUM(0.88)[0.875,0];
 NEURAL_SPAM_SHORT(0.93)[0.927,0];
 DKIM_TRACE(0.00)[bidouilliste.com:+];
 MX_GOOD(-0.01)[cached: mx-backup.blih.net];
 NEURAL_SPAM_LONG(0.15)[0.147,0]; RCVD_NO_TLS_LAST(0.10)[];
 FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+];
 IP_SCORE(0.34)[ip: (-0.99), ipnet: 212.83.160.0/19(2.62), asn: 12876(0.09),
 country: FR(-0.01)]; 
 ASN(0.00)[asn:12876, ipnet:212.83.160.0/19, country:FR];
 MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jul 2019 13:04:34 -0000

On Fri, 26 Jul 2019 14:58:01 +0200
Guido Falsi <madpilot@FreeBSD.org> wrote:

> On 26/07/19 05:10, Emmanuel Vadot wrote:
> > On Thu, 25 Jul 2019 00:17:31 +0200
> > Guido Falsi <madpilot@FreeBSD.org> wrote:
> > 
> >> On 25/07/19 00:14, Guido Falsi wrote:
> >>> On 19/07/19 17:11, Emmanuel Vadot wrote:
> >>>> Author: manu
> >>>> Date: Fri Jul 19 15:11:32 2019
> >>>> New Revision: 350135
> >>>> URL: https://svnweb.freebsd.org/changeset/base/350135
> >>>>
> >>>> Log:
> >>>>   bsd.confs.mk: Test the correct value for the destination package
> >>>>   
> >>>>   Reviewed by:	bapt, gjb
> >>>>   Differential Revision:	https://reviews.freebsd.org/D20961
> >>>>
> >>>
> >>> Hello,
> >>>
> >>> I don't know the actual workings of this file and have not checked it in
> >>> depth, but this change is causing "make package" to not package
> >>> /etc/rc.d/sshd (and others, all the ones being defined in
> >>> ${group}PACKAGE variables), which are then missing when upgrading machines.
> >>>
> >>> Reverting this change makes packaging things work again. I think this
> >>> change is actually wrong and the previous version was correct.
> >>>
> > 
> >  /etc/rc.d/sshd is in the FreeBSD-sshd package, the other ones are also
> > in their own package now, I'll check them all to see if that make sense.
> 
> It makes perfect sense for that file to be in the FreeBSD-sshd package
> and that was my first guess when looking for the missing file, but in my
> case it was not present in that package.
> 
> By reverting your change it appears to end up in the FreeBSD-runtime
> package.

 Fresh build from today :

elbarto@wopr> tar tzf FreeBSD-ssh-13.0.s20190726081149.txz /etc/rc.d/sshd
/etc/rc.d/sshd
elbarto@wopr> tar xzf FreeBSD-ssh-13.0.s20190726081149.txz +MANIFEST
elbarto@wopr> jq < +MANIFEST | grep sshd
    "/etc/rc.d/sshd": "1$09d051563f89dbae0f54af42add15f9c16d5bf5c63a32d8eadc5127f665e4de9",
    "/etc/ssh/sshd_config": "1$7501d70e5186360c812b55cf0f0caff51169ca6764222f3fa668c09e8b5823a8",
    "/usr/sbin/sshd": "1$85772d32ba83cf6edd190fe48e949a358b08079a1dcc2c6a0de9addfe5075829",
    "/usr/share/man/man5/sshd_config.5.gz": "1$593bcd2338b124faf735825c52da8d9534f3e4b326a573590e8625f364017b57",
    "/usr/share/man/man8/sshd.8.gz": "1$729b894da4fa632be0ca6e06897943caca0e9d699a8a3c0ed33393e0b7ecec44",
    "/etc/rc.d/sshd",
    "/etc/ssh/sshd_config"

> > 
> >> After sending this message I also noticed, it causes the spurious
> >> "FreeBSD-zfs" package to be generated again.
> > 
> >  Not so spurious, it now contains the rc.d zfs related files.
> >  I think that I'll remove it anyway, it doesn't make sense.
> 
> It does, but, again reverting your change, those files end up in the
> runtime package.

 Yes reverting make those files end up in the runtime package, aka the default package used when no packages
are specified. The change is good but will needs more tweaking in libexec/rc.d/Makefile so
files endup when it make sense.

> -- 
> Guido Falsi <madpilot@FreeBSD.org>


-- 
Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org>

From owner-svn-src-head@freebsd.org  Fri Jul 26 13:12:33 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E6B5BFE8E;
 Fri, 26 Jul 2019 13:12:33 +0000 (UTC)
 (envelope-from bapt@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 7DA968FF58;
 Fri, 26 Jul 2019 13:12:33 +0000 (UTC)
 (envelope-from bapt@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 6992AFA9B;
 Fri, 26 Jul 2019 13:12:33 +0000 (UTC)
 (envelope-from bapt@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6QDCXks088296;
 Fri, 26 Jul 2019 13:12:33 GMT (envelope-from bapt@FreeBSD.org)
Received: (from bapt@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6QDCXfe088295;
 Fri, 26 Jul 2019 13:12:33 GMT (envelope-from bapt@FreeBSD.org)
Message-Id: <201907261312.x6QDCXfe088295@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: bapt set sender to
 bapt@FreeBSD.org using -f
From: Baptiste Daroussin <bapt@FreeBSD.org>
Date: Fri, 26 Jul 2019 13:12:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350358 - head/cddl/contrib/opensolaris/lib/libzfs/common
X-SVN-Group: head
X-SVN-Commit-Author: bapt
X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzfs/common
X-SVN-Commit-Revision: 350358
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 7DA968FF58
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_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.95)[-0.955,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jul 2019 13:12:33 -0000

Author: bapt
Date: Fri Jul 26 13:12:33 2019
New Revision: 350358
URL: https://svnweb.freebsd.org/changeset/base/350358

Log:
  Fix a bug introduced with parallel mounting of zfs
  
  Incorporate a fix from zol:
  https://github.com/zfsonlinux/zfs/commit/ab5036df1ccbe1b18c1ce6160b5829e8039d94ce
  
  commit log from upstream:
   Fix race in parallel mount's thread dispatching algorithm
  
  Strategy of parallel mount is as follows.
  
  1) Initial thread dispatching is to select sets of mount points that
   don't have dependencies on other sets, hence threads can/should run
   lock-less and shouldn't race with other threads for other sets. Each
   thread dispatched corresponds to top level directory which may or may
   not have datasets to be mounted on sub directories.
  
  2) Subsequent recursive thread dispatching for each thread from 1)
   is to mount datasets for each set of mount points. The mount points
   within each set have dependencies (i.e. child directories), so child
   directories are processed only after parent directory completes.
  
  The problem is that the initial thread dispatching in
  zfs_foreach_mountpoint() can be multi-threaded when it needs to be
  single-threaded, and this puts threads under race condition. This race
  appeared as mount/unmount issues on ZoL for ZoL having different
  timing regarding mount(2) execution due to fork(2)/exec(2) of mount(8).
  `zfs unmount -a` which expects proper mount order can't unmount if the
  mounts were reordered by the race condition.
  
  There are currently two known patterns of input list `handles` in
  `zfs_foreach_mountpoint(..,handles,..)` which cause the race condition.
  
  1) #8833 case where input is `/a /a /a/b` after sorting.
   The problem is that libzfs_path_contains() can't correctly handle an
   input list with two same top level directories.
   There is a race between two POSIX threads A and B,
    * ThreadA for "/a" for test1 and "/a/b"
    * ThreadB for "/a" for test0/a
   and in case of #8833, ThreadA won the race. Two threads were created
   because "/a" wasn't considered as `"/a" contains "/a"`.
  
  2) #8450 case where input is `/ /var/data /var/data/test` after sorting.
   The problem is that libzfs_path_contains() can't correctly handle an
   input list containing "/".
   There is a race between two POSIX threads A and B,
    * ThreadA for "/" and "/var/data/test"
    * ThreadB for "/var/data"
   and in case of #8450, ThreadA won the race. Two threads were created
   because "/var/data" wasn't considered as `"/" contains "/var/data"`.
   In other words, if there is (at least one) "/" in the input list,
   the initial thread dispatching must be single-threaded since every
   directory is a child of "/", meaning they all directly or indirectly
   depend on "/".
  
  In both cases, the first non_descendant_idx() call fails to correctly
  determine "path1-contains-path2", and as a result the initial thread
  dispatching creates another thread when it needs to be single-threaded.
  Fix a conditional in libzfs_path_contains() to consider above two.
  
  Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
  Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
  Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
  
  PR:		237517, 237397, 239243
  Submitted by:	Matthew D. Fuller <fullermd@over-yonder.net> (by email)
  MFC after:	3 days

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c	Fri Jul 26 10:43:07 2019	(r350357)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c	Fri Jul 26 13:12:33 2019	(r350358)
@@ -1281,12 +1281,14 @@ mountpoint_cmp(const void *arga, const void *argb)
 }
 
 /*
- * Reutrn true if path2 is a child of path1
+ * Return true if path2 is a child of path1 or path2 equals path1 or
+ * path1 is "/" (path2 is always a child of "/").
  */
 static boolean_t
 libzfs_path_contains(const char *path1, const char *path2)
 {
-	return (strstr(path2, path1) == path2 && path2[strlen(path1)] == '/');
+	return (strcmp(path1, path2) == 0 || strcmp(path1, "/") == 0 ||
+	    (strstr(path2, path1) == path2 && path2[strlen(path1)] == '/')); 
 }
 
 

From owner-svn-src-head@freebsd.org  Fri Jul 26 15:18:12 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 00DDBA333B;
 Fri, 26 Jul 2019 15:18:11 +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 CFD106DEE0;
 Fri, 26 Jul 2019 15:18:11 +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 8C15A19033;
 Fri, 26 Jul 2019 15:18:11 +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 x6QFIB01059385;
 Fri, 26 Jul 2019 15:18:11 GMT (envelope-from dougm@FreeBSD.org)
Received: (from dougm@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6QFIBPk059384;
 Fri, 26 Jul 2019 15:18:11 GMT (envelope-from dougm@FreeBSD.org)
Message-Id: <201907261518.x6QFIBPk059384@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: dougm set sender to
 dougm@FreeBSD.org using -f
From: Doug Moore <dougm@FreeBSD.org>
Date: Fri, 26 Jul 2019 15:18:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350359 - head/sbin/swapon
X-SVN-Group: head
X-SVN-Commit-Author: dougm
X-SVN-Commit-Paths: head/sbin/swapon
X-SVN-Commit-Revision: 350359
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: CFD106DEE0
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.941,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jul 2019 15:18:12 -0000

Author: dougm
Date: Fri Jul 26 15:18:11 2019
New Revision: 350359
URL: https://svnweb.freebsd.org/changeset/base/350359

Log:
  Rewrite the comments that explain swapon_trim() to make them more
  comprehensible.
  
  Suggested by: rpokala
  Approved by: markj (mentor)
  Differential Revision: https://reviews.freebsd.org/D21034

Modified:
  head/sbin/swapon/swapon.c

Modified: head/sbin/swapon/swapon.c
==============================================================================
--- head/sbin/swapon/swapon.c	Fri Jul 26 13:12:33 2019	(r350358)
+++ head/sbin/swapon/swapon.c	Fri Jul 26 15:18:11 2019	(r350359)
@@ -746,9 +746,11 @@ swapon_trim(const char *name)
 	off_t ioarg[2], sz;
 	int error, fd;
 
+	/* Open a descriptor to create a consumer of the device. */
 	fd = open(name, O_WRONLY);
 	if (fd < 0)
 		errx(1, "Cannot open %s", name);
+	/* Find the device size. */
 	if (fstat(fd, &sb) < 0)
 		errx(1, "Cannot stat %s", name);
 	if (S_ISREG(sb.st_mode))
@@ -758,18 +760,22 @@ swapon_trim(const char *name)
 			err(1, "ioctl(DIOCGMEDIASIZE)");
 	} else
 		errx(1, "%s has an invalid file type", name);
+	/* Trim the device. */
 	ioarg[0] = 0;
 	ioarg[1] = sz;
 	if (ioctl(fd, DIOCGDELETE, ioarg) != 0)
 		warn("ioctl(DIOCGDELETE)");
 
+	/* Start using the device for swapping, creating a second consumer. */
+	error = swapon(name);
+
 	/*
-	 * swapon is invoked after trimming, so that the trimming doesn't happen
-	 * after the device is in use for swapping, but before the fd is closed,
-	 * for the benefit of geli, which could otherwise detach the device,
-	 * before swapon, on close.
+	 * Do not close the device until the swap pager has attempted to create
+	 * another consumer.  For GELI devices created with the 'detach -l'
+	 * option, removing the last consumer causes the device to be detached
+	 * - that is, to disappear.  This ordering ensures that the device will
+	 * not be detached until swapoff is called.
 	 */
-	error = swapon(name);
 	close(fd);
 	return (error);
 }

From owner-svn-src-head@freebsd.org  Fri Jul 26 16:55:08 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B03DA4AD1;
 Fri, 26 Jul 2019 16:55:08 +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 E1162713B8;
 Fri, 26 Jul 2019 16:55:07 +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 B5EAD1A216;
 Fri, 26 Jul 2019 16:55:07 +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 x6QGt78H018389;
 Fri, 26 Jul 2019 16:55:07 GMT (envelope-from dim@FreeBSD.org)
Received: (from dim@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6QGt6Vo018386;
 Fri, 26 Jul 2019 16:55:06 GMT (envelope-from dim@FreeBSD.org)
Message-Id: <201907261655.x6QGt6Vo018386@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org
 using -f
From: Dimitry Andric <dim@FreeBSD.org>
Date: Fri, 26 Jul 2019 16:55:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350360 - in head: contrib/libcxxrt lib/libcxxrt
X-SVN-Group: head
X-SVN-Commit-Author: dim
X-SVN-Commit-Paths: in head: contrib/libcxxrt lib/libcxxrt
X-SVN-Commit-Revision: 350360
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: E1162713B8
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.962,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jul 2019 16:55:08 -0000

Author: dim
Date: Fri Jul 26 16:55:06 2019
New Revision: 350360
URL: https://svnweb.freebsd.org/changeset/base/350360

Log:
  Merge libcxxrt master f96846efbfd508f66d91fcbbef5dd808947c7f6d.
  
  Interesting fixes:
  f96846e Fix std::size_t -> size_t to unbreak build against libc++ 6.0.0
  6f4cfa2 Fix the uncaught exception count with rethrowing (PR 239265)
  db54f53 Added C++14-specific operator delete (#47)
  
  PR:		239265
  MFC after:	3 days

Modified:
  head/contrib/libcxxrt/exception.cc   (contents, props changed)
  head/contrib/libcxxrt/memory.cc   (contents, props changed)
  head/lib/libcxxrt/Makefile
  head/lib/libcxxrt/Version.map
Directory Properties:
  head/contrib/libcxxrt/   (props changed)
  head/contrib/libcxxrt/abi_namespace.h   (props changed)
  head/contrib/libcxxrt/auxhelper.cc   (props changed)
  head/contrib/libcxxrt/cxxabi.h   (props changed)
  head/contrib/libcxxrt/dwarf_eh.h   (props changed)
  head/contrib/libcxxrt/dynamic_cast.cc   (props changed)
  head/contrib/libcxxrt/guard.cc   (props changed)
  head/contrib/libcxxrt/libelftc_dem_gnu3.c   (props changed)
  head/contrib/libcxxrt/stdexcept.cc   (props changed)
  head/contrib/libcxxrt/stdexcept.h   (props changed)
  head/contrib/libcxxrt/terminate.cc   (props changed)
  head/contrib/libcxxrt/typeinfo.cc   (props changed)
  head/contrib/libcxxrt/typeinfo.h   (props changed)

Modified: head/contrib/libcxxrt/exception.cc
==============================================================================
--- head/contrib/libcxxrt/exception.cc	Fri Jul 26 15:18:11 2019	(r350359)
+++ head/contrib/libcxxrt/exception.cc	Fri Jul 26 16:55:06 2019	(r350360)
@@ -879,6 +879,13 @@ extern "C" void __cxa_rethrow()
 
 	assert(ex->handlerCount > 0 && "Rethrowing uncaught exception!");
 
+	// `globals->uncaughtExceptions` was decremented by `__cxa_begin_catch`.
+	// It's normally incremented by `throw_exception`, but this path invokes
+	// `_Unwind_Resume_or_Rethrow` directly to rethrow the exception.
+	// This path is only reachable if we're rethrowing a C++ exception -
+	// foreign exceptions don't adjust any of this state.
+	globals->uncaughtExceptions++;
+
 	// ex->handlerCount will be decremented in __cxa_end_catch in enclosing
 	// catch block
 	
@@ -1224,11 +1231,13 @@ extern "C" void *__cxa_begin_catch(void *e)
 	// we see is a foreign exception then we won't have called it yet.
 	__cxa_thread_info *ti = thread_info();
 	__cxa_eh_globals *globals = &ti->globals;
-	globals->uncaughtExceptions--;
 	_Unwind_Exception *exceptionObject = static_cast<_Unwind_Exception*>(e);
 
 	if (isCXXException(exceptionObject->exception_class))
 	{
+		// Only exceptions thrown with a C++ exception throwing function will
+		// increment this, so don't decrement it here.
+		globals->uncaughtExceptions--;
 		__cxa_exception *ex =  exceptionFromPointer(exceptionObject);
 
 		if (ex->handlerCount == 0)
@@ -1365,6 +1374,14 @@ extern "C" std::type_info *__cxa_current_exception_typ
 }
 
 /**
+ * Cleanup, ensures that `__cxa_end_catch` is called to balance an explicit
+ * `__cxa_begin_catch` call.
+ */
+static void end_catch(char *)
+{
+	__cxa_end_catch();
+}
+/**
  * ABI function, called when an exception specification is violated.
  *
  * This function does not return.
@@ -1372,6 +1389,12 @@ extern "C" std::type_info *__cxa_current_exception_typ
 extern "C" void __cxa_call_unexpected(void*exception) 
 {
 	_Unwind_Exception *exceptionObject = static_cast<_Unwind_Exception*>(exception);
+	// Wrap the call to the unexpected handler in calls to `__cxa_begin_catch`
+	// and `__cxa_end_catch` so that we correctly update exception counts if
+	// the unexpected handler throws an exception.
+	__cxa_begin_catch(exceptionObject);
+	__attribute__((cleanup(end_catch)))
+	char unused;
 	if (exceptionObject->exception_class == exception_class)
 	{
 		__cxa_exception *ex =  exceptionFromPointer(exceptionObject);

Modified: head/contrib/libcxxrt/memory.cc
==============================================================================
--- head/contrib/libcxxrt/memory.cc	Fri Jul 26 15:18:11 2019	(r350359)
+++ head/contrib/libcxxrt/memory.cc	Fri Jul 26 16:55:06 2019	(r350360)
@@ -151,4 +151,21 @@ void operator delete[](void * ptr) NOEXCEPT
 	::operator delete(ptr);
 }
 
+// C++14 additional delete operators
 
+#if __cplusplus >= 201402L
+
+__attribute__((weak))
+void operator delete(void * ptr, size_t) NOEXCEPT
+{
+	::operator delete(ptr);
+}
+
+
+__attribute__((weak))
+void operator delete[](void * ptr, size_t) NOEXCEPT
+{
+	::operator delete(ptr);
+}
+
+#endif

Modified: head/lib/libcxxrt/Makefile
==============================================================================
--- head/lib/libcxxrt/Makefile	Fri Jul 26 15:18:11 2019	(r350359)
+++ head/lib/libcxxrt/Makefile	Fri Jul 26 16:55:06 2019	(r350360)
@@ -22,7 +22,7 @@ SRCS+=		libelftc_dem_gnu3.c\
 
 WARNS=		0
 CFLAGS+=	-isystem ${SRCDIR} -nostdinc++
-CXXSTD?=	c++11
+CXXSTD?=	c++14
 VERSION_MAP=	${.CURDIR}/Version.map
 
 .include <bsd.lib.mk>

Modified: head/lib/libcxxrt/Version.map
==============================================================================
--- head/lib/libcxxrt/Version.map	Fri Jul 26 15:18:11 2019	(r350359)
+++ head/lib/libcxxrt/Version.map	Fri Jul 26 16:55:06 2019	(r350360)
@@ -277,6 +277,10 @@ CXXABI_1.3.9 {
         "typeinfo name for unsigned __int128 const*";
         "typeinfo name for unsigned __int128";
         "typeinfo name for unsigned __int128*";
+        "operator delete[](void*, unsigned int)";
+        "operator delete(void*, unsigned int)";
+        "operator delete[](void*, unsigned long)";
+        "operator delete(void*, unsigned long)";
     };
 } CXXABI_1.3.6;
 

From owner-svn-src-head@freebsd.org  Fri Jul 26 17:48:52 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73814A59B9;
 Fri, 26 Jul 2019 17:48:52 +0000 (UTC)
 (envelope-from carpeddiem@gmail.com)
Received: from mail-io1-f66.google.com (mail-io1-f66.google.com
 [209.85.166.66])
 (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 81D3C7318F;
 Fri, 26 Jul 2019 17:48:51 +0000 (UTC)
 (envelope-from carpeddiem@gmail.com)
Received: by mail-io1-f66.google.com with SMTP id i10so106430035iol.13;
 Fri, 26 Jul 2019 10:48:51 -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=aJgpeuAPvKgCtIh2QKM2DX6QmhIweZbu/E+tQDhMxUo=;
 b=WwQvXOVb+EeGW2yhChFUmS8fUB+9nSbbXFv8xHySTLGICQ2fZfuvwZouyiT85nkmd8
 KZMOZFTjXFufAzKdap9SJfTufDjqeyG1yy2GfUqgj0qYhDpgyTk/HMKqtdUfUt1M59uG
 ndtqoo/t3jHYFzLtOkXrSG/2ZYXqQLurOgxDP//fHQ9lY+H3TG6+gVhR2i8V2uKC/4fW
 m4o6h+HuJoAJ15dG9JipdqRE8rhkYgqxDlDbjDI5+U6z44luM38gbY+JSupPbWGYGQN/
 tj9aRv8xLptMt2h5Yvweb5GuHBXwCfOLP9QCtFz4aBTx6qPFIDDs+nmYJzntVd0wvF7q
 x3uQ==
X-Gm-Message-State: APjAAAXY4ia3y8N8JiPJprBlPh5WuBC+oS2zUuQtJRJpHt9x7PPMEDdF
 6YLlAMPgp0vK9ltbHh7/IIde+CgKy/gSJuVrlykL4t22
X-Google-Smtp-Source: APXvYqxzo9LL37zxCrYBAlzismzhq0XhG8t4Q/2ez2dWK+744jnSjweT7CWzelYVKT1rk68fUs0Pe4qCPVmEOGUcshw=
X-Received: by 2002:a02:aa0d:: with SMTP id r13mr98097378jam.129.1564162915762; 
 Fri, 26 Jul 2019 10:41:55 -0700 (PDT)
MIME-Version: 1.0
References: <201907242106.x6OL6KaM068071@repo.freebsd.org>
 <201907250203.x6P23GeQ076818@slippy.cwsent.com>
In-Reply-To: <201907250203.x6P23GeQ076818@slippy.cwsent.com>
From: Ed Maste <emaste@freebsd.org>
Date: Fri, 26 Jul 2019 12:02:13 -0400
Message-ID: <CAPyFy2DKYxmmDcY+bdjH1TtW+dejSrqF-d78nof+wmsU=ZwMwA@mail.gmail.com>
Subject: Re: svn commit: r350301 - head/lib/libsysdecode
To: Cy Schubert <Cy.Schubert@cschubert.com>
Cc: src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>, 
 svn-src-head <svn-src-head@freebsd.org>
Content-Type: text/plain; charset="UTF-8"
X-Rspamd-Queue-Id: 81D3C7318F
X-Spamd-Bar: ----
Authentication-Results: mx1.freebsd.org;
 spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates
 209.85.166.66 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com
X-Spamd-Result: default: False [-4.16 / 15.00]; ARC_NA(0.00)[];
 NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; FROM_HAS_DN(0.00)[];
 RCPT_COUNT_THREE(0.00)[4];
 R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain];
 RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[freebsd.org];
 TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[];
 MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com];
 NEURAL_HAM_SHORT(-0.86)[-0.863,0];
 RCVD_IN_DNSWL_NONE(0.00)[66.166.85.209.list.dnswl.org : 127.0.5.0];
 IP_SCORE(-1.29)[ip: (-0.54), ipnet: 209.85.128.0/17(-3.42), asn: 15169(-2.45),
 country: US(-0.05)]; 
 FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com];
 MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[];
 FREEMAIL_ENVFROM(0.00)[gmail.com];
 ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US];
 FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com];
 RCVD_COUNT_TWO(0.00)[2]
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jul 2019 17:48:52 -0000

On Wed, 24 Jul 2019 at 22:04, Cy Schubert <Cy.Schubert@cschubert.com> wrote:
>
> In message <201907242106.x6OL6KaM068071@repo.freebsd.org>, Ed Maste
> writes:
> > Author: emaste
> > Date: Wed Jul 24 21:06:19 2019
> > New Revision: 350301
> > URL: https://svnweb.freebsd.org/changeset/base/350301
> >
> > Log:
> >   libsysdecode: add explicit dependencies on recently changed headers
> >
> Hi Ed,
>
> This breaks 32-bit compatibility builds on amd64.

Thanks for the note and sorry about that. lwhsu had a workaround in
r350322 and it should have a proper fix as of r350327.

From owner-svn-src-head@freebsd.org  Fri Jul 26 17:58:47 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9055AA5C37;
 Fri, 26 Jul 2019 17:58:47 +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 734227379B;
 Fri, 26 Jul 2019 17:58:47 +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 403EA1ACC1;
 Fri, 26 Jul 2019 17:58:47 +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 x6QHwlTg053963;
 Fri, 26 Jul 2019 17:58:47 GMT (envelope-from ian@FreeBSD.org)
Received: (from ian@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6QHwlr7053962;
 Fri, 26 Jul 2019 17:58:47 GMT (envelope-from ian@FreeBSD.org)
Message-Id: <201907261758.x6QHwlr7053962@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org
 using -f
From: Ian Lepore <ian@FreeBSD.org>
Date: Fri, 26 Jul 2019 17:58:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350361 - head
X-SVN-Group: head
X-SVN-Commit-Author: ian
X-SVN-Commit-Paths: head
X-SVN-Commit-Revision: 350361
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 734227379B
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.961,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jul 2019 17:58:47 -0000

Author: ian
Date: Fri Jul 26 17:58:46 2019
New Revision: 350361
URL: https://svnweb.freebsd.org/changeset/base/350361

Log:
  Re-wrap the text at 80 columns after fixing the indent in the prior commit.

Modified:
  head/UPDATING

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Fri Jul 26 16:55:06 2019	(r350360)
+++ head/UPDATING	Fri Jul 26 17:58:46 2019	(r350361)
@@ -27,12 +27,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
 	"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.  
+	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

From owner-svn-src-head@freebsd.org  Fri Jul 26 18:03:52 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05D1BA5EA7;
 Fri, 26 Jul 2019 18:03:52 +0000 (UTC)
 (envelope-from madpilot@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 DC33E74230;
 Fri, 26 Jul 2019 18:03:51 +0000 (UTC)
 (envelope-from madpilot@FreeBSD.org)
Received: from tommy.madpilot.net (78-134-115-11.v4.ngi.it [78.134.115.11])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client did not present a certificate)
 (Authenticated sender: madpilot/mail)
 by smtp.freebsd.org (Postfix) with ESMTPSA id 1D91F13BDA;
 Fri, 26 Jul 2019 18:03:50 +0000 (UTC)
 (envelope-from madpilot@FreeBSD.org)
Subject: Re: svn commit: r350135 - head/share/mk
To: Emmanuel Vadot <manu@bidouilliste.com>
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
 src-committers@freebsd.org
References: <201907191511.x6JFBWVi053537@repo.freebsd.org>
 <37944eff-6e00-df14-59d3-beae3fa89b6a@FreeBSD.org>
 <28eb9717-533e-3d87-0e30-f60317ed97cb@FreeBSD.org>
 <20190726051042.fcc4f6d969e19fb6f480977b@bidouilliste.com>
 <0e851350-0967-ee2b-3655-b79d9abd38ed@FreeBSD.org>
 <20190726052345.560b122cf2714bef73a2bf4f@bidouilliste.com>
From: Guido Falsi <madpilot@FreeBSD.org>
Openpgp: preference=signencrypt
Autocrypt: addr=madpilot@FreeBSD.org; prefer-encrypt=mutual; keydata=
 mQENBE+G+l0BCADi/WBQ0aRJfnE7LBPsM0G3m/m3Yx7OPu4iYFvS84xawmRHtCNjWIntsxuX
 fptkmEo3Rsw816WUrek8dxoUAYdHd+EcpBcnnDzfDH5LW/TZ4gbrFezrHPdRp7wdxi23GN80
 qPwHEwXuF0X4Wy5V0OO8B6VT/nA0ADYnBDhXS52HGIJ/GCUjgqJn+phDTdCFLvrSFdmgx4Wl
 c0W5Z1p5cmDF9l8L/hc959AeyNf7I9dXnjekGM9gVv7UDUYzCifR3U8T0fnfdMmS8NeI9NC+
 wuREpRO4lKOkTnj9TtQJRiptlhcHQiAlG1cFqs7EQo57Tqq6cxD1FycZJLuC32bGbgalABEB
 AAG0Ikd1aWRvIEZhbHNpIDxtYWRwaWxvdEBGcmVlQlNELm9yZz6JATYEEwEIACACGwMCHgEC
 F4AFAlLvzwUFCwkIBwMFFQoJCAsEFgIDAQAKCRAa5oYOVsvSk6EzCAC4ovSo6XF4x0spuKmp
 RzVuZ5ywqCJAfRIrJHpW8HjSPkcUYwmXVOE3zjul9j2C2eHPPGobEDN5FqovAtzb7HdYGGcU
 aUdhDApUMMRVkzflwb23C/CI1RBcZxjC0noajSKgbIHx4+Afg6CFMgpngq+NJwEaaVrKlYzq
 G+KcfeVKAdwlWHJOgQJIEylUtwtBqXx/iJDrGwKO5A6a1uSEZrZfuwjSh8cBqoUfIwLZUIFE
 HBjHa8pUkp8mWx7JaZ19vBF6pDpPVZSoLSg8stWd1DPesn/qySYgtSGSY6hpWABVF98HRsBG
 +VXlHtqCaB0j0cGCDhCpHQUI10oGGc8k4zcvuQINBFMQe0EBEAChYaw3HqD3SvyBw0pqI+kk
 GIrLzO1XYXJXkuxPQ6BAFbe8jG3+h22zFU02OnJL8E1kLLMsCwVzVasYHOFiyY831IYHn/lh
 O+TN/lhWJTlUCxmWP8xFYJmta2mJzhzQDs3hyw5hF422T+rxgHg8gWxn0D6RO6hmGe7m3k91
 8EDvj5JXAq7zj49mT3AMRjUtsVVPy8zjagqyaizCUiHAnbG4kj+BuT5wxR7TKJGk2OjhK/Dh
 EHzgHq4XB1Gv8+1LvGLZmqih/kBpBP1hIGkakok579CTkw/g8XoWqr6Cjz2fvtjaQmTBwdou
 gP8Yn5kMBIiIxF7XLngUc5DVEJMYamcktd0q4aHC/cnbWlTwc2WrQBI1AwxCZgDC1RbOOan8
 oTIjWqRyaNp9zFvxOaJqgrxJA3Vl/3p9z+witk3pnmg4ITLIJDSmsf89MDaOVGQpDjzs9MaT
 YlIpTlW5Lns2WTYOue+NanntpX14UCGmeusk+4aYXPzf89zyALS3s3uLtVUdhFwLmdrFgHZS
 gjU5STLGlP8e9AVddVnf8qZ1czOvHX3UCCAI9YjBQA/5VxpRFJil4OTr9lUA5U57UKGpwmKw
 IPvArbT8468nYC2Rat4a7UJn3NLHucr9Vh0uvfgbFDhtPUb72sFA2cVI1tfZMnjfUx2jUYKM
 N5ErgK1Kes0piQARAQABiQEfBBgBCAAJBQJTEHtBAhsMAAoJEBrmhg5Wy9KTDecIAOGwpF/6
 sBFQtOk6HkegtqbrZklkDIKQ2qq7+uR7m6PkBpoNj+HsE2EEOIOqGFktN6h8alVVoSs+xY36
 1fnR/Kmwi30oCHL3QYWu2shmVa7IrjCyhm8N+n3JpGT6Ugznx3D9Fx/GfrvQlo9MVJE8QJWf
 +4uoGElKRtiVjbXZhP1/FVRMl7rAi8MtCtASOtAP+HUUyF9wuECqyd2W1F3oM+9Mp4x3/pUD
 GfSGSgEqETLkuRaMz0Iemm75sGRD3X+SPa4lBJc7x66ifAcdLdz7o3aLYfsjR6Zwca7TvC5E
 Ha0OfD9EsHGiF9909lPaRvG4buWFUfPBUPDkNHBLDwaQ53I=
Message-ID: <2eaac343-b3ef-4910-65e2-b9b0c7886029@FreeBSD.org>
Date: Fri, 26 Jul 2019 20:03:49 +0200
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101
 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <20190726052345.560b122cf2714bef73a2bf4f@bidouilliste.com>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Rspamd-Queue-Id: DC33E74230
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.981,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jul 2019 18:03:52 -0000

On 26/07/19 05:23, Emmanuel Vadot wrote:
> On Fri, 26 Jul 2019 14:58:01 +0200
> Guido Falsi <madpilot@FreeBSD.org> wrote:
>>>>> Hello,
>>>>>
>>>>> I don't know the actual workings of this file and have not checked it in
>>>>> depth, but this change is causing "make package" to not package
>>>>> /etc/rc.d/sshd (and others, all the ones being defined in
>>>>> ${group}PACKAGE variables), which are then missing when upgrading machines.
>>>>>
>>>>> Reverting this change makes packaging things work again. I think this
>>>>> change is actually wrong and the previous version was correct.
>>>>>
>>>
>>>  /etc/rc.d/sshd is in the FreeBSD-sshd package, the other ones are also
>>> in their own package now, I'll check them all to see if that make sense.
>>
>> It makes perfect sense for that file to be in the FreeBSD-sshd package
>> and that was my first guess when looking for the missing file, but in my
>> case it was not present in that package.
>>
>> By reverting your change it appears to end up in the FreeBSD-runtime
>> package.
> 
>  Fresh build from today :
> 
> elbarto@wopr> tar tzf FreeBSD-ssh-13.0.s20190726081149.txz /etc/rc.d/sshd
> /etc/rc.d/sshd
> elbarto@wopr> tar xzf FreeBSD-ssh-13.0.s20190726081149.txz +MANIFEST
> elbarto@wopr> jq < +MANIFEST | grep sshd
>     "/etc/rc.d/sshd": "1$09d051563f89dbae0f54af42add15f9c16d5bf5c63a32d8eadc5127f665e4de9",
>     "/etc/ssh/sshd_config": "1$7501d70e5186360c812b55cf0f0caff51169ca6764222f3fa668c09e8b5823a8",
>     "/usr/sbin/sshd": "1$85772d32ba83cf6edd190fe48e949a358b08079a1dcc2c6a0de9addfe5075829",
>     "/usr/share/man/man5/sshd_config.5.gz": "1$593bcd2338b124faf735825c52da8d9534f3e4b326a573590e8625f364017b57",
>     "/usr/share/man/man8/sshd.8.gz": "1$729b894da4fa632be0ca6e06897943caca0e9d699a8a3c0ed33393e0b7ecec44",
>     "/etc/rc.d/sshd",
>     "/etc/ssh/sshd_config"

A new build gives me the same result as you.

Unluckily I don't have the old packages without the files anymore (my
mistake). I have no idea what has been going on.

Sorry for the noise and thanks for having listened to me!

-- 
Guido Falsi <madpilot@FreeBSD.org>

From owner-svn-src-head@freebsd.org  Fri Jul 26 18:49:22 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0730BA6B7D;
 Fri, 26 Jul 2019 18:49:22 +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 D4CAE75B2A;
 Fri, 26 Jul 2019 18:49:21 +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 953F51B594;
 Fri, 26 Jul 2019 18:49:21 +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 x6QInLdM084078;
 Fri, 26 Jul 2019 18:49:21 GMT (envelope-from dim@FreeBSD.org)
Received: (from dim@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6QInLx6084076;
 Fri, 26 Jul 2019 18:49:21 GMT (envelope-from dim@FreeBSD.org)
Message-Id: <201907261849.x6QInLx6084076@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org
 using -f
From: Dimitry Andric <dim@FreeBSD.org>
Date: Fri, 26 Jul 2019 18:49:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350362 - head/contrib/llvm/lib/CodeGen
X-SVN-Group: head
X-SVN-Commit-Author: dim
X-SVN-Commit-Paths: head/contrib/llvm/lib/CodeGen
X-SVN-Commit-Revision: 350362
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: D4CAE75B2A
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.970,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jul 2019 18:49:22 -0000

Author: dim
Date: Fri Jul 26 18:49:20 2019
New Revision: 350362
URL: https://svnweb.freebsd.org/changeset/base/350362

Log:
  Pull in r366369 from upstream llvm trunk (by Francis Visoiu Mistrih):
  
    [CodeGen][NFC] Simplify checks for stack protector index checking
  
    Use `hasStackProtectorIndex()` instead of `getStackProtectorIndex()
    >= 0`.
  
  Pull in r366371 from upstream llvm trunk (by Francis Visoiu Mistrih):
  
    [PEI] Don't re-allocate a pre-allocated stack protector slot
  
    The LocalStackSlotPass pre-allocates a stack protector and makes sure
    that it comes before the local variables on the stack.
  
    We need to make sure that later during PEI we don't re-allocate a new
    stack protector slot. If that happens, the new stack protector slot
    will end up being **after** the local variables that it should be
    protecting.
  
    Therefore, we would have two slots assigned for two different stack
    protectors, one at the top of the stack, and one at the bottom. Since
    PEI will overwrite the assigned slot for the stack protector, the
    load that is used to compare the value of the stack protector will
    use the slot assigned by PEI, which is wrong.
  
    For this, we need to check if the object is pre-allocated, and re-use
    that pre-allocated slot.
  
    Differential Revision: https://reviews.llvm.org/D64757
  
  Pull in r367068 from upstream llvm trunk (by Francis Visoiu Mistrih):
  
    [CodeGen] Don't resolve the stack protector frame accesses until PEI
  
    Currently, stack protector loads and stores are resolved during
    LocalStackSlotAllocation (if the pass needs to run). When this is the
    case, the base register assigned to the frame access is going to be
    one of the vregs created during LocalStackSlotAllocation. This means
    that we are keeping a pointer to the stack protector slot, and we're
    using this pointer to load and store to it.
  
    In case register pressure goes up, we may end up spilling this
    pointer to the stack, which can be a security concern.
  
    Instead, leave it to PEI to resolve the frame accesses. In order to
    do that, we make all stack protector accesses go through frame index
    operands, then PEI will resolve this using an offset from sp/fp/bp.
  
    Differential Revision: https://reviews.llvm.org/D64759
  
  Together, these fix a issue where the stack protection feature in LLVM's
  ARM backend can be rendered ineffective when the stack protector slot is
  re-allocated so that it appears after the local variables that it is
  meant to protect, leaving the function potentially vulnerable to a
  stack-based buffer overflow.
  
  Reported by:	andrew
  Security:	https://kb.cert.org/vuls/id/129209/
  MFC after:	3 days

Modified:
  head/contrib/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp
  head/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp

Modified: head/contrib/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp
==============================================================================
--- head/contrib/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp	Fri Jul 26 17:58:46 2019	(r350361)
+++ head/contrib/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp	Fri Jul 26 18:49:20 2019	(r350362)
@@ -200,19 +200,27 @@ void LocalStackSlotPass::calculateFrameObjectOffsets(M
   // Make sure that the stack protector comes before the local variables on the
   // stack.
   SmallSet<int, 16> ProtectedObjs;
-  if (MFI.getStackProtectorIndex() >= 0) {
+  if (MFI.hasStackProtectorIndex()) {
+    int StackProtectorFI = MFI.getStackProtectorIndex();
+
+    // We need to make sure we didn't pre-allocate the stack protector when
+    // doing this.
+    // If we already have a stack protector, this will re-assign it to a slot
+    // that is **not** covering the protected objects.
+    assert(!MFI.isObjectPreAllocated(StackProtectorFI) &&
+           "Stack protector pre-allocated in LocalStackSlotAllocation");
+
     StackObjSet LargeArrayObjs;
     StackObjSet SmallArrayObjs;
     StackObjSet AddrOfObjs;
 
-    AdjustStackOffset(MFI, MFI.getStackProtectorIndex(), Offset,
-                      StackGrowsDown, MaxAlign);
+    AdjustStackOffset(MFI, StackProtectorFI, Offset, StackGrowsDown, MaxAlign);
 
     // Assign large stack objects first.
     for (unsigned i = 0, e = MFI.getObjectIndexEnd(); i != e; ++i) {
       if (MFI.isDeadObjectIndex(i))
         continue;
-      if (MFI.getStackProtectorIndex() == (int)i)
+      if (StackProtectorFI == (int)i)
         continue;
 
       switch (MFI.getObjectSSPLayout(i)) {
@@ -343,6 +351,14 @@ bool LocalStackSlotPass::insertFrameReferenceRegisters
     int FrameIdx = FR.getFrameIndex();
     assert(MFI.isObjectPreAllocated(FrameIdx) &&
            "Only pre-allocated locals expected!");
+
+    // We need to keep the references to the stack protector slot through frame
+    // index operands so that it gets resolved by PEI rather than this pass.
+    // This avoids accesses to the stack protector though virtual base
+    // registers, and forces PEI to address it using fp/sp/bp.
+    if (MFI.hasStackProtectorIndex() &&
+        FrameIdx == MFI.getStackProtectorIndex())
+      continue;
 
     LLVM_DEBUG(dbgs() << "Considering: " << MI);
 

Modified: head/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp
==============================================================================
--- head/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp	Fri Jul 26 17:58:46 2019	(r350361)
+++ head/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp	Fri Jul 26 18:49:20 2019	(r350362)
@@ -845,18 +845,26 @@ void PEI::calculateFrameObjectOffsets(MachineFunction 
   // Make sure that the stack protector comes before the local variables on the
   // stack.
   SmallSet<int, 16> ProtectedObjs;
-  if (MFI.getStackProtectorIndex() >= 0) {
+  if (MFI.hasStackProtectorIndex()) {
+    int StackProtectorFI = MFI.getStackProtectorIndex();
     StackObjSet LargeArrayObjs;
     StackObjSet SmallArrayObjs;
     StackObjSet AddrOfObjs;
 
-    AdjustStackOffset(MFI, MFI.getStackProtectorIndex(), StackGrowsDown,
-                      Offset, MaxAlign, Skew);
+    // If we need a stack protector, we need to make sure that
+    // LocalStackSlotPass didn't already allocate a slot for it.
+    // If we are told to use the LocalStackAllocationBlock, the stack protector
+    // is expected to be already pre-allocated.
+    if (!MFI.getUseLocalStackAllocationBlock())
+      AdjustStackOffset(MFI, StackProtectorFI, StackGrowsDown, Offset, MaxAlign,
+                        Skew);
+    else if (!MFI.isObjectPreAllocated(MFI.getStackProtectorIndex()))
+      llvm_unreachable(
+          "Stack protector not pre-allocated by LocalStackSlotPass.");
 
     // Assign large stack objects first.
     for (unsigned i = 0, e = MFI.getObjectIndexEnd(); i != e; ++i) {
-      if (MFI.isObjectPreAllocated(i) &&
-          MFI.getUseLocalStackAllocationBlock())
+      if (MFI.isObjectPreAllocated(i) && MFI.getUseLocalStackAllocationBlock())
         continue;
       if (i >= MinCSFrameIndex && i <= MaxCSFrameIndex)
         continue;
@@ -864,8 +872,7 @@ void PEI::calculateFrameObjectOffsets(MachineFunction 
         continue;
       if (MFI.isDeadObjectIndex(i))
         continue;
-      if (MFI.getStackProtectorIndex() == (int)i ||
-          EHRegNodeFrameIndex == (int)i)
+      if (StackProtectorFI == (int)i || EHRegNodeFrameIndex == (int)i)
         continue;
 
       switch (MFI.getObjectSSPLayout(i)) {
@@ -884,6 +891,15 @@ void PEI::calculateFrameObjectOffsets(MachineFunction 
       llvm_unreachable("Unexpected SSPLayoutKind.");
     }
 
+    // We expect **all** the protected stack objects to be pre-allocated by
+    // LocalStackSlotPass. If it turns out that PEI still has to allocate some
+    // of them, we may end up messing up the expected order of the objects.
+    if (MFI.getUseLocalStackAllocationBlock() &&
+        !(LargeArrayObjs.empty() && SmallArrayObjs.empty() &&
+          AddrOfObjs.empty()))
+      llvm_unreachable("Found protected stack objects not pre-allocated by "
+                       "LocalStackSlotPass.");
+
     AssignProtectedObjSet(LargeArrayObjs, ProtectedObjs, MFI, StackGrowsDown,
                           Offset, MaxAlign, Skew);
     AssignProtectedObjSet(SmallArrayObjs, ProtectedObjs, MFI, StackGrowsDown,
@@ -905,8 +921,7 @@ void PEI::calculateFrameObjectOffsets(MachineFunction 
       continue;
     if (MFI.isDeadObjectIndex(i))
       continue;
-    if (MFI.getStackProtectorIndex() == (int)i ||
-        EHRegNodeFrameIndex == (int)i)
+    if (MFI.getStackProtectorIndex() == (int)i || EHRegNodeFrameIndex == (int)i)
       continue;
     if (ProtectedObjs.count(i))
       continue;

From owner-svn-src-head@freebsd.org  Fri Jul 26 19:14:13 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 213B5A74CC;
 Fri, 26 Jul 2019 19:14:13 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 01B2C76CF1;
 Fri, 26 Jul 2019 19:14:13 +0000 (UTC) (envelope-from mav@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 D28501BB1B;
 Fri, 26 Jul 2019 19:14:12 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6QJEC0X001662;
 Fri, 26 Jul 2019 19:14:12 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6QJEC2B001660;
 Fri, 26 Jul 2019 19:14:12 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201907261914.x6QJEC2B001660@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Fri, 26 Jul 2019 19:14:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350363 - in head/sys/cam: ctl scsi
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: in head/sys/cam: ctl scsi
X-SVN-Commit-Revision: 350363
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 01B2C76CF1
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.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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jul 2019 19:14:13 -0000

Author: mav
Date: Fri Jul 26 19:14:12 2019
New Revision: 350363
URL: https://svnweb.freebsd.org/changeset/base/350363

Log:
  Add support for Long LBA mode parameter block descriptor.
  
  It is formally required for SBC Base 2016 feature set.
  
  MFC after:	2 weeks

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/scsi/scsi_all.h

Modified: head/sys/cam/ctl/ctl.c
==============================================================================
--- head/sys/cam/ctl/ctl.c	Fri Jul 26 18:49:20 2019	(r350362)
+++ head/sys/cam/ctl/ctl.c	Fri Jul 26 19:14:12 2019	(r350363)
@@ -6365,13 +6365,12 @@ int
 ctl_mode_sense(struct ctl_scsiio *ctsio)
 {
 	struct ctl_lun *lun = CTL_LUN(ctsio);
-	int pc, page_code, dbd, subpage;
-	int alloc_len, page_len, header_len, total_len;
-	struct scsi_mode_block_descr *block_desc;
+	int pc, page_code, llba, subpage;
+	int alloc_len, page_len, header_len, bd_len, total_len;
+	void *block_desc;
 	struct ctl_page_index *page_index;
 
-	dbd = 0;
-	block_desc = NULL;
+	llba = 0;
 
 	CTL_DEBUG_PRINT(("ctl_mode_sense\n"));
 
@@ -6383,9 +6382,10 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
 
 		header_len = sizeof(struct scsi_mode_hdr_6);
 		if (cdb->byte2 & SMS_DBD)
-			dbd = 1;
+			bd_len = 0;
 		else
-			header_len += sizeof(struct scsi_mode_block_descr);
+			bd_len = sizeof(struct scsi_mode_block_descr);
+		header_len += bd_len;
 
 		pc = (cdb->page & SMS_PAGE_CTRL_MASK) >> 6;
 		page_code = cdb->page & SMS_PAGE_CODE;
@@ -6399,11 +6399,18 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
 		cdb = (struct scsi_mode_sense_10 *)ctsio->cdb;
 
 		header_len = sizeof(struct scsi_mode_hdr_10);
+		if (cdb->byte2 & SMS_DBD) {
+			bd_len = 0;
+		} else if (lun->be_lun->lun_type == T_DIRECT) {
+			if (cdb->byte2 & SMS10_LLBAA) {
+				llba = 1;
+				bd_len = sizeof(struct scsi_mode_block_descr_dlong);
+			} else
+				bd_len = sizeof(struct scsi_mode_block_descr_dshort);
+		} else
+			bd_len = sizeof(struct scsi_mode_block_descr);
+		header_len += bd_len;
 
-		if (cdb->byte2 & SMS_DBD)
-			dbd = 1;
-		else
-			header_len += sizeof(struct scsi_mode_block_descr);
 		pc = (cdb->page & SMS_PAGE_CTRL_MASK) >> 6;
 		page_code = cdb->page & SMS_PAGE_CODE;
 		subpage = cdb->subpage;
@@ -6536,12 +6543,8 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
 			    (lun->MODE_CTRL.eca_and_aen & SCP_SWP) != 0)
 				header->dev_specific |= 0x80; /* WP */
 		}
-		if (dbd)
-			header->block_descr_len = 0;
-		else
-			header->block_descr_len =
-				sizeof(struct scsi_mode_block_descr);
-		block_desc = (struct scsi_mode_block_descr *)&header[1];
+		header->block_descr_len = bd_len;
+		block_desc = &header[1];
 		break;
 	}
 	case MODE_SENSE_10: {
@@ -6558,12 +6561,10 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
 			    (lun->MODE_CTRL.eca_and_aen & SCP_SWP) != 0)
 				header->dev_specific |= 0x80; /* WP */
 		}
-		if (dbd)
-			scsi_ulto2b(0, header->block_descr_len);
-		else
-			scsi_ulto2b(sizeof(struct scsi_mode_block_descr),
-				    header->block_descr_len);
-		block_desc = (struct scsi_mode_block_descr *)&header[1];
+		if (llba)
+			header->flags |= SMH_LONGLBA;
+		scsi_ulto2b(bd_len, header->block_descr_len);
+		block_desc = &header[1];
 		break;
 	}
 	default:
@@ -6574,12 +6575,27 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
 	 * If we've got a disk, use its blocksize in the block
 	 * descriptor.  Otherwise, just set it to 0.
 	 */
-	if (dbd == 0) {
-		if (lun->be_lun->lun_type == T_DIRECT)
-			scsi_ulto3b(lun->be_lun->blocksize,
-				    block_desc->block_len);
-		else
-			scsi_ulto3b(0, block_desc->block_len);
+	if (bd_len > 0) {
+		if (lun->be_lun->lun_type == T_DIRECT) {
+			if (llba) {
+				struct scsi_mode_block_descr_dlong *bd = block_desc;
+				if (lun->be_lun->maxlba != 0)
+					scsi_u64to8b(lun->be_lun->maxlba + 1,
+					    bd->num_blocks);
+				scsi_ulto4b(lun->be_lun->blocksize,
+				    bd->block_len);
+			} else {
+				struct scsi_mode_block_descr_dshort *bd = block_desc;
+				if (lun->be_lun->maxlba != 0)
+					scsi_ulto4b(MIN(lun->be_lun->maxlba+1,
+					    UINT32_MAX), bd->num_blocks);
+				scsi_ulto3b(lun->be_lun->blocksize,
+				    bd->block_len);
+			}
+		} else {
+			struct scsi_mode_block_descr *bd = block_desc;
+			scsi_ulto3b(0, bd->block_len);
+		}
 	}
 
 	switch (page_code) {

Modified: head/sys/cam/scsi/scsi_all.h
==============================================================================
--- head/sys/cam/scsi/scsi_all.h	Fri Jul 26 18:49:20 2019	(r350362)
+++ head/sys/cam/scsi/scsi_all.h	Fri Jul 26 19:14:12 2019	(r350363)
@@ -264,7 +264,9 @@ struct scsi_mode_hdr_10
 	u_int8_t datalen[2];
 	u_int8_t medium_type;
 	u_int8_t dev_specific;
-	u_int8_t reserved[2];
+	u_int8_t flags;
+#define	SMH_LONGLBA	0x01
+	u_int8_t reserved;
 	u_int8_t block_descr_len[2];
 };
 
@@ -274,6 +276,20 @@ struct scsi_mode_block_descr
 	u_int8_t num_blocks[3];
 	u_int8_t reserved;
 	u_int8_t block_len[3];
+};
+
+struct scsi_mode_block_descr_dshort
+{
+	u_int8_t num_blocks[4];
+	u_int8_t reserved;
+	u_int8_t block_len[3];
+};
+
+struct scsi_mode_block_descr_dlong
+{
+	u_int8_t num_blocks[8];
+	u_int8_t reserved[4];
+	u_int8_t block_len[4];
 };
 
 struct scsi_per_res_in

From owner-svn-src-head@freebsd.org  Fri Jul 26 19:16:02 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7002A7586;
 Fri, 26 Jul 2019 19:16:02 +0000 (UTC) (envelope-from kp@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 C88B876E75;
 Fri, 26 Jul 2019 19:16:02 +0000 (UTC) (envelope-from kp@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 A01301BB1E;
 Fri, 26 Jul 2019 19:16:02 +0000 (UTC) (envelope-from kp@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6QJG2Wp001817;
 Fri, 26 Jul 2019 19:16:02 GMT (envelope-from kp@FreeBSD.org)
Received: (from kp@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6QJG297001816;
 Fri, 26 Jul 2019 19:16:02 GMT (envelope-from kp@FreeBSD.org)
Message-Id: <201907261916.x6QJG297001816@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org
 using -f
From: Kristof Provost <kp@FreeBSD.org>
Date: Fri, 26 Jul 2019 19:16:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350364 - in head/sys/dev/virtio: mmio pci
X-SVN-Group: head
X-SVN-Commit-Author: kp
X-SVN-Commit-Paths: in head/sys/dev/virtio: mmio pci
X-SVN-Commit-Revision: 350364
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: C88B876E75
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.967,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jul 2019 19:16:03 -0000

Author: kp
Date: Fri Jul 26 19:16:02 2019
New Revision: 350364
URL: https://svnweb.freebsd.org/changeset/base/350364

Log:
  virtio: Fix running on machines with memory above 0xffffffff
  
  We want to allocate a contiguous memory block anywhere in memory, but
  expressed this as having to be between 0 and 0xffffffff. This limits us
  on 64-bit machines, and outright breaks on machines where memory is
  mapped above that address range.
  
  Allow the full address range to be used for this allocation.
  
  Sponsored by:	Axiado

Modified:
  head/sys/dev/virtio/mmio/virtio_mmio.c
  head/sys/dev/virtio/pci/virtio_pci.c

Modified: head/sys/dev/virtio/mmio/virtio_mmio.c
==============================================================================
--- head/sys/dev/virtio/mmio/virtio_mmio.c	Fri Jul 26 19:14:12 2019	(r350363)
+++ head/sys/dev/virtio/mmio/virtio_mmio.c	Fri Jul 26 19:16:02 2019	(r350364)
@@ -440,7 +440,7 @@ vtmmio_alloc_virtqueues(device_t dev, int flags, int n
 		size = vtmmio_read_config_4(sc, VIRTIO_MMIO_QUEUE_NUM_MAX);
 
 		error = virtqueue_alloc(dev, idx, size,
-		    VIRTIO_MMIO_VRING_ALIGN, 0xFFFFFFFFUL, info, &vq);
+		    VIRTIO_MMIO_VRING_ALIGN, ~(vm_paddr_t)0, info, &vq);
 		if (error) {
 			device_printf(dev,
 			    "cannot allocate virtqueue %d: %d\n",

Modified: head/sys/dev/virtio/pci/virtio_pci.c
==============================================================================
--- head/sys/dev/virtio/pci/virtio_pci.c	Fri Jul 26 19:14:12 2019	(r350363)
+++ head/sys/dev/virtio/pci/virtio_pci.c	Fri Jul 26 19:16:02 2019	(r350364)
@@ -505,7 +505,7 @@ vtpci_alloc_virtqueues(device_t dev, int flags, int nv
 		size = vtpci_read_config_2(sc, VIRTIO_PCI_QUEUE_NUM);
 
 		error = virtqueue_alloc(dev, idx, size, VIRTIO_PCI_VRING_ALIGN,
-		    0xFFFFFFFFUL, info, &vq);
+		    ~(vm_paddr_t)0, info, &vq);
 		if (error) {
 			device_printf(dev,
 			    "cannot allocate virtqueue %d: %d\n", idx, error);

From owner-svn-src-head@freebsd.org  Fri Jul 26 21:11:06 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 494D2A97A7;
 Fri, 26 Jul 2019 21:11:06 +0000 (UTC) (envelope-from pfg@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 ECEEF83245;
 Fri, 26 Jul 2019 21:11:05 +0000 (UTC) (envelope-from pfg@FreeBSD.org)
Received: from [192.168.0.5] (unknown [181.52.72.201])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client did not present a certificate) (Authenticated sender: pfg)
 by smtp.freebsd.org (Postfix) with ESMTPSA id 3A8781510D;
 Fri, 26 Jul 2019 21:11:05 +0000 (UTC) (envelope-from pfg@FreeBSD.org)
Subject: Re: svn commit: r349802 - head/sys/fs/ext2fs
To: Ed Maste <emaste@freebsd.org>, Fedor Uporov <fsu@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>,
 svn-src-head <svn-src-head@freebsd.org>
References: <201907070858.x678w3go067222@repo.freebsd.org>
 <CAPyFy2B8bDaLFq5bOWBhCBr4xhN=uEWpj1qgU4=tGkx8Deipig@mail.gmail.com>
From: Pedro Giffuni <pfg@FreeBSD.org>
Organization: FreeBSD
Message-ID: <a8f07ce9-1449-2018-5654-9ce54838e41c@FreeBSD.org>
Date: Fri, 26 Jul 2019 16:11:04 -0500
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101
 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <CAPyFy2B8bDaLFq5bOWBhCBr4xhN=uEWpj1qgU4=tGkx8Deipig@mail.gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-Rspamd-Queue-Id: ECEEF83245
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];
 ASN(0.00)[asn:11403, ipnet:96.47.64.0/20, 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jul 2019 21:11:06 -0000

Hi;

On 2019-07-24 08:21, Ed Maste wrote:
> On Sun, 7 Jul 2019 at 04:58, Fedor Uporov <fsu@freebsd.org> wrote:
>> 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.
> Will you MFC this to stable/12 and stable/11?
>

After light testing, I committed it to stable/12. stable/11 has diverged 
a lot (the patch doesn't apply cleanly) and since the patch is not 
critical, it don't think it is worth merging.

Cheers,

Pedro.


From owner-svn-src-head@freebsd.org  Fri Jul 26 21:56:37 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86DA9AAA34;
 Fri, 26 Jul 2019 21:56:37 +0000 (UTC)
 (envelope-from kostikbel@gmail.com)
Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id E9CE884E22;
 Fri, 26 Jul 2019 21:56:36 +0000 (UTC)
 (envelope-from kostikbel@gmail.com)
Received: from tom.home (kib@localhost [127.0.0.1])
 by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x6QLuS1G025275
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO);
 Sat, 27 Jul 2019 00:56:31 +0300 (EEST)
 (envelope-from kostikbel@gmail.com)
DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x6QLuS1G025275
Received: (from kostik@localhost)
 by tom.home (8.15.2/8.15.2/Submit) id x6QLuSnG025274;
 Sat, 27 Jul 2019 00:56:28 +0300 (EEST)
 (envelope-from kostikbel@gmail.com)
X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com
 using -f
Date: Sat, 27 Jul 2019 00:56:28 +0300
From: Konstantin Belousov <kostikbel@gmail.com>
To: Rick Macklem <rmacklem@FreeBSD.org>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: Re: svn commit: r350315 - in head/sys: kern sys
Message-ID: <20190726215628.GE2731@kib.kiev.ua>
References: <201907250546.x6P5kHWq076756@repo.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201907250546.x6P5kHWq076756@repo.freebsd.org>
User-Agent: Mutt/1.12.1 (2019-06-15)
X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00,
 DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM,
 NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jul 2019 21:56:37 -0000

On Thu, Jul 25, 2019 at 05:46:17AM +0000, Rick Macklem wrote:
> Author: rmacklem
> Date: Thu Jul 25 05:46:16 2019
> New Revision: 350315
> URL: https://svnweb.freebsd.org/changeset/base/350315
> 
> Log:
>   Add kernel support for a Linux compatible copy_file_range(2) syscall.

> Modified: head/sys/kern/syscalls.master
> ==============================================================================
> --- head/sys/kern/syscalls.master	Thu Jul 25 03:55:05 2019	(r350314)
> +++ head/sys/kern/syscalls.master	Thu Jul 25 05:46:16 2019	(r350315)
> @@ -3175,6 +3175,16 @@
>  		    int flag
>  		);
>  	}
> +569	AUE_NULL	STD {
> +		ssize_t copy_file_range(
> +		    int infd,
> +		    _Inout_opt_ off_t *inoffp,
> +		    int outfd,
> +		    _Inout_opt_ off_t *outoffp,
> +		    size_t len,
> +		    unsigned int flags
> +		);
> +	}

I sat to write the compat32 shims, and only then noted that len has size_t
type.  Why is it size_t and not off_t ?

From owner-svn-src-head@freebsd.org  Sat Jul 27 01:35:08 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5C7EADD5C;
 Sat, 27 Jul 2019 01:35:08 +0000 (UTC)
 (envelope-from rmacklem@uoguelph.ca)
Received: from CAN01-TO1-obe.outbound.protection.outlook.com
 (mail-eopbgr670060.outbound.protection.outlook.com [40.107.67.60])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "mail.protection.outlook.com",
 Issuer "GlobalSign Organization Validation CA - SHA256 - G3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 93C168B55F;
 Sat, 27 Jul 2019 01:35:08 +0000 (UTC)
 (envelope-from rmacklem@uoguelph.ca)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=FguftwrYaHT8WsBfQwTIbchYd6JAUp/CsLo6YTOCCsxpg5Ru+9iTaOQfcNYf6qApmLeqrC+opprkGu4vJmYlgdnQ1YZtiPBZT2KTFToH/sNqPZq5mCOFdVU66Wl2mltI6ngUGg6y+XPPkqP1eEIOOMnnynliQwrQkb5Oilx0wbL6lG56wCAXkx90bafBFbWhFgvJrV0SQ+QZmVDtzqBlxKiQh86McQPLpJBgLWONUST0xo4mZUuzS7B81hn4aLEsjBC7PnBek3tQ4dfmdzxGiagsHq+YagM/qz+BbD5TcSsXb6hBNKlr17S9vb8TWCnB54hAQdBPtz04b/dE1o92Kg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=gGbIl/w7eO6GiSVuDUdKXzwlVsh1pZSA0cUVeCKgnZo=;
 b=a2Jo4F+3I964P9pvaDjo02XQA4JhUnw8tUvIhzZu7VbxghCBUKdOj9sgmtviAw9MlPw9/SCMtWoBBUUNirz8uiXQkleqargOLdZjkZdfO5fSRAYYU29X3/wXtKutBQ5XXKpfaZUUnrjEdZpzKj+GpUFUvH2WQrLqovGfqtovhu5ZX/O3GZLMm+oTZ1Nxi8XpXUwXtBfuH7VbaLBDhrBYkAjYsnFoMrs1rLS/yX1UnyMb00vAB/AsQvfxEyGsKSn1OPUUyhyhL1ZB3Jt/QORfOgWMD8r36iPSzXyXTNollbrbXm/1tmRPt7D6KwAuHEqS2Y7fhLbxMLoMucx48WAHTw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass
 smtp.mailfrom=uoguelph.ca;dmarc=pass action=none
 header.from=uoguelph.ca;dkim=pass header.d=uoguelph.ca;arc=none
Received: from YTBPR01MB3312.CANPRD01.PROD.OUTLOOK.COM (10.255.13.158) by
 YTBPR01MB3486.CANPRD01.PROD.OUTLOOK.COM (10.255.47.14) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.2115.10; Sat, 27 Jul 2019 01:35:06 +0000
Received: from YTBPR01MB3312.CANPRD01.PROD.OUTLOOK.COM
 ([fe80::70d6:627b:b391:3977]) by YTBPR01MB3312.CANPRD01.PROD.OUTLOOK.COM
 ([fe80::70d6:627b:b391:3977%7]) with mapi id 15.20.2115.005; Sat, 27 Jul 2019
 01:35:06 +0000
From: Rick Macklem <rmacklem@uoguelph.ca>
To: Konstantin Belousov <kostikbel@gmail.com>, Rick Macklem
 <rmacklem@FreeBSD.org>
CC: "src-committers@freebsd.org" <src-committers@freebsd.org>,
 "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,
 "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject: Re: svn commit: r350315 - in head/sys: kern sys
Thread-Topic: svn commit: r350315 - in head/sys: kern sys
Thread-Index: AQHVQ/0DsB7s4Yi/T0Guwd+l7YYIgqbdrdDe
Date: Sat, 27 Jul 2019 01:35:06 +0000
Message-ID: <YTBPR01MB33127701BFED8EF3FE933C96DDC30@YTBPR01MB3312.CANPRD01.PROD.OUTLOOK.COM>
References: <201907250546.x6P5kHWq076756@repo.freebsd.org>,
 <20190726215628.GE2731@kib.kiev.ua>
In-Reply-To: <20190726215628.GE2731@kib.kiev.ua>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: f9acca05-368a-4118-0a42-08d71232a7a3
x-microsoft-antispam: BCL:0; PCL:0;
 RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020);
 SRVR:YTBPR01MB3486; 
x-ms-traffictypediagnostic: YTBPR01MB3486:
x-ms-exchange-purlcount: 1
x-microsoft-antispam-prvs: <YTBPR01MB3486E97A4161EB8B0AD60E79DDC30@YTBPR01MB3486.CANPRD01.PROD.OUTLOOK.COM>
x-ms-oob-tlc-oobclassifiers: OLM:913;
x-forefront-prvs: 01110342A5
x-forefront-antispam-report: SFV:NSPM;
 SFS:(10009020)(376002)(346002)(136003)(366004)(396003)(39860400002)(189003)(199004)(305945005)(966005)(6246003)(6506007)(76116006)(52536014)(8936002)(316002)(66556008)(66446008)(5660300002)(14454004)(786003)(64756008)(66476007)(74316002)(66946007)(86362001)(229853002)(99286004)(6436002)(76176011)(7696005)(25786009)(256004)(33656002)(4326008)(9686003)(71200400001)(110136005)(53936002)(68736007)(81166006)(11346002)(54906003)(446003)(71190400001)(2906002)(81156014)(102836004)(186003)(6306002)(55016002)(478600001)(486006)(46003)(476003)(8676002);
 DIR:OUT; SFP:1101; SCL:1; SRVR:YTBPR01MB3486;
 H:YTBPR01MB3312.CANPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en;
 PTR:InfoNoRecords; MX:1; A:1; 
received-spf: None (protection.outlook.com: uoguelph.ca does not designate
 permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info: jhtzy5dQY+74HE6W4dx6jWqK1D0N4GebcFQCMCD+HpdTQ+w9BtruxcUqCtCbjEsc91OxQ1V4drHtYCtVhnUrrDgUVT2o7Xo2YuRg4qApDgIStPMGHiEtExlAhNBJHiDW1+lriWzVKF7Q2mpa/0QSSQjrLL1gE+eauQsd9eqr100QfJCpji/HuO6a6DaB1ckC0HBv+sE/iuJ/OI1X2gup1PxFF0qHtZWDI97hXUwS+jdkdfsCkC4ACKBnDmX8i7QWHN1TWzw65rJxEIS+E7b7IS6U3DRf9S8EWJ/hdfcV6au9YNIZcAELUWAKUe30vvrXFJuKGLYIneLnp2pRfk4NgyNOQ9lgb+A5pufkRFGHpOvZaxlOfQ3jnTR7H+62BMAMS3dr8FP2Hz4/qXz6RPTLBERqfhCHaGmVAnsHQs+2NwQ=
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: uoguelph.ca
X-MS-Exchange-CrossTenant-Network-Message-Id: f9acca05-368a-4118-0a42-08d71232a7a3
X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Jul 2019 01:35:06.5379 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: rmacklem@uoguelph.ca
X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTBPR01MB3486
X-Rspamd-Queue-Id: 93C168B55F
X-Spamd-Bar: ------
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-6.89 / 15.00];
 NEURAL_HAM_MEDIUM(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.89)[-0.894,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 27 Jul 2019 01:35:08 -0000

Konstantin Belousov wrote:
>On Thu, Jul 25, 2019 at 05:46:17AM +0000, Rick Macklem wrote:
>> Author: rmacklem
>> Date: Thu Jul 25 05:46:16 2019
>> New Revision: 350315
>> URL: https://svnweb.freebsd.org/changeset/base/350315
>>
>> Log:
>>   Add kernel support for a Linux compatible copy_file_range(2) syscall.
>
>> Modified: head/sys/kern/syscalls.master
>> >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=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/kern/syscalls.master     Thu Jul 25 03:55:05 2019        (r=
350314)
>> +++ head/sys/kern/syscalls.master     Thu Jul 25 05:46:16 2019        (r=
350315)
>> @@ -3175,6 +3175,16 @@
>>                   int flag
>>               );
>>       }
>> +569  AUE_NULL        STD {
>> +             ssize_t copy_file_range(
>> +                 int infd,
>> +                 _Inout_opt_ off_t *inoffp,
>> +                 int outfd,
>> +                 _Inout_opt_ off_t *outoffp,
>> +                 size_t len,
>> +                 unsigned int flags
>> +             );
>> +     }
>
>I sat to write the compat32 shims, and only then noted that len has size_t
>type.  Why is it size_t and not off_t ?
Well, that's what Linux did.

Also, since it returns ssize_t, it can't do more than SSIZE_MAX (generally =
1/2 of
SIZE_T_MAX). Returning ssize_t is also what Linux does and is consistent wi=
th
read(2)/write(2).

rick

From owner-svn-src-head@freebsd.org  Sat Jul 27 01:52:35 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4DE12AE51D;
 Sat, 27 Jul 2019 01:52:35 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 2FC6C8C131;
 Sat, 27 Jul 2019 01:52:35 +0000 (UTC)
 (envelope-from rmacklem@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 082C420267;
 Sat, 27 Jul 2019 01:52:35 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6R1qYMT020083;
 Sat, 27 Jul 2019 01:52:34 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6R1qYo4020082;
 Sat, 27 Jul 2019 01:52:34 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201907270152.x6R1qYo4020082@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Sat, 27 Jul 2019 01:52:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350367 - head/sys/ufs/ufs
X-SVN-Group: head
X-SVN-Commit-Author: rmacklem
X-SVN-Commit-Paths: head/sys/ufs/ufs
X-SVN-Commit-Revision: 350367
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 2FC6C8C131
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)[-1.000,0];
 NEURAL_HAM_SHORT(-0.91)[-0.906,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 27 Jul 2019 01:52:35 -0000

Author: rmacklem
Date: Sat Jul 27 01:52:34 2019
New Revision: 350367
URL: https://svnweb.freebsd.org/changeset/base/350367

Log:
  Lock the vnode before calling ufs_bmap_seekdata().
  
  r346932 replaced a call to vn_bmap_seekhole() with a call to
  ufs_bmap_seekdata(). Although vn_bmap_seekhole() locks the vnode,
  ufs_bmap_seekdata() assumes it is already locked.
  This patch adds locking of the vnode before the ufs_bmap_seekdata() call.
  If the vn_lock() call fails, it returns EBADF since that is the normal
  error returned when a file system is forced dismounted and is already
  listed as an error return in the lseek(2) man page.
  
  Discussed with:	markj
  Reviewed by:	kib

Modified:
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/sys/ufs/ufs/ufs_vnops.c
==============================================================================
--- head/sys/ufs/ufs/ufs_vnops.c	Fri Jul 26 21:08:01 2019	(r350366)
+++ head/sys/ufs/ufs/ufs_vnops.c	Sat Jul 27 01:52:34 2019	(r350367)
@@ -2702,11 +2702,18 @@ static int
 ufs_ioctl(struct vop_ioctl_args *ap)
 {
 	struct vnode *vp;
+	int error;
 
 	vp = ap->a_vp;
 	switch (ap->a_command) {
 	case FIOSEEKDATA:
-		return (ufs_bmap_seekdata(vp, (off_t *)ap->a_data));
+		error = vn_lock(vp, LK_SHARED);
+		if (error == 0) {
+			error = ufs_bmap_seekdata(vp, (off_t *)ap->a_data);
+			VOP_UNLOCK(vp, 0);
+		} else
+			error = EBADF;
+		return (error);
 	case FIOSEEKHOLE:
 		return (vn_bmap_seekhole(vp, ap->a_command, (off_t *)ap->a_data,
 		    ap->a_cred));

From owner-svn-src-head@freebsd.org  Sat Jul 27 09:36:29 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id DCF14B51AD;
 Sat, 27 Jul 2019 09:36:29 +0000 (UTC)
 (envelope-from arybchik@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 BF8BB73513;
 Sat, 27 Jul 2019 09:36:29 +0000 (UTC)
 (envelope-from arybchik@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 90CF025566;
 Sat, 27 Jul 2019 09:36:29 +0000 (UTC)
 (envelope-from arybchik@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6R9aTiq093203;
 Sat, 27 Jul 2019 09:36:29 GMT (envelope-from arybchik@FreeBSD.org)
Received: (from arybchik@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6R9aRm5093194;
 Sat, 27 Jul 2019 09:36:27 GMT (envelope-from arybchik@FreeBSD.org)
Message-Id: <201907270936.x6R9aRm5093194@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: arybchik set sender to
 arybchik@FreeBSD.org using -f
From: Andrew Rybchenko <arybchik@FreeBSD.org>
Date: Sat, 27 Jul 2019 09:36:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350369 - in head/sys/dev/sfxge: . common
X-SVN-Group: head
X-SVN-Commit-Author: arybchik
X-SVN-Commit-Paths: in head/sys/dev/sfxge: . common
X-SVN-Commit-Revision: 350369
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: BF8BB73513
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_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.95)[-0.953,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 27 Jul 2019 09:36:29 -0000

Author: arybchik
Date: Sat Jul 27 09:36:27 2019
New Revision: 350369
URL: https://svnweb.freebsd.org/changeset/base/350369

Log:
  sfxge(4): fix power of 2 round up when align has smaller type
  
  Substitute driver-defined P2ROUNDUP() h with EFX_P2ROUNDUP()
  defined in libefx.
  
  Cast value and alignment to one specified type to guarantee result
  correctness.
  
  Reported by:	Andrea Valsania <andrea.valsania at answervad.it>
  Reviewed by:    philip
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:      2 days
  Differential Revision:  https://reviews.freebsd.org/D21074

Modified:
  head/sys/dev/sfxge/common/ef10_impl.h
  head/sys/dev/sfxge/common/ef10_nvram.c
  head/sys/dev/sfxge/common/ef10_rx.c
  head/sys/dev/sfxge/common/efsys.h
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_mcdi.h
  head/sys/dev/sfxge/common/efx_tx.c
  head/sys/dev/sfxge/sfxge_port.c
  head/sys/dev/sfxge/sfxge_rx.c

Modified: head/sys/dev/sfxge/common/ef10_impl.h
==============================================================================
--- head/sys/dev/sfxge/common/ef10_impl.h	Sat Jul 27 02:23:05 2019	(r350368)
+++ head/sys/dev/sfxge/common/ef10_impl.h	Sat Jul 27 09:36:27 2019	(r350369)
@@ -1269,10 +1269,11 @@ efx_mcdi_set_nic_global(
 #define	EFX_RX_PACKED_STREAM_RX_PREFIX_SIZE 8
 
 /* Minimum space for packet in packed stream mode */
-#define	EFX_RX_PACKED_STREAM_MIN_PACKET_SPACE		     \
-	P2ROUNDUP(EFX_RX_PACKED_STREAM_RX_PREFIX_SIZE +	     \
-	    EFX_MAC_PDU_MIN +				     \
-	    EFX_RX_PACKED_STREAM_ALIGNMENT,		     \
+#define	EFX_RX_PACKED_STREAM_MIN_PACKET_SPACE		\
+	EFX_P2ROUNDUP(size_t,				\
+	    EFX_RX_PACKED_STREAM_RX_PREFIX_SIZE +	\
+	    EFX_MAC_PDU_MIN +				\
+	    EFX_RX_PACKED_STREAM_ALIGNMENT,		\
 	    EFX_RX_PACKED_STREAM_ALIGNMENT)
 
 /* Maximum number of credits */

Modified: head/sys/dev/sfxge/common/ef10_nvram.c
==============================================================================
--- head/sys/dev/sfxge/common/ef10_nvram.c	Sat Jul 27 02:23:05 2019	(r350368)
+++ head/sys/dev/sfxge/common/ef10_nvram.c	Sat Jul 27 09:36:27 2019	(r350369)
@@ -394,7 +394,8 @@ tlv_write(
 	if (len > 0) {
 		ptr[(len - 1) / sizeof (uint32_t)] = 0;
 		memcpy(ptr, data, len);
-		ptr += P2ROUNDUP(len, sizeof (uint32_t)) / sizeof (*ptr);
+		ptr += EFX_P2ROUNDUP(uint32_t, len,
+		    sizeof (uint32_t)) / sizeof (*ptr);
 	}
 
 	return (ptr);

Modified: head/sys/dev/sfxge/common/ef10_rx.c
==============================================================================
--- head/sys/dev/sfxge/common/ef10_rx.c	Sat Jul 27 02:23:05 2019	(r350368)
+++ head/sys/dev/sfxge/common/ef10_rx.c	Sat Jul 27 09:36:27 2019	(r350369)
@@ -957,8 +957,9 @@ ef10_rx_qps_packet_info(
 	*lengthp   = EFX_QWORD_FIELD(*qwordp, ES_DZ_PS_RX_PREFIX_ORIG_LEN);
 	buf_len    = EFX_QWORD_FIELD(*qwordp, ES_DZ_PS_RX_PREFIX_CAP_LEN);
 
-	buf_len = P2ROUNDUP(buf_len + EFX_RX_PACKED_STREAM_RX_PREFIX_SIZE,
-			    EFX_RX_PACKED_STREAM_ALIGNMENT);
+	buf_len = EFX_P2ROUNDUP(uint16_t,
+	    buf_len + EFX_RX_PACKED_STREAM_RX_PREFIX_SIZE,
+	    EFX_RX_PACKED_STREAM_ALIGNMENT);
 	*next_offsetp =
 	    current_offset + buf_len + EFX_RX_PACKED_STREAM_ALIGNMENT;
 

Modified: head/sys/dev/sfxge/common/efsys.h
==============================================================================
--- head/sys/dev/sfxge/common/efsys.h	Sat Jul 27 02:23:05 2019	(r350368)
+++ head/sys/dev/sfxge/common/efsys.h	Sat Jul 27 09:36:27 2019	(r350369)
@@ -88,10 +88,6 @@ extern "C" {
 #define	IS_P2ALIGNED(v, a)	((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0)
 #endif
 
-#ifndef P2ROUNDUP
-#define	P2ROUNDUP(x, align)	(-(-(x) & -(align)))
-#endif
-
 #ifndef P2ALIGN
 #define	P2ALIGN(_x, _a)		((_x) & -(_a))
 #endif

Modified: head/sys/dev/sfxge/common/efx.h
==============================================================================
--- head/sys/dev/sfxge/common/efx.h	Sat Jul 27 02:23:05 2019	(r350368)
+++ head/sys/dev/sfxge/common/efx.h	Sat Jul 27 09:36:27 2019	(r350369)
@@ -56,6 +56,10 @@ extern "C" {
 /* The macro expands divider twice */
 #define	EFX_DIV_ROUND_UP(_n, _d)		(((_n) + (_d) - 1) / (_d))
 
+/* Round value up to the nearest power of two. */
+#define	EFX_P2ROUNDUP(_type, _value, _align)	\
+	(-(-(_type)(_value) & -(_type)(_align)))
+
 /* Return codes */
 
 typedef __success(return == 0) int efx_rc_t;
@@ -522,10 +526,10 @@ typedef enum efx_link_mode_e {
 	    + /* bug16011 */ 16)				\
 
 #define	EFX_MAC_PDU(_sdu)					\
-	P2ROUNDUP((_sdu) + EFX_MAC_PDU_ADJUSTMENT, 8)
+	EFX_P2ROUNDUP(size_t, (_sdu) + EFX_MAC_PDU_ADJUSTMENT, 8)
 
 /*
- * Due to the P2ROUNDUP in EFX_MAC_PDU(), EFX_MAC_SDU_FROM_PDU() may give
+ * Due to the EFX_P2ROUNDUP in EFX_MAC_PDU(), EFX_MAC_SDU_FROM_PDU() may give
  * the SDU rounded up slightly.
  */
 #define	EFX_MAC_SDU_FROM_PDU(_pdu)	((_pdu) - EFX_MAC_PDU_ADJUSTMENT)
@@ -611,8 +615,9 @@ efx_mac_stat_name(
 
 #define	EFX_MAC_STATS_MASK_BITS_PER_PAGE	(8 * sizeof (uint32_t))
 
-#define	EFX_MAC_STATS_MASK_NPAGES	\
-	(P2ROUNDUP(EFX_MAC_NSTATS, EFX_MAC_STATS_MASK_BITS_PER_PAGE) / \
+#define	EFX_MAC_STATS_MASK_NPAGES				\
+	(EFX_P2ROUNDUP(uint32_t, EFX_MAC_NSTATS,		\
+		       EFX_MAC_STATS_MASK_BITS_PER_PAGE) /	\
 	    EFX_MAC_STATS_MASK_BITS_PER_PAGE)
 
 /*

Modified: head/sys/dev/sfxge/common/efx_mcdi.h
==============================================================================
--- head/sys/dev/sfxge/common/efx_mcdi.h	Sat Jul 27 02:23:05 2019	(r350368)
+++ head/sys/dev/sfxge/common/efx_mcdi.h	Sat Jul 27 09:36:27 2019	(r350369)
@@ -412,6 +412,11 @@ efx_mcdi_phy_module_get_info(
 	(((mask) & (MC_CMD_PRIVILEGE_MASK_IN_GRP_ ## priv)) ==		\
 	(MC_CMD_PRIVILEGE_MASK_IN_GRP_ ## priv))
 
+#define	EFX_MCDI_BUF_SIZE(_in_len, _out_len)				\
+	EFX_P2ROUNDUP(size_t,						\
+		MAX(MAX(_in_len, _out_len), (2 * sizeof (efx_dword_t))),\
+		sizeof (efx_dword_t))
+
 /*
  * The buffer size must be a multiple of dword to ensure that MCDI works
  * properly with Siena based boards (which use on-chip buffer). Also, it
@@ -419,9 +424,7 @@ efx_mcdi_phy_module_get_info(
  * error responses if the request/response buffer sizes are smaller.
  */
 #define EFX_MCDI_DECLARE_BUF(_name, _in_len, _out_len)			\
-	uint8_t _name[P2ROUNDUP(MAX(MAX(_in_len, _out_len),		\
-				    (2 * sizeof (efx_dword_t))),	\
-				sizeof (efx_dword_t))] = {0}
+	uint8_t _name[EFX_MCDI_BUF_SIZE(_in_len, _out_len)] = {0}
 
 typedef enum efx_mcdi_feature_id_e {
 	EFX_MCDI_FEATURE_FW_UPDATE = 0,

Modified: head/sys/dev/sfxge/common/efx_tx.c
==============================================================================
--- head/sys/dev/sfxge/common/efx_tx.c	Sat Jul 27 02:23:05 2019	(r350368)
+++ head/sys/dev/sfxge/common/efx_tx.c	Sat Jul 27 09:36:27 2019	(r350369)
@@ -797,7 +797,7 @@ siena_tx_qpost(
 		 * Fragments must not span 4k boundaries.
 		 * Here it is a stricter requirement than the maximum length.
 		 */
-		EFSYS_ASSERT(P2ROUNDUP(start + 1,
+		EFSYS_ASSERT(EFX_P2ROUNDUP(efsys_dma_addr_t, start + 1,
 		    etp->et_enp->en_nic_cfg.enc_tx_dma_desc_boundary) >= end);
 
 		EFX_TX_DESC(etp, start, size, ebp->eb_eop, added);
@@ -1067,7 +1067,7 @@ siena_tx_qdesc_dma_create(
 	 * Fragments must not span 4k boundaries.
 	 * Here it is a stricter requirement than the maximum length.
 	 */
-	EFSYS_ASSERT(P2ROUNDUP(addr + 1,
+	EFSYS_ASSERT(EFX_P2ROUNDUP(efsys_dma_addr_t, addr + 1,
 	    etp->et_enp->en_nic_cfg.enc_tx_dma_desc_boundary) >= addr + size);
 
 	EFSYS_PROBE4(tx_desc_dma_create, unsigned int, etp->et_index,

Modified: head/sys/dev/sfxge/sfxge_port.c
==============================================================================
--- head/sys/dev/sfxge/sfxge_port.c	Sat Jul 27 02:23:05 2019	(r350368)
+++ head/sys/dev/sfxge/sfxge_port.c	Sat Jul 27 09:36:27 2019	(r350369)
@@ -798,7 +798,8 @@ sfxge_port_init(struct sfxge_softc *sc)
 	port->mac_stats.decode_buf = malloc(EFX_MAC_NSTATS * sizeof(uint64_t),
 					    M_SFXGE, M_WAITOK | M_ZERO);
 	mac_nstats = efx_nic_cfg_get(sc->enp)->enc_mac_stats_nstats;
-	mac_stats_size = P2ROUNDUP(mac_nstats * sizeof(uint64_t), EFX_BUF_SIZE);
+	mac_stats_size = EFX_P2ROUNDUP(size_t, mac_nstats * sizeof(uint64_t),
+				       EFX_BUF_SIZE);
 	if ((rc = sfxge_dma_alloc(sc, mac_stats_size, mac_stats_buf)) != 0)
 		goto fail2;
 	port->stats_update_period_ms = sfxge_port_stats_update_period_ms(sc);

Modified: head/sys/dev/sfxge/sfxge_rx.c
==============================================================================
--- head/sys/dev/sfxge/sfxge_rx.c	Sat Jul 27 02:23:05 2019	(r350368)
+++ head/sys/dev/sfxge/sfxge_rx.c	Sat Jul 27 09:36:27 2019	(r350369)
@@ -273,7 +273,8 @@ sfxge_rx_qfill(struct sfxge_rxq *rxq, unsigned int tar
 
 		/* m_len specifies length of area to be mapped for DMA */
 		m->m_len  = mblksize;
-		m->m_data = (caddr_t)P2ROUNDUP((uintptr_t)m->m_data, CACHE_LINE_SIZE);
+		m->m_data = (caddr_t)EFX_P2ROUNDUP(uintptr_t, m->m_data,
+						   CACHE_LINE_SIZE);
 		m->m_data += sc->rx_buffer_align;
 
 		sfxge_map_mbuf_fast(rxq->mem.esm_tag, rxq->mem.esm_map, m, &seg);
@@ -1103,14 +1104,14 @@ sfxge_rx_start(struct sfxge_softc *sc)
 
 	/* Ensure IP headers are 32bit aligned */
 	hdrlen = sc->rx_prefix_size + sizeof (struct ether_header);
-	sc->rx_buffer_align = P2ROUNDUP(hdrlen, 4) - hdrlen;
+	sc->rx_buffer_align = EFX_P2ROUNDUP(size_t, hdrlen, 4) - hdrlen;
 
 	sc->rx_buffer_size += sc->rx_buffer_align;
 
 	/* Align end of packet buffer for RX DMA end padding */
 	align = MAX(1, encp->enc_rx_buf_align_end);
 	EFSYS_ASSERT(ISP2(align));
-	sc->rx_buffer_size = P2ROUNDUP(sc->rx_buffer_size, align);
+	sc->rx_buffer_size = EFX_P2ROUNDUP(size_t, sc->rx_buffer_size, align);
 
 	/*
 	 * Standard mbuf zones only guarantee pointer-size alignment;

From owner-svn-src-head@freebsd.org  Sat Jul 27 09:36:45 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 93D9EB51CF;
 Sat, 27 Jul 2019 09:36:45 +0000 (UTC)
 (envelope-from arybchik@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 3F209735DB;
 Sat, 27 Jul 2019 09:36:40 +0000 (UTC)
 (envelope-from arybchik@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 59BA625567;
 Sat, 27 Jul 2019 09:36:37 +0000 (UTC)
 (envelope-from arybchik@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6R9abmn093261;
 Sat, 27 Jul 2019 09:36:37 GMT (envelope-from arybchik@FreeBSD.org)
Received: (from arybchik@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6R9aa2q093258;
 Sat, 27 Jul 2019 09:36:36 GMT (envelope-from arybchik@FreeBSD.org)
Message-Id: <201907270936.x6R9aa2q093258@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: arybchik set sender to
 arybchik@FreeBSD.org using -f
From: Andrew Rybchenko <arybchik@FreeBSD.org>
Date: Sat, 27 Jul 2019 09:36:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350370 - head/sys/dev/sfxge/common
X-SVN-Group: head
X-SVN-Commit-Author: arybchik
X-SVN-Commit-Paths: head/sys/dev/sfxge/common
X-SVN-Commit-Revision: 350370
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 3F209735DB
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];
 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 27 Jul 2019 09:36:45 -0000

Author: arybchik
Date: Sat Jul 27 09:36:36 2019
New Revision: 350370
URL: https://svnweb.freebsd.org/changeset/base/350370

Log:
  sfxge(4): fix align to power of 2 when align has smaller type
  
  Substitute driver-defined P2ALIGN() with EFX_P2ALIGN() defined in
  libefx.
  
  Cast value and alignment to one specified type to guarantee result
  correctness.
  
  Reported by:    Andrea Valsania <andrea.valsania at answervad.it>
  Reviewed by:	philip
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:      2 days
  Differential Revision:  https://reviews.freebsd.org/D21075

Modified:
  head/sys/dev/sfxge/common/ef10_rx.c
  head/sys/dev/sfxge/common/efsys.h
  head/sys/dev/sfxge/common/efx.h

Modified: head/sys/dev/sfxge/common/ef10_rx.c
==============================================================================
--- head/sys/dev/sfxge/common/ef10_rx.c	Sat Jul 27 09:36:27 2019	(r350369)
+++ head/sys/dev/sfxge/common/ef10_rx.c	Sat Jul 27 09:36:36 2019	(r350370)
@@ -869,7 +869,7 @@ ef10_rx_qpush(
 	efx_dword_t dword;
 
 	/* Hardware has alignment restriction for WPTR */
-	wptr = P2ALIGN(added, EF10_RX_WPTR_ALIGN);
+	wptr = EFX_P2ALIGN(unsigned int, added, EF10_RX_WPTR_ALIGN);
 	if (pushed == wptr)
 		return;
 

Modified: head/sys/dev/sfxge/common/efsys.h
==============================================================================
--- head/sys/dev/sfxge/common/efsys.h	Sat Jul 27 09:36:27 2019	(r350369)
+++ head/sys/dev/sfxge/common/efsys.h	Sat Jul 27 09:36:36 2019	(r350370)
@@ -88,10 +88,6 @@ extern "C" {
 #define	IS_P2ALIGNED(v, a)	((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0)
 #endif
 
-#ifndef P2ALIGN
-#define	P2ALIGN(_x, _a)		((_x) & -(_a))
-#endif
-
 #ifndef IS2P
 #define	ISP2(x)			(((x) & ((x) - 1)) == 0)
 #endif

Modified: head/sys/dev/sfxge/common/efx.h
==============================================================================
--- head/sys/dev/sfxge/common/efx.h	Sat Jul 27 09:36:27 2019	(r350369)
+++ head/sys/dev/sfxge/common/efx.h	Sat Jul 27 09:36:36 2019	(r350370)
@@ -60,6 +60,10 @@ extern "C" {
 #define	EFX_P2ROUNDUP(_type, _value, _align)	\
 	(-(-(_type)(_value) & -(_type)(_align)))
 
+/* Align value down to the nearest power of two. */
+#define	EFX_P2ALIGN(_type, _value, _align)	\
+	((_type)(_value) & -(_type)(_align))
+
 /* Return codes */
 
 typedef __success(return == 0) int efx_rc_t;

From owner-svn-src-head@freebsd.org  Sat Jul 27 09:36:46 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 72AC1B51E4;
 Sat, 27 Jul 2019 09:36:46 +0000 (UTC)
 (envelope-from arybchik@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 2CA807364C;
 Sat, 27 Jul 2019 09:36:46 +0000 (UTC)
 (envelope-from arybchik@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 F28CB25568;
 Sat, 27 Jul 2019 09:36:45 +0000 (UTC)
 (envelope-from arybchik@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6R9aj4r093317;
 Sat, 27 Jul 2019 09:36:45 GMT (envelope-from arybchik@FreeBSD.org)
Received: (from arybchik@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6R9ajKN093314;
 Sat, 27 Jul 2019 09:36:45 GMT (envelope-from arybchik@FreeBSD.org)
Message-Id: <201907270936.x6R9ajKN093314@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: arybchik set sender to
 arybchik@FreeBSD.org using -f
From: Andrew Rybchenko <arybchik@FreeBSD.org>
Date: Sat, 27 Jul 2019 09:36:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350371 - head/sys/dev/sfxge/common
X-SVN-Group: head
X-SVN-Commit-Author: arybchik
X-SVN-Commit-Paths: head/sys/dev/sfxge/common
X-SVN-Commit-Revision: 350371
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 2CA807364C
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_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.95)[-0.953,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 27 Jul 2019 09:36:46 -0000

Author: arybchik
Date: Sat Jul 27 09:36:45 2019
New Revision: 350371
URL: https://svnweb.freebsd.org/changeset/base/350371

Log:
  sfxge(4): unify power of 2 alignment check macro
  
  Substitute driver-defined IS_P2ALIGNED() with EFX_IS_P2ALIGNED()
  defined in libefx.
  
  Add type argument and cast value and alignment to one specified type.
  
  Reported by:    Andrea Valsania <andrea.valsania at answervad.it>
  Reviewed by:    philip
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:      2 days
  Differential Revision:  https://reviews.freebsd.org/D21076

Modified:
  head/sys/dev/sfxge/common/ef10_rx.c
  head/sys/dev/sfxge/common/efsys.h
  head/sys/dev/sfxge/common/efx.h

Modified: head/sys/dev/sfxge/common/ef10_rx.c
==============================================================================
--- head/sys/dev/sfxge/common/ef10_rx.c	Sat Jul 27 09:36:36 2019	(r350370)
+++ head/sys/dev/sfxge/common/ef10_rx.c	Sat Jul 27 09:36:45 2019	(r350371)
@@ -1131,12 +1131,12 @@ ef10_rx_qcreate(
 			rc = ENOTSUP;
 			goto fail9;
 		}
-		if (!IS_P2ALIGNED(es_max_dma_len,
+		if (!EFX_IS_P2ALIGNED(uint32_t, es_max_dma_len,
 			    EFX_RX_ES_SUPER_BUFFER_BUF_ALIGNMENT)) {
 			rc = EINVAL;
 			goto fail10;
 		}
-		if (!IS_P2ALIGNED(es_buf_stride,
+		if (!EFX_IS_P2ALIGNED(uint32_t, es_buf_stride,
 			    EFX_RX_ES_SUPER_BUFFER_BUF_ALIGNMENT)) {
 			rc = EINVAL;
 			goto fail11;

Modified: head/sys/dev/sfxge/common/efsys.h
==============================================================================
--- head/sys/dev/sfxge/common/efsys.h	Sat Jul 27 09:36:36 2019	(r350370)
+++ head/sys/dev/sfxge/common/efsys.h	Sat Jul 27 09:36:45 2019	(r350371)
@@ -84,10 +84,6 @@ extern "C" {
 #define	B_TRUE	TRUE
 #endif
 
-#ifndef IS_P2ALIGNED
-#define	IS_P2ALIGNED(v, a)	((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0)
-#endif
-
 #ifndef IS2P
 #define	ISP2(x)			(((x) & ((x) - 1)) == 0)
 #endif
@@ -375,7 +371,8 @@ typedef struct efsys_mem_s {
 		uint32_t *addr;						\
 									\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_dword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_dword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		addr = (void *)((_esmp)->esm_base + (_offset));		\
@@ -394,7 +391,8 @@ typedef struct efsys_mem_s {
 		uint64_t *addr;						\
 									\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_qword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		addr = (void *)((_esmp)->esm_base + (_offset));		\
@@ -413,7 +411,8 @@ typedef struct efsys_mem_s {
 		uint32_t *addr;						\
 									\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_qword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		addr = (void *)((_esmp)->esm_base + (_offset));		\
@@ -435,7 +434,8 @@ typedef struct efsys_mem_s {
 		uint64_t *addr;						\
 									\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_oword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		addr = (void *)((_esmp)->esm_base + (_offset));		\
@@ -457,7 +457,8 @@ typedef struct efsys_mem_s {
 		uint32_t *addr;						\
 									\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_oword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		addr = (void *)((_esmp)->esm_base + (_offset));		\
@@ -482,7 +483,8 @@ typedef struct efsys_mem_s {
 		uint32_t *addr;						\
 									\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_dword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_dword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		EFSYS_PROBE2(mem_writed, unsigned int, (_offset),	\
@@ -501,7 +503,8 @@ typedef struct efsys_mem_s {
 		uint64_t *addr;						\
 									\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_qword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		EFSYS_PROBE3(mem_writeq, unsigned int, (_offset),	\
@@ -521,7 +524,8 @@ typedef struct efsys_mem_s {
 		uint32_t *addr;						\
 									\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_qword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		EFSYS_PROBE3(mem_writeq, unsigned int, (_offset),	\
@@ -543,7 +547,8 @@ typedef struct efsys_mem_s {
 		uint64_t *addr;						\
 									\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_oword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		EFSYS_PROBE5(mem_writeo, unsigned int, (_offset),	\
@@ -565,7 +570,8 @@ typedef struct efsys_mem_s {
 		uint32_t *addr;						\
 									\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_oword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		EFSYS_PROBE5(mem_writeo, unsigned int, (_offset),	\
@@ -617,7 +623,8 @@ typedef struct efsys_bar_s {
 #define	EFSYS_BAR_READD(_esbp, _offset, _edp, _lock)			\
 	do {								\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_dword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_dword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		_NOTE(CONSTANTCONDITION)				\
@@ -641,7 +648,8 @@ typedef struct efsys_bar_s {
 #define	EFSYS_BAR_READQ(_esbp, _offset, _eqp)				\
 	do {								\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_qword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		SFXGE_BAR_LOCK(_esbp);					\
@@ -661,7 +669,8 @@ typedef struct efsys_bar_s {
 #define	EFSYS_BAR_READO(_esbp, _offset, _eop, _lock)			\
 	do {								\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_oword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		_NOTE(CONSTANTCONDITION)				\
@@ -691,7 +700,8 @@ typedef struct efsys_bar_s {
 #define	EFSYS_BAR_READQ(_esbp, _offset, _eqp)				\
 	do {								\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_qword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		SFXGE_BAR_LOCK(_esbp);					\
@@ -714,7 +724,8 @@ typedef struct efsys_bar_s {
 #define	EFSYS_BAR_READO(_esbp, _offset, _eop, _lock)			\
 	do {								\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_oword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		_NOTE(CONSTANTCONDITION)				\
@@ -750,7 +761,8 @@ typedef struct efsys_bar_s {
 #define	EFSYS_BAR_WRITED(_esbp, _offset, _edp, _lock)			\
 	do {								\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_dword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_dword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		_NOTE(CONSTANTCONDITION)				\
@@ -782,7 +794,8 @@ typedef struct efsys_bar_s {
 #define	EFSYS_BAR_WRITEQ(_esbp, _offset, _eqp)				\
 	do {								\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_qword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		SFXGE_BAR_LOCK(_esbp);					\
@@ -810,7 +823,8 @@ typedef struct efsys_bar_s {
 #define	EFSYS_BAR_WRITEQ(_esbp, _offset, _eqp)				\
 	do {								\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_qword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		SFXGE_BAR_LOCK(_esbp);					\
@@ -854,7 +868,8 @@ typedef struct efsys_bar_s {
 #define	EFSYS_BAR_WC_WRITEQ(_esbp, _offset, _eqp)			\
 	do {								\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_qword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		(void) (_esbp);						\
@@ -869,7 +884,8 @@ typedef struct efsys_bar_s {
 #define	EFSYS_BAR_WRITEO(_esbp, _offset, _eop, _lock)			\
 	do {								\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_oword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		_NOTE(CONSTANTCONDITION)				\
@@ -915,7 +931,8 @@ typedef struct efsys_bar_s {
 #define	EFSYS_BAR_WRITEO(_esbp, _offset, _eop, _lock)			\
 	do {								\
 		_NOTE(CONSTANTCONDITION)				\
-		KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)),	\
+		KASSERT(EFX_IS_P2ALIGNED(size_t, _offset,		\
+		    sizeof (efx_oword_t)),				\
 		    ("not power of 2 aligned"));			\
 									\
 		_NOTE(CONSTANTCONDITION)				\

Modified: head/sys/dev/sfxge/common/efx.h
==============================================================================
--- head/sys/dev/sfxge/common/efx.h	Sat Jul 27 09:36:36 2019	(r350370)
+++ head/sys/dev/sfxge/common/efx.h	Sat Jul 27 09:36:45 2019	(r350371)
@@ -64,6 +64,10 @@ extern "C" {
 #define	EFX_P2ALIGN(_type, _value, _align)	\
 	((_type)(_value) & -(_type)(_align))
 
+/* Test if value is power of 2 aligned. */
+#define	EFX_IS_P2ALIGNED(_type, _value, _align)	\
+	((((_type)(_value)) & ((_type)(_align) - 1)) == 0)
+
 /* Return codes */
 
 typedef __success(return == 0) int efx_rc_t;

From owner-svn-src-head@freebsd.org  Sat Jul 27 13:48:14 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34D67BA4DE;
 Sat, 27 Jul 2019 13:48:14 +0000 (UTC)
 (envelope-from kostikbel@gmail.com)
Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 992DC86341;
 Sat, 27 Jul 2019 13:48:13 +0000 (UTC)
 (envelope-from kostikbel@gmail.com)
Received: from tom.home (kib@localhost [127.0.0.1])
 by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x6RDm5mO048122
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO);
 Sat, 27 Jul 2019 16:48:08 +0300 (EEST)
 (envelope-from kostikbel@gmail.com)
DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x6RDm5mO048122
Received: (from kostik@localhost)
 by tom.home (8.15.2/8.15.2/Submit) id x6RDm4np048121;
 Sat, 27 Jul 2019 16:48:04 +0300 (EEST)
 (envelope-from kostikbel@gmail.com)
X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com
 using -f
Date: Sat, 27 Jul 2019 16:48:04 +0300
From: Konstantin Belousov <kostikbel@gmail.com>
To: Rick Macklem <rmacklem@uoguelph.ca>
Cc: Rick Macklem <rmacklem@FreeBSD.org>,
 "src-committers@freebsd.org" <src-committers@freebsd.org>,
 "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,
 "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject: Re: svn commit: r350315 - in head/sys: kern sys
Message-ID: <20190727134804.GF2731@kib.kiev.ua>
References: <201907250546.x6P5kHWq076756@repo.freebsd.org>
 <20190726215628.GE2731@kib.kiev.ua>
 <YTBPR01MB33127701BFED8EF3FE933C96DDC30@YTBPR01MB3312.CANPRD01.PROD.OUTLOOK.COM>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <YTBPR01MB33127701BFED8EF3FE933C96DDC30@YTBPR01MB3312.CANPRD01.PROD.OUTLOOK.COM>
User-Agent: Mutt/1.12.1 (2019-06-15)
X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00,
 DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM,
 NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 27 Jul 2019 13:48:14 -0000

On Sat, Jul 27, 2019 at 01:35:06AM +0000, Rick Macklem wrote:
> Konstantin Belousov wrote:
> >On Thu, Jul 25, 2019 at 05:46:17AM +0000, Rick Macklem wrote:
> >> Author: rmacklem
> >> Date: Thu Jul 25 05:46:16 2019
> >> New Revision: 350315
> >> URL: https://svnweb.freebsd.org/changeset/base/350315
> >>
> >> Log:
> >>   Add kernel support for a Linux compatible copy_file_range(2) syscall.
> >
> >> Modified: head/sys/kern/syscalls.master
> >> >=====================================================================>=========
> >> --- head/sys/kern/syscalls.master     Thu Jul 25 03:55:05 2019        (r350314)
> >> +++ head/sys/kern/syscalls.master     Thu Jul 25 05:46:16 2019        (r350315)
> >> @@ -3175,6 +3175,16 @@
> >>                   int flag
> >>               );
> >>       }
> >> +569  AUE_NULL        STD {
> >> +             ssize_t copy_file_range(
> >> +                 int infd,
> >> +                 _Inout_opt_ off_t *inoffp,
> >> +                 int outfd,
> >> +                 _Inout_opt_ off_t *outoffp,
> >> +                 size_t len,
> >> +                 unsigned int flags
> >> +             );
> >> +     }
> >
> >I sat to write the compat32 shims, and only then noted that len has size_t
> >type.  Why is it size_t and not off_t ?
> Well, that's what Linux did.
> 
> Also, since it returns ssize_t, it can't do more than SSIZE_MAX
> (generally 1/2 of SIZE_T_MAX). Returning ssize_t is also what Linux
> does and is consistent with read(2)/write(2).

If changing the length argument type to off_t, it is reasonable to change
the return type to off_t as well.  We already have the lseek(2) syscall that
requires two return registers on 32bit.

Note that it is reasonable for read(2) to take length as size_t-typed
parameter, because size_t is the type for object sizes. There is no
object in user address space for copy_file_range(2) API, so potentially
wider off_t is acceptable and is in fact useful there. It is useful on
32bit machines where FreeBSD size_t is 32bit, while off_t is 64bit.

From owner-svn-src-head@freebsd.org  Sat Jul 27 15:04:10 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE29FBBA77;
 Sat, 27 Jul 2019 15:04:10 +0000 (UTC)
 (envelope-from manu@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 AFEB8893AB;
 Sat, 27 Jul 2019 15:04:10 +0000 (UTC)
 (envelope-from manu@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 8ACE71172;
 Sat, 27 Jul 2019 15:04:10 +0000 (UTC)
 (envelope-from manu@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6RF4ASs094925;
 Sat, 27 Jul 2019 15:04:10 GMT (envelope-from manu@FreeBSD.org)
Received: (from manu@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6RF4ABi094924;
 Sat, 27 Jul 2019 15:04:10 GMT (envelope-from manu@FreeBSD.org)
Message-Id: <201907271504.x6RF4ABi094924@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: manu set sender to
 manu@FreeBSD.org using -f
From: Emmanuel Vadot <manu@FreeBSD.org>
Date: Sat, 27 Jul 2019 15:04:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350372 - head/sys/arm/conf
X-SVN-Group: head
X-SVN-Commit-Author: manu
X-SVN-Commit-Paths: head/sys/arm/conf
X-SVN-Commit-Revision: 350372
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: AFEB8893AB
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_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.92)[-0.923,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 27 Jul 2019 15:04:10 -0000

Author: manu
Date: Sat Jul 27 15:04:10 2019
New Revision: 350372
URL: https://svnweb.freebsd.org/changeset/base/350372

Log:
  arm: Fix TEGRA124 kernel
  
  Since r350162 device syscon is needed for sdhci driver.
  Add it to the config file.
  
  Reported by:	dim

Modified:
  head/sys/arm/conf/TEGRA124

Modified: head/sys/arm/conf/TEGRA124
==============================================================================
--- head/sys/arm/conf/TEGRA124	Sat Jul 27 09:36:45 2019	(r350371)
+++ head/sys/arm/conf/TEGRA124	Sat Jul 27 15:04:10 2019	(r350372)
@@ -40,6 +40,7 @@ device		clk
 device		phy
 device		hwreset
 device		regulator
+device		syscon
 
 # Pseudo devices.
 device		loop			# Network loopback

From owner-svn-src-head@freebsd.org  Sat Jul 27 17:24:21 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2A4DBE50D;
 Sat, 27 Jul 2019 17:24:21 +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 945B28DECC;
 Sat, 27 Jul 2019 17:24:21 +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 6DC232AB3;
 Sat, 27 Jul 2019 17:24:21 +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 x6RHOLr8077265;
 Sat, 27 Jul 2019 17:24:21 GMT (envelope-from imp@FreeBSD.org)
Received: (from imp@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6RHOKhJ077258;
 Sat, 27 Jul 2019 17:24:20 GMT (envelope-from imp@FreeBSD.org)
Message-Id: <201907271724.x6RHOKhJ077258@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org
 using -f
From: Warner Losh <imp@FreeBSD.org>
Date: Sat, 27 Jul 2019 17:24:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350377 - in head/sys: arm/arm arm/conf arm/mv/discovery
 arm/mv/orion arm/ralink conf
X-SVN-Group: head
X-SVN-Commit-Author: imp
X-SVN-Commit-Paths: in head/sys: arm/arm arm/conf arm/mv/discovery
 arm/mv/orion arm/ralink conf
X-SVN-Commit-Revision: 350377
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 945B28DECC
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];
 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 27 Jul 2019 17:24:21 -0000

Author: imp
Date: Sat Jul 27 17:24:19 2019
New Revision: 350377
URL: https://svnweb.freebsd.org/changeset/base/350377

Log:
  Remove support for kernel.tramp and kernel.tramp.gz
  
  Nothing uses these anymore. They were for super small armv4 boards without
  uboot. We removed armv4 support before 13.0, but neglected to garbage collect
  this at the same time. Today, both flavors of armv5 kernels (mv and ralink) boot
  via uboot which has its own compression scheme for boards that need it.
  
  Note: OLDFILES has not been updated beacuse installkernel will move the whole
  directory out of the way before installing the new kernel.
  
  Differential Revision: https://reviews.freebsd.org/D21072

Deleted:
  head/sys/arm/arm/inckern.S
Modified:
  head/sys/arm/conf/NOTES.armv5
  head/sys/arm/mv/discovery/std.db78xxx
  head/sys/arm/mv/orion/std.db88f5xxx
  head/sys/arm/mv/orion/std.ts7800
  head/sys/arm/ralink/std.ralink
  head/sys/conf/Makefile.arm

Modified: head/sys/arm/conf/NOTES.armv5
==============================================================================
--- head/sys/arm/conf/NOTES.armv5	Sat Jul 27 16:34:07 2019	(r350376)
+++ head/sys/arm/conf/NOTES.armv5	Sat Jul 27 17:24:19 2019	(r350377)
@@ -18,7 +18,6 @@ files	"../mv/orion/files.ts7800"
 
 makeoptions	CONF_CFLAGS+="-march=armv5te"
 makeoptions	LDFLAGS="-zmuldefs"
-makeoptions	KERNPHYSADDR=0x00000000
 
 # Undo options from sys/conf/NOTES that we do not want...
 

Modified: head/sys/arm/mv/discovery/std.db78xxx
==============================================================================
--- head/sys/arm/mv/discovery/std.db78xxx	Sat Jul 27 16:34:07 2019	(r350376)
+++ head/sys/arm/mv/discovery/std.db78xxx	Sat Jul 27 17:24:19 2019	(r350377)
@@ -3,6 +3,5 @@
 include	"../mv/std.mv"
 files	"../mv/discovery/files.db78xxx"
 
-makeoptions	KERNPHYSADDR=0x00900000
 makeoptions	KERNVIRTADDR=0xc0900000
 options		KERNVIRTADDR=0xc0900000

Modified: head/sys/arm/mv/orion/std.db88f5xxx
==============================================================================
--- head/sys/arm/mv/orion/std.db88f5xxx	Sat Jul 27 16:34:07 2019	(r350376)
+++ head/sys/arm/mv/orion/std.db88f5xxx	Sat Jul 27 17:24:19 2019	(r350377)
@@ -3,6 +3,5 @@
 include	"../mv/std.mv"
 files	"../mv/orion/files.db88f5xxx"
 
-makeoptions	KERNPHYSADDR=0x00900000
 makeoptions	KERNVIRTADDR=0xc0900000
 options		KERNVIRTADDR=0xc0900000

Modified: head/sys/arm/mv/orion/std.ts7800
==============================================================================
--- head/sys/arm/mv/orion/std.ts7800	Sat Jul 27 16:34:07 2019	(r350376)
+++ head/sys/arm/mv/orion/std.ts7800	Sat Jul 27 17:24:19 2019	(r350377)
@@ -3,7 +3,6 @@
 include	"../mv/std.mv"
 files	"../mv/orion/files.ts7800"
 
-makeoptions	KERNPHYSADDR=0x00900000
 makeoptions	KERNVIRTADDR=0xc0900000
 options 	KERNVIRTADDR=0xc0900000
 options		PHYSADDR=0x00000000

Modified: head/sys/arm/ralink/std.ralink
==============================================================================
--- head/sys/arm/ralink/std.ralink	Sat Jul 27 16:34:07 2019	(r350376)
+++ head/sys/arm/ralink/std.ralink	Sat Jul 27 17:24:19 2019	(r350377)
@@ -5,6 +5,5 @@ machine 	arm
 makeoptions	CONF_CFLAGS="-march=armv5te"
 options		INTRNG
 
-makeoptions	KERNPHYSADDR=0x40000000
 makeoptions	KERNVIRTADDR=0xc0000000
 options		KERNVIRTADDR=0xc0000000

Modified: head/sys/conf/Makefile.arm
==============================================================================
--- head/sys/conf/Makefile.arm	Sat Jul 27 16:34:07 2019	(r350376)
+++ head/sys/conf/Makefile.arm	Sat Jul 27 17:24:19 2019	(r350377)
@@ -65,86 +65,13 @@ SYSTEM_LD_ = ${LD} -m ${LD_EMULATION} -Bdynamic -T lds
 	${_LDFLAGS} --no-warn-mismatch --warn-common --export-dynamic \
 	--dynamic-linker /red/herring \
 	-o ${FULLKERNEL}.noheader -X ${SYSTEM_OBJS} vers.o
-SYSTEM_LD_TAIL +=;sed s/" + SIZEOF_HEADERS"// ldscript.$M\
+SYSTEM_LD_TAIL +=;sed s/" + SIZEOF_HEADERS"// ldscript.$M \
 		>ldscript.$M.noheader; \
 		${SYSTEM_LD_}; \
 		${OBJCOPY} -S -O binary ${FULLKERNEL}.noheader \
 		${KERNEL_KO}.bin; \
 		rm ${FULLKERNEL}.noheader
 
-FILES_CPU_FUNC = \
-	$S/$M/$M/cpufunc_asm_armv5_ec.S \
-	$S/$M/$M/cpufunc_asm_sheeva.S
-
-.if ${MACHINE_ARCH:Marmv[67]*} == "" && defined(KERNPHYSADDR)
-KERNEL_EXTRA=trampoline
-KERNEL_EXTRA_INSTALL=kernel.gz.tramp
-trampoline: ${KERNEL_KO}.tramp
-${KERNEL_KO}.tramp: ${KERNEL_KO} $S/$M/$M/inckern.S $S/$M/$M/elf_trampoline.c
-	echo "#define KERNNAME \"${KERNEL_KO}.tmp\"" >opt_kernname.h 
-	sed s/${KERNVIRTADDR}/${KERNPHYSADDR}/ ldscript.$M > ldscript.$M.tramp
-	sed s/" + SIZEOF_HEADERS"// ldscript.$M.tramp > \
-	    ldscript.$M.tramp.noheader
-	echo "#include <machine/asm.h>" >tmphack.S
-	echo "ENTRY(_start)" >>tmphack.S
-	echo "bl _startC" >>tmphack.S
-	${OBJCOPY} --strip-symbol '$$d' --strip-symbol '$$a' \
-	    -g --strip-symbol '$$t' ${FULLKERNEL} ${KERNEL_KO}.tmp
-	eval $$(stat -s ${KERNEL_KO}.tmp) && \
-	    echo "#define KERNSIZE $$st_size" >>opt_kernname.h
-	${CC} -O -nostdlib -I. -I$S \
-	    -Xlinker -T -Xlinker ldscript.$M.tramp \
-	    -DELF_TRAMPOLINE \
-	    tmphack.S \
-	    $S/$M/$M/elf_trampoline.c \
-	    $S/$M/$M/inckern.S \
-	    ${FILES_CPU_FUNC} \
-	    -o ${KERNEL_KO}.tramp
-	${CC} -O -nostdlib -I. -I$S \
-	    -Xlinker -T -Xlinker ldscript.$M.tramp.noheader \
-	    -DELF_TRAMPOLINE \
-	    tmphack.S \
-	    $S/$M/$M/elf_trampoline.c \
-	    $S/$M/$M/inckern.S \
-	    ${FILES_CPU_FUNC} \
-	    -o ${KERNEL_KO}.tramp.noheader 
-	${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.noheader \
-	    ${KERNEL_KO}.tramp.bin 
-	${OBJCOPY} ${STRIP_FLAGS} ${KERNEL_KO}.tmp 
-	echo "#define KERNNAME \"${KERNEL_KO}.tmp.gz\"" >opt_kernname.h 
-	eval $$(stat -s ${KERNEL_KO}.tmp) && \
-	    echo "#define KERNSIZE $$st_size" >>opt_kernname.h
-	gzip -f9 ${KERNEL_KO}.tmp
-	eval $$(stat -s ${KERNEL_KO}.tmp.gz) && \
-	    echo "#define KERNCOMPSIZE $$st_size" >>opt_kernname.h
-	${CC} -O2 -ffreestanding -I. -I$S -c \
-	    -DKZIP -DELF_TRAMPOLINE \
-	    $S/kern/subr_inflate.c \
-	    -o inflate-tramp.o
-	${CC} -O -nostdlib -I. -I$S \
-	    -Xlinker -T -Xlinker ldscript.$M.tramp \
-	    -DKZIP -DELF_TRAMPOLINE \
-	    tmphack.S \
-	    $S/$M/$M/elf_trampoline.c \
-	    inflate-tramp.o \
-	    $S/$M/$M/inckern.S \
-	    ${FILES_CPU_FUNC} \
-	    -o ${KERNEL_KO}.gz.tramp
-	${CC} -O -nostdlib -I. -I$S \
-	    -Xlinker -T -Xlinker ldscript.$M.tramp.noheader \
-	    -DKZIP -DELF_TRAMPOLINE \
-	    tmphack.S \
-	    $S/$M/$M/elf_trampoline.c \
-	    inflate-tramp.o \
-	    $S/$M/$M/inckern.S \
-	    ${FILES_CPU_FUNC} \
-	    -o ${KERNEL_KO}.tramp.noheader
-	${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.noheader \
-	    ${KERNEL_KO}.gz.tramp.bin
-	rm ${KERNEL_KO}.tmp.gz ${KERNEL_KO}.tramp.noheader opt_kernname.h \
-	    inflate-tramp.o tmphack.S
-.endif
-
 %BEFORE_DEPEND
 
 %OBJS
@@ -159,13 +86,9 @@ ${KERNEL_KO}.tramp: ${KERNEL_KO} $S/$M/$M/inckern.S $S
 
 CLEAN+=	ldscript.$M ${KERNEL_KO}.bin ldscript.$M.noheader
 
-CLEAN+= ${KERNEL_KO}.tramp ${KERNEL_KO}.tramp.bin ldscript.$M.tramp \
-	ldscript.$M.tramp.noheader ${KERNEL_KO}.gz.tramp \
-	${KERNEL_KO}.gz.tramp.bin
-
 ldscript.$M: $S/conf/ldscript.$M
-	cat $S/conf/ldscript.$M|sed s/KERNPHYSADDR/${KERNPHYSADDR}/g| \
-	  sed s/KERNVIRTADDR/${KERNVIRTADDR}/g > ldscript.$M
+	sed s/KERNVIRTADDR/${KERNVIRTADDR}/g > ldscript.$M < $S/conf/ldscript.$M
+
 %RULES
 	
 .include "$S/conf/kern.post.mk"

From owner-svn-src-head@freebsd.org  Sat Jul 27 17:27:27 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05E46BE5DA;
 Sat, 27 Jul 2019 17:27:27 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 DCF048E0CA;
 Sat, 27 Jul 2019 17:27:26 +0000 (UTC) (envelope-from mav@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 B8FD62ABD;
 Sat, 27 Jul 2019 17:27:26 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6RHRQWJ077453;
 Sat, 27 Jul 2019 17:27:26 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6RHRQhU077451;
 Sat, 27 Jul 2019 17:27:26 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201907271727.x6RHRQhU077451@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Sat, 27 Jul 2019 17:27:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350378 - in head/sys/cam: ctl scsi
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: in head/sys/cam: ctl scsi
X-SVN-Commit-Revision: 350378
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: DCF048E0CA
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];
 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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 27 Jul 2019 17:27:27 -0000

Author: mav
Date: Sat Jul 27 17:27:26 2019
New Revision: 350378
URL: https://svnweb.freebsd.org/changeset/base/350378

Log:
  Allow WRITE SAME handle more then 2^^32 blocks.
  
  If not limited by write_same_max_lba option, split operation into several
  2^^31 blocks chunks in a loop.  For large disks it may take a while, so
  setting write_same_max_lba may be useful to avoid timeouts.
  
  While there, fix build with CAM_CTL_DEBUG.
  
  MFC after:	2 weeks

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/scsi/scsi_all.h

Modified: head/sys/cam/ctl/ctl.c
==============================================================================
--- head/sys/cam/ctl/ctl.c	Sat Jul 27 17:24:19 2019	(r350377)
+++ head/sys/cam/ctl/ctl.c	Sat Jul 27 17:27:26 2019	(r350378)
@@ -1438,7 +1438,7 @@ ctl_isc_event_handler(ctl_ha_channel channel, ctl_ha_e
 			return;
 		}
 
-		CTL_DEBUG_PRINT(("CTL: msg_type %d\n", msg->msg_type));
+		CTL_DEBUG_PRINT(("CTL: msg_type %d\n", msg->hdr.msg_type));
 		switch (msg->hdr.msg_type) {
 		case CTL_MSG_SERIALIZE:
 			io = ctl_alloc_io(softc->othersc_pool);
@@ -5685,12 +5685,36 @@ ctl_write_buffer(struct ctl_scsiio *ctsio)
 	return (CTL_RETVAL_COMPLETE);
 }
 
+static int
+ctl_write_same_cont(union ctl_io *io)
+{
+	struct ctl_lun *lun = CTL_LUN(io);
+	struct ctl_scsiio *ctsio;
+	struct ctl_lba_len_flags *lbalen;
+	int retval;
+
+	ctsio = &io->scsiio;
+	ctsio->io_hdr.status = CTL_STATUS_NONE;
+	lbalen = (struct ctl_lba_len_flags *)
+	    &ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN];
+	lbalen->lba += lbalen->len;
+	if ((lun->be_lun->maxlba + 1) - lbalen->lba <= UINT32_MAX) {
+		ctsio->io_hdr.flags &= ~CTL_FLAG_IO_CONT;
+		lbalen->len = (lun->be_lun->maxlba + 1) - lbalen->lba;
+	}
+
+	CTL_DEBUG_PRINT(("ctl_write_same_cont: calling config_write()\n"));
+	retval = lun->backend->config_write((union ctl_io *)ctsio);
+	return (retval);
+}
+
 int
 ctl_write_same(struct ctl_scsiio *ctsio)
 {
 	struct ctl_lun *lun = CTL_LUN(ctsio);
 	struct ctl_lba_len_flags *lbalen;
-	uint64_t lba;
+	const char *val;
+	uint64_t lba, ival;
 	uint32_t num_blocks;
 	int len, retval;
 	uint8_t byte2;
@@ -5754,17 +5778,25 @@ ctl_write_same(struct ctl_scsiio *ctsio)
 
 	/* Zero number of blocks means "to the last logical block" */
 	if (num_blocks == 0) {
-		if ((lun->be_lun->maxlba + 1) - lba > UINT32_MAX) {
+		ival = UINT64_MAX;
+		val = dnvlist_get_string(lun->be_lun->options,
+		    "write_same_max_lba", NULL);
+		if (val != NULL)
+			ctl_expand_number(val, &ival);
+		if ((lun->be_lun->maxlba + 1) - lba > ival) {
 			ctl_set_invalid_field(ctsio,
-					      /*sks_valid*/ 0,
-					      /*command*/ 1,
-					      /*field*/ 0,
-					      /*bit_valid*/ 0,
-					      /*bit*/ 0);
+			    /*sks_valid*/ 1, /*command*/ 1,
+			    /*field*/ ctsio->cdb[0] == WRITE_SAME_10 ? 7 : 10,
+			    /*bit_valid*/ 0, /*bit*/ 0);
 			ctl_done((union ctl_io *)ctsio);
 			return (CTL_RETVAL_COMPLETE);
 		}
-		num_blocks = (lun->be_lun->maxlba + 1) - lba;
+		if ((lun->be_lun->maxlba + 1) - lba > UINT32_MAX) {
+			ctsio->io_hdr.flags |= CTL_FLAG_IO_CONT;
+			ctsio->io_cont = ctl_write_same_cont;
+			num_blocks = 1 << 31;
+		} else
+			num_blocks = (lun->be_lun->maxlba + 1) - lba;
 	}
 
 	len = lun->be_lun->blocksize;
@@ -9876,6 +9908,8 @@ ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio
 		if (val != NULL)
 			ctl_expand_number(val, &ival);
 		scsi_u64to8b(ival, bl_ptr->max_write_same_length);
+		if (lun->be_lun->maxlba + 1 > ival)
+			bl_ptr->flags |= SVPD_BL_WSNZ;
 	}
 
 	ctl_set_success(ctsio);
@@ -11322,7 +11356,7 @@ ctl_failover_lun(union ctl_io *rio)
 	uint32_t targ_lun;
 
 	targ_lun = rio->io_hdr.nexus.targ_mapped_lun;
-	CTL_DEBUG_PRINT(("FAILOVER for lun %ju\n", targ_lun));
+	CTL_DEBUG_PRINT(("FAILOVER for lun %u\n", targ_lun));
 
 	/* Find and lock the LUN. */
 	mtx_lock(&softc->ctl_lock);

Modified: head/sys/cam/scsi/scsi_all.h
==============================================================================
--- head/sys/cam/scsi/scsi_all.h	Sat Jul 27 17:24:19 2019	(r350377)
+++ head/sys/cam/scsi/scsi_all.h	Sat Jul 27 17:27:26 2019	(r350378)
@@ -2886,7 +2886,7 @@ struct scsi_vpd_logical_block_prov
 };
 
 /*
- * Block Limits VDP Page based on SBC-4 Revision 2
+ * Block Limits VDP Page based on SBC-4 Revision 17
  */
 struct scsi_vpd_block_limits
 {
@@ -2896,7 +2896,8 @@ struct scsi_vpd_block_limits
 	u_int8_t page_length[2];
 #define SVPD_BL_PL_BASIC	0x10
 #define SVPD_BL_PL_TP		0x3C
-	u_int8_t reserved1;
+	u_int8_t flags;
+#define	SVPD_BL_WSNZ		0x01
 	u_int8_t max_cmp_write_len;
 	u_int8_t opt_txfer_len_grain[2];
 	u_int8_t max_txfer_len[4];

From owner-svn-src-head@freebsd.org  Sat Jul 27 18:07:47 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1596BBF2A8;
 Sat, 27 Jul 2019 18:07:47 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (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 EC3268FC8F;
 Sat, 27 Jul 2019 18:07:46 +0000 (UTC) (envelope-from mav@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 DCE3B31D0;
 Sat, 27 Jul 2019 18:07:46 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6RI7kiQ002271;
 Sat, 27 Jul 2019 18:07:46 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6RI7kdJ002270;
 Sat, 27 Jul 2019 18:07:46 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201907271807.x6RI7kdJ002270@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Sat, 27 Jul 2019 18:07:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350383 - head/sys/cam/ctl
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: head/sys/cam/ctl
X-SVN-Commit-Revision: 350383
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: EC3268FC8F
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.965,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 27 Jul 2019 18:07:47 -0000

Author: mav
Date: Sat Jul 27 18:07:46 2019
New Revision: 350383
URL: https://svnweb.freebsd.org/changeset/base/350383

Log:
  Reenable UNMAP support on ramdisks by default.
  
  For some reason, I guess just mechanical editing, it was disable in r333446.
  
  MFC after:	2 weeks

Modified:
  head/sys/cam/ctl/ctl_backend_ramdisk.c

Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c
==============================================================================
--- head/sys/cam/ctl/ctl_backend_ramdisk.c	Sat Jul 27 17:59:30 2019	(r350382)
+++ head/sys/cam/ctl/ctl_backend_ramdisk.c	Sat Jul 27 18:07:46 2019	(r350383)
@@ -1073,7 +1073,7 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc
 	params->lun_size_bytes = be_lun->size_bytes;
 
 	value = dnvlist_get_string(cbe_lun->options, "unmap", NULL);
-	if (value != NULL && strcmp(value, "off") != 0)
+	if (value == NULL || strcmp(value, "off") != 0)
 		cbe_lun->flags |= CTL_LUN_FLAG_UNMAP;
 	value = dnvlist_get_string(cbe_lun->options, "readonly", NULL);
 	if (value != NULL) {

From owner-svn-src-head@freebsd.org  Sat Jul 27 19:46:34 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9EA43C0E01
 for <svn-src-head@mailman.nyi.freebsd.org>;
 Sat, 27 Jul 2019 19:46:34 +0000 (UTC)
 (envelope-from donnie546@carouses.groxt.top)
Received: from mx.carouses.groxt.top (mx.carouses.groxt.top [159.89.54.128])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 582FB6C289
 for <svn-src-head@freebsd.org>; Sat, 27 Jul 2019 19:46:33 +0000 (UTC)
 (envelope-from donnie546@carouses.groxt.top)
Received: from mx.carouses.groxt.top (mx.carouses.groxt.top [127.0.0.1])
 by mx.carouses.groxt.top (Postfix) with ESMTP id 45wxKG0HrFz2238
 for <svn-src-head@freebsd.org>; Sat, 27 Jul 2019 19:46:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=
 carouses.groxt.top; h=content-transfer-encoding:content-type
 :content-type:mime-version:message-id:x-mailer:user-agent
 :reply-to:list-unsubscribe:subject:subject:to:from:from:date
 :date; s=dkim; t=1564256785; x=1566848786; bh=Dm+biffd5K52m6/jb0
 gYapu0OcwI4ZYErglZZiuGpjY=; b=uN4DqtZuPThP3B/Oz3Hg64e9BP0AsjgaKO
 5j/4TlkAjLVY4PsmGIjEiGclOhy5EcrYPaHeGtGLnKEuWSUaIyxMgSKvxVRatfgr
 5m7JC5InozL9Orc5DcLE9exnLcdLUXOxuodd9QOZKLQIzXK+DcUZ3HtmMIzuexni
 8xb7Gko68=
X-Virus-Scanned: Debian amavisd-new at mx.carouses.groxt.top
Received: from mx.carouses.groxt.top ([127.0.0.1])
 by mx.carouses.groxt.top (mx.carouses.groxt.top [127.0.0.1]) (amavisd-new,
 port 10024)
 with ESMTP id ZrMuHqD6eBHV for <svn-src-head@freebsd.org>;
 Sat, 27 Jul 2019 19:46:25 +0000 (UTC)
Received: from [127.0.0.1] (mx.carouses.groxt.top [127.0.0.1])
 by mx.carouses.groxt.top (Postfix) with ESMTP id 45wxJj2mZxz21tR
 for <svn-src-head@freebsd.org>; Sat, 27 Jul 2019 19:45:57 +0000 (UTC)
Date: Sat, 27 Jul 2019 20:45:57 +0100
From: =?UTF-8?Q?Anony=CA=8Dous=20H=C9=91cker?= <donnie546@carouses.groxt.top>
To: svn-src-head@freebsd.org
Subject: =?UTF-8?Q?IMPORTANT!=20You=20have=20been=20recorded=20=CA=8Dasturbating!?=
 =?UTF-8?Q?=20I=20have=20Svn=20Src=20Head.mp4!?=
Reply-To: <donnie546@carouses.groxt.top>
User-Agent: CodeIgniter
X-Sender: donnie546@carouses.groxt.top
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <5d3ca9f547aca@carouses.groxt.top>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 582FB6C289
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=carouses.groxt.top header.s=dkim header.b=uN4DqtZu;
 spf=pass (mx1.freebsd.org: domain of donnie546@carouses.groxt.top designates
 159.89.54.128 as permitted sender) smtp.mailfrom=donnie546@carouses.groxt.top
X-Spamd-Result: default: False [1.00 / 15.00];
 HAS_REPLYTO(0.00)[donnie546@carouses.groxt.top];
 XM_UA_NO_VERSION(0.01)[]; R_SPF_ALLOW(-0.20)[+mx];
 MV_CASE(0.50)[]; TO_DN_NONE(0.00)[];
 REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[4];
 MX_GOOD(-0.01)[mx.carouses.groxt.top,mx.carouses.groxt.top];
 DKIM_TRACE(0.00)[carouses.groxt.top:+];
 HAS_X_PRIO_THREE(0.00)[3]; SUBJECT_ENDS_EXCLAIM(0.00)[];
 FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+];
 RCVD_TLS_LAST(0.00)[];
 ASN(0.00)[asn:14061, ipnet:159.89.48.0/21, country:US];
 MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[];
 R_DKIM_ALLOW(-0.20)[carouses.groxt.top:s=dkim];
 FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[];
 NEURAL_HAM_LONG(-0.67)[-0.672,0]; MIME_GOOD(-0.10)[text/plain];
 PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org];
 DMARC_NA(0.00)[groxt.top]; HAS_LIST_UNSUB(-0.01)[];
 RCPT_COUNT_ONE(0.00)[1]; NEURAL_SPAM_MEDIUM(0.90)[0.898,0];
 IP_SCORE(0.19)[asn: 14061(1.01), country: US(-0.05)];
 NEURAL_SPAM_SHORT(0.59)[0.590,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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 27 Jul 2019 19:46:34 -0000

ATTN:  svn-src-head@freebsd.org

The last time you visited a Ç·orn website with teenagers,
you downloaded and installed the vίrus I developed.

My program has turned on your cam and recorded the act
of your ʍasturbation..

My software also downloaded all your email contact lίsts
and a list of your friends on Facebook.

I have the - Svn Src Head.mp4 - with you jerkίng
off to teens, as well as a file with all your contacts
on my computer.

You are very Ç·erverted!


If you want me to delete both files and keep the secret,
you must send me the Bitcoin payment.
I gıve you 72 houɼs onɭy to transƒer the funds.

If you don't know how to pay with Bitcoin,
visit Google and search - how to buy bitcoin.

*********************************************
Send 2,000 ÙSD (0.226271 BTC)
to this Bitcoin address as soon as possible:

3Maxk4SnySpFACVn4kBdaCdcdSAXo3QyuU
(copy and paste)
*********************************************

1 BTC = 9,235 ÙSD right now, so send exactly 0.226271 BTC
to the address above.



Do not try to cheat me!
As soon as you open this Email I will know you opened it.
I am tracking all actions on your device..

This Bitcoin address is linked to you onÉ­y,
so I will know when you send the correct amount.
When you pay in full, I will remove both files and deactivate
my program.

If you choose to not send the btc...
I will send your ʍasturbation vίdeo to
ALL YOUR FRIENDS AND ASSOCIATES from your
contact lists that I hacked.


Here are the payment details again:

Send 2,000 bucks (0.226271 BTC)
to this Bitcoin address:

*********************************************
0.226271 BTC

to:

3Maxk4SnySpFACVn4kBdaCdcdSAXo3QyuU

(copy and paste)
*********************************************


You саn visit police but nobody can help you.
I know what I am doing.
I don't live in your country and I know how
to stay anonymous.

Don't try to deceive me - I will know it
immediately - my spy software is recording all the
websites you visit and all your key presses.
If you do - I will send this ugly vίd to eveɼyone you know,
INCLUDING YOUR FAMILY MEMBERS.


Don't cheat me! Don't forget the shame and if you ignore
this message your life will be ruined.

I am waiting for your Bitcoin payment.
You have 72 houɼs ɭeft.


Anonymous Hacker


P.S. If you need more time to buy and send BTC,
open your notepad and write '48h more'.
This way you can contact me.
I will consider gıving you another 48 houɼs
befoɼe I releɑse the vίd, but onɭy when I see that
you are really struggling to buy bitcoin.
I KNOW you can afford it - so don't play around...