]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
9 months agoamd64: Add a leaf PTP when pmap_enter(psind=1) creates a wired mapping
Bojan Novković [Fri, 15 Sep 2023 10:41:10 +0000 (12:41 +0200)]
amd64: Add a leaf PTP when pmap_enter(psind=1) creates a wired mapping

This patch reverts the changes made in D19670 and fixes the original
issue by allocating and prepopulating a leaf page table page for wired
userspace 2M pages.

The original issue is an edge case that creates an unmapped, wired
region in userspace. Subsequent faults on this region can trigger wired
superpage creation, which leads to a panic in pmap_demote_pde_locked()
as the pmap does not create a leaf page table page for the wired
superpage. D19670 fixed this by disallowing preemptive creation of
wired superpage mappings, but that fix is currently interfering with an
ongoing effort of speeding up vm_map_wire for large, contiguous entries
(e.g. bhyve wiring guest memory).

Reviewed by: alc, markj
Sponsored by: Google, Inc. (GSoC 2023)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D41132

9 months agolib/libc/tests/string/strcspn_test.c: extend tests to catch previous bug
Robert Clausecker [Tue, 12 Sep 2023 02:48:58 +0000 (22:48 -0400)]
lib/libc/tests/string/strcspn_test.c: extend tests to catch previous bug

This extends the strcspn() unit tests to catch mistakes in the
implementation that only appear when a mismatch occurs in a certain
position of the string against a certain position of the set.

See also: 52d4a4d4e0dedc72bc33082a3f84c2d0fd6f2cbb
Sponsored by: The FreeBSD Foundation
Approved by: imp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D41821

9 months agovfs: count how many times vnlru got woken up due to vnode shortage
Mateusz Guzik [Sat, 16 Sep 2023 17:26:39 +0000 (17:26 +0000)]
vfs: count how many times vnlru got woken up due to vnode shortage

9 months agolibcrypto: link engines and the legacy provider to libcrypto
Pierre Pronchery [Fri, 15 Sep 2023 15:14:16 +0000 (17:14 +0200)]
libcrypto: link engines and the legacy provider to libcrypto

OpenSSL's legacy provider module and engines need to link to
libcrypto.so, as it provides some of the actual implementations of
legacy routines.

This is a little tricky due to build order issues.  Introduce a small
hack (LIBCRYPTO_WITHOUT_SUBDIRS) that builds libcrypto.so in its usual
early phase without any OpenSSL provider modules or engines.  This is
intended to restore the test suite; a future change should remove the
hack and replace it with a better approach.

PR: 254853, 273528
Discussed with: Folks at EuroBSDCon in Coimbra
Sponsored by: The FreeBSD Foundation

9 months agovfs: stabilize freevnodes_old
Mateusz Guzik [Sat, 16 Sep 2023 15:41:12 +0000 (15:41 +0000)]
vfs: stabilize freevnodes_old

In face of parallel callers.

9 months agoAdd WITHOUT_MANSPLITPKG description
Ed Maste [Sat, 16 Sep 2023 15:28:28 +0000 (16:28 +0100)]
Add WITHOUT_MANSPLITPKG description

Fixes: 74da9c39c346 ("pkgbase: Split out manpages by default")
Sponsored by: The FreeBSD Foundation

9 months agozfs: retire z_nr_znodes
Mateusz Guzik [Sat, 16 Sep 2023 14:18:05 +0000 (14:18 +0000)]
zfs: retire z_nr_znodes

It is not needed and is going away soon(tm), facilitating other changes.

See https://github.com/openzfs/zfs/pull/15274

9 months agounix tests: Use the right type for sendmsg(2) return values
Mark Johnston [Fri, 15 Sep 2023 08:59:08 +0000 (04:59 -0400)]
unix tests: Use the right type for sendmsg(2) return values

MFC after: 1 week

9 months agosocket tests: Add a regression test for MSG_WAITALL
Mark Johnston [Thu, 31 Aug 2023 17:29:29 +0000 (13:29 -0400)]
socket tests: Add a regression test for MSG_WAITALL

PR: 212716
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

9 months agosockets: re-check socket state after call to pr_rcvd()
Greg Becker [Sat, 9 Sep 2023 23:38:24 +0000 (18:38 -0500)]
sockets: re-check socket state after call to pr_rcvd()

Socket state may have changed after dropping the receive
buffer lock in order to call pr_rcvd().  If the buffer is
empty, re-check the state after reaquiring the lock and
skip calling sbwait() if the socket is in error or the
peer has closed.

PR: 212716
Reviewed by: markj, glebius
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41783

9 months agovfs: s/u_long vstir/bool vstir/
Mateusz Guzik [Sat, 16 Sep 2023 08:19:24 +0000 (08:19 +0000)]
vfs: s/u_long vstir/bool vstir/

9 months agoObsoleteFiles: cleanup old libclang_rt files for powerpc64le
Dimitry Andric [Sat, 16 Sep 2023 07:47:19 +0000 (09:47 +0200)]
ObsoleteFiles: cleanup old libclang_rt files for powerpc64le

PR: 273776
MFC after: 3 days

9 months agovfs: group vnode-related sysctls under vfs.vnode
Mateusz Guzik [Fri, 15 Sep 2023 21:08:38 +0000 (21:08 +0000)]
vfs: group vnode-related sysctls under vfs.vnode

Instead of having things scattered through vfs, debug and kern trees.

Old names remain for compatibility.

