]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agorelease: fix on-disc pkg binary symbolic links
Glen Barber [Tue, 26 Apr 2022 19:52:40 +0000 (15:52 -0400)]
release: fix on-disc pkg binary symbolic links

PR: 263574
Reported by: loader
MFC after: immediately
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agondaasync: sync to SCSI's daasyncs cam_periph_async() calls
Warner Losh [Tue, 26 Apr 2022 17:01:16 +0000 (11:01 -0600)]
ndaasync: sync to SCSI's daasyncs cam_periph_async() calls

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D35059

2 years agoadaasync: Harmonize with daasync
Warner Losh [Tue, 26 Apr 2022 17:01:06 +0000 (11:01 -0600)]
adaasync: Harmonize with daasync

We should call cam_periph_async() always, like SCSI does. This routine
is supposed to be more of a catch-all.

cam_periph_async() only does actions for AC_LOST_DEVICE. It ignores all
other events (today), but this may not always be true. So this is a nop
change.

Drop in a 'break' so we don't fall through unnecessarily.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D35057

2 years agoRemove dead code.
Dmitry Chagin [Tue, 26 Apr 2022 16:40:59 +0000 (19:40 +0300)]
Remove dead code.

is_physical_memory() dead since 235a54de.

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35056
MFC after: 2 weeks

2 years agolinux(4): Add epoll_pwai2 syscall.
Dmitry Chagin [Tue, 26 Apr 2022 16:35:59 +0000 (19:35 +0300)]
linux(4): Add epoll_pwai2 syscall.

MFC after: 2 weeks

2 years agolinux(4): Regen for epoll_pwait2 syscall.
Dmitry Chagin [Tue, 26 Apr 2022 16:35:58 +0000 (19:35 +0300)]
linux(4): Regen for epoll_pwait2 syscall.

2 years agolinux(4): Change epoll_pwait2 syscall definition to match Linux actual one.
Dmitry Chagin [Tue, 26 Apr 2022 16:35:57 +0000 (19:35 +0300)]
linux(4): Change epoll_pwait2 syscall definition to match Linux actual one.

MFC after: 2 weeks

2 years agolinux(4): Add copyin_sigset() helper.
Dmitry Chagin [Tue, 26 Apr 2022 16:35:57 +0000 (19:35 +0300)]
linux(4): Add copyin_sigset() helper.

MFC after: 2 weeks

2 years agolinux(4): Add linux_epoll_pwait_ts() helper for future use.
Dmitry Chagin [Tue, 26 Apr 2022 16:35:56 +0000 (19:35 +0300)]
linux(4): Add linux_epoll_pwait_ts() helper for future use.

MFC after: 2 weeks

2 years agolinux(4): Copyout pselect timeout.
Dmitry Chagin [Tue, 26 Apr 2022 16:35:56 +0000 (19:35 +0300)]
linux(4): Copyout pselect timeout.

According to pselect6 manual, on error timeout becomes undefined, by fact
Linux modifies the timeout and ignore EFAULT error if so.

MFC after: 2 weeks

2 years agolinux(4): Add a simple rseq syscall implementation.
Dmitry Chagin [Tue, 26 Apr 2022 16:35:56 +0000 (19:35 +0300)]
linux(4): Add a simple rseq syscall implementation.

To avoid annoyng messages from glibc-2.35 test suite add the simple
implementation of rseq syscall which is do nothing for now.

I plan to implement it if and when the API stabilizes.

MFC after: 2 weeks

2 years agolinux(4): Regen for rseq syscall.
Dmitry Chagin [Tue, 26 Apr 2022 16:35:55 +0000 (19:35 +0300)]
linux(4): Regen for rseq syscall.

2 years agolinux(4): Change rseq syscall definition to match Linux actual one.
Dmitry Chagin [Tue, 26 Apr 2022 16:35:54 +0000 (19:35 +0300)]
linux(4): Change rseq syscall definition to match Linux actual one.

MFC after: 2 weeks

2 years agovm_phys: avoid waste in multipage allocation
Doug Moore [Tue, 26 Apr 2022 07:56:23 +0000 (02:56 -0500)]
vm_phys: avoid waste in multipage allocation

In vm_phys_alloc_contig, for an allocation bigger than the size of any
buddy queue free block, avoid examining any maximum-size free block
more than twice, by only starting to consider a sequence of adjacent
max-blocks starting at a max-block that does not follow another
max-block.  If that first max-block follows adjacent blocks of smaller
size, and if together they provide enough memory to reduce by one the
number of max-blocks required for this allocation, use them as part of
this allocation.

Reviewed by: markj
Tested by: pho
Discussed with: alc
Differential Revision: https://reviews.freebsd.org/D34815

