]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 months agoRELNOTES: bump version to 15.0
Christos Margiolis [Mon, 6 Nov 2023 15:36:33 +0000 (17:36 +0200)]
RELNOTES: bump version to 15.0

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D42478

7 months agoloader.efi.8: Fix style warnings
Benedict Reuschling [Mon, 6 Nov 2023 14:45:20 +0000 (14:45 +0000)]
loader.efi.8: Fix style warnings

This is a follow-up commit to bce728719e7f57272d99b6d039f10b4c636fa024
to address mandoc(1) warnings.

7 months agolibpfctl: handle the 'pfctl' netlink family not being supported
Kristof Provost [Mon, 6 Nov 2023 10:57:35 +0000 (11:57 +0100)]
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")

7 months agoAdd paragraph documenting loader.env functionlity
Guido Falsi [Mon, 6 Nov 2023 12:11:26 +0000 (13:11 +0100)]
Add paragraph documenting loader.env functionlity

Approved by: docs (carlavilla)
Differential Revision: https://reviews.freebsd.org/D42476

7 months agoxen-netfront: attempt to make cleanup idempotent
Roger Pau Monné [Fri, 3 Nov 2023 09:28:16 +0000 (10:28 +0100)]
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: 96375eac945c ("xen-netfront: add multiqueue support")
Sponsored by: Citrix Systems R&D

7 months agoxen: fix initialization of grant table frame array
Roger Pau Monné [Thu, 2 Nov 2023 17:23:25 +0000 (18:23 +0100)]
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: 30d1eefe3937 ("Import OS interfaces to Xen services.")
Sponsored by: Citrix Systems R&D

7 months agosctp: minor clean
Michael Tuexen [Mon, 6 Nov 2023 10:04:15 +0000 (11:04 +0100)]
sctp: minor clean

No functional change intended.
MFC after: 1 week

7 months agoshare/mk: Fix .TARGET override documentation
Ka Ho Ng [Sun, 5 Nov 2023 21:27:59 +0000 (16:27 -0500)]
share/mk: Fix .TARGET override documentation

Fixes: 48da57b47ff14
Sponsored by: Juniper Networks, Inc.
MFC after: 3 days
Reviewed by: imp, delphij, emaste
Differential Revision: https://reviews.freebsd.org/D42469

7 months agoif_tuntap: trigger the bpf hook on transmitting for the tap interface
Michael Tuexen [Sun, 5 Nov 2023 19:32:46 +0000 (20:32 +0100)]
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

7 months agoudplite: make socketoption available on IPv6 sockets
Michael Tuexen [Sun, 5 Nov 2023 14:28:54 +0000 (15:28 +0100)]
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

7 months agotcp rack: remove references to rb trees
Michael Tuexen [Sun, 5 Nov 2023 14:21:06 +0000 (15:21 +0100)]
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

7 months agogrep: don't rely on implementation-defined malloc(0) behavior
Kyle Evans [Sun, 5 Nov 2023 02:08:36 +0000 (21:08 -0500)]
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

7 months agocrashinfo: remove unused /usr/bin/gdb support
Ed Maste [Tue, 8 Mar 2022 14:32:24 +0000 (09:32 -0500)]
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

7 months agomountd: Add support for spaces in exported directories
Dan Mcgregor [Sat, 4 Nov 2023 22:07:56 +0000 (15:07 -0700)]
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

7 months agotty: set IUTF8 by default
Christos Margiolis [Sat, 4 Nov 2023 20:31:47 +0000 (22:31 +0200)]
tty: set IUTF8 by default

128f63cedc14 and 9e589b093857 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

7 months agobsd.progs.mk must pass META_XTRAS to gendirdeps.mk
Simon J. Gerraty [Sat, 4 Nov 2023 17:16:33 +0000 (10:16 -0700)]
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

7 months agovfs_lookup_cross_mount(): restore previous do...while loop
Jason A. Harmening [Sat, 4 Nov 2023 16:56:45 +0000 (11:56 -0500)]
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: 80bd5ef0702562c546fa1717e8fe221058974eac
MFC after: 1 week

7 months agostand/zfs: Remove one more read-compatible feature
Alexander Motin [Sat, 4 Nov 2023 17:04:33 +0000 (13:04 -0400)]
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

7 months agoFix typo
Konstantin Belousov [Sat, 4 Nov 2023 16:48:25 +0000 (18:48 +0200)]
Fix typo

Fixes: 967022aa5aa60a18764a668ae0fb78e39e16fa8e
MFC after: 1 week

7 months agoarm64: improve UVA layout for 32bit processes
Konstantin Belousov [Wed, 25 Oct 2023 01:03:09 +0000 (04:03 +0300)]
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

7 months agostand/zfs: Remove read-compatible features
Alexander Motin [Sat, 4 Nov 2023 16:26:25 +0000 (12:26 -0400)]
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

7 months agoshare/examples/etc/make.conf: Add AMD Zen 4 to list
Daniel Engberg [Sat, 4 Nov 2023 15:28:46 +0000 (16:28 +0100)]
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

7 months agoreboot: Avoid unlocking Giant if the scheduler is stopped
Mark Johnston [Sat, 4 Nov 2023 14:48:58 +0000 (10:48 -0400)]
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

7 months agopfsync: Avoid transmitting uninitialized bytes in pfsync_sendout()
Mark Johnston [Sat, 4 Nov 2023 14:28:24 +0000 (10:28 -0400)]
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: 6fc7fc2dbb2b ("pfsync: transport over IPv6")
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42461

