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

2019-06-26 Thread Andriy Gapon
Author: avg
Date: Wed Jun 26 07:08:51 2019
New Revision: 349407
URL: https://svnweb.freebsd.org/changeset/base/349407

Log:
  fix up r349406, add missing .El
  
  MFC after:1 week

Modified:
  head/share/man/man4/owc.4

Modified: head/share/man/man4/owc.4
==
--- head/share/man/man4/owc.4   Wed Jun 26 06:40:30 2019(r349406)
+++ head/share/man/man4/owc.4   Wed Jun 26 07:08:51 2019(r349407)
@@ -86,6 +86,7 @@ that is to be used for the 1-Wire bus.
 For instance, to configure pin 10, use the bitmask of 0x400.
 Please note that this mask should have only one bit set
 (any other bits - i.e., pins - will be ignored).
+.El
 .Sh SEE ALSO
 .Xr gpiobus 4 ,
 .Xr ow 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: r349408 - head/share/man/man4

2019-06-26 Thread Andriy Gapon
Author: avg
Date: Wed Jun 26 07:38:31 2019
New Revision: 349408
URL: https://svnweb.freebsd.org/changeset/base/349408

Log:
  gpio.4: document device hints common to all devices on gpiobus
  
  "at" keyword is documented in device.hints(5) for all buses, but it does
  hurt to add another reference to it.
  "pins" keyword is specific to gpiobus.
  At least these two hints should be configured for any gpiobus device on
  a hints based system.
  
  MFC after:10 days

Modified:
  head/share/man/man4/gpio.4

Modified: head/share/man/man4/gpio.4
==
--- head/share/man/man4/gpio.4  Wed Jun 26 07:08:51 2019(r349407)
+++ head/share/man/man4/gpio.4  Wed Jun 26 07:38:31 2019(r349408)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 5, 2013
+.Dd June 26, 2019
 .Dt GPIO 4
 .Os
 .Sh NAME
@@ -103,12 +103,36 @@ passed to the kernel, being either statically compiled
 of ways where the boot loader (or Open Firmware enabled system) passes the
 DTS blob to the kernel at boot.
 .Pp
+On a
+.Xr device.hints 5
+based system these hints can be used to configure drivers for devices
+attached to
+.Nm
+pins:
+.Bl -tag -width ".Va hint.driver.unit.pins"
+.It Va hint.driver.unit.at
+The
+.Nm gpiobus
+where the device is attached.
+For example,
+.Qq gpiobus0 .
+.Ar driver
+and
+.Ar unit
+are the driver name and the unit number for the device driver.
+.It Va hint.driver.unit.pins
+This is a bitmask of the pins on the
+.Nm gpiobus
+that are connected to the device.
+The pins will be allocated to the specified driver instance.
+.El
+.Pp
 The following
 .Xr device.hints 5
 are only provided by the
 .Cd ar71xx_gpio
 driver:
-.Bl -tag -width ".Va hint.gpioiic.%d.atXXX"
+.Bl -tag -width ".Va hint.gpio.function_clear"
 .It Va hint.gpio.%d.pinmask
 This is a bitmask of pins on the GPIO board that we would like to expose
 for use to the host operating system.
@@ -133,6 +157,7 @@ of some device in a system.
 .Xr gpioiic 4 ,
 .Xr gpioled 4 ,
 .Xr iicbus 4 ,
+.Xr device.hints 5 ,
 .Xr gpioctl 8
 .Sh HISTORY
 The
___
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: r349409 - head/lib/libusb

2019-06-26 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 26 11:28:08 2019
New Revision: 349409
URL: https://svnweb.freebsd.org/changeset/base/349409

Log:
  Fix support for LIBUSB_HOTPLUG_ENUMERATE in libusb. Currently all
  devices are enumerated regardless of of the LIBUSB_HOTPLUG_ENUMERATE
  flag. Make sure when the flag is not specified no arrival events are
  generated for currently enumerated devices.
  
  MFC after:3 days
  Sponsored by: Mellanox Technologies

Modified:
  head/lib/libusb/libusb10.h
  head/lib/libusb/libusb10_hotplug.c

Modified: head/lib/libusb/libusb10.h
==
--- head/lib/libusb/libusb10.h  Wed Jun 26 07:38:31 2019(r349408)
+++ head/lib/libusb/libusb10.h  Wed Jun 26 11:28:08 2019(r349409)
@@ -89,6 +89,8 @@ struct libusb_hotplug_callback_handle_struct {
void *user_data;
 };
 
