Commit Graph

276611 Commits

Author SHA1 Message Date
Martin Matuska
a0b956f5ac zfs: merge openzfs/zfs@cb01da680
Notable upstream pull request merges:
  #12438 Avoid panic with recordsize > 128k, raw sending and no large_blocks
  #13015 Fix dnode byteswapping
  #13256 Add a "zstream decompress" subcommand
  #13555 Scrub mirror children without BPs
  #13576 Several sorted scrub optimizations
  #13579 Fix and disable blocks statistics during scrub
  #13582 Several B-tree optimizations
  #13591 Avoid two 64-bit divisions per scanned block
  #13606 Avoid memory copies during mirror scrub
  #13613 Avoid memory copy when verifying raidz/draid parity

Obtained from:	OpenZFS
OpenZFS commit:	cb01da6805
2022-07-08 00:02:36 +02:00
Alfredo Dal'Ava Junior
4f5890a0fb csu: test: explicitly add libm as build parameter
CSU tests build fails with '/usr/lib/libgcc_s.so: undefined reference to
fma' when built with LLVM 14 for powerpcspe, so '-lm' is being added
explicitly.

It may be linked to https://reviews.llvm.org/D77558

Reviewed by:	imp (earlier version)
MFC after:	2 days
Sponsored by:	Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D35691
2022-07-07 20:58:04 -03:00
John Baldwin
0b09867f67 Simplify conditional guards for libclang_rt.
All supported architectures can build libclang_rt now.

Reviewed by:	dim
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D35740
2022-07-07 13:54:57 -07:00
Finix1979
cb01da6805
Call nvlist_free before return
Fixes a small kernel memory leak which would occur if a pool failed
to import because the `DMU_POOL_VDEV_ZAP_MAP` key can't be read from 
a presumably damaged MOS config.  In the case of a missing key there 
was no leak.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Finix1979 <yancw@info2soft.com>
Closes #13629
2022-07-07 11:43:58 -07:00
Mateusz Piotrowski
a6e734d779 rc.conf.5: Add /etc/rc.conf.d/ to FILES
While here, fix the -width argument.

MFC after:	3 days
2022-07-07 20:09:17 +02:00
Mateusz Piotrowski
df1817a81e rc.conf.5: Improve documentation of <name>_oomprotect
Apart from improving readability, this commit mentions that
<name>_oomprotect is ignored in a jail environment. Also, replace
${name}_cmd with the correct ${argument}_cmd and point the reader to
rc.subr(8).

MFC after:	1 week
2022-07-07 20:09:17 +02:00
Mateusz Piotrowski
cb56f86025 protect.1: Improve synopsis
While here, make the list's -width argument a bit shorter for
readability.

MFC after:	3 days
2022-07-07 20:09:16 +02:00
Albert Jakiela
4692906480 e6000sw: add readphy and writephy wrappers
New functions take lock and give lock after operation.
Removed locking and unlocking within other methods,
to prevent from recursive locking on non recursive lock.

Tested on EspressoBin.

Reviewed by: mw
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D35656
2022-07-07 18:25:00 +02:00
Cy Schubert
c47db49ba4 ipfilter: Support only jails in VNET
Jails without VNET have complete access to the ipfilter rules, NAT,
pools and logs. This is insecure. Only allow jails to manipulate
ipfilter rules, NAT tables and ippools if the jail has its own VNET.
Otherwise a jail can affect the global system.

This patch brings ipfilter in line with ipfw's support of VNET jails and
non-support of non-VNET jails.

MFC after:	1 week
2022-07-07 07:53:45 -07:00
Cy Schubert
70b56f4b92 sqlite3: Vendor import of sqlite3 3.39.0
Changes at https://www.sqlite.org/releaselog/3_39_0.html.

Obtained from https://www.sqlite.org/2022/sqlite-autoconf-3390000.tar.gz

MFC after:      1 month

Merge commit '2380f7c9781e64d137f0712a8fb185dee648ed8c' into new_merge
2022-07-07 06:04:21 -07:00
Alexander V. Chernikov
ce414d02c1 netinet6: add ip6_output() tests.
Differential Revision: https://reviews.freebsd.org/D35708
2022-07-07 10:09:28 +00:00
Alexander V. Chernikov
cfc9cf9baf testing: add ability to specify multi-vnet topologies in the pytest framework.
Notable amount of tests related to the packet IO require two VNET jails
 for proper testing and avoiding side effects for the host system.
