Commit graph

287914 commits

Author SHA1 Message Date
Gleb Smirnoff cd996b8489 ofed: garbage collect now unused sdp_sockaddr()
Submitted by:	zlei
2023-11-30 21:50:16 -08:00
Bjoern A. Zeeb 643d6dce6c tools/net80211: add mlme_assoc
mlme_assoc is a tool to trigger net80211::ieee80211_sta_join1() calls
which in certain conditions cause problems to the LinuxKPI 802.11 compat
code (but also believed to possibly cause problems in case of race to
other firmware based drivers).  This has proven to be a good reproducer
for the problem even on setups which otherwise could run for days without
hitting it.

Sponsored by:	The FreeBSD Foundation
PR:		271979
2023-12-01 01:48:34 +00:00
Stephen J. Kiernan 682b069c5c iicbus: add compat32 support for I2C ioctls
Some of the I2C ioctl request structures contain pointers and need to
handle requests from 32-bit applications on 64-bit kernels.

Obtained from:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D42836
2023-11-30 20:33:46 -05:00
Warner Losh 0f83811158 cam: Make cam.h self-contained for userland
We reference FILE * here, but don't include stdio.h. Do so (both of
these are in !_KERNEL blocks).

Sponsored by:		Netflix
2023-11-30 18:32:39 -07:00
Warner Losh 54521a6fe6 cam: Remove prototype for cam_sim_alloc_dev
The implementation was removed in dcd5dea965, but the prototype was
not. Correct that oversight.

Fixes: dcd5dea965
Sponsored by:		Netflix
2023-11-30 18:32:39 -07:00
Kyle Evans d9c543b6b0 rtld: add a test for RTLD_DEEPBIND
This tests that with RTLD_DEEPBIND, symbols are looked up in all of the
object's needed objects before the global object.

PR:		275393
Reviewed by:	kib
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D42843
2023-11-30 19:26:09 -06:00
Bjoern A. Zeeb 82506f26c0 ath: Revert "Use NET_TASK_INIT() and NET_GROUPTASK_INIT() for drivers that process"
This reverts commit 6c3e93cb5a for
sys/dev/ath/if_ath.c only.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-12-01 00:48:55 +00:00
Bjoern A. Zeeb eb3821e6d9 Revert "[ath] Attempt to fix epoch handling."
This reverts commit af2441fbc7.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-12-01 00:48:55 +00:00
Bjoern A. Zeeb 75f298492a Revert "Enter the network epoch in USB WiFi drivers when processing input"
This reverts commit 17c328b6ae.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-12-01 00:48:54 +00:00
Bjoern A. Zeeb 39b7027979 Revert "Widen EPOCH(9) usage in USB WLAN drivers."
This reverts commit 21c4082de9.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-12-01 00:48:54 +00:00
Bjoern A. Zeeb 1c6dd33d26 Revert "Widen EPOCH(9) usage in PCI WLAN drivers."
This reverts commit b65f813c1a.
As a side effect this also seems to fix wtap which seems to have
lost the epoch over the input path in between.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-12-01 00:48:54 +00:00
Bjoern A. Zeeb de607e3c23 net80211: move net_epoch into net80211
Move the net_epoch into net80211 around the if_input calls and out of
the driver (in this first case LinuxKPI).  This reduces coverage but
also allows us to alloc in calls like (*ampdu_rx_start) which do not
actually pass data up the stack.

The follow-up commits will revert b65f813c1a,
21c4082de9,
17c328b6ae,
af2441fbc7,
and 6c3e93cb5a for ath.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Tested by:	few (rtwn, ath, iwlwifi, ...)
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D42427
2023-12-01 00:46:10 +00:00
Christos Margiolis 3d44dce90a sort: test against all month formats in month-sort
The CLDR specification [1] defines three possible month formats:

- Abbreviation (e.g Jan, Ιαν)
- Full (e.g January, Ιανουαρίου)
- Standalone (e.g January, Ιανουάριος)

Many languages use different case endings depending on whether the month
is referenced as a standalone word (nominative case), or in date context
(genitive, partitive, etc.). sort(1)'s -M option currently sorts months
by testing input against only the abbrevation format, which is
essentially a substring of the full format. While this works fine for
languages like English, where there are no cases, for languages where
there is a different case ending between the abbreviation/full and
standalone formats, it is not sufficient.

