]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agopf: switch kif counters to pf_counter_u64
Mateusz Guzik [Fri, 23 Jul 2021 10:29:46 +0000 (12:29 +0200)]
pf: switch kif counters to pf_counter_u64

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit d40d4b3ed788b05697541b9ae94b1960ff2cf6f6)

2 years agopf: switch pf_status.fcounters to pf_counter_u64
Mateusz Guzik [Sat, 24 Jul 2021 05:33:52 +0000 (07:33 +0200)]
pf: switch pf_status.fcounters to pf_counter_u64

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit fc4c42ce0b5ce87901b327e25f55b4e3ab4c6cf5)

2 years agopf: add hybrid 32- an 64- bit counters
Mateusz Guzik [Thu, 22 Jul 2021 20:47:24 +0000 (22:47 +0200)]
pf: add hybrid 32- an 64- bit counters

Numerous counters got migrated from straight uint64_t to the counter(9)
API. Unfortunately the implementation comes with a significiant
performance hit on some platforms and cannot be easily fixed.

Work around the problem by implementing a pf-specific variant.

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit defdcdd5648dc1ea789bc54bb45108fcab546a6b)

2 years agopf: drop redundant 'else' in pf_normalize_*
Mateusz Guzik [Sat, 24 Jul 2021 05:17:27 +0000 (07:17 +0200)]
pf: drop redundant 'else' in pf_normalize_*

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 6f1fb6561236fa933835a9a67bd442053fb509e9)

2 years agopf: consistently malloc rules with M_ZERO
Mateusz Guzik [Fri, 23 Jul 2021 15:01:29 +0000 (17:01 +0200)]
pf: consistently malloc rules with M_ZERO

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 49a7d47235434a300cc57b205e493988fdebf79c)

2 years agopf: hide struct pf_kstatus behind ifdef _KERNEL
Mateusz Guzik [Fri, 23 Jul 2021 17:34:43 +0000 (17:34 +0000)]
pf: hide struct pf_kstatus behind ifdef _KERNEL

Reviewed by:    kp
Sponsored by:   Rubicon Communications, LLC ("Netgate")

(cherry picked from commit d9cc6ea270ea52e860e3cc730876ee4324081586)

2 years agoudp: Fix soroverflow SOCKBUF unlocking
Konstantin Kukushkin [Sun, 1 Aug 2021 14:41:38 +0000 (07:41 -0700)]
udp: Fix soroverflow SOCKBUF unlocking

We hold the SOCKBUF_LOCK so use soroverflow_locked here.
This bug may manifest as a non-killable process stuck in [*so_rcv].

Approved by: scottl
Reviewed by: Roy Marples <roy@marples.name>
Fixes: 7045b1603bdf
MFC after:  10 days
Differential Revision: https://reviews.freebsd.org/D31374

(cherry picked from commit a61c24ddb7d677337d6184ffcee34a6e902d72d7)

2 years agosocket: Implement SO_RERROR
Roy Marples [Wed, 28 Jul 2021 15:46:59 +0000 (08:46 -0700)]
socket: Implement SO_RERROR

SO_RERROR indicates that receive buffer overflows should be handled as
errors. Historically receive buffer overflows have been ignored and
programs could not tell if they missed messages or messages had been
truncated because of overflows. Since programs historically do not
expect to get receive overflow errors, this behavior is not the
default.

This is really really important for programs that use route(4) to keep
in sync with the system. If we loose a message then we need to reload
the full system state, otherwise the behaviour from that point is
undefined and can lead to chasing bogus bug reports.

Reviewed by: philip (network), kbowling (transport), gbe (manpages)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26652

(cherry picked from commit 7045b1603bdf054145dd958a4acc17b410fb62a0)

2 years agopf: Validate user string nul-termination before copying
Mark Johnston [Wed, 28 Jul 2021 14:16:42 +0000 (10:16 -0400)]
pf: Validate user string nul-termination before copying

Some pf ioctl handlers use strlcpy() to copy strings when converting
from user structures to their in-kernel representations.  strlcpy()
ensures that the destination will be nul-terminated, but it assumes that
the source is nul-terminated.  In particular, it returns the full length
of the source string, so if the source is not nul-terminated, strlcpy()
will keep scanning until it finds a nul byte, and it may encounter an
unmapped page first.  Add a helper to validate user strings before
copying.

There are also places where we look up a ruleset using a user-provided
anchor string.  In some ioctl handlers we were already nul-terminating
the string, avoiding the same problem, but in other places we were not.
Fix those by nul-terminating as well.  Aside from being consistent,
anchors have a maximum length of MAXPATHLEN - 1 so calling strnlen()
might not be so desirable.

Reported by: syzbot+35a1549b4663e9483dd1@syzkaller.appspotmail.com
Reviewed by: kp
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 64432ad2a2c4b10d3d3411a8ca018e2a35cec97e)

2 years agopf: Initialize arrays before copying out to userland
Mark Johnston [Wed, 28 Jul 2021 14:16:25 +0000 (10:16 -0400)]
pf: Initialize arrays before copying out to userland

A number of pf ioctls populate an array of structures and copy it out.
They have the following structures:
- caller specifies the size of its output buffer
- ioctl handler allocates a kernel buffer of the same size
- ioctl handler populates the buffer, possibly leaving some items
  initialized if the caller provided more space than needed
- ioctl handler copies the entire buffer out to userland

Thus, if more space was provided than is required, we end up copying out
uninitialized kernel memory.  Simply zero the buffer at allocation time
to prevent this.

Reported by: KMSAN
Reviewed by: kp
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 2b82c57e399700f5134c47d86d45ef2f2bd465e2)

2 years agoDo not expose to scheduler caches of single CPU.
Alexander Motin [Wed, 28 Jul 2021 20:15:43 +0000 (16:15 -0400)]
Do not expose to scheduler caches of single CPU.

Before this change my dual-Xeon(R) Gold 6242R always reported 3 levels
or topology (root, package/L3 and core/L2).  But with SMT disabled
core/L2 matches thread, so additional topology level only causes more
traversal work.  With this change SMT case is reported same as before,
while non-SMT is reported with only 2 much more simple levels.

MFC after: 2 weeks

(cherry picked from commit 5a49f1914178c5275105f2ab0d23a98118cd585f)

2 years agopf: bound DIOCGETSTATES memory use
Kristof Provost [Mon, 2 Aug 2021 07:46:33 +0000 (09:46 +0200)]
pf: bound DIOCGETSTATES memory use

Similar to what we did earlier for DIOCGETSTATESV2 we only allocate
enough memory for a handful of states and copy those out, bit by bit,
rather than allocating memory for all states in one go.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 600745f1e2260e7ed3c2e6183b24388ff38c916c)

2 years agoloader: tftp client should use server address from rootip
Toomas Soome [Mon, 2 Aug 2021 12:27:38 +0000 (15:27 +0300)]
loader: tftp client should use server address from rootip

