]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoFix mis-spelled macro in the kernel shim.
hselasky [Fri, 4 Dec 2020 16:51:59 +0000 (16:51 +0000)]
Fix mis-spelled macro in the kernel shim.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoAdd support for RK3288 SoC.
mmel [Fri, 4 Dec 2020 16:24:44 +0000 (16:24 +0000)]
Add support for RK3288 SoC.

3 years agomake.py: Also pass STRIPBIN
arichardson [Fri, 4 Dec 2020 15:53:44 +0000 (15:53 +0000)]
make.py: Also pass STRIPBIN

This is required for cross-building to allow stripping the installed binaries.

Submitted By: Henry Vogt <hv@tue.mpg.de>

3 years agocrunchgen: fix NULL-deref bug introduced in r364647
arichardson [Fri, 4 Dec 2020 15:53:37 +0000 (15:53 +0000)]
crunchgen: fix NULL-deref bug introduced in r364647

While porting over the local changes from CheriBSD for upstreaming, I
accidentally committed a broken version of find_entry_point(): we have to
return NULL if the value is not found instead of a value with
ep->name == NULL, since the checks in main were changed to check ep instead
of ep->name for NULL.

This only matters if the crunched tool cannot be found using normal lookup
and one of the fallback paths is used, so it's unlikely to be triggered
in rescue. However, I noticed that one of our CheriBSD test scripts was
failing to run commands under `su` on minimal disk images where all
binaries are hardlinks to a `cheribsdbox` tool generated with crunchgen.

This also updates the bootstrapping check in Makefile.inc1 to bootstrap
crunchgen up to the next version bump.

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

3 years agoAllow the rbtree header file in the LinuxKPI to be used in standalone code.
hselasky [Fri, 4 Dec 2020 15:50:44 +0000 (15:50 +0000)]
Allow the rbtree header file in the LinuxKPI to be used in standalone code.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoAllow the list header file in the LinuxKPI to be used in standalone code.
hselasky [Fri, 4 Dec 2020 15:46:48 +0000 (15:46 +0000)]
Allow the list header file in the LinuxKPI to be used in standalone code.
Some style and spelling nits while at it.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoAdd a driver for FAN53555 based PMIC.
mmel [Fri, 4 Dec 2020 15:23:43 +0000 (15:23 +0000)]
Add a driver for FAN53555 based PMIC.

3 years agognu: don't build libgnuregex for WITH_GNU_GREP_COMPAT
kevans [Fri, 4 Dec 2020 15:21:12 +0000 (15:21 +0000)]
gnu: don't build libgnuregex for WITH_GNU_GREP_COMPAT

bsdgrep switched over to libregex back in r363823 to fill
WITH_GNU_GREP_COMPAT, since libgnuregex in base is quite buggy and libregex
is somewhat functional. Don't build libgnuregex on our account, please.

3 years agoAdd a driver for HYM8563 based RTC.
mmel [Fri, 4 Dec 2020 15:09:42 +0000 (15:09 +0000)]
Add a driver for HYM8563 based RTC.

3 years agoAdd a driver for ACT8846 used as PMIC for RK3288 SoC.
mmel [Fri, 4 Dec 2020 14:57:12 +0000 (14:57 +0000)]
Add a driver for ACT8846 used as PMIC for RK3288 SoC.

3 years agoAdd more macros, types and prototypes for building kernel code into bootloaders.
hselasky [Fri, 4 Dec 2020 14:52:41 +0000 (14:52 +0000)]
Add more macros, types and prototypes for building kernel code into bootloaders.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoFix definition of int64_t and uint64_t when long is 64-bit. This gets the kernel
hselasky [Fri, 4 Dec 2020 14:50:55 +0000 (14:50 +0000)]
Fix definition of int64_t and uint64_t when long is 64-bit. This gets the kernel
shim code in line with the rest of the kernel, sys/x86/include/_types.h.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoAdd TCP feature Proportional Rate Reduction (PRR) - RFC6937
rscheff [Fri, 4 Dec 2020 11:29:27 +0000 (11:29 +0000)]
Add TCP feature Proportional Rate Reduction (PRR) - RFC6937

PRR improves loss recovery and avoids RTOs in a wide range
of scenarios (ACK thinning) over regular SACK loss recovery.

PRR is disabled by default, enable by net.inet.tcp.do_prr = 1.
Performance may be impeded by token bucket rate policers at
the bottleneck, where net.inet.tcp.do_prr_conservate = 1
should be enabled in addition.

Submitted by: Aris Angelogiannopoulos
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D18892

3 years agokern: soclose: don't sleep on SO_LINGER w/ timeout=0
kevans [Fri, 4 Dec 2020 04:39:48 +0000 (04:39 +0000)]
kern: soclose: don't sleep on SO_LINGER w/ timeout=0

This is a valid scenario that's handled in the various protocol layers where
it makes sense (e.g., tcp_disconnect and sctp_disconnect). Given that it
indicates we should immediately drop the connection, it makes little sense
to sleep on it.

This could lead to panics with INVARIANTS. On non-INVARIANTS kernels, this
could result in the thread hanging until a signal interrupts it if the
protocol does not mark the socket as disconnected for whatever reason.

Reported by: syzbot+e625d92c1dd74e402c81@syzkaller.appspotmail.com
Reviewed by: glebius, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27407

3 years agoAdd IPv4/IPv6 rtentry prefix accessors.
melifaro [Thu, 3 Dec 2020 22:23:57 +0000 (22:23 +0000)]
Add IPv4/IPv6 rtentry prefix accessors.

