Commit graph

287581 commits

Author SHA1 Message Date
Zhenlei Huang ecf710f0e0 kern linker: Do not retry loading modules on EEXIST
LINKER_LOAD_FILE() calls linker_load_dependencies() which will return
EEXIST in case the module to be loaded has already been compiled into
the kernel. Since the format of the module is now recognized then there
is no need to retry loading with a different linker, otherwise the
userland will get misleading error number ENOEXEC.

PR:		274936
Reviewed by:	dfr
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D42474
2023-11-07 12:45:25 +08:00
Rick Macklem 501bdf3001 nfscl: newnfs_copycred() cannot be called when a mutex is held
Since newnfs_copycred() calls crsetgroups() which in turn calls
crextend() which might do a malloc(M_WAITOK), newnfs_copycred()
cannot be called with a mutex held.  Fortunately, the malloc()
call is rarely done, since XU_GROUPS is 16 and the NFS client
uses a maximum of 17 (only 17 groups will cause the malloc() to
be called).  Further, it is only a problem if the malloc() tries
to sleep().  As such, this bug does not seem to have caused
problems in practice.

This patch fixes the one place in the NFS client where
newnfs_copycred() is called while a mutex is held by moving the
call to after where the mutex is released.

Found by inspection while working on an experimental patch.

MFC after:	2 weeks
2023-11-06 14:25:30 -08:00
Kristof Provost a6173e9463 pf: expose more syncookie state information to userspace
Allow userspace to retrieve low and high water marks, as well as the
current number of half open states.

MFC after:	1 week
Sponsored by:	Modirum MDPay
2023-11-06 22:22:24 +01:00
Guido Falsi e6eb94a8ff nanobsd: fix typo in utility function call name
Approved by:		imp
Differential Revision:	https://reviews.freebsd.org/D42475
2023-11-06 22:18:35 +01:00
Li-Wen Hsu 86e87c3bd1
Skip sys.netinet6.frag6.frag6_19.frag6_19 in CI
This test case is unreliable in CI environment.

PR:		274941
Sponsored by:	The FreeBSD Foundation
2023-11-07 04:59:24 +08:00
Mark Johnston 3e356fb885 crashinfo: Get local variable values in the gdb backtrace
This should make crash reports a bit more useful without having to ask
for additional information.

Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42465
2023-11-06 14:59:10 -05:00
Mark Johnston 725962a9f4 e6000sw: Fix locking in miibus_{read,write}reg implementations
Commit 4692906480 made e6000sw's
implementation of miibus_(read|write)reg assume that the softc lock is
held.  I presume that is to avoid lock recursion in e6000sw_attach() ->
e6000sw_attach_miibus() -> mii_attach() -> MIIBUS_READREG().

However, the lock assertion in e6000sw_readphy_locked() can fail if a
different driver uses the interface to probe registers.  Work around the
problem by providing implementations which lock the softc if it is not
already locked.

PR:		274795
Fixes:		4692906480 ("e6000sw: add readphy and writephy wrappers")
Reviewed by:	kp, imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42466
2023-11-06 14:57:56 -05:00
Warner Losh 2ffd30f7ee cam: Remove left-over sys/cdefs.h in sys/cam
These weren't removed when $FreeBSD$ was removed. They aren't needed and
now are a style(9) nonconformity.

Sponsored by:		Netflix
2023-11-06 12:20:23 -07:00
Warner Losh 500196c5c7 cam: Add nvme error devctl publishing
Start reporting nvme errors from devices, like we report ata and scsi
errors.

Sponsored by:		Netflix
Reviewed by:		mav, jhb
Differential Revision:	https://reviews.freebsd.org/D41086
2023-11-06 12:10:42 -07:00
Elyes Haouas e5f905c72a yppush: Remove return statement at the end of void functions
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2023-11-06 15:07:10 -04:00
Elyes Haouas 29ca151586 rpcbind: Remove return statement at the end of void functions
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2023-11-06 15:07:10 -04:00
Elyes Haouas 6e90567dde rpc.ypxfrd: Remove return statement at the end of void functions
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2023-11-06 15:07:10 -04:00
Elyes Haouas b5ebd8bb4e ypserv: Remove return statement at the end of void functions
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2023-11-06 15:07:10 -04:00
Elyes Haouas e9e666f7de keyserv: Remove return statement at the end of void functions
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2023-11-06 15:07:10 -04:00
Elyes Haouas be5a2c70b1 rtadvd: Remove return statement at the end of void functions
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2023-11-06 15:07:10 -04:00
ednadolski-ix 3bd4df3841
Improve ZFS objset sync parallelism
As part of transaction group commit, dsl_pool_sync() sequentially calls
dsl_dataset_sync() for each dirty dataset, which subsequently calls
dmu_objset_sync().  dmu_objset_sync() in turn uses up to 75% of CPU
cores to run sync_dnodes_task() in taskq threads to sync the dirty
dnodes (files).

