]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 months agossh: Update to OpenSSH 9.5p1
Ed Maste [Mon, 9 Oct 2023 17:28:17 +0000 (13:28 -0400)]
ssh: Update to OpenSSH 9.5p1

Excerpts from the release notes:

Potentially incompatible changes
--------------------------------

 * ssh-keygen(1): generate Ed25519 keys by default.
   [NOTE: This change was already merged into FreeBSD.]

 * sshd(8): the Subsystem directive now accurately preserves quoting of
   subsystem commands and arguments.

New features
------------

 * ssh(1): add keystroke timing obfuscation to the client.

 * ssh(1), sshd(8): Introduce a transport-level ping facility.

 * sshd(8): allow override of Sybsystem directives in sshd Match blocks.

Full release notes at https://www.openssh.com/txt/release-9.5

Relnotes: Yes
Sponsored by: The FreeBSD Foundation

8 months agobhyve(8): Fix style warnings emitted by mandoc, no content changes
Benedict Reuschling [Mon, 9 Oct 2023 16:43:35 +0000 (16:43 +0000)]
bhyve(8): Fix style warnings emitted by mandoc, no content changes

8 months agobhyve(8): Expand the -p option text with additional text and an example
Felix Johnson [Mon, 9 Oct 2023 16:32:33 +0000 (16:32 +0000)]
bhyve(8): Expand the -p option text with additional text and an example

PR: 249981

8 months agofdc.4: document fdc sysctls
Felix Johnson [Mon, 9 Oct 2023 11:46:03 +0000 (18:46 +0700)]
fdc.4: document fdc sysctls

PR: 105608
MFC-after: 1 week

8 months agomtree: Fix entry
Emmanuel Vadot [Mon, 9 Oct 2023 10:55:32 +0000 (12:55 +0200)]
mtree: Fix entry

Fixes: af5e348c61da ("mtree: Add missing sound entry for /usr/examples")

8 months agotcp: include RFC6675 IsLost() in pipe calculation
Richard Scheffenegger [Mon, 9 Oct 2023 09:55:14 +0000 (11:55 +0200)]
tcp: include RFC6675 IsLost() in pipe calculation

Add more accounting while processing SACK data, to
keep track of when a packet is deemed lost using
the RFC6675 guidance.

Together with PRR (RFC6972) this allows a sender to
retransmit presumed lost packets faster, and loss
recovery to complete earlier.

Reviewed By: cc, rrs, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D39299

8 months agoproc: Add sysctl flag CTLFLAG_TUN to loader tunable
Zhenlei Huang [Mon, 9 Oct 2023 10:30:22 +0000 (18:30 +0800)]
proc: Add sysctl flag CTLFLAG_TUN to loader tunable

The sysctl variable 'kern.kstack_pages' is actually a loader tunable.
Add sysctl flag CTLFLAG_TUN to it so that `sysctl -T` will report it
correctly.

No functional change intended.

Note that on arm64 the thread0 stack size can not be controlled with it,
kib@ suggested that arm64 maintainers can fix it eventually so let's
enable it also on arm64 right now.

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

8 months agobuf: Add sysctl flag CTLFLAG_TUN to loader tunable
Zhenlei Huang [Mon, 9 Oct 2023 10:30:22 +0000 (18:30 +0800)]
buf: Add sysctl flag CTLFLAG_TUN to loader tunable

The sysctl variable 'vfs.unmapped_buf_allowed' is actually a loader
tunable. Add sysctl flag CTLFLAG_TUN to it so that `sysctl -T` will
report it correctly.

No functional change intended.

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

8 months agosockets: Add sysctl flag CTLFLAG_TUN to loader tunable
Zhenlei Huang [Mon, 9 Oct 2023 10:30:22 +0000 (18:30 +0800)]
sockets: Add sysctl flag CTLFLAG_TUN to loader tunable

The sysctl variable 'kern.ipc.maxsockets' is actually a loader tunable.
Add sysctl flag CTLFLAG_TUN to it so that `sysctl -T` will report it
correctly.

No functional change intended.

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

8 months agombuf: Add sysctl flag CTLFLAG_TUN to loader tunables
Zhenlei Huang [Mon, 9 Oct 2023 10:30:22 +0000 (18:30 +0800)]
mbuf: Add sysctl flag CTLFLAG_TUN to loader tunables

The following sysctl variables are actually loader tunables. Add sysctl
flag CTLFLAG_TUN to them so that `sysctl -T` will report them correctly.

 1. kern.ipc.mb_use_ext_pgs
 2. kern.ipc.nmbclusters
 3. kern.ipc.nmbjumbop
 4. kern.ipc.nmbjumbo9
 5. kern.ipc.nmbjumbo16
 6. kern.ipc.nmbufs

No functional change intended.

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

8 months agofd: Add sysctl flag CTLFLAG_TUN to loader tunables
Zhenlei Huang [Mon, 9 Oct 2023 10:30:21 +0000 (18:30 +0800)]
fd: Add sysctl flag CTLFLAG_TUN to loader tunables

The following sysctl variables are actually loader tunables. Add sysctl
flag CTLFLAG_TUN to them so that `sysctl -T` will report them correctly.

 1. kern.maxfiles
 2. kern.maxfilesperproc

No functional change intended.

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

8 months agox86: Add sysctl flag CTLFLAG_TUN to loader tunables
Zhenlei Huang [Mon, 9 Oct 2023 10:30:21 +0000 (18:30 +0800)]
x86: Add sysctl flag CTLFLAG_TUN to loader tunables

The following sysctl variables are actually loader tunables. Add sysctl
flag CTLFLAG_TUN to them so that `sysctl -T` will report them correctly.

 1. machdep.idle
 2. machdep.idle_apl31

