1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-28 08:02:54 +00:00
Commit Graph

293590 Commits

Author SHA1 Message Date
Mark Johnston
43caa2e805 bhyve: Make boot ROM handling more consistent
- On amd64, deprecate lpc.bootrom and lpc.bootvars.  Use top-level
  config variables instead.
- Introduce a generic predicate which can be used to determine whether
  the guest has a boot ROM.

Reviewed by:	corvink, jhb
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D46282
2024-08-19 13:55:47 +00:00
Andrew Turner
7a345763f9 arm64: Expand the use of Armv8.1-A atomics
When targeting Armv8.1 we can assume FEAT_LSE is available and can use
the atomic instructions this provides without needing to check for
support first.

Reviewed by:	imp, markj, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46159
2024-08-19 10:53:12 +00:00
Andrew Turner
87940d2b33 buf_ring: Add an Arm copyright
I've change enough of this file to add Arm as a copyright holder.
Add it after the "All rights reserved" line as that's not needed.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46157
2024-08-19 10:53:12 +00:00
Andrew Turner
fe2445f47d buf_ring: Ensure correct ordering of loads
When enqueueing on an architecture with a weak memory model ensure
loading br->br_prod_head and br->br_cons_tail are ordered correctly.

If br_cons_tail is loaded first then other threads may perform a
dequeue and enqueue before br_prod_head is loaded. This will mean the
tail is one less than it should be and the code under the
prod_next == cons_tail check could incorrectly be skipped.

buf_ring_dequeue_mc has the same issue with br->br_prod_tail and
br->br_cons_head so needs the same fix.

Reported by:	Ali Saidi <alisaidi@amazon.com>
Co-developed by: Ali Saidi <alisaidi@amazon.com>
Reviewed by:	imp, kib, markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46155
2024-08-19 10:53:11 +00:00
Andrew Turner
947754af55 buf_ring: Use atomic operations with br_prod_tail
As with br_cons_tail use an atomic load acquire to read br_prod_tail
in buf_ring_dequeue_mc and buf_ring_peek*.

On dequeue we need to ensure we don't read the entry from the buf_ring
until it is available and prod_tail has updated. There is already an
appropriate store in the enqueue path and an appropriate load in the
single consumer dequeue, we just need one in the other functions that
read from the buf_ring.

Reviewed by:	imp, markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46154
2024-08-19 10:53:11 +00:00
Andrew Turner
7eb0fffc77 buf_ring: Remove old arm-only dequeue code
In the single consumer dequeue the consumer thread controls
br_cons_head. As such no ordering between this and other data are
required.

Reviewed by:	alc, imp, kib, markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46153
2024-08-19 10:53:11 +00:00
Andrew Turner
44e1cfca41 buf_ring: Use atomic operations with br_cons_tail
Use an atomic operation with a memory barrier loading br_cons_tail
from the producer thread and storing to it in the consumer thread.

On dequeue we need to read the pointer value from the buf_ring before
moving the consumer tail as that indicates the entry is available to be
used. The store release atomic operation guarantees this.

In the enqueueing thread we then need to use a load acquire atomic
operation to ensure writing to this entry can only happen after the
tail has been read and checked.

Reported by:	Ali Saidi <alisaidi@amazon.com>
Co-developed by: Ali Saidi <alisaidi@amazon.com>
Reviewed by:	markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46152
2024-08-19 10:53:11 +00:00
Andrew Turner
3cc603909e buf_ring: Keep the full head and tail values
If a thread reads the head but then sleeps for long enough that
another thread fills the ring and leaves the new head with the
expected value then the cmpset can pass when it should have failed.

To work around this keep the full head and tail value and use the
upper bits as a generation count.

Reviewed by:	kib
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46151
2024-08-19 10:53:11 +00:00
Andrew Turner
17a597bc13 buf_ring: Consistently use atomic_*_32
We are operating on uint32_t values, use uint32_t atomic functions.

Reviewed by:	alc, imp, kib, markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46150
2024-08-19 10:04:25 +01:00
Andrew Turner
d3d34d56be buf_ring: Support DEBUG_BUFRING in userspace
The only part of DEBUG_BUFRING we don't support in userspace is the
mutex checks. Add _KERNEL checks around these so we can enable the
extra debugging.

Reviewed by:	alc, imp, kib, markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46149
2024-08-19 10:04:25 +01:00
Andrew Turner
5048308bdb buf_ring: Remove PREFETCH_DEFINED
I'm not able to find anything in the tree that ever defined it. Remove
as it's unused so is untested.

