]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 months agozfs: merge openzfs/zfs@797f55ef1
Martin Matuska [Sun, 22 Oct 2023 16:25:23 +0000 (18:25 +0200)]
zfs: merge openzfs/zfs@797f55ef1

Notable upstream pull request merges:
 #14378 c0e58995e Large sync writes perform worse with slog
 #14721 797f55ef1 Do not persist user/group/project quota zap objects
                  when unneeded
 #15356 380c25f64 FreeBSD: Improve taskq wrapper
 #15390 4fbc52495 Remove lock from dsl_pool_need_dirty_delay()
 #15397 57b409856 Trust ARC_BUF_SHARED() more
 #15402 b29e98fa8 Properly pad struct tx_cpu to cache line
 #15405 ea30b5a9e Set spa_ccw_fail_time=0 when expanding a vdev
 #15416 b9384b949 FreeBSD: taskq: Remove unused declaration

Obtained from: OpenZFS
OpenZFS commit: 797f55ef12d752d2a7fb04fae5d24e019adf2a1d

7 months agoAdd expected failure for tmpfs atime test failing on FreeBSD
Ed Maste [Sat, 21 Oct 2023 15:15:14 +0000 (11:15 -0400)]
Add expected failure for tmpfs atime test failing on FreeBSD

PR: 274615
Reviewed by: ngie
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42321

7 months agonfscl: Handle a Getattr failure with NFSERR_DELAY following Open
Rick Macklem [Sun, 22 Oct 2023 01:33:33 +0000 (18:33 -0700)]
nfscl: Handle a Getattr failure with NFSERR_DELAY following Open

During testing at a recent IETF NFSv4 Bakeathon, a non-FreeBSD
server was rebooted.  After the reboot, the FreeBSD client sent
an Open/Claim_previous with a Getattr after the Open in the same
compound.  The Open/Claim_previous was done to recover the Open
and a Delegation for for a file.  The Open succeeded, but the
Getattr after the Open failed with NFSERR_DELAY.  This resulted
in the FreeBSD client retrying the entire RPC over and over again,
until the server's recovery grace period ended.  Since the Open
succeeded, there was no need to retry the entire RPC.

This patch modifies the NFSv4 client side recovery Open/Claim_previous
RPC reply handling to deal with this case.  With this patch, the
Getattr reply of NFSERR_DELAY is ignored and the successful Open
reply is processed.

This bug will not normally affect users, since this non-FreeBSD
server is not widely used (it may not even have shipped to any
customers).

MFC after: 1 month

7 months agoufs quotas: fix configuring soft quota grace time
Mikel Lechner [Sat, 21 Oct 2023 06:08:38 +0000 (09:08 +0300)]
ufs quotas: fix configuring soft quota grace time

The QTF_CLOSING flag needs to be cleared earlier to allow dqget() to
work.

PR: 274552
MFC after: 1 week

7 months agobpf: Make dead_bpf_if const
Zhenlei Huang [Sat, 21 Oct 2023 04:52:27 +0000 (12:52 +0800)]
bpf: Make dead_bpf_if const

The dead_bpf_if is not subjected to be written. Make it const so that
on destructive writing to it the kernel will panic instead of silent
memory corruption.

No functional change intended.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42189

7 months agox86: Prefer consistent naming for loader tunables
Zhenlei Huang [Tue, 17 Oct 2023 07:05:25 +0000 (15:05 +0800)]
x86: Prefer consistent naming for loader tunables

The following loader tunables do have corresponding sysctl MIBs but
with inconsistent naming. That may be historical reason. Let's prefer
consistent naming for them so that it will be easier to maintain.

 1. hw.dmar.timeout -> hw.iommu.dmar.timeout
 2. hw.lapic_eoi_suppression -> hw.apic.eoi_suppression
 3. hw.lapic_tsc_deadline -> hw.apic.timer_tsc_deadline
 4. hw.x2apic_enable -> hw.apic.x2apic_mode

Those tunables are for field debugging, no need to keep old names for
compatibility.

Reviewed by: kib
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42248

7 months agoamd64 pmap: Prefer consistent naming for loader tunable
Zhenlei Huang [Fri, 20 Oct 2023 07:31:44 +0000 (15:31 +0800)]
amd64 pmap: Prefer consistent naming for loader tunable

The sysctl knob 'vm.pmap.allow_2m_x_ept' is loader tunable and have
public document entry in security(7) but is fetched from kernel
environment 'hw.allow_2m_x_ept'. That is inconsistent and obscure.

As there is public security advisory FreeBSD-SA-19:25.mcepsc [1],
people may refer to it and use 'hw.allow_2m_x_ept', let's keep old
name for compatibility.

[1] https://www.freebsd.org/security/advisories/FreeBSD-SA-19:25.mcepsc.asc

Reviewed by: kib
Fixes: c08973d09c95 Workaround for Intel SKL002/SKL012S errata
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42311

7 months agonfscl: Use Claim_Null_FH and Claim_Deleg_Cur_FH
Rick Macklem [Fri, 20 Oct 2023 23:10:25 +0000 (16:10 -0700)]
nfscl: Use Claim_Null_FH and Claim_Deleg_Cur_FH

For NFSv4.1/4.2, there are two new options for the Open operation.
These two options use the file handle for the file instead of the
file handle for the directory plus a file name.  By doing so, the
client code is simplified (it no longer needs the "nfsv4node" structure
attached to the NFS vnode).  It also avoids problems caused by another
NFS client (or process running locally in the NFS server) doing a
rename or remove of the file name between the Lookup and Open.

Unfortunately, there was a bug (fixed recently by commit X)
in the NFS server which mis-parsed the Claim_Deleg_Cur_FH
arguments.  To allow this patch to work with the broken FreeBSD
NFSv4.1/4.2 server, NFSMNTP_BUGGYFBSDSRV is defined and is set
when a correctly formatted Claim_Deleg_Cur_FH fails with NFSERR_EXPIRED.
(This is what the old, broken NFS server does, since it erroneously
uses the Getattr arguments as a stateID.)  Once this flag is set,
the client fills in a stateID, to make the broken NFS server happy.

Tested at a recent IETF NFSv4 Bakeathon.

MFC after: 1 month

7 months agoMinor sysctl description cleanup.
Kirk McKusick [Fri, 20 Oct 2023 22:32:05 +0000 (15:32 -0700)]
Minor sysctl description cleanup.

No functional change.

Agreed-by: Mateusz Guzik
7 months agoFix a bug in fsck_ffs(8) triggered by corrupted filesystems.
Kirk McKusick [Fri, 20 Oct 2023 22:14:46 +0000 (15:14 -0700)]
Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.

Add missing check for failed block read when checking information about
a snapshot file.

Reported-by: Andreas Bock
PR:           274404
MFC-after:    1 week

7 months agouart: Support EARLY_PRINTF on x86 for port-mapped COM ports
Warner Losh [Fri, 20 Oct 2023 22:07:03 +0000 (16:07 -0600)]
uart: Support EARLY_PRINTF on x86 for port-mapped COM ports