2 years agoxen: Use devclass_find to lookup devclasses in identify.
John Baldwin [Mon, 25 Apr 2022 18:55:30 +0000 (11:55 -0700)]
xen: Use devclass_find to lookup devclasses in identify.

While here, use driver->name instead of hardcoding the xenpv and
xen_et strings both for devclass_find() and BUS_ADD_CHILD().

Reviewed by: Elliott Mitchell <ehem+freebsd@m5p.com>, imp, royger
Differential Revision: https://reviews.freebsd.org/D35001

2 years agoada: Eliminate dead code
Warner Losh [Mon, 25 Apr 2022 18:54:37 +0000 (12:54 -0600)]
ada: Eliminate dead code

We never use the cgd that we get from the XPT_GDEV_TYPE call. Prior to
9a6844d55fe33 we used it to determine if READ AHEAD or WRITE CACHING was
supported. However, all that information was moved into adasetflags so
we no longer need to this since it's cached in the softc and updated
with the IDENTIFY data changes automatically.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D35039

2 years agocam: Small reorg of ata xpt async code
Warner Losh [Mon, 25 Apr 2022 18:54:26 +0000 (12:54 -0600)]
cam: Small reorg of ata xpt async code

Use a switch rather than a nested if to simplify the async event
processing code. No functional changes intended.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D35038

2 years agosched_getaffinity(3): more compatibility with Linux
Konstantin Belousov [Sun, 24 Apr 2022 22:10:18 +0000 (01:10 +0300)]
sched_getaffinity(3): more compatibility with Linux

Report EINVAL instead of EDEADLK when impossible cpu mask is set.

Noted by: dchagin
Reviewed by: dchagin (previous version), markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D35045

2 years agoASAN: reduce verbosity
Baptiste Daroussin [Mon, 25 Apr 2022 09:23:23 +0000 (11:23 +0200)]
ASAN: reduce verbosity

When running binaries compiled with libasan in PIE and with ALSR on,
the previous code always print the WARNING message, the new code only
printed it if the run is made with the right verbosity

Before this change, many unit test will always fail because of the extra
message which is printed

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D35055
MFC after: 2 weeks

2 years agolinuxkpi: Mitigate a seqlock livelock
Mark Johnston [Mon, 25 Apr 2022 13:13:03 +0000 (09:13 -0400)]
linuxkpi: Mitigate a seqlock livelock

Disable preemption in seqlock write sections when using the _irqsave
variant.  This ensures that a writer can't be preempted and subsequently
starved by a reader running in a callout handler on the same CPU.

This fixes occasional display hangs seen when using the i915 driver.

Tested by: emaste, wulf
Reviewed by: wulf, hselasky
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35021

2 years agoman3: Add links for some bitstring(3) routines
Mark Johnston [Mon, 25 Apr 2022 13:08:19 +0000 (09:08 -0400)]
man3: Add links for some bitstring(3) routines

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoFix build after 128b9bf9
Dmitry Chagin [Mon, 25 Apr 2022 11:45:05 +0000 (14:45 +0300)]
Fix build after 128b9bf9

MFC after: 2 weeks

2 years agoLinuxKPI: 802.11 ieee80211_sn_sub() fix
Bjoern A. Zeeb [Mon, 25 Apr 2022 11:35:57 +0000 (11:35 +0000)]
LinuxKPI: 802.11 ieee80211_sn_sub() fix

In ieee80211_sn_sub() we need to shift the mask before applying it.
This fixes the logic from 978f25e840fe4975f243e6077a764842f0e9d3eb.

Reported by: J.R. Oldroyd (fbsd opal.com)
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

2 years agoAdd tests for sigwait family syscalls.
Dmitry Chagin [Mon, 25 Apr 2022 10:20:12 +0000 (13:20 +0300)]
Add tests for sigwait family syscalls.

MFC after: 2 weeks

2 years agosigtimedwait: Prevent timeout math overflows.
Dmitry Chagin [Mon, 25 Apr 2022 07:23:15 +0000 (10:23 +0300)]
sigtimedwait: Prevent timeout math overflows.

Our kern_sigtimedwait() calculates absolute sleep timo value as 'uptime+timeout'.
So, when the user specifies a big timeout value (LONG_MAX), the calculated
timo can be less the the current uptime value.
In that case kern_sigtimedwait() returns EAGAIN instead of EINTR, if
unblocked signal was caught.

While here switch to a high-precision sleep method.

Reviewed by: mav, kib
In collaboration with: mav
Differential revision: https://reviews.freebsd.org/D34981
MFC after: 2 weeks

2 years agolinux(4): Refactor signal send methods.
Dmitry Chagin [Mon, 25 Apr 2022 07:22:51 +0000 (10:22 +0300)]
linux(4): Refactor signal send methods.

