]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agovirtio_pci_legacy: Allow memory space for configuration
Ka Ho Ng [Sat, 20 Mar 2021 07:40:55 +0000 (15:40 +0800)]
virtio_pci_legacy: Allow memory space for configuration

For guests running under some kind of VMMs, configuration structure is
available in memory space but not I/O space.

Reported by: Yuan Rui <number201724@me.com>
Reviewed by: rpokala, bryanv, jhb
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D28818

(cherry picked from commit cf5d1112408ddef3fdff8212599727c49ba90fa4)

3 years agovirtio_pci_legacy: Use the table BAR and PBA BAR from MSI-X cap
Ka Ho Ng [Sat, 20 Mar 2021 07:40:52 +0000 (15:40 +0800)]
virtio_pci_legacy: Use the table BAR and PBA BAR from MSI-X cap

The MSI-X resource shouldn't be assumed to be always on BAR1.
The Virtio v1.1 Spec did not specify that MSI-X table and PBA BAR has to
be BAR1 either.

Reported by: Yuan Rui <number201724@me.com>
Reviewed by: bryanv, jhb
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D28817

(cherry picked from commit faf9a4e9142a02c289ee543a6091bd4b925c6a63)

3 years agovm_fault: handle KERN_PROTECTION_FAILURE
Konstantin Belousov [Sat, 27 Mar 2021 11:08:52 +0000 (13:08 +0200)]
vm_fault: handle KERN_PROTECTION_FAILURE

(cherry picked from commit c7b913aa47bac8b35b6a0679497ad28e561318c2)

3 years agoFix fsck_ffs -R finds unfixed duplicate block errors when rerunning.
Kirk McKusick [Thu, 25 Mar 2021 00:23:33 +0000 (17:23 -0700)]
Fix fsck_ffs -R finds unfixed duplicate block errors when rerunning.

(cherry picked from commit 7848b25edd2a513f115de6d91f0a5a8d8fa1aa58)

3 years agoFix fsck_ffs Pass 1b error exit "bad inode number 2 to nextinode".
Kirk McKusick [Wed, 24 Mar 2021 23:50:24 +0000 (16:50 -0700)]
Fix fsck_ffs Pass 1b error exit "bad inode number 2 to nextinode".

(cherry picked from commit bc444e2ec6e6cc9d96d35ab7ce3c02c0da952fad)

3 years agoichsmb: Add PCI IDs for Intel Comet Lake and Tiger Lake
Neel Chauhan [Sat, 27 Mar 2021 21:08:34 +0000 (14:08 -0700)]
ichsmb: Add PCI IDs for Intel Comet Lake and Tiger Lake

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D27859
MFC after: 2 weeks

(cherry picked from commit a94d15af26b51cea480030b26c751c3550b1b4bb)

3 years agostats(3): Improve t-digest merging of samples which result in mu adjustment underflow.
Lawrence Stewart [Fri, 2 Apr 2021 01:29:29 +0000 (12:29 +1100)]
stats(3): Improve t-digest merging of samples which result in mu adjustment underflow.

Allow the calculation of the mu adjustment factor to underflow instead of
rejecting the VOI sample from the digest and logging an error. This trades off
some (currently unquantified) additional centroid error in exchange for better
fidelity of the distribution's density, which is the right trade off at the
moment until follow up work to better handle and track accumulated error can be
undertaken.

Obtained from: Netflix
MFC after: immediately

(cherry picked from commit 1eb402e47af35b3980e6bd51ec462de3a3faa2c8)

3 years agonfsv4 client: fix forced dismount when sleeping on nfsv4lck
Rick Macklem [Fri, 19 Mar 2021 21:09:33 +0000 (14:09 -0700)]
nfsv4 client: fix forced dismount when sleeping on nfsv4lck

During a recent NFSv4 testing event a test server caused a hang
where "umount -N" failed.  The renew thread was sleeping on "nfsv4lck"
and the "umount" was sleeping, waiting for the renew thread to
terminate.

This is the first of two patches that is hoped to fix the renew thread
so that it will terminate when "umount -N" is done on the mount.

nfsv4_lock() checks for forced dismount, but only after it wakes up
from msleep().  Without this patch, a wakeup() call was required.
This patch adds a 1second timeout on the msleep(), so that it will
wake up and see the forced dismount flag.  Normally a wakeup()
will occur in less than 1second, but if a premature return from
msleep() does occur, it will simply loop around and msleep() again.

While here, replace the nfsmsleep() wrapper that was used for portability
with the actual msleep() call and make the same change for nfsv4_getref().

(cherry picked from commit 5f742d3879deb1f46f2d151d5ef84f49e8d6afe6)

3 years agolibevent1: fix layout of duplicated RB_ENTRY() definition
Kyle Evans [Wed, 24 Mar 2021 04:31:02 +0000 (23:31 -0500)]
libevent1: fix layout of duplicated RB_ENTRY() definition

3a509754ded1 removed the color field from our definition, but libevent1
has a copy of it off to the side to prevent event.h consumers from
*needing* to pull in sys/queue.h and sys/tree.h.

Update the event.h definition so that we don't accidentally end up with
two different views of struct event.

This appears to have no functional effect on anything in tree, but this
came up in a local patch to port if_switch(4) and related components
from OpenBSD.

(cherry picked from commit 64c01719e476923fe1b24e5a6c6012a677cd017f)

3 years agoinit: use explicit_bzero() for clearing passwords
Kyle Evans [Wed, 3 Mar 2021 03:38:37 +0000 (21:38 -0600)]
init: use explicit_bzero() for clearing passwords

This is a nop in practice, because it cannot be proven that this
particular bzero() is not significant.  Make it explicit anyways, rather
than relying on an implementation detail of how the password is
collected.

Discussed with: Andrew Gierth <andrew tao146 riddles org uk>

(cherry picked from commit 852f70b24043885f0e438e8fecedd482a9a96d5e)

3 years agonfsv4 pnfs client: fix updating of the layout stateid.seqid
Rick Macklem [Thu, 18 Mar 2021 19:20:25 +0000 (12:20 -0700)]
nfsv4 pnfs client: fix updating of the layout stateid.seqid

During a recent NFSv4 testing event a test server was replying
NFSERR_OLDSTATEID for layout stateids presented to the server
for LayoutReturn operations.  Upon rereading RFC5661, it was
apparent that the FreeBSD NFSv4.1/4.2 pNFS client did not
maintain the seqid field of the layout stateid correctly.

This patch is believed to correct the problem.  Tested against
a FreeBSD pNFS server with diagnostics added to check the stateid's
seqid did not indicate problems.  Unfortunately, testing aginst
this server will not happen in the near future, so the fix may
not be correct yet.

(cherry picked from commit fd232a21bb35e8ba8b62c2314b16b2f1d7c00afc)

3 years agoMFC 874b1a35486b570513680c3d456b062ba097e1d9:
Cy Schubert [Tue, 23 Mar 2021 03:11:58 +0000 (20:11 -0700)]
MFC 874b1a35486b570513680c3d456b062ba097e1d9:

ipfilter: simplify ipf_proxy_check() return codes