Support early printf for the ns8250 uart driver. Adding
options UART_NS8250_EARLY_PORT=0xYYY
options EARLY_PRINTF
to your kernel config will enable it. The code is rather simple minded,
so caveat emptor. This will enable printf before cninit. cninit
automatically disables this and switches to the real routine. It only
works for port-mapped COM ports, and only if you know the port's address
at compile time. It's intended for be a debugging aide, not a general
purpose thing.

Sponsored by: Netflix
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D42306

7 months agoacpi_pcib: Rename decoded_bus_range to get_decoded_bus_range
John Baldwin [Fri, 20 Oct 2023 21:53:49 +0000 (14:53 -0700)]
acpi_pcib: Rename decoded_bus_range to get_decoded_bus_range

While here, change the return value to bool.

Discussed by: gibbs

7 months agox86: Cosmetic cleanups to struct msi_intsrc
John Baldwin [Fri, 20 Oct 2023 21:53:05 +0000 (14:53 -0700)]
x86: Cosmetic cleanups to struct msi_intsrc

- Sort members by size.

- Change msi_msix from a u_int to a bool.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D42305

7 months agox86 msi: Enable/disable IDT vectors for MSI groups all at once
John Baldwin [Fri, 20 Oct 2023 21:52:38 +0000 (14:52 -0700)]
x86 msi: Enable/disable IDT vectors for MSI groups all at once

Unlike MSI-X, when a device uses multiple MSI interrupts, the entire
group of interrupts are enabled/disabled at once in the relevant PCI
config register.  Currently, the interrupt code enables the IDT vector
for each MSI interrupt when a handler is first registered.  If the PCI
device triggers an MSI interrupt which doesn't yet have a handler,
this can trigger a panic when the Xrsvd ISR executes rather than
treating it as a stray device interrupt.

To fix, enable all the IDT vectors for an MSI group when the first
interrupt handler is configured, and don't disable the IDT vectors
until the last interrupt handler for the group is torn down.

When migrating an MSI group between CPUs, enable/disable the entire
group of IDT vectors if at least one interrupt handler is configured
for the group.

Reported by: jhay
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D42232

7 months agoDo not persist user/group/project quota zap objects when unneeded
Sam Atkinson [Fri, 20 Oct 2023 21:22:04 +0000 (17:22 -0400)]
Do not persist user/group/project quota zap objects when unneeded

In the zfs_id_over*quota functions, there is a short-circuit to skip
the zap_lookup when the quota zap does not exist. If quotas are never
used in a zpool, then the quota zap will never exist. But if
user/group/project quotas are ever used, the zap objects will be
created and will persist even if the quotas are deleted.

The quota zap_lookup in the write path can become a bottleneck for
write-heavy small I/O workloads. Before this commit, it was not
possible to remove this lookup without creating a new zpool.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Sam Atkinson <samatk@amazon.com>
Closes #14721

7 months agocertctl: invoke with LOCALBASE set
Brooks Davis [Mon, 16 Oct 2023 22:35:40 +0000 (23:35 +0100)]
certctl: invoke with LOCALBASE set

When invoking certctl as part of installworld, set LOCALBASE in the
environment to match the build environment.  That ensures that LOCABASE
is non-empty on systems without the user.localbase sysctl and avoids
allowing a system configuration detail to leak into the build.  Users
who wish to build targeting a non-standard LOCALBASE should ensure it is
set in src.conf or similar.

Reviewed by: Mina Galić <freebsd@igalic.co>
Differential Revision: https://reviews.freebsd.org/D40530

7 months agocertctl.8: document LOCALBASE
Brooks Davis [Mon, 16 Oct 2023 22:35:34 +0000 (23:35 +0100)]
certctl.8: document LOCALBASE

Document the LOCALBASE variable and that it's set to user.localbase by
default.  Update path defaults that depend on it.

Reviewed by: bcr
Differential Revision: https://reviews.freebsd.org/D40529

7 months agoTrust ARC_BUF_SHARED() more
Alexander Motin [Fri, 20 Oct 2023 19:38:37 +0000 (15:38 -0400)]
Trust ARC_BUF_SHARED() more

In my understanding ARC_BUF_SHARED() and arc_buf_is_shared() should
return identical results, except the second also asserts it deeper.
The first is much cheaper though, saving few pointer dereferences.
Replace production arc_buf_is_shared() calls with ARC_BUF_SHARED(),
and call arc_buf_is_shared() in random assertions, while making it
even more strict.

On my tests this in half reduces arc_buf_destroy_impl() time, that
noticeably reduces hash_lock congestion under heavy dbuf eviction.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Wilson <george.wilson@delphix.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15397

7 months agoRemove lock from dsl_pool_need_dirty_delay()
Alexander Motin [Fri, 20 Oct 2023 19:37:16 +0000 (15:37 -0400)]
Remove lock from dsl_pool_need_dirty_delay()

Torn reads/writes of dp_dirty_total are unlikely: on 64-bit systems
due to register size, while on 32-bit due to memory constraints.
And even if we hit some race, the code implementing the delay takes
the lock any way.

Removal of the poll-wide lock acquisition saves ~1% of CPU time on
8-thread 8KB write workload.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15390

7 months agorun-zts test procfs/pool_state failed with uncorrectable I/O failure
VaibhavB [Fri, 20 Oct 2023 18:57:39 +0000 (00:27 +0530)]
run-zts test procfs/pool_state failed with uncorrectable I/O failure

Once we trigger the zpool scrub, all zpool/zfs command gets stuck for
180 seconds. Post 180 seconds zpool/zfs commands gets start executing
however few more seconds(10s) it take to update the status. hence
sleeping for 200 seconds so that we get the correct status.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: vaibhav.bhanawat <vaibhav.bhanawat@delphix.com>
Closes #15364

7 months agoProperly pad struct tx_cpu to cache line
Alexander Motin [Fri, 20 Oct 2023 18:54:05 +0000 (14:54 -0400)]
Properly pad struct tx_cpu to cache line

We already use ____cacheline_aligned in many places, so add one more
instead of seems arbitrary char tc_pad[8].

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15402

7 months agoFix typo in tests/zfs-tests/tests/functional/cli_user/misc/misc.cfg
dennisfriedrichsen [Fri, 20 Oct 2023 18:52:13 +0000 (13:52 -0500)]
Fix typo in  tests/zfs-tests/tests/functional/cli_user/misc/misc.cfg

Reviewed-by: Rob N <robn@despairlabs.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Dennis R. Friedrichsen <dennis.r.friedrichsen@gmail.com>
Closes #15417

7 months agoFreeBSD: taskq: Remove unused declaration
Olivier Certner [Fri, 20 Oct 2023 18:49:56 +0000 (20:49 +0200)]
FreeBSD: taskq: Remove unused declaration