7 months agokmsan: Correct the origin address in kmsan_shadow_check()
Mark Johnston [Fri, 3 Nov 2023 19:37:09 +0000 (15:37 -0400)]
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: ca6cd604c8fc ("kmsan: Use the correct origin bytes in kmsan_check_arg()")

7 months agoif_tuntap: improve code consistency
Michael Tuexen [Sat, 4 Nov 2023 09:22:42 +0000 (10:22 +0100)]
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

7 months agocommitters-src: Add Jake Freeland
Jake Freeland [Fri, 3 Nov 2023 16:14:21 +0000 (11:14 -0500)]
committers-src: Add Jake Freeland

Add myself to the active src committers list and document my
mentor/mentee relationships.

7 months agortld/arm: fix initial-exec (IE) thread-local storage relocation
R. Christian McDonald [Fri, 3 Nov 2023 12:56:58 +0000 (13:56 +0100)]
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/

7 months agonet80211: add ieee80211_add_vhtcap_ch()
Bjoern A. Zeeb [Thu, 26 Oct 2023 20:55:59 +0000 (20:55 +0000)]
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

7 months agonet80211: migrate ic_vhtcaps, ic_vht_mcsinfo, ic_flags_vht
Bjoern A. Zeeb [Fri, 27 Oct 2023 18:44:02 +0000 (18:44 +0000)]
net80211: migrate ic_vhtcaps, ic_vht_mcsinfo, ic_flags_vht

Like for the VAP rename ic_flags_vht to ic_vht_flags for consistency to
keep "VHT" fields together and merge ic_vhtcaps and ic_vht_mcsinfo
into struct ieee80211_vht_cap ic_vht_cap.

While the structure layout changes no other functional changes intended.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: adrian, cc
Differential Revision: https://reviews.freebsd.org/D42421

7 months agonet80211: combine iv_vhtcaps and iv_vht_mcsinfo
Bjoern A. Zeeb [Fri, 27 Oct 2023 18:33:22 +0000 (18:33 +0000)]
net80211: combine iv_vhtcaps and iv_vht_mcsinfo

The iv_vhtcaps and iv_vht_mcsinfo fields together form
struct ieee80211_vht_cap so combine them into one field in the VAP
and keep the information together.

While the structure layout changes no other functional changes intended.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: adrian, cc
Differential Revision: https://reviews.freebsd.org/D42420

7 months agonet80211: rename iv_flags_vht to iv_vht_flags
Bjoern A. Zeeb [Fri, 27 Oct 2023 18:18:24 +0000 (18:18 +0000)]
net80211: rename iv_flags_vht to iv_vht_flags

While the flag field is internal start naming it as well as "iv_vht*"
so we keep all "VHT" fields together.  This breaks with what was done
done for HT but with HE, EHT, .. coming one day seems the more logic
choice.

No functional changes intended.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: adrian, cc
Differential Revision: https://reviews.freebsd.org/D42419

7 months agoLinuxKPI: 802.11: zero-pad debug flags
Bjoern A. Zeeb [Sat, 28 Oct 2023 18:43:43 +0000 (18:43 +0000)]
LinuxKPI: 802.11: zero-pad debug flags

Write the debug flags as full 32bit hex numbers to have a better
view on them.

No functional changes.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: cc, emaste
Differential Revision: https://reviews.freebsd.org/D42426

7 months agoLinuxKPI: 802.11: deal with scan_ie_len
Bjoern A. Zeeb [Fri, 27 Oct 2023 20:41:43 +0000 (20:41 +0000)]
LinuxKPI: 802.11: deal with scan_ie_len

We only need to reserve the extra space for DSSS if
NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES is set, so add the conditional.
Also add checks in case scan_ie_len will grow beyond the maximum.
Given this is currently unlikely, leave the cleanup for later as
some other restructuring should be done first.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: cc
Differential Revision: https://reviews.freebsd.org/D42425

7 months agoLinuxKPI: 802.11: fix ieee80211_add_channel_cbw() argument
Bjoern A. Zeeb [Thu, 26 Oct 2023 00:11:43 +0000 (00:11 +0000)]
LinuxKPI: 802.11: fix ieee80211_add_channel_cbw() argument

Fix the last argument passed to ieee80211_add_channel_cbw() in
lkpi_ic_getradiocaps() for both 2Ghz and 5Ghz bands.
We passed in the unmodified version rather than the adjusted version
based on the per-band channel information possibly leaving
ieee80211_channel_flags enabled which should not be.

So far this should not have made a difference given we did not enable
HT or VHT.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: cc
Differential Revision: https://reviews.freebsd.org/D42424

7 months agoLinuxKPI: 802.11: error on state transition failure
Bjoern A. Zeeb [Wed, 25 Oct 2023 22:29:35 +0000 (22:29 +0000)]
LinuxKPI: 802.11: error on state transition failure

The state transition failures we were seeing in the early days are
solved.  If we now experience one stop processing before passing
over to net80211 (sta_newstate()) and before updating iv_state on
the vap.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: cc
Differential Revision: https://reviews.freebsd.org/D42423

7 months agoTrack upstream project rename in contrib/blocklistd
Ed Maste [Tue, 11 Oct 2022 19:27:51 +0000 (15:27 -0400)]
Track upstream project rename in contrib/blocklistd

Upstream is now https://github.com/zoulasc/blocklist/.  Rename the
contrib directory and update Makefiles to match, in advance of the next
vendor branch update.

Sponsored by: The FreeBSD Foundation

7 months agopowerpc: Fix inconsistent Altivec handling in set_mcontext
Shawn Anastasio [Fri, 3 Nov 2023 17:40:18 +0000 (14:40 -0300)]
powerpc: Fix inconsistent Altivec handling in set_mcontext

