HardenedBSD/src ccec693stand defs.mk loader.mk, stand/efi/loader Makefile

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+10-10stand/libsa/zfs/Makefile.inc
+3-4stand/defs.mk
+2-2stand/i386/gptzfsboot/Makefile
+1-1stand/efi/loader/Makefile
+1-1stand/loader.mk
+1-1sys/kern/firmw.S
+18-193 files not shown
+21-229 files

HardenedBSD/src 8d04049bin/sh miscbltin.c sh.1, bin/sh/tests/builtins read12.0 read11.0

Merge branch 'freebsd/14-stable/main' into hardened/14-stable/master
DeltaFile
+57-26bin/sh/miscbltin.c
+32-0bin/sh/tests/builtins/read12.0
+18-3bin/sh/tests/builtins/read11.0
+9-0crypto/openssh/sshconnect.c
+7-0crypto/openssh/FREEBSD-upgrade
+5-1bin/sh/sh.1
+128-301 files not shown
+129-307 files

HardenedBSD/src aff2010bin/sh miscbltin.c sh.1, bin/sh/tests/builtins read12.0 read11.0

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+57-26bin/sh/miscbltin.c
+32-0bin/sh/tests/builtins/read12.0
+18-3bin/sh/tests/builtins/read11.0
+9-0crypto/openssh/sshconnect.c
+7-0crypto/openssh/FREEBSD-upgrade
+5-1bin/sh/sh.1
+128-301 files not shown
+129-307 files

HardenedBSD/src aac0ef5sys/kern firmw.S

kern: Fix section name for embedded firmware blobs

In practice this just ends up as an orphan section and so is placed next
to .rodata-like sections, so it's pretty harmless, but not intended.

Fixes:  a095390344fb ("Use a template assembly file for firmware object files.")
DeltaFile
+1-1sys/kern/firmw.S
+1-11 files

HardenedBSD/src 00e4b16crypto/openssh sshconnect.c FREEBSD-upgrade

openssh: Don't attempt to connect to unsupported addresses

When iterating over known addresses for the requested target host name,
skip those that are not supported by the running kernel.

MFC after:      1 week
PR:             195231
Reviewed by:    emaste
Differential Revision:  https://reviews.freebsd.org/D53588

(cherry picked from commit 5818b6ee552b302f5300934f9b8cb94881867a5f)
DeltaFile
+9-0crypto/openssh/sshconnect.c
+7-0crypto/openssh/FREEBSD-upgrade
+16-02 files

HardenedBSD/src 7f691e0bin/sh miscbltin.c sh.1, bin/sh/tests/builtins read12.0 read11.0

sh: Don't assume EINTR means SIGALRM

While waiting for input in the read builtin, if select() is interrupted
but there is no pending signal, we act like we timed out, and return the
same status as if we had been interrupted by SIGALRM, instead of looping
until we actually do time out.

* Replace the single select() call with a ppoll() loop.

* Improve validation of the timeout value.  We now accept things like
  "1h30m15s", which we used to silently truncate to "1h".  The flip side
  is that we no longer accept things like "1hour" or "5sec".

* Modify the existing `read -t 0` test case to verify that read returns
  immediately when there is input and fails immediately when there isn't.

* Add a second test case which performs the same tests with a non-zero
  timeout value.


    [7 lines not shown]
DeltaFile
+57-26bin/sh/miscbltin.c
+32-0bin/sh/tests/builtins/read12.0
+17-2bin/sh/tests/builtins/read11.0
+5-1bin/sh/sh.1
+1-0bin/sh/tests/builtins/Makefile
+112-295 files

HardenedBSD/src e9019e7bin/sh/tests/builtins read11.0

sh tests: Fix racy test11.0

This was sometimes exiting while the child fifo was created resulting in
[ENOTEMPTY] from rm.  The child fifo isn't needed, just sleep.

PR:     290837
Fixes:  e31fb97148f ("read builtin: Empty variables on timeout")
MFC after:      3 days

(cherry picked from commit 5d55553e160a93788372785300f5bd07c2451f93)
DeltaFile
+2-2bin/sh/tests/builtins/read11.0
+2-21 files

HardenedBSD/src fb57eacbin/sh miscbltin.c sh.1, bin/sh/tests/builtins read12.0 read11.0

sh: Don't assume EINTR means SIGALRM

While waiting for input in the read builtin, if select() is interrupted
but there is no pending signal, we act like we timed out, and return the
same status as if we had been interrupted by SIGALRM, instead of looping
until we actually do time out.

* Replace the single select() call with a ppoll() loop.

* Improve validation of the timeout value.  We now accept things like
  "1h30m15s", which we used to silently truncate to "1h".  The flip side
  is that we no longer accept things like "1hour" or "5sec".

* Modify the existing `read -t 0` test case to verify that read returns
  immediately when there is input and fails immediately when there isn't.

* Add a second test case which performs the same tests with a non-zero
  timeout value.


    [7 lines not shown]
