Commit Graph

271285 Commits

Author SHA1 Message Date
Doug Moore
e6930b1c5f vm_phys: convert error back to warning
Move an assignment back to where it was before, to turn the
defined-but-not-used error back into a set-but-not-used warning.

Fixes:	01e115ab83 vm_phys: #include vm_extern
2021-12-31 00:23:46 -06:00
Doug Moore
01e115ab83 vm_phys: #include vm_extern
Arm64 and powerpc don't include vm_extern.h indirectly in vm_phys.c, which
means that for the sake of those architectures, it must be included explicitly.

Also, fix a set-unused warning that jenkins also found.

Reported by:	Jenkins
Fixes:	c606ab59e7 vm_extern: use standard address checkers everywhere
2021-12-30 23:31:18 -06:00
Doug Moore
029abd3b29 Remove discarded mips source. 2021-12-30 22:12:46 -06:00
Doug Moore
c606ab59e7 vm_extern: use standard address checkers everywhere
Define simple functions for alignment and boundary checks and use them
everywhere instead of having slightly different implementations
scattered about. Define them in vm_extern.h and use them where
possible where vm_extern.h is included.

Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D33685
2021-12-30 22:09:08 -06:00
Warner Losh
c09981f142 mips: Remove sys/mips
Remove sys/mips as the next step of decomissioning mips from the tree.
Remove mips special cases from the kernel make files. Remove the mips
specific linker scripts.

Sponsored by:		Netflix
2021-12-30 20:57:24 -07:00
Warner Losh
fe532f1a50 libkvm: Remove mips support
libkvm references files in sys/mips, so remove it ahead of removing
sys/mips.

Sponsored by:		Netflix
2021-12-30 20:57:24 -07:00
Ed Maste
818952c638 Fix kernel build without INET6
Reported by:	Gary Jennejohn
Fixes:		ff3a85d324 ("[lltable] Add per-family lltable ...")
Sponsored by:	The FreeBSD Foundation
2021-12-30 18:40:46 -05:00
Warner Losh
5974cfe1ba kboot: move to generic syscall interface
Just have the MD code provide syscall and have generic code for the
rest.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D33515
2021-12-30 16:07:20 -07:00
Warner Losh
6497250f6f kboot: Split out powerpc build
Split the powerpc specific parts into kboot/arch/powerpc64. More may be
needed here.

Sponsored by:		Netflix
Reviewed by:		jhibbits
Differential Revision:	https://reviews.freebsd.org/D33514
2021-12-30 16:07:13 -07:00
Warner Losh
4366199644 kboot: Move powerpc kboot to top level
As the first step at making this more generic, move kboot to top level.

Sponsored by:		Netflix
Reviewed by:		luporl, tsoome
Differential Revision:	https://reviews.freebsd.org/D33513
2021-12-30 16:07:06 -07:00
Warner Losh
20a0965182 kboot: Add docs for WITH/WITHOUT LOADER_KBOOT
Sponsored by:		Netflix
Suggestion by:		emaste
Differential Revision:	https://reviews.freebsd.org/D33512
2021-12-30 16:06:53 -07:00
Warner Losh
1a7ed7fe93 kboot: Add MK_LOADER_KBOOT
Control building of KBOOT same as we do for uboot.

Sponsored by:		Netflix
Reviewed by:		tsoome
Differential Revision:	https://reviews.freebsd.org/D33511
2021-12-30 16:06:28 -07:00
Warner Losh
0c7a642ae8 tinybsd: Remove
This hasn't been updated in 10 years in any real way. It's time to
retire it. It hasn't worked in some time due to drivers being removed
starting in FreeBSD 10.  All the interesting bits have already been
hoisted into other parts of base. The google code site hasn't had any
commits since 2011 and claims to Target FreeBSD 5, 6, 7, and 8.

Should someone fix the numerous issues, it can be restored.

