]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agourtwn: use m_get2() in Rx path.
Andriy Voskoboinyk [Fri, 24 Jun 2016 23:43:19 +0000 (23:43 +0000)]
urtwn: use m_get2() in Rx path.

Replace m_getcl() with m_get2(); this fixes 'frame too long'
messages for frames, which are longer than MCLBYTES
(can be easily triggered when A-MSDU is used).

Tested with RTL8188CUS (AP) and RTL8188EU (STA).

Approved by: re (marius)

8 years agoUpdate the release notes following r302182.
Glen Barber [Fri, 24 Jun 2016 23:42:33 +0000 (23:42 +0000)]
Update the release notes following r302182.

Approved by: re (implicit, relnotes)
Sponsored by: The FreeBSD Foundation

8 years agoTurn off MSI-X interrupt migration by default in EC2 instances; this works
Colin Percival [Fri, 24 Jun 2016 23:39:44 +0000 (23:39 +0000)]
Turn off MSI-X interrupt migration by default in EC2 instances; this works
around a bug in older versions of Xen and unbreaks SR-IOV (aka. "EC2
Enhanced Networking").

Approved by: re (gjb)
Thanks to: jhb, Jeremiah Lott

8 years agourtwn: fix memory leak on device restart
Andriy Voskoboinyk [Fri, 24 Jun 2016 23:36:22 +0000 (23:36 +0000)]
urtwn: fix memory leak on device restart

Free data buffers every time when device is stopped, not when
it is detached; they are allocated at the initialization stage.

How-to-reproduce:
1) ifconfig wlan0 create wlandev urtwn0 up
2) vmstat -m | grep USBdev
3) service netif restart
4) vmstat -m | grep USBdev

Also, remove usbd_transfer_drain() call; it is already called by
usbd_transfer_unsetup().

Tested with RTL8188CUS, STA mode.

Approved by: re (marius)

8 years agoRevert r301551, which added blacklistd(8) to sshd(8).
Glen Barber [Fri, 24 Jun 2016 23:22:42 +0000 (23:22 +0000)]
Revert r301551, which added blacklistd(8) to sshd(8).

This change has functional impact, and other concerns raised
by the OpenSSH maintainer.

Requested by: des
PR: 210479 (related)
Approved by: re (marius)
Sponsored by: The FreeBSD Foundation

8 years agoAdd a tunable to disable migration of MSI-X interrupts.
John Baldwin [Fri, 24 Jun 2016 22:49:32 +0000 (22:49 +0000)]
Add a tunable to disable migration of MSI-X interrupts.

The new 'machdep.disable_msix_migration' tunable can be set to 1 to
disable migration of MSI-X interrupts.

Xen versions prior to 4.6.0 do not properly handle updates to MSI-X
table entries after the initial write.  In particular, the operation
to unmask a table entry after updating it during migration is not
propagated to the "real" table for passthrough devices causing the
interrupt to remain masked.  At least some systems in EC2 are
affected by this bug when using SRIOV.  The tunable can be set in
loader.conf as a workaround.

Submitted by: Jeremiah Lott <jlott@averesystems.com> (original patch)
Approved by: re (marius)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D6947

8 years agoFix bitstring allocation on 32-bit platforms
Alan Somers [Fri, 24 Jun 2016 21:44:46 +0000 (21:44 +0000)]
Fix bitstring allocation on 32-bit platforms

sys/sys/bitstring.h
Fix a rounding calculation that could undersize a bitstring on
32-bit platforms.

tests/sys/sys/bitstring_test.h
Add a test for bitstr_size

PR: 210260
Reported by: Mark Millard
Reviewed by: gibbs
Approved by: re (marius)
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6848

8 years agogcore: Forward pending signals when detaching from the target.
Mark Johnston [Fri, 24 Jun 2016 20:21:32 +0000 (20:21 +0000)]
gcore: Forward pending signals when detaching from the target.

Otherwise gcore's ptrace attach operation can race with delivery of a
signal and cause it to be lost.

In collaboration with: Suraj Raju <sraju@isilon.com>
Reviewed by: bdrewery
Approved by: re (gjb, kib)
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoRegenerate
Bryan Drewery [Fri, 24 Jun 2016 20:00:39 +0000 (20:00 +0000)]
Regenerate

Approved by: re (implicit, r302177)

8 years agoWITH_SYSTEM_COMPILER: Enable by default
Bryan Drewery [Fri, 24 Jun 2016 19:55:59 +0000 (19:55 +0000)]
WITH_SYSTEM_COMPILER: Enable by default

This improves buildworld, toolchain, kernel-toolchain, and universe targets.
See r300354 or src.conf(5) for more details.

Approved by: re (gjb)
Relnotes: yes (r300354)
Sponsored by: EMC / Isilon Storage Division

8 years agobsd.prog.mk: add "/usr/lib" to list of base system directories
Ed Maste [Fri, 24 Jun 2016 18:45:16 +0000 (18:45 +0000)]
bsd.prog.mk: add "/usr/lib" to list of base system directories

kgzldr.o is installed into /usr/lib but using bsd.prog.mk. Add
/usr/lib to the base system directory list so that debug files are
installed into /usr/lib/debug/usr/lib, not /usr/lib/.debug .

Approved by: re (gjb)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

8 years agoAdd pci_get_max_payload() to fetch the PCI-express maximum payload size.
John Baldwin [Fri, 24 Jun 2016 17:26:42 +0000 (17:26 +0000)]
Add pci_get_max_payload() to fetch the PCI-express maximum payload size.

Approved by: re (gjb)
MFC after: 2 weeks
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D6951

8 years agoFix "sysctl vm.vmtotal" output on machines with > 2TB virtual memory
Alan Somers [Fri, 24 Jun 2016 14:58:37 +0000 (14:58 +0000)]
Fix "sysctl vm.vmtotal" output on machines with > 2TB virtual memory

sbin/sysctl/sysctl.c
Fix integer overflows in printf format strings

PR: 199673
Submitted by: Vitaly Magerya
Reviewed by: cem
Approved by: re (marius)
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6941

8 years agoThe void isn't void.
Bjoern A. Zeeb [Fri, 24 Jun 2016 11:53:12 +0000 (11:53 +0000)]
The void isn't void.

Unbreak sparc64 and powerpc builds.

Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
MFC after: 12 days

8 years agoResolve issue with libusb C++ header file inclusion.
Hans Petter Selasky [Fri, 24 Jun 2016 10:55:14 +0000 (10:55 +0000)]
Resolve issue with libusb C++ header file inclusion.

Approved by: re (marius)
PR: 210509
MFC after: 1 week

8 years agoUpdate head to ALPHA5 in preparation of new snapshot builds.
Glen Barber [Fri, 24 Jun 2016 00:05:45 +0000 (00:05 +0000)]
Update head to ALPHA5 in preparation of new snapshot builds.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

8 years agoRename CAM_NETFLIX_IOSCHED to CAM_IOSCHED_DYNAMIC to better reflect
Warner Losh [Thu, 23 Jun 2016 23:20:58 +0000 (23:20 +0000)]
Rename CAM_NETFLIX_IOSCHED to CAM_IOSCHED_DYNAMIC to better reflect
its nature.

Approved by: re
Reviewed By: jhb
Differential Revision: https://reviews.freebsd.org/D6811

8 years agoFix gstat's interactive f and q commands
Alan Somers [Thu, 23 Jun 2016 23:13:14 +0000 (23:13 +0000)]
Fix gstat's interactive f and q commands

curses and libedit don't play well together. After last year's libedit
upgrade in head, they play even less well together. This change resets some
curses settings after they get screwed up by libedit calls. Without it,
gstat's interactive commands require an extra "enter", screw up the terminal
on exit, and screw up the display if the user enters an invalid filter
string.

