Commit Graph

276696 Commits

Author SHA1 Message Date
Jessica Clarke
b180713612 Makefile.inc1: Add a missing ${dist} to distributeworld for usr/include/i386
Not including ${dist} results in the following non-fatal error printed
once per extra distribution:

  mkdir  //usr/obj/usr/src/amd64.amd64/release/dist/usr/include/i386
  mkdir: //usr/obj/usr/src/amd64.amd64/release/dist/usr/include: No such file or directory
  *** Error code 1 (ignored)

Also fix a whitespace nit on this line whilst here.

Reviewed by:	brooks
Fixes:		a09ea2bbc3 ("amd64: add an i386 include directory")
2022-07-14 00:23:31 +01:00
Kirk McKusick
064e6b4303 Rewrite function definitions in the UFS/FFS code base with identifier lists.
The K&R style in UFS and other places in the tree's days are numbered
as this syntax is removed in C2x proposal N2432:

	https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2432.pdf

Though running to nearly 6000 lines of diffs this update should cause
no functional change to the code.

Requested by: Warner Losh
MFC after:    2 weeks
2022-07-13 14:08:05 -07:00
Cy Schubert
0a92a9fca7 unbound: Vendor import 1.16.1
Merge commit 'd57351465531b38689892ec862de2725b52842dd' into unbound/main2

MFC after:	1 month
2022-07-13 12:30:14 -07:00
Glen Barber
1dfcff294e release: increase IMAGE_SIZE for arm, arm64, riscv
Related to: 	PR 264032
MFC after:	5 minutes
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-07-13 14:36:22 -04:00
Colin Percival
82a21151cf Fill in cn_name in struct consdev.
It makes debugging easier if the name is filled in from the start.

Reviewed by:	imp
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D35795
2022-07-13 09:59:00 -07:00
Mike Karels
efe58855f3 IPv4: experimental changes to allow net 0/8, 240/4, part of 127/8
Combined changes to allow experimentation with net 0/8 (network 0),
240/4 (Experimental/"Class E"), and part of the loopback net 127/8
(all but 127.0/16).  All changes are disabled by default, and can be
enabled by the following sysctls:

    net.inet.ip.allow_net0=1
    net.inet.ip.allow_net240=1
    net.inet.ip.loopback_prefixlen=16

When enabled, the corresponding addresses can be used as normal
unicast IP addresses, both as endpoints and when forwarding.

Add descriptions of the new sysctls to inet.4.

Add <machine/param.h> to vnet.h, as CACHE_LINE_SIZE is undefined in
various C files when in.h includes vnet.h.

The proposals motivating this experimentation can be found in

    https://datatracker.ietf.org/doc/draft-schoen-intarea-unicast-0
    https://datatracker.ietf.org/doc/draft-schoen-intarea-unicast-240
    https://datatracker.ietf.org/doc/draft-schoen-intarea-unicast-127

Reviewed by:	rgrimes, pauamma_gundo.com; previous versions melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D35741
2022-07-13 09:46:05 -05:00
Mark Johnston
ef221ff645 time: Make realitexpire() local to kern_time.c
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-07-13 09:57:28 -04:00
Mark Johnston
38e1d32dab callout: Simplify cpuid validation in callout_reset_sbt_on()
- Remove a flag variable.
- Convert a runtime check of the passed cpuid to a KASSERT.
- Remove the cc_inited flag.  An attempt to schedule a callout before
  SI_SUB_CPU will crash anyway since the per-CPU mutexes won't have been
  initialized, and that flag was only checked in the case where a cpuid
  was explicitly specified by the caller.

No functional change intended.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2022-07-13 09:47:33 -04:00
Mark Johnston
eee9aab9cb vm_mmap: Remove obsolete code and comments from vm_mmap()
In preparation for removing OBJT_DEFAULT, eliminate some stale/unhelpful
comments from vm_mmap(), and remove an unused case.  In particular, the
remaining callers of vm_mmap() in the tree do not specify OBJT_DEFAULT.

It's much more common to use vm_map_find() to map an object into user
memory, so rather than adjusting vm_mmap() to handle OBJT_SWAP objects,
let's further discourage its use and simply remove OBJT_DEFAULT
handling.