ipf_proxy_check() returns -1 for an error and 0 or 1 for success.
ipf_proxy_check()'s callers check for error and if the return code
is 0, they change it to 1 prior to returning to their callers. Simply
by returning -1 or 1 we reduce complexity and cycles burned changing
0 to 1.

(cherry picked from commit 874b1a35486b570513680c3d456b062ba097e1d9)

3 years agoMFC 4e38478c595a:
Hans Petter Selasky [Thu, 25 Mar 2021 15:55:02 +0000 (16:55 +0100)]
MFC 4e38478c595a:
ipoib: Fix incorrectly computed IPOIB_CM_RX_SG value.

The computed IPOIB_CM_RX_SG is too small. It doesn't account for fallback
to mbuf clusters when jumbo frames are not available and it also doesn't
account for the packet header and trailer mbuf.

This causes a memory overwrite situation when IPOIB_CM is configured.

While at it add a kernel assert to ensure the mapping array is not overwritten.

PR: 254474
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 4e38478c595a9e6225b525890d7ee269a203c200)

3 years agoMFC 31070b5bc77a:
Hans Petter Selasky [Tue, 9 Mar 2021 16:41:18 +0000 (17:41 +0100)]
MFC 31070b5bc77a:
Set default alternate setting when USB audio devices are not in use,
to activate power save features.

Differential Revision: https://reviews.freebsd.org/D28032
Suggested by: Shichun_Ma@Dell.com
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 31070b5bc77a499009a835650eb9d4bf2eceaa15)

3 years agoGet rid of i386 ref here as linux64 is a 64-bit module.
Dmitry Chagin [Wed, 24 Mar 2021 15:56:46 +0000 (18:56 +0300)]
Get rid of i386 ref here as linux64 is a 64-bit module.

Reviewed By: emaste, imp
Differential Revision: https://reviews.freebsd.org/D29412

(cherry picked from commit 88588c4b7611a39cdf965c3c07d8fcc13ed553b4)

3 years agoFix warning about signed comparison and drop WARNS for ktrdump(8).
Dmitry Chagin [Wed, 24 Mar 2021 07:51:25 +0000 (10:51 +0300)]
Fix warning about signed comparison and drop WARNS for ktrdump(8).

Reviewed By: jhb, imp
Differential Revision: https://reviews.freebsd.org/D29381

(cherry picked from commit 9e5aeba51b431256adfd18b087ee61b09bfd6a79)

3 years agoamd64: Make KPDPphys local to pmap.c
Mark Johnston [Wed, 24 Mar 2021 13:55:22 +0000 (09:55 -0400)]
amd64: Make KPDPphys local to pmap.c

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 7ae2e703366e5ac56373509ececae53ecaa5bc59)

3 years agoFix several dev_clone callbacks to avoid out-of-bounds reads
Mark Johnston [Sun, 28 Mar 2021 15:08:36 +0000 (11:08 -0400)]
Fix several dev_clone callbacks to avoid out-of-bounds reads

Use strncmp() instead of bcmp(), so that we don't have to find the
minimum of the string lengths before comparing.

Reviewed by: kib
Reported by: KASAN
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29463

(cherry picked from commit 3428b6c050d102ba7f95514b29f4f5685d76b645)

3 years agopf tests: pfsync bulk update test
Kristof Provost [Mon, 15 Mar 2021 13:10:55 +0000 (14:10 +0100)]
pf tests: pfsync bulk update test

Test that pfsync works as expected with bulk updates. That is, create
some state before setting up the second firewall. Let that firewall
request a bulk update so it can catch up, and check that it got the
state which was created before it enable pfsync.

PR: 254236
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29272

(cherry picked from commit 8ad7d25dfc808ca00300f7553a9b28dfc0e99c18)

3 years agopfsync: Unconditionally push packets when requesting state updates
Thomas Kurschel [Mon, 15 Mar 2021 13:28:52 +0000 (14:28 +0100)]
pfsync: Unconditionally push packets when requesting state updates

When we request a bulk sync we need to ensure we actually send out that
request, not just buffer it until we have enough data to send a full
packet.

PR: 254236
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29271

(cherry picked from commit 9f2e5184173f6af70306678b018270df9a9600f2)

3 years agoFetch the sigfastblock value in syscalls that wait for signals
Jonathan T. Looney [Fri, 12 Mar 2021 18:14:17 +0000 (18:14 +0000)]
Fetch the sigfastblock value in syscalls that wait for signals

We have seen several cases of processes which have become "stuck" in
kern_sigsuspend(). When this occurs, the kernel's td_sigblock_val
is set to 0x10 (one block outstanding) and the userspace copy of the
word is set to 0 (unblocked). Because the kernel's cached value
shows that signals are blocked, kern_sigsuspend() blocks almost all
signals, which means the process hangs indefinitely in sigsuspend().

It is not entirely clear what is causing this condition to occur.
However, it seems to make sense to add some protection against this
case by fetching the latest sigfastblock value from userspace for
syscalls which will sleep waiting for signals. Here, the change is
applied to kern_sigsuspend() and kern_sigtimedwait().

(cherry picked from commit dbec10e08808e375365fb2a2462f306e0cdfda32)

3 years agoPut bandaid for nhgrp_dump_sysctl() malloc KASSERT().
Alexander V. Chernikov [Mon, 29 Mar 2021 23:12:11 +0000 (23:12 +0000)]
Put bandaid for nhgrp_dump_sysctl() malloc KASSERT().

Recent rtsock changes widened epoch and covered nhgrp_dump_sysctl(),
  resulting in `netstat -4On` triggering with KASSERT.

(cherry picked from commit 9fa8d1582b44b4850d40699c9adb104732328b7d)

3 years agoFix nexhtop group index array scaling.
Alexander V. Chernikov [Mon, 29 Mar 2021 23:00:17 +0000 (23:00 +0000)]
Fix nexhtop group index array scaling.

The current code has the limit of 127 nexthop groups due to the
 wrongly-checked bitmask_copy() return value.

PR: 254303
Reported by: Aleks <a.ivanov at veesp.com>

(cherry picked from commit 9095dc7da4cf0c484fb1160b2180b7329b09b107)

3 years agoStop installing kernel-only crypto headers to /usr/include/crypto.
John Baldwin [Tue, 16 Mar 2021 00:00:21 +0000 (17:00 -0700)]
Stop installing kernel-only crypto headers to /usr/include/crypto.

The only user-facing header from OCF is <crypto/cryptodev.h>.

Sponsored by: Chelsio Communications

(cherry picked from commit afbee98232f41fc05fa8a5b9a8cda4c4c65ff448)
(cherry picked from commit 2fc640d5bc0a17024dc1eb996ab00af42a5c6dbd)
(cherry picked from commit 283352dd4f6a3bb2f3c7cb45ce5dca3d86f5e3f4)
(cherry picked from commit 9946b2f4e0b478de69ebd687e2132c318a4d7c21)
(cherry picked from commit 7af04dff025d98e2feff979756ecde8ef0ace390)

3 years agoxnb: Don't pass SIOC{ADD,DEL}MULTI to ifmedia_ioctl().
John Baldwin [Mon, 22 Mar 2021 16:55:49 +0000 (09:55 -0700)]
xnb: Don't pass SIOC{ADD,DEL}MULTI to ifmedia_ioctl().