Created a couple of helpers to send signals to the specific thread or to
the whole process. Use helpers in the corresponding syscalls.
This fixes the confusion where a signal destined for a whole process
was sent to a specific thread and vice versa.
There is an exclusion for the linux_kill() syscall that takes a pid
argument and should send a signal to the whole process, but I know
at least one example where kill() takes tid.

MFC after: 2 weeks

2 years agolinux(4): Check that the thread tid in the thread group pid in linux_tdfind().
Dmitry Chagin [Mon, 25 Apr 2022 07:21:51 +0000 (10:21 +0300)]
linux(4): Check that the thread tid in the thread group pid in linux_tdfind().

MFC after: 2 weeks

2 years agolinux(4): Microoptimize bsd_to_linux_sockaddr().
Dmitry Chagin [Mon, 25 Apr 2022 07:21:20 +0000 (10:21 +0300)]
linux(4): Microoptimize bsd_to_linux_sockaddr().

Differential Revision: https://reviews.freebsd.org/D34725
MFC after: 2 weeks

2 years agoAdd timespecvalid_interval macro and use it.
Dmitry Chagin [Mon, 25 Apr 2022 07:20:54 +0000 (10:20 +0300)]
Add timespecvalid_interval macro and use it.

Reviewed by: jhb, imp (early rev)
Differential revision: https://reviews.freebsd.org/D34848
MFC after: 2 weeks

2 years agoAdd a new RDC phy
Kevin Lo [Mon, 25 Apr 2022 02:00:58 +0000 (10:00 +0800)]
Add a new RDC phy
Reviewed by: jhb
Obtained from: NetBSD via Andrius V
Differential Revision: https://reviews.freebsd.org/D35034

2 years agoRestore original MDC speed control register value after MAC reset, if it
Kevin Lo [Mon, 25 Apr 2022 01:56:20 +0000 (09:56 +0800)]
Restore original MDC speed control register value after MAC reset, if it
wasn't default

Since vte_reset changes register value to MDCSC_DEFAULT value, which may not
be the original value, thus causing some phy registers read failures.
Restoring VTE_MDCSC value to original after reset solves the link state
flapping issue.

Thanks to jhb ("the code looks ok") for his review.
Reviewed by: jhb
Obtained from: NetBSD via Andrius V
Differential Revision: https://reviews.freebsd.org/D34956

2 years agoada/da: Borrow comment from nda about cleanup
Warner Losh [Sun, 24 Apr 2022 21:11:56 +0000 (15:11 -0600)]
ada/da: Borrow comment from nda about cleanup

Remove a XXX comment and replace it with a more accurate comment about
what happens to I/O queued to the hardware.

Sponsored by: Netflix

2 years agoata/nvme: Add comment
Warner Losh [Sun, 24 Apr 2022 21:11:52 +0000 (15:11 -0600)]
ata/nvme: Add comment

Steal the comment from daonninvalidate about the call to disk_gone().

Sponsored by: Netflix

2 years agog_vfs_done: Only report ENXIO once
Warner Losh [Sun, 24 Apr 2022 19:54:29 +0000 (13:54 -0600)]
g_vfs_done: Only report ENXIO once

The contract with the lower layers is that once ENXIO is reported, all
further I/O to the device is not possible. This is reported when the
device departs for good or changes in some material manner out from
underneath the system. Since the lower layers terminate all pending I/O
when this is detected with ENXIO, reporting more than one provides no
extra value. ENXIO suppression done with atomics due to race described
in e8827f4094cb. It's on the error path and a rare event, so this won't affect
performance.

Sponsored by: Netflix
Reviewed by: mckusick, kib
Differential Revision: https://reviews.freebsd.org/D35034

2 years agog_vfs_done: Report when we switch on ENXIO conversion
Warner Losh [Sun, 24 Apr 2022 19:54:20 +0000 (13:54 -0600)]
g_vfs_done: Report when we switch on ENXIO conversion

On the 0 -> 1 transition of sc_enxio_active, report that we're doing
this. This is a rare, but interesting, event. Convert to using atomics
to set this field to prevent a rare race:

    In CAM, when we invalidate a device, one thread (T1) will start the
    process in error processing called from *dadone
    (cam_periph_error). This routine will queue work to xpt_async_td
    (T2) and indicate to *dadone to call biodone(ENXIO) for the bio. T2
    wakes up and basically waits to acquire the periph lock. T2 will do
    so when T1 drops the periph lock just before T1's call to
    biodone. T2 acquires the lock and calls biodone(ENXIO) on all
    pending bios. These two threads will race and we could lose the
    printf or get two in rare cases. Since we only touch sc_enxio_active
    in an error path that's infrequent, the extra atomic traffic will be
    rare but will ensure robustness.

