FreeBSD/src b675ff8share/man/man4 mac_seeotheruids.4, sys/security/mac_seeotheruids mac_seeotheruids.c

mac_seeotheruids: allow specificgid to be a list of groups

The specificgid functionality has historically allowed only a single
group to be exempt, but in practice one might want a few services to
be exempt for reasons.  From a security perspective, we probably don't
want to encourage unrelated users to be grouped together solely for
this purpose, as that creates one point of shared access that could be
used for nefarious purposes.

Normalize the group list as we do cr_groups to allow for linear matching
rather than quadratic, we just need to account for the differences in
FreeBSD 15.0+ where cr_groups is entirely supplementary groups vs.
earlier versions, where cr_groups[0] is the egid and the rest is
sorted.

Reviewed by:    csjp, des (earlier version)
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D56592
DeltaFile
+164-10sys/security/mac_seeotheruids/mac_seeotheruids.c
+2-2share/man/man4/mac_seeotheruids.4
+166-122 files

FreeBSD/src 7ac7604lib/geom/cache gcache.8, lib/geom/eli geli.8

geom manuals: Clarify units

The gpart manual says that sizes are specified in blocks, unless an SI
unit suffix is provided. This confuses new operators because GEOM uses
binary bytes, a large difference at modern storage pool sizes. Rewrite
suffixes in all GEOM manuals to consistently clarify this, matching what
we and the rest of the industry have been doing in other documentation.
While here, use non-breaking spaces between numbers and units, unless
they are already written with a hyphen.

MFC after:              3 days
Reviewed by:            fuz
Reported by:            bbaovanc <bbaovanc at bbaovanc.com>
Differential Revision:  https://reviews.freebsd.org/D56534

(cherry picked from commit 975e3605ebb15cbaf5a25c1c9d1f51aed41291d0)
DeltaFile
+29-23lib/geom/part/gpart.8
+4-4sbin/ggate/ggatec/ggatec.8
+4-4lib/geom/eli/geli.8
+2-2lib/geom/cache/gcache.8
+2-2sbin/ggate/ggated/ggated.8
+41-355 files

FreeBSD/src a46205acontrib/openbsm/bsm libbsm.h, contrib/openbsm/libbsm bsm_io.c bsm_token.c

Fix memory corruption bugs in BSM record parsing

fetch_newgroups_tok(3): clamp group count to AUDIT_MAX_GROUPS before the
loop to prevent a stack buffer overflow when a crafted record specifies
more than 16 groups.

fetch_execarg_tok(3), fetch_execenv_tok(3): add a bounds check at the
top of the string-walking loop to prevent an out-of-bounds read when the
previous string's nul byte is the last byte of the record buffer.

fetch_sock_unix_tok(3): clamp the memchr search length to the number of
bytes remaining in the buffer to prevent an out-of-bounds read on short
tokens. Also clamp slen to sizeof(path) to prevent a one-byte overflow
when no nul byte is found within the path data.

fetch_socket_tok: fix copy-paste error where the remote address was
written into l_addr instead of r_addr.
Previously reported by: @haginara


    [12 lines not shown]
DeltaFile
+44-6contrib/openbsm/libbsm/bsm_io.c
+8-2contrib/openbsm/bsm/libbsm.h
+1-1contrib/openbsm/libbsm/bsm_token.c
+53-93 files

FreeBSD/src 4578c15share/man/man5 pf.conf.5, tests/sys/netpfil/pf route_to.sh

pf: Document broadcast/multicast forwarding through route-to

pf_route() and pf_route6() forward broadcast and multicast traffic
when a route-to rule matches, without any check against the output
interface's broadcast domain. This is a deliberate property of the
route option code path, but it is not documented and the workaround
is non-obvious.

Document the behavior in pf.conf(5) with example block-out rules on
the target interface, scoped with the received-on qualifier so that
only forwarded traffic is dropped while the router's own broadcast
and multicast traffic continues to pass.

Add regression tests covering the full broadcast/multicast and
forwarded/local matrix on both IPv4 and IPv6.

Reviewed by:    glebius, kp
Approved by:    kp (mentor)
MFC after:      1 week

    [2 lines not shown]
DeltaFile
+346-0tests/sys/netpfil/pf/route_to.sh
+45-1share/man/man5/pf.conf.5
+391-12 files