ifmedia_ioctl() doesn't handle these requests, and this matches what
xn does.

Sponsored by: DARPA

(cherry picked from commit 71ba16a0a02f4a3fd56d03e908615a8b5f701ba4)

3 years agoRename linux_set_upcall_kse() to linux_set_upcall().
John Baldwin [Thu, 18 Mar 2021 19:14:34 +0000 (12:14 -0700)]
Rename linux_set_upcall_kse() to linux_set_upcall().

This matches the rename of cpu_set_upcall_kse() in
5c2cf818454375536fda522ba83cf67c50929e6b.

Sponsored by: DARPA

(cherry picked from commit 3b57ddb029daf225a8385dade491019269da82e8)

3 years agox86: Reduce code duplication in cpu_fork() and cpu_copy_thread().
John Baldwin [Thu, 18 Mar 2021 19:13:17 +0000 (12:13 -0700)]
x86: Reduce code duplication in cpu_fork() and cpu_copy_thread().

Add copy_thread() to hold shared code.

Sponsored by: Netflix

(cherry picked from commit a7883464fcc45b78e6aa01222682ae40f787a378)

3 years agoaarch64: Clear TLS registers during exec().
John Baldwin [Wed, 17 Mar 2021 20:19:04 +0000 (13:19 -0700)]
aarch64: Clear TLS registers during exec().

These are not stored in the trapframe so must be cleared explicitly.

This is similar to one of the MIPS changes in 822d2d6ac94f.

Obtained from: CheriBSD
Sponsored by: DARPA

(cherry picked from commit 0723b409150ae302eb021cbde86a5f77348a1bb4)

3 years agox86: Update some stale comments in cpu_fork() and cpu_copy_thread().
John Baldwin [Fri, 12 Mar 2021 17:48:49 +0000 (09:48 -0800)]
x86: Update some stale comments in cpu_fork() and cpu_copy_thread().

Neither of these routines allocate stacks.

Sponsored by: Netflix

(cherry picked from commit 40d593d17eb6d70ea717d6546a16794858944176)

3 years agox86: Always use clean FPU and segment base state for new kthreads.
John Baldwin [Fri, 12 Mar 2021 17:48:36 +0000 (09:48 -0800)]
x86: Always use clean FPU and segment base state for new kthreads.

Sponsored by: Netflix

(cherry picked from commit c7b021352332a2f79907d68f971849f74b73e1c6)

3 years agoSet TDP_KTHREAD before calling cpu_fork() and cpu_copy_thread().
John Baldwin [Fri, 12 Mar 2021 17:48:20 +0000 (09:48 -0800)]
Set TDP_KTHREAD before calling cpu_fork() and cpu_copy_thread().

This permits these routines to use special logic for initializing MD
kthread state.

For the kproc case, this required moving the logic to set these flags
from kproc_create() into do_fork().

Sponsored by: Netflix

(cherry picked from commit 640d54045bdbf894ae3c75cd9818c29fc2f6e5e7)

3 years agoDon't pass RFPROC to kproc_create(), it is redundant.
John Baldwin [Fri, 12 Mar 2021 17:48:10 +0000 (09:48 -0800)]
Don't pass RFPROC to kproc_create(), it is redundant.

Sponsored by: Netflix

(cherry picked from commit 5a50eb6585ef8d1a40c8086bab8639cc56f00df9)

3 years agoRemove unused wrappers around kproc_create() and kproc_exit().
John Baldwin [Fri, 12 Mar 2021 17:47:58 +0000 (09:47 -0800)]
Remove unused wrappers around kproc_create() and kproc_exit().

Sponsored by: Netflix

(cherry picked from commit 645b15e558dc102ff70a6332b1d0b0aa733fd2bb)

3 years agox86: Copy the FPU/XSAVE state from the creating thread to new threads.
John Baldwin [Fri, 12 Mar 2021 17:47:41 +0000 (09:47 -0800)]
x86: Copy the FPU/XSAVE state from the creating thread to new threads.

POSIX states that new threads created via pthread_create() should
inherit the "floating point environment" from the creating thread.

Sponsored by: Netflix

(cherry picked from commit 755efb8d8fcacc6607bc46469750d78497f89378)

3 years agoamd64: Cleanups to setting TLS registers for Linux binaries.
John Baldwin [Fri, 12 Mar 2021 17:47:31 +0000 (09:47 -0800)]
amd64: Cleanups to setting TLS registers for Linux binaries.

- Use update_pcb_bases() when updating FS or GS base addresses to
  permit use of FSBASE and GSBASE in Linux processes.  This also sets
  PCB_FULL_IRET.  linux32 was setting PCB_32BIT which should be a
  no-op (exec sets it).

- Remove write-only variables to construct unused segment descriptors
  for linux32.

Sponsored by: Netflix

(cherry picked from commit 704547ce1ca56e1123048cd152ed4e468d41d703)

3 years agoamd64: Only update fsbase/gsbase in pcb for curthread.
John Baldwin [Fri, 12 Mar 2021 17:45:18 +0000 (09:45 -0800)]
amd64: Only update fsbase/gsbase in pcb for curthread.

Before the pcb is copied to the new thread during cpu_fork() and
cpu_copy_thread(), the kernel re-reads the current register values in
case they are stale.  This is done by setting PCB_FULL_IRET in
pcb_flags.

This works fine for user threads, but the creation of kernel processes
and kernel threads do not follow the normal synchronization rules for
pcb_flags.  Specifically, new kernel processes are always forked from
thread0, not from curthread, so adjusting pcb_flags via a simple
instruction without the LOCK prefix can race with thread0 running on
another CPU.  Similarly, kthread_add() clones from the first thread in
the relevant kernel process, not from curthread.  In practice, Netflix
encountered a panic where the pcb_flags in the first kthread of the
KTLS process were trashed due to update_pcb_bases() in
cpu_copy_thread() running from thread0 to create one of the other KTLS
threads racing with the first KTLS kthread calling fpu_kern_thread()
on another CPU.  In the panicking case, the write to update pcb_flags
in fpu_kern_thread() was lost triggering an "Unregistered use of FPU
in kernel" panic when the first KTLS kthread later tried to use the
FPU.

Sponsored by: Netflix

(cherry picked from commit 92211458689b448cda52a659f9d192fef5a9dd50)

3 years agobsdinstall: Drop vestigial bsdinstall-esps cleanup
Ryan Moeller [Fri, 26 Mar 2021 18:12:18 +0000 (14:12 -0400)]
bsdinstall: Drop vestigial bsdinstall-esps cleanup

This is not needed after 0b7472b3d8d2f1e90fade5236b44fd98d8e396c2.

MFC after: 3 days
Sponsored by: iXsystems, Inc.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D29325

(cherry picked from commit b07b7aec6534052d60cffe010c0426a7ab986d85)

3 years agorpc.lockd: Unconditionally close fds as daemon
Caleb St. John [Fri, 26 Mar 2021 18:00:14 +0000 (14:00 -0400)]
rpc.lockd: Unconditionally close fds as daemon

