FreeBSD/src a0347b0sbin/geom/core geom.c

gpart: "gpart --libxo:JP list" duplicates attribute keys

Add leaf-list modifier to attrib as it's possible to have multiple
attributes on a gpart provider.

I purposely made it so that the normal output still says "attrib:" just
so we don't break any scripts people may be using to parse the output,
but the libxo output now says "attribute" just like `gpart show` will do
once https://reviews.freebsd.org/D53950 is merged.

PR:             291377
MFC after:      1 week
Reviewed by:    asomers
Sponsored by:   ConnectWise
Differential Revision: https://reviews.freebsd.org/D54080
DeltaFile
+6-2sbin/geom/core/geom.c
+6-21 files

FreeBSD/src 23aaa07. Makefile.inc1

Makefile.inc1: Force NO_ROOT for distribute* and package*

These targets are used to produce legacy dist sets for install media and
now always use NO_ROOT mode.  Extend existing logic that forces NO_ROOT
mode to these cases to ensure they do not run in the wrong mode.

Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50551

(cherry picked from commit 300aa267efaa08564337797e89590737a7cc6af0)
DeltaFile
+7-2Makefile.inc1
+7-21 files

FreeBSD/src 17bc015sys/dev/irdma irdma_hw.c irdma_cm.c

irdma(4): fix potential memory leak on qhash cqp operation

It was found that in some circumstances when launching
non-waiting create qhash cqp operation the refcount on
the cqp_request may be not properly decremented leading to a memory
leak.

Signed-off-by: Bartosz Sobczak <bartosz.sobczak at intel.com>

Reviewed by:    anzhu_netapp.com
Tested by:      mateusz.moga_intel.com
Approved by:    kbowling (mentor)
Sponsored by:   Intel Corporation
Differential Revision:  https://reviews.freebsd.org/D53732

(cherry picked from commit 7b6644e160ed63b633e7c68a3cacf2c71d216cd5)
DeltaFile
+108-24sys/dev/irdma/irdma_hw.c
+2-36sys/dev/irdma/irdma_cm.c
+2-2sys/dev/irdma/icrdma.c
+2-1sys/dev/irdma/irdma_main.h
+114-634 files

FreeBSD/src bb69c09sys/dev/irdma irdma_hw.c irdma_cm.c

irdma(4): fix potential memory leak on qhash cqp operation

It was found that in some circumstances when launching
non-waiting create qhash cqp operation the refcount on
the cqp_request may be not properly decremented leading to a memory
leak.

Signed-off-by: Bartosz Sobczak <bartosz.sobczak at intel.com>

Reviewed by:    anzhu_netapp.com
Tested by:      mateusz.moga_intel.com
Approved by:    kbowling (mentor)
Sponsored by:   Intel Corporation
Differential Revision:  https://reviews.freebsd.org/D53732

(cherry picked from commit 7b6644e160ed63b633e7c68a3cacf2c71d216cd5)
DeltaFile
+108-24sys/dev/irdma/irdma_hw.c
+2-36sys/dev/irdma/irdma_cm.c
+2-2sys/dev/irdma/icrdma.c
+2-1sys/dev/irdma/irdma_main.h
+114-634 files

FreeBSD/src 4ae02d9sys/compat/linuxkpi/common/src linux_page.c

linuxkpi: clean up stray pctrie_iter_reset

This removes an extraneous pctrie_iter_reset before returning.
This is not needed as it simply clears a local variable that
will get cleaned up anyway as we immediately return from the
function.

MFC after:      1 week
Sponsored by:   NVIDIA
Reviewed by:    alc
Differential Revision:  https://reviews.freebsd.org/D54153
DeltaFile
+1-3sys/compat/linuxkpi/common/src/linux_page.c
+1-31 files

FreeBSD/src 255af72sys/netlink netlink_snl.h

netlink: Don't overwrite existing data in a linear buffer in snl_writer

First, a bit of background on some of the data structures netlink uses
to manage data associated with a netlink connection.