PR: 204852
Submitted by: Keith White
Reviewed by: pfg
Approved by: re (gjb)
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6934

8 years agoProerply virtualize pfsync for bringup after pf is initialized and
Bjoern A. Zeeb [Thu, 23 Jun 2016 22:31:44 +0000 (22:31 +0000)]
Proerply virtualize pfsync for bringup after pf is initialized and
teardown of VNETs once pf(4) has been shut down.
Properly split resources into VNET_SYS(UN)INITs and one time module
loading.
While here cover the INET parts in the uninit callpath with proper
#ifdefs.

Approved by: re (gjb)
Obtained from:  projects/vnet
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation

8 years agoMake sure pflog is attached after pf is initializaed so we can
Bjoern A. Zeeb [Thu, 23 Jun 2016 22:31:10 +0000 (22:31 +0000)]
Make sure pflog is attached after pf is initializaed so we can
borrow pf's lock, and also make sure pflog goes after pf is gone
in order to avoid callouts in VNETs to an already freed instance.

Reported by:    Ivan Klymenko, Johan Hendriks  on current@ today
Obtained from:  projects/vnet
Sponsored by:   The FreeBSD Foundation
MFC after:      13 days
Approved by: re (gjb)

8 years agoPFSTATE_NOSYNC goes onto state_flags, not sync_state;
Bjoern A. Zeeb [Thu, 23 Jun 2016 21:42:43 +0000 (21:42 +0000)]
PFSTATE_NOSYNC goes onto state_flags, not sync_state;
this prevents: panic: pfsync_delete_state: unexpected sync state 8

Reviewed by: kp
Approved by: re (gjb)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D6942

8 years agoUpdate pf(4) and pflog(4) to survive basic VNET testing, which includes
Bjoern A. Zeeb [Thu, 23 Jun 2016 21:34:38 +0000 (21:34 +0000)]
Update pf(4) and pflog(4) to survive basic VNET testing, which includes
proper virtualisation, teardown, avoiding use-after-free, race conditions,
no longer creating a thread per VNET (which could easily be a couple of
thousand threads), gracefully ignoring global events (e.g., eventhandlers)
on teardown, clearing various globally cached pointers and checking
them before use.

Reviewed by: kp
Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D6924

8 years agoTry to avoid a 2nd conditional by re-writing the loop, pause, and
Bjoern A. Zeeb [Thu, 23 Jun 2016 21:32:52 +0000 (21:32 +0000)]
Try to avoid a 2nd conditional by re-writing the loop, pause, and
escape clause another time.

Submitted by: jhb
Approved by: re (gjb)
MFC after: 12 days

8 years agoFix two typos in r302152.
Brooks Davis [Thu, 23 Jun 2016 21:09:07 +0000 (21:09 +0000)]
Fix two typos in r302152.

Approved by: re (implicit)

8 years agoAdd spares to struct ifnet and socket for packet pacing and/or general
Navdeep Parhar [Thu, 23 Jun 2016 21:07:15 +0000 (21:07 +0000)]
Add spares to struct ifnet and socket for packet pacing and/or general
use.  Update comments regarding the spare fields in struct inpcb.

Bump __FreeBSD_version for the changes to the size of the structures.

Reviewed by: gnn@
Approved by: re@ (gjb@)
Sponsored by: Chelsio Communications

8 years agoAdd an UPDATING entry for the pipe() -> pipe2() transition.
Brooks Davis [Thu, 23 Jun 2016 21:02:05 +0000 (21:02 +0000)]
Add an UPDATING entry for the pipe() -> pipe2() transition.

Approved by: re (gjb)
Sponsored by: DARPA, AFRL

8 years agoposixshm: Fix lock leak when mac_posixshm_check_read rejects read.
Jilles Tjoelker [Thu, 23 Jun 2016 20:59:13 +0000 (20:59 +0000)]
posixshm: Fix lock leak when mac_posixshm_check_read rejects read.

While reading the code, I noticed that shm_read() returns without unlocking
foffset and rangelock if mac_posixshm_check_read() rejects the read.

Reviewed by: kib, jhb, rwatson
Approved by: re (gjb)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D6927

8 years agoSwitch geom_disk over to using a pool mutex.
Kenneth D. Merry [Thu, 23 Jun 2016 20:05:59 +0000 (20:05 +0000)]
Switch geom_disk over to using a pool mutex.

The GEOM disk d_mtx is only acquired on disk creation and destruction.
It is a good candidate for replacement with a pool mutex.  This eliminates
the mutex initialization and teardown and the mutex and name variables
themselves from struct disk.

sys/geom/geom_disk.h:
Take d_mtx and d_mtx_name out of struct disk.

sys/geom/geom_disk.c:
Use mtx_pool_lock() and mtx_pool_unlock() to guard the disk
initialization state instead of a dedicated mutex.

This allows removing the initialization and destruction of
d_mtx.

sys/sys/param.h:
Bump __FreeBSD_version to 1100119 for the change to struct disk.

Suggested by: jhb
Sponsored by: Spectra Logic
Approved by: re (gjb)

8 years agoAdd support for a /etc/defaults/vendor.conf override file
Kurt Lidl [Thu, 23 Jun 2016 19:37:00 +0000 (19:37 +0000)]
Add support for a /etc/defaults/vendor.conf override file

Reviewed by: stas, imp
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D6895

8 years agoFix a bug in the handling of non-blocking SCTP 1-to-1 sockets. When using
Michael Tuexen [Thu, 23 Jun 2016 19:27:29 +0000 (19:27 +0000)]
Fix a bug in the handling of non-blocking SCTP 1-to-1 sockets. When using
this code in the userland stack, it could result in a loop. This happened on iOS.
However, I was not able to reproduce this when using the code in the kernel.
Thanks to Eugen-Andrei Gavriloaie for reporting the issue and proving detailed
information to find the root of the problem.

Approved by: re (gjb)
MFC after: 1 week

8 years agoUse M_NOWAIT when allocating memory for the ACPI wakeup handler.
Mark Johnston [Thu, 23 Jun 2016 19:24:38 +0000 (19:24 +0000)]
Use M_NOWAIT when allocating memory for the ACPI wakeup handler.

If the allocation attempt fails, we may otherwise VM_WAIT after a failed
attempt to reclaim contiguous memory in the requested range. After r297466,
this results in the thread going to sleep, causing a hang during boot.

Reviewed by: jkim, kib
Approved by: re (gjb)
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6945

8 years agomakeroot: zero out subsecond component of time= keywords
Ed Maste [Thu, 23 Jun 2016 19:19:44 +0000 (19:19 +0000)]
makeroot: zero out subsecond component of time= keywords

They are currently not supported by makefs(1).

PR: 194703
Reviewed by: brooks
Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D6925

8 years agobsdinstall: increase EFI partition size to 200MB
Ed Maste [Thu, 23 Jun 2016 18:04:48 +0000 (18:04 +0000)]
bsdinstall: increase EFI partition size to 200MB

A larger EFI file system size will facilitate multi-boot configurations
and the installation other EFI applications like firmware update tools.
200MB matches OS X.

Note that this changes only the partition size, not the file system that
bsdinstall places there. We need to do both, but as the partition size
is difficult to adjust later make this change for now so that at least
systems installed with FreeBSD 11.0 have a partition layout with room
to grow.

Reviewed by: allanjude, imp
Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D6935

8 years agoRaise the WARNS level in cddl/lib
Alan Somers [Thu, 23 Jun 2016 15:02:57 +0000 (15:02 +0000)]
Raise the WARNS level in cddl/lib