When lockd is configured with a debug level of > 0 and foreground == 0,
the process is daemonized with a truth noclose argument to daemon().
This doesn't seem to be the desired behavior because that prevents
stdout and stderr from being closed, however, stdout and stderr aren't
used anywhere else. Furthermore, the man pages state that with a higher
debug level it will use the syslog facilities to do so.

Submitted by: Caleb St. John
Discussed with: rmacklem
MFC after: 3 days
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D29415

(cherry picked from commit badcfbacf3840a4097bb79192054481c7674e7d2)

3 years agoalign nfsdumpstate column output
Caleb St. John [Wed, 24 Mar 2021 20:33:41 +0000 (16:33 -0400)]
align nfsdumpstate column output

There are scenarios where an NFS client will mount an NFSv4 export
without specifying a callback address.

When running nfsdumpstate under this circumstance, the column output is
shifted incorrectly which places the "ClientID" value underneath the
"Clientaddr" column.

This diff is a small cosmetic change that prints a blank in the
"Clientaddr" column and ensures the data for the columns are aligned
appropriately.

Submitted by: Caleb St. John
Reviewed by: sef (previous version)
MFC after: 3 days
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D18958

(cherry picked from commit efad9c8ba3cec7f6e39b128b90afab70701fd8d9)

3 years agoHyper-V: hn: Initialize the internal field of per packet info on tx path
Wei Hu [Mon, 15 Mar 2021 10:20:52 +0000 (10:20 +0000)]
Hyper-V: hn: Initialize the internal field of per packet info on tx path

The RSC support feature introduced a bit field "rm_internal" in
struct rndis_pktinfo with total size unchanged.

The guest does not use this field in the tx path. However we need to
initialize it to zero in case older hosts which are not aware of this
field.

Fixes: a491581f ("Hyper-V: hn: Enable vSwitch RSC support")
MFC after: 2 weeks
Sponsored by: Microsoft

(cherry picked from commit 805dbff6c36a6cd84491aa53a02315fa025734cc)

3 years agoHyper-V: hn: Enable vSwitch RSC support in hn netvsc driver
Wei Hu [Fri, 12 Mar 2021 04:35:16 +0000 (04:35 +0000)]
Hyper-V: hn: Enable vSwitch RSC support in hn netvsc driver

Receive Segment Coalescing (RSC) in the vSwitch is a feature available in
Windows Server 2019 hosts and later. It reduces the per packet processing
overhead by coalescing multiple TCP segments when possible. This happens
mostly when TCP traffics are among different guests on same host.
This patch adds netvsc driver support for this feature.

The patch also updates NVS version to 6.1 as needed for RSC
enablement.

MFC after: 2 weeks
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D29075

(cherry picked from commit a491581f3f8df07cdff0236bd556895205929af4)

3 years agoHyper-V: hn: Store host hash value in flowid
Wei Hu [Wed, 24 Feb 2021 05:07:46 +0000 (05:07 +0000)]
Hyper-V: hn: Store host hash value in flowid

When rx packet contains hash value sent from host, store it in
the mbuf's flowid field so when the same mbuf is on the tx path,
the hash value can be used by the host to determine the outgoing
network queue.

MFC after: 2 weeks
Sponsored by: Microsoft

(cherry picked from commit 80f39bd95f22322152709ea5fae3a3c546044c9c)

3 years agoZero `struct weightened_nhop` fields in nhgrp_get_addition_group().
Alexander V. Chernikov [Sat, 20 Mar 2021 08:26:03 +0000 (08:26 +0000)]
Zero `struct weightened_nhop` fields in nhgrp_get_addition_group().

`struct weightened_nhop` has spare 32bit between the fields due to
 the alignment (on amd64).
Not zeroing these spare bits results in duplicating nhop groups
 in the kernel due to the way how comparison works.

(cherry picked from commit 6f43c72b472ee78e04f1ebd347ca0ae7787ee876)

3 years agoMakefile.inc1: unbreak bootstrap when kbdcontrol does not exist
Glen Barber [Wed, 24 Mar 2021 00:47:14 +0000 (20:47 -0400)]
Makefile.inc1: unbreak bootstrap when kbdcontrol does not exist

Submitted by: Evgeniy Khramtsov
Reviewed by: arichardson
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 50179c5ec7d09d7b02497caf95dca5d33f93bcd9)

3 years agoaccept_filter: Fix filter parameter handling
Mark Johnston [Thu, 25 Mar 2021 21:55:20 +0000 (17:55 -0400)]
accept_filter: Fix filter parameter handling

For filters which implement accf_create, the setsockopt(2) handler
caches the filter name in the socket, but it also incorrectly frees the
buffer containing the copy, leaving a dangling pointer.  Note that no
accept filters provided in the base system are susceptible to this, as
they don't implement accf_create.

Reported by: Alexey Kulaev <alex.qart@gmail.com>
Discussed with: emaste
Security: kernel use-after-free
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 653a437c04440495cd8e7712c7cf39444f26f1ee)

3 years agopf: Handle unmapped mbufs when computing checksums
Mark Johnston [Tue, 23 Mar 2021 13:38:59 +0000 (09:38 -0400)]
pf: Handle unmapped mbufs when computing checksums

PR: 254419
Reviewed by: gallatin, kp
Tested by: Igor A. Valkov <viaprog@gmail.com>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29378

(cherry picked from commit b93a796b06ec013a75a08ac43d8acf6aa94aa970)

3 years agomountd(8): generate a syslog message when the "V4:" line is missing
Rick Macklem [Tue, 9 Mar 2021 00:08:02 +0000 (16:08 -0800)]
mountd(8): generate a syslog message when the "V4:" line is missing

Daniel reported that NFSv4 mounts were not working despite having
set "nfsv4_server_enable=YES" in /etc/rc.conf.  Mountd was logging a
message that there was no /etc/exports file.
He noted that creating a /etc/exports file with a "V4:" line in it
was needed make NFSv4 mounts work.
At least one "V4:" line in one of the exports(5) file(s) is needed to
make NFSv4 mounts work. This patch fixes mountd.c so that it logs a
message indicting that there is no "V4:" line in any exports(5)
file when NFSv4 mounts are enabled.
To avoid this message being generated erroneously, /etc/rc.d/mountd
is updated to make sure vfs.nfsd.server_max_nfsvers is properly set
before mountd(8) is started.

PR: 253901

(cherry picked from commit 09673fc0f36dd1cca74940a240a9ed0f62228084)

3 years agosecurity.7: fix typo in sysctl name
Piotr Pawel Stefaniak [Fri, 26 Mar 2021 21:24:06 +0000 (22:24 +0100)]
security.7: fix typo in sysctl name

It is machdep.syscall_ret_flush_l1d.

(cherry picked from commit 4233882f4ed36bde0ad03918d3f9a54a0cd7697a)

3 years agorelease: amd64: Fix ISO/USB hybrid image
Emmanuel Vadot [Sat, 27 Mar 2021 11:04:51 +0000 (12:04 +0100)]
release: amd64: Fix ISO/USB hybrid image

Recent mkimg changes forces to have partitions given in explicit order.
This is so we can have the first partition starting at a specific offset
and the next ones starting after without having to specify an offset.
Switch the partition in the mkisoimage.sh script so the first one created
is the isoboot one.

