FreeBSD/src a05af6dsys/arm/broadcom/bcm2835 bcm2838_pci.c

pci: bcm2838: cleanup on attach failure to fix devmatch panic

Specifically on the RPi CM4, we currently don't set the controller up
right and it never moves into the ready state (we don't observe the link
active bit).  Failure to cleanup here actually results in a panic not
long after, due to a use-after-free in the rman bits.  Further down in
pci_host_generic, we have some rman stashed in the softc that are
initialized and placed onto the rman tailq, then the softc is later
freed without an rman_fini() to pull them off of the tailq properly.

Note that PCIe on this board won't come up at boot without something
plugged in, so it currently can't be booted with an empty slot with the
intent to hotplug a supported card.  Some issues with controller startup
have been observed with Broadcom NICs in the wild, but no problems have
been observed with other NICs and a variety of different PCIe cards.

Shout-out to Vince <git at darkain.com> for the extensive debugging and
analysis to arrive at this conclusion.


    [2 lines not shown]
DeltaFile
+9-4sys/arm/broadcom/bcm2835/bcm2838_pci.c
+9-41 files

FreeBSD/src 31a94ecsys/dev/pci pci_host_generic_fdt.c pci_host_generic.c

pci: pci_host_generic: provide cleanup methods outside of detach

If device_attach() fails, we're expected to actually cleanup after
ourselves because device_detach() will not be called.  Factor out the
cleanup bits that don't rely on attach having actually succeeded so
that we can cleanup properly in bcm2838_pci.

Reviewed by:    andrew, imp
Differential Revision:  https://reviews.freebsd.org/D56896
DeltaFile
+19-0sys/dev/pci/pci_host_generic_fdt.c
+11-4sys/dev/pci/pci_host_generic.c
+1-0sys/dev/pci/pci_host_generic.h
+1-0sys/dev/pci/pci_host_generic_fdt.h
+32-44 files

FreeBSD/src b230a7bsys/dev/ofw ofw_bus_subr.c ofw_bus_subr.h

kern: ofw: provide ofw_bus_destroy_iinfo to teardown interrupt-map

For symmetry with ofw_bus_setup_iinfo, the next commits will use it to
properly cleanup on failure in bcm2838_pci.

Reviewed by:    andrew
Differential Revision:  https://reviews.freebsd.org/D56895
DeltaFile
+12-0sys/dev/ofw/ofw_bus_subr.c
+1-0sys/dev/ofw/ofw_bus_subr.h
+13-02 files

FreeBSD/src 0696d38sys/amd64/amd64 machdep.c

amd64/machdep.c: explicitly include sys/uio.h

Some kernel configurations result in struct uio being only
forward-declared.

This is direct commit to stable/15.

Sponsored by:   The FreeBSD Foundation
DeltaFile
+1-0sys/amd64/amd64/machdep.c
+1-01 files

FreeBSD/src 72e57bcsys/fs/nfs nfsproto.h nfsrvstate.h, sys/fs/nfsserver nfs_nfsdport.c nfs_nfsdstate.c

nfsd: Add support for striped Flexible File layout

Without this patch, the NFSv4.1/4.2 pNFS server configuration
did not support striping.  This was mainly because the Linux
client driver did not support it either.  The Linux client
driver for Flexible File layout does now support striping.
(Linux kernel version 6.18 or newer)

As such, this patch adds striping support.  The configuration
is currently just two new sysctls called
vfs.nfsd.pnfsstripeunit - Size (in bytes) of a stripe
vfs.nfsd.pnfsstripecnt - # of DSs to stripe across
A setting of 0 for the first sysctl and 1 for the second
disables striping.  A patch that allows use of a different
striping configuration for each exported MDS file system
is planned for the future.

The pnfsdscopymr may be broken by this patch, but since
no one reported that they were actually using a pNFS server

    [12 lines not shown]
