]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
16 months agofsck_ffs: fix the previous change that skipped pass 5 in some cases
Chuck Silvers [Wed, 3 May 2023 20:21:19 +0000 (13:21 -0700)]
fsck_ffs: fix the previous change that skipped pass 5 in some cases

The previous change involved calling check_cgmagic() twice in a row
for the same CG in order to differentiate when the CG was already ok vs.
when the CG was rebuilt, but that doesn't work because the second call
(which was supposed to rebuild the CG) returns 0 (indicating that
the CG was not rebuilt) due to the prevfailcg check causing an early
failure return.  Fix this by moving the rebuild part of check_cgmagic()
out into a separate function which is called by pass1() when it wants to
rebuild a CG.

Fixes: da86e7a20dc4a4b17e8d9e7630ed9b675cf71702
Reported by: pho
Discussed with: mckusick
Sponsored by: Netflix

16 months agolocal.meta.sys.mk set BOOTSTRAPPING
Simon J. Gerraty [Wed, 3 May 2023 19:20:02 +0000 (12:20 -0700)]
local.meta.sys.mk set BOOTSTRAPPING

When building for host on non-FreeBSD
some makefiles want to see BOOTSTRAPPING defined.

With this libmd and hence nmtree build ok

16 months agosctp: only start shutdown guard timer when sending SHUTDOWN chunk
Michael Tuexen [Wed, 3 May 2023 18:28:46 +0000 (20:28 +0200)]
sctp: only start shutdown guard timer when sending SHUTDOWN chunk

The intention is to protect a malicious peer not following the
shutdown procedures.

MFC after: 1 week

16 months agounix: Fix locking in uipc_peeraddr()
Mark Johnston [Wed, 3 May 2023 15:56:46 +0000 (11:56 -0400)]
unix: Fix locking in uipc_peeraddr()