PR:    254490
Reported by: Michael Dexter <editor@callfortesting.org
Tested by: Vincent Milum Jr <freebsd@darkain.com>
MFC after: Right now

(cherry picked from commit 90d2f7c413f9fc4ac479fa5e91ba1de6d4ea8d45)

3 years agoelftoolchain: Support building on Arm-based Macs
Jessica Clarke [Sat, 20 Mar 2021 17:58:10 +0000 (17:58 +0000)]
elftoolchain: Support building on Arm-based Macs

Currently macOS and DragonFlyBSD get their own special case and only
handle x86. Since all the FreeBSD cases should be general enough for
macOS and DragonFlyBSD (and the x86 ones are identical to the existing
ones) we can just delete the special cases and reuse the FreeBSD ones.

Note that upstream has since removed all the architecture-specific
checks in this file, with the only code relevant to us being an
endianness check that uses the generic compiler-provided macros. Thus
this patch will not be upstreamed, and will be dropped in a future
vendor import.

(cherry picked from commit 839fdcfc0c1dba34f728813d9756515ad82ff58a)

3 years agotools/build: Improve host-symlinks failure mode
Jessica Clarke [Sat, 20 Mar 2021 13:00:34 +0000 (13:00 +0000)]
tools/build: Improve host-symlinks failure mode

Since set -e is enabled by sys.mk, if the tool cannot be found in PATH
then the entire shell command line fails, causing us to not print the
error message below and instead silently (due to the @) fail, only
getting the usual "Error code 1" print from bmake. Thus, provide a dummy
default that will never exist (the same as is used by meta2deps.sh) if
which fails so that we get the error message as intended.

(cherry picked from commit 8c9e45503fe41732f72e1a4cc9a231e63b4289ba)

3 years agobhyve: support relocating fbuf and passthru data BARs
D Scott Phillips [Thu, 18 Mar 2021 16:08:52 +0000 (00:08 +0800)]
bhyve: support relocating fbuf and passthru data BARs

We want to allow the UEFI firmware to enumerate and assign
addresses to PCI devices so we can boot from NVMe[1]. Address
assignment of PCI BARs is properly handled by the PCI emulation
code in general, but a few specific cases need additional support.
fbuf and passthru map additional objects into the guest physical
address space and so need to handle address updates. Here we add a
callback to emulated PCI devices to inform them of a BAR
configuration change. fbuf and passthru then watch for these BAR
changes and relocate the frame buffer memory segment and passthru
device mmio area respectively.

We also add new VM_MUNMAP_MEMSEG and VM_UNMAP_PPTDEV_MMIO ioctls
to vmm(4) to facilitate the unmapping needed for addres updates.

[1]: https://github.com/freebsd/uefi-edk2/pull/9/

Originally by: scottph
Sponsored by: Intel Corporation
Reviewed by: grehan
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D24066

(cherry picked from commit f8a6ec2d572758da6cfd29fcb4ecf4430463661d)

3 years agobhyve amd: Small cleanups in amdvi_dump_cmds
Ka Ho Ng [Tue, 23 Mar 2021 08:11:56 +0000 (16:11 +0800)]
bhyve amd: Small cleanups in amdvi_dump_cmds

Bump offset with MOD_INC instead in amdvi_dump_cmds.

Reviewed by: jhb
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D28862

(cherry picked from commit be97fc8dced052f824387a1ae6a0063f9dcfdc89)

3 years agoPlug nexthop group refcount leak.
Alexander V. Chernikov [Wed, 24 Mar 2021 23:51:45 +0000 (23:51 +0000)]
Plug nexthop group refcount leak.
In case with batch route delete via rib_walk_del(), when
 some paths from the multipath route gets deleted, old
 multipath group were not freed.

PR:    254496
Reported by:   Zhenlei Huang <zlei.huang@gmail.com>

(cherry picked from commit 66f138563becf12d5c21924f816d2a45c3a1ed7a)

3 years agoFix panic when destroying interface with ECMP routes.
Alexander V. Chernikov [Tue, 23 Mar 2021 22:00:04 +0000 (22:00 +0000)]
Fix panic when destroying interface with ECMP routes.

Reported by: Zhenlei Huang <zlei.huang at gmail.com>
PR: 254496

(cherry picked from commit a0308e48ec12ae37f525aa3c6d3c1a236fb55dcd)

3 years agoFix kassert panic when inserting multipath routes from multiple threads.
Alexander V. Chernikov [Sun, 21 Mar 2021 18:15:29 +0000 (18:15 +0000)]
Fix kassert panic when inserting multipath routes from multiple threads.

Reported by: Marco Zec <zec at fer.hr>

(cherry picked from commit 2476178e6b09acc8d0fe6b1fb9c1b6f2981f766e)

3 years agoOpenSSL: Regen manual pages for 1.1.1k
Jung-uk Kim [Thu, 25 Mar 2021 16:17:52 +0000 (12:17 -0400)]
OpenSSL: Regen manual pages for 1.1.1k

(cherry picked from commit 7595394130a163b7ff53d9ef3f28fcb87f629d17)

3 years agoOpenSSL: Merge OpenSSL 1.1.1k
Jung-uk Kim [Thu, 25 Mar 2021 15:45:19 +0000 (11:45 -0400)]
OpenSSL: Merge OpenSSL 1.1.1k

Merge commit '94fa08a4bcdfbb3434b025d67d014af3b18e5380'

(cherry picked from commit b6c1fdcdf5033d20c61cc77d66f58f31cc65e2ba)

3 years agoTeach DTrace that unaligned accesses are OK on aarch64, not just x86.
Robert Watson [Mon, 22 Mar 2021 01:50:00 +0000 (01:50 +0000)]
Teach DTrace that unaligned accesses are OK on aarch64, not just x86.

MFC after: 3 days
Reviewed: andrew
Differential Revision: https://reviews.freebsd.org/D29369

3 years agoTune DTrace 'aframes' for the FBT and profile providers on arm64.
Robert Watson [Sun, 21 Mar 2021 00:01:54 +0000 (00:01 +0000)]
Tune DTrace 'aframes' for the FBT and profile providers on arm64.

In both cases, too few frames were trimmed, leading to exception handling
or DTrace internals being exposed in stack traces exposed by D's stack()
primitive.

Reviewed by: emaste, andrew
Differential Revision: https://reviews.freebsd.org/D29356

(cherry picked from commit 599fb1d198ec6792ba062114d2589ca9f01a3568)

3 years agorandom(9): Restore historical [0,2^31-1] output range and related man documention.
Lawrence Stewart [Wed, 24 Mar 2021 04:25:49 +0000 (15:25 +1100)]
random(9): Restore historical [0,2^31-1] output range and related man documention.

Commit SVN r364219 / Git 8a0edc914ffd changed random(9) to be a shim around
prng32(9) and inadvertently caused random(9) to begin returning numbers in the
range [0,2^32-1] instead of [0,2^31-1], where the latter has been the documented
range for decades.

The increased output range has been identified as the source of numerous bugs in
code written against the historical output range e.g. ipfw "prob" rules and
stats(3) are known to be affected, and a non-exhaustive audit of the tree
identified other random(9) consumers which are also likely affected.