Reviewed by:	alc, imp, kib, markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46148
2024-08-19 10:04:24 +01:00
Dag-Erling Smørgrav
9ff2ebd928 adduser: Better document ZFS dataset creation.
MFC after:	3 days
PR:		280873
Reviewed by:	bcr
Differential Revision:	https://reviews.freebsd.org/D46316
2024-08-19 10:30:11 +02:00
Andre Albsmeier
308399a179 tail -F: fix crash
When show() detects an error and closes the file and follow() wants to
close it again, a NULL dereference occurs.

PR:	280910
MFC after:	1 week
2024-08-19 10:54:24 +03:00
Eugene Grosbein
8132e95909 libalias: fix subtle racy problem in outside-inside forwarding
sys/netinet/libalias/alias_db.c has internal static function UseLink()
that passes a link to CleanupLink() to verify if the link has expired.
If so, UseLink() may return NULL.

_FindLinkIn()'s usage of UseLink() is not quite correct.

Assume there is "redirect_port udp" configured to forward incoming
traffic for specific port to some internal address.
Such a rule creates partially specified permanent link.

After first such packet libalias creates new fully specifiled
temporary LINK_UDP with default timeout 60 seconds.
Also, in case of low traffic libalias may assign "timestamp"
for this new temporary link way in the past because
LibAliasTime is updated seldom and can keep old value
for tens of seconds, and it will be used for the temporary link.

It may happen that next incoming packet for redirected port
passed to _FindLinkIn() results in a call to UseLink()
that returns NULL due to detected expiration.
Immediate return of NULL results in broken translation:
either a packet is dropped (deny_incoming mode) or delivered to
original destination address instead of internal one.

Fix it with additional check for NULL to proceed with a search
for original partially specified link. In case of UDP,
it also recreates temporary fully specified link
with a call to ReLink().

Practical examples are "redirect_port udp" rules for unidirectional
SYSLOG protocol (port 514) or some low volume VPN encapsulated in UDP.

Thanks to Peter Much for initial analysis and first version of a patch.

Reported by:	Peter Much <pmc@citylink.dinoex.sub.org>
PR:		269770
MFC after:	1 week
2024-08-19 10:34:37 +07:00
Navdeep Parhar
0a9d1da6e6 cxgbe(4): Stop work request queues in a reliable manner.
Clear the EQ_HW_ALLOCATED flag with the wrq lock held and discard all
work requests, pending or new, when it's not set.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2024-08-17 11:23:32 -07:00
Navdeep Parhar
b5332809c6 cxgbe/iw_cxgbe: Fix typo in assertion.
eanbled -> enabled

MFC after:	3 days
2024-08-17 10:38:36 -07:00
Peter Holm
c7bc30c24f stress2: Some tests use hw.ncpu to scale the load. Tests on a box with
a large number of CPUs show that this number needs to be capped
2024-08-17 08:37:34 +02:00
Rick Macklem
10d5b43424 nfsproto.h: Define the new mode_umask attribute
RFC8275 defines a new attribute as an extension to NFSv4.2
called MODE_UMASK.  This patch adds the attribute number
to nfsproto.h.

Future patches will add optional support for the attribute.
This patch does not cause any semantics change.

MFC after:	2 weeks
2024-08-16 17:40:52 -07:00
Simon J. Gerraty
35399f68c8 safe_dot check file is a file
Since we are being paranoid, check that each arg to safe_dot is
actually a file as well as non-empty.

Check for white-space in filenames - these require special handling.
2024-08-16 13:15:20 -07:00
Cy Schubert
5685098846 unbound: Vendor import 1.21.0
Release notes at
	https://nlnetlabs.nl/news/2024/Aug/15/unbound-1.21.0-released/

MFC after:	1 week

Merge commit '96ef46e5cff01648c80c09c4364d10bc6f58119d'
2024-08-16 10:03:34 -07:00
Cy Schubert
96ef46e5cf unbound: Vendor import 1.21.0
Release notes at
	https://nlnetlabs.nl/news/2024/Aug/15/unbound-1.21.0-released/
2024-08-16 09:41:16 -07:00
Kajetan Staszkiewicz
788f194f60 pf: 'sticky-address' requires 'keep state'
When route_to() processes a packet without state, pf_map_addr() is called for
each packet. Pf_map_addr() will search for a source node and will find none
since those are created only in pf_create_state(). Thus sticky address,
even though requested in rule definition, will never work.

Raise an error when a stateless filter rule uses sticky address to avoid
confusion and to keep ruleset limitations in sync with what the pf code
really does.

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D46310
2024-08-16 11:43:00 +02:00
Peter Holm
41e03b46da stress2: Fix warning about unused variable. Remove debug "date" 2024-08-16 09:19:51 +02:00
Warner Losh
3d89acf590 nvme: Separate total failures from I/O failures
When it's a I/O failure, we can still send admin commands. Separate out
the admin failures and flag them as such so that we can still send admin
commands on half-failed drives.