Sample output of "sysctl vfs.vnode":
vfs.vnode.vnlru.failed_runs: 0
vfs.vnode.vnlru.recycles_free: 0
vfs.vnode.vnlru.recycles: 0
vfs.vnode.stats.alloc_sleeps: 0
vfs.vnode.stats.free: 1310
vfs.vnode.stats.skipped_requeues: 0
vfs.vnode.stats.created: 1686
vfs.vnode.stats.count: 1641
vfs.vnode.param.wantfree: 2097152
vfs.vnode.param.limit: 8388608

9 months agovfs: retire kern.minvnodes
Mateusz Guzik [Sat, 16 Sep 2023 07:33:36 +0000 (07:33 +0000)]
vfs: retire kern.minvnodes

It was marked as legacy in 2005.

9 months agolib/libc/amd64/string/memcmp.S: harden against phony buffer lengths
Robert Clausecker [Thu, 14 Sep 2023 05:19:01 +0000 (01:19 -0400)]
lib/libc/amd64/string/memcmp.S: harden against phony buffer lengths

When memcmp(a, b, len) (or equally, bcmp) is called with a phony length
such that a + len < a, the code would malfunction and not compare the
two buffers correctly.  While such arguments are illegal (buffers do not
wrap around the end of the address space), it is neverthless conceivable
that people try things like memcmp(a, b, SIZE_MAX) to compare a and b
until the first mismatch, in the knowledge that such a mismatch exists,
expecting memcmp() to stop comparing somewhere around the mismatch.
While memcmp() is usually written to confirm to this assumption, no
version of ISO/IEC 9899 guarantees this behaviour (in contrast to
memchr() for which it is).

Neverthless it appears sensible to at least not grossly misbehave on
phony lengths.  This change hardens memcmp() against this case by
comparing at least until the end of the address space if a + len
overflows a 64 bit integer.

Sponsored by: The FreeBSD Foundation
Approved by: mjg (blanket, via IRC)
See also: b2618b651b28fd29e62a4e285f5be09ea30a85d4
MFC after: 1 week

9 months agotcpdump: Initialize tzcode early.
Dag-Erling Smørgrav [Fri, 15 Sep 2023 21:36:41 +0000 (23:36 +0200)]
tcpdump: Initialize tzcode early.

An explicit tzset() call is usually not needed as it happens implicitly
the first time we call localtime() or mktime(), but in some cases
(sandboxing, chroot) this may be too late.

PR: 273807
MFC after: 3 days
Reviewed by: jrm
Differential Revision: https://reviews.freebsd.org/D41880

9 months agortld: output rtld errors into the dbg channel
Konstantin Belousov [Fri, 15 Sep 2023 19:26:50 +0000 (22:26 +0300)]
rtld: output rtld errors into the dbg channel

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

9 months agokinst: do not look for a function epilogue
Christos Margiolis [Fri, 15 Sep 2023 15:33:41 +0000 (16:33 +0100)]
kinst: do not look for a function epilogue

kinst currently only traces functions that start and end with the usual
function prologue and epilogue respectively. Ignoring functions that do
not have an epilogue however, makes the filtering too strict, as this
means that we can not trace functions that never return (e.g
vnlru_proc()). This patch relaxes the filtering and only checks whether
the function pushes the frame pointer.

Reviewed by: markj
Approved by: markj
Differential Revision: https://reviews.freebsd.org/D41876

9 months agovfs: use vnlru_read_freevnodes for the freevnodes sysctl
Mateusz Guzik [Thu, 14 Sep 2023 23:53:11 +0000 (23:53 +0000)]
vfs: use vnlru_read_freevnodes for the freevnodes sysctl

For a more accurate result.

9 months agovfs: retire vnlru_under_unlocked
Mateusz Guzik [Thu, 14 Sep 2023 23:05:51 +0000 (23:05 +0000)]
vfs: retire vnlru_under_unlocked

It only looks at the centralized value which in corner cases can end up
being negative.

9 months agoLinuxKPI: 802.11: fix counting the number of supbands
Bjoern A. Zeeb [Thu, 14 Sep 2023 17:57:53 +0000 (17:57 +0000)]
LinuxKPI: 802.11: fix counting the number of supbands

While the main purpose was to assign an(y) early chandef with the
loop, later additions made use of it to also count supbands as well
as to initialise max_rates.
Due to the main goal we can exit the loop early and not properly
count and initialise supbands and max_rates.
Move the terminating condition into the loop and make it a continue
rather than ending the loop.

Fixes: d9945d7821b9b ("improve hw_scan")
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

9 months agoLinuxKPI: 802.11: make sure bssid for scans (probe_req) is set
Bjoern A. Zeeb [Thu, 14 Sep 2023 17:48:19 +0000 (17:48 +0000)]
LinuxKPI: 802.11: make sure bssid for scans (probe_req) is set

In b0f73768220e9 we added bssid[] to struct cfg80211_scan_request
likely while working on mt76 and did not need it (yet) back then.
iwlwifi started to use the field in Linux f1fec51cda70f (April 2023).
Without it set firmware crashes when trying to send probe requests
((empty) SSID also given to hw_scan).
For now always set the field to the wildcard BSSID.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

9 months agonet80211: improve scan debugging
Bjoern A. Zeeb [Thu, 14 Sep 2023 17:36:29 +0000 (17:36 +0000)]
net80211: improve scan debugging

While debugging other problems I ran into the case where net80211
was thinking a scan was ongoing and new scans could not be started
but given other logging there was clearly no more scan running.
It was hard after the fact to quickly determine enough state to
reconstruct or validate assumptions.

Improve a MSG_SCAN debug logging and implement _db_show_scan() ddb
output which can be printed along with show com /S or /a.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

9 months agonet80211: mark argument to scan_curchan_task() __unused
Bjoern A. Zeeb [Thu, 14 Sep 2023 17:34:01 +0000 (17:34 +0000)]
net80211: mark argument to scan_curchan_task() __unused