When support for fpu_kern_enter/fpu_kern_leave was added to powerpc,
set_mcontext was updated to handle Altivec state restoration in the same
way that the FPU state by lazily restoring the context on the first
trap. However the function was not correctly updated to unconditionally
clear the PCB_VEC and PSL_VEC bits from the pcb's flags and srr1
respectively which can sometimes result in a mismatch between a
process's MSR[VEC] state and its pcb_flags.

Fix this by simply clearing the VEC flags unconditionally in
set_mcontext, which is already done for FPU/VSX.

Fixes: a6662c37b6ffe ("powerpc: Implement fpu_kern_enter/fpu_kern_leave")
Reviewed by: alfredo
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D42417

7 months agofflush: Split a temporary variable in two.
Dag-Erling Smørgrav [Thu, 3 Aug 2023 15:08:03 +0000 (15:08 +0000)]
fflush: Split a temporary variable in two.

It is clearer to avoid reusing temporary variables for different
purposes.

Sponsored by: Klara, Inc.

7 months agopci_vendors: update to 2023-09-22
Baptiste Daroussin [Fri, 3 Nov 2023 16:32:35 +0000 (17:32 +0100)]
pci_vendors: update to 2023-09-22

7 months agocam: Minor tidying up the cam module Makefile
Warner Losh [Thu, 2 Nov 2023 20:41:17 +0000 (14:41 -0600)]
cam: Minor tidying up the cam module Makefile

One src per line + sorting.

Sponsored by: Netflix

7 months agocam: Make cam_debug macros atomic
Warner Losh [Thu, 2 Nov 2023 20:41:09 +0000 (14:41 -0600)]
cam: Make cam_debug macros atomic

The CAM_DEBUG* macros use multiple printfs to dump the data. This is
suboptimal when tracing things that produce even a moderate amount since
it gets intertwingled. I can't even turn on tracing with a 24-disk HBA
on boot without it getting messed up. Add helper routines to work around
clang's over-use of the stack: that way we only pay the stack penalty
when a trace hits.

Sponsored by: Netflix
Reviewed by: ken, mav
Differential Revision: https://reviews.freebsd.org/D42411

7 months agompsutil: Add higher PCIe speeds.
Alexander Motin [Fri, 3 Nov 2023 15:49:59 +0000 (11:49 -0400)]
mpsutil: Add higher PCIe speeds.

There are already PCIe Gen4 HBAs, reported improperly.

MFC after: 1 week

7 months agoriscv: Update a variable name to match a comment
Mark Johnston [Fri, 3 Nov 2023 13:34:11 +0000 (09:34 -0400)]
riscv: Update a variable name to match a comment

This makes pmap_insert_pt_page() consistent with arm64 and amd64.  No
functional change intended.

Reported by: alc
Fixes: 7703ac2e983b ("riscv: Port improvements from arm64/amd64 pmaps, part 1")

7 months agopkgbase: force OSVERSION
Baptiste Daroussin [Fri, 3 Nov 2023 08:29:23 +0000 (09:29 +0100)]
pkgbase: force OSVERSION

This is used to the package annotation helping pkg to know about
backward compatibility is set to the version of the packages not
the version of the host building the packages

7 months agopkgbase: set a default set of kernel for when PACKAGE_BUILDING=1
Baptiste Daroussin [Thu, 2 Nov 2023 13:20:11 +0000 (14:20 +0100)]
pkgbase: set a default set of kernel for when PACKAGE_BUILDING=1

PACKAGE_BUILDING is already known in the ports tree as a variable
use to defined when the packages is being actually built in an
automation process, reuse that variable to define the default set
of kernel we plan to build for the default pkgbase.

Reviewed by: manu, jrtc27
Accepted by: manu
MFC After: 1 week
Differential Revision: https://reviews.freebsd.org/D42444

7 months agoASan: Add asan_static to build
SHENG-YI HONG [Fri, 3 Nov 2023 07:02:26 +0000 (15:02 +0800)]
ASan: Add asan_static to build

This is a partial fix for building with -DWITH_ASAN.

Reviewed by: Fangrui Song, dim, emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42388

7 months agoveriexec: Simplify the initialization of loader tunable
Zhenlei Huang [Fri, 3 Nov 2023 04:08:27 +0000 (12:08 +0800)]
veriexec: Simplify the initialization of loader tunable

The loader tunable 'security.mac.veriexec.block_unlink' has been
already flagged with CTLFLAG_RDTUN, no need to re-fetch it with
TUNABLE_INT_FETCH.

While here move the definition of sysctl knob out of function body,
which is more common in FreeBSD.

No functional change intended.

Reviewed by: stevek
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42132

7 months agoloader: add target for dirdeps build
Stephen J. Kiernan [Thu, 2 Nov 2023 23:33:45 +0000 (19:33 -0400)]
loader: add target for dirdeps build

Update dependencies for the loader variations used for each
architecture.

Reviewed by: sjg
Differential Revision: https://reviews.freebsd.org/D39741

7 months agokrpc: Display stats of TLS usage
Rick Macklem [Thu, 2 Nov 2023 21:07:01 +0000 (14:07 -0700)]
krpc: Display stats of TLS usage