servip is set from bootp bp_siaddr (if present) and rootip is
set immediately from servip in tha sane bootp code.

However, the common/dev_net.c does only set rootip (based on
url processing etc). Therefore, we should also use rootip in tftp
reader.

Fixes hung tftp based boot when bp_siaddr is not provided.

MFC after: 1 week

(cherry-picked from commit 1b1bb6f178802a4522824e0268634a99cdbda098)

2 years agoloader: cstyle cleanup of libsa/lseek.c
Toomas Soome [Sun, 1 Aug 2021 07:07:32 +0000 (10:07 +0300)]
loader: cstyle cleanup of libsa/lseek.c

Clean up lseek.c, no functional changes intended. This is pre-patch
for open file list rewrite.

MFC after: 1 week

(cherry-picked from commit bbb539b83ceced2d355893ead5987193737833fd)

2 years agopf tests: test locally originated connections with route-to
Kristof Provost [Wed, 14 Jul 2021 10:33:37 +0000 (12:33 +0200)]
pf tests: test locally originated connections with route-to

PR: 257106
Submitted by: Mark Cammidge <mark@peralex.com>
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D31178

(cherry picked from commit f808bb9b7e5ee2243e5a2aaad2275a78cdbe981b)

2 years agopf: locally originating connections with 'route-to' fail
Kristof Provost [Wed, 14 Jul 2021 10:17:03 +0000 (12:17 +0200)]
pf: locally originating connections with 'route-to' fail

Similar to the REPLY_TO shortcut (6d786845cf) we also can't shortcut
ROUTE_TO. If we do we will fail to apply transformations or update the
state, which can lead to premature termination of the connections.

PR: 257106
MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31177

(cherry picked from commit 2c0d115bbc8f8ee3f011a5c4a69bcbf58c4b721f)

2 years agoUPDATING: Document the removal of DIOCGETSTATESNV
Kristof Provost [Wed, 14 Jul 2021 13:51:36 +0000 (15:51 +0200)]
UPDATING: Document the removal of DIOCGETSTATESNV

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 3412900333e659124f61ada6389ef40dd0f3ddd4)

2 years agopf: remove DIOCGETSTATESNV
Kristof Provost [Tue, 6 Jul 2021 11:13:24 +0000 (13:13 +0200)]
pf: remove DIOCGETSTATESNV

While nvlists are very useful in maximising flexibility for future
extensions their performance is simply unacceptably bad for the
getstates feature, where we can easily want to export a million states
or more.

The DIOCGETSTATESNV call has been MFCd, but has not hit a release on any
branch, so we can still remove it everywhere.

Reviewed by: mjg
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31099

(cherry picked from commit b69019c14cd89a5e699bc6e69941aec5b1041b1e)

2 years agoHide arm64 features that don't have a HWCAP
Andrew Turner [Thu, 15 Jul 2021 23:22:07 +0000 (23:22 +0000)]
Hide arm64 features that don't have a HWCAP

We should only export MSR fields if there is also a HWCAP so it doesn't
matter which software uses.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit ae47eecf87b5d8a054bd5d640da12608cc5f126a)

2 years agoAdd virtio_scsi to the arm64 GENERIC config
Andrew Turner [Wed, 14 Jul 2021 20:13:10 +0000 (20:13 +0000)]
Add virtio_scsi to the arm64 GENERIC config

This is needed to boot on the Oracle Cloud VM.Standard.A1.Flex instance

Sponsored by: The FreeBSD Foundation

(cherry picked from commit b644d64e8a4641a6e4c53b3f4be51e08cb17f6cc)

2 years agoAdd virtio comments to the arm64 GENERIC config
Andrew Turner [Wed, 14 Jul 2021 20:08:29 +0000 (20:08 +0000)]
Add virtio comments to the arm64 GENERIC config

Most of these are from the amd64 GENERIC config.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit ab9f9cfda5a77ff511d56cf183f081cb72ada79d)

2 years agoRemove the newline from arm64 trap panics
Andrew Turner [Wed, 14 Jul 2021 19:49:58 +0000 (19:49 +0000)]
Remove the newline from arm64 trap panics

The panic function will already print a newline so there is no need to
add it here.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 2665851086795c61e799fbe57bfb37cabab3cf8c)

2 years agoUpdate the SCTLR_EL1 register definitions
Andrew Turner [Thu, 8 Jul 2021 12:14:56 +0000 (12:14 +0000)]
Update the SCTLR_EL1 register definitions

They are valid as of the ARMv8.7 XML.

While here remove SCTLR_RES0 as it's unused and depends on which CPU
the kernel is running on and switch to shifted values as they are
easier to compare with the documentation.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31120

(cherry picked from commit 5484e6d9cc5801e02cba1bf4b9a03ff2e75fa587)

2 years agoUpdate the arm64 HCR_EL2 registers
Andrew Turner [Wed, 7 Jul 2021 11:51:40 +0000 (11:51 +0000)]
Update the arm64 HCR_EL2 registers

They are valid as of the ARMv8.7 XML.

While here switch to use shifted values as they are easier to compare
with values in the Arm Reference Manual.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31093

(cherry picked from commit 3c1bfadaf93da6ec0291a7dc7dc7690ef6611619)

2 years agoSupport fixed size, variable location acpi resources
Andrew Turner [Thu, 8 Jul 2021 15:25:38 +0000 (15:25 +0000)]
Support fixed size, variable location acpi resources

These have been found in some Arm ACPI tables generated by edk2, e.g.
when describing the pl011 uart on the Arm AEMv8 model.

Reviewed by: imp, jkim
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31110

(cherry picked from commit 1472117a1e1c40f10b9c3a48788fbf8355588ee8)

2 years agoFix the name of the arm64 SCTLR_E0E register
Andrew Turner [Wed, 7 Jul 2021 23:12:50 +0000 (23:12 +0000)]
Fix the name of the arm64 SCTLR_E0E register

The character between the E's was the letter O, however in the Arm
Documentation and XML the character is the number 0 (zero).

Sponsored by: The FreeBSD Foundation

(cherry picked from commit c0edde3021900b80fec4e6360d97ba9d9e50d4fd)

2 years agoSync the arm64 special registers with the Armv8.5 XML
Andrew Turner [Thu, 1 Jul 2021 01:14:09 +0000 (01:14 +0000)]
Sync the arm64 special registers with the Armv8.5 XML

Add the missing macros and decode all the fields as described in the
Arm Architecture System Registers XML corresponding to Armv8.5.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30983

(cherry picked from commit a7b05eb16c9d84e1fd59864f5da67d23897ed91c)

2 years agoSwitch the order of the ID_AA64PFR1_EL1 fields
Andrew Turner [Thu, 1 Jul 2021 00:45:39 +0000 (00:45 +0000)]
Switch the order of the ID_AA64PFR1_EL1 fields