For example, in Greek, "May" can take the following forms:

Abbreviation: Μαΐ (genitive case)
Full: Μαΐου (genitive case)
Standalone: Μάιος (nominative case)

If we use the standalone format in Greek, sort(1) will not able to match
"Μαΐ" to "Μάιος" and the sort will fail.

This change makes sort(1) test against all three formats. It also works
when the input contains mixed formats.

[1] https://cldr.unicode.org/translation/date-time/date-time-patterns

Reviewed by:	markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D42847
2023-12-01 02:30:10 +02:00
Richard Scheffenegger f42518ff12 tcp: for LRD move sysctl from tcp.do_lrd tp tcp.sack.lrd, remove sockopt
Moving lrd sysctl to the tcp.sack branch, since LRD only works with SACK.
Remove the sockopt to programmatically control LRD per session.

Reviewed By:           #transport, tuexen, rrs
Sponsored by:          NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D42851
2023-11-30 21:11:45 +01:00
Konstantin Belousov 9daf6cd0f4 RTLD_DEEPBIND: make lookup not just symbolic, but walk all refobj' DAGs
before starting the walk over the global list.  Effectively we visit
needed objects first as well, instead of just the object itself.
This seems to better match the semantic offered by the glibc flag.

Reported by:	kevans
PR:	275393
Reviewed by:	kevans
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42841
2023-11-30 21:34:36 +02:00
Bjoern A. Zeeb c93be3079b net80211: ieee80211_dump_node() check for channel to be set
Avoid panics in case ieee80211_dump_node() gets called before a
channel context is set.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-11-30 18:21:49 +00:00
Mark Johnston 629a72376d ossl: Add AES-GCM support for NEON-enabled armv7
This provides substantially higher throughput than the fallback
implementation.

Reviewed by:	jhb
MFC after:	3 months
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D41305
2023-11-30 12:49:48 -05:00
Mark Johnston 44f8e1e853 ossl: Add support for armv7
OpenSSL provides implementations of several AES modes which use
bitslicing and can be accelerated on CPUs which support the NEON
extension.  This patch adds arm platform support to ossl(4) and provides
an AES-CBC implementation, though bsaes_cbc_encrypt() only implements
decryption.  The real goal is to provide an accelerated AES-GCM
implementation; this will be added in a subsequent patch.

Initially derived from https://reviews.freebsd.org/D37420.

Reviewed by:	jhb
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
MFC after:	3 months
Differential Revision:	https://reviews.freebsd.org/D41304
2023-11-30 12:49:47 -05:00
Mark Johnston 47d767dab5 ossl: Fix some bugs in the fallback AES-GCM implementation
gcm_*_aesni() are used when the AVX512 implementation is not available.
Fix two bugs which manifest when handling operations spanning multiple
segments:
- Avoid underflow when the length of the input is smaller than the
  residual.
- In gcm_decrypt_aesni(), ensure that we begin the operation at the
  right offset into the input and output buffers.

Reviewed by:	jhb
Fixes:		9b1d87286c ("ossl: Add a fallback AES-GCM implementation using AES-NI")
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D42838
2023-11-30 12:49:47 -05:00
Gleb Smirnoff 0fac350c54 sockets: don't malloc/free sockaddr memory on getpeername/getsockname
Just like it was done for accept(2) in cfb1e92912, use same approach
for two simplier syscalls that return socket addresses.  Although,
these two syscalls aren't performance critical, this change generalizes
some code between 3 syscalls trimming code size.

Following example of accept(2), provide VNET-aware and INVARIANT-checking
wrappers sopeeraddr() and sosockaddr() around protosw methods.

Reviewed by:		tuexen
Differential Revision:	https://reviews.freebsd.org/D42694
2023-11-30 08:31:10 -08:00
Gleb Smirnoff cfb1e92912 sockets: don't malloc/free sockaddr memory on accept(2)
Let the accept functions provide stack memory for protocols to fill it in.
Generic code should provide sockaddr_storage, specialized code may provide
smaller structure.

While rewriting accept(2) make 'addrlen' a true in/out parameter, reporting
required length in case if provided length was insufficient.  Our manual
page accept(2) and POSIX don't explicitly require that, but one can read
the text as they do.  Linux also does that. Update tests accordingly.