Fixes: 9229b3105d (nvme: Fail passthrough commands right away in failed state)
Sponsored by: Netflix
2024-08-15 21:31:20 -06:00
Warner Losh
ce7fac64ba Revert "nvme: Separate total failures from I/O failures"
All kinds of crazy stuff was mixed into this commit. Revert
it and do it again.

This reverts commit d5507f9e43.

Sponsored by:		Netflix
2024-08-15 21:29:53 -06:00
Warner Losh
a233cb6914 nvmecontrol: Accept -a {1,2,3,4} for sanitize command for nvme-cli compat
Linux's `nvme sanititze -a` takes a number, not a string. Accept 1-4 for
compatibility so vendor's recepies are easier to implmement.

Sponsored by: Netflix
2024-08-15 20:22:31 -06:00
Warner Losh
d5507f9e43 nvme: Separate total failures from I/O failures
When it's a I/O failure, we can still send admin commands. Separate out
the admin failures and flag them as such so that we can still send admin
commands on half-failed drives.

Fixes: 9229b3105d (nvme: Fail passthrough commands right away in failed state)
Sponsored by: Netflix
2024-08-15 20:22:18 -06:00
Kevin Lo
8b21c469db ng_ubt: Add blacklist entries for MediaTek MT7925
This controller requires firmware patch downloading to operate,
block ng_ubt attachment unless operational firmware is loaded.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D46302
2024-08-16 10:03:19 +08:00
Simon J. Gerraty
82cb2a4158 Update safe_eval.sh to support --export
This update allows

safe_dot --export file ...

to export any variables that get set.

Reviewed by: obrien
2024-08-15 15:42:39 -07:00
Jessica Clarke
3cded05922 tmpfs: Fix OOB write when setting vfs.tmpfs.memory_percent
tmpfs_mem_percent is an int not a long, so on a 64-bit system this
writes 4 bytes past the end of the variable. The read above is correct,
so this was likely a copy paste error from sysctl_mem_reserved.

Found by:	CHERI
Fixes:		636592343c ("tmpfs: increase memory reserve to a percent of available memory + swap")
2024-08-15 20:33:22 +01:00
Pierre Pronchery
ef9fc9609a sys: Mark ACL conversion routines as __result_use_check
Both acl_copy_oldacl_into_acl() and acl_copy_acl_into_oldacl() may fail
in some circumstances (e.g., acl.acl_cnt exceeding the capacity of
OLDACL_MAX_ENTRIES).  This change marks both routines with
__result_use_check, enforcing check for errors by the caller.

Suggested by:	markj
Reviewed by:	markj, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46254
2024-08-15 15:04:29 -04:00
Mark Johnston
bef079254f arm64: Clamp segment sizes properly in bounce_bus_dmamap_load_buffer()
Commit 099b595154 ("Improve loading of multipage aligned buffers.")
modified bounce_bus_dmamap_load_buffer() with the assumption that busdma
memory allocations are physically contiguous, which is not always true:
bounce_bus_dmamem_alloc() will allocate memory with
kmem_alloc_attr_domainset() in some cases, and this function is not
guaranteed to return contiguous memory.

The damage seems to have been mitigated for most consumers by clamping
the segment size to maxsegsz, but this was removed in commit
a77e1f0f81 ("busdma: better handling of small segment bouncing"); in
practice, it seems busdma memory is often allocated with maxsegsz ==
PAGE_SIZE.  In particular, after commit a77e1f0f81 I see occasional
random kernel memory corruption when benchmarking TCP through mlx5
interfaces.

Fix the problem by using separate flags for contiguous and
non-contiguous busdma memory allocations, and using that to decide
whether to clamp.

Fixes:	099b595154 ("Improve loading of multipage aligned buffers.")
Fixes:	a77e1f0f81 ("busdma: better handling of small segment bouncing")
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D46238
2024-08-15 14:19:22 +00:00
Cheng Cui
8cc528c682
tcp cc: clean up some un-used cc_var flags
Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D46299
2024-08-15 09:33:04 -04:00
Martin Matuska
29dc934914 zfs: merge openzfs/zfs@d2ccc2155
Notable upstream pull request merges:
 #16431 244ea5c48 Add missing kstats to dataset kstats

