]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoAdd support for Read_Local_Supported_Commands command to hccontrol(8).
Hans Petter Selasky [Wed, 22 Apr 2020 14:38:39 +0000 (14:38 +0000)]
Add support for Read_Local_Supported_Commands command to hccontrol(8).

Submitted by: Marc Veldman <marc@bumblingdork.com>
PR: 245811
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoFactor code in LinuxKPI to allow attach and detach using any BSD device.
Hans Petter Selasky [Wed, 22 Apr 2020 14:33:25 +0000 (14:33 +0000)]
Factor code in LinuxKPI to allow attach and detach using any BSD device.
This allows non-LinuxKPI based infiniband device drivers to attach
correctly to ibcore.

No functional change intended.

Reviewed by: np @
Differential Revision: https://reviews.freebsd.org/D24514
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoImprove input validation when processing AUTH chunks.
Michael Tuexen [Wed, 22 Apr 2020 12:47:46 +0000 (12:47 +0000)]
Improve input validation when processing AUTH chunks.

Thanks to Natalie Silvanovich from Google for finding and reporting the
issue found by her in the SCTP userland stack.

MFC after: 3 days

4 years agoEnable timer tests in sys.kqueue.libkqueue.kqueue_test.main on i386
Li-Wen Hsu [Wed, 22 Apr 2020 09:53:41 +0000 (09:53 +0000)]
Enable timer tests in sys.kqueue.libkqueue.kqueue_test.main on i386

They were fixed in r360140

PR: 245768
Sponsored by: The FreeBSD Foundation

4 years agoConvert TOE routing lookups to the new routing KPI.
Alexander V. Chernikov [Wed, 22 Apr 2020 07:53:43 +0000 (07:53 +0000)]
Convert TOE routing lookups to the new routing KPI.

Reviewed by: np
Differential Revision: https://reviews.freebsd.org/D24388

4 years agoCorrect efi(8) reference.
Christian Brueffer [Wed, 22 Apr 2020 07:47:04 +0000 (07:47 +0000)]
Correct efi(8) reference.

Submitted by: Gordon Bergling
Differential Revision: https://reviews.freebsd.org/D24441

4 years agoImprove formatting of synopsis section
Mateusz Piotrowski [Wed, 22 Apr 2020 06:32:51 +0000 (06:32 +0000)]
Improve formatting of synopsis section

This patch is about sorting the arguments and using proper mdoc(7) macros
to stylize arguments and command modifiers for much better readability.

Further style fixes in other sections within the bhyve manual page are
going to be worked on in upcoming patches.

Reviewed by: rgrimes
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24526

4 years agokqueue(2): de-vandalize the random sentence in the middle
Kyle Evans [Wed, 22 Apr 2020 04:05:02 +0000 (04:05 +0000)]
kqueue(2): de-vandalize the random sentence in the middle