- struct linear_buffer contains a single virtually-contiguous buffer
  of bytes.  Regions of this buffer are suballocated via lb_allocz()
  which uses a simple "bump" where the buffer is split into an
  allocated region at the start and a free region at the end.  Each
  allocation "bumps" the boundary (lb->offset) forward by the
  allocation size.

  Individual allocations are not freed.  Instead, the entire buffer is
  freed once all of the allocations are no longer in use.

  Linear buffers also contain an embedded link to permit chaining
  buffers together.

- snl_state contains various state for a netlink connection including

    [51 lines not shown]
DeltaFile
+9-11sys/netlink/netlink_snl.h
+9-111 files

FreeBSD/src 2a3b164sbin/shutdown shutdown.8 shutdown.c

shutdown: Adapt to changes in reboot

Now that halt and reboot actually signal init, shutdown needs to run
fasthalt or fastboot instead when given the -o option.

MFC after:      1 month
Reviewed by:    imp, allanjude
Differential Revision:  https://reviews.freebsd.org/D54122
DeltaFile
+4-4sbin/shutdown/shutdown.8
+4-4sbin/shutdown/shutdown.c
+8-82 files

FreeBSD/src 4453ec5sbin/reboot reboot.8 reboot.c

reboot: Default to a clean shutdown

* If invoked as fasthalt or fastboot, behavior is unchanged.

* If not invoked as fasthalt or fastboot, we simply signal init(8),
  just like shutdown(8) does, instead of taking the system down
  ourselves.

* Since only init can handle the RB_REROOT case, the -r flag is not
  supported in fast mode.

* Update the usage string to correctly reflect the program being run
  (fast or normal; halt, boot, or nextboot) and the options available
  in each case.

* Update the manual page to make the distinction between normal and
  fast mode clear, better explain what shutdown(8) still does that
  reboot(8) does not, and add a historical note explaining what the
  difference between the two used to be.

    [5 lines not shown]
DeltaFile
+46-16sbin/reboot/reboot.8
+42-16sbin/reboot/reboot.c
+88-322 files

FreeBSD/src 7ad8cbausr.sbin/certctl certctl.sh

certctl: Improve option processing

For subcommands that did not take any arguments, we never bothered to
check that none were passed.

Reviewed by:    allanjude
Differential Revision:  https://reviews.freebsd.org/D54082
DeltaFile
+72-21usr.sbin/certctl/certctl.sh
+72-211 files

FreeBSD/src ce1e7a7usr.sbin/certctl certctl.sh

certctl: Always copy bundle fragments

When processing a bundle, we split it into individual certificates
stored in temporary files, then pass the name of each temporary file
to the creation function.  Since the temporary files will later be
deleted, we need to force the creation function to copy rather than
symlink these files.

PR:             290957
Fixes:          986c43bd80e7 ("certctl: Add an option to copy files.")
Reviewed by:    allanjude
Differential Revision:  https://reviews.freebsd.org/D54081
DeltaFile
+1-1usr.sbin/certctl/certctl.sh
+1-11 files

FreeBSD/src 80203a2sys/arm/include _align.h, sys/arm64/include _align.h

Add sys/_align.h replacing machine/_align.h

Define _ALIGNBYTES using sizeof(void *) (no functional change on any
existing architecture) which will allow it to work with CHERI were we
must align things up to capability alignment.

In _ALIGN, replace integer manipulation which does not preserve pointer
provenance with a type and provenance preserving builtin.  This requires
modest changes in code which assumes _ALIGN returns an integer, but
those are relatively rare.

Reviewed by:    kib, markj
Effort:         CHERI upstreaming
Sponsored by:   Innovate UK
Differential Revision:  https://reviews.freebsd.org/D53947
DeltaFile
+0-51sys/x86/include/_align.h
+0-51sys/powerpc/include/_align.h
+0-51sys/arm/include/_align.h
+0-47sys/arm64/include/_align.h
+0-41sys/riscv/include/_align.h
+32-0sys/sys/_align.h
+32-24110 files not shown
+40-26016 files

