]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoif_ovpn tests: test pf's route-to
Kristof Provost [Thu, 9 Jun 2022 15:07:12 +0000 (17:07 +0200)]
if_ovpn tests: test pf's route-to

Ensure that pf's route-to works with if_ovpn.

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

2 years agoif_ovpn tests: IPv6 in IPv4 and IPv4 in IPv6 tunnels
Kristof Provost [Fri, 20 May 2022 11:06:09 +0000 (13:06 +0200)]
if_ovpn tests: IPv6 in IPv4 and IPv4 in IPv6 tunnels

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

2 years agoif_ovpn tests: tunnel over IPv6
Kristof Provost [Wed, 18 May 2022 07:41:52 +0000 (09:41 +0200)]
if_ovpn tests: tunnel over IPv6

Set up a tunnel over IPv6 carrying IPv6 traffic.

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

2 years agoif_ovpn: static probe points
Kristof Provost [Thu, 12 May 2022 19:48:23 +0000 (21:48 +0200)]
if_ovpn: static probe points

Sprinkle a few SDTs around if_ovpn to ease debugging.

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

2 years agoif_ovpn tests: timeout on clients
Kristof Provost [Tue, 26 Apr 2022 13:09:59 +0000 (15:09 +0200)]
if_ovpn tests: timeout on clients

Test that openvpn (DCO) clients are notified and handle timeout events.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35091

2 years agoif_ovpn tests: basic test case
Kristof Provost [Mon, 25 Apr 2022 15:58:31 +0000 (17:58 +0200)]
if_ovpn tests: basic test case

Set up an OpenVPN tunnel between two jails, send traffic through them to
confirm basic function.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35067

2 years agoovpn: Introduce OpenVPN DCO support
Kristof Provost [Tue, 22 Feb 2022 09:21:38 +0000 (10:21 +0100)]
ovpn: Introduce OpenVPN DCO support

OpenVPN Data Channel Offload (DCO) moves OpenVPN data plane processing
(i.e. tunneling and cryptography) into the kernel, rather than using tap
devices.
This avoids significant copying and context switching overhead between
kernel and user space and improves OpenVPN throughput.

In my test setup throughput improved from around 660Mbit/s to around
2Gbit/s.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34340

2 years agostress2: Added comment about problem found
Peter Holm [Tue, 28 Jun 2022 09:30:51 +0000 (11:30 +0200)]
stress2: Added comment about problem found

2 years agostress2: Update the exclude list
Peter Holm [Tue, 28 Jun 2022 09:30:11 +0000 (11:30 +0200)]
stress2: Update the exclude list

2 years agopf tests: test short packets
Kristof Provost [Thu, 23 Jun 2022 15:52:52 +0000 (17:52 +0200)]
pf tests: test short packets

Test sending very short packets (i.e. too short for an IP header)
packets in the Ethernet filtering code.

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

2 years agopf: ensure mbufs are long enough before we copy out IP(v6) headers
Kristof Provost [Fri, 24 Jun 2022 07:41:00 +0000 (09:41 +0200)]
pf: ensure mbufs are long enough before we copy out IP(v6) headers

This isn't likely to be an issue on real hardware (as Ethernet has a
minimal packet length of 64 bytes), but can cause panics with short
packets on if_epair.

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

2 years agopf: add missing maximum length check for DIOCADDETHRULE
Kristof Provost [Tue, 28 Jun 2022 07:43:23 +0000 (09:43 +0200)]
pf: add missing maximum length check for DIOCADDETHRULE

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

2 years agoelfnote: place note in a PT_NOTE program header
Roger Pau Monné [Mon, 27 Jun 2022 13:51:28 +0000 (15:51 +0200)]
elfnote: place note in a PT_NOTE program header

Some tools (firecraker loader) only check for notes in PT_NOTE program
headers, so make sure the notes added using the ELFNOTE macro end up
in such header.

Output from readelf -Wl for and amd64 kernel after the change:

Elf file type is EXEC (Executable file)
Entry point 0xffffffff8038a000
There are 11 program headers, starting at offset 64

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
  PHDR           0x000040 0xffffffff80200040 0x0000000000200040 0x000268 0x000268 R   0x8
  INTERP         0x0002a8 0xffffffff802002a8 0x00000000002002a8 0x00000d 0x00000d R   0x1
      [Requesting program interpreter: /red/herring]
  LOAD           0x000000 0xffffffff80200000 0x0000000000200000 0x189e28 0x189e28 R   0x200000
  LOAD           0x18a000 0xffffffff8038a000 0x000000000038a000 0xe447e8 0xe447e8 R E 0x200000
  LOAD           0xfce7f0 0xffffffff811ce7f0 0x00000000011ce7f0 0x6b955c 0x6b955c R   0x200000
  LOAD           0x1800000 0xffffffff81a00000 0x0000000001a00000 0x000140 0x000140 RW  0x200000
  LOAD           0x1801000 0xffffffff81a01000 0x0000000001a01000 0x1c8480 0x5ff000 RW  0x200000
  DYNAMIC        0x1800000 0xffffffff81a00000 0x0000000001a00000 0x000140 0x000140 RW  0x8
  GNU_RELRO      0x1800000 0xffffffff81a00000 0x0000000001a00000 0x000140 0x000140 R   0x1
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW  0
  NOTE           0x1687ae0 0xffffffff81887ae0 0x0000000001887ae0 0x0001c0 0x0001c0 R   0x4

 Section to Segment mapping:
  Segment Sections...
[...]
   10     .note.gnu.build-id .note.Xen

Reported by: cperciva
Fixes: 1a9cdd373a6a ('xen: add PV/PVH kernel entry point')
Fixes: 93ee134a24fa ('Integrate support for xen in to i386 common code.')
Sponsored by: Citrix Systems R&D
Reviewed by: emaste
Differential revision: https://reviews.freebsd.org/D35611

