Commit Graph

274805 Commits

Author SHA1 Message Date
Dmitry Chagin
6201a50d0d 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
2022-04-25 10:22:51 +03:00
Dmitry Chagin
fe894a3705 linux(4): Check that the thread tid in the thread group pid in linux_tdfind().
MFC after:		2 weeks
2022-04-25 10:21:51 +03:00
Dmitry Chagin
bbddd5881d linux(4): Microoptimize bsd_to_linux_sockaddr().
Differential Revision:	https://reviews.freebsd.org/D34725
MFC after:		2 weeks
2022-04-25 10:21:20 +03:00
Dmitry Chagin
91e7bdcdcf Add timespecvalid_interval macro and use it.
Reviewed by:		jhb, imp (early rev)
Differential revision:	https://reviews.freebsd.org/D34848
MFC after:		2 weeks
2022-04-25 10:20:54 +03:00
Kevin Lo
5586515ab1 Add a new RDC phy
Reviewed by:	jhb
Obtained from:	NetBSD via Andrius V
Differential Revision:	https://reviews.freebsd.org/D35034
2022-04-25 10:00:58 +08:00
Kevin Lo
8f216d282c 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
2022-04-25 09:56:20 +08:00
Warner Losh
b43cfe7171 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
2022-04-24 15:11:56 -06:00
Warner Losh
48ae3f4f64 ata/nvme: Add comment
Steal the comment from daonninvalidate about the call to disk_gone().

Sponsored by:		Netflix
2022-04-24 15:11:52 -06:00
Warner Losh
347a8e93fe 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 e8827f4094. 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
2022-04-24 14:01:33 -06:00
Warner Losh
e8827f4094 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
2022-04-24 14:01:08 -06:00
Warner Losh
f58385f3da geom_vfs: make sc_orphaned a bool
Differential Revision:	https://reviews.freebsd.org/D35036
Sponsored by:		Netflix
2022-04-24 14:01:08 -06:00
Warner Losh
965e919506 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
2022-04-24 14:01:08 -06:00
Ka Ho Ng
fb7288456a vnode_pager_purge_range.9: "content" is an uncountable noun 2022-04-24 12:58:14 -04:00
Piotr Pawel Stefaniak
ed016aa435 base64: ignore -i as promised 2022-04-24 08:23:27 +02:00
Piotr Pawel Stefaniak
aad4fd5495 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)
2022-04-24 08:20:27 +02:00
Piotr Pawel Stefaniak
ff2b1ffbb0 bintrans: adjust mmencode.c to style(9) 2022-04-24 08:19:49 +02:00
Piotr Pawel Stefaniak
9d68da4ee8 bintrans: make mmencode.c compilable
Also remove MSDOS code, base64 code and commented out code.
2022-04-24 08:19:48 +02:00
Piotr Pawel Stefaniak
8a65b02dac 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.
2022-04-24 08:19:48 +02:00
Warner Losh
c08ceddbf7 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
2022-04-23 20:31:46 -06:00
Alexander Motin
38f8addaab CAM: Replicate e0ceec676d from da to ada and nda.
MFC after:	1 week
2022-04-23 20:15:17 -04:00
Ed Maste
6e24fe6128 ssh: use upstream SSH_OPENSSL_VERSION macro
With the upgrade to OpenSSH 6.7p1 in commit a0ee8cc636 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
2022-04-23 20:07:57 -04:00
Simon J. Gerraty
525d1e204b 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.
2022-04-23 14:44:17 -07:00
Ed Maste
835ee05f3c 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
2022-04-22 19:12:23 -04:00
John Baldwin
a8280123e4 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
2022-04-22 15:52:50 -07:00
John Baldwin
663ae8f7f9 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
2022-04-22 15:52:27 -07:00
John Baldwin
a4c5d490f6 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
2022-04-22 15:52:12 -07:00
John Baldwin
f2d166d532 amd64 NOTES: Add entries for qlxgb, glxgbe, and glxge. 2022-04-22 15:18:06 -07:00
John Baldwin
5bf623bbcd amd64 NOTES: Sort the axp entry. 2022-04-22 15:18:06 -07:00
John Baldwin
618aa8cd0a qlxgb/qlxgbe/qlxge: Fix build without INET and/or without INET6.
This is in preparation for adding these drivers to amd64 NOTES.
2022-04-22 15:18:05 -07:00
Mateusz Guzik
f7daf71038 iwm: plug set-but-not-used vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-22 22:16:25 +00:00
Simon J. Gerraty
2f2a5ecdf8 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'
2022-04-22 13:42:11 -07:00
Simon J. Gerraty
92bfae0e6b Add -m to post.sh 2022-04-22 13:38:42 -07:00
Simon J. Gerraty
2061c94e6f 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.
2022-04-22 13:34:55 -07:00
Kristof Provost
e68b35e408 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")
2022-04-22 20:04:38 +02:00
Reid Linnemann
0abcc1d2d3 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
2022-04-22 19:53:20 +02:00
Cy Schubert
1452bfcd9b 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:		0da2c91e64
MFC after:	3 days
2022-04-22 09:15:49 -07:00
Kristof Provost
797b94504f 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")
2022-04-22 16:55:23 +02:00
John F. Carr
f010b9c2b9 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
2022-04-22 16:39:23 +02:00
Mateusz Piotrowski
460ad988a9 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
2022-04-22 14:37:14 +02:00
Mateusz Piotrowski
f69f064483 freebsd-update.8: Add --currently-running to synopsis
While here, sort flags in synopsis.

MFC after:	3 days
2022-04-22 13:57:11 +02:00
Alexander Leidinger
b75644771a Add nullfs specific nocache option. 2022-04-22 10:22:26 +02:00
Adrian Chadd
e8de31cace 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
2022-04-21 22:49:01 -07:00
Peter Holm
29acff870b stress2: Added a syzkaller reproducer 2022-04-22 06:20:14 +02:00
Piotr Kubaj
1d307cc85c 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
2022-04-22 01:06:13 +02:00
John Baldwin
d96f81b0c5 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
2022-04-21 14:01:02 -07:00
John Baldwin
a6c09f20e8 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
2022-04-21 13:52:48 -07:00
John Baldwin
4b337ada34 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
2022-04-21 13:49:40 -07:00
Kyle Evans
914dc91d12 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
2022-04-21 14:57:24 -05:00
John Baldwin
92e40a9b92 busdma_bounce: Batch bounce page free operations when possible.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D34968
2022-04-21 12:01:55 -07:00
John Baldwin
d4ab3a8d4f 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
2022-04-21 10:42:14 -07:00