DeltaFile
+817-258sys/fs/nfsserver/nfs_nfsdport.c
+47-44sys/fs/nfsserver/nfs_nfsdstate.c
+13-3sys/fs/nfs/nfsproto.h
+11-5sys/fs/nfsserver/nfs_nfsdserv.c
+13-0sys/fs/nfs/nfsrvstate.h
+4-4sys/fs/nfs/nfs_var.h
+905-3141 files not shown
+908-3147 files

FreeBSD/src f0ac411usr.sbin/bsdinstall/distextract distextract.c

bsdinstall: Use libarchive secure flags for extract

This doesn't really matter, as we trust that the installer tarballs are
not malicious, but it doesn't hurt to set these flags.

Reported by: Yuxiang Yang, Yizhou Zhao, Ao Wang, Xuewei Feng, Qi Li, and Ke Xu from Tsinghua University using GLM-5.1 from Z.ai
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57274

(cherry picked from commit f9f46294d6af2a937afa74938bd4bb6826cbb921)
DeltaFile
+2-0usr.sbin/bsdinstall/distextract/distextract.c
+2-01 files

FreeBSD/src cc00806sys/amd64/amd64 machdep.c support.S

x86: for wrmsr_early_safe(), catch all exceptions, not only #GP

(cherry picked from commit 0a02a47fd94a8326e84ac0a6cb857342b59671f8)
DeltaFile
+15-9sys/amd64/amd64/machdep.c
+3-4sys/amd64/amd64/support.S
+18-132 files

FreeBSD/src e5488ddstand/man loader.efi.8, sys/amd64/amd64 machdep.c

amd64: explain in more details why the slop is needed

(cherry picked from commit 963a92d63b7443d27588fb4260bd4226f7525117)
DeltaFile
+7-0sys/amd64/amd64/machdep.c
+3-0stand/man/loader.efi.8
+10-02 files

FreeBSD/src 5377cd6sys/amd64/amd64 machdep.c, sys/sys systm.h

sys: add safe_read(9)

(cherry picked from commit 7b2702ee25f5230011fa7f8f650b65b37248fcca)
DeltaFile
+18-0sys/amd64/amd64/machdep.c
+8-0sys/sys/systm.h
+26-02 files

FreeBSD/src 9681364sys/amd64/amd64 mem.c uio_machdep.c, sys/amd64/include md_var.h

amd64: extract uiomove_mem() from memrw()

(cherry picked from commit 67d61d18bb8debb4ffc51ef2248aa37ed0bfb8f5)
DeltaFile
+11-92sys/amd64/amd64/mem.c
+96-0sys/amd64/amd64/uio_machdep.c
+6-0sys/amd64/include/md_var.h
+113-923 files

FreeBSD/src 2fa4a6bsys/kern imgact_elf.c

imgact_elf: read program headers if not contained in the first page

PR:     295629

(cherry picked from commit 804daf166406a1b0e22f93b9417b90ed7d3aa1ae)
DeltaFile
+62-29sys/kern/imgact_elf.c
+62-291 files

FreeBSD/src 21d0d2asys/kern imgact_elf.c

imgact_elf: add sysctl kern.elfXX.phnums for the number of program headers

(cherry picked from commit 201090678e033237e20d80eb29cc059e0df9a1e1)
DeltaFile
+12-10sys/kern/imgact_elf.c
+12-101 files

FreeBSD/src 5bbd104sys/kern imgact_elf.c kern_exec.c, sys/sys imgact.h

image activators: pass the current thread

(cherry picked from commit 9b729333bb2495afb8821044fa42c9ebe0874703)
DeltaFile
+16-20sys/kern/imgact_elf.c
+1-0sys/kern/kern_exec.c
+1-0sys/sys/imgact.h
+18-203 files

FreeBSD/src 21fb5a5sys/fs/smbfs smbfs_node.c

smbfs: plug smbfs_node_alloc() leak of name buffers when insmntque() fails

PR:     295577

