]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 months agoMerge llvm-project main llvmorg-17-init-19304-gd0b54bb50e51
Dimitry Andric [Sat, 2 Sep 2023 21:17:18 +0000 (23:17 +0200)]
Merge llvm-project main llvmorg-17-init-19304-gd0b54bb50e51

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-17-init-19304-gd0b54bb50e51, the
last commit before the upstream release/17.x branch was created.

PR: 273753
MFC after: 1 month

5 months agolibcasper: document that most libcasper functions are not thread-safe
Alan Somers [Tue, 5 Dec 2023 23:24:28 +0000 (16:24 -0700)]
libcasper: document that most libcasper functions are not thread-safe

And neither are most libcasper services' functions, because internally
they all use cap_xfer_nvlist.  cap_xfer_nvlist sends and then receives
data over a unix domain socket and associated with the cap_channel_t
argument.  So absent synchronization, two threads may not use the same
cap_channel_t argument or they risk receiving the other's reply.

MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: oshogbo
Differential Revision: https://reviews.freebsd.org/D42928

5 months agoNotable upstream pull request merges:
Martin Matuska [Fri, 8 Dec 2023 08:32:30 +0000 (09:32 +0100)]
Notable upstream pull request merges:
 #15539 687e4d7f9 Extend import_progress kstat with a notes field
 #15544 c7b611926 Allow block cloning across encrypted datasets
 #15553 adcea23cb ZIO: Add overflow checks for linear buffers
 #15593 5f2700eee zpool: flush output before sleeping
 #15609 3e4bef52b Only provide execvpe(3) when needed
 #15610 735ba3a7b Use uint64_t instead of u_int64_t
 #15612 bcd83ccd2 ZIL: Remove TX_CLONE_RANGE replay for ZVOLs
 #15617 55b764e06 ZIL: Do not clone blocks from the future
 #15623 727497ccd module/icp/asm-arm/sha2: enable non-SIMD asm kernels
                  on armv5/6
 #15625 9743d0963 BRT: Limit brt_vdev_dump() to only one vdev
 #15629 f9765b182 zdb: Dump encrypted write and clone ZIL records
 #15634 2aa3a482a ZIL: Remove 128K into 2x68K LWB split optimization
 #15639 11656234b FreeBSD: Ensure that zfs_getattr() initializes the
                  va_rdev field
 #15647 4836d293c zfs_refcount_remove: explictly ignore returns
 #15649 f0cb6482e setproctitle: fix ununitialised variable
 #15650 450f2d0b0 import: ignore return on hostid lookups

Obtained from: OpenZFS
OpenZFS commit: 450f2d0b08e73cfb057d0e301a813418b70d64b9

5 months agovmstat: Rely on libxo for numbers humanization
Alexander Motin [Fri, 8 Dec 2023 02:21:35 +0000 (21:21 -0500)]
vmstat: Rely on libxo for numbers humanization

This makes code cleaner, plus fixes such nonsense as humanized JSON
and XML, making all numbers raw without quotes, spaces, suffixes, etc.

MFC after:      2 weeks

5 months agovmm: implement VM_CAP_MASK_HWINTR on AMD CPUs
Bojan Novković [Thu, 7 Dec 2023 23:08:58 +0000 (15:08 -0800)]
vmm: implement VM_CAP_MASK_HWINTR on AMD CPUs

This patch implements the interrupt blocking VM capability on AMD
CPUs.  Implementing this capability allows the GDB stub to single-step
a virtual machine without landing inside interrupt handlers.

Reviewed by: jhb, corvink
Sponsored by:   Google, Inc. (GSoC 2022)
Differential Revision: https://reviews.freebsd.org/D42299

5 months agovmm: implement single-stepping for AMD CPUs
Bojan Novković [Thu, 7 Dec 2023 23:00:31 +0000 (15:00 -0800)]
vmm: implement single-stepping for AMD CPUs

This patch implements single-stepping for AMD CPUs using the RFLAGS.TF
single-stepping mechanism.  The GDB stub requests single-stepping
using the VM_CAP_RFLAGS_TF capability.  Setting this capability will
set the RFLAGS.TF bit on the selected vCPU, activate DB exception
intercepts, and activate POPF/PUSH instruction intercepts.  The
resulting DB exception is then caught by the IDT_DB vmexit handler and
bounced to userland where it is processed by the GDB stub.  This patch
also makes sure that the value of the TF bit is correctly updated and
that it is not erroneously propagated into memory.  Stepping over PUSHF
will cause the vm_handle_db function to correct the pushed RFLAGS
value and stepping over POPF will update the shadowed TF bit copy.

Reviewed by: jhb
Sponsored by: Google, Inc. (GSoC 2022)
Differential Revision: https://reviews.freebsd.org/D42296

5 months agovmm: enable software breakpoints for AMD CPUs
Bojan Novković [Thu, 7 Dec 2023 22:46:31 +0000 (14:46 -0800)]
vmm: enable software breakpoints for AMD CPUs

This patch adds support for software breakpoint vmexits on AMD SVM.
It implements the VM_CAP_BPT_EXIT used to enable software breakpoints.
When enabled, breakpoint vmexits are passed to userspace where they
are handled by the GDB stub.

Reviewed by: jhb
Sponsored by: Google, Inc. (GSoC 2022)
Differential Revision: https://reviews.freebsd.org/D42295

5 months agovmm: refactor event reflection in AMD SVM
Bojan Novković [Thu, 7 Dec 2023 22:40:28 +0000 (14:40 -0800)]
vmm: refactor event reflection in AMD SVM

This patch refactors AMD SVM event reflection to allow events to be
propagated to userland, rather than always reflected into the guest.

This is necessary to implement some capabilities that request VMEXITs
when a specific exception occurs (e.g. VM_CAP_BPT_EXIT).

Reviewed by: jhb
Sponsored by: Google, Inc. (GSoC 2022)
Differential Revision: https://reviews.freebsd.org/D42405

5 months agotcp_hpts: let tcp_hpts_init() set a random CPU only once
Gleb Smirnoff [Thu, 7 Dec 2023 22:41:43 +0000 (14:41 -0800)]
tcp_hpts: let tcp_hpts_init() set a random CPU only once

After d2ef52ef3dee the tcp_hpts_init() function can be called multiple
times on a tcpcb if it is switched there and back between two TCP stacks.
First, this makes existing assertion in tcp_hpts_init() incorrect.  Second,
it creates possibility to change a randomly set t_hpts_cpu to a different
random value, while a tcpcb is already in the HPTS wheel, triggering other
assertions later in tcp_hptsi().

The best approach here would be to work on the stacks to really clear a
tcpcb out of HPTS wheel in tfb_tcp_fb_fini, draining the IHPTS_MOVING
state.  But that's pretty intrusive change, so let's just get back to the
old logic (pre d2ef52ef3dee) where t_hpts_cpu was set to a random value
only once in a CPU lifetime and a newly switched stack inherits t_hpts_cpu
from the previous stack.

