svn commit: r351245 - in head/sys/powerpc: booke include

2019-08-19 Thread Justin Hibbits
Author: jhibbits
Date: Tue Aug 20 01:26:02 2019
New Revision: 351245
URL: https://svnweb.freebsd.org/changeset/base/351245

Log:
  powerpc: Link Book-E kernels at the same address as AIM kernels
  
  Summary:
  Reduce the diff between AIM and Book-E even more.  This also cleans up
  vmparam.h significantly.
  
  Reviewed by:  luporl
  Differential Revision:https://reviews.freebsd.org/D21301

Modified:
  head/sys/powerpc/booke/pmap.c
  head/sys/powerpc/include/param.h
  head/sys/powerpc/include/vmparam.h

Modified: head/sys/powerpc/booke/pmap.c
==
--- head/sys/powerpc/booke/pmap.c   Tue Aug 20 01:06:43 2019
(r351244)
+++ head/sys/powerpc/booke/pmap.c   Tue Aug 20 01:26:02 2019
(r351245)
@@ -219,7 +219,7 @@ uint32_t tlb1_entries;
 
 #define TLB1_ENTRIES (tlb1_entries)
 
-static vm_offset_t tlb1_map_base = VM_MAXUSER_ADDRESS + PAGE_SIZE;
+static vm_offset_t tlb1_map_base = (vm_offset_t)VM_MAXUSER_ADDRESS + PAGE_SIZE;
 
 static tlbtid_t tid_alloc(struct pmap *);
 static void tid_flush(tlbtid_t tid);
@@ -1574,7 +1574,6 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o
 * Note that kernel end does not necessarily relate to kernsize.
 * kernsize is the size of the kernel that is actually mapped.
 */
-   kernstart = trunc_page(start);
data_start = round_page(kernelend);
data_end = data_start;
 
