FreeBSD/src 51fcd5dsys/netinet igmp.c, sys/sys mbuf.h

igmp: Avoid leaving dangling pointers in the state-change queue

When igmp_v3_merge_state_changes() is iterating over state-change
packets, there is a case where it'll free a queued packet but will fail
to remove it from the queue.  Fix that.

Reported by:    Yuxiang Yang, Yizhou Zhao, Xuewei Feng, Qi Li, and Ke Xu from Tsinghua University using GLM5.1 from Z.ai
Reviewed by:    pouria, glebius
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D56947

(cherry picked from commit beab4a237a45aea809e81802b9e1e9ff30f3d929)
DeltaFile
+5-3sys/netinet/igmp.c
+8-0sys/sys/mbuf.h
+13-32 files

FreeBSD/src 74d5c2bsys/net if_vxlan.c

if_vxlan: Update *m0 after a pullup

vxlan_input()'s caller is supposed to free *m0 if it is non-NULL after
the function returns.  vxlan_input() failed to update *m0 after the
pullup however, so if it hits an error case after the pullup, we'll free
the mbuf twice.  Currently this can happen only if the interface is
brought down or due to a packet loop.

Reported by:    Yuxiang Yang, Yizhou Zhao, Xuewei Feng, Qi Li, and Ke Xu from Tsinghua University using GLM5.1 from Z.ai
Reviewed by:    pouria, zlei
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D56944

(cherry picked from commit a6c4fe2d1a38885914b1c3e85508b965ccdb7874)
DeltaFile
+1-2sys/net/if_vxlan.c
+1-21 files

FreeBSD/src 7797d07tests/sys/kern Makefile

tests/timerfd: Serialize

At least one of these tests changes the system clock, which potentially
interferes with concurrently running tests and causes them to fail.

MFC after:      1 week

(cherry picked from commit 001cfc7b8aa38122c4e0fe8ae48fae3556a1f2b6)
DeltaFile
+2-0tests/sys/kern/Makefile
+2-01 files

FreeBSD/src 04d8c9asys/net/route route_tables.c

routing: Use a better error number in sysctl_fibs()

ENOTCAPABLE is for capsicum and its use here is inappropriate.  In
particular, note that syscallret() treats this value specially.

Reviewed by:    glebius, pouria, zlei
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D56481

(cherry picked from commit 8de0fc10a1c2d65bdb39eff862266ab1f87902c8)
DeltaFile
+1-1sys/net/route/route_tables.c
+1-11 files

FreeBSD/src 5937f2ftests/sys/net if_lagg_test.sh

tests/if_lagg: Minor improvements

- Set require.kmods instead of relying on ifconfig to load if_lagg.ko,
  as this doesn't work when running within a jail.
- Simplify helper functions which create tap and lagg devices.

MFC after:      1 week

(cherry picked from commit 47ae0135d461854b72b905ac77bf3e1f5b2868bc)
DeltaFile
+11-24tests/sys/net/if_lagg_test.sh
+11-241 files

FreeBSD/src 605d3bctests/sys/netinet socket_afinet.c

tests/socket_afinet: Fix the bind_connected_port test

The test verifies that a socket can bind to a local address assigned by
connect(2) to a different socket.  It was however trying to bind to the
wrong address, and the check of the result was inverted, so this went
unnoticed.  It also needs to set SO_REUSEADDR for this to succeed.

Reported by:    glebius
MFC after:      1 week

(cherry picked from commit d3d0466cae546254c50c80cf3e0c060bbbbba53c)
DeltaFile
+7-7tests/sys/netinet/socket_afinet.c
+7-71 files

FreeBSD/src 5bf82cbtests/sys/posixshm posixshm_test.c

tests/posixshm: Check for hardware support in largepage_pkru

MFC after:      3 days
Fixes:          ca87c0b8e396 ("pkru: Fix handling of 1GB largepage mappings")

(cherry picked from commit 75c66218401c00f4728d5312e2b933b8d3aefde1)
DeltaFile
+10-0tests/sys/posixshm/posixshm_test.c
+10-01 files