Mostly as documentation mark an unused argument to scan_curchan_task()
as __unused.  We may possibly want to check all callers in the future
and see if the argument was supposed to be useful or should be entirely
removed.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

9 months agoiwlwifi: fix a bug in iwl_ssid_exist()
Bjoern A. Zeeb [Thu, 14 Sep 2023 17:22:04 +0000 (17:22 +0000)]
iwlwifi: fix a bug in iwl_ssid_exist()

Rather than always comparing a given SSID to the first SSID of the
IE list, compare it to the the iterator one.  That way duplicates can
be found.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

9 months agovfs cache: garbage collect the fullpathfail2 counter
Mateusz Guzik [Thu, 14 Sep 2023 20:25:54 +0000 (20:25 +0000)]
vfs cache: garbage collect the fullpathfail2 counter

The conditions it checks cannot legally be true (modulo races against
forced unmount), so assert on it instead.

9 months agovfs: fix stale comment about freevnodes management
Mateusz Guzik [Thu, 14 Sep 2023 17:28:32 +0000 (17:28 +0000)]
vfs: fix stale comment about freevnodes management

9 months agovfs: don't kick vnlru if it is already running
Mateusz Guzik [Thu, 14 Sep 2023 16:27:47 +0000 (16:27 +0000)]
vfs: don't kick vnlru if it is already running

Further shaves some lock trips.

9 months agoObsoleteFiles: cleanup old libclang_rt files for powerpc64
Dimitry Andric [Thu, 14 Sep 2023 16:39:31 +0000 (18:39 +0200)]
ObsoleteFiles: cleanup old libclang_rt files for powerpc64

PR:             273776
MFC after:      3 days

9 months agoFix typo in VERIEXEC_VERIFIED_FILE
Simon J. Gerraty [Thu, 14 Sep 2023 16:31:31 +0000 (09:31 -0700)]
Fix typo in VERIEXEC_VERIFIED_FILE

Reviewed by: stevek

9 months agopkgbase: Split out manpages by default
Doug Rabson [Thu, 14 Sep 2023 14:38:07 +0000 (15:38 +0100)]
pkgbase: Split out manpages by default

This helps with building small container images using pkgbase.

Reviewed by: manu bapt
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41861

9 months agox86: Add defines for workaround bits in AMD's MSR "Decode Configuration"
Olivier Certner [Mon, 11 Sep 2023 13:10:35 +0000 (15:10 +0200)]
x86: Add defines for workaround bits in AMD's MSR "Decode Configuration"

They are a bit more informative than raw hexadecimal values.

While here, sort existing defines of bits for AMD MSRs to match the address
order.

Reviewed by: kib, emaste
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41816

9 months agovfs: drop one vnode list lock trip during vnlru free recycle
Mateusz Guzik [Thu, 14 Sep 2023 14:35:40 +0000 (14:35 +0000)]
vfs: drop one vnode list lock trip during vnlru free recycle

vnlru_free_impl would take the lock prior to returning even though most
frequent caller does not need it.

Unsurprisingly vnode_list mtx is the primary bottleneck when recycling
and avoiding the useless lock trip helps.

Setting maxvnodes to 400000 and running 20 parallel finds each with a
dedicated directory tree of 1 million vnodes in total:
before: 4.50s user 1225.71s system 1979% cpu 1:02.14 total
after: 4.20s user 806.23s system 1973% cpu 41.059 total

That's 34% reduction in total real time.

With this the block *remains* the primary bottleneck when running on
ZFS.

9 months agomana: add lro and tso stat counters
Wei Hu [Thu, 14 Sep 2023 11:56:20 +0000 (11:56 +0000)]
mana: add lro and tso stat counters

Add a few stat counters for tso and lro.

MFC after: 3 days
Sponsored by: Microsoft

9 months agoarp(8): fix by-interface and by-host filtering when using netlink
R. Christian McDonald [Thu, 14 Sep 2023 07:07:24 +0000 (09:07 +0200)]
arp(8): fix by-interface and by-host filtering when using netlink

arp(8) has traditionally supported filtering by interface via -i and
by hostname. However, this functionality was omitted from the initial
netlink-ification of arp. This patch re-introduces this filtering
functionality.

This patch also improves by-interface filtering by storing and using the
ifindex of the requested interface for filtering instead of comparing
interface name strings

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

9 months agocorrect FreeBSD release
Wolfram Schneider [Thu, 14 Sep 2023 10:10:35 +0000 (10:10 +0000)]
correct FreeBSD release

PR: 273690

9 months agopkgbase: put library links and symlinks in the -dev package
Doug Rabson [Wed, 13 Sep 2023 10:18:09 +0000 (11:18 +0100)]
pkgbase: put library links and symlinks in the -dev package

Some libraries (e.g. ncurses) install links to the main library for
backwards compatibilty. This change ensures that those links are in the
dev package since the files being linked to are in that package.

PR: 249143
MFC after: 1 week
Reviewed by: emaste, manu
Differential Revision: https://reviews.freebsd.org/D41841

9 months agoupdate homepage for FreeBSD Manual Pages
Wolfram Schneider [Thu, 14 Sep 2023 08:40:47 +0000 (08:40 +0000)]
update homepage for FreeBSD Manual Pages

9 months agoAvoid IPv6 source address selection on accepting TCP connections
Andrey V. Elsukov [Thu, 14 Sep 2023 08:39:06 +0000 (11:39 +0300)]
Avoid IPv6 source address selection on accepting TCP connections