Reviewed by:	dougm, alc, kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35778
2022-07-13 09:39:26 -04:00
Mark Johnston
eaab493eee git-arc: Fix the -y option 2022-07-13 09:30:17 -04:00
Mark Johnston
31508912d8 uma: Apply a missed piece of review feedback from D35738
Fixes:	93cd28ea82 ("uma: Use a taskqueue to execute uma_timeout()")
2022-07-13 09:30:00 -04:00
Cy Schubert
d573514655 unbound: Vendor import 1.16.1 2022-07-13 06:02:01 -07:00
Xin LI
643ac419fa Improve usability of head(1) and tail(1):
- Consistently support -q (quiet) and -v (verbose)
 - Allow specifying numbers with SI prefixes supported by expand_number(3)
 - Remove 2^31 limit on lines for head(1)

MFC after:		2 weeks
Reviewed by:		lwhsu, pauamma, gbe
Relnotes:		yes
Differential Revision: https://reviews.freebsd.org/D35720
2022-07-12 21:14:25 -07:00
Bartosz Sobczak
d8cce8145c
ice(4): Add ice_rdma.c to module Makefile
When ice is built as a module, it can't be loaded due to unresolved
symbol.  Ensuring in Makefile that the ice_rdma.c is built fixes the
problem.

Signed-off-by: Bartosz Sobczak <bartosz.sobczak@intel.com>
Signed-off-by: Eric Joyner <erj@freebsd.org>

Reviewed by:	erj@
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D35687
2022-07-12 18:30:19 -07:00
Yan Ka Chiu
e706512a2b
ixl(4): Fix SR-IOV panics
The hw and ifp of a vsi will be NULL if such ixl_vsi is allocated
for a VF. When ixl_reconfigure_filters called, it is trying to
access vsi->ifp and hw->mac.addr and therefore is casuing panic.