FreeBSD/src aad4fecusr.sbin/ctld ctld.cc ctld.hh

ctld: Move the pidfile handle out to a global variable

This ensures it will be destroyed (removing the associated pidfile)
anytime the process exits, including from exit(3) calls.  This fixes
a few places that would "leak" the pidfile on certain errors.

This also removes the need for some convoluted logic where
configuration objects would hand-off ownership of the pidfile handle
from the old configuration to the new configuration.

Reviewed by:    asomers
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D56527
DeltaFile
+13-29usr.sbin/ctld/ctld.cc
+1-6usr.sbin/ctld/ctld.hh
+14-352 files

FreeBSD/src 3df5cc3usr.sbin/ctld ctld.hh

ctld: Ports without a portal group are not dummy ports

The default implementation of is_dummy should return false.  Only
portal group ports should possibly return true.

PR:             293076
Reported by:    Ken J. Thomson <thomsonk at yandex.com>
Fixes:          6acc7afa34aa ("ctld: Convert struct port to a hierarchy of C++ classes")
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D56524
DeltaFile
+1-1usr.sbin/ctld/ctld.hh
+1-11 files

FreeBSD/src 614ef71usr.sbin/ctld ctld.cc

ctld: Don't add an iscsi port for targets with only kernel ports

PR:             293076
Reviewed by:    asomers
Fixes:          969876fcee57 ("ctld: parse config file independently of getting kernel info")
Differential Revision:  https://reviews.freebsd.org/D56523
DeltaFile
+1-1usr.sbin/ctld/ctld.cc
+1-11 files

FreeBSD/src 7982985sys/security/mac mac_policy.h

kern: mac: bump the MAC_VERSION for 16.x

Reviewed by:    bapt
Differential Revision:  https://reviews.freebsd.org/D55703
DeltaFile
+2-1sys/security/mac/mac_policy.h
+2-11 files

FreeBSD/src 28b0084sys/security/mac mac_framework.c mac_policy.h

kern: mac: sprinkle a bit of const correctness

mpc_name and mpc_fullname are string literals in correct usage, so they
should really be const instead.

mpc_ops aren't typically const, but the framework shouldn't be doing
anything to clobber it; thus, good to constify it as a reminder.

Switch to using a slightly more semantically correct `void **` in the
fastpath bits while we're here, since we only do arithmetic on the outer
layer of pointer and compare the inner to a pointer-typed (NULL).

Reviewed by:    bapt
Differential Revision:  https://reviews.freebsd.org/D55702
DeltaFile
+5-5sys/security/mac/mac_framework.c
+3-3sys/security/mac/mac_policy.h
+8-82 files

FreeBSD/src 0faa88fsys/kern vfs_mount.c, sys/security/mac mac_vfs.c mac_policy.h

kern: vfs: add MAC checks for mount/unmount/update

The unmount check is straightforward and only really needs the
struct mount and flags used, in case a MAC policy wants to reject
force-unmounts or do special handling for FSID-based unmounts.

The mount check offers as much information as I think might be of
interest to a MAC policy: the vnode to be mounted on, vfsconf, and
applicable mount options.   XNU also has a later version that just takes
a struct mount for everything that VFS_MOUNT() has to offer, but my
draft policy doesn't need any of that.  It also doesn't really need the
unmount check, but it seems reasonable to add it while I'm here.

The update check similarly passes the flags/options for the operation,
along with the struct mount and label.

Reviewed by:    kib, olce
Differential Revision:  https://reviews.freebsd.org/D55601
DeltaFile
+50-0sys/security/mac/mac_vfs.c
+37-0sys/security/mac_test/mac_test.c
+28-0sys/security/mac_stub/mac_stub.c
+24-1sys/kern/vfs_mount.c
+12-0sys/security/mac/mac_policy.h
+7-0sys/security/mac/mac_framework.h
+158-16 files

FreeBSD/src 2ddefc8libexec/rtld-elf rtld.c

rtld: fix processing of preloaded z_initfirst objects

(cherry picked from commit 9b844b495e8e63439ffe523757ac7444a16317af)
DeltaFile
+5-0libexec/rtld-elf/rtld.c
+5-01 files

FreeBSD/src f3ca689usr.bin/kdump kdump.c Makefile

kdump: tweaks for the extended errors decoding

