]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoWITH_SYSTEM_COMPILER: Avoid using GCC4.8+ logic on native GCC4.2 platforms.
bdrewery [Wed, 29 Jun 2016 01:50:30 +0000 (01:50 +0000)]
WITH_SYSTEM_COMPILER: Avoid using GCC4.8+ logic on native GCC4.2 platforms.

As the XXX notes, these should really be checking MK_GNUCXX since there is
already a version check in share/mk/src.opts.mk to disable it.  Fixing that
here is more complex though.  This could also be using X_COMPILER_FEATURES
but uses X_COMPILER_VERSION to keep in sync with the src.opts.mk logic.

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

7 years agoDo not coredump if the packet is too long in the global (non-interface
phk [Tue, 28 Jun 2016 20:10:30 +0000 (20:10 +0000)]
Do not coredump if the packet is too long in the global (non-interface
associated) instance.

The result is that the packet is dropped without an indication
that smaller MTU is advisable, which is not optimal, but better
than a NULL pointer deref.

Approved by: re (glebius)

7 years agoUse on crypto.x and rpc.x from the source tree.
bdrewery [Tue, 28 Jun 2016 19:53:16 +0000 (19:53 +0000)]
Use on crypto.x and rpc.x from the source tree.

This fixes the build when DESTDIR may be blank or not yet populated.
It also fixes reproducibility.

Submitted by: brooks
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D6455

7 years agoRevert svn r302253 at the request/review of Ken M. This commit is
sbruno [Tue, 28 Jun 2016 18:32:15 +0000 (18:32 +0000)]
Revert svn r302253 at the request/review of Ken M.  This commit is
incorrect.

PR: 202625
Approved by: re (implicit)

7 years agoCorrect PERSISTENT RESERVE OUT command and populate scsi_cmd->length.
sbruno [Tue, 28 Jun 2016 18:08:47 +0000 (18:08 +0000)]
Correct PERSISTENT RESERVE OUT command and populate scsi_cmd->length.

PR: 202625
Submitted by: niakrisn@gmail.com
Reviewed by: scottl
Approved by: re (hrs)
MFC after: 2 weeks

7 years agoCurrently the ntptime code and resettodr() are Giant-locked. In
kib [Tue, 28 Jun 2016 16:43:23 +0000 (16:43 +0000)]
Currently the ntptime code and resettodr() are Giant-locked. In
particular, the Giant is supposed to protect against parallel
ntp_adjtime(2) invocations.  But, for instance, sys_ntp_adjtime() does
copyout(9) under Giant and then examines time_status to return syscall
result.  Since copyout(9) could sleep, the syscall result might be
inconsistent.

Another and more important issue is that if PPS is configured,
hardpps(9) is executed without any protection against the parallel
top-level code invocation. Potentially, this may result in the
inconsistent state of the ntptime state variables, but I cannot say
how serious such distortion is. The non-functional splclock() call in
sys_ntp_adjtime() protected against clock interrupts calling hardpps()
in the pre-SMP era.

Modernize the locking. A mutex protects ntptime data.  Due to the
hardpps() KPI legitimately serving from the interrupt filters (and
e.g. uart(4) does call it from filter), the lock cannot be sleepable
mutex if PPS_SYNC is defined.  Otherwise, use normal sleepable mutex
to reduce interrupt latency.

Reviewed by:   imp, jhb
Sponsored by:   The FreeBSD Foundation
Approved by:   re (gjb)
Differential revision: https://reviews.freebsd.org/D6825

7 years agoDo not use Giant to prevent parallel calls to CLOCK_SETTIME(). Use
kib [Tue, 28 Jun 2016 16:42:40 +0000 (16:42 +0000)]
Do not use Giant to prevent parallel calls to CLOCK_SETTIME().  Use
private mtx in resettodr(), no implementation of CLOCK_SETTIME() is
allowed to sleep.

Reviewed by:   imp, jhb
Sponsored by:   The FreeBSD Foundation
Approved by:   re (gjb)
X-Differential revision: https://reviews.freebsd.org/D6825

7 years agoComplete r302215. TDF_SBDRY | TDF_SERESTART and TDF_SBDRY |
kib [Tue, 28 Jun 2016 16:41:50 +0000 (16:41 +0000)]
Complete r302215.  TDF_SBDRY | TDF_SERESTART and TDF_SBDRY |
TDF_SEINTR flags values, unlike TDF_SBDRY, must be treated almost as
if TDF_SBDRY is not set for STOP signal delivery.  The only difference
is that sig_suspend_threads() should abort the sleep instead of doing
immediate suspension.

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

7 years agoRegenerate for WITH_EXTRA_TCP_STACKS updates.
jtl [Tue, 28 Jun 2016 13:42:50 +0000 (13:42 +0000)]
Regenerate for WITH_EXTRA_TCP_STACKS updates.

Approved by: re (gjb)
Sponsored by: Juniper Networks

7 years agoDocument support for alternate TCP stacks.
jtl [Tue, 28 Jun 2016 13:37:01 +0000 (13:37 +0000)]
Document support for alternate TCP stacks.

Differential Revision: https://reviews.freebsd.org/D6940
Reviewed by: hiren
Approved by: re (gjb)
Sponsored by: Juniper Networks

7 years agoThis commit addresses regression introduceded in r302177
cy [Tue, 28 Jun 2016 07:47:42 +0000 (07:47 +0000)]
This commit addresses regression introduceded in r302177
(WITH_SYSTEM_COMPILER: Enable by default) and it's prerequisite: r300354,
caused i386 builds to fail when cross-built on an amd64 host.

Reviewed by: bdrewery, delphij, gjb
Approved by: re (gjb)

7 years agoFix userspace build after r302235: do not expose bool field of the
kib [Mon, 27 Jun 2016 23:34:53 +0000 (23:34 +0000)]
Fix userspace build after r302235: do not expose bool field of the
structure, change it to int.

The real fix is to sanitize user-visible definitions in sys/event.h,
e.g. the affected struct knlist is of no use for userspace programs.

Reported and tested by: jkim
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)