Sponsored by:		Netflix
Reviewed by:		brooks
Differential Revision:	https://reviews.freebsd.org/D33450
2021-12-30 15:57:22 -07:00
John Baldwin
74cf7cae4d softclock: Use dedicated ithreads for running callouts.
Rather than using the swi infrastructure, rewrite softclock() as a
thread loop (softclock_thread()) and use it as the main routine of the
softclock threads.  The threads use the CC_LOCK as the thread lock
when idle.

Reviewed by:	mav, imp, kib
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D33683
2021-12-30 14:55:08 -08:00
John Baldwin
dda9847275 depend-cleanup.sh: Handle stale libc++.so ldscripts.
libc++ was moved from /usr/lib to /lib, but the libc++.so linker
script is not regenerated when the value of SHLIB changes.

Reported by:	cy
2021-12-30 14:25:47 -08:00
Garance A Drosehn
b7b447fd4c When parsing a rule to rotate log files on a specific week day,
parseDWM() can advance the time to the next week. If the next week is
in the next month, then tm_mon is incremented. However, the increment
was failing to handle the wraparound from December to January, so when
parsing a rule during the last week of the December, the month would
advance to month 12. This triggered an out-of-bounds read of the
mtab[] array in days_pmonth() after parseDWM() returned.  To fix,
this change resets the month to January and increment the year when
the month increment wraps.

The default rule for /var/log/weekly.log triggers this during the
last week of December each year.
Reported by:	CHERI
Obtained from:	CheriBSD
Reviewed by:	jhb
Sponsored by:	The University of Cambridge, Google Inc.
Differential Revision:	<https://reviews.freebsd.org/D33687>
2021-12-30 20:45:13 +00:00
Dimitry Andric
5e6a2d6eb2 Reapply: move libc++ from /usr/lib to /lib
As with other runtime components like libc or libcxxrt.

If desired we can stop linking devd statically after this change (to
achive approximately no net change in required root filesystem size).

We must set SHLIBDIR with ?= before including <src.opts.mk>, otherwise
that will have set SHBLIDIR to its default value of /usr/lib.

Otherwise, "make delete-old-libs" would suggest to delete libc++.so.1
from /usr/lib, while there was not yet a copy in /lib.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33123
2021-12-30 17:08:54 +01:00
Emmanuel Vadot
dfc9c1d493 loader: tftp: Copy the first block into the cache
tftp_open reads the first block so copy it in the cached data.
If we have more than one block (i.e. we called tftp_read before
tftp_preload) simply just reset the transfer.

Reported by:	mmel
Reviewed by:	mmel, tsoome
MFC after:	2 weeks
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33697
2021-12-30 16:30:13 +01:00
Ed Maste
b6f7942cbc Revert "Move libc++ from /usr/lib to /lib"
This reverts commit 6b1c5775d1.
There are reports of errors with this change.

Reported by:	antoine
2021-12-30 10:25:58 -05:00
Michael Tuexen
1adb91e521 sctp: retire sctp_mtu_size_reset()
Thanks to Timo Voelker for making me aware that sctp_mtu_size_reset()
is very similar to sctp_pathmtu_adjustment().

MFC after:	3 days
2021-12-30 15:30:11 +01:00
Michael Tuexen
2de2ae331b sctp: improve sctp_pathmtu_adjustment()
Allow the resending of DATA chunks to be controlled by the caller,
which allows retiring sctp_mtu_size_reset() in a separate commit.
Also improve the computaion of the overhead and use 32-bit integers
consistently.
Thanks to Timo Voelker for pointing me to the code.

MFC after:	3 days
2021-12-30 15:16:05 +01:00
Stefan Eßer
b78860f96c sys/sys/cpuset.h
Fix typo in source file.

Reported by:	pluknet at gmail.com (Sergey Kandaurov)
2021-12-30 13:14:43 +01:00
Stefan Eßer
e2650af157 Make CPU_SET macros compliant with other implementations
The introduction of <sched.h> improved compatibility with some 3rd
party software, but caused the configure scripts of some ports to
assume that they were run in a GLIBC compatible environment.

Parts of sched.h were made conditional on -D_WITH_CPU_SET_T being
added to ports, but there still were compatibility issues due to
invalid assumptions made in autoconfigure scripts.