Reviewed by: rrs, tuexen
Differential Revision: https://reviews.freebsd.org/D42946
Reported-by: syzbot+fab29fe1ab089c52998d@syzkaller.appspotmail.com
Reported-by: syzbot+ca5f2aa0fda15dcfe6d7@syzkaller.appspotmail.com
Fixes: 2b3a77467dd3d74a7170f279fb25f9736b46ef8a

5 months agotcp: stop stack timers in tcp_switch_back_to_default()
Gleb Smirnoff [Thu, 7 Dec 2023 22:41:36 +0000 (14:41 -0800)]
tcp: stop stack timers in tcp_switch_back_to_default()

This funcion is an alternative code path that detaches an alternative
TCP stack, missed in d2ef52ef3dee38cccb7f54d33ecc2a4b944dad9d.

Reviewed by: rrs, tuexen
Differential Revision: https://reviews.freebsd.org/D42917
Reported-by: syzbot+186130be9f0ca5557d4e@syzkaller.appspotmail.com
Fixes: d2ef52ef3dee38cccb7f54d33ecc2a4b944dad9d

5 months agoCirrus CI: Add manual jobs for amd64 and aarch64 using GCC 13
John Baldwin [Thu, 7 Dec 2023 22:32:08 +0000 (14:32 -0800)]
Cirrus CI: Add manual jobs for amd64 and aarch64 using GCC 13

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D42840

5 months agoRevert "linuxkpi: `GFP_KERNEL` equals `M_NOWAIT` now"
Jean-Sébastien Pédron [Thu, 7 Dec 2023 18:45:25 +0000 (19:45 +0100)]
Revert "linuxkpi: `GFP_KERNEL` equals `M_NOWAIT` now"

This change seems to break some drivers such as the mlx5*(4) drivers.

As kib@ says:
> According to the 'official' Linux kernel documentation, the GFP_KERNEL
> flag implies sleepable context.

It was introduced while working on the new vt(4)/DRM integration [1].
During this work, doing sleepable allocations broke vt(4) and the DRM
drivers. However, I made further improvements and some locking-related
fixed to the new integration without revisiting the need for it.

After more testing, the improvements to the integration mentionned above
seems to make the change to `GFP_KERNEL` unneeded now. I can thus
revert it to restore expectations of other drivers.

This reverts commit 14dcd40983748596d116d91acb934a8a95ac76bc.

[1] https://github.com/freebsd/drm-kmod/pull/243

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

5 months agobuild: use bare (and portable) echo instead of echo -n
Warner Losh [Thu, 7 Dec 2023 20:27:27 +0000 (13:27 -0700)]
build: use bare (and portable) echo instead of echo -n

There's no need to use echo -n here. A single echo will do nicely.
This fixes the post-buildworld output on a macos build, where echo -n
is implemented like System V instead of BSD (so you get two lines
first one starting with -n).

Sponsored by: Netflix
Reviewed by: jrtc27, emaste
Differential Revision: https://reviews.freebsd.org/D42869

5 months agosort: Only build FreeBSD-specific ALTMON_x stuff when ATLMON_1 is defined
Warner Losh [Thu, 7 Dec 2023 20:27:07 +0000 (13:27 -0700)]
sort: Only build FreeBSD-specific ALTMON_x stuff when ATLMON_1 is defined

On MacOS, we bootstrap sort. Since ALTMON_* are not defined there, the
build blows up. Since we don't need this feature for the FreeBSD build
process, and since we won't use it unless we actually install the NL
files that have this data in it, just #ifdef it out for now. In the
extremely unlikely event that the FreeBSD bootstrap/build process grows
this dependency, we can evaluate the best solution then (which most
likely is going to be not depend on the local's month names).

Fixes: 3d44dce90a69 (MacOS builds and github CI)
Sponsored by: Netflix
Reviewed by: jrtc27, jlduran@gmail.com, markj
Differential Revision: https://reviews.freebsd.org/D42868

5 months agocp: Don't warn for chflags() failing with EOPNOTSUPP if flags == 0
Warner Losh [Thu, 7 Dec 2023 19:32:30 +0000 (12:32 -0700)]
cp: Don't warn for chflags() failing with EOPNOTSUPP if flags == 0

From NetBSD's utils.c 1.5 importing importing BSDI change, with light
formatting changes:
    Author: cgd <cgd@NetBSD.org>
    Date:   Wed Feb 26 14:40:51 1997 +0000

    Patch from BSDI (via Keith Bostic):
    >NFS doesn't support chflags; ignore errors unless there's reason
    >to believe we're losing bits.  (Note, this still won't be right
    >if the server supports flags and we were trying to *remove* flags
    >on a file that we copied, i.e., that we didn't create.)

    CVS Info: utils.c 1.6

Obtained from: NetBSD
Sponsored by: Netflix

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

5 months agocp: Add -N flag, inspired by NetBSD's similar flag
Warner Losh [Thu, 7 Dec 2023 19:32:27 +0000 (12:32 -0700)]
cp: Add -N flag, inspired by NetBSD's similar flag

Add -N to supress copying of file flags when -p is specified (explicitly
or implicitly). Often times we don't care about the flags or wish to be
able to copy to NFS, and this comes in handy for that. FreeBSD's and
NetBSD's cp are somewhat different, so I had to reimplement all but one
of the patch hunks...

Obtained from: NetBSD (cp.1 1.25, cp.c 1.37, utils.c 1.28 by elad)
Sponsored by: Netflix

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

5 months agocamcontrol: One file per line in Makefile
Warner Losh [Fri, 1 Dec 2023 03:07:53 +0000 (20:07 -0700)]
camcontrol: One file per line in Makefile

We have enough files now that moving to one file per line makes sense.

Sponsored by: Netflix

6 months agoif_smsc: fix build on armv6 & armv7
Ronald Klop [Thu, 7 Dec 2023 16:46:58 +0000 (17:46 +0100)]
if_smsc: fix build on armv6 & armv7

compile error was:
/usr/src/sys/dev/usb/net/if_smsc.c:1597:40: error: format specifies type 'unsigned long' but the argument has type 'ssize_t' (aka 'int') [-Werror,-Wformat]
                                "failed alloc for bootargs (%lu)", len);
                                                            ~~~    ^~~
                                                            %zd

PR: 274092
Approved by: karels
MFC after: 1 month

6 months agoimport: ignore return on hostid lookups
Rob N [Thu, 7 Dec 2023 16:41:54 +0000 (03:41 +1100)]
import: ignore return on hostid lookups

Just silencing a warning. Its totally fine for a hostid to not be there.

Reported-by: Coverity (CID-1573336)
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #15650

6 months agosetproctitle: fix ununitialised variable
Rob N [Thu, 7 Dec 2023 16:23:16 +0000 (03:23 +1100)]
setproctitle: fix ununitialised variable

Reported-by: Coverity (CID-1573333)
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #15649

6 months agozfs_refcount_remove: explictly ignore returns
Rob N [Thu, 7 Dec 2023 16:21:38 +0000 (03:21 +1100)]
zfs_refcount_remove: explictly ignore returns

