Jung-uk Kim [Tue, 21 Jun 2022 17:33:01 +0000 (13:33 -0400)]
OpenSSL: Merge OpenSSL 1.1.1p
Merge commit '
54ae8e38f717f22963c2a87f48af6ecefc6b3e9b'
Greg V [Tue, 21 Jun 2022 17:09:30 +0000 (19:09 +0200)]
LinuxKPI: add asm/neon.h
This is equivalent to asm/fpu/api.h, but is included by drm on aarch64.
Reviewed by: bz, imp, hselasky
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D35512
Jung-uk Kim [Tue, 21 Jun 2022 14:36:39 +0000 (10:36 -0400)]
Import OpenSSL 1.1.1p
Emmanuel Vadot [Tue, 21 Jun 2022 13:52:49 +0000 (15:52 +0200)]
fb: Add a default getinfo method
fb_getinfo is badly designed as it returns either the
info if the driver have the method or ENXIO via the kobj stuff
if the driver doesn't have it.
Add a default method that returns NULL as the code already checks this
and it avoid changing the interface.
None of the drm drivers supported have this method and it sometimes
fails and panic when loading them (for now only usb-c docks seems to be
affected).
MFC after: 3 days
Sponsored by: Beckhoff Automation GmbH & Co. KG
Li-Wen Hsu [Tue, 21 Jun 2022 12:00:07 +0000 (20:00 +0800)]
Temporarily skip flaky test case: sys.netpfil.common.dummynet.ipfw_queue
PR: 264805
Sponsored by: The FreeBSD Foundation
Hans Petter Selasky [Tue, 21 Jun 2022 09:23:55 +0000 (11:23 +0200)]
ibcore: Fix a race with disassociate and exit_mmap()
If uverbs_user_mmap_disassociate() is called while the mmap is
concurrently doing exit_mmap then the ordering of the
rdma_user_mmap_entry_put() is not reliable.
The put must be done before uvers_user_mmap_disassociate() returns,
otherwise there can be a use after free on the ucontext, and a left over
entry in the xarray. If the put is not done here then it is done during
rdma_umap_close() later.
Add the missing put to the error exit path.
Linux commit:
39c011a538272589b9eb02ff1228af528522a22c
PR: 264473
MFC after: 3 days
Sponsored by: NVIDIA Networking
Hans Petter Selasky [Tue, 21 Jun 2022 09:07:06 +0000 (11:07 +0200)]
ibcore: Fix sysfs registration error flow
The kernel commit cited below restructured ib device management
so that the device kobject is initialized in ib_alloc_device.
As part of the restructuring, the kobject is now initialized in
procedure ib_alloc_device, and is later added to the device hierarchy
in the ib_register_device call stack, in procedure
ib_device_register_sysfs (which calls device_add).
However, in the ib_device_register_sysfs error flow, if an error
occurs following the call to device_add, the cleanup procedure
device_unregister is called. This call results in the device object
being deleted -- which results in various use-after-free crashes.
The correct cleanup call is device_del -- which undoes device_add
without deleting the device object.
The device object will then (correctly) be deleted in the
ib_register_device caller's error cleanup flow, when the caller invokes
ib_dealloc_device.
Linux commit:
b312be3d87e4c80872cbea869e569175c5eb0f9a
PR: 264472
MFC after: 3 days
Sponsored by: NVIDIA Networking
Peter Holm [Tue, 21 Jun 2022 08:20:43 +0000 (10:20 +0200)]
stress2: Added a timeout
Alan Cox [Tue, 21 Jun 2022 04:48:31 +0000 (23:48 -0500)]
iommu_gas: Add a missing error-case unlock
Release the domain lock when iommu_gas_reserve_region_extend()'s call to
iommu_gas_reserve_region_locked() fails.
MFC after: 2 weeks
Alan Cox [Mon, 20 Jun 2022 18:40:42 +0000 (13:40 -0500)]
busdma_iommu: Eliminate a redundant trunc_page()
Since OFF_TO_IDX() inherently truncates the given value, there is no
need to perform trunc_page() on it.
MFC after: 2 weeks
Doug Moore [Tue, 21 Jun 2022 00:34:46 +0000 (19:34 -0500)]
iommu_gas: Drop needless bound check in lowermatch
The loop iteration in iommu_gas_lowermatch checks the bound
a->common->lowaddr twice per loop iteration. Rewrite to test only once
per iteration. Do not worry about passing to iommu_gas_match_one a
range wholly beyond lowaddr. Since that function checks the upper end
of the range against lowaddr, it'll get rejected there.
Reviewed by: alc
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35522
Rick Macklem [Mon, 20 Jun 2022 20:23:04 +0000 (13:23 -0700)]
nfscl: Clean up the code by removing vfs_flags() macro
The vfs_flags() macro was used to make the code compatible
with Mac OSX, for the Mac OSX port.
For FreeBSD, this macro just obscured the code, so
remove it to clean up the code.
This commit should not result in a semantics change.
Alan Cox [Mon, 20 Jun 2022 17:14:53 +0000 (12:14 -0500)]
iommu_gas: Eliminate a stale comment
As of
19bb5a7244ff, the size passed to iommu_gas_map is no longer
required to be a multiple of the CPU page size.
MFC after: 2 weeks
Mark Johnston [Mon, 20 Jun 2022 16:19:40 +0000 (12:19 -0400)]
kevent.2: Add an xref to listen.2
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Mark Johnston [Mon, 20 Jun 2022 16:18:15 +0000 (12:18 -0400)]
vm: Fix racy checks for swap objects
Commit
4b8365d752ef introduced the ability to dynamically register
VM object types, for use by tmpfs, which creates swap-backed objects.
As a part of this, checks for such objects changed from
object->type == OBJT_DEFAULT || object->type == OBJT_SWAP
to
object->type == OBJT_DEFAULT || (object->flags & OBJ_SWAP) != 0
In particular, objects of type OBJT_DEFAULT do not have OBJ_SWAP set;
the swap pager sets this flag when converting from OBJT_DEFAULT to
OBJT_SWAP.
A few of these checks are done without the object lock held. It turns
out that this can result in false negatives since the swap pager
converts objects like so:
object->type = OBJT_SWAP;
object->flags |= OBJ_SWAP;
Fix the problem by adding explicit tests for OBJT_SWAP objects in
unlocked checks.
PR: 258932
Fixes:
4b8365d752ef ("Add OBJT_SWAP_TMPFS pager")
Reported by: bdrewery
Reviewed by: kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35470
Mark Johnston [Mon, 20 Jun 2022 16:17:11 +0000 (12:17 -0400)]
aio: Improve UMA usage
- Remove the AIO proc zone. This zone gets one allocation per AIO
daemon process, which isn't enough to warrant a dedicated zone. Plus,
unlike other AIO structures, aiops are small (32 bytes with LP64), so
UMA doesn't provide better space efficiency than malloc(9). Change
one of the malloc types in vfs_aio.c to make it more general.
- Don't set the NOFREE flag on the other AIO zones. This flag means
that memory allocated to the AIO subsystem is never freed back to the
VM, so it's always preferable to avoid using it when possible. NOFREE
was set without explanation when AIO was converted to use UMA 20 years
ago, but it does not appear to be required; all of the structures
allocated from UMA (per-process kaioinfo, kaiocb, and aioliojob) keep
track of references and get freed only when none exist. Plus, these
structures will contain dangling pointer after they're freed (e.g.,
the "cred", "fd_file" and "uiop" fields of struct kaiocb), so
use-after-frees are dangerous even when the structures themselves are
type-stable.
Reviewed by: asomers
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35493
Mark Johnston [Mon, 20 Jun 2022 16:03:37 +0000 (12:03 -0400)]
bpf: Zero pad bytes preceding BPF headers
BPF headers are word-aligned when copied into the store buffer. Ensure
that pad bytes following the preceding packet are cleared.
Reported by: KMSAN
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Mark Johnston [Mon, 20 Jun 2022 16:02:59 +0000 (12:02 -0400)]
bpf: Correct a comment
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Mark Johnston [Mon, 20 Jun 2022 16:01:09 +0000 (12:01 -0400)]
vm_kern: Update KMSAN shadow maps when allocating kmem memory
This addresses a couple of false positive reports for memory returned by
malloc_large().
Sponsored by: The FreeBSD Foundation
Mark Johnston [Mon, 20 Jun 2022 15:50:54 +0000 (11:50 -0400)]
uma: Mark zeroed slabs as initialized for KMSAN
Otherwise zone initializers can produce false positives, e.g., when
lock_init() attempts to detect double initialization.
Sponsored by: The FreeBSD Foundation
Cy Schubert [Mon, 20 Jun 2022 14:21:55 +0000 (07:21 -0700)]
wpa: Restore missing patch
In December after a failed MFV due to a now understood issue I had with
git -- git aborts with extremely large MFV -- this patch was removed
during the revert. Restore this patch.
PR: 264238
Fixes:
4b72b91a7132df1f77bbae194e1071ac621f1edb
MFC after: 1 week
Peter Holm [Mon, 20 Jun 2022 12:36:57 +0000 (14:36 +0200)]
stress2: Added a timeout to the test
Peter Holm [Mon, 20 Jun 2022 12:35:59 +0000 (14:35 +0200)]
stress2: Fix process handling error
Kristof Provost [Tue, 31 May 2022 12:55:15 +0000 (14:55 +0200)]
pf tests: basic 'tagged' test for Ethernet rules
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35364
Kristof Provost [Tue, 31 May 2022 12:40:05 +0000 (14:40 +0200)]
pf tests: basic 'tagged' test for Ethernet rules
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35363
Kristof Provost [Tue, 31 May 2022 12:00:52 +0000 (14:00 +0200)]
pf: support matching on tags for Ethernet rules
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35362
Toomas Soome [Mon, 20 Jun 2022 06:51:44 +0000 (09:51 +0300)]
loader: GELI encrypted disk should still use device name disk
geli_probe_and_attach() does pick geli_devsw structure for
encrypted disks, the implementation depends on device
name "disk" when device type is DEVT_DISK, but geli_devsw is
setting name field "gelidisk".
PR: 264282
Submitted by: yamagi@yamagi.org
Reported by: yamagi@yamagi.org
MFC after: 2 weeks
Fernando Apesteguía [Wed, 26 May 2021 12:34:49 +0000 (14:34 +0200)]
getnetent(3): Add documentation for missing reentrant functions
Add gethostbyname_r, gethostbyname2_r and gethostbyaddr_r signatures and
descriptions.
PR: 249154
Reported by: asomers@
Approved by: manpages (imp@), Pau Amma
Differential Revision: https://reviews.freebsd.org/D30385
Fernando Apesteguía [Fri, 21 May 2021 15:25:25 +0000 (17:25 +0200)]
getnetent(3): Add missing reentrant functions
Add documentation for gethostbyname_r, gethostbyname2_r and gethostbyaddr_r
Create proper MLINKs for the new functions.
PR: 249154
Reported by: asomers@
Approved by: manpages (0mp@), Pau Amma
Differential Revision: https://reviews.freebsd.org/D30469
Toomas Soome [Thu, 9 Jun 2022 06:56:19 +0000 (09:56 +0300)]
userboot is missing vdisk_dev
Add vdisk device support in userboot configuration.
MFC after: 1 week
Doug Moore [Sun, 19 Jun 2022 16:55:44 +0000 (11:55 -0500)]
tree.3: document RB_AUGMENT
Document the RB_AUGMENT macro, and provide an example of its use.
Reviewed by: alc, kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35518
Toomas Soome [Wed, 1 Jun 2022 07:28:43 +0000 (10:28 +0300)]
test_diskread(): detect end of the disk
Detect the end of the disk condition. This may happpen when
disk image is truncated and the reads are addressing blocks past
image end.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35432
Toomas Soome [Wed, 8 Sep 2021 00:14:51 +0000 (03:14 +0300)]
loader.efi: fix panic() after BS off
panic() is using multiple services - attempting to read
keyboard, accessing time functions and finally, exiting the loader.
Protect all the accessed listed above. Note, when BS are off,
we really can not just exit the loader, we only can reboot.
MFC after: 1 week
Rick Macklem [Sat, 18 Jun 2022 20:43:02 +0000 (13:43 -0700)]
nfscl: Clean up the code by removing #if(n)def APPLE
The definition of "APPLE" was used by the Mac OSX port.
For FreeBSD, this definition is never used, so remove
the references to it to clean up the code.
This commit should not result in a semantics change.
Damjan Jovanovic [Fri, 17 Jun 2022 13:37:40 +0000 (16:37 +0300)]
struct kinfo_file changes needed for lsof to work using only usermode APIs`
Add kf_pipe_buffer_[in/out/size] fields to kf_pipe, and populate them.
Add a kf_kqueue struct to the kf_un union, to allow querying kqueue state,
and populate it.
Populate the kf_sock_rcv_sb_state and kf_sock_snd_sb_state fields in
kf_sock for INET/INET6 sockets, and populate all other fields for all
transport layer protocols, not just TCP.
Bump __FreeBSD_version.
Differential revision: https://reviews.freebsd.org/D34184
Reviewed by: jhb, kib, se
MFC after: 1 week
Damjan Jovanovic [Fri, 17 Jun 2022 13:28:16 +0000 (16:28 +0300)]
KERN_LOCKF: report kl_file_fsid consistently with stat(2)
PR: 264723
Reviewed by: kib
Discussed with: markj
MFC after: 1 week
Kyle Evans [Sat, 30 Apr 2022 03:12:56 +0000 (22:12 -0500)]
mixer: remove volume backwards compat, add % interpretation
The current situation is fairly confusing, where an integer is interpreted
as a percent until you slap a decimal on it and magically it becomes an
absolute value.
Let's have a flag day in 14.0 and remove this shim entirely. Setting with
percent can still be useful, so allow a trailing '%' to indicate as such.
As a side effect, we tighten down the format allowed in the volume a little
bit by ensuring there's no trailing garbage after the value once it's
separated into left and right components.
Reviewed by: christos, hselasky, pauamma_gundo.com (manpages)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D35101
наб [Mon, 30 May 2022 23:18:12 +0000 (01:18 +0200)]
rc.d/hostid: remove useless cat
We've already read it and validated it ‒ re-reading is wasteful
PR: 264376
Rick Macklem [Fri, 17 Jun 2022 23:46:11 +0000 (16:46 -0700)]
nfscl: Clean up the code by removing unused arguments
The "void *stuff" (also called fstuff and dstuff) argument
was used by the Mac OSX port. For FreeBSD, this argument
is always NULL, so remove it to clean up the code.
This commit gets rid of "stuff" for assorted functions
defined in nfs_clrpcops.c and called in nfs_clvnops.c and
nfs_clstate.c.
This commit should not result in a semantics change.
Bjoern A. Zeeb [Fri, 17 Jun 2022 22:55:13 +0000 (22:55 +0000)]
net80211 / LinuxKPI: 802.11: add Control Trigger Subframe information
Add definitions related to 802.11ax Control Trigger frame format
needed for rtw89.
MFC after: 3 days
Rick Macklem [Fri, 17 Jun 2022 21:51:11 +0000 (14:51 -0700)]
nfscl: Clean up the code by removing unused arguments
The "void *stuff" (also called fstuff and dstuff) argument
was used by the Mac OSX port. For FreeBSD, this argument
is always NULL, so remove it to clean up the code.
This commit gets rid of "stuff" for assorted functions
defined in nfs_clrpcops.c and called in nfs_clvnops.c and
nfs_clvfsops.c. Future commits will do the same for other functions.
This commit should not result in a semantics change.
Brooks Davis [Fri, 17 Jun 2022 19:34:58 +0000 (20:34 +0100)]
ncurses: add SRCHDRS (ncurses_dll.h) to tinfo SRCS
This avoids relying on the `includes` target to generate this header
which must be in .OBJDIR for the ncurses library to find it.
With an upcoming change libcompat build won't build a seperate
sysroot and will instead share with the 64-bit target which means the
`includes` target will not be called.
Sponsored by: DARPA, AFRL
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D35510
Alan Cox [Fri, 17 Jun 2022 17:03:06 +0000 (12:03 -0500)]
iommu_gas: Correct a broken KASSERT
If iommu_gas_find_space() ever called iommu_gas_uppermatch(), and it
succeeded in allocating space, then the subsequent KASSERT would be
triggered. Change that KASSERT to accept either success or ENOMEM.
MFC after: 1 week
Juraj Lutter [Fri, 17 Jun 2022 13:36:53 +0000 (15:36 +0200)]
kldload: Bring functionality in line with manual page
Honor -q parameter and do not display any warning messages when -q is
specified.
Approved by: dfr
MFC after: 2 weeks
Sponsored by: Resulta, s.r.o.
Differential Revision: https://reviews.freebsd.org/D35511
Andrew Turner [Wed, 20 Apr 2022 17:33:00 +0000 (17:33 +0000)]
Remove PAGE_SIZE from the kcov tests
To allow for a dynamic page size on arm64 remove the static valud from
the kcov tests
Sponsored by: The FreeBSD Foundation
Andrew Turner [Tue, 3 May 2022 13:59:33 +0000 (14:59 +0100)]
Remove PAGE_SIZE from hastd
It may not be known at compile time so we should detect it at run time.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35118
Andrew Turner [Mon, 23 May 2022 09:41:36 +0000 (10:41 +0100)]
Clean up in the pci host generic driver
Add clean up on failure and a detach function to the pci host generic
driver.
Reviewed by: jhb (earlier version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35291
Andrew Turner [Mon, 6 Jun 2022 12:11:19 +0000 (13:11 +0100)]
Fix the random source descriptions
- Add the missing RANDOM_PURE_QUALCOMM description
- Make RANDOM_PURE_VMGENID consistent with the other pure sources
by including "PURE_" in the description.
Approved by: csprng (cem)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35412
Kristof Provost [Fri, 17 Jun 2022 07:01:05 +0000 (09:01 +0200)]
dhclient: fix pcp:pcp cleanup failure
If isc-dhcp44-server is not installed (as is the case the project's CI
servers) we don't create ngctl.shutdown, causing the 'rm' to fail.
That in turn causes the cleanup function to return non-zero, which
causes kyua to consider the test failed.
Use 'rm -f' instead, so we don't error even if the file doesn't exist.
Sponsored by: Rubicon Communications, LLC ("Netgate")
Alan Cox [Tue, 14 Jun 2022 19:01:36 +0000 (14:01 -0500)]
iommu_gas: Eliminate unnecessary wrappers
Eliminate trivial wrappers for several iommu_gas functions that serve
no functional purpose.
Reviewed by: br, dougm, kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35487
Peter Holm [Fri, 17 Jun 2022 03:42:52 +0000 (05:42 +0200)]
stress2: Remove bsdlabel(8) from tests
Reported by: mhorne
Discussed with: kib
Rick Macklem [Thu, 16 Jun 2022 23:46:06 +0000 (16:46 -0700)]
nfscl: Clean up the code by removing unused arguments
The "void *stuff" (also called fstuff and dstuff) argument
was used by the Mac OSX port. For FreeBSD, this argument
is always NULL, so remove it to clean up the code.
This commit gets rid of "stuff" for assorted functions
defined in nfs_clrpcops.c and called in nfs_clvnops.c.
Future commits will do the same for other functions.
This commit should not result in a semantics change.
Rick Macklem [Thu, 16 Jun 2022 23:17:13 +0000 (16:17 -0700)]
nfscl: Clean up the code by removing unused arguments
The "void *stuff" (also called fstuff and dstuff) argument
was used by the Mac OSX port. For FreeBSD, this argument
is always NULL, so remove it to clean up the code.
This commit gets rid of "stuff" for assorted functions
defined in nfs_clrpcops.c and called in nfs_clvnops.c.
Future commits will do the same for other functions.
This commit should not result in a semantics change.
James Mintram [Thu, 16 Jun 2022 20:17:44 +0000 (13:17 -0700)]
bhyve: Report an error for invalid UUIDs.
Reviewed by: rgrimes, grehan, jhb
Differential Revision: https://reviews.freebsd.org/D30050
Alexander Motin [Thu, 16 Jun 2022 18:51:50 +0000 (14:51 -0400)]
amd64: Stop using REP MOVSB for backward memmove()s.
Enhanced REP MOVSB feature of CPUs starting from Ivy Bridge makes
REP MOVSB the fastest way to copy memory in most of cases. However
Intel Optimization Reference Manual says: "setting the DF to force
REP MOVSB to copy bytes from high towards low addresses will expe-
rience significant performance degradation". Measurements on Intel
Cascade Lake and Alder Lake, same as on AMD Zen3 show that it can
drop throughput to as low as 2.5-3.5GB/s, comparing to ~10-30GB/s
of REP MOVSQ or hand-rolled loop, used for non-ERMS CPUs.
This patch keeps ERMS use for forward ordered memory copies, but
removes it for backward overlapped moves where it does not work.
This is just a cosmetic sync with kernel, since libc does not use
ERMS at this time.
Reviewed by: mjg
MFC after: 2 weeks
Alexander Motin [Thu, 16 Jun 2022 17:01:12 +0000 (13:01 -0400)]
amd64: Stop using REP MOVSB for backward memmove()s.
Enhanced REP MOVSB feature of CPUs starting from Ivy Bridge makes
REP MOVSB the fastest way to copy memory in most of cases. However
Intel Optimization Reference Manual says: "setting the DF to force
REP MOVSB to copy bytes from high towards low addresses will expe-
rience significant performance degradation". Measurements on Intel
Cascade Lake and Alder Lake, same as on AMD Zen3 show that it can
drop throughput to as low as 2.5-3.5GB/s, comparing to ~10-30GB/s
of REP MOVSQ or hand-rolled loop, used for non-ERMS CPUs.
This patch keeps ERMS use for forward ordered memory copies, but
removes it for backward overlapped moves where it does not work.
Reviewed by: mjg
MFC after: 2 weeks
Mark Johnston [Thu, 16 Jun 2022 14:10:45 +0000 (10:10 -0400)]
socket: Fix a race between kevent(2) and listen(2)
When locking the knote list for a socket, we check whether the socket is
a listening socket in order to select the appropriate mutex; a listening
socket uses the socket lock, while data sockets use socket buffer
mutexes.
If SOLISTENING(so) is false and the knote lock routine locks a socket
buffer, then it must re-check whether the socket is a listening socket
since solisten_proto() could have changed the socket's identity while we
were blocked on the socket buffer lock.
Reported by: syzkaller
Reviewed by: glebius
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35492
Mark Johnston [Thu, 16 Jun 2022 14:05:10 +0000 (10:05 -0400)]
debugnet: Fix an error handling bug in the DDB command tokenizer
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Mark Johnston [Thu, 16 Jun 2022 14:02:00 +0000 (10:02 -0400)]
debugnet: Handle batches of packets from if_input
Some drivers will collect multiple mbuf chains, linked by m_nextpkt,
before passing them to upper layers. debugnet_pkt_in() didn't handle
this and would process only the first packet, typically leading to
retransmits.
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Rick Macklem [Wed, 15 Jun 2022 23:10:50 +0000 (16:10 -0700)]
nfscl: Clean up the code by removing unused arguments
The "void *stuff" (also called fstuff and dstuff) argument
was used by the Mac OSX port. For FreeBSD, this argument
is always NULL, so remove it to clean up the code.
This commit gets rid of "stuff" for assorted functions
defined in nfs_clrpcops.c and called in nfs_clvnops.c.
Future commits will do the same for other functions.
This commit should not result in a semantics change.
Michael Tuexen [Wed, 15 Jun 2022 21:28:54 +0000 (23:28 +0200)]
tcp: fix TCPPCAP for kernels enabling VNET
Reviewed by: rscheff
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D35503
Bjoern A. Zeeb [Tue, 14 Jun 2022 16:52:45 +0000 (16:52 +0000)]
XHCI: clear warm and port reset
It seems we do not clear UPS_C_BH_PORT_RESET and UPS_C_PORT_RESET
conditions after warm or port reset. Add that code.
Obtained from: an old patch mainly debugging other problems
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D35483
Bjoern A. Zeeb [Tue, 14 Jun 2022 16:39:31 +0000 (16:39 +0000)]
USB: add quirks to XHCI
While XHCI is very generic some revisions of chipsets have problems.
On dwc3 <= 3.00a Port Disable does not seem to work so we need to not
enable it.
For that introduce quirks to xhci so that controllers can steer
certain features. I would hope that this is and remains the only one.
Obtained from: an old patch mainly debugging other problems
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D35482
Bjoern A. Zeeb [Wed, 15 Jun 2022 21:02:45 +0000 (21:02 +0000)]
LinuxKPI: 802.11: ieee80211_start_tx_ba_session()
For as long as we do not implement the compat code for tx aggregation
return -EINVAL in ieee80211_start_tx_ba_session() as both rtw88 and
rtw89 check for this value and only then disable further attempts.
MFC after: 3 days
Rick Macklem [Wed, 15 Jun 2022 20:10:44 +0000 (13:10 -0700)]
nfscl: Clean up the code by removing unused arguments
The "void *stuff" (also called fstuff and dstuff) argument
was used by the Mac OSX port. For FreeBSD, this argument
is always NULL, so remove it to clean up the code.
This commit gets rid of "stuff" for assorted functions
defined in nfs_clrpcops.c and called in nfs_clvnops.c.
Future commits will do the same for other functions.
This commit should not result in a semantics change.
Zhenlei Huang [Wed, 15 Jun 2022 17:49:27 +0000 (18:49 +0100)]
ifconfig.8: reflect removal of FDDI and Token Ring
Reviewed By: pauamma
Differential Revision: https://reviews.freebsd.org/D35409
Doug Moore [Wed, 15 Jun 2022 16:32:56 +0000 (11:32 -0500)]
iommu_gas: make iommu_gas_lowermatch non-recursive
Change the recursive implementation to one that uses parent pointers
to walk back up the rb-tree, to slightly improve performance.
Reviewed by: alc, kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35486
Alexander Motin [Wed, 15 Jun 2022 15:39:37 +0000 (11:39 -0400)]
hwpmc: Reenable PME before reenabling counters.
Doing otherwise may lead to lost interrupts, that in combination
with hardware PMCs freezing may leave them frozen forever. It may
also slightly improve profiling accuracy.
MFC after: 2 weeks
Alexander Motin [Wed, 15 Jun 2022 15:37:26 +0000 (11:37 -0400)]
hwpmc: Correct sysctl description.
MFC after: 2 weeks
Mark Johnston [Wed, 15 Jun 2022 14:47:13 +0000 (10:47 -0400)]
loader: Relax the check in is_kernphys_relocatable()
The check fails in kernels compiled with KASAN because AddressSanitizer
inserts redzones around global variables, so the size of the "kernphys"
symbol is 32 rather than 8. Thus we fall back to copying even though
it's not necessary.
Simply remove the size check. I didn't want to extend the symbol size
check since there's no guarantee that AddressSanitizer will always emit
32 bytes for "kernphys".
Reviewed by: kib
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35448
Mark Johnston [Wed, 15 Jun 2022 14:48:16 +0000 (10:48 -0400)]
kasan: Create a shadow for the bootstack prior to hammer_time()
When the kernel is compiled with -asan-stack=true, the address sanitizer
will emit inline accesses to the shadow map. In other words, some
shadow map accesses are not intercepted by the KASAN runtime, so they
cannot be disabled even if the runtime is not yet initialized by
kasan_init() at the end of hammer_time().
This went unnoticed because the loader will initialize all PML4 entries
of the bootstrap page table to point to the same PDP page, so early
shadow map accesses do not raise a page fault, though they are silently
corrupting memory. In fact, when the loader does not copy the staging
area, we do get a page fault since in that case only the first and last
PML4Es are populated by the loader. But due to another bug, the loader
always treated KASAN kernels as non-relocatable and thus always copied
the staging area.
It is not really practical to annotate hammer_time() and all callees
with __nosanitizeaddress, so instead add some early initialization which
creates a shadow for the boot stack used by hammer_time(). This is only
needed by KASAN, not by KMSAN, but the shared pmap code handles both.
Reported by: mhorne
Reviewed by: kib
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35449
Mark Johnston [Wed, 15 Jun 2022 14:29:39 +0000 (10:29 -0400)]
Fix the test used to wait for AP startup on x86, arm64, riscv
On arm64, testing pc_curpcb != NULL is not correct since pc_curpcb is
set in pmap_switch() while the bootstrap stack is still in use. As a
result, smp_after_idle_runnable() can free the boot stack prematurely.
Take a different approach: use smp_rendezvous() to wait for all APs to
acknowledge an interrupt. Since APs must not enable interrupts until
they've entered the scheduler, i.e., switched off the boot stack, this
provides the right guarantee without depending as much on the
implementation of cpu_throw(). And, this approach applies to all
platforms, so convert x86 and riscv as well.
Reported by: mmel
Tested by: mmel
Reviewed by: kib
Fixes:
8db2e8fd16c4 ("Remove the secondary_stacks array in arm64 and riscv kernels.")
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35435
Mark Johnston [Wed, 15 Jun 2022 14:19:01 +0000 (10:19 -0400)]
pmap: Keep PTI page table pages busy
PTI page table pages are allocated from a VM object, so must be
exclusively busied when they are freed, e.g., when a thread loses a race
in pmap_pti_pde(). Simply keep PTPs busy at all times, as was done for
some other kernel allocators in commit
e9ceb9dd110e04fc19729b4e9fb1c8bfbb8398a3.
Also remove some redundant assertions on "ref_count":
vm_page_unwire_noq() already asserts that the page's reference count is
greater than zero.
Reported by: syzkaller
Reviewed by: kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35466
Doug Ambrisko [Tue, 14 Jun 2022 21:37:27 +0000 (14:37 -0700)]
mount: revert the active vnode reporting feature
Revert the computing of active vnode reporting since statfs is used
by a lot of tools. Only report the vnodes used.
Reported by: mjg
Emmanuel Vadot [Tue, 14 Jun 2022 11:23:26 +0000 (13:23 +0200)]
linuxkpi: Acquire giant when adding/removing i2c adapters
We need Giant as we run in a taskqueue_thread via linux_work.
This fix detaching amdgpu and i915kms.
Reviewed by: bz, hselasky, imp
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35478
Stefan Eßer [Wed, 15 Jun 2022 09:54:13 +0000 (11:54 +0200)]
contrib/bc: merge from vendor release 5.3.3
This update fixes a build issue of release 5.3.2 on the FreeBSD base
system.
Merge commit '
3f739b0595b7d6ac4bac9aaa1cae0910f11f92e2'
MFC after: 2 weeks
Stefan Eßer [Wed, 15 Jun 2022 09:34:25 +0000 (11:34 +0200)]
vendor/bc: import version 5.3.3
This version fixes a build issue caused by the strict compiler
warnings used when building FreeBSD base system components.
Mark Johnston [Tue, 14 Jun 2022 20:37:35 +0000 (16:37 -0400)]
vm_fault: Avoid unnecessary object relocking in vm_fault_copy_entry()
Suggested by: alc
Reviewed by: alc, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35485
Mark Johnston [Tue, 14 Jun 2022 20:36:54 +0000 (16:36 -0400)]
vm_fault: Fix a racy copy of page valid bits
We do not hold the object lock or a page busy lock when copying src_m's
validity state. Prior to commit
45d72c7d7fca we marked dst_m as fully
valid.
Use the source object's read lock to ensure that valid bits are not
concurrently cleared.
Reviewed by: alc, kib
Fixes:
45d72c7d7fca ("vm_fault_copy_entry: accept invalid source pages.")
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35471
Rick Macklem [Tue, 14 Jun 2022 20:35:25 +0000 (13:35 -0700)]
nfscl: Clean up the code by removing unused arguments
The "void *stuff" (also called fstuff and dstuff) argument
was used by the Mac OSX port. For FreeBSD, this argument
is always NULL, so remove it to clean up the code.
This commit gets rid of "stuff" for assorted functions
defined in nfs_clrpcops.c and called in nfs_clvnops.c.
Future commits will do the same for other functions.
This commit should not result in a semantics change.
Stefan Eßer [Tue, 14 Jun 2022 20:06:28 +0000 (22:06 +0200)]
vendor/bc: import version 5.3.2
This update restores support for suppression of the prompt with -P
when using the libedit or libreadline libraries for command line
editing and history.
John Baldwin [Tue, 14 Jun 2022 17:52:54 +0000 (10:52 -0700)]
pmcannotate: Don't increment end address passed to objdump -d.
libpmc already returns an end address that is after the end of the
last instruction of a function (on both amd64 and arm64) as the end
address written to the annotate map file is computed as the start
address of the symbol plus the size.
Adding one could result in a curious failure where an entire
function's contents in assembly was reduced instead to only the first
instruction. The reason is that when the end instruction is bumped by
one, objdump -d can append the first instruction of the next function
in its output. However, since pmcannotate concatenates all of the
objdump -d output from various functions into a single file which it
then searches to find the assembly for a given file, if this
additional trailer was earlier in the file than the full function, the
trailer was chosen to represent the entire function resulting in the
truncated listing of the function.
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D35399
John Baldwin [Tue, 14 Jun 2022 17:51:39 +0000 (10:51 -0700)]
newvers.sh: Don't use return to exit.
Commit
acfb506b3d00 replaced an exit 0 when using -V with a return
instead. FreeBSD's sh treats a return outside of a function like
exit, but this is a non-portable extension. Other Bourne shells only
permit return to be used within a function and continue execution
(possibly with a warning).
To fix, don't reuse VARS_ONLY (which is intended to be set by other
scripts before sourcing newvers.sh directly) and instead use a new
variable (VARS_ONLY_EXIT) to restore the use of exit for the
non-sourced case.
Reviewed by: emaste
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D35481
John Baldwin [Tue, 14 Jun 2022 17:50:51 +0000 (10:50 -0700)]
firmware: Map '@' in filenames to '_' in symbols.
'@' is not a valid character in symbol names and can sometimes appear
in path names.
Reviewed by: imp, markj
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D35480
John Baldwin [Tue, 14 Jun 2022 17:42:51 +0000 (10:42 -0700)]
rc.d/ntpd: Restart ntpd when resuming from sleep.
ntpd does not always gracefully handle clock steps during resume.
This is probably most useful in conjunction with
ntpd_sync_on_start=YES which will work around any clock skew while
suspended.
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D35479
John Baldwin [Tue, 14 Jun 2022 17:35:01 +0000 (10:35 -0700)]
ktls_test: Permit an option to skip tests not using ifnet TLS.
If ktls.require_ifnet is set to true, then check the TLS offload mode
for tests sending and receiving records and skip the test if the
offload mode is not ifnet mode.
This can be used along with ktls.host to run KTLS tests against a NIC
supporting ifnet TLS and verify that expected cipher suites and
directions used ifnet TLS rather than software TLS. Receive tests may
result in a false positive as receive ifnet TLS can use software as a
fallback.
Reviewed by: markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D35427
John Baldwin [Tue, 14 Jun 2022 17:34:51 +0000 (10:34 -0700)]
ktls_test: Permit connecting to a remote echo server for tests.
Previously ktls tests always executed over a local socket pair.
ktls.host can be set to a host to connect to with a single socket
instead. The remote end is expected to echo back any data received
(such as the echo service). The port can be set with ktls.port which
defaults to "echo".
This is primarily useful to permit testing NIC TLS offload use cases
where the traffic needs to transit the NIC.
Note that the variables must be set via
'kyua -v test_suites.FreeBSD.ktls.host=host'.
Reviewed by: markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D35426
John Baldwin [Tue, 14 Jun 2022 17:34:38 +0000 (10:34 -0700)]
ktls_test: Add a helper function to close sockets.
Reviewed by: markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D35425
Mitchell Horne [Tue, 14 Jun 2022 16:09:11 +0000 (13:09 -0300)]
ddb: namespacing of struct command
'command' is too generic for something specific to the kernel debugger;
change this so it is less likely to collide with local variable names.
Also rename struct command_table to struct db_command_table.
Reviewed by: markj
MFC after: 1 week
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35367
Mitchell Horne [Tue, 14 Jun 2022 16:07:30 +0000 (13:07 -0300)]
modules: Only build MAC modules if options MAC is set
They are not loadable otherwise.
Reviewed by: emaste
MFC after: 1 week
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35369
Mark Johnston [Tue, 14 Jun 2022 15:36:00 +0000 (11:36 -0400)]
mount: Fix an incorrect assertion in kernel_mount()
The pointer to the mount values may be null if an error occurred while
copying them in, so fix the assertion condition to reflect that
possibility.
While here, move some initialization code into the error == 0 block. No
functional change intended.
Reported by: syzkaller
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Mark Johnston [Tue, 14 Jun 2022 15:35:20 +0000 (11:35 -0400)]
vm_object: Use the vm_object_(set|clear)_flag() helpers
... rather than setting and clearing flags inline. No functional change
intended.
Reviewed by: alc, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35469
Mark Johnston [Tue, 14 Jun 2022 15:34:57 +0000 (11:34 -0400)]
truss: Make control message header parsing more robust
print_cmsg() was assuming that the control message chain is well-formed,
but that isn't necessarily the case for sendmsg(2). In particular, if
cmsg_len is zero, print_cmsg() will loop forever. Check for truncated
headers and try to recover if possible.
Reviewed by: tuexen
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35476
Mark Johnston [Tue, 14 Jun 2022 15:27:38 +0000 (11:27 -0400)]
rip6: Fix a lock order reversal in rip6_bind()
See also commit
71a1539e3783.
Reported by: syzbot+
9b461b6a07a83cc10daa@syzkaller.appspotmail.com
Reported by: syzbot+
b6ce0aec16f5fdab3282@syzkaller.appspotmail.com
Reviewed by: glebius
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35472
Mark Johnston [Tue, 14 Jun 2022 14:52:03 +0000 (10:52 -0400)]
pipe: Use a distinct wait channel for I/O serialization
Suppose a thread tries to read from an empty pipe. pipe_read() does the
following:
1. pipelock(), possibly sleeping
2. check for buffered data
3. pipeunlock()
4. set PIPE_WANTR and sleep
5. goto 1
pipelock() is an open-coded mutex; if a thread blocks in pipelock(), it
sleeps until the lock holder calls pipeunlock().
Both sleeps use the same wait channel. So if there are multiple threads
in pipe_read(), a thread T1 in step 3 can wake up a thread T2 sleeping
in step 4. Then T1 goes to sleep in step 4, and T2 acquires and
releases the pipelock, waking up T1 again. This can go on indefinitely,
livelocking the process (and potentially starving a would-be writer).
Fix the problem by using a separate wait channel for pipelock().
Reported by: Paul Floyd <paulf2718@gmail.com>
Reviewed by: mjg, kib
PR: 264441
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35415
Cy Schubert [Sun, 12 Jun 2022 19:02:47 +0000 (12:02 -0700)]
rc.d/wpa_supplicant: Remove the sleep to improve boot time
bapt@ had discovered a noticeable boot improvement without the sleep.
Without the sleep does not affect warm or cold boot however a
service netif restart may cause dhclient to spend a few extra seconds
to rerequest the DHCP request.
Reported by: bapt
Reviewed by: bapt
MFC after: 2 months
Differential Revision: https://reviews.freebsd.org/D35457
Mitchell Horne [Mon, 13 Jun 2022 13:21:18 +0000 (10:21 -0300)]
Remove mips-specific Makefiles for /sbin and /usr/sbin
They are no longer needed, but were likely missed simply because they
don't show up in a grep for 'mips'.
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D35475
Konstantin Belousov [Fri, 10 Jun 2022 11:35:45 +0000 (14:35 +0300)]
null_vptocnp(): busy nullfs mp instead of refing it
null_nodeget() needs a valid mount point data, otherwise we might
race and dereference NULL.
Using MBF_NOWAIT makes non-forced unmount non-transparent for
vn_fullpath() over nullfs, but we make no guarantee that fullpath
calculation succeeds anyway.
Reported and tested by: pho
Reviewed by: jah
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D35477
Doug Moore [Tue, 14 Jun 2022 05:47:22 +0000 (00:47 -0500)]
iommu_gas: use to first-fit search for lowermatch
Reverse the order of the search for a free space in lowermatch, to
make it a first-fit search. Iommu_gas_match_one always allocates from
the beginning of the free gap discovered from searching the tree, so
the current code isn't really allocating in a reverse first-fit
anyway, and making the search first-fit reduces the number of iommu
page table pages that are used.
Reported by: alc
Reviewed by: alc, kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35458
Peter Holm [Tue, 14 Jun 2022 04:59:32 +0000 (06:59 +0200)]
stress2: Added a syzkaller reproducer. Enable all reaper tests