This makes them consistent with the fields in other registers.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 244002b48257a8e4d3b4772872981c0d7a467923)

2 years agoAdd more GIC and GICv3 registers
Andrew Turner [Mon, 14 Jun 2021 12:48:53 +0000 (12:48 +0000)]
Add more GIC and GICv3 registers

These aren't used by either driver, however they will be needed by
bhyve on arm64 to emulate a GICv3 interrupt controller.

Sponsored by: Innovate UK

(cherry picked from commit 15fa52a56494d050c4b8e1535d98e2fd416f1944)

2 years agoUse the correct length when copying arm64 vfp registers
Andrew Turner [Mon, 14 Jun 2021 11:01:46 +0000 (11:01 +0000)]
Use the correct length when copying arm64 vfp registers

We passed the wrong length into memcpy in the arm64 get_fpcontext and
set_fpcontext. This caused us to copy two status registers we didn't
expect to copy.

These are safe as they exist in both the source and destination, although
in a different order, and we copy the correct values after the memcpy.

Obtained from: CheriBSD
Sponsored by: Innovate UK

(cherry picked from commit e7f369b1c18ca0377bb0b016b4cab3f0de2a74c5)

2 years agoUse the arm virtual counter in the arm64 loader
Andrew Turner [Wed, 12 May 2021 07:45:09 +0000 (07:45 +0000)]
Use the arm virtual counter in the arm64 loader

It exist on all ARMv8+ CPUs, and other boot loaders rely on it being
present.

Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D30410

(cherry picked from commit 0a0d6ce34d6be89cb356c7815648e455fabe3151)

2 years agovirtio: enable VTNET_LEGACY_TX when ALTQ is enabled.
Luiz Otavio O Souza [Thu, 26 Oct 2017 02:30:54 +0000 (21:30 -0500)]
virtio: enable VTNET_LEGACY_TX when ALTQ is enabled.

ALTQ only works on network drivers which use if_start (rather than
if_transmit). vtnet uses if_start if built with VTNET_LEGACY_TX. Default
to that the kernel is built with ALTQ enabled, to reduce user surprise.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 5afe81a7b23afd27289ca40e04a6a764134d6273)

2 years agolibc/locale: Use O_CLOEXEC when opening locale tables
Mark Johnston [Thu, 29 Jul 2021 13:14:50 +0000 (09:14 -0400)]
libc/locale: Use O_CLOEXEC when opening locale tables

Reviewed by: kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 98bfb9dac28585fb5629c5fc951ce0d83490d446)

2 years agoAdd missing bsd.linker.mk include after 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3
Alex Richardson [Mon, 2 Aug 2021 15:38:39 +0000 (16:38 +0100)]
Add missing bsd.linker.mk include after 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3

This is needed for -DWITH_CLEAN builds since the cleandir phase does not
include bsd.linker.mk from bsd.compiler.mk

(cherry picked from commit 9f1db6c5557bd01734ee63afacaf07a37fb3cc60)

2 years agoAllow bootstrapping llvm-tblgen on macOS and Linux
Alex Richardson [Mon, 2 Aug 2021 13:36:03 +0000 (14:36 +0100)]
Allow bootstrapping llvm-tblgen on macOS and Linux

This is needed in order to build various LLVM binutils (e.g. addr2line)
as well as clang/lld/lldb.

Co-authored-by: Jessica Clarke <jrtc27@FreeBSD.org>
Test Plan: Compiles on ubuntu 18.04 and macOS 11.4
Reviewed By: dim
Differential Revision: https://reviews.freebsd.org/D31057

(cherry picked from commit 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3)

2 years agoRemove mkcsmapper_static and mkesdb_static from build-tools
Alex Richardson [Mon, 2 Aug 2021 09:49:01 +0000 (10:49 +0100)]
Remove mkcsmapper_static and mkesdb_static from build-tools

Build them as part of the bootstrap-tools phase instead.

Reviewed by: emaste (no objections)
Differential Revision: https://reviews.freebsd.org/D28181

(cherry picked from commit 2de949cf85d0e0b9ff71e1ffd74153814de96175)

2 years agotools/build: Don't redefine open() for the linux bootstrap
Alex Richardson [Mon, 2 Aug 2021 08:45:05 +0000 (09:45 +0100)]
tools/build: Don't redefine open() for the linux bootstrap

This is needed to bootstrap llvm-tblgen on Linux since LLVM calls
`::open(...)` which does not work if open is a statement macro.
Also stop defining O_SHLOCK/O_EXLOCK and update the only bootstrap tools
user of those flags to deal with missing definitions.

Reviewed By: jrtc27
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31226

(cherry picked from commit 5f6c8ce2452da2da233e37bf4c2b6fccde8594b1)

2 years agobsd.linker.mk: Detect LLD when built with PACKAGE_VENDOR
Alex Richardson [Tue, 20 Jul 2021 15:04:56 +0000 (16:04 +0100)]
bsd.linker.mk: Detect LLD when built with PACKAGE_VENDOR

Recent versions of homebrew's LLD are built with PACKAGE_VENDOR (since
https://github.com/Homebrew/homebrew-core/commit/e7c972b6062af753e564104e58d1fa20c0d1ad7a).
This means that the -v output is now
`Homebrew LLD 12.0.1 (compatible with GNU linkers)` and bsd.linker.mk no
longer detects it as LLD since it only checks whether the first word is
LLD. This change allow me to build on macOS again and should unbreak the
GitHub actions CI.

Reviewed By: imp, uqs
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D31224

(cherry picked from commit f8147dad44f1036160a413bb00b4e8b41f7a4a84)

2 years agoDon't build lldb-tablegen if MK_LLDB=no
Alex Richardson [Mon, 5 Jul 2021 17:36:02 +0000 (18:36 +0100)]
Don't build lldb-tablegen if MK_LLDB=no

Split out from D31060.

Reviewed by: emaste

(cherry picked from commit c5d1d88a351abe869c436f4f70c85d4c29e6e98c)

2 years agoAllow building usr.bin/vi with MK_ASAN
Alex Richardson [Mon, 19 Jul 2021 14:04:19 +0000 (15:04 +0100)]
Allow building usr.bin/vi with MK_ASAN

We have to namespace the regex functions to avoid duplicate symbol errors.
This also ensures that vi doesn't define the libc reg* functions with
mismatched signatures.

ld: error: duplicate symbol: regcomp
>>> defined at sanitizer_common_interceptors.inc:7519 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7519)
>>>            asan_interceptors.o:(__interceptor_regcomp) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a
>>> defined at regcomp.c
>>>            .../regex/regcomp.c.o:(.text+0x0)

ld: error: duplicate symbol: regerror
>>> defined at sanitizer_common_interceptors.inc:7543 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7543)
>>>            asan_interceptors.o:(__interceptor_regerror) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a
>>> defined at regerror.c
>>>            .../regex/regerror.c.o:(.text+0x0)