Variable 'uma_align_cache' has not been used since commit "FreeBSD: Use
a hash table for taskqid lookups" (3933305ea).  Moreover, it is soon
going to become private to FreeBSD's UMA in 15.0-CURRENT (main),
14.0-STABLE (stable/14) and 13.2-STABLE (stable/13).  Should accessing
this information become necessary again, one will have to use the new
accessors for recent versions.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Olivier Certner <olce.freebsd@certner.fr>
Closes #15416

7 months agoObsoleteFiles.inc: Remove old mixer(8) tests
John Baldwin [Fri, 20 Oct 2023 18:33:11 +0000 (11:33 -0700)]
ObsoleteFiles.inc: Remove old mixer(8) tests

These were removed when the new mixer(3) library was imported.

PR: 274602
Fixes: 903873ce1560 Implement and use new mixer(3) library for FreeBSD.

7 months agotests: fix ATF_TESTS_PYTEST no clean build
Gleb Smirnoff [Fri, 20 Oct 2023 17:47:08 +0000 (10:47 -0700)]
tests: fix ATF_TESTS_PYTEST no clean build

The hack with .xtmp file was effectively making the make to
ignore changes to the sources, breaking NO_CLEAN builds.  The
hack can be actually omitted as setting SCRIPTSNAME_${_T} for
every test is sufficient to prevent renaming by bsd.prog.mk.

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D42283

7 months agoSet spa_ccw_fail_time=0 when expanding a vdev.
Colin Percival [Fri, 20 Oct 2023 17:30:32 +0000 (10:30 -0700)]
Set spa_ccw_fail_time=0 when expanding a vdev.

When a vdev is to be expanded -- either via `zpool online -e` or via
the autoexpand option -- a SPA_ASYNC_CONFIG_UPDATE request is queued
to be handled via an asynchronous worker thread (spa_async_thread).
This normally happens almost immediately; but will be delayed up to
zfs_ccw_retry_interval seconds (default 5 minutes) if an attempt to
write the zpool configuration cache failed.

When FreeBSD boots ZFS-root VM images generated using `makefs -t zfs`,
the zpoolupgrade rc.d script runs `zpool upgrade`, which modifies the
pool configuration and triggers an attempt to write to the cache file.
This attempted write fails because the filesystem is still mounted
read-only at this point in the boot process, triggering a 5-minute
cooldown before SPA_ASYNC_CONFIG_UPDATE requests will be handled by
the asynchronous worker thread.

When expanding a vdev, reset the "when did a configuration cache
write last fail" value so that the SPA_ASYNC_CONFIG_UPDATE request
will be handled promptly.  A cleaner but more intrusive option would
be to use separate SPA_ASYNC_ flags for "configuration changed" and
"try writing the configuration cache again", but with FreeBSD 14.0
coming very soon I'd prefer to leave such refactoring for a later
date.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Colin Percival <cperciva@FreeBSD.org>
Closes #15405

7 months agoFix ZED auto-replace for VDEVs using by-id paths
Don Brady [Fri, 20 Oct 2023 16:29:02 +0000 (10:29 -0600)]
Fix ZED auto-replace for VDEVs using by-id paths

The change is simple -- restore the original code so that the VDEV
path is updated when using by-id paths.  The more challenging part
was to devise a second ZTS test, that would test auto-replace for
'by-id' and help prevent a future regression.

With that new test, we can now do an A|B test with , and without,
the fix to confirm that auto-replace for by-id paths works. The
existing auto-replace test, functional/fault/auto_replace_001_pos,
will confirm that we didn't break auto-replace for 'by-vdev' paths.

In the original functional/fault/auto_replace_001_pos test, the disk
wipe (using dd) was not effective in removing the partitioning since
the kernel was never informed of the wipe.

Added a call to wipefs(8) so that the kernel is informed and ZED will
re-partition the device.

Added a validation step that the re-partitioning occurred by
confirming  that the GPT partition UUID changes.

Sponsored-By: OpenDrives Inc.
Sponsored-By: Klara Inc.
Reviewed-by: Rob Norris <rob.norris@klarasystems.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Don Brady <don.brady@klarasystems.com>
Closes #15363

7 months agoarm64: Add PAC instruction macros
Andrew Turner [Thu, 12 Oct 2023 09:48:38 +0000 (10:48 +0100)]
arm64: Add PAC instruction macros

To support Pointer Authentication (PAC) in assembly files add a pair of
macros that sign the link register. When used before storing to the
stack it will allow hardware to detect if it has changed before using
it in the return instruction.

Reviewed by: markj, emaste
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D42226

7 months agoarm64: Support creating a BTI & PAC note
Andrew Turner [Tue, 10 Oct 2023 13:00:59 +0000 (14:00 +0100)]
arm64: Support creating a BTI & PAC note

To detect when an object file is build with the Branch Target
Identification (BTI) and Pointer Authentication Code (PAC) extensions
there is an elf note the compiler will insert. It will only do so from
a high level language, e.g. C or C++.

To get the not in assembly add the GNU_PROPERTY_AARCH64_FEATURE_1_NOTE
macro that can be used to create it, and the
GNU_PROPERTY_AARCH64_FEATURE_1_VAL macro to insert the correct value
based on which combination of BTI and PAC are enabled.

Reviewed by: markj (earlier version), emaste
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D42225

7 months agotools/build: Support building with glibc 2.38
Andrew Turner [Fri, 20 Oct 2023 15:45:06 +0000 (16:45 +0100)]
tools/build: Support building with glibc 2.38

Ubuntu 23.10 uses glibc 2.38. This adds strlcpy and strlcmp so we need
to remove them from the cross build environment.

Reviewed by: jrtc27 (earlier version), arichardson
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D42303

7 months agosys/sys: Check for __ASSEMBLER__ in elf_common.h
Andrew Turner [Thu, 12 Oct 2023 09:45:43 +0000 (10:45 +0100)]
sys/sys: Check for __ASSEMBLER__ in elf_common.h

When preprocessing assembly files with clang or gcc the __ASSEMBLER__
macro is defined. Check for this as an alternative to LOCORE in
elf_common.h so it can be included by .S files.

Reviewed by: imp
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D42224

7 months agoTweaks to libarchive's upgrade instructions
Mitchell Horne [Fri, 20 Oct 2023 15:11:21 +0000 (12:11 -0300)]
Tweaks to libarchive's upgrade instructions

I would like to use this file as an example of the FREEBSD-upgrade
convention, see D42302. libarchive is picked somewhat arbitrarily as a
longstanding piece of contrib software in FreeBSD.

- Remove SVN references (HEAD/trunk)
- Mention the vendor/libarchive git branch
- Update link to import instructions
- Remove $FreeBSD$

Reviewed by: mm, imp, emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42308

7 months agonetinet tests: Fix leaks in ip6_v4mapped_test
Mark Johnston [Fri, 20 Oct 2023 14:05:58 +0000 (10:05 -0400)]
netinet tests: Fix leaks in ip6_v4mapped_test

Reported by: Coverity
MFC after: 1 week

7 months agonetfront: fix the support for disabling LRO at boot time
Doug Rabson [Sat, 12 Aug 2023 13:19:47 +0000 (14:19 +0100)]
netfront: fix the support for disabling LRO at boot time

