svn commit: r303901 - head/sys/dev/hyperv/netvsc

2016-08-09 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Aug 10 03:11:07 2016
New Revision: 303901
URL: https://svnweb.freebsd.org/changeset/base/303901

Log:
  hyperv/hn: Reorganize send done callback.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7450

Added:
  head/sys/dev/hyperv/netvsc/if_hnvar.h   (contents, props changed)
Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.h

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Aug 10 03:10:34 2016
(r303900)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Aug 10 03:11:07 2016
(r303901)
@@ -68,6 +68,12 @@ static void hv_nv_on_receive_completion(
 static void hv_nv_on_receive(netvsc_dev *net_dev,
 struct hn_rx_ring *rxr, struct vmbus_channel *chan,
 const struct vmbus_chanpkt_hdr *pkt);
+static void hn_nvs_sent_none(struct hn_send_ctx *sndc,
+struct netvsc_dev_ *net_dev, struct vmbus_channel *chan,
+const struct nvsp_msg_ *msg);
+
+static struct hn_send_ctx  hn_send_ctx_none =
+HN_SEND_CTX_INITIALIZER(hn_nvs_sent_none, NULL);
 
 /*
  *
@@ -141,6 +147,7 @@ hv_nv_get_next_send_section(netvsc_dev *
 static int 
 hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *sc)
 {
+   struct hn_send_ctx sndc;
netvsc_dev *net_dev;
nvsp_msg *init_pkt;
int ret = 0;
@@ -189,9 +196,10 @@ hv_nv_init_rx_buffer_with_net_vsp(struct
 
/* Send the gpadl notification request */
 
+   hn_send_ctx_init_simple(, hn_nvs_sent_wakeup, NULL);
ret = vmbus_chan_send(sc->hn_prichan,
VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
-   init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt);
+   init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t));
if (ret != 0) {
goto cleanup;
}
@@ -240,6 +248,7 @@ exit:
 static int 
 hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc)
 {
+   struct hn_send_ctx sndc;
netvsc_dev *net_dev;
nvsp_msg *init_pkt;
int ret = 0;
@@ -287,9 +296,10 @@ hv_nv_init_send_buffer_with_net_vsp(stru
 
/* Send the gpadl notification request */
 
+   hn_send_ctx_init_simple(, hn_nvs_sent_wakeup, NULL);
ret = vmbus_chan_send(sc->hn_prichan,
VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
-   init_pkt, sizeof(nvsp_msg), (uint64_t)init_pkt);
+   init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t));
if (ret != 0) {
goto cleanup;
}
@@ -348,8 +358,7 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_
 
ret = vmbus_chan_send(net_dev->sc->hn_prichan,
VMBUS_CHANPKT_TYPE_INBAND, 0, revoke_pkt, sizeof(nvsp_msg),
-   (uint64_t)(uintptr_t)revoke_pkt);
-
+   (uint64_t)(uintptr_t)_send_ctx_none);
/*
 * If we failed here, we might as well return and have a leak 
 * rather than continue and a bugchk
@@ -414,9 +423,8 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne
NETVSC_SEND_BUFFER_ID;
 
ret = vmbus_chan_send(net_dev->sc->hn_prichan,
-   VMBUS_CHANPKT_TYPE_INBAND, 0,
-   revoke_pkt, sizeof(nvsp_msg),
-   (uint64_t)(uintptr_t)revoke_pkt);
+   VMBUS_CHANPKT_TYPE_INBAND, 0, revoke_pkt, sizeof(nvsp_msg),
+   (uint64_t)(uintptr_t)_send_ctx_none);
/*
 * If we failed here, we might as well return and have a leak 
 * rather than continue and a bugchk
@@ -466,6 +474,7 @@ static int
 hv_nv_negotiate_nvsp_protocol(struct hn_softc *sc, netvsc_dev *net_dev,
 uint32_t nvsp_ver)
 {
+   struct hn_send_ctx sndc;
nvsp_msg *init_pkt;
int ret;
 
@@ -480,9 +489,10 @@ hv_nv_negotiate_nvsp_protocol(struct hn_
init_pkt->msgs.init_msgs.init.protocol_version_2 = nvsp_ver;
 
/* Send the init request */
+   hn_send_ctx_init_simple(, hn_nvs_sent_wakeup, NULL);
ret = vmbus_chan_send(sc->hn_prichan,
VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
-   init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt);
+   init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t));
if (ret != 0)
return (-1);
 
@@ -524,7 +534,7 @@ hv_nv_send_ndis_config(struct hn_softc *
 
/* Send the configuration packet */
ret = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, 0,
-   init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt);
+   init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)_send_ctx_none);
if (ret != 0)
   

svn commit: r303900 - in head/cddl/usr.sbin/dtrace/tests: common/raise common/safety tools

2016-08-09 Thread Garrett Cooper
Author: ngie
Date: Wed Aug 10 03:10:34 2016
New Revision: 303900
URL: https://svnweb.freebsd.org/changeset/base/303900

Log:
  Highball memory requirement (4GB) with common/{raise,safety}
  
  Both test suites require more memory than my amd64 VM using
  GENERIC-NODEBUG can provide and reliably panic it with OOM issues in
  dtrace(4).
  
  Some of the testcases fail, but this at least bypasses the panic behavior
  on platforms that don't have enough resources
  
  MFC after: 2 weeks
  Discussed with: markj
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/cddl/usr.sbin/dtrace/tests/common/raise/Makefile
  head/cddl/usr.sbin/dtrace/tests/common/safety/Makefile
  head/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh

Modified: head/cddl/usr.sbin/dtrace/tests/common/raise/Makefile
==
--- head/cddl/usr.sbin/dtrace/tests/common/raise/Makefile   Wed Aug 10 
02:44:46 2016(r303899)
+++ head/cddl/usr.sbin/dtrace/tests/common/raise/Makefile   Wed Aug 10 
03:10:34 2016(r303900)
@@ -20,4 +20,6 @@ CFILES= \
  tst.raise3.c  \
 
 
+TEST_METADATA.t_dtrace_contrib+=   required_memory="4g"
+
 .include "../../dtrace.test.mk"

Modified: head/cddl/usr.sbin/dtrace/tests/common/safety/Makefile
==
--- head/cddl/usr.sbin/dtrace/tests/common/safety/Makefile  Wed Aug 10 
02:44:46 2016(r303899)
+++ head/cddl/usr.sbin/dtrace/tests/common/safety/Makefile  Wed Aug 10 
03:10:34 2016(r303900)
@@ -53,4 +53,6 @@ CFILES= \
 
 
 
+TEST_METADATA.t_dtrace_contrib+=   required_memory="4g"
+
 .include "../../dtrace.test.mk"

Modified: head/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh
==
--- head/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh   Wed Aug 10 
02:44:46 2016(r303899)
+++ head/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh   Wed Aug 10 
03:10:34 2016(r303900)
@@ -34,15 +34,28 @@ genmakefile()
 
 # One-off variable definitions.
 local special
-if [ "$basedir" = proc ]; then
+case "$basedir" in
+proc)
 special="
 LIBADD.tst.sigwait.exe+= rt
 "
-elif [ "$basedir" = uctf ]; then
+;;
+raise)
+   special="
+TEST_METADATA.t_dtrace_contrib+=   required_memory=\"4g\"
+"
+;;
+safety)
+   special="
+TEST_METADATA.t_dtrace_contrib+=   required_memory=\"4g\"
+"
+;;
+uctf)
 special="
 WITH_CTF=YES
 "
-fi
+;;
+esac
 
 local makefile=$(mktemp)
 cat <<__EOF__ > $makefile
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303890 - in head/sys: contrib/ncsw/user/env contrib/octeon-sdk dev/auxio dev/bktr dev/e1000 dev/ixgb dev/ixgbe dev/ixl dev/netmap dev/pci dev/sound/sbus dev/tpm kern mips/nlm/dev/net

2016-08-09 Thread Bruce Evans

On Tue, 9 Aug 2016, [UTF-8] Jean-S??bastien P??dron wrote:


Log:
 Consistently use `device_t`

 Several files use the internal name of `struct device` instead of
 `device_t` which is part of the public API. This patch changes all
 `struct device *` to `device_t`.


device_t is properly opque, yet it still causes namespace problems and
is harder to use, especially in userland where it doesn't exist.

Headers now have namespace pollution/dependencies on  where
they carefully used 'struct device' before.

Many kernel .c files probably depend on magic ordering to compile now.
Alphabetical ordering mostly works accidentally since b < [c-z].

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

Re: svn commit: r303895 - head/sys/sys

2016-08-09 Thread Ngie Cooper
On Tue, Aug 9, 2016 at 4:45 PM, Ngie Cooper  wrote:

..