7 years agoIf the vm_fault() handler raced with the vm_object_collapse()
kib [Mon, 27 Jun 2016 21:54:19 +0000 (21:54 +0000)]
If the vm_fault() handler raced with the vm_object_collapse()
sleepable scan, iteration over the shadow chain looking for a page
could find an OBJ_DEAD object.  Such state of the mapping is only
transient, the dead object will be terminated and removed from the
chain shortly.  We must not return KERN_PROTECTION_FAILURE unless the
object type is changed to OBJT_DEAD in the chain, indicating that
paging on this address is really impossible.  Returning
KERN_PROTECTION_FAILURE prematurely causes spurious SIGSEGV delivered
to processes, or kernel accesses to UVA spuriously failing with
EFAULT.

If the object with OBJ_DEAD flag is found, only return
KERN_PROTECTION_FAILURE when object type is already OBJT_DEAD.
Otherwise, sleep a tick and retry the fault handling.

Ideally, we would wait until the OBJ_DEAD flag is resolved, e.g. by
waiting until the paging on this object is finished.  But to do so, we
need to reference the dead object, while vm_object_collapse() insists
on owning the final reference on the collapsed object.  This could be
fixed by e.g. changing the assert to shared reference release between
vm_fault() and vm_object_collapse(), but it seems to be too much
complications for rare boundary condition.

PR: 204426
Tested by:    pho
Reviewed by:  alc
Sponsored by: The FreeBSD Foundation
X-Differential revision: https://reviews.freebsd.org/D6085
MFC after: 2 weeks
Approved by: re (gjb)

7 years agoWhen filt_proc() removes event from the knlist due to the process
kib [Mon, 27 Jun 2016 21:52:17 +0000 (21:52 +0000)]
When filt_proc() removes event from the knlist due to the process
exiting (NOTE_EXIT->knlist_remove_inevent()), two things happen:
- knote kn_knlist pointer is reset
- INFLUX knote is removed from the process knlist.
And, there are two consequences:
- KN_LIST_UNLOCK() on such knote is nop
- there is nothing which would block exit1() from processing past the
  knlist_destroy() (and knlist_destroy() resets knlist lock pointers).
Both consequences result either in leaked process lock, or
dereferencing NULL function pointers for locking.

Handle this by stopping embedding the process knlist into struct proc.
Instead, the knlist is allocated together with struct proc, but marked
as autodestroy on the zombie reap, by knlist_detach() function.  The
knlist is freed when last kevent is removed from the list, in
particular, at the zombie reap time if the list is empty.  As result,
the knlist_remove_inevent() is no longer needed and removed.

Other changes:

