FreeBSD/src 2472e35sys/netinet ip_icmp.c, sys/netinet6 icmp6.c

icmp: correct the assertion that checks limit + jitter

Fixes:  4399e055ea610cdefa1470ad1ee614dd81ba5e56
(cherry picked from commit f7c4d12bcd5bd7f7fbf6bf9fa601c47e7f97bc5f)
DeltaFile
+1-1sys/netinet/ip_icmp.c
+1-1sys/netinet6/icmp6.c
+2-22 files

FreeBSD/src d366b49sys/netinet ip_icmp.c, sys/netinet6 icmp6.c

icmp: allow zero value for ICMP limits

Zero means limit is disabled, so the value doesn't need to be checked
against jitter value.

Fixes:  ac44739fd834f51cacb26485a4140fd482e20150
Fixes:  a03aff88a14448c3084a0384082ec996d7213897
(cherry picked from commit 4399e055ea610cdefa1470ad1ee614dd81ba5e56)
DeltaFile
+1-1sys/netinet/ip_icmp.c
+1-1sys/netinet6/icmp6.c
+2-22 files

FreeBSD/src 5a676edtests/sys/netpfil/common dummynet.sh

netpfil tests: disable ICMPv6 rate limiting in the test jail

The dummynet test uses flood ping as source of traffic, so the rate
limiting of ICMP replies broke the test.

Fixes:  32aeee8ce7e72738fff236ccd5629d55035458f8
(cherry picked from commit 75d15e893b14188b83c5fb5e4979fa21c557934f)
DeltaFile
+1-0tests/sys/netpfil/common/dummynet.sh
+1-01 files

FreeBSD/src b544e62sys/netinet6 icmp6.c

icmp6: bring rate limiting on a par with IPv4

Use counter_ratecheck() instead of racy and slow ppsratecheck. Use a
separate counter for every currently known type of ICMPv6. Provide logging
of ratelimit events. Provide jitter to counter open UDP port detection.

Reviewed by:            tuexen, zlei
Differential Revision:  https://reviews.freebsd.org/D44482

(cherry picked from commit a03aff88a14448c3084a0384082ec996d7213897)
DeltaFile
+162-23sys/netinet6/icmp6.c
+162-231 files

FreeBSD/src 24a07b6sys/netinet6 in6_proto.c nd6.c

icmp6: move ICMPv6 related tunables to the files where they are used

Most of them can be declared as static after the move out of in6_proto.c.
Keeping sysctl(9) declarations with their text descriptions next to the
variable declaration create self-documenting code.  There should be no
functional changes.

Differential Revision:  https://reviews.freebsd.org/D44481

(cherry picked from commit 4f96be33fe7676c69c5abb476bb09bba0c63a3f4)
DeltaFile
+0-65sys/netinet6/in6_proto.c
+31-13sys/netinet6/nd6.c
+29-5sys/netinet6/icmp6.c
+0-14sys/netinet6/nd6.h
+13-1sys/netinet6/in6.c
+7-3sys/netinet6/nd6_rtr.c
+80-1013 files not shown
+91-1129 files

FreeBSD/src f6561ffsys/netinet6 icmp6.c

icmp6: rate limit our echo replies

The generation of ICMP6_ECHO_REPLY bypasses icmp6_error(), thus rate
limit was not applied.

Reviewed by:            tuexen, zlei
Differential Revision:  https://reviews.freebsd.org/D44480

(cherry picked from commit 32aeee8ce7e72738fff236ccd5629d55035458f8)
DeltaFile
+2-0sys/netinet6/icmp6.c
+2-01 files

FreeBSD/src 9e09b33sys/netinet6 icmp6.c

icmp6: make icmp6_ratelimit() responsible to update the stats counter

Reviewed by:            tuexen
Differential Revision:  https://reviews.freebsd.org/D44479

(cherry picked from commit c6c96aaba8dd74eb39469ed156ff19cc31d599b7)
DeltaFile
+2-3sys/netinet6/icmp6.c
+2-31 files

FreeBSD/src c04006esys/netinet ip_icmp.c

icmp: hide icmp_bandlimit_uninit() under VIMAGE

The uninitialization may be executed only on a kernel with VIMAGE.

Reviewed by:            kp, tuexen, zlei
Differential Revision:  https://reviews.freebsd.org/D44476