When an application listens IPv6 TCP socket, due to ipfw
forwarding tag it may handle connections for addresses that do not
belongs to the jail or even current host (transparent proxy).
Syncache code can successfully handle TCP handshake for such connections.
When syncache finally accepts connection it uses in6_pcbconnect() to
properly initlize new connection info.

For IPv4 this scenario just works, but for IPv6 it fails when
local address doesn't belongs to the jail. This check occurs when
in6_pcbladdr() applies IPv6 SAS algorithm.
We need IPv6 SAS when we are connection initiator, but in the above
case connection is already established and both source and destination
addresses are known.

Use unused argument to notify in6_pcbconnect() when we don't need
source address selection. This will fix `ipfw fwd` to jailed IPv6
address.

When we are connection initiator, we stil use IPv6 SAS algorithm and
apply all related restrictions.

MFC after:              1 month
Sponsored by:           Yandex LLC
Differential Revision:  https://reviews.freebsd.org/D41685

9 months agocorrect FreeBSD release
Wolfram Schneider [Thu, 14 Sep 2023 08:03:05 +0000 (08:03 +0000)]
correct FreeBSD release
PR: 273690

9 months agoHyper-V: vmbus: implementat bus_get_dma_tag in vmbus
Souradeep Chakrabarti [Thu, 14 Sep 2023 07:11:25 +0000 (07:11 +0000)]
Hyper-V: vmbus: implementat bus_get_dma_tag in vmbus

In ARM64 Hyper-V UFS filesystem is getting corruption and those
corruptions are consistently happening just after hitting a page
boundary. It is unable to correctly read disk blocks into buffers
that are not aligned to 512-byte boundaries.

It happens because storvsc needs physically contiguous memory which
may not be the case when bus_dma needs to create a bounce buffer.
This can happen when the destination is not cache-line aligned.

Hyper-V VMs have VMbus synthetic devices and PCI pass-thru devices
that are added dynamically via the VMbus protocol and are not
represented in the ACPI DSDT. Only the top level VMbus node exists
in the DSDT. As such, on ARM64 these devices don't pick up coherence
information and default to not hardware coherent.

PR: 267654, 272666
Reviewed by: andrew, whu
Tested by: lwhsu
MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D41728

9 months agoice(4): Update to 1.38.16-k
Eric Joyner [Thu, 24 Aug 2023 23:26:13 +0000 (16:26 -0700)]
ice(4): Update to 1.38.16-k

New features
- Add sysctl "link_active_on_if_down" (defaults to 1 to match previous
behavior): set this to 0 to have the driver bring the physical link down when
the interface is brought administratively down
- Add sysctl "temp" to read chip temperature on E810 devices; this requires a
4.30 or newer NVM (see package sysutils/intel-nvmupdate-100g)

Bug fixes and general changes
- (linked to irdma) properly propagate PF reset request from irdma driver
- (linked to irdma) properly notify irdma of an impending PF reset
- (linked to irdma) move Protocol Engine error handling to irdma
- Print log message when using a DDP that doesn't support the "TX balancing"
mode
- Block LLDP agent configuration when DSCP QoS mode is enabled
- Fix kernel panic when updating NVM when adapter is in the "TX balancing" mode
- Remove ice_sbq_cmd.h since it's unused
- Fix LLDP RX filter to still allow LLDP frames to be received by SW after a PF
reset in SW LLDP mode
- Add ice_if_needs_restart handler in order to fix a bad VLAN and link down
interaction
- Issue PF reset during unload
- nvmupdate process fixes
- Use pci_msix_table_bar() to get MSI-X bar index at runtime instead of hardcoding it

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: anzhu@netapp.com
MFC after: 3 days
Sponsored by: Intel Corporation, NetApp
Differential Revision: https://reviews.freebsd.org/D41655

9 months agoirdma(4): remove artificial completion generator
Bartosz Sobczak [Tue, 12 Sep 2023 21:35:06 +0000 (14:35 -0700)]
irdma(4): remove artificial completion generator

Removing artificial completion generator as there had been no indication
of the code being required for E810 cards.  Further more it was found
that the code may have unpleasant side effects on user experience when
using ucmatose tool.

Signed-off-by: Bartosz Sobczak <bartosz.sobczak@intel.com>
Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: erj@
MFC after: 1 day
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D41593

9 months agoirdma(4): use related vnet for searching netdev
Bartosz Sobczak [Tue, 12 Sep 2023 21:31:39 +0000 (14:31 -0700)]
irdma(4): use related vnet for searching netdev

It was found through testing that when ULP uses individual vnet, the
search for the correct vlan_id may failing because of no proper
interface with given address.

The solution is to use vnet associated to the connection whenever
possible.

Signed-off-by: Bartosz Sobczak <bartosz.sobczak@intel.com>
Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: erj@
MFC after: 1 day
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D41592

9 months agoftpd: correct deprecation notice markup
Ed Maste [Wed, 13 Sep 2023 21:13:42 +0000 (22:13 +0100)]
ftpd: correct deprecation notice markup

Also bump .Dd for the original change.

Reported by: karels
Fixes: 98b98ec1bc7e ("ftpd: add deprecation notice")
Sponsored by: The FreeBSD Foundation

9 months agopowerpc pmap: initialize kernel pmap radix trie
Doug Moore [Wed, 13 Sep 2023 18:17:57 +0000 (13:17 -0500)]
powerpc pmap: initialize kernel pmap radix trie

Commit 2d2bcba7ba70141388729ed49674b36fd01146c5 changed radix trie
implementation and made it necessary that radix tries be initialized
with vm_radix_init. @dbaio reports that in some configurations, there
is a powerpc boot panic and that this commit introduced the
problem. In powerpc/aim/mmu_radix.c, the radix trie in kernel_pmap is
initialized by zeroing all its fields.