FreeBSD/src 8eab86fcontrib/netbsd-tests/lib/libc/sys t_mmap.c

netbsd-tests: Fix the mmap_truncate_signal test

Add a volatile qualifier in the loop which triggers SIGBUS, as otherwise
the compiler is smart enough to elide it, replacing it with a check for
page != 0.

MFC after:      1 week

(cherry picked from commit e3b8e55e710bf355f371d798aa943281007a7ea9)
DeltaFile
+1-1contrib/netbsd-tests/lib/libc/sys/t_mmap.c
+1-11 files

FreeBSD/src 7d63a75sys/net/route route_tables.c

routing: Initialize V_rt_numfibs earlier during boot

V_rt_numfibs can be set at compile time (with the ROUTETABLES kernel
config option) or boot time (with the net.fibs tunable).
vnet_rtables_init(), running during SI_PROTO_DOMAIN, was checking the
tunable and updating V_rt_numfibs accordingly, but that means that
earlier SYSINITs, such as vnet_mroute_init(), see the compile-time value
for V_rt_numfibs before it gets corrected in vnet_rtables_init().

Fix this by initializing V_rt_numfibs earlier, so that SYSINITs are less
likely to use the wrong value.

Add a comment describing the weird, preexisting semantic of resetting
rt_numfibs to 1 in VNET jails.

PR:             294510
Reviewed by:    glebius, zlei, pouria
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D56473

    [2 lines not shown]
DeltaFile
+16-8sys/net/route/route_tables.c
+16-81 files

FreeBSD/src 4f29251sys/net if_fwsubr.c

net: bandaid for plugging a fw_com leak in fwip_detach()

Adding a temporary workaround for plugging a fw_com upon if_fwip unloading.

Steps to reproduce(needs two hosts connected with firewire):

  while true; do
    ifconfig fwip0 10.0.0.5 up
    fwcontrol -r
    ping -c 10.0.0.3
    kldunload if_fwip
  done

There's a chance that the unloading of if_fwip.ko triggers following warning:

        Warning: memory type fw_com leaked memory on destroy (1 allocations, 64 bytes leaked).

commit d79b6b8ec267e7eef6e07cf4245159705e24acd5 (origin/main, origin/HEAD)

(cherry picked from commit 25a5bb7318052322190a2880e0e7ef18e06d54bd)
DeltaFile
+1-0sys/net/if_fwsubr.c
+1-01 files

FreeBSD/src de69cf1sys/netinet tcp_subr.c

tcp: cleanup

No functional change intended.

Reviewed by:            pouria, rrs, Timo Völker
Sponsored by:           Netflix, Inc.
Differential Revision:  https://reviews.freebsd.org/D55415

(cherry picked from commit c984c7593e11aa95f21f79bb5425a9d5e9181945)
DeltaFile
+12-12sys/netinet/tcp_subr.c
+12-121 files

FreeBSD/src ede0f15sys/netinet tcp_subr.c

tcp: improve validation of received TCP over UDP packets

Reviewed by:            glebius, pouria
Sponsored by:           Netflix, Inc.
Differential Revision:  https://reviews.freebsd.org/D55410

(cherry picked from commit e1886559ea477add82a0a86cddf728f6778f1603)
DeltaFile
+17-5sys/netinet/tcp_subr.c
+17-51 files

FreeBSD/src 9958d0fshare/misc bsd-family-tree

bsd-family-tree: add OpenBSD 7.9
DeltaFile
+2-0share/misc/bsd-family-tree
+2-01 files

FreeBSD/src eeffed5tests/sys/netinet Makefile

tests/if_carp: Run all tests with execenv=jail

Otherwise failures can occur when running tests in parallel since some
tests reuse jail names.

MFC after:      1 week
DeltaFile
+2-0tests/sys/netinet/Makefile
+2-01 files

FreeBSD/src 8e44312lib/libufs libufs.h inode.c

libufs: Avoid using param.h constants in libufs.h