There are two problems:

1. Each ZVOL in a pool is a separate dataset/objset having a single
   dnode.  This means the objsets are synchronized serially, which
   leads to a bottleneck of ~330K blocks written per second per pool.

2. In the case of multiple dirty dnodes/files on a dataset/objset on a
   big system they will be sync'd in parallel taskq threads. However,
   it is inefficient to to use 75% of CPU cores of a big system to do
   that, because of (a) bottlenecks on a single write issue taskq, and
   (b) allocation throttling.  In addition, if not for the allocation
   throttling sorting write requests by bookmarks (logical address),
   writes for different files may reach space allocators interleaved,
   leading to unwanted fragmentation.

The solution to both problems is to always sync no more and (if
possible) no fewer dnodes at the same time than there are allocators
the pool.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Edmund Nadolski <edmund.nadolski@ixsystems.com>
Closes #15197
2023-11-06 10:38:42 -08:00
Warner Losh fd9a4a67d0 cam: Minor opt_cam.h cleanup
sys/cam/cam.h includes opt_cam.h, so none of the clients need to do
this. cam.h does all the right dancing to conditionally include
opt_cam.h only when it makes sense. It generally only matters when
cam_debug.h is included (it must be included before that). Many of the
stray opt_cam.h includes were after cam_debug.h which would be a problem
were it not included in cam/cam.h. The other users of CAM options that
aren't debug all already include cam/cam.h.

Also trim unneeded sys/cdefs.h files from the files touched.

Sponsored by:		Netflix
2023-11-06 10:47:15 -07:00
Mitchell Horne c1e2146821 pmap_kextract(9): some additions
Mainly, provide a little more detail on the caller's responsibilities.

Suggested by:	kib, jhb
Reviewed by:	kib, markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D42458
2023-11-06 12:54:45 -04:00
Alexander Motin 8d6c0743e3 nvme: Introduce longer timeouts for admin queue
KIOXIA CD8 SSDs routinely take ~25 seconds to delete non-empty
namespace.  In some cases like hot-plug it takes longer, triggering
timeout and controller resets after just 30 seconds. Linux for many
years has separate 60 seconds timeout for admin queue.  This patch
does the same.  And it is good to be consistent.

Sponsored by:	iXsystems, Inc.
Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42454
2023-11-06 11:05:48 -05:00
Mateusz Guzik 733a66841d Fix up the vm_guest_sysctl_names size assert.
As VM_LAST was included in the array, the size check had to always pass.

While here modernize the assert itself.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-11-06 15:39:17 +00:00
Christos Margiolis b351fa9d08 RELNOTES: mention bb830e346b
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D42479
2023-11-06 17:36:39 +02:00
Christos Margiolis 963f38b2db RELNOTES: bump version to 15.0
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D42478
2023-11-06 17:36:33 +02:00
Benedict Reuschling 94eca4b5f3 loader.efi.8: Fix style warnings
This is a follow-up commit to bce728719e
to address mandoc(1) warnings.
2023-11-06 14:45:20 +00:00
Kristof Provost 497ccc21ef libpfctl: handle the 'pfctl' netlink family not being supported
If we fail to find the pfctl family we should not attempt to make the
call. That means that either pf is not loaded, or it's a very old (i.e.
pre-netlink) version.

Reported by: manu
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-11-06 13:53:56 +01:00
Guido Falsi bce728719e Add paragraph documenting loader.env functionlity
Approved by:		docs (carlavilla)
Differential Revision:	https://reviews.freebsd.org/D42476
2023-11-06 13:21:53 +01:00
Roger Pau Monné 318bbb6d5a xen-netfront: attempt to make cleanup idempotent
Current cleanup code assumes that all the fields are allocated and/or setup by
the time cleanup is called, but this is not always true: a failure in mid-setup
of the device will cause the functions to be called with possibly uninitialized
fields.