ld: error: duplicate symbol: regexec
>>> defined at sanitizer_common_interceptors.inc:7530 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7530)
>>>            asan_interceptors.o:(__interceptor_regexec) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a
>>> defined at regexec.c
>>>            .../regex/regexec.c.o:(.text+0x0)

ld: error: duplicate symbol: regfree
>>> defined at sanitizer_common_interceptors.inc:7553 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7553)
>>>            asan_interceptors.o:(__interceptor_regfree) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a
>>> defined at regfree.c
>>>            .../regex/regfree.c.o:(.text+0x0)

Committed upstream as https://github.com/lichray/nvi2/pull/92

Reviewed By: bapt
Differential Revision: https://reviews.freebsd.org/D31050

(cherry picked from commit 8ef98a8045d4623edd75b91ce76eedeaa4ad3f01)

2 years agobin/ps: Avoid function name conflict with libc uname()
Alex Richardson [Mon, 19 Jul 2021 14:03:38 +0000 (15:03 +0100)]
bin/ps: Avoid function name conflict with libc uname()

This prevents ps from being built with address sanitizer instrumentation.

Reviewed By: trasz
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31048

(cherry picked from commit 2423585b1de50dd2daea8478318e94ff80e0e6ec)

2 years agoFix building rescue/rescue when sanitizers are enabled
Alex Richardson [Tue, 6 Jul 2021 11:18:29 +0000 (12:18 +0100)]
Fix building rescue/rescue when sanitizers are enabled

We have to ensure that we don't link any instrumented object files
into rescue as it is a static executable and static binaries can't
use the sanitizer runtime.

Reviewed By: imp
Differential Revision: https://reviews.freebsd.org/D31044

(cherry picked from commit 2eefc1d926430dbba83128d27f8bed3c34199159)

2 years agousr.bin/diff: fix UBSan error in readhash
Alex Richardson [Tue, 6 Jul 2021 11:16:40 +0000 (12:16 +0100)]
usr.bin/diff: fix UBSan error in readhash

UBSan complains about the `sum = sum * 127 + chrtran(t);` line below since
that can overflow an `int`. Use `unsigned int` instead to ensure that
overflow is well-defined.

Reviewed By: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31075

(cherry picked from commit c78f449d85e0b292fe5d942cca99f11c1cd430fa)

2 years agousr.bin/login: send errors to console if syslog isn't running
Alex Richardson [Tue, 6 Jul 2021 09:50:05 +0000 (10:50 +0100)]
usr.bin/login: send errors to console if syslog isn't running

I was debugging why login(1) wasn't working as expected on a minimal
MFS_ROOT disk image. This image doesn't have syslogd running so the
warnings were lost and I had to use GDB to find out why login(1) was
failing (missing PAM libraries) instead of being able to see it in
the console output.

MFC after: 1 week
Reviewed By: pfg
Differential Revision: https://reviews.freebsd.org/D30892

(cherry picked from commit 4d552825ecebecd6c95a995c0b314b09936121b5)

2 years agousr.bin/sort: Avoid UBSan errors
Alex Richardson [Mon, 5 Jul 2021 13:32:48 +0000 (14:32 +0100)]
usr.bin/sort: Avoid UBSan errors

UBSan complains about out-of-bounds accesses for zero-length arrays. To
avoid this we can use flexible array members. However, the C standard does
not allow for structures that only contain flexible array members, so we
move the length parameters into that structure too.

Split out from D28233.

Reviewed By: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31009

(cherry picked from commit d053fb22f6d3b6bb0f4e47e4507fefc20cbe0e32)

2 years agoSimplify and speed up the kyua build
Alex Richardson [Fri, 2 Jul 2021 08:21:04 +0000 (09:21 +0100)]
Simplify and speed up the kyua build

Instead of having multiple kyua libraries, just include the files as part
of usr.bin/kyua. Previously, we would build each kyua source up to four
times: once as a .o file and once as a .pieo. Additionally, the kyua
libraries might be built again for compat32. As all the kyua libraries
amount to 102 C++ sources the build time is significant (especially when
using an assertions enabled compiler). This change ensures that we build
306 fewer .cpp source files as part of buildworld.

Reviewed By: brooks
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30967

Remove lib/kyua from the build

I forgot to include this line in 2eb9ad427475190e87d026de4ca7fc296947f2a0.

Reported by: Jenkins CI
MFC after: 1 week
Fixes: 2eb9ad427475190ei ("Simplify and speed up the kyua build")

Revert "Remove lib/kyua from the build"

Accidentally removed it from the wrong file...

This reverts commit 8ec4ba8a76aaf256942ac5996d45cc29022641ae.

Remove lib/kyua from the build

I forgot to include this line in 2eb9ad427475190e87d026de4ca7fc296947f2a0.

Reported by:    Jenkins CI
MFC after:      1 week
Fixes: 2eb9ad427475190ei ("Simplify and speed up the kyua build")
(cherry picked from commit 2eb9ad427475190e87d026de4ca7fc296947f2a0)
(cherry picked from commit 8ec4ba8a76aaf256942ac5996d45cc29022641ae)
(cherry picked from commit 89da04fcaa33f100a60d06770f7424e5b7f1312f)
(cherry picked from commit c951566915886330612bee880d6ece0d65bf9f5d)

2 years agox86 __vdso_gettc: add O_CLOEXEC flag to open
Konstantin Belousov [Thu, 29 Jul 2021 01:26:38 +0000 (04:26 +0300)]
x86 __vdso_gettc: add O_CLOEXEC flag to open

(cherry picked from commit cbf6f55e77a9176572830a20804cf1d005dfea73)

2 years agovmci(4): Shorten interrupt descriptions.
Alexander Motin [Thu, 22 Jul 2021 16:58:10 +0000 (12:58 -0400)]
vmci(4): Shorten interrupt descriptions.

We have no space there for such a long strings.  Also it makes no
sense to set description if there is only one interrupt.

MFC after: 2 weeks

(cherry picked from commit ab38c12b4a488c011ea85252621430ded6e87139)

2 years agonfscl: Send stateid.seqid of 0 for NFSv4.1/4.2 mounts
Rick Macklem [Tue, 20 Jul 2021 00:35:39 +0000 (17:35 -0700)]
nfscl: Send stateid.seqid of 0 for NFSv4.1/4.2 mounts

For NFSv4.1/4.2, the client may set the "seqid" field of the
stateid to 0 in RPC requests.  This indicates to the server that
it should not check the "seqid" or return NFSERR_OLDSTATEID if the
"seqid" value is not up to date w.r.t. Open/Lock operations
on the stateid.  This "seqid" is incremented by the NFSv4 server
for each Open/OpenDowngrade/Lock/Locku operation done on the stateid.