Additionally, it is often required to run actions in the jails seme-sequentially
- waiting for the listener initialisation can be an example of such
  dependency.

This change extends pytest vnet framework to allow defining multi-vnet
 multi-epair topologies in declarative style, without any need to bother
 about jail or repair names. All jail creation/teardown, interface
 creation/teardown and address assignments are handled automatically.

Example:

TOPOLOGY = {
  "vnet1": {"ifaces": ["if1", "if2", "if3"]},
  "vnet2": {"ifaces": ["if1", "if2", "if3"]},
  "if1": {"prefixes6": [("2001:db8:a::1/64", "2001:db8:a::2/64")]},
  "if2": {"prefixes6": [("2001:db8:b::1/64", "2001:db8:b::2/64")]},
  "if3": {"prefixes6": [("2001:db8:c::1/64", "2001:db8:c::2/64")]},
}
def vnet2_handler(self, vnet, obj_map, pipe):
  ss = VerboseSocketServer("::", self.DEFAULT_PORT)
  pipe.send("READY")

def test_output6_base(self):
  self.wait_object(second_vnet.pipe)

The definitions above will create 2 vnets ("jail_test_output6_base",
 "jail_test_output6_base_2"), 3 epairs, attached to both first and
 second jails, set up the IP addresses for each epair, spawn another
 process for vnet2_handler and pass control to vnet2_handler and
 test_output6_base. Both processes can pass objects between each
 other using pre-created pipes.

Differential Revision: https://reviews.freebsd.org/D35708
2022-07-07 10:05:06 +00:00
Andrew Turner
92f692fd24 Only add gicv3 fdt children with a compatible property
Not all gicv3 fdt children have a compatible property. Those that don't
are configuration data rather than something that should have a driver
attach.

Sponsored by:	The FreeBSD Foundation
2022-07-07 10:29:10 +01:00
Kristof Provost
37f604b49d vnet: make VNET_FOREACH() always be a loop
VNET_FOREACH() is a LIST_FOREACH if VIMAGE is set, but empty if it's
not. This means that users of the macro couldn't use 'continue' or
'break' as one would expect of a loop.

Change VNET_FOREACH() to be a loop in all cases (although one that is
fixed to one iteration if VIMAGE is not set).

Reviewed by:	karels, melifaro, glebius
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D35739
2022-07-07 09:52:21 +02:00
Peter Holm
a526ec4351 stress2: Added a mount(8) test scenario 2022-07-07 09:44:55 +02:00
Cy Schubert
2380f7c978 sqlite3: Vendor import of sqlite3 3.39.0
Changes at https://www.sqlite.org/releaselog/3_39_0.html.

Obtained from https://www.sqlite.org/2022/sqlite-autoconf-3390000.tar.gz
2022-07-06 23:15:38 -07:00
Gleb Smirnoff
d961ccd350 sockstat(1): print PID adjusted to the right
This allows for easy copy-and-paste of a unix(4) peer name for lookup.
With current implementation it is guaranteed that a peer listed could be
found in the output.

Differential revision:	https://reviews.freebsd.org/D35727
2022-07-06 22:19:08 -07:00
Gleb Smirnoff
2c436d4890 sockstat(1): print out full connection graph for unix(4) sockets
Kernel provides us with enough information to display all possible
connections between UNIX sockets.

o Store unp_conn, xu_firstref and xu_nextref in the faddr of a UNIX sock.
o Build tree of file descriptors, indexed by the socket pointer.
o In displaysock() print out all possible information:
  1) if socket is bound, print name of this socket
  2) if socket has connected to a peer with a name, print peers name
  3) if socket has connected to a peer without a name, print [pid fd]
  4) if a bound socket has received connections, print list of them
     as [pid fd]
  Previously, only 1) either 2) were printed.

Reviewed by:		tuexen
Differential revision:	https://reviews.freebsd.org/D35726
2022-07-06 22:19:08 -07:00
Gleb Smirnoff
c5bdcd1f10 sockstat(1): widen the FD printing format
Three digit file descriptors are very common these days.  So let the
columns not break with them.

Reviewed by:		tuexen
Differential revision:	https://reviews.freebsd.org/D35725
2022-07-06 22:19:08 -07:00
Gleb Smirnoff
a83d596f43 sockstat(1): use tree(3) rbtree instead of hash
o Use tree to lookup by socket kvaddr. The size of hash is too big for a
  small virtual machine and at the same time too little for a large
  production server.  A tree would better fit here.