As random(9) is deprecated and slated for eventual removal in 14.0, consumers
should gradually be audited and migrated to prng(9).

Submitted by: Loic Prylli <lprylli@netflix.com>
Obtained from: Netflix
Reviewed by: cem, delphij, imp
MFC after: 1 day
MFC to: stable/13, releng/13.0
Differential Revision: https://reviews.freebsd.org/D29385

(cherry picked from commit dbbf3e3f37d67d3eae0931855f8b62b9b299b80a)

3 years agomn: bump deprecation version to 14 in man page as well
Ed Maste [Thu, 25 Mar 2021 02:37:33 +0000 (22:37 -0400)]
mn: bump deprecation version to 14 in man page as well

Fixes: 66e75d9e2ddd ("mn: report that this driver is removed in 14, not 13")
3 years agomn: report that this driver is removed in 14, not 13
Ed Maste [Thu, 25 Mar 2021 02:35:38 +0000 (22:35 -0400)]
mn: report that this driver is removed in 14, not 13

3 years agoarm64: implement COMPAT_FREEBSD32 fill/set dbregs/fpregs
Ed Maste [Wed, 17 Mar 2021 14:10:41 +0000 (10:10 -0400)]
arm64: implement COMPAT_FREEBSD32 fill/set dbregs/fpregs

On FreeBSD/arm fill_fpregs, fill_dbregs are stubs that zero the reg
struct and return success. set_fpregs and set_dbregs do nothing and
return success.

Provide the same implementation for arm64 COMPAT_FREEBSD32.

Reviewed by: andrew
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29314

(cherry picked from commit 5be27cbf16c85ce95d21db57349f61494f851821)

3 years agortsold: Fix validation of RDNSS options
Mark Johnston [Sun, 21 Mar 2021 18:18:10 +0000 (14:18 -0400)]
rtsold: Fix validation of RDNSS options

The header specifies the size of the option in multiples of eight bytes.
The option consists of an eight-byte header followed by one or more IPv6
addresses, so the option is invalid if the size is not equal to 1+2n for
some n>0.  Check this.

The bug can cause random stack data to be formatted as an IPv6 address
and passed to resolvconf(8), but a host able to trigger the bug may also
specify arbitrary addresses this way.

Reported by: Q C <cq674350529@gmail.com>
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 1af332a7d8f86b6fcc1f0f575fe5b06021b54f4c)

3 years agoMFC eeb26cf52c4c51e1571253d57684c442aa79a98d:
Cy Schubert [Wed, 17 Mar 2021 00:06:17 +0000 (17:06 -0700)]
MFC eeb26cf52c4c51e1571253d57684c442aa79a98d:

wpa: import fix for P2P provision discovery processing vulnerability

Latest version available from: https://w1.fi/security/2021-1/

Vulnerability

A vulnerability was discovered in how wpa_supplicant processes P2P
(Wi-Fi Direct) provision discovery requests. Under a corner case
condition, an invalid Provision Discovery Request frame could end up
reaching a state where the oldest peer entry needs to be removed. With
a suitably constructed invalid frame, this could result in use
(read+write) of freed memory. This can result in an attacker within
radio range of the device running P2P discovery being able to cause
unexpected behavior, including termination of the wpa_supplicant process
and potentially code execution.

Vulnerable versions/configurations

wpa_supplicant v1.0-v2.9 with CONFIG_P2P build option enabled

An attacker (or a system controlled by the attacker) needs to be within
radio range of the vulnerable system to send a set of suitably
constructed management frames that trigger the corner case to be reached
in the management of the P2P peer table.

Note: FreeBSD base does not enable P2P.
(cherry picked from commit eeb26cf52c4c51e1571253d57684c442aa79a98d)

3 years agoMFC 1acf24a044aa:
Hans Petter Selasky [Tue, 16 Mar 2021 15:06:42 +0000 (16:06 +0100)]
MFC 1acf24a044aa:
Implement pci_get_relaxed_ordering_enabled() helper function.

Discussed with: kib@
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 1acf24a044aaa0391c61af4abe7e018c3bf8a37c)

3 years agonvme: Replace potentially long DELAY() with pause().
Alexander Motin [Wed, 17 Mar 2021 14:30:40 +0000 (10:30 -0400)]
nvme: Replace potentially long DELAY() with pause().

In some cases like broken hardware nvme(4) may wait minutes for
controller response before timeout.  Doing so in a tight spin loop
made whole system unresponsive.

Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29309
Sponsored by: iXsystems, Inc.

(cherry picked from commit 4fbbe523653b6d2a0186aca38224efcab941deaa)

3 years agoMFC: Fix post-start check when unbound.conf has moved.
Dag-Erling Smørgrav [Wed, 10 Mar 2021 14:18:59 +0000 (14:18 +0000)]
MFC: Fix post-start check when unbound.conf has moved.

On behalf of: des
Reported by: phk@
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 409388cfac49a312034e9397c870e3f81ff90734)

3 years agoMFC: Fix local-unbound setup for some IPv6 deployments.
Dag-Erling Smørgrav [Wed, 10 Mar 2021 14:01:38 +0000 (14:01 +0000)]
MFC: Fix local-unbound setup for some IPv6 deployments.

On behalf of: des
PR: 250984

(cherry picked from commit e5f02c140bf1e519a95bd6331382e8a2a1b6219f)

3 years agonetmap: fix issues in nm_os_extmem_create()
Vincenzo Maffione [Sat, 20 Mar 2021 17:15:50 +0000 (17:15 +0000)]
netmap: fix issues in nm_os_extmem_create()

- Call vm_object_reference() before vm_map_lookup_done().
- Use vm_mmap_to_errno() to convert vm_map_* return values to errno.
- Fix memory leak of e->obj.

Reported by: markj
Reviewed by: markj
MFC after: 1 week

(cherry picked from commit ee7ffaa2e6e08b63efb4673610875d40964d5058)

3 years agoFix scripted installs on EFI systems after default mounting of the ESP.
Nathan Whitehorn [Tue, 23 Mar 2021 13:19:42 +0000 (09:19 -0400)]
Fix scripted installs on EFI systems after default mounting of the ESP.