Since a failure return of NFSERR_OLDSTATEID is of no use to
the client for I/O operations, it makes sense to set "seqid"
to 0 for the stateid argument for I/O operations.
This avoids server failure replies of NFSERR_OLDSTATEID,
although I am not aware of any case where this failure occurs.

This makes the FreeBSD NFSv4.1/4.2 client compatible with the
Linux NFSv4.1/4.2 client.

(cherry picked from commit 7685f8344d9a59e9498bdfebb48066f98216fecd)

2 years agosrc.conf.5: regen after 3f244aace29b
Ed Maste [Wed, 4 Aug 2021 17:24:02 +0000 (13:24 -0400)]
src.conf.5: regen after 3f244aace29b

2 years agoUpdate WITHOUT_KERNEL_SYMBOLS description
Ed Maste [Tue, 27 Jul 2021 21:18:41 +0000 (17:18 -0400)]
Update WITHOUT_KERNEL_SYMBOLS description

We have installed kernel debug data under /usr/lib/debug/ for some time
now, so the suggestion to set WITHOUT_KERNEL_SYMBOLS for small root
partitions is no longer valid.

Also call them "debug symbol files" rather than just "symbol files",
since they contain much more than just symbols.  The kernel also
includes (some) symbols, regardless of the setting of this knob.

MFC after: 1 week

(cherry picked from commit 5f946c76c0cc2d1b4fa150f691764da163579d19)

2 years agoCorrect section reference for examples in RFC3542
Tom Jones [Sun, 1 Aug 2021 12:52:07 +0000 (13:52 +0100)]
Correct section reference for examples in RFC3542

Reviewed by: bz, network
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26272

(cherry picked from commit 44752e92e134167e9a0ecd277e32608a5595e6d1)

2 years agoRevert "arm: remove fslsdma from GENERIC"
Warner Losh [Wed, 4 Aug 2021 02:09:18 +0000 (20:09 -0600)]
Revert "arm: remove fslsdma from GENERIC"

The firmware was already in the tree when I did this commit, and I
missed the message. The bug was obsolete.

This reverts commit 9e3761d126c5c019d6c935e83989928eb1a0e76e.

The commit was f219c053852d82acb9852cd735c815ba315f416d in stable/13.

PR: 237466
Sponsored by: Netflix

(cherry picked from commit e94f1a0a37fdd3252201aaa5a94f46da7f8e740e)

2 years agoRELNOTES: Add entries for commits 9fb6e613373c and 9ec7dbf46b0a
Rick Macklem [Wed, 4 Aug 2021 00:24:23 +0000 (17:24 -0700)]
RELNOTES: Add entries for commits 9fb6e613373c and 9ec7dbf46b0a

This is a direct commit.

2 years agoUPDATING: Add an entry for commits 9fb6e613373c and 9ec7dbf46b0a
Rick Macklem [Wed, 4 Aug 2021 00:12:22 +0000 (17:12 -0700)]
UPDATING: Add an entry for commits 9fb6e613373c and 9ec7dbf46b0a

This is a direct commit.

2 years agoparam.h: Bump __FreeBSD_version to 1300514
Rick Macklem [Wed, 4 Aug 2021 00:06:59 +0000 (17:06 -0700)]
param.h: Bump __FreeBSD_version to 1300514

Commits 9fb6e613373c and 9ec7dbf46b0a both changed the internal
KAPI between the NFS modules.  Bump __FreeBSD_version to 1300514
so that all modules are rebuilt from sources.

This is a direct commit.

2 years agonfsd: Add sysctl to set maximum I/O size up to 1Mbyte
Rick Macklem [Fri, 16 Jul 2021 22:01:03 +0000 (15:01 -0700)]
nfsd: Add sysctl to set maximum I/O size up to 1Mbyte

Since MAXPHYS now allows the FreeBSD NFS client
to do 1Mbyte I/O operations, add a sysctl called vfs.nfsd.srvmaxio
so that the maximum NFS server I/O size can be set up to 1Mbyte.
The Linux NFS client can also do 1Mbyte I/O operations.

The default of 128Kbytes for the maximum I/O size has
not been changed for two reasons:
- kern.ipc.maxsockbuf must be increased to support 1Mbyte I/O
- The limited benchmarking I can do actually shows a drop in I/O rate
  when the I/O size is above 256Kbytes.
However, daveb@spectralogic.com reports seeing an increase
in I/O rate for the 1Mbyte I/O size vs 128Kbytes using a Linux client.

(cherry picked from commit ee29e6f31111ea3cd490248987f2f2ec412eb0bb)

2 years agomount_nfs.8: Add information for "nconnect" to man page
Rick Macklem [Sun, 11 Jul 2021 20:34:16 +0000 (13:34 -0700)]
mount_nfs.8: Add information for "nconnect" to man page

Commit 1e0a518d6548 added a new NFS mount option "nconnect".
This patch adds information on this option to the man page.

It also adds an IMPLEMENTATION section that explains how
the default I/O size is determined and that "nfsstat -m" can
be used to find out what option settings are actually in use.

This is a content change.

(cherry picked from commit 4488c8c34ba38146aab52fd60211bb32cdc87267)

2 years agoloader.conf(5): mention "efi" option for "console" parameter
Li-Wen Hsu [Sat, 31 Jul 2021 22:41:49 +0000 (06:41 +0800)]
loader.conf(5): mention "efi" option for "console" parameter

PR: 213467
Reviewed by: imp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D31368

(cherry picked from commit de0c7fbe280a1e0946afb111cf7a9811364c4bd6)

2 years agonfscl: Add a Linux compatible "nconnect" mount option
Rick Macklem [Fri, 9 Jul 2021 00:39:04 +0000 (17:39 -0700)]
nfscl: Add a Linux compatible "nconnect" mount option

Linux has had an "nconnect" NFS mount option for some time.
It specifies that N (up to 16) TCP connections are to created for a mount,
instead of just one TCP connection.

A discussion on freebsd-net@ indicated that this could improve
client<-->server network bandwidth, if either the client or server
have one of the following:
- multiple network ports aggregated to-gether with lagg/lacp.
- a fast NIC that is using multiple queues
It does result in using more IP port#s and might increase server
peak load for a client.

One difference from the Linux implementation is that this implementation
uses the first TCP connection for all RPCs composed of small messages
and uses the additional TCP connections for RPCs that normally have
large messages (Read/Readdir/Write).  The Linux implementation spreads
all RPCs across all TCP connections in a round robin fashion, whereas
this implementation spreads Read/Readdir/Write across the additional
TCP connections in a round robin fashion.

(cherry picked from commit 1e0a518d65488caafff89a4ecba9cfb2be233379)

2 years agoarm: Bump KSTACK_PAGES default to match i386/amd64
Kevin Bowling [Wed, 21 Jul 2021 01:35:54 +0000 (18:35 -0700)]
arm: Bump KSTACK_PAGES default to match i386/amd64