+TAILQ_HEAD(libusb_device_head, libusb_device);
+
 struct libusb_context {
int debug;
int debug_fixed;
@@ -106,7 +108,7 @@ struct libusb_context {
TAILQ_HEAD(, libusb_super_pollfd) pollfds;
TAILQ_HEAD(, libusb_super_transfer) tr_done;
TAILQ_HEAD(, libusb_hotplug_callback_handle_struct) hotplug_cbh;
-   TAILQ_HEAD(, libusb_device) hotplug_devs;
+   struct libusb_device_head hotplug_devs;
 
struct libusb_super_pollfd ctx_poll;
 

Modified: head/lib/libusb/libusb10_hotplug.c
==
--- head/lib/libusb/libusb10_hotplug.c  Wed Jun 26 07:38:31 2019
(r349408)
+++ head/lib/libusb/libusb10_hotplug.c  Wed Jun 26 11:28:08 2019
(r349409)
@@ -85,20 +85,35 @@ libusb_hotplug_filter(libusb_context *ctx, libusb_hotp
return (pcbh->fn(ctx, dev, event, pcbh->user_data));
 }
 
+static int
+libusb_hotplug_enumerate(libusb_context *ctx, struct libusb_device_head *phead)
+{
+   libusb_device **ppdev;
+   ssize_t count;
+   ssize_t x;
+
+   count = libusb_get_device_list(ctx, &ppdev);
+   if (count < 0)
+   return (-1);
+
+   for (x = 0; x != count; x++)
+   TAILQ_INSERT_TAIL(phead, ppdev[x], hotplug_entry);
+
+   libusb_free_device_list(ppdev, 0);
+   return (0);
+}
+
 static void *
 libusb_hotplug_scan(void *arg)
 {
-   TAILQ_HEAD(, libusb_device) hotplug_devs;
+   struct libusb_device_head hotplug_devs;
libusb_hotplug_callback_handle acbh;
libusb_hotplug_callback_handle bcbh;
libusb_context *ctx = arg;
-   libusb_device **ppdev;
libusb_device *temp;
libusb_device *adev;
libusb_device *bdev;
unsigned do_loop = 1;
-   ssize_t count;
-   ssize_t x;
 
while (do_loop) {
usleep(400);
@@ -108,14 +123,8 @@ libusb_hotplug_scan(void *arg)
TAILQ_INIT(&hotplug_devs);
 
if (ctx->hotplug_handler != NO_THREAD) {
-   count = libusb_get_device_list(ctx, &ppdev);
-   if (count < 0)
+   if (libusb_hotplug_enumerate(ctx, &hotplug_devs) < 0)
continue;
-   for (x = 0; x != count; x++) {
-   TAILQ_INSERT_TAIL(&hotplug_devs, ppdev[x],
-   hotplug_entry);
-   }
-   libusb_free_device_list(ppdev, 0);
} else {
do_loop = 0;
}
@@ -201,6 +210,8 @@ int libusb_hotplug_register_callback(libusb_context *c
handle->devclass = dev_class;
handle->fn = cb_fn;
handle->user_data = user_data;
+
+   libusb_hotplug_enumerate(ctx, &ctx->hotplug_devs);
 
if (flags & LIBUSB_HOTPLUG_ENUMERATE) {
TAILQ_FOREACH(adev, &ctx->hotplug_devs, hotplug_entry) {
___
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: r349410 - head/lib/libusb

2019-06-26 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 26 12:04:54 2019
New Revision: 349410
URL: https://svnweb.freebsd.org/changeset/base/349410

Log:
  Only call libusb_hotplug_enumerate() once from 
libusb_hotplug_register_callback().
  Else when registering multiple filters the same USB device may appear twice in
  the list.
  
  MFC after:3 days
  Sponsored by: Mellanox Technologies

Modified:
  head/lib/libusb/libusb10_hotplug.c

Modified: head/lib/libusb/libusb10_hotplug.c
==
--- head/lib/libusb/libusb10_hotplug.c  Wed Jun 26 11:28:08 2019
(r349409)
+++ head/lib/libusb/libusb10_hotplug.c  Wed Jun 26 12:04:54 2019
(r349410)
@@ -1,6 +1,6 @@
 /* $FreeBSD$ */
 /*-
- * Copyright (c) 2016 Hans Petter Selasky. All rights reserved.
+ * Copyright (c) 2016-2019 Hans Petter Selasky. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -200,6 +200,8 @@ int libusb_hotplug_register_callback(libusb_context *c
 
HOTPLUG_LOCK(ctx);
if (ctx->hotplug_handler == NO_THREAD) {
+   libusb_hotplug_enumerate(ctx, &ctx->hotplug_devs);
+
if (pthread_create(&ctx->hotplug_handler, NULL,
&libusb_hotplug_scan, ctx) != 0)
ctx->hotplug_handler = NO_THREAD;
@@ -210,8 +212,6 @@ int libusb_hotplug_register_callback(libusb_context *c
handle->devclass = dev_class;
handle->fn = cb_fn;
handle->user_data = user_data;
-
-   libusb_hotplug_enumerate(ctx, &ctx->hotplug_devs);
 
if (flags & LIBUSB_HOTPLUG_ENUMERATE) {
TAILQ_FOREACH(adev, &ctx->hotplug_devs, hotplug_entry) {
___
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: r349414 - head/sys/net

2019-06-26 Thread Marius Strobl
Author: marius
Date: Wed Jun 26 15:28:21 2019
New Revision: 349414
URL: https://svnweb.freebsd.org/changeset/base/349414

Log:
  o In iflib_txq_drain():
- Remove desc_used, which is only ever written to.
- Remove a dead store to reclaimed.
- Don't recycle avail.
- Sort variables according to style(9).
These changes will make a subsequent commit easier to read.
  o In iflib_tx_credits_update(), don't bother checking whether the
ift_txd_credits_update method pointer is NULL; _iflib_pre_assert()
asserts upfront that this method has been assigned and functions
like iflib_{fast_intr_rxtx,netmap_timer_adjust,txq_can_drain}()
and _task_fn_tx() were already unconditionally relying on the
method being callable.

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cWed Jun 26 15:16:23 2019(r349413)
+++ head/sys/net/iflib.cWed Jun 26 15:28:21 2019(r349414)
@@ -3580,10 +3580,10 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, ui
iflib_txq_t txq = r->cookie;
if_ctx_t ctx = txq->ift_ctx;
if_t ifp = ctx->ifc_ifp;
-   struct mbuf **mp, *m;
-   int i, count, consumed, pkt_sent, bytes_sent, mcast_sent, avail;
-   int reclaimed, err, in_use_prev, desc_used;
-   bool do_prefetch, ring, rang;
+   struct mbuf *m, **mp;
+   int avail, bytes_sent, consumed, count, err, i, in_use_prev;
+   int mcast_sent, pkt_sent, reclaimed, txq_avail;
+   bool do_prefetch, rang, ring;
 
if (__predict_false(!(if_getdrvflags(ifp) & IFF_DRV_RUNNING) ||
!LINK_ACTIVE(ctx))) {
@@ -3621,16 +3621,15 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, ui
   avail, ctx->ifc_flags, TXQ_AVAIL(txq));
 #endif
do_prefetch = (ctx->ifc_flags & IFC_PREFETCH);
-   avail = TXQ_AVAIL(txq);
+   txq_avail = TXQ_AVAIL(txq);
err = 0;
-   for (desc_used = i = 0; i < count && avail > MAX_TX_DESC(ctx) + 2; i++) 
{
+   for (i = 0; i < count && txq_avail > MAX_TX_DESC(ctx) + 2; i++) {
int rem = do_prefetch ? count - i : 0;
 
mp = _ring_peek_one(r, cidx, i, rem);
MPASS(mp != NULL && *mp != NULL);
if (__predict_false(*mp == (struct mbuf *)txq)) {
consumed++;
-   reclaimed++;
continue;
}
in_use_prev = txq->ift_in_use;
@@ -3649,10 +3648,9 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, ui
DBG_COUNTER_INC(tx_sent);
bytes_sent += m->m_pkthdr.len;
mcast_sent += !!(m->m_flags & M_MCAST);
-   avail = TXQ_AVAIL(txq);
+   txq_avail = TXQ_AVAIL(txq);
 
txq->ift_db_pending += (txq->ift_in_use - in_use_prev);
-   desc_used += (txq->ift_in_use - in_use_prev);
ETHER_BPF_MTAP(ifp, m);
if (__predict_false(!(ifp->if_drv_flags & IFF_DRV_RUNNING)))
break;
@@ -6154,9 +6152,6 @@ iflib_tx_credits_update(if_ctx_t ctx, iflib_txq_t txq)
 #ifdef INVARIANTS
int credits_pre = txq->ift_cidx_processed;
 #endif
-
-   if (ctx->isc_txd_credits_update == NULL)
-   return (0);
 
bus_dmamap_sync(txq->ift_ifdi->idi_tag, txq->ift_ifdi->idi_map,
BUS_DMASYNC_POSTREAD);
___
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: r349416 - head/lib/libc/stdlib

2019-06-26 Thread Alex Richardson
Author: arichardson
Date: Wed Jun 26 15:43:20 2019
New Revision: 349416
URL: https://svnweb.freebsd.org/changeset/base/349416

Log:
  Fix -Wsign-compare warnings in realpath.c
  
  This is needed in order to build realpath.c as part of rtld.

Modified:
  head/lib/libc/stdlib/realpath.c

Modified: head/lib/libc/stdlib/realpath.c
==
--- head/lib/libc/stdlib/realpath.c Wed Jun 26 15:34:35 2019
(r349415)
+++ head/lib/libc/stdlib/realpath.c Wed Jun 26 15:43:20 2019
(r349416)
@@ -91,7 +91,7 @@ realpath1(const char *path, char *resolved)
 */
p = strchr(left, '/');
 
-   next_token_len = p != NULL ? p - left : left_len;
+   next_token_len = p != NULL ? (size_t)(p - left) : left_len;
memcpy(next_token, left, next_token_len);
next_token[next_token_len] = '\0';
 
@@ -146,7 +146,7 @@ realpath1(const char *path, char *resolved)
return (NULL);
}
slen = readlink(resolved, symlink, sizeof(symlink));
-   if (slen <= 0 || slen >= sizeof(symlink)) {
+   if (slen <= 0 || slen >= (ssize_t)sizeof(symlink)) {
if (slen < 0)
; /* keep errno from readlink(2) call */
else if (slen == 0)
@@ -173,7 +173,7 @@ realpath1(const char *path, char *resolved)
 */
if (p != NULL) {
if (symlink[slen - 1] != '/') {
-   if (slen + 1 >= sizeof(symlink)) {
+   if (slen + 1 >= 
(ssize_t)sizeof(symlink)) {
errno = ENAMETOOLONG;
return (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: r349417 - head/libexec/rtld-elf

2019-06-26 Thread Alex Richardson
Author: arichardson
Date: Wed Jun 26 15:43:26 2019
New Revision: 349417
URL: https://svnweb.freebsd.org/changeset/base/349417

Log:
  Use rtld_putstr() instead of write() for the rtld msg() macro
  
  This removes an unnecessary libc dependency from rtld.
  See https://reviews.freebsd.org/D20663 for more details.

Modified:
  head/libexec/rtld-elf/debug.h
  head/libexec/rtld-elf/rtld_printf.h

Modified: head/libexec/rtld-elf/debug.h
==
--- head/libexec/rtld-elf/debug.h   Wed Jun 26 15:43:20 2019
(r349416)
+++ head/libexec/rtld-elf/debug.h   Wed Jun 26 15:43:26 2019
(r349417)
@@ -37,7 +37,7 @@
 #include 
 
 #include 
-#include 
+#include "rtld_printf.h"
 
 void debug_printf(const char *, ...) __printflike(1, 2);
 extern int debug;
@@ -57,7 +57,7 @@ extern int debug;
 #define assert(cond)   ((cond) ? (void) 0 :\
 (msg(_MYNAME ": assert failed: " __FILE__ ":"  \
   __XSTRING(__LINE__) "\n"), abort()))
-#define msg(s) write(STDOUT_FILENO, s, strlen(s))
+#define msg(s) rtld_putstr(s)
 #define trace()msg(_MYNAME ": " __XSTRING(__LINE__) "\n")
 
 

Modified: head/libexec/rtld-elf/rtld_printf.h
==
--- head/libexec/rtld-elf/rtld_printf.h Wed Jun 26 15:43:20 2019
(r349416)
+++ head/libexec/rtld-elf/rtld_printf.h Wed Jun 26 15:43:26 2019
(r349417)
@@ -31,6 +31,7 @@
 #define RTLD_PRINTF_H 1
 
 #include 
+#include 
 #include 
 
 int rtld_snprintf(char *buf, size_t bufsize, const char *fmt, ...)
___
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: r349418 - head/sys/conf

2019-06-26 Thread Alexander Motin
Author: mav
Date: Wed Jun 26 16:23:24 2019
New Revision: 349418
URL: https://svnweb.freebsd.org/changeset/base/349418

Log:
  Fix qlxgbe(4) static build.
  
  MFC after:2 weeks

Modified:
  head/sys/conf/files.amd64

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Wed Jun 26 15:43:26 2019(r349417)
+++ head/sys/conf/files.amd64   Wed Jun 26 16:23:24 2019(r349418)
@@ -389,6 +389,9 @@ dev/qlxgbe/ql_isr.c optionalqlxgbe pci
 dev/qlxgbe/ql_misc.c   optionalqlxgbe pci
 dev/qlxgbe/ql_os.c optionalqlxgbe pci
 dev/qlxgbe/ql_reset.c  optionalqlxgbe pci
+dev/qlxgbe/ql_fw.c optionalqlxgbe pci
+dev/qlxgbe/ql_boot.c   optionalqlxgbe pci
+dev/qlxgbe/ql_minidump.c   optionalqlxgbe pci
 dev/qlnx/qlnxe/ecore_cxt.c optionalqlnxe pci \
compile-with "${LINUXKPI_C}"
 dev/qlnx/qlnxe/ecore_dbg_fw_funcs.c optional   qlnxe pci \
___
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: r349419 - head/sys/ufs/ffs

2019-06-26 Thread Mark Johnston
Author: markj
Date: Wed Jun 26 16:28:42 2019
New Revision: 349419
URL: https://svnweb.freebsd.org/changeset/base/349419

Log:
  Remove references to splbio in ffs_softdep.c.
  
  Assert that the per-mountpoint softdep mutex is held in modified
  functions that do not already have this assertion.  No functional
  change intended.
  
  Reviewed by:  kib, mckusick (previous version)
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D20741

Modified:
  head/sys/ufs/ffs/ffs_softdep.c

Modified: head/sys/ufs/ffs/ffs_softdep.c
==
--- head/sys/ufs/ffs/ffs_softdep.c  Wed Jun 26 16:23:24 2019
(r349418)
+++ head/sys/ufs/ffs/ffs_softdep.c  Wed Jun 26 16:28:42 2019
(r349419)
@@ -2110,7 +2110,6 @@ pagedep_find(pagedephd, ino, lbn, pagedeppp)
  * Look up a pagedep. Return 1 if found, 0 otherwise.
  * If not found, allocate if DEPALLOC flag is passed.
  * Found or allocated entry is returned in pagedeppp.
- * This routine must be called with splbio interrupts blocked.
  */
 static int
 pagedep_lookup(mp, bp, ino, lbn, flags, pagedeppp)
@@ -2202,7 +2201,6 @@ inodedep_find(inodedephd, inum, inodedeppp)
  * Look up an inodedep. Return 1 if found, 0 if not found.
  * If not found, allocate if DEPALLOC flag is passed.
  * Found or allocated entry is returned in inodedeppp.
- * This routine must be called with splbio interrupts blocked.
  */
 static int
 inodedep_lookup(mp, inum, flags, inodedeppp)
@@ -5478,7 +5476,6 @@ jnewblk_merge(new, old, wkhd)
 
 /*
  * Replace an old allocdirect dependency with a newer one.
- * This routine must be called with splbio interrupts blocked.
  */
 static void
 allocdirect_merge(adphead, newadp, oldadp)
@@ -7534,7 +7531,6 @@ free_newblk(newblk)
 
 /*
  * Free a newdirblk. Clear the NEWBLOCK flag on its associated pagedep.
- * This routine must be called with splbio interrupts blocked.
  */
 static void
 free_newdirblk(newdirblk)
@@ -7665,7 +7661,6 @@ softdep_freefile(pvp, ino, mode)
 /*
  * Check to see if an inode has never been written to disk. If
  * so free the inodedep and return success, otherwise return failure.
- * This routine must be called with splbio interrupts blocked.
  *
  * If we still have a bitmap dependency, then the inode has never
  * been written to disk. Drop the dependency as it is no longer
@@ -8897,8 +8892,7 @@ cancel_diradd(dap, dirrem, jremref, dotremref, dotdotr
 }
 
 /*
- * Free a diradd dependency structure. This routine must be called
- * with splbio interrupts blocked.
+ * Free a diradd dependency structure.
  */
 static void
 free_diradd(dap, wkhd)
@@ -11195,9 +11189,7 @@ softdep_disk_write_complete(bp)
 }
 
 /*
- * Called from within softdep_disk_write_complete above. Note that
- * this routine is always called from interrupt level with further
- * splbio interrupts blocked.
+ * Called from within softdep_disk_write_complete above.
  */
 static void 
 handle_allocdirect_partdone(adp, wkhd)
@@ -11209,6 +11201,7 @@ handle_allocdirect_partdone(adp, wkhd)
struct inodedep *inodedep;
long bsize;
 
+   LOCK_OWNED(VFSTOUFS(adp->ad_block.nb_list.wk_mp));
if ((adp->ad_state & ALLCOMPLETE) != ALLCOMPLETE)
return;
/*
@@ -11818,7 +11811,6 @@ handle_written_indirdep(indirdep, bp, bpp, flags)
 
 /*
  * Process a diradd entry after its dependent inode has been written.
- * This routine must be called with splbio interrupts blocked.
  */
 static void
 diradd_inode_written(dap, inodedep)
@@ -11826,6 +11818,7 @@ diradd_inode_written(dap, inodedep)
struct inodedep *inodedep;
 {
 
+   LOCK_OWNED(VFSTOUFS(dap->da_list.wk_mp));
dap->da_state |= COMPLETE;
complete_diradd(dap);
WORKLIST_INSERT(&inodedep->id_pendinghd, &dap->da_list);
@@ -12386,8 +12379,7 @@ retry:
 
 /*
  * Merge the a new inode dependency list (such as id_newinoupdt) into an
- * old inode dependency list (such as id_inoupdt). This routine must be
- * called with splbio interrupts blocked.
+ * old inode dependency list (such as id_inoupdt).
  */
 static void
 merge_inode_lists(newlisthead, oldlisthead)
@@ -12397,6 +12389,8 @@ merge_inode_lists(newlisthead, oldlisthead)
struct allocdirect *listadp, *newadp;
 
newadp = TAILQ_FIRST(newlisthead);
+   if (newadp != NULL)
+   LOCK_OWNED(VFSTOUFS(newadp->ad_block.nb_list.wk_mp));
for (listadp = TAILQ_FIRST(oldlisthead); listadp && newadp;) {
if (listadp->ad_offset < newadp->ad_offset) {
listadp = TAILQ_NEXT(listadp, ad_next);
@@ -12891,7 +12885,6 @@ out:
 
 /*
  * Flush the dependencies associated with an inodedep.
- * Called with splbio blocked.
  */
 static int
 flush_inodedep_deps(vp, mp, ino)
@@ -12956,7 +12949,6 @@ restart:
 
 /*
  * Flush an inode dependency list.
- * Called with splbio blocked.
  */
 static int
 flush_deplist(listhea

svn commit: r349420 - head/contrib/elftoolchain/libelftc

2019-06-26 Thread Mark Johnston
Author: markj
Date: Wed Jun 26 16:30:14 2019
New Revision: 349420
URL: https://svnweb.freebsd.org/changeset/base/349420

Log:
  libelftc: Micro-optimize string table insertion.
  
  The string's length is already known, so use memcpy() instead of
  strcpy() to add it to the string table image.
  
  Reviewed by:  emaste
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D20760

Modified:
  head/contrib/elftoolchain/libelftc/elftc_string_table.c

Modified: head/contrib/elftoolchain/libelftc/elftc_string_table.c
==
--- head/contrib/elftoolchain/libelftc/elftc_string_table.c Wed Jun 26 
16:28:42 2019(r349419)
+++ head/contrib/elftoolchain/libelftc/elftc_string_table.c Wed Jun 26 
16:30:14 2019(r349420)
@@ -119,7 +119,7 @@ elftc_string_table_add_to_pool(Elftc_String_Table *st,
st->st_string_pool_size = newsize;
}
 
-   strcpy(st->st_string_pool + stlen, string);
+   memcpy(st->st_string_pool + stlen, string, len);
ELFTC_STRING_TABLE_UPDATE_LENGTH(st, stlen + len);
 
return (stlen);
___
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: r349421 - head/contrib/elftoolchain/libelftc

2019-06-26 Thread Mark Johnston
Author: markj
Date: Wed Jun 26 16:31:50 2019
New Revision: 349421
URL: https://svnweb.freebsd.org/changeset/base/349421

Log:
  libelftc: Consistently use size_t for string table offsets and sizes.
  
  Reviewed by:  emaste
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D20702

Modified:
  head/contrib/elftoolchain/libelftc/elftc_string_table.c
  head/contrib/elftoolchain/libelftc/elftc_string_table_create.3
  head/contrib/elftoolchain/libelftc/libelftc.h

Modified: head/contrib/elftoolchain/libelftc/elftc_string_table.c
==
--- head/contrib/elftoolchain/libelftc/elftc_string_table.c Wed Jun 26 
16:30:14 2019(r349420)
+++ head/contrib/elftoolchain/libelftc/elftc_string_table.c Wed Jun 26 
16:31:50 2019(r349421)
@@ -44,7 +44,7 @@ ELFTC_VCSID("$Id: elftc_string_table.c 2869 2013-01-06
 #defineELFTC_STRING_TABLE_POOL_SIZE_INCREMENT  (4*1024)
 
 struct _Elftc_String_Table_Entry {
-   int ste_idx;
+   ssize_t ste_idx;
SLIST_ENTRY(_Elftc_String_Table_Entry) ste_next;
 };
 
@@ -64,9 +64,9 @@ struct _Elftc_String_Table_Entry {
} while (0)
 
 struct _Elftc_String_Table {
-   unsigned intst_len; /* length and flags */
+   size_t  st_len; /* length and flags */
int st_nbuckets;
-   int st_string_pool_size;
+   size_t  st_string_pool_size;
char*st_string_pool;
SLIST_HEAD(_Elftc_String_Table_Bucket,
_Elftc_String_Table_Entry) st_buckets[];
@@ -86,7 +86,7 @@ elftc_string_table_find_hash_entry(Elftc_String_Table 
*rhashindex = hashindex;
 
SLIST_FOREACH(ste, &st->st_buckets[hashindex], ste_next) {
-   s = st->st_string_pool + abs(ste->ste_idx);
+   s = st->st_string_pool + labs(ste->ste_idx);
 
assert(s > st->st_string_pool &&
s < st->st_string_pool + st->st_string_pool_size);
@@ -102,7 +102,7 @@ static int
 elftc_string_table_add_to_pool(Elftc_String_Table *st, const char *string)
 {
char *newpool;
-   int len, newsize, stlen;
+   size_t len, newsize, stlen;
 
len = strlen(string) + 1; /* length, including the trailing NUL */
stlen = ELFTC_STRING_TABLE_LENGTH(st);
@@ -126,10 +126,10 @@ elftc_string_table_add_to_pool(Elftc_String_Table *st,
 }
 
 Elftc_String_Table *
-elftc_string_table_create(int sizehint)
+elftc_string_table_create(size_t sizehint)
 {
-   int n, nbuckets, tablesize;
struct _Elftc_String_Table *st;
+   int n, nbuckets, tablesize;
 
if (sizehint < ELFTC_STRING_TABLE_DEFAULT_SIZE)
sizehint = ELFTC_STRING_TABLE_DEFAULT_SIZE;
@@ -173,13 +173,13 @@ elftc_string_table_destroy(Elftc_String_Table *st)
 }
 
 Elftc_String_Table *
-elftc_string_table_from_section(Elf_Scn *scn, int sizehint)
+elftc_string_table_from_section(Elf_Scn *scn, size_t sizehint)
 {
-   int len;
Elf_Data *d;
GElf_Shdr sh;
const char *s, *end;
Elftc_String_Table *st;
+   size_t len;
 
/* Verify the type of the section passed in. */
if (gelf_getshdr(scn, &sh) == NULL ||
@@ -235,7 +235,8 @@ elftc_string_table_image(Elftc_String_Table *st, size_
char *r, *s, *end;
struct _Elftc_String_Table_Entry *ste;
struct _Elftc_String_Table_Bucket *head;
-   int copied, hashindex, offset, length, newsize;
+   size_t copied, offset, length, newsize;
+   int hashindex;
 
/*
 * For the common case of a string table has not seen
@@ -303,8 +304,9 @@ elftc_string_table_image(Elftc_String_Table *st, size_
 size_t
 elftc_string_table_insert(Elftc_String_Table *st, const char *string)
 {
-   int hashindex, idx;
struct _Elftc_String_Table_Entry *ste;
+   ssize_t idx;
+   int hashindex;
 
hashindex = 0;
 
@@ -326,7 +328,7 @@ elftc_string_table_insert(Elftc_String_Table *st, cons
 
idx = ste->ste_idx;
if (idx < 0)/* Undelete. */
-   ste->ste_idx = idx = (- idx);
+   ste->ste_idx = idx = -idx;
 
return (idx);
 }
@@ -334,8 +336,9 @@ elftc_string_table_insert(Elftc_String_Table *st, cons
 size_t
 elftc_string_table_lookup(Elftc_String_Table *st, const char *string)
 {
-   int hashindex, idx;
struct _Elftc_String_Table_Entry *ste;
+   ssize_t idx;
+   int hashindex;
 
ste = elftc_string_table_find_hash_entry(st, string, &hashindex);
 
@@ -350,17 +353,17 @@ elftc_string_table_lookup(Elftc_String_Table *st, cons
 int
 elftc_string_table_remove(Elftc_String_Table *st, const char *string)
 {
-   int idx;
struct _Elftc_String_Table_Entry *ste;
+   ssize_t idx;
 
ste = elftc_string_table_find_hash_entry(st, string, NULL);
 
if (st

svn commit: r349422 - head/contrib/elftoolchain/libelftc

2019-06-26 Thread Mark Johnston
Author: markj
Date: Wed Jun 26 16:32:41 2019
New Revision: 349422
URL: https://svnweb.freebsd.org/changeset/base/349422

Log:
  libelftc: Fix the documented prototype for elftc_string_table_destroy().
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/elftoolchain/libelftc/elftc_string_table_create.3

Modified: head/contrib/elftoolchain/libelftc/elftc_string_table_create.3
==
--- head/contrib/elftoolchain/libelftc/elftc_string_table_create.3  Wed Jun 
26 16:31:50 2019(r349421)
+++ head/contrib/elftoolchain/libelftc/elftc_string_table_create.3  Wed Jun 
26 16:32:41 2019(r349422)
@@ -41,7 +41,7 @@
 .In libelftc.h
 .Ft "Elftc_String_Table *"
 .Fn elftc_string_table_create "size_t sizehint"
-.Ft int
+.Ft void
 .Fn elftc_string_table_destroy "Elftc_String_Table *table"
 .Ft "Elftc_String_Table *"
 .Fn elftc_string_table_from_section "Elf_Scn *scn" "size_t sizehint"
___
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: r349423 - head/contrib/elftoolchain/elfcopy

2019-06-26 Thread Mark Johnston
Author: markj
Date: Wed Jun 26 16:35:37 2019
New Revision: 349423
URL: https://svnweb.freebsd.org/changeset/base/349423

Log:
  elfcopy: Provide a size hint when creating the section string table.
  
  Use the input file's .shstrtab size as the hint if it exists.  This
  gives a small performance improvement when processing files with
  many sections.
  
  Reviewed by:  emaste
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D20544

Modified:
  head/contrib/elftoolchain/elfcopy/sections.c

Modified: head/contrib/elftoolchain/elfcopy/sections.c
==
--- head/contrib/elftoolchain/elfcopy/sections.cWed Jun 26 16:32:41 
2019(r349422)
+++ head/contrib/elftoolchain/elfcopy/sections.cWed Jun 26 16:35:37 
2019(r349423)
@@ -1398,8 +1398,24 @@ update_shdr(struct elfcopy *ecp, int update_link)
 void
 init_shstrtab(struct elfcopy *ecp)
 {
+   Elf_Scn *shstrtab;
+   GElf_Shdr shdr;
struct section *s;
+   size_t indx, sizehint;
 
+   if (elf_getshstrndx(ecp->ein, &indx) != 0) {
+   shstrtab = elf_getscn(ecp->ein, indx);
+   if (shstrtab == NULL)
+   errx(EXIT_FAILURE, "elf_getscn failed: %s",
+   elf_errmsg(-1));
+   if (gelf_getshdr(shstrtab, &shdr) != &shdr)
+   errx(EXIT_FAILURE, "gelf_getshdr failed: %s",
+   elf_errmsg(-1));
+   sizehint = shdr.sh_size;
+   } else {
+   sizehint = 0;
+   }
+
if ((ecp->shstrtab = calloc(1, sizeof(*ecp->shstrtab))) == NULL)
err(EXIT_FAILURE, "calloc failed");
s = ecp->shstrtab;
@@ -1410,7 +1426,7 @@ init_shstrtab(struct elfcopy *ecp)
s->loadable = 0;
s->type = SHT_STRTAB;
s->vma = 0;
-   s->strtab = elftc_string_table_create(0);
+   s->strtab = elftc_string_table_create(sizehint);
 
add_to_shstrtab(ecp, "");
add_to_shstrtab(ecp, ".symtab");
___
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: r349424 - head/contrib/elftoolchain/libdwarf

2019-06-26 Thread Mark Johnston
Author: markj
Date: Wed Jun 26 16:38:30 2019
New Revision: 349424
URL: https://svnweb.freebsd.org/changeset/base/349424

Log:
  libdwarf: Use the cached strtab pointer when reading string attributes.
  
  Previously we would perform a linear search of the DWARF section
  list for ".debug_str".  However, libdwarf always caches a pointer to
  the strtab image in its debug descriptor.  Using it gives a modest
  performance improvement when iterating over the attributes of each
  DIE.
  
  Reviewed by:  emaste
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D20759

Modified:
  head/contrib/elftoolchain/libdwarf/libdwarf_attr.c

Modified: head/contrib/elftoolchain/libdwarf/libdwarf_attr.c
==
--- head/contrib/elftoolchain/libdwarf/libdwarf_attr.c  Wed Jun 26 16:35:37 
2019(r349423)
+++ head/contrib/elftoolchain/libdwarf/libdwarf_attr.c  Wed Jun 26 16:38:30 
2019(r349424)
@@ -100,7 +100,6 @@ _dwarf_attr_init(Dwarf_Debug dbg, Dwarf_Section *ds, u
 uint64_t form, int indirect, Dwarf_Error *error)
 {
struct _Dwarf_Attribute atref;
-   Dwarf_Section *str;
int ret;
 
ret = DW_DLE_NONE;
@@ -183,9 +182,7 @@ _dwarf_attr_init(Dwarf_Debug dbg, Dwarf_Section *ds, u
break;
case DW_FORM_strp:
atref.u[0].u64 = dbg->read(ds->ds_data, offsetp, dwarf_size);
-   str = _dwarf_find_section(dbg, ".debug_str");
-   assert(str != NULL);
-   atref.u[1].s = (char *) str->ds_data + atref.u[0].u64;
+   atref.u[1].s = _dwarf_strtab_get_table(dbg) + atref.u[0].u64;
break;
case DW_FORM_ref_sig8:
atref.u[0].u64 = 8;
___
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: r349426 - head/sys/arm64/arm64

2019-06-26 Thread Olivier Houchard
Author: cognet
Date: Wed Jun 26 16:56:56 2019
New Revision: 349426
URL: https://svnweb.freebsd.org/changeset/base/349426

Log:
  Fix debugging of 32bits arm binaries on arm64.
  
  In set_regs32()/fill_regs32(), we have to get/set SP and LR from/to
  tf_x[13] and tf_x[14].
  set_regs() and fill_regs() may be called for a 32bits process, if the process
  is ptrace'd from a 64bits debugger. So, in set_regs() and fill_regs(), get
  or set PC and SPSR from where the debugger expects it, from tf_x[15] and
  tf_x[16].

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

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Wed Jun 26 16:38:46 2019
(r349425)
+++ head/sys/arm64/arm64/machdep.c  Wed Jun 26 16:56:56 2019
(r349426)
@@ -194,6 +194,16 @@ fill_regs(struct thread *td, struct reg *regs)
 
memcpy(regs->x, frame->tf_x, sizeof(regs->x));
 
+#ifdef COMPAT_FREEBSD32
+   /*
+* We may be called here for a 32bits process, if we're using a
+* 64bits debugger. If so, put PC and SPSR where it expects it.
+*/
+   if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) {
+   regs->x[15] = frame->tf_elr;
+   regs->x[16] = frame->tf_spsr;
+   }
+#endif
return (0);
 }
 
@@ -211,6 +221,17 @@ set_regs(struct thread *td, struct reg *regs)
 
memcpy(frame->tf_x, regs->x, sizeof(frame->tf_x));
 
+#ifdef COMPAT_FREEBSD32
+   if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) {
+   /*
+* We may be called for a 32bits process if we're using
+* a 64bits debugger. If so, get PC and SPSR from where
+* it put it.
+*/
+   frame->tf_elr = regs->x[15];
+   frame->tf_spsr = regs->x[16] & PSR_FLAGS;
+   }
+#endif
return (0);
 }
 
@@ -283,8 +304,9 @@ fill_regs32(struct thread *td, struct reg32 *regs)
tf = td->td_frame;
for (i = 0; i < 13; i++)
regs->r[i] = tf->tf_x[i];
-   regs->r_sp = tf->tf_sp;
-   regs->r_lr = tf->tf_lr;
+   /* For arm32, SP is r13 and LR is r14 */
+   regs->r_sp = tf->tf_x[13];
+   regs->r_lr = tf->tf_x[14];
regs->r_pc = tf->tf_elr;
regs->r_cpsr = tf->tf_spsr;
 
@@ -300,8 +322,9 @@ set_regs32(struct thread *td, struct reg32 *regs)
tf = td->td_frame;
for (i = 0; i < 13; i++)
tf->tf_x[i] = regs->r[i];
-   tf->tf_sp = regs->r_sp;
-   tf->tf_lr = regs->r_lr;
+   /* For arm 32, SP is r13 an LR is r14 */
+   tf->tf_x[13] = regs->r_sp;
+   tf->tf_x[14] = regs->r_lr;
tf->tf_elr = regs->r_pc;
tf->tf_spsr = regs->r_cpsr;
 
___
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: r349427 - head/sys/amd64/amd64

2019-06-26 Thread Konstantin Belousov
Author: kib
Date: Wed Jun 26 17:16:26 2019
New Revision: 349427
URL: https://svnweb.freebsd.org/changeset/base/349427

Log:
  amd64 pmap: Fix pkru handling in pmap_remove().
  
  When pmap_pkru_on_remove() is called, the sva argument value was
  advanced.  Clear PKRU earlier when sva still specifies the start of
  the region.
  
  Noted and reviewed by:alc
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

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

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Wed Jun 26 16:56:56 2019(r349426)
+++ head/sys/amd64/amd64/pmap.c Wed Jun 26 17:16:26 2019(r349427)
@@ -4998,6 +4998,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t 
 
pmap_delayed_invl_start();
PMAP_LOCK(pmap);
+   pmap_pkru_on_remove(pmap, sva, eva);
 
/*
 * special handling of removing one page.  a very
@@ -5091,7 +5092,6 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t 
 out:
if (anyvalid)
pmap_invalidate_all(pmap);
-   pmap_pkru_on_remove(pmap, sva, eva);
PMAP_UNLOCK(pmap);
pmap_delayed_invl_finish();
vm_page_free_pages_toq(&free, true);
___
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: r349428 - head/sys/dev/ow

2019-06-26 Thread Andriy Gapon
Author: avg
Date: Wed Jun 26 17:17:33 2019
New Revision: 349428
URL: https://svnweb.freebsd.org/changeset/base/349428

Log:
  owc_gpiobus: clean / fix up the driver module things
  
  "fdt" is removed from the driver module name as the driver does not
  require FDT and can work very well on hints based systems.
  
  A module dependency is added for gpiobus.  Without that owc cannot
  resolve symbols in gpiobus if both are loaded as kernel modules.
  
  Finally, a driver module module version is added.
  
  Reviewed by:  imp
  MFC after:11 days

Modified:
  head/sys/dev/ow/owc_gpiobus.c

Modified: head/sys/dev/ow/owc_gpiobus.c
==
--- head/sys/dev/ow/owc_gpiobus.c   Wed Jun 26 17:16:26 2019
(r349427)
+++ head/sys/dev/ow/owc_gpiobus.c   Wed Jun 26 17:17:33 2019
(r349428)
@@ -416,5 +416,7 @@ static driver_t owc_gpiobus_driver = {
sizeof(struct owc_gpiobus_softc),
 };
 
-DRIVER_MODULE(owc_gpiobus_fdt, gpiobus, owc_gpiobus_driver, 
owc_gpiobus_devclass, 0, 0);
-MODULE_DEPEND(owc_gpiobus_fdt, ow, 1, 1, 1);
+DRIVER_MODULE(owc_gpiobus, gpiobus, owc_gpiobus_driver, owc_gpiobus_devclass, 
0, 0);
+MODULE_DEPEND(owc_gpiobust, ow, 1, 1, 1);
+MODULE_DEPEND(owc_gpiobus, gpiobus, 1, 1, 1);
+MODULE_VERSION(owc_gpiobus, 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"


Re: svn commit: r349428 - head/sys/dev/ow

2019-06-26 Thread Ian Lepore
On Wed, 2019-06-26 at 17:17 +, Andriy Gapon wrote:
> +MODULE_DEPEND(owc_gpiobust, ow, 1, 1, 1);

Looks like a typo there.

-- Ian

___
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: r349428 - head/sys/dev/ow

2019-06-26 Thread Andriy Gapon
On 26/06/2019 20:31, Ian Lepore wrote:
> On Wed, 2019-06-26 at 17:17 +, Andriy Gapon wrote:
>> +MODULE_DEPEND(owc_gpiobust, ow, 1, 1, 1);
> 
> Looks like a typo there.

Busted!
Thank you!

-- 
Andriy Gapon
___
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: r349432 - in head/sys: amd64/sgx dev/drm2/ttm vm

2019-06-26 Thread Mark Johnston
Author: markj
Date: Wed Jun 26 17:37:51 2019
New Revision: 349432
URL: https://svnweb.freebsd.org/changeset/base/349432

Log:
  Add a return value to vm_page_remove().
  
  Use it to indicate whether the page may be safely freed following
  its removal from the object.  Also change vm_page_remove() to assume
  that the page's object pointer is non-NULL, and have callers perform
  this check instead.
  
  This is a step towards an implementation of an atomic reference counter
  for each physical page structure.
  
  Reviewed by:  alc, dougm, kib
  MFC after:1 week
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D20758

Modified:
  head/sys/amd64/sgx/sgx.c
  head/sys/dev/drm2/ttm/ttm_bo_vm.c
  head/sys/vm/device_pager.c
  head/sys/vm/vm_fault.c
  head/sys/vm/vm_object.c
  head/sys/vm/vm_page.c
  head/sys/vm/vm_page.h

Modified: head/sys/amd64/sgx/sgx.c
==
--- head/sys/amd64/sgx/sgx.cWed Jun 26 17:32:31 2019(r349431)
+++ head/sys/amd64/sgx/sgx.cWed Jun 26 17:37:51 2019(r349432)
@@ -358,7 +358,7 @@ sgx_page_remove(struct sgx_softc *sc, vm_page_t p)
uint64_t offs;
 
vm_page_lock(p);
-   vm_page_remove(p);
+   (void)vm_page_remove(p);
vm_page_unlock(p);
 
dprintf("%s: p->pidx %ld\n", __func__, p->pindex);

Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c
==
--- head/sys/dev/drm2/ttm/ttm_bo_vm.c   Wed Jun 26 17:32:31 2019
(r349431)
+++ head/sys/dev/drm2/ttm/ttm_bo_vm.c   Wed Jun 26 17:37:51 2019
(r349432)
@@ -115,7 +115,7 @@ ttm_bo_vm_fault(vm_object_t vm_obj, vm_ooffset_t offse
vm_object_pip_add(vm_obj, 1);
if (*mres != NULL) {
vm_page_lock(*mres);
-   vm_page_remove(*mres);
+   (void)vm_page_remove(*mres);
vm_page_unlock(*mres);
}
 retry:

Modified: head/sys/vm/device_pager.c
==
--- head/sys/vm/device_pager.c  Wed Jun 26 17:32:31 2019(r349431)
+++ head/sys/vm/device_pager.c  Wed Jun 26 17:37:51 2019(r349432)
@@ -236,7 +236,7 @@ cdev_pager_free_page(vm_object_t object, vm_page_t m)
KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("unmanaged %p", m));
pmap_remove_all(m);
vm_page_lock(m);
-   vm_page_remove(m);
+   (void)vm_page_remove(m);
vm_page_unlock(m);
} else if (object->type == OBJT_DEVICE)
dev_pager_free_page(object, m);

Modified: head/sys/vm/vm_fault.c
==
--- head/sys/vm/vm_fault.c  Wed Jun 26 17:32:31 2019(r349431)
+++ head/sys/vm/vm_fault.c  Wed Jun 26 17:37:51 2019(r349432)
@@ -1144,7 +1144,7 @@ readrest:
fs.object == fs.first_object->backing_object) {
vm_page_lock(fs.m);
vm_page_dequeue(fs.m);
-   vm_page_remove(fs.m);
+   (void)vm_page_remove(fs.m);
vm_page_unlock(fs.m);
vm_page_lock(fs.first_m);
vm_page_replace_checked(fs.m, fs.first_object,

Modified: head/sys/vm/vm_object.c
==
--- head/sys/vm/vm_object.c Wed Jun 26 17:32:31 2019(r349431)
+++ head/sys/vm/vm_object.c Wed Jun 26 17:37:51 2019(r349432)
@@ -1595,10 +1595,8 @@ vm_object_collapse_scan(vm_object_t object, int op)
vm_page_lock(p);
KASSERT(!pmap_page_is_mapped(p),
("freeing mapped page %p", p));
-   if (!vm_page_wired(p))
+   if (vm_page_remove(p))
vm_page_free(p);
-   else
-   vm_page_remove(p);
vm_page_unlock(p);
continue;
}
@@ -1639,10 +1637,8 @@ vm_object_collapse_scan(vm_object_t object, int op)
vm_page_lock(p);
KASSERT(!pmap_page_is_mapped(p),
("freeing mapped page %p", p));
-   if (!vm_page_wired(p))
+   if (vm_page_remove(p))
vm_page_free(p);
-   else
-   vm_page_remove(p);
vm_page_unlock(p);
continue;
}

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Wed Ju

svn commit: r349433 - head/sys/dev/ow

2019-06-26 Thread Andriy Gapon
Author: avg
Date: Wed Jun 26 17:38:38 2019
New Revision: 349433
URL: https://svnweb.freebsd.org/changeset/base/349433

Log:
  fix up r349428, fix a typo made during "fdt" removal
  
  Reported by:  ian
  MFC after:11 days

Modified:
  head/sys/dev/ow/owc_gpiobus.c

Modified: head/sys/dev/ow/owc_gpiobus.c
==
--- head/sys/dev/ow/owc_gpiobus.c   Wed Jun 26 17:37:51 2019
(r349432)
+++ head/sys/dev/ow/owc_gpiobus.c   Wed Jun 26 17:38:38 2019
(r349433)
@@ -417,6 +417,6 @@ static driver_t owc_gpiobus_driver = {
 };
 
 DRIVER_MODULE(owc_gpiobus, gpiobus, owc_gpiobus_driver, owc_gpiobus_devclass, 
0, 0);
-MODULE_DEPEND(owc_gpiobust, ow, 1, 1, 1);
+MODULE_DEPEND(owc_gpiobus, ow, 1, 1, 1);
 MODULE_DEPEND(owc_gpiobus, gpiobus, 1, 1, 1);
 MODULE_VERSION(owc_gpiobus, 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: r349438 - head/sbin/dhclient

2019-06-26 Thread Mark Johnston
Author: markj
Date: Wed Jun 26 20:11:52 2019
New Revision: 349438
URL: https://svnweb.freebsd.org/changeset/base/349438

Log:
  Avoid a divide-by-zero when bad checksum counters overflow.
  
  A mixture of IP or UDP packets with valid and invalid checksum could
  cause {ip,udp}_packets_bad_checksum to wrap around to 0, resulting
  in a division by zero.
  
  This is packet.c rev. 1.27 from OpenBSD.
  
  admbugs:  552
  Obtained from:OpenBSD
  MFC after:3 days

Modified:
  head/sbin/dhclient/packet.c

Modified: head/sbin/dhclient/packet.c
==
--- head/sbin/dhclient/packet.c Wed Jun 26 20:07:16 2019(r349437)
+++ head/sbin/dhclient/packet.c Wed Jun 26 20:11:52 2019(r349438)
@@ -183,7 +183,7 @@ decode_udp_ip_header(unsigned char *buf, int bufix, st
ip_packets_seen++;
if (wrapsum(checksum(buf + bufix, ip_len, 0)) != 0) {
ip_packets_bad_checksum++;
-   if (ip_packets_seen > 4 &&
+   if (ip_packets_seen > 4 && ip_packets_bad_checksum != 0 &&
(ip_packets_seen / ip_packets_bad_checksum) < 2) {
note("%d bad IP checksums seen in %d packets",
ip_packets_bad_checksum, ip_packets_seen);
@@ -235,7 +235,7 @@ decode_udp_ip_header(unsigned char *buf, int bufix, st
udp_packets_seen++;
if (usum && usum != sum) {
udp_packets_bad_checksum++;
-   if (udp_packets_seen > 4 &&
+   if (udp_packets_seen > 4 && udp_packets_bad_checksum != 0 &&
(udp_packets_seen / udp_packets_bad_checksum) < 2) {
note("%d bad udp checksums in %d packets",
udp_packets_bad_checksum, udp_packets_seen);
___
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: r349439 - head/sbin/dhclient

2019-06-26 Thread Mark Johnston
Author: markj
Date: Wed Jun 26 20:19:48 2019
New Revision: 349439
URL: https://svnweb.freebsd.org/changeset/base/349439

Log:
  Free DHCP options with length zero.
  
  Otherwise they are leaked, allowing an attacker to trigger memory
  exhaustion.
  
  This is options.c rev. 1.70 from OpenBSD.
  
  admbugs:  552
  Obtained from:OpenBSD
  MFC after:3 days

Modified:
  head/sbin/dhclient/options.c

Modified: head/sbin/dhclient/options.c
==
--- head/sbin/dhclient/options.cWed Jun 26 20:11:52 2019
(r349438)
+++ head/sbin/dhclient/options.cWed Jun 26 20:19:48 2019
(r349439)
@@ -896,6 +896,5 @@ do_packet(struct interface_info *interface, struct dhc
 
/* Free the data associated with the options. */
for (i = 0; i < 256; i++)
-   if (tp.options[i].len && tp.options[i].data)
-   free(tp.options[i].data);
+   free(tp.options[i].data);
 }
___
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: r349441 - head/sys/amd64/vmm

2019-06-26 Thread Rodney W. Grimes
Author: rgrimes
Date: Wed Jun 26 21:19:43 2019
New Revision: 349441
URL: https://svnweb.freebsd.org/changeset/base/349441

Log:
  Emulate the "TEST r/m{16,32,64}, imm{16,32,32}" instructions (opcode F7H).
  
  This adds emulation for:
test r/m16, imm16
test r/m32, imm32
test r/m64, imm32 sign-extended to 64
  
  OpenBSD guests compiled with clang 8.0.0 use TEST directly against a
  Local APIC register instead of separate read via MOV followed by a
  TEST against the register.
  
  PR:   238794
  Submitted by: jhb
  Reported by:  Jason Tubnor ja...@tubnor.net
  Tested by:Jason Tubnor ja...@tubnor.net
  Reviewed by:  markj, Patrick Mooney patrick.moo...@joyent.com
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D20755

Modified:
  head/sys/amd64/vmm/vmm_instruction_emul.c

Modified: head/sys/amd64/vmm/vmm_instruction_emul.c
==
--- head/sys/amd64/vmm/vmm_instruction_emul.c   Wed Jun 26 20:25:57 2019
(r349440)
+++ head/sys/amd64/vmm/vmm_instruction_emul.c   Wed Jun 26 21:19:43 2019
(r349441)
@@ -78,6 +78,7 @@ enum {
VIE_OP_TYPE_BITTEST,
VIE_OP_TYPE_TWOB_GRP15,
VIE_OP_TYPE_ADD,
+   VIE_OP_TYPE_TEST,
VIE_OP_TYPE_LAST
 };
 
@@ -221,6 +222,12 @@ static const struct vie_op one_byte_opcodes[256] = {
.op_byte = 0x8F,
.op_type = VIE_OP_TYPE_POP,
},
+   [0xF7] = {
+   /* XXX Group 3 extended opcode - not just TEST */
+   .op_byte = 0xF7,
+   .op_type = VIE_OP_TYPE_TEST,
+   .op_flags = VIE_OP_F_IMM,
+   },
[0xFF] = {
/* XXX Group 5 extended opcode - not just PUSH */
.op_byte = 0xFF,
@@ -450,6 +457,41 @@ getaddflags(int opsize, uint64_t x, uint64_t y)
return (getaddflags64(x, y));
 }
 
+/*
+ * Return the status flags that would result from doing (x & y).
+ */
+#defineGETANDFLAGS(sz) 
\
+static u_long  \
+getandflags##sz(uint##sz##_t x, uint##sz##_t y)
\
+{  \
+   u_long rflags;  \
+   \
+   __asm __volatile("and %2,%1; pushfq; popq %0" : \
+   "=r" (rflags), "+r" (x) : "m" (y)); \
+   return (rflags);\
+} struct __hack
+
+GETANDFLAGS(8);
+GETANDFLAGS(16);
+GETANDFLAGS(32);
+GETANDFLAGS(64);
+
+static u_long
+getandflags(int opsize, uint64_t x, uint64_t y)
+{
+   KASSERT(opsize == 1 || opsize == 2 || opsize == 4 || opsize == 8,
+   ("getandflags: invalid operand size %d", opsize));
+
+   if (opsize == 1)
+   return (getandflags8(x, y));
+   else if (opsize == 2)
+   return (getandflags16(x, y));
+   else if (opsize == 4)
+   return (getandflags32(x, y));
+   else
+   return (getandflags64(x, y));
+}
+
 static int
 emulate_mov(void *vm, int vcpuid, uint64_t gpa, struct vie *vie,
mem_region_read_t memread, mem_region_write_t memwrite, void *arg)
@@ -1219,6 +1261,55 @@ emulate_cmp(void *vm, int vcpuid, uint64_t gpa, struct
 }
 
 static int
+emulate_test(void *vm, int vcpuid, uint64_t gpa, struct vie *vie,
+mem_region_read_t memread, mem_region_write_t memwrite, void *arg)
+{
+   int error, size;
+   uint64_t op1, rflags, rflags2;
+
+   size = vie->opsize;
+   error = EINVAL;
+
+   switch (vie->op.op_byte) {
+   case 0xF7:
+   /*
+* F7 /0test r/m16, imm16
+* F7 /0test r/m32, imm32
+* REX.W + F7 /0test r/m64, imm32 sign-extended to 64
+*
+* Test mem (ModRM:r/m) with immediate and set status
+* flags according to the results.  The comparison is
+* performed by anding the immediate from the first
+* operand and then setting the status flags.
+*/
+   if ((vie->reg & 7) != 0)
+   return (EINVAL);
+
+   error = memread(vm, vcpuid, gpa, &op1, size, arg);
+   if (error)
+   return (error);
+
+   rflags2 = getandflags(size, op1, vie->immediate);
+   break;
+   default:
+   return (EINVAL);
+   }
+   error = vie_read_register(vm, vcpuid, VM_REG_GUEST_RFLAGS, &rflags);
+   if (error)
+   return (error);
+
+   /*
+* OF and CF are cleared; the SF, ZF and PF flags are set according
+* to the result; AF i

svn commit: r349442 - head/sys/arm64/arm64

2019-06-26 Thread Alan Cox
Author: alc
Date: Wed Jun 26 21:43:41 2019
New Revision: 349442
URL: https://svnweb.freebsd.org/changeset/base/349442

Log:
  Revert one of the changes from r349323.  Specifically, undo the change
  that replaced a pmap_invalidate_page() with a dsb(ishst) in
  pmap_enter_quick_locked().  Even though this change is in principle
  correct, I am seeing occasional, spurious bus errors that are only
  reproducible without this pmap_invalidate_page().  (None of adding an
  isb, "upgrading" the dsb to wait on loads as well as stores, or
  disabling superpage mappings eliminates the bus errors.)  Add an XXX
  comment explaining why the pmap_invalidate_page() is being performed.
  
  Discussed with:andrew, markj

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

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Wed Jun 26 21:19:43 2019(r349441)
+++ head/sys/arm64/arm64/pmap.c Wed Jun 26 21:43:41 2019(r349442)
@@ -3758,7 +3758,15 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v
cpu_icache_sync_range(PHYS_TO_DMAP(pa), PAGE_SIZE);
 
pmap_load_store(l3, l3_val);
-   dsb(ishst);
+
+   /*
+* XXX In principle, because this L3 entry was invalid, we should not
+* need to perform a TLB invalidation here.  However, in practice,
+* when simply performing a "dsb ishst" here, processes are being
+* terminated due to bus errors and segmentation violations. 
+*/
+   pmap_invalidate_page(pmap, va);
+
return (mpte);
 }
 
___
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: r349444 - head/sys/arm64/arm64

2019-06-26 Thread Olivier Houchard
Author: cognet
Date: Wed Jun 26 22:06:40 2019
New Revision: 349444
URL: https://svnweb.freebsd.org/changeset/base/349444

Log:
  In get_fpcontext32() and set_fpcontext32(), we can't just use memcpy() to
  copy the VFP registers.
  arvm7 VFP uses 32 64bits fp registers (but those could be used in pairs to
  make 16 128bits registers), while aarch64 uses 32 128bits fp registers, so
  we have to copy the value of each register.

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

Modified: head/sys/arm64/arm64/freebsd32_machdep.c
==
--- head/sys/arm64/arm64/freebsd32_machdep.cWed Jun 26 21:59:43 2019
(r349443)
+++ head/sys/arm64/arm64/freebsd32_machdep.cWed Jun 26 22:06:40 2019
(r349444)
@@ -122,6 +122,7 @@ static void
 get_fpcontext32(struct thread *td, mcontext32_vfp_t *mcp)
 {
struct pcb *curpcb;
+   int i;
 
critical_enter();
curpcb = curthread->td_pcb;
@@ -137,8 +138,8 @@ get_fpcontext32(struct thread *td, mcontext32_vfp_t *m
("Called get_fpcontext while the kernel is 
using the VFP"));
KASSERT((curpcb->pcb_fpflags & ~PCB_FP_USERMASK) == 0,
("Non-userspace FPU flags set in 
get_fpcontext"));
-   memcpy(mcp->mcv_reg, curpcb->pcb_fpustate.vfp_regs,
-   sizeof(mcp->mcv_reg));
+   for (i = 0; i < 32; i++)
+   mcp->mcv_reg[i] = 
(uint64_t)curpcb->pcb_fpustate.vfp_regs[i];
mcp->mcv_fpscr = 
VFP_FPSCR_FROM_SRCR(curpcb->pcb_fpustate.vfp_fpcr,
curpcb->pcb_fpustate.vfp_fpsr);
}
@@ -149,13 +150,14 @@ static void
 set_fpcontext32(struct thread *td, mcontext32_vfp_t *mcp)
 {
struct pcb *pcb;
+   int i;
 
critical_enter();
pcb = td->td_pcb;
if (td == curthread)
vfp_discard(td);
-   memcpy(pcb->pcb_fpustate.vfp_regs, mcp->mcv_reg,
-   sizeof(pcb->pcb_fpustate.vfp_regs));
+   for (i = 0; i < 32; i++)
+   pcb->pcb_fpustate.vfp_regs[i] = mcp->mcv_reg[i];
pcb->pcb_fpustate.vfp_fpsr = VFP_FPSR_FROM_FPSCR(mcp->mcv_fpscr);
pcb->pcb_fpustate.vfp_fpcr = VFP_FPSR_FROM_FPSCR(mcp->mcv_fpscr);
critical_exit();
___
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: r349446 - in head/lib/libsecureboot: . h openpgp

2019-06-26 Thread Simon J. Gerraty
Author: sjg
Date: Wed Jun 26 23:33:32 2019
New Revision: 349446
URL: https://svnweb.freebsd.org/changeset/base/349446

Log:
  libsecureboot: allow OpenPGP support to be dormant
  
  Since we can now add OpenPGP trust anchors at runtime,
  ensure the latent support is available.
  
  Ensure we do not add duplicate keys to trust store.
  
  Also allow reporting names of trust anchors added/revoked
  
  We only do this for loader and only after initializing trust store.
  Thus only changes to initial trust store will be logged.
  
  Reviewed by:  stevek
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D20700

Modified:
  head/lib/libsecureboot/h/libsecureboot.h
  head/lib/libsecureboot/libsecureboot-priv.h
  head/lib/libsecureboot/local.trust.mk
  head/lib/libsecureboot/openpgp/opgp_key.c
  head/lib/libsecureboot/readfile.c
  head/lib/libsecureboot/verify_file.c
  head/lib/libsecureboot/vets.c

Modified: head/lib/libsecureboot/h/libsecureboot.h
==
--- head/lib/libsecureboot/h/libsecureboot.hWed Jun 26 23:10:20 2019
(r349445)
+++ head/lib/libsecureboot/h/libsecureboot.hWed Jun 26 23:33:32 2019
(r349446)
@@ -42,6 +42,7 @@
 
 #include 
 
+unsigned char * read_fd(int, size_t);
 #ifndef NEED_BRSSL_H
 unsigned char * read_file(const char *, size_t *);
 #endif
@@ -51,8 +52,12 @@ extern int DebugVe;
 #define DEBUG_PRINTF(n, x) if (DebugVe >= n) printf x
 
 int ve_trust_init(void);
+size_t ve_trust_anchors_add_buf(unsigned char *, size_t);
+size_t ve_trust_anchors_revoke(unsigned char *, size_t);
 int ve_trust_add(const char *);
 void ve_debug_set(int);
+void ve_anchor_verbose_set(int);
+int ve_anchor_verbose_get(void);
 void ve_utc_set(time_t utc);
 char *ve_error_get(void);
 int ve_error_set(const char *, ...) __printflike(1,2);

Modified: head/lib/libsecureboot/libsecureboot-priv.h
==
--- head/lib/libsecureboot/libsecureboot-priv.h Wed Jun 26 23:10:20 2019
(r349445)
+++ head/lib/libsecureboot/libsecureboot-priv.h Wed Jun 26 23:33:32 2019
(r349446)
@@ -56,6 +56,8 @@ int is_verified(struct stat *stp);
 void add_verify_status(struct stat *stp, int status);
 
 int openpgp_trust_init(void);
+int openpgp_trust_add_buf(unsigned char *, size_t);
+int openpgp_trust_revoke(const char *);
 int openpgp_self_tests(void);
 
 int efi_secure_boot_enabled(void);

Modified: head/lib/libsecureboot/local.trust.mk
==
--- head/lib/libsecureboot/local.trust.mk   Wed Jun 26 23:10:20 2019
(r349445)
+++ head/lib/libsecureboot/local.trust.mk   Wed Jun 26 23:33:32 2019
(r349446)
@@ -33,6 +33,10 @@ VE_SIGNATURE_EXT_LIST+= \
sig
 .endif
 
+# add OpenPGP support - possibly dormant
+VE_SIGNATURE_LIST+= OPENPGP
+VE_SIGNATURE_EXT_LIST+= asc
+
 SIGNER ?= ${SB_TOOLS_PATH:U/volume/buildtools/bin}/sign.py
 
 .if exists(${SIGNER})
@@ -42,7 +46,12 @@ SIGN_ECDSA= ${PYTHON} ${SIGNER} -u ${SIGN_HOST}:${ECDS
 RSA2_PORT:= ${163%y:L:gmtime}
 SIGN_RSA2=   ${PYTHON} ${SIGNER} -u ${SIGN_HOST}:${RSA2_PORT} -h sha256
 
+# deal with quirk of our .esig format
+XCFLAGS.vets+= -DVE_ECDSA_HASH_AGAIN
+
 .if !empty(OPENPGP_SIGN_URL)
+XCFLAGS.opgp_key+= -DHAVE_TA_ASC_H
+
 VE_SIGNATURE_LIST+= OPENPGP
 VE_SIGNATURE_EXT_LIST+= asc
 

Modified: head/lib/libsecureboot/openpgp/opgp_key.c
==
--- head/lib/libsecureboot/openpgp/opgp_key.c   Wed Jun 26 23:10:20 2019
(r349445)
+++ head/lib/libsecureboot/openpgp/opgp_key.c   Wed Jun 26 23:33:32 2019
(r349446)
@@ -209,13 +209,54 @@ openpgp_trust_add(OpenPGP_key *key)
 
LIST_INIT(&trust_list);
}
-   if (key) {
-   DEBUG_PRINTF(2, ("openpgp_trust_add(%s)\n", key->id));
+   if (key && openpgp_trust_get(key->id) == NULL) {
+   if (ve_anchor_verbose_get())
+   printf("openpgp_trust_add(%s)\n", key->id);
LIST_INSERT_HEAD(&trust_list, key, entries);
}
 }
 
 /**
+ * @brief add trust anchor from buf
+ */
+int
+openpgp_trust_add_buf(unsigned char *buf, size_t nbytes)
+{
+   OpenPGP_key *key;
+
+   if ((key = load_key_buf(buf, nbytes))) {
+   openpgp_trust_add(key);
+   }
+   return (key != NULL);
+}
+
+
+/**
+ * @brief if keyID is in our list clobber it
+ *
+ * @return true if keyID removed
+ */
+int
+openpgp_trust_revoke(const char *keyID)
+{
+   OpenPGP_key *key, *tkey;
+
+   openpgp_trust_add(NULL);/* initialize if needed */
+
+   LIST_FOREACH(key, &trust_list, entries) {
+   if (strcmp(key->id, keyID) == 0) {
+   tkey = key;
+   LIST_REMOVE(tkey, entries);
+   printf("openpgp_trust_revoke

svn commit: r349448 - head/contrib/ipfilter/man

2019-06-26 Thread Cy Schubert
Author: cy
Date: Thu Jun 27 02:42:56 2019
New Revision: 349448
URL: https://svnweb.freebsd.org/changeset/base/349448

Log:
  Fix a typo.
  
  PR/238816 initially addressed updates to usage() however it has now
  become a shopping list of fixes to ipmon man pages and usage().
  
  PR:   238816
  MFC after:3 days

Modified:
  head/contrib/ipfilter/man/ipmon.8

Modified: head/contrib/ipfilter/man/ipmon.8
==
--- head/contrib/ipfilter/man/ipmon.8   Thu Jun 27 00:00:48 2019
(r349447)
+++ head/contrib/ipfilter/man/ipmon.8   Thu Jun 27 02:42:56 2019
(r349448)
@@ -27,7 +27,7 @@ ipmon \- monitors /dev/ipl for logged packets
 .LP
 \fBipmon\fP opens \fB/dev/ipl\fP for reading and awaits data to be saved from
 the packet filter.  The binary data read from the device is reprinted in
-human readable for, however, IP#'s are not mapped back to hostnames, nor are
+human readable form, however, IP#'s are not mapped back to hostnames, nor are
 ports mapped back to service names.  The output goes to standard output by
 default or a filename, if given on the command line.  Should the \fB\-s\fP
 option be used, output is instead sent to \fBsyslogd(8)\fP.  Messages sent
___
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: r349449 - in head: sbin/ipf/ipmon tools/build/mk

2019-06-26 Thread Cy Schubert
Author: cy
Date: Thu Jun 27 02:43:26 2019
New Revision: 349449
URL: https://svnweb.freebsd.org/changeset/base/349449

Log:
  Add the ipmon.5 man page.
  
  PR/238816 initially addressed updates to usage() however the PR has
  morphed into a shopping list of updates to usage() and man pages.
  
  PR:   238816 (I added to the list during discussion)
  MFC after:1 week

Modified:
  head/sbin/ipf/ipmon/Makefile
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/sbin/ipf/ipmon/Makefile
==
--- head/sbin/ipf/ipmon/MakefileThu Jun 27 02:42:56 2019
(r349448)
+++ head/sbin/ipf/ipmon/MakefileThu Jun 27 02:43:26 2019
(r349449)
@@ -3,7 +3,7 @@
 PACKAGE=   ipf
 PROG=  ipmon
 SRCS=  ${GENHDRS} ipmon.c ipmon_y.c ipmon_l.c
-MAN=   ipmon.8
+MAN=   ipmon.5 ipmon.8
 
 CFLAGS+=   -DLOGFAC=LOG_LOCAL0 -I.
 

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Thu Jun 27 02:42:56 
2019(r349448)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Thu Jun 27 02:43:26 
2019(r349449)
@@ -3350,6 +3350,7 @@ OLD_FILES+=usr/share/man/man5/ipf.5.gz
 OLD_FILES+=usr/share/man/man5/ipf.conf.5.gz
 OLD_FILES+=usr/share/man/man5/ipf6.conf.5.gz
 OLD_FILES+=usr/share/man/man5/ipfilter.5.gz
+OLD_FILES+=usr/share/man/man8/ipmon.5.gz
 OLD_FILES+=usr/share/man/man5/ipnat.5.gz
 OLD_FILES+=usr/share/man/man5/ipnat.conf.5.gz
 OLD_FILES+=usr/share/man/man5/ippool.5.gz
___
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: r349450 - head/contrib/ipfilter/tools

2019-06-26 Thread Cy Schubert
Author: cy
Date: Thu Jun 27 02:43:30 2019
New Revision: 349450
URL: https://svnweb.freebsd.org/changeset/base/349450

Log:
  Update usage() to refect the current state of ipmon.
  
  PR:   238816
  MFC after:1 week

Modified:
  head/contrib/ipfilter/tools/ipmon.c

Modified: head/contrib/ipfilter/tools/ipmon.c
==
--- head/contrib/ipfilter/tools/ipmon.c Thu Jun 27 02:43:26 2019
(r349449)
+++ head/contrib/ipfilter/tools/ipmon.c Thu Jun 27 02:43:30 2019
(r349450)
@@ -1438,8 +1438,11 @@ printipflog:
 static void usage(prog)
char *prog;
 {
-   fprintf(stderr, "%s: [-NFhstvxX] [-f ]\n", prog);
-   exit(1);
+   fprintf(stderr, "Usage: %s [ -abDFhnpstvxX ] [ -B  ] [ 
-C  ]\n"
+   "\t[ -f  ] [ -L  ] [ -N  ]\n"
+   "\t[ -o [NSI] ] [ -O [NSI] ] [ -P  ] [ -S  ]\n"
+   "\t[  ]\n", prog);
+   exit(-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"


Re: svn commit: r349450 - head/contrib/ipfilter/tools

2019-06-26 Thread Rodney W. Grimes
> Author: cy
> Date: Thu Jun 27 02:43:30 2019
> New Revision: 349450
> URL: https://svnweb.freebsd.org/changeset/base/349450
> 
> Log:
>   Update usage() to refect the current state of ipmon.
>   
>   PR: 238816
>   MFC after:  1 week
> 
> Modified:
>   head/contrib/ipfilter/tools/ipmon.c
> 
> Modified: head/contrib/ipfilter/tools/ipmon.c
> ==
> --- head/contrib/ipfilter/tools/ipmon.c   Thu Jun 27 02:43:26 2019
> (r349449)
> +++ head/contrib/ipfilter/tools/ipmon.c   Thu Jun 27 02:43:30 2019
> (r349450)
> @@ -1438,8 +1438,11 @@ printipflog:
>  static void usage(prog)
>   char *prog;
>  {
> - fprintf(stderr, "%s: [-NFhstvxX] [-f ]\n", prog);
> - exit(1);
expected

> + fprintf(stderr, "Usage: %s [ -abDFhnpstvxX ] [ -B  ] [ 
> -C  ]\n"
> + "\t[ -f  ] [ -L  ] [ -N  ]\n"
> + "\t[ -o [NSI] ] [ -O [NSI] ] [ -P  ] [ -S  ]\n"
> + "\t[  ]\n", prog);
> + exit(-1);

Was it intentional to flip the exit code to -1?
Someones scripts might not be prepared for that.

>  }

-- 
Rod Grimes rgri...@freebsd.org
___
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: r349450 - head/contrib/ipfilter/tools

2019-06-26 Thread Cy Schubert
In message <201906270301.x5r31slh057...@gndrsh.dnsmgr.net>, "Rodney W. 
Grimes"
writes:
> > Author: cy
> > Date: Thu Jun 27 02:43:30 2019
> > New Revision: 349450
> > URL: https://svnweb.freebsd.org/changeset/base/349450
> > 
> > Log:
> >   Update usage() to refect the current state of ipmon.
> >   
> >   PR:   238816
> >   MFC after:1 week
> > 
> > Modified:
> >   head/contrib/ipfilter/tools/ipmon.c
> > 
> > Modified: head/contrib/ipfilter/tools/ipmon.c
> > ===
> ===
> > --- head/contrib/ipfilter/tools/ipmon.c Thu Jun 27 02:43:26 2019
>   (r349449)
> > +++ head/contrib/ipfilter/tools/ipmon.c Thu Jun 27 02:43:30 2019
>   (r349450)
> > @@ -1438,8 +1438,11 @@ printipflog:
> >  static void usage(prog)
> > char *prog;
> >  {
> > -   fprintf(stderr, "%s: [-NFhstvxX] [-f ]\n", prog);
> > -   exit(1);
> expected
>
> > +   fprintf(stderr, "Usage: %s [ -abDFhnpstvxX ] [ -B  ] [ 
> -C  ]\n"
> > +   "\t[ -f  ] [ -L  ] [ -N  ]\n"
> > +   "\t[ -o [NSI] ] [ -O [NSI] ] [ -P  ] [ -S  ]\n
> "
> > +   "\t[  ]\n", prog);
> > +   exit(-1);
>
> Was it intentional to flip the exit code to -1?
> Someones scripts might not be prepared for that.

My mistake I missed that.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  http://www.FreeBSD.org

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


___
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: r349451 - head/contrib/ipfilter/tools

2019-06-26 Thread Cy Schubert
Author: cy
Date: Thu Jun 27 03:50:13 2019
New Revision: 349451
URL: https://svnweb.freebsd.org/changeset/base/349451

Log:
  Return a return code scripts might expect. I missed this while
  reviewing and rewriting a patch in PR/238816.
  
  PR:   238816
  Reported by:  rgrimes@
  Pointy hat to:cy@
  MFC after:1 week
  X-MFC with:   r349450

Modified:
  head/contrib/ipfilter/tools/ipmon.c

Modified: head/contrib/ipfilter/tools/ipmon.c
==
--- head/contrib/ipfilter/tools/ipmon.c Thu Jun 27 02:43:30 2019
(r349450)
+++ head/contrib/ipfilter/tools/ipmon.c Thu Jun 27 03:50:13 2019
(r349451)
@@ -1442,7 +1442,7 @@ static void usage(prog)
"\t[ -f  ] [ -L  ] [ -N  ]\n"
"\t[ -o [NSI] ] [ -O [NSI] ] [ -P  ] [ -S  ]\n"
"\t[  ]\n", prog);
-   exit(-1);
+   exit(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"