In filt_procattach(), clear NOTE_EXEC and NOTE_FORK desired events
from kn_sfflags for knote registered by kernel to only get NOTE_CHILD
notifications.  The flags leak resulted in excessive
NOTE_EXEC/NOTE_FORK reports.

Fix immediate note activation in filt_procattach().  Condition should
be either the immediate CHILD_NOTE activation, or immediate NOTE_EXIT
report for the exiting process.

In knote_fork(), do not perform racy check for KN_INFLUX before kq
lock is taken.  Besides being racy, it did not accounted for notes
just added by scan (KN_SCAN).

Some minor and incomplete style fixes.

Analyzed and tested by: Eric Badger <eric@badgerio.us>
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)
Differential revision: https://reviews.freebsd.org/D6859

7 years agoFix build: explicitly reference the generated magic.h as dependency
delphij [Mon, 27 Jun 2016 06:41:11 +0000 (06:41 +0000)]
Fix build: explicitly reference the generated magic.h as dependency
of mkmagic and point its location.

Reported by: jenkins
Pointy hat to: delphij
MFC after: 2 weeks
X-MFC-With: 302221
Approved by: re (kib)

7 years agoMFV r302218: file 5.28.
delphij [Mon, 27 Jun 2016 01:29:17 +0000 (01:29 +0000)]
MFV r302218: file 5.28.

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

7 years agoVendor import of file 5.28.
delphij [Sun, 26 Jun 2016 20:59:11 +0000 (20:59 +0000)]
Vendor import of file 5.28.

7 years agoWhen sleeping waiting for either local or remote advisory lock,
kib [Sun, 26 Jun 2016 20:08:42 +0000 (20:08 +0000)]
When sleeping waiting for either local or remote advisory lock,
interrupt sleeps with the ERESTART on the suspension attempts.
Otherwise, single-threading requests are deferred until the locks are
granted for NFS files, which causes hangs.

When retrying local registration of the remotely-granted adv lock,
allow full suspension and check for suspension, for usual reasons.

Reported by: markj, pho
Reviewed by: jilles
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)

7 years agoRewrite sigdeferstop(9) and sigallowstop(9) into more flexible
kib [Sun, 26 Jun 2016 20:07:24 +0000 (20:07 +0000)]
Rewrite sigdeferstop(9) and sigallowstop(9) into more flexible
framework allowing to set the suspension policy for the dynamic block.
Extend the currently possible policies of stopping on interruptible
sleeps and ignoring such sleeps by two more: do not suspend at
interruptible sleeps, but interrupt them with either EINTR or ERESTART.

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

7 years agoEnter 64-bit mode as early as possible in the 64-bit PowerPC boot sequence.
nwhitehorn [Sun, 26 Jun 2016 18:43:42 +0000 (18:43 +0000)]
Enter 64-bit mode as early as possible in the 64-bit PowerPC boot sequence.
Most of the effect of setting MSR[SF] is that the CPU will stop ignoring
the high 32 bits of registers containing addresses in load/store
instructions. As such, the kernel was setting it only when it began to
need access to high memory. MSR[SF] also affects the operation of some
conditional instructions, however, and so setting it at late times could
subtly break code at very early times. This fixes use of the FDT mode in
loader, and FDT boot more generally, on 64-bit PowerPC systems.

Hardware provided by: IBM LTC
Approved by: re (kib)

7 years agoFix a bug introduced in r283433.
dchagin [Sun, 26 Jun 2016 16:59:59 +0000 (16:59 +0000)]
Fix a bug introduced in r283433.

[1] Remove unneeded sockaddr conversion before kern_recvit() call as the from
argument is used to record result (the source address of the received message) only.

[2] In Linux the type of msg_namelen member of struct msghdr is signed but native
msg_namelen has a unsigned type (socklen_t). So use the proper storage to fetch fromlen
from userspace and than check the user supplied value and return EINVAL if it is less
than 0 as a Linux do.

Reported by: Thomas Mueller <tmueller at sysgo dot com> [1]
Reviewed by: kib@
Approved by: re (gjb, kib)
MFC after: 3 days

7 years agoThis patch fixes two bugs related to the SCTP message recovery
tuexen [Sun, 26 Jun 2016 16:38:42 +0000 (16:38 +0000)]
This patch fixes two bugs related to the SCTP message recovery
for messages which have been put on the send queue:
* Do not report any DATA or I-DATA chunk padding.
* Correctly deal with the I-DATA chunk header instead of the DATA
  chunk header when the I-DATA extension is used.

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