The differences between the FreeBSD version of macros like CPU_AND,
CPU_OR, etc. and the GLIBC versions was in the number of arguments:
FreeBSD used a 2-address scheme (one source argument is also used as
the destination of the operation), while GLIBC uses a 3-adderess
scheme (2 source operands and a separately passed destination).

The GLIBC scheme provides a super-set of the functionality of the
FreeBSD macros, since it does not prevent passing the same variable
as source and destination arguments. In code that wanted to preserve
both source arguments, the FreeBSD macros required a temporary copy of
one of the source arguments.

This patch set allows to unconditionally provide functions and macros
expected by 3rd party software written for GLIBC based systems, but
breaks builds of externally maintained sources that use any of the
following macros: CPU_AND, CPU_ANDNOT, CPU_OR, CPU_XOR.

One contributed driver (contrib/ofed/libmlx5) has been patched to
support both the old and the new CPU_OR signatures. If this commit
is merged to -STABLE, the version test will have to be extended to
cover more ranges.

Ports that have added -D_WITH_CPU_SET_T to build on -CURRENT do
no longer require that option.

The FreeBSD version has been bumped to 1400046 to reflect this
incompatible change.

Reviewed by:	kib
MFC after:	2 weeks
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D33451
2021-12-30 12:20:32 +01:00
Dimitry Andric
1331805574 Avoid emitting popcnt in libclang_rt.fuzzer*.a if unsupported
Since popcnt is only supported by CPUTYPE=nehalem and later, ensure that
this instruction is only emitted when appropriate. Otherwise, programs
using the library can abort with SIGILL.

See also: https://github.com/llvm/llvm-project/issues/52893

PR:		258156
Reported by:	Eric Rucker <bhtooefr@bhtooefr.org>
MFC after:	3 days
2021-12-30 10:55:49 +01:00
Gleb Smirnoff
841e0a8757 uma: with KTR trace allocs/frees from SMR zones 2021-12-29 23:08:33 -08:00
Gleb Smirnoff
28782f73df uma: with KTR report item being freed in uma_zfree_arg() 2021-12-29 23:08:15 -08:00
Gleb Smirnoff
dcb724b5a7 ktrdump: properly parse %% in the format string
Discovered by:	27ca37acb7
2021-12-29 23:08:15 -08:00
Fedor Uporov
f1d5e2c862 Improve extents verification logic
Add functionality for extents validation inside the filesystem
extents block. The main logic is implemented under
ext4_validate_extent_entries() function, which verifies extents
or extents indexes depending of extent depth value.

PR:                     259112
Reported by:            Robert Morris
Reviewed by:            pfg
MFC after:              2 weeks
Differential Revision:  https://reviews.freebsd.org/D33375
2021-12-30 09:14:45 +03:00
Fedor Uporov
ced2172822 Add more accurate check for root inode
Check that root inode has links and is directory.

PR:             259105
Reported by:    Robert Morris
MFC after:      2 weeks
2021-12-30 09:14:45 +03:00
Fedor Uporov
bb9f1ba4b5 Add more accurate directory entries check
Rename ext2_dirbadentry() to ext2_check_direntry(). Add directory
entry inode value check, and call ext2_check_direntry() in all cases.
The dirchk sysctl is removed.

PR:                     259024,259041
Reported by:            Robert Morris
Reviewed by:            pfg
MFC after:              2 weeks
Differential Revision:  https://reviews.freebsd.org/D33374
2021-12-30 09:14:44 +03:00
Fedor Uporov
5034b44574 Remove unnecessary e2fs_first_dblock value check
MFC after:      2 weeks
2021-12-30 09:14:44 +03:00
Alexander Motin
b06771aa66 CTL: Allow I/Os up to 8MB, depending on maxphys value.
For years CTL block backend limited I/O size to 1MB, splitting larger
requests into sequentially processed chunks.  It is sufficient for
most of use cases, since typical initiators rarely use bigger I/Os.