cddl/lib/libavl/Makefile
cddl/lib/libctf/Makefile
cddl/lib/libnvpair/Makefile
cddl/lib/libumem/Makefile
cddl/lib/libuutil/Makefile
Increase WARNS to the highest working level for each of these
libraries

Approved by: re (gjb, hrs)
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp

8 years agoIn VNET TCP teardown Do not sleep unconditionally but only if we
Bjoern A. Zeeb [Thu, 23 Jun 2016 11:55:15 +0000 (11:55 +0000)]
In VNET TCP teardown Do not sleep unconditionally but only if we
have any TCP connections left.

Submitted by: zec
Approved by: re (hrs)
MFC after: 13 days

8 years agoUse correct Q-counter output array.
Hans Petter Selasky [Thu, 23 Jun 2016 09:23:37 +0000 (09:23 +0000)]
Use correct Q-counter output array.

Sponsored by: Mellanox Technologies
Approved by: re (kib)
MFC after: 3 days

8 years agoDon't consider the socket when processing an incoming ICMP/ICMP6 packet,
Michael Tuexen [Thu, 23 Jun 2016 09:13:15 +0000 (09:13 +0000)]
Don't consider the socket when processing an incoming ICMP/ICMP6 packet,
which was triggered by an SCTP packet. Whether a socket exists, is just
not relevant.

Approved by: re (kib)
MFC after: 1 week

8 years agoIn vm_page_xunbusy_maybelocked(), add fast path for unbusy when no
Konstantin Belousov [Thu, 23 Jun 2016 08:28:13 +0000 (08:28 +0000)]
In vm_page_xunbusy_maybelocked(), add fast path for unbusy when no
waiters exist, same as for vm_page_xunbusy().  If previous value of
busy_lock was VPB_SINGLE_EXCLUSIVER, no waiters existed and wakeup is
not needed.

Move common code from vm_page_xunbusy_maybelocked() and
vm_page_xunbusy_hard() to vm_page_xunbusy_locked().

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)

8 years agoAdd a comment noting locking regime for vm_page_xunbusy().
Konstantin Belousov [Thu, 23 Jun 2016 08:27:38 +0000 (08:27 +0000)]
Add a comment noting locking regime for vm_page_xunbusy().

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)

8 years agoAdd support for USB streams to the LibUSB v1.0 API and update the
Hans Petter Selasky [Thu, 23 Jun 2016 07:12:22 +0000 (07:12 +0000)]
Add support for USB streams to the LibUSB v1.0 API and update the
libusb(3) manual page.

Approved by: re (gjb)
Requested by: swills
MFC after: 1 week

8 years agofix deadlock-prone code in getzfsvfs()
Andriy Gapon [Thu, 23 Jun 2016 07:01:54 +0000 (07:01 +0000)]
fix deadlock-prone code in getzfsvfs()

getzfsvfs() called vfs_busy() in the waiting mode while having a hold on
a pool (via a call to dmu_objset_hold).  In other words,
dp_config_rwlock was held in the shared mode while a thread could be
sleeping in vfs_busy().
The pool's txg sync thread needs to take dp_config_rwlock in the
exclusive mode for some actions, e.g., for executing sync tasks.  If the
sync thread gets blocked, then any thread waiting for its sync task to
get executed is also blocked.  Which, in turn, could mean that
vfs_busy() will keep waiting indefinitely.

The solution is to use vfs_ref() in the locked section and to call
vfs_busy() only after dropping other locks.
Note that a reference on a struct mount object does not prevent an
associated zfsvfs_t object from being destroyed.  So, we have to be
careful to operate only on the struct mount object until we successfully
vfs_busy it.

Approved by: re (gjb)
MFC after: 2 weeks

8 years agoImport a fix for and old security issue (CVE-2010-3830) in pf which
Bjoern A. Zeeb [Thu, 23 Jun 2016 05:41:46 +0000 (05:41 +0000)]
Import a fix for and old security issue (CVE-2010-3830) in pf which
was not relevant to FreeBSD as only root could open /dev/pf by default.
With VIMAGE this is will longer be the case.  As pf(4) starts to
be supported with VNETs 3rd party users may open /dev/pf inside the
virtual jail instance; thus we need to address this issue after all.
While OpenBSD largely rewrote code parts for the fix [1], and it's
unclear what Apple [3] did, import the minimal fix from NetBSD [2].

[1] http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/net/pf_ioctl.c.diff?r1=1.235&r2=1.236
[2] http://mail-index.netbsd.org/source-changes/2011/01/19/msg017518.html
[3] https://support.apple.com/en-gb/HT202154

Obtained from: http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dist/pf/net/pf_ioctl.c.diff?r1=1.42&r2=1.43&only_with_tag=MAIN
MFC After: 2 weeks
Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
Security: CVE-2010-3830

8 years agocxgbe(4): Merge netmap support from the ncxgbe/ncxl interfaces to the
Navdeep Parhar [Thu, 23 Jun 2016 02:53:00 +0000 (02:53 +0000)]
cxgbe(4): Merge netmap support from the ncxgbe/ncxl interfaces to the
vcxgbe/vcxl interfaces and retire the 'n' interfaces.  The main
cxgbe/cxl interfaces and tunables related to them are not affected by
any of this and will continue to operate as usual.

The driver used to create an additional 'n' interface for every
cxgbe/cxl interface if "device netmap" was in the kernel.  The 'n'
interface shared the wire with the main interface but was otherwise
autonomous (with its own MAC address, etc.).  It did not have normal
tx/rx but had a specialized netmap-only data path.  r291665 added
another set of virtual interfaces (the 'v' interfaces) to the driver.
These had normal tx/rx but no netmap support.

This revision consolidates the features of both the interfaces into the
'v' interface which now has a normal data path, TOE support, and native
netmap support.  The 'v' interfaces need to be created explicitly with
the hw.cxgbe.num_vis tunable.  This means "device netmap" will not
result in the automatic creation of any virtual interfaces.

The following tunables can be used to override the default number of
queues allocated for each 'v' interface.  nofld* = 0 will disable TOE on
the virtual interface and nnm* = 0 to will disable native netmap
support.

# number of normal NIC queues
hw.cxgbe.ntxq_vi
hw.cxgbe.nrxq_vi

# number of TOE queues
hw.cxgbe.nofldtxq_vi
hw.cxgbe.nofldrxq_vi

# number of netmap queues
hw.cxgbe.nnmtxq_vi
hw.cxgbe.nnmrxq_vi

hw.cxgbe.nnm{t,r}xq{10,1}g tunables have been removed.

--- tl;dr version ---
The workflow for netmap on cxgbe starting with FreeBSD 11 is:
1) "device netmap" in the kernel config.
2) "hw.cxgbe.num_vis=2" in loader.conf.  num_vis > 2 is ok too, you'll
end up with multiple autonomous netmap-capable interfaces for every
port.
3) "dmesg | grep vcxl | grep netmap" to verify that the interface has
netmap queues.
4) Use any of the 'v' interfaces for netmap.  pkt-gen -i vcxl<n>... .
One major improvement is that the netmap interface has a normal data
path as expected.
5) Just ignore the cxl interfaces if you want to use netmap only.  No
need to bring them up.  The vcxl interfaces are completely independent
and everything should just work.
---------------------

Approved by: re@ (gjb@)
Relnotes: Yes
Sponsored by: Chelsio Communications

8 years agorevert error commit from previous commit. my bad!
Adrian Chadd [Thu, 23 Jun 2016 01:15:35 +0000 (01:15 +0000)]
revert error commit from previous commit. my bad!

Approved by: re (implicit)

8 years ago[BHND/bcma] Add implementation of BHND_BUS_RESET_CORE function for BCMA
Adrian Chadd [Thu, 23 Jun 2016 01:14:33 +0000 (01:14 +0000)]
[BHND/bcma] Add implementation of BHND_BUS_RESET_CORE function for BCMA