(cherry picked from commit f0e702a7a289f0f350bdaeb943805d6d17f9e403)
DeltaFile
+4-0sys/fs/smbfs/smbfs_node.c
+4-01 files

FreeBSD/src 67df313sys/compat/linuxkpi/common/include/linux pm_qos.h

linuxkpi: Make pm_qos.h self-contained

Include <linux/types.h> for `false`.  This is needed by amdgpu somewhere
between Linux 6.12 and 6.15.

Reviewed by:    Minsoo Choo <minsoo at minsoo.io>, bz
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57415
DeltaFile
+2-0sys/compat/linuxkpi/common/include/linux/pm_qos.h
+2-01 files

FreeBSD/src 73e0d6bbin/pwd/tests pwd_test.sh, usr.bin/env/tests env_test.sh

tests: Avoid sleep when causing a write error

Cause a write error using a fifo and wait, rather than needing a sleep
to wait for something to terminate. This is faster and avoids a
potential test failure on a heavily loaded system.

Using /dev/full would be simpler, but it is not portable enough (it
tends not to be available in jails, even). Starting programs with stdout
not open or only open for read/execute/search may have unexpected side
effects.

Reviewed by:    ngie, des
Differential Revision:  https://reviews.freebsd.org/D57213
DeltaFile
+8-7bin/pwd/tests/pwd_test.sh
+7-6usr.bin/printenv/tests/printenv_test.sh
+7-6usr.bin/uniq/tests/uniq_test.sh
+7-6usr.bin/yes/tests/yes_test.sh
+7-5usr.bin/env/tests/env_test.sh
+7-5usr.bin/ident/tests/ident_test.sh
+43-353 files not shown
+64-509 files

FreeBSD/src 8bf4902usr.bin/diff pr.c

diff: Correct fd 0 case on pipe

After git commit c8d40bf8ecc60cc15e3904410db62065ea681fdc, if fd 0 was
not open, it is left with CLOEXEC set and therefore fails. This is an
unlikely situation, but fixing it reduces the size of the code (by using
posix_spawn_file_actions_adddup2's special case if the two file
descriptor numbers are the same).

At the same time, check the error code from
posix_spawn_file_actions_adddup2.

Reviewed by:    bapt
Differential Revision:  https://reviews.freebsd.org/D56910
DeltaFile
+3-2usr.bin/diff/pr.c
+3-21 files

FreeBSD/src 248dd56usr.bin/xinstall install.1

install.1: Convert link flags to a table

The five link flags get lost in prose.

Reviewed by:    ziaee
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57418
DeltaFile
+13-10usr.bin/xinstall/install.1
+13-101 files

FreeBSD/src 545cef1sys/dev/ena ena.h

ena: Update driver version to v2.8.3

Features:
* Report RX overrun errors via sysctl hw stats

Bug Fixes:
* Budget rx descriptors, not packets, to fix jumbo frame throughput

Minor Changes:
* Adjust ena_[rt]x_cleanup to return bool

MFC after: 2 weeks
Sponsored by: Amazon, Inc.
Differential Revision: https://reviews.freebsd.org/D56641

(cherry picked from commit af7911d3b732b8e0d4254c5d0bf60d74ced89157)
DeltaFile
+1-1sys/dev/ena/ena.h
+1-11 files

FreeBSD/src 109ee0asys/dev/ena ena_datapath.c ena.h

ena: Budget rx descriptors, not packets

We had ENA_RX_BUDGET = 256 in order to allow up to 256 received
packets to be processed before we do other cleanups (handling tx
packets and, critically, refilling the rx buffer ring).  Since the
ring holds 1024 buffers by default, this was fine for normal packets:
We refill the ring when it falls below 7/8 full, and even with a large
burst of incoming packets allowing it to fall by another 1/4 before we
consider refilling the ring still leaves it at 7/8 - 1/4 = 5/8 full.