One of known exceptions is VMWare VAAI offload, by default sending up
to 8 4MB EXTENDED COPY requests same time.  CTL internally converted
those into 32 1MB READ/WRITE requests, that could overwhelm the block
backend, having finite number of processing threads and making more
important interactive I/Os to wait in its queue.  Previously it was
partially covered by CTL core serializing sequential reads to help
ZFS speculative prefetcher, but that serialization was significantly
relaxed after recent ZFS improvements.

With the new settings block backend receives 8 4MB requests, that
should be easier for both CTL itself and the underlying storage.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2021-12-29 23:49:24 -05:00
John Baldwin
61ff0a1f81 /dev/crypto: Store blocksize in cse rather than txform pointer.
Reviewed by:	markj
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D33614
2021-12-29 17:50:23 -08:00
John Baldwin
c3907ef482 /dev/crypto: Minimize cipher-specific logic.
Rather than duplicating the switches in crypto_auth_hash() and
crypto_cipher(), copy the algorithm constants from the new session
ioctl into a csp directly which permits using the functions in
crypto.c.

Reviewed by:	markj
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D33613
2021-12-29 17:50:03 -08:00
John Baldwin
c3a688ef4d OCF: Hook up plain RIPEMD160 in cryptosoft and /dev/crypto.
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33612
2021-12-29 16:46:48 -08:00
John Baldwin
b406897911 iscsi: Handle large Text responses.
Text requests and responses can span multiple PDUs.  In that case, the
sender sets the Continue bit in non-final PDUs and the Final bit in
the last PDU.  The receiver responds to non-final PDUs with an empty
text PDU.

To support this, add a more abstract API in libiscsi which accepts and
receives key sets rather than PDUs.  These routines internally send or
receive one or more PDUs.  Use these new functions to replace the
handling of TextRequest and TextResponse PDUs in discovery sessions in
both ctld and iscsid.

Note that there is not currently a use case for large Text requests
and those are still always sent as a single PDU.  However, discovery
sessions can return a text response listing targets that spans
multiple PDUs, so the new API supports sending and receiving multi-PDU
responses.

Reported by:	Jithesh Arakkan @ Chelsio
Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D33548
2021-12-29 14:36:04 -08:00
Toomas Soome
04f55b5b0e bhyve smbios type 3 structure is incorrect
If you look at the SMBIOS specification, we'll find something is
missing. In particular at offset 0Dh is supposed to be the OEM-defined
field. This should go between security and height. It is not legal to
actually skip this and will lead to other folks not properly
interpreting later parts of the table.

https://www.illumos.org/issues/14312

Reviewed by:	jhb
Submitted by:	Robert Mustacchi <rm@fingolfin.org>
Obtained from:	ilumos
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D33682
2021-12-27 20:06:33 +02:00
Toomas Soome
c2fa905cf6 bhyve: clean up trailing whitespaces
Clean up trailing whitespaces. No functional changes.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D33681
2021-12-27 19:58:10 +02:00
Alexander Motin
62ed2d0152 libc: Fix build with -DNS_REREAD_CONF.
MFC after:	3 days
2021-12-29 17:01:05 -05:00
Alexander V. Chernikov
63f7f3921b routing: Add unified level-based logging support for the routing subsystem.
Summary: MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D33664
2021-12-29 21:30:18 +00:00
Alexander V. Chernikov
823a08d740 nhops: split nh_family into nh_upper_family and nh_neigh_family.
With IPv4 over IPv6 nexthops and IP->MPLS support, there is a need
 to distingush "upper" e.g. traffic family and "neighbor" e.g. LLE/gateway
 address family. Store them explicitly in the private part of the nexthop data.

While here, store nhop fibnum in nhop_prip datastructure to make it self-contained.

MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D33663
2021-12-29 21:03:19 +00:00
Alexander V. Chernikov
ff3a85d324 [lltable] Add per-family lltable getters.
Introduce a new function, lltable_get(), to retrieve lltable pointer
 for the specified interface and family.
Use it to avoid all-iftable list traversal when adding or deleting
 ARP/ND records.