Add a call to vm_radix_init to properly initialize
kernel_pmap->pm_radix.

Reported by: dbaio
Reviewed by: alc, jhibbits
Fixes: 2d2bcba7ba drop NULL check from radix trie search
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41846

9 months agonewvers.sh: Avoid picking up stray envars.
Dag-Erling Smørgrav [Wed, 13 Sep 2023 18:10:46 +0000 (18:10 +0000)]
newvers.sh: Avoid picking up stray envars.

89f361f742ae added a mechanism to allow arbitrary overrides from the
command line.  Unfortunately, it also had the (likely unintended)
effect of allowing RELEASE and VERSION to be passed in from the
environment, and Makefile.inc1 happens to define VERSION for the
benefit of pkgbase.  To restore the status quo, unset RELEASE and
VERSION at the top of the script.

Fixes: 89f361f742ae
MFC after: 3 days
Reviewed by: gallatin, sjg, emaste
Differential Revision: https://reviews.freebsd.org/D41845

9 months agoaxge: Skip dummy packet headers
Damien Broka [Wed, 13 Sep 2023 08:23:47 +0000 (09:23 +0100)]
axge: Skip dummy packet headers

Newer versions of the AX88179 interweave dummies alongside valid
packet headers in bulk IN transfer data. This was probably done for
backward compatibility with existing drivers.

However current driver records these dummy headers as dropped frames,
leading to stats misreporting one Ierr per Ipkt.

This skips those dummy headers silently, thereby not generating Ierrs
for them.

Reviewed by: emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/842

9 months agosctp: further improve shutting down the read side of a socket
Michael Tuexen [Wed, 13 Sep 2023 11:02:51 +0000 (13:02 +0200)]
sctp: further improve shutting down the read side of a socket

Deal with the case that the association is already gone.

Reported by: syzbot+e256d42e9b390564530a@syzkaller.appspotmail.com
MFC after: 3 days

9 months agoBelatedly document OPIE removal in RELNOTES and UPDATING.
Dag-Erling Smørgrav [Wed, 13 Sep 2023 11:43:34 +0000 (11:43 +0000)]
Belatedly document OPIE removal in RELNOTES and UPDATING.

MFC after: 3 days
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D41822

9 months agopf tests: pfsync:defer requires scapy
Kristof Provost [Wed, 13 Sep 2023 09:11:02 +0000 (11:11 +0200)]
pf tests: pfsync:defer requires scapy

Add the kyua hint so we skip the test if it's not installed.

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

9 months agomana: add ioctl to support toggling offloading features
Wei Hu [Wed, 13 Sep 2023 10:48:02 +0000 (10:48 +0000)]
mana: add ioctl to support toggling offloading features

With this support, users can enable or disable offloading features
such as txcsum, rxcsum, tso and software lro through ifconfig.

To enable or disable tx features, do it on mana interface first,
then hn/netvsc to sync it up with mana. For example:

ifconfig mana0 -txcsum
ifconfig hn0 -tscsum

To enable or disable rx features, just applying on mana interface
would be sufficient.

Disabling txcsum imples disabling tso. Enabling tso when txcsum
is disabled will result in an error message in dmesg requesting
to enable txcsum first.

Above applies to ipv6 offloading features as well.

Tested by: whu
MFC after: 3 days
Sponsored by: Microsoft

9 months agoipfilter: Avoid allocating a new ipf token when not needed
Cy Schubert [Tue, 12 Sep 2023 20:29:29 +0000 (13:29 -0700)]
ipfilter: Avoid allocating a new ipf token when not needed

Only allocate a new ipftoken_t if one cannot be found. This eliminates
allocating unnecessary token structures that will never be used when
performing simple lookups for existing token structures.

MFC after: 2 weeks

9 months agosctp: improve shutting down the read side of a socket
Michael Tuexen [Tue, 12 Sep 2023 23:33:54 +0000 (01:33 +0200)]
sctp: improve shutting down the read side of a socket

When shutdown(..., SHUT_RD) or shutdown(..., SHUT_RDWR) is called,
really clean up the read queue and issue an ungraceful shutdown if
user messages are affected.

Reported by: syzbot+d4e1d30d578891245f59@syzkaller.appspotmail.com
MFC after: 3 days

9 months agoncurses: avoid hardcoded assumptions about the layout of .OBJDIR
Kyle Evans [Tue, 12 Sep 2023 21:00:45 +0000 (16:00 -0500)]
ncurses: avoid hardcoded assumptions about the layout of .OBJDIR

Abstract out the details of the FreeBSD build into a $TINFO_OBJDIR that
external builds can override if they orchestrate the build a bit
differently and have a different objdir layout as a result.  This makes
the ncurses build a little bit more flexible without requiring weird
backflips.

Reviewed by: bapt, sjg
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D41834

9 months agopowerpc_mmu_radix: include vm_radix.h file
Doug Moore [Tue, 12 Sep 2023 19:35:48 +0000 (14:35 -0500)]
powerpc_mmu_radix: include vm_radix.h file

Replacing _vm_radix.h with vm_radix.h in one header file leaves one
source file short of function definitions.  Include vm_radix.h in that
source file.

Fixes a problem rooted in change 429c871ddddac4bbf6abf1eb9e2e6603f87c2ef5.

9 months agotslog.4: fix typo
Piotr Pawel Stefaniak [Tue, 12 Sep 2023 19:10:08 +0000 (21:10 +0200)]
tslog.4: fix typo

9 months agosh: also auto-complete functions
Piotr Pawel Stefaniak [Sun, 30 Apr 2023 16:31:52 +0000 (18:31 +0200)]
sh: also auto-complete functions

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