Because the ESP mount point (/boot/efi) is in mtree, tar will attempt to
extract a directory at that point post-mount when the system is installed.
Normally, this is fine, since tar can happily set whatever properties it
wants. For FAT32 file systems, however, like the ESP, tar will attempt to
set mtime on the root directory, which FAT does not support, and tar will
interpret this as a fatal error, breaking the install (see
https://github.com/libarchive/libarchive/issues/1516). This issue would
also break scripted installs on bare-metal POWER8, POWER9, and PS3
systems, as well as some ARM systems.

This patch solves the problem in two ways:
- If stdout is a TTY, use the distextract stage instead of tar, as in
  interactive installs. distextract solves this problem internally and
  provides a nicer UI to boot, but requires a TTY.
- If stdout is not a TTY, use tar but, as a stopgap for 13.0, exclude
  boot/efi from tarball extraction and then add it by hand. This is a
  hack, and better solutions (as in the libarchive ticket above) will
  obsolete it, but it solves the most common case, leaving only
  unattended TTY-less installs on a few tier-2 platforms broken.

In addition, fix a bug with fstab generation uncovered once the tar issue
is fixed that umount(8) can depend on the ordering of lines in fstab in a
way that mount(8) does not. The partition editor now writes out fstab in
mount order, making sure umount (run at the end of scripted, but not
interactive, installs) succeeds.

PR: 254395
Approved by: re (gjb)
Reviewed by: gjb, imp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29380

(cherry picked from commit c2f16c595eb51c6e0cb6ece3f6f078d738019059)

3 years agopf: pool/kpool conversion code
Kristof Provost [Thu, 11 Mar 2021 10:37:05 +0000 (11:37 +0100)]
pf: pool/kpool conversion code

stuct pf_pool and struct pf_kpool are different. We should not simply
bcopy() them.

Happily it turns out that their differences were all pointers, and the
userspace provided pointers were overwritten by the kernel, so this did
actually work correctly, but we should fix it anyway.

Reviewed by: glebius
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29216

(cherry picked from commit 15b82e00a1640d1b9a1d720c95f65e580be30187)

3 years agopchtherm: fix a wrong bit and a wrong register use
Michal Vanco [Fri, 5 Mar 2021 08:55:30 +0000 (10:55 +0200)]
pchtherm: fix a wrong bit and a wrong register use

Probably just copy-paste errors that slipped in.

(cherry picked from commit 5084dde5f087264cf9a826569d1152c65d88a0fe)

PR: 253915
Reported by: Michal Vanco <michal.vanco@gmail.com>

3 years agoMFC dfb33cb0ef48:
Hans Petter Selasky [Wed, 10 Mar 2021 12:26:09 +0000 (13:26 +0100)]
MFC dfb33cb0ef48:
Allocating the LinuxKPI current structure from a software interrupt thread
must be done using the M_NOWAIT flag after 1ae20f7c70ea .

Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit dfb33cb0ef48084da84072244e8ca486dfcf3a96)

3 years agoMFC d1cbe7908986:
Hans Petter Selasky [Wed, 10 Mar 2021 09:50:01 +0000 (10:50 +0100)]
MFC d1cbe7908986:
Allocating the LinuxKPI current structure from an interrupt thread must be
done using the M_NOWAIT flag after 1ae20f7c70ea .

Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit d1cbe79089868226625c12ef49f51214d79aa427)

3 years agoMFC 6eb60f5b7f7d:
Hans Petter Selasky [Wed, 10 Mar 2021 11:21:01 +0000 (12:21 +0100)]
MFC 6eb60f5b7f7d:
Use the word "LinuxKPI" instead of "Linux compatibility", to not confuse with
user-space Linux compatibility support. No functional change.

Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 6eb60f5b7f7df1a59de139260aebfa0aa5f6d79e)

3 years agoMFC ebe5cf355dca:
Hans Petter Selasky [Fri, 5 Mar 2021 11:44:06 +0000 (12:44 +0100)]
MFC ebe5cf355dca:
Implement basic support for allocating memory from a specific numa node
in the LinuxKPI.

Differential Revision: https://reviews.freebsd.org/D29077
Reviewed by: markj@ and kib@
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit ebe5cf355dca1d7827a70b99a9d9c4f97f78691d)

3 years agoMFC c743a6bd4fc0:
Hans Petter Selasky [Sat, 6 Mar 2021 10:25:12 +0000 (11:25 +0100)]
MFC c743a6bd4fc0:
Implement mallocarray_domainset(9) variant of mallocarray(9).

Reviewed by: kib @
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit c743a6bd4fc0d1be30f9bc9996333ac0ba079563)

3 years agostand: Load INIT_ARRAY and FINI_ARRAY sections
Mark Johnston [Tue, 16 Mar 2021 19:01:41 +0000 (15:01 -0400)]
stand: Load INIT_ARRAY and FINI_ARRAY sections

This is required for preloading modules into a KASAN-configured kernel.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 7b1b5aad95df671aba3192f1669a8d96da481939)

3 years agonlmrsa: Mark deprecated for 14.
John Baldwin [Tue, 16 Mar 2021 21:34:58 +0000 (14:34 -0700)]
nlmrsa: Mark deprecated for 14.

This is the only in-tree driver for the asymmetric crypto support in
OCF that is already marked deprecated for 14.

Sponsored by: Chelsio Communications

(cherry picked from commit 096a84721670d388e432a1f7399251e4b20714f1)

3 years agoiscsi: Mark iSCSI CAM sims as non-pollable.
John Baldwin [Thu, 11 Feb 2021 21:51:20 +0000 (13:51 -0800)]
iscsi: Mark iSCSI CAM sims as non-pollable.

Previously, iscsi_poll() just panicked.  This meant if you got a panic
on a box when using the iSCSI initiator, the attempt to shutdown would
trigger a nested panic and never write out a core.  Now, CCB's sent to
iSCSI devices (such as the sychronize-cache request in dashutdown())
just fail with a timeout during a panic shutdown.

Sponsored by: Chelsio

(cherry picked from commit 47769bc5573fc5d2263f9e20cb06f6c12d0a82e7)

3 years agocam: Don't permit crashdumps on non-pollable devices.
John Baldwin [Thu, 11 Feb 2021 21:51:01 +0000 (13:51 -0800)]
cam: Don't permit crashdumps on non-pollable devices.

If a disk's SIM doesn't support polling, then it can't be used to
store crashdumps.  Leave d_dump NULL in that case so that dumpon(8)
fails gracefully rather than having dumps fail at crash time.

Sponsored by: Chelsio

(cherry picked from commit e07ac3f2fd7336e04178d116033989a6c099fec4)

3 years agocam: Permit non-pollable sims.
John Baldwin [Thu, 11 Feb 2021 21:49:43 +0000 (13:49 -0800)]
cam: Permit non-pollable sims.

Some CAM sim drivers do not support polling (notably iscsi(4)).
Rather than using a no-op poll routine that always times out requests,
permit a SIM to set a NULL poll callback.  cam_periph_runccb() will
fail polled requests non-pollable sims immediately as if they had
timed out.

Sponsored by: Chelsio

(cherry picked from commit 447b3557a9cc5f00a301be8404339f21a9a0faa8)
(cherry picked from commit e6405c8c37335a42a187a9d2470025b57347b1b5)

3 years agoarmv8crypto: note derivation in armv8_crypto_wrap.c
Mitchell Horne [Mon, 15 Mar 2021 13:46:03 +0000 (10:46 -0300)]
armv8crypto: note derivation in armv8_crypto_wrap.c

This file inherits some boilerplate and structure from the analogous
file in aesni(4), aesni_wrap.c. Note the derivation and the copyright
holders of that file.

For example, the AES-XTS bits added in 4979620ece984 were ported from
aesni(4).

Requested by: jmg
Reviewed by: imp, gnn

(cherry picked from commit da45b462664148ff6f8adbe59847c6c06f295391)

3 years agoiflib: Make if_shared_ctx_t a pointer to const
Mark Johnston [Mon, 8 Mar 2021 17:39:06 +0000 (12:39 -0500)]
iflib: Make if_shared_ctx_t a pointer to const