o For those pcbs, that don't have a socket associated, use a list.
o Provide a second tree to lookup by pcb kvaddr.  These removes full hash
  traversal when printing every unix(4) socket.

Reviewed by:		tuexen
Differential revision:	https://reviews.freebsd.org/D35724
2022-07-06 22:19:08 -07:00
Gleb Smirnoff
7d016011f4 sockstat(1): we don't need kernel struct unpcb
Fixes:	0e229f343f
2022-07-06 22:19:08 -07:00
Gleb Smirnoff
86cdadbed4 tree(3): allow the compare function to return any signed type
This allows to write very short comparison function when we are
comparing just pointer values:

	return ((intptr_t)((uintptr_t)a->ptr/2 - (uintptr_t)b->ptr/2));

Reviewed by:		dougm, alc
Differential revision:	https://reviews.freebsd.org/D35722
2022-07-06 22:19:08 -07:00
Gleb Smirnoff
1b91978f63 tcp: remove a condition in tcp_usr_detach() that never happens
The comment from Robert Watson doubts that this condition ever happens.
Our analysis confirm that.  Also, we found that if you manage to create
such a connection with help of some other bug, then after the "second
case" code is executed, the kernel will panic in other part of the stack.

Reviewed by:		rrs, tuexen
Differential revision:	https://reviews.freebsd.org/D35714
2022-07-06 21:09:45 -07:00
Kirk McKusick
5bc926af9f Bug fix to UFS/FFS superblock integrity checks when reading a superblock.
Older versions of growfs(8) failed to correctly update fs_dsize.
Filesystems that have been grown fail the test for fs_dsize's correct
value. For now we exclude the fs_dsize test from the requirements.

Reported by: Edward Tomasz Napiera
Tested by:   Edward Tomasz Napiera
Tested by:   Peter Holm
MFC after:   1 month (with 076002f24d)
Differential Revision: https://reviews.freebsd.org/D35219
2022-07-06 14:45:30 -07:00
Kirk McKusick
9e1f44d044 Bug fix to UFS/FFS superblock integrity checks when reading a superblock.
The original check verified that if an alternate superblock has not
been selected that the superblock is located in its standard location.
For UFS1 the with a 65536 block size, the first backup superblock
is at the same location as the UFS2 superblock. Since SBLOCK_UFS2
is the first location checked, the first backup is the superblock
that will be used for a UFS1 filesystems with a 65536 block size.
This patch allows the use of the first backup superblock in that
situation.

Reported by: Peter Holm
Tested by:   Peter Holm
MFC after:   1 month (with 076002f24d)
Differential Revision: https://reviews.freebsd.org/D35219
2022-07-06 14:45:30 -07:00
Kirk McKusick
f3f5368dfb Bug fix to UFS/FFS superblock integrity checks when reading a superblock.
The tests for number of cylinder groups (fs_ncg), inodes per cylinder
group (fs_ipg), and the size and layout of the cylinder group summary
information (fs_csaddr and fs_cssize) were overly restrictive and
would exclude some valid filesystems. These updates avoid precluding
valid fiesystems while still detecting rogue values that can crash or
hang the kernel.

Reported by: Chuck Silvers
Tested by:   Peter Holm
MFC after:   1 month (with 076002f24d)
Differential Revision: https://reviews.freebsd.org/D35219
2022-07-06 14:45:29 -07:00
Alexander V. Chernikov
2bfd8b5b94 testing: provide meaningful error when pytest is not available
atf format does not provide any way of signalling any error message
 back to the atf runner when listing tests. Work this around by
 reporting "__test_cases_list_pytest_binary_not_found__" test instead.

Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D35721
2022-07-06 19:55:58 +00:00
Mitchell Horne
6f50b73ee5 libpmc: add armv8 pmu-event aliases
These are all "standard microarchitectural events", which in theory are
supported by every ARMv8 processor. In practice, it depends on the
pmu-event definitions being complete and accurate, which they are not
for every processor. Still, these aliases should be functional on the
majority of systems.

PR:		254532
Reported by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35550
2022-07-06 14:32:21 -03:00
Mitchell Horne
9d97138e2d libpmc: import updated pmu-events for arm64
Thanks to the recently updated import of the jevents utility by mav@, we
can now compile the latest version of these event definitions. This
should support a wider set of common ARMv8 processors, for example, the
Cortex-A72 in the Raspberry Pi 4.