This patch adds some sysctls:
kern.rpc.unenc.tx_msgcnt
kern.rpc.unenc.tx_msgbytes
kern.rpc.unenc.rx_msgcnt
kern.rpc.unenc.rx_msgbytes
kern.rpc.tls.tx_msgcnt
kern.rpc.tls.tx_msgbytes
kern.rpc.tls.rx_msgcnt
kern.rpc.tls.rx_msgbytes
kern.rpc.tls.handshake_success
kern.rpc.tls.handshake_failed
kern.rpc.tls.alerts
which allow a NFS server sysadmin to determine how much
NFS-over-TLS is being used.  A large number of failed
handshakes might also indicate an NFS confirguration
problem.

This patch moves the definition of "kern.rpc" from the
kgssapi module to the krpc module.  As such, both modules
need to be rebuilt from sources.  Since __FreeBSD_version
was bumped yesterday, I will not bump it again.

Suggested by: gwollman
Discussed on: freebsd-current
MFC after: 1 month

7 months agoblacklistd: Handle fds that are pointing to routing sockets
Jose Luis Duran [Wed, 12 Oct 2022 16:14:44 +0000 (13:14 -0300)]
blacklistd: Handle fds that are pointing to routing sockets

If the fd has access to make changes via the routing socket, grant full
permission to make filter changes.

Obtained from: https://github.com/zoulasc/blocklist/commit/1b9475b2c8e0be2b9adc4d88e521ed488ac3c43c

7 months agograid3: Fix teardown races
Mark Johnston [Thu, 2 Nov 2023 18:35:37 +0000 (14:35 -0400)]
graid3: Fix teardown races

Port commit dc399583ba09 from g_mirror, which has an effectively
identical startup sequence.

This fixes a race that was occasionally causing panics during GEOM test
suite runs on riscv.

MFC after: 1 month

7 months agoriscv: Remove unnecessary invalidations in pmap_enter_quick_locked()
Mark Johnston [Thu, 2 Nov 2023 18:34:26 +0000 (14:34 -0400)]
riscv: Remove unnecessary invalidations in pmap_enter_quick_locked()

This function always overwrites an invalid PTE, so if
pmap_try_insert_pv_entry() fails it is certainly not necessary to
invalidate anything, because the PTE has not yet been written by that
point.

It should also not be necessary to invalidate TLBs after overwriting an
invalid entry.  In principle the TLB could cache negative entries, but
then the worst case scenario is a spurious fault.  Since pmap_enter()
does not bother issuing an sfence.vma, pmap_enter_quick_locked() should
behave similarly.

Reviewed by: kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D42291

7 months agoriscv: Port improvements from arm64/amd64 pmaps, part 3
Mark Johnston [Thu, 2 Nov 2023 18:34:07 +0000 (14:34 -0400)]
riscv: Port improvements from arm64/amd64 pmaps, part 3

- Let pmap_enter_quick_locked() trigger superpage promotions.

Reviewed by: kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D42290

7 months agoriscv: Port improvements from arm64/amd64 pmaps, part 2
Mark Johnston [Thu, 2 Nov 2023 18:33:55 +0000 (14:33 -0400)]
riscv: Port improvements from arm64/amd64 pmaps, part 2

- Give pmap_promote_l2() a return value indicating whether or not
  promotion succeeded.
- Check pmap_ps_enabled() in pmap_promote_l2() rather than making
  callers do it.
- Annotate superpages_enabled with __read_frequently.

Reviewed by: kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D42289

7 months agoriscv: Port improvements from arm64/amd64 pmaps, part 1
Mark Johnston [Thu, 2 Nov 2023 18:33:37 +0000 (14:33 -0400)]
riscv: Port improvements from arm64/amd64 pmaps, part 1

- When promoting, do not require that all PTEs all have PTE_A set.
  Instead, record whether they did and store this information in the
  PTP's valid bits.
- Synchronize some comments in pmap_promote_l2().
- Make pmap_promote_l2() scan starting from the end of the 2MB range
  instead of the beginning.  See the commit log for 9d1b7fa31f510 for
  justification of this, which I believe applies here as well.

Reviewed by: kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D42288

7 months agoriscv: Retire PMAP_INLINE
Mark Johnston [Thu, 2 Nov 2023 18:33:20 +0000 (14:33 -0400)]
riscv: Retire PMAP_INLINE

pmap_kremove() is not called from within pmap.c, so there's no reason to
inline it.  No functional change intended.

Reviewed by: alc, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42287

7 months agoamd64: Remove PMAP_INLINE
Mark Johnston [Thu, 2 Nov 2023 18:30:10 +0000 (14:30 -0400)]
amd64: Remove PMAP_INLINE

With clang it expands to "inline"; clang in practice may inline
externally visible functions even without the hint.  So just remove the
hints and let the compiler decide.

No functional change intended.  pmap.o is identical before and after
this patch.

Reviewed by: alc
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42446

7 months agoino64: Fix incremental builds
Warner Losh [Thu, 2 Nov 2023 18:06:19 +0000 (12:06 -0600)]
ino64: Fix incremental builds

These files were removed, so we need to fix up depends for WITHOUT_CLEAN
builds (the default). Metamode builds aren't affected.

Sponsored by: Netflix
Feedback from: emaste
Tested by: Pierre Pronchery
Differential Revision: https://reviews.freebsd.org/D42433

7 months agoarm: Update declarations for arm_dcache_align{,_mask}
Mark Johnston [Thu, 2 Nov 2023 16:23:51 +0000 (12:23 -0400)]
arm: Update declarations for arm_dcache_align{,_mask}

Reported by: Jenkins
Fixes: 3d8f548b9e57 ("uma: Make the cache alignment mask unsigned")

7 months agobhyve(8): fix manpage formatting
Dan McGregor [Thu, 2 Nov 2023 14:50:10 +0000 (10:50 -0400)]
bhyve(8): fix manpage formatting