MAXBSIZE is defined in param.h, which defines many other things.  To
avoid forcing all consumers of libufs.h to include param.h, let's
instead redefine it and verify the definition in inode.c.

Reviewed by:    kib
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D56859

(cherry picked from commit 271d25a066b59df1e2bb774990948c985382126a)
DeltaFile
+5-2lib/libufs/libufs.h
+3-0lib/libufs/inode.c
+8-22 files

FreeBSD/src e2053eesbin/fsck_ffs fsck.h gjournal.c

fsck_ffs: Avoid relying on param.h pollution from libufs.h

- gjournal.c needs param.h to get a definition of isclr().
- fsck.h needs signal.h for sig_atomic_t.

Sort includes while here.

Reviewed by:    kib
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D56858

(cherry picked from commit 3cd3900b690d8296094921cec844da3f72d30cbb)
DeltaFile
+6-5sbin/fsck_ffs/fsck.h
+2-2sbin/fsck_ffs/gjournal.c
+8-72 files

FreeBSD/src 951e271lib/libutil quotafile.c

libutil: Include param.h in quotafile.c

Required for MAXPATHLEN.

MFC after:      1 week

(cherry picked from commit 237900f17f091d059a3ead6a5320285654f4bfa0)
DeltaFile
+1-1lib/libutil/quotafile.c
+1-11 files

FreeBSD/src 919d220sys/sys _cpuset.h cpuset.h

cpuset: Move userspace declarations out of _cpuset.h

The _*.h headers are for structure definitions and should avoid
dependencies on other headers.  This convention is violated by using
__BEGIN_DECLS/__END_DECLS.

Move the declarations to cpuset.h, I see no reason they can't be there.

Reviewed by:    olce, brooks, kib
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D56856

(cherry picked from commit 8b4b995effb7911cc13706dc309d5e03c83b9a94)
DeltaFile
+0-7sys/sys/_cpuset.h
+6-1sys/sys/cpuset.h
+6-82 files

FreeBSD/src 3fa3e36sys/kern subr_vmem.c

vmem: Include param.h in the userspace port as well

It is required at least for NBBY.

MFC after:      1 week

(cherry picked from commit fab4acbb7db8ffc7082d1b60b3c8e446a7cfef90)
DeltaFile
+1-1sys/kern/subr_vmem.c
+1-11 files

FreeBSD/src 5478353tests/sys/netinet ip_mroute.py

tests/ip_mroute: Remove test timeouts

The configured timeout of 30s is a bit too low for a couple of tests
which create 4+ VNET jails when running tests in parallel and with
kernel sanitizers enabled.  There's no reason to have custom timeouts,
just use the default.

MFC after:      1 week

(cherry picked from commit 3b16e96b005c723717aa6a4ebc48000354e64fa1)
DeltaFile
+0-6tests/sys/netinet/ip_mroute.py
+0-61 files

FreeBSD/src 54e213dsys/netinet igmp.c, sys/sys mbuf.h

igmp: Avoid leaving dangling pointers in the state-change queue

When igmp_v3_merge_state_changes() is iterating over state-change
packets, there is a case where it'll free a queued packet but will fail
to remove it from the queue.  Fix that.

Reported by:    Yuxiang Yang, Yizhou Zhao, Xuewei Feng, Qi Li, and Ke Xu from Tsinghua University using GLM5.1 from Z.ai
Reviewed by:    pouria, glebius
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D56947

(cherry picked from commit beab4a237a45aea809e81802b9e1e9ff30f3d929)
DeltaFile
+5-3sys/netinet/igmp.c
+8-0sys/sys/mbuf.h
+13-32 files

FreeBSD/src 00becaatests/sys/net if_lagg_test.sh

tests/if_lagg: Minor improvements

- Set require.kmods instead of relying on ifconfig to load if_lagg.ko,
  as this doesn't work when running within a jail.
- Simplify helper functions which create tap and lagg devices.

MFC after:      1 week

(cherry picked from commit 47ae0135d461854b72b905ac77bf3e1f5b2868bc)
DeltaFile
+11-24tests/sys/net/if_lagg_test.sh
+11-241 files

