FreeBSD/src 646c0a2libexec/nuageinit nuageinit

nuageinit: Add guards against empty user data

Add guards against attempting to process a user data file with an empty
first line or contents.

PR:             290395
Reviewed by:    bapt (earlier), dtxdf, markj
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D53239

(cherry picked from commit 57d25b6333523491ac7a3e869bd5d16127203eed)
DeltaFile
+8-0libexec/nuageinit/nuageinit
+8-01 files

FreeBSD/src 9eca972libexec/nuageinit nuageinit nuage.lua, libexec/nuageinit/tests addfile.lua nuageinit.sh

nuageinit: Silence luacheck warnings and fix typos

No functional change intended.

Reviewed by:    bapt, dtxdf, kevans
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D53238

(cherry picked from commit 81af04b081402d131c7e34b30c88b7c337271fad)
DeltaFile
+11-13libexec/nuageinit/nuageinit
+2-4libexec/nuageinit/nuage.lua
+1-1libexec/nuageinit/tests/addfile.lua
+1-1libexec/nuageinit/tests/nuageinit.sh
+15-194 files

FreeBSD/src a7cadfflibexec/nuageinit nuageinit

nuageinit: Add guards against empty user data

Add guards against attempting to process a user data file with an empty
first line or contents.

PR:             290395
Reviewed by:    bapt (earlier), dtxdf, markj
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D53239

(cherry picked from commit 57d25b6333523491ac7a3e869bd5d16127203eed)
DeltaFile
+8-0libexec/nuageinit/nuageinit
+8-01 files

FreeBSD/src a5adb1clibexec/nuageinit nuageinit nuage.lua, libexec/nuageinit/tests addfile.lua nuageinit.sh

nuageinit: Silence luacheck warnings and fix typos

No functional change intended.

Reviewed by:    bapt, dtxdf, kevans
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D53238

(cherry picked from commit 81af04b081402d131c7e34b30c88b7c337271fad)
DeltaFile
+11-13libexec/nuageinit/nuageinit
+2-4libexec/nuageinit/nuage.lua
+1-1libexec/nuageinit/tests/addfile.lua
+1-1libexec/nuageinit/tests/nuageinit.sh
+15-194 files

FreeBSD/src a303b14sys/dev/cxgbe t4_main.c

cxgbe(4): Fix compile warning for !RSS kernels

.../sys/dev/cxgbe/t4_main.c:7197:1: warning: unused function 'hashen_to_hashconfig' [-Wunused-function]
 7197 | hashen_to_hashconfig(int hashen)
      | ^~~~~~~~~~~~~~~~~~~~
1 warning generated.

Reported by:    bz
Fixes:  d381a6b4a552 cxgbe: use newly exposed RSS hash key API rather than ad-hoc hashing
DeltaFile
+2-4sys/dev/cxgbe/t4_main.c
+2-41 files

FreeBSD/src 4cd93dfsys/kern kern_prot.c, sys/sys syscallsubr.h

setcred(): Remove an optimization for when cr_groups[0] was the egid

Because setcred() has (always) treated the effective GID separately from
the supplementary groups, when cr_groups[0] was storing the effective
GID, it internally needed to build an array containing both the
effective GID and the specified supplementary groups to eventually call
crsetgroups_internal().

As kern_setcred() was only used to actually implement
user_setcred()/sys_setcred(), which need to allocate a buffer to copy in
the userland groups array into, some optimization was put in place where
these would allocate an array with one more element than
'wc_supp_groups', copyin() the latter into the subarray starting at
index 1 and pass the pointer to the whole array to kern_setcred() in
'preallocated_groups'.  This would allow kern_setcred() not to have to
allocate memory again to make room for the additional effective GID.