The driver has a tunable hw.xn.enable_lro which is intended to control
whether LRO is enabled. This is currently non-functional - even if its
set to zero, the driver still requests LRO support from the backend.
This change fixes the feature so that if enable_lro is set to zero, LRO
no longer appears in the interface capabilities and LRO is not requested
from the backend.

PR: 273046
MFC after: 1 week
Reviewed by: royger
Differential Revision: https://reviews.freebsd.org/D41439

7 months agolibc: More missing MLINKS.
Dag-Erling Smørgrav [Fri, 20 Oct 2023 10:29:20 +0000 (12:29 +0200)]
libc: More missing MLINKS.

Differential Revision: https://reviews.freebsd.org/D42292

7 months agocertctl: Fix recent regressions.
Dag-Erling Smørgrav [Fri, 20 Oct 2023 10:29:06 +0000 (12:29 +0200)]
certctl: Fix recent regressions.

- If an untrusted certificate is also found in the list of trusted
  certificate, issue a warning and skip it, but don't fail.
- Split on -+BEGIN CERTIFICATE-+ instead of "Certificate:" since
  that's what we're really looking for.

Also fix a long-standing bug: .crl files are not certificates, so we
should not include them when searching for certificates.

Reported by: madpilot, netchild, tijl
Reviewed by: netchild, allanjude
Differential Revision: https://reviews.freebsd.org/D42276

7 months agoHyper-V: vmbus: check if signaling host is needed in vmbus_rxbr_read
Wei Hu [Fri, 20 Oct 2023 08:58:20 +0000 (08:58 +0000)]
Hyper-V: vmbus: check if signaling host is needed in vmbus_rxbr_read

It is observed that netvsc's send rings could stall on the latest
Azure Boost platforms. This is due to vmbus_rxbr_read() routine
doesn't check if host is waiting for more room to put data, which
leads to host side sleeping forever on this vmbus channel. The
problem was only observed on the latest platform because the host
requests larger buffer ring room to be available, which causes
the issue to happen much more easily.

Fix this by adding check in the vmbus_rxbr_read call and signaling
the host in the callers if check returns positively.

Reported by: NetApp
Tested by: whu
MFC after: 3 days
Sponsored by: Microsoft

7 months agopf: use an enum for packet direction in divert tag
Kristof Provost [Fri, 20 Oct 2023 07:13:56 +0000 (09:13 +0200)]
pf: use an enum for packet direction in divert tag

The benefit is that in the debugger you will see PF_DIVERT_MTAG_DIR_IN
instead of 1 when looking at a structure. And compilation time failure
if anybody sets it to a wrong value. Using "port" instead of "ndir" when
assigning a port improves readability of code.

Suggested by: glebius
MFC after: 3 weeks
X-MFC-With: fabf705f4b

7 months agoreleng-gce: Add missing _
Colin Percival [Thu, 19 Oct 2023 22:46:59 +0000 (15:46 -0700)]
releng-gce: Add missing _

Fixes: 1b10bdf0e2fa8 "releng-gce: Add ZFS support to GCE"
MFC after: 3 days

7 months agoFix Sumit's email address
Warner Losh [Thu, 19 Oct 2023 21:49:05 +0000 (15:49 -0600)]
Fix Sumit's email address

In my haste to get things in for 14.0, I used the wrong email
address for Sumit Saxena. Fix that here so git log is correct.

7 months agompi3mr: Move creation of watchdog to interupt config hook
Sumit Saxena [Thu, 19 Oct 2023 21:06:29 +0000 (15:06 -0600)]
mpi3mr: Move creation of watchdog to interupt config hook

Move creation of watchdog process from just before we configure the
interrupt config hook to into the config hook itself. This prevents it
from racing the config intr hook and doing an extra reset of the
card. This extra reset is usually harmless, but sometimes it can prevent
discovery of devices if done at just the wrong time. This can lead to no
disks being registered in a box full of disks, for example. Starting it
later eliminates this race, making discovery reliable.

Reviewed by: imp

7 months agonfsd: Fix NFSv4.1/4.2 Claim_Deleg_Cur_FH
Rick Macklem [Thu, 19 Oct 2023 19:35:35 +0000 (12:35 -0700)]
nfsd: Fix NFSv4.1/4.2 Claim_Deleg_Cur_FH

When I implemented a test patch using Open Claim_Deleg_Cur_FH
I discovered that the NFSv4.1/4.2 server was broken for this
Open option.  Fortunately it is never used by the FreeBSD
client and never used by other clients unless delegations
are enabled. (The FreeBSD NFSv4 server does not have delegations
enabled by default.)

Claim_Deleg_Cur_FH was broken because the code mistakenly
assumed a stateID argument, which is not the case.
This patch fixes the bug by changing the XDR parser to not
expect a stateID and to fill most of the stateID in from the
clientID. The clientID is the first two elements of the "other"
array for the stateID and is sufficient to identify which
client the delegation is issued to.  Since there is only one
delegation issued to a client per file, this is sufficient to
locate the correct delegation.

If you are running non-FreeBSD NFSv4.1/4.2 mounts against the
FreeBSD server, you need this patch if you have delegations enabled.

PR: 274574
MFC after: 2 weeks

7 months agoKTLS: Enable KTLS for receiving as well in TLS 1.3
Daiki Ueno [Sun, 10 Oct 2021 07:14:06 +0000 (09:14 +0200)]
KTLS: Enable KTLS for receiving as well in TLS 1.3

This removes a guard condition that prevents KTLS being enabled for
receiving in TLS 1.3.  Use the correct sequence number and BIO for
receive vs transmit offload.

Obtained from: OpenSSL commit 7c78932b9a4330fb7c8db72b3fb37cbff1401f8b

7 months agoKTLS: Handle TLS 1.3 in ssl3_get_record.
Daiki Ueno [Sun, 10 Oct 2021 06:54:07 +0000 (08:54 +0200)]
KTLS: Handle TLS 1.3 in ssl3_get_record.

- Don't unpad records, check the outer record type, or extract the
  inner record type from TLS 1.3 records handled by the kernel.  KTLS
  performs all of these steps and returns the inner record type in the
  TLS header.

- When checking the length of a received TLS 1.3 record don't allow
  for the extra byte for the nested record type when KTLS is used.

- Pass a pointer to the record type in the TLS header to the
  SSL3_RT_INNER_CONTENT_TYPE message callback.  For KTLS, the old
  pointer pointed to the last byte of payload rather than the record
  type.  For the non-KTLS case, the TLS header has been updated with
  the inner type before this callback is invoked.

Obtained from: OpenSSL commit a5fb9605329fb939abb536c1604d44a511741624)

7 months agoKTLS: Add using_ktls helper variable in ssl3_get_record().
John Baldwin [Tue, 8 Mar 2022 00:55:18 +0000 (16:55 -0800)]
KTLS: Add using_ktls helper variable in ssl3_get_record().