Differential Revision: https://reviews.freebsd.org/D33660
MFC after:	2 weeks
2021-12-29 20:57:15 +00:00
Colin Percival
33812d60b9 vfs_mountroot: Check for root dev before waiting
If GEOM is idle but the root device is not yet present when we enter
vfs_mountroot_wait_if_necessary, we call vfs_mountroot_wait to wait
for root holds (e.g. CAM or USB initialization).  Upon returning from
vfs_mountroot_wait, we wait 100 ms at a time until the root device
shows up.

Since the root device most likely appeared during vfs_mountroot_wait
-- waiting for subsystems which may be responsible for the root
device is the whole purpose of that function -- it makes sense to
check if the device is now present rather than printing a warning
and pausing for 100 ms before checking.

Reviewed by:	trasz
Fixes: a3ba3d09c2 Make root mount wait mechanism smarter
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D33593
2021-12-29 12:41:09 -08:00
Colin Percival
19a172158c vfs_mountroot: Wait for GEOM idle post root holds
In the case of a root hold related to the initialization of a disk
device, a flurry of GEOM tasting is likely to take place as soon as
the device is initialized and the root hold is released.  If we
don't wait for GEOM idle it's easy for vfs_mountroot to "win" the
race and proceed before the root filesystem GEOM is ready.

Reviewed by:	imp
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D33592
2021-12-29 12:41:08 -08:00
Colin Percival
e6db5eb9ec vfs_mountroot: Skip 'Root mount waiting' < 1 s
While the message is technically correct, it's not particularly
helpful in the case where we're only waiting a few ms; this case
occurs frequently on EC2 arm64 instances with CAM initialization
racing to release its root hold before vfs_mountroot reaches this
point.  Only print the message if we end up waiting for more than
one second.

Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D33591
2021-12-29 12:41:08 -08:00
Ed Maste
ca457394fc readelf: add Go Build ID ELF note support
Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D33379
2021-12-29 15:30:22 -05:00
Ed Maste
edadbb4606 ar: deprecate -T option
Other ar implementations (GNU, LLVM) use -T to mean thin archive
rather than use only the first fifteen characters of the archive member
name.  We support both -T and -f for this, with -f documented as an
alias of -T.

An exp-run showed that the ports invoking `ar -T` expect thin archives,
not truncated names.  Switch -f to be the documented flag for this
behaviour, and emit a warning when -T is used.

The warning will be changed to an error in the future (in main), once
ports no longer use -T.

PR:		260523 [exp-run]
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-12-29 15:14:06 -05:00
Ed Maste
6b1c5775d1 Move libc++ from /usr/lib to /lib
As with other runtime components like libc or libcxxrt.

If desired we can stop linking devd statically after this change (to
achive approximately no net change in required root filesystem size).

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33123
2021-12-29 14:51:28 -05:00
Doug Moore
8119cdd38b vm_phys: hide vm_phys_set_pool
It is only called in the file that defines it, so make it static and
remove the declaration from the header.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D33688
2021-12-29 11:17:33 -06:00
Bjoern A. Zeeb
f1442847c9 bhyve: passthru: enable BARs before possibly mmap(2)ing them
The first time we start bhyve with a passthru device everything is fine
as on boot we do enable BARs.  If a driver (unload) inside bhyve disables
the BAR(s) as some Linux drivers do, we need to make sure we re-enable
them on next bhyve start.

If we are trying to mmap a disabled BAR for MSI-X (PCIOCBARMMAP)
the kernel will give us an EBUSY.
While we were re-enabling the BAR(s) in the current code loop
cfginit() was writing the changes out too late to the real hardware.

Move the call to init_msix_table() after the register on the real
hardware was updated.  That way the kernel will be happy and the
mmap will succeed and bhyve will start.
Also simplify the code given the last argument to init_msix_table()
is unused we do not need to do checks for each bar. [1]

MFC after:	3 days
PR:		260148
Pointed out by:	markj [1]
Sponsored by:	The FreeBSD Foundation
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D33628
2021-12-29 17:01:05 +00:00