(cherry picked from commit 9d7f17d7467ed8c9740730a8db7a82e4768e5177)
DeltaFile
+2-0sys/netinet/ip_icmp.c
+2-01 files

FreeBSD/src d8acc72sys/netinet ip_icmp.c

icmp: improve ICMP limit jitter

Instead of fixing up invalid values set by a user in badport_bandlim()
which is a fast path function, provide a sysctl handler
sysctl_icmplim_and_jitter(), that will check that jitter is less than the
limit.

Provide jitter initilization function icmplim_new_jitter() used at boot,
in the sysctl handler and when we actually hit the limit.  This also fixes
no jitter on a fresh booted system until first limit hit.

Instead of CVE number provide link the the actual paper that explains what
and why we are doing here.  The CVE number isn't very informative, it will
just tell you what RedHat version you need to upgrade to.

Reviewed by:            kp, tuexen, zlei
Differential Revision:  https://reviews.freebsd.org/D44478

(cherry picked from commit ac44739fd834f51cacb26485a4140fd482e20150)
DeltaFile
+59-22sys/netinet/ip_icmp.c
+59-221 files

FreeBSD/src 09a0522sys/netinet ip_icmp.c

icmp: when logging ICMP ratelimiting message use correct jitter value

The limiting of the very last second has been done using certain jitter
value.  We update the jitter for the next second.  But the logging should
report the jitter before the change.

Reviewed by:            kp, tuexen, zlei
Differential Revision:  https://reviews.freebsd.org/D44477

(cherry picked from commit b508545ce044dbfdd83da772e73f969a3713d59d)
DeltaFile
+5-5sys/netinet/ip_icmp.c
+5-51 files

FreeBSD/src 2193c63sys/netinet ip_icmp.c

icmp: do not store per-VNET identical array of strings

We need per-VNET struct counter_rate, but we don't need per-VNET set of
const char *.  Also, identical word "response" can go into the format
string instead of being stored 7 times.

Reviewed by:            kp, zlei, tuexen
Differential Revision:  https://reviews.freebsd.org/D44475

(cherry picked from commit 7142ab4790666022a2a3d85910e9cd8e241d9b87)
DeltaFile
+18-19sys/netinet/ip_icmp.c
+18-191 files

FreeBSD/src b2351a4tests/sys/kern unix_seqpacket_test.c

test: disable sys.kern.unix_seqpacket_test.random_eor_and_waitall

It's been failing for a while, at least some of the time.

PR: 279994
Sponsored by:           Netflix
DeltaFile
+3-0tests/sys/kern/unix_seqpacket_test.c
+3-01 files

FreeBSD/src d6fecberelease Makefile.mirrors Makefile.vm

release: Publish non-uploaded cloudware bits

[MFC note: We don't have BASIC-CLOUDINIT or support for multiple disk
formats or filesystems in VMs on 13.x so this MFC only does BASIC-CI
and only for UFS on RAW.]

While most "cloudware" (AWS, Azure, GCP, Vagrant) images get uploaded
to their respective clouds, we have two images -- BASIC-CI and
BASIC-CLOUDINIT -- which are published via the FTP mirrors.  We have
been handling these using a manual and error-prone process of copying
them from the internal build directories into the FTP staging tree,
but they should be handled using the "make install ftp-stage"
mechanism which is used for all the other published images.

This commit 1. Adds a new 'make cloud-install' target which is run as
part of 'make install' and installs BASIC-CI and BASIC-CLOUDINIT images,
and 2. Extends 'make ftp-stage' in Makefile.mirrors to copy those bits
into the FTP staging area.


    [7 lines not shown]
DeltaFile
+52-0release/Makefile.mirrors
+20-0release/Makefile.vm
+2-1release/Makefile
+74-13 files

FreeBSD/src 4ef9a9drelease Makefile.mirrors Makefile.vm

release: Publish non-uploaded cloudware bits

While most "cloudware" (AWS, Azure, GCP, Vagrant) images get uploaded
to their respective clouds, we have two images -- BASIC-CI and
BASIC-CLOUDINIT -- which are published via the FTP mirrors.  We have
been handling these using a manual and error-prone process of copying
them from the internal build directories into the FTP staging tree,
but they should be handled using the "make install ftp-stage"
mechanism which is used for all the other published images.

This commit 1. Adds a new 'make cloud-install' target which is run as
part of 'make install' and installs BASIC-CI and BASIC-CLOUDINIT images,
and 2. Extends 'make ftp-stage' in Makefile.mirrors to copy those bits
into the FTP staging area.