Multiple consumers like ipfw, netflow or new route lookup algorithms
 need to get the prefix data out of struct rtentry.
Instead of providing direct access to the rtentry, create IPv4/IPv6
 accessors to abstract struct rtentry internals and avoid including
 internal routing headers for external consumers.

While here, move struct route_nhop_data to the public header, so external
 customers can actually use lookup functions returning rt&nhop data.

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

3 years agoClear TLS offload mode if a TLS socket hangs without receiving data.
jhb [Thu, 3 Dec 2020 22:06:08 +0000 (22:06 +0000)]
Clear TLS offload mode if a TLS socket hangs without receiving data.

By default, if a TOE TLS socket stops receiving data for more than 5
seconds, revert the connection back to plain TOE mode.  This provides
a fallback if the userland SSL library does not support KTLS.  In
addition, for client TLS 1.3 sockets using connect(), the TOE socket
blocks before the handshake has completed since the socket option is
only invoked for the final handshake.

The timeout defaults to 5 seconds, but can be changed at boot via the
hw.cxgbe.toe.tls_rx_timeout tunable or for an individual interface via
the dev.<nexus>.toe.tls_rx_timeout sysctl.

Reviewed by: np
MFC after: 2 weeks
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D27470

3 years agocxgbe(4): Fix vertical alignment in sysctl_cpl_stats.
np [Thu, 3 Dec 2020 22:04:23 +0000 (22:04 +0000)]
cxgbe(4): Fix vertical alignment in sysctl_cpl_stats.

MFC after: 3 days
Sponsored by: Chelsio Communications

3 years agoDon't transmit mbufs that aren't yet ready on TOE sockets.
jhb [Thu, 3 Dec 2020 22:01:13 +0000 (22:01 +0000)]
Don't transmit mbufs that aren't yet ready on TOE sockets.

This includes mbufs waiting for data from sendfile() I/O requests, or
mbufs awaiting encryption for KTLS.

Reviewed by: np
MFC after: 2 weeks
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D27469

3 years agocxgbe(4): two new debug sysctls.
np [Thu, 3 Dec 2020 22:00:41 +0000 (22:00 +0000)]
cxgbe(4): two new debug sysctls.

dev.<nexus>.<instance>.misc.tid_stats
dev.<nexus>.<instance>.misc.tnl_stats

MFC after: 3 days
Sponsored by: Chelsio Communications

3 years agoClear TLS offload mode for unsupported cipher suites and versions.
jhb [Thu, 3 Dec 2020 21:59:47 +0000 (21:59 +0000)]
Clear TLS offload mode for unsupported cipher suites and versions.

If TOE TLS is requested for an unsupported cipher suite or TLS
version, disable TLS processing and fall back to plain TOE.  In
addition, if an error occurs when saving the decryption keys in the
card's memory, disable TLS processing and fall back to plain TOE.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D27468

3 years agoFix downgrading of TOE TLS sockets to plain TOE.
jhb [Thu, 3 Dec 2020 21:49:20 +0000 (21:49 +0000)]
Fix downgrading of TOE TLS sockets to plain TOE.

If a TOE TLS socket ends up using an unsupported TLS version or
ciphersuite, it must be downgraded to a "plain" TOE socket with TLS
encryption/decryption performed on the host.  The previous
implementation of this fallback was incomplete and resulted in hung
connections.

Reviewed by: np
MFC after: 2 weeks
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D27467

3 years agoFix typo in kern_testfrwk.9.
np [Thu, 3 Dec 2020 21:38:00 +0000 (21:38 +0000)]
Fix typo in kern_testfrwk.9.

3 years agoMerge commit d989ffd10 from llvm git (by Dimitry Andric):
dim [Thu, 3 Dec 2020 19:29:18 +0000 (19:29 +0000)]
Merge commit d989ffd10 from llvm git (by Dimitry Andric):

  Implement computeHostNumHardwareThreads() for FreeBSD

  This retrieves CPU affinity via FreeBSD's cpuset(2) API, and makes
  LLVM respect affinity settings configured by the user via the
  cpuset(1) command.

  In particular, this allows to reduce the number of threads used on
  machines with high core counts, which can interact badly with
  parallelized build systems. This is particularly noticable with lld,
  which spawns lots of threads even for linking e.g. hello_world!

  This fix is related to PR48193, but does not adress the more
  fundamental problem, which is that LLVM by default grabs as many CPUs
  and/or threads as possible.

  Reviewed By: MaskRay

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

Originally by: mjg
MFC after: 1 week

3 years agoRevert r367815, so we can apply the slightly different version that
dim [Thu, 3 Dec 2020 19:26:21 +0000 (19:26 +0000)]
Revert r367815, so we can apply the slightly different version that
landed upstream:

For llvm's internal function which retrieves the number of available
"hardware threads", use cpuset_getaffinity(2) on FreeBSD, so it will
honor processor sets configured by the cpuset(1) command.

This should make it possible to avoid e.g. lld creating a huge number of
threads on a machine with many cores, even for linking simple programs.

This will also be submitted upstream.

Submitted by: mjg

3 years agoAlways use 64-bit physical addresses for dump_avail[] in minidumps
markj [Thu, 3 Dec 2020 17:12:31 +0000 (17:12 +0000)]
Always use 64-bit physical addresses for dump_avail[] in minidumps

As of r365978, minidumps include a copy of dump_avail[].  This is an
array of vm_paddr_t ranges.  libkvm walks the array assuming that
sizeof(vm_paddr_t) is equal to the platform "word size", but that's not
correct on some platforms.  For instance, i386 uses a 64-bit vm_paddr_t.