No functional change intended.

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

8 months agonfscl: Add sysctl flag CTLFLAG_TUN to loader tunable
Zhenlei Huang [Mon, 9 Oct 2023 10:30:21 +0000 (18:30 +0800)]
nfscl: Add sysctl flag CTLFLAG_TUN to loader tunable

The sysctl variable 'vfs.nfs.iodmin' is actually a loader tunable. Add
sysctl flag CTLFLAG_TUN to it so that `sysctl -T` will report it
correctly.

No functional change intended.

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

8 months agoddb: Add sysctl flag CTLFLAG_TUN to loader tunable
Zhenlei Huang [Mon, 9 Oct 2023 10:30:21 +0000 (18:30 +0800)]
ddb: Add sysctl flag CTLFLAG_TUN to loader tunable

The sysctl variable 'debug.ddb.capture.bufsize' is actually a loader
tunable. Add sysctl flag CTLFLAG_TUN to it so that `sysctl -T` will
report it correctly.

No functional change intended.

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

8 months agocam/scsi: Add sysctl flag CTLFLAG_TUN to loader tunable
Zhenlei Huang [Mon, 9 Oct 2023 10:30:21 +0000 (18:30 +0800)]
cam/scsi: Add sysctl flag CTLFLAG_TUN to loader tunable

The sysctl variable 'kern.cam.scsi_delay' is actually a loader tunable.
Add sysctl flag CTLFLAG_TUN to it so that `sysctl -T` will report it
correctly.

No functional change intended.