As a side benefit, this will also make BASIC-CI and BASIC-CLOUDINIT
images available for arm64; until now they have only been available
for amd64.


    [3 lines not shown]
DeltaFile
+96-0release/Makefile.mirrors
+42-0release/Makefile.vm
+2-1release/Makefile
+140-13 files

FreeBSD/src 443a4cerelease Makefile.mirrors

release: Don't publish CW if !WITH_CLOUDWARE

If WITH_CLOUDWARE is not set, we didn't build BASIC-CLOUDWARE; don't try
to install it into the /VM-IMAGES/ directory as part of ftp-stage.

Fixes:  4771c2e9d1c7 "release: Publish non-uploaded cloudware bits"
MFC after:      6 days

(cherry picked from commit 836f00ebb96ac343e0f8a68ea264d2d330198488)
DeltaFile
+18-14release/Makefile.mirrors
+18-141 files

FreeBSD/src 3da5687stand/common module.c

stand: module: unlink the entire tail when dependencies fail to load

Assume you have loader configured to load linux64, which has a
dependency on both linux_common and mqueuefs but neither the kernel
nor kernel config in question have the mqueuefs module included.

When the load command for linux64 fails to find mqueuefs, it will
free both linux64 and linux_common as they were loaded first, but only
linux64 gets removed from the module list.  As a result, future
traversals hit an easy use-after-free with linux_common.

Fix it so that we unlink the entire tail of the list.  Anything after
the initially loaded module is, by definition, a dependency on the
loaded module while we're still in the load command, so we can just
discard the entire tail.  If linux_common were loaded before linux64, it
should not move to a position during this load where it would suddenly
be missing from the view presented to the kernel.

Reported by:    philip

    [3 lines not shown]
DeltaFile
+26-5stand/common/module.c
+26-51 files

FreeBSD/src 7d6932dusr.sbin/ctladm ctladm.c

ctladm: Fix a race when loading ctl.ko

If multiple ctladm processes try to load ctl.ko at the same time, only
one will succeed.  Handle this possibility by retrying the operation
(open /dev/cam/ctl) if kldload returns EEXIST, rather than bailing.
This at least helps ensure that ctladm tests can be run in parallel
when ctl.ko is not preloaded.

Reviewed by:    asomers
MFC after:      1 week
DeltaFile
+1-1usr.sbin/ctladm/ctladm.c
+1-11 files

FreeBSD/src f29bdeasys/fs/ext2fs ext2_extents.c

ext4_ext_tree_init: correct memset initialization

gcc -Wmemset-elt-size diagnosed this.  The code was only initializing
1/4 of the array.  However, it was actually harmless, as the only caller
had done an M_ZERO allocation anyway.

Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D45701
DeltaFile
+1-1sys/fs/ext2fs/ext2_extents.c
+1-11 files

FreeBSD/src 07cc7ealib/msun/ld128 e_rem_pio2l.h s_logl.c, lib/msun/ld80 e_rem_pio2l.h s_logl.c

libmsun: remove duplicates after cdefs.h added inline to __always_inline

Reviewed by:    kib, olce
Sponsored by:   Dell EMC Isilon
Differential Revision:  https://reviews.freebsd.org/D45712
DeltaFile
+1-1lib/msun/ld128/e_rem_pio2l.h
+1-1lib/msun/ld128/s_logl.c
+1-1lib/msun/ld80/e_rem_pio2l.h
+1-1lib/msun/ld80/s_logl.c
+1-1lib/msun/src/e_rem_pio2.c
+1-1lib/msun/src/e_rem_pio2f.c
+6-66 files

FreeBSD/src d25f0bdsys/sys cdefs.h

cdefs.h: add __inline to __always_inline

Add __inline to the __always_inline macro to quiet dozens of gcc
warnings of the form:
warning: 'always_inline' function might not be inlinable [-Wattributes]

It's clearly the intention of the __always_inline macro applied to a
function to inline the function.  However, gcc seems to be picky with
the -Wattributes.  It appears that __attribute__((__always_inline__))
was intended to apply to inline functions, as in, function declarations
with the attribute should also be declared as inline.  Both clang and
gcc sources themselves use the two in combination:
inline __attribute__((__always_inline__))