Reviewed by:		rscheff, tuexen, zlei, dchagin
Differential Revision:	https://reviews.freebsd.org/D42635
2023-11-30 08:30:55 -08:00
Richard Scheffenegger 34c45bc6a3 tcp: enable LRD by default
Lost Retransmission Detection was added as a
feature in May 2021, but disabled by default.

Enabling the feature by default to reduce the
flow completion time by avoiding RTOs when
retransmissions get lost too.

Reviewed By:           tuexen, #transport, zlei
MFC after:             10 weeks
Sponsored by:          NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D42845
2023-11-30 05:38:16 +01:00
Andrew Turner 839999e7ef vm: Add kva_alloc_aligned
Add a function like kva_alloc that allows us to specify the alignment
of the virtual address space returned.

Reviewed by:	alc, kib, markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42788
2023-11-30 10:50:03 +00:00
Andrew Turner 8daee410d2 vm: Use vmem_xalloc in kva_alloc
The kernel_arena used in kva_alloc has the qcache disabled. vmem_alloc
will first try to use the qcache before falling back to vmem_xalloc.

Rather than trying to use the qcache in vmem_alloc just call
vmem_xalloc directly.

Reviewed by:	alc, kib, markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42831
2023-11-30 10:50:03 +00:00
Jamie Gritton 51e7276365 Unbreak build from ed31b3f4a1 (misapplied diff).
Differential Revision:	<https://reviews.freebsd.org/D28150
2023-11-29 17:27:37 -08:00
Jamie Gritton ed31b3f4a1 jail: Don't allow jail_set(2) to resurrect dying jails.
Currently, a prison in "dying" state (removed but still holding
resources) can be brought back to alive state via "jail -d", or
the JAIL_DYING flag to jail_set(2).  This seemed like a good idea
at the time.

Its main use was to improve support for specifying the jid when
creating a jail, which also seemed like a good idea at the time.
But resurrecting a jail that was partway through thr process of
shutting down is trouble waiting to happen.

This patch deprecates that flag, leaving it as a no-op for creating
jails (but still useful for looking at dying jails).  It sill allows
creating a new jail with the same jid as a dying one, but will renumber
the old one in that case.  That's imperfect, but allows for current
behavior.

Reviewed by:	bz
Differential Revision:	https://reviews.freebsd.org/D28150
2023-11-29 16:12:13 -08:00
Stephen J. Kiernan 376330aca1 smbus: add compat32 support for SMB ioctls
Some of the SMB ioctl request structures contain pointers and need to
handle requests from 32-bit applications on 64-bit kernels.

Obtained from:	Juniper Networks, Inc.
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D42837
2023-11-29 18:15:09 -05:00
Martin Matuska 525fe93dc7 zfs: merge openzfs/zfs@a03ebd9be
Notable upstream pull request merges:
 #15517 2a27fd411 ZIL: Assert record sizes in different places
 #15557 b94ce4e17 module/icp/asm-arm/sha2: fix compiling on armv5/6
 #15557 4340f69be module/icp/asm-arm/sha2: auto detect __ARM_ARCH
 #15603 a03ebd9be ZIL: Call brt_pending_add() replaying TX_CLONE_RANGE
 #15606 1c38cdfe9 zdb: fix printf() length for uint64_t devid

Obtained from:	OpenZFS
OpenZFS commit:	a03ebd9bee
2023-11-29 23:08:25 +01:00
Dag-Erling Smørgrav b70e57be2c tail: Clean up error messages.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D42842
2023-11-29 22:49:44 +01:00
Dag-Erling Smørgrav 621f45532c tail: Fix heap overflow in -F case.
The number of events we track can vary over time, but we only allocate
enough space for the exact number of events we are tracking when we
first begin, resulting in a trivially reproducable heap overflow.  Fix
this by allocating enough space for the greatest possible number of
events (two per file) and clean up the code a bit.