See 3f6867ef6386 for additional context.

It is also needed for OpenZFS performance and stability.

Reviewed by: ian (arm), imp
Differential Revision: https://reviews.freebsd.org/D31244

(cherry picked from commit b684d812fcb04b2997fd755405a92c36b9f6e30e)

2 years agolinuxkpi: remove global atomic counter of the task allocations
Konstantin Belousov [Thu, 20 May 2021 15:28:20 +0000 (18:28 +0300)]
linuxkpi: remove global atomic counter of the task allocations

(cherry picked from commit d96f55bc7159e8d018847abe5b1782d74c8aa415)

2 years agoWait for all task_struct allocations to be returned before freeing the UMA zone in...
Hans Petter Selasky [Fri, 21 May 2021 11:17:42 +0000 (13:17 +0200)]
Wait for all task_struct allocations to be returned before freeing the UMA zone in the LinuxKPI

(cherry picked from commit b764a426534f2f5f86d6625288c74dafdbc94d2b)

2 years agoamd64: add pmap_alloc_page_below_4g()
Konstantin Belousov [Tue, 13 Jul 2021 15:00:54 +0000 (18:00 +0300)]
amd64: add pmap_alloc_page_below_4g()

(cherry picked from commit c8bae074d9e1d766bcbc2e631ce0c2e9d248881c)

2 years agoamd64 pti init: fix calculation of the kernel text start
Konstantin Belousov [Sat, 10 Jul 2021 19:51:16 +0000 (22:51 +0300)]
amd64 pti init: fix calculation of the kernel text start

(cherry picked from commit 34516d4ad19b83e5dfe6ec8c1db232c422d7ecff)

2 years agoamd64: do not touch low memory in AP startup unless we used legacy boot
Konstantin Belousov [Thu, 29 Jul 2021 13:18:19 +0000 (16:18 +0300)]
amd64: do not touch low memory in AP startup unless we used legacy boot

(cherry picked from commit 2572376f7f6412bc69bd6138e9ac9a6efd7642af)

2 years agoamd64: do not touch low memory in AP startup unless we used legacy boot
Konstantin Belousov [Thu, 22 Jul 2021 16:27:21 +0000 (19:27 +0300)]
amd64: do not touch low memory in AP startup unless we used legacy boot

(cherry picked from commit 48216088b1157a22b95540efea58f70057cd5c06)

2 years agoamd64: make efi_boot global
Konstantin Belousov [Thu, 22 Jul 2021 16:22:21 +0000 (19:22 +0300)]
amd64: make efi_boot global

(cherry picked from commit 6a3821369f43bb1e8a672cbbfd7732406d9f9a4c)

2 years ago/dev/pci: clarify meaning of writeable file descriptor
Konstantin Belousov [Tue, 27 Jul 2021 00:22:14 +0000 (03:22 +0300)]
/dev/pci: clarify meaning of writeable file descriptor

(cherry picked from commit 85ae35ef37c07c32d4e923435b637cbf0df3e8a3)

2 years agoRegen
Konstantin Belousov [Wed, 28 Jul 2021 10:56:19 +0000 (13:56 +0300)]
Regen

2 years agoRevert most of ce42e793100b460f597e4c85ec0da12e274f9394
Konstantin Belousov [Mon, 19 Jul 2021 15:40:38 +0000 (18:40 +0300)]
Revert most of ce42e793100b460f597e4c85ec0da12e274f9394

to restore ABI compatibility for pre-10.x binaries.

It restores _umtx_lock() and _umtx_unlock() syscalls, and UMTX_OP_LOCK/
UMTX_OP_UNLOCK umtx_op(2) operations. UMUTEX_ERROR_CHECK flag is left
out for now, I do not think it makes a difference.

PR: 218571
Reviewed by: brooks (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31220

(cherry picked from commit 9b6b793bd79521edc082a89b264a30881cb65e22)

2 years agonullfs: provide custom null_rename bypass
Konstantin Belousov [Sat, 24 Jul 2021 15:05:58 +0000 (18:05 +0300)]
nullfs: provide custom null_rename bypass

(cherry picked from commit 4eaf9609fe42878eccaaf5fe1873f792074a62e4)

2 years agonull_rename: some style
Konstantin Belousov [Sat, 24 Jul 2021 14:46:51 +0000 (17:46 +0300)]
null_rename: some style

(cherry picked from commit 26e72728ce12c8670894435fcef8055a0ecb6266)

2 years agofifofs: fifo vnode might be relocked before VOP_OPEN() is called
Konstantin Belousov [Thu, 22 Jul 2021 10:27:43 +0000 (13:27 +0300)]
fifofs: fifo vnode might be relocked before VOP_OPEN() is called

(cherry picked from commit 10db1896495b744aa5b039dd4ef1973b7a339379)

2 years agonull_lookup: restore dvp lock always, not only on success
Konstantin Belousov [Wed, 21 Jul 2021 13:19:51 +0000 (16:19 +0300)]
null_lookup: restore dvp lock always, not only on success

(cherry picked from commit 4f21442e10dbb22f1bd4c990dc0b1a2aa51231b9)

2 years agonull_bypass(): prevent loosing the only reference to the lower vnode
Konstantin Belousov [Tue, 20 Jul 2021 00:53:08 +0000 (03:53 +0300)]
null_bypass(): prevent loosing the only reference to the lower vnode

(cherry picked from commit d5b078163e0d6bb2fe36f8e49a44853908d5e2db)

2 years agonullfs: provide custom null_advlock bypass
Konstantin Belousov [Sat, 17 Jul 2021 22:56:47 +0000 (01:56 +0300)]
nullfs: provide custom null_advlock bypass

(cherry picked from commit 161e9a97363d17caf0b47983b28a37f3f59f9978)

2 years agonull_bypass(): some style
Konstantin Belousov [Tue, 20 Jul 2021 00:48:49 +0000 (03:48 +0300)]
null_bypass(): some style

(cherry picked from commit 7b7227c4a601d92a46cf625ca7ae245664a809fe)

2 years agoRemove opensolaris_atomic.S dependency.
Alexander Motin [Tue, 27 Jul 2021 23:50:52 +0000 (19:50 -0400)]
Remove opensolaris_atomic.S dependency.

This file is no longer there, so this broke static zfs build.

(cherry picked from commit e0229c5110d2a35e1cc464a596fff2498b836b1c)

2 years agoigb: clean up igb_txrx comments
Kevin Bowling [Sat, 31 Jul 2021 15:04:25 +0000 (08:04 -0700)]
igb: clean up igb_txrx comments

Reviewed by: grehan
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D31227

(cherry picked from commit ff01d6343f1f0c6550e4072eddda91dabd366d09)

2 years agoe1000: Add missing branch prediction
Kevin Bowling [Tue, 20 Jul 2021 07:21:21 +0000 (00:21 -0700)]
e1000: Add missing branch prediction

I missed this edit from the ixgbe review (D30074)

Reviewed by: gallatin
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30073

(cherry picked from commit 9fd0cda92d3346e1daa30eb48e185e2077ac0566)

2 years agoe1000: Clean up igb_txrx
Kevin Bowling [Tue, 20 Jul 2021 07:06:31 +0000 (00:06 -0700)]
e1000: Clean up igb_txrx

The intention here is to reduce differences between em, igb, igc, ixgbe.

The main functional change is logical simplification in igb_rx_checksum
and getting interface caps from scctx instead of the ifp.

Reviewed by: gallatin, markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30073

(cherry picked from commit 41f02257146d128cdd4aa2bdcfdab7f9e08a4314)

2 years agorip: Add missing minimum length validation in rip_output()
Mark Johnston [Mon, 26 Jul 2021 20:39:18 +0000 (16:39 -0400)]
rip: Add missing minimum length validation in rip_output()

If the socket is configured such that the sender is expected to supply
the IP header, then we need to verify that it actually did so.

Reported by: syzkaller+KMSAN
Reviewed by: donner
Sponsored by: The FreeBSD Foundation

(cherry picked from commit ba21825202737a8b7e90e1ef669c7fe7e7d50325)

2 years agolibvmmapi: Fix warnings and stop overridding WARNS
Mark Johnston [Mon, 26 Jul 2021 20:40:16 +0000 (16:40 -0400)]
libvmmapi: Fix warnings and stop overridding WARNS

- Avoid shadowing the global optarg.
- Sprinkle __unused.
- Cast nitems() to int.
- Fix sign in vm_copy_setup().

Reviewed by: grehan
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 45cd18ec73dcd262612898bf1a263cacde17d348)