Fix the functions to cope with such sate, while also attempting to make the
cleanup idempotent.

Finally fix an error path during setup that would not mark the device as
closed, and hence prevents the kernel from finishing booting.

Fixes: 96375eac94 ("xen-netfront: add multiqueue support")
Sponsored by: Citrix Systems R&D
2023-11-06 11:17:40 +01:00
Roger Pau Monné 1a12f0aea8 xen: fix initialization of grant table frame array
The current sizing of the array used to store grant table frames is broken, as
the calculation:

       max_nr_glist_frames = (boot_max_nr_grant_frames *
                              GREFS_PER_GRANT_FRAME /
                              (PAGE_SIZE / sizeof(grant_ref_t)));

Is plain bogus, for once grant_ref_t is the type of the grant reference, but
not the entry used to store such references in the grant frames.  But even if
the above calculation is switched to use grant_entry_v1_t, it would end up as:

       max_nr_glist_frames = (boot_max_nr_grant_frames *
                              (PAGE_SIZE / sizeof(grant_entry_v1_t)) /
                              (PAGE_SIZE / sizeof(grant_entry_v1_t)));

Which is pointless (note GREFS_PER_GRANT_FRAME has been expanded to (PAGE_SIZE
/ sizeof(grant_entry_v1_t))).

Just use boot_max_nr_grant_frames directly to size the grant table frames
array.

Fixes: 30d1eefe39 ("Import OS interfaces to Xen services.")
Sponsored by: Citrix Systems R&D
2023-11-06 11:17:39 +01:00
Michael Tuexen 3bbbfc8dcd sctp: minor clean
No functional change intended.
MFC after:	1 week
2023-11-06 11:04:15 +01:00
Ka Ho Ng 475fa89800 share/mk: Fix .TARGET override documentation
Fixes: 		48da57b47f
Sponsored by:	Juniper Networks, Inc.
MFC after:	3 days
Reviewed by:	imp, delphij, emaste
Differential Revision:	https://reviews.freebsd.org/D42469
2023-11-05 16:28:34 -05:00
Michael Tuexen 35af22ac98 if_tuntap: trigger the bpf hook on transmitting for the tap interface
The tun interface triggers the bpf hook when a packet is transmitted,
the tap interface triggers it when the packet is read from the
character device. This is inconsistent.
So fix the tap device such that it behaves like the tun device.
This is needed for adding support for the tap device to packetdrill.

Reviewed by:		kevans, rscheff
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D42467
2023-11-05 20:32:46 +01:00
Michael Tuexen 03c3a70abe udplite: make socketoption available on IPv6 sockets
This patch allows the IPPROTO_UDPLITE-level socket options
UDPLITE_SEND_CSCOV and UDPLITE_RECV_CSCOV to be used on
AF_INET6 sockets in addition to AF_INET sockets.

Reviewed by:		ae, rscheff
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D42430
2023-11-05 15:28:54 +01:00
Michael Tuexen b10ae5a9b2 tcp rack: remove references to rb trees
The references should have been removed in
https://cgit.freebsd.org/src/commit/?id=030434acaf4631c4e205f8bccedcc7f845cbfcbf

Reviewed by:		rscheff, zlei
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D42386
2023-11-05 15:21:06 +01:00
Kyle Evans e116e040f3 grep: don't rely on implementation-defined malloc(0) behavior
The very few places that rely on malloc/calloc of a zero-size region
won't attempt to dereference it, so just return NULL rather than rolling
the dice with the underlying malloc implementation.