(cherry picked from commit 5c89d661a023c83a2001cf5b354b09c7d3ac91d8)
DeltaFile
+20-3usr.bin/kdump/kdump.c
+1-0usr.bin/kdump/Makefile
+21-32 files

FreeBSD/src 75ae51busr.bin/kdump kdump.c

kdump(1): add sys/ prefix for exterror source file name

(cherry picked from commit 4d062dbc20dce5a94da8dca1253ac9337b951c51)
DeltaFile
+1-1usr.bin/kdump/kdump.c
+1-11 files

FreeBSD/src 0b6f465libexec/rtld-elf rtld.c

rtld: fix processing of preloaded z_initfirst objects

(cherry picked from commit 9b844b495e8e63439ffe523757ac7444a16317af)
DeltaFile
+5-0libexec/rtld-elf/rtld.c
+5-01 files

FreeBSD/src 68d2339sys/sys param.h

Bump __FreeBSD_version for changing various kernel APIs to use pointers

Effort:         CHERI upstreaming
Sponsored by:   AFRL, DARPA
DeltaFile
+1-1sys/sys/param.h
+1-11 files

FreeBSD/src 9a6e9d7sys/amd64/amd64 pmap.c, sys/arm64/arm64 pmap.c

VM_PAGE_TO_DMAP: Wrapper macro to return direct map address for a page

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+18-24sys/powerpc/aim/mmu_radix.c
+20-21sys/amd64/amd64/pmap.c
+12-12sys/arm64/arm64/pmap.c
+5-17sys/powerpc/aim/mmu_oea64.c
+10-12sys/riscv/riscv/pmap.c
+10-12sys/opencrypto/criov.c
+75-9816 files not shown
+105-13922 files

FreeBSD/src 496453esys/amd64/amd64 pmap.c, sys/arm64/arm64 pmap.c

amd64/aarch64 pmap: Switch type of pmap_preinit_mapping.va to void *

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+17-15sys/amd64/amd64/pmap.c
+13-11sys/arm64/arm64/pmap.c
+30-262 files

FreeBSD/src 120a5e3sys/amd64/amd64 pmap.c, sys/arm64/arm64 pmap.c

DMAP_TO_VM_PAGE: Wrapper macro to map direct map address to a page

Effort:         CHERI upstreaming
Suggested by:   kib
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+15-15sys/amd64/amd64/pmap.c
+5-5sys/powerpc/booke/pmap_64.c
+3-3sys/powerpc/aim/mmu_radix.c
+2-2sys/riscv/riscv/pmap.c
+2-2sys/arm64/arm64/pmap.c
+2-0sys/vm/vm_page.h
+29-273 files not shown
+32-309 files

FreeBSD/src bee1aaesys/contrib/ncsw/user/env xx.c

ncsw: Allow pmap_kextract to handle direct map addresses

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+1-5sys/contrib/ncsw/user/env/xx.c
+1-51 files

FreeBSD/src 30af462sys/i386/linux linux_machdep.c, sys/kern kern_exec.c

kmap_alloc_wait/kmap_free_wakeup: Use void * instead of vm_offset_t

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+6-8sys/kern/kern_exec.c
+6-4sys/vm/vm_kern.c
+2-2sys/vm/vm_extern.h
+1-1sys/i386/linux/linux_machdep.c
+15-154 files

FreeBSD/src c49cbf8sys/powerpc/aim mmu_oea64.c moea64_native.c

powerpc aim64: Return vm_paddr_t from moea64_bootstrap_alloc

Consistently use vm_paddr_t for the type returned from
moea64_bootstrap_alloc and avoid temporarily smuggling it via a
pointer.  Instead, be explicit in the places that assume a 1:1
mapping.

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+10-7sys/powerpc/aim/mmu_oea64.c
+7-8sys/powerpc/aim/moea64_native.c
+1-1sys/powerpc/aim/mmu_oea64.h
+1-1sys/powerpc/aim/mmu_radix.c
+19-174 files

FreeBSD/src 8a0ff50sys/vm vm_glue.c

vm_kstack: Use void * instead of vm_offset_t

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+34-35sys/vm/vm_glue.c
+34-351 files

FreeBSD/src 2d0634dsys/arm64/arm64 pmap.c, sys/i386/i386 copyout.c pmap.c