Since commit be1f7435ef21 ("kern: start tracking cr_gid outside of
cr_groups[]"), crsetgroups_internal() only takes supplementary groups,

    [8 lines not shown]
DeltaFile
+47-69sys/kern/kern_prot.c
+1-1sys/sys/syscallsubr.h
+48-702 files

FreeBSD/src b92b1b4usr.bin/mdo mdo.c

mdo(1): Avoid calling getgroups() in some unnecessary cases

If the basis for supplementary groups are the current ones, we do not
need to fetch them when they are to be replaced entirely (which we
already have been doing), as in the '!start_from_current_groups' case,
but specifically also when they are not going to be touched at all.

This change in passing makes the modified code block's comment saying
that SETCREDF_SUPP_GROUPS need not be set here correct.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D53771
DeltaFile
+8-2usr.bin/mdo/mdo.c
+8-21 files

FreeBSD/src ff3c48asys/netpfil/ipfw ip_fw2.c

ipfw: fix lookup dst-ip opcode

Opcode handling should not fall through to the LOOKUP_DSCP type.

Reviewed by:    melifaro
Obtained from:  Yandex LLC
Differential Revision:  https://reviews.freebsd.org/D53775

(cherry picked from commit 8012c61bef3bb19a48d8459b38b65e27d46c186c)
DeltaFile
+2-2sys/netpfil/ipfw/ip_fw2.c
+2-21 files

FreeBSD/src 7b6644esys/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)
MFC after:      1 week
Sponsored by:   Intel Corporation
Differential Revision:  https://reviews.freebsd.org/D53732
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 d78231esys/dev/cxgbe/common t4_msg.h

cxgbe: Fix the RSS build

When "options RSS" is configured, opt_rss.h defines the "RSS" token.

PR:     291068
Fixes:  17b4a0acfaf5 ("cxgbe(4): T7 related updates to shared code")
DeltaFile
+1-1sys/dev/cxgbe/common/t4_msg.h
+1-11 files

FreeBSD/src 72a447dsys/vm vm_object.c

vm_object_page_remove(): clear pager even if there is no resident pages

Swap pager might still carry the data.

Debugging help from:    mmel
Reviewed by:    alc
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D53891
DeltaFile
+2-1sys/vm/vm_object.c
+2-11 files

FreeBSD/src 91e2d7bsys/conf newvers.sh

15.0: Update to RC4

This will hopefully be the final RC build before the release.

Approved by:    re (implicit)
DeltaFile
+1-1sys/conf/newvers.sh
+1-11 files

FreeBSD/src 76883b7sys/kern vfs_inotify.c

inotify: Work around the vput() bug directly