Obtained from:	OpenZFS
OpenZFS commit: d2ccc21552
2024-08-15 13:30:31 +02:00
Kristof Provost
9aeee9486a pf tests: basic test for sticky-address configuration on rules
There was a bug in pf_handle_get_addr() where it confused the counter and
pointer in the pf_addr_wrap.p union, causing panics. Test for this.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-08-15 11:11:59 +02:00
Kajetan Staszkiewicz
1fc0dac54c pf: Convert struct pf_addr_wrap before sending it over netlink
The struct pf_addr_wrap when used inside of kernel operates on pointers to
tables or interfaces. When reading a ruleset the struct must contain
counters calculated from the aforementioned tables and interfaces. Both the
pointers and the resulting counters are stored in an union and thus can't be
present in the struct at the same time.

The original ioctl code handles this by making a copy of struct pf_addr_wrap
for pool addresses, accessing the table or interface structures by their
pointers, calculating the counter values and storing them in place of those
pointers in the copy. Then this copy is sent over ioctl.

Use this mechanism for netlink too. Create a copy of src/dst addresses. Use
the existing function pf_addr_copyout() to convert pointers to counters both
for src/dst and pool addresses.

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D46291
2024-08-15 11:11:59 +02:00
Kajetan Staszkiewicz
6c479edc61 pf: Fix indentation in struct pf_ksrc_node
This is a purely cosmetic change to simplify future diffs.

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D46298
2024-08-15 09:36:18 +02:00
Igor Ostapenko
09b7a03862 pf tests: Add 'mbuf' test for (*m0)->m_len < sizeof(struct ip) cases
Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D45927
2024-08-15 09:28:13 +02:00
Igor Ostapenko
8aaffd78c0 Add dummymbuf module for testing purposes
Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D45928
2024-08-15 09:28:13 +02:00
Jitendra Patidar
d2ccc21552
Fix projid accounting for xattr objects
zpool upgraded with 'feature@project_quota' needs re-layout of SA's
to fix the SA_ZPL_PROJID at SA_PROJID_OFFSET (128). Its necessary for
the correct accounting of object usage against its projid.
Old object (created before upgrade) when gets a projid assigned, its
SA gets re-layout via sa_add_projid(). If object has xattr dir, SA
of xattr dir also gets re-layout. But SA re-layout of xattr objects
inside a xattr dir is not done.

Fix zfs_setattr_dir() to re-layout SA's on xattr objects, when setting
projid on old xattr object (created before upgrade).

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Jitendra Patidar <jitendra.patidar@nutanix.com>
Closes #16355
Closes #16356
2024-08-14 17:59:19 -07:00
Paul Dagnelie
bd4f2023bb Add missing kstats to dataset kstats
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Reviewed-by: Rob Norris <robn@despairlabs.com>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes #16431
(cherry picked from commit 244ea5c488)
2024-08-14 15:42:00 -07:00
Paul Dagnelie
244ea5c488
Add missing kstats to dataset kstats
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Reviewed-by: Rob Norris <robn@despairlabs.com>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes #16431
2024-08-14 14:18:46 -07:00
Tony Hutter
d06de4f007
ZTS: Use /dev/urandom instead of /dev/random
Use /dev/urandom so we never have to wait on entropy.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #16442
2024-08-14 12:27:07 -07:00
Gleb Smirnoff
b458ddf27f zfs: fix build without MAC 2024-08-14 09:06:31 -07:00
Warner Losh
ca83345ab4 UPDATING: Add note about DMAR
DMAR crashes my laptop on boot, I had to disable it in the boot
laoder. Add a note until this is handled more gracefully.

Sponsored by:		Netflix
2024-08-14 09:00:37 -06:00
Wolfram Schneider
c9e8a2cdba ports(7): searchable index of all ports is at ports.freebsd.org
PR: 280816
2024-08-14 14:53:38 +00:00
Kristof Provost
89f6723288 pf: invert direction for inner icmp state lookups
(e.g. traceroute with icmp)
ok henning, jsing

Also extend the test case to cover this scenario.

PR:		280701
Obtained from:	OpenBSD
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-08-14 14:15:07 +02:00
Rob Norris
2633075e09 Linux 6.11: avoid passing "end" sentinel to register_sysctl()
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes #16400
2024-08-13 17:47:22 -07:00
Rob Norris
3abffc8781 Linux 6.11: add compat macro for page_mapping()
Since the change to folios it has just been a wrapper anyway. Linux has
removed their wrapper, so we add one.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes #16400
2024-08-13 17:47:18 -07:00
Rob Norris
f5236fe47a Linux 6.11: add more queue_limit fields with removed setters
These fields are very old, so no detection necessary; we just move them
into the limit setup functions.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes #16400
2024-08-13 17:47:13 -07:00