kva_alloc/free: Use void * instead of vm_offset_t

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+29-29sys/arm64/arm64/pmap.c
+24-22sys/i386/i386/copyout.c
+21-21sys/i386/i386/pmap.c
+15-15sys/powerpc/aim/mmu_oea64.c
+13-12sys/kern/subr_devmap.c
+13-11sys/vm/vm_kern.c
+115-11037 files not shown
+246-23943 files

FreeBSD/src fe2957fsys/amd64/amd64 machdep.c, sys/amd64/include stack.h

sys: Switch td_kstack from vm_offset_t to char *

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+6-6sys/vm/vm_glue.c
+5-5sys/kern/kern_thread.c
+4-4sys/riscv/include/stack.h
+4-4sys/amd64/amd64/machdep.c
+4-4sys/amd64/include/stack.h
+4-4sys/arm/include/stack.h
+27-2723 files not shown
+65-6529 files

FreeBSD/src 025b39bsys/dev/gve gve_qpl.c gve.h

gve: Convert a couple of structure members from vm_offset_t to char *

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+6-6sys/dev/gve/gve_qpl.c
+2-2sys/dev/gve/gve.h
+2-2sys/dev/gve/gve_tx.c
+10-103 files

FreeBSD/src ec3a0b2sys/amd64/amd64 pmap.c, sys/arm64/arm64 pmap.c

pmap_map_io_transient: Use void * instead of vm_offset_t for vaddr array

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+14-10sys/amd64/amd64/pmap.c
+6-4sys/arm64/arm64/pmap.c
+6-4sys/riscv/riscv/pmap.c
+2-2sys/arm64/include/pmap.h
+2-2sys/riscv/riscv/uio_machdep.c
+2-2sys/dev/cxgbe/cxgbei/icl_cxgbei.c
+32-244 files not shown
+40-3210 files

FreeBSD/src e275013sys/arm64/arm64 pmap.c, sys/compat/linuxkpi/common/src linux_page.c

pmap_qenter/qremove: Use void * instead of vm_offset_t

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+15-18sys/kern/vfs_bio.c
+15-16sys/powerpc/aim/mmu_radix.c
+12-11sys/compat/linuxkpi/common/src/linux_page.c
+11-11sys/kern/kern_kcov.c
+12-10sys/arm64/arm64/pmap.c
+12-10sys/i386/i386/pmap.c
+77-7639 files not shown
+224-21545 files

FreeBSD/src 573e631sys/amd64/include sf_buf.h, sys/arm64/include sf_buf.h

sf_buf_kva: Return a pointer instead of a vm_offset_t

This removes the need for several casts to pointer in callers.

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+3-3sys/dev/ti/if_ti.c
+3-3sys/sys/sf_buf.h
+2-2sys/riscv/include/sf_buf.h
+2-2sys/arm64/include/sf_buf.h
+2-2sys/amd64/include/sf_buf.h
+1-2sys/net/bpf_zerocopy.c
+13-1412 files not shown
+25-2618 files

FreeBSD/src ac7d527sys/arm/arm pmap-v6.c, sys/powerpc/aim mmu_oea64.c mmu_radix.c

pmap_map: Use void * for the return value instead of vm_offset_t

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+5-6sys/powerpc/aim/mmu_oea64.c
+5-4sys/powerpc/aim/mmu_radix.c
+4-4sys/powerpc/booke/pmap.c
+4-4sys/vm/vm_page.c
+3-3sys/arm/arm/pmap-v6.c
+3-3sys/powerpc/aim/mmu_oea.c
+24-2412 files not shown
+40-4018 files

FreeBSD/src fe3e92esys/amd64/amd64 pmap.c, sys/arm64/arm64 pmap.c

PHYS_TO_DMAP: Return a void * instead of a vm_offset_t

Add a new PHYS_TO_DMAP_ADDR that still returns an address for use in
places that only need an address and not a pointer.

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+86-85sys/amd64/amd64/pmap.c
+60-63sys/arm64/arm64/pmap.c
+49-52sys/powerpc/aim/mmu_radix.c
+36-36sys/riscv/riscv/pmap.c
+22-24sys/powerpc/booke/pmap_64.c
+14-15sys/powerpc/aim/mmu_oea64.c
+267-27567 files not shown
+426-44973 files