This patch addes missing implementation of BHND_BUS_RESET_CORE function for BCMA.
The reset procedure is very simple: enable reset mode, stop clocking,
enable clocking & force clock gating, disable reset mode, stop clock gating.

Tested:

* (michael) Tested on ASUS RT-N53 for enabling/reset USB core

Submitted by: Michael Zhilin <mizhka@gmail.com>
Approved by: re (gjb)

8 years ago[iwm] Use mbuf for large firmware commands, like OpenBSD does.
Adrian Chadd [Thu, 23 Jun 2016 01:13:30 +0000 (01:13 +0000)]
[iwm] Use mbuf for large firmware commands, like OpenBSD does.

We also need to consider the size of large firmware commands in iwm_alloc_tx_ring(),
in the dma tag creation, when qid == IWM_MVM_CMD_QUEUE. The old code apparently
only allocated a 2KB (MCLBYTES) sized buffer when it actually expected 4KB.

Submitted by: Imre Vadasz <imre@vdsz.com>
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D6824

8 years ago[iwm] Add and use iwm_phy_db_free(), to plug phy_db memory leak.
Adrian Chadd [Thu, 23 Jun 2016 01:11:52 +0000 (01:11 +0000)]
[iwm] Add and use iwm_phy_db_free(), to plug phy_db memory leak.

(Together with other iwm(4) memory leak fixes) Memory leakage in M_DEVBUF
is now at ca. 2KB for each iwm(4) module load/unload cycle.

Submitted by: Imre Vadasz <imre@vdsz.com>
Approved by: re (gjb)
Obtained from: DragonflyBSD git eaf551a1d464c643e98ce5781971dd32124e9af1
Differential Revision: https://reviews.freebsd.org/D6819

8 years ago[iwm] Fix iwm_dma_contig_free(). dma->map is always NULL here.
Adrian Chadd [Thu, 23 Jun 2016 01:00:13 +0000 (01:00 +0000)]
[iwm] Fix iwm_dma_contig_free(). dma->map is always NULL here.

* When bus_dmamem_alloc is used, the bus_dmamap_t is usually set to NULL, so
  we were never actually freeing any dma memory allocations done via
  iwm_dma_contig_alloc(). So we should check dma->vaddr instead of dma->map here.

* Also, the dmamap is actually supposed to be invalidated as part of
  bus_dmamem_free(), so bus_dmamap_destroy() is never needed here.

Submitted by: Imre Vadasz <imre@vdsz.com>
Approved by: re (gjb)
Obtained from: DragonflyBSD git ef2b29a7ba6ca8a9d2c82ab591c0622227ff84cb

8 years ago[iwm] Use vap->iv_myaddr instead of ic->ic_macaddr when vap != NULL.
Adrian Chadd [Thu, 23 Jun 2016 00:56:54 +0000 (00:56 +0000)]
[iwm] Use vap->iv_myaddr instead of ic->ic_macaddr when vap != NULL.

ic_macaddr is only used for the initial mac address provided by NVM. We should
rather use vap->iv_myaddr when vap != NULL, to allow the MAC address
to be changed later with ifconfig(8).

Submitted by: Imre Vadasz <imre@vdsz.com>
Reviewed by: avos
Approved by: re (gjb)
Obtained from: DragonflyBSD git 4aee7a78275676d22d14c04177bd0c9377d91478
Differential Revision: https://reviews.freebsd.org/D6743

8 years ago[ath] fix comments!
Adrian Chadd [Thu, 23 Jun 2016 00:54:14 +0000 (00:54 +0000)]
[ath] fix comments!

I keep asking myself "what do these fields mean" and so now I've clarified
it for myself.

Tested:

* Reading the comments, going "a-ha!" a couple times.

Approved by: re (gjb)

8 years agoCheck the V_tcbinfo.ipi_count to hit 0 before doing the full TCP cleanup.
Bjoern A. Zeeb [Thu, 23 Jun 2016 00:34:03 +0000 (00:34 +0000)]
Check the V_tcbinfo.ipi_count to hit 0 before doing the full TCP cleanup.
That way timers can finish cleanly and we do not gamble with a DELAY().

Reviewed by: gnn, jtl
Approved by: re (gjb)
Obtained from: projects/vnet
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D6923

8 years agoNo longer mark TCP TW zone NO_FREE.
Bjoern A. Zeeb [Thu, 23 Jun 2016 00:32:58 +0000 (00:32 +0000)]
No longer mark TCP TW zone NO_FREE.
Timewait code does a proper cleanup after itself.

Reviewed by: gnn
Approved by: re (gjb)
Obtained from: projects/vnet
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D6922

8 years agoRegen post r302096 and implement svr4_pipe().
Brooks Davis [Thu, 23 Jun 2016 00:30:09 +0000 (00:30 +0000)]
Regen post r302096 and implement svr4_pipe().

Approved by: re (implict, fixing build)
Sponsored by: DARPA, AFRL

8 years agoDeclare a svr4 version of pipe() now that sys_pipe() is no more.
Brooks Davis [Thu, 23 Jun 2016 00:29:03 +0000 (00:29 +0000)]
Declare a svr4 version of pipe() now that sys_pipe() is no more.

Approved by: re (implicit, fixing build)
Sponsored by: DARPA, AFRL

8 years agoGenerate syscall tables and update pipe() implementation after r302094.
Brooks Davis [Wed, 22 Jun 2016 21:18:19 +0000 (21:18 +0000)]
Generate syscall tables and update pipe() implementation after r302094.

Mark the pipe() system call as COMPAT10.

As of r302092 libc uses pipe2() with a zero flags value instead of pipe().

Approved by: re (gjb)
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D6816

8 years agoMark the pipe() system call as COMPAT10.
Brooks Davis [Wed, 22 Jun 2016 21:15:59 +0000 (21:15 +0000)]
Mark the pipe() system call as COMPAT10.

As of r302092 libc uses pipe2() with a zero flags value instead of pipe().

Commit with regenerated files and implementation to follow.

Approved by: re (gjb)
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D6816

8 years agoAdd support for COMPAT10 keywords in syscalls.master.
Brooks Davis [Wed, 22 Jun 2016 21:12:53 +0000 (21:12 +0000)]
Add support for COMPAT10 keywords in syscalls.master.

Approved by: re (gjb)
Sponsored by: DARPA, AFRL

8 years agoReplace use of the pipe(2) system call with pipe2(2) with a zero flags
Brooks Davis [Wed, 22 Jun 2016 21:11:27 +0000 (21:11 +0000)]
Replace use of the pipe(2) system call with pipe2(2) with a zero flags
value.

This eliminates the need for machine dependant assembly wrappers for
pipe(2).

It also make passing an invalid address to pipe(2) return EFAULT rather
than triggering a segfault.  Document this behavior (which was already
true for pipe2(2), but undocumented).

Reviewed by: andrew
Approved by: re (gjb)
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D6815

8 years agoDo not complete pending gmirror BIOs when tearing down the provider.
Mark Johnston [Wed, 22 Jun 2016 21:00:28 +0000 (21:00 +0000)]
Do not complete pending gmirror BIOs when tearing down the provider.

This will result in lock recursion and is more generally incorrect since
the completion handlers will just reinsert the BIOs into the queue we're
trying to drain.

Reviewed by: imp, ngie
Approved by: re (gjb)
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6908

8 years agoAdd AFLAGS.IMPSRC and document A[C]FLAGS
Bryan Drewery [Wed, 22 Jun 2016 20:31:49 +0000 (20:31 +0000)]
Add AFLAGS.IMPSRC and document A[C]FLAGS