DeltaFile
+57-26bin/sh/miscbltin.c
+32-0bin/sh/tests/builtins/read12.0
+17-2bin/sh/tests/builtins/read11.0
+5-1bin/sh/sh.1
+1-0bin/sh/tests/builtins/Makefile
+112-295 files

HardenedBSD/src 4004f9acrypto/openssh sshconnect.c FREEBSD-upgrade

openssh: Don't attempt to connect to unsupported addresses

When iterating over known addresses for the requested target host name,
skip those that are not supported by the running kernel.

MFC after:      1 week
PR:             195231
Reviewed by:    emaste
Differential Revision:  https://reviews.freebsd.org/D53588

(cherry picked from commit 5818b6ee552b302f5300934f9b8cb94881867a5f)
DeltaFile
+9-0crypto/openssh/sshconnect.c
+7-0crypto/openssh/FREEBSD-upgrade
+16-02 files

HardenedBSD/src 43b1b7cbin/sh/tests/builtins read11.0

sh tests: Fix racy test11.0

This was sometimes exiting while the child fifo was created resulting in
[ENOTEMPTY] from rm.  The child fifo isn't needed, just sleep.

PR:     290837
Fixes:  e31fb97148f ("read builtin: Empty variables on timeout")
MFC after:      3 days

(cherry picked from commit 5d55553e160a93788372785300f5bd07c2451f93)
DeltaFile
+2-2bin/sh/tests/builtins/read11.0
+2-21 files

HardenedBSD/src 1e8988bsys/dev/cxgbe t4_main.c, sys/kern kern_prot.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+47-69sys/kern/kern_prot.c
+8-2usr.bin/mdo/mdo.c
+2-4sys/dev/cxgbe/t4_main.c
+1-1sys/sys/syscallsubr.h
+58-764 files

HardenedBSD/src 37c18e4libexec/nuageinit nuageinit nuage.lua, libexec/nuageinit/tests addfile.lua nuageinit.sh

Merge branch 'freebsd/14-stable/main' into hardened/14-stable/master
DeltaFile
+19-13libexec/nuageinit/nuageinit
+2-4libexec/nuageinit/nuage.lua
+1-1libexec/nuageinit/tests/addfile.lua
+1-1libexec/nuageinit/tests/nuageinit.sh
+23-194 files

HardenedBSD/src 5987531libexec/nuageinit nuageinit nuage.lua, libexec/nuageinit/tests addfile.lua nuageinit.sh

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+19-13libexec/nuageinit/nuageinit
+2-4libexec/nuageinit/nuage.lua
+2-2sys/netpfil/ipfw/ip_fw2.c
+1-1libexec/nuageinit/tests/addfile.lua
+1-1libexec/nuageinit/tests/nuageinit.sh
+25-215 files

HardenedBSD/src 3c85756stand defs.mk, stand/efi/libefi Makefile

stand: Rename ZFSSRC to SAZFSSRC to avoid confusion

ZFSSRC is abiguous on its surface and too clos to ZFSTOP, so rename it
to SAZFSSRC.

Sponsored by:           Netflix
Reviewed by:            tsoome
Differential Revision:  https://reviews.freebsd.org/D53901
DeltaFile
+2-2stand/libsa/zfs/Makefile.inc
+2-2stand/i386/gptzfsboot/Makefile
+1-1stand/efi/libefi/Makefile
+1-1stand/efi/loader/Makefile
+1-1stand/kboot/kboot/Makefile
+1-1stand/defs.mk
+8-82 files not shown
+10-108 files

HardenedBSD/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

HardenedBSD/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

HardenedBSD/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

HardenedBSD/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

HardenedBSD/src 0534624stand defs.mk, stand/libsa/zfs Makefile.inc

stand: Move from OZFS to ZFSTOP

Use ZFSTOP instead of OZFS. They are the saame thing.

Sponsored by:           Netflix
Reviewed by:            tsoome
Differential Revision:  https://reviews.freebsd.org/D53900
DeltaFile
+8-8stand/libsa/zfs/Makefile.inc
+2-3stand/defs.mk
+10-112 files

HardenedBSD/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

HardenedBSD/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

HardenedBSD/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

HardenedBSD/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

HardenedBSD/src f4cd5cecddl/lib/libzfs Makefile, sys/dev/irdma irdma_hw.c irdma_cm.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+108-24sys/dev/irdma/irdma_hw.c
+18-41sys/kern/kern_prot.c
+2-36sys/dev/irdma/irdma_cm.c
+16-16cddl/lib/libzfs/Makefile
+1-29sys/dev/mlx5/mlx5_en/mlx5_en_main.c
+16-11sys/netlink/netlink_snl.h
+161-15760 files not shown
+392-42766 files

HardenedBSD/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

HardenedBSD/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

HardenedBSD/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

HardenedBSD/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

HardenedBSD/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

HardenedBSD/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