Sponsored by: Netflix
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D35037

2 years agogeom_vfs: make sc_orphaned a bool
Warner Losh [Sun, 24 Apr 2022 19:54:15 +0000 (13:54 -0600)]
geom_vfs: make sc_orphaned a bool

Differential Revision: https://reviews.freebsd.org/D35036
Sponsored by: Netflix

2 years agobio: Add the speedup flags to PRINT_BIO_FLAGS
Warner Losh [Sun, 24 Apr 2022 19:54:10 +0000 (13:54 -0600)]
bio: Add the speedup flags to PRINT_BIO_FLAGS

The BIO_SPEEDUP_WRITE and BIO_SPEEDUP_TRIM bits are part of the flags
word, so print them as such.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35035

2 years agovnode_pager_purge_range.9: "content" is an uncountable noun
Ka Ho Ng [Sun, 24 Apr 2022 16:57:16 +0000 (12:57 -0400)]
vnode_pager_purge_range.9: "content" is an uncountable noun

2 years agobase64: ignore -i as promised
Piotr Pawel Stefaniak [Thu, 21 Apr 2022 16:54:36 +0000 (18:54 +0200)]
base64: ignore -i as promised

2 years agoAdd a quoted-printable encoder/decoder
Piotr Pawel Stefaniak [Fri, 15 Apr 2022 13:25:30 +0000 (15:25 +0200)]
Add a quoted-printable encoder/decoder

As an example:
printf 'We don=27t know what to do with other=20worlds.=0D=0A' \
| bintrans qp -u

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

Reviewed by: debdrup (manpage)

2 years agobintrans: adjust mmencode.c to style(9)
Piotr Pawel Stefaniak [Fri, 15 Apr 2022 13:00:36 +0000 (15:00 +0200)]
bintrans: adjust mmencode.c to style(9)

2 years agobintrans: make mmencode.c compilable
Piotr Pawel Stefaniak [Fri, 15 Apr 2022 12:26:31 +0000 (14:26 +0200)]
bintrans: make mmencode.c compilable

Also remove MSDOS code, base64 code and commented out code.

2 years agobintrans: import mmencode.c for quoted-printable en/de-coding
Piotr Pawel Stefaniak [Fri, 15 Apr 2022 12:08:05 +0000 (14:08 +0200)]
bintrans: import mmencode.c for quoted-printable en/de-coding

This is a preliminary commit in preparation for exposing
a quoted-printable encoder and decoder through the new command bintrans.

2 years agonda: Fix comment
Warner Losh [Sat, 23 Apr 2022 23:08:39 +0000 (17:08 -0600)]
nda: Fix comment

Fix a comment that was left over from the orignial
implementation. Explain how pending transactions in hardware are
completed/aborted in the SIM prior to ndacleanup being called.

Sponsored by: Netflix

2 years agoCAM: Replicate e0ceec676dc8 from da to ada and nda.
Alexander Motin [Sun, 24 Apr 2022 00:14:10 +0000 (20:14 -0400)]
CAM: Replicate e0ceec676dc8 from da to ada and nda.

MFC after: 1 week

2 years agossh: use upstream SSH_OPENSSL_VERSION macro
Ed Maste [Sat, 23 Apr 2022 19:52:03 +0000 (15:52 -0400)]
ssh: use upstream SSH_OPENSSL_VERSION macro

With the upgrade to OpenSSH 6.7p1 in commit a0ee8cc636cd we replaced
WITH_OPENSSL ifdefs with an OPENSSL_VERSION macro, later changing it
to OPENSSL_VERSION_STRING.

A few years later OpenSSH made an equivalent change (with a different
macro name), in commit 4d94b031ff88.  Switch to the macro name they
chose.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoUpdate dirdeps.mk
Simon J. Gerraty [Sat, 23 Apr 2022 21:44:17 +0000 (14:44 -0700)]
Update dirdeps.mk

Latest dirdeps.mk is far more efficient when generating
DIRDEPS_CACHE.

Update dirdeps-options.mk to allow DEP_RELDIR to factor
into option processing. This is not very interesting if all
options are global.

2 years agossh: drop $FreeBSD$ from crypto/openssh
Ed Maste [Fri, 22 Apr 2022 23:05:44 +0000 (19:05 -0400)]
ssh: drop $FreeBSD$ from crypto/openssh

After we moved to git $FreeBSD$ is no longer expanded and serves no
purpose.  Remove them from OpenSSH to reduce diffs against upstream.

Sponsored by: The FreeBSD Foundation