When KTLS receive is enabled, pending data may still be present due to
read ahead.  This data must still be processed the same as records
received without KTLS.  To ease readability (especially in
consideration of additional checks which will be added for TLS 1.3),
add a helper variable 'using_ktls' that is true when the KTLS receive
path is being used to receive a record.

Obtained from: OpenSSL commit 031132c297e54cbc20404a0bf8de6ed863196399

7 months agoKTLS: Check for unprocessed receive records in ktls_configure_crypto.
John Baldwin [Thu, 24 Feb 2022 18:12:07 +0000 (10:12 -0800)]
KTLS: Check for unprocessed receive records in ktls_configure_crypto.

KTLS implementations currently assume that the start of the in-kernel
socket buffer is aligned with the start of a TLS record for the
receive side.  The socket option to enable KTLS specifies the TLS
sequence number of this initial record.

When read ahead is enabled, data can be pending in the SSL read buffer
after negotiating session keys.  This pending data must be examined to
ensurs that the kernel's socket buffer does not contain a partial TLS
record as well as to determine the correct sequence number of the
first TLS record to be processed by the kernel.

In preparation for enabling receive kernel offload for TLS 1.3, move
the existing logic to handle read ahead from t1_enc.c into ktls.c and
invoke it from ktls_configure_crypto().

Obtained from: OpenSSL commit 85773128d0e80cd8dcc772a6931d385b8cf4acd1

7 months agoAdd support for Chacha20-Poly1305 to kernel TLS on FreeBSD.
John Baldwin [Wed, 23 Dec 2020 22:09:51 +0000 (14:09 -0800)]
Add support for Chacha20-Poly1305 to kernel TLS on FreeBSD.

FreeBSD's kernel TLS supports Chacha20 for both TLS 1.2 and TLS 1.3.

Obtained from: OpenSSL commit 77f3936928068bee9d7e0c6939709ac179cb1059

7 months agovmx: Prefer consistent naming for loader tunables
Zhenlei Huang [Thu, 19 Oct 2023 17:18:25 +0000 (01:18 +0800)]
vmx: Prefer consistent naming for loader tunables

The following loader tunables do have corresponding sysctl MIBs but
with different names. That may be historical reason. Let's prefer
consistent naming for them so that it will be easier to read and
maintain.

 1. hw.vmm.l1d_flush -> hw.vmm.vmx.l1d_flush
 2. hw.vmm.l1d_flush_sw -> hw.vmm.vmx.l1d_flush_sw
 3. hw.vmm.vmx.use_apic_pir -> hw.vmm.vmx.cap.posted_interrupts
 4. hw.vmm.vmx.use_apic_vid -> hw.vmm.vmx.cap.virtual_interrupt_delivery
 5. hw.vmm.vmx.use_tpr_shadowing -> hw.vmm.vmx.cap.tpr_shadowing

Old names are kept for compatibility.

Meanwhile, add sysctl flag CTLFLAG_TUN to them so that `sysctl -T` will
report them correctly.

Reviewed by: corvink, jhb, kib, #bhyve
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D42251

7 months agopmap: Prefer consistent naming for loader tunable
Zhenlei Huang [Thu, 19 Oct 2023 17:00:31 +0000 (01:00 +0800)]
pmap: Prefer consistent naming for loader tunable

The sysctl knob 'vm.pmap.pv_entry_max' becomes a loader tunable since
7ff48af7040f (Allow a specific setting for pv entries) but is fetched
from system environment 'vm.pmap.pv_entries'. That is inconsistent and
obscure.

This reverts 36e1b9702e21 (Correct the tunable name in the message).

PR: 231577
Reviewed by: jhibbits, alc, kib
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42274

7 months agoamd64: Fix two typos of loader tunables
Zhenlei Huang [Thu, 19 Oct 2023 15:23:33 +0000 (23:23 +0800)]
amd64: Fix two typos of loader tunables

To match the sysctl MIBs and document entries in security(7).

Fixes: 2dec2b4a34b4 amd64: flush L1 data cache on syscall return with an error
Fixes: 17edf152e556 Control for Special Register Buffer Data Sampling mitigation

Reviewed by: kib
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D42249

7 months agoAdd myself as ports committer, update mentor/mentee
Michael Osipov [Thu, 19 Oct 2023 13:53:11 +0000 (15:53 +0200)]
Add myself as ports committer, update mentor/mentee

This completes step 5 from Committer's Guide.

Approved by: jrm (mentor)
Differential Review: https://reviews.freebsd.org/D42293

7 months agopf: remove COMPAT_FREEBSD14 #ifdef from pfvar.h
Kristof Provost [Thu, 19 Oct 2023 10:06:29 +0000 (12:06 +0200)]
pf: remove COMPAT_FREEBSD14 #ifdef from pfvar.h

When userspace includes pfvar.h it doesn't get the kernel's COMPAT_*
defines, so we end up not having required symbols in userspace. This
caused the libpfctl port to fail to build.

libpfctl will be updated to use the new netlink-based state export code
soon, which will also fix thix build issue.

Sponsored by: Rubicon Communications, LLC ("Netgate")

7 months agohwpmc_amd: remove an unused variable
Mitchell Horne [Thu, 19 Oct 2023 13:58:48 +0000 (10:58 -0300)]
hwpmc_amd: remove an unused variable

This should fix the LINT builds.

Reported by: Jenkins
Sponsored by: The FreeBSD Foundation
Fixes: 2c6f474ee824 ("hwpmc_amd: kill of k7 support bits")

7 months agoping tests: Fix test on i386 platforms
Jose Luis Duran [Tue, 17 Oct 2023 11:35:38 +0000 (11:35 +0000)]
ping tests: Fix test on i386 platforms

Actually use INT_MAX (0x7fffffff), not UINT_MAX (0xffffffff) to avoid
overflowing time_t and missing the test.

Reported by: Jenkins
Reviewed by: markj
Fixes: 5b8af90fe332 ("ping: Add ATF-Python tests")
Pull Request: https://github.com/freebsd/freebsd-src/pull/874
Differential Revision: https://reviews.freebsd.org/D42268

7 months agopf: fix pf divert-to loop
Igor Ostapenko [Thu, 19 Oct 2023 10:12:15 +0000 (12:12 +0200)]
pf: fix pf divert-to loop

Resolved conflict between ipfw and pf if both are used and pf wants to
do divert(4) by having separate mtags for pf and ipfw.

Also fix the incorrect 'rulenum' check, which caused the reported loop.

While here add a few test cases to ensure that divert-to works as
expected, even if ipfw is loaded.

divert(4)
PR: 272770
MFC after: 3 weeks
Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D42142

7 months agobsdinstall hostname: Restore bsdconfig API
Alfonso S. Siciliano [Thu, 19 Oct 2023 10:54:24 +0000 (12:54 +0200)]
bsdinstall hostname: Restore bsdconfig API

Restore bsdconfig API to handle hostname dialog because bsddialog 1.0
matches all features required by bsdconfig(1). Implicitly this commit
restores also Xdialog(1) for this script.