This commit add checks to determine if vsi is a VF by checking
if vsi->hw is NULL, before adding IXL_VLAN_ANY filter (which
is already in a VF vsi's filter list) and VLAN filters.

(erj's Note: The SR-IOV flows need revisiting; this will help
prevent panics for now)

Reviewed by:	krzysztof.galazka@intel.com, erj@
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D35649
2022-07-12 18:17:03 -07:00
Jessica Clarke
becd9908be rtld-elf: Fix leaks and wild frees in origin_subst
55abf23dd3 inverted the value passed to origin_subst_one when rolling
up the existing code into a loop. If the first token is found ($ORIGIN),
this results in a wild free of part of strtab. Processing the second
token works fine and will act how the first should have regardless of
whether found, allocating memory for the string without freeing.
Processing subsequent tokens however will then leak, regardless of
whether found, as they will also believe they need to allocate memory
and can't free the string.

Found by:	CHERI
Reviewed by:	kib, markj
Fixes:		55abf23dd3 ("rtld: make token substitution table-driven")
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D35792
2022-07-12 17:47:47 +01:00
Mark Johnston
70b2996120 vm_map: Simplify a call to vm_object_allocate_anon()
vm_object_allocate_anon() automatically sets "charge" to 0 if no cred
reference is provided, so the caller doesn't need any conditional logic.

No functional change intended.

Reviewed by:	alc, kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35781
2022-07-12 09:10:15 -04:00
Mark Johnston
e1979b45b6 vm_object: Assert that overcommit charge is released in the object dtor
Reviewed by:	alc, kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35780
2022-07-12 09:10:15 -04:00
Mark Johnston
6b38974085 vm_object: Modify various drivers to allocate OBJT_SWAP objects
This is in preparation for removal of OBJT_DEFAULT.  In particular, it
is now cheap to check whether an OBJT_SWAP object has any swap blocks
allocated, so the benefit of having a separate OBJT_DEFAULT type is
quite marginal, and the OBJT_DEFAULT->SWAP transition is a source of
bugs.

Reviewed by:	alc, hselasky, kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35779
2022-07-12 09:10:15 -04:00
Kristof Provost
59219dde9a if_ovpn: fix mbuf leak
If the link is down or we can't find a peer we do not transmit the
packet, but also don't fee it.

Remember to m_freem() mbufs we can't transmit.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-07-12 14:19:25 +02:00
Yi Kong
7e06f4708c
msun: Rewrite function definitions with identifier lists
This syntax is removed in C2x proposal N2432.

Reviewed by:	pfg
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D35771
2022-07-12 13:17:47 +08:00
Peter Holm
7f3383d29b stress2: Added a fsck_ffs(8) test scenario 2022-07-12 06:42:33 +02:00
Rick Macklem
d4a11b3e3b nfscl: Fix CreateSession for an established ClientID
Commit 981ef32230 added optional use of the session
slots marked bad to recover a new session when all
slots are marked bad.  The recovery worked against
a FreeBSD NFSv4.1/4.2 server, but not a Linux one.
It turns out that it was a bug in the FreeBSD client
and not the Linux server.

This patch fixes the client so that DeleteSession
followed by CreateSession after receiving a
NFSERR_BADSESSION error reply works against the
Linux server (and conforms to the RFC).

This also implies that the FreeBSD NFSv4.1/4.2
server needs to be fixed in a future commit.
Without the fix, the FreeBSD server does a full
recovery, including creation of a new ClientID,
but since "intr" mounts were broken, this does
not result in a regression.

This patch only affects the case where a CreateSession
is done for an already confirmed ClientID, which was
not being done prior to commit 981ef32230.

PR: 260011
MFC after:	2 weeks
2022-07-11 16:50:34 -07:00
Rick Macklem
2adb30740b nfscl: Replace "cred" with NULL to cleanup code
Commit 326bcf9394 added a new "cred" argument to nfscl_reqstart().
Fsinfo is a NFSv3 RPC and since the "cred" argument is not
used for NFSv3, it does not matter what is passed in.
However, to be consistent with the rest of the patch, change the
argument to NULL.

This patch should not result in a semantics change.

PR: 260011
MFC after:	2 weeks
2022-07-11 15:58:07 -07:00
Mateusz Piotrowski
6452fb1e87 protect.1: Document that protect(1) does not work in jails
The reason is that in order to protect a process procctl(2) needs
the PRIV_VM_MADV_PROTECT privilege, which is currently denied in jails
(see kern_jail.c).

MFC after:	1 week
2022-07-12 00:47:58 +02:00
Kristof Provost
16899291de dummynet: check for ifp on all PROTO_LAYER2 packets
When we extended the switch statement to allow for PROTO_LAYER2 |
PROTO_IPV6 in c21cbaca2b we didn't extend the check for a non-NULL
struct ifnet pointer.
Happily the only PROTO_IPV6 case is pf's layer 2 support, which always
provides one.

Reported by:	Coverity (CID 1490459)
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-07-11 22:07:11 +02:00
Mark Johnston
ece453d5fa eventtimer: Simplify KTR traces
Stop including the current CPU in all event messages, since it's already
saved in KTR log entries and thus is redundant.  All eventtimer traces
occur in a context where CPU migration is not possible.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-07-11 15:58:43 -04:00
Mark Johnston
93cd28ea82 uma: Use a taskqueue to execute uma_timeout()
uma_timeout() has several responsibilities; it visits every UMA zone and
as of recently will drain underutilized caches, so is rather expensive
(>1ms in some cases).  Currently it is executed by softclock threads
and so will preempt most other CPU activity.  None of this work requires
a high scheduling priority, though, so defer it to a taskqueue so as to
avoid stalling higher-priority work.

Reviewed by:	rlibby, alc, mav, kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35738
2022-07-11 15:58:43 -04:00
Mark Johnston
a889a65ba3 eventtimer: Fix several races in the timer reload code
In handleevents(), lock the timer state before fetching the time for the
next event.  A concurrent callout_cc_add() call might be changing the
next event time, and the race can cause handleevents() to program an
out-of-date time, causing the callout to run later (by an unbounded
period, up to the idle hardclock period of 1s) than requested.

In cpu_idleclock(), call getnextcpuevent() with the timer state mutex
held, for similar reasons.  In particular, cpu_idleclock() runs with
interrupts enabled, so an untimely timer interrupt can result in a stale
next event time being programmed.  Further, an interrupt can cause
cpu_idleclock() to use a stale value for "now".

In cpu_activeclock(), disable interrupts before loading "now", so as to
avoid going backwards in time when calling handleevents().  It's ok to
leave interrupts enabled when checking "state->idle", since the race at
worst will cause handleevents() to be called unnecessarily.  But use an
atomic load to indicate that the test is racy.

PR:		264867
Reviewed by:	mav, jhb, kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35735
2022-07-11 15:58:43 -04:00
Mark Johnston
ebb3cb6195 eventtimer: Pass a pcpu state pointer to getnext(cpu)event()
Callers have already loaded the pointer, so these functions don't need
to fetch it again.

No functional change intended.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-07-11 15:58:43 -04:00
Mark Johnston
ba71333f60 sched_ule: Fix a typo in a comment
PR:		226107
MFC after:	1 week
2022-07-11 15:58:43 -04:00
Mark Johnston
ef80894c9d sched_ule: Purge an obsolete comment
The referenced bitmask was removed in commit 62fa74d95a.

MFC after:	 1 week
Sponsored by:	The FreeBSD Foundation
2022-07-11 15:58:43 -04:00
Mark Johnston
35dd6d6cb5 sched_ule: Eliminate a superfluous local variable in tdq_move()
No functional change intended.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-07-11 15:58:43 -04:00
Mark Johnston
b57be759d0 vm_fault: Fix some nits in vm_fault_copy_entry()
- Correct the description (vm_fault_copy_entry() does not create a
  shadow object).
- Move some initialization and assertions out of the scope of the object
  locks, when doing so makes sense.
- Merge a pair of conditional blocks.
- Use __unused when appropriate.

No functional change intended.

Reviewed by:	alc
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2022-07-11 15:58:42 -04:00
Vitaliy Gusev
1228a047aa libvmm: add __BEGIN_DECLS/__END_DECLS for linking with c++ binaries
Reviewed by:	jhb, markj, imp
Sponsored by:	vStack
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D35719
2022-07-11 15:58:42 -04:00
Kristof Provost
6d1471fda8 pf tests: support packet size range in pft_ether.py
Teach pft_ether.py to send a range of packet sizes. Use this to move the
size sweep into Python, removing the repeated Python startup overhead
and greatly speeding up the pf.ether.short_pkt test.

This should fix test timeouts seen on ci.freebsd.org.

While here also extend the range of packet sizes tested, because it adds
very little runtime now.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-07-11 19:55:26 +02:00
Eugene Grosbein
3c9ad9398f ifconfig.8: cleanup reminiscence about long gone ppp(4)
Replace ppp(4) removed since FreeBSD 8.0-RELEASE with vlan(4).
While here, remove commented out reference to non-existing "egress"
interface group hiding since initial import of interface groups
from OpenBSD in 2006.
2022-07-11 11:53:54 +07:00
Xin LI
0bbf270296 libproc: replace home grown crc32 with zlib implementation.
MFC after:	2 weeks
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D35766
2022-07-10 16:31:35 -07:00
Rick Macklem
8f4a5fc6bc nfscl: Do not call nfscl_hasexpired() for NFSv4.1/4.2
Commit 981ef32230 enabled marking of potentially bad
session slots when an RPC is interrupted if the "intr"
mount option is used.  As such, it no longer makes
sense to call nfscl_hasexpired() for I/O operations that
reply NFSERR_BADSTATEID for NFSv4.1/4.2, which does a full
recovery of NFSv4 open state, destroying all byte range locks.
Recovery of open state should not be usually needed, since
the session slot has been marked potentially bad and,
although opens for the process that has been terminated via
a signal may be broken, locks for other processes will still
be valid.

This patch disables calls to nfscl_hasexpired for NFSv4.1/4.2
mounts, when I/O RPCs receive NFSERR_BADSTATEID replies.
It does not affect the behaviour of NFSv4.0 mounts nor
hard (non "intr") mounts.

PR: 260011
MFC after:	2 weeks
2022-07-10 13:56:38 -07:00
Rick Macklem
981ef32230 nfscl: Enable detection of bad session slots
To deal with broken session slots caused by the use of the
"soft" and/or "intr" mount options, nfsv4_sequencelookup()
has been modified to track the potentially broken session
slots (commit 40ada74ee1).  Then, when all session slots
are potentially broken, nfsv4_sequencelookup() does a
DeleteSession operation, so that the NFSv4.1/4.2 server will
reply NFSERR_BADSESSION to uses of the session.
The client will then recover by doing a CreateSession to
acquire a new session.

This patch adds the code that marks potentially bad
slots, so that the above semantics become functional.
It has been successfully tested against a FreeBSD
NFSv4.1/4.2 server, but does not work against a Linux 5.15
NFSv4.1/4.2 server. (The Linux 5.15 server creates
a new session with the same sessionid as the destroyed
one and, as such, keeps returning NFSERR_BADSESSION.
I believe this is a bug in the Linux server.)

However, this should not cause a regression and will
make "intr" mounts fairly usable against the NFSv4.1/4.2
servers where it works.

PR: 260011
MFC after:	2 weeks
2022-07-10 13:33:19 -07:00
Doug Moore
e0e8d0c8d6 iommu_gas: consolidate find_space helpers
Merge lowermatch and uppermatch into find_space.  Eliminate uppermatch
recursion.  Merge match_insert into match_one and eliminate some
redundant calculation.  Move some initialization out of find_space and
into map (and out from under a lock).

Reviewed by:	kib (previous version), alc
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D35440
2022-07-10 14:24:23 -05:00
Alexander V. Chernikov
50fa27e795 netinet6: fix interface handling for loopback traffic
Currently, processing of IPv6 local traffic is partially broken:
 link-local connection fails and global unicast connect() takes
 3 seconds to complete.
This happens due to the combination of multiple factors.
IPv6 code passes original interface "origifp" when passing
traffic via loopack to retain the scope that is mandatory for the
correct hadling of link-local traffic. First problem is that the logic
of passing source interface is not working correcly for TCP connections,
resulting in passing "origifp" on the first 2 connection attempts and
lo0 on the subsequent ones. Second problem is that source address
validation logic skips its checks iff the source interface is loopback,
which doesn't cover "origifp" case.
More detailed description is available at https://reviews.freebsd.org/D35732

Fix the first problem by untangling&simplifying ifp/origifp logic.
Fix the second problem by switching source address validation check to
using M_LOOP mbuf flag instead of interface type.

PR:		265089
Reviewed by:	ae, bz(previous version)
Differential Revision:	https://reviews.freebsd.org/D35732
MFC after:	2 weeks
2022-07-10 12:47:47 +00:00
Aleksandr Rybalko
da4e1e319c Add the Arm CoreLink CMN-600 Coherent Mesh Network Controller PMU driver man page.
Add the Arm CoreLink CMN-600 Coherent Mesh Network Controller PMU driver man page.

Reviewed by:	pauamma_gundo.com
Sponsored By: ARM
Differential Revision: https://reviews.freebsd.org/D32335
2022-07-10 12:26:55 +03:00
Rick Macklem
627f1555f5 nfscl: Initialize nfsess_badslots to zero
Commit 40ada74ee1 added a field to mark bad session slots.
This patch ensures that the field is initialized to 0.

PR: 260011
MFC after:	2 weeks
2022-07-09 16:12:31 -07:00
Rick Macklem
40ada74ee1 nfscl: Add optional support for slots marked bad
This patch adds support for session slots marked bad
to nfsv4_sequencelookup().  An additional boolean
argument indicates if the check for slots marked bad
should be done.

The "cred" argument added to nfscl_reqstart() by
commit 326bcf9394 is now passed into nfsv4_setquence()
so that it can optionally set the boolean argument
for nfsv4_sequencelookup().  When optionally enabled,
nfsv4_setsequence() will do a DestroySession when all
slots are marked bad.

Since the code that marks slots bad is not yet committed,
this patch should not result in a semantics change.

PR: 260011
MFC after:	2 weeks
2022-07-09 14:43:16 -07:00
Rick Macklem
dff31ae1c5 nfscl: Move nfsrpc_destroysession into nfscommon
This patch moves nfsrpc_destroysession() into nfscommon.ko
and also modifies its arguments slightly.  This will allow
the function to be called from nfsv4_sequencelookup() in
a future commit.

This patch should not result in a semantics change.

PR: 260011
MFC after:	2 weeks
2022-07-09 08:02:14 -07:00
Dimitry Andric
9ef1127008 Apply tentative llvm fix for avoiding fma on PowerPC SPE
Merge llvm review D77558, by Justin Hibbits:

  PowerPC: Don't hoist float multiply + add to fused operation on SPE

  SPE doesn't have a fmadd instruction, so don't bother hoisting a
  multiply and add sequence to this, as it'd become just a library call.
  Hoisting happens too late for the CTR usability test to veto using the CTR
  in a loop, and results in an assert "Invalid PPC CTR loop!".

Reported by:		alfredo
Obtained from:		https://reviews.llvm.org/D77558
MFC after:		3 days
2022-07-09 15:17:26 +02:00
Ganbold Tsagaankhuu
eec3290266 Add RK3568 SoC support to pinctrl driver.
Submitted by:	sos
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D31330
2022-07-09 13:06:52 +00:00
Gleb Smirnoff
8f9972075c rack/bbr: fix standalone kernel module build 2022-07-08 22:04:44 -07:00
Gleb Smirnoff
aeb6948d43 bbr: check proper flag for connection had been closed
An older version of D35663 slipped through final reviews.

Submitted by:	Peter Lei
Fixes:		74703901d8
2022-07-08 22:04:44 -07:00