Fix the problem by always dumping 64-bit addresses.  On platforms where
vm_paddr_t is 32 bits wide, namely arm and mips (sometimes), translate
dump_avail[] to an array of uint64_t ranges.  With this change, libkvm
no longer needs to maintain a notion of the target word size, so get rid
of it.

This is a no-op on platforms where sizeof(vm_paddr_t) == 8.

Reviewed by: alc, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27082

3 years agosdt: Create providers and probes in separate passes when loading sdt.ko
markj [Thu, 3 Dec 2020 17:10:00 +0000 (17:10 +0000)]
sdt: Create providers and probes in separate passes when loading sdt.ko

The sdt module's load handler iterates over SDT linker sets for the
kernel and all loaded modules to create probes and providers defined by
SDT(9).  Probes in one module may belong to a provider in a different
module, but when a probe is created we assume that the provider is
already defined.  To maintain this invariant, modify the load handler to
perform two separate passes over loaded modules: one to define providers
and the other to define probes.

The problem manifests when loading linux.ko, which depends on
linux_common.ko, which defines providers used by probes defined in
linux.ko.

Reported by: gallatin
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

3 years ago[axgbe] Fix compiler warnings in gcc-6.3; perhaps fix a PHY issue
adrian [Thu, 3 Dec 2020 16:54:59 +0000 (16:54 +0000)]
[axgbe] Fix compiler warnings in gcc-6.3; perhaps fix a PHY issue

* uninitialised variable use
* Using AXGBE_SET_ADV() where it was intended; using AXGBE_ADV()
  seems wrong and also causes a compiler warning.

Reviewed by: rpokala
Differential Revision:   https://reviews.freebsd.org/D26839

3 years agoaddr2line: fix allocation leak in error path
emaste [Thu, 3 Dec 2020 14:41:11 +0000 (14:41 +0000)]
addr2line: fix allocation leak in error path

CID: 1437677
Reported by: Coverity Scan
Sponsored by: The FreeBSD Foundation

3 years agodtrace: honor LC_NUMERIC for %'d and alike, and LC_TIME for %T
avg [Thu, 3 Dec 2020 11:59:40 +0000 (11:59 +0000)]
dtrace: honor LC_NUMERIC for %'d and alike, and LC_TIME for %T

Note that the public documentation on dtrace.org fails to mention %T and
incorrectly documents %Y.  The latter actually uses format "%Y %b %e %T"
where %b is always in C locale.

Discussed with: markj
MFC after: 1 month
Sponsored by: Panzura

3 years agoif_dwc: Honor snps,pbl property
manu [Thu, 3 Dec 2020 11:15:49 +0000 (11:15 +0000)]
if_dwc: Honor snps,pbl property

DTS node can have this property which configure the burst length
for both TX and RX if it's the same.
This unbreak if_dwc on Allwinner A20 and possibly other boards that
uses this prop.

Reported by: qroxana <qroxana@mail.ru>

3 years agocxgbe(4): Stop but don't free netmap queues when netmap is switched off.
np [Thu, 3 Dec 2020 08:30:29 +0000 (08:30 +0000)]
cxgbe(4): Stop but don't free netmap queues when netmap is switched off.

It is common for freelists to be starving when a netmap application
stops.  Mailbox commands to free queues can hang in such a situation.
Avoid that by not freeing the queues when netmap is switched off.
Instead, use an alternate method to stop the queues without releasing
the context ids.  If netmap is enabled again later then the same queue
is reinitialized for use.  Move alloc_nm_rxq and txq to t4_netmap.c
while here.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoRemove trailing whitespace.
cy [Thu, 3 Dec 2020 05:49:59 +0000 (05:49 +0000)]
Remove trailing whitespace.

MFC after: 1 week

3 years agoAdd support for hw.physmem tunable for ARM/ARM64/RISC-V platforms
gonzo [Thu, 3 Dec 2020 05:39:27 +0000 (05:39 +0000)]
Add support for hw.physmem tunable for ARM/ARM64/RISC-V platforms

hw.physmem tunable allows to limit number of physical memory available to the
system. It's handled in machdep files for x86 and PowerPC. This patch adds
required logic to the consolidated physmem management interface that is used by
ARM, ARM64, and RISC-V.

Submitted by: Klara, Inc.
Reviewed by: mhorne
Sponsored by: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D27152

3 years ago[PowerPC64LE] Fix LE VSX/fpr interop
bdragon [Thu, 3 Dec 2020 01:39:59 +0000 (01:39 +0000)]
[PowerPC64LE] Fix LE VSX/fpr interop

In the PCB struct, we need to match the VSX register file layout
correctly, as the VSRs shadow the FPRs.

In LE, we need to have a dword of padding before the fprs so they end up
on the correct side, as the struct may be manipulated by either the FP
routines or the VSX routines.

Additionally, when saving and restoring fprs, we need to explicitly target
the fpr union member so it gets offset correctly on LE.

Fixes weirdness with FP registers in VSX-using programs (A FPR that was
saved by the FP routines but restored by the VSX routines was becoming 0
due to being loaded to the wrong side of the VSR.)

Original patch by jhibbits.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D27431

3 years agoFix r368197: suppress error printing for the "check" command.
glebius [Wed, 2 Dec 2020 21:53:28 +0000 (21:53 +0000)]
Fix r368197: suppress error printing for the "check" command.

Reviewed by: kevans