With jumbos, the story is different: A 9k jumbo (as is used by default
within the EC2 network) consumes 3 descriptors, so a single rx cleanup
pass can consume 3/4 of the default-sized rx ring; if the rx buffer
ring wasn't completely full before a packet burst arrives, this puts
us perilously close to running out of rx buffers.

This precise failure mode has been observed on some EC2 instance types
within a Cluster Placement Group, resulting in the nominal 10 Gbps
single-flow throughput between instances dropping to ~100 Mbps as a

    [21 lines not shown]
DeltaFile
+10-3sys/dev/ena/ena_datapath.c
+2-2sys/dev/ena/ena.h
+12-52 files

FreeBSD/src 94659fcsys/dev/ena ena_datapath.c

ena: Adjust ena_[rt]x_cleanup to return bool

The ena_[rt]x_cleanup functions are limited internally to a maximum
number of packets; this ensures that TX doesn't starve RX (or vice
versa) and also attempts to ensure that we get a chance to refill
the RX buffer ring before the device runs out of buffers and starts
dropping packets.

Historically these functions have returned the number of packets which
they processed which ena_cleanup compares to their respective budgets
to decide whether to reinvoke them.  This is unnecessary complication;
since the precise number of packets processed is never used, adjust
the APIs of those functions to return a bool indicating if they want
to be reinvoked (aka if they hit their limits).

Since ena_tx_cleanup now only uses work_done if diagnostics are
enabled (ena_log_io macros to nothing otherwise) eliminate that
variable and pass its value (ENA_TX_BUDGET - budget) to ena_log_io
directly.

    [9 lines not shown]
DeltaFile
+12-14sys/dev/ena/ena_datapath.c
+12-141 files

FreeBSD/src 77876ebsys/dev/ena ena.c ena.h

ena: Report RX overrun errors

Extract rx_overruns from the keep alive descriptor reported by
the device and expose it via sysctl hw stats.

RX overrun errors occur when a packet arrives but there are not
enough free buffers in the RX ring to receive it.

MFC after: 2 weeks
Sponsored by: Amazon, Inc.
Differential Revision: https://reviews.freebsd.org/D56640

(cherry picked from commit e3f4a63af63bea70bc86b6c790b14aa5ee99fcd0)
DeltaFile
+4-0sys/dev/ena/ena.c
+2-0sys/dev/ena/ena.h
+2-0sys/dev/ena/ena_sysctl.c
+8-03 files

FreeBSD/src b49021busr.bin/xinstall install.1

install.1: Document options incompatible with -s

Reported by:    des
Reviewed by:    ziaee
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57409
DeltaFile
+5-1usr.bin/xinstall/install.1
+5-11 files

FreeBSD/src 303df71sys/rpc svc_vc.c rpcsec_tls.h, sys/rpc/rpcsec_tls rpctls_impl.c

krpc: Get rid of KRPC_VNET macros

When the krpc was vnet'd, the VNET macros were hidden
behind macros that had the KRPC_ prefix on them.
This was done because, at the time, it was thought
that something other than vnet might be used for this.
That has not happened and probably will not happen,
so this patch replaces these obscuring macros with
the regular vnet ones.

There should be no semantics change caused by
this commit.

(cherry picked from commit d8d9e1cf5e055433565a7e686bc096a8494d2bb8)
DeltaFile
+45-45sys/rpc/svc_vc.c
+15-15sys/rpc/rpcsec_tls/rpctls_impl.c
+0-15sys/rpc/rpcsec_tls.h
+60-753 files

FreeBSD/src fcc7609sys/fs/nfs nfs_commonport.c nfs_commonsubs.c, sys/fs/nfsserver nfs_nfsdport.c nfs_nfsdstate.c

nfsd: Get rid of NFSD_VNET macros

When the nfsd was vnet'd, the VNET macros were hidden
behind macros that had the NFSD_ prefix on them.
This was done because, at the time, it was thought
that something other than vnet might be used for this.
That has not happened and probably will not happen,
so this patch replaces these obscuring macros with
the regular vnet ones.