9 months agosh: introduce a function to iterate over all hashed commands
Piotr Pawel Stefaniak [Sun, 30 Apr 2023 16:30:56 +0000 (18:30 +0200)]
sh: introduce a function to iterate over all hashed commands

While aliases and built-ins are opportunistically stored in cmdtable, each
function will be added to it immediately on definition.

Factor out the hashing function, write the iterator function and make it use
the hashing function.

Add the cmdname pointer to struct cmdentry so that the command name can be
exposed that way.

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

9 months agosh: tab-complete aliases
Piotr Pawel Stefaniak [Sat, 29 Apr 2023 20:38:50 +0000 (22:38 +0200)]
sh: tab-complete aliases

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

9 months agosh: introduce a function to iterate over all aliases
Piotr Pawel Stefaniak [Sat, 29 Apr 2023 20:23:59 +0000 (22:23 +0200)]
sh: introduce a function to iterate over all aliases

Currently the data structure holding alias information is opaque for
consumers outside alias.c and there is no way to iterate over all
aliases, which will become needed by a future commit.

The new function "iteralias" takes a null pointer to return the first
alias or an existing alias to return the next one, unless there is
no alias to return, in which case it returns a null pointer.

I slightly changed the static function hashalias so that it returns the
index into the array holding link heads, and not the link head directly.
In this form it's easier to use by iteralias and the slight adjustment
in the three existing callers doesn't look too bad.

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

9 months agosh: reindent a for loop in parser.c
Piotr Pawel Stefaniak [Sun, 1 Jan 2023 19:22:28 +0000 (20:22 +0100)]
sh: reindent a for loop in parser.c

Reduce indentation level before a commit that will add new code here.

Reviewed by: jilles
Differential Revision: https://reviews.freebsd.org/D37926

9 months agoFix zfsd with the device_removal pool feature.
Alan Somers [Tue, 12 Sep 2023 01:20:39 +0000 (19:20 -0600)]
Fix zfsd with the device_removal pool feature.

Previously zfsd would crash in the presence of a pool with a
top-level-vdev that had previously been removed.  The crash happened
because the configuration nvlist of such a TLV contains an empty
ZPOOL_CONFIG_CHILDREN array, which led to a pop_front from an empty
list, which has undefined behavior.

The crash only happened in stable/14 and later, probably do to
differences in libcxx, but the change should be MFCed anyway.

PR: 273663
Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
MFC after: 1 week
Sponsored by: Axcient
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D41818

9 months agosysctl(9): Fix typo translatation -> translation
Damien Broka [Mon, 11 Sep 2023 11:15:18 +0000 (12:15 +0100)]
sysctl(9): Fix typo translatation -> translation

MFC after: 3 days
Pull Request: https://github.com/freebsd/freebsd-src/pull/839

9 months agousbdi(9): Fix typo to simply -> to simplify
Damien Broka [Mon, 11 Sep 2023 11:12:27 +0000 (12:12 +0100)]
usbdi(9): Fix typo to simply -> to simplify

MFC after: 3 days
Pull Request: https://github.com/freebsd/freebsd-src/pull/839

9 months agopowerpc_pmap: include proper vm_radix file
Doug Moore [Tue, 12 Sep 2023 13:10:15 +0000 (08:10 -0500)]
powerpc_pmap: include proper vm_radix file

Like the pmap.h files for amd64, arm64, i386 and riscv, the one for powerpc
should #include vm/_vm_radix.h, not vm/vm_radix.h, to get a definition for
struct vm_radix.

Fixes a problem introduced with 429c871ddddac4bbf6abf1eb9e2e6603f87c2ef5.

9 months agopkgbase: Move headers and libs out of runtime and utilities
Doug Rabson [Mon, 11 Sep 2023 08:38:46 +0000 (09:38 +0100)]
pkgbase: Move headers and libs out of runtime and utilities

Headers from src/include were in the runtime-dev package but
subdirectories of src/include ended up in utilities-dev by default.
Neither package is a good choice - the headers in src/include are not
useful without the libraries contained in clibs-dev.

This moves the standard C headers to clibs-dev (C++ headers are already
in this package). While working on this, I found that various clang
libraries and headers were also bundled into utilities-dev by default
so these are also moved to clang-dev.

I also added a FreeBSD-build-essential meta package to make it simple to
install all the toolchain parts.

PR: 254173
Reviewed byb: manu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41815

9 months agolinux(4): Cleanup dummy syscall list on arm64
Dmitry Chagin [Tue, 12 Sep 2023 10:37:45 +0000 (13:37 +0300)]
linux(4): Cleanup dummy syscall list on arm64

These syscalls do not exist on arm64 Linux.

MFC after: 1 week

9 months agovm_radix: add a missing paren
Doug Moore [Tue, 12 Sep 2023 09:19:51 +0000 (04:19 -0500)]
vm_radix: add a missing paren

429c871ddddac4bbf6abf1eb9e2e6603f87c2ef5 left parens unbalanced in a
powerpc case that my testing missed.  Restore balance.

Reported by: jenkins

9 months agoradix_trie: have vm_radix use pctrie code
Doug Moore [Tue, 12 Sep 2023 07:42:38 +0000 (02:42 -0500)]
radix_trie: have vm_radix use pctrie code

Implement everything currently in vm_radix.c with calls to functions
in subr_pctrie.c, asccessed via the interface provided by the
DEFINE_PCTRIE_SMR macro.

Add back some #includes removed in the first attempt, and avoid the
use of a discontinued type in a bit of conditionally compiled code.

Reviewed by: alc, markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D41344

9 months agono trailing dot (".") for FreeBSD releases
Wolfram Schneider [Tue, 12 Sep 2023 06:42:47 +0000 (06:42 +0000)]
no trailing dot (".") for FreeBSD releases
PR: 273690