FreeBSD/src cfae62elib/libcasper/services/cap_grp cap_grp.c

libcasper: fix warnings when _ALIGN preserves types

Without the void * casts, the compiler complains about an alignment
requirement increase.

Reviewed by:    kib, markj
Obtained from:  CheriBSD
Effort:         CHERI upstreaming
Sponsored by:   DARPA, AFRL
Differential Revision:  https://reviews.freebsd.org/D53946
DeltaFile
+2-2lib/libcasper/services/cap_grp/cap_grp.c
+2-21 files

FreeBSD/src ac79e2elib/libc/gen getgrent.c, lib/libc/include nscache.h

get*ent: be consistant about _ALIGN(p) - p

Add an nscache specific inline function to calculate the misalignment
rather than adding and subtracting _ALIGN(p) and p which can take the
buffer far out of bound (undefined behavior in C and unsupported on
CHERI).

Reviewed by:    kib
Effort:         CHERI upstreaming
Obtained from:  CheriBSD
Sponsored by:   DARPA
Differential Revision:  https://reviews.freebsd.org/D53945
DeltaFile
+8-0lib/libc/include/nscache.h
+3-3lib/libc/gen/getgrent.c
+2-2lib/libc/net/getprotoent.c
+2-2lib/libc/net/getservent.c
+2-2lib/libc/rpc/getrpcent.c
+2-2lib/libc/net/gethostnamadr.c
+19-111 files not shown
+21-137 files

FreeBSD/src 9bbb08fshare/mk meta.autodep.mk meta2deps.sh

Update share/mk files from bmake

Update to the latest makefiles etc from bmake.
Mostly this just replaces sjg license with an SPDX tag.

There are also some improvements to meta2deps* and optimizations
to leverage POSIX shell features in some target scripts.
Default isPOSIX_SHELL to ':' in sys.mk to enable these.

Use :sh1 in M_type if possible.

bsd.progs.mk has diverged too much to touch beyond making the
SPDX tag update.

Reviewed by:    stevek
Differential Revision:  https://reviews.freebsd.org/D54150
DeltaFile
+52-31share/mk/meta.autodep.mk
+42-12share/mk/meta2deps.sh
+21-29share/mk/install-new.mk
+39-10share/mk/meta2deps.py
+28-18share/mk/meta.stage.mk
+17-7share/mk/gendirdeps.mk
+199-10712 files not shown
+232-19918 files

FreeBSD/src c818089sys/fs/nfsserver nfs_nfsdstate.c

nfs_nfsdstate.c: Add sanity checks for lock stateids

Bugzilla PR reported a crash caused by a synthetic client
doing a Lock operation request with a delegation stateid.

This patch fixes the problem by adding sanity checks
for the type of stateid provided as an argument to the
Lock and LockU operations.

It has been tested with the FreeBSD, Linux and Solaris 11.4
clients.  Hopefully, other NFSv4 clients will work ok
as well.

PR:     291080

(cherry picked from commit aa1cf240887ddcca66dfb969fdc5a8d545396037)
DeltaFile
+14-0sys/fs/nfsserver/nfs_nfsdstate.c
+14-01 files

FreeBSD/src ffd47a4sys/fs/nfsserver nfs_nfsdstate.c

nfs_nfsdstate.c: Add sanity checks for lock stateids

Bugzilla PR reported a crash caused by a synthetic client
doing a Lock operation request with a delegation stateid.

This patch fixes the problem by adding sanity checks
for the type of stateid provided as an argument to the
Lock and LockU operations.

It has been tested with the FreeBSD, Linux and Solaris 11.4
clients.  Hopefully, other NFSv4 clients will work ok
as well.

PR:     291080

(cherry picked from commit aa1cf240887ddcca66dfb969fdc5a8d545396037)
DeltaFile
+14-0sys/fs/nfsserver/nfs_nfsdstate.c
+14-01 files

