]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agotzcode: Implement timezone change detection
Edward Tomasz Napierala [Sun, 12 Sep 2021 03:07:26 +0000 (03:07 +0000)]
tzcode: Implement timezone change detection

Implement optional timezone change detection for local time libc
functions.  This is disabled by default; set WITH_DETECT_TZ_CHANGES
to build it.

Reviewed By: imp
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
X-NetApp-PR: #47
Differential Revision: https://reviews.freebsd.org/D30183

2 years agolibprocstat: extend zfs_defs hack for .pieo
Ed Maste [Sun, 12 Sep 2021 23:04:31 +0000 (19:04 -0400)]
libprocstat: extend zfs_defs hack for .pieo

By default _pie.a archives are built only for INTERNALLIBs, so there is
usually no need for zfs_defs.pieo to exist.  However, some experimental
work builds _pie.a archives for everything.  Extend the existing set of
zfs_defs hacks to build zfs_defs.pieo as well.

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

2 years agoFix data race in scsi cd driver.
Alexander Motin [Mon, 13 Sep 2021 12:59:51 +0000 (08:59 -0400)]
Fix data race in scsi cd driver.

There is a data race between cdsysctlinit and cdcheckmedia.  Both
functions change softc->flags without synchronization.

Submitted by: Arseny Smalyuk <smalukav@gmail.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D31726

2 years agoAdd missing dep patterns for .pieo
Alex Richardson [Mon, 13 Sep 2021 12:22:07 +0000 (13:22 +0100)]
Add missing dep patterns for .pieo

While adding sanitizer support, I noticed that all other extensions were
handled but .pieo was missing.

Reviewed By: emaste, imp
MFC after: 1 week

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

2 years agobsd.lib.mk: add conditions for building _pie.a archives
Ed Maste [Sun, 12 Sep 2021 16:45:50 +0000 (12:45 -0400)]
bsd.lib.mk: add conditions for building _pie.a archives

As with other .a targets, build _pie.a archives only if LIB is set.

At present we build _pie.a only for INTERNALLIBs, and none of them
include bsd.lib.mk without setting LIB.  However, we might want to build
_pie.a for non-INTERNALLIBs in the future.

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

2 years agoRevert "if_mvneta: Build the driver as a kernel module"
Wojciech Macek [Mon, 13 Sep 2021 10:55:15 +0000 (12:55 +0200)]
Revert "if_mvneta: Build the driver as a kernel module"

This reverts commit 41b0190cc404e21cb8b430602eabfedc20107471.

2 years agoif_mvneta: Build the driver as a kernel module
Hubert Mazur [Mon, 13 Sep 2021 09:44:31 +0000 (11:44 +0200)]
if_mvneta: Build the driver as a kernel module

Fix device detach and attach routine. Add required Makefile
to build as a module. Remove entry from GENERIC, since now
it can be loaded automatically.

Tested on EspressoBin.

Obtained from: Semihalf
Reviewed by: manu
Differential revision: https://reviews.freebsd.org/D31581

2 years agoe6000sw: Build the driver as a kernel module
Hubert Mazur [Mon, 13 Sep 2021 09:42:16 +0000 (11:42 +0200)]
e6000sw: Build the driver as a kernel module

Fix detach routine.
Driver was tested on EspressoBin.
Remove it from GENERIC, since now it can be loaded automatically.

Obtained from: Semihalf
Reviewed by: manu
Differential revision: https://reviews.freebsd.org/D31580

2 years agoe6000sw: Use taskqueue subsytem for MDIO polling
Hubert Mazur [Mon, 13 Sep 2021 09:35:51 +0000 (11:35 +0200)]
e6000sw: Use taskqueue subsytem for MDIO polling

Previosuly the link status was pooled in an infinite loop in a separate
kproc. Use taskqueue subsytem instead. This is a prequisite for making
this driver work as a loadable module.

Obtained from: Semihalf
Differential revision: https://reviews.freebsd.org/D31579

2 years agoAdd a test for https://reviews.freebsd.org/D31858 (PR 258310)
Alex Richardson [Mon, 13 Sep 2021 09:16:05 +0000 (10:16 +0100)]
Add a test for https://reviews.freebsd.org/D31858 (PR 258310)