9 months agoDisable byteswap.h for now.
Xin LI [Tue, 12 Sep 2023 06:24:08 +0000 (23:24 -0700)]
Disable byteswap.h for now.

Ideally we should be testing __FreeBSD_version (1400079) and/or
BOOTSTRAPPING from an older version, but restore compatibility to
older FreeBSD versions and macOS while we find out a better way to
fix it.

9 months agolib/libc/amd64/string/strcspn.S: fix behaviour with sets of 17--32
Robert Clausecker [Mon, 11 Sep 2023 23:56:30 +0000 (19:56 -0400)]
lib/libc/amd64/string/strcspn.S: fix behaviour with sets of 17--32

When a string is matched against a set of 17--32 characters, each chunk
of the string is matched first against the first 16 characters of the
set and then against the remaining characters.  We also check at the
same time if the string has a nul byte in the current chunk, terminating
the search if it does.

Due to misconceived logic, the order of checks was "first half of set,
nul byte, second half of set", meaning that a match with the second half
of the set was ignored when the string ended in the same 16 bytes.
Reverse the order of checks to fix this problem.

Sponsored by: The FreeBSD Foundation
Approved by: mjg (blanket, via IRC)
MFC after: 1 week
MFC to: stable/14

9 months agosiftr: flush pkt_nodes to the log file in batch
Cheng Cui [Tue, 25 Jul 2023 13:53:55 +0000 (09:53 -0400)]
siftr: flush pkt_nodes to the log file in batch

Reviewed by: rscheff, tuexen
Differential Revision: https://reviews.freebsd.org/D41175

9 months agolinux(4): Cleanup includes under amd64/linux32
Dmitry Chagin [Mon, 11 Sep 2023 18:29:40 +0000 (21:29 +0300)]
linux(4): Cleanup includes under amd64/linux32

No functional changes.

MFC after: 1 week

9 months agolinux(4): Cleanup includes under amd64/linux
Dmitry Chagin [Mon, 11 Sep 2023 18:29:34 +0000 (21:29 +0300)]
linux(4): Cleanup includes under amd64/linux

No functional changes.

MFC after: 1 week

9 months agolinux(4): Cleanup includes under arm64
Dmitry Chagin [Mon, 11 Sep 2023 18:29:28 +0000 (21:29 +0300)]
linux(4): Cleanup includes under arm64

No functional changes.

MFC after: 1 week

9 months agostand/loader.efi: fix regression with ignoring nvstore
Gleb Smirnoff [Mon, 11 Sep 2023 18:04:48 +0000 (11:04 -0700)]
stand/loader.efi: fix regression with ignoring nvstore

To read/update the boot loader nvstore, we always need to call
zfs_attach_nvstore() regardless of whether we use bootonce key
in nvstore or the bootfs property of the pool.  The call was
unintentionally left in the block of code that is processed
only when bootonce key is present.

In particular this fixes broken 'nextboot -k'.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D41795
Fixes: e3e2681d0ec28d6661fef6da76c9479049e2761c

9 months agopkg: use https by default
Baptiste Daroussin [Thu, 8 Jun 2023 21:37:58 +0000 (23:37 +0200)]
pkg: use https by default

Switch the repository to use https by default, base is providing a CA
root bundle suitable to validate the certificates used by the project.
This can now be activated without requiring another packages to be installed

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40473

9 months agoLinuxKPI: skbuff: remove assumption about mac_header
Bjoern A. Zeeb [Fri, 8 Sep 2023 12:47:03 +0000 (12:47 +0000)]
LinuxKPI: skbuff: remove assumption about mac_header

It seems the mac_header can be set to offset 0 for frames received.
Remove the warning splattering messages to the console for each packet.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

9 months agotools/wlanstats: fix -Wunused-but-set-variable
Bjoern A. Zeeb [Mon, 11 Sep 2023 14:11:52 +0000 (14:11 +0000)]
tools/wlanstats: fix -Wunused-but-set-variable

The "allnodes" code is currently #if 0 so also #if 0 the setting of the
command line option and variable in order to keep wlanstats compiling.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

9 months agonet80211: fix ddb print alignment
Bjoern A. Zeeb [Mon, 11 Sep 2023 14:23:20 +0000 (14:23 +0000)]
net80211: fix ddb print alignment

Add missing \ts after new lines to properly align output of ddb show
commands.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

9 months agolibc: Don't assume signed char.
Dag-Erling Smørgrav [Mon, 11 Sep 2023 13:18:18 +0000 (13:18 +0000)]
libc: Don't assume signed char.

MFC after: 3 days
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D41814

9 months agohyperv/vmbus: Flip a message to only be emitted on failure
Li-Wen Hsu [Mon, 11 Sep 2023 08:51:46 +0000 (16:51 +0800)]
hyperv/vmbus: Flip a message to only be emitted on failure

This message is not very useful when things are working well.
Flip its meaning and let it only be emitted on failure.

While here, pet style(9).

Reviewed by: mhorne, whu
Differential Revision: https://reviews.freebsd.org/D41788

9 months agoRevert "radix_trie: have vm_radix use pctrie code"
Doug Moore [Mon, 11 Sep 2023 08:34:46 +0000 (03:34 -0500)]
Revert "radix_trie: have vm_radix use pctrie code"

This reverts commit a494d30465f21e8cb014a5c788a43001397325d7.

9 months agozfs: merge openzfs/zfs@0ee9b0239
Martin Matuska [Mon, 11 Sep 2023 07:13:30 +0000 (09:13 +0200)]
zfs: merge openzfs/zfs@0ee9b0239