@@ -2146,7 +2145,7 @@ mmu_booke_map_user_ptr(mmu_t mmu, pmap_t pm, volatile 
 void **kaddr, size_t ulen, size_t *klen)
 {
 
-   if ((uintptr_t)uaddr + ulen > VM_MAXUSER_ADDRESS + PAGE_SIZE)
+   if (trunc_page((uintptr_t)uaddr + ulen) > VM_MAXUSER_ADDRESS)
return (EFAULT);
 
*kaddr = (void *)(uintptr_t)uaddr;
@@ -2166,7 +2165,7 @@ mmu_booke_decode_kernel_ptr(mmu_t mmu, vm_offset_t add
 vm_offset_t *decoded_addr)
 {
 
-   if (addr < VM_MAXUSER_ADDRESS)
+   if (trunc_page(addr) <= VM_MAXUSER_ADDRESS)
*is_user = 1;
else
*is_user = 0;
@@ -4025,7 +4024,8 @@ tlb1_mapin_region(vm_offset_t va, vm_paddr_t pa, vm_si
 void
 tlb1_init()
 {
-   uint32_t mas0, mas1, mas2, mas3, mas7;
+   vm_offset_t mas2;
+   uint32_t mas0, mas1, mas3, mas7;
uint32_t tsz;
 
tlb1_get_tlbconf();
@@ -4044,6 +4044,7 @@ tlb1_init()
 
tsz = (mas1 & MAS1_TSIZE_MASK) >> MAS1_TSIZE_SHIFT;
kernsize += (tsz > 0) ? tsize2size(tsz) : 0;
+   kernstart = trunc_page(mas2);
 
/* Setup TLB miss defaults */
set_mas4_defaults();

Modified: head/sys/powerpc/include/param.h
==
--- head/sys/powerpc/include/param.hTue Aug 20 01:06:43 2019
(r351244)
+++ head/sys/powerpc/include/param.hTue Aug 20 01:26:02 2019
(r351245)
@@ -103,7 +103,7 @@
 #defineCACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT)
 
 #definePAGE_SHIFT  12
-#definePAGE_SIZE   (1L << PAGE_SHIFT)  /* Page size */
+#definePAGE_SIZE   (1 << PAGE_SHIFT)   /* Page size */
 #definePAGE_MASK   (PAGE_SIZE - 1)
 #defineNPTEPG  (PAGE_SIZE/(sizeof (pt_entry_t)))
 

Modified: head/sys/powerpc/include/vmparam.h
==
--- head/sys/powerpc/include/vmparam.h  Tue Aug 20 01:06:43 2019
(r351244)
+++ head/sys/powerpc/include/vmparam.h  Tue Aug 20 01:26:02 2019
(r351245)
@@ -72,53 +72,35 @@
 #endif
 
 #ifdef AIM
-#defineVM_MAXUSER_ADDRESS32((vm_offset_t)0xf000)
+#defineVM_MAXUSER_ADDRESS320xf000
 #else
-#defineVM_MAXUSER_ADDRESS32((vm_offset_t)0x7000)
+#defineVM_MAXUSER_ADDRESS320x7000
 #endif
 
 /*
  * Would like to have MAX addresses = 0, but this doesn't (currently) work
  */
-#if !defined(LOCORE)
 #ifdef __powerpc64__
-#defineVM_MIN_ADDRESS  (0xUL)
-#defineVM_MAXUSER_ADDRESS  (0x3000UL)
-#defineVM_MAX_ADDRESS  (0xUL)
+#defineVM_MIN_ADDRESS  0x
+#defineVM_MAXUSER_ADDRESS  0x3000
+#defineVM_MAX_ADDRESS  0x
+#defineVM_MIN_KERNEL_ADDRESS   0xe000
+#defineVM_MAX_KERNEL_ADDRESS   0xe007
+#defineVM_MAX_SAFE_KERNEL_ADDRESS  VM_MAX_KERNEL_ADDRESS
 #else
-#defineVM_MIN_ADDRESS  ((vm_offset_t)0)
+#defineVM_MIN_ADDRESS  0
 #defineVM_MAXUSER_ADDRESS  VM_MAXUSER_ADDRESS32
-#defineVM_MAX_ADDRESS  ((vm_offset_t)0x)
+#defineVM_MAX_ADDRESS  0x
 #endif
+
 #defineSHAREDPAGE  (VM_MAXUSER_ADDRESS - PAGE_SIZE)
-#else /* LOCORE */
-#ifdef BOOKE
-#defineVM_MIN_ADDRESS  

svn commit: r351244 - head/sys/dev/usb/net

2019-08-19 Thread Stephen J. Kiernan
Author: stevek
Date: Tue Aug 20 01:06:43 2019
New Revision: 351244
URL: https://svnweb.freebsd.org/changeset/base/351244

Log:
  usb_ethernet.h includes a number of mii headers, but only does so in
  order to have struct mii_data available. However, it only really needs
  a forward declaration of struct mii_data for use in pointer form for
  the return type of a function prototype.
  
  Custom kernel configuration that have usb and fdt enabled, but no miibus,
  end up with compilation failures because miibus_if.h will not get
  generated.
  
  Due to the above, the following changes have been made to usb_ethernet.h:
   * remove the inclusion of mii headers
   * forward-declare struct mii_data
   * include net/ifq.h to satify the need for complete struct ifqueue
  
  Reviewed by:  ian
  Obtained from:Juniper Networks, Inc.
  Differential Revision:https://reviews.freebsd.org/D21293

Modified:
  head/sys/dev/usb/net/usb_ethernet.h

Modified: head/sys/dev/usb/net/usb_ethernet.h
==
--- head/sys/dev/usb/net/usb_ethernet.h Tue Aug 20 00:50:17 2019
(r351243)
+++ head/sys/dev/usb/net/usb_ethernet.h Tue Aug 20 01:06:43 2019
(r351244)
@@ -45,14 +45,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
-#include "miibus_if.h"
-
-#include 
-#include 
-
+struct mii_data;
 struct usb_ether;
 struct usb_device_request;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351241 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs kern vm

2019-08-19 Thread Jeff Roberson
Author: jeff
Date: Mon Aug 19 23:09:38 2019
New Revision: 351241
URL: https://svnweb.freebsd.org/changeset/base/351241

Log:
  Use an atomic reference count for paging in progress so that callers do not
  require the object lock.
  
  Reviewed by:  markj
  Tested by:pho (as part of a larger branch)
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D21311

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  head/sys/kern/vfs_cluster.c
  head/sys/kern/vfs_subr.c
  head/sys/vm/swap_pager.c
  head/sys/vm/vm_object.c
  head/sys/vm/vm_object.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 
19 23:01:59 2019(r351240)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 
19 23:09:38 2019(r351241)
@@ -451,7 +451,7 @@ page_unbusy(vm_page_t pp)
 {
 
vm_page_sunbusy(pp);
-   vm_object_pip_subtract(pp->object, 1);
+   vm_object_pip_wakeup(pp->object);
 }
 
 static vm_page_t
@@ -523,6 +523,7 @@ update_pages(vnode_t *vp, int64_t start, int len, objs
 
off = start & PAGEOFFSET;
zfs_vmobject_wlock(obj);
+   vm_object_pip_add(obj, 1);
for (start &= PAGEMASK; len > 0; start += PAGESIZE) {
vm_page_t pp;
int nbytes = imin(PAGESIZE - off, len);
@@ -541,7 +542,7 @@ update_pages(vnode_t *vp, int64_t start, int len, objs
len -= nbytes;
off = 0;
}
-   vm_object_pip_wakeupn(obj, 0);
+   vm_object_pip_wakeup(obj);
zfs_vmobject_wunlock(obj);
 }
 

Modified: head/sys/kern/vfs_cluster.c
==
--- head/sys/kern/vfs_cluster.c Mon Aug 19 23:01:59 2019(r351240)
+++ head/sys/kern/vfs_cluster.c Mon Aug 19 23:09:38 2019(r351241)
@@ -479,7 +479,8 @@ cluster_rbuild(struct vnode *vp, u_quad_t filesize, da
}
if (tsize > 0) {
 clean_sbusy:
-   vm_object_pip_add(tbp->b_bufobj->bo_object, -j);
+   vm_object_pip_wakeupn(tbp->b_bufobj->bo_object,
+   j);
for (k = 0; k < j; k++)
vm_page_sunbusy(tbp->b_pages[k]);
VM_OBJECT_WUNLOCK(tbp->b_bufobj->bo_object);

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cMon Aug 19 23:01:59 2019(r351240)
+++ head/sys/kern/vfs_subr.cMon Aug 19 23:09:38 2019(r351241)
@@ -1786,13 +1786,9 @@ bufobj_invalbuf(struct bufobj *bo, int flags, int slpf
 */
do {
bufobj_wwait(bo, 0, 0);
-   if ((flags & V_VMIO) == 0) {
+   if ((flags & V_VMIO) == 0 && bo->bo_object != NULL) {
BO_UNLOCK(bo);
-   if (bo->bo_object != NULL) {
-   VM_OBJECT_WLOCK(bo->bo_object);
-   vm_object_pip_wait(bo->bo_object, "bovlbx");
-   VM_OBJECT_WUNLOCK(bo->bo_object);
-   }
+   vm_object_pip_wait_unlocked(bo->bo_object, "bovlbx");
BO_LOCK(bo);
}
} while (bo->bo_numoutput > 0);

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cMon Aug 19 23:01:59 2019(r351240)
+++ head/sys/vm/swap_pager.cMon Aug 19 23:09:38 2019(r351241)
@@ -1256,7 +1256,7 @@ swap_pager_getpages(vm_object_t object, vm_page_t *ma,
while ((ma[0]->oflags & VPO_SWAPINPROG) != 0) {
ma[0]->oflags |= VPO_SWAPSLEEP;
VM_CNT_INC(v_intrans);
-   if (VM_OBJECT_SLEEP(object, >paging_in_progress, PSWP,
+   if (VM_OBJECT_SLEEP(object, >handle, PSWP,
"swread", hz * 20)) {
printf(
 "swap_pager: indefinite wait buffer: bufobj: %p, blkno: %jd, size: %ld\n",
@@ -1531,7 +1531,7 @@ swp_pager_async_iodone(struct buf *bp)
m->oflags &= ~VPO_SWAPINPROG;
if (m->oflags & VPO_SWAPSLEEP) {
m->oflags &= ~VPO_SWAPSLEEP;
-   wakeup(>paging_in_progress);
+   wakeup(>handle);
}
 
if (bp->b_ioflags & BIO_ERROR) {

Modified: head/sys/vm/vm_object.c
==
--- head/sys/vm/vm_object.c Mon Aug 19 23:01:59 2019(r351240)
+++ head/sys/vm/vm_object.c Mon Aug 19 23:09:38 2019 

svn commit: r351240 - head/sys/gdb

2019-08-19 Thread Conrad Meyer
Author: cem
Date: Mon Aug 19 23:01:59 2019
New Revision: 351240
URL: https://svnweb.freebsd.org/changeset/base/351240

Log:
  Fix stylistic nit in r351239
  
  Meant to fix this before committing, but forgot.

Modified:
  head/sys/gdb/gdb_main.c

Modified: head/sys/gdb/gdb_main.c
==
--- head/sys/gdb/gdb_main.c Mon Aug 19 22:58:30 2019(r351239)
+++ head/sys/gdb/gdb_main.c Mon Aug 19 23:01:59 2019(r351240)
@@ -310,7 +310,6 @@ gdb_trap(int type, int code)
gdb_tx_char('C');
gdb_tx_varhex((long)kdb_thread->td_tid);
gdb_tx_end();
-   break;
} else if (gdb_rx_equal("fThreadInfo")) {
thr_iter = kdb_thr_first();
gdb_do_threadinfo(_iter);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351239 - head/sys/gdb

2019-08-19 Thread Conrad Meyer
Author: cem
Date: Mon Aug 19 22:58:30 2019
New Revision: 351239
URL: https://svnweb.freebsd.org/changeset/base/351239

Log:
  gdb(4): Support "qC" query
  
  Sometimes GDB gets confused about what the current thread is.  When it does,
  it asks the remote: "Who am I?"
  
  Answer it.

Modified:
  head/sys/gdb/gdb_main.c

Modified: head/sys/gdb/gdb_main.c
==
--- head/sys/gdb/gdb_main.c Mon Aug 19 22:57:03 2019(r351238)
+++ head/sys/gdb/gdb_main.c Mon Aug 19 22:58:30 2019(r351239)
@@ -305,7 +305,13 @@ gdb_trap(int type, int code)
break;
}
case 'q':   /* General query. */
-   if (gdb_rx_equal("fThreadInfo")) {
+   if (gdb_rx_equal("C")) {
+   gdb_tx_begin('Q');
+   gdb_tx_char('C');
+   gdb_tx_varhex((long)kdb_thread->td_tid);
+   gdb_tx_end();
+   break;
+   } else if (gdb_rx_equal("fThreadInfo")) {
thr_iter = kdb_thr_first();
gdb_do_threadinfo(_iter);
} else if (gdb_rx_equal("sThreadInfo")) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351238 - head/sys/gdb

2019-08-19 Thread Conrad Meyer
Author: cem
Date: Mon Aug 19 22:57:03 2019
New Revision: 351238
URL: https://svnweb.freebsd.org/changeset/base/351238

Log:
  gdb(4): Pack 'info threads' responses into fewer packets
  
  We suffer at least one round trip ACK latency every command / packet that
  GDB has to send and receive, and the response format for 'info threads'
  supports packing many threads IDs into a single packet, so do so.
  
  Adds and uses a new API, gdb_txbuf_has_capacity(), which checks for a
  certain number of bytes available in the outgoing txbuf.
  
  On an example amd64 VM, the number of RTTs to transmit this list is reduced
  by a factor of 110x.  This is especially beneficial with recent GDB, which
  seems to request the list at least twice during attach.

Modified:
  head/sys/gdb/gdb_int.h
  head/sys/gdb/gdb_main.c
  head/sys/gdb/gdb_packet.c

Modified: head/sys/gdb/gdb_int.h
==
--- head/sys/gdb/gdb_int.h  Mon Aug 19 22:53:05 2019(r351237)
+++ head/sys/gdb/gdb_int.h  Mon Aug 19 22:57:03 2019(r351238)
@@ -62,6 +62,7 @@ void gdb_tx_begin(char);
 int gdb_tx_end(void);
 int gdb_tx_mem(const unsigned char *, size_t);
 void gdb_tx_reg(int);
+bool gdb_txbuf_has_capacity(size_t);
 int gdb_rx_bindata(unsigned char *data, size_t datalen, size_t *amt);
 int gdb_search_mem(const unsigned char *addr, size_t size,
 const unsigned char *pat, size_t patlen, const unsigned char **found);

Modified: head/sys/gdb/gdb_main.c
==
--- head/sys/gdb/gdb_main.c Mon Aug 19 22:53:05 2019(r351237)
+++ head/sys/gdb/gdb_main.c Mon Aug 19 22:57:03 2019(r351238)
@@ -123,6 +123,45 @@ gdb_do_mem_search(void)
gdb_tx_err(EIO);
 }
 
+static void
+gdb_do_threadinfo(struct thread **thr_iter)
+{
+   static struct thread * const done_sentinel = (void *)(uintptr_t)1;
+   static const size_t tidsz_hex = sizeof(lwpid_t) * 2;
+   size_t tds_sent;
+
+   if (*thr_iter == NULL) {
+   gdb_tx_err(ENXIO);
+   return;
+   }
+
+   if (*thr_iter == done_sentinel) {
+   gdb_tx_begin('l');
+   *thr_iter = NULL;
+   goto sendit;
+   }
+
+   gdb_tx_begin('m');
+
+   for (tds_sent = 0;
+   *thr_iter != NULL && gdb_txbuf_has_capacity(tidsz_hex + 1);
+   *thr_iter = kdb_thr_next(*thr_iter), tds_sent++) {
+   if (tds_sent > 0)
+   gdb_tx_char(',');
+   gdb_tx_varhex((*thr_iter)->td_tid);
+   }
+
+   /*
+* Can't send EOF and "some" in same packet, so set a sentinel to send
+* EOF when GDB asks us next.
+*/
+   if (*thr_iter == NULL && tds_sent > 0)
+   *thr_iter = done_sentinel;
+
+sendit:
+   gdb_tx_end();
+}
+
 static int
 gdb_trap(int type, int code)
 {
@@ -268,23 +307,9 @@ gdb_trap(int type, int code)
case 'q':   /* General query. */
if (gdb_rx_equal("fThreadInfo")) {
thr_iter = kdb_thr_first();
-   gdb_tx_begin('m');
-   gdb_tx_hex((long)thr_iter->td_tid, 8);
-   gdb_tx_end();
+   gdb_do_threadinfo(_iter);
} else if (gdb_rx_equal("sThreadInfo")) {
-   if (thr_iter == NULL) {
-   gdb_tx_err(ENXIO);
-   break;
-   }
-   thr_iter = kdb_thr_next(thr_iter);
-   if (thr_iter != NULL) {
-   gdb_tx_begin('m');
-   gdb_tx_hex((long)thr_iter->td_tid, 8);
-   gdb_tx_end();
-   } else {
-   gdb_tx_begin('l');
-   gdb_tx_end();
-   }
+   gdb_do_threadinfo(_iter);
} else if (gdb_rx_equal("Search:memory:")) {
gdb_do_mem_search();
} else if (!gdb_cpu_query())

Modified: head/sys/gdb/gdb_packet.c
==
--- head/sys/gdb/gdb_packet.c   Mon Aug 19 22:53:05 2019(r351237)
+++ head/sys/gdb/gdb_packet.c   Mon Aug 19 22:57:03 2019(r351238)
@@ -327,6 +327,12 @@ gdb_tx_reg(int regnum)
gdb_tx_mem(regp, regsz);
 }
 
+bool
+gdb_txbuf_has_capacity(size_t req)
+{
+   return (((char *)gdb_txbuf + sizeof(gdb_txbuf) - gdb_txp) >= req);
+}
+
 /* Read binary data up until the end of the packet or until we have datalen 
decoded bytes */
 int
 

svn commit: r351237 - in head/sys: conf libkern sys

2019-08-19 Thread Conrad Meyer
Author: cem
Date: Mon Aug 19 22:53:05 2019
New Revision: 351237
URL: https://svnweb.freebsd.org/changeset/base/351237

Log:
  libkern: Implement strchrnul(3)

Added:
  head/sys/libkern/strchrnul.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/sys/libkern.h

Modified: head/sys/conf/files
==
--- head/sys/conf/files Mon Aug 19 22:31:04 2019(r351236)
+++ head/sys/conf/files Mon Aug 19 22:53:05 2019(r351237)
@@ -3974,6 +3974,7 @@ libkern/scanc.c   standard
 libkern/strcasecmp.c   standard
 libkern/strcat.c   standard
 libkern/strchr.c   standard
+libkern/strchrnul.coptional gdb
 libkern/strcmp.c   standard
 libkern/strcpy.c   standard
 libkern/strcspn.c  standard

Added: head/sys/libkern/strchrnul.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/libkern/strchrnul.cMon Aug 19 22:53:05 2019
(r351237)
@@ -0,0 +1,41 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 Conrad Meyer 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+
+char *
+strchrnul(const char *p, int ch)
+{
+
+   for (; *p != 0 && *p != ch; p++)
+   ;
+   return (__DECONST(char *, p));
+}

Modified: head/sys/sys/libkern.h
==
--- head/sys/sys/libkern.h  Mon Aug 19 22:31:04 2019(r351236)
+++ head/sys/sys/libkern.h  Mon Aug 19 22:53:05 2019(r351237)
@@ -170,6 +170,7 @@ void srandom(u_long);
 int strcasecmp(const char *, const char *);
 char   *strcat(char * __restrict, const char * __restrict);
 char   *strchr(const char *, int);
+char   *strchrnul(const char *, int);
 int strcmp(const char *, const char *);
 char   *strcpy(char * __restrict, const char * __restrict);
 size_t  strcspn(const char * __restrict, const char * __restrict) __pure;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351235 - head/sys/vm

2019-08-19 Thread Jeff Roberson
Author: jeff
Date: Mon Aug 19 22:25:28 2019
New Revision: 351235
URL: https://svnweb.freebsd.org/changeset/base/351235

Log:
  Permit vm_pager_has_page() to run with a shared lock.  Introduce
  VM_OBJECT_DROP/VM_OBJECT_PICKUP to handle functions that are called with
  uncertain lock state.
  
  Reviewed by:  kib, markj
  Tested by:pho
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D21310

Modified:
  head/sys/vm/vm_object.h
  head/sys/vm/vm_pager.h
  head/sys/vm/vnode_pager.c

Modified: head/sys/vm/vm_object.h
==
--- head/sys/vm/vm_object.h Mon Aug 19 21:59:02 2019(r351234)
+++ head/sys/vm/vm_object.h Mon Aug 19 22:25:28 2019(r351235)
@@ -255,6 +255,10 @@ extern struct vm_object kernel_object_store;
rw_wowned(&(object)->lock)
 #defineVM_OBJECT_WUNLOCK(object)   
\
rw_wunlock(&(object)->lock)
+#defineVM_OBJECT_DROP(object)  
\
+   lock_class_rw.lc_unlock(&(object)->lock.lock_object)
+#defineVM_OBJECT_PICKUP(object, state) 
\
+   lock_class_rw.lc_lock(&(object)->lock.lock_object, (state))
 
 struct vnode;
 

Modified: head/sys/vm/vm_pager.h
==
--- head/sys/vm/vm_pager.h  Mon Aug 19 21:59:02 2019(r351234)
+++ head/sys/vm/vm_pager.h  Mon Aug 19 22:25:28 2019(r351235)
@@ -151,7 +151,7 @@ vm_pager_has_page(
 ) {
boolean_t ret;
 
-   VM_OBJECT_ASSERT_WLOCKED(object);
+   VM_OBJECT_ASSERT_LOCKED(object);
ret = (*pagertab[object->type]->pgo_haspage)
(object, offset, before, after);
return (ret);

Modified: head/sys/vm/vnode_pager.c
==
--- head/sys/vm/vnode_pager.c   Mon Aug 19 21:59:02 2019(r351234)
+++ head/sys/vm/vnode_pager.c   Mon Aug 19 22:25:28 2019(r351235)
@@ -355,13 +355,14 @@ vnode_pager_haspage(vm_object_t object, vm_pindex_t pi
 {
struct vnode *vp = object->handle;
daddr_t bn;
+   uintptr_t lockstate;
int err;
daddr_t reqblock;
int poff;
int bsize;
int pagesperblock, blocksperpage;
 
-   VM_OBJECT_ASSERT_WLOCKED(object);
+   VM_OBJECT_ASSERT_LOCKED(object);
/*
 * If no vp or vp is doomed or marked transparent to VM, we do not
 * have the page.
@@ -384,9 +385,9 @@ vnode_pager_haspage(vm_object_t object, vm_pindex_t pi
blocksperpage = (PAGE_SIZE / bsize);
reqblock = pindex * blocksperpage;
}
-   VM_OBJECT_WUNLOCK(object);
+   lockstate = VM_OBJECT_DROP(object);
err = VOP_BMAP(vp, reqblock, NULL, , after, before);
-   VM_OBJECT_WLOCK(object);
+   VM_OBJECT_PICKUP(object, lockstate);
if (err)
return TRUE;
if (bn == -1)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351233 - head/sys/dev/sound/pci/hda

2019-08-19 Thread Jung-uk Kim
Author: jkim
Date: Mon Aug 19 21:45:25 2019
New Revision: 351233
URL: https://svnweb.freebsd.org/changeset/base/351233

Log:
  Partially revert the previous commit.
  
  It was an experiment and not meant to be committed. :-(

Modified:
  head/sys/dev/sound/pci/hda/hdaa_patches.c

Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c
==
--- head/sys/dev/sound/pci/hda/hdaa_patches.c   Mon Aug 19 21:38:10 2019
(r351232)
+++ head/sys/dev/sound/pci/hda/hdaa_patches.c   Mon Aug 19 21:45:25 2019
(r351233)
@@ -778,18 +778,16 @@ hdaa_patch_direct(struct hdaa_devinfo *devinfo)
hda_command(dev, HDA_CMD_12BIT(0, devinfo->nid,
0xf88, 0xc0));
break;
-   case HDA_CODEC_ALC255:
-   case HDA_CODEC_ALC256:
-   case HDA_CODEC_ALC285:
-   val = hdaa_read_coef(dev, 0x20, 0x46);
-   hdaa_write_coef(dev, 0x20, 0x46, val | 0x3000);
-   break;
case HDA_CODEC_ALC1150:
if (subid == 0xd9781462) {
/* Too low volume on MSI H170 GAMING M3. */
hdaa_write_coef(dev, 0x20, 0x07, 0x7cb);
}
break;
+   }
+   if (id == HDA_CODEC_ALC255 || id == HDA_CODEC_ALC256) {
+   val = hdaa_read_coef(dev, 0x20, 0x46);
+   hdaa_write_coef(dev, 0x20, 0x46, val|0x3000);
}
if (subid == APPLE_INTEL_MAC)
hda_command(dev, HDA_CMD_12BIT(0, devinfo->nid,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351232 - head/usr.sbin/makefs

2019-08-19 Thread Ed Maste
Author: emaste
Date: Mon Aug 19 21:38:10 2019
New Revision: 351232
URL: https://svnweb.freebsd.org/changeset/base/351232

Log:
  makefs.8: expand description of image size
  
  Submitted by: ryan_freqlabs.com, Siva Mahadevan
  Differential Revision:https://reviews.freebsd.org/D21316

Modified:
  head/usr.sbin/makefs/makefs.8

Modified: head/usr.sbin/makefs/makefs.8
==
--- head/usr.sbin/makefs/makefs.8   Mon Aug 19 21:30:12 2019
(r351231)
+++ head/usr.sbin/makefs/makefs.8   Mon Aug 19 21:38:10 2019
(r351232)
@@ -35,7 +35,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 30, 2018
+.Dd August 19, 2019
 .Dt MAKEFS 8
 .Os
 .Sh NAME
@@ -225,6 +225,17 @@ Defaults to 512.
 .It Fl s Ar image-size
 Set the size of the file system image to
 .Ar image-size .
+This is equivalent to setting both the minimum
+.Fl ( M )
+and the maximum
+.Fl ( m )
+sizes to the same value.
+For
+.Sy ffs
+the
+.Ar image-size
+does not include the
+.Ar offset .
 .It Fl T Ar timestamp
 Specify a timestamp to be set for all filesystem files and directories
 created so that repeatable builds are possible.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351231 - head/sys/dev/sound/pci/hda

2019-08-19 Thread Jung-uk Kim
Author: jkim
Date: Mon Aug 19 21:30:12 2019
New Revision: 351231
URL: https://svnweb.freebsd.org/changeset/base/351231

Log:
  Fix sound on headset jack for Lenovo Thinkpad X1 Carbon Gen 6 (model 20KH).
  
  Note this commit was inspired by r350433.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/sound/pci/hda/hdaa_patches.c
  head/sys/dev/sound/pci/hda/hdac.h

Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c
==
--- head/sys/dev/sound/pci/hda/hdaa_patches.c   Mon Aug 19 21:21:32 2019
(r351230)
+++ head/sys/dev/sound/pci/hda/hdaa_patches.c   Mon Aug 19 21:30:12 2019
(r351231)
@@ -389,6 +389,13 @@ hdac_pin_patch(struct hdaa_widget *w)
patch = "as=1 seq=15";
break;
}
+   } else if (id == HDA_CODEC_ALC285 &&
+   subid == LENOVO_X120KH_SUBVENDOR) {
+   switch (nid) {
+   case 33:
+   patch = "as=1 seq=15";
+   break;
+   }
} else if (id == HDA_CODEC_ALC269 &&
subid == ASUS_UX31A_SUBVENDOR) {
switch (nid) {
@@ -771,16 +778,18 @@ hdaa_patch_direct(struct hdaa_devinfo *devinfo)
hda_command(dev, HDA_CMD_12BIT(0, devinfo->nid,
0xf88, 0xc0));
break;
+   case HDA_CODEC_ALC255:
+   case HDA_CODEC_ALC256:
+   case HDA_CODEC_ALC285:
+   val = hdaa_read_coef(dev, 0x20, 0x46);
+   hdaa_write_coef(dev, 0x20, 0x46, val | 0x3000);
+   break;
case HDA_CODEC_ALC1150:
if (subid == 0xd9781462) {
/* Too low volume on MSI H170 GAMING M3. */
hdaa_write_coef(dev, 0x20, 0x07, 0x7cb);
}
break;
-   }
-   if (id == HDA_CODEC_ALC255 || id == HDA_CODEC_ALC256) {
-   val = hdaa_read_coef(dev, 0x20, 0x46);
-   hdaa_write_coef(dev, 0x20, 0x46, val|0x3000);
}
if (subid == APPLE_INTEL_MAC)
hda_command(dev, HDA_CMD_12BIT(0, devinfo->nid,

Modified: head/sys/dev/sound/pci/hda/hdac.h
==
--- head/sys/dev/sound/pci/hda/hdac.h   Mon Aug 19 21:21:32 2019
(r351230)
+++ head/sys/dev/sound/pci/hda/hdac.h   Mon Aug 19 21:30:12 2019
(r351231)
@@ -257,6 +257,7 @@
 #defineLENOVO_X1_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21e8)
 #defineLENOVO_X1CRBN_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f9)
 #defineLENOVO_X120BS_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x2227)
+#defineLENOVO_X120KH_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x225c)
 #define LENOVO_X220_SUBVENDOR  HDA_MODEL_CONSTRUCT(LENOVO, 0x21da)
 #define LENOVO_X300_SUBVENDOR  HDA_MODEL_CONSTRUCT(LENOVO, 0x20ac)
 #defineLENOVO_T400_SUBVENDOR   HDA_MODEL_CONSTRUCT(LENOVO, 0x20f2)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351230 - head/usr.sbin/makefs

2019-08-19 Thread Ed Maste
Author: emaste
Date: Mon Aug 19 21:21:32 2019
New Revision: 351230
URL: https://svnweb.freebsd.org/changeset/base/351230

Log:
  makefs.8: style updates from igor
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/makefs/makefs.8

Modified: head/usr.sbin/makefs/makefs.8
==
--- head/usr.sbin/makefs/makefs.8   Mon Aug 19 19:01:59 2019
(r351229)
+++ head/usr.sbin/makefs/makefs.8   Mon Aug 19 21:21:32 2019
(r351230)
@@ -119,7 +119,7 @@ XXX: document these
 .It Fl F Ar mtree-specfile
 .Em This is almost certainly not the option you are looking for.
 To create an image from a list of files in an mtree format manifest,
-specify it as the last argument on the commandline, not as a the
+specify it as the last argument on the command line, not as a the
 argument to
 .Fl F .
 .Pp
@@ -160,10 +160,10 @@ and
 (in the case of symbolic links).
 If
 .Sy time
-isn't provided, the current time will be used.
+is not provided, the current time will be used.
 If
 .Sy flags
-isn't provided, the current file flags will be used.
+is not provided, the current file flags will be used.
 Missing regular file entries will be created as zero-length files.
 .It Fl f Ar free-files
 Ensure that a minimum of
@@ -331,9 +331,11 @@ The following keywords are supported:
 Allow the directory structure to exceed the maximum specified in
 the spec.
 .It Sy allow-illegal-chars
-Allow illegal characters in filenames. This option is not implemented.
+Allow illegal characters in filenames.
+This option is not implemented.
 .It Sy allow-lowercase
-Allow lowercase characters in filenames. This option is not implemented.
+Allow lowercase characters in filenames.
+This option is not implemented.
 .It Sy allow-max-name
 Allow 37 instead of 33 characters for filenames by omitting the
 version id.
@@ -348,7 +350,8 @@ extension to encode
 .Tn RISC OS
 metadata.
 .It Sy bootimagedir
-Boot image directory. This option is not implemented.
+Boot image directory.
+This option is not implemented.
 .It Sy chrp-boot
 Write an MBR partition table to the image to allow older CHRP hardware to
 boot.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351229 - head/sys/net

2019-08-19 Thread Kyle Evans
Author: kevans
Date: Mon Aug 19 19:01:59 2019
New Revision: 351229
URL: https://svnweb.freebsd.org/changeset/base/351229

Log:
  tuntap: belatedly add MODULE_VERSION for if_tun and if_tap
  
  When tun/tap were merged, appropriate MODULE_VERSION should have been added
  for things like modfind(2) to continue to do the right thing with the old
  names.
  
  Reported by:  jhb

Modified:
  head/sys/net/if_tuntap.c

Modified: head/sys/net/if_tuntap.c
==
--- head/sys/net/if_tuntap.cMon Aug 19 18:50:56 2019(r351228)
+++ head/sys/net/if_tuntap.cMon Aug 19 19:01:59 2019(r351229)
@@ -671,6 +671,8 @@ static moduledata_t tuntap_mod = {
 
 DECLARE_MODULE(if_tuntap, tuntap_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
 MODULE_VERSION(if_tuntap, 1);
+MODULE_VERSION(if_tun, 1);
+MODULE_VERSION(if_tap, 1);
 
 static void
 tunstart(struct ifnet *ifp)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351227 - head/sys/mips/include

2019-08-19 Thread Kyle Evans
Author: kevans
Date: Mon Aug 19 18:15:17 2019
New Revision: 351227
URL: https://svnweb.freebsd.org/changeset/base/351227

Log:
  mips: avoid empty mdproc struct
  
  Compiling with a more modern toolchain than GCC 4.2 in base warns about the
  empty struct. Take a hint and comment from r350902+r350953 by luporl@.

Modified:
  head/sys/mips/include/proc.h

Modified: head/sys/mips/include/proc.h
==
--- head/sys/mips/include/proc.hMon Aug 19 17:54:40 2019
(r351226)
+++ head/sys/mips/include/proc.hMon Aug 19 18:15:17 2019
(r351227)
@@ -79,7 +79,8 @@ struct mdthread {
 #defineMDTD_COP2USED   0x0002  /* Process used the COP2 */
 
 struct mdproc {
-   /* empty */
+   /* Avoid empty structs because they are undefined behavior. */
+   longmd_spare;
 };
 
 struct syscall_args {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351226 - head/sbin/ping

2019-08-19 Thread Alan Somers
Author: asomers
Date: Mon Aug 19 17:54:40 2019
New Revision: 351226
URL: https://svnweb.freebsd.org/changeset/base/351226

Log:
  Fix uninitialized variable warnings when MK_CASPER=no
  
  Submitted by: Ján Sučan 
  MFC after:2 weeks
  Sponsored by: Google, inc. (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21322

Modified:
  head/sbin/ping/ping.c

Modified: head/sbin/ping/ping.c
==
--- head/sbin/ping/ping.c   Mon Aug 19 17:51:06 2019(r351225)
+++ head/sbin/ping/ping.c   Mon Aug 19 17:54:40 2019(r351226)
@@ -610,6 +610,7 @@ main(int argc, char *const *argv)
}
 
/* From now on we will use only reverse DNS lookups. */
+#ifdef WITH_CASPER
if (capdns != NULL) {
const char *types[1];
 
@@ -617,7 +618,7 @@ main(int argc, char *const *argv)
if (cap_dns_type_limit(capdns, types, 1) < 0)
err(1, "unable to limit access to system.dns service");
}
-
+#endif
if (connect(ssend, (struct sockaddr *), sizeof(whereto)) != 0)
err(1, "connect");
 
@@ -1709,9 +1710,10 @@ static cap_channel_t *
 capdns_setup(void)
 {
cap_channel_t *capcas, *capdnsloc;
+#ifdef WITH_CASPER
const char *types[2];
int families[1];
-
+#endif
capcas = cap_init();
if (capcas == NULL)
err(1, "unable to create casper process");
@@ -1720,6 +1722,7 @@ capdns_setup(void)
cap_close(capcas);
if (capdnsloc == NULL)
err(1, "unable to open system.dns service");
+#ifdef WITH_CASPER
types[0] = "NAME2ADDR";
types[1] = "ADDR2NAME";
if (cap_dns_type_limit(capdnsloc, types, 2) < 0)
@@ -1727,7 +1730,7 @@ capdns_setup(void)
families[0] = AF_INET;
if (cap_dns_family_limit(capdnsloc, families, 1) < 0)
err(1, "unable to limit access to system.dns service");
-
+#endif
return (capdnsloc);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351225 - in head/sys/dev: acpica nvdimm

2019-08-19 Thread D Scott Phillips
Author: scottph
Date: Mon Aug 19 17:51:06 2019
New Revision: 351225
URL: https://svnweb.freebsd.org/changeset/base/351225

Log:
  Don't set the string "unknown" as a device's location_str
  
  Return an empty string when the location is unknown instead of the
  string "unknown". This ensures that all location entries are of
  the form key=val.
  
  Suggested by: imp
  Approved by:  jhb (mentor)
  MFC after:1 week
  Sponsored by: Intel Corporation
  Differential Revision:https://reviews.freebsd.org/D21326

Modified:
  head/sys/dev/acpica/acpi.c
  head/sys/dev/nvdimm/nvdimm.c

Modified: head/sys/dev/acpica/acpi.c
==
--- head/sys/dev/acpica/acpi.c  Mon Aug 19 17:28:12 2019(r351224)
+++ head/sys/dev/acpica/acpi.c  Mon Aug 19 17:51:06 2019(r351225)
@@ -866,7 +866,7 @@ acpi_child_location_str_method(device_t cbdev, device_
 strlcat(buf, buf2, buflen);
 }
 } else {
-snprintf(buf, buflen, "unknown");
+snprintf(buf, buflen, "");
 }
 return (0);
 }

Modified: head/sys/dev/nvdimm/nvdimm.c
==
--- head/sys/dev/nvdimm/nvdimm.cMon Aug 19 17:28:12 2019
(r351224)
+++ head/sys/dev/nvdimm/nvdimm.cMon Aug 19 17:51:06 2019
(r351225)
@@ -571,7 +571,7 @@ nvdimm_root_child_location_str(device_t dev, device_t 
if (handle != NULL)
res = snprintf(buf, buflen, "handle=%s", acpi_name(handle));
else
-   res = snprintf(buf, buflen, "unknown");
+   res = snprintf(buf, buflen, "");
 
if (res >= buflen)
return (EOVERFLOW);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351223 - head/sbin/ping

2019-08-19 Thread Alan Somers
Author: asomers
Date: Mon Aug 19 17:28:12 2019
New Revision: 351223
URL: https://svnweb.freebsd.org/changeset/base/351223

Log:
  ping: fix -Wformat-truncating warning with GCC
  
  Increase buffer size for the string representation of n_time
  
  ICMP timestamp is a 32-bit number. In pr_ntime(), number of minutes
  and seconds is always 2 characters wide. Max. number of hours is 4
  characters wide. The buffer size should be at least:
  
  4 + 2 + 2 + 1 (':') + 1 (':') + 1 ('\0') = 11
  
  Submitted by: Ján Sučan 
  MFC after:2 weeks
  Sponsored by: Google, inc. (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21325

Modified:
  head/sbin/ping/ping.c

Modified: head/sbin/ping/ping.c
==
--- head/sbin/ping/ping.c   Mon Aug 19 17:27:06 2019(r351222)
+++ head/sbin/ping/ping.c   Mon Aug 19 17:28:12 2019(r351223)
@@ -1661,7 +1661,7 @@ pr_retip(struct ip *ip)
 static char *
 pr_ntime(n_time timestamp)
 {
-   static char buf[10];
+   static char buf[11];
int hour, min, sec;
 
sec = ntohl(timestamp) / 1000;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351224 - head/share/man/man9

2019-08-19 Thread John Baldwin
Author: jhb
Date: Mon Aug 19 17:28:12 2019
New Revision: 351224
URL: https://svnweb.freebsd.org/changeset/base/351224

Log:
  Trim a spurious blank line I added in r348969.
  
  I did not bump .Dd since there is no content change.
  
  MFC after:3 days

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

Modified: head/share/man/man9/sysctl.9
==
--- head/share/man/man9/sysctl.9Mon Aug 19 17:28:12 2019
(r351223)
+++ head/share/man/man9/sysctl.9Mon Aug 19 17:28:12 2019
(r351224)
@@ -482,7 +482,6 @@
 .Fn SYSCTL_UQUAD parent number name ctlflags ptr val descr
 .Fn SYSCTL_UMA_MAX parent number name ctlflags ptr descr
 .Fn SYSCTL_UMA_CUR parent number name ctlflags ptr descr
-
 .Sh DESCRIPTION
 The
 .Nm SYSCTL
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351221 - head/share/man/man4

2019-08-19 Thread Vincenzo Maffione
Author: vmaffione
Date: Mon Aug 19 17:26:04 2019
New Revision: 351221
URL: https://svnweb.freebsd.org/changeset/base/351221

Log:
  link ptnet(4) man page to the build system
  
  Reported by:  kevans
  Reviewed by:  kevans, bcr
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D21312

Modified:
  head/share/man/man4/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileMon Aug 19 17:23:22 2019
(r351220)
+++ head/share/man/man4/MakefileMon Aug 19 17:26:04 2019
(r351221)
@@ -412,6 +412,7 @@ MAN=aac.4 \
psm.4 \
pst.4 \
pt.4 \
+   ptnet.4 \
pts.4 \
pty.4 \
puc.4 \
@@ -691,6 +692,7 @@ MLINKS+=pccbb.4 cbb.4
 MLINKS+=pcm.4 snd.4 \
pcm.4 sound.4
 MLINKS+=pms.4 pmspcv.4
+MLINKS+=ptnet.4 if_ptnet.4
 MLINKS+=ral.4 if_ral.4
 MLINKS+=re.4 if_re.4
 MLINKS+=rl.4 if_rl.4
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351220 - head/sys/net

2019-08-19 Thread Vincenzo Maffione
Author: vmaffione
Date: Mon Aug 19 17:23:22 2019
New Revision: 351220
URL: https://svnweb.freebsd.org/changeset/base/351220

Log:
  if_tuntap: minor improvements
  
  Rewrite a loop to avoid duplicating the exit condition.
  Simplify mask processing in tunpoll().
  Fix minor typos.
  
  Reviewed by:  kevans, markj
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D21302

Modified:
  head/sys/net/if_tuntap.c

Modified: head/sys/net/if_tuntap.c
==
--- head/sys/net/if_tuntap.cMon Aug 19 16:29:51 2019(r351219)
+++ head/sys/net/if_tuntap.cMon Aug 19 17:23:22 2019(r351220)
@@ -110,7 +110,6 @@ struct tuntap_softc {
u_short  tun_flags; /* misc flags */
 #defineTUN_OPEN0x0001
 #defineTUN_INITED  0x0002
-#defineTUN_RCOLL   0x0004
 #defineTUN_IASET   0x0008
 #defineTUN_DSTADDR 0x0010
 #defineTUN_LMODE   0x0020
@@ -168,9 +167,9 @@ SX_SYSINIT(tun_ioctl_sx, _ioctl_sx, "tun_ioctl");
 SYSCTL_DECL(_net_link);
 /* tun */
 static SYSCTL_NODE(_net_link, OID_AUTO, tun, CTLFLAG_RW, 0,
-"IP tunnel software network interface.");
+"IP tunnel software network interface");
 SYSCTL_INT(_net_link_tun, OID_AUTO, devfs_cloning, CTLFLAG_RWTUN, , 
0,
-"Enable legacy devfs interface creation.");
+"Enable legacy devfs interface creation");
 
 /* tap */
 static SYSCTL_NODE(_net_link, OID_AUTO, tap, CTLFLAG_RW, 0,
@@ -442,7 +441,7 @@ tun_clone_create(struct if_clone *ifc, char *name, siz
return (ENXIO);
 
if (unit != -1) {
-   /* If this unit number is still available that/s okay. */
+   /* If this unit number is still available that's okay. */
if (alloc_unr_specific(drv->unrhdr, unit) == -1)
return (EEXIST);
} else {
@@ -1435,22 +1434,22 @@ tunread(struct cdev *dev, struct uio *uio, int flag)
 
tp->tun_flags &= ~TUN_RWAIT;
 
-   do {
+   for (;;) {
IFQ_DEQUEUE(>if_snd, m);
-   if (m == NULL) {
-   if (flag & O_NONBLOCK) {
-   TUN_UNLOCK(tp);
-   return (EWOULDBLOCK);
-   }
-   tp->tun_flags |= TUN_RWAIT;
-   error = mtx_sleep(tp, >tun_mtx, PCATCH | (PZERO + 
1),
-   "tunread", 0);
-   if (error != 0) {
-   TUN_UNLOCK(tp);
-   return (error);
-   }
+   if (m != NULL)
+   break;
+   if (flag & O_NONBLOCK) {
+   TUN_UNLOCK(tp);
+   return (EWOULDBLOCK);
}
-   } while (m == NULL);
+   tp->tun_flags |= TUN_RWAIT;
+   error = mtx_sleep(tp, >tun_mtx, PCATCH | (PZERO + 1),
+   "tunread", 0);
+   if (error != 0) {
+   TUN_UNLOCK(tp);
+   return (error);
+   }
+   }
TUN_UNLOCK(tp);
 
if ((tp->tun_flags & TUN_L2) != 0)
@@ -1629,8 +1628,7 @@ tunpoll(struct cdev *dev, int events, struct thread *t
}
IFQ_UNLOCK(>if_snd);
}
-   if (events & (POLLOUT | POLLWRNORM))
-   revents |= events & (POLLOUT | POLLWRNORM);
+   revents |= events & (POLLOUT | POLLWRNORM);
 
return (revents);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351219 - head/sys/netinet/netdump

2019-08-19 Thread Mark Johnston
Author: markj
Date: Mon Aug 19 16:29:51 2019
New Revision: 351219
URL: https://svnweb.freebsd.org/changeset/base/351219

Log:
  Fix netdump buffering after r348473.
  
  nd_buf is used to buffer headers (for both the kernel dump itself and
  for EKCD) before the final call to netdump_dumper(), which flushes
  residual data in nd_buf.  As a result, a small portion of the residual
  data would be corrupted.  This manifests when kernel dump compression
  is enabled since both zstd and zlib detect the corruption during
  decompression.
  
  Reviewed by:  cem
  Differential Revision:https://reviews.freebsd.org/D21294

Modified:
  head/sys/netinet/netdump/netdump_client.c

Modified: head/sys/netinet/netdump/netdump_client.c
==
--- head/sys/netinet/netdump/netdump_client.c   Mon Aug 19 14:33:22 2019
(r351218)
+++ head/sys/netinet/netdump/netdump_client.c   Mon Aug 19 16:29:51 2019
(r351219)
@@ -923,6 +923,24 @@ netdump_network_poll(void)
  */
 
 /*
+ * Flush any buffered vmcore data.
+ */
+static int
+netdump_flush_buf(void)
+{
+   int error;
+
+   error = 0;
+   if (nd_conf.nd_buf_len != 0) {
+   error = netdump_send(NETDUMP_VMCORE, nd_conf.nd_tx_off,
+   nd_buf, nd_conf.nd_buf_len);
+   if (error == 0)
+   nd_conf.nd_buf_len = 0;
+   }
+   return (error);
+}
+
+/*
  * Callback from dumpsys() to dump a chunk of memory.
  * Copies it out to our static buffer then sends it across the network.
  * Detects the initial KDH and makes sure it is given a special packet type.
@@ -948,13 +966,9 @@ netdump_dumper(void *priv __unused, void *virtual,
virtual, (uintmax_t)offset, length);
 
if (virtual == NULL) {
-   if (nd_conf.nd_buf_len != 0) {
-   error = netdump_send(NETDUMP_VMCORE, nd_conf.nd_tx_off, 
nd_buf,
-   nd_conf.nd_buf_len);
-   if (error != 0) {
-   dump_failed = 1;
-   }
-   }
+   error = netdump_flush_buf();
+   if (error != 0)
+   dump_failed = 1;
 
if (dump_failed != 0)
printf("failed to dump the kernel core\n");
@@ -968,16 +982,14 @@ netdump_dumper(void *priv __unused, void *virtual,
if (length > sizeof(nd_buf))
return (ENOSPC);
 
-   if (nd_conf.nd_buf_len + length > sizeof(nd_buf) || 
-   (nd_conf.nd_buf_len != 0 && nd_conf.nd_tx_off + 
+   if (nd_conf.nd_buf_len + length > sizeof(nd_buf) ||
+   (nd_conf.nd_buf_len != 0 && nd_conf.nd_tx_off +
nd_conf.nd_buf_len != offset)) {
-   error = netdump_send(NETDUMP_VMCORE, nd_conf.nd_tx_off, nd_buf, 
-   nd_conf.nd_buf_len);
+   error = netdump_flush_buf();
if (error != 0) {
dump_failed = 1;
return (error);
}
-   nd_conf.nd_buf_len = 0;
nd_conf.nd_tx_off = offset;
}
 
@@ -1078,6 +1090,9 @@ netdump_write_headers(struct dumperinfo *di, struct ke
 {
int error;
 
+   error = netdump_flush_buf();
+   if (error != 0)
+   return (error);
memcpy(nd_buf, kdh, sizeof(*kdh));
error = netdump_send(NETDUMP_KDH, 0, nd_buf, sizeof(*kdh));
if (error == 0 && keysize > 0) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351218 - head/sys/arm/ti

2019-08-19 Thread Emmanuel Vadot
Author: manu
Date: Mon Aug 19 14:33:22 2019
New Revision: 351218
URL: https://svnweb.freebsd.org/changeset/base/351218

Log:
  ti: sdhci: Correct voltage caps
  
  ti,dual-volt property say that the eMMC support 1.8V and 3.3V not 3.0V
  Use the correct caps for the mmc stack.
  Note that the MMCHS_SD_CAPA register can only be written once after bootup
  so if one is using a u-boot compiled with eMMC support (this is the default)
  this code is a no-op but just in case someone have u-boot compiled without
  eMMC support this make eMMC works when the kernel is booted.
  
  MFC after:1 week

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

Modified: head/sys/arm/ti/ti_sdhci.c
==
--- head/sys/arm/ti/ti_sdhci.c  Mon Aug 19 14:28:54 2019(r351217)
+++ head/sys/arm/ti/ti_sdhci.c  Mon Aug 19 14:33:22 2019(r351218)
@@ -482,15 +482,14 @@ ti_sdhci_hw_init(device_t dev)
 * The attach() routine has examined fdt data and set flags in
 * slot.host.caps to reflect what voltages we can handle.  Set those
 * values in the CAPA register.  The manual says that these values can
-* only be set once, "before initialization" whatever that means, and
-* that they survive a reset.  So maybe doing this will be a no-op if
-* u-boot has already initialized the hardware.
+* only be set once, and that they survive a reset so unless u-boot 
didn't
+* set this register this code is a no-op.
 */
regval = ti_mmchs_read_4(sc, MMCHS_SD_CAPA);
if (sc->slot.host.caps & MMC_OCR_LOW_VOLTAGE)
regval |= MMCHS_SD_CAPA_VS18;
-   if (sc->slot.host.caps & (MMC_OCR_290_300 | MMC_OCR_300_310))
-   regval |= MMCHS_SD_CAPA_VS30;
+   if (sc->slot.host.caps & (MMC_OCR_320_330 | MMC_OCR_330_340))
+   regval |= MMCHS_SD_CAPA_VS33;
ti_mmchs_write_4(sc, MMCHS_SD_CAPA, regval);
 
/* Set initial host configuration (1-bit, std speed, pwr off). */
@@ -524,17 +523,20 @@ ti_sdhci_attach(device_t dev)
}
 
/*
-* The hardware can inherently do dual-voltage (1p8v, 3p0v) on the first
+* The hardware can inherently do dual-voltage (1p8v, 3p3v) on the first
 * device, and only 1p8v on other devices unless an external transceiver
 * is used.  The only way we could know about a transceiver is fdt data.
 * Note that we have to do this before calling ti_sdhci_hw_init() so
 * that it can set the right values in the CAPA register, which can only
 * be done once and never reset.
 */
-   sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE;
-   if (sc->mmchs_clk_id == MMC1_CLK || OF_hasprop(node, "ti,dual-volt")) {
-   sc->slot.host.caps |= MMC_OCR_290_300 | MMC_OCR_300_310;
-   }
+   if (OF_hasprop(node, "ti,dual-volt")) {
+   sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE | MMC_OCR_320_330 | 
MMC_OCR_330_340;
+   } else if (OF_hasprop(node, "no-1-8-v")) {
+   sc->slot.host.caps |= MMC_OCR_320_330 | MMC_OCR_330_340;
+   } else
+   sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE;
+
 
/*
 * Set the offset from the device's memory start to the MMCHS registers.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351217 - head/sys/arm/mv

2019-08-19 Thread Emmanuel Vadot
Author: manu
Date: Mon Aug 19 14:28:54 2019
New Revision: 351217
URL: https://svnweb.freebsd.org/changeset/base/351217

Log:
  arm64: a37x0_gpio: Use syscon instead of MMIO region
  
  The fdt node for this driver is a simple-mfd and syscon compatible one
  meaning that simplemfd will be the driver attached for it. The gpio driver
  is attached to the 'gpio' subnode so use syscon_get_handle_default to
  obtain the handle of the syscon from the parent device and use this
  to read/write to the memory region.
  
  MFC after:1 week

Modified:
  head/sys/arm/mv/a37x0_gpio.c

Modified: head/sys/arm/mv/a37x0_gpio.c
==
--- head/sys/arm/mv/a37x0_gpio.cMon Aug 19 14:20:26 2019
(r351216)
+++ head/sys/arm/mv/a37x0_gpio.cMon Aug 19 14:28:54 2019
(r351217)
@@ -46,21 +46,14 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "gpio_if.h"
+#include "syscon_if.h"
 
-static struct resource_spec a37x0_gpio_res_spec[] = {
-   { SYS_RES_MEMORY, 0, RF_ACTIVE },   /* Pinctl / GPIO */
-   { SYS_RES_MEMORY, 1, RF_ACTIVE },   /* Interrupts control */
-   { -1, 0, 0 }
-};
-
 struct a37x0_gpio_softc {
-   bus_space_tag_t sc_bst;
-   bus_space_handle_t  sc_bsh;
device_tsc_busdev;
int sc_type;
uint32_tsc_max_pins;
uint32_tsc_npins;
-   struct resource *sc_mem_res[nitems(a37x0_gpio_res_spec) - 1];
+   struct syscon   *syscon;
 };
 
 /* Memory regions. */
@@ -72,9 +65,9 @@ struct a37x0_gpio_softc {
 #defineA37X0_SB_GPIO   2
 
 #defineA37X0_GPIO_WRITE(_sc, _off, _val)   \
-bus_space_write_4((_sc)->sc_bst, (_sc)->sc_bsh, (_off), (_val))
+SYSCON_WRITE_4((_sc)->syscon, (_off), (_val))
 #defineA37X0_GPIO_READ(_sc, _off)  \
-bus_space_read_4((_sc)->sc_bst, (_sc)->sc_bsh, (_off))
+SYSCON_READ_4((_sc)->syscon, (_off))
 
 #defineA37X0_GPIO_BIT(_p)  (1U << ((_p) % 32))
 #defineA37X0_GPIO_OUT_EN(_p)   (0x0 + ((_p) / 32) * 4)
@@ -280,6 +273,12 @@ a37x0_gpio_attach(device_t dev)
 
sc = device_get_softc(dev);
 
+   err = syscon_get_handle_default(dev, >syscon);
+   if (err != 0) {
+   device_printf(dev, "Cannot get syscon handle from parent\n");
+   return (ENXIO);
+   }
+
/* Read and verify the "gpio-ranges" property. */
ncells = OF_getencprop_alloc(ofw_bus_get_node(dev), "gpio-ranges",
(void **));
@@ -295,14 +294,6 @@ a37x0_gpio_attach(device_t dev)
/* Check the number of pins in the DTS vs HW capabilities. */
if (sc->sc_npins > sc->sc_max_pins)
return (ENXIO);
-
-   err = bus_alloc_resources(dev, a37x0_gpio_res_spec, sc->sc_mem_res);
-   if (err != 0) {
-   device_printf(dev, "cannot allocate memory window\n");
-   return (ENXIO);
-   }
-   sc->sc_bst = rman_get_bustag(sc->sc_mem_res[A37X0_GPIO]);
-   sc->sc_bsh = rman_get_bushandle(sc->sc_mem_res[A37X0_GPIO]);
 
sc->sc_busdev = gpiobus_attach_bus(dev);
if (sc->sc_busdev == NULL)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351216 - head/sbin/ping6

2019-08-19 Thread Alan Somers
Author: asomers
Date: Mon Aug 19 14:20:26 2019
New Revision: 351216
URL: https://svnweb.freebsd.org/changeset/base/351216

Log:
  ping6: revert r350857
  
  Some socket options require root privileges to set.  The old code did indeed
  drop privileges at the earliest opportunity.
  
  Submitted by: Ján Sučan 
  MFC after:Never
  Sponsored by: Google, Inc. (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21319

Modified:
  head/sbin/ping6/ping6.c

Modified: head/sbin/ping6/ping6.c
==
--- head/sbin/ping6/ping6.c Mon Aug 19 14:11:54 2019(r351215)
+++ head/sbin/ping6/ping6.c Mon Aug 19 14:20:26 2019(r351216)
@@ -663,12 +663,6 @@ main(int argc, char *argv[])
err(1, "socket srecv");
freeaddrinfo(res);
 
-   /* revoke root privilege */
-   if (seteuid(getuid()) != 0)
-   err(1, "seteuid() failed");
-   if (setuid(getuid()) != 0)
-   err(1, "setuid() failed");
-
/* set the source address if specified. */
if ((options & F_SRCADDR) != 0) {
/* properly fill sin6_scope_id */
@@ -738,6 +732,12 @@ main(int argc, char *argv[])
err(1, "setsockopt(IPV6_RECVRTHDRDSTOPTS)");
 #endif
}
+
+   /* revoke root privilege */
+   if (seteuid(getuid()) != 0)
+   err(1, "seteuid() failed");
+   if (setuid(getuid()) != 0)
+   err(1, "setuid() failed");
 
if ((options & F_FLOOD) && (options & F_INTERVAL))
errx(1, "-f and -i incompatible options");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351215 - head/sys/kern

2019-08-19 Thread Mateusz Guzik
Author: mjg
Date: Mon Aug 19 14:11:54 2019
New Revision: 351215
URL: https://svnweb.freebsd.org/changeset/base/351215

Log:
  vfs: fix up r351193 ("stop always overwriting ->mnt_stat in VFS_STATFS")
  
  fs-specific part of vfs_statfs routines only fill in small portion of the
  structure. Previous code was always copying everything at a higher layer to
  acoomodate it and this patch does the same.
  
  'df' (no arguments) worked fine because the caller uses mnt_stat itself as the
  target buffer, making all the copying a no-op for its own case.
  'df /' and similar use a different consumer which passes its own buffer and
  this is where you can run into trouble.
  
  Reported by:  cy
  Fixes: r351193
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/vfs_mount.c

Modified: head/sys/kern/vfs_mount.c
==
--- head/sys/kern/vfs_mount.c   Mon Aug 19 12:42:03 2019(r351214)
+++ head/sys/kern/vfs_mount.c   Mon Aug 19 14:11:54 2019(r351215)
@@ -1833,6 +1833,12 @@ __vfs_statfs(struct mount *mp, struct statfs *sbp)
 {
 
/*
+* Filesystems only fill in part of the structure for updates, we
+* have to read the entirety first to get all content.
+*/
+   memcpy(sbp, >mnt_stat, sizeof(*sbp));
+
+   /*
 * Set these in case the underlying filesystem fails to do so.
 */
sbp->f_version = STATFS_VERSION;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351214 - head/sys/kern

2019-08-19 Thread Andrey V. Elsukov
Author: ae
Date: Mon Aug 19 12:42:03 2019
New Revision: 351214
URL: https://svnweb.freebsd.org/changeset/base/351214

Log:
  Use TAILQ_FOREACH_SAFE() macro to avoid use after free in soclose().
  
  PR:   239893
  MFC after:1 week

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Mon Aug 19 11:18:36 2019(r351213)
+++ head/sys/kern/uipc_socket.c Mon Aug 19 12:42:03 2019(r351214)
@@ -1131,9 +1131,9 @@ drop:
so->so_state |= SS_NOFDREF;
sorele(so);
if (listening) {
-   struct socket *sp;
+   struct socket *sp, *tsp;
 
-   TAILQ_FOREACH(sp, , so_list) {
+   TAILQ_FOREACH_SAFE(sp, , so_list, tsp) {
SOCK_LOCK(sp);
if (sp->so_count == 0) {
SOCK_UNLOCK(sp);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r351200 - in head/sys: amd64/amd64 dev/acpica

2019-08-19 Thread Andrew Gallatin

On 2019-08-18 19:44, Jeff Roberson wrote:

Author: jeff
Date: Sun Aug 18 23:44:23 2019
New Revision: 351200

<..>

Log:
   Allocate all per-cpu datastructures in domain correct memory.
   
   Reviewed by:	kib, gallatin (some objections)


No objection to what you actually committed.   The only objection was 
this issues I found on non-NUMA, which you fixed in the committed code.


Thanks!

Drew


___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351213 - head/sys/kern

2019-08-19 Thread Andriy Gapon
Author: avg
Date: Mon Aug 19 11:18:36 2019
New Revision: 351213
URL: https://svnweb.freebsd.org/changeset/base/351213

Log:
  assert that td_lk_slocks is not leaked upon return from kernel
  
  This is similar to checks for td_sx_slocks and td_rw_rlocks.
  Although td_lk_slocks is an implementation detail, it still makes sense
  to validate it.
  
  MFC after:1 week
  Sponsored by: Panzura

Modified:
  head/sys/kern/subr_trap.c

Modified: head/sys/kern/subr_trap.c
==
--- head/sys/kern/subr_trap.c   Mon Aug 19 10:48:27 2019(r351212)
+++ head/sys/kern/subr_trap.c   Mon Aug 19 11:18:36 2019(r351213)
@@ -176,6 +176,9 @@ userret(struct thread *td, struct trapframe *frame)
KASSERT(td->td_sx_slocks == 0,
("userret: Returning with %d sx locks held in shared mode",
td->td_sx_slocks));
+   KASSERT(td->td_lk_slocks == 0,
+   ("userret: Returning with %d lockmanager locks held in shared mode",
+   td->td_lk_slocks));
KASSERT((td->td_pflags & TDP_NOFAULTING) == 0,
("userret: Returning with pagefaults disabled"));
KASSERT(td->td_no_sleeping == 0,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351212 - in head: . tests/sys/netpfil/common tests/sys/netpfil/pf

2019-08-19 Thread Kristof Provost
Author: kp
Date: Mon Aug 19 10:48:27 2019
New Revision: 351212
URL: https://svnweb.freebsd.org/changeset/base/351212

Log:
  netpfil tests: Move pft_ping.py and sniffer.py to the common test directory
  
  The pft_ping.py and sniffer.py tool is moved from tests/sys/netpfil/pf to
  tests/sys/netpfil/common directory because these tools are to be used in
  common for all the firewalls.
  
  Submitted by: Ahsan Barkati
  Reviewed by:  kp, thj
  Sponsored by: Google, Inc. (GSoC 2019)
  Differential Revision:https://reviews.freebsd.org/D21276

Added:
  head/tests/sys/netpfil/common/pft_ping.py
 - copied unchanged from r351211, head/tests/sys/netpfil/pf/pft_ping.py
  head/tests/sys/netpfil/common/sniffer.py
 - copied unchanged from r351211, head/tests/sys/netpfil/pf/sniffer.py
Deleted:
  head/tests/sys/netpfil/pf/pft_ping.py
  head/tests/sys/netpfil/pf/sniffer.py
Modified:
  head/ObsoleteFiles.inc
  head/tests/sys/netpfil/common/Makefile
  head/tests/sys/netpfil/pf/Makefile
  head/tests/sys/netpfil/pf/forward.sh
  head/tests/sys/netpfil/pf/set_tos.sh

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Mon Aug 19 09:33:09 2019(r351211)
+++ head/ObsoleteFiles.inc  Mon Aug 19 10:48:27 2019(r351212)
@@ -38,6 +38,9 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20190817: pft_ping.py and sniffer.py moved to /usr/tests/sys/netpfil/common
+OLD_FILES+=usr/tests/sys/netpfil/pf/sniffer.py
+OLD_FILES+=usr/tests/sys/netpfil/pf/pft_ping.py
 # 20190816: dir.h removed from POSIX
 OLD_FILES+=usr/include/sys/dir.h
 # 20190729: gzip'ed a.out support removed

Modified: head/tests/sys/netpfil/common/Makefile
==
--- head/tests/sys/netpfil/common/Makefile  Mon Aug 19 09:33:09 2019
(r351211)
+++ head/tests/sys/netpfil/common/Makefile  Mon Aug 19 10:48:27 2019
(r351212)
@@ -11,6 +11,10 @@ ATF_TESTS_SH+=   \
 
 ${PACKAGE}FILES+=  \
utils.subr \
-   runner.subr
+   runner.subr \
+   pft_ping.py \
+   sniffer.py
+
+${PACKAGE}FILESMODE_pft_ping.py=   0555
 
 .include 

Copied: head/tests/sys/netpfil/common/pft_ping.py (from r351211, 
head/tests/sys/netpfil/pf/pft_ping.py)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/netpfil/common/pft_ping.py   Mon Aug 19 10:48:27 2019
(r351212, copy of r351211, head/tests/sys/netpfil/pf/pft_ping.py)
@@ -0,0 +1,135 @@
+#!/usr/local/bin/python2.7
+
+import argparse
+import scapy.all as sp
+import sys
+from sniffer import Sniffer
+
+PAYLOAD_MAGIC = 0x42c0ffee
+
+def check_ping_request(args, packet):
+   if args.ip6:
+   return check_ping6_request(args, packet)
+   else:
+   return check_ping4_request(args, packet)
+
+def check_ping4_request(args, packet):
+   """
+   Verify that the packet matches what we'd have sent
+   """
+   dst_ip = args.to[0]
+
+   ip = packet.getlayer(sp.IP)
+   if not ip:
+   return False
+   if ip.dst != dst_ip:
+   return False
+
+   icmp = packet.getlayer(sp.ICMP)
+   if not icmp:
+   return False
+   if sp.icmptypes[icmp.type] != 'echo-request':
+   return False
+
+   raw = packet.getlayer(sp.Raw)
+   if not raw:
+   return False
+   if raw.load != str(PAYLOAD_MAGIC):
+   return False
+
+   # Wait to check expectations until we've established this is the packet 
we
+   # sent.
+   if args.expect_tos:
+   if ip.tos != int(args.expect_tos[0]):
+   print "Unexpected ToS value %d, expected %s" \
+   % (ip.tos, args.expect_tos[0])
+   return False
+
+   return True
+
+def check_ping6_request(args, packet):
+   """
+   Verify that the packet matches what we'd have sent
+   """
+   dst_ip = args.to[0]
+
+   ip = packet.getlayer(sp.IPv6)
+   if not ip:
+   return False
+   if ip.dst != dst_ip:
+   return False
+
+   icmp = packet.getlayer(sp.ICMPv6EchoRequest)
+   if not icmp:
+   return False
+   if icmp.data != str(PAYLOAD_MAGIC):
+   return False
+
+   return True
+
+def ping(send_if, dst_ip, args):
+   ether = sp.Ether()
+   ip = sp.IP(dst=dst_ip)
+   icmp = sp.ICMP(type='echo-request')
+   raw = sp.Raw(str(PAYLOAD_MAGIC))
+
+   if args.send_tos:
+   ip.tos = int(args.send_tos[0])
+
+   req = ether / ip / icmp / raw
+   sp.sendp(req, iface=send_if, verbose=False)
+
+def ping6(send_if, dst_ip, args):
+   ether = sp.Ether()
+   ip6 = sp.IPv6(dst=dst_ip)
+   icmp = 

svn commit: r351211 - head/tests/sys/kern

2019-08-19 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 19 09:33:09 2019
New Revision: 351211
URL: https://svnweb.freebsd.org/changeset/base/351211

Log:
  sys.kern.pdeathsig.signal_delivered_ptrace: fix startup.
  
  Inform D that C executed procctl(PROC_PDEATHSIG_CTL).  Otherwise D
  might allow B to exit before C is set up to receive a signal on the
  parent exit.  In this case, C waits forever for the signal and test
  hangs.
  
  PR:   237657
  Reported and tested by:   lwhsu
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

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

Modified: head/tests/sys/kern/pdeathsig.c
==
--- head/tests/sys/kern/pdeathsig.c Mon Aug 19 09:29:27 2019
(r351210)
+++ head/tests/sys/kern/pdeathsig.c Mon Aug 19 09:33:09 2019
(r351211)
@@ -229,6 +229,7 @@ ATF_TC_BODY(signal_delivered_ptrace, tc)
int rc;
int pipe_ca[2];
int pipe_db[2];
+   int pipe_cd[2];
char buffer;
int status;
 
@@ -236,6 +237,8 @@ ATF_TC_BODY(signal_delivered_ptrace, tc)
ATF_REQUIRE(rc == 0);
rc = pipe(pipe_db);
ATF_REQUIRE(rc == 0);
+   rc = pipe(pipe_cd);
+   assert(rc == 0);
 
rc = fork();
ATF_REQUIRE(rc != -1);
@@ -263,6 +266,9 @@ ATF_TC_BODY(signal_delivered_ptrace, tc)
rc = procctl(P_PID, 0, PROC_PDEATHSIG_CTL, );
assert(rc == 0);
 
+   rc = write(pipe_cd[1], "x", 1);
+   assert(rc == 1);
+
/* wait for B to die and signal us... */
signum = 0xdeadbeef;
rc = sigwait(, );
@@ -292,6 +298,9 @@ ATF_TC_BODY(signal_delivered_ptrace, tc)
 
rc = ptrace(PT_CONTINUE, c_pid, (caddr_t) 1, 0);
assert(rc == 0);
+
+   rc = read(pipe_cd[0], , 1);
+   assert(rc == 1);
 
/* tell B that we're ready for it to exit now */
rc = write(pipe_db[1], ".", 1);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r351210 - head/tests/sys/kern

2019-08-19 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 19 09:29:27 2019
New Revision: 351210
URL: https://svnweb.freebsd.org/changeset/base/351210

Log:
  sys.kern.pdeathsig.signal_delivered_ptrace: fix debugger detach
  
  ptrace(PT_DETACH) requires stopped debuggee, otherwise it fails.  When
  the call fails, the C process is left as debuggee of the process D,
  and might be killed too early if process D exits occurs fast enough.
  
  Since pipes are not closed in the forked children, this resulted in
  the test hanging, since no write occured from C to wake A.
  
  PR:   237657
  Reported and tested by:   lwhsu
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

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

Modified: head/tests/sys/kern/pdeathsig.c
==
--- head/tests/sys/kern/pdeathsig.c Mon Aug 19 07:47:09 2019
(r351209)
+++ head/tests/sys/kern/pdeathsig.c Mon Aug 19 09:29:27 2019
(r351210)
@@ -305,7 +305,9 @@ ATF_TC_BODY(signal_delivered_ptrace, tc)
WSTOPSIG(status));
assert(rc == 0);
 
-   ptrace(PT_DETACH, c_pid, 0, 0);
+   waitpid(c_pid, , 0);
+   if (!WIFEXITED(status))
+   ptrace(PT_DETACH, c_pid, 0, 0);
 
_exit(0);
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"