> This is the second time this has happened in the last few months (last
> time was per mmacy's request IIRC for some linuxkpi stuff). Seems like
> this warrants a comment at least.

I just saw the culprit... yeah... same thing as before. Some extra
care needs to be used when dealing with this in/out of _KERNEL
space... especially because libkvm and a handful of other tools
violate the _KERNEL vs !_KERNEL boundary for "reasons".
Thanks,
-Ngie
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303895 - head/sys/sys

2016-08-09 Thread Ngie Cooper
On Tue, Aug 9, 2016 at 2:45 PM, Jean-Sébastien Pédron
 wrote:
> Author: dumbbell
> Date: Tue Aug  9 21:45:47 2016
> New Revision: 303895
> URL: https://svnweb.freebsd.org/changeset/base/303895
>
> Log:
>   sys/pcpu.h: Revert change introduced in r303890
>
>   `device_t` is not defined outside the kernel but this header is used by
>   eg. libkvm or vmstat(8). Thus, r303890 broke the build.
>
>   So let's restore `struct device` here until a longer term solution is
>   found.
>
>   Reported by:  Michael Butler , Jenkins
>   MFC after:3 days
>   MFC with: r303890

This is the second time this has happened in the last few months (last
time was per mmacy's request IIRC for some linuxkpi stuff). Seems like
this warrants a comment at least.
Thanks,
-Ngie
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

svn commit: r303897 - head/release

2016-08-09 Thread Glen Barber
Author: gjb
Date: Tue Aug  9 22:48:46 2016
New Revision: 303897
URL: https://svnweb.freebsd.org/changeset/base/303897

Log:
  Pass overrides to make(1) when building ports for arm/armv6
  targets, similar to what is done for the run-autotools-fixup
  override for non-arm targets.
  
  MFC after:3 days
  Tested on:12-CURRENT building 10-STABLE
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/release.sh

Modified: head/release/release.sh
==
--- head/release/release.sh Tue Aug  9 22:10:40 2016(r303896)
+++ head/release/release.sh Tue Aug  9 22:48:46 2016(r303897)
@@ -287,9 +287,15 @@ extra_chroot_setup() {
fi
 
if [ ! -z "${EMBEDDEDPORTS}" ]; then
+   _OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U)
+   REVISION=$(chroot ${CHROOTDIR} make -C /usr/src/release -V 
REVISION)
+   BRANCH=$(chroot ${CHROOTDIR} make -C /usr/src/release -V BRANCH)
+   PBUILD_FLAGS="OSVERSION=${_OSVERSION} BATCH=yes"
+   PBUILD_FLAGS="${PBUILD_FLAGS} UNAME_r=${UNAME_r}"
+   PBUILD_FLAGS="${PBUILD_FLAGS} OSREL=${REVISION}"
for _PORT in ${EMBEDDEDPORTS}; do
eval chroot ${CHROOTDIR} make -C /usr/ports/${_PORT} \
-   BATCH=1 FORCE_PKG_REGISTER=1 install clean 
distclean
+   FORCE_PKG_REGISTER=1 ${PBUILD_FLAGS} install 
clean distclean
done
fi
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303896 - head/lib/libc/sys

2016-08-09 Thread John Baldwin
Author: jhb
Date: Tue Aug  9 22:10:40 2016
New Revision: 303896
URL: https://svnweb.freebsd.org/changeset/base/303896

Log:
  Remove obsolete manpage that is not currently installed.

Deleted:
  head/lib/libc/sys/kse.2
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303895 - head/sys/sys

2016-08-09 Thread Jean-Sébastien Pédron
Author: dumbbell
Date: Tue Aug  9 21:45:47 2016
New Revision: 303895
URL: https://svnweb.freebsd.org/changeset/base/303895

Log:
  sys/pcpu.h: Revert change introduced in r303890
  
  `device_t` is not defined outside the kernel but this header is used by
  eg. libkvm or vmstat(8). Thus, r303890 broke the build.
  
  So let's restore `struct device` here until a longer term solution is
  found.
  
  Reported by:  Michael Butler , Jenkins
  MFC after:3 days
  MFC with: r303890

Modified:
  head/sys/sys/pcpu.h

Modified: head/sys/sys/pcpu.h
==
--- head/sys/sys/pcpu.h Tue Aug  9 19:46:05 2016(r303894)
+++ head/sys/sys/pcpu.h Tue Aug  9 21:45:47 2016(r303895)
@@ -160,7 +160,7 @@ struct pcpu {
struct lock_list_entry *pc_spinlocks;
struct vmmeter  pc_cnt; /* VM stats counters */
longpc_cp_time[CPUSTATES];  /* statclock ticks */
-   device_tpc_device;
+   struct device   *pc_device;
void*pc_netisr; /* netisr SWI cookie */
int pc_unused1; /* unused field */
int pc_domain;  /* Memory domain. */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303887 - head/tools/tools/dmardump

2016-08-09 Thread John Baldwin
On Tuesday, August 09, 2016 07:06:05 PM John Baldwin wrote:
> Author: jhb
> Date: Tue Aug  9 19:06:05 2016
> New Revision: 303887
> URL: https://svnweb.freebsd.org/changeset/base/303887
> 
> Log:
>   Add a dmardump utility to dump the VT-d context tables.
>   
>   This tool parses the ACPI DMAR table looking for DMA remapping devices.
>   For each device it walks the root table and any context tables
>   referenced to display mapping info for PCI devices.
>   
>   Note that acpidump -t already parses the info in the ACPI DMAR tables
>   directly.  This tool examines some of the data structures the DMAR
>   remapping engines use to translate DMA requests.
>   
>   Reviewed by:kib, grehan
>   MFC after:  1 month
>   Sponsored by:   Chelsio Communications
>   Differential Revision:  https://reviews.freebsd.org/D7444

I should have mentioned that this tool only supports "normal" context
entry tables.  It does not (yet) support extended context entry
tables.  However, neither bhyve nor ACPI_DMAR create extended context
entry tables.

Sample output from a machine where ppt0 is passed through to a bhyve
guest:

# ./dmardump
drhd @ 0xfbffc000 (version 1.0) PCI segment 0:
root table @ 0x0x13823f000
PCI bus 0:
{ 0,0 } (hostb0) TR SLPT 0x139e41000 domain 1
{ 1,0 } (pcib2) TR SLPT 0x139e41000 domain 1
{ 2,0 } (pcib3) TR SLPT 0x139e41000 domain 1
{ 3,0 } (pcib4) TR SLPT 0x139e41000 domain 1
{ 3,2 } (pcib5) TR SLPT 0x139e41000 domain 1
{ 3,3 } (pcib6) TR SLPT 0x139e41000 domain 1
{ 4,0 } TR SLPT 0x139e41000 domain 1
{ 4,1 } TR SLPT 0x139e41000 domain 1
{ 4,2 } TR SLPT 0x139e41000 domain 1
{ 4,3 } TR SLPT 0x139e41000 domain 1
{ 4,4 } TR SLPT 0x139e41000 domain 1
{ 4,5 } TR SLPT 0x139e41000 domain 1
{ 4,6 } TR SLPT 0x139e41000 domain 1
{ 4,7 } TR SLPT 0x139e41000 domain 1
{ 5,0 } TR SLPT 0x139e41000 domain 1
{ 5,1 } TR SLPT 0x139e41000 domain 1
{ 5,2 } TR SLPT 0x139e41000 domain 1
{ 5,4 } (ioapic0) TR SLPT 0x139e41000 domain 1
{ 17,0 } TR SLPT 0x139e41000 domain 1
{ 17,4 } (ahci0) TR SLPT 0x139e41000 domain 1
{ 20,0 } (xhci0) TR SLPT 0x139e41000 domain 1
{ 22,0 } TR SLPT 0x139e41000 domain 1
{ 22,1 } TR SLPT 0x139e41000 domain 1
{ 26,0 } (ehci0) TR SLPT 0x139e41000 domain 1
{ 28,0 } (pcib7) TR SLPT 0x139e41000 domain 1
{ 28,6 } (pcib8) TR SLPT 0x139e41000 domain 1
{ 29,0 } (ehci1) TR SLPT 0x139e41000 domain 1
{ 31,0 } (isab0) TR SLPT 0x139e41000 domain 1
{ 31,2 } (ahci1) TR SLPT 0x139e41000 domain 1
{ 31,3 } TR SLPT 0x139e41000 domain 1
{ 31,6 } TR SLPT 0x139e41000 domain 1
PCI bus 3:
{ 0,0 } (t5iov0) TR SLPT 0x139e41000 domain 1
{ 0,1 } (t5iov1) TR SLPT 0x139e41000 domain 1
{ 0,2 } (t5iov2) TR SLPT 0x139e41000 domain 1
{ 0,3 } (t5iov3) TR SLPT 0x139e41000 domain 1
{ 0,4 } (t5nex0) TR SLPT 0x139e41000 domain 1
{ 0,5 } TR SLPT 0x139e41000 domain 1
{ 0,6 } TR SLPT 0x139e41000 domain 1
{ 0,8 } (ppt0) TR SLPT 0x1a157b000 domain 2
PCI bus 5:
{ 0,0 } (igb0) TR SLPT 0x139e41000 domain 1
{ 0,1 } (igb1) TR SLPT 0x139e41000 domain 1
PCI bus 7:
{ 0,0 } (pcib9) TR SLPT 0x139e41000 domain 1
PCI bus 8:
{ 0,0 } (vgapci0) TR SLPT 0x139e41000 domain 1

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


svn commit: r303894 - head/usr.sbin/ancontrol

2016-08-09 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Aug  9 19:46:05 2016
New Revision: 303894
URL: https://svnweb.freebsd.org/changeset/base/303894

Log:
  ancontrol(8): replace comma with semicolon when pertinent.
  
  Uses of commas instead of a semicolons can easily go undetected. The comma
  can serve as a statement separator but this shouldn't be abused when
  statements are meant to be standalone.
  
  Detected with devel/coccinelle following a hint from DragonFlyBSD.
  
  MFC after:1 month

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

Modified: head/usr.sbin/ancontrol/ancontrol.c
==
--- head/usr.sbin/ancontrol/ancontrol.c Tue Aug  9 19:44:33 2016
(r303893)
+++ head/usr.sbin/ancontrol/ancontrol.c Tue Aug  9 19:46:05 2016
(r303894)
@@ -573,9 +573,9 @@ an_dumpstats(const char *iface)
printf("Management frames transmitted:\t\t\t[ %u ]\n",
stats->an_tx_mgmt_pkts);
printf("Refresh frames received:\t\t\t[ %u ]\n",
-   stats->an_rx_refresh_pkts),
+   stats->an_rx_refresh_pkts);
printf("Refresh frames transmitted:\t\t\t[ %u ]\n",
-   stats->an_tx_refresh_pkts),
+   stats->an_tx_refresh_pkts);
printf("Poll frames received:\t\t\t\t[ %u ]\n",
stats->an_rx_poll_pkts);
printf("Poll frames transmitted:\t\t\t[ %u ]\n",
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303893 - head/lib/libpcap

2016-08-09 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Aug  9 19:44:33 2016
New Revision: 303893
URL: https://svnweb.freebsd.org/changeset/base/303893

Log:
  libpcap: replace comma with semicolon when pertinent.
  
  Uses of commas instead of a semicolons can easily go undetected. The comma
  can serve as a statement separator but this shouldn't be abused when
  statements are meant to be standalone.
  
  Detected with devel/coccinelle following a hint from DragonFlyBSD.
  
  MFC after:1 month

Modified:
  head/lib/libpcap/pcap-netmap.c

Modified: head/lib/libpcap/pcap-netmap.c
==
--- head/lib/libpcap/pcap-netmap.c  Tue Aug  9 19:42:20 2016
(r303892)
+++ head/lib/libpcap/pcap-netmap.c  Tue Aug  9 19:44:33 2016
(r303893)
@@ -240,7 +240,7 @@ pcap_netmap_activate(pcap_t *p)
p->linktype = DLT_EN10MB;
p->selectable_fd = p->fd;
p->read_op = pcap_netmap_dispatch;
-   p->inject_op = pcap_netmap_inject,
+   p->inject_op = pcap_netmap_inject;
p->setfilter_op = install_bpf_program;
p->setdirection_op = NULL;
p->set_datalink_op = NULL;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303892 - in head/sys: arm/xscale/ixp425 boot/i386/zfsboot cam/ata cam/scsi net80211 sparc64/pci x86/cpufreq

2016-08-09 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Aug  9 19:42:20 2016
New Revision: 303892
URL: https://svnweb.freebsd.org/changeset/base/303892

Log:
  sys: replace comma with semicolon when pertinent.
  
  Uses of commas instead of a semicolons can easily go undetected. The comma
  can serve as a statement separator but this shouldn't be abused when
  statements are meant to be standalone.
  
  Detected with devel/coccinelle following a hint from DragonFlyBSD.
  
  MFC after:1 month

Modified:
  head/sys/arm/xscale/ixp425/avila_ata.c
  head/sys/boot/i386/zfsboot/zfsboot.c
  head/sys/cam/ata/ata_all.c
  head/sys/cam/scsi/scsi_all.c
  head/sys/cam/scsi/scsi_da.c
  head/sys/net80211/ieee80211_crypto_wep.c
  head/sys/sparc64/pci/fire.c
  head/sys/x86/cpufreq/powernow.c

Modified: head/sys/arm/xscale/ixp425/avila_ata.c
==
--- head/sys/arm/xscale/ixp425/avila_ata.c  Tue Aug  9 19:41:46 2016
(r303891)
+++ head/sys/arm/xscale/ixp425/avila_ata.c  Tue Aug  9 19:42:20 2016
(r303892)
@@ -202,17 +202,17 @@ ata_avila_attach(device_t dev)
 */
sc->sc_expbus_tag.bs_privdata = sc; /* NB: backpointer */
/* read single */
-   sc->sc_expbus_tag.bs_r_1= ata_bs_r_1,
-   sc->sc_expbus_tag.bs_r_2= ata_bs_r_2,
+   sc->sc_expbus_tag.bs_r_1= ata_bs_r_1;
+   sc->sc_expbus_tag.bs_r_2= ata_bs_r_2;
/* read multiple */
-   sc->sc_expbus_tag.bs_rm_2   = ata_bs_rm_2,
-   sc->sc_expbus_tag.bs_rm_2_s = ata_bs_rm_2_s,
+   sc->sc_expbus_tag.bs_rm_2   = ata_bs_rm_2;
+   sc->sc_expbus_tag.bs_rm_2_s = ata_bs_rm_2_s;
/* write (single) */
-   sc->sc_expbus_tag.bs_w_1= ata_bs_w_1,
-   sc->sc_expbus_tag.bs_w_2= ata_bs_w_2,
+   sc->sc_expbus_tag.bs_w_1= ata_bs_w_1;
+   sc->sc_expbus_tag.bs_w_2= ata_bs_w_2;
/* write multiple */
-   sc->sc_expbus_tag.bs_wm_2   = ata_bs_wm_2,
-   sc->sc_expbus_tag.bs_wm_2_s = ata_bs_wm_2_s,
+   sc->sc_expbus_tag.bs_wm_2   = ata_bs_wm_2;
+   sc->sc_expbus_tag.bs_wm_2_s = ata_bs_wm_2_s;
 
rman_set_bustag(>sc_ata, >sc_expbus_tag);
rman_set_bustag(>sc_alt_ata, >sc_expbus_tag);

Modified: head/sys/boot/i386/zfsboot/zfsboot.c
==
--- head/sys/boot/i386/zfsboot/zfsboot.cTue Aug  9 19:41:46 2016
(r303891)
+++ head/sys/boot/i386/zfsboot/zfsboot.cTue Aug  9 19:42:20 2016
(r303892)
@@ -576,7 +576,7 @@ main(void)
 bootinfo.bi_bios_dev = dsk->drive;
 
 bootdev = MAKEBOOTDEV(dev_maj[dsk->type],
- dsk->slice, dsk->unit, dsk->part),
+ dsk->slice, dsk->unit, dsk->part);
 
 /* Process configuration file */
 

Modified: head/sys/cam/ata/ata_all.c
==
--- head/sys/cam/ata/ata_all.c  Tue Aug  9 19:41:46 2016(r303891)
+++ head/sys/cam/ata/ata_all.c  Tue Aug  9 19:42:20 2016(r303892)
@@ -1075,7 +1075,7 @@ ata_zac_mgmt_in(struct ccb_ataio *ataio,
} else {
command_out = ATA_RECV_FPDMA_QUEUED;
sectors_out = ATA_RFPDMA_ZAC_MGMT_IN << 8;
-   auxiliary = (zm_action & 0xf) | (zone_flags << 8),
+   auxiliary = (zm_action & 0xf) | (zone_flags << 8);
ata_flags = CAM_ATAIO_FPDMA;
/*
 * For RECEIVE FPDMA QUEUED, the transfer length is

Modified: head/sys/cam/scsi/scsi_all.c
==
--- head/sys/cam/scsi/scsi_all.cTue Aug  9 19:41:46 2016
(r303891)
+++ head/sys/cam/scsi/scsi_all.cTue Aug  9 19:42:20 2016
(r303892)
@@ -8691,7 +8691,7 @@ scsi_read_attribute(struct ccb_scsiio *c
bzero(scsi_cmd, sizeof(*scsi_cmd));
 
scsi_cmd->opcode = READ_ATTRIBUTE;
-   scsi_cmd->service_action = service_action,
+   scsi_cmd->service_action = service_action;
scsi_ulto2b(element, scsi_cmd->element);
scsi_cmd->elem_type = elem_type;
scsi_cmd->logical_volume = logical_volume;

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Tue Aug  9 19:41:46 2016(r303891)
+++ head/sys/cam/scsi/scsi_da.c Tue Aug  9 19:42:20 2016(r303892)
@@ -5718,7 +5718,7 @@ scsi_ata_zac_mgmt_out(struct ccb_scsiio 
 
if (use_ncq == 0) {
command_out = ATA_ZAC_MANAGEMENT_OUT;
-   features_out = (zm_action & 0xf) | (zone_flags << 8),
+   features_out 

svn commit: r303891 - in head/sys/dev: aic7xxx ath/ath_hal/ar5212 ath/ath_hal/ar5416 bxe etherswitch/ip17x usb/controller

2016-08-09 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Aug  9 19:41:46 2016
New Revision: 303891
URL: https://svnweb.freebsd.org/changeset/base/303891

Log:
  sys/dev: replace comma with semicolon when pertinent.
  
  Uses of commas instead of a semicolons can easily go undetected. The comma
  can serve as a statement separator but this shouldn't be abused when
  statements are meant to be standalone.
  
  Detected with devel/coccinelle following a hint from DragonFlyBSD.
  
  MFC after:1 month

Modified:
  head/sys/dev/aic7xxx/aic7xxx_osm.c
  head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
  head/sys/dev/bxe/bxe.c
  head/sys/dev/etherswitch/ip17x/ip17x.c
  head/sys/dev/usb/controller/ehci_ixp4xx.c

Modified: head/sys/dev/aic7xxx/aic7xxx_osm.c
==
--- head/sys/dev/aic7xxx/aic7xxx_osm.c  Tue Aug  9 19:32:06 2016
(r303890)
+++ head/sys/dev/aic7xxx/aic7xxx_osm.c  Tue Aug  9 19:41:46 2016
(r303891)
@@ -130,7 +130,7 @@ aic7770_map_registers(struct ahc_softc *
return ENOMEM;
}
ahc->platform_data->regs_res_type = SYS_RES_IOPORT;
-   ahc->platform_data->regs_res_id = rid,
+   ahc->platform_data->regs_res_id = rid;
ahc->platform_data->regs = regs;
ahc->tag = rman_get_bustag(regs);
ahc->bsh = rman_get_bushandle(regs);

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
==
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Tue Aug  9 19:32:06 
2016(r303890)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Tue Aug  9 19:41:46 
2016(r303891)
@@ -270,8 +270,8 @@ ar5212InitState(struct ath_hal_5212 *ahp
ahp->ah_acktimeout = (u_int) -1;
ahp->ah_ctstimeout = (u_int) -1;
ahp->ah_sifstime = (u_int) -1;
-   ahp->ah_txTrigLev = INIT_TX_FIFO_THRESHOLD,
-   ahp->ah_maxTxTrigLev = MAX_TX_FIFO_THRESHOLD,
+   ahp->ah_txTrigLev = INIT_TX_FIFO_THRESHOLD;
+   ahp->ah_maxTxTrigLev = MAX_TX_FIFO_THRESHOLD;
 
OS_MEMCPY(>ah_bssidmask, defbssidmask, IEEE80211_ADDR_LEN);
 #undef N

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Tue Aug  9 19:32:06 
2016(r303890)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Tue Aug  9 19:41:46 
2016(r303891)
@@ -103,8 +103,8 @@ ar5416InitState(struct ath_hal_5416 *ahp
ah->ah_configPCIE   = ar5416ConfigPCIE;
ah->ah_disablePCIE  = ar5416DisablePCIE;
ah->ah_perCalibration   = ar5416PerCalibration;
-   ah->ah_perCalibrationN  = ar5416PerCalibrationN,
-   ah->ah_resetCalValid= ar5416ResetCalValid,
+   ah->ah_perCalibrationN  = ar5416PerCalibrationN;
+   ah->ah_resetCalValid= ar5416ResetCalValid;
ah->ah_setTxPowerLimit  = ar5416SetTxPowerLimit;
ah->ah_setTxPower   = ar5416SetTransmitPower;
ah->ah_setBoardValues   = ar5416SetBoardValues;

Modified: head/sys/dev/bxe/bxe.c
==
--- head/sys/dev/bxe/bxe.c  Tue Aug  9 19:32:06 2016(r303890)
+++ head/sys/dev/bxe/bxe.c  Tue Aug  9 19:41:46 2016(r303891)
@@ -13332,7 +13332,7 @@ bxe_get_shmem_info(struct bxe_softc *sc)
 
 /* get the port feature config */
 sc->port.config =
-SHMEM_RD(sc, dev_info.port_feature_config[port].config),
+SHMEM_RD(sc, dev_info.port_feature_config[port].config);
 
 /* get the link params */
 sc->link_params.speed_cap_mask[0] =

Modified: head/sys/dev/etherswitch/ip17x/ip17x.c
==
--- head/sys/dev/etherswitch/ip17x/ip17x.c  Tue Aug  9 19:32:06 2016
(r303890)
+++ head/sys/dev/etherswitch/ip17x/ip17x.c  Tue Aug  9 19:41:46 2016
(r303891)
@@ -84,7 +84,7 @@ ip17x_probe(device_t dev)
phy_id1 = MDIO_READREG(device_get_parent(dev), 0, MII_PHYIDR1);
phy_id2 = MDIO_READREG(device_get_parent(dev), 0, MII_PHYIDR2);
 
-   oui = MII_OUI(phy_id1, phy_id2),
+   oui = MII_OUI(phy_id1, phy_id2);
model = MII_MODEL(phy_id2);
/* We only care about IC+ devices. */
if (oui != IP17X_OUI) {

Modified: head/sys/dev/usb/controller/ehci_ixp4xx.c
==
--- head/sys/dev/usb/controller/ehci_ixp4xx.c   Tue Aug  9 19:32:06 2016
(r303890)
+++ head/sys/dev/usb/controller/ehci_ixp4xx.c   Tue Aug  9 19:41:46 2016
(r303891)
@@ -147,13 +147,13 @@ ehci_ixp_attach(device_t self)
isc->iot = rman_get_bustag(sc->sc_io_res);
isc->tag.bs_privdata = isc->iot;

svn commit: r303890 - in head/sys: contrib/ncsw/user/env contrib/octeon-sdk dev/auxio dev/bktr dev/e1000 dev/ixgb dev/ixgbe dev/ixl dev/netmap dev/pci dev/sound/sbus dev/tpm kern mips/nlm/dev/net m...

2016-08-09 Thread Jean-Sébastien Pédron
Author: dumbbell
Date: Tue Aug  9 19:32:06 2016
New Revision: 303890
URL: https://svnweb.freebsd.org/changeset/base/303890

Log:
  Consistently use `device_t`
  
  Several files use the internal name of `struct device` instead of
  `device_t` which is part of the public API. This patch changes all
  `struct device *` to `device_t`.
  
  The remaining occurrences of `struct device` are those referring to the
  Linux or OpenBSD version of the structure, or the code is not built on
  FreeBSD and it's unclear what to do.
  
  Submitted by: Matthew Macy  (previous version)
  Approved by:  emaste, jhibbits, sbruno
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D7447

Modified:
  head/sys/contrib/ncsw/user/env/xx.c
  head/sys/contrib/octeon-sdk/cvmx-twsi.c
  head/sys/dev/auxio/auxio.c
  head/sys/dev/bktr/bktr_os.c
  head/sys/dev/bktr/bktr_reg.h
  head/sys/dev/e1000/e1000_osdep.h
  head/sys/dev/e1000/if_em.h
  head/sys/dev/e1000/if_igb.h
  head/sys/dev/e1000/if_lem.h
  head/sys/dev/ixgb/if_ixgb.h
  head/sys/dev/ixgb/if_ixgb_osdep.h
  head/sys/dev/ixgbe/ixgbe.h
  head/sys/dev/ixl/i40e_osdep.h
  head/sys/dev/ixl/ixl.h
  head/sys/dev/ixl/ixl_pf.h
  head/sys/dev/ixl/ixlv.h
  head/sys/dev/netmap/netmap_mem2.c
  head/sys/dev/pci/pcivar.h
  head/sys/dev/sound/sbus/cs4231.c
  head/sys/dev/tpm/tpm.c
  head/sys/kern/subr_bus.c
  head/sys/mips/nlm/dev/net/xlpge.c
  head/sys/mips/rmi/dev/nlge/if_nlge.c
  head/sys/powerpc/include/bus_dma.h
  head/sys/powerpc/powerpc/busdma_machdep.c
  head/sys/sparc64/fhc/clkbrd.c
  head/sys/sys/pcpu.h
  head/sys/sys/rman.h

Modified: head/sys/contrib/ncsw/user/env/xx.c
==
--- head/sys/contrib/ncsw/user/env/xx.c Tue Aug  9 19:20:53 2016
(r303889)
+++ head/sys/contrib/ncsw/user/env/xx.c Tue Aug  9 19:32:06 2016
(r303890)
@@ -406,7 +406,7 @@ XX_DeallocIntr(int irq)
 t_Error
 XX_SetIntr(int irq, t_Isr *f_Isr, t_Handle handle)
 {
-   struct device *dev;
+   device_t dev;
struct resource *r;
unsigned int flags;
int err;
@@ -455,7 +455,7 @@ finish:
 t_Error
 XX_FreeIntr(int irq)
 {
-   struct device *dev;
+   device_t dev;
struct resource *r;
 
r = (struct resource *)irq;

Modified: head/sys/contrib/octeon-sdk/cvmx-twsi.c
==
--- head/sys/contrib/octeon-sdk/cvmx-twsi.c Tue Aug  9 19:20:53 2016
(r303889)
+++ head/sys/contrib/octeon-sdk/cvmx-twsi.c Tue Aug  9 19:32:06 2016
(r303890)
@@ -85,7 +85,7 @@ static struct i2c_adapter *__cvmx_twsix_
resource_size_t twsi_phys;
void __iomem *twsi_base;
resource_size_t regsize;
-   struct device *dev;
+   device_t dev;
int broken_irq_mode;
};
struct i2c_adapter *adapter;

Modified: head/sys/dev/auxio/auxio.c
==
--- head/sys/dev/auxio/auxio.c  Tue Aug  9 19:20:53 2016(r303889)
+++ head/sys/dev/auxio/auxio.c  Tue Aug  9 19:32:06 2016(r303890)
@@ -98,7 +98,7 @@ __FBSDID("$FreeBSD$");
 #define AUXIO_PCIO_NREG5
 
 struct auxio_softc {
-   struct device   *sc_dev;
+   device_tsc_dev;
 
int sc_nauxio;
struct resource *sc_res[AUXIO_PCIO_NREG];

Modified: head/sys/dev/bktr/bktr_os.c
==
--- head/sys/dev/bktr/bktr_os.c Tue Aug  9 19:20:53 2016(r303889)
+++ head/sys/dev/bktr/bktr_os.c Tue Aug  9 19:32:06 2016(r303890)
@@ -889,10 +889,11 @@ vm_offset_t vm_page_alloc_contig(vm_offs
 
 #if defined(__OpenBSD__)
 static int  bktr_probe(struct device *, void *, void *);
+static void bktr_attach(struct device *, struct device *, void *);
 #else
-static int  bktr_probe(struct device *, struct cfdata *, void *);
+static int  bktr_probe(device_t, struct cfdata *, void *);
+static void bktr_attach(device_t, device_t, void *);
 #endif
-static void bktr_attach(struct device *, struct device *, void *);
 
 struct cfattach bktr_ca = {
 sizeof(struct bktr_softc), bktr_probe, bktr_attach
@@ -908,10 +909,11 @@ struct cfdriver bktr_cd = {
 
 int
 bktr_probe(parent, match, aux)
-   struct device *parent;
 #if defined(__OpenBSD__)
+struct device *parent;
 void *match;
 #else
+device_t parent;
 struct cfdata *match;
 #endif
 void *aux;
@@ -933,7 +935,15 @@ bktr_probe(parent, match, aux)
  * the attach routine.
  */
 static void
-bktr_attach(struct device *parent, struct device *self, void *aux)
+bktr_attach(parent, self, aux)
+#if defined(__OpenBSD__)
+   struct device *parent;
+   struct device *self;
+#else
+   device_t parent;
+   device_t 

svn commit: r303888 - stable/11/usr.bin/grep/regex

2016-08-09 Thread Dimitry Andric
Author: dim
Date: Tue Aug  9 19:20:53 2016
New Revision: 303888
URL: https://svnweb.freebsd.org/changeset/base/303888

Log:
  MFC r303676:
  
  Fix a segfault in bsdgrep when parsing the invalid extended regexps "?"
  or "+" (these are invalid, because there is no preceding operand).
  
  When bsdgrep attempts to emulate GNU grep in discarding and ignoring the
  invalid ? or + operators, some later logic in tre_compile_fast() goes
  beyond the end of the buffer, leading to a crash.
  
  Fix this by bailing out, and reporting a bad pattern instead.
  
  Approved by:  re (gjb, kib)
  Reported by:  Steve Kargl

Modified:
  stable/11/usr.bin/grep/regex/tre-fastmatch.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/grep/regex/tre-fastmatch.c
==
--- stable/11/usr.bin/grep/regex/tre-fastmatch.cTue Aug  9 19:06:05 
2016(r303887)
+++ stable/11/usr.bin/grep/regex/tre-fastmatch.cTue Aug  9 19:20:53 
2016(r303888)
@@ -621,7 +621,7 @@ tre_compile_fast(fastmatch_t *fg, const 
  case TRE_CHAR('+'):
  case TRE_CHAR('?'):
if ((cflags & REG_EXTENDED) && (i == 0))
- continue;
+ goto badpat;
else if ((cflags & REG_EXTENDED) ^ !escaped)
  STORE_CHAR;
else
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303889 - head/lib/libc/rpc

2016-08-09 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Aug  9 19:20:53 2016
New Revision: 303889
URL: https://svnweb.freebsd.org/changeset/base/303889

Log:
  libc/rpc: replace comma with semicolon when pertinent.
  
  Uses of commas instead of a semicolons can easily go undetected. The comma
  can serve as a statement separator but this shouldn't be abused when
  statements are meant to be standalone.
  
  Detected with devel/coccinelle following a hint from DragonFlyBSD.
  
  MFC after:1 month

Modified:
  head/lib/libc/rpc/svc_vc.c

Modified: head/lib/libc/rpc/svc_vc.c
==
--- head/lib/libc/rpc/svc_vc.c  Tue Aug  9 19:20:53 2016(r303888)
+++ head/lib/libc/rpc/svc_vc.c  Tue Aug  9 19:20:53 2016(r303889)
@@ -700,7 +700,7 @@ svc_vc_rendezvous_ops(SVCXPRT *xprt)
ops.xp_reply =
(bool_t (*)(SVCXPRT *, struct rpc_msg *))abort;
ops.xp_freeargs =
-   (bool_t (*)(SVCXPRT *, xdrproc_t, void *))abort,
+   (bool_t (*)(SVCXPRT *, xdrproc_t, void *))abort;
ops.xp_destroy = svc_vc_destroy;
ops2.xp_control = svc_vc_rendezvous_control;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303887 - head/tools/tools/dmardump

2016-08-09 Thread John Baldwin
Author: jhb
Date: Tue Aug  9 19:06:05 2016
New Revision: 303887
URL: https://svnweb.freebsd.org/changeset/base/303887

Log:
  Add a dmardump utility to dump the VT-d context tables.
  
  This tool parses the ACPI DMAR table looking for DMA remapping devices.
  For each device it walks the root table and any context tables
  referenced to display mapping info for PCI devices.
  
  Note that acpidump -t already parses the info in the ACPI DMAR tables
  directly.  This tool examines some of the data structures the DMAR
  remapping engines use to translate DMA requests.
  
  Reviewed by:  kib, grehan
  MFC after:1 month
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D7444

Added:
  head/tools/tools/dmardump/
  head/tools/tools/dmardump/Makefile   (contents, props changed)
  head/tools/tools/dmardump/dmardump.c   (contents, props changed)

Added: head/tools/tools/dmardump/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/tools/dmardump/Makefile  Tue Aug  9 19:06:05 2016
(r303887)
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+PROG=  dmardump
+SRCS=  dmardump.c
+MAN=
+
+# Pull in bits from acpidump
+ACPIDUMP=${.CURDIR}/../../../usr.sbin/acpi/acpidump
+.PATH: ${ACPIDUMP}
+SRCS+= acpi_user.c acpi.c
+CFLAGS+= -I${ACPIDUMP}
+
+CFLAGS+= -I${.CURDIR}/../../../sys
+
+.include 

Added: head/tools/tools/dmardump/dmardump.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/tools/dmardump/dmardump.cTue Aug  9 19:06:05 2016
(r303887)
@@ -0,0 +1,292 @@
+/*-
+ * Copyright (c) 2016 Chelsio Communications, Inc.
+ * All rights reserved.
+ * Written by: John Baldwin 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "acpidump.h"
+
+int tflag;
+int vflag;
+
+static uint32_t
+read_4(char *regs, size_t offset)
+{
+   return *(uint32_t *)(regs + offset);
+}
+
+static uint64_t
+read_8(char *regs, size_t offset)
+{
+   return *(uint64_t *)(regs + offset);
+}
+
+static struct pci_conf *
+pci_find_conf(int segment, int bus, int slot, int func)
+{
+   static int pcifd = -1;
+   static struct pci_conf conf;
+   struct pci_conf_io pc;
+   struct pci_match_conf patterns[1];
+
+   if (pcifd == -1) {
+   pcifd = open("/dev/pci", O_RDONLY);
+   if (pcifd < 0)
+   err(1, "Failed to open /dev/pci");
+   }
+
+   bzero(, sizeof(pc));
+   pc.match_buf_len = sizeof(conf);
+   pc.matches = 
+   bzero(, sizeof(patterns));
+   patterns[0].pc_sel.pc_domain = segment;
+   patterns[0].pc_sel.pc_bus = bus;
+   patterns[0].pc_sel.pc_dev = slot;
+   patterns[0].pc_sel.pc_func = func;
+   patterns[0].flags = PCI_GETCONF_MATCH_DOMAIN |
+   PCI_GETCONF_MATCH_BUS | PCI_GETCONF_MATCH_DEV |
+   PCI_GETCONF_MATCH_FUNC;
+   pc.num_patterns = 1;
+   pc.pat_buf_len = sizeof(patterns);
+   pc.patterns = patterns;
+   if (ioctl(pcifd, PCIOCGETCONF, ) == -1)
+   err(1, "ioctl(PCIOCGETCONF)");
+
+   if (pc.status != PCI_GETCONF_LAST_DEVICE ||
+   pc.num_matches == 0)
+   return (NULL);
+
+   return ();
+}
+
+static void
+dump_context_table(int segment, int bus, uint64_t base_addr)
+{
+   struct dmar_ctx_entry *ctx;
+   struct pci_conf *conf;
+   bool printed;
+   

svn commit: r303884 - stable/11/sys/kern

2016-08-09 Thread John Baldwin
Author: jhb
Date: Tue Aug  9 18:56:29 2016
New Revision: 303884
URL: https://svnweb.freebsd.org/changeset/base/303884

Log:
  MFC 303503: Don't treat NOCPU as a valid CPU to CPU_ISSET.
  
  If a thread is created bound to a cpuset it might already be bound before
  its very first timeslice, and td_lastcpu will be NOCPU in that case.
  
  Approved by:  re (gjb)

Modified:
  stable/11/sys/kern/sched_4bsd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/sched_4bsd.c
==
--- stable/11/sys/kern/sched_4bsd.c Tue Aug  9 18:53:57 2016
(r303883)
+++ stable/11/sys/kern/sched_4bsd.c Tue Aug  9 18:56:29 2016
(r303884)
@@ -1241,7 +1241,7 @@ sched_pickcpu(struct thread *td)
 
mtx_assert(_lock, MA_OWNED);
 
-   if (THREAD_CAN_SCHED(td, td->td_lastcpu))
+   if (td->td_lastcpu != NOCPU && THREAD_CAN_SCHED(td, td->td_lastcpu))
best = td->td_lastcpu;
else
best = NOCPU;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303886 - head/sys/x86/iommu

2016-08-09 Thread John Baldwin
Author: jhb
Date: Tue Aug  9 19:02:14 2016
New Revision: 303886
URL: https://svnweb.freebsd.org/changeset/base/303886

Log:
  Add additional constants.
  
  - Add constants for the fields in the root-entry table address register,
namely the root type type (RTT) and root table address (RTA) mask.
  - Add macros for the bitmask of the domain ID field in the second word
of context table entries as well as a helper macro (DMAR_CTX2_GET_DID)
to extract the domain ID from a context table entry.
  
  Reviewed by:  kib
  MFC after:1 month
  Sponsored by: Chelsio Communications

Modified:
  head/sys/x86/iommu/intel_reg.h

Modified: head/sys/x86/iommu/intel_reg.h
==
--- head/sys/x86/iommu/intel_reg.h  Tue Aug  9 18:59:16 2016
(r303885)
+++ head/sys/x86/iommu/intel_reg.h  Tue Aug  9 19:02:14 2016
(r303886)
@@ -67,7 +67,9 @@ typedef   struct dmar_ctx_entry {
 #defineDMAR_CTX2_AW_4LVL   2   /* 4-level page tables 
*/
 #defineDMAR_CTX2_AW_5LVL   3   /* 5-level page tables 
*/
 #defineDMAR_CTX2_AW_6LVL   4   /* 6-level page tables 
*/
+#defineDMAR_CTX2_DID_MASK  0x0
 #defineDMAR_CTX2_DID(x)((x) << 8)  /* Domain Identifier */
+#defineDMAR_CTX2_GET_DID(ctx2) (((ctx2) & DMAR_CTX2_DID_MASK) >> 8)
 
 typedef struct dmar_pte {
uint64_t pte;
@@ -214,6 +216,8 @@ typedef struct dmar_irte {
 
 /* Root-Entry Table Address register */
 #defineDMAR_RTADDR_REG 0x20
+#defineDMAR_RTADDR_RTT (1 << 11)   /* Root Table Type */
+#defineDMAR_RTADDR_RTA_MASK0xf000
 
 /* Context Command register */
 #defineDMAR_CCMD_REG   0x28
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303885 - in stable: 10/sys/kern 9/sys/kern

2016-08-09 Thread John Baldwin
Author: jhb
Date: Tue Aug  9 18:59:16 2016
New Revision: 303885
URL: https://svnweb.freebsd.org/changeset/base/303885

Log:
  MFC 303503: Don't treat NOCPU as a valid CPU to CPU_ISSET.
  
  If a thread is created bound to a cpuset it might already be bound before
  its very first timeslice, and td_lastcpu will be NOCPU in that case.

Modified:
  stable/9/sys/kern/sched_4bsd.c
Directory Properties:
  stable/9/sys/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/sys/kern/sched_4bsd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/9/sys/kern/sched_4bsd.c
==
--- stable/9/sys/kern/sched_4bsd.c  Tue Aug  9 18:56:29 2016
(r303884)
+++ stable/9/sys/kern/sched_4bsd.c  Tue Aug  9 18:59:16 2016
(r303885)
@@ -1235,7 +1235,7 @@ sched_pickcpu(struct thread *td)
 
mtx_assert(_lock, MA_OWNED);
 
-   if (THREAD_CAN_SCHED(td, td->td_lastcpu))
+   if (td->td_lastcpu != NOCPU && THREAD_CAN_SCHED(td, td->td_lastcpu))
best = td->td_lastcpu;
else
best = NOCPU;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303885 - in stable: 10/sys/kern 9/sys/kern

2016-08-09 Thread John Baldwin
Author: jhb
Date: Tue Aug  9 18:59:16 2016
New Revision: 303885
URL: https://svnweb.freebsd.org/changeset/base/303885

Log:
  MFC 303503: Don't treat NOCPU as a valid CPU to CPU_ISSET.
  
  If a thread is created bound to a cpuset it might already be bound before
  its very first timeslice, and td_lastcpu will be NOCPU in that case.

Modified:
  stable/10/sys/kern/sched_4bsd.c
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/9/sys/kern/sched_4bsd.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/10/sys/kern/sched_4bsd.c
==
--- stable/10/sys/kern/sched_4bsd.c Tue Aug  9 18:56:29 2016
(r303884)
+++ stable/10/sys/kern/sched_4bsd.c Tue Aug  9 18:59:16 2016
(r303885)
@@ -1235,7 +1235,7 @@ sched_pickcpu(struct thread *td)
 
mtx_assert(_lock, MA_OWNED);
 
-   if (THREAD_CAN_SCHED(td, td->td_lastcpu))
+   if (td->td_lastcpu != NOCPU && THREAD_CAN_SCHED(td, td->td_lastcpu))
best = td->td_lastcpu;
else
best = NOCPU;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303883 - in stable/9/usr.bin/grep: . regex

2016-08-09 Thread Dimitry Andric
Author: dim
Date: Tue Aug  9 18:53:57 2016
New Revision: 303883
URL: https://svnweb.freebsd.org/changeset/base/303883

Log:
  MFC r228395 (by ed):
  
  Add missing "static const" to long options table.
  
  This table is only used in this C file and passed to getopt_long(), so
  we can safely add static and const to it.
  
  MFC r241737 (by ed):
  
  More -Wmissing-variable-declarations fixes.
  
  MFC r270132 (by gabor):
  
  - Do not look for more matching lines if -L is specified
  
  Submitted by:   eadler (based on)
  
  MFC r296799 (by ian):
  
  Fix a bug in bsdgrep that caused the program to hang in a tight loop for
  some combinations of command line options and search patterns.  The code was
  examining regexec flags looking for a regcomp flag value.  The fix is to
  look in the struct field where the decoded regcomp flag was stored when the
  regex was compiled.
  
  With this fix, it's possible to build WITHOUT_GNU_GREP_COMPAT and
  WITH_BSDGREP and have a usable GPL-free grep (which of course lacks gnugrep
  extensions).  It now passes the kyua tests except for one test that requires
  the -z/--null-data gnu extension, and one test involving outputting context
  lines across multiple files which appears to sometimes output an extra
  delimiter line ("--") between matches (a rather obscure failure of a rather
  obscure feature, so bsdgrep should be generally usable now).
  
  MFC r303676:
  
  Fix a segfault in bsdgrep when parsing the invalid extended regexps "?"
  or "+" (these are invalid, because there is no preceding operand).
  
  When bsdgrep attempts to emulate GNU grep in discarding and ignoring the
  invalid ? or + operators, some later logic in tre_compile_fast() goes
  beyond the end of the buffer, leading to a crash.
  
  Fix this by bailing out, and reporting a bad pattern instead.
  
  Reported by:  Steve Kargl

Modified:
  stable/9/usr.bin/grep/grep.c
  stable/9/usr.bin/grep/regex/glue.h
  stable/9/usr.bin/grep/regex/tre-fastmatch.c
  stable/9/usr.bin/grep/regex/xmalloc.c
  stable/9/usr.bin/grep/util.c
Directory Properties:
  stable/9/usr.bin/grep/   (props changed)

Modified: stable/9/usr.bin/grep/grep.c
==
--- stable/9/usr.bin/grep/grep.cTue Aug  9 18:49:19 2016
(r303882)
+++ stable/9/usr.bin/grep/grep.cTue Aug  9 18:53:57 2016
(r303883)
@@ -83,14 +83,15 @@ int  eflags = REG_STARTEND;
 boolmatchall;
 
 /* Searching patterns */
-unsigned intpatterns, pattern_sz;
+unsigned intpatterns;
+static unsigned int pattern_sz;
 struct pat *pattern;
 regex_t*r_pattern;
 fastmatch_t*fg_pattern;
 
 /* Filename exclusion/inclusion patterns */
-unsigned intfpatterns, fpattern_sz;
-unsigned intdpatterns, dpattern_sz;
+unsigned int   fpatterns, dpatterns;
+static unsigned int fpattern_sz, dpattern_sz;
 struct epat*dpattern, *fpattern;
 
 /* For regex errors  */
@@ -167,7 +168,7 @@ usage(void)
 
 static const char  *optstr = 
"0123456789A:B:C:D:EFGHIJMLOPSRUVZabcd:e:f:hilm:nopqrsuvwxXy";
 
-struct option long_options[] =
+static const struct option long_options[] =
 {
{"binary-files",required_argument,  NULL, BIN_OPT},
{"help",no_argument,NULL, HELP_OPT},

Modified: stable/9/usr.bin/grep/regex/glue.h
==
--- stable/9/usr.bin/grep/regex/glue.h  Tue Aug  9 18:49:19 2016
(r303882)
+++ stable/9/usr.bin/grep/regex/glue.h  Tue Aug  9 18:53:57 2016
(r303883)
@@ -50,7 +50,7 @@ typedef enum { STR_WIDE, STR_BYTE, STR_M
   if ((long long)pmatch[0].rm_eo - pmatch[0].rm_so < 0)\
return REG_NOMATCH; \
   ret = fn;
\
-  for (unsigned i = 0; (!(eflags & REG_NOSUB) && (i < nmatch)); i++)\
+  for (unsigned i = 0; (!preg->nosub && (i < nmatch)); i++)
\
{   \
  pmatch[i].rm_so += offset;\
  pmatch[i].rm_eo += offset;\

Modified: stable/9/usr.bin/grep/regex/tre-fastmatch.c
==
--- stable/9/usr.bin/grep/regex/tre-fastmatch.c Tue Aug  9 18:49:19 2016
(r303882)
+++ stable/9/usr.bin/grep/regex/tre-fastmatch.c Tue Aug  9 18:53:57 2016
(r303883)
@@ -621,7 +621,7 @@ tre_compile_fast(fastmatch_t *fg, const 
  case TRE_CHAR('+'):
  case TRE_CHAR('?'):
if ((cflags & REG_EXTENDED) && (i == 0))
- continue;
+ goto badpat;
else if ((cflags & REG_EXTENDED) ^ !escaped)
  STORE_CHAR;
else

Modified: 

svn commit: r303882 - in stable/10/usr.bin/grep: . regex

2016-08-09 Thread Dimitry Andric
Author: dim
Date: Tue Aug  9 18:49:19 2016
New Revision: 303882
URL: https://svnweb.freebsd.org/changeset/base/303882

Log:
  MFC r270132 (by gabor):
  
  - Do not look for more matching lines if -L is specified
  
  Submitted by:   eadler (based on)
  
  MFC r296799 (by ian):
  
  Fix a bug in bsdgrep that caused the program to hang in a tight loop for
  some combinations of command line options and search patterns.  The code was
  examining regexec flags looking for a regcomp flag value.  The fix is to
  look in the struct field where the decoded regcomp flag was stored when the
  regex was compiled.
  
  With this fix, it's possible to build WITHOUT_GNU_GREP_COMPAT and
  WITH_BSDGREP and have a usable GPL-free grep (which of course lacks gnugrep
  extensions).  It now passes the kyua tests except for one test that requires
  the -z/--null-data gnu extension, and one test involving outputting context
  lines across multiple files which appears to sometimes output an extra
  delimiter line ("--") between matches (a rather obscure failure of a rather
  obscure feature, so bsdgrep should be generally usable now).
  
  MFC r303676:
  
  Fix a segfault in bsdgrep when parsing the invalid extended regexps "?"
  or "+" (these are invalid, because there is no preceding operand).
  
  When bsdgrep attempts to emulate GNU grep in discarding and ignoring the
  invalid ? or + operators, some later logic in tre_compile_fast() goes
  beyond the end of the buffer, leading to a crash.
  
  Fix this by bailing out, and reporting a bad pattern instead.
  
  Reported by:  Steve Kargl

Modified:
  stable/10/usr.bin/grep/regex/glue.h
  stable/10/usr.bin/grep/regex/tre-fastmatch.c
  stable/10/usr.bin/grep/util.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/grep/regex/glue.h
==
--- stable/10/usr.bin/grep/regex/glue.h Tue Aug  9 17:57:11 2016
(r303881)
+++ stable/10/usr.bin/grep/regex/glue.h Tue Aug  9 18:49:19 2016
(r303882)
@@ -50,7 +50,7 @@ typedef enum { STR_WIDE, STR_BYTE, STR_M
   if ((long long)pmatch[0].rm_eo - pmatch[0].rm_so < 0)\
return REG_NOMATCH; \
   ret = fn;
\
-  for (unsigned i = 0; (!(eflags & REG_NOSUB) && (i < nmatch)); i++)\
+  for (unsigned i = 0; (!preg->nosub && (i < nmatch)); i++)
\
{   \
  pmatch[i].rm_so += offset;\
  pmatch[i].rm_eo += offset;\

Modified: stable/10/usr.bin/grep/regex/tre-fastmatch.c
==
--- stable/10/usr.bin/grep/regex/tre-fastmatch.cTue Aug  9 17:57:11 
2016(r303881)
+++ stable/10/usr.bin/grep/regex/tre-fastmatch.cTue Aug  9 18:49:19 
2016(r303882)
@@ -621,7 +621,7 @@ tre_compile_fast(fastmatch_t *fg, const 
  case TRE_CHAR('+'):
  case TRE_CHAR('?'):
if ((cflags & REG_EXTENDED) && (i == 0))
- continue;
+ goto badpat;
else if ((cflags & REG_EXTENDED) ^ !escaped)
  STORE_CHAR;
else

Modified: stable/10/usr.bin/grep/util.c
==
--- stable/10/usr.bin/grep/util.c   Tue Aug  9 17:57:11 2016
(r303881)
+++ stable/10/usr.bin/grep/util.c   Tue Aug  9 18:49:19 2016
(r303882)
@@ -336,7 +336,7 @@ procline(struct str *l, int nottext)
}
 
/* One pass if we are not recording matches */
-   if (!wflag && ((color == NULL && !oflag) || qflag || lflag))
+   if (!wflag && ((color == NULL && !oflag) || qflag || lflag || 
Lflag))
break;
 
if (st == (size_t)pmatch.rm_so)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303855 - in head/sys: kern sys

2016-08-09 Thread Mark Johnston
On Tue, Aug 09, 2016 at 01:51:35AM +0200, Oliver Pinter wrote:
> (Added bdrewery to CC, since I'm talking with him on IRC.)
> 
> On Tue, Aug 9, 2016 at 1:43 AM, Mark Johnston  wrote:
> > On Tue, Aug 09, 2016 at 12:53:47AM +0200, Oliver Pinter wrote:
> >> Hi!
> >>
> >> Can you please MFC back this change 10-STABLE together with the
> >> following: 
> >> https://github.com/HardenedBSD/hardenedBSD/commit/576619e564618bca3675db57580d8e1f76bd2ac7
> >>
> >> This issue is still exists on 10-STABLE, as you can test with the
> >> linked program from phabricator:
> >> https://people.freebsd.org/~mjg/reproducers/unp-gc-panic.c
> >
> > Hm, I don't think this could be MFCed directly. It changes the kernel
> > ABI by modifying the argument of dom_dispose(). This could be fixed in
> > stable/10 with a hack to call the unix domain socket code directly when
> > appropriate, which I think is preferable to the current state of things.
> > I'll look into it further.
> 
> The question is how much external / out of tree components would use
> this ABI or how acceptable to break this ABI.
> I just grepped through the src tree for internal uses, and I found only these:

I don't think it's acceptable. This could be side-stepped with a hack:

if (pr->pr_domain->dom_family == AF_LOCAL)
unp_dispose_wrapper(so);
else if (pr->pr_flags & PR_RIGHTS && pr->pr_domain->dom_dispose != NULL)
(*pr->pr_domain->dom_dispose)(so->so_rcv.sb_mb);
...

So I'm inclined to just do that and avoid the issue.

> 
> op@opn hardenedBSD.git> git grep dom_dispose
> share/doc/smm/18.net/6.t:   int (*dom_dispose)();   /*
> dispose of internalized rights */
> share/man/man9/domain.9:void(*dom_dispose)  /*
> dispose of internalized rights */
> sys/kern/uipc_debug.c:  db_printf("dom_dispose: %p\n", d->dom_dispose);
> sys/kern/uipc_socket.c: if (pr->pr_flags & PR_RIGHTS &&
> pr->pr_domain->dom_dispose != NULL)
> sys/kern/uipc_socket.c: (*pr->pr_domain->dom_dispose)(so);
> sys/kern/uipc_socket.c:  * dom_dispose() and sbrelease_internal() are
> an inlining of what was
> sys/kern/uipc_socket.c:  * In order to avoid calling dom_dispose with
> the socket buffer mutex
> sys/kern/uipc_socket.c: if (pr->pr_flags & PR_RIGHTS &&
> pr->pr_domain->dom_dispose != NULL)
> sys/kern/uipc_socket.c: (*pr->pr_domain->dom_dispose)();
> sys/kern/uipc_usrreq.c: .dom_dispose =  unp_dispose_so,
> sys/sys/domain.h:   void(*dom_dispose)  /* dispose of
> internalized rights */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303881 - in head: share/man/man4 sys/dev/pci

2016-08-09 Thread John Baldwin
Author: jhb
Date: Tue Aug  9 17:57:11 2016
New Revision: 303881
URL: https://svnweb.freebsd.org/changeset/base/303881

Log:
  Reliably return PCI_GETCONF_LAST_DEVICE from PCIOCGETCONF.
  
  Previously the loop in PCIIOCGETCONF would terminate as soon as it
  found enough matches.  Now it will continue iterating through the
  PCI device list and only terminate if it finds another matching device
  for which it has no room to store a conf structure.  This means that
  PCI_GETCONF_LAST_DEVICE is reliably returned when the number of
  matching devices is equal to the number of slots in the matches
  buffer.  For example, if a program requests the conf structure for a
  single PCI function with a specified domain/bus/slot/function it will
  now get PCI_GETCONF_LAST_DEVICE instead of PCI_GETCONF_MORE_DEVS.
  
  While here, simplify the loop conditional a bit more by explicitly
  breaking out of the loop if copyout() fails and removing a redundant
  i < pci_numdevs check.
  
  Reviewed by:  vangyzen, imp
  MFC after:1 month
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D7445

Modified:
  head/share/man/man4/pci.4
  head/sys/dev/pci/pci_user.c

Modified: head/share/man/man4/pci.4
==
--- head/share/man/man4/pci.4   Tue Aug  9 17:49:42 2016(r303880)
+++ head/share/man/man4/pci.4   Tue Aug  9 17:57:11 2016(r303881)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 3, 2008
+.Dd August 9, 2016
 .Dt PCI 4
 .Os
 .Sh NAME
@@ -229,7 +229,8 @@ The status tells the user the dispositio
 The possible status values are:
 .Bl -ohang
 .It PCI_GETCONF_LAST_DEVICE
-This means that there are no more devices in the PCI device list after the
+This means that there are no more devices in the PCI device list matching
+the specified criteria after the
 ones returned in the
 .Va matches
 buffer.
@@ -245,9 +246,7 @@ and
 to zero to start over at the beginning of the list.
 .It PCI_GETCONF_MORE_DEVS
 This tells the user that his buffer was not large enough to hold all of the
-remaining devices in the device list that possibly match his criteria.
-It is possible for this status to be returned, even when none of the remaining
-devices in the list would match the user's criteria.
+remaining devices in the device list that match his criteria.
 .It PCI_GETCONF_ERROR
 This indicates a general error while servicing the user's request.
 If the

Modified: head/sys/dev/pci/pci_user.c
==
--- head/sys/dev/pci/pci_user.c Tue Aug  9 17:49:42 2016(r303880)
+++ head/sys/dev/pci/pci_user.c Tue Aug  9 17:57:11 2016(r303881)
@@ -708,10 +708,9 @@ pci_ioctl(struct cdev *dev, u_long cmd, 
 * Go through the list of devices and copy out the devices
 * that match the user's criteria.
 */
-   for (cio->num_matches = 0, error = 0, i = 0,
+   for (cio->num_matches = 0, i = 0,
 dinfo = STAILQ_FIRST(devlist_head);
-(dinfo != NULL) && (cio->num_matches < ionum) &&
-(error == 0) && (i < pci_numdevs);
+dinfo != NULL;
 dinfo = STAILQ_NEXT(dinfo, pci_links), i++) {
 
if (i < cio->offset)
@@ -833,11 +832,12 @@ pci_ioctl(struct cdev *dev, u_long cmd, 
} else
 #endif /* PRE7_COMPAT */
confdata = >conf;
-   /* Only if we can copy it out do we count it. */
-   if (!(error = copyout(confdata,
+   error = copyout(confdata,
(caddr_t)cio->matches +
-   confsz * cio->num_matches, confsz)))
-   cio->num_matches++;
+   confsz * cio->num_matches, confsz);
+   if (error)
+   break;
+   cio->num_matches++;
}
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303880 - head/sys/dev/cxgbe

2016-08-09 Thread John Baldwin
Author: jhb
Date: Tue Aug  9 17:49:42 2016
New Revision: 303880
URL: https://svnweb.freebsd.org/changeset/base/303880

Log:
  Track the base absolute ID of ingress and egress queues.
  
  Use this to map an absolute queue ID to a logical queue ID in interrupt
  handlers.  For the regular cxgbe/cxl drivers this should be a no-op as
  the base absolute ID should be zero.  VF devices have a non-zero base
  absolute ID and require this change.  While here, export the absolute ID
  of egress queues via a sysctl.
  
  Reviewed by:  np
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D7446

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hTue Aug  9 16:02:35 2016
(r303879)
+++ head/sys/dev/cxgbe/adapter.hTue Aug  9 17:49:42 2016
(r303880)
@@ -430,6 +430,7 @@ enum {DOORBELL_UDB, DOORBELL_WCWR, DOORB
 struct sge_eq {
unsigned int flags; /* MUST be first */
unsigned int cntxt_id;  /* SGE context id for the eq */
+   unsigned int abs_id;/* absolute SGE id for the eq */
struct mtx eq_lock;
 
struct tx_desc *desc;   /* KVA of descriptor ring */
@@ -738,8 +739,10 @@ struct sge {
struct sge_nm_txq *nm_txq;  /* netmap tx queues */
struct sge_nm_rxq *nm_rxq;  /* netmap rx queues */
 
-   uint16_t iq_start;
-   int eq_start;
+   uint16_t iq_start;  /* first cntxt_id */
+   uint16_t iq_base;   /* first abs_id */
+   int eq_start;   /* first cntxt_id */
+   int eq_base;/* first abs_id */
struct sge_iq **iqmap;  /* iq->cntxt_id to iq mapping */
struct sge_eq **eqmap;  /* eq->cntxt_id to eq mapping */
 

Modified: head/sys/dev/cxgbe/t4_sge.c
==
--- head/sys/dev/cxgbe/t4_sge.c Tue Aug  9 16:02:35 2016(r303879)
+++ head/sys/dev/cxgbe/t4_sge.c Tue Aug  9 17:49:42 2016(r303880)
@@ -1444,7 +1444,8 @@ service_iq(struct sge_iq *iq, int budget
 break;
 }
 
-   q = sc->sge.iqmap[lq - sc->sge.iq_start];
+   q = sc->sge.iqmap[lq - sc->sge.iq_start -
+   sc->sge.iq_base];
if (atomic_cmpset_int(>state, IQS_IDLE,
IQS_BUSY)) {
if (service_iq(q, q->qsize / 16) == 0) {
@@ -2972,6 +2973,7 @@ alloc_rxq(struct vi_info *vi, struct sge
 struct sysctl_oid *oid)
 {
int rc;
+   struct adapter *sc = vi->pi->adapter;
struct sysctl_oid_list *children;
char name[16];
 
@@ -2980,12 +2982,20 @@ alloc_rxq(struct vi_info *vi, struct sge
if (rc != 0)
return (rc);
 
+   if (idx == 0)
+   sc->sge.iq_base = rxq->iq.abs_id - rxq->iq.cntxt_id;
+   else
+   KASSERT(rxq->iq.cntxt_id + sc->sge.iq_base == rxq->iq.abs_id,
+   ("iq_base mismatch"));
+   KASSERT(sc->sge.iq_base == 0 || sc->flags & IS_VF,
+   ("PF with non-zero iq_base"));
+
/*
 * The freelist is just barely above the starvation threshold right now,
 * fill it up a bit more.
 */
FL_LOCK(>fl);
-   refill_fl(vi->pi->adapter, >fl, 128);
+   refill_fl(sc, >fl, 128);
FL_UNLOCK(>fl);
 
 #if defined(INET) || defined(INET6)
@@ -3317,6 +3327,7 @@ eth_eq_alloc(struct adapter *sc, struct 
eq->flags |= EQ_ALLOCATED;
 
eq->cntxt_id = G_FW_EQ_ETH_CMD_EQID(be32toh(c.eqid_pkd));
+   eq->abs_id = G_FW_EQ_ETH_CMD_PHYSEQID(be32toh(c.physeqid_pkd));
cntxt_id = eq->cntxt_id - sc->sge.eq_start;
if (cntxt_id >= sc->sge.neq)
panic("%s: eq->cntxt_id (%d) more than the max (%d)", __func__,
@@ -3557,6 +3568,14 @@ alloc_txq(struct vi_info *vi, struct sge
 
/* Can't fail after this point. */
 
+   if (idx == 0)
+   sc->sge.eq_base = eq->abs_id - eq->cntxt_id;
+   else
+   KASSERT(eq->cntxt_id + sc->sge.eq_base == eq->abs_id,
+   ("eq_base mismatch"));
+   KASSERT(sc->sge.eq_base == 0 || sc->flags & IS_VF,
+   ("PF with non-zero eq_base"));
+
TASK_INIT(>tx_reclaim_task, 0, tx_reclaim, eq);
txq->ifp = vi->ifp;
txq->gl = sglist_alloc(TX_SGL_SEGS, M_WAITOK);
@@ -3572,6 +3591,8 @@ alloc_txq(struct vi_info *vi, struct sge
NULL, "tx queue");
children = SYSCTL_CHILDREN(oid);
 
+   SYSCTL_ADD_UINT(>ctx, children, OID_AUTO, "abs_id", CTLFLAG_RD,
+   >abs_id, 0, "absolute id of the queue");
SYSCTL_ADD_UINT(>ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD,
 

Re: svn commit: r303870 - head/sys/dev/mlx5/mlx5_en

2016-08-09 Thread John Baldwin
On Tuesday, August 09, 2016 07:43:15 AM Hans Petter Selasky wrote:
> Author: hselasky
> Date: Tue Aug  9 07:43:15 2016
> New Revision: 303870
> URL: https://svnweb.freebsd.org/changeset/base/303870
> 
> Log:
>   Fix for use after free.
>   
>   Clear the device description to avoid use after free because the
>   bsddev is not destroyed when the mlx5en module is unloaded. Only when
>   the parent mlx5 module is unloaded the bsddev is destroyed. This fixes
>   a panic on listing sysctls which refer strings in the bsddev after the
>   mlx5en module has been unloaded.
>   
>   Sponsored by:   Mellanox Technologies
>   MFC after:  1 week

Hmmm, this seems like it is working around a bug somewhere else.
device_detach() calls device_set_driver(dev, NULL) which in turn calls
device_set_desc(dev, NULL) which should be clearing the description.  You can
only be leaking a desc pointer if you aren't detaching the device.  Not
detaching a device but unloading the module containing part (but apparently
not all) of its driver would seem to be fraught with peril.  Why are you not
detaching the mlx5en0 device when unloading this module?

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


svn commit: r303878 - stable/11/release

2016-08-09 Thread Glen Barber
Author: gjb
Date: Tue Aug  9 15:59:57 2016
New Revision: 303878
URL: https://svnweb.freebsd.org/changeset/base/303878

Log:
  Update the SRCBRANCH for release.sh to use stable/11 as the
  SRCBRANCH.
  
  This is a direct commit to stable/11.
  
  Approved by:  re (kib)
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/release/release.conf.sample

Modified: stable/11/release/release.conf.sample
==
--- stable/11/release/release.conf.sample   Tue Aug  9 15:57:37 2016
(r303877)
+++ stable/11/release/release.conf.sample   Tue Aug  9 15:59:57 2016
(r303878)
@@ -16,7 +16,7 @@ CHROOTDIR="/scratch"
 SVNROOT="svn://svn.FreeBSD.org/"
 
 ## Set the src/, ports/, and doc/ branches or tags.
-SRCBRANCH="base/head@rHEAD"
+SRCBRANCH="base/stable/11@rHEAD"
 DOCBRANCH="doc/head@rHEAD"
 PORTBRANCH="ports/head@rHEAD"
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303879 - in head/sys/arm: broadcom/bcm2835 xscale/pxa

2016-08-09 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Aug  9 16:02:35 2016
New Revision: 303879
URL: https://svnweb.freebsd.org/changeset/base/303879

Log:
  Remove some NULL checks after M_WAITOK allocations from sys/arm/.
  
  MFC after:1 month

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_vcio.c
  head/sys/arm/xscale/pxa/pxa_smi.c
  head/sys/arm/xscale/pxa/pxa_space.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_vcio.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_vcio.cTue Aug  9 15:59:57 
2016(r303878)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_vcio.cTue Aug  9 16:02:35 
2016(r303879)
@@ -68,10 +68,6 @@ vcio_ioctl(struct cdev *dev, u_long cmd,
if (error != 0)
break;
property = malloc(size, M_VCIO, M_WAITOK);
-   if (property == NULL) {
-   error = ENOMEM;
-   break;
-   }
 
error = copyin(ptr, property, size);
if (error) {

Modified: head/sys/arm/xscale/pxa/pxa_smi.c
==
--- head/sys/arm/xscale/pxa/pxa_smi.c   Tue Aug  9 15:59:57 2016
(r303878)
+++ head/sys/arm/xscale/pxa/pxa_smi.c   Tue Aug  9 16:02:35 2016
(r303879)
@@ -322,8 +322,6 @@ pxa_smi_add_device(device_t dev, const c
 
ivars = (struct smi_ivars *)malloc(
sizeof(struct smi_ivars), M_PXASMI, M_WAITOK);
-   if (ivars == NULL)
-   return;
 
child = device_add_child(dev, name, unit);
if (child == NULL) {

Modified: head/sys/arm/xscale/pxa/pxa_space.c
==
--- head/sys/arm/xscale/pxa/pxa_space.c Tue Aug  9 15:59:57 2016
(r303878)
+++ head/sys/arm/xscale/pxa/pxa_space.c Tue Aug  9 16:02:35 2016
(r303879)
@@ -191,9 +191,6 @@ pxa_bus_tag_alloc(bus_addr_t offset)
 
tag = (struct bus_space *)malloc(sizeof(struct bus_space), M_PXATAG,
M_WAITOK);
-   if (tag == NULL) {
-   return (NULL);
-   }
 
bcopy(&_base_tag, tag, sizeof(struct bus_space));
tag->bs_privdata = (void *)offset;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303877 - head/usr.sbin/bsdinstall/scripts

2016-08-09 Thread Steven Kreuzer
Author: skreuzer (doc,ports committer)
Date: Tue Aug  9 15:57:37 2016
New Revision: 303877
URL: https://svnweb.freebsd.org/changeset/base/303877

Log:
  Write kern.randompid to /etc/sysctl.conf
  
  PR:   211471
  Reported by:  su...@protonmail.com
  Reviewed by:  robak@
  Approved by:  allanjude@
  MFC after:3 days
  Differential Revision: https://reviews.freebsd.org/D7440

Modified:
  head/usr.sbin/bsdinstall/scripts/hardening

Modified: head/usr.sbin/bsdinstall/scripts/hardening
==
--- head/usr.sbin/bsdinstall/scripts/hardening  Tue Aug  9 15:56:33 2016
(r303876)
+++ head/usr.sbin/bsdinstall/scripts/hardening  Tue Aug  9 15:57:37 2016
(r303877)
@@ -29,6 +29,7 @@
 : ${DIALOG_OK=0}
 
 echo -n > $BSDINSTALL_TMPETC/rc.conf.hardening
+echo -n > $BSDINSTALL_TMPETC/sysctl.conf.hardening
 
 exec 3>&1
 FEATURES=$( dialog --backtitle "FreeBSD Installer" \
@@ -39,7 +40,7 @@ FEATURES=$( dialog --backtitle "FreeBSD 
"hide_gids" "Hide processes running as other groups" ${hide_gids:-off} \
"read_msgbuf" "Disable reading kernel message buffer for unprivileged 
users" ${read_msgbuf:-off} \
"proc_debug" "Disable process debugging facilities for unprivileged 
users" ${proc_debug:-off} \
-   "random_pid" "Randomize the PID of newly created processes" 
${random_id:-off} \
+   "random_pid" "Randomize the PID of newly created processes" 
${random_pid:-off} \
"stack_guard" "Insert stack guard page ahead of the growable segments" 
${stack_guard:-off} \
"clear_tmp" "Clean the /tmp filesystem on system startup" 
${clear_tmp:-off} \
"disable_syslogd" "Disable opening Syslogd network socket (disables 
remote logging)" ${disable_syslogd:-off} \
@@ -60,7 +61,7 @@ for feature in $FEATURES; do
if [ "$feature" = "proc_debug" ]; then
echo security.bsd.unprivileged_proc_debug=0 >> 
$BSDINSTALL_TMPETC/sysctl.conf.hardening
fi
-   if [ "$feature" = "random_id" ]; then
+   if [ "$feature" = "random_pid" ]; then
echo kern.randompid=$(jot -r 1 ) >> 
$BSDINSTALL_TMPETC/sysctl.conf.hardening
fi
if [ "$feature" = "stack_guard" ]; then
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303876 - head/sys/dev/nand

2016-08-09 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Aug  9 15:56:33 2016
New Revision: 303876
URL: https://svnweb.freebsd.org/changeset/base/303876

Log:
  Remove NULL checks after M_WAITOK allocations from nand(4).
  
  MFC after:1 month

Modified:
  head/sys/dev/nand/nand_generic.c
  head/sys/dev/nand/nandsim_chip.c

Modified: head/sys/dev/nand/nand_generic.c
==
--- head/sys/dev/nand/nand_generic.cTue Aug  9 15:55:14 2016
(r303875)
+++ head/sys/dev/nand/nand_generic.cTue Aug  9 15:56:33 2016
(r303876)
@@ -228,8 +228,6 @@ generic_nand_attach(device_t dev)
if (ivar->is_onfi) {
onfi_chip_params = malloc(sizeof(struct onfi_chip_params),
M_NAND, M_WAITOK | M_ZERO);
-   if (onfi_chip_params == NULL)
-   return (ENOMEM);
 
if (onfi_read_parameter(chip, onfi_chip_params)) {
nand_debug(NDBG_GEN,"Could not read parameter page!\n");
@@ -741,10 +739,6 @@ onfi_is_blk_bad(device_t device, uint32_
chip = device_get_softc(device);
 
oob = malloc(chip->chip_geom.oob_size, M_NAND, M_WAITOK);
-   if (!oob) {
-   device_printf(device, "%s: cannot allocate oob\n", __func__);
-   return (ENOMEM);
-   }
 
page_number = block_number * chip->chip_geom.pgs_per_blk;
*bad = 0;
@@ -1001,10 +995,6 @@ generic_is_blk_bad(device_t dev, uint32_
chip = device_get_softc(dev);
 
oob = malloc(chip->chip_geom.oob_size, M_NAND, M_WAITOK);
-   if (!oob) {
-   device_printf(dev, "%s: cannot allocate OOB\n", __func__);
-   return (ENOMEM);
-   }
 
page_number = block * chip->chip_geom.pgs_per_blk;
*bad = 0;

Modified: head/sys/dev/nand/nandsim_chip.c
==
--- head/sys/dev/nand/nandsim_chip.cTue Aug  9 15:55:14 2016
(r303875)
+++ head/sys/dev/nand/nandsim_chip.cTue Aug  9 15:56:33 2016
(r303876)
@@ -90,8 +90,6 @@ nandsim_chip_init(struct nandsim_softc* 
int error;
 
chip = malloc(sizeof(*chip), M_NANDSIM, M_WAITOK | M_ZERO);
-   if (!chip)
-   return (NULL);
 
mtx_init(>ns_lock, "nandsim lock", NULL, MTX_DEF);
callout_init(>ns_callout, 1);
@@ -206,9 +204,6 @@ nandsim_blk_state_init(struct nandsim_ch
 
chip->blk_state = malloc(size * sizeof(struct nandsim_block_state),
M_NANDSIM, M_WAITOK | M_ZERO);
-   if (!chip->blk_state) {
-   return (-1);
-   }
 
for (i = 0; i < size; i++) {
if (wear_lev)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303875 - head/sys/dev/ofw

2016-08-09 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Aug  9 15:55:14 2016
New Revision: 303875
URL: https://svnweb.freebsd.org/changeset/base/303875

Log:
  Remove NULL checks after M_WAITOK allocations from sys/dev/ofw/.
  
  MFC after:1 month

Modified:
  head/sys/dev/ofw/openfirmio.c
  head/sys/dev/ofw/openpromio.c

Modified: head/sys/dev/ofw/openfirmio.c
==
--- head/sys/dev/ofw/openfirmio.c   Tue Aug  9 15:52:17 2016
(r303874)
+++ head/sys/dev/ofw/openfirmio.c   Tue Aug  9 15:55:14 2016
(r303875)
@@ -100,8 +100,6 @@ openfirm_getstr(int len, const char *use
return (ENAMETOOLONG);
 
*cpp = cp = malloc(len + 1, M_TEMP, M_WAITOK);
-   if (cp == NULL)
-   return (ENOMEM);
error = copyin(user, cp, len);
cp[len] = '\0';
return (error);
@@ -173,10 +171,6 @@ openfirm_ioctl(struct cdev *dev, u_long 
if (len <= 0)
break;
value = malloc(len, M_TEMP, M_WAITOK);
-   if (value == NULL) {
-   error = ENOMEM;
-   break;
-   }
len = OF_getprop(node, name, (void *)value, len);
error = copyout(value, of->of_buf, len);
break;
@@ -199,10 +193,6 @@ openfirm_ioctl(struct cdev *dev, u_long 
if (error)
break;
value = malloc(of->of_buflen, M_TEMP, M_WAITOK);
-   if (value == NULL) {
-   error = ENOMEM;
-   break;
-   }
error = copyin(of->of_buf, value, of->of_buflen);
if (error)
break;

Modified: head/sys/dev/ofw/openpromio.c
==
--- head/sys/dev/ofw/openpromio.c   Tue Aug  9 15:52:17 2016
(r303874)
+++ head/sys/dev/ofw/openpromio.c   Tue Aug  9 15:55:14 2016
(r303875)
@@ -151,18 +151,10 @@ openprom_ioctl(struct cdev *dev, u_long 
break;
}
prop = malloc(len, M_TEMP, M_WAITOK | M_ZERO);
-   if (prop == NULL) {
-   error = ENOMEM;
-   break;
-   }
error = copyinstr(>oprom_array, prop, len, );
if (error != 0)
break;
buf = malloc(OPROMMAXPARAM, M_TEMP, M_WAITOK | M_ZERO);
-   if (buf == NULL) {
-   error = ENOMEM;
-   break;
-   }
node = openprom_node;
switch (cmd) {
case OPROMGETPROP:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303874 - head/sys/dev/mpt

2016-08-09 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Aug  9 15:52:17 2016
New Revision: 303874
URL: https://svnweb.freebsd.org/changeset/base/303874

Log:
  Remove NULL check after M_WAITOK allocation from mpt(4).
  
  MFC after:1 month

Modified:
  head/sys/dev/mpt/mpt_pci.c

Modified: head/sys/dev/mpt/mpt_pci.c
==
--- head/sys/dev/mpt/mpt_pci.c  Tue Aug  9 15:51:11 2016(r303873)
+++ head/sys/dev/mpt/mpt_pci.c  Tue Aug  9 15:52:17 2016(r303874)
@@ -654,10 +654,6 @@ mpt_dma_mem_alloc(struct mpt_softc *mpt)
 
len = sizeof (request_t) * MPT_MAX_REQUESTS(mpt);
mpt->request_pool = (request_t *)malloc(len, M_DEVBUF, M_WAITOK|M_ZERO);
-   if (mpt->request_pool == NULL) {
-   mpt_prt(mpt, "cannot allocate request pool\n");
-   return (1);
-   }
 
/*
 * Create a parent dma tag for this device.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303873 - head/sys/dev/msk

2016-08-09 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Aug  9 15:51:11 2016
New Revision: 303873
URL: https://svnweb.freebsd.org/changeset/base/303873

Log:
  Remove NULL checks after M_WAITOK allocations from msk(4).
  
  MFC after:1 month

Modified:
  head/sys/dev/msk/if_msk.c

Modified: head/sys/dev/msk/if_msk.c
==
--- head/sys/dev/msk/if_msk.c   Tue Aug  9 15:50:03 2016(r303872)
+++ head/sys/dev/msk/if_msk.c   Tue Aug  9 15:51:11 2016(r303873)
@@ -1953,12 +1953,6 @@ mskc_attach(device_t dev)
goto fail;
}
mmd = malloc(sizeof(struct msk_mii_data), M_DEVBUF, M_WAITOK | M_ZERO);
-   if (mmd == NULL) {
-   device_printf(dev, "failed to allocate memory for "
-   "ivars of PORT_A\n");
-   error = ENXIO;
-   goto fail;
-   }
mmd->port = MSK_PORT_A;
mmd->pmd = sc->msk_pmd;
mmd->mii_flags |= MIIF_DOPAUSE;
@@ -1977,12 +1971,6 @@ mskc_attach(device_t dev)
}
mmd = malloc(sizeof(struct msk_mii_data), M_DEVBUF, M_WAITOK |
M_ZERO);
-   if (mmd == NULL) {
-   device_printf(dev, "failed to allocate memory for "
-   "ivars of PORT_B\n");
-   error = ENXIO;
-   goto fail;
-   }
mmd->port = MSK_PORT_B;
mmd->pmd = sc->msk_pmd;
if (sc->msk_pmd == 'L' || sc->msk_pmd == 'S')
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303872 - head/sys/dev/tws

2016-08-09 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Aug  9 15:50:03 2016
New Revision: 303872
URL: https://svnweb.freebsd.org/changeset/base/303872

Log:
  Remove NULL checks after M_WAITOK allocations from tws(4).
  
  MFC after:1 month

Modified:
  head/sys/dev/tws/tws.c

Modified: head/sys/dev/tws/tws.c
==
--- head/sys/dev/tws/tws.c  Tue Aug  9 11:37:08 2016(r303871)
+++ head/sys/dev/tws/tws.c  Tue Aug  9 15:50:03 2016(r303872)
@@ -606,21 +606,9 @@ tws_init(struct tws_softc *sc)
 
 sc->reqs = malloc(sizeof(struct tws_request) * tws_queue_depth, M_TWS,
   M_WAITOK | M_ZERO);
-if ( sc->reqs == NULL ) {
-TWS_TRACE_DEBUG(sc, "malloc failed", 0, sc->is64bit);
-return(ENOMEM);
-}
 sc->sense_bufs = malloc(sizeof(struct tws_sense) * tws_queue_depth, M_TWS,
   M_WAITOK | M_ZERO);
-if ( sc->sense_bufs == NULL ) {
-TWS_TRACE_DEBUG(sc, "sense malloc failed", 0, sc->is64bit);
-return(ENOMEM);
-}
 sc->scan_ccb = malloc(sizeof(union ccb), M_TWS, M_WAITOK | M_ZERO);
-if ( sc->scan_ccb == NULL ) {
-TWS_TRACE_DEBUG(sc, "ccb malloc failed", 0, sc->is64bit);
-return(ENOMEM);
-}
 if (bus_dmamem_alloc(sc->data_tag, (void **)>ioctl_data_mem,
 (BUS_DMA_NOWAIT | BUS_DMA_ZERO), >ioctl_data_map)) {
 device_printf(sc->tws_dev, "Cannot allocate ioctl data mem\n");
@@ -668,8 +656,6 @@ tws_init_aen_q(struct tws_softc *sc)
 sc->aen_q.overflow=0;
 sc->aen_q.q = malloc(sizeof(struct tws_event_packet)*sc->aen_q.depth, 
   M_TWS, M_WAITOK | M_ZERO);
-if ( ! sc->aen_q.q )
-return(FAILURE);
 return(SUCCESS);
 }
 
@@ -682,8 +668,6 @@ tws_init_trace_q(struct tws_softc *sc)
 sc->trace_q.overflow=0;
 sc->trace_q.q = malloc(sizeof(struct tws_trace_rec)*sc->trace_q.depth,
   M_TWS, M_WAITOK | M_ZERO);
-if ( ! sc->trace_q.q )
-return(FAILURE);
 return(SUCCESS);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303869 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-08-09 Thread Conrad Meyer
This was detected by Coverity as CID 1361483, for what it's worth.

Best,
Conrad

On Mon, Aug 8, 2016 at 11:11 PM, Andriy Gapon  wrote:
> Author: avg
> Date: Tue Aug  9 06:11:24 2016
> New Revision: 303869
> URL: https://svnweb.freebsd.org/changeset/base/303869
>
> Log:
>   fix a zfs cross-device rename crash introduced in r303763
>
>   The problem was that 'zfsvfs' variable was not initialized if the error
>   was detected, but in the exit path the variable was dereferenced before
>   the error code was checked.
>
>   Reported by:  np
>   MFC after:3 days
>   X-MFC with:   r303763
>
> Modified:
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
>
> 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 Tue 
> Aug  9 04:59:55 2016(r303868)
> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue 
> Aug  9 06:11:24 2016(r303869)
> @@ -3956,7 +3956,7 @@ unlockout:/* all 4 vnodes are 
> locked,
> VOP_UNLOCK(sdvp, 0);
>
>  out:   /* original two vnodes are locked */
> -   if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS && error == 0)
> +   if (error == 0 && zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
> zil_commit(zilog, 0);
>
> if (*tvpp != NULL)
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303716 - head/crypto/openssh

2016-08-09 Thread Warner Losh

> On Aug 8, 2016, at 10:45 PM, Warner Losh  wrote:
> 
> On Mon, Aug 8, 2016 at 4:41 AM, Dag-Erling Smørgrav  wrote:
>> Warner Losh  writes:
>>> Andrey Chernov  writes:
 FreeBSD 11 is not released yet (betas are not counted), stable-10 too,
 so it is right time to deprecate for them.
>>> Nice try, but feature freeze was months ago. Have you got buy in from the
>>> security officer and the release engineer?
>>> 
>>> I didn’t think so...
>> 
>> You have absolutely *no* basis for this claim, and I would like you to
>> retract it.
> 
> Why do I need to retract anything? He provided pointers to the re@ approval.
> 
> Come on DES.

Actually, you’re right. My defensive reaction was wrong.

I’m sorry DES. What I said was in the heat of the moment, and isn’t supported
by the facts. I was wrong to say it like I did, especially since I didn’t check 
into
it first.

Please forgive my outbursts.

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

Re: svn commit: r303716 - head/crypto/openssh

2016-08-09 Thread Warner Losh
On Mon, Aug 8, 2016 at 4:41 AM, Dag-Erling Smørgrav  wrote:
> Warner Losh  writes:
>> Andrey Chernov  writes:
>> > FreeBSD 11 is not released yet (betas are not counted), stable-10 too,
>> > so it is right time to deprecate for them.
>> Nice try, but feature freeze was months ago. Have you got buy in from the
>> security officer and the release engineer?
>>
>> I didn’t think so...
>
> You have absolutely *no* basis for this claim, and I would like you to
> retract it.

Why do I need to retract anything? He provided pointers to the re@ approval.

Come on DES.

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

Re: svn commit: r303716 - head/crypto/openssh

2016-08-09 Thread Warner Losh
On Mon, Aug 8, 2016 at 1:25 AM, Brooks Davis  wrote:
> On Sun, Aug 07, 2016 at 03:48:44PM -0700, Xin Li wrote:
>>
>>
>> On 8/7/16 14:20, Warner Losh wrote:
>> >
>> >> On Aug 7, 2016, at 3:11 PM, Andrey Chernov  wrote:
>> >>
>> >>> OTOH, FreeBSD has a documented deprecation process that says things will
>> >>> continue working for a major release after being formally deprecated.
>> >>
>> >> FreeBSD 11 is not released yet (betas are not counted), stable-10 too,
>> >> so it is right time to deprecate for them.
>> >
>> > Nice try, but feature freeze was months ago. Have you got buy in from the
>> > security officer and the release engineer?
>>
>> Well, despite the fact that I have to admit that I get locked out from
>> my own storage box too, however (even without wearing any hat) I am for
>> the change and would blame myself for being lazy in adopting the change
>> when the upstream have announced it earlier about a year ago.
>
> While the timing sucks, I don't see any way around this change given our
> experience with the HPN patches and that upstream plans to kill this
> feature, we must not ship 11 with support enabled.  There's just no
> practical way to keep adding back a feature for 4-5 years.

Then we should put http://www.openssh.com/legacy.html in the release notes,
UPDATING and maybe the man page.

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


svn commit: r303870 - head/sys/dev/mlx5/mlx5_en

2016-08-09 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Aug  9 07:43:15 2016
New Revision: 303870
URL: https://svnweb.freebsd.org/changeset/base/303870

Log:
  Fix for use after free.
  
  Clear the device description to avoid use after free because the
  bsddev is not destroyed when the mlx5en module is unloaded. Only when
  the parent mlx5 module is unloaded the bsddev is destroyed. This fixes
  a panic on listing sysctls which refer strings in the bsddev after the
  mlx5en module has been unloaded.
  
  Sponsored by: Mellanox Technologies
  MFC after:1 week

Modified:
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cTue Aug  9 06:11:24 2016
(r303869)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cTue Aug  9 07:43:15 2016
(r303870)
@@ -3108,6 +3108,13 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *
/* don't allow more IOCTLs */
priv->gone = 1;
 
+   /*
+* Clear the device description to avoid use after free,
+* because the bsddev is not destroyed when this module is
+* unloaded:
+*/
+   device_set_desc(mdev->pdev->dev.bsddev, NULL);
+
/* XXX wait a bit to allow IOCTL handlers to complete */
pause("W", hz);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303869 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-08-09 Thread Andriy Gapon
Author: avg
Date: Tue Aug  9 06:11:24 2016
New Revision: 303869
URL: https://svnweb.freebsd.org/changeset/base/303869

Log:
  fix a zfs cross-device rename crash introduced in r303763
  
  The problem was that 'zfsvfs' variable was not initialized if the error
  was detected, but in the exit path the variable was dereferenced before
  the error code was checked.
  
  Reported by:  np
  MFC after:3 days
  X-MFC with:   r303763

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c

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 Tue Aug 
 9 04:59:55 2016(r303868)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Aug 
 9 06:11:24 2016(r303869)
@@ -3956,7 +3956,7 @@ unlockout:/* all 4 vnodes are 
locked,
VOP_UNLOCK(sdvp, 0);
 
 out:   /* original two vnodes are locked */
-   if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS && error == 0)
+   if (error == 0 && zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
zil_commit(zilog, 0);
 
if (*tvpp != NULL)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303763 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys

2016-08-09 Thread Andriy Gapon
On 09/08/2016 08:10, Andriy Gapon wrote:
> On 09/08/2016 02:48, Navdeep Parhar wrote:
>> Hello Andriy,
>>
>> I'm at r303837 and have had two panics today in zfs_rename.  I have a
>> core for a kernel built with -O0.  Let me know if you think it's related
>> to this commit and need more information.  This is the stack:
>>
>> (also available at https://people.freebsd.org/~np/rename_panic.txt in
>> case the wide lines are hard to read in email).
> 
> Thank you very much for the report.
> More details are required for analysis. In frame 11 I would like to see 
> objects
> pointed to by all arguments and additionally local variables tdzp, sdzp, 
> zfsvfs
> and zilog.

Navdeep,

thank you for the debugging information (provided out-of-band).
The problem seems to be with leaving a variable uninitialized when a
cross-device rename is detected and then accessing that variable before checking
the error code.  Also, thank you for testing a fix.  I'll commit it very soon.

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