2 years agoKTLS: Add a new recrypt operation to the software backend.
John Baldwin [Fri, 22 Apr 2022 22:52:50 +0000 (15:52 -0700)]
KTLS: Add a new recrypt operation to the software backend.

When using NIC TLS RX, packets that are dropped and retransmitted are
not decrypted by the NIC but are passed along as-is.  As a result, a
received TLS record might contain a mix of encrypted and decrypted
data.  If this occurs, the already-decrypted data needs to be
re-encrypted so that the resulting record can then be decrypted
normally.

Add support for this for sessions using AES-GCM with TLS 1.2 or TLS
1.3.  For the recrypt operation, allocate a temporary buffer and
encrypt the the payload portion of the TLS record with AES-CTR with an
initial IV constructed from the AES-GCM nonce.  Then fixup the
original mbuf chain by copying the results from the temporary buffer
back into the original mbufs for any mbufs containing decrypted data.

Once it has been recrypted, the mbuf chain can then be decrypted via
the normal software decryption path.

Co-authored by: Hans Petter Selasky <hselasky@FreeBSD.org>
Reviewed by: hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35012

2 years agoKTLS: Construct IV directly in crp.crp_iv for TLS 1.3 AEAD encryption.
John Baldwin [Fri, 22 Apr 2022 22:52:27 +0000 (15:52 -0700)]
KTLS: Construct IV directly in crp.crp_iv for TLS 1.3 AEAD encryption.

Previously this used a temporary nonce[] buffer.  The decrypt hook for
TLS 1.3 as well as the hooks for TLS 1.2 already constructed the IV
directly in crp.crp_iv.

Reviewed by: hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35027

2 years agoKTLS: Move OCF function pointers out of ktls_session.
John Baldwin [Fri, 22 Apr 2022 22:52:12 +0000 (15:52 -0700)]
KTLS: Move OCF function pointers out of ktls_session.

Instead, create a switch structure private to ktls_ocf.c and store a
pointer to the switch in the ocf_session.  This will permit adding an
additional function pointer needed for NIC TLS RX without further
bloating ktls_session.

Reviewed by: hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35011

2 years agoamd64 NOTES: Add entries for qlxgb, glxgbe, and glxge.
John Baldwin [Fri, 22 Apr 2022 22:18:06 +0000 (15:18 -0700)]
amd64 NOTES: Add entries for qlxgb, glxgbe, and glxge.

2 years agoamd64 NOTES: Sort the axp entry.
John Baldwin [Fri, 22 Apr 2022 22:18:06 +0000 (15:18 -0700)]
amd64 NOTES: Sort the axp entry.

2 years agoqlxgb/qlxgbe/qlxge: Fix build without INET and/or without INET6.
John Baldwin [Fri, 22 Apr 2022 22:18:05 +0000 (15:18 -0700)]
qlxgb/qlxgbe/qlxge: Fix build without INET and/or without INET6.

This is in preparation for adding these drivers to amd64 NOTES.

2 years agoiwm: plug set-but-not-used vars
Mateusz Guzik [Fri, 22 Apr 2022 22:16:25 +0000 (22:16 +0000)]
iwm: plug set-but-not-used vars

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoMerge bmake-20220418
Simon J. Gerraty [Fri, 22 Apr 2022 20:40:29 +0000 (13:40 -0700)]
Merge bmake-20220418

        o ignore '.POSIX:' if not in first non-comment line
        of Makefile as specified by POSIX.
        add unit-tests for above.

Merge commit '92bfae0e6bd53a7a0d6fe55e70a916d86cf26e8b'

2 years agoAdd -m to post.sh
Simon J. Gerraty [Fri, 22 Apr 2022 20:38:42 +0000 (13:38 -0700)]
Add -m to post.sh

2 years agoImport bmake-20220418
Simon J. Gerraty [Fri, 22 Apr 2022 20:34:55 +0000 (13:34 -0700)]
Import bmake-20220418

Most relevant change:

o ignore '.POSIX:' if not in first non-comment line
of Makefile as specified by POSIX.
add unit-tests for above.

2 years agoBump __FreeBSD_version for udp_tun_func_t() prototype change
Kristof Provost [Fri, 22 Apr 2022 18:04:38 +0000 (20:04 +0200)]
Bump __FreeBSD_version for udp_tun_func_t() prototype change

742e7210d0 changed the prototype of udp_tun_func_t(). Bump
__FreeBSD_version so that external modules can #ifdef for it as
required.

PR: 263297
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopf: Add per-rule timestamps for rule and eth_rule
Reid Linnemann [Fri, 22 Apr 2022 11:54:51 +0000 (13:54 +0200)]
pf: Add per-rule timestamps for rule and eth_rule