7 years agobhyve: improve memory size documentation
novel [Sun, 26 Jun 2016 14:44:01 +0000 (14:44 +0000)]
bhyve: improve memory size documentation

A couple of minor memory size option related nits:

 - use common name 'memsize' (instead of 'max-size' or just 'size')
 - bhyve: update usage with memsize unit suffix, drop legacy "MB"
   unit
 - bhyveload: update usage with memsize unit suffix
 - bhyve(8): document default size
 - bhyveload(8): use memsize formatting like it's done
   in bhyve(8)

Reviewed by:            wblock, grehan
Approved by:            re (kib), wblock, grehan
Differential Revision:  https://reviews.freebsd.org/D6952

7 years agoClean other flags in ncl_inactive, only. Add comment explaining why other
kib [Sun, 26 Jun 2016 14:18:28 +0000 (14:18 +0000)]
Clean other flags in ncl_inactive, only.  Add comment explaining why other
flags should be unset.

Suggested and reviewed by: rmacklem
Sponsored by: The FreeBSD Foundation
MFC after: 12 days
Approved by: re (gjb)

7 years agoThis patch fixes a locking bug when a send() call blocks
tuexen [Sun, 26 Jun 2016 12:41:02 +0000 (12:41 +0000)]
This patch fixes a locking bug when a send() call blocks
on an SCTP socket and the association is aborted by the
peer.

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

7 years agoSkip lastcomm and sa tests on unsupported architectures
asomers [Sun, 26 Jun 2016 00:53:31 +0000 (00:53 +0000)]
Skip lastcomm and sa tests on unsupported architectures

usr.bin/lastcom/tests/Makefile
usr.sbin/sa/tests/Makefile
Set allow_architectures appropriately.  These tests depend on golden
files that must be generated for each architecture, and haven't yet
been generated for all of them.

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

7 years agoUnbreak building of LINT kernels after r302163.
bz [Sat, 25 Jun 2016 22:24:16 +0000 (22:24 +0000)]
Unbreak building of LINT kernels after r302163.

Approved by: re (gjb)

7 years ago[net80211] re-revert the ibss "is this local to the bss" patch.
adrian [Sat, 25 Jun 2016 20:31:20 +0000 (20:31 +0000)]
[net80211] re-revert the ibss "is this local to the bss" patch.

avos@ pointed out to me that this broke IBSS merging because the rest of
the input path no longer was called for non-IBSS frames.

I committed a change to not input non-IBSS frames, which stopped
nodes being created for BSSes that weren't ours.  Unfortunately
thta stopped the input path for non-IBSS frames in general,
so the management input path didn't work.

So, I'll revert this until I come up with a better solution.
(Hopefully before 11.)

Reviewed by: avos
Approved by: re (gjb)

7 years agoRevert r302194, there are issues with some applications after changing
kib [Sat, 25 Jun 2016 20:20:24 +0000 (20:20 +0000)]
Revert r302194, there are issues with some applications after changing
the return value, in particular console-kit-daemon.

Reported by: Ivan Klymenko <fidaj@ukr.net>
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)

7 years agoRemove reference to mroute6d in /etc/netstart.
bapt [Sat, 25 Jun 2016 12:54:27 +0000 (12:54 +0000)]
Remove reference to mroute6d in /etc/netstart.

mroute6d has been removed in r298512.

PR: 209405
Submitted by: Trond.Endrestol@ximalas.info
Approved by: re (gjb)

7 years agoThis patch fixes two bugs:
tuexen [Sat, 25 Jun 2016 12:46:18 +0000 (12:46 +0000)]
This patch fixes two bugs:
* sctp46, tcp46, and udp46 sockets are displayed as such and not as
  sctp4 6, tcp4 6, udp4 6. This bug was introduced in
  http://svnweb.freebsd.org/base?view=revision&revision=187915
* For SCTP sockets, the the -4 and -6 flags are honoured as much as
  possible. This means IPv4 sockets are handled correctly,  IPv6
  sockets are displayed as sctp46, since it is currently not possible
  to distinguish between sctp6 and sctp46.

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

