]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agocontigmalloc: handle M_EXEC.
kib [Thu, 7 Feb 2019 02:00:23 +0000 (02:00 +0000)]
contigmalloc: handle M_EXEC.

Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D19092

5 years agoClean up all directories created by `make hier`
ngie [Wed, 6 Feb 2019 21:24:44 +0000 (21:24 +0000)]
Clean up all directories created by `make hier`

The logic I introduced in r322511 unfortunately left chflags schg'ed
directories behind created by `make hier` (in the stock /etc/mtree
files, this is limited to /var/empty).

The proposed change calls `chflags -R 0` and `rm -Rf ...` to clean all
of the directories that could not be removed by `${MAKE} clean`.
`${MAKE} clean` in bsd.obj.mk calls `cleandir`/`cleanobj`, which handles
the first directory tree walk/removal.

Approved by: emaste (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18641

5 years agoSupport the Lenovo OneLink in ure(4).
gavin [Wed, 6 Feb 2019 20:18:22 +0000 (20:18 +0000)]
Support the Lenovo OneLink in ure(4).

MFC after: 1 week

5 years agoriscv: default to non-executable stack
emaste [Wed, 6 Feb 2019 19:22:15 +0000 (19:22 +0000)]
riscv: default to non-executable stack

There's no need to worry about potential backwards compatibility issues
in a brand-new architecture, so avoid stack PROT_EXEC as with arm64.

Discussed with: br

5 years agovtfontcvt: whitespace cleanup
emaste [Wed, 6 Feb 2019 18:50:48 +0000 (18:50 +0000)]
vtfontcvt: whitespace cleanup

PR: 205707
Submitted by: Dmitry Wagin

5 years agoRetire SPX_HACK option unused after r342244
emaste [Wed, 6 Feb 2019 17:21:25 +0000 (17:21 +0000)]
Retire SPX_HACK option unused after r342244

5 years agoRetire CTM option after r342126
emaste [Wed, 6 Feb 2019 16:30:08 +0000 (16:30 +0000)]
Retire CTM option after r342126

5 years agonet80211(4): validate supplied roam:rate values from ifconfig(8)
avos [Wed, 6 Feb 2019 13:01:21 +0000 (13:01 +0000)]
net80211(4): validate supplied roam:rate values from ifconfig(8)

MFC after: 4 days

5 years agoAdapt FreeBSD specific DT stub for Jetson TK1 board to be consistent with
mmel [Wed, 6 Feb 2019 06:03:44 +0000 (06:03 +0000)]
Adapt FreeBSD specific DT stub for Jetson TK1 board to be consistent with
update of devicetree to 4.19 in r340337.
Our build system doesn't provide dependencies for included DTS files, so
nobody noticed this issue for long time.

PR: 235362
MFC after: 1 week

5 years agor341692 changed cap_syslog(3) to preserve the stdio descriptors inherited
jah [Wed, 6 Feb 2019 04:36:28 +0000 (04:36 +0000)]
r341692 changed cap_syslog(3) to preserve the stdio descriptors inherited
from its parent so that LOG_PERROR would work.  However, this caused
dhclient(8)'s stdio streams to remain open across daemonization, breaking
the ability to capture its foreground output as done in netconfig_ipv4.

Fix this by reverting r341692 and instead passing the parent's stderr
descriptor as an argument to cap_openlog() only when LOG_PERROR is specified
in logopt.

PR: 234514
Suggested by: markj
Reported by: Shawn Webb
Reviewed by: markj, oshogbo
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18989

5 years agopwm.8: fix markup in synopsis, add -f description
yuripv [Wed, 6 Feb 2019 04:00:37 +0000 (04:00 +0000)]
pwm.8: fix markup in synopsis, add -f description

Reviewed by: bcr, manu
Differential revision: https://reviews.freebsd.org/D18829

5 years agopwm.9: fix markup in interfaces description
yuripv [Wed, 6 Feb 2019 03:57:51 +0000 (03:57 +0000)]
pwm.9: fix markup in interfaces description

Reviewed by: manu
Differential revision: https://reviews.freebsd.org/D18830

5 years agopowerpc: Bind IRQs to only one interrupt on QorIQ SoCs
jhibbits [Wed, 6 Feb 2019 03:52:14 +0000 (03:52 +0000)]
powerpc: Bind IRQs to only one interrupt on QorIQ SoCs

The QorIQ SoCs don't actually support multicast interrupts, and the
references state explicitly that multicast is undefined behavior.  Avoid the
undefined behavior by binding to only a single CPU, using a quirk to
determine if this is necessary.

MFC after: 3 weeks

5 years agoiwn(4): plug initialization path vs interrupt handler races
avos [Wed, 6 Feb 2019 01:34:14 +0000 (01:34 +0000)]
iwn(4): plug initialization path vs interrupt handler races

There are few places in interrupt handler where the driver
lock is dropped; ensure that device is still running before
processing remaining ring entries.

PR: 192641
MFC after: 5 days

5 years agoAdd quirk for Sansisk X400 drives
imp [Tue, 5 Feb 2019 22:53:36 +0000 (22:53 +0000)]
Add quirk for Sansisk X400 drives

Certain versions of Sandisk x400 firmware can hang under extremely
heavly load of large I/Os for prolonged periods of time. Newer /
current versions work fine, and should be used where possible. Where
not possible, this quirk ensures that I/O requests are limited to 128k
to avoids the bug, even under extreme load. Since MAXPHYS is 128k,
only users with custom kernels are at risk on the older firmware.
Once all known users of the older firmware have upgraded, this quirk
will be removed.

Sponsored by: Netflix, Inc.

5 years agoRemove obsolete controller
imp [Tue, 5 Feb 2019 21:37:45 +0000 (21:37 +0000)]
Remove obsolete controller

We removed support for the super-old samsung s3xxxx parts, but this is
a straggler. Remove it too.

5 years agoRemove All Rights Reserved
imp [Tue, 5 Feb 2019 21:37:34 +0000 (21:37 +0000)]
Remove All Rights Reserved

Remove the all rights reserved clause from my copyright, and make
other minor tweaks needed where that might have created ambiguity.

5 years agoRemove a few stray "All Rights Reserved." declarations on stuff I've
imp [Tue, 5 Feb 2019 21:28:29 +0000 (21:28 +0000)]
Remove a few stray "All Rights Reserved." declarations on stuff I've
written.

5 years agoMake it possible to override PAE mode on boot.
kib [Tue, 5 Feb 2019 20:09:31 +0000 (20:09 +0000)]
Make it possible to override PAE mode on boot.

Initialize the static kenv in pmap_cold() and fetch user opinion on
vm.pmap.pae_mode tunable if hardware is capable.  Note that the static
environment is reinitilized in init386() later when paging is enabled.

Reviewed by: bde
Discussed with: kevans
Sponsored by: The FreeBSD Foundation
MFC after: 2 months

5 years agoRemove pointless initial value for i386 vm.pmap.pat_works sysctl definition.
kib [Tue, 5 Feb 2019 20:02:16 +0000 (20:02 +0000)]
Remove pointless initial value for i386 vm.pmap.pat_works sysctl definition.

The OID is served by external data.

Submitted by: bde
MFC after: 3 days

5 years ago[ppc64] llan: fix fatal kernel trap when system is low on memory
luporl [Tue, 5 Feb 2019 18:16:14 +0000 (18:16 +0000)]
[ppc64] llan: fix fatal kernel trap when system is low on memory

When running several builders in parallel, on QEMU, with 8GB of
memory, a fatal kernel trap (0x300 (data storage interrupt))
caused by llan driver is sometimes observed, when the system
starts to run out of swap space.

This happens because, at llan_intr(), a phyp call to add a
logical LAN buffer is always made when llan_add_rxbuf() fails,
even if it fails to allocate a new buffer.

PR: 235489
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D19084

5 years agoAvoid leaking fp references when truncating SCM_RIGHTS control messages.
markj [Tue, 5 Feb 2019 17:55:08 +0000 (17:55 +0000)]
Avoid leaking fp references when truncating SCM_RIGHTS control messages.

Reported by: pho
Approved by: so
MFC after: 0 minutes
Security: CVE-2019-5596
Sponsored by: The FreeBSD Foundation

5 years agoamd64: clear callee-preserved registers on syscall exit.
kib [Tue, 5 Feb 2019 17:49:27 +0000 (17:49 +0000)]
amd64: clear callee-preserved registers on syscall exit.

%r8, %r10, and on non-KPTI configuration %r9 were not restored on fast
return from a syscall.

Reviewed by: markj
Approved by: so
Security: CVE-2019-5595
Sponsored by: The FreeBSD Foundation
MFC after: 0 minutes

5 years agoFix missing translation of old ioctls for KDSETMODE, KDSBORDER and
bde [Tue, 5 Feb 2019 17:17:12 +0000 (17:17 +0000)]
Fix missing translation of old ioctls for KDSETMODE, KDSBORDER and
CONS_SETWINORG.  After translation, the last 2 are not supported, but
the first one has incomplete support that is enough to run old versions
of X.

5 years agoMy recent fix for programmable function keys in syscons only worked
bde [Tue, 5 Feb 2019 16:59:29 +0000 (16:59 +0000)]
My recent fix for programmable function keys in syscons only worked
when TEKEN_CONS25 is configured.  Fix this by adding a function to
set the flag that enables the fix and always calling this function
for syscons.

Expand the man page for teken_set_cons25().  This function is not
very useful since it can only set but not clear 1 flag.  In practice,
it is only used when TEKEN_CONS25 is configured and all that does is
choose the the default emulation for syscons at compile time.

5 years agoFix zapping of static hints and env in init_static_kenv(). Environments
bde [Tue, 5 Feb 2019 15:34:55 +0000 (15:34 +0000)]
Fix zapping of static hints and env in init_static_kenv().  Environments
are terminated by 2 NULs, but only 1 NUL was zapped.  Zapping only 1
NUL just splits the first string into an empty string and a corrupted
string.  All other strings in static hints and env remained live early
in the boot when they were supposed to be disabled.

Support calling init_static_kenv() very early in the boot, so as to
use the env very early in the boot.  Then the pointer to the loader
env may change after the first call due to enabling paging or otherwise
remapping the pointer.  Another call is needed to register the change.
Don't use the previous pointer in this (or any) later call.

Reviewed by: kib

5 years agonetmap: refactor logging macros and pipes
vmaffione [Tue, 5 Feb 2019 12:10:48 +0000 (12:10 +0000)]
netmap: refactor logging macros and pipes

Changelist:
    - Replace ND, D and RD macros with nm_prdis, nm_prinf, nm_prerr
      and nm_prlim, to avoid possible naming conflicts.
    - Add netmap_krings_mode_commit() helper function and use that
      to reduce code duplication.
    - Refactor pipes control code to export some functions that
      can be reused by the veth driver (on Linux) and epair(4).
    - Add check to reject API requests with version less than 11.
    - Small code refactoring for the null adapter.

MFC after: 1 week

5 years agoOnly reduce the PMTU after the send call. The only way to increase it, is
tuexen [Tue, 5 Feb 2019 10:29:31 +0000 (10:29 +0000)]
Only reduce the PMTU after the send call. The only way to increase it, is
via PMTUD.

This fixes an MTU issue reported by Timo Voelker.

MFC after: 3 days

5 years agoFix an off-by-one error in the input validation of the SCTP_RESET_STREAMS
tuexen [Tue, 5 Feb 2019 10:13:51 +0000 (10:13 +0000)]
Fix an off-by-one error in the input validation of the SCTP_RESET_STREAMS
socketoption.

This was found by running syzkaller.

MFC after: 3 days

5 years agoarm, acpi: increase size of memory region arrays
jchandra [Tue, 5 Feb 2019 06:25:35 +0000 (06:25 +0000)]
arm, acpi: increase size of memory region arrays

Bump up MAX_HWCNT and MAX_EXCNT to 32 when ACPI is enabled. These are
the sizes of the hwregions and exregions arrays respectively. ACPI
firmware typically has more memory regions and the current value of
16 is not sufficient for some platforms.

This commit fixes a failure seen with AMI firmware on Cavium's Sabre
ThunderX2 reference platform. This platform needs 21 physical memory
regions and 18 excluded regions to boot correctly with the current
firmware release.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D19073

5 years agopowerpc: Don't idle with the wait instruction on booke
jhibbits [Tue, 5 Feb 2019 04:47:41 +0000 (04:47 +0000)]
powerpc: Don't idle with the wait instruction on booke

It appears idling via 'wait' on e5500 causes strange behaviors, such as
top(1) simply hanging sporadically, until input.  Until this can possibly be
sorted out (interrupt issue?), just don't idle on this hardware.  The SoCs
are low power already, and the wait state doesn't save much anyway.

5 years agoextattr_list_vp: Narrow locked section somewhat
cem [Tue, 5 Feb 2019 04:47:21 +0000 (04:47 +0000)]
extattr_list_vp: Narrow locked section somewhat

Suggested by: mjg
Reviewed by: kib, mjg
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D19083

5 years agoextattr_list_vp: Only take shared vnode lock
cem [Tue, 5 Feb 2019 03:32:58 +0000 (03:32 +0000)]
extattr_list_vp: Only take shared vnode lock

List is a 'read'-type operation that does not modify shared state; it's safe
for multiple thread to proceed concurrently.  This is reflected in the vnode
operation LISTEXTATTR locking protocol specification, which only requires a
shared lock.

(Similar to previous r248933.)

Reported by: Case van Rij <case.vanrij AT isilon.com>
Reviewed by: kib, mjg
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D19082

5 years agoFix deterministic builds by sorting input to fts in jevents
mmacy [Tue, 5 Feb 2019 00:31:25 +0000 (00:31 +0000)]
Fix deterministic builds by sorting input to fts in jevents

Reported by: emaste@

5 years agoUpdate CPUID bits definitions and CPU identification based on changes
kib [Mon, 4 Feb 2019 23:57:59 +0000 (23:57 +0000)]
Update CPUID bits definitions and CPU identification based on changes
in SDM rev. 069.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years agoRegularize the Netflix copyright
imp [Mon, 4 Feb 2019 21:28:25 +0000 (21:28 +0000)]
Regularize the Netflix copyright

Use recent best practices for Copyright form at the top of
the license:
1. Remove all the All Rights Reserved clauses on our stuff. Where we
   piggybacked others, use a separate line to make things clear.
2. Use "Netflix, Inc." everywhere.
3. Use a single line for the copyright for grep friendliness.
4. Use date ranges in all places for our stuff.

Approved by: Netflix Legal (who gave me the form), adrian@ (pmc files)

5 years agoFixes for very early use of the pthread_mutex_* and libthr malloc.
kib [Mon, 4 Feb 2019 21:16:15 +0000 (21:16 +0000)]
Fixes for very early use of the pthread_mutex_* and libthr malloc.

When libthr is statically linked into the binary, order of the
constructors execution is not deterministic.  It is possible for the
application constructor to use pthread_mutex_* functions before the
libthr initialization was done.

Handle it by:
- making thr_malloc.c locking functions operational when curthread is not
  yet set;
- making __thr_malloc_init() idempotent, allowing more than one call to it;
- unconditionally calling __thr_malloc_init() before initializing
  a process-private mutex.

Reported and tested by: mmel
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoo As illustrated by e. g. figure 7-14 of the Intel 82599 10 GbE
marius [Mon, 4 Feb 2019 20:46:57 +0000 (20:46 +0000)]
o As illustrated by e. g. figure 7-14 of the Intel 82599 10 GbE
  controller datasheet revision 3.3, in the context of Ethernet
  MACs the control data describing the packet buffers typically
  are named "descriptors". Each of these descriptors references
  one buffer, multiple of which a packet can be composed of.
  By contrast, in comments, messages and the names of structure
  members, iflib(4) refers to DMA resources employed for RX and
  TX buffers (rather than control data) as "desc(riptors)".
  This odd naming convention of iflib(4) made reviewing r343085
  and identifying wrong and missing bus_dmamap_sync(9) calls in
  particular way harder than it already is. This convention may
  also explain why the netmap(4) part of iflib(4) pairs the DMA
  tags for control data with DMA maps of buffers and vice versa
  in calls to bus_dma(9) functions.
  Therefore, change iflib(4) to refer to buf(fers) when buffers
  and not the usual understanding of descriptors is meant. This
  change does not include corrections to the DMA resources used
  in the netmap(4) parts. However, it revises error messages to
  state which kind of allocation/creation failed. Specifically,
  the "Unable to allocate tx_buffer (map) memory" copy & pasted
  inappropriately on several occasions was replaced with proper
  messages.
o Enhance some other error messages to indicate which half - RX
  or TX - they apply to instead of using identical text in both
  cases and generally canonicalize them.
o Correct the descriptions of iflib_{r,t}xsd_alloc() to reflect
  reality; current code doesn't use {r,t}x_buffer structures.
o In iflib_queues_alloc():
  - Remove redundant BUS_DMA_NOWAIT of iflib_dma_alloc() calls,
  - change the M_WAITOK from malloc(9) calls into M_NOWAIT. The
    return values are already checked, deferred DMA allocations
    not being an option at this point, BUS_DMA_NOWAIT has to be
    used anyway and prior malloc(9) calls in this function also
    specify M_NOWAIT.

Reviewed by: shurd
Differential Revision: https://reviews.freebsd.org/D19067

5 years agos/Maximal/Maximum/ in sysctl description.
mav [Mon, 4 Feb 2019 20:09:22 +0000 (20:09 +0000)]
s/Maximal/Maximum/ in sysctl description.

Submitted by: smh
MFC after: 1 week

5 years agoAvoid the DNS lookup for "localhost"
ngie [Mon, 4 Feb 2019 19:12:45 +0000 (19:12 +0000)]
Avoid the DNS lookup for "localhost"

ci.FreeBSD.org does not have access to a DNS resolver/network (unlike my test
VM), so in order for the test to pass on the host, it needs to avoid the DNS
lookup by using the numeric host address representation.

PR: 235200
Reviewed by: asomers, lwhsu
Approved by: emaste (mentor)
MFC after: 2 weeks
MFC with: r343362, r343365, r343367-r343368, r343461
Differential Revision: https://reviews.freebsd.org/D19026

5 years agorelease: arm64: pine64-lts: Use the newly created u-boot-pine64-lts port
manu [Mon, 4 Feb 2019 18:30:47 +0000 (18:30 +0000)]
release: arm64: pine64-lts: Use the newly created u-boot-pine64-lts port

In U-Boot 2019.01 there is now a config for this board, use it for the
release image.

MFC after: 1 week

5 years agorelease: arm64: rpi3: Install the RPI3B+ DTB file
manu [Mon, 4 Feb 2019 18:29:23 +0000 (18:29 +0000)]
release: arm64: rpi3: Install the RPI3B+ DTB file

We should use the correct DTB file otherwise the firmware uses
the RPI3B one.

MFC after: 1 week

5 years agoUse NLDT to get number of LDTs on i386
dim [Mon, 4 Feb 2019 18:07:03 +0000 (18:07 +0000)]
Use NLDT to get number of LDTs on i386

Compiling a GENERIC kernel for i386 with clang 8.0 results in the
following warning:

/usr/src/sys/i386/i386/sys_machdep.c:542:40: error: 'sizeof ((ldt))' will return the size of the pointer, not the array itself [-Werror,-Wsizeof-pointer-div]
        nldt = pldt != NULL ? pldt->ldt_len : nitems(ldt);
                                              ^~~~~~~~~~~
/usr/src/sys/sys/param.h:299:32: note: expanded from macro 'nitems'
#define nitems(x)       (sizeof((x)) / sizeof((x)[0]))
                         ~~~~~~~~~~~ ^

Indeed, 'ldt' is declared as 'union descriptor *', so nitems() is not
the right way to determine the number of LDTs.  Instead, the NLDT define
from sys/x86/include/segments.h should be used.

Reviewed by: kib
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D19074

5 years agoOnly enable trace-cmp on Clang and modern GCC.
andrew [Mon, 4 Feb 2019 16:55:24 +0000 (16:55 +0000)]
Only enable trace-cmp on Clang and modern GCC.

It's was only added to GCC 8.1 so don't try to enable it for earlier
releases.

Reported by: lwhsu
Sponsored by: DARPA, AFRL

5 years agoAdd missed tunables/sysctls for some new vdev variables.
mav [Mon, 4 Feb 2019 16:13:41 +0000 (16:13 +0000)]
Add missed tunables/sysctls for some new vdev variables.

While there, make few existing sysctls writeable, since there is no reason
not to.

MFC after: 1 week

5 years agopowerpc64: Add a trap stack area
luporl [Mon, 4 Feb 2019 16:02:03 +0000 (16:02 +0000)]
powerpc64: Add a trap stack area

Currently, the trap code switches to the the temporary stack in the dbtrap
section. It works in most cases, but in the beginning of the execution, the
temp stack is being used, as starting in the powerpc_init() code.

In this current scenario, the stack is being overwritten, which causes the
return of breakpoint() to take abnormal execution.

This current patchset create a small stack to use by the dbtrap: codepath
avoiding the corruption of the temporary stack.

PR: 224872
Submitted by: breno.leitao_gmail.com
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D14484

5 years agoAdd missing SCTP_EOR entry.
tuexen [Mon, 4 Feb 2019 13:30:47 +0000 (13:30 +0000)]
Add missing SCTP_EOR entry.

MFC after: 3 days

5 years agoRemove two more #ifdefs missed in r343701.
cy [Mon, 4 Feb 2019 05:37:16 +0000 (05:37 +0000)]
Remove two more #ifdefs missed in r343701.

MFC after: 1 month
X-MFC with: r343701

5 years agoAdd support for the authinfo map
gshapiro [Mon, 4 Feb 2019 02:18:27 +0000 (02:18 +0000)]
Add support for the authinfo map

Submitted by: keramida

5 years agoCheck element type before setting LEDs.
mav [Mon, 4 Feb 2019 01:24:10 +0000 (01:24 +0000)]
Check element type before setting LEDs.

With r319610, sesutil started twiddling the bits of every SES device.
Not everything is a disk slot, there are also fan controllers, temperature
sensors, even power supplies, among other things controlled by SES.

Add a type check to make sure we are only operating on device slot and array
device slot elements.  Other type elements will be skipped, but it would be
simple to add additional cases for controlling the ident LEDs of other
element types (which are not necessarily the same bits).

Rather than doing raw bit manipulation of an unstructured byte array using
unnamed numeric constants, leverage existing code abstractions.

Submitted by: Ryan Moeller <ryan@freqlabs.com>
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D19052

5 years agoUse switch instead of chained if/else to improve readability.
mav [Mon, 4 Feb 2019 01:20:56 +0000 (01:20 +0000)]
Use switch instead of chained if/else to improve readability.

Submitted by: Ryan Moeller <ryan@freqlabs.com>
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D19051

5 years agoDo not call PHOLD() while owning the allproc_lock sx.
kib [Sun, 3 Feb 2019 21:31:40 +0000 (21:31 +0000)]
Do not call PHOLD() while owning the allproc_lock sx.

Otherwise the lock might recurse in faultin() if the process is
swapped out.

Reported by: zeising
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoi386: Do not ever store to other-CPU counter64 slot.
kib [Sun, 3 Feb 2019 21:28:58 +0000 (21:28 +0000)]
i386: Do not ever store to other-CPU counter64 slot.

On CPUs supporting cmpxchg8b, fetch is performed by cmpxchg8b on
corresponding CPU slot, which unconditionally write to the slot.  If
for that slot, the owner CPU increments it, then both CPUs might run
the cmpxchg8b instruction concurrently and this might race and
override the incremental write.  So the counter update would be lost.

Fix it by implementing fetch as IPI and accumulation of result.  It is
acceptable for rare counter64 fetch operation to be more expensive.

Diagnosed and tested by: Andreas Longwitz <longwitz@incore.de>
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

5 years agoAllow vm_page_free_prep() to dequeue pages without the page lock.
markj [Sun, 3 Feb 2019 18:43:20 +0000 (18:43 +0000)]
Allow vm_page_free_prep() to dequeue pages without the page lock.

This is a step towards being able to free pages without the page
lock held.  The approach is simply to add an implementation of
vm_page_dequeue_deferred() which does not assert that the page
lock is held.  Formally, the page lock is required to set
PGA_DEQUEUE, but in the case of vm_page_free_prep() we get the
same mutual exclusion for free by virtue of the fact that no
other references to the page may exist.

No functional change intended.

Reviewed by: kib (previous version)
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D19065

5 years agoFix a race in vm_page_dequeue_deferred().
markj [Sun, 3 Feb 2019 18:38:58 +0000 (18:38 +0000)]
Fix a race in vm_page_dequeue_deferred().

To detect the case where the page is already marked for a deferred
dequeue, we must read the "queue" and "aflags" fields in a
precise order.  Otherwise, a race with a concurrent
vm_page_dequeue_complete() could leave the page with PGA_DEQUEUE
set despite it already having been dequeued.  Fix the problem by
using vm_page_queue() to check the queue state, which correctly
handles the race.

Reviewed by: kib
Tested by: pho
MFC after: 3 days
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D19039

5 years agoEnable COVERAGE and KCOV by default on arm64 and amd64.
andrew [Sun, 3 Feb 2019 12:46:27 +0000 (12:46 +0000)]
Enable COVERAGE and KCOV by default on arm64 and amd64.

This allows userspace to trace the kernel using the coverage sanitizer
found in clang. It will also allow other coverage tools to be built as
modules and attach into the same framework.

Sponsored by: DARPA, AFRL

5 years agoTeach pfil_ioctl() about VIMAGE.
glebius [Sun, 3 Feb 2019 08:28:02 +0000 (08:28 +0000)]
Teach pfil_ioctl() about VIMAGE.

Submitted by: gallatin

5 years agoReduce log spam from rpc.statd
dfr [Sun, 3 Feb 2019 08:15:26 +0000 (08:15 +0000)]
Reduce log spam from rpc.statd

This only reports failed attempts to contact hosts on the first attempt.

5 years agonew_kmem_alloc(9) is a Solaris/illumos malloc(9). FreeBSD and NetBSD
cy [Sun, 3 Feb 2019 05:26:10 +0000 (05:26 +0000)]
new_kmem_alloc(9) is a Solaris/illumos malloc(9). FreeBSD and NetBSD
never get here, however a test for SOLARIS, as redundant as this test is,
serves to document that this is the illumos definition. This should help
those who come after me to follow the code more easily.

MFC after: 1 month

5 years agoKernel module shim sources have no business being in the userland
cy [Sun, 3 Feb 2019 05:26:07 +0000 (05:26 +0000)]
Kernel module shim sources have no business being in the userland
build directory, especially those for other operating systems.
The kernel module shims for other operating systems are hereby removed.
The kernel module shim for FreeBSD, mlfk_ipl.c, is already in
sys/contrib/ipfilter/netinet. The one here is never used and should
not be in the userland build directory either.

mlfk_rule.c isn't used either however we will keep it in case someone
wishes to use this shim to load rules via a kernel module, handy for
embedded. In that case it should be copied to
sys/contrib/ipfilter/netinet and a Makefile created to employ it.
(Probably a useful documentation project when time permits.)

MFC after: 1 month

5 years agoRemove a reference to HP-UX in a comment.
cy [Sun, 3 Feb 2019 05:26:04 +0000 (05:26 +0000)]
Remove a reference to HP-UX in a comment.

MFC after: 1 month

5 years agoRemove a redundant ip_compat.h, originally merged from upstream.
cy [Sun, 3 Feb 2019 05:26:01 +0000 (05:26 +0000)]
Remove a redundant ip_compat.h, originally merged from upstream.

MFC after: 1 month

5 years agoipfilter #ifdef cleanup.
cy [Sun, 3 Feb 2019 05:25:49 +0000 (05:25 +0000)]
ipfilter #ifdef cleanup.

Remove #ifdefs for ancient and irrelevant operating systems from
ipfilter.

When ipfilter was written the UNIX and UNIX-like systems in use
were diverse and plentiful. IRIX, Tru64 (OSF/1) don't exist any
more. OpenBSD removed ipfilter shortly after the first time the
ipfilter license terms changed in the early 2000's. ipfilter on AIX,
HP/UX, and Linux never really caught on. Removal of code for operating
systems that ipfilter will never run on again will simplify the code
making it easier to fix bugs, complete partially implemented features,
and extend ipfilter.

Unsupported previous version FreeBSD code and some older NetBSD code
has also been removed.

What remains is supported FreeBSD, NetBSD, and illumos. FreeBSD and
NetBSD have collaborated exchanging patches, while illumos has expressed
willingness to have their ipfilter updated to 5.1.2, provided their
zone-specific updates to their ipfilter are merged (which are of interest
to FreeBSD to allow control of ipfilters in jails from the global zone).

Reviewed by: glebius@
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D19006

5 years agoifconfig(8): actually, non-11n rates should be divided by 2...
avos [Sun, 3 Feb 2019 04:41:00 +0000 (04:41 +0000)]
ifconfig(8): actually, non-11n rates should be divided by 2...

MFC after: 1 week
MFC with: 343698

5 years agonet80211(4): do not setup Tx parameters for unsupported modes.
avos [Sun, 3 Feb 2019 04:31:50 +0000 (04:31 +0000)]
net80211(4): do not setup Tx parameters for unsupported modes.

That should shorten 'ifconfig <wlan> list txparam' output since
unsupported modes will not be shown.

Checked with RTL8188EE, STA mode.

MFC after: 2 weeks

5 years agoifconfig(8): display management / multicast wlan(4) rates properly
avos [Sun, 3 Feb 2019 03:02:59 +0000 (03:02 +0000)]
ifconfig(8): display management / multicast wlan(4) rates properly

For 11n / 11ac we are still using non-11n rates for management and
multicast traffic by default; check 'MCS rate' bit to determine how
to print them correctly.

PR: 161035
MFC after: 1 week

5 years agonet80211(4): fix rate check when 'roaming' ifconfig(8) option is set to 'auto'
avos [Sun, 3 Feb 2019 02:32:13 +0000 (02:32 +0000)]
net80211(4): fix rate check when 'roaming' ifconfig(8) option is set to 'auto'

Do not try to clear 'basic rate' bit from roamRate; it cannot be here and,
actually, this operation clears 'MCS rate' bit instead, breaking comparison
for 11n / 11ac modes.

Tested with RTL8188CUS, HOSTAP mode + RTL8821AU, STA mode.

MFC after: 3 days

5 years agonet80211(4): do not setup roaming parameters for unsupported modes.
avos [Sun, 3 Feb 2019 01:32:02 +0000 (01:32 +0000)]
net80211(4): do not setup roaming parameters for unsupported modes.

ifconfig(8) prints per-mode parameters if they are non-zero; since
we have 13 possible modes with 3...5 typically supported this change
should greatly reduce amount of information for 'ifconfig <wlan> list roam'
command.

While here ensure that sta_roam_check() will not use roaming parameters
for unsupported modes (it should not).

This change effectively reverts r188776.

MFC after: 2 weeks

5 years agoifconfig(8): interpret VHT rates correctly for 'list roam / txparam' options
avos [Sun, 3 Feb 2019 00:18:29 +0000 (00:18 +0000)]
ifconfig(8): interpret VHT rates correctly for 'list roam / txparam' options

They are represented via MCS rate index, not as a 'speed in MBps' * 2.

MFC after: 5 days

5 years agonetmap: upgrade sync-kloop support
vmaffione [Sat, 2 Feb 2019 22:39:29 +0000 (22:39 +0000)]
netmap: upgrade sync-kloop support

Add SYNC_KLOOP_MODE option, and add support for direct mode, where application
executes the TXSYNC and RXSYNC in the context of the ioeventfd wake up callback.

MFC after: 5 days

5 years agoFix interrupt index configuratoin when using MSI interrupts.
pkelsey [Sat, 2 Feb 2019 21:14:53 +0000 (21:14 +0000)]
Fix interrupt index configuratoin when using MSI interrupts.

When in MSI mode, the device was only being configured with one
interrupt index, but it needs two - one for the actual interrupt and
one to park the tx queue at.

Also clarified comments relating to interrupt index assignment.

Reported by: Yuri Pankov <yuripv@yuripv.net>
MFC after: 1 day

5 years agoDrop unused M_80211_COM malloc(9) type.
avos [Sat, 2 Feb 2019 16:23:45 +0000 (16:23 +0000)]
Drop unused M_80211_COM malloc(9) type.

It is not used since r287197.

MFC after: 3 days

5 years agoDo not acquire IEEE80211_LOCK twice in cac_timeout(); reuse
avos [Sat, 2 Feb 2019 16:21:23 +0000 (16:21 +0000)]
Do not acquire IEEE80211_LOCK twice in cac_timeout(); reuse
locked function instead.

It is externally visible since r257065.

MFC after: 5 days

5 years agosys/dev/wtap: Check return value from malloc(..., M_NOWAIT) and
avos [Sat, 2 Feb 2019 16:15:46 +0000 (16:15 +0000)]
sys/dev/wtap: Check return value from malloc(..., M_NOWAIT) and
drop unneeded cast.

MFC after: 3 days

5 years agorun(4): fix allocated memory type for ieee80211_node(4).
avos [Sat, 2 Feb 2019 16:07:56 +0000 (16:07 +0000)]
run(4): fix allocated memory type for ieee80211_node(4).

PR: 177366
MFC after: 3 days

5 years agorun(4): revert previous commit; there were no compiler warning
avos [Sat, 2 Feb 2019 16:06:06 +0000 (16:06 +0000)]
run(4): revert previous commit; there were no compiler warning
(at least, from clang(1)).

5 years agorun(4): fix allocated memory type and -Wincompatible-pointer-types
avos [Sat, 2 Feb 2019 16:01:16 +0000 (16:01 +0000)]
run(4): fix allocated memory type and -Wincompatible-pointer-types
compiler warning.

PR: 177366
MFC after: 3 days

5 years agoReturn PFIL_CONSUMED if packet was consumed. While here gather all
glebius [Sat, 2 Feb 2019 05:49:05 +0000 (05:49 +0000)]
Return PFIL_CONSUMED if packet was consumed.  While here gather all
the identical endings of pf_check_*() into single function.

PR: 235411

5 years agopowerpc/powernv: Add a driver for the POWER9 XIVE interrupt controller
jhibbits [Sat, 2 Feb 2019 04:15:16 +0000 (04:15 +0000)]
powerpc/powernv: Add a driver for the POWER9 XIVE interrupt controller

The XIVE (External Interrupt Virtualization Engine) is a new interrupt
controller present in IBM's POWER9 processor.  It's a very powerful,
very complex device using queues and shared memory to improve interrupt
dispatch performance in a virtualized environment.

This yields a ~10% performance improvment over the XICS emulation mode,
measured in both buildworld, and 'dd' from nvme to /dev/null.

Currently, this only supports native access.

MFC after: 1 month

5 years agoFix integer math overflow in UMA hash_alloc().
mav [Sat, 2 Feb 2019 04:11:59 +0000 (04:11 +0000)]
Fix integer math overflow in UMA hash_alloc().

512GB of ZFS ABD ARC means abd_chunk zone of 128M 4KB items.  To manage
them UMA tries to allocate 2GB hash table, which size does not fit into
the int variable, causing later allocation failure, which makes ARC shrink
back below the 512GB, not letting it to use more RAM.  With this change I
easily reached >700GB ARC size on 768GB RAM machine.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

5 years agortld: pacify -Wmaybe-uninitialized from gcc6
vangyzen [Fri, 1 Feb 2019 23:16:59 +0000 (23:16 +0000)]
rtld: pacify -Wmaybe-uninitialized from gcc6

Sponsored by: Dell EMC Isilon

5 years agolibm: squelch -Woverflow from gcc6
vangyzen [Fri, 1 Feb 2019 23:15:54 +0000 (23:15 +0000)]
libm: squelch -Woverflow from gcc6

Sponsored by: Dell EMC Isilon

5 years agoqlnxr(4), qlnxe(4): Unbreak gcc build
cem [Fri, 1 Feb 2019 23:04:45 +0000 (23:04 +0000)]
qlnxr(4), qlnxe(4): Unbreak gcc build

Remove redundant definitions and conditionalize Clang-specific CFLAGS.

Sponsored by: Dell EMC Isilon

5 years agoreadelf: decode FreeBSD note types
emaste [Fri, 1 Feb 2019 22:24:14 +0000 (22:24 +0000)]
readelf: decode FreeBSD note types

Decode NT_FREEBSD_ABI_TAG, NT_FREEBSD_ARCH_TAG, and NT_FREEBSD_FEATURE_CTL.

Reviewed by: brooks, kib (earlier)
MFC after: 2 weeks
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19054

5 years agoDisable boot-time memory test on i386 be default.
kib [Fri, 1 Feb 2019 21:09:36 +0000 (21:09 +0000)]
Disable boot-time memory test on i386 be default.

With the current 24G memory limit for GENERIC, the boot time test
causes quite visible delay, amplified by the default
debug.late_console = 0.

The comment text is copied from the same setting explanation for
amd64.

Suggested by: bde
Discussed with: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 2 months

5 years agox86: correctly limit max memory resource address..
kib [Fri, 1 Feb 2019 20:46:47 +0000 (20:46 +0000)]
x86: correctly limit max memory resource address..

CPU and buses can manage up to the limit reported by cpu_maxphyaddr,
so set mem_rman to the value returned by cpu_getmaxphyaddr().  For the
PAE mode, it was missed both when rman_res_t was increased to
uintmax_t, and from the PAE merge commit.

When importing smaps or dump_avail chunks into memory rman, do not
blindly ignore resources which ends above the limit, chomp them
instead if start is below the limit.  The same change was already done
to i386 add_physmap_entry().

Based on the submission by: bde
MFC after: 2 months

5 years agocxgbe(4): Improved error reporting and diagnostics.
np [Fri, 1 Feb 2019 20:42:49 +0000 (20:42 +0000)]
cxgbe(4): Improved error reporting and diagnostics.

"slow" interrupt handler:
- Expand the list of INT_CAUSE registers known to the driver.
- Add decode information for many more bits but decouple it from the
  rest of intr_info so that it is entirely optional.
- Call t4_fatal_err exactly once, and from the top level PL intr handler.

t4_fatal_err:
- Use t4_shutdown_adapter from the common code to stop the adapter.
- Stop servicing slow interrupts after the first fatal one.

Driver/firmware interaction:
- CH_DUMP_MBOX: note whether the mailbox being dumped is a command or a
  reply or something else.
- Log the raw value of pcie_fw for some errors.
- Use correct log levels (debug vs. error).

Sponsored by: Chelsio Communications

5 years agoreadelf: use table-based DT_FLAGS and DT_FLAGS_1 decoding
emaste [Fri, 1 Feb 2019 20:28:15 +0000 (20:28 +0000)]
readelf: use table-based DT_FLAGS and DT_FLAGS_1 decoding

Fewer lines of code and more maintainable.

Reviewed by: brooks, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19053

5 years agoFix function keys for syscons in cons25 mode (vidcontrol -T cons25).
bde [Fri, 1 Feb 2019 16:07:49 +0000 (16:07 +0000)]
Fix function keys for syscons in cons25 mode (vidcontrol -T cons25).

kbd(4) (but only documented in atkbd(4)) maintains a table of strings
for 96 function keys.  Using teken broke this 9+ years ago for the
most usable first 12 function keys and for 10 cursor keys, by supplying
its own non-programmable strings so that the keyboard driver's strings
are not used.

Fix this by supplying NULL in the teken layer for syscons in cons25 mode
so that the the strings are found in the kbd(4) layer.

vt needs more changes to use kbd(4)'s tables.  Teken's cons25 table is
still needed to supply nonempty strings for vt in cons25 mode.

Keep using teken's xterm tables for both syscons and vt in xterm mode.
Function keys should at least default to xterm values in xterm mode,
and kbd(4) doesn't support this.

teken_set_cons25() sets a sticky flag to ask for the fix, and space is
reserved for another new flag.  vt should set this flag when it uses
kbd(4)'s tables.

PR: 226553 (for vt)

5 years agoWhen handling SYN-ACK segments in the SYN-RCVD state, set tp->snd_wnd
tuexen [Fri, 1 Feb 2019 12:33:00 +0000 (12:33 +0000)]
When handling SYN-ACK segments in the SYN-RCVD state, set tp->snd_wnd
consistently.

This inconsistency was observed when working on the bug reported in
PR 235256, although it does not fix the reported issue. The fix for
the PR will be a separate commit.

PR: 235256
Reviewed by: rrs@, Richard Scheffenegger
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D19033

5 years agoRepair siftr(4): PFIL_IN and PFIL_OUT are defines of some value, relying
glebius [Fri, 1 Feb 2019 08:10:26 +0000 (08:10 +0000)]
Repair siftr(4): PFIL_IN and PFIL_OUT are defines of some value, relying
on them having particular values can break things.

5 years agoUnbreak call to ipf_check(): it expects the out parameter to be 0 or 1.
glebius [Fri, 1 Feb 2019 07:48:37 +0000 (07:48 +0000)]
Unbreak call to ipf_check(): it expects the out parameter to be 0 or 1.

Pointy hat to: glebius
Reported by: cy

5 years agoRevert r343634:
araujo [Fri, 1 Feb 2019 03:09:11 +0000 (03:09 +0000)]
Revert r343634:
Mostly a cosmetic change to replace strlen with strnlen.

Requested by: kib and imp

5 years agoHopefully fix compilation by other compilers.
glebius [Fri, 1 Feb 2019 00:34:18 +0000 (00:34 +0000)]
Hopefully fix compilation by other compilers.

5 years agoFix build without INET6.
glebius [Fri, 1 Feb 2019 00:33:17 +0000 (00:33 +0000)]
Fix build without INET6.

5 years agoMostly a cosmetic change to replace strlen with strnlen.
araujo [Thu, 31 Jan 2019 23:32:19 +0000 (23:32 +0000)]
Mostly a cosmetic change to replace strlen with strnlen.

Obtained from: Project ACRN
MFC after: 2 weeks

5 years agoShar files may be seen as binary by grep.
bdrewery [Thu, 31 Jan 2019 23:21:18 +0000 (23:21 +0000)]
Shar files may be seen as binary by grep.

Suggest using -a to egrep to properly see executed commands.

This is a minor improvement to the manpage.  A better improvement
would be removal or gigantic warnings.

Sponsored by: Dell EMC
MFC after: 1 week

5 years agoRemove iBCS2: also remove xenix syscall function support.
brooks [Thu, 31 Jan 2019 23:01:12 +0000 (23:01 +0000)]
Remove iBCS2: also remove xenix syscall function support.

Missed in r342243.

5 years agoNew pfil(9) KPI together with newborn pfil API and control utility.
glebius [Thu, 31 Jan 2019 23:01:03 +0000 (23:01 +0000)]
New pfil(9) KPI together with newborn pfil API and control utility.

The KPI have been reviewed and cleansed of features that were planned
back 20 years ago and never implemented.  The pfil(9) internals have
been made opaque to protocols with only returned types and function
declarations exposed. The KPI is made more strict, but at the same time
more extensible, as kernel uses same command structures that userland
ioctl uses.

In nutshell [KA]PI is about declaring filtering points, declaring
filters and linking and unlinking them together.

New [KA]PI makes it possible to reconfigure pfil(9) configuration:
change order of hooks, rehook filter from one filtering point to a
different one, disconnect a hook on output leaving it on input only,
prepend/append a filter to existing list of filters.

Now it possible for a single packet filter to provide multiple rulesets
that may be linked to different points. Think of per-interface ACLs in
Cisco or Juniper. None of existing packet filters yet support that,
however limited usage is already possible, e.g. default ruleset can
be moved to single interface, as soon as interface would pride their
filtering points.

Another future feature is possiblity to create pfil heads, that provide
not an mbuf pointer but just a memory pointer with length. That would
allow filtering at very early stages of a packet lifecycle, e.g. when
packet has just been received by a NIC and no mbuf was yet allocated.

Differential Revision: https://reviews.freebsd.org/D18951

5 years agoRegen after r342190.
brooks [Thu, 31 Jan 2019 22:58:17 +0000 (22:58 +0000)]
Regen after r342190.

Differential Revision: https://reviews.freebsd.org/D18444