3 years agouart: allow UART_DEV_DBGPORT for fdt consoles
mhorne [Wed, 2 Dec 2020 21:01:52 +0000 (21:01 +0000)]
uart: allow UART_DEV_DBGPORT for fdt consoles

Allow fdt devices to be used as debug ports for gdb(4).

A debug console can be specified with the "freebsd,debug-path" property
in the device tree's /chosen node, or using the environment variable
hw.fdt.dbgport.

The device should be specified by its name in the device tree, for
example hw.fdt.dbgport="serial2".

PR: 251053
Submitted by: Dmitry Salychev <dsl@mcusim.org>
Submitted by:   stevek (original patch, D5986)
Reviewed by: andrew, mhorne
Differential Revision: https://reviews.freebsd.org/D27422

3 years agocxgbe(4): Revert r367917.
np [Wed, 2 Dec 2020 20:54:03 +0000 (20:54 +0000)]
cxgbe(4): Revert r367917.

r367917 fixed the backpressure on the netmap rxq being stopped but that
doesn't help if some other netmap rxq is starved (because it is stopping
too although the driver doesn't know this yet) and blocks the pipeline.
An alternate fix that works in all cases will be checked in instead.

Sponsored by: Chelsio Communications

3 years agocrashinfo: Add references to the gdb port/package
emaste [Wed, 2 Dec 2020 19:58:50 +0000 (19:58 +0000)]
crashinfo: Add references to the gdb port/package

We intend to remove the obsolete GDB 6.1.1 from FreeBSD before FreeBSD 13.

Reviewed by jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27447

3 years agoem: fix a null de-reference in em_free_pci_resources
mhorne [Wed, 2 Dec 2020 17:37:32 +0000 (17:37 +0000)]
em: fix a null de-reference in em_free_pci_resources

A failure in iflib_device_register() can result in
em_free_pci_resources() being called after receive queues have already
been freed. In particular, a failure to allocate IRQ resources will goto
fail_queues, where IFDI_QUEUES_FREE() will be called via
iflib_tx_structures_free(), preceding the call to IFDI_DETACH().

Cope with this by checking adapter->rx_queues before dereferencing it.
A similar check is present in ixgbe(4) and ixl(4).

MFC after: 1 week
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27260

3 years agoaddr2line: rework check_range conditions
emaste [Wed, 2 Dec 2020 17:22:29 +0000 (17:22 +0000)]
addr2line: rework check_range conditions

Simplify logic and reduce indentation for DW_AT_low_pc case.

Reviewed by: Tiger Gao, markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27426

3 years agoNVME: Multiple busdma related fixes.
mmel [Wed, 2 Dec 2020 16:54:24 +0000 (16:54 +0000)]
NVME: Multiple busdma related fixes.
- in nvme_qpair_process_completions() do dma sync before completion buffer
  is used.
- in nvme_qpair_submit_tracker(), don't do explicit wmb() also for arm
  and arm64. Bus_dmamap_sync() on these architectures is sufficient to ensure
  that all CPU stores are visible to external (including DMA) observers.
- Allocate completion buffer as BUS_DMA_COHERENT. On not-DMA coherent systems,
  buffers continuously owned (and accessed) by DMA must be allocated with this
  flag. Note that BUS_DMA_COHERENT flag is no-op on DMA coherent systems
  (or coherent buses in mixed systems).

MFC after: 4 weeks
Reviewed by: mav, imp
Differential Revision: https://reviews.freebsd.org/D27446

3 years agortsold: Fix bugs reported by Coverity
markj [Wed, 2 Dec 2020 16:46:45 +0000 (16:46 +0000)]
rtsold: Fix bugs reported by Coverity

- Avoid leaking a socket if llflags_get() fails.
- Avoid leaking a file handle if rtsold_init_dumpfile() fails.
- Tighten the check in if_nametosdl() which determines whether we failed
  to find the specified interface.
- Fix errno handling in an error path in rtsock_open().

MFC after: 1 week

3 years agopf tests: Test case for bug #251414
kp [Wed, 2 Dec 2020 16:33:23 +0000 (16:33 +0000)]
pf tests: Test case for bug #251414

Changing a table from not having counters to having counters (or vice versa)
may trigger panics.

PR: 251414
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27441

3 years agopf: Fix table entry counter toggling
markj [Wed, 2 Dec 2020 16:01:43 +0000 (16:01 +0000)]
pf: Fix table entry counter toggling

When updating a table, pf will keep existing table entry structures
corresponding to addresses that are in both of the old and new tables.
However, the update may also enable or disable per-entry counters which
are allocated separately.  Thus when toggling PFR_TFLAG_COUNTERS, the
entries may be missing counters or may have unused counters allocated.

Fix the problem by modifying pfr_ina_commit() to transfer counters
from or to entries in the shadow table.

PR: 251414
Reported by: sigsys@gmail.com
Reviewed by: kp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27440

3 years agonvme: Fix typo in definition
chuck [Wed, 2 Dec 2020 15:59:08 +0000 (15:59 +0000)]
nvme: Fix typo in definition

Change occurrences of "selt test" to "self tests in the NVMe header
file.

Reviewed by: imp, mav
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27439

3 years agovt/fonts: fix typo
tsoome [Wed, 2 Dec 2020 09:42:02 +0000 (09:42 +0000)]
vt/fonts: fix typo

add missing 'is'.

Reported by: bcr

3 years agoFix r368153. Wrong branch of #ifdef __ARMEB__ was deleted.
mmel [Wed, 2 Dec 2020 08:14:56 +0000 (08:14 +0000)]
Fix r368153. Wrong branch of #ifdef __ARMEB__ was deleted.