Similar to ipfw rule timestamps, these timestamps internally are
uint32_t snaps of the system time in seconds. The timestamp is CPU local
and updated each time a rule or a state associated with a rule or state
is matched.

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34970

2 years agolibexec/rc.d/hostapd: Down/up interface when interface is specified
Cy Schubert [Fri, 22 Apr 2022 16:03:08 +0000 (09:03 -0700)]
libexec/rc.d/hostapd: Down/up interface when interface is specified

When no interface is specified results in a syntax error in the rc
script. Only execute poststart when an interface has been specified.

PR: 263358
Submitted by: markj
Reported by: Joshua Kinard <freebsd@kumba.dev>
Fixes: 0da2c91e64528d896f69d36670e25b4b4a140579
MFC after: 3 days

2 years agoudp6: allow udp_tun_func_t() to indicate it did not eat the packet
Kristof Provost [Fri, 22 Apr 2022 14:11:31 +0000 (16:11 +0200)]
udp6: allow udp_tun_func_t() to indicate it did not eat the packet

Implement the same filter feature we implemented for UDP over IPv6 in
742e7210d. This was missed in that commit.

Pointed out by: markj
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopci: recognize "non-essential instrumentation" devices
John F. Carr [Fri, 22 Apr 2022 14:28:34 +0000 (16:28 +0200)]
pci: recognize "non-essential instrumentation" devices

Some AMD EPYC VCPUs generated boot message of the type:

     pci4: <unknown> at device 0.0 (no driver attached)

These are displayed for device class 0x13 devices, e.g.:

none8@pci0:130:0:0: class=0x130000 rev=0x00 hdr=0x00 vendor=0x1022 \
device=0x148a subvendor=0x1022 subdevice=0x148a
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Starship/Matisse PCIe Dummy Function'
    class      = non-essential instrumentation

Since these devices serve no purpose (no driver attaches) I have
enabled the reporting of suich devices only for verbose boots (a
diversion from the patch provided in the PR).

A verbose boot will now display such devices as:

  pci4: <non-essential instrumentation> at device 0.0 (no driver attached)

PR: 263469
Reported by: jfc@mit.edu (John F. Carr)
MFC after: 1 week

2 years agofreebsd-update.8: Note availability of updates for ALPHA, BETA, and RC
Mateusz Piotrowski [Fri, 22 Apr 2022 12:28:04 +0000 (14:28 +0200)]
freebsd-update.8: Note availability of updates for ALPHA, BETA, and RC

While here, restructure the section about the binary updates
availability.

MFC after: 1 week

2 years agofreebsd-update.8: Add --currently-running to synopsis
Mateusz Piotrowski [Thu, 21 Apr 2022 14:31:51 +0000 (16:31 +0200)]
freebsd-update.8: Add --currently-running to synopsis

While here, sort flags in synopsis.

MFC after: 3 days

2 years agoAdd nullfs specific nocache option.
Alexander Leidinger [Fri, 22 Apr 2022 08:22:26 +0000 (10:22 +0200)]
Add nullfs specific nocache option.

2 years agonet80211: Fix traffic hang on STA/AP VAPs on a multi-VAP interface
Adrian Chadd [Tue, 12 Apr 2022 20:20:28 +0000 (13:20 -0700)]
net80211: Fix traffic hang on STA/AP VAPs on a multi-VAP interface

This took an embarrasingly long time to find.

The state changes for a radio with a STA /and/ AP VAP gets a bit messy.
The AP maps are marked as waiting, waiting for the STA AP to find a
channel to use before the AP VAPs become active.

However, the code path that clears the OACTIVE flag on a VAP only runs
during a successful run of ieee80211_newstate_cb().

So here is how it goes:

* the STA VAP goes down and needs to scan;
* the AP vap goes RUN->INIT; but it doesn't YET call ieee80211_newstate_cb();
* meanwhile - a send on the AP VAP causes the VAP to set the OACTIVE flag here;
* then the STA VAP finishes scan and goes to RUN;
* which will call wakeupwaiting() as part of the STA VAP transition to RUN;
* .. then the AP VAP goes INIT->RUN directly via a call to hostap_newstate
  in wakeupwaiting rather than it being through the deferred path;
* /then/ the ieee80211_newstate_cb() is called, but it sees the state go
  RUN->RUN;
* .. which results in the OACTIVE flag never being cleared.

This clears the OACTIVE flag when a VAP transitions RUN->RUN; the
driver layer or net80211 layer can set it if required in a subsequent
transmit.

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

Reviewed by: bz

2 years agostress2: Added a syzkaller reproducer
Peter Holm [Fri, 22 Apr 2022 04:20:14 +0000 (06:20 +0200)]
stress2: Added a syzkaller reproducer