This commit reverts:
 - "bsdinstall hostname: Replace dialog with bsddialog"
   6368dcb29228dd8e18d50c54c3ca1596262d4676
 - "bsdinstall(8) hostname: Update for bsddialog 0.3"
   5f3ec44e7e9c11f90ad1128db1116925b493fad0.

The script continues to use bsddialog(1) by default via $DIALOG in
bsdconfig(1).

7 months agovfs cache: Fallback to namei to resolve symlinks with leading / in target for non...
Dmitry Chagin [Thu, 19 Oct 2023 10:33:58 +0000 (13:33 +0300)]
vfs cache: Fallback to namei to resolve symlinks with leading / in target for non-native ABI

This is a temporary solution to fix PR before release.
During 15.0 it's necessary to refactor symlinks handling
between vfs & namecache.

PR: 273414
Reported by: Vincent Milum Jr, Dan Kotowski, glebius
Tested by: Dan Kotowski, glebius
Reviewed by:
Differential Revision: https://reviews.freebsd.org/D41806
MFC after: 3 days

7 months agopf: Update documentation regarding matching, scrubbing and reassembly
Kajetan Staszkiewicz [Thu, 19 Oct 2023 08:41:32 +0000 (10:41 +0200)]
pf: Update documentation regarding matching, scrubbing and reassembly

Update pf documentation:

 - default behaviour of fragment reassembly
 - introduction of scrub option for filter rules
 - disadvantages of using the old scrub ruleset
 - options supported for match rules
 - fix missing list block end
 - remove duplicate description of match filter rule
 - update example to modern syntax

Reviewed by: kp
Fragments obtained from: OpenBSD
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D42270

7 months agonet/route: properly brace the RT_LOG() macro
Gleb Smirnoff [Thu, 19 Oct 2023 05:21:53 +0000 (22:21 -0700)]
net/route: properly brace the RT_LOG() macro

7 months agotests/netlink: mark the vlan(4) test with required module
Gleb Smirnoff [Thu, 19 Oct 2023 05:21:53 +0000 (22:21 -0700)]
tests/netlink: mark the vlan(4) test with required module

7 months agosmartpqi: Change alignment for dma tags
John Hall [Thu, 19 Oct 2023 03:10:58 +0000 (21:10 -0600)]
smartpqi: Change alignment for dma tags

Problem: Under certain I/O conditions, a program doing large block disk
reads can cause a controller to crash.

Root Cause: The SCSI read request and destination address in the BDMA
descriptor is incorrect, causing the BDMA engine in the controller to
assert.

Fix: Change the alignment for creating bus_dma_tags in the driver from
PAGE_SIZE (4k) to 1, which allows the controller to manage it's own
address range for BDMA transactions.

Risk: Medium

Exposure: This reverts a change first made to support NVMe drives on
Excalibur. At that time a 4k alignment was necessary. This no longer
seems to be the case.

PR: 259541
Reported by: Ka Ho Ng <khng@freebsd.org>
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D41619

7 months agosmartpqi: Drop spinlock before freeing memory
John F. Carr [Thu, 19 Oct 2023 03:02:42 +0000 (21:02 -0600)]
smartpqi: Drop spinlock before freeing memory

pqisrc_free_device frees the device softc with the os spinlock
held. This causes crashes when devices are removed because the memory
free might sleep (which is prohibited with spin locks held). Drop the
spinlock before releasing the memory.

MFC After: 2 days
PR: 273289
Reviewed by: imp

7 months agoinstall: handle -m +X more accurately
Kyle Evans [Thu, 19 Oct 2023 02:43:06 +0000 (21:43 -0500)]
install: handle -m +X more accurately

As described by chmod(1), +X in the mode may be used to optionally set
the +x bit if the file is a directory if any of the execute/search bits
are set in the original mode.  The latter is not applicable because we
assume -m is a fresh mask, but a functional +X could be useful in the
former case if we're passing along a common INSTALL_MODE that's designed
to install either 0644 or 0755 depending simply on whether it's a
directory or not.

Reviewed by: des
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D42273

7 months agoUPDATING: Add entry for commit 57ce37f9dcd0
Rick Macklem [Wed, 18 Oct 2023 20:17:42 +0000 (13:17 -0700)]
UPDATING: Add entry for commit 57ce37f9dcd0

7 months agoparam.h: Bump __FreeBSD_version for commit 57ce37f9dcd0
Rick Macklem [Wed, 18 Oct 2023 20:12:26 +0000 (13:12 -0700)]
param.h: Bump __FreeBSD_version for commit 57ce37f9dcd0

Commit 57ce37f9dcc0 changed the internal KAPI between the
nfscommon and nfscl modules.  Both must be rebuilt from sources.

7 months agonfscl: Make NFSv4.2 Copy set atime on infd
Rick Macklem [Wed, 18 Oct 2023 20:07:39 +0000 (13:07 -0700)]
nfscl: Make NFSv4.2 Copy set atime on infd

RFC7862 does not specify infile atime behaviour when a NFSv4.2 Copy
operation is performed.  Since the collective opinion of a mailing
list discussion (on freebsd-hackers@) seemed to indicate that
copy_file_range(2) should update atime on the infd,
even if there is no data copied, this
patch attempts to ensure that behaviour.

For Copy, it preceeds the Copy operation with a Setattr of
TimeAccess_Set(NFSv4. speak for atime) for the invp.  For the case
where no data will be copied, it does a Setattr RPC to set
TimeAccess_Set for the invp.

A __FreeBSD_version bump will be done as a separate commit, since
this patch changes the internal interface between the nfscommon and
nfscl modules.

MFC after: 1 month

7 months agonfscl: Handle the NFSERR_RETRYUNCACHEDREP error from a NFSv4 server
Rick Macklem [Wed, 18 Oct 2023 19:42:12 +0000 (12:42 -0700)]
nfscl: Handle the NFSERR_RETRYUNCACHEDREP error from a NFSv4 server

In a recent email list discussion related to NFSv4 mount problems
against a non-FreeBSD NFSv4 server, the reporter of the issue noted
that the server had replied 10068 (NFSERR_RETRYUNCACHEDREP).  This
did not seem related to the mount problem, but I had never seen this
error before.  It indicates that an RPC retry after a new TCP
connection has been established failed because the server did not
cache the reply.  Since this should only happen for idempotent
operations, redoing the RPC should be safe.

This patch modifies the NFSv4.1/4.2 client to redo the RPC instead
of considering the server error fatal.  It should only affect the
unusual case where TCP connections to NFSv4 servers are breaking
without the NFSv4 server rebooting.

Reported by: J David <j.devid.lists@gmail.com>
MFC after: 2 weeks

7 months agopmc.amd(3): rename from pmc.k8(3)
Mitchell Horne [Wed, 18 Oct 2023 17:57:06 +0000 (14:57 -0300)]
pmc.amd(3): rename from pmc.k8(3)

This is the first step in recognizing that the K8 microarchitecture
represents a small and aged subset of AMD CPUs supported by this class.
Future changes will update the code and documentation details to better
reflect this.