3 years agoAIO tests: update expected failure messages after r368265
asomers [Wed, 2 Dec 2020 00:53:03 +0000 (00:53 +0000)]
AIO tests: update expected failure messages after r368265

PR: 220398, 251515
MFC after: 1 week
MFC-With: r368265

3 years agoselect: make sure there are no wakeup attempts after selfdfree returns
mjg [Wed, 2 Dec 2020 00:48:15 +0000 (00:48 +0000)]
select: make sure there are no wakeup attempts after selfdfree returns

Prior to the patch returning selfdfree could still be racing against doselwakeup
which set sf_si = NULL and now locks stp to wake up the other thread.

A sufficiently unlucky pair can end up going all the way down to freeing
select-related structures before the lock/wakeup/unlock finishes.

This started manifesting itself as crashes since select data started getting
freed in r367714.

3 years agoFix syntax
kib [Tue, 1 Dec 2020 23:51:48 +0000 (23:51 +0000)]
Fix syntax

3 years agoImprove man page for AmazonEFS mounts.
rmacklem [Tue, 1 Dec 2020 23:33:10 +0000 (23:33 +0000)]
Improve man page for AmazonEFS mounts.

PR#250770 was actually just a misunderstanding of what
NFS mount options are needed for AmazonEFS mounts.
This patch attempts to clarify the manpage to clarify this.

This is a content change.

PR: 250770
Reviewed by: bcr
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27430

3 years agoadd documentation that the rules need to be reloaded, and how to do it...
jmg [Tue, 1 Dec 2020 23:25:21 +0000 (23:25 +0000)]
add documentation that the rules need to be reloaded, and how to do it...

MFC after: 1 week

3 years agoficl: make dump a bit friendlier
tsoome [Tue, 1 Dec 2020 23:07:05 +0000 (23:07 +0000)]
ficl: make dump a bit friendlier

would be nice to have dump to output hex and ascii.

3 years agolio_listio(2): send signal even if number of jobs is zero.
kib [Tue, 1 Dec 2020 22:53:33 +0000 (22:53 +0000)]
lio_listio(2): send signal even if number of jobs is zero.

Right now, if lio registered zero jobs, syscall frees lio job
structure, cleaning up queued ksi.  As result, the realtime signal is
dequeued and never delivered.

Fix it by allowing sendsig() to copy ksi when job count is zero.

PR: 220398
Reported and reviewed by: asomers
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27421

3 years agovfs_aio.c: style.
kib [Tue, 1 Dec 2020 22:46:51 +0000 (22:46 +0000)]
vfs_aio.c: style.

Mostly re-wrap conditions to split after binary ops.

Reviewed by: asomers
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27421

3 years agoFix syntax
kib [Tue, 1 Dec 2020 22:44:23 +0000 (22:44 +0000)]
Fix syntax

3 years agovfs_aio.c: correct comment.
kib [Tue, 1 Dec 2020 22:30:32 +0000 (22:30 +0000)]
vfs_aio.c: correct comment.

Reviewed by: asomers
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27421

3 years agoficl: instead of pad, emit can use local variable
tsoome [Tue, 1 Dec 2020 22:28:02 +0000 (22:28 +0000)]
ficl: instead of pad, emit can use local variable

Pad in forth is used as "scratchpad" and internal implementations
should not use it. Ficl does not really follow this rule and this can fire back.
emit has no need to use pad, we can use local variable instead.

3 years agortld: bump r_debug.r_version to 1 from current 0.
kib [Tue, 1 Dec 2020 22:28:01 +0000 (22:28 +0000)]
rtld: bump r_debug.r_version to 1 from current 0.

Add r_ldbase.

Requested and reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27429

3 years ago[arm64] Parse ACPI _PXM property on ARM64 platform
gonzo [Tue, 1 Dec 2020 20:27:06 +0000 (20:27 +0000)]
[arm64] Parse ACPI _PXM property on ARM64 platform

Enable devices' NUMA proximity infromation parsing on ARM64 systems

Sponsored by: Ampere Computing
Submitted by: Klara, Inc.

3 years ago[arm64] Bump MAXMEMDOM value to 8 to match amd64
gonzo [Tue, 1 Dec 2020 20:10:55 +0000 (20:10 +0000)]
[arm64] Bump MAXMEMDOM value to 8 to match amd64

On some of the server-grade ARM64 machines the number of NUMA domains is higher
than 2. When booting GENERIC kernel on such machines the SRAT parser fails
leaving the system with a single domain. To make GENERIC kernel usable on those
server, match the parameter value with the one for amd64 arch.

Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D27368
Sponsored by: Ampere Computing
Submitted by: Klara, Inc.

3 years agortsold: Fix multiple buffer overflows
markj [Tue, 1 Dec 2020 19:34:44 +0000 (19:34 +0000)]
rtsold: Fix multiple buffer overflows

Approved by: so
Security: CVE-2020-25577
MFC after: now

3 years agoFix a couple of typos.
jhb [Tue, 1 Dec 2020 18:57:37 +0000 (18:57 +0000)]
Fix a couple of typos.

Submitted by: rmacklem

3 years agoUSB umass: add quirk to not probe
bz [Tue, 1 Dec 2020 18:24:06 +0000 (18:24 +0000)]
USB umass: add quirk to not probe

Some USB WLAN devices have "on-board" storage showing up as umass
and making the root mount wait for a very long time.
The WLAN drivers know how to deal with that an issue an eject
command later when attaching themselves.
Introduce a quirk to not probe these devices as umass and avoid
hangs and confusion altogether.