For 15.0, apply a minimal fix which at least ensures that inotify can't
trigger the latent race described in commit 99cb3dca4773 ("vnode: Rework
vput() to avoid holding the vnode lock after decrementing").

Approved by:    re (cperciva)
Reviewed by:    olce, kib
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D53774

(cherry picked from commit ebc17879f0885ca87644980f6275b9759b311eb3)
(cherry picked from commit 1f6e3abf41718e8e4a309be122f0a6048e9c5772)
DeltaFile
+8-1sys/kern/vfs_inotify.c
+8-11 files

FreeBSD/src 8a766c9sys/dev/nvme nvme.h

nvme: Fix some comments

Tweak a couple of comments and fix a spelling error.

Sponsored by:           Netflix
DeltaFile
+2-3sys/dev/nvme/nvme.h
+2-31 files

FreeBSD/src 828df4dsys/netlink netlink_snl.h

netlink: Fix overallocation of netlink message buffers

Prior to commit 0c511bafdd5b309505c13c8dc7c6816686d1e103, each time
snl_realloc_msg_buffer was called, it called snl_allocz to request a
new buffer.  If an existing linear buffer was used, then after the
call, the linear buffer effectively contained the old buffer contents
followed by the new buffer (so there was definitely wasted memory),
but the linear buffer state was consistent (lb->offset correctly
accounted for both copies).  For example, if the initial linear buffer
was 256 bytes in size, lb->size would be 256.  Using 16 bytes followed
by 32 bytes would first set lb->offset to 16, then the second realloc
would allocate 48 bytes (16 + 32) setting lb->offset to 64 (16 + 48).

Commit 0c511bafdd5b309505c13c8dc7c6816686d1e103 aimed to avoid this
memory waste by resetting the base pointer to the start of the
existing linear buffer if the new allocation was later in the same
linear buffer.  This avoided some of the waste, but broke the
accounting.  Using the same example above, the second realloc would
reuse the pointer at an offset of 0, but the linear buffer would still

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

FreeBSD/src f7ab908sys/compat/freebsd32 freebsd32_misc.c, sys/sys ucred.h

freebsd32_setcred: Copy all of the setcred fields individually

This is the more typical style used in compat syscalls.  Modern
compilers are smart enough to coalesce multiple member assignments
into a bulk copy.

Reviewed by:    olce, brooks
Obtained from:  CheriBSD
Sponsored by:   AFRL, DARPA
Differential Revision:  https://reviews.freebsd.org/D53757
DeltaFile
+8-4sys/compat/freebsd32/freebsd32_misc.c
+0-2sys/sys/ucred.h
+8-62 files

FreeBSD/src 6292eecsys/compat/freebsd32 freebsd32_misc.c, sys/kern kern_prot.c

setcred: Move initial copyin of struct setcred out to per-ABI syscall

This is the more typical approach used in the tree for system calls
with per-ABI structure layouts.

Reviewed by:    olce, brooks
Obtained from:  CheriBSD
Sponsored by:   AFRL, DARPA
Differential Revision:  https://reviews.freebsd.org/D53756
DeltaFile
+17-35sys/kern/kern_prot.c
+16-2sys/compat/freebsd32/freebsd32_misc.c
+2-2sys/sys/ucred.h
+35-393 files

FreeBSD/src 134d00bsys/kern kern_prot.c, sys/security/mac mac_syscalls.c mac_syscalls.h

MAC: Use the current thread's user ABI to determine the layout of struct mac

This removes mac_label_copyin32() as mac_label_copyin() can now handle
both native and 32-bit struct mac objects.

Reviewed by:    olce, brooks
Obtained from:  CheriBSD
Sponsored by:   AFRL, DARPA
Differential Revision:  https://reviews.freebsd.org/D53755
DeltaFile
+5-20sys/security/mac/mac_syscalls.c
+1-8sys/security/mac/mac_syscalls.h
+1-6sys/kern/kern_prot.c
+7-343 files

FreeBSD/src e928afccddl/lib/libzdb Makefile, cddl/lib/libzfs Makefile

Use ZFSTOP more broadly

Reviewed by:    brooks
Obtained from:  CheriBSD
Differential Revision:  https://reviews.freebsd.org/D53791
DeltaFile
+16-16cddl/lib/libzfs/Makefile
+13-13cddl/lib/libzfs_core/Makefile
+10-10cddl/lib/libzutil/Makefile
+10-10cddl/lib/pam_zfs_key/Makefile
+9-9cddl/lib/libzfsbootenv/Makefile
+9-9cddl/lib/libzdb/Makefile
+67-6731 files not shown
+188-18837 files

FreeBSD/src 7980cf5cddl/lib/libzpool Makefile, cddl/sbin/zfs Makefile

Centralize definition of ZFSTOP

Define this helper variable in one place and make it available while
building the entire base system.

Reviewed by:    sjg
Obtained from:  CheriBSD (mostly)
Differential Revision:  https://reviews.freebsd.org/D53790
DeltaFile
+3-0share/mk/src.sys.mk
+0-2cddl/lib/libzpool/Makefile
+0-2cddl/sbin/zfs/Makefile
+0-2cddl/sbin/zpool/Makefile
+0-2cddl/share/zfs/compatibility.d/Makefile
+0-2cddl/usr.bin/zinject/Makefile
+3-107 files not shown
+3-2413 files

FreeBSD/src 2fe3792sys/net if_loop.c

loopback: Clear hash unconditionally.

Clear the RSS hash on transmit, now that RSS hashing is enabled
unconditionally, and the network stack may want to trust that
it is getting the correct hash on input.

Differential Revision:  https://reviews.freebsd.org/D53090
Reviewed by: zlei
Sponsored by: Netflix
DeltaFile
+0-2sys/net/if_loop.c
+0-21 files

FreeBSD/src 8f94088sys/dev/mlx5/mlx5_en mlx5_en_main.c mlx5_en_rx.c

mlx5: use newly exposed RSS hash key API rather than ad-hoc hashing

Differential Revision:  https://reviews.freebsd.org/D53091
Reviewed by: kib
Sponsored by: Netflix
DeltaFile
+1-29sys/dev/mlx5/mlx5_en/mlx5_en_main.c
+0-4sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
+0-2sys/dev/mlx5/mlx5_en/en.h
+1-353 files

FreeBSD/src bac572busr.sbin/bhyve net_backend_slirp.c

bhyve/slirp: Avoid a nested declaration of environ

Fixes:  0e62ebd20172 ("bhyve: Move the slirp backend out into a separate process")
DeltaFile
+2-1usr.sbin/bhyve/net_backend_slirp.c
+2-11 files

FreeBSD/src b0c7eafusr.sbin/bhyve/slirp slirp-helper.c

bhyve/slirp: Drop privileges before entering capability mode

When in restricted mode, the slirp-helper process enters a capsicum
sandbox, after which we cannot look up the uid for the "nobody" user.
Reverse the order.

Reported by:    kp
Fixes:  0e62ebd20172 ("bhyve: Move the slirp backend out into a separate process")
DeltaFile
+5-5usr.sbin/bhyve/slirp/slirp-helper.c
+5-51 files

FreeBSD/src 6739241krb5/util/ss Makefile

krb5: Use sh to run mk_cmds

Otherwise etcupdate apparently can fail if its private object directory
under /var/db is in a filesystem mounted noexec.  We shouldn't be
building this target at all, but for now, just apply this workaround.

PR:             291043
Reviewed by:    ivy, cy, des
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D53861
DeltaFile
+1-1krb5/util/ss/Makefile
+1-11 files

FreeBSD/src 0628c25libexec/rtld-elf/powerpc reloc.c, libexec/rtld-elf/powerpc64 reloc.c

rtld: fix powerpc build

In arch_fix_auxv(), remove local variable shadowing the argument,
remove write-only variable, and declare the loop variable.
The wrong patch was committed after series of local reverts and
re-apply.

Fixes:  b2b3d2a962eb00005641546fbe672b95e5d0672a
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
DeltaFile
+1-3libexec/rtld-elf/powerpc/reloc.c
+1-3libexec/rtld-elf/powerpc64/reloc.c
+2-62 files

FreeBSD/src 8f8b8e4sys/dev/sound/midi midi.c

sound: Fix revents in midi_poll()

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Reviewed by:    christos
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1887
DeltaFile
+9-11sys/dev/sound/midi/midi.c
+9-111 files

FreeBSD/src 4991bb6sys/dev/sound/pci/hda hdaa_patches.c hdac.h

snd_hda: Patch Lenovo V15

PR:             290496
Tested by:      adrian
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week

(cherry picked from commit 5f624d923db0f2fb33990948cffdc24da44deaa8)
DeltaFile
+2-1sys/dev/sound/pci/hda/hdaa_patches.c
+1-0sys/dev/sound/pci/hda/hdac.h
+3-12 files

FreeBSD/src 120f8a4sys/arm/freescale/imx imx6_ssi.c, sys/arm/freescale/vybrid vf_sai.c

arm: Add missing argument in mtx_init() calls

Fixes:          9d18115ca0ab ("sound: Retire snd_mtx* wrappers")
Reported by:    CI
Sponsored by:   The FreeBSD Foundation
MFC after:      4 days
DeltaFile
+1-5sys/arm/freescale/imx/imx6_ssi.c
+1-5sys/arm/freescale/vybrid/vf_sai.c
+2-102 files

FreeBSD/src a067eb5sbin/mount mount.8

mount.8: document nosymfollow option

Document the nosymfollow mount option in more details.
Forgotten in 5ddc8ded1dbe650b7d83240a1f86a1eb6e2b9b5a
DeltaFile
+7-2sbin/mount/mount.8
+7-21 files