Also add a test case which triggers the aforementioned heap overflow,
although we don't currently have a way to detect it.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D42839
2023-11-29 22:49:38 +01:00
Bjoern A. Zeeb b647615ede iwlwififw: add firmware for the Bz/B200 chipset
The iwlwifi driver already supports the chipset as "Bz TBD"
(also in 14.0).  Add the firmware for it.  Successfully tested
for 0x8086/0x272b/0x8086/0x00f4 on arm64 thanks to donated
hardware [1].

    Firmware was obtained from linux-firmware at
    9552083a783e5e48b90de674d4e3bf23bb855ab0 .

Sponsored by:	The FreeBSD Foundation
Sponsored by:	Martin Hoehne / minipci.biz (B200 card) [1]
MFC after:	3 days
2023-11-29 21:42:36 +00:00
Jean-Sébastien Pédron b292c995cf
linuxkpi: Include <linux/rbtree.h> from <linux/hrtimer.h> and <linux/mm_types.h>
[Why]
Some files in DRM rely on this indirect include to use `struct rb_*`.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D42835
2023-11-29 19:54:48 +01:00
Jean-Sébastien Pédron 40c20fc29c
vt(4): Call post-switch callback after replacing the backend
[Why]
For instance, it gives a chance to the new backend to refresh the
screen. This is needed by the vt_drmfb backend and `drm_fb_helper`.

This change was lost when I posted changes to reviews.freebsd.org and it
broken the amdgpu driver... Thanks to manu@ for reporting the problem
and wulf@ to find out the missing change!

Tested by:	manu
Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D42834
2023-11-29 19:54:14 +01:00
Alexander Motin a03ebd9bee
ZIL: Call brt_pending_add() replaying TX_CLONE_RANGE
zil_claim_clone_range() takes references on cloned blocks before ZIL
replay.  Later zil_free_clone_range() drops them after replay or on
dataset destroy.  The total balance is neutral.  It means on actual
replay we must take additional references, which would stay in BRT.

Without this blocks could be freed prematurely when either original
file or its clone are destroyed.  I've observed BRT being emptied
and the feature being deactivated after ZIL replay completion, which
should not have happened.  With the patch I see expected stats.

Reviewed-by: Kay Pedersen <mail@mkwg.de>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rob Norris <robn@despairlabs.com>
Signed-off-by:	Alexander Motin <mav@FreeBSD.org>
Sponsored by:	iXsystems, Inc.
Closes #15603
2023-11-29 10:51:34 -08:00
John Baldwin f54a3890b1 x86: Support multiple PCI MCFG regions
In particular, this enables support for PCI config access for domains
(segments) other than 0.

Reported by:	cperciva
Tested by:	cperciva (m7i.metal-48xl AWS instance)
Reviewed by:	imp
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D42828
2023-11-29 10:32:39 -08:00
John Baldwin 9893a4fd31 x86: Refactor pcie_cfgregopen
Split out some bits of pcie_cfgregopen that only need to be executed
once into helper functions in preparation for supporting multiple MCFG
entries.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D42829
2023-11-29 10:32:16 -08:00
John Baldwin 1587a9db92 pci_cfgreg: Add a PCI domain argument to the low-level register API
This commit changes the API of pci_cfgreg(read|write) to add a domain
argument (referred to as a segment in ACPI parlance) (note that this
is not the same as a NUMA domain, but something PCI-specific).  This
does not yet enable access to domains other than 0, but updates the
API to support domains.

Places that use hard-coded bus/slot/function addresses have been
updated to hardcode a domain of 0.  A few places that have the PCI
domain (segment) available such as the acpi_pcib_acpi.c Host-PCI
bridge driver pass the PCI domain.

The hpt27xx(4) and hptnr(4) drivers fail to attach to a device not on
domain 0 since they provide APIs to their binary blobs that only
permit bus/slot/function addressing.

