FreeBSD/src bc3b72fsys/netpfil/pf pf.c, tests/sys/netpfil/pf sctp.py

pf: relax sctp v_tag verification

pf was too strict when validating SCTP tags. When a server receives a
retransmitted INIT it will reply with a random initiate tag every time.
However, pf saves the first initiate tag and expects every subsequent INIT_ACK
retransmission to have the same tag. This is not the case, leading to endless
INIT/INIT_ACK cycles.

Allow the tag to be updated as long as we've not gone past COOKIE_WAIT.

Add a test case to verify this.

MFC after:      2 weeks
See also:       https://redmine.pfsense.org/issues/16516
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+67-0tests/sys/netpfil/pf/sctp.py
+5-1sys/netpfil/pf/pf.c
+72-12 files

FreeBSD/src a8151f1libexec/rtld-elf rtld.1

Add description of the LD_DEBUG environment variable.
DeltaFile
+6-1libexec/rtld-elf/rtld.1
+6-11 files

FreeBSD/src 23ddcd2sys/kern kern_event.c

kevent: Hold the knlist mutex when invoking f_event(NOTE_FORK)

In general f_event is supposed to be called with the knlist mutex held,
so lock it earlier to follow this protocol.  Also make sure that the
update to kn_fflags is synchronized.

Lock the kqueue itself earlier in the case where the knote is activated,
to avoid locking and unlocking the kqueue twice.

PR:             291005
Reported by:    Qiu-ji Chen <chenqiuji666 at gmail.com>
Reviewed by:    kib
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D53762

(cherry picked from commit d795c753e262b97a93dc353aa66b858e1b1969d1)
DeltaFile
+12-4sys/kern/kern_event.c
+12-41 files

FreeBSD/src f8bf6f8sys/kern kern_event.c

kevent: Hold the knlist mutex when invoking f_event(NOTE_FORK)

In general f_event is supposed to be called with the knlist mutex held,
so lock it earlier to follow this protocol.  Also make sure that the
update to kn_fflags is synchronized.

Lock the kqueue itself earlier in the case where the knote is activated,
to avoid locking and unlocking the kqueue twice.

PR:             291005
Reported by:    Qiu-ji Chen <chenqiuji666 at gmail.com>
Reviewed by:    kib
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D53762

(cherry picked from commit d795c753e262b97a93dc353aa66b858e1b1969d1)
DeltaFile
+12-4sys/kern/kern_event.c
+12-41 files

FreeBSD/src 238ad59lib/libpfctl libpfctl.c

libpfctl: improve error handling

If we fail to open /dev/pf don't try to close it again. That would result in
errno getting overwritten by close(), hiding potentially useful information.

MFC after:      2 weeks
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+2-2lib/libpfctl/libpfctl.c
+2-21 files

FreeBSD/src 9562994. UPDATING, sys/kern link_elf.c link_elf_obj.c

kernel linker: Disable local sym resolution by default

In 95c20faf11a1 and ecd8245e0d77 kib introduced support to have the
kernel linker stop resolving local symbols from other files, but did
not enable it by default to avoid surprises.  Flip the default now,
before FreeBSD 16.0.

The debug.link_elf_leak_locals and debug.link_elf_obj_leak_locals
sysctls are available to revert to the previous behaviour if necessary.

PR:             207898
Reviewed by:    bz
Relnotes:       Yes
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47742
DeltaFile
+9-0UPDATING
+1-1sys/kern/link_elf.c
+1-1sys/kern/link_elf_obj.c
+11-23 files

FreeBSD/src 870a7a9sys/netpfil/pf pf_lb.c, tests/sys/netpfil/pf nat.sh

pf: fix udp_mapping cleanup

If we fail to obtain a new source port (pf_get_sport()) while we've
created a udp_mapping (for 'endpoint independent nat') we must free the
udp_mapping in pf_get_sport(). Otherwise the calling function will call
pf_udp_mapping_release(). This will then attempt to remove the udp_mapping from
a list it's not in, and crash.

Actually free the udp_mapping in all failure cases. While here sprinkle in a few
more assertions to ensure we don't forget leak udp_mappings and add a test case
to provoke this problem.

Reviewed by:    thj
MFC after:      1 week
See also:       https://redmine.pfsense.org/issues/16517
Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D53737

(cherry picked from commit c12013f5bb3819e64499f02ecd199a635003c7ce)
DeltaFile
+30-0tests/sys/netpfil/pf/nat.sh
+22-7sys/netpfil/pf/pf_lb.c
+52-72 files

FreeBSD/src 7799b57sys/net if_ovpn.c

if_ovpn: use IFT_TUNNEL

IFT_ENC has special behaviour in pf we don't desire, and this also ensures that
for all interface types there is N:1:1 correspondence between if_type:dlt:header len.

Requested by:   glebius
MFC after:      1 week

(cherry picked from commit ff9f76a206c80c263050816735d537a151ee2999)
DeltaFile
+1-1sys/net/if_ovpn.c
+1-11 files

FreeBSD/src 58eacc8sys/net if_ovpn.c

if_ovpn: use IFT_TUNNEL

IFT_ENC has special behaviour in pf we don't desire, and this also ensures that
for all interface types there is N:1:1 correspondence between if_type:dlt:header len.

Requested by:   glebius
MFC after:      1 week

(cherry picked from commit ff9f76a206c80c263050816735d537a151ee2999)
DeltaFile
+1-1sys/net/if_ovpn.c
+1-11 files

FreeBSD/src 64ee9c1sys/dev/e1000 if_em.c

em(4): fix capability bounds needed to access checksum context.

Ensure the offp capability bounds cover entire struct with checksum fields.

This is needed for CHERI systems to avoid bounds violation trap, as
otherwise offp allowed to dereference 4 bytes of csum_flags field only
so bzero failed.

Tested on ARM Morello.

Reviewed by:    kbowling
Discussed with: jrtc27
Sponsored by:   CHERI Research Centre
Differential Revision:  https://reviews.freebsd.org/D53903
DeltaFile
+1-1sys/dev/e1000/if_em.c
+1-11 files

FreeBSD/src b87f633sys/dev/nvme nvme_ctrlr.c

nvme(4): Increase HMB alignment.

The NVME controller in Crucial P310 disk does not accept 16-byte aligned
host memory buffer on Codasip Prime platform, but works fine on PAGE_SIZE
aligned memory.

Instead of adding a quirk, just increase alignment for everyone.

Reviewed by:    jhb
Discussed with: imp
Sponsored by:   CHERI Research Centre
Differential Revision:  https://reviews.freebsd.org/D53296
DeltaFile
+1-1sys/dev/nvme/nvme_ctrlr.c
+1-11 files

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

FreeBSD/src f6bd9b2crypto/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
+6-0crypto/openssh/FREEBSD-upgrade
+15-02 files

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

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

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

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

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

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

FreeBSD/src 3c85756stand loader.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/loader.mk
+8-82 files not shown
+10-108 files

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

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