Approved by: re (gjb)
Sponsored by: EMC / Isilon Storage Division

8 years agoFix a LOR between vnode locks and allproc_lock.
Konstantin Belousov [Wed, 22 Jun 2016 20:15:37 +0000 (20:15 +0000)]
Fix a LOR between vnode locks and allproc_lock.

There is an order between covered vnode lock and allproc_lock, which
is established by calling mountcheckdirs() while owning the covered
vnode lock. mountcheckdirs() iterates over the processes, protected by
allproc_lock.  This order is needed and seems to be not avoidable.

On the other hand, various VM daemons also need to iterate over all
processes, and they lock and unlock user maps.  Since unlock of the
user map may trigger processing of the deferred map entries, it causes
vnode locking to occur.  Or, when vmspace is freed, dropping references
on the vnode-backed object also lock vnodes.  We get reverted order
comparing with the mount/unmount order.

For VM daemons, there is no need to own allproc_lock while we operate
on vmspaces. If the process is held, it serves as the marker for
allproc list, which allows to continue the iteration.

Add _PHOLD_LITE() macro, similar to _PHOLD(), but not causing swap-in
of the kernel stacks.  It is used instead of _PHOLD() in vm code,
since e.g. calling faultin() in OOM conditions only exaggerates the
problem.

Modernize comment describing PHOLD.

Reported by: lists@yamagi.org
Tested by: pho (previous version)
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 3 week
Approved by: re (gjb)
Differential revision: https://reviews.freebsd.org/D6679

8 years agoWITH_META_MODE: Whitelist 'make kernel-toolchain'
Bryan Drewery [Wed, 22 Jun 2016 19:07:41 +0000 (19:07 +0000)]
WITH_META_MODE: Whitelist 'make kernel-toolchain'

Approved by: re (blanket, META_MODE)
Sponsored by: EMC / Isilon Storage Division

8 years agoFix a bug that caused da(4) peripheral drivers to not fully go away
Kenneth D. Merry [Wed, 22 Jun 2016 14:39:13 +0000 (14:39 +0000)]
Fix a bug that caused da(4) peripheral drivers to not fully go away
after the underlying device went away.

The problem was that callers who queue the GEOM resize provider
event didn't check to make sure that the provider had not been
withered.  For the other equivalent case, g_new_provider_event(),
the code checks to see whether the provider has been withered
before queueing a g_new_provider_event() to the event thread.