Reported by:	brooks, Shawn Webb
2023-11-04 21:19:12 -05:00
Ed Maste 13a9745746 crashinfo: remove unused /usr/bin/gdb support
We have not had gdb 6.1 in the base system for some time; there is no
need to check for it.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34478
2023-11-04 21:45:15 -04:00
Dan Mcgregor 7c5146da12 mountd: Add support for spaces in exported directories
The previous code would correctly parse strings including quotation
marks (") or backslash (/), but the tests when creating the export
includes them in the final string. This prevents exporting paths
with embedded spaces, for example "/exports/with space". Trying
results in log lines resembling:

mountd[1337]: bad exports list line '/exports/with\ space':
    /exports/with\ space: lstat() failed: No such file or directory.

Turns out that when creating its exports list, zfs escapes strings
in a format compatible with vis(3). Since I expect that zfs sharenfs
is the dominating use case for generating an exports list, use
strunvis(3) to parse the export path. The result is lines like the
following allowing spaces:

/exports/with\040space -network 192.168.0 -mask 255.255.255.0

A man page update will be done as a separate commit.

MFC after:	1 month
Reviewed by:	rmacklem
Differential Revision:	https://reviews.freebsd.org/D42432
2023-11-04 15:07:56 -07:00
Christos Margiolis bb830e346b tty: set IUTF8 by default
128f63cedc and 9e589b0938 added proper UTF-8 backspacing handling in
the tty(4) driver, which is enabled by setting the new IUTF8 flag
through stty(1). Since the default locale is UTF-8, and the feature
itself is important enough, enable IUTF8 by default.

Related discussion:
https://lists.freebsd.org/archives/freebsd-arch/2023-November/000534.html

Reviewed by:	imp, bojan.novkovic_fer.hr
Differential Revision:	https://reviews.freebsd.org/D42464
2023-11-04 22:31:47 +02:00
Simon J. Gerraty 6647af9b56 bsd.progs.mk must pass META_XTRAS to gendirdeps.mk
The indirection used by bsd.progs.mk is setting META_XTRAS
means the value needs to be passed in the environment to
gendirdeps.mk, as any expansion before then will be empty.

Remove a now misleading comment from bsd.progs.mk
before it includes bsd.prog.mk

Update gendirdeps.mk to accommodate this.

Reviewed by:	stevek
2023-11-04 10:17:40 -07:00
Jason A. Harmening 586fed0b03 vfs_lookup_cross_mount(): restore previous do...while loop
When the cross-mount walking logic in vfs_lookup() was factored into
a separate function, the main cross-mount traversal loop was changed
from a do...while loop conditional on the current vnode having
VIRF_MOUNTPOINT set to an unconditional for(;;) loop.  For the
unionfs 'crosslock' case in which the vnode may be re-locked, this
meant that continuing the loop upon finding inconsistent
v_mountedhere state would no longer branch to a check that the vnode
is in fact still a mountpoint.  This would in turn lead to over-
iteration and, for INVARIANTS builds, a failed assert on the next
iteration.

Fix this by restoring the previous loop behavior.

Reported by:	pho
Tested by:	pho
Fixes:		80bd5ef070
MFC after:	1 week
2023-11-04 12:15:20 -05:00
Alexander Motin c2588f5e06 stand/zfs: Remove one more read-compatible feature
This feature is marked as ZFEATURE_FLAG_READONLY_COMPAT and so
irrelevant for read-only pool imports by the loader:

	"com.delphix:spacemap_v2"

This should cause no functional changes, just a code cleanup.

I'm sorry, missed it in previous commit.

MFC after:	2 months
2023-11-04 13:07:31 -04:00
Konstantin Belousov d093fe94e1 Fix typo
Fixes:	967022aa5a
MFC after:	1 week
2023-11-04 18:48:25 +02:00
Konstantin Belousov 967022aa5a arm64: improve UVA layout for 32bit processes
Add compat.aarch32 tunables for maxssiz, maxdsiz, and maxvmem.
Set the default values same as for amd64.
Fix freebsd32 sysentvec on arm64 to provide sv_maxssiz, and sv_fixlimit.

PR:	274705
Reviewed by:	markj
Tested by:	fuz
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42451
2023-11-04 18:47:50 +02:00
Alexander Motin 939a62d673 stand/zfs: Remove read-compatible features
These features are marked as ZFEATURE_FLAG_READONLY_COMPAT and so
irrelevant for read-only pool imports by the loader:

	"com.datto:resilver_defer",
	"com.delphix:obsolete_counts",
	"com.delphix:spacemap_histogram",
	"com.delphix:zpool_checkpoint",
	"com.intel:allocation_classes",
	"org.zfsonlinux:allocation_classes"

This should cause no functional changes, just a code cleanup.

MFC after:	2 months
2023-11-04 12:26:25 -04:00
Daniel Engberg 105e5f55ae share/examples/etc/make.conf: Add AMD Zen 4 to list
Add AMD Zen 4 (znver4) to the list of valid "Intel x86 CPU types"

Reviewed by:	emaste
Approved by:	emaste
Differential Revision:	https://reviews.freebsd.org/D41518
2023-11-04 16:28:56 +01:00
Mark Johnston deacab7560 reboot: Avoid unlocking Giant if the scheduler is stopped
When the scheduler is stopped, mtx_unlock() turns into a no-op, so the
loop

    while (mtx_owned(&Giant))
	    mtx_unlock(&Giant);

runs forever if the calling thread has Giant locked.

Reviewed by:	mhorne
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D42460
2023-11-04 10:48:58 -04:00
Mark Johnston bd80263606 pfsync: Avoid transmitting uninitialized bytes in pfsync_sendout()
When IPv6 support was added to pfsync, PFSYNC_MINPKT increased such that
we always allocate enough space for either IPv4 or IPv6 headers.  IPv6
headers are 20 bytes larger than IPv4 headers.  When pfsync_sendout()
does its thing, it ends up allocating enough space for either; thus when
transmitting an IPv4 packet, the last 20 bytes of the buffer are left
uninitialized.

Fix the problem by stashing the length in a local variable and adjusting
it depending on the address family in use.

While here, just zero the entire buffer in one go rather than being
careful to initialize each subheader.  This seems simpler and less error
prone.

Reported by:	KMSAN
Reviewed by:	kp
Fixes:		6fc7fc2dbb ("pfsync: transport over IPv6")
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D42461
2023-11-04 10:28:24 -04:00
Mark Johnston 346134f19a kmsan: Correct the origin address in kmsan_shadow_check()
Otherwise a KMSAN report (which panics the system by default) could
trigger a recursive panic.

MFC after:	1 week
Fixes:	ca6cd604c8 ("kmsan: Use the correct origin bytes in kmsan_check_arg()")
2023-11-04 10:28:13 -04:00
Michael Tuexen 4ffe410e40 if_tuntap: improve code consistency
No functional change intended.

Reviewed by:		rscheff
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D42462
2023-11-04 10:22:42 +01:00
Jake Freeland b0203aaa46 committers-src: Add Jake Freeland
Add myself to the active src committers list and document my
mentor/mentee relationships.
2023-11-03 19:04:17 -05:00
R. Christian McDonald 98fd69f009 rtld/arm: fix initial-exec (IE) thread-local storage relocation
net/frr[89] revealed an interesting edge-case on arm when dynamically
linking a shared library that declares more than one static TLS variable
with at least one  using the "initial-exec" TLS model. In the case
of frr[89], this library was libfrr.so which essentially does the
following:

	#include <stdio.h>

	#include "lib.h"

	static __thread int *a
		__attribute__((tls_model("initial-exec")));

	void lib_test()
	{
		static __thread int b = -1;

		printf("&a = %p\n", &a);
		printf(" a = %p\n", a);

		printf("\n");

		printf("&b = %p\n", &b);
		printf(" b = %d\n", b);
	}

Allocates a file scoped `static __thread` pointer with
tls_model("initial-exec") and later a block scoped TLS int. Notice in
the above minimal reproducer, `b == -1`. The relocation process does
the wrong thing and ends up pointing both `a` and `b` at the same place
in memory.

The output of the above in the broken state is:

	&a = 0x4009c018
	 a = 0xffffffff

	&b = 0x4009c018
	 b = -1

With the patch applied, the output becomes:

	&a = 0x4009c01c
	 a = 0x0

	&b = 0x4009c018
	 b = -1

Reviewed by:	kib
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D42415/
2023-11-03 22:43:40 +01:00
Bjoern A. Zeeb 6c3ae01cc7 net80211: add ieee80211_add_vhtcap_ch()
Add an implementation of ieee80211_add_vhtcap() which works based on
information derived from the vap (and possibly channel/band but we do
not support that yet in net80211).  This is needed for scans request
information in LinuxKPI at times before we have a BSS.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	adrian, cc
Differential Revision: https://reviews.freebsd.org/D42422
2023-11-03 21:08:04 +00:00