After the locking protocol changed in commit 75a67bf3d00d ("AF_UNIX:
make unix socket locking finer grained"), uipc_peeraddr() was not
updated accordingly.

The link lock now only protects global socket lists.  The PCB lock is
used to protect the link between connected PCBs, so use that.  Remove an
old comment which appears to be noting that unp_conn is not set for
connected SOCK_DGRAM sockets (in one direction anyway).

Reviewed by: glebius
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39855

16 months agosrc.conf: add WITH_TOOLCHAIN description
Ed Maste [Tue, 2 May 2023 17:27:18 +0000 (13:27 -0400)]
src.conf: add WITH_TOOLCHAIN description

It is not used by the in-tree default configuration, but adding it
allows downstream projects with different defaults to make use of
Cirrus-CI (as the makeman test added in 85e8c2a03490 requires that
there are no missing option descriptions).

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39936

16 months agosctp: improve shutdown(..., SHUT_WR) handling
Michael Tuexen [Wed, 3 May 2023 15:30:50 +0000 (17:30 +0200)]
sctp: improve shutdown(..., SHUT_WR) handling

When shutdown(..., SHUT_WR) is called in the front states, send a
SHUTDOWN chunk when a COOKIE ACK chunk is received and there is
no outstanding data.

MFC after: 1 week

16 months agoauthpf: do not sprintf to a null pointer
Ed Maste [Wed, 3 May 2023 13:26:42 +0000 (09:26 -0400)]
authpf: do not sprintf to a null pointer

The fgetln loop will terminate with buf = NULL at EOF.

Reported by: GCC
Reviewed by: kp
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39947

16 months agozfs: merge openzfs/zfs@d96e29576
Martin Matuska [Wed, 3 May 2023 10:04:55 +0000 (12:04 +0200)]
zfs: merge openzfs/zfs@d96e29576

Notable upstream pull request merges:

  #11680 Add support for zpool user properties
  #14145 Storage device expansion "silently" fails on degraded vdev
  #14405 Create zap for root vdev
  #14659 Allow MMP to bypass waiting for other threads
  #14674 Miscellaneous FreBSD compilation bugfixes
  #14692 Fix some signedness issues in arc_evict()
  #14702 Fix typo in check_clones()
  #14715 module: small fixes for FreeBSD/aarch64
  #14716 Trim needless zeroes from checksum events
  #14719 vdev: expose zfs_vdev_max_ms_shift as a module parameter
  #14722 Fix "Detach spare vdev in case if resilvering does not happen"
  #14723 freebsd clone range fixes
  #14728 Fix BLAKE3 aarch64 assembly for FreeBSD and macOS
  #14735 Fix in check_filesystem()
  #14739 Fix data corruption when cloning embedded blocks
  #14758 Fix VERIFY(!zil_replaying(zilog, tx)) panic
  #14761 Revert "ZFS_IOC_COUNT_FILLED does unnecessary txg_wait_synced()"
  #14774 FreeBSD .zfs fixups
  #14776 FreeBSD: make zfs_vfs_held() definition consistent with declaration
  #14779 powerpc64: Support ELFv2 asm on Big Endian
  #14788 FreeBSD: add missing vop_fplookup assignments
  #14789 PAM: support the authentication facility
  #14790 Revert "Fix data race between zil_commit() and zil_suspend()"
  #14795 Fix positive ABD size assertion in abd_verify()
  #14798 Mark TX_COMMIT transaction with TXG_NOTHROTTLE
  #14804 Correct ABD size for split block ZIOs
  #14806 Use correct block pointer in block cloning case.
  #14808 blake3: fix up bogus checksums in face of cpu migration

Obtained from: OpenZFS
OpenZFS commit: d96e29576c89e6e547cb82b477651d2b85ea0fed

16 months agopf: improve source node error handling
Kajetan Staszkiewicz [Wed, 3 May 2023 08:31:05 +0000 (10:31 +0200)]
pf: improve source node error handling

Functions manipulating source nodes can fail due to various reasons like
memory allocation errors, hitting configured limits or lack of
redirection targets. Ensure those errors are properly caught and
propagated in the code. Increase the error counters not only when
parsing the main ruleset but the NAT ruleset too.

Cherry-picked from development of D39880

Reviewed by: kp
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D39940

16 months agopf: simplify structs with anonymous unions
Kristof Provost [Wed, 3 May 2023 06:02:43 +0000 (08:02 +0200)]
pf: simplify structs with anonymous unions

Rather than playing preprocessor hacks use actual anonymous unions.
No functional change.

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

16 months agoRELNOTES: Document TI code removal from armv7 GENERIC kernel
Emmanuel Vadot [Wed, 3 May 2023 07:21:58 +0000 (09:21 +0200)]
RELNOTES: Document TI code removal from armv7 GENERIC kernel

Suggested by: mhorne
Sponsored by: Beckhoff Automation GmbH & Co. KG

16 months agoRELNOTES: Add fwget entry
Emmanuel Vadot [Wed, 3 May 2023 07:20:35 +0000 (09:20 +0200)]
RELNOTES: Add fwget entry

Sponsored by: Beckhoff Automation GmbH & Co. KG

16 months agovfs: reduce audit branching in namei_setup
Mateusz Guzik [Wed, 3 May 2023 06:56:10 +0000 (06:56 +0000)]
vfs: reduce audit branching in namei_setup

16 months agoriscv: Add pass(4) to GENERIC kernel
Jessica Clarke [Wed, 3 May 2023 04:14:57 +0000 (05:14 +0100)]
riscv: Add pass(4) to GENERIC kernel

Whilst we don't have ahci(4) currently, we do have umass(4), and need
pass(4) for smartctl(8) to be able to talk to such devices.

Reported by: David Gilbert <dgilbert@daveg.ca>
MFC after: 1 week

16 months agortld: don't add extraneous -L directory when MK_TOOLCHAIN == no
Ed Maste [Tue, 2 May 2023 19:57:20 +0000 (15:57 -0400)]
rtld: don't add extraneous -L directory when MK_TOOLCHAIN == no

rtld's Makefile used to add -L${LIBDIR} to LDFLAGS when MK_TOOLCHAIN was
no.  This was done as part of a change to fix building rtld with
MK_TOOLCHAIN == no (although I'm not sure this part was necessary).

In any case as of 5f2e84015da7 libc_pic.a is built independent of the
MK_TOOLCHAIN setting and the main part of the workaround has already
been removed.  Remove the rest now.

This reverts commit c0f5aeb0329d71e6b02379133c0c9c0145c9afea.

Reviewed by: jrtc27
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39938

16 months agovmrun.sh: mention new edk2 package
Christos Margiolis [Tue, 2 May 2023 19:19:08 +0000 (19:19 +0000)]
vmrun.sh: mention new edk2 package

uefi-edk2-bhyve no longer exists.

Reviewed by: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39937

16 months agoConvert nfs bootp/diskless to use IfAPI
Justin Hibbits [Tue, 7 Feb 2023 19:37:03 +0000 (14:37 -0500)]
Convert nfs bootp/diskless to use IfAPI

Use the new IfAPI interface and address iterators so the nfs driver
doesn't need direct access to the interface structures.

Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38962

16 months agoMechanically convert if_hn(4) to IfAPI
Justin Hibbits [Mon, 26 Sep 2022 14:34:28 +0000 (10:34 -0400)]
Mechanically convert if_hn(4) to IfAPI

Reviewed by: zlei
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37855

16 months agoIfAPI: Add if_maddr_empty() to check for any maddrs
Justin Hibbits [Mon, 10 Apr 2023 18:20:00 +0000 (14:20 -0400)]
IfAPI: Add if_maddr_empty() to check for any maddrs

if_llmaddr_count() only counts link-level multicast addresses.
hv_netvsc(4) needs to know if there are any multicast addresses.  Since
hv_netvsc(4) is the only instance where this would be used, make it a
simple boolean.  If others need a if_maddr_count(), that can be added in
the future.

Reviewed by: melifaro
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D39493

16 months agoriscv: retire the FPE kernel option
Mitchell Horne [Tue, 25 Apr 2023 17:51:35 +0000 (14:51 -0300)]
riscv: retire the FPE kernel option

We always build the kernel floating point support. Now that the
riscv64sf userspace variant has been removed the option is required for
correct operation.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39851

16 months agoriscv: remove unused string from swtch.S
Mitchell Horne [Mon, 23 Jan 2023 17:11:16 +0000 (13:11 -0400)]
riscv: remove unused string from swtch.S

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

16 months agoUse correct block pointer in block cloning case.
Pawel Jakub Dawidek [Tue, 2 May 2023 16:24:26 +0000 (01:24 +0900)]
Use correct block pointer in block cloning case.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #14806

16 months agoWrap clang specific pragma
Brian Behlendorf [Tue, 2 May 2023 16:21:47 +0000 (09:21 -0700)]
Wrap clang specific pragma

Clang specific pragmas need to be wrapped to prevent a build
warning when compiling with gcc.

Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #14814

16 months agortsol: introduce an 'always' script
Kristof Provost [Tue, 2 May 2023 08:45:01 +0000 (10:45 +0200)]
rtsol: introduce an 'always' script

In addition to the 'M' and 'O' scripts (for when 'Managed' and 'Other'
flags are set) also introduce an 'always' script that is called for any
router advertisement (so even if M and O are not set).

This is primarly useful for systems like pfSense that wish to be
informed of routers for further system configuration.

See also https://redmine.pfsense.org/issues/14072

Reviewed by: melifaro
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D39931

16 months agofstatat(2): restore AT_EMPTY_PATH handling
Konstantin Belousov [Tue, 2 May 2023 15:11:39 +0000 (18:11 +0300)]
fstatat(2): restore AT_EMPTY_PATH handling

Fixes: cb858340dcbf214cc4c4d78dbb741620d7b3a252
Reported by: markj
Sponsored by: The FreeBSD Foundation

16 months agoIntel DMAR: remove parsing of 6-level paging capability
Jason A. Harmening [Mon, 1 May 2023 16:22:39 +0000 (11:22 -0500)]
Intel DMAR: remove parsing of 6-level paging capability

Early versions of the VT-d spec mentioned 6-level paging support as a
possible value for the SAGAW capability, but later versions removed it
and SAGAW=0x10 is currently listed as a reserved value.

The 6-level (agaw=64) entry in sagaw_bits is furthermore problematic
with clang15 because the attempted comparison against 1ULL << 64 in
dmar_maxaddr2mgaw() causes the compiler to elide the last iteration
of the initial loop, which bypasses the subsequent logic to find the
greatest HW-supported address width.  This results in 5-level paging
always being selected regardless of whether the hardware supports it,
which can result address translation failure due to invalid context-
entry programming.

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

16 months agoamd64: store pcids pmap data in pcpu zone
Konstantin Belousov [Mon, 1 May 2023 05:17:45 +0000 (08:17 +0300)]
amd64: store pcids pmap data in pcpu zone

This change eliminates the struct pmap_pcid array embedded into struct
pmap and sized by MAXCPU, which would bloat with MAXCPU increase.  Also
it removes false sharing of cache lines, since the array elements are
mostly locally accessed by corresponding CPUs.

Suggested by: mjg
Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D39890

16 months agoamd64 pmap_pcid_alloc(): pass a pointer to struct pmap_pcid instead of cpuid
Konstantin Belousov [Mon, 1 May 2023 11:35:48 +0000 (14:35 +0300)]
amd64 pmap_pcid_alloc(): pass a pointer to struct pmap_pcid instead of cpuid

Cpuid is used to index the pmap->pm_pcids array only.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D39890

16 months agoamd64: add pmap_get_pcid() helper
Konstantin Belousov [Mon, 1 May 2023 11:02:59 +0000 (14:02 +0300)]
amd64: add pmap_get_pcid() helper

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D39890

16 months agoamd64 pmap: add pmap_pinit_pcids() helper
Konstantin Belousov [Mon, 1 May 2023 11:21:10 +0000 (14:21 +0300)]
amd64 pmap: add pmap_pinit_pcids() helper

to initialize pm_pcids array for a new user pmap

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D39890

16 months agoamd64: move definition of the struct pmap_pcids into _pmap.h
Konstantin Belousov [Mon, 1 May 2023 11:06:30 +0000 (14:06 +0300)]
amd64: move definition of the struct pmap_pcids into _pmap.h

and rename the structure to pmap_pcid.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D39890

16 months agoMFV: less v632.
Xin LI [Tue, 2 May 2023 03:43:57 +0000 (20:43 -0700)]
MFV: less v632.

MFC after: 2 weeks

16 months agosrc.conf.5: regen after MK_TOOLCHAIN / MK_INCLUDES decoupling
Ed Maste [Tue, 2 May 2023 00:39:30 +0000 (20:39 -0400)]
src.conf.5: regen after MK_TOOLCHAIN / MK_INCLUDES decoupling

16 months agosrc.opts.mk: Decouple MK_INCLUDES from MK_TOOLCHAIN
Ed Maste [Mon, 1 May 2023 20:58:42 +0000 (16:58 -0400)]
src.opts.mk: Decouple MK_INCLUDES from MK_TOOLCHAIN

Prior to 590461a4b89b installation of include files was controlled
directly by ${MK_TOOLCHAIN}.  590461a4b89b added an INCLUDES knob
defaulting to YES.  Setting WITHOUT_TOOLCHAIN forced it off to retain
existing behaviour.

Decouple them now, as there are reasonable use cases for installing
libraries and include files without a compiler or other tool chain
components.

Reviewed by: imp, jrtc27
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39918

16 months agoblake3: fix up bogus checksums in face of cpu migration
Mateusz Guzik [Tue, 2 May 2023 00:21:27 +0000 (02:21 +0200)]
blake3: fix up bogus checksums in face of cpu migration

This is a temporary measure until a better fix is sorted out.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Sponsored by: Rubicon Communications, LLC ("Netgate")
Closes #14785
Closes #14808

16 months agoCorrect ABD size for split block ZIOs
Serapheim Dimitropoulos [Tue, 2 May 2023 00:18:42 +0000 (17:18 -0700)]
Correct ABD size for split block ZIOs

Currently when layering the ABD buffer of each split block on top of
an indirect vdev's ZIO ABD we don't specify the split block's ABD.
This results in those ABDs being incorrectly sized by inheriting
the size of their parent ABD which is larger than what each split
block needs.

The above behavior isn't causing any bugs currently but can lead
to unexpected ABD sizes for people analyzing and/or working on
the ZIO codepath. This patch fixes this behavior by properly setting
the ABD size for split block ZIOs.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Mark Maybee <mark.maybee@delphix.com>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Serapheim Dimitropoulos <serapheim@delphix.com>
Closes #14804

16 months agostand: More protection against malformed smbios tables
Warner Losh [Mon, 1 May 2023 21:12:41 +0000 (15:12 -0600)]
stand: More protection against malformed smbios tables

Add some more sanity checks to make sure we don't march off the end of
the table. Typically, smbios structures are well formed, or Windows
wouldn't boot. Sometimes they aren't, and this at least fails safe.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D39794

16 months agostand: Avoid unaligned access in smbios code
Warner Losh [Mon, 1 May 2023 21:12:34 +0000 (15:12 -0600)]
stand: Avoid unaligned access in smbios code

This code was written on x86 where unaligned accesses were
easy. LinuxBoot running on aarch64 uses mmap of /dev/mem to read the
smbios table. Linux's mapping of this memory doesn't allow the normal
unaligned fixup, so we get a bus error instead. We can't use the more
natural le16dec and friends because they optimize into a single,
unaligned memory load. We don't see this issue on aarch64 UEFI because
memory is mapped such that unaligned accesses are fixed up.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D39793

16 months agokboot: Add smbios support
Warner Losh [Mon, 1 May 2023 21:12:29 +0000 (15:12 -0600)]
kboot: Add smbios support

Add support for getting smbios from /sys/firmware/efi/systab, if
any. Add ptov mapping that uses mmap on /dev/mem to do the mapping with
64k pages (usually we only need 1 or two mappings).

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D39792

16 months agokboot: Fix an off by one error
Warner Losh [Mon, 1 May 2023 21:12:24 +0000 (15:12 -0600)]
kboot: Fix an off by one error

Fix an off-by-one error that would mean we'd get stuck on the newline if
ACPI= wasn't first.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D39817

16 months agostand: Testing program for smbios
Warner Losh [Mon, 1 May 2023 21:12:19 +0000 (15:12 -0600)]
stand: Testing program for smbios

Write a quick and dirty testing program to dump physical memory to help
test and debug the smbios.c code in new environments.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D39791

16 months agokboot: Add HOST_MAP_FAILED define
Warner Losh [Mon, 1 May 2023 21:11:32 +0000 (15:11 -0600)]
kboot: Add HOST_MAP_FAILED define

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D39790

16 months agostand: Add isspace to FreeBSD ctypes.h
Warner Losh [Mon, 1 May 2023 17:50:21 +0000 (11:50 -0600)]
stand: Add isspace to FreeBSD ctypes.h

And eliminate blake3_impl_hack.c since it's no longer needed.

Sponsored by: Netflix
Reviewed by: delphij
Differential Revision: https://reviews.freebsd.org/D39899

16 months agostand: back out the most of the horrible aarch64 kludge
Warner Losh [Mon, 1 May 2023 16:07:00 +0000 (10:07 -0600)]
stand: back out the most of the horrible aarch64 kludge

Add one ifdef to upstrem code and get rid of compiling the horrible
checked-in aarch64 assembler for the boot loader that the loader will
never use. I'll attempt to upstream this and adjust as needed.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D39897

16 months agostand: remove ZFS warning about computered but unused variable
Warner Losh [Mon, 1 May 2023 15:45:41 +0000 (09:45 -0600)]
stand: remove ZFS warning about computered but unused variable

Toss a __unused on the unexpected_errors variable. We compute it, but
never use it.

Sponsored by: Netflix

16 months agostand: Fix warning about variable unused
Warner Losh [Mon, 1 May 2023 15:35:16 +0000 (09:35 -0600)]
stand: Fix warning about variable unused

dflag is unused when LOADER_VERIEXEC isn't defined, so move it under the
ifdef.

Sponsored by: Netflix

16 months agostand/kboot: Simplify
Warner Losh [Mon, 1 May 2023 15:28:32 +0000 (09:28 -0600)]
stand/kboot: Simplify

There's plenty of stack in kboot, so use it here rather than the
malloc/free dance.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D39416

16 months agostand/efi: Simplify code here
Warner Losh [Mon, 1 May 2023 15:28:25 +0000 (09:28 -0600)]
stand/efi: Simplify code here

We have plenty of stack in the EFI case, so use it instead of the
complicated malloc / free dance.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D39415

16 months agostand/userboot: Simplify code
Warner Losh [Mon, 1 May 2023 15:28:17 +0000 (09:28 -0600)]
stand/userboot: Simplify code

We have way more than 8k of stack for the current value of the zfs
bootonce attribute. Allocate buf on the stack rather than the
complicated malloc / free dance.

Sponsored by: Netflix
Reviewed by: tsoome, kevans, jhb
Differential Revision: https://reviews.freebsd.org/D39414

16 months agorc.d/zfsbe: Simplify
Warner Losh [Mon, 1 May 2023 15:28:11 +0000 (09:28 -0600)]
rc.d/zfsbe: Simplify

So $(foo) is a shorter version of "`foo`".

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D39413

16 months agostand/boot1.efi: Implement bootonce for ZFS
Warner Losh [Mon, 1 May 2023 15:27:14 +0000 (09:27 -0600)]
stand/boot1.efi: Implement bootonce for ZFS

Implement ZFS bootonce protocol. We pass zfs-bootonce=t to the next boot
stage as a command line argument. Unlike zfsboot -> loader handoff in
the BIOS case, we don't use the OS_BOOTONCE_USED. This would require
modifications to loader.efi which would only server to make it more
complicated. Instead, use the command line parsing interface for the
boot1.efi -> loader.efi to pass in the zfs-bootonce kenv that will be
needed by rc.d/zfsbe to activate the BE if boot progresses that far.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D39412

16 months agostand/zfs: Refactor zfs_get_bootonce
Warner Losh [Mon, 1 May 2023 15:27:06 +0000 (09:27 -0600)]
stand/zfs: Refactor zfs_get_bootonce

Lookup the spa and pass it into zfs_get_bootonce_spa to process the boot
once protocol.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D39411

16 months agostand/zfs: Refactor zfs_set_bootenv
Warner Losh [Mon, 1 May 2023 15:26:59 +0000 (09:26 -0600)]
stand/zfs: Refactor zfs_set_bootenv

Refactor zfs_set_bootenv to split out the lookup of spa from the
rest. zfs_set_bootenv_spa flushes the benv to the vdevs and updates the
cached benv.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D39410

16 months agostand/zfs: Refactor zfs_get_bootenv
Warner Losh [Mon, 1 May 2023 15:26:51 +0000 (09:26 -0600)]
stand/zfs: Refactor zfs_get_bootenv

Create a new interface to zfs_get_bootenv called zfs_get_bootenv_spa
which takes a spa instead of a void * (effectively a devdesc *). Use
that in zfs_get_bootenv.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D39409

16 months agostand/zfs: Move spa_find_by_dev from zfsimpl.c to zfs.c
Warner Losh [Mon, 1 May 2023 15:26:44 +0000 (09:26 -0600)]
stand/zfs: Move spa_find_by_dev from zfsimpl.c to zfs.c

zfsimpl.c doesn't know about devdesc at all, but zfs.c does. Move it to
zfs.c, which is the only user. Keep it static for now, but it could be
exposed later if something else were to need it.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D39408

16 months agostand/boot1.efi: Allow modules to add env variables
Warner Losh [Mon, 1 May 2023 15:26:31 +0000 (09:26 -0600)]
stand/boot1.efi: Allow modules to add env variables

Sometimes filesystem modules need to pass details of the state of the
filesystem to later stages of a boot. Provide a generic method to do
so. We'll add them after any env variables set in our config files.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D39407

16 months agobsd.lib.mk: decouple lib*_pic.a from TOOLCHAIN build knob
Ed Maste [Mon, 1 May 2023 20:33:47 +0000 (16:33 -0400)]
bsd.lib.mk: decouple lib*_pic.a from TOOLCHAIN build knob

A user may use a tool chain from a package or just use an existing
tool chain from a previous installation.  There is no reason for this
to disable the installation of lib${LIB}_pic.a.

This also means we don't need to force MK_TOOLCHAIN=yes in lib/libc.

This reverts part of commit c0f5aeb0329d71e6b02379133c0c9c0145c9afea.

Reviewed by: jrtc27
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39917

16 months agobxe: prefer C99 bool to boolean_t
Ed Maste [Thu, 4 Jul 2019 14:56:07 +0000 (10:56 -0400)]
bxe: prefer C99 bool to boolean_t

Differential Revision: https://reviews.freebsd.org/D20853

16 months agopkgbase: hide duplicate METALOG directory warnings under verbose
Ed Maste [Mon, 1 May 2023 17:25:18 +0000 (13:25 -0400)]
pkgbase: hide duplicate METALOG directory warnings under verbose

Creating directories multiple times is an inherent side effect of the
way installation is done.  Hide warnings from duplicate directory
entries (with identical metadata) under metalog_reader's verbose mode.

Duplicate file entries are always reported.  They currently generate
warnings but will be switched to errors once the few instances currently
in the tree are fixed.

PR: 244596, 271178
Reviewed by: kevans
Sponsored By: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39898

16 months agoCirrus-CI: set PKG_FORMAT via top level `env:`
Ed Maste [Mon, 1 May 2023 16:45:36 +0000 (12:45 -0400)]
Cirrus-CI: set PKG_FORMAT via top level `env:`

This ensures consistency among different CI scripts, including future
ones for pkgbase work.

Sponsored by: The FreeBSD Foundation

16 months agokinst: test lock in kinst_trampoline_dealloc_locked()
Christos Margiolis [Mon, 1 May 2023 15:22:37 +0000 (15:22 +0000)]
kinst: test lock in kinst_trampoline_dealloc_locked()

Reviewed by: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39883

16 months agofbt: get rid of redundant defines
Christos Margiolis [Mon, 1 May 2023 15:20:34 +0000 (15:20 +0000)]
fbt: get rid of redundant defines

No functional change intended.

Reviewed by: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39882

16 months agohwpmc: Fix a typo
Mark Johnston [Mon, 1 May 2023 15:19:25 +0000 (11:19 -0400)]
hwpmc: Fix a typo

MFC after: 1 week

16 months agogeom(4): Add cross reference to geom(8)
Tom Hukins [Mon, 27 Mar 2023 20:50:25 +0000 (21:50 +0100)]
geom(4): Add cross reference to geom(8)

PR: 264387
Reviewed by: ceri
Pull Request: https://github.com/freebsd/freebsd-src/pull/702

16 months agomfi(4): Refer to mrsas(4)
Tom Hukins [Wed, 19 Apr 2023 20:03:09 +0000 (21:03 +0100)]
mfi(4): Refer to mrsas(4)

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/722

16 months agonetlink: whitespace fix in netlink_message_writer.h.
Alexander V. Chernikov [Mon, 1 May 2023 14:45:45 +0000 (14:45 +0000)]
netlink: whitespace fix in netlink_message_writer.h.

Reported by: garga
MFC after: 2 weeks

16 months agowlan(4): Add more related drivers to "See also"
Tom Hukins [Wed, 19 Apr 2023 19:47:24 +0000 (20:47 +0100)]
wlan(4): Add more related drivers to "See also"

Pull Request: https://github.com/freebsd/freebsd-src/pull/721

16 months agopf: Fix a spelling mistake in a comment
Tom Hukins [Wed, 29 Mar 2023 14:00:00 +0000 (15:00 +0100)]
pf: Fix a spelling mistake in a comment

Pull Request: https://github.com/freebsd/freebsd-src/pull/704

16 months agolibc: Fix a documentation spelling mistake
Tom Hukins [Wed, 29 Mar 2023 13:38:12 +0000 (14:38 +0100)]
libc: Fix a documentation spelling mistake

Pull Request: https://github.com/freebsd/freebsd-src/pull/704

16 months agopf: reduce number of hashing operations when handling source nodes
Kajetan Staszkiewicz [Mon, 1 May 2023 14:07:42 +0000 (16:07 +0200)]
pf: reduce number of hashing operations when handling source nodes

Reduce number of hashing operations when handling source nodes by always
having a pointer to the hash row mutex in the source node. Provide
macros for handling and asserting the mutex. Calculate the hash only
once in pf_find_src_node() and then use this hash in subsequent
operations.

Cherry-picked from development of D39880

Reviewed by: kp, mjg
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D39888

16 months agonetlink: always zero provided header buffers.
Alexander V. Chernikov [Mon, 1 May 2023 14:07:33 +0000 (14:07 +0000)]
netlink: always zero provided header buffers.

Reported by: KMSAN
MFC after: 3 days

16 months agolibmlx5: Add more ConnectX-6/7/8 HCA IDs to hca_table.
Hans Petter Selasky [Mon, 1 May 2023 11:48:20 +0000 (13:48 +0200)]
libmlx5: Add more ConnectX-6/7/8 HCA IDs to hca_table.

To allow userspace utilities to use these devices.

MFC after: 1 week
Sponsored by: NVIDIA Networking

16 months agoopensm: Fix build with -Werror and -Wdate-time.
Mina Galić [Mon, 1 May 2023 09:13:30 +0000 (11:13 +0200)]
opensm: Fix build with -Werror and -Wdate-time.

This fixes builds WITH_OFED_EXTRA=YES .

PR: 270776
Pull Request: https://github.com/freebsd/freebsd-src/pull/715
MFC after: 1 week
Sponsored by: NVIDIA Networking

16 months agostress2: Added a temporary fix for the UFS+SU "out of inodes" issue
Peter Holm [Mon, 1 May 2023 10:52:42 +0000 (12:52 +0200)]
stress2: Added a temporary fix for the UFS+SU "out of inodes" issue

16 months agoVendor import of less v632.
Xin LI [Mon, 1 May 2023 08:22:19 +0000 (01:22 -0700)]
Vendor import of less v632.

16 months agofwget: Introduce new utility
Emmanuel Vadot [Wed, 26 Apr 2023 05:46:20 +0000 (07:46 +0200)]
fwget: Introduce new utility

This script's goal is to check the system for peripherals that needs
firmware and install the needed packages for them.
For now it only support pci subsystem and only video classes for AMD
and Intel GPUs.

Reviewed by: bapt
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39825

16 months agoarmv7: release: Stop installing BBB u-boot
Emmanuel Vadot [Thu, 27 Apr 2023 06:21:47 +0000 (08:21 +0200)]
armv7: release: Stop installing BBB u-boot

BBB code was removed from GENERIC kernel as it's not functional.
Stop installing u-boot for a platform that we don't boot on.

Reviewed by: imp, gjb
Approved by: re@ (gjb)
MFC after: never
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39844

16 months agoarm: Remove TI code from GENERIC
Emmanuel Vadot [Thu, 27 Apr 2023 06:19:07 +0000 (08:19 +0200)]
arm: Remove TI code from GENERIC

TI support is in a sad state for years.
We haven't been able to keep up with all the breaking changes that
upstream do in the DTS. This requires a lot of new drivers to handle the
new buses that they create and all the new clocks that they expose.
Keep the code for now in case somebody is interested in reviving this
platform but stop bloating GENERIC with code that don't work.

Reviewed by: imp, mmel
MFC after: never
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39843

16 months agolisten(2): improve administrator control over logging
Eugene Grosbein [Sun, 30 Apr 2023 20:14:30 +0000 (03:14 +0700)]
listen(2): improve administrator control over logging

As documented in listen.2 manual page, the kernel emits a LOG_DEBUG
syslog message if a socket listen queue overflows. For some appliances,
it may be desirable to change the priority to some higher value
like LOG_INFO while keeping other debugging suppressed.

OTOH there are cases when such overflows are normal and expected.
Then it may be desirable to suppress overflow logging altogether,
so that dmesg buffer is not flooded over long run.

In addition to existing sysctl kern.ipc.sooverinterval,
introduce new sysctl kern.ipc.sooverprio that defaults to 7 (LOG_DEBUG)
to preserve current behavior. It may be changed to any value
in a range of 0..7 for corresponding priority or to -1 to suppress logging.
Document it in the listen.2 manual page.

MFC after: 1 month

16 months agocontrib/bc: import version 6.5.0
Stefan Eßer [Sun, 30 Apr 2023 17:53:26 +0000 (19:53 +0200)]
contrib/bc: import version 6.5.0

This release that fixes an infinite loop bug in the (non-standard)
extended math library functions root() and cbrt(), fixes a bug with
BC_LINE_LENGTH=0, and adds the fib() function to the extended math
library to calculate Fibonacci numbers.

(cherry picked from commit 438a1101dc1f687928cdbe02cd7817a88a24f42f)

MFC after:      3 days

16 months agolibifconfig: fix carp key configuration
Kristof Provost [Fri, 28 Apr 2023 16:18:55 +0000 (18:18 +0200)]
libifconfig: fix carp key configuration

There were two issues with the carp key configuration in the new netlink
code.

The first is that userspace failed to actually pass the CARP_NL_KEY
attribute to the kernel, so a key was never set.

The second issue is that snl_attr_get_string() returns a pointer to the
string inside the netlink message. It does not copy the string to the
target buffer. That's somewhat inconvenient to work with in libifconfig
where we have a static buffer for the key.
Introduce snl_attr_copy_string() which can copy a string to a target
buffer and uses the 'arg' parameter to pass the buffer size, so it
doesn't accidentally exceed the available space.

Reviewed by: melifaro
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D39874

16 months agonewfs: fix up 32-bit compile
Mateusz Guzik [Sun, 30 Apr 2023 18:00:20 +0000 (18:00 +0000)]
newfs: fix up 32-bit compile

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

16 months agosctp: improve handling of stale cookie error causes
Michael Tuexen [Sun, 30 Apr 2023 09:39:32 +0000 (11:39 +0200)]
sctp: improve handling of stale cookie error causes

* If a measure of staleness of 0 is reported, use the RTT instead.
* Ensure that we always send a cookie preservative parameter by
  rounding up during the calculation.
* If allowed, perform a round trip time measurement.
* Clear the overall error counter, since the error cause also
  acts like an ACK.

MFC after: 1 week

16 months agoYet another try to fix printf format conflict.
Kirk McKusick [Sun, 30 Apr 2023 06:59:45 +0000 (23:59 -0700)]
Yet another try to fix printf format conflict.

I find it very annoying that there is no FreeBSD infrastructure to
determine failures across architectures other than to check in
changes and then have Jenkins find them.

Suggested by: Jessica Clarke
MFC after:    1 week

16 months agofreebsd-update: Mention 13.2-RELEASE in usage.
Poul-Henning Kamp [Sun, 30 Apr 2023 05:06:56 +0000 (05:06 +0000)]
freebsd-update:  Mention 13.2-RELEASE in usage.

16 months agoFix printf format conflict
Kirk McKusick [Sun, 30 Apr 2023 00:55:15 +0000 (17:55 -0700)]
Fix printf format conflict

MFC after:   1 week

16 months agoAdditional validity checking in newfs(8).
Kirk McKusick [Sat, 29 Apr 2023 19:49:50 +0000 (12:49 -0700)]
Additional validity checking in newfs(8).

A check in the superblock validity code verifies that the computed
size of the filesystem cylinder groups (CGSIZE macro) does not
exceed the filesystem block size (fs_bsize).

A report was received that a filesystem had been flagged as failing
this check. We were unable to determine how the reported filesystem
could have been created. This commit adds a check at the end of the
newfs(8) command to verify that the the cylinder group size is valid.
If an oversize cylinder group is found newfs(8) prints a diagnostic
output and rebuilds the filesystem to make it compiliant.

MFC after:   1 week

16 months agoUpdates to UFS/FFS superblock integrity checks when reading a superblock.
Kirk McKusick [Sat, 29 Apr 2023 18:52:27 +0000 (11:52 -0700)]
Updates to UFS/FFS superblock integrity checks when reading a superblock.

Check for an uninitialed (zero valued) fs_maxbsize and set it
to its minimum valid size (fs_bsize). Uninitialed fs_maxbsize
were left by older versions of makefs(8) and the superblock
integrity checks fail when they are found.

No legitimate superblocks should fail as a result of these changes.

MFC after:    1 week
Sponsored by: The FreeBSD Foundation

16 months agoAdditional output from dumpfs(8).
Kirk McKusick [Sat, 29 Apr 2023 18:41:23 +0000 (11:41 -0700)]
Additional output from dumpfs(8).

Provide an additional line of output for the superblock giving the
computed size of the cylinder group (CGSIZE macro) along with the
details needed to calculate it.

MFC after:   1 week

16 months agowg: change module name to if_wg
Kristof Provost [Thu, 27 Apr 2023 15:35:12 +0000 (17:35 +0200)]
wg: change module name to if_wg

Other virtual interface drivers (e.g. if_gif, if_stf, if_ovpn) all start
with if_. The wireguard file is also named if_wg, but the module name
was 'wg'.

Fix this inconsistency.

Reported by: Christian McDonald <cmcdonald@netgate.com>
Reviewed by: zlei, kevans
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D39853

16 months agoReported by: vvd
Vladimir Druzenko [Sat, 29 Apr 2023 12:38:54 +0000 (15:38 +0300)]
Reported by: vvd
Approved by: tcberner (mentor)
Differential Revision: https://reviews.freebsd.org/D39859

Add records about new ports committer (vvd).
Update Mentor and Mentee Information to follow step 5 of the Committers
Guide.

16 months agosetfacl.1: correct reference to a trailing comma, should read "colon"
Ceri Davies [Sat, 29 Apr 2023 11:22:52 +0000 (12:22 +0100)]
setfacl.1: correct reference to a trailing comma, should read "colon"
PR: 271063
Reported by: rdd@rdd.nu

16 months agocross-build: Add common compatibility headers after OS-specific ones
Alex Richardson [Fri, 21 Apr 2023 22:06:51 +0000 (15:06 -0700)]
cross-build: Add common compatibility headers after OS-specific ones

The current order is rather counter-intuitive and it appears to work fine
if we swap the order.

Pull Request: https://github.com/freebsd/freebsd-src/pull/725
Reviewed by: imp

16 months agomrsas(4) switch from PTRIN define to include sys/abi_compat.h
Doug Ambrisko [Fri, 28 Apr 2023 20:51:20 +0000 (13:51 -0700)]
mrsas(4) switch from PTRIN define to include sys/abi_compat.h

Suggested by: dchagin

16 months agomrsas(4) fix build on targets that don't define PTRIN.
Doug Ambrisko [Fri, 28 Apr 2023 20:12:32 +0000 (13:12 -0700)]
mrsas(4) fix build on targets that don't define PTRIN.

16 months agoarmv7: Fix BeagleBone Black panic on system start
Konrad Sewiłło-Jopek [Fri, 28 Apr 2023 20:03:38 +0000 (22:03 +0200)]
armv7: Fix BeagleBone Black panic on system start

There is now assertion which requires all memory allocations of positive size.
Negative and zero-sized allocations lead to panic, so plug them off.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D39846

16 months agovfs: Rename vfs_emptydir() to vn_dir_check_empty()
Olivier Certner [Fri, 28 Apr 2023 09:00:11 +0000 (11:00 +0200)]
vfs: Rename vfs_emptydir() to vn_dir_check_empty()

No functional change.  While here, adapt comments to style(9).

Reviewed by:    kib
MFC after:      1 week

16 months agovfs: vn_dir_next_dirent(): Adapt comments to style(9)
Olivier Certner [Fri, 28 Apr 2023 09:04:16 +0000 (11:04 +0200)]
vfs: vn_dir_next_dirent(): Adapt comments to style(9)

No functional change.

Reviewed by:    kib
MFC after: 1 week

16 months agosrc.conf.5: regen after 4f6a5e1d6ce3, NETLINK_SUPPORT default change
Ed Maste [Fri, 28 Apr 2023 18:15:07 +0000 (14:15 -0400)]
src.conf.5: regen after 4f6a5e1d6ce3, NETLINK_SUPPORT default change

Sponsored by: The FreeBSD Foundation

16 months agojedec_dimm(4): Refactor offset adjustment and page0 reset
Ravi Pokala [Thu, 27 Apr 2023 05:03:48 +0000 (22:03 -0700)]
jedec_dimm(4): Refactor offset adjustment and page0 reset

Offsets greater than 255 bytes reside on page1 of the SPD device.
Accessing them requires switching to page1, and adjusting the absolute
offset to be relative to the start of page1. After the access, the page
must be set back to page0. These operations are performed in several
places, so break them out into their own functions.

Also, replace a pair of default cases, which should be impossible due to
earlier checks, with __assert_unreachable().

Reviewed by: imp
MFC after: 1 week
Sponsored by: Panasas
Differential Revision: https://reviews.freebsd.org/D39842