Reviewed by: kib, imp (for #cam)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42113

8 months agomtree: Add missing sound entry for /usr/examples
Emmanuel Vadot [Mon, 9 Oct 2023 09:21:53 +0000 (11:21 +0200)]
mtree: Add missing sound entry for /usr/examples

Sponsored by: Beckhoff Automation GmbH & Co. KG

8 months ago(upstream) PR/386: Add newlines for consitency 2
Jose Luis Duran [Mon, 9 Oct 2023 04:52:53 +0000 (21:52 -0700)]
(upstream) PR/386: Add newlines for consitency 2

Obtained from: https://github.com/file/file/pull/134/

8 months agofile_test: Fix file test
Jose Luis Duran [Sat, 7 Oct 2023 12:47:29 +0000 (12:47 +0000)]
file_test: Fix file test

Trimming of the line feed is no longer necessary after
https://github.com/file/file/commit/d993c6b0db20711b2c4cb9d2bee8c7f2e59b0a43

Currently the tests:

  - bcachefs2
  - gpkg-1-zst
  - multiple

are failing, but a fix will be committed upstream.

This also reverts c5e957ad4 "file: fix test case for gpkg by removing the extra \n."

MFC after: 3 days

8 months agosctp: Various fixes for loader tunables
Zhenlei Huang [Mon, 9 Oct 2023 04:36:48 +0000 (12:36 +0800)]
sctp: Various fixes for loader tunables

The following sysctl variables are actually loader tunables. Add sysctl
flag CTLFLAG_TUN to them so that `sysctl -T` will report them correctly.

 1. net.inet.sctp.tcbhashsize
 2. net.inet.sctp.pcbhashsize
 3. net.inet.sctp.chunkscale

The loader tunable 'net.inet.sctp.tcbhashsize' and 'net.inet.sctp.chunkscale'
are only used during vnet initializing, thus it make no senses to make them
writable tunable.

Validate the values of loader tunables on vnet initialize, reset them to
theirs defaults if invalid to prevent potential kernel panics.

Reviewed by: tuexen, #transport, #network
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42007

8 months agoarm64: Add a leaf PTP when pmap_enter(psind=1) creates a wired mapping
Bojan Novković [Mon, 9 Oct 2023 00:38:08 +0000 (20:38 -0400)]
arm64: Add a leaf PTP when pmap_enter(psind=1) creates a wired mapping

Let pmap_enter_l2() create wired mappings.  In particular, allocate a
leaf PTP for use during demotion.  This is a step towards reverting
commit 64087fd7f372.

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

8 months agoi386: Add a leaf PTP when pmap_enter(psind=1) creates a wired mapping
Bojan Novković [Mon, 9 Oct 2023 00:32:35 +0000 (20:32 -0400)]
i386: Add a leaf PTP when pmap_enter(psind=1) creates a wired mapping

Let pmap_enter_pde() create wired mappings.  In particular, allocate a
leaf PTP for use during demotion.  This is a step towards reverting
commit 64087fd7f372.

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

8 months agomount_nfs(8): Indicate that the -t option is deprecated
Benedict Reuschling [Sun, 8 Oct 2023 13:47:24 +0000 (13:47 +0000)]
mount_nfs(8): Indicate that the -t option is deprecated

In mount_nfs.c the -t option is deprecated and advises to use
timeout=<N> instead. However, since that refers to NFS over UDP, which
is not used nowadays, mark this option as deprecated in the man page.

PR: 260611
Suggested by: rmacklem

8 months agoteken: fix up unused func warnings
Mateusz Guzik [Sun, 8 Oct 2023 13:54:11 +0000 (13:54 +0000)]
teken: fix up unused func warnings

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

8 months agotcp: Simplify the initialization of loader tunable 'net.inet.tcp.tcbhashsize'
Zhenlei Huang [Sun, 8 Oct 2023 10:03:59 +0000 (18:03 +0800)]
tcp: Simplify the initialization of loader tunable 'net.inet.tcp.tcbhashsize'

No functional change intended.

Reviewed by: cc, rscheff, #transport
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41998

8 months agozfs: update zfs_config.h and zfs_gitrev.h missing in b2526e8bfe51
Martin Matuska [Sun, 8 Oct 2023 07:55:29 +0000 (09:55 +0200)]
zfs: update zfs_config.h and zfs_gitrev.h missing in b2526e8bfe51

8 months agozfs: merge openzfs/zfs@66b81b349
Martin Matuska [Sun, 8 Oct 2023 07:43:15 +0000 (09:43 +0200)]
zfs: merge openzfs/zfs@66b81b349

Notable upstream pull request merges:
 #15290 54b1b1d89 import: require force when cachefile hostid doesn't
                  match on-disk
 #15319 342357cd9 Reduce number of metaslab preload taskq threads
 #15340 2a6c62109 ARC: Remove b_cv from struct l1arc_buf_hdr
 #15347 75a2eb7fa ARC: Drop different size headers for crypto
 #15350 96b9cf42e ARC: Remove b_bufcnt/b_ebufcnt from ARC headers
 #15353 66b81b349 ZIL: Reduce maximum size of WR_COPIED to 7.5K
 #15362 5b8688e62 zfsconcepts: add description of block cloning

Obtained from: OpenZFS
OpenZFS commit: 66b81b349749bc1ba11fa277bee860be03315429

8 months agolibfetch, fetch: Stop recommending the use of ca_root_nss.
Dag-Erling Smørgrav [Sun, 8 Oct 2023 04:35:15 +0000 (06:35 +0200)]
libfetch, fetch: Stop recommending the use of ca_root_nss.

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

8 months agojexec.8: Add examples section
Danilo G. Baio [Sat, 7 Oct 2023 22:44:44 +0000 (19:44 -0300)]
jexec.8: Add examples section

MFC after: 3 days
Reviewed by: gbe, 0mp, danfe, pauamma_gundo.com
Differential Revision: https://reviews.freebsd.org/D40831

8 months agoteken: use __bitcount() instead of bitcount()
Christos Margiolis [Sat, 7 Oct 2023 21:36:59 +0000 (00:36 +0300)]
teken: use __bitcount() instead of bitcount()

The use of bitcount() triggered a build error because it couldn't be
located. __bitcount() on the other hand is defined in sys/types.h, which
is included in teken/teken.h.

MFC after: 2 weeks

8 months agotty: fix improper backspace behaviour for UTF8 characters when in canonical mode
Bojan Novković [Sat, 7 Oct 2023 18:00:11 +0000 (21:00 +0300)]
tty: fix improper backspace behaviour for UTF8 characters when in canonical mode

This patch adds additional logic in ttydisc_rubchar() to properly handle
backspace behaviour for UTF-8 characters.

Currently, typing in a backspace after a UTF8 character will delete only
one byte from the byte sequence, leaving garbled output in the tty's
output queue. With this change all of the character's bytes are deleted.
This change is only active when the IUTF8 flag is set (see
19054eb6053189144aa962b2ecc1bf5087758a3e "(s)tty: add support for IUTF8
input flag")

The code uses the teken_wcwidth() function to properly handle character
column widths for different code points, and adds the
teken_utf8_bytes_to_codepoint() function that converts a UTF-8 byte
sequence to a codepoint, as specified in RFC3629.

Reported by:    christos
Reviewed by:    christos, imp
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D42067

8 months ago(s)tty: add support for IUTF8 input flag
Bojan Novković [Sat, 7 Oct 2023 17:59:57 +0000 (20:59 +0300)]
(s)tty: add support for IUTF8 input flag

This patch adds the necessary kernel and stty code to support setting
the IUTF8 flag for ttys. It is the first of two patches that fix
backspace behaviour for UTF-8 encoded characters when in canonical mode.

Reported by: christos
Reviewed by: christos, imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D42066

8 months agofusefs: sanitize FUSE_READLINK results for embedded NULs
Alan Somers [Wed, 4 Oct 2023 18:48:01 +0000 (12:48 -0600)]
fusefs: sanitize FUSE_READLINK results for embedded NULs

If VOP_READLINK returns a path that contains a NUL, it will trigger an
assertion in vfs_lookup.  Sanitize such paths in fusefs, rejecting any
and warning the user about the misbehaving server.

PR: 274268
MFC after: 1 week
Sponsored by: Axcient
Reviewed by: mjg, markj
Differential Revision: https://reviews.freebsd.org/D42081

8 months agoudp: fix sending of IPv4-mapped addresses
Michael Tuexen [Sat, 7 Oct 2023 13:56:00 +0000 (15:56 +0200)]
udp: fix sending of IPv4-mapped addresses

The inp_vflags field must be adjusted during the call of
in_pcbbind_setup(). This is consistent with the other places in the
code, but not elegant at all.

PR: 274009
Reported by: syzbot+81ccc423a2737ed031ac@syzkaller.appspotmail.com
Reported by: syzbot+c8e3dac881bba85bc029@syzkaller.appspotmail.com
Reviewed by: markj, rrs, rscheff
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D42031

8 months agosrc.conf(5): regen after 166a655fcf13 (bsdinstall/libdialog)
Ed Maste [Sat, 7 Oct 2023 01:14:11 +0000 (21:14 -0400)]
src.conf(5): regen after 166a655fcf13 (bsdinstall/libdialog)

Sponsored by: The FreeBSD Foundation

8 months agomrsas: Fix callout locking in mrsas_complete_cmd()
Mark Johnston [Sat, 7 Oct 2023 00:31:03 +0000 (20:31 -0400)]
mrsas: Fix callout locking in mrsas_complete_cmd()

callout_stop() requires the associated lock to be held.

This is a bit hacky, but I believe it's safe since the subsequent
mrsas_cmd_done() call will also acquire the SIM lock to stop a different
callout.

PR: 265484
Reviewed by: imp
Tested by: Jérémie Jourdin <jeremie.jourdin@advens.fr>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39559

8 months agoFix intermittency in the sys.fs.fusefs.symlink.main test
Alan Somers [Fri, 6 Oct 2023 21:05:41 +0000 (15:05 -0600)]
Fix intermittency in the sys.fs.fusefs.symlink.main test

This change is identical to 86885b18689 but for symlink instead of
mknod.  The kernel sends a FUSE_FORGET asynchronously with the final
syscall.  The lack of an expectation caused this test to occasionally
fail.

Also, remove a sleep that accidentally snuck into a different test.

MFC after: 2 weeks
MFC with: 86885b18689889e9b9142fd31d8c67f21334ba32
Sponsored by: Axcient

8 months agomitigations.7: briefly explain RELRO
Ed Maste [Fri, 6 Oct 2023 14:37:55 +0000 (10:37 -0400)]
mitigations.7: briefly explain RELRO

Reviewed by: bcr (earlier), kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42107

8 months agoFix intermittency in the sys.fs.fusefs.mknod.main test
Alan Somers [Fri, 6 Oct 2023 19:46:42 +0000 (13:46 -0600)]
Fix intermittency in the sys.fs.fusefs.mknod.main test

In the Mknod.parent_inode test case, the kernel sends an extra
FUSE_FORGET message.  But because it gets sent asynchronously with the
failing syscall, it doesn't always get received before the test ends.
So we never setup an expectation for it.  And 90+% of the time the test
would exit successfully.

Fix the intermittency by always waiting to receive the FUSE_FORGET
message.

MFC after: 2 weeks
Sponsored by: Axcient

8 months agoi2c: rtc: Add module for hym8563 driver
Emmanuel Vadot [Fri, 6 Oct 2023 19:20:00 +0000 (21:20 +0200)]
i2c: rtc: Add module for hym8563 driver

It's used in the nanopi-r5s

8 months agoZIL: Reduce maximum size of WR_COPIED to 7.5K
Alexander Motin [Fri, 6 Oct 2023 17:09:27 +0000 (13:09 -0400)]
ZIL: Reduce maximum size of WR_COPIED to 7.5K

Benchmarks show that at certain write sizes range lock/unlock take
not so much time as extra memory copy.  The exact threshold is not
obvious due to other overheads, but it is definitely lower than
~63KB used before.  Make it configurable, defaulting at 7.5KB,
that is 8KB of nearest malloc() size minus itx and lr structs.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15353

8 months agodwc: Rewrite barrier part
Emmanuel Vadot [Fri, 6 Oct 2023 16:04:49 +0000 (18:04 +0200)]
dwc: Rewrite barrier part

We only need a barrier after writing the OWN bit so everything is
coherent for the DMA engine.

8 months agodwc: rockchip: Properly calculate mii clock based on pclk_mac
Emmanuel Vadot [Fri, 6 Oct 2023 15:44:00 +0000 (17:44 +0200)]
dwc: rockchip: Properly calculate mii clock based on pclk_mac

8 months agodwc: Get the mii clock after calling IF_DWC_INIT
Emmanuel Vadot [Fri, 6 Oct 2023 15:43:09 +0000 (17:43 +0200)]
dwc: Get the mii clock after calling IF_DWC_INIT

We need to calculate it based on the clocks and they aren't started
before IF_DWC_INIT.

8 months agodwc: Rewrite part of the descriptors setup functions
Emmanuel Vadot [Thu, 5 Oct 2023 17:10:00 +0000 (19:10 +0200)]
dwc: Rewrite part of the descriptors setup functions

 - Add a txdesc_clear which clears the tx desc instead of doing that in
   dwc_setup_txdesc based on arguments.
 - Remove dwc_set_owner, in the end we always set the owner of the desc
   as we do it for id > 0 and then for the first one.
 - Remove dwc_ prefix

No functional changes intended.

8 months agorpm: Fix `make rpm` on Debian/Ubuntu
siv0 [Fri, 6 Oct 2023 16:53:23 +0000 (18:53 +0200)]
rpm: Fix `make rpm` on Debian/Ubuntu

The recent patch to change the bash completion install location based
on the Distribution, ignored that it should still be possible to
create RPMs on Debian derived systems. Additionally `make deb` itself
creates RPMs and converts them via `alien`.

This patch adds the bashcompletiondir variable to the rpm defines and
uses this for the location, where to get the bash completion file.

It still changes the location on Debian/Ubuntu systems in the final
packages from /etc/bash_completion.d to
/usr/share/bash-completion/completions

Fixes: e69ade32e116e72d03068c03799924c3f1a15c95
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Closes #15355
Closes #15365

8 months agodaemon: Disable stdio buffering.
Dag-Erling Smørgrav [Fri, 6 Oct 2023 16:44:52 +0000 (18:44 +0200)]
daemon: Disable stdio buffering.

The daemon utility already does its own buffering and retransmits its
child's output line by line.  There's no need for stdio to add its own
buffering on top of this.

MFC after: 1 week
Sponsored by: Modirum MDPay
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D42111

8 months agotests: Use ifconfig -j instead of jexec ifconfig.
Dag-Erling Smørgrav [Fri, 6 Oct 2023 16:40:07 +0000 (18:40 +0200)]
tests: Use ifconfig -j instead of jexec ifconfig.

Reviewed by: kp, asomers
Differential Revision: https://reviews.freebsd.org/D42110

8 months agotests: Add a test case for arp host lookups.
Dag-Erling Smørgrav [Fri, 6 Oct 2023 16:39:59 +0000 (18:39 +0200)]
tests: Add a test case for arp host lookups.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D42108

8 months agoimport: require force when cachefile hostid doesn't match on-disk
Rob Norris [Sat, 16 Sep 2023 07:02:02 +0000 (17:02 +1000)]
import: require force when cachefile hostid doesn't match on-disk

Previously, if a cachefile is passed to zpool import, the cached config
is mostly offered as-is to ZFS_IOC_POOL_TRYIMPORT->spa_tryimport(), and
the results are taken as the canonical pool config and handed back to
ZFS_IOC_POOL_IMPORT.

In the course of its operation, spa_load() will inspect the pool and
build a new config from what it finds on disk. However, it then
regenerates a new config ready to import, and so rightly sets the hostid
and hostname for the local host in the config it returns.

Because of this, the "require force" checks always decide the pool is
exported and last touched by the local host, even if this is not true,
which is possible in a HA environment when MMP is not enabled. The pool
may be imported on another head, but the import checks still pass here,
so the pool ends up imported on both.

(This doesn't happen when a cachefile isn't used, because the pool
config is discovered in userspace in zpool_find_import(), and that does
find the on-disk hostid and hostname correctly).

Since the systemd zfs-import-cache.service unit uses cachefile imports,
this can lead to a system returning after a crash with a "valid"
cachefile on disk and automatically, quietly, importing a pool that has
already been taken up by a secondary head.

This commit causes the on-disk hostid and hostname to be included in the
ZPOOL_CONFIG_LOAD_INFO item in the returned config, and then changes the
"force" checks for zpool import to use them if present.

This method should give no change in behaviour for old userspace on new
kernels (they won't know to look for the new config items) and for new
userspace on old kernels (the won't find the new config items).

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Closes #15290

8 months agotests: add tests for zpool import behaviour when hostid changes
Rob Norris [Mon, 18 Sep 2023 01:07:32 +0000 (11:07 +1000)]
tests: add tests for zpool import behaviour when hostid changes

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Closes #15290

8 months agopfctl: fix incorrect mask on dynamic address
Kristof Provost [Fri, 6 Oct 2023 12:20:17 +0000 (14:20 +0200)]
pfctl: fix incorrect mask on dynamic address

A PF rule using an IPv4 address followed by an IPv6 address and then a
dynamic address, e.g. "pass from {192.0.2.1 2001:db8::1} to (pppoe0)",
will have an incorrect /32 mask applied to the dynamic address.

MFC after: 3 weeks
Obtained from: OpenBSD
See also: https://ftp.openbsd.org/pub/OpenBSD/patches/5.6/common/007_pfctl.patch.sig
Sponsored by: Rubicon Communications, LLC ("Netgate")
Event: Oslo Hackathon at Modirum

8 months agozfsconcepts: add description of block cloning
Rob N [Fri, 6 Oct 2023 16:06:29 +0000 (03:06 +1100)]
zfsconcepts: add description of block cloning

Here I'm trying to succinctly introduce the concept, the basics of its
construction, how its different to dedup, how to use it, and where its
limitations lie, in four paragraphs and with enough searchable terms to
help the reader find more information both within OpenZFS and elsewhere.

Phew.

Sponsored-By: Klara, Inc.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #15362

8 months agoReduce number of metaslab preload taskq threads.
Alexander Motin [Fri, 6 Oct 2023 16:04:00 +0000 (12:04 -0400)]
Reduce number of metaslab preload taskq threads.

Before this change ZFS created threads for 50% of CPUs for each top-
level vdev.  Plus it created the same number of threads for embedded
log groups (that have only one metaslab and don't need any preload).
As result, on system with 80 CPUs and pool of 60 vdevs this resulted
in 4800 metaslab preload threads, that is absolutely insane.

This patch changes the preload threads to 50% of CPUs in one taskq
per pool, so on the mentioned system it will be only 40 threads.

Among other things this fixes zdb on the mentioned system and pool
on FreeBSD, that failed to create so many threads in one process.

Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15319

8 months agogeom.4: Document kern.geom.notaste sysctl
Felix Johnson [Fri, 6 Oct 2023 15:58:32 +0000 (15:58 +0000)]
geom.4: Document kern.geom.notaste sysctl

Reported by: jdc_koitsu.org
PR: 254897
Approved by: des
Event: Oslo Hackathon
Differential Revision: https://reviews.freebsd.org/D42109

8 months agoARC: Drop different size headers for crypto
Alexander Motin [Tue, 3 Oct 2023 15:57:48 +0000 (11:57 -0400)]
ARC: Drop different size headers for crypto

To reduce memory usage ZFS crypto allocated bigger by 56 bytes ARC
headers only when specific block was encrypted on disk.  It was a
nice optimization, except in some cases the code reallocated them
on fly, that invalidated header pointers from the buffers.  Since
the buffers use different locking, it created number of races, that
were originally covered (at least partially) by b_evict_lock, used
also to protection evictions.  But it has gone as part of #14340.
As result, as was found in #15293, arc_hdr_realloc_crypt() ended
up unprotected and causing use-after-free.

Instead of introducing some even more elaborate locking, this patch
just drops the difference between normal and protected headers. It
cost us additional 56 bytes per header, but with couple patches
saving 24 bytes, the net growth is only 32 bytes with total header
size of 232 bytes on FreeBSD, that IMHO is acceptable price for
simplicity.  Additional locking would also end up consuming space,
time or both.

Reviewe-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15293
Closes #15347

8 months agoARC: Remove b_bufcnt/b_ebufcnt from ARC headers
Alexander Motin [Fri, 6 Oct 2023 15:56:17 +0000 (11:56 -0400)]
ARC: Remove b_bufcnt/b_ebufcnt from ARC headers

In most cases we do not care about exact number of buffers linked
to the header, we just need to know if it is zero, non-zero or one.
That can easily be checked just looking on b_buf pointer or in some
cases derefencing it.

b_ebufcnt is read only once, and in that case we already traverse
the list as part of arc_buf_remove(), so second traverse should not
be expensive.

This reduces L1 ARC header size by 8 bytes and full crypto header by
16 bytes, down to 176 and 232 bytes on FreeBSD respectively.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15350

8 months agoCI: add FreeBSD build with Cirrus CI
Martin Matuška [Fri, 6 Oct 2023 15:50:26 +0000 (17:50 +0200)]
CI: add FreeBSD build with Cirrus CI

As a first step for automatic FreeBSD testing add a build and install
for FreeBSD versions 12.4, 13.2 and 14-snapshot using Cirrus CI.

Reviewed-by: Jose Luis Duran
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Martin Matuska <mm@FreeBSD.org>
Closes #15332

8 months agotests/block_cloning: sync before write in fallback test
Rob N [Fri, 6 Oct 2023 15:39:20 +0000 (02:39 +1100)]
tests/block_cloning: sync before write in fallback test

We're still seeing this test fail intermittently (that is, the clone
happens), which must mean the write and the clone can still be happening
on different txgs.

It might be that there's still activity after the pool is created. So
here we force a sync before starting the write.

Sponsored-By: Klara Inc.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #15359

8 months agoImprove the pf nat exhaustion test by checking the reply from the echo server
Brad Davis [Fri, 6 Oct 2023 15:19:51 +0000 (09:19 -0600)]
Improve the pf nat exhaustion test by checking the reply from the echo server

Event: Oslo Hackathon
Approved by: kp

8 months agoExtend description of -p to include interactions with -d and implying -x
Benedict Reuschling [Fri, 6 Oct 2023 14:29:21 +0000 (14:29 +0000)]
Extend description of -p to include interactions with -d and implying -x

PR: 268052
Event: Oslo Hackathon
Differential Revision: https://reviews.freebsd.org/D40595

8 months agoCirrus CI: Only trigger amd64-gcc12 on pull requests
Jose Luis Duran [Fri, 6 Oct 2023 12:13:26 +0000 (12:13 +0000)]
Cirrus CI: Only trigger amd64-gcc12 on pull requests

Since Cirrus Labs is limiting their free usage tier [1], limit gcc CI
runs to pull requests only.

[1]: https://cirrus-ci.org/blog/2023/07/17/limiting-free-usage-of-cirrus-ci/

8 months agomailmap: Add pstef and val
Mina Galić [Thu, 5 Oct 2023 18:25:30 +0000 (20:25 +0200)]
mailmap: Add pstef and val

normalize pstef@'s Name, as well as Val Packett's.

Reviewed by: pstef, val_packett.cool
Differential Revision: https://reviews.freebsd.org/D41949

8 months agogrowfs: make exit codes more consistent
Mina Galić [Thu, 5 Oct 2023 18:24:53 +0000 (20:24 +0200)]
growfs: make exit codes more consistent

We have overused err(1), so it's hard to distinguish when an error is
very, very serious, and when it's just a user-error, or even harmless.

This patch changes the current behaviour to distinguish between the
following three:

1 for usage errors
2 for recoverable errors
3 or higher for unrecoverable errors

Reviewed by: jilles, pauamma_gundo.com, des
Differential Revision: https://reviews.freebsd.org/D27161

8 months agortw88: re-connect to the build
Bjoern A. Zeeb [Fri, 6 Oct 2023 10:53:07 +0000 (10:53 +0000)]
rtw88: re-connect to the build

This adds the (updated) rtw88 driver back to the build.
Functionality has not been tested (much) so might not currently
work but people offered to test.

Firmware is provided by the wifi-firmware-rtw88-kmod port/package.

This reverts commit 712468443df1130db8f893a5e2ce5c6a8dbf5cde.

8 months agonet80211: pass __func__, __LINE__ also to ieee80211_alloc_node()
Bjoern A. Zeeb [Fri, 6 Oct 2023 10:38:22 +0000 (10:38 +0000)]
net80211: pass __func__, __LINE__ also to ieee80211_alloc_node()

Pass caller information to ieee80211_alloc_node() so that in case
IEEE80211_DEBUG_REFCNT is compiled in we can (better) track references,
in this case the initial ieee80211_node_initref().

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

8 months agoCorrect the example: use maxproc instead of nonexistent nproc
Benedict Reuschling [Fri, 6 Oct 2023 09:02:30 +0000 (09:02 +0000)]
Correct the example: use maxproc instead of nonexistent nproc

Reported by: dewayne@heuristicsystems.com.au
PR: 272357
Differential Revision: https://reviews.freebsd.org/D40885

8 months agoif_re: add Realtek Killer Ethernet E2600 IDs
Sk Razee [Fri, 6 Oct 2023 06:08:16 +0000 (08:08 +0200)]
if_re: add Realtek Killer Ethernet E2600 IDs

PR: 274292
MFC after: 1 week
Reviewed by: kp
Event: Oslo Hackathon at Modirum

8 months agoConnect mitigations(7) to the build
Ed Maste [Thu, 5 Oct 2023 17:55:36 +0000 (13:55 -0400)]
Connect mitigations(7) to the build

Also add some cross references.

Sponsored by: The FreeBSD Foundation

8 months agoAdd mitigations(7) describing our vulnerability mitigations
Ed Maste [Fri, 8 Sep 2023 17:49:11 +0000 (13:49 -0400)]
Add mitigations(7) describing our vulnerability mitigations

This is an initial take on documenting vulnerability mitigations.

Reviewed by: gbe (earlier)
Sponsored by: The FreeBSD Foundation
Co-authored-by: Olivier Certner <olce.freebsd@certner.fr>
Differential Revision: https://reviews.freebsd.org/D41794

8 months agodwc: if_dwc_aw: Include net/if_media.h
Emmanuel Vadot [Thu, 5 Oct 2023 16:59:56 +0000 (18:59 +0200)]
dwc: if_dwc_aw: Include net/if_media.h

Needed my miivar.h

Fixes: 6b73554e3e9b ("dwc: Do not re-invent phy mode type")

8 months agofusefs: add more readdir tests for misbehaving servers
Alan Somers [Thu, 5 Oct 2023 16:13:05 +0000 (10:13 -0600)]
fusefs: add more readdir tests for misbehaving servers

Inspired by PR 274268

MFC after: 2 weeks
Sponsored by: Axcient

8 months agopf: fix SCTP SDT probe
Kristof Provost [Thu, 5 Oct 2023 14:57:50 +0000 (16:57 +0200)]
pf: fix SCTP SDT probe

We want the return value of pf_test_rule(), i.e. the result of the
evaluation of the new state, not the result of the evaluation of the
original packet/state.

MFC after: 1 week
Sponsored by: Orange Business Services

8 months agobsdconfig: remove even more of the ftp support
Baptiste Daroussin [Thu, 5 Oct 2023 15:37:21 +0000 (17:37 +0200)]
bsdconfig: remove even more of the ftp support

8 months agodwc: Remove if_dwc_mac_type
Emmanuel Vadot [Wed, 4 Oct 2023 19:10:47 +0000 (21:10 +0200)]
dwc: Remove if_dwc_mac_type

This doesn't represent the mac_type but if the DMA engine support
extended descriptors.
Read the HW_FEATURE register to learn if the DMA engine supports it.

No functional changes intended.

8 months agodwc: Move BUS_MODE_DEFAULT_PBL; in if_dwcvar.h
Emmanuel Vadot [Wed, 4 Oct 2023 18:21:24 +0000 (20:21 +0200)]
dwc: Move BUS_MODE_DEFAULT_PBL; in if_dwcvar.h

And rename it to DMA_DEFAULT_PBL, this is the default for all (most ?)
dma engine that dwc should support.
While here stop including dwc1000_reg.h in if_dwc.c, we don't need it anymore.

No functional changes intended.

8 months agodwc: Do not re-invent phy mode type
Emmanuel Vadot [Wed, 4 Oct 2023 16:29:11 +0000 (18:29 +0200)]
dwc: Do not re-invent phy mode type

Directly uses the MII_CONTYPE_*

No functional changes intended.

8 months agodwc: Move dma engine configuration to dwc1000_dma.c
Emmanuel Vadot [Wed, 4 Oct 2023 16:19:26 +0000 (18:19 +0200)]
dwc: Move dma engine configuration to dwc1000_dma.c

No functional changes intended.

8 months agodwc: Move the dma reset code in dwc1000_dma.c
Emmanuel Vadot [Wed, 4 Oct 2023 05:55:11 +0000 (07:55 +0200)]
dwc: Move the dma reset code in dwc1000_dma.c

No functional changes intended

8 months agodwc: Setup desc addresses in the dma init function.
Emmanuel Vadot [Tue, 3 Oct 2023 16:46:56 +0000 (18:46 +0200)]
dwc: Setup desc addresses in the dma init function.

8 months agodwc: Move interrupt related code to core and dma file
Emmanuel Vadot [Tue, 3 Oct 2023 16:04:03 +0000 (18:04 +0200)]
dwc: Move interrupt related code to core and dma file

No functional changes intended.

8 months agodwc: Put all DMA related defines in dma1000_dma.c
Emmanuel Vadot [Thu, 28 Sep 2023 20:37:48 +0000 (22:37 +0200)]
dwc: Put all DMA related defines in dma1000_dma.c

No need to polute dwm1000_dma.h now.

No functional changes intended.

8 months agodwc: Move struct dwc_hash_maddr_ctx declaration in dwc1000_core
Emmanuel Vadot [Thu, 28 Sep 2023 20:36:24 +0000 (22:36 +0200)]
dwc: Move struct dwc_hash_maddr_ctx declaration in dwc1000_core

it's only used there.

No functional change intended.

8 months agodwc: Move the txstart dma part to dwc1000_dma
Emmanuel Vadot [Thu, 28 Sep 2023 20:34:47 +0000 (22:34 +0200)]
dwc: Move the txstart dma part to dwc1000_dma

This is dma related to move it to the dma file.

No functional changes intended.

8 months agodwc: Split core functions
Emmanuel Vadot [Thu, 28 Sep 2023 19:38:36 +0000 (21:38 +0200)]
dwc: Split core functions

Synopsis/Designware controller have multiple version. The version currently
supported by dwc(4) is the version 3 and it's usually called 1000 for gigabit.
In the goal to support all of those in the same base driver start splitting the
core function to a new file.

No functional changes intended.

8 months agodwc: Split dma functions
Emmanuel Vadot [Thu, 28 Sep 2023 18:40:55 +0000 (20:40 +0200)]
dwc: Split dma functions

Synopsis/Designware controller have multiple dma version, the one included
in the driver is the base one. if_awg is one example of a dwc variant that
have another DMA controller. eqos is a newer variant of dwc that have a newer
dma controller.
In the goal to support all of those in the same base driver start splitting the
dma function to a new file.

No functional changes intended.

8 months agodwc: Rename if_dwc.h to dwc1000_reg.h
Emmanuel Vadot [Mon, 25 Sep 2023 17:56:31 +0000 (19:56 +0200)]
dwc: Rename if_dwc.h to dwc1000_reg.h

Synopsis/Designware controller have multiple version. The version currently
supported by dwc(4) is the version 3 and it's usually called 1000 for gigabit.
This file only have definition for the registers of this version so rename it.

No functional changes intended.

8 months agodwc: Drop 'All rights reserved'
Emmanuel Vadot [Tue, 26 Sep 2023 17:26:16 +0000 (19:26 +0200)]
dwc: Drop 'All rights reserved'

Discussed with: br

8 months agodwc: Rewrite clock and reset functions
Emmanuel Vadot [Sat, 23 Sep 2023 16:24:22 +0000 (18:24 +0200)]
dwc: Rewrite clock and reset functions

snps,dwmac have one required clock named stmmaceth and one optional pclk,
correctly handle both in if_dwc, no need to get/enable stmmacseth again
in if_dwc_rk.
It also have one required reset also named stmmaceth and one optional ahb,
correctly handle both.
Rockchip have another optional clock named clk_mac_speed, get it and enable it
if present. Also fix the optional RMII clocks, they were previously wrongly
enabled in RGMII case.

8 months agodwc: Add support for aal
Emmanuel Vadot [Sat, 23 Sep 2023 16:56:26 +0000 (18:56 +0200)]
dwc: Add support for aal

snps,aal is used to indicate that the DMA engine should
use Address-Aligned Beats.

8 months agodwc: Add support for mixed-burst
Emmanuel Vadot [Sat, 23 Sep 2023 16:52:29 +0000 (18:52 +0200)]
dwc: Add support for mixed-burst

snps,mixed-burst is used to indicate that the DMA engine should
use mixed-burst mode.

8 months agodwc: Remove unused GPIO_ACTIVE_LOW define
Emmanuel Vadot [Sat, 23 Sep 2023 16:45:04 +0000 (18:45 +0200)]
dwc: Remove unused GPIO_ACTIVE_LOW define

While here move comment block above the appropriate functions.

8 months agodwc: Rename dwc_reset to dwc_reset_phy
Emmanuel Vadot [Sat, 23 Sep 2023 16:34:19 +0000 (18:34 +0200)]
dwc: Rename dwc_reset to dwc_reset_phy

It only deals with reseting the phy.
While here avoid calling ofw_bus_get_node again and save the node in softc.

8 months agodwc: Move every sub drivers to dev/dwc
Emmanuel Vadot [Sat, 23 Sep 2023 14:38:32 +0000 (16:38 +0200)]
dwc: Move every sub drivers to dev/dwc

It makes it easier to find all the sub drivers and change them if needed.
While here do not gate dwc_rk with soc options, dwc_rk is made for all rockchip
SoCs. Same thing for dwc_socfpga

8 months agobsdconfig: simplify pkg installation and ABI detection
Baptiste Daroussin [Thu, 5 Oct 2023 15:16:31 +0000 (17:16 +0200)]
bsdconfig: simplify pkg installation and ABI detection

8 months agocertctl: Split certificate bundles before processing.
Dag-Erling Smørgrav [Thu, 5 Oct 2023 14:50:01 +0000 (16:50 +0200)]
certctl: Split certificate bundles before processing.

This allows 'certctl rehash' to do the right thing when ca_root_nss is
installed, instead of linking the entire bundle to the hash of the
first certificate it contains.

MFC after: 3 days
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D42087

8 months agocertctl: Clean up.
Dag-Erling Smørgrav [Thu, 5 Oct 2023 14:49:53 +0000 (16:49 +0200)]
certctl: Clean up.

MFC after: 3 days
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D42086

8 months agonet80211: de-inline ieee80211_ref_node()
Bjoern A. Zeeb [Mon, 2 Oct 2023 20:20:14 +0000 (20:20 +0000)]
net80211: de-inline ieee80211_ref_node()

Make ieee80211_ref_node() a macro so we can pass __func__, __LINE__
in for IEEE80211_DEBUG_REFCNT as we do for other refcount related
functions.  Add the appropriate IEEE80211_DPRINTF() call to the
_ieee80211_ref_node() implementation to support wlandebug(8) +node
printf style tracing.
As a plus we can now also use Dtrace fbt on the
_ieee80211_{ref,free}_node() implementations with futher logic,
gathering backtraces, etc. more flexibly.

Sponsored by: The FreeBSD Foundation
X-MFC: never

8 months agoLinuxKPI: 802.11: hide txq debugging behind checks
Bjoern A. Zeeb [Wed, 4 Oct 2023 20:30:00 +0000 (20:30 +0000)]
LinuxKPI: 802.11: hide txq debugging behind checks

Two txq debug messages were left unconditionally.  Hide them behind
ifdef/if() condition checks for selective debugging only.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

8 months agortw88: Use RF_CFGCH instead of hard coded 0x18
Bjoern A. Zeeb [Thu, 5 Oct 2023 14:01:48 +0000 (14:01 +0000)]
rtw88: Use RF_CFGCH instead of hard coded 0x18

While debugging some funky register reads of 0xaeaea from RF_CFGCH
resulting in "rtw880: [TXGAPK] unknown channel 234!!" more of these
reads came to my attention hidden by using the register index rather
than the defined value.  Make this more grep-able.

MFC after: 3 days

8 months agonet80211: remove ieee80211_unref_node()
Bjoern A. Zeeb [Mon, 2 Oct 2023 14:30:46 +0000 (14:30 +0000)]
net80211: remove ieee80211_unref_node()

ieee80211_unref_node() was only used in two error cases in
ieee80211_send_nulldata().  There we do not need to guard against
ni pointer reuse after decrementing the refcount of the ni as we
only update the stats and return.

Update the man page and remove the link for the now gone function.

Sponsored by: The FreeBSD Foundation
X-MFC: never
Reviewed by: adrian, emaste
Differential Revision: https://reviews.freebsd.org/D42035