This structure is shared among multiple instances of a driver, so we
should ensure that it doesn't somehow get treated as if there's a
separate instance per interface.  This is especially important for
software-only drivers like wg.

DEVICE_REGISTER() still returns a void * and so the per-driver sctx
structures are not yet defined with the const qualifier.

Reviewed by: gallatin, erj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29102

(cherry picked from commit ffe3def903a5f239c319e5fe12450659658974a5)

3 years agoofwfb: fix boot on LE
Leandro Lupori [Tue, 9 Mar 2021 15:11:58 +0000 (12:11 -0300)]
ofwfb: fix boot on LE

Some framebuffer properties obtained from the device tree were not being
properly converted to host endian.
Replace OF_getprop calls by OF_getencprop where needed to fix this.

This fixes boot on PowerPC64 LE, when using ofwfb as the system console.

Reviewed by:    bdragon
Sponsored by:   Eldorado Research Institute (eldorado.org.br)
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D27475

(cherry picked from commit 043577b721ec4e5c2ab7571e6c05cfd54e49473c)

3 years agoInclude ccompile.h after opt_global.h.
Alexander Motin [Mon, 15 Mar 2021 17:48:50 +0000 (13:48 -0400)]
Include ccompile.h after opt_global.h.

This restores INVARIANTS enabling ZFS_DEBUG when built as module.

Discussed with: freqlabs
MFC after: 1 week

(cherry picked from commit 8ea35c45d5206ad57945ba160484f04450c88b75)

3 years agogenet: Fix problem with forwarding some TCP/IPv6 packets
Mike Karels [Thu, 18 Mar 2021 00:19:24 +0000 (19:19 -0500)]
genet: Fix problem with forwarding some TCP/IPv6 packets

TCP/IPv6 packets to be forwarded can be laid out with only the Ethernet
header in the first mbuf, and these packets are lost.  There was a
previous hack to pullup ICMPv6 packets with such a layout for the
same reason.  Generalize, and pullup any IPv6 packets with only the
Ethernet header in the first mbuf.  Possibly this should also include
IPv4, but that situation has not been observed to fail.

PR: 254060
Reported by: denis at h3q.com
MFC after: 3 days

(cherry picked from commit 2bdcf6237744b2d9d9707d623660d33931daeb52)

3 years agoVendor import of bc 3.3.4
Stefan Eßer [Fri, 19 Mar 2021 08:39:56 +0000 (09:39 +0100)]
Vendor import of bc 3.3.4

This update performs an implicit flush of the output when a script
calls read() in case a prompt is to be displayed in line-buffered
output mode.

(cherry picked from commit 893ecb52db5ed47d6c1e8698334d34e0df651612)

3 years agoMerge tcsh 6.22.03-ceccc7f
Dmitry Chagin [Sun, 14 Mar 2021 16:33:13 +0000 (19:33 +0300)]
Merge tcsh 6.22.03-ceccc7f

PR: 252663

(cherry picked from commit 5224c2a3bc95b431f729f3692f264395248d8acc)

3 years agoSpeed up geom_stats_resync in the presence of many devices
Alan Somers [Sat, 27 Feb 2021 15:59:40 +0000 (08:59 -0700)]
Speed up geom_stats_resync in the presence of many devices

The old code had a O(n) loop, where n is the size of /dev/devstat.
Multiply that by another O(n) loop in devstat_mmap for a total of
O(n^2).

This change adds DIOCGMEDIASIZE support to /dev/devstat so userland can
quickly determine the right amount of memory to map, eliminating the
O(n) loop in userland.

This change decreases the time to run "gstat -bI0.001" with 16,384 md
devices from 29.7s to 4.2s.

Also, fix a memory leak first reported as PR 203097.

Sponsored by: Axcient
Reviewed by: mav, imp
Differential Revision: https://reviews.freebsd.org/D28968

(cherry picked from commit ab63da3564e8ab0907f9d8eb565774848ffdadeb)

3 years agofortune: add a tip about gstat
Alan Somers [Fri, 26 Feb 2021 15:06:07 +0000 (08:06 -0700)]
fortune: add a tip about gstat

(cherry picked from commit 60a632f047cdb6e5314711f593a4d3b1f1d8dde9)

3 years agofusefs: set d_off during VOP_READDIR
Alan Somers [Fri, 12 Feb 2021 01:01:10 +0000 (18:01 -0700)]
fusefs: set d_off during VOP_READDIR

This allows d_off to be used with lseek to position the file so that
getdirentries(2) will return the next entry.  It is not used by
readdir(3).

PR: 253411
Reported by: John Millikin <jmillikin@gmail.com>
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D28605

(cherry picked from commit 71befc35061b3c9d8cc07e34c5dce622c848fcdb)

3 years agopf tests: Test tos/dscp matching
Kristof Provost [Wed, 3 Mar 2021 20:15:39 +0000 (21:15 +0100)]
pf tests: Test tos/dscp matching

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29078

(cherry picked from commit 9d3b2bcf761041bbe79da3de25f2e4142d90b46a)

3 years agopfctl: Add missing 'va' code point name
Kristof Provost [Thu, 4 Mar 2021 12:50:28 +0000 (13:50 +0100)]
pfctl: Add missing 'va' code point name

Add the 'va' (voice-admit, RFC5865) symbolic name.

Reviewed by: rgrimes, gbe (man page)
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29069

(cherry picked from commit b4e3f3c2de6e6dc614f99615e50d0d87f3367ca0)

3 years agofind(1): Refine the HISTORY within the manual page.
Gordon Bergling [Sat, 13 Mar 2021 18:28:26 +0000 (19:28 +0100)]
find(1): Refine the HISTORY within the manual page.

A simple find command appeared in Version 1 AT&T UNIX and was removed in
Version 3 AT&T UNIX. It was rewritten for Version 5 AT&T UNIX and later
be enhanced for the Programmer's Workbench (PWB). These changes were
later incorporated in AT&T UNIX v7.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D29114

(cherry picked from commit a9275d996c229a30879baa42a6d02d24663ac43b)

3 years agofind(1): Mark -not as an extensions to POSIX
Daniel Ebdrup Jensen [Tue, 23 Feb 2021 15:23:09 +0000 (16:23 +0100)]
find(1): Mark -not as an extensions to POSIX

While here, change mdoc macro from Ic to Fl.

PR: 253499
Reported by: Michael Siegel <bugcounterism at malbolge.net>

(cherry picked from commit 75e6f664c469927ca73ecd7b16a8058bc292a451)

3 years agonet80211: Fix a typo in a comment
Gordon Bergling [Sat, 13 Mar 2021 14:51:30 +0000 (15:51 +0100)]
net80211: Fix a typo in a comment

- destionation -> destination
- while here, fix some whitespace issues

(cherry picked from commit d197bf2b20e7efc6ffef520bf96d5f642e26a015)

3 years agoFix a few typos in comments
Gordon Bergling [Sat, 13 Mar 2021 15:37:28 +0000 (16:37 +0100)]
Fix a few typos in comments

- trough -> through

MFC after: 1 week

(cherry picked from commit 183502d1625fbcc3600fbe1d196758b946749569)