This brings this folder in sync with Linux commit 62e6eb8d5454.

Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35549
2022-07-06 14:32:21 -03:00
Michal Krawczyk
25b64933a4 ena: Update driver version to v2.6.1
Minor version update which improves styling of a printouts, fixes
the KASAN and KMSAN kernel builds and LLQ reconfiguration after the
device reset.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
2022-07-06 17:06:21 +02:00
Michal Krawczyk
3324e304c1 ena: Fix LLQ descriptor reconfiguration
After the device reset, the LLQ configuration descriptor wasn't passed
to the hardware. On a 6-generation AWS instances (like C6gn), it is
required to pass the LLQ descriptor after the device reset, otherwise
the hardware will be missing the LLQ configuration resulting in
performance degradation.

This patch reconfigures the LLQ each time the ena_device_init() is
called. This means that the LLQ descriptor will be passed during the
initial configuration and after a reset.

The ena_map_llq_mem_bar() function call was moved before the
ena_device_init() call, to make sure that the mem bar is available.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
2022-07-06 17:06:21 +02:00
Michal Krawczyk
38d036e91a ena: Align req_id and qid print order
In most places, the req_id is printed first, and the qid is printed as a
second. To align the driver, one printout was reworked and the print
order of those variables was changed.

Suggested by: rpokala
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
2022-07-06 17:06:21 +02:00
Brooks Davis
3bf6636512 cddl/*: add a WITH(OUT)_DTRACE option
Add an option to enable/disable DTrace without disabling ZFS.  New
architectures such as CHERI may support ZFS before they support DTrace
and the old model of WITHOUT_CDDL disabling both wasn't helpful.

For compatiblity, the CDDL option remains and WITHOUT_CDDL implies
WITHOUT_DTRACE.  WITHOUT_DTRACE also implies WITHOUT_CTF.

As part of this change, largely convert cddl/*/Makefile to using the
more compact SUBDIR.${MK_<FOO>}+= form rather than using intermediate
variables.

Reviewed by:	markj
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D35718
2022-07-06 14:03:48 +01:00
Konstantin Belousov
513e1bbc73 ufs_rename(): revert the bump of fvp nlink count in case of EMLINK for tdvp
Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2022-07-06 15:34:36 +03:00
Konstantin Belousov
ab5ef5fb63 ufs_rename(): do not treat ERELOOKUP specially
Delegate handling of it to the top VFS layer, as it is done everywhere.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2022-07-06 15:34:28 +03:00
Mike Karels
231092bb6f netstat -i: do not truncate interface names
The field for interface names for netstat -i was 5 characters by
default, which is no longer sufficient with names like "vlan1234"
and "vtnet0".  netstat -iW computed the necessary field width, but
also enlarged the address field by a lot (especially with IPv6 enabled).
Make netstat -i compute the field width for interface names with or
without -W.  Note that the existing default output does not fit in
80 columns in any case.  Update the man page accordingly, documenting
the remaining effect of -W with -i.  Also add -W to the list of
General Options, as there are numerous pointers to this.

Reported by:	Chris Ross
Reviewed by:	melifaro, rgrimes, cy
Differential Revision: https://reviews.freebsd.org/D35703
MFC after:	1 week
2022-07-06 07:12:16 -05:00
Bjoern A. Zeeb
fbb5cb66f7 dwc3: add ACPI attachment
Split the current FDT-only implementation up into an FDT and an
ACPI part reusing and sharing as much code as possible (thanks mw!).

This makes the Synopsis XHCI root hubs attach correctly on SolidRun's
HoenyComb instead of just the generic XHCI root and this means we
are also doing proper chip setup and applying the quirk needed there [1].

There is one problem with ACPI attachment in that it uses the generic
XHCI PNP ID.  So we need to do extra checks in order to not claim
all xhci, which means we check for a known quirk to be present
in acpi_probe.  Long term this isn't scaling and this was discussed
in SolidRun's Discord Channel in 2021 with the intend that "jnettlet"
will take this to a steering committee.  Since then ACPI has kind-of
become a technology non grata (due to not getting changes into Linux
timely) so it is unclear if this will ever happen.  If there will be
further hardware with dwc3/ACPI we should go and make sure this problem
gets solved.

[1] 24698f90b7/Silicon/NXP/LX2160A/AcpiTables/Dsdt/Usb.asl