In some cases, a resize provider event would come through after
the provider had been withered and all of the existing consumers
had been orphaned.  When the resize event triggered a taste of
the provider, that would attach a new consumer to the now
withered provider.  The wither washer (g_wither_washer() would
never be able to completely tear down the GEOM because of the
consumers that were hanging around.

The solution was to check the G_PF_WITHER provider flag before
queueing the g_resize_provider_event(), and add an assert to
g_resize_provider_event() to insure that it isn't called on a
withered provider.

sys/geom/geom_subr.c:
In g_resize_provider(), don't try to continue if the
G_PF_WITHER flag is set.

In g_resize_provider_event(), add an assert that the
G_PF_WITHER flag is not set.

In g_access(), if a provider has an error, print out the
name of the provider with the error.

Sponsored by: Spectra Logic
Approved by: re (marius)
MFC after: 3 days

8 years agoAdd more fields to if_debug.c for ddb(4) 'show ifnet'; resort
Bjoern A. Zeeb [Wed, 22 Jun 2016 12:53:10 +0000 (12:53 +0000)]
Add more fields to if_debug.c for ddb(4) 'show ifnet';  resort
some fields to match the order in the struct.  Especially needed
if_pf_kif to do pf(4) VNET debugging.

Approved by: re (marius)
Obtained from: projects/vnet
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

8 years agoFix a race when the hardware has raised an exception with an unknown or
Andrew Turner [Wed, 22 Jun 2016 12:05:08 +0000 (12:05 +0000)]
Fix a race when the hardware has raised an exception with an unknown or
uncategorised reason. We need to read the fault address register before
enabling interrupts as the interrupt handler may cause this register to
change.

Approved by: re (marius, kib)
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

8 years agoAfter r302054 unloading an network interface driver on a kernel
Bjoern A. Zeeb [Wed, 22 Jun 2016 11:45:30 +0000 (11:45 +0000)]
After r302054 unloading an network interface driver on a kernel
without VIMAGE support would dereference a NULL point unconditionally
leading to a panic.  Wrap the entire VIMAGE related code with #ifdefs
rather than just the decision making part to save an extra bit of
resources.

Reported by: np
Sponsored by: The FreeBSD Foundation
MFC After: 13 days
Approved by: re (marius)

8 years agoFix the NULL pointer dereference for unresolved link layer entries in
Andrey V. Elsukov [Wed, 22 Jun 2016 11:29:21 +0000 (11:29 +0000)]
Fix the NULL pointer dereference for unresolved link layer entries in
the netinet6 code. Copy link layer address only when corresponding entry
has LLE_VALID flag.

PR: 210379
Approved by: re (kib)

8 years agoImplement libusb_hotplug_register_callback() and
Hans Petter Selasky [Wed, 22 Jun 2016 10:38:41 +0000 (10:38 +0000)]
Implement libusb_hotplug_register_callback() and
libusb_hotplug_deregister_callback() for the LibUSB v1.0 API and
update the libusb(3) manual page.

Approved by: re (kib)
Requested by: swills
MFC after: 1 week

8 years agoUpdate the definition for number of scratch pages to match the latest
Hans Petter Selasky [Wed, 22 Jun 2016 09:03:55 +0000 (09:03 +0000)]
Update the definition for number of scratch pages to match the latest
version of the XHCI specification. Make sure the code can handle the
maximum number of allowed scratch pages.

Submitted by: Shichun_Ma@Dell.com
Approved by: re (hrs)
MFC after: 1 week

8 years agoMFV r302003,r302037,r302038,r302056:
Martin Matuska [Wed, 22 Jun 2016 07:49:59 +0000 (07:49 +0000)]
MFV r302003,r302037,r302038,r302056:

Update libarchive to 3.2.1 (bugfix and security fix release)

List of vendor fixes:
- fix exploitable heap overflow vulnerability in Rar decompression
  (vendor issue 719, CVE-2016-4302, TALOS-2016-0154)
- fix exploitable stack based buffer overflow vulnebarility in mtree
  parse_device functionality (vendor PR 715, CVE-2016-4301, TALOS-2016-0153)
- fix exploitable heap overflow vulnerability in 7-zip read_SubStreamsInfo
  (vendor issue 718, CVE-2016-4300, TALOS-2016-152)
- fix integer overflow when computing location of volume descriptor
  (vendor issue 717)
- fix buffer overflow when reading a crafred rar archive (vendor issue 521)
- fix possible buffer overflow when reading ISO9660 archives on machines
  where sizeof(int) < sizeof(size_t) (vendor issue 711)
- tar and cpio should fail if an input file named on the command line is
  missing (vendor issue 708)
- fix incorrect writing of gnutar filenames that are exactly 512 bytes
  long (vendor issue 682)
- allow tests to be run from paths that are equal or longer than 128
  characters (vendor issue 657)
- add memory allocation errors in archive_entry_xattr.c (vendor PR 603)
- remove dead code in archive_entry_xattr_add_entry() (vendor PR 716)
- fix broken decryption of ZIP files (vendor issue 553)
- manpage style, typo and description fixes

Post-3.2.1 vendor fixes:
- fix typo in cpio version reporting (Vendor PR 725, 726)
- fix argument range of ctype functions in libarchive_fe/passphrase.c
- fix ctype use and avoid empty loop bodies in WARC reader

MFC after: 1 week
Security: CVE-2016-4300, CVE-2016-4301, CVE-2016-4302
Approved by: re (kib)

8 years agoAccount for AIO socket operations in thread/process resource usage.
John Baldwin [Tue, 21 Jun 2016 22:19:06 +0000 (22:19 +0000)]
Account for AIO socket operations in thread/process resource usage.

File and disk-backed I/O requests store counts of read/written disk
blocks in each AIO job so that they can be charged to the thread that
completes an AIO request via aio_return() or aio_waitcomplete().  This
change extends AIO jobs to store counts of received/sent messages and
updates socket backends to set these counts accordingly.  Note that
the socket backends are careful to only charge a single messages for
each AIO request even though a single request on a blocking socket might
invoke sosend or soreceive multiple times.  This is to mimic the
resource accounting of synchronous read/write.

Adjust the UNIX socketpair AIO test to verify that the message resource
usage counts update accordingly for aio_read and aio_write.

Approved by: re (hrs)
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D6911

8 years agoMETA_MODE: Don't generate or read _EXTRADEPEND dependencies when using filemon.
Bryan Drewery [Tue, 21 Jun 2016 21:55:03 +0000 (21:55 +0000)]
META_MODE: Don't generate or read _EXTRADEPEND dependencies when using filemon.

The DPADD data in .depend will be redundant with what is in the .meta file.

Also extend NO_EXTRADEPEND support to bsd.prog.mk.

Approved by: re (blanket, META_MODE)
Sponsored by: EMC / Isilon Storage Division

8 years agoBump __FreeBSD_version to 1100118 for r302069, which breaks binary
Kenneth D. Merry [Tue, 21 Jun 2016 20:28:30 +0000 (20:28 +0000)]
Bump __FreeBSD_version to 1100118 for r302069, which breaks binary
compatibility for loadable modules that depend on struct disk.

Approved by: re (delphij)
Sponsored by: Spectra Logic

8 years agoFix a bug that caused da(4) instances to hang around after the underlying
Kenneth D. Merry [Tue, 21 Jun 2016 20:18:19 +0000 (20:18 +0000)]
Fix a bug that caused da(4) instances to hang around after the underlying
device is gone.

The problem was that when disk_gone() is called, if the GEOM disk
creation process has not yet happened, the withering process
couldn't start.

We didn't record any state in the GEOM disk code, and so the d_gone()
callback to the da(4) driver never happened.

The solution is to track the state of the creation process, and
initiate the withering process from g_disk_create() if the disk is
being created.

This change does add fields to struct disk, and so I have bumped
DISK_VERSION.

geom_disk.c: Track where we are in the disk creation process,
and check to see whether our underlying disk has
gone away or not.

In disk_gone(), set a new d_goneflag variable that
g_disk_create() can check to see if it needs to
clean up the disk instance.

geom_disk.h:    Add a mutex to struct disk (for internal use) disk
init level, and a gone flag.

Bump DISK_VERSION because the size of struct disk has
changed and fields have been added at the beginning.

Sponsored by: Spectra Logic
Approved by: re (marius)

8 years agoFix top-level builds with fmake / 9.x.
Bryan Drewery [Tue, 21 Jun 2016 20:14:32 +0000 (20:14 +0000)]
Fix top-level builds with fmake / 9.x.

Reported by: allanjude
Approved by: re (marius)
Sponsored by: EMC / Isilon Storage Division

8 years agoRevert the recent armv6 changes to ALIGNED_POINTER(), restoring the
Ian Lepore [Tue, 21 Jun 2016 17:53:42 +0000 (17:53 +0000)]
Revert the recent armv6 changes to ALIGNED_POINTER(), restoring the
fully-pessimized implementation that requires a type to be aligned to
its natural size.

On armv6+ the compiler might generate load-/store-multiple instructions
which require 4-byte alignment even though the source code is only
accessing individual uint32_t values in a way that doesn't require any
particular alignment at all.  The compiler apparently feels free to
combine multiple accesses into a single instruction that requires a
more-strict alignment, and no set of compiler flags seems to disable
this behavior (at least in clang 3.8).

This fixes alignment faults on arm systems using wifi adapters.  The
wifi code uses ALIGNED_POINTER(p, uint32_t) to decide whether it needs
to copy-align tcp headers.  Because clang is combining several uint32_t
accesses into a single ldm instruction, we need to say that accessing a
uint32_t requires 4-byte alignment.

Approved by: re(gjb)

8 years agoThe vmtotal sysctl handler marks active vm objects to calculate
Konstantin Belousov [Tue, 21 Jun 2016 17:49:33 +0000 (17:49 +0000)]
The vmtotal sysctl handler marks active vm objects to calculate
statistics.  Marking is done by setting the OBJ_ACTIVE flag.  The
flags change is locked, but the problem is that many parts of system
assume that vm object initialization ensures that no other code could
change the object, and thus performed lockless.  The end result is
corrupted flags in vm objects, most visible is spurious OBJ_DEAD flag,
causing random hangs.

Avoid the active object marking, instead provide equally inexact but
immutable is_object_alive() definition for the object mapped state.

Avoid iterating over the processes mappings altogether by using
arguably improved definition of the paging thread as one which sleeps
on the v_free_count.

PR: 204764
Diagnosed by: pho
Tested by: pho (previous version)
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Approved by: re (gjb)

8 years ago[ath] fix TX throughput for EDMA chips by pushing more into the TX FIFO.
Adrian Chadd [Tue, 21 Jun 2016 15:38:20 +0000 (15:38 +0000)]
[ath] fix TX throughput for EDMA chips by pushing more into the TX FIFO.

It turns out that getting decent performance requires stacking the TX
FIFO a little more aggressively.

* Ensure that when we complete a frame, we attempt to push a new frame
  into the FIFO so TX is kept as active as it needs to be
* Be more aggressive about batching non-aggregate frames into a single
  TX FIFO slot.  This "fixes" TDMA performance (since we only get one
  TX FIFO slot ungated per DMA beacon alert) but it does this by pushing
  a whole lot of work into the TX FIFO slot.

I'm not /entirely/ pleased by this solution, but it does fix a whole bunch
of corner case issues in the transmit side and fix TDMA whilst I'm at it.
I'll go revisit transmit packet scheduling in ath(4) post 11.

Tested:

* AR9380, STA mode
* AR9580, hostap mode
* AR9380, TDMA client mode

Approved by: re (hrs)

8 years agoFix uninitialized variable from r300881
Alan Somers [Tue, 21 Jun 2016 15:27:16 +0000 (15:27 +0000)]
Fix uninitialized variable from r300881

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Initialize needs_update in vdev_geom_set_physpath

PR: 210409
Reported by: kp
Reviewed by: kp
Approved by: re (hrs)
MFC after: 4 weeks
X-MFC-With: 300881
Sponsored by: Spectra Logic Corp

8 years agosyscons.4,vt.4: update kern.vty description reflecting vt as default
Ed Maste [Tue, 21 Jun 2016 14:16:32 +0000 (14:16 +0000)]
syscons.4,vt.4: update kern.vty description reflecting vt as default

rS274085 made vt(4) the default system console. Catch up to this in
the man page description for the kern.vty tunable.

Reviewed by: bz
Approved by: re (hrs)
Differential Revision: https://reviews.freebsd.org/D6901

8 years agoGet closer to a VIMAGE network stack teardown from top to bottom rather
Bjoern A. Zeeb [Tue, 21 Jun 2016 13:48:49 +0000 (13:48 +0000)]
Get closer to a VIMAGE network stack teardown from top to bottom rather
than removing the network interfaces first. This change is rather larger
and convoluted as the ordering requirements cannot be separated.

Move the pfil(9) framework to SI_SUB_PROTO_PFIL, move Firewalls and
related modules to their own SI_SUB_PROTO_FIREWALL.
Move initialization of "physical" interfaces to SI_SUB_DRIVERS,
move virtual (cloned) interfaces to SI_SUB_PSEUDO.
Move Multicast to SI_SUB_PROTO_MC.

Re-work parts of multicast initialisation and teardown, not taking the
huge amount of memory into account if used as a module yet.

For interface teardown we try to do as many of them as we can on
SI_SUB_INIT_IF, but for some this makes no sense, e.g., when tunnelling
over a higher layer protocol such as IP. In that case the interface
has to go along (or before) the higher layer protocol is shutdown.

Kernel hhooks need to go last on teardown as they may be used at various
higher layers and we cannot remove them before we cleaned up the higher
layers.

For interface teardown there are multiple paths:
(a) a cloned interface is destroyed (inside a VIMAGE or in the base system),
(b) any interface is moved from a virtual network stack to a different
network stack ("vmove"), or (c) a virtual network stack is being shut down.
All code paths go through if_detach_internal() where we, depending on the
vmove flag or the vnet state, make a decision on how much to shut down;
in case we are destroying a VNET the individual protocol layers will
cleanup their own parts thus we cannot do so again for each interface as
we end up with, e.g., double-frees, destroying locks twice or acquiring
already destroyed locks.
When calling into protocol cleanups we equally have to tell them
whether they need to detach upper layer protocols ("ulp") or not
(e.g., in6_ifdetach()).

Provide or enahnce helper functions to do proper cleanup at a protocol
rather than at an interface level.

Approved by: re (hrs)
Obtained from: projects/vnet
Reviewed by: gnn, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D6747

8 years agoAdd two missing test files in r302037
Martin Matuska [Tue, 21 Jun 2016 00:00:05 +0000 (00:00 +0000)]
Add two missing test files in r302037

8 years agoUpdate vendor/libarchive to git 139d0576b51a253732a5ab1f66805dffbf8b00af
Martin Matuska [Mon, 20 Jun 2016 23:55:33 +0000 (23:55 +0000)]
Update vendor/libarchive to git 139d0576b51a253732a5ab1f66805dffbf8b00af
tag v3.2.1

Fixed vendor issues:
Issue 521: Properly check reading from lzss decompression buffer
Issue 717: Fix integer overflow when computing location of volume
           descriptor
Issue 718: Security fix TALOS-CAN-152
Issue 719: Security fix TALOS-CAN-154

Security: TALOS-CAN-152, TALOS-CAN-154

8 years agoSkip sys/acl tests on systems lacking perl
Alan Somers [Mon, 20 Jun 2016 23:17:00 +0000 (23:17 +0000)]
Skip sys/acl tests on systems lacking perl

tests/sys/acl/Makefile
add perl to the required_programs for all tests in this directory

Reviewed by: ngie
Approved by: re (gjb)
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6870

8 years agortwn: fix Tx processing, add some busdma synchronization.
Andriy Voskoboinyk [Mon, 20 Jun 2016 22:45:19 +0000 (22:45 +0000)]
rtwn: fix Tx processing, add some busdma synchronization.

1) Unload mbuf instead of descriptor in rtwn_tx_done().
2) Add more synchronization for device visible mappings before
touching the memory.
3) Improve watchdog timer logic.