In commit 67c26eb2a57 a stray ".El" was introduced, breaking
formatting of options.

Reviewed by: corvink, markj
Fixes: 67c26eb2a57c ("bhyve: add cmdline option for TPM emulation")
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42434

7 months agoEnsure 'struct thread' is aligned to a cache line
Olivier Certner [Fri, 13 Oct 2023 08:52:31 +0000 (10:52 +0200)]
Ensure 'struct thread' is aligned to a cache line

Using the new UMA_ALIGN_CACHE_AND_MASK() facility, which allows to
simultaneously guarantee a minimum of 32 bytes of alignment (the 5 lower
bits are always 0).

For the record, to this day, here's a (possibly non-exhaustive) list of
synchronization primitives using lower bits to store flags in pointers
to thread structures:
- lockmgr, rwlock and sx all use the 5 bits directly.
- rmlock indirectly relies on sx, so can use the 5 bits.
- mtx (non-spin) relies on the 3 lower bits.

Reviewed by:            markj, kib
MFC after:              2 week
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D42266

7 months agouma: Permit specifying max of cache line and some custom alignment
Olivier Certner [Fri, 13 Oct 2023 15:05:34 +0000 (17:05 +0200)]
uma: Permit specifying max of cache line and some custom alignment

To be used for structures for which we want to enforce that pointers to
them have some number of lower bits always set to 0, while still
ensuring we benefit from cache line alignment to avoid false sharing
between structures and fields within the structures (provided they are
properly ordered).

First candidate consumer that comes to mind is 'struct thread', see next
commit.

Reviewed by:            markj, kib
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D42265

7 months agolinuxkpi: dma_get_cache_alignment(): Fix off-by-one result
Olivier Certner [Fri, 13 Oct 2023 15:13:28 +0000 (17:13 +0200)]
linuxkpi: dma_get_cache_alignment(): Fix off-by-one result

Substituting 'uma_align_cache' by the appropriately named accessor
uma_get_cache_align_mask() made apparent that dma_get_cache_alignment()
was off by one, since it was defined to be the mask derived from the
alignment value.

Reviewed by:            markj, bz
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D42264

7 months agouma: New check_align_mask(): Validate alignments (INVARIANTS)
Olivier Certner [Fri, 13 Oct 2023 14:09:51 +0000 (16:09 +0200)]
uma: New check_align_mask(): Validate alignments (INVARIANTS)

New function check_align_mask() asserts (under INVARIANTS) that the mask
fits in a (signed) integer (see the comment) and that the corresponding
alignment is a power of two.

Use check_align_mask() in uma_set_align_mask() and also in uma_zcreate()
to replace the KASSERT() there (that was checking only for a power of
2).

Reviewed by:            kib, markj
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D42263

7 months agouma: Make the cache alignment mask unsigned
Olivier Certner [Fri, 13 Oct 2023 12:49:11 +0000 (14:49 +0200)]
uma: Make the cache alignment mask unsigned

In uma_set_align_mask(), ensure that the passed value doesn't have its
highest bit set, which would lead to problems since keg/zone alignment
is internally stored as signed integers.  Such big values do not make
sense anyway and indicate some programming error.  A future commit will
introduce checks for this case and other ones.

Reviewed by:            kib, markj
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D42262

7 months agoarm: Simplify get_cachetype_cp15()
Olivier Certner [Fri, 13 Oct 2023 12:22:14 +0000 (14:22 +0200)]
arm: Simplify get_cachetype_cp15()

There's no point in setting 'arm_dcache_align_mask' before the
function's end.

Reviewed by:            markj, kib
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D42261

7 months agouma: UMA_ALIGN_CACHE: Resolve the proper value at use point
Olivier Certner [Fri, 13 Oct 2023 12:13:30 +0000 (14:13 +0200)]
uma: UMA_ALIGN_CACHE: Resolve the proper value at use point

Having a special value of -1 that is resolved internally to
'uma_align_cache' provides no significant advantages and prevents
changing that variable to an unsigned type, which is natural for an
alignment mask.  So suppress it and replace its use with a call to
uma_get_align_mask().  The small overhead of the added function call is
irrelevant since UMA_ALIGN_CACHE is only used when creating new zones,
which is not performance critical.

Reviewed by:            markj, kib
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D42259

7 months agouma: Hide 'uma_align_cache'; Create/rename accessors
Olivier Certner [Fri, 13 Oct 2023 09:52:28 +0000 (11:52 +0200)]
uma: Hide 'uma_align_cache'; Create/rename accessors

Create the uma_get_cache_align_mask() accessor and put it in a separate
private header so as to minimize namespace pollution in header/source
files that need only this function and not the whole 'uma.h' header.

Make sure the accessors have '_mask' as a suffix, so that callers are
aware that the real alignment is the power of two that is the mask plus
one.  Rename the stem to something more explicit.  Rename
uma_set_cache_align_mask()'s single parameter to 'mask'.

Hide 'uma_align_cache' to ensure that it cannot be set in any other way
then by a call to uma_set_cache_align_mask(), which will perform sanity
checks in a further commit.  While here, rename it to
'uma_cache_align_mask'.

This is also in preparation for some further changes, such as improving
the sanity checks, eliminating internal resolving of UMA_ALIGN_CACHE and
changing the type of the 'uma_cache_align_mask' variable.

Reviewed by:            markj, kib
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D42258

7 months agoEnsure "init" (PID 1) also executes userret() initially
Olivier Certner [Tue, 10 Oct 2023 17:36:20 +0000 (19:36 +0200)]
Ensure "init" (PID 1) also executes userret() initially