2 years agopowerpc: add GENERIC64LE-NODEBUG config and improve GENERIC64-NODEBUG
Piotr Kubaj [Thu, 21 Apr 2022 23:04:36 +0000 (01:04 +0200)]
powerpc: add GENERIC64LE-NODEBUG config and improve GENERIC64-NODEBUG

Also remove whitespace from GENERIC-NODEBUG.

Approved by: jhibbits (src)
Differential review: https://reviews.freebsd.org/D34785

2 years agoqlxge: Inline the one use of a variable only used in a debug trace.
John Baldwin [Thu, 21 Apr 2022 21:01:02 +0000 (14:01 -0700)]
qlxge: Inline the one use of a variable only used in a debug trace.

The other QL_DPRINT*() invocations in qls_init_hw_if() all used the
expanded form instead of the local variable.  The module build always
defines QL_DBG in CFLAGS so doesn't trip over this, but adding qlxge
to a kernel config builds without QL_DBG.

Reported by: olivier

2 years agopsm: Swap the unit member in the softc for a device_t.
John Baldwin [Thu, 21 Apr 2022 20:52:48 +0000 (13:52 -0700)]
psm: Swap the unit member in the softc for a device_t.

This entails various changes to make this driver more "modern"
(new-bus vs pre-new-bus) using device_log() and device_printf() rather
than psm%d.  It also fixes the device_busy/unbusy calls to use sc->dev
directly rather than looking the device_t up via the devclass and
unit.

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

2 years agoKTLS: Free the MAC session when destroying AES-CBC software sessions.
John Baldwin [Thu, 21 Apr 2022 20:49:40 +0000 (13:49 -0700)]
KTLS: Free the MAC session when destroying AES-CBC software sessions.

Reviewed by: hselasky
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35013

2 years agostand: zfs: handle holes at the tail end correctly
Kyle Evans [Thu, 21 Apr 2022 19:57:24 +0000 (14:57 -0500)]
stand: zfs: handle holes at the tail end correctly

This mirrors dmu_read_impl(), zeroing out the tail end of the buffer and
clipping the read to what's contained by the block that exists.

This fixes an issue that arose during the 13.1 release process; in
13.1-RC1 and later, setting up GELI+ZFS will result in a failure to
boot.  The culprit is this, which causes us to fail to load geom_eli.ko
as there's a residual portion after the single datablk that should be
zeroed out.

PR: 263407
Reviewed by: tsoome
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D35019

2 years agobusdma_bounce: Batch bounce page free operations when possible.
John Baldwin [Thu, 21 Apr 2022 19:01:55 +0000 (12:01 -0700)]
busdma_bounce: Batch bounce page free operations when possible.

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

2 years agobusdma_bounce: Add free_bounce_pages helper function.
John Baldwin [Thu, 21 Apr 2022 17:42:14 +0000 (10:42 -0700)]
busdma_bounce: Add free_bounce_pages helper function.

Deduplicate code to iterate over the bpages list in a bus_dmamap_t
freeing bounce pages during bus_dmamap_unload.

Reviewed by: imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34967

2 years agobusdma_bounce: Make the map waiting list per-bounce-zone.
John Baldwin [Thu, 21 Apr 2022 17:41:09 +0000 (10:41 -0700)]
busdma_bounce: Make the map waiting list per-bounce-zone.

When pages are freed to a bounce zone, only maps waiting for pages for
that zone can make forward progress.  If a map for a different bounce
zone is at the head of the global list, then requests that could
otherwise make forward progress will be stalled waiting on the other
bounce zone.  If bounce zones shared bounce pages then a global list
would still make sense to prevent "later" requests from starving an
earlier request but that is not a concern with per-zone bounce page
pools.

Reviewed by: imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34966

2 years agobusdma_bounce: Use a simple kproc to invoke deferred requests.
John Baldwin [Thu, 21 Apr 2022 17:40:35 +0000 (10:40 -0700)]
busdma_bounce: Use a simple kproc to invoke deferred requests.

Rather than using a software interrupt with a single handler, just
create a dedicated kernel process woken up with a simple wakeup().

Reviewed by: imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34965

2 years agoRun softclock threads at a hardware ithread priority.
John Baldwin [Thu, 21 Apr 2022 17:40:01 +0000 (10:40 -0700)]
Run softclock threads at a hardware ithread priority.

Add a new PI_SOFTCLOCK for use by softclock threads.  Currently this
maps to PI_AV which is the second-highest ithread priority.

Reviewed by: mav, kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D33693

2 years agoacpi_toshiba: Use device_get_softc in attach.
John Baldwin [Thu, 21 Apr 2022 17:29:15 +0000 (10:29 -0700)]
acpi_toshiba: Use device_get_softc in attach.

Rather than a detour via the devclass and hardcoding unit 0.