Reported and tested by: mva

Approved by: re (gjb)

8 years agourtwn: fix panic on device detach.
Andriy Voskoboinyk [Mon, 20 Jun 2016 22:39:32 +0000 (22:39 +0000)]
urtwn: fix panic on device detach.

Remove frames from active/pending Tx queues and free related node
references when vap is destroyed to prevent various use-after-free
scenarios.

Reported and tested by: Aleksander Alekseev <afiskon@devzen.ru>
PR: 208632
Approved by: re (gjb)

8 years ago- No log bit in IOCStatus and endian-safe changes.
Stephen McConnell [Mon, 20 Jun 2016 18:14:51 +0000 (18:14 +0000)]
- No log bit in IOCStatus and endian-safe changes.

Use MPI2_IOCSTATUS_MASK when checking IOCStatus to mask off the log bit, and
make a few more things endian-safe.

- Fix possible use of invalid pointer.

It was possible to use an invalid pointer to get the target ID value. To fix
this, initialize a local Target ID variable to an invalid value and change that
variable to a valid value only if the pointer to the Target ID is not NULL.

- No need to set the MPSSAS_SHUTDOWN flag because it's never used.

- done_ccb pointer can be used if it is NULL.

To prevent this, move check for done_ccb == NULL to before done_ccb is used in
mpssas_stop_unit_done().

- Disks can go missing until a reboot is done in some cases.

This is due to the DevHandle not being released, which causes the Firmware to
not allow that disk to be re-added.

Reviewed by: ken
Approved by: re (gjb), ken, scottl, ambrisko (mentors)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D6872

8 years ago[ath] implement TX queue configuration extensions for the AR9380 HAL.
Adrian Chadd [Mon, 20 Jun 2016 16:12:27 +0000 (16:12 +0000)]
[ath] implement TX queue configuration extensions for the AR9380 HAL.

Among other things, this introduces the idea of DBA-gated queues that
aren't the CABQ.  The TDMA support requires this.

Tested:

* AR9580 (hostap mode)
* AR9380 (sta mode)

Approved by: re (gjb)

8 years agoFix typo. Note that atomic is still required even for interlocked case.
Konstantin Belousov [Mon, 20 Jun 2016 15:45:50 +0000 (15:45 +0000)]
Fix typo.  Note that atomic is still required even for interlocked case.

Sponsored by: The FreeBSD Foundation
Approved by: re (marius)

8 years agoFix generation of locales with multiple variants
Baptiste Daroussin [Mon, 20 Jun 2016 06:45:42 +0000 (06:45 +0000)]
Fix generation of locales with multiple variants

Serbian locales have triple components to represent the 2 variations of the
locale: Latin and Cyrillic. Previously the tools generatic the locale were
appending both definitions instead of differentiating them.

Reported by: ache
Approved by: re (gjb)

8 years agoARM64: bsdinstall support for creating EFI partitions
Wojciech Macek [Mon, 20 Jun 2016 06:40:58 +0000 (06:40 +0000)]
ARM64: bsdinstall support for creating EFI partitions

    This patch enables bsdinstall to create EFI partition during installation and uploading it's contents,
    making the ARM64 FreeBSD installation bootable.

    Obtained from:         Semihalf
    Sponsored by:          Cavium
    Approved by:           re
    Reviewed by:           allanjude, emaste, nwhitehorn, wma
    Differential Revision: https://reviews.freebsd.org/D6853

8 years ago[ath] fix EDMA TX buffer flags for use when retransmitting frames.
Adrian Chadd [Mon, 20 Jun 2016 02:04:40 +0000 (02:04 +0000)]
[ath] fix EDMA TX buffer flags for use when retransmitting frames.

This started showing up when doing lots of aggregate traffic. For TDMA it's
always no-ACK traffic and I didn't notice this, and I didn't notice it
when doing 11abg traffic as it didn't fail enough in a bad way to trigger
this.

This showed up as the fifo depth being < 0.

Eg:

Jun 19 09:23:07 gertrude kernel: ath0: ath_tx_edma_push_staging_list: queued 2 packets; depth=2, fifo depth=1
Jun 19 09:23:07 gertrude kernel: ath0: ath_edma_tx_processq: Q1, bf=0xfffffe000385f068, start=1, end=1
Jun 19 09:23:07 gertrude kernel: ath0: ath_edma_tx_processq: Q1: FIFO depth is now 0 (1)
Jun 19 09:23:07 gertrude kernel: ath0: ath_edma_tx_processq: Q1, bf=0xfffffe0003866fe8, start=0, end=1
Jun 19 09:23:07 gertrude kernel: ath0: ath_edma_tx_processq: Q1: FIFO depth is now -1 (0)