Reviewed by:		manu, mw
MFC after:		10 days
Differential Revision:	https://reviews.freebsd.org/D32256
2022-07-06 11:26:34 +00:00
Alexander Motin
74230a5bc1
Avoid memory copy when verifying raidz/draid parity
Before this change for every valid parity column raidz_parity_verify()
allocated new buffer and copied there existing data, then recalculated
the parity and compared the result with the copy.  This patch removes
the memory copy, simply swapping original buffer pointers with newly
allocated empty ones for parity recalculation and comparison. Original
buffers with potentially incorrect parity data are then just freed,
while new recalculated ones are used for repair.

On a pool of 12 4-wide raidz vdevs, storing 1.5TB of 16MB blocks, this
change reduces memory traffic during scrub by 17% and total unhalted
CPU time by 25%.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #13613
2022-07-05 16:27:29 -07:00
Alexander Motin
1ac7d194e5
Avoid memory copies during mirror scrub
Issuing several scrub reads for a block we may use the parent ZIO
buffer for one of child ZIOs.  If that read complete successfully,
then we won't need to copy the data explicitly.  If block has only
one copy (typical for root vdev, which is also a mirror inside),
then we never need to copy -- succeed or fail as-is.  Previous
code also copied data from buffer of every successfully completed
child ZIO, but that just does not make any sense.

On healthy N-wide mirror this saves all N+1 (or even more in case
of ditto blocks) memory copies for each scrubbed block, allowing
CPU to focus mostly on check-summing.  For other vdev types it
should save one memory copy per block copy at root vdev.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Mark Maybee <mark.maybee@delphix.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #13606
2022-07-05 16:26:20 -07:00
Warner Losh
5c19fabbe3 devinfo: xref devctl
devctl has ways to get the different locator's paths to devices, while
devinfo does not. xref devctl in devinfo(8) as a hint.

Sponsored by:		Netflix
2022-07-05 15:15:08 -06:00
Kristof Provost
6ba6c05cb2 if_ovpn: deal with short packets
If we receive a UDP packet (directed towards an active OpenVPN socket)
which is too short to contain an OpenVPN header ('struct
ovpn_wire_header') we wound up making m_copydata() read outside the
mbuf, and panicking the machine.

Explicitly check that the packet is long enough to copy the data we're
interested in. If it's not we will pass the packet to userspace, just
like we'd do for an unknown peer.

Extend a test case to provoke this situation.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-07-05 19:27:00 +02:00
Kristof Provost
cbb019b831 dummynet: fix ip_dn_vnet_init() / dummynet_task() race
If dummynet_task() is run on a vnet where dummynet is still initialising
(i.e. still running ip_dn_vnet_init()) we can attempt to use an
uninitialised mutex.

We can use the existing init_done field to check if the per-vnet
V_dn_cfg is fully set up, if we ensure that it's only set to 1 when
we've done all of the init work.

Reported by:	Alfredo Dal'Ava Júnior <alfredo@freebsd.org>
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D35716
2022-07-05 18:59:00 +02:00
Jung-uk Kim
9576bca583 OpenSSL: Regen assembly file for OpenSSSL 1.1.1q 2022-07-05 12:06:50 -04:00
Jung-uk Kim
25fb251592 OpenSSL: Regen manual pages for OpenSSL 1.1.1q 2022-07-05 12:01:07 -04:00
Jung-uk Kim
64cbf7cebc OpenSSL: Merge OpenSSL 1.1.1q
Merge commit 'f874e59ffcd8b5ecd018ad8311d78e866340f3e9'
2022-07-05 11:47:01 -04:00
Jung-uk Kim
f874e59ffc Import OpenSSL 1.1.1q 2022-07-05 11:27:51 -04:00
Tom Jones
1e692b938e xargs: fix description of strnsubst return value
Reported by:	oshogbo
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35574
2022-07-05 16:27:15 +01:00
Tom Jones
f058359ba5 xargs: terminate if line replacement cannot be constructed
If the line with replacement cannot be constructed xargs should
terminate as documented in the man page

We encounter this error, but gnu/xargs doesn't because they have a much
larger limit for created outputs (~10000 lines).

Reviewed by:	oshogbo
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35574
2022-07-05 16:18:05 +01:00
Mitchell Horne
62bca9c4df DB_COMMAND(9): fix a typo
Fixes:	b83d53cb68
2022-07-05 12:15:30 -03:00
Mitchell Horne
b83d53cb68 DB_COMMAND(9): update to mention additional macros
Document the existing alias definitions, and augment the example with
one of these. Also, describe the purpose of the newly added _FLAGS
variations of these command definitions.

Make some small style improvements to appease mandoc -Tlint.

Reviewed by:	markj
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35664
2022-07-05 11:56:55 -03:00