There should be no semantics change caused by
this commit.

(cherry picked from commit 821976facf746ef241e1524b44bb1de0af98fdc0)
DeltaFile
+147-147sys/fs/nfs/nfs_commonport.c
+147-147sys/fs/nfs/nfs_commonsubs.c
+89-89sys/fs/nfsserver/nfs_nfsdport.c
+80-80sys/fs/nfsserver/nfs_nfsdstate.c
+67-67sys/fs/nfsserver/nfs_nfsdcache.c
+42-42sys/fs/nfsserver/nfs_fha_new.c
+572-5727 files not shown
+671-68513 files

FreeBSD/src ce77cd3sys/fs/nfs nfs_commonkrpc.c, sys/fs/nfsserver nfs_nfsdserv.c

nfscl: Fix handling of gssd upcalls for the NFS client

Without this patch, all upcalls to the gssd daemon are
done in vnet0 (outside of any vnet jail).  This does
not work well, because a user principal's credential
cache can be within the jail (/tmp/krb5cc_NNN in the
jail's namespace).

This patch modifies the client so that RPCs done
from within vnet jails does an upcall to a gssd
daemon running within the vnet jail.  It required
that the cache of uid->credential shorthands in
the rpcsec_gss be vnet'd.

The situation is still less than ideal and sec=krb5[ip]
mounts that are visible within vnet jails is still
not something I would recommend, but it can work ok
with this patch.


    [5 lines not shown]
DeltaFile
+59-52sys/rpc/rpcsec_gss/rpcsec_gss.c
+21-2sys/fs/nfs/nfs_commonkrpc.c
+6-2sys/fs/nfsserver/nfs_nfsdserv.c
+6-1sys/rpc/clnt_vc.c
+6-1sys/rpc/clnt_bck.c
+6-1sys/rpc/clnt_dg.c
+104-592 files not shown
+107-608 files

FreeBSD/src 07d7339sys/fs/nfsclient nfs_clrpcops.c

nfs_clrpcops.c: Change initial layout type to flex files

Since the File 4.1 layout is only supported by some
large configurations of Netapp Filers, switch the client
pNFS code to attempting to use Flexible File Format first.

File 4.1 Layout should still work for any servers that do
no support Flexible File Layout.
DeltaFile
+5-5sys/fs/nfsclient/nfs_clrpcops.c
+5-51 files

FreeBSD/src 9a133eesys/dev/thunderbolt nhi.c router.c

thunderbolt: Fix INVARIANTS compilation

The problem is that THUNDERBOLT_DEBUG triggers the use of some
variables, but it is independent of INVARIANTS and the variables it uses
were tagged with '__diagused'.

Fix this by using '__maybe_unused' in those places.

Fixes:          183633079178 ("thunderbolt: make code -Wunused clean")
Fixes:          886164895f3f ("amd64: complete thunderbolt KERNCONF integration")
Sponsored by:   The FreeBSD Foundation
DeltaFile
+3-3sys/dev/thunderbolt/nhi.c
+2-2sys/dev/thunderbolt/router.c
+1-1sys/dev/thunderbolt/tb_acpi_pcib.c
+1-1sys/dev/thunderbolt/tb_pcib.c
+7-74 files

FreeBSD/src 521afceusr.bin/xinstall xinstall.c, usr.bin/xinstall/tests install_test.sh

xinstall: Do not allow -l and -s together

Cannot strip the target if creating a link.

Reviewed by:    des
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57398
DeltaFile
+6-0usr.bin/xinstall/xinstall.c
+3-0usr.bin/xinstall/tests/install_test.sh
+9-02 files

FreeBSD/src 4908beausr.bin/xinstall/tests install_test.sh

xinstall: Add test for -d -s not allowed together

Reviewed by:    des
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57403
DeltaFile
+7-0usr.bin/xinstall/tests/install_test.sh
+7-01 files