]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
14 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")

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

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

MFC after: 2 weeks

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

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

14 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

14 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

14 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

14 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

14 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

14 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

14 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")

14 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

14 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

14 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.

14 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

14 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

14 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

14 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

14 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

14 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.

14 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

14 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

14 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

14 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.

14 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

14 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

14 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

14 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

14 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

14 months agojedec_dimm(4): Add manufacturing year and week.
Ravi Pokala [Tue, 25 Apr 2023 06:07:39 +0000 (23:07 -0700)]
jedec_dimm(4): Add manufacturing year and week.

DDR3 and DDR4 encode the week and year that the DIMM was manufactured,
as a pair of two-digit binary-coded decimal values. Read the values, and
report them as (uint8_t)s.

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

14 months agoAdd the mfi(4) ioctl support to mrsas(4)
Doug Ambrisko [Wed, 24 Aug 2022 22:27:03 +0000 (15:27 -0700)]
Add the mfi(4) ioctl support to mrsas(4)

The hardware supported by mfi(4) and mrsas(4) use the same dcmd's.
mfiutil(8) in theory could run on controlled attached to mrsas(4).
It can't since mrsas(4) doesn't have support for the FreeBSD mfi(4)
ioctl.  Porting the ioctl from mfi(4) to mrsas(4) would be the first
step in making mrsasutil(8) which is an additional name for mfiutil(8)
but opens /dev/mrsasX instead of /dev/mfiX

PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265794
Reviewed by: jhb
Differential revision: https://reviews.freebsd.org/D36342
Tested by: Dan Mahoney <freebsd@gushi.org>

14 months agonetlink: fix debug message on 32-bit archs
Alexander V. Chernikov [Fri, 28 Apr 2023 15:47:11 +0000 (15:47 +0000)]
netlink: fix debug message on 32-bit archs

14 months agonetlink: add forgotten opt_netlink header
Alexander V. Chernikov [Fri, 28 Apr 2023 15:44:01 +0000 (15:44 +0000)]
netlink: add forgotten opt_netlink header

14 months agokinst: do not use DPCPU_ID_GET if we already have the trampoline
Christos Margiolis [Fri, 28 Apr 2023 15:11:10 +0000 (15:11 +0000)]
kinst: do not use DPCPU_ID_GET if we already have the trampoline

No functional change intended.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39870

14 months agobusdma: Update KMSAN shadow maps later in bounce_bus_dmamap_sync()
Mark Johnston [Fri, 28 Apr 2023 14:49:25 +0000 (10:49 -0400)]
busdma: Update KMSAN shadow maps later in bounce_bus_dmamap_sync()

Otherwise POSTREAD syncs may re-invalidate the shadow of the data buffer
when copying from bounce pages, resulting in false-positive KMSAN
reports.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

14 months agoApply clang fix for assertion building emulators/rpcs3
Dimitry Andric [Fri, 28 Apr 2023 14:08:42 +0000 (16:08 +0200)]
Apply clang fix for assertion building emulators/rpcs3

Merge commit a5e1a93ea10f from llvm-project (by Mariya Podchishchaeva):

  [clang] Fix crash when handling nested immediate invocations

  Before this patch it was expected that if there was several immediate
  invocations they all belong to the same expression evaluation context.
  During parsing of non local variable initializer a new evaluation context is
  pushed, so code like this
  ```
  namespace scope {
  struct channel {
      consteval channel(const char* name) noexcept { }
  };
  consteval const char* make_channel_name(const char* name) { return name;}

  channel rsx_log(make_channel_name("rsx_log"));
  }
  ```
  produced a nested immediate invocation whose subexpressions are attached
  to different expression evaluation contexts. The constructor call
  belongs to TU context and `make_channel_name` call to context of
  variable initializer.

  This patch removes this assumption and adds tracking of previously
  failed immediate invocations, so it is possible when handling an
  immediate invocation th check that its subexpressions from possibly another
  evaluation context contains errors and not produce duplicate
  diagnostics.

  Fixes https://github.com/llvm/llvm-project/issues/58207

  Reviewed By: aaron.ballman, shafik

  Differential Revision: https://reviews.llvm.org/D146234

PR: 269489
MFC after: 3 days

14 months agonetlink: properly zero all fields in the ndmsg header.
Alexander V. Chernikov [Fri, 28 Apr 2023 14:04:47 +0000 (14:04 +0000)]
netlink: properly zero all fields in the ndmsg header.

MFC after: 3 days

14 months agoroute: show originator PID in netlink monitor
Alexander V. Chernikov [Fri, 28 Apr 2023 12:44:04 +0000 (12:44 +0000)]
route: show originator PID in netlink monitor

Replacing rtsock with netlink also means providing similar tracing facilities,
rtsock provides `route -n monitor` interface, where each message can be traced
to the originating PID.
This diff closes the feature gap between rtsock and netlink in that regard.

Netlink works slightly differently from rtsock, as it is a generic message
"broker". It calls some kernel KPIs and returns the result to the caller.
Other Netlink consumers gets notified on the changed kernel state using the
relevant subsystem callbacks. Typically, it is close to impossible to pass
some data through these KPIs to enhance the notification.

This diff approaches the problem by using osd(9) to assign the relevant
socket pointer (`'nlp`) to the per-socket taskqueue execution thread.
This change allows to recover the pointer in the aforementioned notification
callbacks and extract some additional data.
Using `osd(9)` (and adding additional metadata) to the notification receiver
comes with some additional cost attached, so this interface needs to be
enabled explicitly by using a newly-created `NETLINK_MSG_INFO` `SOL_NETLINK`
socket option.

The actual medatadata (which includes the originator PID) is provided via
control messages. To enable extensibility, the control message data is
encoded in the standard netlink(TLV-based) fashion. The list of the
currently-provided properties can be found in `nlmsginfo_attrs`.
snl(3) is extended to enable decoding of netlink messages with metadata
(`snl_read_message_dbg()` stores the parsed structure in the provided buffer).

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

14 months agonetlink: fix netlink interface operations when netlink is loaded as a module.
Alexander V. Chernikov [Fri, 28 Apr 2023 13:30:36 +0000 (13:30 +0000)]
netlink: fix netlink interface operations when netlink is loaded as a module.

This change completes 089104e0e01f.

MFC after: 2 weeks

14 months agonetlink: enable NETLINK_SUPPORT by default on all architectures.
Alexander V. Chernikov [Thu, 27 Apr 2023 14:38:08 +0000 (14:38 +0000)]
netlink: enable NETLINK_SUPPORT by default on all architectures.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D39849

14 months agolibifconfig: fix incorrect carp output
Kristof Provost [Fri, 28 Apr 2023 11:24:44 +0000 (13:24 +0200)]
libifconfig: fix incorrect carp output

If one interface has a carp address configured on it ifconfig would show
this information on all interfaces.

That's because the kernel does (as one would expect) not return any carp
data for interface without carp configuration. However, this wound up
not overwriting the data passed in by the caller, and leaving the (now
stale) information in pace. As a result the caller thought carp was
configured on the interface.

Zero out the input structure before making the call to the kernel, so
that we correctly return 0 if there is no carp configuration on the
queried interface.

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

14 months agoSplit out pmap_map_delete on arm64
Andrew Turner [Fri, 28 Apr 2023 10:54:19 +0000 (11:54 +0100)]
Split out pmap_map_delete on arm64

This will be used when supporting some extensions, e.g. Branch Target
Identification (BTI).

Sponsored by: Arm Ltd