FreeBSD sources mostly only use __always_inline, without the inline
keyword.  Only a few files in libmsun used both.

Reviewed by:    imp, kib, olce
Sponsored by:   Dell EMC Isilon
Differential Revision:  https://reviews.freebsd.org/D45711
DeltaFile
+1-1sys/sys/cdefs.h
+1-11 files

FreeBSD/src 8aa9192sys/dev/isp isp.c

isp: fix ISPCTL_ABORT_CMD switch case

Prevent kernel panic by not running ISPCTL_FCLINK_TEST after a
failed ISPCTL_ABORT_CMD.

Reviewed by:    mav
Tested by:      Arne Steinkamm <arne at steinkamm.com>
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D45718
DeltaFile
+1-0sys/dev/isp/isp.c
+1-01 files

FreeBSD/src df7001bsys/netlink/route rt.c

netlink/route: provide pre-2.6.19 Linux compat shim

The old Linux used 8-bit rtm_table field of the RTM_NEWROUTE message to
specify routing table id.  Modern netlink uses RTA_TABLE 32-bit attribute.

Unfortunately, there is modern software (namely bird) that would prefer
the old API as long as the routing table id fits into 8-bit.

PR:             279662
(cherry picked from commit f34aca55adef1e28cd68b2e6705a0cac03f0238e)
DeltaFile
+6-1sys/netlink/route/rt.c
+6-11 files

FreeBSD/src 44d4ee7sys/riscv/include fpe.h, sys/riscv/riscv fpe.c

riscv: add FPE code.

Add floating point extension (FPE) code needed for bhyve and world switch.

Reviewed by:    mhorne
Sponsored by:   UKRI
Differential Revision:  https://reviews.freebsd.org/D45697
DeltaFile
+190-0sys/riscv/riscv/fpe.c
+11-1sys/riscv/include/fpe.h
+201-12 files

FreeBSD/src d596360sys/riscv/include sbi.h, sys/riscv/riscv sbi.c

riscv: add SBI implementation IDs.

Add new SBI implementation IDs including recently allocated one for bhyve.

Reviewed by:    mhorne
Sponsored by:   UKRI
Differential Revision:  https://reviews.freebsd.org/D45696
DeltaFile
+23-4sys/riscv/riscv/sbi.c
+6-0sys/riscv/include/sbi.h
+29-42 files

FreeBSD/src 8521ea1lib/libcompiler_rt Makefile.inc

Revert "WIP: Switch to compiler-rt sync on armv7"

This reverts commit 940cf92c07867bcfb1cd5648cffc5df25fd0b92a.

This wasn't ready to be committed
DeltaFile
+0-7lib/libcompiler_rt/Makefile.inc
+0-71 files

FreeBSD/src 36e0db4sys/arm/include acle-compat.h

Revert "arm: Start to remove the now unneeded acle-compat.h"

This reverts commit 3d02fe6c59dc87b265f268233cd574f7f04edb5d.

This wasn't ready to be committed
DeltaFile
+155-3sys/arm/include/acle-compat.h
+155-31 files

FreeBSD/src 940cf92lib/libcompiler_rt Makefile.inc

WIP: Switch to compiler-rt sync on armv7
DeltaFile
+7-0lib/libcompiler_rt/Makefile.inc
+7-01 files

FreeBSD/src 0cdd003sys/arm64/vmm vmm_arm64.c

arm64/vmm: Fix the SPAN check

When raising an exception we may need to set the SPSR_EL1.PAN field.
The check for this was incorrect meaning it would be set when it
shouldn't be.

Reviewed by:    markj
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D45717
DeltaFile
+1-1sys/arm64/vmm/vmm_arm64.c
+1-11 files

FreeBSD/src c36fa8dsys/dev/hwpmc hwpmc_arm64.c

hwpmc/arm64: Support the kernel booting to VHE

When booting to VHE we need to handle using the PMU at either EL1 or
EL2. WE already support EL1 so add support for EL2.

Reviewed by:    mhorne
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D45527
DeltaFile
+13-0sys/dev/hwpmc/hwpmc_arm64.c
+13-01 files

FreeBSD/src 3d02fe6sys/arm/include acle-compat.h

arm: Start to remove the now unneeded acle-compat.h

All supported compilers provide the acle macros so we don't need the
backup versions.

Sponsored by:   Arm Ltd
DeltaFile
+3-155sys/arm/include/acle-compat.h
+3-1551 files