Reviewed by: hselasky, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27434

3 years agoUse uintptr_t instead of uint64_t for pointers in stack frames.
jhb [Tue, 1 Dec 2020 18:22:34 +0000 (18:22 +0000)]
Use uintptr_t instead of uint64_t for pointers in stack frames.

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

3 years agoUse uintptr_t for pointers in stack frames.
jhb [Tue, 1 Dec 2020 18:08:22 +0000 (18:08 +0000)]
Use uintptr_t for pointers in stack frames.

This catches up to the changes made to struct unwind_state in r364180.

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

3 years agoMake stack_save*() more robust on MIPS.
jhb [Tue, 1 Dec 2020 17:17:22 +0000 (17:17 +0000)]
Make stack_save*() more robust on MIPS.

- Validate any stack addresses read from against td_kstack before
  reading.  If an unwind operation would attempt to read outside the
  bounds of td_kstack, abort the unwind instead.

- For stack_save_td(), don't use the PC and SP from the current
  thread, instead read the PC and SP from pcb_context[].

- For stack_save(), use the current PC and SP of the current thread,
  not the values from pcb_regs (the horribly named td_frame of the
  outermost trapframe).  The result was that stack_trace() never
  logged _any_ kernel frames but only the frame from the saved
  userspace registers on entry from the kernel.

- Inline the one use of stack_register_fetch().

- Add a VALID_PC() helper macro and simplify types to remove
  excessive casts in stack_capture().

- Fix stack_capture() to work on compilers written in this century.
  Don't treat function epilogues as function prologues by skipping
  additions to SP when searching for a function start.

- Add some comments to stack_capture() and fix some style bugs.

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

3 years agoAdd a kstack_contains() helper function.
jhb [Tue, 1 Dec 2020 17:04:46 +0000 (17:04 +0000)]
Add a kstack_contains() helper function.

This is useful for stack unwinders which need to avoid out-of-bounds
reads of a kernel stack which can trigger kernel faults.

Reviewed by: kib, markj
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27356

3 years agopf tests: Re-enable panicing tests
kp [Tue, 1 Dec 2020 16:44:36 +0000 (16:44 +0000)]
pf tests: Re-enable panicing tests

We've fixed the vnet/epair cleanup race, so it is now safe to re-enable these
tests.

MFC after: 2 weeks
Sponsored by: Modirum MDPay

3 years agonet: Revert vnet/epair cleanup race mitigation
kp [Tue, 1 Dec 2020 16:34:43 +0000 (16:34 +0000)]
net: Revert vnet/epair cleanup race mitigation

Revert the mitigation code for the vnet/epair cleanup race (done in r365457).
r368237 introduced a more reliable fix.

MFC after: 2 weeks
Sponsored by: Modirum MDPay

3 years agoif: Fix panic when destroying vnet and epair simultaneously
kp [Tue, 1 Dec 2020 16:23:59 +0000 (16:23 +0000)]
if: Fix panic when destroying vnet and epair simultaneously

When destroying a vnet and an epair (with one end in the vnet) we often
panicked. This was the result of the destruction of the epair, which destroys
both ends simultaneously, happening while vnet_if_return() was moving the
struct ifnet to its home vnet. This can result in a freed ifnet being re-added
to the home vnet V_ifnet list. That in turn panics the next time the ifnet is
used.

Prevent this race by ensuring that vnet_if_return() cannot run at the same time
as if_detach() or epair_clone_destroy().

PR: 238870, 234985, 244703, 250870
MFC after: 2 weeks
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D27378

3 years agovmem: Revert r364744
markj [Tue, 1 Dec 2020 16:06:31 +0000 (16:06 +0000)]
vmem: Revert r364744

A pair of bugs are believed to have caused the hangs described in the
commit log message for r364744:

1. uma_reclaim() could trigger reclamation of the reserve of boundary
   tags used to avoid deadlock.  This was fixed by r366840.
2. The loop in vmem_xalloc() would in some cases try to allocate more
   boundary tags than the expected upper bound of BT_MAXALLOC.  The
   reserve is sized based on the value BT_MAXMALLOC, so this behaviour
   could deplete the reserve without guaranteeing a successful
   allocation, resulting in a hang.  This was fixed by r366838.

PR: 248008
Tested by: rmacklem

3 years agoMFV r368207:
mm [Tue, 1 Dec 2020 15:53:12 +0000 (15:53 +0000)]
MFV r368207:
Update libarchive to 3.5.0

Relevant vendor changes:
  Issue #1258: add archive_read_support_filter_by_code()
  PR #1347: mtree digest reader support
  Issue #1381: skip hardlinks pointing to itself on extraction
  PR #1387: fix writing of cpio archives with hardlinks without file type
  PR #1388: fix rdev field in cpio format for device nodes
  PR #1389: completed support for UTF-8 encoding conversion
  PR #1405: more formats in archive_read_support_format_by_code()
  PR #1408: fix uninitialized size in rar5_read_data
  PR #1409: system extended attribute support
  PR #1435: support for decompression of symbolic links in zipx archives
  Issue #1456: memory leak after unsuccessful archive_write_open_filename

MFC after: 1 week

3 years agoUpdate vendor/libarchive/dist to git 833821f55b1807cac22a63a58b759a7802df2fb7
mm [Tue, 1 Dec 2020 10:36:46 +0000 (10:36 +0000)]
Update vendor/libarchive/dist to git 833821f55b1807cac22a63a58b759a7802df2fb7

Libarchive 3.5.0