7 years agoSince VOP_INACTIVE() is not guaranteed to be called, all cleanups
kib [Sat, 25 Jun 2016 11:34:06 +0000 (11:34 +0000)]
Since VOP_INACTIVE() is not guaranteed to be called, all cleanups
executed by inactive methods, must be repeated on reclaim.  In
particular, unlink and free sillyrenamed vnode both on inactivation
and reclaim.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)

7 years agoDo not clear robust lists pointers on fork. The forked child thread
kib [Sat, 25 Jun 2016 11:31:25 +0000 (11:31 +0000)]
Do not clear robust lists pointers on fork.  The forked child thread
lists must be functional.

Reported by: Daniel Engberg <daniel.engberg.lists@pyret.net>,
Guy Yur <guyyur@gmail.com>
Tested by: Guy Yur <guyyur@gmail.com>
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb), including the KBI change

7 years agoFor pthread_mutex_trylock() call on owned error-check or non-portable
kib [Sat, 25 Jun 2016 11:30:40 +0000 (11:30 +0000)]
For pthread_mutex_trylock() call on owned error-check or non-portable
adaptive mutex, return EDEADLK as required by POSIX.  The
pthread_mutex_lock() is already compliant.

Tested by: Guy Yur <guyyur@gmail.com>
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)

7 years agobhnd(4): Add devinfo allocation and child addition methods, modeled on
landonf [Sat, 25 Jun 2016 04:36:30 +0000 (04:36 +0000)]
bhnd(4): Add devinfo allocation and child addition methods, modeled on
pci_if.

This allows bhnd(4) to manage per-device state (such as per-core
pmu/clock refcounting) on behalf of subclass driver instances.

Approved by: re (gjb), adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D6959

7 years agoReplace mips/sentry5 with mips/broadcom
landonf [Sat, 25 Jun 2016 04:34:54 +0000 (04:34 +0000)]
Replace mips/sentry5 with mips/broadcom

The delta between SENTRY5 and BCM was already small due to BCM being
derived from SENTRY5; re-integrating the two avoids the maintenance
overhead of keeping them both in sync with bhnd(4) changes.

- Re-integrate minor SENTRY5 deltas in bcm_machdep.c
- Modify uart_cpu_chipc to allow specifying UART debug/console flags via
  kenv and device hints.
- Switch SENTRY5 to std.broadcom
- Enabled CFI flash support for SENTRY5

Reviewed by: Michael Zhilin <mizkha@gmail.com> (Broadcom MIPS support)
Approved by: re (gjb), adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D6897

7 years agobhnd(4): Perform explicit chipc child enumeration.
landonf [Sat, 25 Jun 2016 04:33:00 +0000 (04:33 +0000)]
bhnd(4): Perform explicit chipc child enumeration.

Replaces use of DEVICE_IDENTIFY with explicit enumeration of chipc
child devices using the chipc capability structure.

This is a precursor to PMU support, which requires more complex resource
assignment handling than achievable with the static device name-based
hints table.

Reviewed by: Michael Zhilin <mizkha@gmail.com> (Broadcom MIPS support)
Approved by: re (gjb), adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D6896

7 years agourtwn: use m_get2() in Rx path.
avos [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)