Notable upstream pull request merges:
  #15251 Add more constraints for block cloning

Obtained from: OpenZFS
OpenZFS commit: 0ee9b02390d57c10a4dee0f3d19fcb115b424ca5

9 months agoradix_trie: have vm_radix use pctrie code
Doug Moore [Mon, 11 Sep 2023 06:53:40 +0000 (01:53 -0500)]
radix_trie: have vm_radix use pctrie code

Implement everything currently in vm_radix.c with calls to functions
in subr_pctrie.c, asccessed via the interface provided by the
DEFINE_PCTRIE_SMR macro.

Reviewed by: alc, markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D41344

9 months agopf: fix state leak
Kristof Provost [Wed, 6 Sep 2023 07:58:07 +0000 (09:58 +0200)]
pf: fix state leak

If we hit the csfailed case in pf_create_state() we may have allocated
a state, so we must also free it. While here reduce the amount of
duplicated cleanup code.

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

9 months agoMFV: file 5.45.
Xin LI [Sun, 10 Sep 2023 19:20:33 +0000 (12:20 -0700)]
MFV: file 5.45.

MFC after: 3 days

9 months agomkfile: getopt() returns an int, not a char.
Dag-Erling Smørgrav [Sun, 10 Sep 2023 18:33:18 +0000 (18:33 +0000)]
mkfile: getopt() returns an int, not a char.

MFC after: 3 days
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D41804

9 months agocxgbe(4): Fix tracing with netlink enabled kernels.
Navdeep Parhar [Sat, 9 Sep 2023 19:39:15 +0000 (12:39 -0700)]
cxgbe(4): Fix tracing with netlink enabled kernels.

1. The tracing ifnet's name must match the nexus name.  One way to do
   this is to not use a unit number.

2. Do not hold the tracer lock around ether_ifattach or ether_ifdetach.
   netlink calls back into the driver (see stack below) and that leads
   to illegal lock recursion.

   tracer_ioctl
   if_ioctl
   get_operstate_ether
   get_operstate
   dump_iface
   rtnl_handle_ifevent
   rtnl_handle_ifattach
   if_attach_internal
   if_attach
   ether_ifattach
   t4_cloner_create

MFC after: 3 days
Sponsored by: Chelsio Communications

9 months agopfsync: fix state leak
Kristof Provost [Fri, 8 Sep 2023 09:21:12 +0000 (11:21 +0200)]
pfsync: fix state leak

If we receive a state with a route-to interface name set and we can't
find the interface we do not insert the state. However, in that case we
must still clean up the state (and state keys).
Do so, so we do not leak states.

Reviewed by: Kajetan Staszkiewicz <vegeta@tuxpowered.net>
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D41779

9 months agolib/libc/amd64/string/memchr.S: fix behaviour with overly long buffers
Robert Clausecker [Sun, 10 Sep 2023 04:11:07 +0000 (00:11 -0400)]
lib/libc/amd64/string/memchr.S: fix behaviour with overly long buffers

When memchr(buf, c, len) is called with a phony len (say, SIZE_MAX),
buf + len overflows and we have buf + len < buf.  This confuses the
implementation and makes it return incorrect results.  Neverthless we
must support this case as memchr() is guaranteed to work even with
phony buffer lengths, as long as a match is found before the buffer
actually ends.

Sponsored by: The FreeBSD Foundation
Reported by: yuri, des
Tested by: des
Approved by: mjg (blanket, via IRC)
MFC after: 1 week
MFC to: stable/14
PR: 273652

9 months agoCorrect the grammo in "will underlined".
Jens Schweikhardt [Sun, 10 Sep 2023 09:00:21 +0000 (11:00 +0200)]
Correct the grammo in "will underlined".

9 months agoVendor import of file 5.45.
Xin LI [Sun, 10 Sep 2023 04:50:07 +0000 (21:50 -0700)]
Vendor import of file 5.45.

9 months agonetpfil/pf/pf.c: fix build without dtrace
Konstantin Belousov [Sat, 9 Sep 2023 21:54:42 +0000 (00:54 +0300)]
netpfil/pf/pf.c: fix build without dtrace

Sponsored by: The FreeBSD Foundation

9 months agoshmfd: hide direct rangelock(9) use under a wrapper
Konstantin Belousov [Fri, 18 Aug 2023 12:38:28 +0000 (15:38 +0300)]
shmfd: hide direct rangelock(9) use under a wrapper

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

9 months agoufs: restore name cache fast path lookup
Mateusz Guzik [Sat, 9 Sep 2023 21:48:57 +0000 (21:48 +0000)]
ufs: restore name cache fast path lookup

Found by: dchagin
Fixes: f3c81b973897 ("ufs: add missing vop_fplookup ops")

9 months agodrm2: fix build after abs64 became global
Mateusz Guzik [Sat, 9 Sep 2023 20:50:55 +0000 (20:50 +0000)]
drm2: fix build after abs64 became global

Fixes: 229c65a83fb ("kern: Globally define abs64")
Sponsored by: Rubicon Communications, LLC ("Netgate")

9 months agogic_acpi: Limit the number of CPUs to GIC_MAXCPU
John Baldwin [Sat, 9 Sep 2023 19:13:57 +0000 (12:13 -0700)]
gic_acpi: Limit the number of CPUs to GIC_MAXCPU

madt_table_data contains an array of pointers for each CPU and was
allocated on the stack.  If MAXCPU is raised to a sufficiently large
value this can overflow the kernel stack.  Cap the stack growth by
using GIC_MAXCPU instead as for other parts of the gicv1/v2 driver in
commit a0e20c0ded1a.

Suggested by: andrew
Reviewed by: andrew, emaste
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D41800