2 years agoxen/blkback: do not use x86 CPUID in generic code
Roger Pau Monné [Fri, 17 Jun 2022 13:29:05 +0000 (15:29 +0200)]
xen/blkback: do not use x86 CPUID in generic code

Move checker for whether Xen creates IOMMU mappings for foreign pages
into a helper that's defined in arch-specific code.

Reported by: Elliott Mitchell <ehem+freebsd@m5p.com>
Fixes: 1d528f95e8ce ('xen/blkback: remove bounce buffering mode')
Sponsored by: Citrix Systems R&D

2 years agoCorrectly update fs_dsize in growfs(8)
Kirk McKusick [Tue, 28 Jun 2022 04:46:15 +0000 (21:46 -0700)]
Correctly update fs_dsize in growfs(8)

When growing a UFS/FFS filesystem, the size of the summary information
may expand into additional blocks. These blocks must be removed from
fs_dsize which records the number of blocks in the filesystem that can
be used to hold filesystem data.

While here also update the fs_old_dsize and fs_old_size fields for
compatibility with kernels that were compiled before the addition
of UFS2.

Reported by: Edward Tomasz Napiera
MFC after:   1 week

2 years agoEliminate set but not used variable.
Kirk McKusick [Tue, 28 Jun 2022 04:37:09 +0000 (21:37 -0700)]
Eliminate set but not used variable.

No functional change intended.

2 years agodate: attempt to more accurately describe year limitations with -v
Kyle Evans [Tue, 28 Jun 2022 03:54:13 +0000 (22:54 -0500)]
date: attempt to more accurately describe year limitations with -v

The previous description was both incorrect and incomplete in its
description -- the 2038 limit doesn't apply on !i386 platforms, and
it didn't note that values above 100 are accepted and interpreted
differently.  Further, it didn't note that absolute years are accepted.

Reviewed by: pauamma_gundo.com (manpages)
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35360

2 years agoblackhole(4): fix operator precedence
Gleb Smirnoff [Tue, 28 Jun 2022 00:52:19 +0000 (17:52 -0700)]
blackhole(4): fix operator precedence

Fixes: 3ea9a7cf7b09a355cde3a76824809402b99d0892

2 years agokboot: rename kexec_load to host_kexec_load
Warner Losh [Mon, 13 Jun 2022 17:46:48 +0000 (11:46 -0600)]
kboot: rename kexec_load to host_kexec_load

And make it match the system call more closely by passing in the proper
args.

Sponsored by: Netflix

2 years agokboot: sort system calls
Warner Losh [Mon, 13 Jun 2022 17:39:55 +0000 (11:39 -0600)]
kboot: sort system calls

Sort the system calls. No functional change intended.

Sponsored by: Netflix

2 years agokboot: use SYS_kexec_load insteaed of __NR_kexec_load
Warner Losh [Mon, 13 Jun 2022 17:33:24 +0000 (11:33 -0600)]
kboot: use SYS_kexec_load insteaed of __NR_kexec_load

Make this regular with the rest of the system calls.

Sponsored by: Netflix

2 years agokboot: Sort system calls alphabetically
Warner Losh [Mon, 13 Jun 2022 17:28:31 +0000 (11:28 -0600)]
kboot: Sort system calls alphabetically

No functional change: sort the system calls alphbetically to make it
easier to add new ones.

Sponsored by: Netflix

2 years agodevmatch: Properly ignore commented fields
Greg V [Mon, 27 Jun 2022 20:41:59 +0000 (14:41 -0600)]
devmatch: Properly ignore commented fields

Any field that starts with # is a commented out field (there as a place
holder only, the data in that place holder is completely ignored). The
previous code improperly detected this using strcmp. Instead, any field
whose names starts with '#' is ignored.

Differential Reivsion: https://reviews.freebsd.org/D34633

2 years agoObsoleteFiles: flowtable header deleted in 2017
Gleb Smirnoff [Mon, 27 Jun 2022 19:31:36 +0000 (12:31 -0700)]
ObsoleteFiles: flowtable header deleted in 2017

Miss from ae69ad884d43826bdf8a67c51596d37f729c09a9

2 years agotesting: workaround pytest parser bug in pytest-atf-wrapper.
Alexander V. Chernikov [Mon, 27 Jun 2022 15:52:25 +0000 (15:52 +0000)]
testing: workaround pytest parser bug in pytest-atf-wrapper.

Reviewed by: lwhsu, kp
Differential Revision: https://reviews.freebsd.org/D35614
MFC after: 2 weeks

2 years agorouting: simplify decompose_change_notification().
Alexander V. Chernikov [Mon, 27 Jun 2022 17:29:03 +0000 (17:29 +0000)]
routing: simplify decompose_change_notification().

The function's goal is to compare old/new nhop/nexthop group for the route
 and decompose it into the series of RTM_ADD/RTM_DELETE single-nhop
 events, calling specified callback for each event.
Simplify it by properly leveraging the fact that both old/new groups
 are sorted nhop-# ascending.

Tested by: Claudio Jeker<claudio.jeker@klarasystems.com>
Differential Revision: https://reviews.freebsd.org/D35598
MFC after: 2 weeks

2 years agorouting: actually sort nexthops in nhgs by their index
Alexander V. Chernikov [Mon, 27 Jun 2022 17:19:50 +0000 (17:19 +0000)]
routing: actually sort nexthops in nhgs by their index

Nexthops in the nexthop groups needs to be deterministically sorted
 by some their property to simplify reporting cost when changing
 large nexthop groups.

Fix reporting by actually sorting next hops by their indices (`wn_cmp_idx()`).
As calc_min_mpath_slots_fast() has an assumption that next hops are sorted
using their relative weight in the nexthop groups, it needs to be
addressed as well. The latter sorting is required to quickly determine the
layout of the next hops in the actual forwarding group. For example,
what's the best way to split the traffic between nhops with weights
19,31 and 47 if the maximum nexthop group width is 64?
It is worth mentioning that such sorting is only required during nexthop
group creation and is not used elsewhere. Lastly, normally all nexthop
are of the same weight. With that in mind, (a) use spare 32 bytes inside
`struct weightened_nexthop` to avoid another memory allocation and
(b) use insertion sort to sort the nexthop weights.

Reported by: thj
Tested by: Claudio Jeker<claudio.jeker@klarasystems.com>
Differential Revision: https://reviews.freebsd.org/D35599
MFC after: 2 weeks

2 years agosmartpqi: Allocate DMA memory NOWAIT
Yuri [Mon, 27 Jun 2022 15:48:31 +0000 (09:48 -0600)]
smartpqi: Allocate DMA memory NOWAIT

We're not allowed to wait in this allocation path, so allocate the
memory NOWAIT instead of WAITOK. The code already copes with the
failures that may result, so no additional code is needed.

PR: 263008
Reviewed by: markj, Scott Benesh at Microsemi, imp
Differential Revision: https://reviews.freebsd.org/D35601

2 years agosctp: add KASSERTs to ensure correct handling of listeners
Michael Tuexen [Mon, 27 Jun 2022 17:04:45 +0000 (19:04 +0200)]
sctp: add KASSERTs to ensure correct handling of listeners

This was suggested by markj@.

MFC after: 3 days

2 years agosctp: do not clobber listening socket with sockbuf operations
Gleb Smirnoff [Mon, 27 Jun 2022 16:21:45 +0000 (09:21 -0700)]
sctp: do not clobber listening socket with sockbuf operations

The problem was here since 779f106aa16, but a4fc41423f7 turned it
into a panic.

Reviewed by: tuexen
Reported by: syzcaller

2 years agoBump .Dd for recently modified manual pages
Fernando Apesteguía [Mon, 27 Jun 2022 16:11:24 +0000 (18:11 +0200)]
Bump .Dd for recently modified manual pages

During the removal of named(8) references, some pages were modified but their
.Dd where not updated accordingly.

Reported by: lwhsu@
Fixes: 942e234d868d

2 years agoFix cross-builds from macOS
Ed Maste [Sun, 26 Jun 2022 17:23:39 +0000 (13:23 -0400)]
Fix cross-builds from macOS

The macOS linker does not support -zrelro/-znorelro.  Since it is only
used to for build tools that run on the host, and WITH_RELRO or
WITHOUT_RELRO does not matter there, just skip the option.

Reviewed by: markj
Fixes: 2f3a961487c9 ("Add RELRO build knob, default to enabled")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35589

2 years agoif_bridge tests: test adding interfaces with different MTU
Kristof Provost [Sat, 25 Jun 2022 11:47:31 +0000 (13:47 +0200)]
if_bridge tests: test adding interfaces with different MTU

We now allow new bridge members to be added with a different MTU from
the bridge. We change the interface MTU to match the bridge.
Test this.

PR: 264883

2 years agoif_bridge: change MTU for new members
Kristof Provost [Sat, 25 Jun 2022 11:39:44 +0000 (13:39 +0200)]
if_bridge: change MTU for new members

Rather than reject new bridge members because they have the wrong MTU
change it to match the bridge. If that fails, reject the new interface.

PR: 264883
Different Revision: https://reviews.freebsd.org/D35597

2 years agovt: Improve multi lingual word separation.
Hans Petter Selasky [Sat, 25 Jun 2022 09:17:44 +0000 (11:17 +0200)]
vt: Improve multi lingual word separation.

Suggested by: Tomoaki AOKI <junchoon@dec.sakura.ne.jp>
Differential Revision: https://reviews.freebsd.org/D35552
PR: 263084
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agovt: Fix contents of paste buffer for newcons.
Hans Petter Selasky [Wed, 22 Jun 2022 16:38:47 +0000 (18:38 +0200)]
vt: Fix contents of paste buffer for newcons.

Trim all word separators from end of line, except for last line and
only use '\r' to terminate the pasted lines as expected by TTY.

Submitted by: Ivan Quitschal <tezeka@hotmail.com>
Differential Revision: https://reviews.freebsd.org/D35552
PR: 263084
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agocache: drop the vfs.cache_rename_add tunable
Mateusz Guzik [Mon, 27 Jun 2022 07:54:20 +0000 (07:54 +0000)]
cache: drop the vfs.cache_rename_add tunable

The functionality has been in use since Jan 2021 -- long enough(tm).

2 years agohwpmc: further fix build (__diagused/debug/missing files entries)
Bjoern A. Zeeb [Mon, 27 Jun 2022 01:23:24 +0000 (01:23 +0000)]
hwpmc: further fix build (__diagused/debug/missing files entries)

Fix builds after 1459a22787ea16e3798694067c8dcb20325dca4b and
59191f3573f6cb2ea055ac319cbcb68823ca8e17 by using __diagused
for variables only used in KASSERT().
In addition remove two debug lines that look like a copy and paste error
from dmc620 to cmn600.
Further add the newly introduced files to sys/confg/files.arm64 as well
so that LINT compiles without missing symbols.

2 years agopmc: unhide struct pmc_md_dmc620_pmu_op_pmcallocate
Bjoern A. Zeeb [Mon, 27 Jun 2022 00:37:23 +0000 (00:37 +0000)]
pmc: unhide struct pmc_md_dmc620_pmu_op_pmcallocate

Fix build after e3572eb654733a94e1e765fe9e95e0579981d851 as
struct pmc_md_dmc620_pmu_op_pmcallocate is needed when building
libpmc/pmclog.c as it is partof the public API via machine/pmc_mdep.h.

2 years agolibpmc: attempt to fix the build
Bjoern A. Zeeb [Sun, 26 Jun 2022 23:14:56 +0000 (23:14 +0000)]
libpmc: attempt to fix the build

Try to fix the build (blindly) after e3572eb654733a94e1e765fe9e95e0579981d851.
I had missed the missing #ifdef in the review.  Hope that's all it takes.

2 years agoAdd support of ARM CMN-600 controller, PMU access functions only. Add support of...
Aleksandr Rybalko [Wed, 16 Feb 2022 00:36:17 +0000 (00:36 +0000)]
Add support of ARM CMN-600 controller, PMU access functions only. Add support of PMU counters of ARM CMN-600 controller.

Add support of ARM CMN-600 controller, PMU access functions only.
Add support of PMU counters of ARM CMN-600 controller.

Reviewed by: mhorne
Sponsored By: ARM
Differential Revision: https://reviews.freebsd.org/D32321

2 years agoThe Arm CoreLink DMC-620 Dynamic Memory Controller PMU driver
Aleksandr Rybalko [Wed, 16 Feb 2022 00:29:31 +0000 (00:29 +0000)]
The Arm CoreLink DMC-620 Dynamic Memory Controller PMU driver

Add the Arm CoreLink DMC-620 Dynamic Memory Controller PMU driver
Add DMC-620 support to hwpmc(4)

Reviewed by: mhorne
Sponsored By: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D32670

2 years agoAllocate event for DMC-620 and CMN-600 controllers PMU. Add events supported by DMC...
Aleksandr Rybalko [Wed, 16 Feb 2022 00:19:19 +0000 (00:19 +0000)]
Allocate event for DMC-620 and CMN-600 controllers PMU. Add events supported by DMC-620 and CMN-600 controllers PMU.

Allocate event for DMC-620 and CMN-600 controllers PMU.
Add events supported by DMC-620 and CMN-600 controllers PMU.

Reviewed by: bz
Sponsored By: ARM
Sponsored By: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D35609

2 years agoiommu_gas: Fix a recent regression with IOMMU_MF_CANSPLIT
Alan Cox [Sun, 26 Jun 2022 16:48:12 +0000 (11:48 -0500)]
iommu_gas: Fix a recent regression with IOMMU_MF_CANSPLIT

As of 19bb5a7244ff, the IOMMU_MF_CANSPLIT case in iommu_gas_match_one()
must take into account the specified offset.  Otherwise, the recently
changed end calculation in iommu_gas_match_insert() could produce an
end address that crosses the specified boundary by one page.

Reviewed by: dougm
MFC with: 19bb5a7244ff

2 years agoLinuxKPI: 802.11: remove an early bandaid to make sure queues are allocated
Bjoern A. Zeeb [Sun, 26 Jun 2022 19:17:04 +0000 (19:17 +0000)]
LinuxKPI: 802.11: remove an early bandaid to make sure queues are allocated

iwlwifi allocates queues on first wakeup.  This takes a lot longer on
FreeBSD's work implementation that it seems to on Linux based on some
discussion.  That meant that we couldn't get non-data frames out quickly
enough initially and failed to associate.
d0d2911035192473e8bd3f6b99ed5ca9b1b29e47 should have solved most of this
for us with iwlwifi.  None of the other drivers ported to LinuxKPI/802.11
up to today will call a dequeue so we get notified when the queus are
allocated or even need to do so.
Remove the bandaid initilly put in for iwlwifi now and speed up the
overall process of getting us associated.

MFC after: 3 days

2 years agoLinuxKPI: 802.11: cleanup lsta better
Bjoern A. Zeeb [Sun, 26 Jun 2022 19:13:00 +0000 (19:13 +0000)]
LinuxKPI: 802.11: cleanup lsta better

This changes cleans up lsta from the VIF station list as well as
deals with freeing the lsta itself so it is not leaked.

lkpi_iv_update_bss() makes this more complicated than it should be
as we ties more sta state (incl. drv/fw) to the node that net80211
does not know about.  There is more work to be done detangling this
now that is better understood.

MFC after: 3 days

2 years agoLinuxKPI: 802.11: sync sta->addr in lkpi_iv_update_bss()
Bjoern A. Zeeb [Sun, 26 Jun 2022 19:04:16 +0000 (19:04 +0000)]
LinuxKPI: 802.11: sync sta->addr in lkpi_iv_update_bss()

In lkpi_iv_update_bss() introduced in d9f59799fc3e7 we swap lsta and
along with that sta and drv state if ni gets reused and swapped under
us by net80211.  What we did not do was to sync sta->addr which later
(usually in lkpi_sta_assoc_to_run) during a bss_info update cause
problems in drivers (or firmware) as the BSSID and the station address
were not aligned.

If this proves to hold up to fix iwlwifi issues seem on firmware
for older chipsets, multi-assoc runs, and rtw89 (which this fixes)
we should add asserts that lkpi_iv_update_bss() can only happen in
pre-auth stages and/or make sure we factor out synching more state
fields.

Found debugging: rtw89
MFC after: 3 days

2 years agoRevert "LinuxKPI: 802.11: fix iwlwifi fw assert with older chipsets"
Bjoern A. Zeeb [Sun, 26 Jun 2022 18:50:36 +0000 (18:50 +0000)]
Revert "LinuxKPI: 802.11: fix iwlwifi fw assert with older chipsets"

This reverts commit 013e516dc9b1b32e9422ab02a875a05fc2d32f39.

2 years agoRemove references to named(8)
Fernando Apesteguía [Wed, 22 Jun 2022 16:39:30 +0000 (18:39 +0200)]
Remove references to named(8)

named(8) hasn't been in base for some time. Remove all references to it in
manual pages.

Approved by: manpages (Pau Amma)
Differential Revision: https://reviews.freebsd.org/D35586

2 years agotesting: move atf-pytest-wrapper to /usr/libexec
Alexander V. Chernikov [Sun, 26 Jun 2022 11:46:37 +0000 (11:46 +0000)]
testing: move atf-pytest-wrapper to /usr/libexec

Move pytest wrapper to the collection of the other atf wrappers
 in libexec. It solves the problem of combining bits & pieces from
 bsd.test.mk and bgs.prog.mk to address "test binary, but not the
 suite binary".

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D35604
MFC after: 2 weeks

2 years agoSupport of optional PMC classes.
Aleksandr Rybalko [Wed, 16 Feb 2022 00:18:04 +0000 (00:18 +0000)]
Support of optional PMC classes.

Reviewed by: mhorne
Differential Revision: https://reviews.freebsd.org/D32316

2 years agoSystem wide and NUMA domain wide counters support. PMC classes for ARM DMC-620 and...
Aleksandr Rybalko [Wed, 16 Feb 2022 00:17:02 +0000 (00:17 +0000)]
System wide and NUMA domain wide counters support. PMC classes for ARM DMC-620 and CMN-600.

Add support for system wide and NUMA domain wide counters support.
Add 3 new PMC classes for ARM DMC-620 and CMN-600 controllers PMU.

Reviewed by: mhorne
Sponsored By: ARM
Sponsored By: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D35342

2 years agorouting: fix debug headers added in 6fa8ed43ee0c #2.
Alexander V. Chernikov [Sun, 26 Jun 2022 07:26:53 +0000 (07:26 +0000)]
routing: fix debug headers added in 6fa8ed43ee0c #2.

Move debug declaration out of COMPAT_FREEBSD32 in rtsock.c

MFC after: 2 weeks

2 years agoiommu_gas: Tidy up
Alan Cox [Sun, 26 Jun 2022 05:44:47 +0000 (00:44 -0500)]
iommu_gas: Tidy up

Move a comment to the code that it describes.  Improve the wording.

Style fixes.

MFC after: 2 weeks

2 years agorouting: fix debug headers added in 6fa8ed43ee0c.
Alexander V. Chernikov [Sat, 25 Jun 2022 23:05:25 +0000 (23:05 +0000)]
routing: fix debug headers added in 6fa8ed43ee0c.

- move debug headers out of COMPAT_FREEBSD32 in rtsock.c
- remove accidentally-added LOG_ defines from syslog.h

MFC after: 2 weeks

2 years agorouting: fix syslog include for rtsock.c
Alexander V. Chernikov [Sat, 25 Jun 2022 22:08:10 +0000 (22:08 +0000)]
routing: fix syslog include for rtsock.c

MFC after: 2 weeks

2 years agorouting: add tests/sys/net/routing to mtree
Alexander V. Chernikov [Sat, 25 Jun 2022 21:13:48 +0000 (21:13 +0000)]
routing: add tests/sys/net/routing to mtree

MFC after: 2 weeks

2 years agorouting: improve debugging.
Alexander V. Chernikov [Sat, 25 Jun 2022 19:53:31 +0000 (19:53 +0000)]
routing: improve debugging.

Use unified guidelines for the severity across the routing subsystem.
Update severity for some of the already-used messages to adhere the
guidelines.
Convert rtsock logging to the new FIB_ reporting format.

MFC after: 2 weeks

2 years agorouting: fix crash when RTM_CHANGE results in no-op for the multipath
Alexander V. Chernikov [Sat, 25 Jun 2022 19:32:59 +0000 (19:32 +0000)]
routing: fix crash when RTM_CHANGE results in no-op for the multipath
route.

Reporting logic assumed there is always some nhop change for every
 successful modification operation. Explicitly check that the changed
 nexthop indeed exists when reporting back to userland.

MFC after: 2 weeks
Reported by: Claudio Jeker <claudio.jeker@klarasystems.com>
Tested by: Claudio Jeker <claudio.jeker@klarasystems.com>

2 years agorouting: add multipath pytest tests
Alexander V. Chernikov [Sat, 25 Jun 2022 19:25:38 +0000 (19:25 +0000)]
routing: add multipath pytest tests

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

2 years agotesting: Add basic atf support to pytest.
Alexander V. Chernikov [Sat, 25 Jun 2022 19:01:45 +0000 (19:01 +0000)]
testing: Add basic atf support to pytest.

Implementation consists of the pytest plugin implementing ATF format and
a simple C++ wrapper, which reorders the provided arguments from ATF format
to the format understandable by pytest. Each test has this wrapper specified
after the shebang. When kyua executes the test, wrapper calls pytest, which
loads atf plugin, does the work and returns the result. Additionally, a
separate python "package", `/usr/tests/atf_python` has been added to collect
code that may be useful across different tests.

Current limitations:
* Opaque metadata passing via X-Name properties. Require some fixtures to write
* `-s srcdir` parameter passed by the runner is ignored.
* No `atf-c-api(3)` or similar - relying on pytest framework & existing python libraries
* No support for `atf_tc_<get|has>_config_var()` & `atf_tc_set_md_var()`.
 Can be probably implemented with env variables & autoload fixtures

Differential Revision: https://reviews.freebsd.org/D31084
Reviewed by: kp, ngie

2 years agorouting: fix RTM_CHANGE nhgroup updates.
Alexander V. Chernikov [Sat, 25 Jun 2022 18:54:37 +0000 (18:54 +0000)]
routing: fix RTM_CHANGE nhgroup updates.

RTM_CHANGE operates on a single component of the multipath route (e.g. on a single nexthop).
Search of this nexthop is peformed by iterating over each component from multipath (nexthop)
 group, using check_info_match_nhop. The problem with the current code that it incorrectly
 assumes that `check_info_match_nhop()` returns true value on match, while in reality it
 returns an error code on failure). Fix this by properly comparing the result with 0.
Additionally, the followup code modified original necthop group instead of a new one.
Fix this by targetting new nexthop group instead.

Reported by: thj
Tested by: Claudio Jeker <claudio.jeker@klarasystems.com>
Differential Revision: https://reviews.freebsd.org/D35526
MFC after: 2 weeks

2 years agocuse(3): Remove PAGE_SIZE from libcuse.
Hans Petter Selasky [Thu, 23 Jun 2022 20:34:45 +0000 (22:34 +0200)]
cuse(3): Remove PAGE_SIZE from libcuse.

To allow for a dynamic page size on arm64 remove the static value from libcuse.

Differential Revision: https://reviews.freebsd.org/D35585
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agobusdma: Protect ARM busdma bounce page counters using the bounce page lock.
Hans Petter Selasky [Thu, 23 Jun 2022 09:31:17 +0000 (11:31 +0200)]
busdma: Protect ARM busdma bounce page counters using the bounce page lock.

In bus_dmamap_unload() on ARM, the counters for free_bpages and reserved_bpages
appear to be vulnerable to unprotected read-modify-write operations that result
in accounting that looks like a page leak.

This was noticed on a 2GB quad core i.MX6 system that has more than one device
attached via FTDI based USB serial connection.

Submitted by: John Hein <jcfyecrayz@liamekaens.com>
Differential Revision: https://reviews.freebsd.org/D35553
PR: 264836
MFC after: 3 days
Sponsored by: NVIDIA Networking

2 years agorb_tree: optimize tree rotation
Doug Moore [Sat, 25 Jun 2022 07:40:16 +0000 (02:40 -0500)]
rb_tree: optimize tree rotation

The RB_ROTATE macros begin with fetching a field via a pointer. In
most cases, that value is one that has already been pulled into a
register, and the compiler cannot infer that. So, to eliminate those
needless fetches, have the caller of the RB_ROTATE macros present the
data in the third macro parameter, rather than having the macro fetch
it.

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

2 years agostress2: Added two syzkaller reproducers
Peter Holm [Sat, 25 Jun 2022 06:40:20 +0000 (08:40 +0200)]
stress2: Added two syzkaller reproducers

2 years agostress2: Added reagression tests
Peter Holm [Sat, 25 Jun 2022 06:21:30 +0000 (08:21 +0200)]
stress2: Added reagression tests
PR: 165392

2 years agobusdma_iommu: Fine-grained locking for the dmamap's map list
Alan Cox [Wed, 22 Jun 2022 21:51:47 +0000 (16:51 -0500)]
busdma_iommu: Fine-grained locking for the dmamap's map list

Introduce fine-grained locking on the dmamap's list of map entries,
replacing the use of the domain lock.  This is not the most significant
source of lock contention, but it is the easiest to address.

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

2 years agonfscommon: Clean up the code by removing the vnode_vtype() macro
Rick Macklem [Fri, 24 Jun 2022 20:56:35 +0000 (13:56 -0700)]
nfscommon: Clean up the code by removing the vnode_vtype() macro

The vnode_vtype() macro was used to make the code compatible
with Mac OSX, for the Mac OSX port.
For FreeBSD, this macro just obscured the code and, therefore,
use of the macro has been deleted by previous commits.
This commit deletes the, now unused, macro.

This commit should not result in a semantics change.

2 years agonfscommon: Clean up the code by not using the vnode_vtype() macro
Rick Macklem [Fri, 24 Jun 2022 20:47:57 +0000 (13:47 -0700)]
nfscommon: Clean up the code by not using the vnode_vtype() macro

The vnode_vtype() macro was used to make the code compatible
with Mac OSX, for the Mac OSX port.
For FreeBSD, this macro just obscured the code, so
avoid using it to clean up the code.

This commit should not result in a semantics change.

2 years agotests/unix_passfd: compile SOCK_STREAM and SOCK_DGRAM versions
Gleb Smirnoff [Fri, 24 Jun 2022 16:09:11 +0000 (09:09 -0700)]
tests/unix_passfd: compile SOCK_STREAM and SOCK_DGRAM versions

Most test pass identically on different kinds of sockets. However,
few edge cases work differently on stream and datagram sockets. We
want to exercise this and document.

Differential revision: https://reviews.freebsd.org/D35420

2 years agolibc/syslog: deprecate use of "/var/run/logpriv"
Gleb Smirnoff [Fri, 24 Jun 2022 16:09:11 +0000 (09:09 -0700)]
libc/syslog: deprecate use of "/var/run/logpriv"

This additional socket was created in 2e89951b6f20 and 240d5a9b1ce76
to try workaround problems with classic PF_UNIX/SOCK_DGRAM sockets.

With recent changes in kernel this trick is no longer needed, so the
trick can be reverted.

In syslogd(8) we would still create the socket for the next several
major releases for compatibility.

Differential revision: https://reviews.freebsd.org/D35305

2 years agolibc/syslog: fully deprecate and don't try to open "/dev/log"
Gleb Smirnoff [Fri, 24 Jun 2022 16:09:11 +0000 (09:09 -0700)]
libc/syslog: fully deprecate and don't try to open "/dev/log"

The "/dev/log" socket existed in pre-FreeBSD times.  Later it was
substituted to a compatibility symlink.  The symlink creation was
deprecated in FreeBSD 10.2 and 9-STABLE.

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35304

2 years agounix/dgram: smart socket buffers for one-to-many sockets
Gleb Smirnoff [Fri, 24 Jun 2022 16:09:11 +0000 (09:09 -0700)]
unix/dgram: smart socket buffers for one-to-many sockets

A one-to-many unix/dgram socket is a socket that has been bound
with bind(2) and can get multiple connections.  A typical example
is /var/run/log bound by syslogd(8) and receiving multiple
connections from libc syslog(3) API.  Until now all of these
connections shared the same receive socket buffer of the bound
socket.  This made the socket vulnerable to overflow attack.
See 240d5a9b1ce for a historical attempt to workaround the problem.

This commit creates a per-connection socket buffer for every single
connected socket and eliminates the problem.  The new behavior will
optimize seldom writers over frequent writers.  See added test case
scenarios and code comments for more detailed description of the
new behavior.

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35303

2 years agounix/dgram: reduce mbuf chain traversals in send(2) and recv(2)
Gleb Smirnoff [Fri, 24 Jun 2022 16:09:11 +0000 (09:09 -0700)]
unix/dgram: reduce mbuf chain traversals in send(2) and recv(2)

o Use m_pkthdr.memlen from m_uiotombuf()
o Modify unp_internalize() to keep track of allocated space and memory
  as well as pointer to the last buffer.
o Modify unp_addsockcred() to keep track of allocated space and memory
  as well as pointer to the last buffer.
o Record the datagram len/memlen/ctllen in the first (from) mbuf of the
  chain in uipc_sosend_dgram() and reuse it in uipc_soreceive_dgram().

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35302

2 years agom_uiotombuf: write total memory length of the allocated chain in pkthdr
Gleb Smirnoff [Fri, 24 Jun 2022 16:09:11 +0000 (09:09 -0700)]
m_uiotombuf: write total memory length of the allocated chain in pkthdr

Data allocated by m_uiotombuf() usually goes into a socket buffer.
We are interested in the length of useful data to be added to sb_acc,
as well as total memory used by mbufs.  The later would be added to
sb_mbcnt.  Calculating this value at allocation time allows to save
on extra traversal of the mbuf chain.

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35301

2 years agounix/dgram: use minimal possible socket buffer for PF_UNIX/SOCK_DGRAM
Gleb Smirnoff [Fri, 24 Jun 2022 16:09:11 +0000 (09:09 -0700)]
unix/dgram: use minimal possible socket buffer for PF_UNIX/SOCK_DGRAM

This change fully splits away PF_UNIX/SOCK_DGRAM from other socket
buffer implementations, without any behavior changes.

Generic socket implementation is reduced down to one STAILQ and very
little code.

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35300

2 years agosockets: enable protocol specific socket buffers
Gleb Smirnoff [Fri, 24 Jun 2022 16:09:10 +0000 (09:09 -0700)]
sockets: enable protocol specific socket buffers

Split struct sockbuf into common shared fields and protocol specific
union, where protocols are free to implement whatever buffer they
want.  Such protocols should mark themselves with PR_SOCKBUF and are
expected to initialize their buffers in their pr_attach and tear
them down in pr_detach.

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35299

2 years agounix: provide an option to return locked from unp_connectat()
Gleb Smirnoff [Fri, 24 Jun 2022 16:09:10 +0000 (09:09 -0700)]
unix: provide an option to return locked from unp_connectat()

Use this new version in unix/dgram socket when sending to a target
address.  This removes extra lock release/acquisition and possible
counter-intuitive ENOTCONN.

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35298

2 years agounix/dgram: inline sbappendaddr_locked() into uipc_sosend_dgram()
Gleb Smirnoff [Fri, 24 Jun 2022 16:09:10 +0000 (09:09 -0700)]
unix/dgram: inline sbappendaddr_locked() into uipc_sosend_dgram()

This allows to remove one M_NOWAIT allocation and also makes it
more clear what's going on.

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35297

2 years agounix/dgram: add a specific receive method - uipc_soreceive_dgram
Gleb Smirnoff [Fri, 24 Jun 2022 16:09:10 +0000 (09:09 -0700)]
unix/dgram: add a specific receive method - uipc_soreceive_dgram

With this second step PF_UNIX/SOCK_DGRAM has protocol specific
implementation.  This gives some possibility performance
optimizations.  However, it still operates on the same struct
socket as all other sockets do.

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35296

2 years agounix/dgram: cleanup uipc_send of PF_UNIX/SOCK_DGRAM, step 2
Gleb Smirnoff [Fri, 24 Jun 2022 16:09:10 +0000 (09:09 -0700)]
unix/dgram: cleanup uipc_send of PF_UNIX/SOCK_DGRAM, step 2

Just remove one level of indentation as the case clause always match.

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35295

2 years agounix/dgram: cleanup uipc_send of PF_UNIX/SOCK_DGRAM, step 1
Gleb Smirnoff [Fri, 24 Jun 2022 16:09:10 +0000 (09:09 -0700)]
unix/dgram: cleanup uipc_send of PF_UNIX/SOCK_DGRAM, step 1

Remove the dead code.  The new uipc_sosend_dgram() handles send()
on PF_UNIX/SOCK_DGRAM in full.

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35294

2 years agounix/dgram: add a specific send method - uipc_sosend_dgram()
Gleb Smirnoff [Fri, 24 Jun 2022 16:09:10 +0000 (09:09 -0700)]
unix/dgram: add a specific send method - uipc_sosend_dgram()

This is first step towards splitting classic BSD socket
implementation into separate classes.  The first to be
split is PF_UNIX/SOCK_DGRAM as it has most differencies
to SOCK_STREAM sockets and to PF_INET sockets.

Historically a protocol shall provide two methods for sendmsg(2):
pru_sosend and pru_send.  The former is a generic send method,
e.g. sosend_generic() which would internally call the latter,
uipc_send() in our case.  There is one important exception, though,
the sendfile(2) code will call pru_send directly.  But sendfile
doesn't work on SOCK_DGRAM, so we can do the trick.  We will create
socket class specific uipc_sosend_dgram() which will carry only
important bits from sosend_generic() and uipc_send().

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35293

2 years agoUFS rename: make it reliable when using SU and reaching nlink limit
Konstantin Belousov [Wed, 22 Jun 2022 13:54:01 +0000 (16:54 +0300)]
UFS rename: make it reliable when using SU and reaching nlink limit

PR: 165392
Reviewed by: mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D35577

2 years agoAdd the SVE reigster definitions
Andrew Turner [Fri, 24 Jun 2022 11:51:26 +0000 (11:51 +0000)]
Add the SVE reigster definitions

Sponsored by: The FreeBSD Foundation

2 years agoTrap SVE instructions until we have SVE support
Andrew Turner [Fri, 24 Jun 2022 11:50:28 +0000 (11:50 +0000)]
Trap SVE instructions until we have SVE support

When running on hardware that supports SVE send the correct signal when
an SVE instruction is run.

Sponsored by: The FreeBSD Foundation

2 years agoFix the zfs build for arm64
Andrew Turner [Fri, 24 Jun 2022 13:16:50 +0000 (13:16 +0000)]
Fix the zfs build for arm64

Remove -mgeneral-regs-only when building the arm64 blake3 code. It
uses simd instructions so will use non-general purpose registers.

Sponsored by: The FreeBSD Foundation

2 years agoifconfig.8: Document -g all and -G all
Mateusz Piotrowski [Fri, 24 Jun 2022 09:38:02 +0000 (11:38 +0200)]
ifconfig.8: Document -g all and -G all

The special group name "all" selects all the interfaces.

MFC after: 3 days

2 years agorc.conf.5: Add missing Ns macros
Mateusz Piotrowski [Fri, 24 Jun 2022 09:31:56 +0000 (11:31 +0200)]
rc.conf.5: Add missing Ns macros

MFC after: 3 days

2 years agoDrop atheros dead link from uath manual page
Sergio Carlavilla Delgado [Fri, 24 Jun 2022 09:22:56 +0000 (11:22 +0200)]
Drop atheros dead link from uath manual page

PR:             264256
MFC after:      2 weeks

2 years agoFix build break in 50dc4c7.
Kirk McKusick [Fri, 24 Jun 2022 02:54:18 +0000 (19:54 -0700)]
Fix build break in 50dc4c7.

No functional change intended.

MFC after:   1 month (with 076002f24d35)

2 years agoWhen a superblock integrity check fails, report the cause of the failure.
Kirk McKusick [Fri, 24 Jun 2022 00:39:05 +0000 (17:39 -0700)]
When a superblock integrity check fails, report the cause of the failure.

No functional change intended.

MFC after:   1 month (with 076002f24d35)
Differential Revision: https://reviews.freebsd.org/D35219

2 years agonfscl: Clean up the code by not using the vnode_vtype() macro
Rick Macklem [Thu, 23 Jun 2022 23:13:12 +0000 (16:13 -0700)]
nfscl: Clean up the code by not using the vnode_vtype() macro

The vnode_vtype() macro was used to make the code compatible
with Mac OSX, for the Mac OSX port.
For FreeBSD, this macro just obscured the code, so
avoid using it to clean up the code.

This commit should not result in a semantics change.

2 years agox86 mptable: Include <x86/legacvar.h> for legacy_get_pcibus().
John Baldwin [Thu, 23 Jun 2022 22:00:12 +0000 (15:00 -0700)]
x86 mptable: Include <x86/legacvar.h> for legacy_get_pcibus().

Fixes: b076d8d54c2f mptable_hostb: Use legacy_get_pcibus() to fetch PCI bus number.
MFC after: 1 week

2 years agouhid(4): Don't read-ahead from the USB IN endpoint.
Hans Petter Selasky [Thu, 23 Jun 2022 17:39:21 +0000 (19:39 +0200)]
uhid(4): Don't read-ahead from the USB IN endpoint.

This avoids an issue where IN endpoint data received from the device right
before the file handle is closed, gets lost.

PR: 263995
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agotcp: Correctly compute the TCP goodput in bits per second by using SEQ_SUB().
Hans Petter Selasky [Thu, 16 Jun 2022 02:42:46 +0000 (04:42 +0200)]
tcp: Correctly compute the TCP goodput in bits per second by using SEQ_SUB().

TCP sequence number differences should be computed using SEQ_SUB().

Differential Revision: https://reviews.freebsd.org/D35505
Reviewed by: rscheff@
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agosubr_bus: restore bus_null_rescan()
Mitchell Horne [Thu, 23 Jun 2022 18:44:28 +0000 (15:44 -0300)]
subr_bus: restore bus_null_rescan()

Partially revert the previous change; we need to keep this method as a
specific override for pci_driver subclasses which should not use
pci_rescan_method() -- cardbus and ofw_pcibus. However, change the return
value to ENODEV for the same reasoning given in the original commit, and
use this as the default rescan method in bus_if.m.

Reported by: jhb
Fixes: 36a8572ee8f5 ("bus_if: provide a default null rescan method")
MFC with: 36a8572ee8f5

2 years agobhyve: Enable suspend/resume support for virtio-blk.
Vitaliy Gusev [Thu, 23 Jun 2022 18:46:06 +0000 (11:46 -0700)]
bhyve: Enable suspend/resume support for virtio-blk.

Reviewed by: jhb
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D26267

2 years agobhyve: Snapshot impovements for 'blockif' backend
Vitaliy Gusev [Thu, 23 Jun 2022 18:46:06 +0000 (11:46 -0700)]
bhyve: Snapshot impovements for 'blockif' backend

When pausing a block I/O device model as part of suspending a VM, wait
for all active block I/O requests to finish before saving snapshot
data.  This avoids having to save information about in-flight requests
both in the block_if layer and in storage device models.

For the AHCI device model, the queues are now guaranteed to be idle
when taking a snapshot, so remove the code to save queue state and
rely on the initial state in a resumed VM having all queues already
idle.

This will also simplify adding NVMe snapshot support in the future.

Reviewed by: jhb
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D26267