Coverity noticed that sometimes we ignore the return, and sometimes we
don't. Its not wrong, and I like consistent style, so here we are.

Reported-by: Coverity (CID-1564584)
Reported-by: Coverity (CID-1564585)
Reported-by: Coverity (CID-1564586)
Reported-by: Coverity (CID-1564587)
Reported-by: Coverity (CID-1564588)
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #15647

6 months agoFreeBSD: Ensure that zfs_getattr() initializes the va_rdev field
Mark Johnston [Thu, 7 Dec 2023 16:20:11 +0000 (11:20 -0500)]
FreeBSD: Ensure that zfs_getattr() initializes the va_rdev field

Otherwise the field is left uninitialized, leading to a possible kernel
memory disclosure to userspace or to the network.  Use the same
initialization value we use in zfsctl_common_getattr().

Reported-by: KMSAN
Sponsored-by: The FreeBSD Foundation
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ed Maste <emaste@FreeBSD.org>
Signed-off-by: Mark Johnston <markj@FreeBSD.org>
Closes #15639

6 months agotcp: shift PRR sending cadence slightly left
Richard Scheffenegger [Thu, 7 Dec 2023 14:13:05 +0000 (15:13 +0100)]
tcp: shift PRR sending cadence slightly left

Don't let PRR pass up on the opportunity of clocking
out packets on arrival of ACKs - by pulling sends
forward by about half a packet. Prevents unexpectedly
long runs of incoming ACKs without eliciting a
packet transmission.

MFC after:             1 week
Reviewed By:           #transport, tuexen
Sponsored by:          NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D42918

6 months agobsd-family-tree: add FreeBSD 14
Sergey A. Osokin [Thu, 7 Dec 2023 14:26:12 +0000 (09:26 -0500)]
bsd-family-tree: add FreeBSD 14

MFC after: 3 days

6 months agosiftr: refactor batch log processing
Richard Scheffenegger [Thu, 7 Dec 2023 13:43:03 +0000 (14:43 +0100)]
siftr: refactor batch log processing

Refactoring to perform the batch processing of
log messaged in two phases. First cycling through a limited
number of collected packets, and only thereafter freeing
the processed packets. This prevents any chance of calling
free while in a critical / spinlocked section.

Reviewed By:           tuexen
Sponsored by:          NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D42949

6 months agovnet: (read) lock the vnet list while iterating it
Kristof Provost [Tue, 5 Dec 2023 19:08:11 +0000 (20:08 +0100)]
vnet: (read) lock the vnet list while iterating it

Ensure that the vnet list cannot be modified while we're running through
it.

Reviewed by: mjg (previous version), zlei (previous version)
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D42927

6 months agoTeach if_smsc to get MAC from bootargs.
Ronald Klop [Sat, 4 Nov 2023 14:14:00 +0000 (15:14 +0100)]
Teach if_smsc to get MAC from bootargs.

Some Raspberry Pi pass smsc95xx.macaddr=XX:XX:XX:XX:XX:XX as bootargs.
Use this if no ethernet address is found in an EEPROM.
As last resort fall back to ether_gen_addr() instead of random MAC.

PR: 274092
Reported by: Patrick M. Hausen (via ML)
Reviewed by: imp, karels, zlei
Tested by: Patrick M. Hausen
Approved by: karels
MFC after: 1 month
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D42463

6 months agobsdinstall: add include to SUBDIR
Simon J. Gerraty [Thu, 7 Dec 2023 06:17:14 +0000 (22:17 -0800)]
bsdinstall: add include to SUBDIR

6 months agorc.conf: correct $ntp_leapfile_sources
Philip Paeps [Thu, 7 Dec 2023 05:48:13 +0000 (13:48 +0800)]
rc.conf: correct $ntp_leapfile_sources

IETF is no longer serving leap-seconds.list.  Point at IANA instead.

This fixes "service ntpd fetch".

MFC after: 1 day

6 months agovmstat: Let libxo properly humanize -m numbers
Alexander Motin [Thu, 7 Dec 2023 04:08:45 +0000 (23:08 -0500)]
vmstat: Let libxo properly humanize -m numbers

Raw numbers can be seen in json/xml or with --libxo=no-humanize.

MFC after: 2 weeks

6 months agobsdinstall generate opt_osname.h in include
Simon J. Gerraty [Thu, 7 Dec 2023 02:34:52 +0000 (18:34 -0800)]
bsdinstall generate opt_osname.h in include

This allows the subdirs that do more work to run in parallel

Reviewed by: jrtc27
Differential Revision: https://reviews.freebsd.org/D42947

6 months agoBRT: Limit brt_vdev_dump() to only one vdev
Alexander Motin [Wed, 6 Dec 2023 23:37:27 +0000 (18:37 -0500)]
BRT: Limit brt_vdev_dump() to only one vdev

Without this patch on pool of 60 vdevs with ZFS_DEBUG enabled clone
takes much more time than copy, while heavily trashing dbgmsg for
no good reason, repeatedly dumping all vdevs BRTs again and again,
even unmodified ones.

I am generally not sure this dumping is not excessive, but decided
to keep it for now, just restricting its scope to more reasonable.

Reviewed-by: Kay Pedersen <mail@mkwg.de>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15625

6 months agobusdma: tidy bus_dma_run_filter() functions
Mitchell Horne [Wed, 6 Dec 2023 23:09:27 +0000 (19:09 -0400)]
busdma: tidy bus_dma_run_filter() functions

After removing filter functionality, the naming doesn't clearly
represent what the function does, so try to address this. Include some
code clarity and style improvements.

Create a common version in subr_busdma_bounce.c, used by most
implementations. powerpc still needs its own version of the function,
due to its dmat->iommu == NULL check.

No functional change intended.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42896

6 months agobusdma: remove parent tag tracking
Mitchell Horne [Wed, 6 Dec 2023 23:08:51 +0000 (19:08 -0400)]
busdma: remove parent tag tracking

Without filter functions, we do not need to keep track of tag ancestry.
All inheritance of the parent tag's parameters occurs when creating the
new child tag.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42895

6 months agobusdma: kill filter functionality internally
Mitchell Horne [Wed, 6 Dec 2023 23:08:13 +0000 (19:08 -0400)]
busdma: kill filter functionality internally

Address filter functions are unused, unsupported, and now rejected.
Simplify some busdma code by removing filter functionality completely.

Note that the chains of parent tags become useless, and will be cleaned
up in the next commit.

No functional change intended.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42894

6 months agobusdma: Prevent the use of filters with bus_dma_tag_create()
Mitchell Horne [Wed, 6 Dec 2023 23:07:31 +0000 (19:07 -0400)]
busdma: Prevent the use of filters with bus_dma_tag_create()

A deprecation notice was added to the bus_dma(9) man page by scottl@ in
September 2020 discouraging the use of filter functions. I've performed
an attentive check of all callers in the tree and everything that exists
today passes NULL for both filtfunc and filtarg. Thus, we should start
returning EINVAL if these arguments are non-NULL to prevent new usages
from popping up. Update the man page to be more clear about this.