FreeBSD/src cc1e4aalibexec/rc/rc.d ipfilter

rc.d/ipfilter: ipfilter must be enabled for options to take

ipfilter options are erased and reset to default when ipfilter is
disabled. This results in nullifying options from rc.conf that were
previously set.

8d6feaaaa26f, which added this code, was incorrect as it was for a bug in
ipfilter 4.2.28 and no longer applies to ipfilter 5.1.2.

Fixes:          8d6feaaaa26f
MFC after:      1 day
DeltaFile
+3-6libexec/rc/rc.d/ipfilter
+3-61 files

FreeBSD/src a837d1fsys/kern uipc_socket.c

splice: Fix leaks that can happen when initiating a splice

- change the state to SPLICE_EXCEPTION to allow so_unsplice() to work
  to cleanup failed splices (fixes socket reference leak)
- NULL out sp->dst when unsplicing from so_splice() before so2 has been
   been referenced.
- Deal with a null sp->dst / so2 in so_unsplice
- Fix asserts that talked about sp->state == SPLICE_INIT; that state
  is not possible here.

Differential Revision: https://reviews.freebsd.org/D54157
Reviewed by: markj
Sponsored by: Netflix
Fixes: c0c5d01e5374 ("so_splice: Synchronize so_unsplice() with so_splice()")
MFC after: 3 days
DeltaFile
+27-17sys/kern/uipc_socket.c
+27-171 files

FreeBSD/src f04b23clibexec/rc/rc.d ipfilter ippool

rc.d/{ipfilter,ippool}: Fix typo in variable name

MFC after:      1 day
DeltaFile
+1-1libexec/rc/rc.d/ipfilter
+1-1libexec/rc/rc.d/ippool
+2-22 files

FreeBSD/src ca942absys/dev/bhnd bhnd.h bhnd_subr.c, sys/dev/bhnd/bcma bcma_subr.c

bhnd_bus_*_resource: Remove redundant type and rid arguments

Remove type and rid arguments from
bhnd_bus_(activate|deactivate|release)_resource.  This should have
been done earlier to match the changes made to bus_release_resource,
etc.

While fixing up the callers, remove rid members from softc structures
since the only time a value is needed is as a constant input to
bhnd_bus_alloc_resource*.

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D53410
DeltaFile
+9-24sys/dev/bhnd/bhnd.h
+10-10sys/dev/bhnd/bhnd_subr.c
+6-10sys/dev/bhnd/cores/chipc/chipc_subr.c
+3-11sys/dev/bhnd/bhnd_erom.c
+4-6sys/dev/bhnd/bcma/bcma_subr.c
+5-5sys/dev/bhnd/bhndb/bhndb.c
+37-6616 files not shown
+58-11122 files

FreeBSD/src 1033312sys/dev/bhnd bhnd_subr.c bhnd.h, sys/dev/bhnd/bcma bcma_subr.c

bhnd_bus_alloc_resource*: Pass rid by value

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D53409
DeltaFile
+4-4sys/dev/bhnd/bhnd_subr.c
+3-3sys/dev/bhnd/bhnd.h
+1-1sys/dev/bhnd/cores/chipc/chipc_gpio.c
+1-1sys/dev/bhnd/bcma/bcma_subr.c
+1-1sys/dev/bhnd/bhnd_bus_if.m
+1-1sys/dev/bhnd/bhnd_erom.c
+11-116 files not shown
+17-1712 files

FreeBSD/src d08fac0sys/dev/dpaa2 dpaa2_rc.c

dpaa2_rc_add_res: Pass rid by value

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D53408
DeltaFile
+14-16sys/dev/dpaa2/dpaa2_rc.c
+14-161 files

FreeBSD/src 01dcb4esys/dev/gpio gpiobus.c gpiobusvar.h, sys/dev/mmc mmc_fdt_helpers.c