Calling userret() from fork_return() misses the first return to
userspace of the "init" (PID 1) process.  The latter is indeed created
by fork1() followed by a call to cpu_fork_kthread_handler() call that
replaces fork_return() by start_init() as the function to execute after
fork.

A new process' initial return to userspace in the end always happens
through returning from fork_exit(), so move userret() there instead to
fix the omission.

This problem was discovered as part of a revamp of scheduling priorities
that lead to experimenting with asserting and sometimes resetting
priorities in sched_userret(), in the course of which the author
stumbled on panics being triggered only in init() or only in other
processes, depending on the modifications to sched_userret().  This
change currently has no practical effect but will have some in the near
future.

Reviewed by:            markj, kib
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D42257

7 months agopdinit(): Fix comment
Olivier Certner [Tue, 26 Sep 2023 10:26:46 +0000 (12:26 +0200)]
pdinit(): Fix comment

Reviewed by:            markj, kib
MFC after:              1 week
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D42256

7 months agoOpen-code proc_set_cred_init()
Olivier Certner [Mon, 25 Sep 2023 08:48:49 +0000 (10:48 +0200)]
Open-code proc_set_cred_init()

This function is to be called only when initializing a new process (so,
'proc0' and at fork), and not in any other circumstances.  Setting the
process' 'p_ucred' field to the result of crcowget() on the original
credentials is the only thing it does, hiding the fact that the process'
'p_ucred' field is crushed by the call.  Moreover, most of the code it
executes is already encapsulated in crcowget().

To prevent misuse and improve code readability, just remove this
function and replace it with a direct assignment to 'p_ucred'.

Reviewed by:            markj (earlier version), kib
MFC after:              1 week
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D42255

7 months agoHyper-V: vmbus: Add NULL check for vmbus_res
Zhenlei Huang [Thu, 2 Nov 2023 09:07:11 +0000 (17:07 +0800)]
Hyper-V: vmbus: Add NULL check for vmbus_res

QEMU emulates Hyper-V [1] but lacks the emulation for vmbus_res, thus no
coherence information is available. Add NULL check for it and fallback
to no coherence. This will prevent FreeBSD guests from panic on QEMU
with the Hyper-V enlightenment hv-synic enabled.

For real Hyper-V, both gen1 and gen2 have vmbus_res then they are not
affected by this change.

1. https://www.qemu.org/docs/master/system/i386/hyperv.html

PR: 274810
Reviewed by: mhorne, emaste, delphij, whu
Diagnosed by: mhorne
Fixes: e7a9817b8d32 Hyper-V: vmbus: implementat bus_get_dma_tag in vmbus
Insta-MFC approved by: re (delphij) for 14.0-RC4
Differential Revision: https://reviews.freebsd.org/D42414

7 months agohmt(4): Do not require input report HID usages to be a member of TLC
Vladimir Kondratyev [Thu, 2 Nov 2023 06:20:20 +0000 (09:20 +0300)]
hmt(4): Do not require input report HID usages to be a member of TLC

Some touchpads places button usages (in HID report descriptor) in to
the 2-nd level collection rather than in to the top level one. That
confuses current code. Remove collection level check in HID report
descriptor parser to fix device detection.

Reported by: Peter Much <pmc@citylink.dinoex.sub.org>
PR: 267094
MFC after: 1 week

7 months agoevdev: Sync event codes with Linux kernel 6.5
Vladimir Kondratyev [Thu, 2 Nov 2023 06:20:20 +0000 (09:20 +0300)]
evdev: Sync event codes with Linux kernel 6.5

MFC after: 1 week

7 months agocam/ata: Postpone removal of two compat sysctls until 15
Zhenlei Huang [Thu, 2 Nov 2023 05:14:40 +0000 (13:14 +0800)]
cam/ata: Postpone removal of two compat sysctls until 15

Prefer UNMAPPEDIO and ROTATING from flags sysctl. See
 1. aeab0812e68c (Add flags sysctl to ada)
 2. cf3ff63e55e4 (Convert unmappedio over to a flag)
 3. 96eb32bf0f5a (Convert rotating to a flag bit)

Reviewed by: imp, ken, #cam
MFC after: immediately (we want this in 14.0)
Differential Revision: https://reviews.freebsd.org/D42402

7 months agolibc: Purge unneeded cdefs.h
Warner Losh [Wed, 1 Nov 2023 22:43:37 +0000 (16:43 -0600)]
libc: Purge unneeded cdefs.h

These sys/cdefs.h are not needed. Purge them. They are mostly left-over
from the $FreeBSD$ removal. A few in libc are still required for macros
that cdefs.h defines. Keep those.

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

7 months agoip_var.h: align comment style
Igor Ostapenko [Wed, 1 Nov 2023 12:21:16 +0000 (14:21 +0200)]
ip_var.h: align comment style

MFC after: 2 weeks
Reviewed by: kp
Pull Request: https://github.com/freebsd/freebsd-src/pull/883

7 months agoRemove MOVED_LIBS handling from list-old-libs
Ed Maste [Mon, 16 Oct 2023 12:46:31 +0000 (08:46 -0400)]
Remove MOVED_LIBS handling from list-old-libs

In 922337e8d398 I added MOVED_LIBS into list-old-files, so that
delete-old-files would remove the old /usr/lib/libc++.so.1 as soon as
possible (after the library moved to /lib).

I left it in list-old-libs in case a user updated their src tree between
delete-old-files and delete-old-libs.  Now that some time has passed,
tremove the redundant MOVED_LIBS entry.