The deprecation notice is present since at least 13.0-RELEASE, so this
is the appropriate step for the lifetime of 15, without actually
breaking the driver API. Stable branches will emit a warning instead.

This change enables the removal of a fair amount of unused complexity
across the various busdma implementations.

Reviewed by: jhb
MFC after: never
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42852

6 months agoZIL: Remove 128K into 2x68K LWB split optimization
Alexander Motin [Wed, 6 Dec 2023 23:02:05 +0000 (18:02 -0500)]
ZIL: Remove 128K into 2x68K LWB split optimization

To improve 128KB block write performance in case of multiple VDEVs
ZIL used to spit those writes into two 64KB ones.  Unfortunately it
was found to cause LWB buffer overflow, trying to write maximum-
sizes 128KB TX_CLONE_RANGE record with 1022 block pointers into
68KB buffer, since unlike TX_WRITE ZIL code can't split it.

This is a minimally-invasive temporary block cloning fix until the
following more invasive prediction code refactoring.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15634

6 months agobsdinstall: Encode dists to valid variable names in checksum script
Jessica Clarke [Wed, 6 Dec 2023 21:37:32 +0000 (21:37 +0000)]
bsdinstall: Encode dists to valid variable names in checksum script

Currently we just strip the .txz of the dist name (and add a status_
prefix) to get the shell variable name for its status, but this doesn't
give a valid result for dists like base-dbg, kernel-dbg and lib32-dbg,
or even kernel.KERNCONF (or, combining the two, kernel.KERNCONF-dbg). As
a result, four things go wrong for such dists:

1. If there is a dot and/or a dash in the name, writing to the variable
   fails and spits an error out on stderr to the log
3. If there is a dot in the name before any dash, the syntax is always
   invalid, reading the variable fails, spits an error out on stderr to
   the log, the result is the empty string and that is interpreted as
   being 0%
2. If there is a dash in the name before any dot, and there is a dist
   whose name is the substring up to that first dash, and it has already
   had its status written to, reading the variable instead reads that
   dist's variable and so the status of that dist is displayed instead
3. If there is a dash in the name before any dot, and either there is
   not a dist whose name is the substring up to that first dash or there
   is such a dist but it has not already had its status written to,
   reading the varaible instead results in the substring after the first
   dash, including any additional string expansion syntax that follows
   (i.e. ${status_kernel-dbg:--11}, the expression used to read the
   variable, is interpreted as reading status_kernel with a default
   value of "dbg:--11")

For example, in a default install with base, kernel, kernel-dbg and
lib32, the following sequence of displays happens:

1. base is In Progress, kernel is Pending, kernel-dbg is 0% (what shows
   for the garbage input "dbg:--11") and lib32 is Pending
2. base is Passed, kernel is In Progress, kernel-dbg is In Progress
   (since kernel has now had its status written to) and lib32 is
   Pending
3. base is Passed, kernel is Passed, kernel-dbg is Passed (again, since
   that is the status of kernel, despite that kernel-dbg is being
   verified at this point) and lib32 is Pending
4. base is Passed, kernel is Passed, kernel-dbg is Passed and lib32 is
   In Progress

Fix this with a crude encoding scheme. More special characters can
easily be added if needed in future.