2 years agomrsas(4): Report more correct maximum I/O size.
Alexander Motin [Thu, 1 Jul 2021 19:28:55 +0000 (15:28 -0400)]
mrsas(4): Report more correct maximum I/O size.

Subtract one SGE for the case of misaligned address.  Also take into
account maximum number of sectors reported by firmware, that gives
nicer 256KB limit instead of 276KB calculated from the SGE limit.

While there, remove number of I/O size checks, duplicating what is
already checked by CAM and busdma(9).

MFC after: 1 month
Sponsored by: iXsystems, Inc.

(cherry picked from commit fa3d57c256104649217b5022947de9c1c59a326e)

2 years agonet tests: basic test case for bpf(4)'s ability to set vlan pcp
Kristof Provost [Thu, 22 Jul 2021 12:50:27 +0000 (14:50 +0200)]
net tests: basic test case for bpf(4)'s ability to set vlan pcp

Use dhclient with its 'vlan-pcp' option to set a VLAN PCP value and
verify that it actually gets set.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31276

(cherry picked from commit 3e87f800f01b6d2cbe49924a01038379889d8b3b)

2 years agovlan: deduplicate bpf_setpcp() and pf_ieee8021q_setpcp()
Kristof Provost [Thu, 22 Jul 2021 08:35:08 +0000 (10:35 +0200)]
vlan: deduplicate bpf_setpcp() and pf_ieee8021q_setpcp()

These two fuctions were identical, so move them into the common
vlan_set_pcp() function, exposed in the if_vlan_var.h header.

Reviewed by: donner
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31275

(cherry picked from commit 9ef8cd0b7906371803421aa897056b6fc0710fcb)

2 years agobpf: Add an ioctl to set the VLAN Priority on packets sent by bpf
Luiz Otavio O Souza [Wed, 21 Jul 2021 15:41:22 +0000 (17:41 +0200)]
bpf: Add an ioctl to set the VLAN Priority on packets sent by bpf

This allows the use of VLAN PCP in dhclient, which is required for
certain ISPs (such as Orange.fr).

Reviewed by: bcr (man page)
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31263

(cherry picked from commit 1e7fe2fbb9c0bed230d8db94d7444a90ca5ce199)

2 years agobridge tests: test linking bridges with a gif tunnel
Kristof Provost [Wed, 21 Jul 2021 15:32:24 +0000 (17:32 +0200)]
bridge tests: test linking bridges with a gif tunnel

Fairly basic test case for using gif(4)'s ability to tunnel Ethernet
traffic between bridges.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 4b765ab4cda051a6d9ceb5fb9cac80c7f3b910bf)

3 years agoinet6_option_space is deprecated, refer to inet6_opt_init instead
Tom Jones [Fri, 30 Jul 2021 13:23:39 +0000 (14:23 +0100)]
inet6_option_space is deprecated, refer to inet6_opt_init instead

Reviewed by: bz, hrs
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26273

(cherry picked from commit 0943200b1308bcf2e2b331f6aba514d64d74545f)

3 years agotcp: Add PRR cwnd reduction for non-SACK loss
Richard Scheffenegger [Sat, 19 Jun 2021 17:06:48 +0000 (19:06 +0200)]
tcp: Add PRR cwnd reduction for non-SACK loss

This completes PRR cwnd reduction in all circumstances
for the base TCP stack (SACK loss recovery, ECN window reduction,
non-SACK loss recovery), preventing the arriving ACKs to
clock out new data at the old, too high rate. This
reduces the chance to induce additional losses while
recovering from loss (during congested network conditions).

For non-SACK loss recovery, each ACK is assumed to have
one MSS delivered. In order to prevent ACK-split attacks,
only one window worth of ACKs is considered to actually
have delivered new data.

MFC after: 6 weeks
Reviewed By: rrs, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29441

(cherry picked from commit 74d7fc8753a76851db6db556ff0f09de1fbb26d5)

3 years agoless: upgrade to v590.
Xin LI [Sun, 18 Jul 2021 05:20:44 +0000 (22:20 -0700)]
less: upgrade to v590.

(cherry picked from commit 30a1828c5196c415c8afc0d50f9131885d0c6b43)
(cherry picked from commit 4bcc6d14e23d1443a275fc3a494094274a2f8382)

3 years agoMerge llvm-project 12.0.1 release and follow-up fixes
Dimitry Andric [Sun, 13 Jun 2021 19:31:46 +0000 (21:31 +0200)]
Merge llvm-project 12.0.1 release and follow-up fixes

Merge llvm-project main llvmorg-12-init-17869-g8e464dd76bef

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-12-init-17869-g8e464dd76bef, the last commit before the
upstream release/12.x branch was created.

PR: 255570

(cherry picked from commit e8d8bef961a50d4dc22501cde4fb9fb0be1b2532)

Merge llvm-project 12.0.0 release

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-12.0.0-0-gd28af7c654d8, a.k.a. 12.0.0 release.

PR: 255570

(cherry picked from commit d409305fa3838fb39b38c26fc085fb729b8766d5)

Disable strict-fp for powerpcspe, as it does not work properly yet