Relevant vendor changes:
  Issue #1258: add archive_read_support_filter_by_code()
  PR #1347: mtree digest reader support
  Issue #1381: skip hardlinks pointing to itself on extraction
  PR #1387: fix writing of cpio archives with hardlinks without file type
  PR #1388: fix rdev field in cpio format for device nodes
  PR #1389: completed support for UTF-8 encoding conversion
  PR #1405: more formats in archive_read_support_format_by_code()
  PR #1408: fix uninitialized size in rar5_read_data
  PR #1409: system extended attribute support
  PR #1435: support for decompression of symbolic links in zipx archives
  Issue #1456: memory leak after unsuccessful archive_write_open_filename

3 years agoRemove duplicated SV_ASLR from the elf flags.
mmel [Tue, 1 Dec 2020 09:18:18 +0000 (09:18 +0000)]
Remove duplicated SV_ASLR from the elf flags.

Reported by: lattera

3 years agoAlways use the __unused attribute even for potentially unused parameters.
mmel [Tue, 1 Dec 2020 08:52:13 +0000 (08:52 +0000)]
Always use the __unused attribute even for potentially unused parameters.

Requested by: ian, imp
MFC with: r368167

3 years agoefibootmgr: fix an incorrect error handling check
mhorne [Mon, 30 Nov 2020 22:16:11 +0000 (22:16 +0000)]
efibootmgr: fix an incorrect error handling check

efivar_device_path_to_unix_path() returns standard error codes on
failure and zero on success. Checking for a return value less than zero
means that the actual failure cases won't be handled. This could
manifest as a segfault during the subsequent call to printf().

Reviewed by: imp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D27424

3 years agoMove inner loop logic out of sysctl_sysctl_next_ls().
melifaro [Mon, 30 Nov 2020 21:59:52 +0000 (21:59 +0000)]
Move inner loop logic out of sysctl_sysctl_next_ls().

Refactor sysctl_sysctl_next_ls():
* Move huge inner loop out of sysctl_sysctl_next_ls() into a separate
 non-recursive function, returning the next step to be taken.
* Update resulting node oid parts only on successful lookup
* Make sysctl_sysctl_next_ls() return boolean success/failure instead of errno,
 slightly simplifying logic

Reviewed by: freqlabs
Differential Revision: https://reviews.freebsd.org/D27029

3 years agoRenumber NHR_* flags after NHR_IFAIF removal in r368127.
melifaro [Mon, 30 Nov 2020 21:42:55 +0000 (21:42 +0000)]
Renumber NHR_* flags after NHR_IFAIF removal in r368127.

Suggested by: rpokala

3 years agoPrint at least something when failing.
glebius [Mon, 30 Nov 2020 21:05:31 +0000 (21:05 +0000)]
Print at least something when failing.

3 years agowireguard: fix zfs_ copy pasta in module init macro
mmacy [Mon, 30 Nov 2020 20:58:42 +0000 (20:58 +0000)]
wireguard: fix zfs_ copy pasta in module init macro

Reported by: Jessica Clarke

3 years agoRemove (dead) GPL copyright code from wireguard sources
mmacy [Mon, 30 Nov 2020 20:54:44 +0000 (20:54 +0000)]
Remove (dead) GPL copyright code from wireguard sources

3 years agoqat: Initialize the crypto device ID to -1 instead of 0
markj [Mon, 30 Nov 2020 20:53:45 +0000 (20:53 +0000)]
qat: Initialize the crypto device ID to -1 instead of 0

Otherwise qat_detach() may attempt to deregister an unrelated crypto
driver if an error occurs in qat_attach() before crypto_get_driverid()
is called, since 0 is a valid driver ID.

MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (Netgate)

3 years agoqat: Fix firmware module autoloading
markj [Mon, 30 Nov 2020 20:53:25 +0000 (20:53 +0000)]
qat: Fix firmware module autoloading

If firmware_get() fails to find a loaded firmware image, it searches for
candidate KLDs to load.  It will search for a KLD containing a module
with the same name as the requested image, and failing that, will load a
KLD with the same basename as the requested image.

The module name given by fw_stub.awk is simply "<mangled KLD name>_fw".

QAT firmware modules contain two images, neither of which match either
of the names used during lookup, so automatic loading of firmware images
after mountroot does not work.  Work around this by using the same
string for the first image name and for the KLD basename.

MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (Netgate)

3 years agoAdd a few missed entries to ObsoleteFiles.inc:
dim [Mon, 30 Nov 2020 19:18:50 +0000 (19:18 +0000)]
Add a few missed entries to ObsoleteFiles.inc:

* libzfs.so was bumped from 3 to 4 in r364746
* libcap_random.so.1 was removed in r350307, but its .so symlink was not

3 years agoffs: do not read full direct blocks if they are going to be overwritten.
kib [Mon, 30 Nov 2020 17:03:26 +0000 (17:03 +0000)]
ffs: do not read full direct blocks if they are going to be overwritten.

BA_CLRBUF specifies that existing context of the block will be
completely overwritten by caller, so there is no reason to spend io
fetching existing data.  We do the same for indirect blocks.

Reported by: tmunro
Reviewed by: mckusick, tmunro
Tested by: pho, tmunro
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27353

3 years agoEnsure that threading library is initialized in pthread_mutex_init().
kib [Mon, 30 Nov 2020 17:00:36 +0000 (17:00 +0000)]
Ensure that threading library is initialized in pthread_mutex_init().

We need at least thr_malloc ready.  The situation is possible e.g. in case
of libthr being listed in DT_NEEDED before some of its consumers.

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