FreeBSD/src 9b55252tests/sys/kern Makefile

tests/timerfd: Serialize

At least one of these tests changes the system clock, which potentially
interferes with concurrently running tests and causes them to fail.

MFC after:      1 week

(cherry picked from commit 001cfc7b8aa38122c4e0fe8ae48fae3556a1f2b6)
DeltaFile
+2-0tests/sys/kern/Makefile
+2-01 files

FreeBSD/src b84629bsys/net if_vxlan.c

if_vxlan: Update *m0 after a pullup

vxlan_input()'s caller is supposed to free *m0 if it is non-NULL after
the function returns.  vxlan_input() failed to update *m0 after the
pullup however, so if it hits an error case after the pullup, we'll free
the mbuf twice.  Currently this can happen only if the interface is
brought down or due to a packet loop.

Reported by:    Yuxiang Yang, Yizhou Zhao, Xuewei Feng, Qi Li, and Ke Xu from Tsinghua University using GLM5.1 from Z.ai
Reviewed by:    pouria, zlei
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D56944

(cherry picked from commit a6c4fe2d1a38885914b1c3e85508b965ccdb7874)
DeltaFile
+1-2sys/net/if_vxlan.c
+1-21 files

FreeBSD/src a1e4bc8sys/kern kern_exec.c, sys/vm vm_kern.c vm_init.c

execve: Add guard pages around execve KVA buffers

This helps ensure that overflows will trigger a panic instead of
silently corrupting adjacent buffers, as happened in SA-26:13.exec.

Extend kmap_alloc_wait() to support allocation of guard pages on both
sides of a KVA allocation.  Modify the exec_map setup accordingly.  Add
the "vm.exec_map_guard_pages" tunable to provide control over the guard
page allocations.

Reviewed by:    kib
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D56711

(cherry picked from commit eca4dd133883c9e9aaeca68e0119a638ba0aaca7)
DeltaFile
+32-7sys/vm/vm_kern.c
+6-2sys/vm/vm_init.c
+2-1sys/kern/kern_exec.c
+1-1sys/vm/vm_extern.h
+1-0sys/vm/vm_kern.h
+42-115 files

FreeBSD/src 111a521usr.bin/find extern.h

find: Include signal.h to get a definition for sig_atomic_t

MFC after:      1 week

(cherry picked from commit 5615db1007bdc935ac6592a66721320ccd8335ce)
DeltaFile
+1-1usr.bin/find/extern.h
+1-11 files

FreeBSD/src 27b9d3dtests/sys/kern execve_overflow.c Makefile

tests: Add a simple regression test for an execve overflow bug

MFC after:      2 weeks

(cherry picked from commit 41b03932e59068decf03b7975889841f71c73ec4)
DeltaFile
+46-0tests/sys/kern/execve_overflow.c
+1-0tests/sys/kern/Makefile
+47-02 files

FreeBSD/src 9eea4e0sbin/hastd hooks.c

hastd: Include param.h instead of relying on pollution in hooks.c

This is needed at least for MAX() and PATH_MAX.

MFC after:      1 week

(cherry picked from commit fae5815a1d7ef6ef07a15231ca695cba0f848e18)
DeltaFile
+1-1sbin/hastd/hooks.c
+1-11 files

FreeBSD/src 21ad40fsbin/reboot reboot.c

reboot: Include limits.h for PATH_MAX

MFC after:      1 week

(cherry picked from commit 9461071d5cd901c968dcd7f4a114905995f90d66)
DeltaFile
+1-0sbin/reboot/reboot.c
+1-01 files

FreeBSD/src 3dac23cusr.sbin/edquota edquota.c

edquota: Include param.h

Required for MAXPATHLEN and MAXLOGNAME.

MFC after:      1 week

(cherry picked from commit ee2d1a1a5a1877f8ce7b9eee94479ec702880bd7)
DeltaFile
+1-0usr.sbin/edquota/edquota.c
+1-01 files