7 years agoUpdate the release notes following r302182.
gjb [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

7 years agoTurn off MSI-X interrupt migration by default in EC2 instances; this works
cperciva [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

7 years agourtwn: fix memory leak on device restart
avos [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)

7 years agoRevert r301551, which added blacklistd(8) to sshd(8).
gjb [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

7 years agoAdd a tunable to disable migration of MSI-X interrupts.
jhb [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

7 years agoFix bitstring allocation on 32-bit platforms
asomers [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

7 years agogcore: Forward pending signals when detaching from the target.
markj [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

7 years agoRegenerate
bdrewery [Fri, 24 Jun 2016 20:00:39 +0000 (20:00 +0000)]
Regenerate

Approved by: re (implicit, r302177)

7 years agoWITH_SYSTEM_COMPILER: Enable by default
bdrewery [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

7 years agobsd.prog.mk: add "/usr/lib" to list of base system directories
emaste [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

7 years agoAdd pci_get_max_payload() to fetch the PCI-express maximum payload size.
jhb [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

7 years agoFix "sysctl vm.vmtotal" output on machines with > 2TB virtual memory
asomers [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

7 years agoThe void isn't void.
bz [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

7 years agoResolve issue with libusb C++ header file inclusion.
hselasky [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

7 years agoUpdate head to ALPHA5 in preparation of new snapshot builds.
gjb [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

7 years agoRename CAM_NETFLIX_IOSCHED to CAM_IOSCHED_DYNAMIC to better reflect
imp [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

7 years agoFix gstat's interactive f and q commands
asomers [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

7 years agoProerply virtualize pfsync for bringup after pf is initialized and
bz [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

7 years agoMake sure pflog is attached after pf is initializaed so we can
bz [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)

7 years agoPFSTATE_NOSYNC goes onto state_flags, not sync_state;
bz [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

7 years agoUpdate pf(4) and pflog(4) to survive basic VNET testing, which includes
bz [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

7 years agoTry to avoid a 2nd conditional by re-writing the loop, pause, and
bz [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

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

Approved by: re (implicit)

7 years agoAdd spares to struct ifnet and socket for packet pacing and/or general
np [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

7 years agoAdd an UPDATING entry for the pipe() -> pipe2() transition.
brooks [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

7 years agoposixshm: Fix lock leak when mac_posixshm_check_read rejects read.
jilles [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

7 years agoSwitch geom_disk over to using a pool mutex.
ken [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)

7 years agoAdd support for a /etc/defaults/vendor.conf override file
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

7 years agoFix a bug in the handling of non-blocking SCTP 1-to-1 sockets. When using
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

7 years agoUse M_NOWAIT when allocating memory for the ACPI wakeup handler.
markj [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

7 years agomakeroot: zero out subsecond component of time= keywords
emaste [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

7 years agobsdinstall: increase EFI partition size to 200MB
emaste [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

7 years agoRaise the WARNS level in cddl/lib
asomers [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

7 years agoIn VNET TCP teardown Do not sleep unconditionally but only if we
bz [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

7 years agoUse correct Q-counter output array.
hselasky [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

7 years agoDon't consider the socket when processing an incoming ICMP/ICMP6 packet,
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

7 years agoIn vm_page_xunbusy_maybelocked(), add fast path for unbusy when no
kib [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)

7 years agoAdd a comment noting locking regime for vm_page_xunbusy().
kib [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)

7 years agoAdd support for USB streams to the LibUSB v1.0 API and update the
hselasky [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

7 years agofix deadlock-prone code in getzfsvfs()
avg [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

7 years agoImport a fix for and old security issue (CVE-2010-3830) in pf which
bz [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

7 years agocxgbe(4): Merge netmap support from the ncxgbe/ncxl interfaces to the
np [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

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

Approved by: re (implicit)

7 years ago[BHND/bcma] Add implementation of BHND_BUS_RESET_CORE function for BCMA
adrian [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)

7 years ago[iwm] Use mbuf for large firmware commands, like OpenBSD does.
adrian [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

7 years ago[iwm] Add and use iwm_phy_db_free(), to plug phy_db memory leak.
adrian [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

7 years ago[iwm] Fix iwm_dma_contig_free(). dma->map is always NULL here.
adrian [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

7 years ago[iwm] Use vap->iv_myaddr instead of ic->ic_macaddr when vap != NULL.
adrian [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

7 years ago[ath] fix comments!
adrian [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)

7 years agoCheck the V_tcbinfo.ipi_count to hit 0 before doing the full TCP cleanup.
bz [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

7 years agoNo longer mark TCP TW zone NO_FREE.
bz [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

7 years agoRegen post r302096 and implement svr4_pipe().
brooks [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

7 years agoDeclare a svr4 version of pipe() now that sys_pipe() is no more.
brooks [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

7 years agoGenerate syscall tables and update pipe() implementation after r302094.
brooks [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

7 years agoMark the pipe() system call as COMPAT10.
brooks [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

7 years agoAdd support for COMPAT10 keywords in syscalls.master.
brooks [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

7 years agoReplace use of the pipe(2) system call with pipe2(2) with a zero flags
brooks [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

7 years agoDo not complete pending gmirror BIOs when tearing down the provider.
markj [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

7 years agoAdd AFLAGS.IMPSRC and document A[C]FLAGS
bdrewery [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

7 years agoFix a LOR between vnode locks and allproc_lock.
kib [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

7 years agoWITH_META_MODE: Whitelist 'make kernel-toolchain'
bdrewery [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

7 years agoFix a bug that caused da(4) peripheral drivers to not fully go away
ken [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