This test (based on https://github.com/jiixyj/epoll-shim/pull/32#issuecomment-891276654)
fails reproducibly on QEMU with KVM and `-smp 2` prior to D31858 (committed
as 98168a6e6c12dab8f608f6b5f5b0b175d2b87ef0) and passes with the patch applied.

Reviewed By: kib, imp
Differential Revision: https://reviews.freebsd.org/D31862

2 years agostress2: Update test to the sysctl 'vfs.lookup_shared' being removed
Peter Holm [Mon, 13 Sep 2021 08:56:06 +0000 (08:56 +0000)]
stress2: Update test to the sysctl 'vfs.lookup_shared' being removed

2 years agostress2: Added missing unmount
Peter Holm [Mon, 13 Sep 2021 08:55:19 +0000 (08:55 +0000)]
stress2: Added missing unmount

2 years agosdhci: add sysctls to dump sdhci registers and capabilites
Bartlomiej Grzesik [Mon, 13 Sep 2021 08:00:25 +0000 (10:00 +0200)]
sdhci: add sysctls to dump sdhci registers and capabilites

Add sysctls dev.sdhci.X.slotY.dumpregs and dev.sdhci.X.slotY.dumpcaps
which dumps sdhci registers or capabilities.

Obtained from: Semihalf
Reviewed by: mw
Differential revision: https://reviews.freebsd.org/D31406

2 years agoMeasure latency of PMC interruptions
Wojciech Macek [Mon, 13 Sep 2021 04:08:32 +0000 (06:08 +0200)]
Measure latency of PMC interruptions

Add HWPMC events to measure latency.
Provide sysctl to choose the number of outstanding events which
trigger HWPMC event.

Obtained from: Semihalf
Sponsored by: Stormshield
Differential revision: https://reviews.freebsd.org/D31283

2 years agosocket: Do not include control messages in FIONREAD return value
Mark Johnston [Sun, 12 Sep 2021 20:05:49 +0000 (16:05 -0400)]
socket: Do not include control messages in FIONREAD return value

Some system software expects to be able to read at least the number of
bytes returned by FIONREAD.  When control messages are counted in this
return value, this assumption is violated.  Follow Linux and OpenBSD
here (as well as our own kevent(EVFILT_READ)) and only return the number
of data bytes available.

Reported by: avg
MFC after: 2 weeks

2 years agobhyve: Fix pci device node key in bhyve_config.5
Ka Ho Ng [Sun, 12 Sep 2021 20:31:19 +0000 (04:31 +0800)]
bhyve: Fix pci device node key in bhyve_config.5

PCI device node key in the manual page is wrong. It should be
pci.bus.slot.function.

MFC after: 3 days

2 years agosctp: avoid LOR
Michael Tuexen [Sun, 12 Sep 2021 19:11:14 +0000 (21:11 +0200)]
sctp: avoid LOR

Don't lock the inp-info lock while holding an stcb lock.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31921

2 years agosctp: minor cleanup, no functional change
Michael Tuexen [Sun, 12 Sep 2021 17:21:15 +0000 (19:21 +0200)]
sctp: minor cleanup, no functional change

MFC after: 1 week

2 years agoUPDATING: Add entry for commit 55089ef4f8bb
Rick Macklem [Sat, 11 Sep 2021 22:44:52 +0000 (15:44 -0700)]
UPDATING: Add entry for commit 55089ef4f8bb

2 years agonfscl: Make vfs.nfs.maxcopyrange larger by default
Rick Macklem [Sat, 11 Sep 2021 22:36:32 +0000 (15:36 -0700)]
nfscl: Make vfs.nfs.maxcopyrange larger by default

As of commit 103b207536f9, the NFSv4.2 server will limit the size
of a Copy operation based upon a 1 second timeout.  The Linux 5.2
kernel server also limits Copy operation size to 4Mbytes.
As such, the NFSv4.2 client can attempt a large Copy without
resulting in a long RPC RTT for these servers.

This patch changes vfs.nfs.maxcopyrange to 64bits and sets
the default to the maximum possible size of SSIZE_MAX, since
a larger size makes the Copy operation more efficient and
allows for copying to complete with fewer RPCs.
The sysctl may be need to be made smaller for other non-FreeBSD
NFSv4.2 servers.

MFC after: 2 weeks

2 years agoAdd EPOCH_TRACE to NOTES to get LINT coverage.
John Baldwin [Sat, 11 Sep 2021 20:05:44 +0000 (13:05 -0700)]
Add EPOCH_TRACE to NOTES to get LINT coverage.

Sponsored by: The FreeBSD Foundation

2 years agolio_test: Specify a mode with O_CREAT
Mark Johnston [Sat, 11 Sep 2021 16:56:07 +0000 (12:56 -0400)]
lio_test: Specify a mode with O_CREAT

Sponsored by: The FreeBSD Foundation

2 years agoaio: Fix up the opcode in aiocb32_copyin()
Mark Johnston [Sat, 11 Sep 2021 16:55:32 +0000 (12:55 -0400)]
aio: Fix up the opcode in aiocb32_copyin()

With lio_listio(2), the opcode is specified by userspace rather than
being hard-coded by the system call (e.g., aio_readv() -> LIO_READV).
kern_lio_listio() calls aio_aqueue() with an opcode of LIO_NOP, which
gets fixed up when the aiocb is copied in.

When copying in a job request for vectored I/O, we need to dynamically
allocate a uio to wrap an iovec.  So aiocb_copyin() needs to get the
opcode from the aiocb and then decide whether an allocation is required.
We failed to do this in the COMPAT_FREEBSD32 case.  Fix it.

Reported by: syzbot+27eab6f2c2162f2885ee@syzkaller.appspotmail.com
Reviewed by: kib, asomers
Fixes: f30a1ae8d529 ("lio_listio(2):  Allow LIO_READV and LIO_WRITEV.")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31914

2 years agosctp: Tighten up locking around sctp_aloc_assoc()
Mark Johnston [Sat, 11 Sep 2021 14:15:21 +0000 (10:15 -0400)]
sctp: Tighten up locking around sctp_aloc_assoc()

All callers of sctp_aloc_assoc() mark the PCB as connected after a
successful call (for one-to-one-style sockets).  In all cases this is
done without the PCB lock, so the PCB's flags can be corrupted.  We also
do not atomically check whether a one-to-one-style socket is a listening
socket, which violates various assumptions in solisten_proto().

We need to hold the PCB lock across all of sctp_aloc_assoc() to fix
this.  In order to do that without introducing lock order reversals, we
have to hold the global info lock as well.

So:
- Convert sctp_aloc_assoc() so that the inp and info locks are
  consistently held.  It returns with the association lock held, as
  before.
- Fix an apparent bug where we failed to remove an association from a
  global hash if sctp_add_remote_addr() fails.
- sctp_select_a_tag() is called when initializing an association, and it
  acquires the global info lock.  To avoid lock recursion, push locking
  into its callers.
- Introduce sctp_aloc_assoc_connected(), which atomically checks for a
  listening socket and sets SCTP_PCB_FLAGS_CONNECTED.

There is still one edge case in sctp_process_cookie_new() where we do
not update PCB/socket state correctly.

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

2 years agoFix spelling of BUILDENV_SHELL
Doug Rabson [Sat, 11 Sep 2021 12:03:52 +0000 (13:03 +0100)]
Fix spelling of BUILDENV_SHELL

2 years agomd: Add MD_MUSTDEALLOC support
Ka Ho Ng [Sat, 11 Sep 2021 12:03:38 +0000 (20:03 +0800)]
md: Add MD_MUSTDEALLOC support

This adds an option to detect if hole-punching is implemented by the
underlying file system.  If this flag is set, and if the underlying file
system does not support hole-punching, md(4) fails BIO_DELETE requests
with EOPNOTSUPP.

Sponsored by: The FreeBSD Foundation
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D31883

2 years agoImport atf 0.22 snapshot 55c21b2c5fb189bbdfccb2b297bfa89236502542
Alan Somers [Fri, 10 Sep 2021 23:08:42 +0000 (17:08 -0600)]
Import atf 0.22 snapshot 55c21b2c5fb189bbdfccb2b297bfa89236502542

The main improvement is the ability to skip a test that is expected to
fail.

2 years agoVendor import of atf commit 55c21b2c5fb189bbdfccb2b297bfa89236502542
Alan Somers [Fri, 10 Sep 2021 22:50:50 +0000 (16:50 -0600)]
Vendor import of atf commit 55c21b2c5fb189bbdfccb2b297bfa89236502542

Updated from https://github.com/freebsd/atf

2 years agocxgbei: Handle errors in PDUs.
John Baldwin [Fri, 10 Sep 2021 22:10:00 +0000 (15:10 -0700)]
cxgbei: Handle errors in PDUs.

When a PDU with an error (bad padding, header digest, or data digest)
is received, log the error via ICL_WARN() and then reset the
connection via the ic_error callback.

While here, add per-rxq counters for errors.

Sponsored by: Chelsio Communications

2 years agopkg: fix regression that breaks bootstrap from not a current directory.
Gleb Smirnoff [Fri, 10 Sep 2021 21:49:17 +0000 (14:49 -0700)]
pkg: fix regression that breaks bootstrap from not a current directory.

Fixes: 40b9f924b18
Reviewed by: kevans

2 years agoaio: Interlock with listen(2)
Mark Johnston [Fri, 10 Sep 2021 21:21:11 +0000 (17:21 -0400)]
aio: Interlock with listen(2)

soo_aio_queue() did not handle the possibility that the provided socket
is a listening socket.  Up until recently, to fix this one would have to
acquire the socket lock first and check, since the socket buffer locks
were destroyed by listen(2).

Now that the socket buffer locks belong to the socket, simply check
SOLISTENING(so) after acquiring them, and make listen(2) return an error
if any AIO jobs are enqueued on the socket.

Add a couple of simple regression test cases.

Note that this fixes things only for the default AIO implementation;
cxgbe(4)'s TCP offload has a separate pru_aio_queue implementation which
requires its own solution.

Reported by: syzbot+c8aa122fa2c6a4e2a28b@syzkaller.appspotmail.com
Reported by: syzbot+39af117d43d4f0faf512@syzkaller.appspotmail.com
Reported by: syzbot+60cceb9569145a0b993b@syzkaller.appspotmail.com
Reported by: syzbot+2d522c5db87710277ca5@syzkaller.appspotmail.com
Reviewed by: tuexen, gallatin, jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31901

2 years agosocket: Add macros to lock socket buffers using socket references
Mark Johnston [Fri, 10 Sep 2021 21:20:39 +0000 (17:20 -0400)]
socket: Add macros to lock socket buffers using socket references

Since commit c67f3b8b78e50c6df7c057d6cf108e4d6b4312d0 the sockbuf
mutexes belong to the containing socket.  Sockbufs contain a pointer to
a mutex, which by default is initialized to the corresponding mutexes in
the socket.  The SOCKBUF_LOCK() etc. macros operate on this pointer.
However, the pointer is clobbered by listen(2) so it's not safe to use
them unless one is sure that the socket is not a listening socket.

This change introduces a new set of macros which lock socket buffers
through the socket.  This is a bit cheaper since it removes the pointer
indirection, and allows one to safely lock socket buffers and then check
for a listening socket.

For MFC, these macros should be reimplemented in terms of the existing
socket buffer layout.

Reviewed by: tuexen, gallatin, jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31900

2 years agomake: fix MAKE_JOB_ERROR_TOKEN
Simon J. Gerraty [Fri, 10 Sep 2021 20:11:28 +0000 (13:11 -0700)]
make: fix MAKE_JOB_ERROR_TOKEN

The rework of GetBooleanVar to GetBooleanExpr requires
we add "${" and ":U}" around the expression so it can be directly
evaluated.

Reported by: mjg
MFC after: 1 week

#
#                                                         72 columns --|
#
# Uncomment and complete these metadata fields, as appropriate:
#
# PR: <If and which Problem Report is related.>
# Reported by: <If someone else reported the issue.>
# Reviewed by: <If someone else reviewed your modification.>
# Approved by: <If you needed approval for this commit.>
# Obtained from: <If the change is from a third party.>
# MFC after: <N [day[s]|week[s]|month[s]].  Request a reminder email>
# MFH: <Ports tree branch name.  Request approval for merge.>
# Relnotes: <Set to 'yes' for mention in release notes.>
# Security: <Vulnerability reference (one per line) or description.>
# Sponsored by: <If the change was sponsored by an organization.>
# Pull Request: <https://github.com/freebsd/<repo>/pull/###>
# Differential Revision: <https://reviews.freebsd.org/D###>
#
# "Pull Request" and "Differential Revision" require the *full* GitHub or
# Phabricator URL.  The commit author should be set appropriately, using
# `git commit --author` if someone besides the committer sent in the change.
#
# Uncomment and complete these metadata fields, as appropriate:
#
# PR:
# Reported by: <If someone else reported the issue.>
# Reviewed by: <If someone else reviewed your modification.>
# Approved by: <If you needed approval for this commit.>
# Obtained from: <If the change is from a third party.>
# MFC after: <N [day[s]|week[s]|month[s]].  Request a reminder email>
# MFH: <Ports tree branch name.  Request approval for merge.>
# Relnotes: <Set to 'yes' for mention in release notes.>
# Security: <Vulnerability reference (one per line) or description.>
# Sponsored by: <If the change was sponsored by an organization.>
# Pull Request: <https://github.com/freebsd/<repo>/pull/###>
# Differential Revision: <https://reviews.freebsd.org/D###>
#
# "Pull Request" and "Differential Revision" require the *full* GitHub or
# Phabricator URL.  The commit author should be set appropriately, using
# `git commit --author` if someone besides the committer sent in the change.
#

2 years agong_l2tp: improve callout locking.
Gleb Smirnoff [Fri, 6 Aug 2021 23:04:31 +0000 (16:04 -0700)]
ng_l2tp: improve callout locking.

Apparently e62e4b85942 wasn't enough to close the race between
a queue being flushed by a packet and callout executing, because
the callouts used without a lock aren't 100% bulletproof. To close
the race use callout_init_mtx() for L2TP timers, and make sure that
all calls to ng_callout()/ng_uncallout() are done under the seq lock.

If used properly, a locked callout can be used transparently with
old netgraph KPI of ng_callout/ng_uncallout which predates locked
callouts.

While here, utilize ng_uncallout_drain() instead of ng_uncallout()
on the node shutdown.

PR: 241133
Reviewed by: mjg, markj
Differential Revision: https://reviews.freebsd.org/D31476

2 years agong_l2tp: improve seq structure locking.
Gleb Smirnoff [Fri, 6 Aug 2021 22:49:51 +0000 (15:49 -0700)]
ng_l2tp: improve seq structure locking.

Cover few cases of access to seq without lock missed in 702f98951d5.
There are no known bugs fixed with this change, however. With INVARIANTS
embed ng_l2tp_seq_check() into lock/unlock macros. Slightly reduce number
of locks/unlocks per packet keeping the lock between functions.

Reviewed by: mjg, markj
Differential Revision: https://reviews.freebsd.org/D31476

2 years agonetgraph: add ng_uncallout_drain().
Gleb Smirnoff [Fri, 6 Aug 2021 20:16:32 +0000 (13:16 -0700)]
netgraph: add ng_uncallout_drain().

Move shared code into ng_uncallout_internal(). While here add a comment
mentioning a problem with scheduled+executing callout.

Reviewed by: mjg, markj
Differential Revision: https://reviews.freebsd.org/D31476

2 years agonetgraph: pass return value from callout_stop() unmodified to callers of
Gleb Smirnoff [Fri, 6 Aug 2021 20:12:13 +0000 (13:12 -0700)]
netgraph: pass return value from callout_stop() unmodified to callers of
ng_uncallout. Most of them do not check it anyway, so very little node
changes are required.

Reviewed by: mjg, markj
Differential Revision: https://reviews.freebsd.org/D31476

2 years agopf: fix NOINET6 builds
Kristof Provost [Fri, 10 Sep 2021 15:20:39 +0000 (17:20 +0200)]
pf: fix NOINET6 builds

MFC after: 1 week
Sponsored by: Modirum MDPay

2 years agopf: qid and pqid can be uint16_t
Kristof Provost [Tue, 7 Sep 2021 12:41:37 +0000 (14:41 +0200)]
pf: qid and pqid can be uint16_t

tag2name() returns a uint16_t, so we don't need to use uint32_t for the
qid (or pqid). This reduces the size of struct pf_kstate slightly. That
in turn buys us space to add extra fields for dummynet later.

Happily these fields are not exposed to user space (there are user space
versions of them, but they can just stay uint32_t), so there's no ABI
breakage in modifying this.

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

2 years agowpi: Fix a lock leak in an error path in wpi_run()
Mark Johnston [Fri, 10 Sep 2021 14:03:51 +0000 (10:03 -0400)]
wpi: Fix a lock leak in an error path in wpi_run()

PR: 258243
Reported by: dinghao.liu@zju.edu.cn
MFC after: 1 week

2 years agonet: Fix memory leaks upon arp_fillheader() failures
orange30 [Wed, 1 Sep 2021 15:37:36 +0000 (23:37 +0800)]
net: Fix memory leaks upon arp_fillheader() failures

Free memory before return from arprequest_internal().  In in_arpinput(),
if arp_fillheader() fails, it should use goto drop.

Reviewed by: melifaro, imp, markj
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/534

2 years agopf tests: synproxy to localhost test
Kristof Provost [Wed, 30 Jun 2021 12:22:27 +0000 (14:22 +0200)]
pf tests: synproxy to localhost test

Test syn-proxying a connection to the local host.

Sponsored by: Modirum MDPay
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31854

2 years agopf: fix synproxy to local
Kristof Provost [Wed, 1 Sep 2021 07:54:55 +0000 (09:54 +0200)]
pf: fix synproxy to local

When we're synproxy-ing a connection that's going to us (as opposed to a
forwarded one) we wound up trying to send out the pf-generated tcp
packets through pf_intr(), which called ip(6)_output(). That doesn't
work all that well for packets that are destined for us, so in that case
we must call ip(6)_input() instead.

MFC after: 1 week
Sponsored by:   Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31853

2 years agoipsec: Validate the protocol identifier in ipsec4_ctlinput()
Mark Johnston [Fri, 10 Sep 2021 13:07:59 +0000 (09:07 -0400)]
ipsec: Validate the protocol identifier in ipsec4_ctlinput()

key_allocsa() expects to handle only IPSec protocols and has an
assertion to this effect.  However, ipsec4_ctlinput() has to handle
messages from ICMP unreachable packets and was not validating the
protocol number.  In practice such a packet would simply fail to match
any SADB entries and would thus be ignored.

Reported by: syzbot+6a9ef6fcfadb9f3877fe@syzkaller.appspotmail.com
Reviewed by: ae
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31890

2 years agonet: Enter a net epoch around protocol if_up/down notifications
Mark Johnston [Fri, 10 Sep 2021 13:07:40 +0000 (09:07 -0400)]
net: Enter a net epoch around protocol if_up/down notifications

When traversing a list of interface addresses, we need to be in a net
epoch section, and protocol ctlinput routines need a stable reference to
the address.

Reported by: syzbot+3219af764ead146a3a4e@syzkaller.appspotmail.com
Reviewed by: kp, melifaro
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31889

2 years agoAdd support for jail.conf.d
Antranig Vartanian [Wed, 8 Sep 2021 07:07:49 +0000 (02:07 -0500)]
Add support for jail.conf.d

Using /etc/jail.{jailname}.conf is nice, however it makes /etc/ very
messy if you have many jails.  This patch allows one to move these
config files out of the way into /etc/jail.conf.d/{jailname}.conf.

Note that the same caveat as /etc/jail.*.conf applies: the jail service
will not autodiscover all of these for starting 'all' jails.  This is
considered future work, since the behavior matches.

Reviewed by: kevans
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D24570

2 years agokern: drop remaining references to removed makesyscalls.sh
Kyle Evans [Thu, 13 May 2021 18:46:17 +0000 (13:46 -0500)]
kern: drop remaining references to removed makesyscalls.sh

This was accidentally omitted from the recent removal of makeyscalls.sh.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D30250

2 years agolibc: Fix build on case-insensitive file systems
Jessica Clarke [Fri, 10 Sep 2021 00:19:38 +0000 (01:19 +0100)]
libc: Fix build on case-insensitive file systems

On case-insensitive file systems (most likely to be seen on macOS, where
it is the default), _Fork.o for the new POSIX _Fork function conflicts
with _fork.o for the PSEUDO file. This results in non-determinsitic
behaviour in terms of which ends up being present; if _Fork.o wins then
the build fails to link libc.so due to missing __sys_fork, and if
_fork.o wins then libc silently fails to include the implementation of
_Fork. A similar issue occurred in the past for C99's _Exit conflicting
with exit(2) and was fixed in cb1cb6a2a83f, so this adds a fix based on
that.

As a longer-term solution it might be better to instead make the
generated files use a different prefix that's less likely to conflict
with other things (such as __sys_foo.o given they always contain that)
but that's a rather more invasive change.

Fixes: 49ad342cc10c ("Add _Fork()")
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31895

2 years agoopenssh: regen config.h
Ed Maste [Thu, 9 Sep 2021 23:04:10 +0000 (19:04 -0400)]
openssh: regen config.h

Fixes: 19261079b743 ("openssh: update to OpenSSH v8.7p1")
Reported by: O. Hartmann
Sponsored by: The FreeBSD Foundation

2 years agox86/tsc.c: Add TSLOG to test_tsc
Colin Percival [Fri, 10 Sep 2021 00:01:00 +0000 (17:01 -0700)]
x86/tsc.c: Add TSLOG to test_tsc

On my benchmark system this takes ~ 14 ms; enough to be worth
recording in the boot time profile.

2 years agotabs: a hacky version of tabs appeared in 1st edition Unix
Warner Losh [Thu, 9 Sep 2021 23:11:18 +0000 (17:11 -0600)]
tabs: a hacky version of tabs appeared in 1st edition Unix

First edition Unix had an /etc/tabs file. It contained the escape
sequences to set tabs to every 8 stops on an old Teletype Model 37 and
compatible terminals. One would 'cat /etc/tabs' to reset them.  Unix at
the time effectively mandated this because the delays in the tty driver
assumed this and tabs didn't work when they were too different from '8'.
Document this historical niggle in HISTORY after it was brought to my
attention on a Hacker News thread.

Sponsored by: Netflix

2 years agoopenssh: Add new source files to libssl
Guido Falsi [Thu, 9 Sep 2021 22:56:24 +0000 (00:56 +0200)]
openssh: Add new source files to libssl

Add some new OpenSSH v8.7p1 source files to the ones being used to
build libssl to avoid missing symbols.

PR:             258384
Fixes: 19261079b743 ("openssh: update to OpenSSH v8.7p1")
Approved by:    kevans (src)

2 years agohkbd(4): Fix build on 32bit platforms
Vladimir Kondratyev [Thu, 9 Sep 2021 22:49:26 +0000 (01:49 +0300)]
hkbd(4): Fix build on 32bit platforms

MFC after: 2 weeks

2 years agohkbd(4): Fix key repeats on multireport keyboards
Vladimir Kondratyev [Thu, 9 Sep 2021 21:40:13 +0000 (00:40 +0300)]
hkbd(4): Fix key repeats on multireport keyboards

Currently hkbd counts all key states to be "Up" at the start of
interrupt callback. That results in generation of "Key Up" event for
each key that has been downed before but is not listed in current
report while is still downed.

Fix that with clearing of temporary key data storage bits only for
keys contained in processed report.

Reported by: Greg V
Obtained from: sysutils/iichid
MFC after: 2 weeks

2 years agohkbd(4): Use bitstring(3) KPI for key bitmaps processing.
Vladimir Kondratyev [Thu, 9 Sep 2021 21:39:46 +0000 (00:39 +0300)]
hkbd(4): Use bitstring(3) KPI for key bitmaps processing.

No functional changes intended.

MFC after: 2 weeks

2 years agohkbd(4): Reduce diff with ukbd(4)
Vladimir Kondratyev [Thu, 9 Sep 2021 21:39:05 +0000 (00:39 +0300)]
hkbd(4): Reduce diff with ukbd(4)

MFC after: 2 weeks

2 years agopsm(4): Disable KVM switch "jitter" clamping for absolute touchpads.
Vladimir Kondratyev [Thu, 9 Sep 2021 21:37:40 +0000 (00:37 +0300)]
psm(4): Disable KVM switch "jitter" clamping for absolute touchpads.

r123442 introduced solution for clamping of PS/2 mice jitter when using
a KVM. Solution is to buffer mouse packets for 0.050ms if mouse activity
has not been seen for more than 0.5 seconds. Then flush that data to driver
if no validation errors found or drop the entire queue otherwise.

While it works well with relative devices it has issues with absolute ones
Depending on history buffering may results in delaying of the touch front
edge for 0.050ms that affects gesture processing (tap detection).

As absolute touchpads usually are built-in devices we can safely disable
bufferization and KVM jitter clamping to avoid such a delays.

MFC after: 2 weeks

2 years agortsx: Call taskqueue sooner, adjust DELAY(9) calls, add an inversion heuristic
Henri Hennebert [Thu, 9 Sep 2021 17:33:51 +0000 (13:33 -0400)]
rtsx: Call taskqueue sooner, adjust DELAY(9) calls, add an inversion heuristic

- Some configurations, e.g. HP EliteBook 840 G3, come with a dummy card
in the card slot which is detected as a valid SD card.  This added long
timeout at boot time.  To alleviate the problem, the default timeout is
reduced to one second during the setup phase. [1]

- Some configurations crash at boot if rtsx(4) is defined in the kernel
config.  At boot time, without a card inserted, the driver found that
a card is present and just after that a "spontaneous" interrupt is
generated showing that no card is present.  To solve this problem,
DELAY(9) is set to one quarter of a second before checking card presence
during driver attach.

- As advised by adrian, taskqueue and DMA are set up sooner during
the driver attach.  A heuristic to try to detect configuration needing
inversion was added.

PR: 255130 [1]
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30499

2 years agosctp: add explicit cast, no functional change intended
Michael Tuexen [Thu, 9 Sep 2021 17:13:47 +0000 (19:13 +0200)]
sctp: add explicit cast, no functional change intended

MFC after: 3 days

2 years agosctp: use appropriate argument when freeing association
Michael Tuexen [Thu, 9 Sep 2021 16:01:35 +0000 (18:01 +0200)]
sctp: use appropriate argument when freeing association

Reported by: syzbot+7fe26e26911344e7211d@syzkaller.appspotmail.com
MFC after: 3 days

2 years agofetch: do not confuse capacity and length
Baptiste Daroussin [Thu, 9 Sep 2021 14:48:21 +0000 (16:48 +0200)]
fetch: do not confuse capacity and length

The patch converting fetch to getline
(ee3ca711a898cf41330c320826ea1e0e6e451f1d),
did confuse the capacity of the line buffer with the actual len of the read
line confusing fetch -v.

2 years agoosd: Fix racy assertions
Mark Johnston [Thu, 9 Sep 2021 13:50:27 +0000 (09:50 -0400)]
osd: Fix racy assertions

osd_register(9) may reallocate and expand the destructor array for a
given object type if no space is available for a new key.  This happens
with the object lock held.  Thus, when verifying that a given slot in
the array is occupied, we need to hold the object lock to avoid racing
with a reallocation.

Reported by: syzbot+69ce54c7d7d813315dd3@syzkaller.appspotmail.com
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoopenssh: remove update notes about upstreamed changes
Ed Maste [Thu, 9 Sep 2021 13:57:22 +0000 (09:57 -0400)]
openssh: remove update notes about upstreamed changes

Two local changes were committed upstream and are present in OpenSSH
8.7p1.  Remove references from FREEBSD-upgrade now that we have updated
to that version.

2 years agosctp: Clear assoc socket references when freeing a PCB
Mark Johnston [Thu, 9 Sep 2021 12:33:26 +0000 (08:33 -0400)]
sctp: Clear assoc socket references when freeing a PCB

This restores behaviour present in the first import of SCTP.  Commit
ceaad40ae729dea2c5d8ffcfdd45bb96fb8969d2 commented this out and commit
62fb761ff28bb184a2543e539dd689fefd5d3246 removed it.  However, once
sctp_inpcb_free() returns, the socket reference is gone no matter what,
so we need to clear it.

Reported by: syzbot+30dd69297fcbc5f0e10a@syzkaller.appspotmail.com
Reported by: syzbot+7b2f9d4bcac1c9569291@syzkaller.appspotmail.com
Reported by: syzbot+ed3e651f7d040af480a6@syzkaller.appspotmail.com
Reviewed by: tuexen
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31886

2 years agoExport _mmap and __sys_mmap from libc.so
Alex Richardson [Thu, 9 Sep 2021 10:46:53 +0000 (11:46 +0100)]
Export _mmap and __sys_mmap from libc.so

Unlike the other syscalls these two symbols were missing from the
version script. I noticed this while looking into the compiler-rt
runtime libraries for CHERI.

Reviewed by: brooks
Obtained from: https://github.com/CTSRD-CHERI/cheribsd/pull/1063
MFC after: 3 days

2 years agostress2: Add a syzkaller reproducer
Peter Holm [Thu, 9 Sep 2021 07:30:47 +0000 (07:30 +0000)]
stress2: Add a syzkaller reproducer

2 years agolualoader: use more concise verbiage for autoboot
Kyle Evans [Wed, 8 Sep 2021 21:34:33 +0000 (16:34 -0500)]
lualoader: use more concise verbiage for autoboot

The behavior remains the same, but lualoader now uses the more concise
verbiage that forthloader used.  This is particularly important because
the previous line would exceed the right boundary of the menu and run
straight into space that would typically be allowed for the logo.

This makes it slightly easier to port logos from forthloader to
lualoader.

2 years agolualoader: allow brands to specify a shift
Kyle Evans [Wed, 8 Sep 2021 21:33:28 +0000 (16:33 -0500)]
lualoader: allow brands to specify a shift

Some brands will want to specify a shift to make sure they're properly
centered; let it happen.

2 years agolualoader: remove shadowed local from graphics:drawitem()
Kyle Evans [Wed, 8 Sep 2021 21:32:53 +0000 (16:32 -0500)]
lualoader: remove shadowed local from graphics:drawitem()

for loop vars are local already and distinct from this earlier
declaration; remove it.

2 years agopkgbase: Move back mlxcontrol in the default package
Emmanuel Vadot [Thu, 9 Sep 2021 06:14:53 +0000 (08:14 +0200)]
pkgbase: Move back mlxcontrol in the default package

mlxcontrol(8) is a tool for mlx(4) raid card and isn't related to
Mellanox card.

Reported by: jhb

2 years agocxgbe/t4_tom: Use stale L2T entry and avoid busy-waiting for resolution.
Navdeep Parhar [Thu, 9 Sep 2021 03:46:42 +0000 (20:46 -0700)]
cxgbe/t4_tom: Use stale L2T entry and avoid busy-waiting for resolution.
MFC after: 1 week
Sponsored by: Chelsio Communications

2 years agonfsd: Fix build after commit 103b207536f9 for 32bit arches
Rick Macklem [Thu, 9 Sep 2021 01:55:06 +0000 (18:55 -0700)]
nfsd: Fix build after commit 103b207536f9 for 32bit arches

MFC after: 2 weeks

2 years agowpa: Address CTRL-EVENT-SCAN-FAILED
Cy Schubert [Thu, 9 Sep 2021 00:20:52 +0000 (17:20 -0700)]
wpa: Address CTRL-EVENT-SCAN-FAILED

5fcdc19a8111 didn't fully resolve the issue. There remains a report
that an ifconfig wlan0 up by itself is insufficient. Ifconfig down
must precede it.

Reported by: Filipe da Silva Santos <contact _ shiori_com_br>
Fixes: 5fcdc19a8111
MFC after: 3 days

2 years agosctp: cleanup timewait handling for vtags
Michael Tuexen [Wed, 8 Sep 2021 23:18:58 +0000 (01:18 +0200)]
sctp: cleanup timewait handling for vtags

MFC after: 1 week

2 years agonfsd: Use the COPY_FILE_RANGE_TIMEO1SEC flag
Rick Macklem [Wed, 8 Sep 2021 21:29:20 +0000 (14:29 -0700)]
nfsd: Use the COPY_FILE_RANGE_TIMEO1SEC flag

Although it is not specified in the RFCs, the concept that
the NFSv4 server should reply to an RPC request within a
reasonable time is accepted practice within the NFSv4 community.

Without this patch, the NFSv4.2 server attempts to reply to
a Copy operation within 1 second by limiting the copy to
vfs.nfs.maxcopyrange bytes (default 10Mbytes). This is crude at
best, given the large variation in I/O subsystem performance.

This patch uses the COPY_FILE_RANGE_TIMEO1SEC flag added by
commit c5128c48df3c to limit the reply time for a Copy
operation to approximately 1 second.

MFC after: 2 weeks

2 years agopath_test: Fix test sorting
Mark Johnston [Wed, 8 Sep 2021 14:59:42 +0000 (10:59 -0400)]
path_test: Fix test sorting

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agopath_test: Fix the unix socket test
Mark Johnston [Wed, 8 Sep 2021 14:57:04 +0000 (10:57 -0400)]
path_test: Fix the unix socket test

The intent was to specify O_PATH to open(2).

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agosctp: Fix a lock order reversal in sctp_swap_inpcb_for_listen()
Mark Johnston [Wed, 8 Sep 2021 03:20:21 +0000 (23:20 -0400)]
sctp: Fix a lock order reversal in sctp_swap_inpcb_for_listen()

When port reuse is enabled in a one-to-one-style socket, sctp_listen()
may call sctp_swap_inpcb_for_listen() to move the PCB out of the "TCP
pool".  In so doing it will drop the PCB lock, yielding an LOR since we
now hold several socket locks.  Reorder sctp_listen() so that it
performs this operation before beginning the conversion to a listening
socket.  Also modify sctp_swap_inpcb_for_listen() to return with PCB
write-locked, since that's what sctp_listen() expects now.

Reviewed by: tuexen
Fixes: bd4a39cc93d9 ("socket: Properly interlock when transitioning to a listening socket")
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31879

2 years agosctp: Fix lock recursion in sctp_swap_inpcb_for_listen()
Mark Johnston [Wed, 8 Sep 2021 03:02:15 +0000 (23:02 -0400)]
sctp: Fix lock recursion in sctp_swap_inpcb_for_listen()

After commit bd4a39cc93d9 we now hold the global inp info lock across
the call to sctp_swap_inpcb_for_listen(), which attempts to acquire it
again.  Since sctp_swap_inpcb_for_listen()'s sole caller is
sctp_listen(), we can simply change it to not try to acquire the lock.

Reported by: syzbot+a76b19ea2f8e1190c451@syzkaller.appspotmail.com
Reported by: syzbot+a1b6cef257ad145b7187@syzkaller.appspotmail.com
Reviewed by: tuexen
Fixes: bd4a39cc93d9 ("socket: Properly interlock when transitioning to a listening socket")
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31878

2 years agodummynet: remove unused definitions
Kristof Provost [Wed, 16 Jun 2021 14:52:25 +0000 (16:52 +0200)]
dummynet: remove unused definitions

No functional change.

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

2 years agonetpfil tests: IPv6 dummynet queue test
Kristof Provost [Thu, 2 Sep 2021 13:40:51 +0000 (15:40 +0200)]
netpfil tests: IPv6 dummynet queue test

Same as the v4 test, but with IPv6.

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

2 years agonetpfil tests: dummynet queue test
Kristof Provost [Thu, 2 Sep 2021 13:38:04 +0000 (15:38 +0200)]
netpfil tests: dummynet queue test

Test prioritisation and dummynet queues.
We need to give the pipe sufficient bandwidth for dummynet to work.
Given that we can't rely on the TCP connection failing alltogether, but
we can measure the effect of dummynet by imposing a time limit on a
larger data transfer.

If TCP is prioritised it'll get most of the pipe bandwidth and easily
manage to transfer the data in 3 seconds or less. When not prioritised
this will not succeed.

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

2 years agodummynet tests: pipe test for IPv6
Kristof Provost [Mon, 14 Jun 2021 19:24:59 +0000 (21:24 +0200)]
dummynet tests: pipe test for IPv6

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

2 years agoipfw: Introduce dnctl
Kristof Provost [Tue, 25 May 2021 14:54:32 +0000 (16:54 +0200)]
ipfw: Introduce dnctl

Introduce a link to the ipfw command, dnctl, for dummynet configuration.
dnctl only handles dummynet configuration, and is part of the effort to
support dummynet in pf.

/sbin/ipfw continues to accept pipe, queue and sched commands, but these can
now also be issued via the new dnctl command.

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

2 years agosctp: minor cleanups, no functional change intended
Michael Tuexen [Wed, 8 Sep 2021 13:13:05 +0000 (15:13 +0200)]
sctp: minor cleanups, no functional change intended

2 years agoloader: implement mount/unmount rootfs
Toomas Soome [Thu, 12 Aug 2021 05:45:52 +0000 (08:45 +0300)]
loader: implement mount/unmount rootfs

We want to keep our root file system open to preserve bcache segment
between file accesses, thus reducing physical disk IO.

Reviewed by: imp, allanjude, kevans (previous version)
Differential Revision: https://reviews.freebsd.org/D30848
MFC after: 1 month

2 years agoi386 loaders: avoid lld 13 garbage collecting linker sets
Dimitry Andric [Wed, 8 Sep 2021 12:04:13 +0000 (14:04 +0200)]
i386 loaders: avoid lld 13 garbage collecting linker sets

Because lld 13 and higher default to garbage collecting start/stop
symbols when using --gc-sections, the linker sets used in the i386 boot
loaders will disappear. This leads to the loaders not recognizing any
commands, and failure to boot.

Until we have a good set of linker scripts for the loaders, work around
it by disabling the start-stop-gc feature.

MFC after: 1 week

2 years agopowerpc64: fix radix on pseries TLB invalidation
Leandro Lupori [Wed, 8 Sep 2021 11:37:11 +0000 (08:37 -0300)]
powerpc64: fix radix on pseries TLB invalidation

When running in a virtualized environment, TLB invalidations can only
be performed on process scope, as only the hypervisor is allowed to
invalidate a global scope, or else a Program Interrupt is triggered.

Since we are here, also make sure that the register process table
hypercall returns success.

Reviewed by: jhibbits
MFC after: 2 weeks
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D31775

2 years agotop(1): indicate how to reset grep string
John Grafton [Tue, 7 Sep 2021 17:39:59 +0000 (13:39 -0400)]
top(1): indicate how to reset grep string

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/536/files

2 years agoopenssh: remove unnecessary $FreeBSD$ tags
Ed Maste [Wed, 8 Sep 2021 01:48:15 +0000 (21:48 -0400)]
openssh: remove unnecessary $FreeBSD$ tags

Diff reduction against upstream: remove $FreeBSD$ tags from files where
the tag itself is the only difference from upstream.

2 years agoDisable acpi_timer_test by default
Colin Percival [Tue, 7 Sep 2021 23:59:45 +0000 (16:59 -0700)]
Disable acpi_timer_test by default

This disables testing the ACPI timer by default, forcing the use of
ACPI-fast rather than ACPI-safe.  The broken-ACPI-timers workaround
can be re-enabled by setting the hw.acpi.timer_test_enabled=1 tunable.

This speeds up the FreeBSD boot process by 140 ms on an EC2 c5.xlarge
instance.

This change will not be MFCed.

Assuming no problems are reported, acpi_timer_test, the associated
tunable, and the ACPI-safe timecounter should be removed in FreeBSD 15.

Relnotes: The ACPI-safe timer is disabled in favour of ACPI-fast;
if timekeeping issues are observed, please test with
hw.acpi.timer_test_enabled=1 in loader.conf and report
if that fixes the problem.

2 years agoHide acpi_timer_test behind a tunable
Colin Percival [Tue, 7 Sep 2021 23:58:18 +0000 (16:58 -0700)]
Hide acpi_timer_test behind a tunable

When hw.acpi.timer_test_enabled is set to 0, this makes acpi_timer_test
return 1 without actually testing the ACPI timer; this results in the
ACPI-fast timecounter always being used rather than potentially using
ACPI-safe.

The ACPI timer testing was introduced in 2002 as a workaround for
errata in Pentium II and Pentium III chipsets, and is unlikely to be
needed in 2021.

While I'm here, add TSENTER/TSEXIT to make it easier to see the time
spent on the test (if it is enabled).

Reviewed by: allanjude, imp
MFC After: 1 week

2 years agoopenssh: update to OpenSSH v8.7p1
Ed Maste [Wed, 8 Sep 2021 01:05:51 +0000 (21:05 -0400)]
openssh: update to OpenSSH v8.7p1

Some notable changes, from upstream's release notes:

- sshd(8): Remove support for obsolete "host/port" syntax.
- ssh(1): When prompting whether to record a new host key, accept the key
  fingerprint as a synonym for "yes".
- ssh-keygen(1): when acting as a CA and signing certificates with an RSA
  key, default to using the rsa-sha2-512 signature algorithm.
- ssh(1), sshd(8), ssh-keygen(1): this release removes the "ssh-rsa"
  (RSA/SHA1) algorithm from those accepted for certificate signatures.
- ssh-sk-helper(8): this is a new binary. It is used by the FIDO/U2F
  support to provide address-space isolation for token middleware
  libraries (including the internal one).
- ssh(1): this release enables UpdateHostkeys by default subject to some
  conservative preconditions.
- scp(1): this release changes the behaviour of remote to remote copies
  (e.g. "scp host-a:/path host-b:") to transfer through the local host
  by default.
- scp(1): experimental support for transfers using the SFTP protocol as
  a replacement for the venerable SCP/RCP protocol that it has
  traditionally used.

Additional integration work is needed to support FIDO/U2F in the base
system.

Deprecation Notice
------------------

OpenSSH will disable the ssh-rsa signature scheme by default in the
next release.

Reviewed by: imp
MFC after: 1 month
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29985

2 years agoVOP_COPY_FILE_RANGE: Add a COPY_FILE_RANGE_TIMEO1SEC flag
Rick Macklem [Wed, 8 Sep 2021 00:35:26 +0000 (17:35 -0700)]
VOP_COPY_FILE_RANGE: Add a COPY_FILE_RANGE_TIMEO1SEC flag

Although it is not specified in the RFCs, the concept that
the NFSv4 server should reply to an RPC request within a
reasonable time is accepted practice within the NFSv4 community.

Without this patch, the NFSv4.2 server attempts to reply to
a Copy operation within 1second by limiting the copy to
vfs.nfs.maxcopyrange bytes (default 10Mbytes). This is crude at
best, given the large variation in I/O subsystem performance.

This patch adds a kernel only flag COPY_FILE_RANGE_TIMEO1SEC
that the NFSv4.2 can specify, which tells VOP_COPY_FILE_RANGE()
to return after approximately 1 second with a partial result and
implements this in vn_generic_copy_file_range(), used by
vop_stdcopyfilerange().

Modifying the NFSv4.2 server to set this flag will be done in
a separate patch.  Also under consideration is exposing the
COPY_FILE_RANGE_TIMEO1SEC to userland for use on the FreeBSD
copy_file_range(2) syscall.

MFC after: 2 weeks
Reviewed by: khng
Differential Revision: https://reviews.freebsd.org/D31829

2 years agocxgbe(4): Fix the decode and display of the DBVFIFO region in meminfo.
Navdeep Parhar [Tue, 7 Sep 2021 23:28:11 +0000 (16:28 -0700)]
cxgbe(4): Fix the decode and display of the DBVFIFO region in meminfo.

MFC after: 1 week
Sponsored by: Chelsio Communications

2 years agocxgbe(4): Display HMA information in meminfo.
Navdeep Parhar [Tue, 7 Sep 2021 20:39:44 +0000 (13:39 -0700)]
cxgbe(4): Display HMA information in meminfo.

This should have been added with initial T6 support many years ago.

MFC after: 1 week
Sponsored by: Chelsio Communications

2 years agorouting: fix source address selection rules for IPv4 over IPv6.
Alexander V. Chernikov [Mon, 6 Sep 2021 22:08:15 +0000 (22:08 +0000)]
routing: fix source address selection rules for IPv4 over IPv6.

Current logic always selects an IFA of the same family from the
 outgoing interfaces. In IPv4 over IPv6 setup there can be just
 single non-127.0.0.1 ifa, attached to the loopback interface.

Create a separate rt_getifa_family() to handle entire ifa selection
 for the IPv4 over IPv6.

Differential Revision: https://reviews.freebsd.org/D31868
MFC after: 1 week

2 years agoBump __FreeBSD_version for the recent socket KPI changes
Mark Johnston [Tue, 7 Sep 2021 21:14:36 +0000 (17:14 -0400)]
Bump __FreeBSD_version for the recent socket KPI changes

Sponsored by: The FreeBSD Foundation

2 years agosocket: Avoid clearing SS_ISCONNECTING if soconnect() fails
Mark Johnston [Tue, 7 Sep 2021 18:51:54 +0000 (14:51 -0400)]
socket: Avoid clearing SS_ISCONNECTING if soconnect() fails

This behaviour appears to date from the 4.4 BSD import.  It has two
problems:

1. The update to so_state is not protected by the socket lock, so
   concurrent updates to so_state may be lost.
2. Suppose two threads race to call connect(2) on a socket, and one
   succeeds while the other fails.  Then the failing thread may
   incorrectly clear SS_ISCONNECTING, confusing the state machine.

Simply remove the update.  It does not appear to be necessary:
pru_connect implementations which call soisconnecting() only do so after
all failure modes have been handled.  For instance, tcp_connect() and
tcp6_connect() will never return an error after calling soisconnected().
However, we cannot correctly assert that SS_ISCONNECTED is not set after
an error from soconnect() since the socket lock is not held across the
pru_connect call, so a concurrent connect(2) may have set the flag.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31699

2 years agosctp: Remove special handling for a listen(2) backlog of 0
Mark Johnston [Tue, 7 Sep 2021 18:51:19 +0000 (14:51 -0400)]
sctp: Remove special handling for a listen(2) backlog of 0

... when applied to one-to-one-style sockets.  sctp_listen() cannot be
used to toggle the listening state of such a socket.  See RFC 6458's
description of expected listen(2) semantics for one-to-one- and
one-to-many-style sockets.

Reviewed by: tuexen
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31774