The x86 non-ACPI PCI bus drivers all hardcode a domain of 0 as they do
not support multiple domains.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D42827
2023-11-29 10:31:47 -08:00
John Baldwin 71ac18a84d agp_amd64: Use <machine/pci_cfgreg.h> rather than bare prototypes
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D42826
2023-11-29 10:31:16 -08:00
Wraithh 8adf2e3066
Fix zoneid when USER_NS is disabled
getzoneid() should return GLOBAL_ZONEID instead of 0 when USER_NS is disabled.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ilkka Sovanto <github@ilkka.kapsi.fi>
Closes #15560
2023-11-29 09:55:17 -08:00
VaibhavB 7d68900af3
ZTS: get_persistent_disk_name can return truncated names
Instead of using only the 3rd element return the entire string after 
the split to handle device names with dashes.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Vaibhav Bhanawat <vaibhav.bhanawat@delphix.com>
Closes #15567
2023-11-29 09:34:29 -08:00
Martin Matuška 1c38cdfe98
zdb: fix printf() length for uint64_t devid
Bug introduced in 213d682967.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Warner Losh <imp@FreeBSD.org>
Signed-off-by: Martin Matuska <mm@FreeBSD.org>
Closes #15606
2023-11-29 09:18:30 -08:00
Igor Ostapenko 0626d30e41 pf: fix mem leaks upon vnet destroy
Add missing cleanup actions:
- remove user defined anchor rulesets
- remove user defined ether anchor rulesets
- remove tables linked to user defined anchors
- deal with wildcard anchor peculiarities to get them removed correctly

PR:		274310
Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42747
2023-11-29 17:59:28 +01:00
Mark Johnston 5c0dac0b7a ossl: Keep mutable AES-GCM state on the stack
ossl(4)'s AES-GCM implementation keeps mutable state in the session
structure, together with the key schedule.  This was done for
convenience, as both are initialized together.  However, some OCF
consumers, particularly ZFS, assume that requests may be dispatched to
the same session in parallel.  Without serialization, this results in
incorrect output.

Fix the problem by explicitly copying per-session state onto the stack
at the beginning of each operation.

PR:		275306
Reviewed by:	jhb
Fixes:		9a3444d91c ("ossl: Add a VAES-based AES-GCM implementation for amd64")
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D42783
2023-11-29 12:55:51 -05:00
Warner Losh db0a4f2d7a openzfs: unbreak 32-bit builds.
32-bit builds are broken. fix that by using PRIu64 instead of a
bare '%lu.'

Feel free to revert when upstream has this fixed. I'm agnostic as to the
proper fix, but don't have the time to fight upstreaming this on top of
everything else.
2023-11-29 08:26:29 -07:00
Alan Somers d565784a7e zfsd: fault disks that generate too many I/O delay events
If ZFS reports that a disk had at least 8 I/O operations over 60s that
were each delayed by at least 30s (implying a queue depth > 4 or I/O
aggregation, obviously), fault that disk.  Disks that respond this
slowly can degrade the entire system's performance.

MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:	delphij
Differential Revision: https://reviews.freebsd.org/D42825
2023-11-29 07:51:11 -07:00
Warner Losh 272a406042 mpi3mr: Minor tweak to task queue pausing
Use a while loop with cancel / drain to make sure that all tasks have
completed before proceeding to reset.

Suggested by:		jhb
Sponsored by:		Netflix
2023-11-28 18:52:28 -07:00
Warner Losh 1ec7c672bc mpi3mr: Assume dma_hiaddr is BUS_SPACE_MAXADDR
No sense having a variable for this. So use BUS_SPACE_MAXADDR and remove
dma_hiaddr from softc.

Suggested by:		jhb
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D42808
2023-11-28 18:52:28 -07:00
Warner Losh 2361a0056f mpi3mr: Replace can't happen DataLength == 0 with an assert
Replace the test for DataLength == 0 with an assert. It can't happen,
but an assert doesn't hurt. Emacs removed some trailing white space too.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D42807
2023-11-28 18:52:28 -07:00
Alexander Motin 489eee0d41 mpi3mr: Use template for main busdma tag.
Use the simpler template code for the parent busdma tag for all I/O to
this card.

Reviewed by:		mav, jhb, imp
Differential Revision:	https://reviews.freebsd.org/D42607
2023-11-28 18:52:23 -07:00
Alexander Motin 39a3e6a812 mpi3mr: Make these bus_dmamap_load calls synchronous
These calls "should" all be synchrounous. There's no bouncing that's
needed for them (at least in the typical case that we have a sane card
that has more bits of dma addresses decoded than we have memory), so
there's no errors possible. Ensure these calls are really synchronous
with BUS_DMA_NOWAIT flags (which should never fail now that the
bus_dmamem_alloc() has succeeded).

Reviewed by:		mav, jhb, imp
Differential Revision:	https://reviews.freebsd.org/D42606
2023-11-28 18:52:16 -07:00