While here, remove a check for sc being NULL.  It will never be NULL
when attach is called.

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

2 years agovgapm: Use devclass_find to lookup the vga devclass in suspend and resume.
John Baldwin [Thu, 21 Apr 2022 17:29:15 +0000 (10:29 -0700)]
vgapm: Use devclass_find to lookup the vga devclass in suspend and resume.

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

2 years agoFB_INSTALL_CDEV: Remove this option and related code.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
FB_INSTALL_CDEV: Remove this option and related code.

This option was never enabled in GENERIC and does not appear to work
(the cdevsw is stored in a global array but never passed to make_dev
to be associated with a character device).

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

2 years agosc: Use devclass_find to lookup the sc devclass.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
sc: Use devclass_find to lookup the sc devclass.

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

2 years agoarcmsr: Remove never-true NULL check from cdev callbacks.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
arcmsr: Remove never-true NULL check from cdev callbacks.

si_drv1 will always hold a non-NULL pointer.

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

2 years agoarcmsr: Store softc pointer in si_drv1 of cdev.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
arcmsr: Store softc pointer in si_drv1 of cdev.

Rather than fetching the softc using the controller's unit number as
an index into the devclass.

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

2 years agoccp: Use devclass_find to lookup devclass in db_show_ccp.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
ccp: Use devclass_find to lookup devclass in db_show_ccp.

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

2 years agocpufreq_curr_sysctl: Use devclass_find to lookup cpufreq devclass.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
cpufreq_curr_sysctl: Use devclass_find to lookup cpufreq devclass.

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

2 years agohidbus: Use devclass_find to lookup the devclass for hidbus.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
hidbus: Use devclass_find to lookup the devclass for hidbus.

Reviewed by: wulf, imp
Differential Revision: https://reviews.freebsd.org/D35000

2 years agotwe: Use devclass_find in twe_report debug function.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
twe: Use devclass_find in twe_report debug function.

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

2 years agopcm: Initialize pcm_devclass in sound_modevent.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
pcm: Initialize pcm_devclass in sound_modevent.

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

2 years agopcm: Remove dead code from sound_modevent.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
pcm: Remove dead code from sound_modevent.

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

2 years agosmbios/vpd: Use devclass_find to lookup devclass in module event handler.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
smbios/vpd: Use devclass_find to lookup devclass in module event handler.

While here, use a modern function declaration for smbios_modevent and
vpd_modevent.

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

2 years agonvme: Use devclass_find to lookup the nvme devclass.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
nvme: Use devclass_find to lookup the nvme devclass.

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

2 years agomlx: Use devclass_find to lookup the devclass for mlxd.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
mlx: Use devclass_find to lookup the devclass for mlxd.

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

2 years agohptiop: Store softc pointer in si_drv1 of cdev.
John Baldwin [Thu, 21 Apr 2022 17:29:13 +0000 (10:29 -0700)]
hptiop: Store softc pointer in si_drv1 of cdev.

Rather than fetching the softc using the controller's unit number as
an index into the devclass.

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

2 years agoacpi_tz: Lookup devclass by name when needed.
John Baldwin [Thu, 21 Apr 2022 17:29:13 +0000 (10:29 -0700)]
acpi_tz: Lookup devclass by name when needed.

Cache the value in a local variable in the worker thread.

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

2 years agoacpi_isab: Check the unit in probe instead of using the devclass.
John Baldwin [Thu, 21 Apr 2022 17:29:13 +0000 (10:29 -0700)]
acpi_isab: Check the unit in probe instead of using the devclass.

This is an alternate way to only attach to isab0 for the reasons
described in commit 852989bdbf62932455d48342d9d45dfbab4e65dc.

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

2 years agoacpi_hpet: Use devclass_find to find devclass in identify.
John Baldwin [Thu, 21 Apr 2022 17:29:13 +0000 (10:29 -0700)]
acpi_hpet: Use devclass_find to find devclass in identify.

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

2 years agoacpi_ec: Use device_get_devclass to find devclass in probe.
John Baldwin [Thu, 21 Apr 2022 17:29:13 +0000 (10:29 -0700)]
acpi_ec: Use device_get_devclass to find devclass in probe.

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

2 years agoacpi_cpu: Use device_get_devclass to find devclass in attach.
John Baldwin [Thu, 21 Apr 2022 17:29:13 +0000 (10:29 -0700)]
acpi_cpu: Use device_get_devclass to find devclass in attach.

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

2 years agoacpi_apei: Use devclass_find to find devclass in identify.
John Baldwin [Thu, 21 Apr 2022 17:29:13 +0000 (10:29 -0700)]
acpi_apei: Use devclass_find to find devclass in identify.

Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D34987