gpio_alloc_intr_resource: Pass rid by value

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D53407
DeltaFile
+2-2sys/dev/gpio/gpiobus.c
+1-1sys/dev/gpio/gpiobusvar.h
+1-1sys/dev/gpio/gpioc.c
+1-1sys/dev/gpio/gpiopps.c
+1-1sys/dev/mmc/mmc_fdt_helpers.c
+1-1sys/dev/sdhci/sdhci_fdt_gpio.c
+7-72 files not shown
+9-98 files

FreeBSD/src 1056844sys/dev/acpica acpi_perf.c acpi_package.c

acpi_PkgGas: Pass rid by value

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D53406
DeltaFile
+3-3sys/dev/acpica/acpi_perf.c
+2-2sys/dev/acpica/acpi_package.c
+1-1sys/dev/acpica/acpi_cpu.c
+1-1sys/dev/acpica/acpivar.h
+7-74 files

FreeBSD/src 2a23faesys/dev/acpica acpi.c acpi_throttle.c

acpi_bus_alloc_gas: Pass rid by value

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D53405
DeltaFile
+4-4sys/dev/acpica/acpi.c
+2-2sys/dev/acpica/acpi_throttle.c
+2-2sys/dev/acpica/acpi_cpu.c
+2-2sys/dev/acpica/acpi_apei.c
+1-1sys/dev/acpica/acpi_package.c
+1-1sys/dev/acpica/acpivar.h
+12-121 files not shown
+13-137 files

FreeBSD/src d9f1922sys/compat/linuxkpi/common/src linux_pci.c, sys/dev/pci pci.c pci_private.h

pci_reserve_map: Pass rid by value

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D53404
DeltaFile
+15-15sys/dev/pci/pci.c
+1-1sys/dev/pci/pci_private.h
+1-1sys/compat/linuxkpi/common/src/linux_pci.c
+17-173 files

FreeBSD/src e279724sys/dev/acpica acpi.c, sys/dev/dpaa2 dpaa2_rc.c

resource_list_reserve: Pass rid by value

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D53403
DeltaFile
+11-12sys/dev/pci/pci.c
+3-3sys/kern/subr_bus.c
+1-1sys/dev/dpaa2/dpaa2_rc.c
+1-1sys/dev/acpica/acpi.c
+1-1sys/sys/bus.h
+17-185 files

FreeBSD/src 5756395sys/dev/pccbb pccbb.c, sys/dev/pci pci.c pci_pci.c

bus_alloc_resource: Pass rid by value to BUS_ALLOC_RESOURCE DEVMETHOD

The wrapper functions such as bus_alloc_resource_any() still support
passing the rid by value or pointer, but the underlying implementation
now passes by value.

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D53402
DeltaFile
+22-22sys/sys/bus.h
+14-14sys/dev/pci/pci.c
+11-11sys/kern/subr_bus.c
+11-11sys/dev/pccbb/pccbb.c
+9-9sys/dev/pci/pci_pci.c
+8-8sys/x86/isa/isa.c
+75-7577 files not shown
+276-28283 files

FreeBSD/src 12165acsys/netlink netlink_snl.h

Revert "netlink: Fix overallocation of netlink message buffers"

This patch was based on an incorrect assumption that the linear buffer
chain for an snl_writer only contained the netlink message body.

This reverts commit 828df4d36d9d5a6ca0dcc294d65572b4a0474142.

Sponsored by:   AFRL, DARPA
DeltaFile
+11-16sys/netlink/netlink_snl.h
+11-161 files

FreeBSD/src cf39b51sys/compat/linuxkpi/common/include/linux radix-tree.h, sys/compat/linuxkpi/common/src linux_radix.c

linuxkpi: Take const root in read-only radix tree functions

This is a preparation step for a future addition to this file. This is
also closer to what Linux does.

Reviewed by:    emaste
Sponsored by:   The FreeBSD Foundation
DeltaFile
+4-4sys/compat/linuxkpi/common/src/linux_radix.c
+2-2sys/compat/linuxkpi/common/include/linux/radix-tree.h
+6-62 files