PR: 272642
Sponsored by: The FreeBSD Foundation

7 months agoudplite: fix checksum computation on the sender side
Michael Tuexen [Wed, 1 Nov 2023 09:24:56 +0000 (10:24 +0100)]
udplite: fix checksum computation on the sender side

Don't fill the fields of the UDP/IP header not used for the
checksum computation before performing the checksum computation.

Reviewed by: glebius
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42275

7 months agozfs: merge openzfs/zfs@41e55b476
Martin Matuska [Wed, 1 Nov 2023 09:12:47 +0000 (10:12 +0100)]
zfs: merge openzfs/zfs@41e55b476

Notable upstream pull request merges:
 #15366 c3773de1 ZIL: Cleanup sync and commit handling
 #15409 dbe839a9 zvol: Cleanup set property
 #15409 60387fac zvol: Implement zvol threading as a Property
 #15409 9ccdb8be zvol: fix delayed update to block device ro entry
 #15448 05a7348a RAIDZ: Use cache blocking during parity math
 #15452 514d661c Tune zio buffer caches and their alignments
 #15456 799e09f7 Unify arc_prune_async() code
 #15465 763ca47f Fix block cloning between unencrypted and encrypted
                 datasets

To make the module version better comparable, the module version number
now includes the commit count since last tag.

Obtained from: OpenZFS
OpenZFS commit: 41e55b476bcfc90f1ad81c02c5375367fdace9e9

7 months agovfs: remove majority of stale commentary about free list
Mateusz Guzik [Wed, 1 Nov 2023 08:28:28 +0000 (08:28 +0000)]
vfs: remove majority of stale commentary about free list

There is no "free list" for a long time now.

While here slightly tidy up affected comments in other ways.

Note that the "free vnode" term is a misnomer at best and will also need
to get sorted out.

7 months agovfs: fix a typo introdued in previous
Mateusz Guzik [Wed, 1 Nov 2023 08:29:29 +0000 (08:29 +0000)]
vfs: fix a typo introdued in previous

Reported by: pstef

7 months agovfs: bring getnewvnode manpage closer to reality
Mateusz Guzik [Wed, 1 Nov 2023 08:20:12 +0000 (08:20 +0000)]
vfs: bring getnewvnode manpage closer to reality

7 months agoparam.h: FreeBSD_version 1500003: ino64 forward compat removal
Warner Losh [Wed, 1 Nov 2023 04:22:33 +0000 (22:22 -0600)]
param.h: FreeBSD_version 1500003: ino64 forward compat removal

Bump FreeBSD_version to 1500003 to mark the removal of the forward
compat code for the inode64 conversion. This removal should be a nop.

Sponsored by: Netflix

7 months agoino64: Remove 'forward compat' code for this
Warner Losh [Tue, 31 Oct 2023 20:55:58 +0000 (14:55 -0600)]
ino64: Remove 'forward compat' code for this

Forward compatibility code was added for running newer ino64 binaries on
older kernels as a transition aide. Now that ino64 has been in the tree
6 years, this code is no longer useful and should have been removed long
ago.  Remove it now. Should be no user-visible changes at this point as
all the 'upgrade' scenarios it was intended for are long since past.

Also need to remove this stuff from rtld since the _foo versions
no longer exist.

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

7 months agoFix nfs_truncate_shares without /etc/exports.d
siv0 [Tue, 31 Oct 2023 20:57:54 +0000 (21:57 +0100)]
Fix nfs_truncate_shares without /etc/exports.d

Calling nfs_reset_shares on Linux prints a warning:
`failed to lock /etc/exports.d/zfs.exports.lock: No such file or
directory`
when /etc/exports.d does not exist. The directory gets created, when a
filesystem is actually exported through nfs_toggle_share and
nfs_init_share. The truncation of /etc/exports.d/zfs.exports happens
unconditionally when calling `zfs mount -a` (via zfs_do_mount and
share_mount in `cmd/zfs/zfs_main.c`).

Fixing the issue only in the Linux part, since the exports file on
freebsd is in `/etc/zfs/`, which seems present on 2 FreeBSD systems I
have access to (through `/etc/zfs/compatibility.d/`), while a Debian
box does not have the directory even if `/usr/sbin/exportfs` is
present through the `nfs-kernel-server` package.

The code for exports_available is copied from nfs_available above.

Fixes: ede037cda73675f42b1452187e8dd3438fafc220
("Make zfs-share service resilient to stale exports")

Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Closes #15369
Closes #15468

7 months agobhyve: ps2 implement command 0xf6
Warner Losh [Tue, 31 Oct 2023 20:03:32 +0000 (14:03 -0600)]
bhyve: ps2 implement command 0xf6

Implement PS2 Keyboard command 0xf6, which is "SET DEFAULTS". This is
the same as 0xf5 (DISABLE KEYBOARD), but without disabling the keyboard
(since that resets all the defaults as a side effect). Normally, we
clear the fifo when we re-enable the keyboard. However, since this
leaves the keyboard enabled, clear the fifo as part of this command and
send an ack.

Linux's keyboard driver sends this command on reboot. Other commands
enable / reset the kebyoard, so it doesn't matter too much this isn't
implemented for booting, eg ubuntu.

Sponsored by: Netflix
Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D42384

7 months agoFix block cloning between unencrypted and encrypted datasets
Martin Matuška [Tue, 31 Oct 2023 20:49:41 +0000 (21:49 +0100)]
Fix block cloning between unencrypted and encrypted datasets