3 years agouma: Avoid allocating buckets with the cross-domain lock held
markj [Mon, 30 Nov 2020 16:18:33 +0000 (16:18 +0000)]
uma: Avoid allocating buckets with the cross-domain lock held

Allocation of a bucket can trigger a cross-domain free in the bucket
zone, e.g., if the per-CPU alloc bucket is empty, we free it and get
migrated to a remote domain.  This can lead to deadlocks since a bucket
zone may allocate buckets from itself or a pair of bucket zones could be
allocating from each other.

Fix the problem by dropping the cross-domain lock before allocating a
new bucket and handling refill races.  Use a list of empty buckets to
ensure that we can make forward progress.

Reported by: imp, mjg (witness(9) warnings)
Discussed with: jeff
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27341

3 years agoFix compilation on head and while here:
olivier [Mon, 30 Nov 2020 15:04:35 +0000 (15:04 +0000)]
Fix compilation on head and while here:
- remove unwanted whitespaces
- remove useless function ifphys()
- fix the Makefile to install it into /usr/bin

PR: 250133
Reviewed by: glebius, maxim
Approved by: glebius
Differential Revision: https://reviews.freebsd.org/D27155

3 years agoUnbreak r368167 in userland. Decorate unused arguments.
mmel [Mon, 30 Nov 2020 14:51:48 +0000 (14:51 +0000)]
Unbreak r368167 in userland. Decorate unused arguments.

Reported by: kp, tuexen, jenkins, and many others
MFC with: r368167

3 years agommccam: Convert some printf to CAM_DEBUG
manu [Mon, 30 Nov 2020 14:49:13 +0000 (14:49 +0000)]
mmccam: Convert some printf to CAM_DEBUG

This not not useful if you are not debuging mmccam

3 years agoarm: allwinner: aw_mmc: Add a sysctl for debuging
manu [Mon, 30 Nov 2020 14:48:50 +0000 (14:48 +0000)]
arm: allwinner: aw_mmc: Add a sysctl for debuging

Add a new hw.aw_mmc.debug sysctl to help debugging the driver.
Bit 0 will debug card changes (removal, insertion, power up/down)
Bit 1 will debug ios changes
Bit 2 will debug interrupts received
Bit 3 will debug commands sent

3 years agovt: if loader did pass the font via metadata, use it
tsoome [Mon, 30 Nov 2020 11:45:47 +0000 (11:45 +0000)]
vt: if loader did pass the font via metadata, use it

The built in 8x16 font may be way too small with large framebuffer
resolutions, to improve readability, use loader provied font.

3 years agoUse function macro for sema_init() in the LinuxKPI to limit macro expansion scope.
hselasky [Mon, 30 Nov 2020 09:47:53 +0000 (09:47 +0000)]
Use function macro for sema_init() in the LinuxKPI to limit macro expansion scope.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agofix vmbus_fb_mmio_res after r368168
tsoome [Mon, 30 Nov 2020 08:31:41 +0000 (08:31 +0000)]
fix vmbus_fb_mmio_res after r368168

mixed efifb versus vbefb struct use did slip in by mistake.

3 years agoAdd VT driver for VBE framebuffer device
tsoome [Mon, 30 Nov 2020 08:22:40 +0000 (08:22 +0000)]
Add VT driver for VBE framebuffer device

Implement vt_vbefb to support Vesa Bios Extensions (VBE) framebuffer with VT.
vt_vbefb is built based on vt_efifb and is assuming similar data for
initialization, use MODINFOMD_VBE_FB to identify the structure vbe_fb
in kernel metadata.

struct vbe_fb, is populated by boot loader, and is passed to kernel via
metadata payload.

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

3 years agoNVME: Don't try to swap data on little endian machines.
mmel [Mon, 30 Nov 2020 07:01:12 +0000 (07:01 +0000)]
NVME: Don't try to swap data on little endian machines.
These swapping functions violate BUSDMA contract - we cannot write
to armed (by bus_dmamap_sync(PRE_..)) buffers. Remove them at least
from little endian machines until a better solution will be developed.

Reviewed by: imp
MFC after: 3 weeks

3 years agoRemove RADIX_MPATH config option.
melifaro [Sun, 29 Nov 2020 19:43:33 +0000 (19:43 +0000)]
Remove RADIX_MPATH config option.

ROUTE_MPATH is the new config option controlling new multipath routing
 implementation. Remove the last pieces of RADIX_MPATH-related code and
 the config option.

Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D27244

3 years agoImport kernel WireGuard support
mmacy [Sun, 29 Nov 2020 19:38:03 +0000 (19:38 +0000)]
Import kernel WireGuard support

Data path largely shared with the OpenBSD implementation by
Matt Dunwoodie <ncon@nconroy.net>

Reviewed by: grehan@freebsd.org
MFC after: 1 month
Sponsored by: Rubicon LLC, (Netgate)
Differential Revision: https://reviews.freebsd.org/D26137

3 years agoReduce MAXPHYS back to 128KB on 32bit architectures.
kib [Sun, 29 Nov 2020 19:06:32 +0000 (19:06 +0000)]
Reduce MAXPHYS back to 128KB on 32bit architectures.

Some of them have limited KVA, like arm, which prevents startup from
allocating needed number of large pbufs.  Other, for instance i386,
are dis-balanced enough after 4/4 that blind bump is probably harmful
because it allows for much more in-flight io than other tunables are
ready for.

Requested by: mmel
Reviewed by: emaste, mmel
Sponsored by: The FreeBSD Foundation