Merge commit 5c18d1136665 from llvm git (by Qiu Chaofan)

  [SPE] Disable strict-fp for SPE by default

  As discussed in PR50385, strict-fp on PowerPC SPE has not been
  handled well. This patch disables it by default for SPE.

  Reviewed By: nemanjai, vit9696, jhibbits

  Differential Revision: https://reviews.llvm.org/D103235

PR: 255570

(cherry picked from commit 715df83abc049b23d9acddc81f2480bd4c056d64)

Apply upstream libc++ fix to allow building with devel/xxx-xtoolchain-gcc

Merge commit 52e9d80d5db2 from llvm git (by Jason Liu):

  [libc++] add `inline` for __open's definition in ifstream and ofstream

  Summary:

  When building with gcc on AIX, it seems that gcc does not like the
  `always_inline` without the `inline` keyword.
  So adding the inline keywords in for __open in ifstream and ofstream.
  That will also make it consistent with __open in basic_filebuf
  (it seems we added `inline` there before for gcc build as well).

  Differential Revision: https://reviews.llvm.org/D99422

PR: 255570

(cherry picked from commit d099db25464b826c5724cf2fb5b22292bbe15f6e)

Undefine HAVE_(DE)REGISTER_FRAME in llvm's config.h on arm

Otherwise, the lli tool (enable by WITH_CLANG_EXTRAS) won't link on arm,
stating that __register_frame is undefined. This function is normally
provided by libunwind, but explicitly not for the ARM Exception ABI.

Reported by: oh
PR: 255570

(cherry picked from commit f336b45e943c7f9a90ffcea1a6c4c7039e54c73c)

Merge llvm-project 12.0.1 rc2

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-12.0.1-rc2-0-ge7dac564cd0e, a.k.a. 12.0.1 rc2.

PR: 255570

(cherry picked from commit 23408297fbf3089f0388a8873b02fa75ab3f5bb9)

Revert libunwind change to fix backtrace segfault on aarch64

Revert commit 22b615a96593 from llvm git (by Daniel Kiss):

  [libunwind] Support for leaf function unwinding.

  Unwinding leaf function is useful in cases when the backtrace finds a
  leaf function for example when it caused a signal.
  This patch also add the support for the DW_CFA_undefined because it marks
  the end of the frames.

  Ryan Prichard provided code for the tests.

  Reviewed By: #libunwind, mstorsjo

  Differential Revision: https://reviews.llvm.org/D83573

  Reland with limit the test to the x86_64-linux target.

Bisection has shown that this particular upstream commit causes programs
using backtrace(3) on aarch64 to segfault. This affects the lang/rust
port, for instance. Until we can upstream to fix this problem, revert
the commit for now.

Reported by: mikael
PR: 256864

(cherry picked from commit 5866c369e4fd917c0d456f0f10b92ee354b82279)

Merge llvm-project 12.0.1 release

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-12.0.1-0-gfed41342a82f, a.k.a. 12.0.1 release.

PR: 255570

(cherry picked from commit 4652422eb477731f284b1345afeefef7f269da50)

compilert-rt: build out-of-line LSE atomics helpers for aarch64

Both clang >= 12 and gcc >= 10.1 now default to -moutline-atomics for
aarch64. This requires a bunch of helper functions in libcompiler_rt.a,
to avoid link errors like "undefined symbol: __aarch64_ldadd8_acq_rel".

(Note: of course you can use -mno-outline-atomics as a workaround too,
but this would negate the potential performance benefit of the faster
LSE instructions.)

Bump __FreeBSD_version so ports maintainers can easily detect this.

PR: 257392

(cherry picked from commit cc55ee8009a550810d38777fd6ace9abf3a2f6b4)

3 years agoawk: remove proctab.c
Warner Losh [Mon, 12 Jul 2021 03:26:08 +0000 (21:26 -0600)]
awk: remove proctab.c

proctab.c is a generated file and never should have been committed to
the tree. This file has been added and removed a couple of times, most
recently added by me in my 2019 updates.

Sponsored by: Netflix

(cherry picked from commit 0c92d88c9180bf25187f01f1d7e419edea9a0fef)

3 years agopf: fix ABI breakage
Kristof Provost [Wed, 28 Jul 2021 09:24:44 +0000 (11:24 +0200)]
pf: fix ABI breakage

The introduction of synproxy support changed the size of struct
pf_status, which in turn broke the userspace ABI.

Revert the relevant change. More work is needed on the synproxy code to
keep and expose the counters, but in the mean time this restores the
ABI.

PR:             257469
MFC after:      3 days
Sponsored by:   Modirum MDPay

(cherry picked from commit da8d8b22e69c72f1d001d55b5eff5acbb0265cfc)

3 years agopf.conf.5: Document new 'match' keyword
Kristof Provost [Tue, 2 Mar 2021 19:34:41 +0000 (20:34 +0100)]
pf.conf.5: Document new 'match' keyword

Reviewed by: bcr
Obtained from: pfSense
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31117

(cherry picked from commit 0351b9875a3eb5eb4b502a4106b1917ce954e959)

3 years agopf tests: Test the match keyword
Kristof Provost [Tue, 2 Mar 2021 15:57:27 +0000 (16:57 +0100)]
pf tests: Test the match keyword

The new match keyword can currently only assign queues, so we can only
test it with ALTQ.
Set up a basic scenario where we use 'match' to assign ICMP traffic to a
slow queue, and confirm that it's really getting slowed down.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31116

(cherry picked from commit d363ebc78cbb50bc334d74fb5bb755af53c69ff0)

3 years agopf: match keyword support
Kristof Provost [Tue, 2 Mar 2021 15:01:04 +0000 (16:01 +0100)]
pf: match keyword support

Support the 'match' keyword.
Note that support is limited to adding queuing information, so without
ALTQ support in the kernel setting match rules is pointless.

For the avoidance of doubt: this is NOT full support for the match
keyword as found in OpenBSD's pf. That could potentially be built on top
of this, but this commit is NOT that.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31115

(cherry picked from commit ef950daa35d43dd396958ca28ce9de0514daf873)

3 years agoaltq tests: Basic ALTQ test
Kristof Provost [Sat, 23 Jan 2021 09:37:03 +0000 (10:37 +0100)]
altq tests: Basic ALTQ test

Activate ALTQ_HFSC, crudely check if it really limits bandwidth as we'd expect.

Reviewed by: donner@
Differential Revision: https://reviews.freebsd.org/D28303

(cherry picked from commit 16b3833344ad04194f10b567bc6fae829a52a850)

3 years agoaltq: Fix typo in features sysctl description
Kristof Provost [Tue, 26 Jan 2021 15:02:45 +0000 (16:02 +0100)]
altq: Fix typo in features sysctl description

Reported by: Jose Luis Duran

(cherry picked from commit 35dabb7b9cff601045b623aeca59ccc68930d520)