Keep the old filename as an alias.

Reviewed by: jkoshy
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41279

7 months agopmc: remove last bits of AMD K7 CPU support
Mitchell Horne [Wed, 18 Oct 2023 17:56:41 +0000 (14:56 -0300)]
pmc: remove last bits of AMD K7 CPU support

This includes event definitions from sys/pmc_events.h, definitions from
sys/pmc.h, and the man pages.

Reviewed by: jkoshy
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41275

7 months agohwpmc_amd: kill off k7 support bits
Mitchell Horne [Wed, 18 Oct 2023 17:54:24 +0000 (14:54 -0300)]
hwpmc_amd: kill off k7 support bits

This is i386-only, and has been effectively disabled since 2018 when the
companion support was removed from libpmc (e92a1350b50e). Remove the
kernel support to simplify the AMD class.

Reviewed by: jkoshy
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41274

7 months agohwpmc_amd: simplify counter descriptor definitions
Mitchell Horne [Wed, 18 Oct 2023 17:54:04 +0000 (14:54 -0300)]
hwpmc_amd: simplify counter descriptor definitions

No functional change intended.

Reviewed by: jkoshy
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41273

7 months agohpwmc_amd.c: style improvements
Mitchell Horne [Wed, 18 Oct 2023 17:53:27 +0000 (14:53 -0300)]
hpwmc_amd.c: style improvements

 - Return style
 - Explicit value checks
 - Whitespace formatting
 - Comment formatting
 - Local variable declaration order
 - __unused annotations

Reviewed by: jkoshy
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41272

7 months agohwpmc_core: remove two non-existent function prototypes
Mitchell Horne [Wed, 18 Oct 2023 17:53:05 +0000 (14:53 -0300)]
hwpmc_core: remove two non-existent function prototypes

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

7 months agohwpmc: tidy pcd_finalize methods
Mitchell Horne [Wed, 18 Oct 2023 17:50:49 +0000 (14:50 -0300)]
hwpmc: tidy pcd_finalize methods

Make them a little bit more consistent with one another in terms of what
is done:
 - Add/reduce assertions to what is most useful: a loop to ensure
   pcpu_fini freed everything
 - Add PMCDBG trace entries

The exception is the dmc620/cmn600 classes, which behave a little
differently, so leave them untouched.

Reviewed by: jkoshy
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41270

7 months agofreebsd-update: allow user to break out of conflict resolution loop
Ed Maste [Fri, 3 Mar 2023 17:32:51 +0000 (12:32 -0500)]
freebsd-update: allow user to break out of conflict resolution loop

When a conflict marker is found during update allow the user to confirm
they want it to remain in the file.

Suggested by: Tim Hogard
Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Fixes: ceb5f28ba5fc ("freebsd-update: re-edit files if merge confli...")
Differential Revision: https://reviews.freebsd.org/D38896

7 months agoRemove $FreeBSD$: one line sh-pattern
Jose Luis Duran [Wed, 18 Oct 2023 15:14:33 +0000 (09:14 -0600)]
Remove $FreeBSD$: one line sh-pattern

Remove the $FreeBSD$ pattern added to the tests, as well as fixing the
mkimg_test.sh script to stop adding it when we rebase the tests.

Reviewed by: imp, emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/870

7 months agorm description of EXTRA_TCP_STACKS option.
Dag-Erling Smørgrav [Wed, 18 Oct 2023 15:00:19 +0000 (17:00 +0200)]
rm description of EXTRA_TCP_STACKS option.

Fixes: 3a338c534154
Reported by: mhorne

7 months agofreebsd-update: for rollback, first create directories
Ed Maste [Fri, 29 Sep 2023 15:28:35 +0000 (11:28 -0400)]
freebsd-update: for rollback, first create directories

rollback_files() tried to install files before creating the directories
for those files.  In some cases this is due to special handling to
install certain classes of files earlier than others.

Just create all directories up front when performing rollback.

PR: 273950
Reviewed by: dim
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42020

7 months agofreebsd-update: handle directories changing to files
Ed Maste [Tue, 12 Sep 2023 02:59:30 +0000 (22:59 -0400)]
freebsd-update: handle directories changing to files