A last minute change appears to have inadvertently vandalized unrelated
parts of the manpage with the date. =-(

Reported by: rpokala

4 years agokqueue(2): add a note about EV_RECEIPT
Kyle Evans [Wed, 22 Apr 2020 03:45:52 +0000 (03:45 +0000)]
kqueue(2): add a note about EV_RECEIPT

In the below-referenced PR, a case is attached of a simple reproducer that
exhibits suboptimal behavior: EVFILT_READ and EVFILT_WRITE being set in the
same kevent(2) call will only honor the first one. This is, in-fact, how
it's supposed to work.

A read of the manpage leads me to believe we could be more clear about this;
right now there's a logical leap to make in the relevant statement: "When
passed as input, it forces EV_ERROR to always be returned." -- the logical
leap being that this indicates the caller should have allocated space for
the change to be returned with EV_ERROR indicated in the events, or
subsequent filters will get dropped on the floor.

Another possible workaround that accomplishes similar effect without needing
space for all events is just setting EV_RECEIPT on the final change being
passed in; if any errored before it, the kqueue would not be drained. If we
made it to the final change with EV_RECEIPT set, then we would return that
one with EV_ERROR and still not drain the kqueue. This would seem to not be
all that advisable.

PR: 229741
MFC after: 1 week

4 years agoAdd genet driver for Raspberry Pi 4B Ethernet
Mike Karels [Wed, 22 Apr 2020 00:42:10 +0000 (00:42 +0000)]
Add genet driver for Raspberry Pi 4B Ethernet

Add driver for Broadcom "GENET" version 5, as found in BCM-2711 on
Raspberry Pi 4B. The driver is derived in part from the bcmgenet.c
driver in NetBSD, along with bcmgenetreg.h.

Reviewed by: manu
Obtained from: in part from NetBSD
Relnotes: yes, note addition
Differential Revision: https://reviews.freebsd.org/D24436

4 years agorevert rS360143 - Correctly set up initial cwnd
Richard Scheffenegger [Wed, 22 Apr 2020 00:16:42 +0000 (00:16 +0000)]
revert rS360143 - Correctly set up  initial cwnd
due to syzkaller panics found

Reported by: tuexen
Approved by: tuexen (mentor)
Sponsored by: NetApp, Inc.

4 years agoDon't pass a user buffer pointer as the data pointer in a CCB.
John Baldwin [Tue, 21 Apr 2020 23:38:54 +0000 (23:38 +0000)]
Don't pass a user buffer pointer as the data pointer in a CCB.

Allocate a temporary buffer in the kernel to serve as the CCB data
pointer for a pass-through transaction and use copyin/copyout to
shuffle the data to/from the user buffer.

Reviewed by: scottl, brooks
Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24489

4 years agoMap negative types passed to vm_capability_type2name to NULL.
John Baldwin [Tue, 21 Apr 2020 21:48:35 +0000 (21:48 +0000)]
Map negative types passed to vm_capability_type2name to NULL.

Submitted by: vangyzen

4 years agovmm(4): Decode and emulate BEXTR
Conrad Meyer [Tue, 21 Apr 2020 21:34:24 +0000 (21:34 +0000)]
vmm(4): Decode and emulate BEXTR

Clang 10 -march=native kernels on znver1 emit BEXTR for APIC reads,
apparently.  Decode and emulate the instruction.

Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D24463

4 years agovmm(4): Decode 3-byte VEX-prefixed instructions
Conrad Meyer [Tue, 21 Apr 2020 21:33:06 +0000 (21:33 +0000)]
vmm(4): Decode 3-byte VEX-prefixed instructions

Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D24462

4 years agoMerge OpenSSL 1.1.1g.
Jung-uk Kim [Tue, 21 Apr 2020 19:38:32 +0000 (19:38 +0000)]
Merge OpenSSL 1.1.1g.

4 years agoImport OpenSSL 1.1.1g.
Jung-uk Kim [Tue, 21 Apr 2020 19:07:46 +0000 (19:07 +0000)]
Import OpenSSL 1.1.1g.

4 years agoUpdate string tables in hccontrol(8).
Hans Petter Selasky [Tue, 21 Apr 2020 17:51:54 +0000 (17:51 +0000)]
Update string tables in hccontrol(8).

Submitted by: Marc Veldman <marc@bumblingdork.com>
PR: 245796
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoDon't access a user buffer directly from the kernel.
John Baldwin [Tue, 21 Apr 2020 17:47:05 +0000 (17:47 +0000)]
Don't access a user buffer directly from the kernel.

The handle_string callback for the ENCIOC_SETSTRING ioctl was passing
a user pointer to memcpy().  Fix by using copyin() instead.

For ENCIOC_GETSTRING ioctls, the handler was storing the user pointer
in a CCB's data_ptr field where it was indirected by other code.  Fix
this by allocating a temporary buffer (which ENCIOC_SETSTRING already
did) and copying the result out to the user buffer after the CCB has
been processed.

Reviewed by: kib
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24487

4 years agoRetire two unused background fsck sysctls.
John Baldwin [Tue, 21 Apr 2020 17:42:32 +0000 (17:42 +0000)]
Retire two unused background fsck sysctls.

These two sysctls were added to support UFS softupdates journalling
with snapshots.  However, the changes to fsck to use them were never
committed and there have never been any in-tree uses of these sysctls.

More details from Kirk:

When journalling got added to soft updates, its journal rollback freed
blocks that it thought were no longer in use. But it does not take
snapshots into account (i.e., if a snapshot is still using it, then it
cannot be freed). So I added the needed logic to fsck by having the
free go through the kernel's blkfree code so it could grab blocks that
were still needed by snapshots. That is done using the setbufoutput
hack. I never got that code working reliably, so it is still sitting
in my work directory. Which also explains why you still cannot take
snapshots on filesystems running with journalling...

In looking over my use of this feature, and in particular the troubles
I was having with it, I conclude that it may be better to extract the
code from the kernel that handles freeing blocks claimed by snapshots
and putting it into fsck directly. My original intent was that it is
complex and at the time changing, so only having to maintain it in one
place was appealing. But at this point it has not changed in years and
the hacks like setinode and setbufoutput to be able to use the kernel
code is sufficiently ugly, that I am leaning towards just extracting
it.

Reviewed by: mckusick
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24484

4 years agoCheck the magic value in longjmp() before calling sigprocmask().
John Baldwin [Tue, 21 Apr 2020 17:40:23 +0000 (17:40 +0000)]
Check the magic value in longjmp() before calling sigprocmask().

This avoids passing garbage to sigprocmask() if the jump buffer is
invalid.

Reviewed by: mhorne
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24483

4 years agoHandle non-dtrace-triggered kernel breakpoint traps in mips.
John Baldwin [Tue, 21 Apr 2020 17:38:07 +0000 (17:38 +0000)]
Handle non-dtrace-triggered kernel breakpoint traps in mips.

If DTRACE is enabled at compile time, all kernel breakpoint traps are
first given to dtrace to see if they are triggered by a FBT probe.
Previously if dtrace didn't recognize the trap, it was silently
ignored breaking the handling of other kernel breakpoint traps such as
the debug.kdb.enter sysctl.  This only returns early from the trap
handler if dtrace recognizes the trap and handles it.

Submitted by: Nicolò Mazzucato <nicomazz97@gmail.com>
Reviewed by: markj
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D24478

4 years agoAbort transfer if fseeko() fails.
John Baldwin [Tue, 21 Apr 2020 17:32:57 +0000 (17:32 +0000)]
Abort transfer if fseeko() fails.

CID: 1420215
Reviewed by: asomers
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24454

4 years agoAdd description string for VM_CAP_BPT_EXIT.
John Baldwin [Tue, 21 Apr 2020 17:30:56 +0000 (17:30 +0000)]
Add description string for VM_CAP_BPT_EXIT.

While here, replace the array of mapping structures with an array of
string pointers where the index is the capability value.

Submitted by: Rob Fairbanks <rob.fx907@gmail.com>
Reviewed by: rgrimes
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24289

4 years agoAlso update est(4) as r360162 and r360164
Li-Wen Hsu [Tue, 21 Apr 2020 17:17:32 +0000 (17:17 +0000)]
Also update est(4) as r360162 and r360164

MFC after: 3 days

4 years agoUpdate .Dd
Li-Wen Hsu [Tue, 21 Apr 2020 17:14:08 +0000 (17:14 +0000)]
Update .Dd

4 years agoHandle PCATCH in blockcount_sleep() so it can be interrupted.
Mark Johnston [Tue, 21 Apr 2020 17:13:06 +0000 (17:13 +0000)]
Handle PCATCH in blockcount_sleep() so it can be interrupted.

blockcount_wait() still unconditionally waits for the count to reach
zero before returning.

Tested by: pho (a larger patch)
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24513

4 years agohwpstate_intel(4): small text tweaks
Li-Wen Hsu [Tue, 21 Apr 2020 17:07:02 +0000 (17:07 +0000)]
hwpstate_intel(4): small text tweaks

The sysctl output looks like this:

dev.hwpstate_intel.0.epp: 50
dev.hwpstate_intel.0.%parent: cpu0
dev.hwpstate_intel.0.%pnpinfo:
dev.hwpstate_intel.0.%location:
dev.hwpstate_intel.0.%driver: hwpstate_intel
dev.hwpstate_intel.0.%desc: Intel Speed Shift

but all the '%' got escaped in the manual page, un-escape them.

While here:
- Move the example of dev.hwpstate_intel.%d.%parent after the description to
  align with others.
- Capitalize "CPU" (*)

Submitted by: danfe (*)
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D24520

4 years agokevent32: fix the split of data into data1/data2
Kyle Evans [Tue, 21 Apr 2020 16:13:22 +0000 (16:13 +0000)]
kevent32: fix the split of data into data1/data2

The current situation results in intermittent breakage if data gets split up
with the sign bit set on the data1 half of it, as PAIR32TO64 will then:
data1 | (data2 << 32) -> resulting in data1 getting sign-extended when it's
implicitly widened and clobbering the result. AFAICT, there's no compelling
reason for these to be signed.

This was most exposed by flakiness in the kqueue timer tests under compat32
after the ABSTIME test got switched over to using a better clock and
microseconds.

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

4 years agoFactor out the kmem contig page alloc and reclamation code.
Mark Johnston [Tue, 21 Apr 2020 16:01:44 +0000 (16:01 +0000)]
Factor out the kmem contig page alloc and reclamation code.

kmem_alloc_attr_domain() and kmem_alloc_contig_domain() duplicated each
other's page allocation and reclamation logic.  Place it in a single
function to make it easier to add additional consumers.  No functional
change intended.

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

4 years agoMinimize conditional compilation for handling of M_EXEC.
Mark Johnston [Tue, 21 Apr 2020 15:55:28 +0000 (15:55 +0000)]
Minimize conditional compilation for handling of M_EXEC.

This simplifies some planned changes.  No functional change intended.

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

4 years agoRemove extern from function declarations in common.h
Alex Richardson [Tue, 21 Apr 2020 15:55:08 +0000 (15:55 +0000)]
Remove extern from function declarations in common.h

Suggested by: cem

4 years agoFix OpenSSL remote denial of service.
Gordon Tetlow [Tue, 21 Apr 2020 15:44:20 +0000 (15:44 +0000)]
Fix OpenSSL remote denial of service.

See https://www.openssl.org/news/secadv/20200421.txt for details.

Approved by: so
Security: CVE-2020-1967

4 years agoSilence down a warning which should really be a debug message.
Edward Tomasz Napierala [Tue, 21 Apr 2020 13:57:51 +0000 (13:57 +0000)]
Silence down a warning which should really be a debug message.

MFC after: 2 weeks
Sponsored by: DARPA

4 years agoblacklistd.8: fix db file path
Ed Maste [Tue, 21 Apr 2020 13:30:00 +0000 (13:30 +0000)]
blacklistd.8: fix db file path

PR: 245781
Submitted by: Jose Luis Duran
MFC after: 3 days

4 years agoCorrectly set up the initial TCP congestion window
Richard Scheffenegger [Tue, 21 Apr 2020 13:05:44 +0000 (13:05 +0000)]
Correctly set up the initial TCP congestion window
in all cases, by adjust snd_una right after the
connection initialization, to include the one byte
in sequence space occupied by the SYN bit.

This does not change the regular ACK processing,
while making the BYTES_THIS_ACK macro to work properly.

PR: 235256
Reviewed by: tuexen (mentor), rgrimes (mentor)
Approved by: tuexen (mentor), rgrimes (mentor)
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D19000

4 years agokqueue: fix conversion of timer data to sbintime
Kyle Evans [Tue, 21 Apr 2020 03:57:30 +0000 (03:57 +0000)]
kqueue: fix conversion of timer data to sbintime

This unbreaks the i386 kqueue timer tests after a recent change switched
NOTE_ABSTIME over to using microseconds. Notably, the data argument (which
holds useconds) is an int64_t, but we were passing it to timer2sbintime
which takes an intptr_t. Perhaps in a previous incarnation, intptr_t would
have made sense, but now it just leads to the timestamp getting truncated
and subsequently rejected when it no longer fits in an intptr_t.

PR: 245768
Reported by: lwhsu / CI
MFC after: 1 week

4 years agoFix build with NO_HISTORY set
Bryan Drewery [Tue, 21 Apr 2020 00:37:55 +0000 (00:37 +0000)]
Fix build with NO_HISTORY set

Reviewed by: jilles
Differential Revision: https://reviews.freebsd.org/D24458

4 years agoFix immediate crash when snmpd is bound to a specific IP address.
Gleb Smirnoff [Mon, 20 Apr 2020 23:32:49 +0000 (23:32 +0000)]
Fix immediate crash when snmpd is bound to a specific IP address.

The code that sets up msghdr must first fully fill in the msghdr
itself, and only then use CMSG_xxx() macros.

Silence from: harti, one week

4 years agoUpdate comments about IVs used in IPsec ESP.
John Baldwin [Mon, 20 Apr 2020 22:57:15 +0000 (22:57 +0000)]
Update comments about IVs used in IPsec ESP.

Add some prose and a diagram describing the layout of the cipher IV
for AES-CTR and AES-GCM and how it relates to the ESP IV stored in the
packet after the ESP header.  Also, remove an XXX comment about the
initial block counter value used for AES-CTR in esp_output as the
current code matches the RFC (and the equivalent code in esp_input
didn't have the XXX comment).

Discussed with: cem

4 years agoRetire the CRYPTO_F_IV_GENERATE flag.
John Baldwin [Mon, 20 Apr 2020 22:24:49 +0000 (22:24 +0000)]
Retire the CRYPTO_F_IV_GENERATE flag.

The sole in-tree user of this flag has been retired, so remove this
complexity from all drivers.  While here, add a helper routine drivers
can use to read the current request's IV into a local buffer.  Use
this routine to replace duplicated code in nearly all drivers.

Reviewed by: cem
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D24450

4 years agoGenerate IVs directly in esp_output.
John Baldwin [Mon, 20 Apr 2020 22:20:26 +0000 (22:20 +0000)]
Generate IVs directly in esp_output.

This is the only place that uses CRYPTO_F_IV_GENERATE.  All crypto
drivers currently duplicate the same boilerplate code to handle this
case.  Doing the generation directly removes complexity from drivers.
It also simplifies support for separate input and output buffers.

Reviewed by: cem
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D24449

4 years agoMerge commit 64b31d96d from llvm git (by Nemanja Ivanovic):
Dimitry Andric [Mon, 20 Apr 2020 19:16:10 +0000 (19:16 +0000)]
Merge commit 64b31d96d from llvm git (by Nemanja Ivanovic):

  [PowerPC] Do not attempt to reuse load for 64-bit FP_TO_UINT without
  FPCVT

  We call the function that attempts to reuse the conversion without
  checking whether the target matches the constraints that the callee
  expects. This patch adds the check prior to the call.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=43976
  Differential revision: https://reviews.llvm.org/D77564

This should fix 'Assertion failed: ((Op.getOpcode() == ISD::FP_TO_SINT
|| Subtarget.hasFPCVT()) && "i64 FP_TO_UINT is supported only with
FPCVT"), function LowerFP_TO_INTForReuse, file
/usr/src/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp, line 7276'
when building the devel/libslang2 port (and a few others) for PowerPC64.

Requested by: pkubaj
MFC after: 6 weeks
X-MFC-With: 358851

4 years agoFix kern.evdev.rcpt_mask on powerpc
Niclas Zeising [Mon, 20 Apr 2020 18:23:31 +0000 (18:23 +0000)]
Fix kern.evdev.rcpt_mask on powerpc

In r360126, I meant to have a different mask only on powerpc, not powerpc64.
Update the check to check that we're not compiling for powerpc64.

Reported by: jhibbits
Approved by: wulf (implicit)
MFC after: 2 weeks
X-MFC-Note: 12 only
X-MFC-With: r360126
Differential Revision: D24370 (followup)

4 years agoacpi_ec(4): Do not probe "successfully" if an error occurred
Conrad Meyer [Mon, 20 Apr 2020 18:01:45 +0000 (18:01 +0000)]
acpi_ec(4): Do not probe "successfully" if an error occurred

All of the 'goto out;' cases in this probe routine without explicit
initialization of 'ret' indicate error cases and were clearly intended
to use the initial definition of 'ret' with ENXIO.  However, 'ret' was
accidentally squashed by reuse for a subroutine call near the beginning
of probe.

Use a different variable for the subroutine status to preserve ENXIO ret
for the 'goto out's as a minimal solution to the panic reported at attach
for now.

PR: 245757

4 years agoTemporarily skip timer tests in sys.kqueue.libkqueue.kqueue_test.main on i386
Li-Wen Hsu [Mon, 20 Apr 2020 17:48:10 +0000 (17:48 +0000)]
Temporarily skip timer tests in sys.kqueue.libkqueue.kqueue_test.main on i386

PR: 245768
Sponsored by: The FreeBSD Foundation

4 years agoMerge commit ce5173c0e from llvm git (by Reid Kleckner):
Dimitry Andric [Mon, 20 Apr 2020 17:39:51 +0000 (17:39 +0000)]
Merge commit ce5173c0e from llvm git (by Reid Kleckner):

  Use FinishThunk to finish musttail thunks

  FinishThunk, and the invariant of setting and then unsetting
  CurCodeDecl, was added in 7f416cc42638 (2015). The invariant didn't
  exist when I added this musttail codepath in ab2090d10765 (2014).
  Recently in 28328c3771, I started using this codepath on non-Windows
  platforms, and users reported problems during release testing
  (PR44987).

  The issue was already present for users of EH on i686-windows-msvc,
  so I added a test for that case as well.

  Reviewed By: hans

  Differential Revision: https://reviews.llvm.org/D76444

This should fix 'Assertion failed: (!empty() && "popping exception stack
when not empty"), function popTerminate, file
/usr/src/contrib/llvm-project/clang/lib/CodeGen/CGCleanup.h, line 583'
when building the net-p2p/libtorrent-rasterbar

PR: 244830
Reported by: jbeich, yuri
MFC after: 6 weeks
X-MFC-With: 358851

4 years agoImplement the atomic fetch add unless functions for the LinuxKPI.
Hans Petter Selasky [Mon, 20 Apr 2020 16:21:37 +0000 (16:21 +0000)]
Implement the atomic fetch add unless functions for the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoChange kern.evdev.rcpt_mask to 12 by default
Niclas Zeising [Mon, 20 Apr 2020 16:17:16 +0000 (16:17 +0000)]
Change kern.evdev.rcpt_mask to 12 by default

Change kern.evdev.rcpt_mask from 3 to 12 by default.  This makes us much
more evdev-friendly, and will prevent everyone using xorg and wayland with
evdev devices (the default) from needing to change this locally.

powerpc32 still uses the old value for the keyboard part, becaues the adb
keyboard driver used there is not evdev compatible.

Reviewed by: wulf
Approved by: wulf
MFC after: 2 weeks
X-MFC-Note: 12 only
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D24370

4 years agodiff(1): reject conflicting formatting options
Kyle Evans [Mon, 20 Apr 2020 16:14:44 +0000 (16:14 +0000)]
diff(1): reject conflicting formatting options

This matches GNU diff(1) behavior and, more importantly, eliminates any
source of confusion if multiple formatting options are specified.

Note that the committed diff differs slightly from the submitted: I've
modified it so that we initialize diff_format to something that isn't an
accepted format option so that we can also reject --normal -c and -c
--normal, which would've otherwise been accepted because the default was
--normal. After option parsing we default it to D_NORMAL if it's still
unset.

PR: 243975
Submitted by: fehmi noyan isi
MFC after: 1 week

4 years agohdac: remove unused macro
Ed Maste [Mon, 20 Apr 2020 15:41:40 +0000 (15:41 +0000)]
hdac: remove unused macro

4 years agoAllow namespace-id specification where it makes sense.
Alexander Motin [Mon, 20 Apr 2020 14:54:41 +0000 (14:54 +0000)]
Allow namespace-id specification where it makes sense.

It makes tool more convenient to not require user to explicitly convert
namespace device name into controller device name.  There should be no
changes to already existing syntaxes.

MFC after: 1 week

4 years agoHandle trashed queue pointers in vm_page_acquire_unlocked().
Mark Johnston [Mon, 20 Apr 2020 14:45:17 +0000 (14:45 +0000)]
Handle trashed queue pointers in vm_page_acquire_unlocked().

vm_page_acquire_unlocked() relies on type-stability of vm_page
structures and assumes that the listq linkage pointers always point to a
vm_page or are NULL.  QUEUE_MACRO_DEBUG_TRASH breaks that assumption, so
add an explicit check for a trashed queue pointer before dereferencing.

Reported and tested by: pho
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24472

4 years agoOnly skip sys.netinet.socket_afinet.socket_afinet_bind_zero in CI env
Li-Wen Hsu [Mon, 20 Apr 2020 14:24:13 +0000 (14:24 +0000)]
Only skip sys.netinet.socket_afinet.socket_afinet_bind_zero in CI env

Sponsored by: The FreeBSD Foundation

4 years agoTemporarily disable sys.netinet.divert.* on i386
Li-Wen Hsu [Mon, 20 Apr 2020 14:18:56 +0000 (14:18 +0000)]
Temporarily disable sys.netinet.divert.* on i386

PR: 244703
Sponsored by: The FreeBSD Foundation

4 years agoImplement aligned LinuxKPI types for u16, u32 and u64.
Hans Petter Selasky [Mon, 20 Apr 2020 14:03:05 +0000 (14:03 +0000)]
Implement aligned LinuxKPI types for u16, u32 and u64.
Makes a difference for 32-bit platforms mostly.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoAllow test_bit() in the LinuxKPI to accept a const pointer.
Hans Petter Selasky [Mon, 20 Apr 2020 13:47:15 +0000 (13:47 +0000)]
Allow test_bit() in the LinuxKPI to accept a const pointer.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoOpen device with O_RDONLY when command is non-invasive.
Alexander Motin [Mon, 20 Apr 2020 13:47:07 +0000 (13:47 +0000)]
Open device with O_RDONLY when command is non-invasive.

This allows to use some of the subcommands against mounted nvd devices.

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

4 years agoSubstitute le_read_supported_status with le_read_supported_states.
Hans Petter Selasky [Mon, 20 Apr 2020 13:44:14 +0000 (13:44 +0000)]
Substitute le_read_supported_status with le_read_supported_states.
Refer to bluetooth core v5.2 specifications Vol4. Part E. 7.8.27.

PR: 245763
Submitted by: Marc Veldman <marc@bumblingdork.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoAllow the ERR_CAST() function in the LinuxKPI to take a const void pointer.
Hans Petter Selasky [Mon, 20 Apr 2020 13:36:01 +0000 (13:36 +0000)]
Allow the ERR_CAST() function in the LinuxKPI to take a const void pointer.
No functional change.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agotests: kqueue: fix some issues with now() on ILP32 platforms
Kyle Evans [Mon, 20 Apr 2020 00:47:28 +0000 (00:47 +0000)]
tests: kqueue: fix some issues with now() on ILP32 platforms

There were ultimately two separate problems here:
- a 32-bit long cannot represent microseconds since 1970 (noted by ian)
- time_t is 32-bit on i386, so now() was wrong anyways even with the correct
  return type.

For the first, just explicitly use a uint64_t for now() and all of the
callers. For the second, we need to explicitly cast tv_sec to uint64_t
before it gets multiplied in the SEC_TO_US macro. Casting this instance
rather than generally in the macro was arbitrarily chosen simply because all
other uses are converting small relative time values.

The tests now pass on i386, at least; presumably other ILP32 will be fine
now as well.

4 years agovmm(4): Bump VM_MAX_MEMMAPS for vmgenid
Conrad Meyer [Sun, 19 Apr 2020 23:53:47 +0000 (23:53 +0000)]
vmm(4): Bump VM_MAX_MEMMAPS for vmgenid

As a short term solution for the problem reported by Shawn Webb re: r359950,
bump the maximum number of memmaps per VM. This structure is 40 bytes, and the
additional four (fixed array embedded in the struct vm) members increase the
size of struct vm by 3%.

(The vast majority of struct vm is the embedded struct vcpu array, which
accounts for 84% of the size -- over 4 kB.)

Reported by: Shawn Webb <shawn.webb AT hardenedbsd.org>
Reviewed by: grehan
X-MFC-With: r359950
Differential Revision: https://reviews.freebsd.org/D24507

4 years agoDue to popular demand, revert r360102.
Cy Schubert [Sun, 19 Apr 2020 21:38:03 +0000 (21:38 +0000)]
Due to popular demand, revert r360102.

Reported by: many

4 years agosnd_hda: whitespace and style(9) cleanups
Ed Maste [Sun, 19 Apr 2020 17:53:44 +0000 (17:53 +0000)]
snd_hda: whitespace and style(9) cleanups

4 years agoUse LIST_FOREACH_SAFE instead of LIST_FOREACH as we are removing
Xin LI [Sun, 19 Apr 2020 17:28:42 +0000 (17:28 +0000)]
Use LIST_FOREACH_SAFE instead of LIST_FOREACH as we are removing
elements in the middle.

This fixes a panic when detaching USB mouse.

PR: 245732
Reviewed by: wulf
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D24500

4 years agoConditionally install Kerberos rc files based on MK_KERBEROS_SCRIPTS
Cy Schubert [Sun, 19 Apr 2020 17:01:21 +0000 (17:01 +0000)]
Conditionally install Kerberos rc files based on MK_KERBEROS_SCRIPTS
instead of MK_KERBEROS. The reason for this change is some users
prefer to build FreeBSD WITHOUT_KERBEROS, wanting to retain the
Kerberos rc scripts to start/stop MIT Kerberos or Heimdal from ports.

PR: 197337
Reported by: Adam McDougall <ebay at looksharp.net>
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D24252

4 years agoConvert ipfilter to the new routing KPI.
Cy Schubert [Sun, 19 Apr 2020 17:01:17 +0000 (17:01 +0000)]
Convert ipfilter to the new routing KPI.

Reviewed by: melifaro (previous version)

4 years agofib4_free_nh_ext is an empty function. It does nothing. Don't call it.
Cy Schubert [Sun, 19 Apr 2020 17:01:14 +0000 (17:01 +0000)]
fib4_free_nh_ext is an empty function. It does nothing. Don't call it.

MFC after: 2 weeks

4 years agobridge tests: Ensure that bridges in different jails get different MAC addresses
Kristof Provost [Sun, 19 Apr 2020 16:30:49 +0000 (16:30 +0000)]
bridge tests: Ensure that bridges in different jails get different MAC addresses

We used to have a problem where bridges created in different vnet jails
would end up having the same mac address. This is now fixed by
including the jail name as a seed for the mac address generation, but we
should verify that it doesn't regress.

4 years agopf: Improve ioctl() input validation
Kristof Provost [Sun, 19 Apr 2020 16:10:20 +0000 (16:10 +0000)]
pf: Improve ioctl() input validation

Both DIOCCHANGEADDR and DIOCADDADDR take a struct pf_pooladdr from
userspace. They failed to validate the dyn pointer contained in its
struct pf_addr_wrap member structure.

This triggered assertion failures under fuzz testing in
pfi_dynaddr_setup(). Happily the dyn variable was overruled there, but
we should verify that it's set to NULL anyway.

Reported-by: syzbot+93e93150bc29f9b4b85f@syzkaller.appspotmail.com
Reviewed by: emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24431

4 years agopfctl: Call ifa_load() before ifa_grouplookup()
Kristof Provost [Sun, 19 Apr 2020 15:37:13 +0000 (15:37 +0000)]
pfctl: Call ifa_load() before ifa_grouplookup()

ifa_grouplookup() uses the data loaded in ifa_load() (through is_a_group()), so
we must call ifa_load() before we can rely on any of the data it populates.

Submitted by: Nick Rogers
MFC after: 1 week
Sponsored by: RG Nets

4 years agopfctl: Remove unused variable
Kristof Provost [Sun, 19 Apr 2020 15:32:14 +0000 (15:32 +0000)]
pfctl: Remove unused variable

Submitted by: Nick Rogers
MFC after: 1 week
Sponsored by: RG Nets

4 years agoFix cut and paste off-by-one error in hccontrol(8).
Hans Petter Selasky [Sun, 19 Apr 2020 14:25:56 +0000 (14:25 +0000)]
Fix cut and paste off-by-one error in hccontrol(8).
Make sure strncpy() doesn't write beyond its given buffer.

PR: 245739
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoImprove printing of le features in hccontrol(8).
Hans Petter Selasky [Sun, 19 Apr 2020 14:22:21 +0000 (14:22 +0000)]
Improve printing of le features in hccontrol(8).

Submitted by: Marc Veldman <marc@bumblingdork.com>
PR: 245739
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agorelease: arm64: Remove DTSO for Allwinner boards
Emmanuel Vadot [Sun, 19 Apr 2020 10:50:29 +0000 (10:50 +0000)]
release: arm64: Remove DTSO for Allwinner boards

Both SID and THS dts node are now in the main dts and the DTSO have
been removed in r359935

MFC after: 2 month
X-MFC-With: r359935

4 years agoBring HCI error messages up-to-date.
Hans Petter Selasky [Sun, 19 Apr 2020 10:24:15 +0000 (10:24 +0000)]
Bring HCI error messages up-to-date.
See Bluetooth v5.6 core specification Vol.1 Part F: Controller error codes.

Submitted by: Marc Veldman <marc@bumblingdork.com>
PR: 245737
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoAlign initial-exec TLS segments to the p_vaddr % align.
Konstantin Belousov [Sun, 19 Apr 2020 09:28:59 +0000 (09:28 +0000)]
Align initial-exec TLS segments to the p_vaddr % align.

This is continuation of D21163/r359634, which handled the alignment
for global mode.

Non-x86 arches are not handled, maintainers are welcomed.

Tested by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D24366

4 years agoFix lookup key generation in fib6_check_urpf().
Alexander V. Chernikov [Sun, 19 Apr 2020 07:27:12 +0000 (07:27 +0000)]
Fix lookup key generation in fib6_check_urpf().

The version introduced in r359823 assumed D23051
 had been in tree already. As this is not the case yet,
 revert to sockaddr.

4 years agolibauditd: make it a PRIVATELIB
Alan Somers [Sun, 19 Apr 2020 02:20:39 +0000 (02:20 +0000)]
libauditd: make it a PRIVATELIB

According to the upstream man page (which we don't install), none of
libauditd's symbols are intended to be public. Also, I can't find any
evidence for a port that uses libauditd. Therefore, we should treat it like
other such libraries and use PRIVATELIB.

Reported by: phk
Reviewed by: cem, emaste
MFC after: 2 weeks

4 years agolibbsm: fix some MLINKS
Alan Somers [Sun, 19 Apr 2020 02:18:40 +0000 (02:18 +0000)]
libbsm: fix some MLINKS

Add missing MLINKS entries for a few functions. Remove some old typo
entries.

Reported by: phk
Reviewed by: cem
MFC after: 2 weeks

4 years agobectl.8: correctly sort SEE ALSO section after 360078
Alan Somers [Sun, 19 Apr 2020 01:43:59 +0000 (01:43 +0000)]
bectl.8: correctly sort SEE ALSO section after 360078

Reported by: yuripv
MFC after: 2 weeks
MFC with: 360078

4 years agoRISC-V: provide the correct value for kernstart
Mitchell Horne [Sun, 19 Apr 2020 00:34:49 +0000 (00:34 +0000)]
RISC-V: provide the correct value for kernstart

pmap_bootstrap() expects the kernel's physical load address, but we have
been providing the start of physical memory. This had the nice effect of
protecting the memory used by the SBI runtime firmware, but now that we
have alternate means of achieving that, we should provide the correct
value. This will free up any memory between the SBI firmware and the
kernel for allocation.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D24156

4 years agoRISC-V: exclude reserved memory regions
Mitchell Horne [Sun, 19 Apr 2020 00:33:05 +0000 (00:33 +0000)]
RISC-V: exclude reserved memory regions

The device tree may contain a "reserved-memory" node, whose purpose is
to communicate sections of physical memory that should not be used for
general allocations. Add the logic to parse and exclude these regions.

The particular motivation for this is protection of the SBI runtime
firmware. Currently, there is no mechanism through which the SBI
can communicate the details of its reserved memory region(s) to
a supervisor payload. There has been some discussion recently on how
this can be achieved [1], and it seems that the path going forward
will be to add an entry to the reserved-memory node.

This hasn't caused any issues for us yet, since we exclude all physical
memory below the kernel's load address from being allocated, and on all
currently supported platforms this covers the SBI firmware region. This
will change in another commit, so as a safety measure, ensure that the
lowest 2MB of memory is excluded if this region has not been reported.

[1] https://github.com/riscv/riscv-sbi-doc/pull/37

Reviewed by: markj, nick (older version)
Differential Revision: https://reviews.freebsd.org/D24155

4 years agoRISC-V: use physmem to manage physical memory
Mitchell Horne [Sun, 19 Apr 2020 00:18:16 +0000 (00:18 +0000)]
RISC-V: use physmem to manage physical memory

Replace our hand-rolled functions with the generic ones provided by
kern/subr_physmem.c. This greatly simplifies the initialization of
physical memory regions and kernel globals.

Tested by: nick
Differential Revision: https://reviews.freebsd.org/D24154

4 years agoConvert arm's physmem interface to MI code
Mitchell Horne [Sun, 19 Apr 2020 00:12:30 +0000 (00:12 +0000)]
Convert arm's physmem interface to MI code

The arm_physmem interface found in arm's MD code provides a convenient
set of routines for adding/excluding physical memory regions and
initializing important kernel globals such as Maxmem, realmem,
phys_avail[], and dump_avail[]. It is especially convenient for FDT
systems, since we can use FDT parsing functions and pass the result
directly to one of these physmem routines. This interface is already in
use on arm and arm64, and can be used to simplify this early
initialization on RISC-V as well.

This requires only a couple trivial changes:
  - Move arm_physmem_kernel_addr to arm/machdep.c. It is unused on arm64,
    and manipulated entirely in arm MD code.
  - Convert arm32_btop/arm64_btop to atop. This is equivalently defined
    on all architectures.
  - Drop the "arm" prefix.

Reviewed by: manu, emaste ("looks reasonable")
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24153

4 years agoChange the type of "len" to avoid warnings.
Rick Macklem [Sat, 18 Apr 2020 23:46:58 +0000 (23:46 +0000)]
Change the type of "len" to avoid warnings.

The "len" variable is used as the last argument to getsockname(2) and
accept(2). It was declared an "int" and this patch changes it to "socklen_t".

4 years agozfs-program.8: fix orphan .Xr
Alan Somers [Sat, 18 Apr 2020 20:55:43 +0000 (20:55 +0000)]
zfs-program.8: fix orphan .Xr

Reported by: phk
Reviewed by: avg
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24488

4 years agocap_dns.3: fix some orphan .Xr links
Alan Somers [Sat, 18 Apr 2020 20:13:43 +0000 (20:13 +0000)]
cap_dns.3: fix some orphan .Xr links

Reported by: phk
MFC after: 2 weeks

4 years agobectl.8, beinstall.sh.8: fix man page section of beinstall.sh
Alan Somers [Sat, 18 Apr 2020 19:53:47 +0000 (19:53 +0000)]
bectl.8, beinstall.sh.8: fix man page section of beinstall.sh

Reported by: phk
MFC after: 2 weeks

4 years agozfsd.8: fix orphan .Xr
Alan Somers [Sat, 18 Apr 2020 19:47:38 +0000 (19:47 +0000)]
zfsd.8: fix orphan .Xr

Though ZFS is a kernel module, it has no man page in section 4.

Reported by: phk
MFC after: 2 weeks

4 years agohda: remove hda*_lockowned macros
Ed Maste [Sat, 18 Apr 2020 18:25:30 +0000 (18:25 +0000)]
hda: remove hda*_lockowned macros

These are not used anywhere.

4 years agoSet the maximum exit latency to 0 for XHCI USB 3.0 devices, because we
Hans Petter Selasky [Sat, 18 Apr 2020 15:05:10 +0000 (15:05 +0000)]
Set the maximum exit latency to 0 for XHCI USB 3.0 devices, because we
don't implement link power management, LPM.

This fixes error code XHCI_TRB_ERROR_BANDWIDTH for isochronous USB 3.0
transactions.

Submitted by: Horse Ma <Shichun.Ma@dell.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoUse the Ic macro for find(1) primaries consistently
Mateusz Piotrowski [Sat, 18 Apr 2020 13:29:54 +0000 (13:29 +0000)]
Use the Ic macro for find(1) primaries consistently

MFC after: 3 days

4 years agoFix various warnings in tests/sys/kqueue and bump WARNS
Alex Richardson [Sat, 18 Apr 2020 12:54:47 +0000 (12:54 +0000)]
Fix various warnings in tests/sys/kqueue and bump WARNS

Reviewed By: kevans
Differential Revision: https://reviews.freebsd.org/D24296

4 years agoMore fixes to build the kernel with a compiler that defaults to -fno-common
Alex Richardson [Sat, 18 Apr 2020 12:54:40 +0000 (12:54 +0000)]
More fixes to build the kernel with a compiler that defaults to -fno-common

Using the same approach as the last commit for the files used by genassym.sh.

Obtained from: CheriBSD

4 years agoAllow kernel modules to build with a compiler that defaults to -fno-common
Alex Richardson [Sat, 18 Apr 2020 12:54:35 +0000 (12:54 +0000)]
Allow kernel modules to build with a compiler that defaults to -fno-common

This uses the same approach as r359691.

Reviewed By: brooks
Differential Revision: https://reviews.freebsd.org/D24405

4 years agoAdd missing feature descriptions to hci_features2str().
Hans Petter Selasky [Sat, 18 Apr 2020 08:29:16 +0000 (08:29 +0000)]
Add missing feature descriptions to hci_features2str().

The list of possible features in hccontrol/features2str() is incomplete.
Refer to "Bluetooth Core Specification 5.2 Vol. 2 Part C. 3.3 Feature Mask Definition".

Submitted by: Marc Veldman <marc@bumblingdork.com>
PR: 245354
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agobridge: Simplify mac address generation
Kristof Provost [Sat, 18 Apr 2020 08:00:58 +0000 (08:00 +0000)]
bridge: Simplify mac address generation

Unconditionally use ether_gen_addr() to generate bridge mac addresses.  This
function is now less likely to generate duplicate mac addresses across jails.
The old hand rolled hostid based code adds no value.

Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D24432

4 years agoethersubr: Make the mac address generation more robust
Kristof Provost [Sat, 18 Apr 2020 07:50:30 +0000 (07:50 +0000)]
ethersubr: Make the mac address generation more robust

If we create two (vnet) jails and create a bridge interface in each we end up
with the same mac address on both bridge interfaces.
These very often conflicts, resulting in same mac address in both jails.

Mitigate this problem by including the jail name in the mac address.

Reviewed by: kevans, melifaro
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24383

4 years agosendfile: When all io finished, assert that sfio->pa[] is in expected state.
Konstantin Belousov [Sat, 18 Apr 2020 03:09:25 +0000 (03:09 +0000)]
sendfile: When all io finished, assert that sfio->pa[] is in expected state.

It must contain fully restored contigous run of the wired pages from
the object, except possible trimmed tail.

Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks