freebsd.git
2 years agousr.bin/bc: update to version 5.3.1
Stefan Eßer [Sat, 11 Jun 2022 11:03:06 +0000 (13:03 +0200)]
usr.bin/bc: update to version 5.3.1

This version adds support for command line editing and history using
the libedit or readline libraries in addition to the line editing
features available in previous versions.

The version in the base system is configured to use libedit.

This allows to choose between emacs and vi line editing commands and
to use command overrides via a ~/.editrc file.

Merge commit 'bd54318046bfee055b140705a5cfd4148e78da07'

PR: 264010

MFC after: 2 weeks

2 years agovendor/bc: import of version 5.3.1
Stefan Eßer [Sat, 11 Jun 2022 09:54:23 +0000 (11:54 +0200)]
vendor/bc: import of version 5.3.1

This update does not contain any functional change, but fixes two
minor build issues:

- Temporary files were created in the source directory, causing build
  failures if the sources were not writable at build time.
- A message catalogue contained extra characters that were ignored but
  made gencat print warning messages.

2 years agovendor/bc: import of version 5.3.0
Stefan Eßer [Sat, 11 Jun 2022 09:50:28 +0000 (11:50 +0200)]
vendor/bc: import of version 5.3.0

This version adds support for command line editing and history using
the editline or readline libraries in addition to the line editing
features available in previous versions.

2 years agorb_tree: drop needless tests from rb_next, rb_prev
Doug Moore [Fri, 10 Jun 2022 21:53:16 +0000 (16:53 -0500)]
rb_tree: drop needless tests from rb_next, rb_prev

In RB_NEXT, when there is no RB_RIGHT node, the search must proceed
through the parent node.

There is code written to handle the case when the parent is non-NULL
and the current element is the left child of that parent. If you
assume that the current element is either the left child of its
parent, or the right child of its parent, but not both, then this test
is not necessary. Instead of assigning RB_PARENT(elm, field) to elm
when elm == RB_LEFT, removing the test has the code assign
RB_PARENT(elm, field) to elm when elm != RB_RIGHT. There's no need to
examine the RB_LEFT field at all.

This change removes that needless RB_LEFT test, and makes a similar
change to the RB_PREV implementation.

Reviewed by: alc
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35450

2 years agoiommu_gas: pass size to iommu_map without rounding
Doug Moore [Fri, 10 Jun 2022 18:56:54 +0000 (13:56 -0500)]
iommu_gas: pass size to iommu_map without rounding

Let the caller to iommu_map pass the size parameter without rounding
it up to a multiple of page size.  Let iommu_map round it up when
necessary, which is not all of the time, so that in some cases less
space is reserved.

Reviewed by: alc, kib (previous version)
Tested by: pho, br
Discussed with: andrew
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35424

2 years agoUpdate organization.dot with new CORE.12 members
Muhammad Moinur Rahman [Fri, 10 Jun 2022 17:11:45 +0000 (12:11 -0500)]
Update organization.dot with new CORE.12 members

Approved by: core (bofh with core-secretary@ hat on)

2 years agoLinuxKPI: 802.11: rework handling of the special IEEE80211_NUM_TIDS queue
Bjoern A. Zeeb [Fri, 10 Jun 2022 14:18:57 +0000 (14:18 +0000)]
LinuxKPI: 802.11: rework handling of the special IEEE80211_NUM_TIDS queue

Rework the way we are dealing with the last queue.  If the driver
opts in to STA_MMPDU_TXQ then preferably send all non-data frames
via the last (IEEE80211_NUM_TIDS) queue which otherwise is not used
in station mode.
If we do not have that queue we do individual tx() calls for non-data
frames now.
Everything else goes via the selected queue if possible for as long as
we have a ni (sta) and otherwise resorts to direct tx.

Tested on: Intel AX200 and AX210
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoftpd(8): do not refer to now unused libxo(3)
Eugene Grosbein [Fri, 10 Jun 2022 14:03:07 +0000 (21:03 +0700)]
ftpd(8): do not refer to now unused libxo(3)

In 2018, the commit r328100 (0fdf7fa846b1a1b1679e86812a1b08b8cb623604)
removed libxo(3) support from ls(1), so ftpd has no reasons to link
with libxo since then.

ls(1) does not depend on libxo in both of stable/12 and stable/13.

MFC after: 2 weeks

2 years agoLinuxKPI: move pm_message_t from kernel.h to pm.h
Bjoern A. Zeeb [Fri, 20 May 2022 21:50:01 +0000 (21:50 +0000)]
LinuxKPI: move pm_message_t from kernel.h to pm.h

Move pm_message_t from kernel.h to pm.h and remove a private define
in usb.h as well as adjust the implementation in linux_usb.c.
This cleans up what I believe to be a historic shortcut and is
needed for future wireless driver updates.

Leave a note in UPDATING that drm-kmod users need to update to the
latest version before re-compiling a new kernel to avoid errors
(see PR).

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
PR: 264449 (drm-kmod port update, thanks wulf)
Obtained from: bz_git_iwlwifi (Dec 2020) (partly)
Reviewed by: hselasky, imp
Differential Revision: https://reviews.freebsd.org/D35276

2 years agopci_vendors: udpate to 2022-05-18
Baptiste Daroussin [Fri, 10 Jun 2022 10:55:43 +0000 (12:55 +0200)]
pci_vendors: udpate to 2022-05-18

2 years agoloader: add support for gzip compression
Toomas Soome [Wed, 25 May 2022 18:53:57 +0000 (21:53 +0300)]
loader: add support for gzip compression

As we do have zlib code in loader, we should also support gzip
compression in zfs.

PR: 153173
Submitted by: Mikhail Zakharov <zmey20000@yahoo.com>
Reviewed by: imp, markj, delphij
Differential Revision: https://reviews.freebsd.org/D35320
MFC after: 1 month

2 years agohwpmc: Permit the minimum sampling count to be set as a sysctl.
John Baldwin [Thu, 9 Jun 2022 18:05:34 +0000 (11:05 -0700)]
hwpmc: Permit the minimum sampling count to be set as a sysctl.

A rarely occurring event (e.g. an event that occurs less than 1000
times during execution of a program) may require a lower minimum
threshold than 1000.  Replace the hardcoded 1000 with a sysctl that
the administrator can use to permit smaller sampling count values.

Reviewed by: mhorne, mav
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D35400

2 years ago.github: Add a build on Ubuntu 22.04 using llvm 14.
John Baldwin [Thu, 9 Jun 2022 17:20:03 +0000 (10:20 -0700)]
.github: Add a build on Ubuntu 22.04 using llvm 14.

Reviewed by: uqs
Pull Request: https://github.com/freebsd/freebsd-src/pull/599

2 years agousr.bin/dtc: Include <limits> for std::numeric_limits<>.
John Baldwin [Thu, 9 Jun 2022 17:20:03 +0000 (10:20 -0700)]
usr.bin/dtc: Include <limits> for std::numeric_limits<>.

This is needed when building natively as a cross-tool on hosts such as
Linux using more recent versions of libstdc++.

Co-authored-by: Alexander Richardson <arichardson@FreeBSD.org>
Obtained from: CheriBSD

2 years ago.github: Cross-build aarch64 as well as amd64 kernels.
John Baldwin [Thu, 9 Jun 2022 17:20:03 +0000 (10:20 -0700)]
.github: Cross-build aarch64 as well as amd64 kernels.

This required adding an explicit os list to the matrix.

Reviewed by: uqs
Pull Request: https://github.com/freebsd/freebsd-src/pull/599

2 years ago.github: Update compilers used for cross-build testing.
John Baldwin [Thu, 9 Jun 2022 17:20:02 +0000 (10:20 -0700)]
.github: Update compilers used for cross-build testing.

- Drop clang 9 build, and switch the remaining ubuntu build to
  the more modern clang 12.

- Update the label for the macos-latest builds which are now using
  clang 13 rather than clang 12.

Reviewed by: uqs
Pull Request: https://github.com/freebsd/freebsd-src/pull/599

2 years agoSort SPLIT_KERNEL_DEBUG correctly in kern.opts.mk
Ed Maste [Thu, 9 Jun 2022 14:39:24 +0000 (10:39 -0400)]
Sort SPLIT_KERNEL_DEBUG correctly in kern.opts.mk

Fixes: e3709cfe6a2a ("Add SPLIT_KERNEL_DEBUG knob")

2 years agoupgt(4): Adjust all pause calls to use milliseconds instead of ticks.
Hans Petter Selasky [Thu, 9 Jun 2022 13:14:17 +0000 (15:14 +0200)]
upgt(4): Adjust all pause calls to use milliseconds instead of ticks.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agourtw(4): Adjust all pause calls to use milliseconds instead of ticks.
Hans Petter Selasky [Thu, 9 Jun 2022 13:11:29 +0000 (15:11 +0200)]
urtw(4): Adjust all pause calls to use milliseconds instead of ticks.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agovmm: move bumping VMEXIT_USERSPACE stat to the right place
Vitaliy Gusev [Thu, 9 Jun 2022 12:57:25 +0000 (08:57 -0400)]
vmm: move bumping VMEXIT_USERSPACE stat to the right place

Statistic for "number of vm exits handled in userspace" should be
increased in vm_run() instead of vmx_run() because in some cases
vm_run() doesn't exit to userspace and keeps entering the guest.

Also svm_run's implementation even wrongly misses that stat.

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

2 years agoiommu_gas: Change find_space lower search order
Doug Moore [Thu, 9 Jun 2022 04:14:28 +0000 (23:14 -0500)]
iommu_gas: Change find_space lower search order

iommu_gas_lowermatch looks right, then left, then right again in its
search for free space.  Change to a more straightforward last-fit
search that touches fewer tree nodes and improves performance.

Reported by: wxzhu@rice.edu
Reviewed by: alc, kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35439

2 years agoEC2: Enable ephemeral swap by default
Colin Percival [Wed, 8 Jun 2022 22:45:41 +0000 (15:45 -0700)]
EC2: Enable ephemeral swap by default

The latest version of the ec2-scripts package includes a completely
rewritten "use EC2 ephemeral disks for swap space" script.  Now that
we have something which works on recent versions of FreeBSD, turn it
on since it's a great way to use the ephemeral disks.

Note that the option for controlling this, ec2_ephemeral_swap_enable,
is not the same as the option (ec2_ephemeralswap_enable) used with the
previous ephemeral-swap script; this change was deliberate to avoid
astonishment for users who upgraded their ec2-scripts package and had
a setting left behind in rc.conf.

2 years agounbound: Vendor import 1.16.0
Cy Schubert [Wed, 8 Jun 2022 22:08:42 +0000 (15:08 -0700)]
unbound: Vendor import 1.16.0

Merge commit '5f9f82264b91e041df7cba2406625146e7268ce4' into main

MFC after: 1 month

2 years agosctp: remove book keeping not needed anymore
Michael Tuexen [Wed, 8 Jun 2022 21:30:52 +0000 (23:30 +0200)]
sctp: remove book keeping not needed anymore

MFC after: 3 days

2 years agosrc.conf.5: regen for SPLIT_KERNEL_DEBUG knob
Ed Maste [Wed, 8 Jun 2022 21:13:56 +0000 (17:13 -0400)]
src.conf.5: regen for SPLIT_KERNEL_DEBUG knob

2 years agoAdd SPLIT_KERNEL_DEBUG knob
Ed Maste [Wed, 8 Jun 2022 21:02:24 +0000 (17:02 -0400)]
Add SPLIT_KERNEL_DEBUG knob

Prior to 9b6edf364eb0 WITHOUT_KERNEL_SYMBOLS split kernel debug data
into standalone debug files at build time, but did not install those
files.  As of 9b6edf364eb0 it stopped splitting the debug data, leaving
it in the kernel and modules (the default kernel configs include
DEBUG=-g).

Revert 9b6edf364eb0 and introduce a new build-time SPLIT_KERNEL_DEBUG
knob, as some people rely on the pre-9b6edf364eb0 WITHOUT_KERNEL_SYMBOLS
behaviour and that was imp's original intent.

PR: 264433
Reviewed by: eugen, imp
MFC after: 3 weeks
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35437

2 years agosctp: cleanup, no functional change
Michael Tuexen [Wed, 8 Jun 2022 20:35:14 +0000 (22:35 +0200)]
sctp: cleanup, no functional change

MFC after: 3 days

2 years agosshd_config: clarify password authentication options
Ed Maste [Wed, 25 May 2022 13:32:57 +0000 (09:32 -0400)]
sshd_config: clarify password authentication options

Passwords may be accepted by both the PasswordAuthentication and
KbdInteractiveAuthentication authentication schemes.  Add a reference to
the latter in the description/comment for PasswordAuthentication, as it
otherwise may seem that "PasswordAuthentication no" implies passwords
will be disallowed.

This situation should be clarified with more extensive documentation on
the authentication schemes and configuration options, but that should be
done in coordination with upstream OpenSSH.  This is a minimal change
that will hopefully clarify the situation without requiring an extensive
local patch set.

PR: 263045
Reviewed by: manu (earlier version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35272

2 years agounbound: Vendor import 1.16.0
Cy Schubert [Wed, 8 Jun 2022 14:43:13 +0000 (07:43 -0700)]
unbound: Vendor import 1.16.0

2 years agotcp: exclude KASSERTS when rescue retransmissions are in play.
Richard Scheffenegger [Wed, 8 Jun 2022 12:21:28 +0000 (14:21 +0200)]
tcp: exclude KASSERTS when rescue retransmissions are in play.

The KASSERT criteria needs to be checked against the
sendbuffer so_snd in a subsequent version.

Reviewed By: tuexen, #transport
PR: 263445
MFC after: 1 week
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D35431

2 years agomlx5en(4): Allow RX TLS to be enabled and disabled by ifconfig(8).
Hans Petter Selasky [Wed, 8 Jun 2022 11:22:32 +0000 (13:22 +0200)]
mlx5en(4): Allow RX TLS to be enabled and disabled by ifconfig(8).

While at it, fix double initialization of the "drv_ioctl_data_d" structure
and the "mask" variable.

Reviewed by: kib@
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agotcp: remove goto and address another NULL deref in SACK
Richard Scheffenegger [Wed, 8 Jun 2022 07:14:16 +0000 (09:14 +0200)]
tcp: remove goto and address another NULL deref in SACK

Missed another NULL dereference during KASSERTS after traversing
the scoreboard. While at it, scratch the goto by making the
traversal conditional, and remove duplicate checks using an
unconditional loop with all checks inside.

Reviewed By: hselasky
PR: 263445
MFC after: 1 week
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D35428

2 years agoBump the FreeBSD version after recent mbuf(9) structure changes.
Hans Petter Selasky [Wed, 8 Jun 2022 06:37:16 +0000 (08:37 +0200)]
Bump the FreeBSD version after recent mbuf(9) structure changes.

Differential revision: https://reviews.freebsd.org/D35339
Sponsored by: NVIDIA Networking

2 years agopw: reinitialize struct tm before every call to strptime
Baptiste Daroussin [Tue, 7 Jun 2022 20:28:13 +0000 (22:28 +0200)]
pw: reinitialize struct tm before every call to strptime

This prevents corrupted result due to leftover of previous failed
call to strptime

2 years agombuf(9): Update comment about pkthdr structure size.
Hans Petter Selasky [Tue, 7 Jun 2022 20:19:03 +0000 (22:19 +0200)]
mbuf(9): Update comment about pkthdr structure size.

Differential revision: https://reviews.freebsd.org/D35339
Sponsored by: NVIDIA Networking

2 years agombuf(9): Fix size of mbuf for all 32-bit platforms (i386, ARM, PowerPC and RISCV)
Hans Petter Selasky [Tue, 7 Jun 2022 19:55:01 +0000 (21:55 +0200)]
mbuf(9): Fix size of mbuf for all 32-bit platforms (i386, ARM, PowerPC and RISCV)

Do this by reducing the size of the MBUF_PEXT_MAX_PGS, causing "struct mbuf" to
be bigger than M_SIZE, and also add a missing padding field to ensure 64-bit
alignment.

Reviewed by: gallatin@
Reported by: Elliott Mitchell
Differential revision: https://reviews.freebsd.org/D35339
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoCorrect a typo in a string literal.
Jens Schweikhardt [Tue, 7 Jun 2022 19:48:59 +0000 (21:48 +0200)]
Correct a typo in a string literal.

2 years agotcp: skip sackhole checks on NULL
Richard Scheffenegger [Tue, 7 Jun 2022 16:16:54 +0000 (18:16 +0200)]
tcp: skip sackhole checks on NULL

Inadvertedly introduced NULL pointer dereference during
sackhole sanity check in D35387.

Reviewed By: glebius
PR: 263445
MFC after: 1 week
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D35423

2 years agoClarify WITHOUT_KERNEL_SYMBOLS description
Ed Maste [Tue, 7 Jun 2022 14:20:39 +0000 (10:20 -0400)]
Clarify WITHOUT_KERNEL_SYMBOLS description

Debug data is enabled via `makeoptions DEBUG=-g` in the kernel config
file (e.g. GENERIC).

If debug data is enabled and WITHOUT_KERNEL_SYMBOLS is set then debug
data is included in the kernel and module files.

PR: 264433
Discussed with: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agomlx4core: Use-after-free causes a resource leak in flow-steering detach
Hans Petter Selasky [Tue, 7 Jun 2022 14:27:53 +0000 (16:27 +0200)]
mlx4core: Use-after-free causes a resource leak in flow-steering detach

mlx4_QP_FLOW_STEERING_DETACH_wrapper first removes the steering
rule (which results in freeing the rule structure), and then
references a field in this struct (the qp number) when releasing the
busy-status on the rule's qp.

Since this memory was freed, it could reallocated and changed.
Therefore, the qp number in the struct may be incorrect,
so that we are releasing the incorrect qp. This leaves the rule's qp
in the busy state (and could possibly release an incorrect qp as well).

Fix this by saving the qp number in a local variable, for use after
removing the steering rule.

Linux commit:
3b01fe7f91c8e4f9afc4fae3c5af72c14958d2d8

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

2 years agoktls: Add full support for TLS RX offloading via network interface.
Hans Petter Selasky [Sat, 23 Apr 2022 08:11:18 +0000 (10:11 +0200)]
ktls: Add full support for TLS RX offloading via network interface.

Basic TLS RX offloading uses the "csum_flags" field in the mbuf packet
header to figure out if an incoming mbuf has been fully offloaded or
not. This information follows the packet stream via the LRO engine, IP
stack and finally to the TCP stack. The TCP stack preserves the mbuf
packet header also when re-assembling packets after packet loss. When
the mbuf goes into the socket buffer the packet header is demoted and
the offload information is transferred to "m_flags" . Later on a
worker thread will analyze the mbuf flags and decide if the mbufs
making up a TLS record indicate a fully-, partially- or not decrypted
TLS record. Based on these three cases the worker thread will either
pass the packet on as-is or recrypt the decrypted bits, if any, or
decrypt the packet as usual.

During packet loss the kernel TLS code will call back into the network
driver using the send tag, informing about the TCP starting sequence
number of every TLS record that is not fully decrypted by the network
interface. The network interface then stores this information in a
compressed table and starts asking the hardware if it has found a
valid TLS header in the TCP data payload. If the hardware has found a
valid TLS header and the referred TLS header is at a valid TCP
sequence number according to the TCP sequence numbers provided by the
kernel TLS code, the network driver then informs the hardware that it
can resume decryption.

Care has been taken to not merge encrypted and decrypted mbuf chains,
in the LRO engine and when appending mbufs to the socket buffer.

The mbuf's leaf network interface pointer is used to figure out from
which network interface the offloading rule should be allocated. Also
this pointer is used to track route changes.

Currently mbuf send tags are used in both transmit and receive
direction, due to convenience, but may get a new name in the future to
better reflect their usage.

Reviewed by: jhb@ and gallatin@
Differential revision: https://reviews.freebsd.org/D32356
Sponsored by: NVIDIA Networking

2 years agoktls: Refer send tag pointer once.
Hans Petter Selasky [Wed, 25 May 2022 12:16:27 +0000 (14:16 +0200)]
ktls: Refer send tag pointer once.

So that the asserts and the actual code see the same values.

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

2 years agomlx5en(4): Set the leaf network interface field in the mbuf packet header.
Hans Petter Selasky [Wed, 25 May 2022 12:10:27 +0000 (14:10 +0200)]
mlx5en(4): Set the leaf network interface field in the mbuf packet header.

This will be used for TLS RX.

Submitted by: jhb@
Differential revision: https://reviews.freebsd.org/D32356
Sponsored by: NVIDIA Networking

2 years agombuf(9): Implement a leaf network interface field in the mbuf packet header.
Hans Petter Selasky [Wed, 25 May 2022 12:08:50 +0000 (14:08 +0200)]
mbuf(9): Implement a leaf network interface field in the mbuf packet header.

When packets are received they may traverse several network interfaces like
vlan(4) and lagg(9). When doing receive side offloads it is important to
know the first network interface entry point, because that is where all
offloading is taking place. This makes it possible to track receive
side route changes for multiport setups, for example when lagg(9) receives
traffic from more than one port. This avoids having to install multiple
offloading rules for the same stream.

This field works similar to the existing "rcvif" mbuf packet header field.

Submitted by: jhb@
Reviewed by: gallatin@ and gnn@
Differential revision: https://reviews.freebsd.org/D35339
Sponsored by: NVIDIA Networking
Sponsored by: Netflix

2 years agovlan(4): Add support for allocating TLS receive tags.
Hans Petter Selasky [Wed, 25 May 2022 10:39:56 +0000 (12:39 +0200)]
vlan(4): Add support for allocating TLS receive tags.

The TLS receive tags are allocated directly from the receiving interface,
because mbufs are flowing in the opposite direction and then route change
checks are not useful, because they only work for outgoing traffic.

Differential revision: https://reviews.freebsd.org/D32356
Sponsored by: NVIDIA Networking

2 years agolagg(4): Add support for allocating TLS receive tags.
Hans Petter Selasky [Wed, 25 May 2022 10:38:30 +0000 (12:38 +0200)]
lagg(4): Add support for allocating TLS receive tags.

The TLS receive tags are allocated directly from the receiving interface,
because mbufs are flowing in the opposite direction and then route change
checks are not useful, because they only work for outgoing traffic.

Differential revision: https://reviews.freebsd.org/D32356
Sponsored by: NVIDIA Networking

2 years agoxen/blkback: remove bounce buffering mode
Roger Pau Monné [Tue, 12 Apr 2022 14:17:09 +0000 (16:17 +0200)]
xen/blkback: remove bounce buffering mode

Remove bounce buffering code for blkback and only attach if Xen
creates IOMMU entries for grant mapped pages.

Such bounce buffering consumed a non trivial amount of memory and CPU
resources to do the memory copy, when it's been a long time since Xen
has been creating IOMMU entries for grant maps.

Refuse to attach blkback if Xen doesn't advertise that IOMMU entries
are created for grant maps.

Sponsored by: Citrix Systems R&D

2 years agoxen/blkback: fix tear-down issues
Roger Pau Monné [Sun, 27 Mar 2022 08:43:42 +0000 (10:43 +0200)]
xen/blkback: fix tear-down issues

Handle tearing down a blkback that hasn't been fully initialized. This
requires carefully checking that fields are allocated before trying to
access them.  Also communication memory is allocated before setting
XBBF_RING_CONNECTED, so gating it's freeing on XBBF_RING_CONNECTED
being set is wrong and will lead to memory leaks.

Also stop using xbb_disconnect() in error paths. Use xenbus_dev_fatal
and let the normal disconnection procedure take care of the cleanup.

Reported by: Ze Dupsys <zedupsys@gmail.com>
Sponsored by: Citrix Systems R&D

2 years agoxenbus: improve device tracking
Roger Pau Monné [Mon, 21 Mar 2022 11:47:20 +0000 (12:47 +0100)]
xenbus: improve device tracking

xenbus needs to keep track of the devices exposed on xenstore, so that
it can trigger frontend and backend device creation.

Removal of backend devices is currently detected by checking the
existence of the device (backend) xenstore directory, but that's prone
to races as the device driver would usually add entries to such
directory itself, so under certain circumstances it's possible for a
driver to add node to the directory after the toolstack has removed
it.  This leads to devices not removed, which can eventually exhaust
the memory of FreeBSD.

Fix this by checking for the existence of the 'state' node instead of
the directory, as such node will always be present when a device is
active, and will be removed by the toolstack when the device is shut
down.  In order to avoid any races with the updating of the 'state'
node by FreeBSD and the toolstack removing it use a transaction in
xenbusb_write_ivar() for that purpose.

Reported by: Ze Dupsys <zedupsys@gmail.com>
Sponsored by: Citrix Systems R&D

2 years agotcp: Sanity check of SACK holes on retransmissions
Richard Scheffenegger [Tue, 7 Jun 2022 07:07:09 +0000 (09:07 +0200)]
tcp: Sanity check of SACK holes on retransmissions

Adding a few KASSERT() to validate sanity of sack holes, and
bail out if sack hole is inconsistent to avoid panicing non-invariant builds.

Reviewed By: hselasky, glebius
PR: 263445
MFC after: 1 week
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D35387

2 years agohwpmc: Increase thread priority while iterating CPUs.
Alexander Motin [Tue, 7 Jun 2022 02:36:16 +0000 (22:36 -0400)]
hwpmc: Increase thread priority while iterating CPUs.

This allows to profile already running high-priority threads, that
otherwise by blocking thread migration to respective CPUs blocked PMC
management, i.e. profiling could start only when workload completed.

While there, return the thread to its original CPU after iterating
the list.  Otherwise all threads using PMC end up on the last CPU.

MFC after: 1 month

2 years agoalc: force maximum payload size to 128 bytes for AR816X/AR817x
Kyle Evans [Tue, 7 Jun 2022 01:52:55 +0000 (20:52 -0500)]
alc: force maximum payload size to 128 bytes for AR816X/AR817x

Otherwise, we'll trigger a DMA write error and render the device
unusable.

Obtained from: OpenBSD (via Haiku, waddlesplash)
MFC after: 3 days

2 years agogcore: Don't hardcode VM write permissions.
John Baldwin [Mon, 6 Jun 2022 23:43:02 +0000 (16:43 -0700)]
gcore: Don't hardcode VM write permissions.

This ensures read-only PT_LOAD segments are not marked as writable in
the phdr flags.

Reviewed by: markj
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D35398

2 years agoiommu_gas: restrict tree search to promising paths
Doug Moore [Mon, 6 Jun 2022 21:26:01 +0000 (16:26 -0500)]
iommu_gas: restrict tree search to promising paths

In iommu_gas_lowermatch and iommu_gas_uppermatch, a subtree search is
quickly terminated if the largest available free space in the subtree
is below a limit, where that limit is related to the size of the
allocation request. However, that limit is too small; it does not
account for both of the guard pages that will surround the allocated
space, but only for one of them. Consequently, it permits the search
to proceed through nodes that cannot produce a successful allocation
for all the requested space. Fix that limit to improve search
performance.

Reviewed by: alc, kib
Submitted by: Weixi Zhu (wxzhu@rice.edu)
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35414

2 years agofdescfs: allow chown/utime etc on fdescfs fd for underlying files opened with O_PATH
Konstantin Belousov [Sun, 5 Jun 2022 18:49:09 +0000 (21:49 +0300)]
fdescfs: allow chown/utime etc on fdescfs fd for underlying files opened with O_PATH

Reported and tested by: dchagin
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D35410

2 years agobsddialog(3): Fix text wrapping
Alfonso S. Siciliano [Mon, 6 Jun 2022 19:07:03 +0000 (21:07 +0200)]
bsddialog(3): Fix text wrapping

Fix text wrapping with more than 1024 words.

Reported by: brd
Reviewed by: bapt, brd
Differential Revision: https://reviews.freebsd.org/D35413

2 years agogcore: Remove unused elf_note_arm_vfp function.
John Baldwin [Mon, 6 Jun 2022 18:06:49 +0000 (11:06 -0700)]
gcore: Remove unused elf_note_arm_vfp function.

Fixes: add00c381e5c Use a regset for NT_ARM_VFP.

2 years agounix/*: rewrite unp_internalize() cmsg parsing cycle
Gleb Smirnoff [Mon, 6 Jun 2022 17:05:28 +0000 (10:05 -0700)]
unix/*: rewrite unp_internalize() cmsg parsing cycle

Make it a complex, but a single for(;;) statement.  The previous cycle
with some loop logic in the beginning and some loop logic at the end
was confusing.  Both me and markj@ were misleaded to a conclusion that
some checks are unnecessary, while they actually were necessary.

While here, handle an edge case found by Mark, when on 64-bit platform
an incorrect message from userland would underflow length counter, but
return without any error.  Provide a test case for such message.

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

2 years agosmp: Use local copies of the setup function pointer and argument
Yuichiro NAITO [Mon, 6 Jun 2022 15:21:33 +0000 (11:21 -0400)]
smp: Use local copies of the setup function pointer and argument

No functional change intended.

PR: 264383
Reviewed by: jhb, markj
MFC after: 1 week

2 years agoarm64: Print per-CPU cache summary
Justin Hibbits [Tue, 31 May 2022 15:40:20 +0000 (10:40 -0500)]
arm64: Print per-CPU cache summary

Summary:
It can be useful to see a summary of CPU caches on bootup.  This is done
for most platforms already, so add this to arm64, in the form of (taken
from Apple M1 pro test):

  L1 cache: 192KB (instruction), 128KB (data)
  L2 cache: 12288KB (unified)

This is printed out per-CPU, only under bootverbose.

Future refinements could instead determine if a cache level is shared
with other cores (L2 is shared among cores on some SoCs, for instance),
and perform a better calculation to the full true cache sizes.  For
instance, it's known that the M1 pro, on which this test was done, has 2
12MB L2 clusters, for a total of 24MB.  Seeing each CPU with 12288KB L2
would make one think that there's 12MB * NCPUs, for possibly 120MB
cache, which is incorrect.

Sponsored by: Juniper Networks, Inc.
Reviewed by: #arm64, andrew
Differential Revision: https://reviews.freebsd.org/D35366

2 years agobsdinstall/scripts/docsinstall: Add Indonesian Documentation
Marc Fonvieille [Mon, 6 Jun 2022 11:40:56 +0000 (13:40 +0200)]
bsdinstall/scripts/docsinstall: Add Indonesian Documentation

Add Indonesian Documentation to docinstall menu.

Approved by: doceng (implicit) re (gjb, implicit)
MFC after: 1 week

2 years agoLinuxKPI: Fix dmi_matches() function
Hans Petter Selasky [Mon, 6 Jun 2022 08:23:23 +0000 (10:23 +0200)]
LinuxKPI: Fix dmi_matches() function

Make sure to check for NULL pointers and also check all search criterias,
not only the first one!

Bump the FreeBSD version.

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

2 years agoixgbe(4): Fix common typos in source code comments
Gordon Bergling [Mon, 6 Jun 2022 05:28:56 +0000 (07:28 +0200)]
ixgbe(4): Fix common typos in source code comments

- s/filer/filter/

Obtained from: NetBSD
MFC after: 3 days

2 years agofirewire.4: Fix typo
PauAmma [Mon, 6 Jun 2022 03:52:34 +0000 (23:52 -0400)]
firewire.4: Fix typo

While there, replace dead wiki URL with dev handbook one and fix markup.

Reviewed by: gbe
Differential Revision: https://reviews.freebsd.org/D35252

2 years agobsdinstall: allow overriding DISTRIBUTIONS in the normal auto mode
Brad Davis [Mon, 6 Jun 2022 01:04:04 +0000 (19:04 -0600)]
bsdinstall: allow overriding DISTRIBUTIONS in the normal auto mode

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

2 years agoLinuxKPI: 802.11: plug a ni leak in lkpi_sta_assoc_to_run()
Bjoern A. Zeeb [Sun, 5 Jun 2022 21:10:01 +0000 (21:10 +0000)]
LinuxKPI: 802.11: plug a ni leak in lkpi_sta_assoc_to_run()

In lkpi_sta_assoc_to_run() we are going through some code segments
twice (auth->assoc, assoc->authorized).  The 2nd time we shall not
re-gain a reference on the net80211 node as otherwise it'll leak.
Likewise we do not have to re-set lsta and sta.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoAdd more old clang files to (Optional)ObsoleteFiles.inc
Dimitry Andric [Sun, 5 Jun 2022 20:45:37 +0000 (22:45 +0200)]
Add more old clang files to (Optional)ObsoleteFiles.inc

There were a few more libclang_rt libraries added recently, but not yet
listed in the ObsoleteFiles.inc lists.

MFC after: 3 days

2 years agortw88: plug various skb leaks in error cases
Bjoern A. Zeeb [Sun, 5 Jun 2022 18:07:48 +0000 (18:07 +0000)]
rtw88: plug various skb leaks in error cases

Based on manual inspection the skbs are not freed in those unlikely
cases, though all would give an error message so would have gone noticed
if happened.
While here fix a typo in one of these error messages.

MFC after: 3 days

2 years agoLinuxKPI: 802.11 plug mbuf leak in error cases
Bjoern A. Zeeb [Sun, 5 Jun 2022 18:04:57 +0000 (18:04 +0000)]
LinuxKPI: 802.11 plug mbuf leak in error cases

Manually free the mbuf in certain error cases from net80211 to not
leak it.
Note that the differences between ieee80211_input_mimo() and
ieee80211_input_mimo_all(), the former not consuming the mbuf while
the later does, is confusing.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoif_qlxge: fix stand-alone module build
Eugene Grosbein [Sun, 5 Jun 2022 18:05:02 +0000 (01:05 +0700)]
if_qlxge: fix stand-alone module build

Fix module build outside of kernel build environment.

MFC after: 3 days

2 years agoif_glxgbe: fix stand-alone module build
Eugene Grosbein [Sun, 5 Jun 2022 17:59:46 +0000 (00:59 +0700)]
if_glxgbe: fix stand-alone module build

Fix module build outside of kernel build environment.

MFC after: 3 days

2 years agoif_glxgb: fix stand-alone module build
Eugene Grosbein [Sun, 5 Jun 2022 17:54:50 +0000 (00:54 +0700)]
if_glxgb: fix stand-alone module build

Fix module build outside of kernel build environment.

MFC after: 3 days

2 years agoUpdate rest of llvm-project build glue for 14.0.4
Dimitry Andric [Sun, 5 Jun 2022 16:39:43 +0000 (18:39 +0200)]
Update rest of llvm-project build glue for 14.0.4

I completely forgot about updating the generated llvm-project config
files, which also contain version numbers, etc. Sorry for the churn.

PR: 261742
Fixes: ab9d54731f43
MFC after: 3 days

2 years agoqlxgbe(4): Fix a common typo in a source code comment
Gordon Bergling [Sun, 5 Jun 2022 07:56:29 +0000 (09:56 +0200)]
qlxgbe(4): Fix a common typo in a source code comment

- s/independant/independent/

MFC after: 3 days

2 years agotwe(4): Fix a common typo in a source code comment
Gordon Bergling [Sun, 5 Jun 2022 07:55:25 +0000 (09:55 +0200)]
twe(4): Fix a common typo in a source code comment

- s/independant/independent/

MFC after: 3 days

2 years agoffec: Fix a common typo in a source code comment
Gordon Bergling [Sun, 5 Jun 2022 07:54:39 +0000 (09:54 +0200)]
ffec: Fix a common typo in a source code comment

- s/independant/independent/

MFC after: 3 days

2 years agomlx(4): Fix a common typo in a source code comment
Gordon Bergling [Sun, 5 Jun 2022 07:53:59 +0000 (09:53 +0200)]
mlx(4): Fix a common typo in a source code comment

- s/independant/independent/

MFC after: 3 days

2 years agolibgssapi: Fix a common typo in a source code comment
Gordon Bergling [Sun, 5 Jun 2022 07:53:24 +0000 (09:53 +0200)]
libgssapi: Fix a common typo in a source code comment

- s/independant/independent/

MFC after: 3 days

2 years agovm: Fix a common typo in a source code comment
Gordon Bergling [Sun, 5 Jun 2022 07:52:32 +0000 (09:52 +0200)]
vm: Fix a common typo in a source code comment

- s/independant/independent/

MFC after: 3 days

2 years agonlist(3): Fix a common typo in a source code comment
Gordon Bergling [Sun, 5 Jun 2022 07:51:57 +0000 (09:51 +0200)]
nlist(3): Fix a common typo in a source code comment

- s/independant/independent/

MFC after: 3 days

2 years agogeom(4): Fix a common typo in a source code comment
Gordon Bergling [Sun, 5 Jun 2022 07:51:10 +0000 (09:51 +0200)]
geom(4): Fix a common typo in a source code comment

- s/independant/independent/

MFC after: 3 days

2 years agostand: Fix a common typo in source code comments
Gordon Bergling [Sun, 5 Jun 2022 07:49:51 +0000 (09:49 +0200)]
stand: Fix a common typo in source code comments

- s/independant/independent/

MFC after: 3 days

2 years agoqlnxe(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 5 Jun 2022 07:15:33 +0000 (09:15 +0200)]
qlnxe(4): Fix a typo in a source code comment

- s/indepent/independent/

MFC after: 3 days

2 years agoif_age(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 5 Jun 2022 07:14:17 +0000 (09:14 +0200)]
if_age(4): Fix a typo in a source code comment

- s/indepent/independent/

MFC after: 3 days

2 years agolibkern: Fix a typo in a source code comment
Gordon Bergling [Sun, 5 Jun 2022 06:57:26 +0000 (08:57 +0200)]
libkern: Fix a typo in a source code comment

- s/involes/involves/

Obtained from: NetBSD
MFC after: 3 days

2 years agompt(4): Fix two typos in debug statements
Gordon Bergling [Sat, 4 Jun 2022 18:41:15 +0000 (20:41 +0200)]
mpt(4): Fix two typos in debug statements

- s/Intermidiate/Intermediate/

Obtained from: NetBSD
MFC after:i 3 days

2 years agonvmecontrol(8): Fix a typo in an error message
Gordon Bergling [Sat, 4 Jun 2022 18:30:48 +0000 (20:30 +0200)]
nvmecontrol(8): Fix a typo in an error message

- s/insufficent/insufficient/

MFC after: 3 days

2 years agosed(1): Fix a typo in a source code comment
Gordon Bergling [Sat, 4 Jun 2022 18:27:45 +0000 (20:27 +0200)]
sed(1): Fix a typo in a source code comment

- s/Initialy/Initially/

Obtained from: NetBSD
MFC after: 3 days

2 years agokthread(9): Add a missing space
Gordon Bergling [Sat, 4 Jun 2022 18:15:07 +0000 (20:15 +0200)]
kthread(9): Add a missing space

- s/inthe/in the/

MFC after: 3 days

2 years agopowerpc: Fix a typo in a comment
Gordon Bergling [Sat, 4 Jun 2022 17:55:03 +0000 (19:55 +0200)]
powerpc: Fix a typo in a comment

- s/layed/laid/

MFC after: 3 days

2 years agousbhid(3): Fix a typo in the manual page
Gordon Bergling [Sat, 4 Jun 2022 17:54:25 +0000 (19:54 +0200)]
usbhid(3): Fix a typo in the manual page

- s/layed/laid/

MFC after: 3 days

2 years agoiwlwifi: disable more MEI (Management Engine) code
Bjoern A. Zeeb [Sat, 4 Jun 2022 16:18:58 +0000 (16:18 +0000)]
iwlwifi: disable more MEI (Management Engine) code

It is unclear why this hasn't bothered anyone in months; I can only assume
optimization levels but it seems there were unresolved symbols in
iwlwifi after d9836fb4b9380e2ed1c38455fb31a3832b452671:
link_elf_obj: symbol iwl_mvm_send_roaming_forbidden_event undefined

Hide more of the currently unsupported (GPL-only) MEI (Management Engine)
code behind #ifdef to avoid this.

Reported by: dchagin
Tested by: dchagin
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoipfw: add support radix tables and table lookup for MAC addresses
Arseny Smalyuk [Sat, 4 Jun 2022 16:12:29 +0000 (19:12 +0300)]
ipfw: add support radix tables and table lookup for MAC addresses

By analogy with IP address matching, add a way to use ipfw radix
tables for MAC matching. This is implemented using new ipfw table
with mac:radix type. Also there are src-mac and dst-mac lookup
commands added.

Usage example:
  ipfw table 1 create type mac
  ipfw table 1 add 11:22:33:44:55:66/48
  ipfw add skipto tablearg src-mac 'table(1)'
  ipfw add deny src-mac 'table(1, 100)'
  ipfw add deny lookup dst-mac 1

Note: sysctl net.link.ether.ipfw=1 should be set to enable ipfw
filtering on L2.

Reviewed by: melifaro
Obtained from: Yandex LLC
MFC after: 1 month
Relnotes: yes
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D35103

2 years agorack: Fix a common typo in comments and a sysctl description
Gordon Bergling [Sat, 4 Jun 2022 15:56:56 +0000 (17:56 +0200)]
rack: Fix a common typo in comments and a sysctl description

- s/multipler/multiplier/

MFC after: 3 days

2 years agoena(4): Fix a typo in a source code comment
Gordon Bergling [Sat, 4 Jun 2022 15:17:04 +0000 (17:17 +0200)]
ena(4): Fix a typo in a source code comment

- s/entred/entered/

MFC after: 3 days

2 years agoif_sis(4): Fix a typo in a source code comment
Gordon Bergling [Sat, 4 Jun 2022 14:56:18 +0000 (16:56 +0200)]
if_sis(4): Fix a typo in a source code comment

- s/emperical/empirical/

MFC after: 3 days

2 years agoaic7xxx: Fix a few typos in comments and an error message
Gordon Bergling [Sat, 4 Jun 2022 14:49:53 +0000 (16:49 +0200)]
aic7xxx: Fix a few typos in comments and an error message

- s/directrive/directive/
- s/specifiled/specified/
- s/Decend/Descend/
- s/tranversal/transversal/

Obtained from: NetBSD
MFC after: 3 days

2 years agoal_eth: Fix a typo in a source code comment
Gordon Bergling [Sat, 4 Jun 2022 13:33:36 +0000 (15:33 +0200)]
al_eth: Fix a typo in a source code comment

- s/enought/enough/

MFC after: 3 days

2 years agorack: Fix a typo in a source code comment
Gordon Bergling [Sat, 4 Jun 2022 13:32:59 +0000 (15:32 +0200)]
rack: Fix a typo in a source code comment

- s/enought/enough/

MFC after: 3 days

2 years agoufs: Fix a typo a source code comment
Gordon Bergling [Sat, 4 Jun 2022 13:23:53 +0000 (15:23 +0200)]
ufs: Fix a typo a source code comment

- s/droped/dropped/

MFC after: 3 days