Note that, prior to bsddialog being used (and thus for branches this is
MFC'ed to where dialog is still used), the same problem existed but
displayed slightly differently due to a combination of different default
values and different behaviour for unintended inputs.

Fixes: b70047d41362 ("Add generation of an installation manifest containing SHA256 checksums as ...")
MFC after: 1 week

6 months agolibc: simplify MDASM/NOASM checks
Brooks Davis [Wed, 6 Dec 2023 20:48:46 +0000 (20:48 +0000)]
libc: simplify MDASM/NOASM checks

Use boolean evaluation of :M matches and a single if statement.

Reviewed by: imp, kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D42915

6 months agolibc: don't needlessly add vfork.o to NOASM
Brooks Davis [Wed, 6 Dec 2023 20:48:39 +0000 (20:48 +0000)]
libc: don't needlessly add vfork.o to NOASM

For architectures where vfork.S was named Ovfork.S this was needed, but
it was always pointless here as an entry in either MDASM or NOASM is
equivalent.

Reviewed by: kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D42914

6 months agolibc: rename arm and i386 Ovfork.S to vfork.S
Brooks Davis [Wed, 6 Dec 2023 20:47:50 +0000 (20:47 +0000)]
libc: rename arm and i386 Ovfork.S to vfork.S

While this has been Ovfork.S forever on i386 it differs from other
syscalls that require wrappers for no obvious reason so fix that.

Reviewed by: kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D42909

6 months agozdb: Dump encrypted write and clone ZIL records
Alexander Motin [Wed, 6 Dec 2023 20:39:12 +0000 (15:39 -0500)]
zdb: Dump encrypted write and clone ZIL records

Block pointers are not encrypted in TX_WRITE and TX_CLONE_RANGE
records, so we can dump them, that may be useful for debugging.

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

6 months agocompact: workaround for GPL-only symbols on riscv from Linux 6.2
Shengqi Chen [Wed, 6 Dec 2023 20:37:50 +0000 (04:37 +0800)]
compact: workaround for GPL-only symbols on riscv from Linux 6.2

Since Linux 6.2, the implementation of flush_dcache_page on riscv
references GPL-only symbol `PageHuge`, breaking the build of zfs.

This patch uses existing mechanism to override flush_dcache_page,
removing the call to `PageHuge`. According to comments in kernel,
it is only used to do some check against HugeTLB pages, which only
exist in userspace. ZFS uses flush_dcache_page only on kernel pages,
thus this patch will not introduce any behaviour change.

See also: torvalds/linux@d33deda, openzfs/zfs@589f59b

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
Closes #14974
Closes #15627

6 months agovmstat: Improve -z formatting for large names/values
Alexander Motin [Wed, 6 Dec 2023 19:55:58 +0000 (14:55 -0500)]
vmstat: Improve -z formatting for large names/values

MFC after: 2 weeks

6 months agoconf: Expand the include path for more openssl files
Mark Johnston [Wed, 6 Dec 2023 18:39:48 +0000 (13:39 -0500)]
conf: Expand the include path for more openssl files

Fixes: e655cc70dfcd ("ossl: Move arm_arch.h to a common subdirectory")
Reported by: Jenkins

6 months agokmsan: Add kmsan_check_uio()
Mark Johnston [Wed, 6 Dec 2023 16:31:15 +0000 (11:31 -0500)]
kmsan: Add kmsan_check_uio()

This was handy for some ad-hoc debugging and fits in with other
kmsan_check_*() routines which operate on some kind of data container.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

6 months agocap_net.3: remove a copypasta
Alan Somers [Tue, 5 Dec 2023 23:23:29 +0000 (16:23 -0700)]
cap_net.3: remove a copypasta

This line appears to have been copied from cap_sysctl.3.  While I'm
here, reorder and reword the description of cap_net_limit a bit.

[skip ci]

MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: oshogbo
Differential Revision: https://reviews.freebsd.org/D42919

6 months agoExtend import_progress kstat with a notes field
Don Brady [Tue, 5 Dec 2023 22:27:56 +0000 (15:27 -0700)]
Extend import_progress kstat with a notes field

Detail the import progress of log spacemaps as they can take a very
long time.  Also grab the spa_note() messages to, as they provide
insight into what is happening

Sponsored-By: OpenDrives Inc.
Sponsored-By: Klara Inc.
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Don Brady <don.brady@klarasystems.com>
Co-authored-by: Allan Jude <allan@klarasystems.com>
Closes #15539

6 months agopf tests: test that we validate sequence numbers on TCP RST
Kristof Provost [Wed, 29 Nov 2023 12:51:39 +0000 (13:51 +0100)]
pf tests: test that we validate sequence numbers on TCP RST

MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")

6 months agomodule/icp/asm-arm/sha2: enable non-SIMD asm kernels on armv5/6
Shengqi Chen [Tue, 5 Dec 2023 20:01:09 +0000 (04:01 +0800)]
module/icp/asm-arm/sha2: enable non-SIMD asm kernels on armv5/6

My merged pull request #15557 fixes compilation of sha2 kernels on arm
v5/6. However, the compiler guards only allows sha256/512_armv7_impl to
be used when __ARM_ARCH > 6. This patch enables these ASM kernels on all
arm architectures. Some compiler guards are adjusted accordingly to
avoid the unnecessary compilation of SIMD (e.g., neon, armv8ce) kernels
on old architectures.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
Closes #15623

6 months agozpool: flush output before sleeping
Rob N [Tue, 5 Dec 2023 19:53:14 +0000 (06:53 +1100)]
zpool: flush output before sleeping

Several zpool commands (status, list, iostat) have modes that present
some information, sleep a while, present the current state, sleep, etc.
Some of those had ways to invoke them that when piped would appear to do
nothing for a while, because non-terminals are block-buffered, not
line-buffered, by default.  Fix this by forcing a flush before sleeping.

In particular, all of these buffered:
- zpool status <pool> <interval>
- zpool iostat -y<m> <pool> <interval>
- zpool list <pool> <interval>

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #15593

6 months agoriscv: add some more drivers to GENERIC
Mitchell Horne [Tue, 5 Dec 2023 19:29:55 +0000 (15:29 -0400)]
riscv: add some more drivers to GENERIC

Enable phy and regulator extres devices. These aren't needed for
existing SoC support, but are of general utility to FDT platforms and
enable out-of-tree work.

Similarly, enable sdhci and mmc.

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

6 months agoriscv: remove commented lines from GENERIC
Mitchell Horne [Tue, 5 Dec 2023 19:29:42 +0000 (15:29 -0400)]
riscv: remove commented lines from GENERIC

These are relics of development, when static compilation of certain
functionality/parameters was necessary. Today we have full module and
loader(8) support.

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

6 months agoriscv: add more dump features to GENERIC
Mitchell Horne [Tue, 5 Dec 2023 19:29:31 +0000 (15:29 -0400)]
riscv: add more dump features to GENERIC

Match what is provided by default on other architectures.

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

6 months agoriscv: tweak SoC-specific conf organization
Mitchell Horne [Tue, 5 Dec 2023 19:28:59 +0000 (15:28 -0400)]
riscv: tweak SoC-specific conf organization

Hide some lines from the main GENERIC files by mimicking arm64's model.

I do not have any intention of creating a std.riscv or SIFIVE
configuration file at this time.

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

6 months agoCirrus-CI: forcably upgrade pkg to latest
Jose Luis Duran [Tue, 5 Dec 2023 19:04:04 +0000 (19:04 +0000)]
Cirrus-CI: forcably upgrade pkg to latest

make packages requires the latest pkg for now so force that.

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

6 months agoAllow block cloning across encrypted datasets
oromenahar [Tue, 5 Dec 2023 19:03:48 +0000 (20:03 +0100)]
Allow block cloning across encrypted datasets

When two datasets share the same master encryption key, it is safe
to clone encrypted blocks. Currently only snapshots and clones
of a dataset share with it the same encryption key.

Added a test for:
- Clone from encrypted sibling to encrypted sibling with
  non encrypted parent
- Clone from encrypted parent to inherited encrypted child
- Clone from child to sibling with encrypted parent
- Clone from snapshot to the original datasets
- Clone from foreign snapshot to a foreign dataset
- Cloning from non-encrypted to encrypted datasets
- Cloning from encrypted to non-encrypted datasets

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Original-patch-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Signed-off-by: Kay Pedersen <mail@mkwg.de>
Closes #15544

6 months agoCirrus-CI: fix git usage by build user
Brooks Davis [Tue, 5 Dec 2023 19:03:35 +0000 (19:03 +0000)]
Cirrus-CI: fix git usage by build user

The git checkout it owned by root, but builds are run as "user".  git
refuses to operate in such an environment unless the directory is
trusted so make "user" trust it.

Fixes CI after 99b8c0c35b0fcc633649209621243d678a13542a.

Sponsored by: DARPA

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D42903

6 months agoZIL: Do not clone blocks from the future
Alexander Motin [Tue, 5 Dec 2023 18:58:11 +0000 (13:58 -0500)]
ZIL: Do not clone blocks from the future

ZIL claim can not handle block pointers cloned from the future,
since they are not yet allocated at that point.  It may happen
either if the block was just written when it was cloned, or if
the pool was frozen or somehow else rewound on import.

Handle it from two sides: prevent cloning of blocks with physical
birth time from not yet synced or frozen TXG, and abort ZIL claim
if we still detect such blocks due to rewind or something else.

While there, assert that any cloned blocks we claim are really
allocated by calling metaslab_check_free().

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

6 months agobhnd: Correct the softc size in the siba_bhndb_driver definition
Mark Johnston [Tue, 5 Dec 2023 18:47:03 +0000 (13:47 -0500)]
bhnd: Correct the softc size in the siba_bhndb_driver definition

struct siba_bhndb_softc embeds struct siba_softc and adds an extra
field, "quirks".  In practice, this bug was harmless since "quirks" is
unconditionally initialized during driver attach and would have lived in
the redzone of the softc allocation, but KASAN catches the out-of-bounds
access.

PR: 275515
Reported by: Frank Hilgendorf <frank.hilgendorf@posteo.de>
MFC after: 1 week

6 months agopf: remove incorrect fragmentation check
Kristof Provost [Wed, 29 Nov 2023 18:06:31 +0000 (19:06 +0100)]
pf: remove incorrect fragmentation check

We do not need to check PFDESC_IP_REAS while tracking TCP state.
Moreover, this check incorrectly considers no-data packets (e.g. RST) to
be in-window when this flag is not set.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Approved by: so
Security: FreeBSD-SA-23:17.pf

6 months agovmstat: fix column names broken in c168508655720
Maxim Sobolev [Tue, 5 Dec 2023 01:39:21 +0000 (17:39 -0800)]
vmstat: fix column names broken in c168508655720

Loss of the trailing space in the multi-line format string has
resulted in column name being emitted as "FAILSLEEP", instead of
two columns "FAIL" and "SLEEP".

6 months agopkgbase: propagate SRCRELDATE to the packages correctly
Baptiste Daroussin [Mon, 4 Dec 2023 08:22:02 +0000 (09:22 +0100)]
pkgbase: propagate SRCRELDATE to the packages correctly

MFC After: 3 days
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D42892

6 months agoRemove never implemented sbrk and sstk syscalls
Brooks Davis [Mon, 4 Dec 2023 20:36:08 +0000 (20:36 +0000)]
Remove never implemented sbrk and sstk syscalls

Both system calls were stubs returning EOPNOTSUPP and libc did not
provide _ or __sys_ prefixed symbols.  The actual implementation of
sbrk(2) is on top of the undocumented break(2) system call.

Technically this is a change in ABI, but no non-contrived program ever
called these syscalls.

Reviewed by: kib, emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D42872

6 months agohpts: remove from opt_inet.h
Gleb Smirnoff [Mon, 4 Dec 2023 18:19:47 +0000 (10:19 -0800)]
hpts: remove from opt_inet.h

No conditionally compilable code left.  The hpts.ko is fully functional.

Reviewed by: imp, tuexen, rrs
Differential Revision: https://reviews.freebsd.org/D42859

6 months agokern/subr_trap.c: repair the HPTS performance hack in userret()
Gleb Smirnoff [Mon, 4 Dec 2023 18:19:46 +0000 (10:19 -0800)]
kern/subr_trap.c: repair the HPTS performance hack in userret()

It wasn't functional as subr_trap.c doesn't include opt_inet.h.  Put a
better comment provided by gallatin@ in place of the old one.  The idea
is to use userret() as a cheap place to call a soft clock.  This approach
saves CPU on busy machines and saves power on idle machines.
An alternative would be to constantly schedule callouts.  Running with
neither callouts nor the soft clock ruins HPTS precision.

Reviewed by: tuexen, rrs
Differential Revision: https://reviews.freebsd.org/D42860

6 months agohpts/lro: make tcp_lro_flush_tcphpts() and tcp_run_hpts() pointers
Gleb Smirnoff [Mon, 4 Dec 2023 18:19:46 +0000 (10:19 -0800)]
hpts/lro: make tcp_lro_flush_tcphpts() and tcp_run_hpts() pointers

Rename tcp_run_hpts() to tcp_hpts_softlock() to better describe its
function.  This makes loadable hpts.ko working correctly with LRO.

Reviewed by: tuexen, rrs
Differential Revision: https://reviews.freebsd.org/D42858

6 months agotcp/hpts: make stacks responsible for clearing themselves out HPTS
Gleb Smirnoff [Mon, 4 Dec 2023 18:19:46 +0000 (10:19 -0800)]
tcp/hpts: make stacks responsible for clearing themselves out HPTS

There already is the tfb_tcp_timer_stop_all method that is supposed to stop
all time events associated with a given tcpcb by given stack.  Some time
ago it was doing actual callout_stop().  Today bbr/rack just mark their
internal state as inactive in their tfb_tcp_timer_stop_all methods, but
tcpcb stays in HPTS wheel and potentially called in from HPTS.  Change the
methods to also call tcp_hpts_remove().  Note: I'm not sure if internal
flag is still relevant once we are out of HPTS wheel.

Call the method when connection goes into TCP_CLOSED state, instead of
calling it later when tcpcb is freed.  Also call it when we switch between
stacks.

Reviewed by: tuexen, rrs
Differential Revision: https://reviews.freebsd.org/D42857

6 months agohpts: make stacks responsible for tcp_hpts_init()
Gleb Smirnoff [Mon, 4 Dec 2023 18:19:46 +0000 (10:19 -0800)]
hpts: make stacks responsible for tcp_hpts_init()

Those stacks that use HPTS should care about init, not generic code.

Reviewed by: imp, tuexen, rrs
Differential Revision: https://reviews.freebsd.org/D42856

6 months agohpts: don't ifdef tcp_in_hpts()
Gleb Smirnoff [Mon, 4 Dec 2023 18:19:46 +0000 (10:19 -0800)]
hpts: don't ifdef tcp_in_hpts()

This small inline function is always available.

Reviewed by: imp, tuexen, rrs
Differential Revision: https://reviews.freebsd.org/D42855

6 months agolro: separate HPTS specific code into tcp_lro_hpts.c
Gleb Smirnoff [Mon, 4 Dec 2023 18:19:46 +0000 (10:19 -0800)]
lro: separate HPTS specific code into tcp_lro_hpts.c

Put same copyright header as tcp_hpts.c has, since all this code
was developed by Randall Stewart <rrs@FreeBSD.org> as a part of
the HPTS work.  Also copy Mellanox copyright from tcp_lro.c as
Hans Petter Selasky also participated in restructuring the code.

Reviewed by: imp, tuexen, rrs
Differential Revision: https://reviews.freebsd.org/D42854

6 months agoif_tuntap: fix NOIP build
Gleb Smirnoff [Mon, 4 Dec 2023 18:18:56 +0000 (10:18 -0800)]
if_tuntap: fix NOIP build

Note: this removes one TUNDEBUG() for the sake of not having one more
ifdefed variable declaration and for the overall code brevity.  The call
from tuntap into LRO can be so easily traced with dtrace(1) that an
80-ish printf(9)-based debugging can be omitted.

Fixes: 99c79cab422705f92f05a2924a29bdf823372ebf

6 months agoMerge commit 989879f8fded from llvm git (by Paul Walker):
Dimitry Andric [Mon, 4 Dec 2023 17:59:02 +0000 (18:59 +0100)]
Merge commit 989879f8fded from llvm git (by Paul Walker):

  [Clang] Allow C++11 style initialisation of SVE types.

  Fixes https://github.com/llvm/llvm-project/issues/63223

  Differential Revision: https://reviews.llvm.org/D153560

Requested by: andrew
MFC after: 3 days

6 months agoossl: Remove a stray __FBSDID("$FreeBSD$")
Mark Johnston [Mon, 4 Dec 2023 17:29:30 +0000 (12:29 -0500)]
ossl: Remove a stray __FBSDID("$FreeBSD$")

Fixes: 44f8e1e8530e ("ossl: Add support for armv7")

6 months agoossl: Move arm_arch.h to a common subdirectory
Mark Johnston [Mon, 4 Dec 2023 17:29:11 +0000 (12:29 -0500)]
ossl: Move arm_arch.h to a common subdirectory

OpenSSL itself keeps only a single copy of this header.  Do the same in
sys/crypto/openssl to avoid the extra maintenance burden.  This requires
adjusting the include paths for generated asm files.

No functional change intended.

Reported by: jrtc27
Reviewed by: jhb
MFC after: 3 months
Differential Revision: https://reviews.freebsd.org/D42866

6 months agozfs tests: Silence clang warning
Jose Luis Duran [Tue, 7 Nov 2023 15:05:15 +0000 (12:05 -0300)]
zfs tests: Silence clang warning

"assigning to 'pattern_t *' from 'const pattern_t *' discards qualifiers"

Reviewed by: asomers
Reported by: clang
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42791

6 months agopkgbase: kill circular dependency
Baptiste Daroussin [Mon, 4 Dec 2023 16:27:51 +0000 (17:27 +0100)]
pkgbase: kill circular dependency

clang was set to depend on clang-dev, but clang-dev already depends
on clang by design

MFC After: 3 days

6 months agopci_vendors: update to 2023-11-11
Baptiste Daroussin [Mon, 4 Dec 2023 10:51:59 +0000 (11:51 +0100)]
pci_vendors: update to 2023-11-11

6 months agopkgbase: create source package
Baptiste Daroussin [Fri, 17 Nov 2023 16:19:39 +0000 (17:19 +0100)]
pkgbase: create source package

FreeBSD-src for all the sources but the kernel
FreeBSD-src-sys just for the kernel

MFC After: 3 days
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D42651

6 months agoautofs: media: Always use sync option for fat*
Emmanuel Vadot [Fri, 1 Dec 2023 09:27:59 +0000 (10:27 +0100)]
autofs: media: Always use sync option for fat*

Users of autofs for removable media expect to be able to copy files and
directly remove the media without having the need to call sync(8) or umount(8).
Only do that for fat/ntfs filesystems.

Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D42494
Reviewed by: rew (older version)

6 months agonfscl: Fix comment for commit 6aded1e6b2e5
Rick Macklem [Mon, 4 Dec 2023 00:12:14 +0000 (16:12 -0800)]
nfscl: Fix comment for commit 6aded1e6b2e5

Commit 6aded1e6b2e5 fixed a rare case when handling an NFSv4
Rename reply when delegations are in use.  This patch fixes the
associated comment.

MFC after: 2 weeks

6 months agonfscl: Fix processing of a rare Rename reply case
Rick Macklem [Sun, 3 Dec 2023 23:31:01 +0000 (15:31 -0800)]
nfscl: Fix processing of a rare Rename reply case

When delegations are enabled (they are not by default in
the FreeBSD NFSv4 server), rename will check for and return
delegations.  If the second of these DelegReturn operations
were to fail (they rarely do), then the code would not retry
the rename with returning delegations, as it is intended to do.

The patch fixes the problem, since the DelegReturn reply status
is the second iteration of the loop and not the first iteration.

As noted, this bug would have rarely manifested a problem, since
DelegReturn operations do not normally fail.

MFC after: 2 weeks

6 months agorelease/Makefile.vm: Rework emulator-portinstall
Colin Percival [Sun, 3 Dec 2023 21:39:30 +0000 (13:39 -0800)]
release/Makefile.vm: Rework emulator-portinstall

The emulator-portinstall target now unconditionally ensures that qemu
is installed; but is only invoked if needed (aka. when cross building
VM images).

MFC After: 3 days
MFC With: 97bd53ef4d20 ("Fix duplicate rc.conf files")

6 months agoIncrease UFS/FFS maximum link count from 32767 to 65530.
Kirk McKusick [Sun, 3 Dec 2023 20:36:42 +0000 (12:36 -0800)]
Increase UFS/FFS maximum link count from 32767 to 65530.

The link count for a UFS/FFS inode is stored in a signed 16-bit
integer. Thus the maximum link count has been 32767.

This limit has been recently hit by the poudriere build system when
doing a ports build as it needs one directory per port and the
number of ports recently passed 32767.

A long-term solution would be to use one of the spare 32-bit fields
in the inode to store the link count. However, the UFS1 format does
not have a spare and adding the spare in UFS2 would make it hard
to make it compatible when running on older kernels that use the
original link count field. So this patch uses the much simpler
approach of changing the existing link count field from a signed
16-bit value to an unsigned 16-bit value. It has the fewest lines
of code changes. The only thing that changes is the type in the
dinode and inode structures and the definition of UFS_LINK_MAX. It
has the added benefit that it works with both UFS1 and UFS2.

It allows easy backward compatibility. Indeed it is backward
compatibility that is the primary reason to go with this approach.
If a filesystem with the new organization is mounted on an older
kernel, it still needs to work. Thus if we move the new link count
to a new field, we still need to maintain the old link count as
best as possible even when running on a kernel that knows about the
larger link counts. And we would have to carry this overhead for
the indefinite future.

If we have a new link-count field, we will have to add a new
filesystem flag to indicate that we are running with larger link
counts. We will also need to add of one of the new-feature flags
to say that we have larger link counts. Older kernels clear the
new-feature flags that they do not know about, so when a filesystem
is used on an older kernel and then moved back to a newer one, the
newer one will know that the new link counts have not been maintained
and that it will be necessary to run a full fsck on the filesystem
to correct the link counts before it can be mounted.

With this change, older kernels will generally work with the bigger
counts. While it will not itself allow the link count to exceed
32767, it will have no problem working with inodes that have a link
count greater than 32767. Since it tests that i_nlink <= UFS_LINK_MAX,
counts that are bigger than 32767 will appear negative, so will
still pass the test. Of course, if they ever drop below 32767, they
will no longer be able to exceed 32767. The one issue is if the
link count ever exceeds 65535 then it will wrap to zero and the
older kernel will be none the wiser. But this corner case is likely
to be very rare since these kernels and the applications running
on them do not expect to be able to get link counts over 32767. And
over time, the use of new filesystems on older kernels will become
rarer and rarer.

Reported-by: Mark Millard running poudriere on the ports tree
Reviewed-by: kib, olce.freebsd_certner.fr
Tested-by: Peter Holm, Mark Millard
MFC-after:   2 weeks
Differential Revision: https://reviews.freebsd.org/D42767

6 months agopatch: fix locate_hunk in empty files
Pedro F. Giffuni [Sun, 3 Dec 2023 17:33:03 +0000 (12:33 -0500)]
patch: fix locate_hunk in empty files

if `first_guess' is zero then main() assumes that locate_hunk has failed
and aborts the patch operation.  Instead, make sure to return 1 (the
line number) so that the patch operation can continue.

Issue originally found by Neels Hofmeyr in the regress suite of the diff
implementation for got, where the tests assume that applying a diff with
`patch' and then again with `patch -R' yields back the original file.

Obtained from: OpenBSD (CVS patch.c,v 1.71)

6 months agousbdevs: add quirk for WD MyPassport Ultra External HDD
Eugene Grosbein [Sun, 3 Dec 2023 16:48:34 +0000 (23:48 +0700)]
usbdevs: add quirk for WD MyPassport Ultra External HDD

WD MyPassport Ultra External HDD needs quirk
UQ_MSC_NO_TEST_UNIT_READY to attach.

MFC after: 3 days

6 months agomlx5: Fix HCA cap 2 query
Patrisious Haddad [Thu, 11 May 2023 09:48:26 +0000 (12:48 +0300)]
mlx5: Fix HCA cap 2 query

Previously we were trying to set hca_cap_2 without checking if
sw_vhca_id_valid max value, which is the only settable value inside
hca_cap_2, and seeing that we dont have driver support for sw_vhca_id
yet there is no need to set hca_cap_2 at all, it is enough to query it.

Fixes: 7b959396ca6fae5635260131eedb9bc19f2726a3 ("mlx5: Introduce new destination type TABLE_TYPE")
MFC after: 3 days

6 months agoperiodic/daily/480.leapfile-ntpd: only attempt to refresh leap-seconds.list
Xin LI [Sun, 3 Dec 2023 07:00:32 +0000 (23:00 -0800)]
periodic/daily/480.leapfile-ntpd: only attempt to refresh leap-seconds.list
when ntpd is enabled.

The leap-seconds.list is used exclusively by ntpd, therefore, do not bother
to perform the fetch when ntpd is not enabled.

PR: conf/275419
Reviewed by: cy, michaelo, imp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42875

6 months agosound: remove Legacy Hardware section from man page
Ed Maste [Sat, 2 Dec 2023 21:10:16 +0000 (16:10 -0500)]
sound: remove Legacy Hardware section from man page

Support for "old legacy ISA cards" was removed in 9054e296819f and
preceeding commits.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

6 months agowpa: ctrl_iface set sendbuf size
Bjoern A. Zeeb [Sun, 12 Nov 2023 20:33:41 +0000 (20:33 +0000)]
wpa: ctrl_iface set sendbuf size

In order to avoid running into the default net.local.dgram.maxdgram
of 2K currently when calling sendto(2) try to set the sndbuf size to
the maximum ctrl message size.
While on 14 and 15 this does not actually raise the limit anymore (and
be7c095ac99ad29fd72b780c7d58949a38656c66 raised it for syslogd and this),
FreeBSD 13 still requires this change and it will work as expected there.
In addition we always ensure a large enough send buffer this way
independent of kernel defaults.
The problem occured, e.g., when the scan_list result had enough BSSIDs
so the text output would exceed 2048 bytes.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
PR: 274990
Reviewed by: cy, adrian (with previous comment)
Differential Revision: https://reviews.freebsd.org/D42558

6 months agotcp: properly initialize LRD while accepting session in syncache
Richard Scheffenegger [Sat, 2 Dec 2023 11:15:37 +0000 (12:15 +0100)]
tcp: properly initialize LRD while accepting session in syncache

Inherit the setting from the listener socket in syncache_socket.

MFC after:             2 weeks
Reviewed By:           tuexen, #transport
Sponsored by:          NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D42874

6 months agolibclang_rt: Update Makefile.depend
Ka Ho Ng [Sat, 2 Dec 2023 09:15:53 +0000 (04:15 -0500)]
libclang_rt: Update Makefile.depend

MFC after: 3 days

6 months agotermcap.small: Include xterm-256color
Ka Ho Ng [Sat, 2 Dec 2023 05:55:56 +0000 (00:55 -0500)]
termcap.small: Include xterm-256color

MFC after: 7 days
Reviewed by: imp, jhb
Differential Revision: https://reviews.freebsd.org/D42784

6 months agoarmv8rng: Don't require toolchain to support FEAT_RNG
Jessica Clarke [Fri, 1 Dec 2023 23:59:07 +0000 (23:59 +0000)]
armv8rng: Don't require toolchain to support FEAT_RNG

We have the mechanism in place to support encoding system registers
explicitly, so use that rather than requiring LLVM 13+, which breaks our
current set of GitHub CI builds.

Fixes: 9eecef052155 ("Add an Armv8 rndr random number provider")

6 months agounix/dgram: bump maximum datagram size limit to 8k
Gleb Smirnoff [Fri, 1 Dec 2023 23:37:29 +0000 (15:37 -0800)]
unix/dgram: bump maximum datagram size limit to 8k

This is important for wpa_supplicant operation on a crowded network.

Note: we actually need an API to increase maximum datagram size on a
socket.  Previously SO_SNDBUF magically acted like that, but that was
an undocumented "feature".

Also move the comment to the proper line.  Previously it was the receive
buffer that imposed the limit.  Now notion of buffer size and maximum
datagram are separate.

Reviewed by: bz, tuexen, karels
Differential Revision: https://reviews.freebsd.org/D42830
PR: 274990

6 months agoAdd Ntfy notification support to ZED
Dex Wood [Fri, 1 Dec 2023 23:25:17 +0000 (17:25 -0600)]
Add Ntfy notification support to ZED

This commit adds the zed_notify_ntfy() function and hooks it
into zed_notify(). This will allow ZED to send notifications
to ntfy.sh or a self-hosted Ntfy service, which can be received
on a desktop or mobile device. It is configured with ZED_NTFY_TOPIC,
ZED_NTFY_URL, and ZED_NTFY_ACCESS_TOKEN variables in zed.rc.

Reviewed-by: @classabbyamp
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Dex Wood <slash2314@gmail.com>
Closes #15584

6 months agoZIL: Remove TX_CLONE_RANGE replay for ZVOLs.
Alexander Motin [Fri, 1 Dec 2023 23:23:20 +0000 (18:23 -0500)]
ZIL: Remove TX_CLONE_RANGE replay for ZVOLs.

zil_claim_clone_range() takes references on cloned blocks before ZIL
replay.  Later zil_free_clone_range() drops them after replay or on
dataset destroy.  The total balance is neutral.  It means we do not
need to do anything (drop the references) for not implemented yet
TX_CLONE_RANGE replay for ZVOLs.

This is a logical follow up to #15603.

Reviewed-by: Kay Pedersen <mail@mkwg.de>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15612

6 months agoLinuxKPI: 802.11: bring in some HT code
Bjoern A. Zeeb [Thu, 26 Oct 2023 21:14:44 +0000 (21:14 +0000)]
LinuxKPI: 802.11: bring in some HT code

Fix defines and structures to use proper types.

Bring in basic ni->sta synchronization, some channel width handling,
and overload the net80211 functions so that we can talk to
driver/firmware to setup parameters.  We will likely not need one
or two of those but it is good for tracing currently.

Cover HT and bits of VHT code in LinuxKPI behind apropriate #ifdef
which are currently not enabled (like LKPI_80211_HW_CRYPTO) until
confirmed to work.
Last, IEEE80211_AMPDU_RX_START made some firmware unhappy.

This will allow others to work on it and test as well.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

6 months agosysproto.h: regen after c1c8afd04e34d
Brooks Davis [Fri, 1 Dec 2023 21:45:42 +0000 (21:45 +0000)]
sysproto.h: regen after c1c8afd04e34d

6 months agosysvipc: Fix 32-bit compat on !i386
Brooks Davis [Fri, 1 Dec 2023 20:48:29 +0000 (20:48 +0000)]
sysvipc: Fix 32-bit compat on !i386

The various time fields are time_t's which are only 32-bit on i386.

Fixing the old versions is probably of little use, but it's more correct
and in theory there could be powerpc binaries from 6.x.

PR: 240035
Fixes: fbb273bc05bef Properly support for FreeBSD 4 32bit System V shared memory.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D42870