Further to f6d37c9ca13f ("freebsd-update: handle file -> directory on
upgrade"), handle the reverse case of a directory changing to a file.
We may not encounter this case on upgradess (before freebsd-update is
retired) but it is needed to support rollback.

PR: 273950
Reviewed by: dim
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41945

7 months agoAdd the BBR and RACK stacks to the LINT kernel.
Dag-Erling Smørgrav [Wed, 18 Oct 2023 14:13:12 +0000 (16:13 +0200)]
Add the BBR and RACK stacks to the LINT kernel.

While here, drop the EXTRA_TCP_STACKS option, which serves no purpose and
should never have been added.  Instead, build bbr and rack as long as
either or both of INET and INET6 is enabled.  There is no risk to anyone
who doesn't load one or both and then twiddle the relevant sysctls.

Differential Revision: https://reviews.freebsd.org/D42088

7 months agolibc: Fix missing or misspelled MLINKS.
Dag-Erling Smørgrav [Wed, 18 Oct 2023 14:05:44 +0000 (16:05 +0200)]
libc: Fix missing or misspelled MLINKS.

Differential Revision: https://reviews.freebsd.org/D42192

7 months agomemory(3): Mention more functions.
Dag-Erling Smørgrav [Wed, 18 Oct 2023 14:05:41 +0000 (16:05 +0200)]
memory(3): Mention more functions.

Differential Revision: https://reviews.freebsd.org/D42191

7 months agohesiod: Modernize.
Dag-Erling Smørgrav [Wed, 18 Oct 2023 14:05:37 +0000 (16:05 +0200)]
hesiod: Modernize.

Reviewed by: zlei
Differential Revision: https://reviews.freebsd.org/D42190

7 months agolinuxkpi: Fix an assertion in linux_free_kmem()
Mark Johnston [Wed, 18 Oct 2023 13:43:02 +0000 (09:43 -0400)]
linuxkpi: Fix an assertion in linux_free_kmem()

In the LinuxKPI, PAGE_MASK is the logical negation of FreeBSD's
PAGE_MASK, so the original assertion was simply incorrect.

Reported by: trasz
Tested by: trasz
Fixes: 6223d0b67af9 ("linuxkpi: Handle direct-mapped addresses in linux_free_kmem()")

7 months agobsdinstall: Fail nicely in jail target
Fernando Apesteguía [Tue, 17 Oct 2023 13:37:04 +0000 (15:37 +0200)]
bsdinstall: Fail nicely in jail target

If the directory is empty we fail with a message regarding mkdir in which
the empty directory can't be seen because it is not quoted.

Show a nice message so the user knows what is going on.

Reviewed by: bapt@
Differential Revision: https://reviews.freebsd.org/D42252

7 months agostress2: Fix "-Wunused-but-set-variable" warnings
Peter Holm [Wed, 18 Oct 2023 06:54:38 +0000 (08:54 +0200)]
stress2: Fix "-Wunused-but-set-variable" warnings

7 months agonfsd: Fix a server crash
Rick Macklem [Wed, 18 Oct 2023 02:40:23 +0000 (19:40 -0700)]
nfsd: Fix a server crash

PR#274346 reports a crash which appears to be caused by a NULL default session
being destroyed.  This patch should avoid the crash.

Tested by: Joshua Kinard <freebsd@kumba.dev>
PR: 274346
MFC after: 2 weeks

7 months agomkimg: Regenerate all the tests for gpt
Warner Losh [Tue, 17 Oct 2023 21:54:20 +0000 (15:54 -0600)]
mkimg: Regenerate all the tests for gpt

Recent changes to mkimg has changed the generated GPT images to be more
correct. Use make rebase to regenerate the baseline.

Sponsored by: Netflix

7 months agomkimg_test: remove vtoc8 images, they aren't needed
Warner Losh [Tue, 17 Oct 2023 21:52:02 +0000 (15:52 -0600)]
mkimg_test: remove vtoc8 images, they aren't needed

vtoc8 support expired with sparc64 removal, so remove them all.

Sponsored by: Netflix

7 months agonfsd: Avoid acquiring a vnode for some NFSv4 Readdir operations
Rick Macklem [Tue, 17 Oct 2023 20:55:48 +0000 (13:55 -0700)]
nfsd: Avoid acquiring a vnode for some NFSv4 Readdir operations

Without this patch, a NFSv4 Readdir operation acquires the vnode for
each entry in the directory.  If only the Type, Fileid, Mounted_on_fileid
and ReaddirError attributes are requested by a client, acquiring the vnode
is not necessary for non-directories.  Directory vnodes must be acquired
to check for server file system mount points.

This patch avoids acquiring the vnode, as above, resulting in a 3-8%
improvement in Readdir RPC RTT for some simple tests I did.

Note that only non-rdirplus NFSv4 mounts will benefit from this change.

Tested during a recent IETF NFSv4 Bakeathon testing event.

MFC after: 1 month

7 months agolltable: fix ddb show llentry l3_addr pretty printer
R. Christian McDonald [Tue, 17 Oct 2023 17:03:49 +0000 (19:03 +0200)]
lltable: fix ddb show llentry l3_addr pretty printer

The ddb commands for lltable do not produce useful l3_addr information.

This fixes the llentry pretty printer to correctly display the l3_addr

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D42253

7 months agondp: fix timestamp display output
R. Christian McDonald [Tue, 17 Oct 2023 16:57:22 +0000 (18:57 +0200)]
ndp: fix timestamp display output

The current xo_format string is incorrect. This restores the display
format prior to libxo-ification work while also explicitly marking
tv_sec and tv_usec as encoded output only.

MFC after: 1 week
Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D42269

7 months agobhyve: Remove init_snapshot() and initialize static vars
Vitaliy Gusev [Tue, 17 Oct 2023 14:16:08 +0000 (14:16 +0000)]
bhyve: Remove init_snapshot() and initialize static vars

vCPU threads are starting before init_snapshot() is called. That can lead
to corruption of vcpu_lock userspace mutex (snapshot.c) and then VM hangs
in acquiring that mutex.

init_snapshot() initializes only static variables (mutex, cv) and that
code can be optimized and removed.

Fixes: 9a9a248964696 ("bhyve: init checkput before caph_enter")
Reviewed by: markj
MFC after: 1 week
Sponsored by: vStack

7 months agoMakefile.inc1: remove ncurses/form from _prebuild_libs
Ed Maste [Mon, 16 Oct 2023 13:12:16 +0000 (09:12 -0400)]
Makefile.inc1: remove ncurses/form from _prebuild_libs

As of d287d3282f43 libbsddialog has a built-in form implementation and
does not need a formw dependency.

This reverts commit 483a226238ed8949c6d280ae0757a0683962a74b.

Reported by: asiciliano
Sponsored by: The FreeBSD Foundation

7 months agomkimg: Ensure GPT Entry Array is at least 16k
Warner Losh [Tue, 17 Oct 2023 17:14:14 +0000 (11:14 -0600)]
mkimg: Ensure GPT Entry Array is at least 16k

UEFI v2.10 Section 5.3 documentes that the minimum reserved space after
the GPT header be at least 16kB. Enforce this minimum. Before, we'd only
set the number of entries to be the unpadded size. gpart's selective
enforcement of aspects of the GPT standard meant that these images would
work, but couldn't be changed (to add a partition or grow the size of a
partition). This ensures that gpart's overly picky standards don't cause
problems for people wishing to, for example, resize release images.

MFC after: 1 day (we want this in 14.0)
PR: 274312
Sponsored by: Netflix
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D42245

7 months agoautomount(8): when flushing autofs, specify fsid
Konstantin Belousov [Fri, 29 Sep 2023 18:43:42 +0000 (21:43 +0300)]
automount(8): when flushing autofs, specify fsid

Which should avoid situation where flushed filesystem is not autofs,
because it was mounted over autofs mp.

Reported and tested by: Andrew "RhodiumToad" Gierth <andrew@tao11.riddles.org.uk>
PR: 272446
Reviewed by: mjg
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D42023

7 months agoautomount: check for mounted-over autofs instances on flush
Andrew Gierth [Mon, 10 Jul 2023 15:09:56 +0000 (16:09 +0100)]
automount: check for mounted-over autofs instances on flush

PR: 272446
Reviewed by: kib
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D40961

7 months agonmount(MNT_UPDATE): add optional generid fsid parameter
Konstantin Belousov [Fri, 29 Sep 2023 18:42:50 +0000 (21:42 +0300)]
nmount(MNT_UPDATE): add optional generid fsid parameter

to check looked up path against specific mounted filesystem.

Reviewed by: mjg
Tested by: Andrew Gierth <andrew@tao146.riddles.org.uk>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D42023

7 months agobhyve: Use VMIO_SIOCSIFFLAGS instead of SIOCGIFFLAGS
Jan Bramkamp [Mon, 4 Sep 2023 08:38:25 +0000 (10:38 +0200)]
bhyve: Use VMIO_SIOCSIFFLAGS instead of SIOCGIFFLAGS

Creating an IP socket to invoke the SIOCGIFFLAGS ioctl on is the only
thing preventing bhyve from working inside a bhyve jail with IPv4 and
IPv6 disabled restricting the jailed bhyve process to only access the
host network via a tap/vmnet device node.

PR: 273557
Fixes: 56be282bc999 ("bhyve: net_backends, automatically IFF_UP tap devices")
Reviewed by: markj
MFC after: 1 week

7 months agonetinet tests: Add error handling tests for UDP with v4-mapped sockets
Mark Johnston [Tue, 17 Oct 2023 14:29:42 +0000 (10:29 -0400)]
netinet tests: Add error handling tests for UDP with v4-mapped sockets

This provides a regression test for commit abca3ae7734f.

Add it to the existing v4-mapped address test file, and rename
accordingly.

Reviewed by: tuexen, karels, rrs
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39216