So, clear the flags before adding them to a TX queue, so if they're
re-added for the retransmit path it'll clear whatever they were and
not double-account the FIFOEND flag.  Oops.

Tested:

* AR9380, STA mode, 11n iperf testing (~130mbit)

Approved by: re (delphij)

8 years agoAdd Mike Karels as committer, with gnn as mentor.
Mike Karels [Sun, 19 Jun 2016 23:36:40 +0000 (23:36 +0000)]
Add Mike Karels as committer, with gnn as mentor.

Approved by: gnn (mentor)
Approved by: re

8 years agoRemote and local adv lock servers might de-synchronize (the added comment
Konstantin Belousov [Sun, 19 Jun 2016 18:32:35 +0000 (18:32 +0000)]
Remote and local adv lock servers might de-synchronize (the added comment
explains the plausible scenario), resulting in EDEADLK returned on the
local registration attempt.  Handle this by re-trying the local op [1].

On unmount, local registration abort is indicated as EINTR, abort the nlm
call as well.

Reported and tested by: pho
Suggested and reviewed by: dfr (previous version, [1])
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Approved by: re (delphij)

8 years agoDo not access NFS data for reclaimed vnode.
Konstantin Belousov [Sun, 19 Jun 2016 18:29:43 +0000 (18:29 +0000)]
Do not access NFS data for reclaimed vnode.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Approved by: re (delphij)

8 years ago[net80211] remove node scan lock / generation number + fix few LORs
Adrian Chadd [Sun, 19 Jun 2016 07:31:02 +0000 (07:31 +0000)]
[net80211] remove node scan lock / generation number + fix few LORs

Drop scan generation number and node table scan lock - the only place
where ni_scangen is checked is in ieee80211_timeout_stations() (and it
is used to prevent duplicate checking of the same node); node scan lock
protects only this variable + node table scan generation number.

This will fix (at least) next LOR (hostap mode):

lock order reversal:
1st 0xc175f84c urtwm0_scan_loc (urtwm0_scan_loc) @ /usr/src/sys/modules/wlan/../../net80211/ieee80211_node.c:2019
2nd 0xc175e018 urtwm0_com_lock (urtwm0_com_lock) @ /usr/src/sys/modules/wlan/../../net80211/ieee80211_node.c:2693
stack backtrace:
#0 0xa070d1c5 at witness_debugger+0x75
#1 0xa070d0f6 at witness_checkorder+0xd46
#2 0xa0694cce at __mtx_lock_flags+0x9e
#3 0xb03ad9ef at ieee80211_node_leave+0x12f
#4 0xb03afd13 at ieee80211_timeout_stations+0x483
#5 0xb03aa1c2 at ieee80211_node_timeout+0x42
#6 0xa06c6fa1 at softclock_call_cc+0x1e1
#7 0xa06c7518 at softclock+0xc8
#8 0xa06789ae at intr_event_execute_handlers+0x8e
#9 0xa0678fa0 at ithread_loop+0x90
#10 0xa0675fbe at fork_exit+0x7e
#11 0xa08af910 at fork_trampoline+0x8

In addition to the above:

* switch to ieee80211_iterate_nodes();
* do not assert that node table lock is held, while calling node_age();
  that's not really needed (there are no resources, which can be protected
  by this lock) + this fixes LOR/deadlock between ieee80211_timeout_stations()
  and ieee80211_set_tim() (easy to reproduce in HOSTAP mode while
  sending something to an STA with enabled power management).

Tested:

* (avos) urtwn0, hostap mode
* (adrian) AR9380, STA mode
* (adrian) AR9380, AR9331, AR9580, hostap mode

Notes:

* This changes the net80211 internals, so you have to recompile all of it
  and the wifi drivers.

Submitted by: avos
Approved by: re (delphij)
Differential Revision: https://reviews.freebsd.org/D6833

8 years ago[ath] add support for batching frames to the general TX queues.
Adrian Chadd [Sun, 19 Jun 2016 03:45:32 +0000 (03:45 +0000)]
[ath] add support for batching frames to the general TX queues.

It turns out the frame scheduling policies (eg DBA_GATED) operate on
a single TX FIFO entry.  ASAP scheduling is fine; those frames always
go out.

DBA-gated sets the TX queue ready when the DBA timer fires, which triggers
a beacon transmit.  Normally this is used for content-after-beacon queue
(CABQ) work, which needs to burst out immediately after a beacon.
(eg broadcast, multicast, etc frames.)  This is a general policy that you
can use for any queue, and Sam's TDMA code uses it.

When DBA_GATED is used and something like say, an 11e TX burst window,
it only operates on a single TX FIFO entry.  If you have a single frame
per TX FIFO entry and say, a 2.5ms long burst window (eg TDMA!) then it'll
only burst a single frame every 2.5ms.  If there's no gating (eg ASAP) then
the burst window is fine, and multiple TX FIFO slots get used.

The CABQ code does pack in a list of frames (ie, the whole cabq) but
up until this commit, the normal TX queues didn't.  It showed up when
I started to debug TDMA on the AR9380 and later.

This commit doesn't fix the TDMA case - that's still broken here, because
all I'm doing here is allowing 'some' frames to be bursting, but I'm
certainly not filling the whole TX FIFO slot entry with frames.
Doing that 'properly' kind of requires me to take into account how long
packets should take to transmit and say, doing 1.5 or something times that
per TX FIFO slot, as if you partially transmit a slot, when it's next
gated it'll just finish that TX FIFO slot, then not advance to the next
one.

Now, I /also/ think queuing a new packet restarts DMA, but you have to
push new frames into the TX FIFO.  I need to experiment some more with
this because if it's really the case, I will be able to do TDMA support
without the egregious hacks I have in my local tree.  Sam's TDMA code
for previous chips would just kick the TXE bit to push along DMA
again, but we can't do that for EDMA chips - we /have/ to push a new
frame into the TX FIFO to restart DMA.  Ugh.

Tested:

* AR9380, STA mode
* AR9380, hostap mode
* AR9580, hostap mode

Approved by: re (gjb)

8 years ago- Prefer to use %d over %e where the day of the month should be zero
Hajimu UMEMOTO [Sun, 19 Jun 2016 03:44:32 +0000 (03:44 +0000)]
- Prefer to use %d over %e where the day of the month should be zero
  filled.
- Since %e means the day of the month as well, regard %e as same as %d
  in md_order.

Reported by: vangyzen
Approved by: re (gjb)

8 years agoFix if_ntb interface setup to include IFF_MULTICAST.
Eric van Gyzen [Sat, 18 Jun 2016 23:18:04 +0000 (23:18 +0000)]
Fix if_ntb interface setup to include IFF_MULTICAST.

This allows IPv6 link local addresses (and other IPv6 functionality) to work.

PR: 210355
Submitted by: Steve Wahl and David Bright (both at Dell Inc.)
Reviewed by: cem, mav
Tested by: mav (on Intel hardware)
Approved by: re (kib)
MFC after: 5 days
Sponsored by: Dell Inc.
Differential Revision: https://reviews.freebsd.org/D6885

8 years agoAfter the vnode unlock, mount point might be destroyed immediately,
Konstantin Belousov [Sat, 18 Jun 2016 20:22:53 +0000 (20:22 +0000)]
After the vnode unlock, mount point might be destroyed immediately,
dropping the reference on mnt_cred. Prevent this by referencing the
temporal credentials before unlock.

Tested by: pho
Reviewed by: dfr
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Approved by: re (gjb)