Block cloning from an encrypted dataset into an unencrypted dataset
and vice versa is not possible. The current code did allow cloning
unencrypted files into an encrypted dataset causing a panic when
these were accessed. Block cloning between encrypted and encrypted
is currently supported on the same filesystem only.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Kay Pedersen <mail@mkwg.de>
Reviewed-by: Rob N <robn@despairlabs.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Martin Matuska <mm@FreeBSD.org>
Closes #15464
Closes #15465

7 months agoAdd IBM TS1170 density codes and specs.
Kenneth D. Merry [Tue, 31 Oct 2023 19:20:36 +0000 (15:20 -0400)]
Add IBM TS1170 density codes and specs.

These were obtained from a drive, but they agree with the IBM
documentation.

The bpi/bpmm values are the same as TS1160, but the number of
tracks is much larger (18944 tracks vs 8704 for TS1160).  The tapes
are also longer, 1337m total.  (According to the MAM on a sample JF
tape.  I don't have a JE tape handy to compare.)  The end result
is a 50TB raw capacity (150TB compressed) for TS1170 with a JF
cartridge vs 20TB raw capacity (60TB compressed) for TS1160 with
a JE cartridge.

lib/libmt/mtlib.c:
Add the TS1170 density codes to the denstiy table in libmt.

usr.bin/mt/mt.1:
Add the TS1170 density codes and specs to the density table
in the mt(1) man page.  As usual for TS drives, there is an
encrypted and non-encrypted density code (0x79 and 0x59
respectively).

MFC after: 3 days
Sponsored by: Spectra Logic

7 months agoAdd all read-only compatible zpool features to grub2 compatibility
Umer Saleem [Tue, 31 Oct 2023 16:51:54 +0000 (21:51 +0500)]
Add all read-only compatible zpool features to grub2 compatibility

GRUB opens the boot pool in read-only mode. All read-only
compatible features for zpool can be enabled and added to
grub2 compatibility, as GRUB does not open the boot-pool
for write.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Umer Saleem <usaleem@ixsystems.com>
Closes #15459

7 months agozvol: fix delayed update to block device ro entry
Ameer Hamza [Tue, 17 Oct 2023 19:19:58 +0000 (00:19 +0500)]
zvol: fix delayed update to block device ro entry

The change in the zvol readonly property does not update the block
device readonly entry until the first IO to the ZVOL. This patch
addresses the issue by updating the block device readonly property
from the set property IOCTL call.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
Closes #15409

7 months agozvol: Implement zvol threading as a Property
Ameer Hamza [Tue, 24 Oct 2023 21:53:27 +0000 (02:53 +0500)]
zvol: Implement zvol threading as a Property

Currently, zvol threading can be switched through the zvol_request_sync
module parameter system-wide. By making it a zvol property, zvol
threading can be switched per zvol.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
Closes #15409

7 months agozvol: Cleanup set property
Ameer Hamza [Wed, 11 Oct 2023 22:31:11 +0000 (03:31 +0500)]
zvol: Cleanup set property

zvol_set_volmode() and zvol_set_snapdev() share a common code path.
Merge this shared code path into zvol_set_common().

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
Closes #15409

7 months agopf: support SCTP-specific timeouts
Kristof Provost [Fri, 27 Oct 2023 14:45:07 +0000 (16:45 +0200)]
pf: support SCTP-specific timeouts

Allow SCTP state timeouts to be configured independently from TCP state
timeouts.

Reviewed by: tuexen
MFC after: 1 week
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D42393

7 months agolibpfctl: be more tolerant of kernel extensions
Kristof Provost [Fri, 27 Oct 2023 12:13:57 +0000 (14:13 +0200)]
libpfctl: be more tolerant of kernel extensions

Allow the kernel to supply more array elements than expected, but cut
off when we hit what we think the maximum is. This will improve forward
compatibility (i.e. old userspace with newer kernel).

Reviewed by: zlei
MFC after: 1 week
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D42392

7 months agopf tests: ensure that we generate all permutations for SCTP multihome
Kristof Provost [Tue, 10 Oct 2023 09:56:15 +0000 (11:56 +0200)]
pf tests: ensure that we generate all permutations for SCTP multihome

The initial multihome implementation was a little simplistic, and failed
to create all of the required states. Given a client with IP 1 and 2 and
a server with IP 3 and 4 we end up creating states for 1 - 3 and 2 - 3,
as well as 3 - 1 and 4 - 1, but not for 2 - 4.

Check for this.

MFC after: 1 week
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D42362

7 months agopf: fix missing SCTP multihomed states
Kristof Provost [Tue, 17 Oct 2023 16:10:39 +0000 (18:10 +0200)]
pf: fix missing SCTP multihomed states

The existing code to create extra states when SCTP endpoints supplied
extra addresses missed a case. As a result we failed to generate all of
the required states.

Briefly, if host A has address 1 and 2 and host B has addres 3 and 4 we
generated 1 - 3 and 2 - 3, as well as 1 - 4, but not 2 - 4.

Store the list of endpoints supplied by each host and use those to
generate all of the connection permutations.

MFC after: 1 week
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D42361

7 months agoGiant: Postpone removal of Giant-locked drivers until 15
Zhenlei Huang [Tue, 31 Oct 2023 12:45:14 +0000 (20:45 +0800)]
Giant: Postpone removal of Giant-locked drivers until 15

Reviewed by: imp
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D42401

7 months agosetkey(8): make the policy specification more readable
Konstantin Belousov [Tue, 31 Oct 2023 04:07:10 +0000 (06:07 +0200)]
setkey(8): make the policy specification more readable

by applying markup and highlighting the semantical blocks.

Sponsored by: NVidia networking
MFC after: 1 week