]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
11 months agolinux(4): Refactor recvmsg
Dmitry Chagin [Mon, 14 Aug 2023 12:46:12 +0000 (15:46 +0300)]
linux(4): Refactor recvmsg

As the amount of handled anxiliary messages grows move they handlers
into a separate functions.

MFC after: 1 week

11 months agolinux(4): Skip unsupported anxiliary message
Dmitry Chagin [Mon, 14 Aug 2023 12:46:12 +0000 (15:46 +0300)]
linux(4): Skip unsupported anxiliary message

Instead of returning error, skip unsupported anxiliary messages and
fail if no one handled.

MFC after: 1 week

11 months agolinux(4): Improve readability of recvmsg control buffer copyout code
Dmitry Chagin [Mon, 14 Aug 2023 12:46:12 +0000 (15:46 +0300)]
linux(4): Improve readability of recvmsg control buffer copyout code

MFC after: 1 week

11 months agolinux(4): Drop bogus empty line in linux_socket.c
Dmitry Chagin [Mon, 14 Aug 2023 12:46:12 +0000 (15:46 +0300)]
linux(4): Drop bogus empty line in linux_socket.c

MFC after: 1 week

11 months agolinux(4): Fix control message size calculation again
Dmitry Chagin [Mon, 14 Aug 2023 12:46:11 +0000 (15:46 +0300)]
linux(4): Fix control message size calculation again

It looks Linux recvmsg allows msg_controllen size less then CMSG_SPACE
buffer, at least for case with one cmsghdr. Glibc misc/tst-scm_rights
test succed on Ubuntu 23.04

Fixes:   67116c69 "linux(4): Fix control message size calculation"
MFC after: 1 week

11 months agosctp: cleanup
Michael Tuexen [Mon, 14 Aug 2023 10:27:39 +0000 (12:27 +0200)]
sctp: cleanup

Do not put a variable in the stcb for passing it to a function.
Just use a parameter of the function. No functional change intended.

MFC after: 1 week

11 months agobhyve: add Qemu PPI emulation for TPM devices
Corvin Köhne [Mon, 29 Aug 2022 10:10:47 +0000 (12:10 +0200)]
bhyve: add Qemu PPI emulation for TPM devices

Windows requires a physical presence interface to recognize the TPM
device. Qemu's OVMF has an implementation for the PPI which can be
reused. Using the Qemu PPI makes it very easy because we don't have to
implement new PPI functionality into our OVMF. The Qemu implementation
is already there.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40462

11 months agosctp: add an assert
Michael Tuexen [Sun, 13 Aug 2023 20:47:43 +0000 (22:47 +0200)]
sctp: add an assert

This enforces a condition mentioned in a comment.

MFC after: 1 week

11 months agosctp: use consistent names for locking macros
Michael Tuexen [Sun, 13 Aug 2023 20:32:54 +0000 (22:32 +0200)]
sctp: use consistent names for locking macros

While there, add also a macro for an assert. Will be used shortly.
No functional change intended.

MFC after: 1 week

11 months agoixgbe: define IXGBE_LE32_TO_CPUS
Kevin Bowling [Mon, 14 Aug 2023 01:47:09 +0000 (18:47 -0700)]
ixgbe: define IXGBE_LE32_TO_CPUS

Richard Lowe notes in PR 170267 IXGBE_LE32_TO_CPUS was previously
directly defined as le32dec() which is a pure function but the shared
code is expecting an in place conversion.

In SVN r282289 its assignment was removed altogether.

There was some deliberation in the PR on what to define this as, we
just need to do the update in place which is easy enough.

The uintptr_t casts in the shared code were from a DPDK sync and are
unwanted with our new ixgbe_osdep.h implementation.

PR: 170267
Reported by: Richard Lowe <richlowe@richlowe.net>
MFC after: 1 week

11 months agoofw_firmware: Only match if there is no compatible
Emmanuel Vadot [Sun, 13 Aug 2023 06:28:13 +0000 (08:28 +0200)]
ofw_firmware: Only match if there is no compatible

If there is a compatible string it likely means that the firmware needs
a dedicated driver (like on RPI*).

PR: 273087
Tested-by: Mark Millard <marklmi26-fbsd@yahoo.com>
Sponsored by: Beckhoff Automation GmbH & Co. KG
Fixes: fdfd3a90b6ce ("ofw: Add a ofw_firmware driver")

11 months agostress2: Added a 'fsck_ffs -B' regression test
Peter Holm [Sun, 13 Aug 2023 09:09:39 +0000 (11:09 +0200)]
stress2: Added a 'fsck_ffs -B' regression test

11 months agogdtoa: Regenerate configuration headers for 32-bit arm.
Michal Meloun [Sun, 13 Aug 2023 05:51:56 +0000 (07:51 +0200)]
gdtoa: Regenerate configuration headers for 32-bit arm.

These configuration headers were only guessed, but unfortunately not exactly
correctly. Therefore, re-generate them on real HW.

Generated on CA15, verified on CA9, CA7(with VFP lite) and on 32-bit ARMv9.

PR: 272229
Reported by: Robert Clausecker <fuz@FreeBSD.org>
MFC after: 2 weeks

11 months agoMFV: less v643.
Xin LI [Sun, 13 Aug 2023 07:13:31 +0000 (00:13 -0700)]
MFV: less v643.

MFC after: 2 weeks

11 months agoVendor import of less v643.
Xin LI [Sun, 13 Aug 2023 07:06:29 +0000 (00:06 -0700)]
Vendor import of less v643.

11 months agovis(3): need <stdint.h> for SIZE_MAX
Kyle Evans [Sun, 13 Aug 2023 05:28:12 +0000 (00:28 -0500)]
vis(3): need <stdint.h> for SIZE_MAX

11 months agoMerge commit 'acb089b983171667467adc66f56a723b609ed22e' into kbsd/vis
Kyle Evans [Sun, 13 Aug 2023 05:23:02 +0000 (00:23 -0500)]
Merge commit 'acb089b983171667467adc66f56a723b609ed22e' into kbsd/vis

Highlights:
- Some style fixes
- Bumped mbbuf in istrsenvisx() to MB_LEN_MAX to avoid VLAs
- mbslength cannot go negative, so make it unsigned
- Further bounds checking & fix an additional overrun, with dlen == 0
- Avoid duplicate call to wcslen(start)

11 months agoVendor import of NetBSD's (un)vis(3) at 2023-08-13
Kyle Evans [Sun, 13 Aug 2023 05:16:33 +0000 (00:16 -0500)]
Vendor import of NetBSD's (un)vis(3) at 2023-08-13

11 months agotc_fill_vdso_timehands32(): fix
Konstantin Belousov [Sat, 12 Aug 2023 19:51:37 +0000 (22:51 +0300)]
tc_fill_vdso_timehands32(): fix

On 64bit, there is a 4-byte hole in struct vdso_timekeep32 after
tk_current, if the structure is not packed.  This is due to the MD
th_x86_pvc_last_systime being 64bit.

Change amd64 VDSO_TIMEHANDS_MD32 to not use uint64_t, replace it with
pair of uint32_t, as it is done for all other members.

PR: 273085
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

11 months agolibc vdso time functions: correctly convert errors into errnos
Konstantin Belousov [Sat, 12 Aug 2023 15:45:43 +0000 (18:45 +0300)]
libc vdso time functions: correctly convert errors into errnos

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

11 months agoSet UFS/FFS file type to snapshot before changing its block pointers.
Kirk McKusick [Sat, 12 Aug 2023 18:20:08 +0000 (11:20 -0700)]
Set UFS/FFS file type to snapshot before changing its block pointers.

A UFS/FFS snapshot file is identified with the SF_SNAPSHOT
flag to identify it as a snapshot. This flag needs to be
set before setting some of its block pointers to the special
values BLK_SNAP and BLK_NOCOPY. If the snapshot creation fails
and we call VOP_REMOVE(), the SF_SNAPSHOT flag will let the
remove routine know that the special block pointer values need
to be rolled back before attempting deletion of the file.

Also ensure that an fsck is required after setting superblock
values in the ffs_checkcgintegrity() routine.

Reported-by: Peter Holm
Tested-by: Peter Holm
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
11 months agovlan: Respect IFCAP_LRO mask
Kevin Bowling [Sat, 12 Aug 2023 16:31:22 +0000 (09:31 -0700)]
vlan: Respect IFCAP_LRO mask

vlan_capabilities(), used by the IFCAP ioctl, was not respecting the
IFCAP_LRO bit if it was masked by the requestor.

This prevented if_bridge(4) from automasking LRO with a message like:
bridge0: can't disable some capabilities on em3.11: 0x400

This also prevented manually disabling LRO from any vlan interface.

PR: 254596
Reported by: Paul Vixie <paul@redbarn.org>
MFC after: 1 week

11 months agoRevert "if_vlan: do not enable LRO for bridge interaces"
Kristof Provost [Sat, 12 Aug 2023 13:56:21 +0000 (15:56 +0200)]
Revert "if_vlan: do not enable LRO for bridge interaces"

This reverts commit 5f11a33ceeb385477cb22d9ad5941061c5a26be9.

As requested by Kevin Bowling. He explains:

> The subtle bug was that vlan_capabilities() in if_vlan was not obeying
> the requested mask from its IFCAP ioctl.

11 months agogve: Simplify tx loop over buffer ring
Shailend Chand [Sat, 12 Aug 2023 07:59:26 +0000 (00:59 -0700)]
gve: Simplify tx loop over buffer ring

Reviewed by: markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D41281

11 months agovm: Fix address hints of 0 with MAP_32BIT
Alan Cox [Thu, 3 Aug 2023 07:07:14 +0000 (02:07 -0500)]
vm: Fix address hints of 0 with MAP_32BIT

Also, rename min_addr to default_addr, which better reflects what it
represents.  The min_addr is not a minimum address in the same way that
max_addr is actually a maximum address that can be allocated.  For
example, a non-zero hint can be less than min_addr and be allocated.

Reported by: dchagin
Reviewed by: dchagin, kib, markj
Fixes: d8e6f4946cec0 "vm: Fix anonymous memory clustering under ASLR"
Differential Revision: https://reviews.freebsd.org/D41397

11 months agolinuxolator: implement Linux' PROT_GROWSDOWN
Konstantin Belousov [Sat, 29 Jul 2023 21:00:51 +0000 (00:00 +0300)]
linuxolator: implement Linux' PROT_GROWSDOWN

From the Linux man page for mprotect(2):
   PROT_GROWSDOWN
       Apply  the  protection  mode  down to the beginning of a mapping
       that grows downward (which should be a stack segment or a
       segment mapped with the MAP_GROWSDOWN flag set).

Reported by: dchagin
Reviewed by: alc, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41099

11 months agovm_map_protect(): add VM_MAP_PROTECT_GROWSDOWN flag
Konstantin Belousov [Fri, 28 Jul 2023 00:40:53 +0000 (03:40 +0300)]
vm_map_protect(): add VM_MAP_PROTECT_GROWSDOWN flag

which requests to propagate lowest stack segment protection to the grow gap.
This seems to be required for Linux emulation.

Reported by: dchagin
Reviewed by: alc, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41099

11 months agovm_map_growstack(): restore stack gap data if gap entry was removed
Konstantin Belousov [Tue, 25 Jul 2023 18:52:15 +0000 (21:52 +0300)]
vm_map_growstack(): restore stack gap data if gap entry was removed

and then restored.

Reviewed by: alc, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41099

11 months agovm_map: do not allow to merge stack gap entries
Konstantin Belousov [Tue, 25 Jul 2023 18:48:57 +0000 (21:48 +0300)]
vm_map: do not allow to merge stack gap entries

At least, offset handling is wrong for them.

Reviewed by: alc, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41099

11 months agovm_map_protect(): handle stack protection stored in the stack guard
Konstantin Belousov [Tue, 25 Jul 2023 13:32:28 +0000 (16:32 +0300)]
vm_map_protect(): handle stack protection stored in the stack guard

mprotect(2) on the stack region needs to adjust guard stored protection,
so that e.g. enable executing on stack worked properly on stack growth.

Reported by: dchagin
Reviewed by: alc, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41099

11 months agovm_map_protect(): move guard handling at the last phase into an empty dedicated helper
Konstantin Belousov [Fri, 28 Jul 2023 00:14:07 +0000 (03:14 +0300)]
vm_map_protect(): move guard handling at the last phase into an empty dedicated helper

Restructure the first phase slightly, to facilitate further changes.

Reviewed by: alc, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41099

11 months agovm_map_growstack(): handle max protection for stacks
Konstantin Belousov [Tue, 25 Jul 2023 13:56:29 +0000 (16:56 +0300)]
vm_map_growstack(): handle max protection for stacks

Do not assume that protection is same as max_protection.  Store both in
offset, packed in the same way as the prot syscall parameter.

Reviewed by: alc, markj (previous version)
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41099

11 months agovm_map.c: add CONTAINS_BITS macro
Konstantin Belousov [Sat, 29 Jul 2023 17:52:52 +0000 (20:52 +0300)]
vm_map.c: add CONTAINS_BITS macro

Suggested by: dougm
Reviewed by: alc, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41099

11 months agoAdd vm_map_insert1(9)
Konstantin Belousov [Wed, 19 Jul 2023 16:44:18 +0000 (19:44 +0300)]
Add vm_map_insert1(9)

The function returns the newly created entry.
Use vm_map_insert1() in stack grow code to avoid gap entry re-lookup.

The comment update for vm_map_try_merge_entries() was suggested by dougm.

Suggested by: alc
Reviewed by: alc, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41099

11 months agovm_map_insert(): update herald comment
Konstantin Belousov [Thu, 10 Aug 2023 07:59:25 +0000 (10:59 +0300)]
vm_map_insert(): update herald comment

Only a part of the object may be mapped.

Noted by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41099

11 months agorpi: Simplify dtb file tests
Warner Losh [Tue, 5 Jul 2022 16:33:17 +0000 (10:33 -0600)]
rpi: Simplify dtb file tests

Now that we no longer support armv[45] devices, these tests can be
simplified. While here, update the comment to reflect which rpi devices
we support. It's been way more thant he Pi-B for a long time.

Sponsored by: Netflix

11 months agoclang: Minor build simplification now that armv[45] is not supported
Warner Losh [Tue, 5 Jul 2022 16:19:32 +0000 (10:19 -0600)]
clang: Minor build simplification now that armv[45] is not supported

Simplify these expressions a little and remove an obsolete comment.

Sponsored by: Netflix

11 months agoMakefile.inc1: Remove redundant test for armv[67]
Warner Losh [Tue, 5 Jul 2022 16:16:19 +0000 (10:16 -0600)]
Makefile.inc1: Remove redundant test for armv[67]

If MACHINE is arm, then MACHINE_ARCH is going to be either armv6* or
armv7*.

Sponsored by: Netflix

11 months agorelease(7): Bump date after introducing VMFSLIST in 32ae9a6b3937
Li-Wen Hsu [Sat, 12 Aug 2023 04:39:53 +0000 (12:39 +0800)]
release(7): Bump date after introducing VMFSLIST in 32ae9a6b3937

Sponsored by: The FreeBSD Foundation

11 months agotests: Also exclude powerpc/powerpcspe from mmap_map_32bit_test
Li-Wen Hsu [Sat, 12 Aug 2023 01:24:15 +0000 (09:24 +0800)]
tests: Also exclude powerpc/powerpcspe from mmap_map_32bit_test

Sponsored by: The FreeBSD Foundation

11 months agoif_vlan: do not enable LRO for bridge interaces
Paul Vixie [Fri, 11 Aug 2023 18:17:16 +0000 (20:17 +0200)]
if_vlan: do not enable LRO for bridge interaces

If the parent interface is not a bridge and can do LRO and
checksum offloading on VLANs, then guess it may do LRO on VLANs.
False positive here cost nothing, while false negative may lead
to some confusions. According to Wikipedia:

"LRO should not operate on machines acting as routers, as it breaks
the end-to-end principle and can significantly impact performance."

The same reasoning applies to machines acting as bridges.

PR: 254596
MFC after: 3 weeks

11 months agotmpfs: add the "pgread" mount option to the allowed options list for mount
Konstantin Belousov [Fri, 11 Aug 2023 18:00:44 +0000 (21:00 +0300)]
tmpfs: add the "pgread" mount option to the allowed options list for mount

Fixes: 0f613ab85e5a5274704d179f39fb15163d46e7c4
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

11 months agopkgbase: move libcom_err from kerberos to kerberos-lib
Doug Rabson [Wed, 9 Aug 2023 07:42:16 +0000 (08:42 +0100)]
pkgbase: move libcom_err from kerberos to kerberos-lib

This makes it possible to install kerberos-lib (which is used by common
utilities such as curl) without pulling in the rest of kerberos.

MFC after: 1 week

11 months agovtnet: allow IFF_ALLMULTI to be set without VIRTIO_NET_F_CTRL_RX
Kristof Provost [Tue, 8 Aug 2023 07:15:53 +0000 (09:15 +0200)]
vtnet: allow IFF_ALLMULTI to be set without VIRTIO_NET_F_CTRL_RX

If the host doesn't announce VIRTIO_NET_F_CTRL_RX we cannot disable all
multicast traffic. Previously we'd refuse to set the IFF_ALLMULTI flag,
which is the exact opposite of what is actually happening.

This broke things such as igmpproxy.

See also: https://redmine.pfsense.org/issues/14301
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D41356

11 months agoOptimize operations on UFS/FFS filesystems with bad cylinder group(s).
Kirk McKusick [Fri, 11 Aug 2023 06:02:47 +0000 (23:02 -0700)]
Optimize operations on UFS/FFS filesystems with bad cylinder group(s).

If a UFS/FFS filesystem develops a broken cylinder group (which is
usually detected when its check hash fails), that cylinder group
will not be usable until the filesystem has been unmounted and fsck
has been run to repair it. On the first attempt to to allocate
resources from the broken cylinder group, its available resources
are set to zero in the superblock summary information. Since it
will appear to have no resources available, no further calls will
be made to allocate resources from it. When resources are freed to
the broken cylinder group, the resource free routines will find the
cylinder group unusable so the resource will simply be discarded
and thus will not show up in the superblock summary information
until they are recovered by fsck.

Reported-by: Peter Holm
Tested-by: Peter Holm
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
11 months agoCleanups to UFS/FFS ffs_checkblk().
Kirk McKusick [Fri, 11 Aug 2023 05:38:56 +0000 (22:38 -0700)]
Cleanups to UFS/FFS ffs_checkblk().

Rename to ffs_checkfreeblk() to better describe that it is checking
to find out if a block or fragment is free. Clarify its implementation.

No functional change intended.

MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
11 months agoLink /usr/bin/cpuset to a relative path
Enji Cooper [Fri, 11 Aug 2023 08:11:57 +0000 (01:11 -0700)]
Link /usr/bin/cpuset to a relative path

This creates an appropriate symlink instead of a potentially incorrect
path pointing to the absolute path for cpuset(8) on the host.

MFC after: 2 weeks
MFC with: f05948d4e98d3abd0965a
Requested by: imp
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D41419

11 months agomana: fix a KASSERT panic on recursed lock access in mana_cfg_vport
Wei Hu [Fri, 11 Aug 2023 03:30:38 +0000 (03:30 +0000)]
mana: fix a KASSERT panic on recursed lock access in mana_cfg_vport

The panic stack looks like this:
panic: _sx_xlock_hard: recursed on non-recursive sx MANA port lock
@ /usr/src/sys/dev/mana/mana_en.c:1022

KDB: stack backtrace:
vpanic() at vpanic+0x150/frame 0xfffffe011b3c1970
panic() at panic+0x43/frame 0xfffffe011b3c19d0
_sx_xlock_hard() at _sx_xlock_hard+0x82d/frame 0xfffffe011b3c1a70
_sx_xlock() at _sx_xlock+0xb0/frame 0xfffffe011b3c1ab0
mana_cfg_vport() at mana_cfg_vport+0x79/frame 0xfffffe011b3c1b40
mana_alloc_queues() at mana_alloc_queues+0x3b/frame 0xfffffe011b3c1c50
mana_up() at mana_up+0x40/frame 0xfffffe011b3c1c70
mana_ioctl() at mana_ioctl+0x25b/frame 0xfffffe011b3c1cb0
ifhwioctl() at ifhwioctl+0xd11/frame 0xfffffe011b3c1db0
hn_xpnt_vf_init() at hn_xpnt_vf_init+0x15f/frame 0xfffffe011b3c1e10

The lock has already been held in the caller. Remove this
redundant lock attempt.

Reported by: NetApp
Sponsored by: Microsoft

11 months agossh: Update to OpenSSH 9.4p1
Ed Maste [Fri, 11 Aug 2023 03:10:18 +0000 (23:10 -0400)]
ssh: Update to OpenSSH 9.4p1

Excerpts from the release notes:

 * ssh-agent(1): PKCS#11 modules must now be specified by their full
   paths. Previously dlopen(3) could search for them in system
   library directories.

 * ssh(1): allow forwarding Unix Domain sockets via ssh -W.

 * ssh(1): add support for configuration tags to ssh(1).
   This adds a ssh_config(5) "Tag" directive and corresponding
   "Match tag" predicate that may be used to select blocks of
   configuration similar to the pf.conf(5) keywords of the same
   name.

 * ssh(1): add a "match localnetwork" predicate. This allows matching
   on the addresses of available network interfaces and may be used to
   vary the effective client configuration based on network location.

 * ssh-agent(1): improve isolation between loaded PKCS#11 modules
   by running separate ssh-pkcs11-helpers for each loaded provider.

 * ssh-agent(1), ssh(1): improve defences against invalid PKCS#11
   modules being loaded by checking that the requested module
   contains the required symbol before loading it.

 * ssh(1): don't incorrectly disable hostname canonicalization when
   CanonicalizeHostname=yes and ProxyJump was expicitly set to
   "none". bz3567

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

Relnotes: Yes
Sponsored by: The FreeBSD Foundation

11 months agoOpenSSL: clean up botched merges in OpenSSL 3.0.9 import
Jung-uk Kim [Fri, 11 Aug 2023 02:36:15 +0000 (22:36 -0400)]
OpenSSL: clean up botched merges in OpenSSL 3.0.9 import

No functional change intended.

11 months agoqcom: fix panic in qcom_mdio_ipq4018 implementation
Bjoern A. Zeeb [Fri, 11 Aug 2023 02:05:45 +0000 (02:05 +0000)]
qcom: fix panic in qcom_mdio_ipq4018 implementation

Fix a boot-time panic in qcom_mdio_ipq4018 due to a missing bus function
and hook the file up to the build so that it will not rot away.

Test booted on an ipq807x in 2022.
X-Differential Revision: extracted from D37882

11 months agoClean up and document UFS/FFS error returns.
Kirk McKusick [Fri, 11 Aug 2023 00:50:23 +0000 (17:50 -0700)]
Clean up and document UFS/FFS error returns.

The ffs_inotovp() function returns a vnode from a mounted filesystem
for an inode number with specified generation number. We now
consistently return ESTALE if the inode with given generation number
no longer exists on that filesystem.

The ffs_reload() function reloads all incore data for a filesystem.
It is used after running fsck on a mounted filesystem and finding
things to fix. It now returns the EINTEGRITY error if it is unable
to find a valid superblock.

MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
11 months agocpuset(8): move to /bin/
Enji Cooper [Thu, 11 May 2023 05:54:51 +0000 (22:54 -0700)]
cpuset(8): move to /bin/

Summary:
This change moves /usr/bin/cpuset to /bin/cpuset so it is more readily
available on hosts where the /usr partition might not be mounted at the
time / has been mounted.

Remove some complexity from rc.subr(8) since /bin is assumed to always
be present if/when / is mounted.

MFC after: 2 weeks
MFC with: 0661f93892a2271d552379af

Test Plan:
- Test out rc.subr change.
- Confirm that the installation logic does what's needed.

Relnotes: yes (moving cpuset may impact strict file permissions/mode checking)
Reviewers: kevans
Subscribers: imp
Differential Revision: https://reviews.freebsd.org/D40057

11 months agoOpenSSL: regen opensslv.h for OpenSSL 3.0.10
Jung-uk Kim [Fri, 11 Aug 2023 00:17:23 +0000 (20:17 -0400)]
OpenSSL: regen opensslv.h for OpenSSL 3.0.10

11 months agorelease: update main to ALPHA1
Glen Barber [Fri, 11 Aug 2023 00:02:11 +0000 (20:02 -0400)]
release: update main to ALPHA1

Update CURRENT to ALPHA1 as part of the 14.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: GoFundMe https://www.gofundme.com/f/gjbbsd
Sponsored by: PayPal https://paypal.me/gjbbsd

11 months agoMakefile.libcompat: Fix DTRACE variable
Jessica Clarke [Thu, 10 Aug 2023 23:48:01 +0000 (00:48 +0100)]
Makefile.libcompat: Fix DTRACE variable

Back when Makefile.lib32 was turned into Makefile.libcompat, a typo was
introduced; it should have been LIBCOMPATDTRACE, but instead gained a
dollar sign in it as LIB$COMPATDTRACE (and with COMPATDTRACE not being
defined, was equivalent to ${LIB:U${DTRACE}}). This then meant it was
not converted to LIB${_LIBCOMPAT}DTRACE in 91d7edd549f5 ("Generalise
libcompat to be a list rather than a single option") and instead left
broken. Belatedly fix this long-standing seemingly-inconsequential bug.

Fixes: dba75e9fa5a9 ("Move Makefile.lib32 to Makefile.libcompat and generalize it.")

11 months agoUnbreak usr.bin/dc with OpenSSL 3
Enji Cooper [Fri, 11 Aug 2023 03:36:48 +0000 (20:36 -0700)]
Unbreak usr.bin/dc with OpenSSL 3

OpenSSL's BN_zero API has had a void return value since 1.1.x: chase the
change to unbreak the build on OpenSSL 3.x with MK_GH_BC == no.

MFC after: 2 weeks
Reviewed by: emaste, kevans
Differential Revision: https://reviews.freebsd.org/D41410

11 months agomountd: Fix type of signal variable
Rick Macklem [Thu, 10 Aug 2023 19:50:35 +0000 (12:50 -0700)]
mountd: Fix type of signal variable

Without this patch got_sighup(), which is the SIGHUP handler,
would set a variable of type int.

This would appear to be incorrect, although it has worked reliably.
This patch changes the type to "_Atomic(int)", which appears
to be all that is needed to correct it.

Reported by: pen@lysator.lui.se
Reviewed by: theraven, karels (prev version), kevans (prev version)
Differential Revision: https://reviews.freebsd.org/D41265

11 months agonetlink: Align allocations on __max_align_t, not uint64_t.
John Baldwin [Thu, 10 Aug 2023 18:12:52 +0000 (11:12 -0700)]
netlink: Align allocations on __max_align_t, not uint64_t.

uint64_t is not sufficient alignment for allocators on all platforms.
On a CHERI platform pointers require 16 byte alignment, but also if a
type contained a uint128_t or long double it would not be aligned
correctly either.  C11 added max_align_t precisely to provide a
portable type for allocators to use.

Reviewed by: melifaro
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D41301

11 months agokern: osd: avoid dereferencing freed slots
Kyle Evans [Thu, 10 Aug 2023 17:32:33 +0000 (12:32 -0500)]
kern: osd: avoid dereferencing freed slots

If a slot is freed that isn't the last one, we'll set its destructor to
NULL to indicate that it's been freed and leave a hole in the slot map.
Check osd_destructors in osd_call() to avoid dereferencing a method that
is potentially from a module that's been unloaded.

This scenario would most commonly surface when two modules are loaded
that osd_register(), then the earlier one deregisters and an osd_call()
is made after the fact.  In the specific report that triggered the
investigation, kldload if_wg -> kldload linux* -> kldunload if_wg ->
destroy a jail -> panic.

Noted in the review, but left for follow-up work, is that the realloc
that may happen in osd_deregister() should likely go away and the
assumption that reallocating to a smaller size cannot fail is actually
not correct.

Reported by: dim
Reviewed by: markj, jamie
Differential Revision: https://reviews.freebsd.org/D41404

11 months agoUFS: panic rather than forcibly unmount the root fs
Chuck Silvers [Thu, 10 Aug 2023 16:55:47 +0000 (09:55 -0700)]
UFS: panic rather than forcibly unmount the root fs

If the root fs is forcibly unmounted then basically every process
will die with a SEGV as soon as it tries to run again because libc.so
is gone, which leaves the system basically hung.  It seems better
to just panic instead, so let's do that.

Requested-by: karels
Reviewed-by: imp, mckusick, karels
Sponsored-by: Netflix
Differential Revision: https://reviews.freebsd.org/D41387

11 months agoVendor import of OpenSSH 9.4p1
Ed Maste [Thu, 10 Aug 2023 16:16:53 +0000 (12:16 -0400)]
Vendor import of OpenSSH 9.4p1

11 months agoOpenSSL: update to 3.0.10
Pierre Pronchery [Thu, 10 Aug 2023 16:07:32 +0000 (12:07 -0400)]
OpenSSL: update to 3.0.10

OpenSSL 3.0.10 addresses:
- CVE-2023-3817
- CVE-2023-3446
- CVE-2023-2975

(Note that the vendor branch commit incorrectly referenced 3.0.9.)

Relnotes: Yes
Pull request: https://github.com/freebsd/freebsd-src/pull/808
Sponsored by: The FreeBSD Foundation

11 months agoixl.4: update link to intel-nvmupdate ports
Alan Somers [Wed, 2 Aug 2023 00:04:12 +0000 (18:04 -0600)]
ixl.4: update link to intel-nvmupdate ports

MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: pkubaj
Differential Revision: https://reviews.freebsd.org/D41288

11 months agotcopy: Pick up max blocksize from sysctl kern.maxphys
Poul-Henning Kamp [Thu, 10 Aug 2023 14:56:53 +0000 (14:56 +0000)]
tcopy: Pick up max blocksize from sysctl kern.maxphys

11 months agoigc: sync srrctl buffer sizing with e1000
Kevin Bowling [Thu, 10 Aug 2023 14:41:21 +0000 (07:41 -0700)]
igc: sync srrctl buffer sizing with e1000

Approved by: grehan
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31493

11 months agoix: Fix accessing wrong register
Piotr Pietruszewski [Thu, 10 Aug 2023 13:43:21 +0000 (15:43 +0200)]
ix: Fix accessing wrong register

Use IXGBE_GRC_BY_MAC(hw) macro instead of IXGBE_GRC as IXGBE_GRC's
address is different on Denverton platform.

This patch is part of change made in NetBSD kernel
by Masanobu Saitoh, NetBSD maintainer.

Differential Revision: https://reviews.freebsd.org/D19175
Approved by: erj

11 months agozfs: cherry-pick fix from openzfs
Martin Matuska [Thu, 10 Aug 2023 07:59:39 +0000 (09:59 +0200)]
zfs: cherry-pick fix from openzfs

Vendor PR:
  #15103 Remove zl_issuer_lock from zil_suspend()

Obtained from: OpenZFS
OpenZFS commit: 2848de11e516a2ef2e6baa574a60d77a6fb47023

Note: full vendor imports will continue when stable/14 has been branched

11 months agozfs: cherry-pick fix from openzfs
Martin Matuska [Thu, 10 Aug 2023 07:55:42 +0000 (09:55 +0200)]
zfs: cherry-pick fix from openzfs

Vendor PR:
  #15080 ZIL: Fix config lock deadlock

Obtained from: OpenZFS
OpenZFS commit: 2cb992a99ccadb78d97049b40bd442eb4fdc549d

Note: full vendor imports will continue when stable/14 has been branched

11 months agobhyve: emulate TPM passthru by accessing /dev/tpmX
Corvin Köhne [Mon, 29 Aug 2022 10:10:45 +0000 (12:10 +0200)]
bhyve: emulate TPM passthru by accessing /dev/tpmX

To send commands to the TPM device, bhyve can use the host TPM driver by
reading and writing from /dev/tpmX. Using this approach, only the host
TPM driver has to detect and interact with the physical TPM interface.
This simplifies bhyve's code much. As the host TPM driver has to
interact with the TPM regardless of bhyve making use of it or not, makes
it a good approach.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40460

11 months agobhyve: add emulation for CRB register of TPM devices
Corvin Köhne [Mon, 29 Aug 2022 10:10:44 +0000 (12:10 +0200)]
bhyve: add emulation for CRB register of TPM devices

Trap accesses to the CRB MMIO range and emulate them properly.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40459

11 months agosdhci: Add support for disable-wp
Emmanuel Vadot [Thu, 29 Sep 2022 11:58:08 +0000 (13:58 +0200)]
sdhci: Add support for disable-wp

Some platform needs it when the WP pin is broken.

Sponsored by: Beckhoff Automation GmbH & Co. KG
MFC after: 2 weeks

11 months agosdhci: xilinx: Add compatible and quirks for ZynqMP
Emmanuel Vadot [Thu, 29 Sep 2022 08:49:05 +0000 (10:49 +0200)]
sdhci: xilinx: Add compatible and quirks for ZynqMP

Sponsored by: Beckhoff Automation GmbH & Co. KG
MFC after: 2 weeks

11 months agoarm64: xilinx: gpio: Add support for ZynqMP SoC
Emmanuel Vadot [Thu, 29 Sep 2022 08:41:24 +0000 (10:41 +0200)]
arm64: xilinx: gpio: Add support for ZynqMP SoC

Add support for the gpio controller found in the ZynqMP SoC.
The registers are the same as the Zynq 7000, just the number of
banks/pins per banks differs.

Sponsored by: Beckhoff Automation GmbH & Co. KG
MFC after: 2 weeks

11 months agoarm: xilinx: gpio: Make the driver more generic
Emmanuel Vadot [Thu, 29 Sep 2022 08:05:19 +0000 (10:05 +0200)]
arm: xilinx: gpio: Make the driver more generic

All other Zynq SoCs have the same GPIO controller, the only difference
is the number of banks/pins so make this driver more generic to add
other SoCs more easily.
No functional changes intended.

Sponsored by: Beckhoff Automation GmbH & Co. KG
MFC after: 2 weeks

11 months agoUpdate comment describing struct vm_map
Konstantin Belousov [Thu, 10 Aug 2023 05:01:39 +0000 (08:01 +0300)]
Update comment describing struct vm_map

There is no list connecting all entries any more, and correspondingly no
order on the list entries.

Reviewed by: dougm
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D41405

11 months agofusefs tests: handle -Wdeprecated* issues with GoogleTest 1.14.0
Enji Cooper [Tue, 8 Aug 2023 13:42:07 +0000 (06:42 -0700)]
fusefs tests: handle -Wdeprecated* issues with GoogleTest 1.14.0

`INSTANTIATE_TEST_CASE_P` has been replaced with `INSTANTIATE_TEST_SUITE_P`.
Replace all uses of the former macro with the latter macro.

While here, address the fact that the latter macro doesn't permit some
of the constructions that the former macro did, e.g., empty parameters,
etc.

MFC after: 2 weeks
Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D41398

11 months agoImport GoogleTest 1.14.0
Enji Cooper [Tue, 8 Aug 2023 06:17:32 +0000 (23:17 -0700)]
Import GoogleTest 1.14.0

GoogleTest 1.14.0 now requires C++14 to build. Change
`googletest.test.inc.mk` to reflect this requirement.

Adjust the build integration logic to handle the new version of
GoogleTest (add/remove headers/sources as needed).

Tighten down warnings via `CXXFLAGS.clang` instead of ignoring all
warnings. Some new warnings snuck in after I did my last round of fix
submissions upstream.

Also address some overlinking added in the previous version import by
removing superfluous libraries.

===============================

Expect WhenDynamicCastToTest.AmbiguousCast to fail

This change reapplies the expected failure from 1.10.0.

Ref: https://github.com/google/googletest/issues/2172

MFC after: 2 weeks
Reviewed by: asomers, emaste
Differential Revision: https://reviews.freebsd.org/D41399

Merge commit '8ef491440fcaec96f899d73e08873426c78583a4' into googletest-v1.14.0-import

11 months agoixgbe: Add support for 82599 LS
Kevin Bowling [Thu, 10 Aug 2023 01:30:15 +0000 (18:30 -0700)]
ixgbe: Add support for 82599 LS

Obtained from: DPDK 549ccd3dc01539e060597b503f2b65b272de3347
MFC after: 1 week

11 months agoixgbe: Check for fw_recovery
Kevin Bowling [Thu, 10 Aug 2023 00:31:49 +0000 (17:31 -0700)]
ixgbe: Check for fw_recovery

The x550 uses an upgradable flash code.  Check for recovery condition
like other flashable intel cards do in case of fw errors.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31869

11 months agoLinuxKPI: add page pool skeleton
Bjoern A. Zeeb [Tue, 23 May 2023 23:15:57 +0000 (23:15 +0000)]
LinuxKPI: add page pool skeleton

Add the page pool skeleton based on a wireless driver.  We have to
sort out some struct page problems first before we can start
implementing this but that should happen independent of all other
changes.

MFC after: 10 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40250

11 months agoRemove a partial UFS/FFS snapshot if it fails to build successfully.
Kirk McKusick [Wed, 9 Aug 2023 23:43:41 +0000 (16:43 -0700)]
Remove a partial UFS/FFS snapshot if it fails to build successfully.

When taking a UFS/FFS snapshot, it may not succeed for example if the
filesystem is too full to hold it. When a snapshot is unable to be
successfully taken, the partial snapshot should be removed.

Reported-by: Peter Holm
Tested-by: Peter Holm
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
11 months agoEC2: Build and upload AMIs for both UFS and ZFS
Colin Percival [Mon, 7 Aug 2023 01:56:18 +0000 (18:56 -0700)]
EC2: Build and upload AMIs for both UFS and ZFS

The pre-existing "ec2ami" target builds and uploads a single AMI
(with filesystem determined by ${VMFS}) as before; a new "ec2amis"
target does both UFS and ZFS.

Reviewed by: gjb
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D41343

11 months agoEC2: Respect ${VMFS}
Colin Percival [Mon, 7 Aug 2023 01:55:37 +0000 (18:55 -0700)]
EC2: Respect ${VMFS}

Prior to this commit, ${VMFS} controlled the filesystem used for
building EC2 images, but the AMIs were recorded with SSM Parameter
paths which indicated that they were UFS.

This commit (a) uses ${VMFS} in the SSM parameter path instead of
a hard-coded "ufs", and (b) adds the filesystem to the AMI name.

Reviewed by: gjb
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D41342

11 months agorelease: Build cloudware with multiple FS types
Colin Percival [Mon, 7 Aug 2023 01:54:39 +0000 (18:54 -0700)]
release: Build cloudware with multiple FS types

New ${CW}_FSLIST settings control the list of filesystem types with which
each cloudware image will be built; currently these are all set to "ufs",
i.e. no change from previous.

The cloudware images have their filesystem type as part of their file
name; for backwards compatibilty the ${VMFS} image is linked to the
previously used file name.  This compatibility can be removed once all
the cloudware uploading/publishing code has been updated to use the new
image names (possibly more than one of them).

Reviewed by: gjb
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D41341

11 months agorelease: Build UFS and ZFS VM images
Colin Percival [Mon, 7 Aug 2023 01:53:16 +0000 (18:53 -0700)]
release: Build UFS and ZFS VM images

A new option 'VMFSLIST' controls the list of filesystems for which VM
images will be built; the default is to build both UFS and ZFS.

The vm-install target installs these as ${OSRELEASE}-${FS}.${FORMAT},
e.g. FreeBSD-14.0-CURRENT-amd64-zfs.vmdk.  For backwards compatibility,
the ${VMFS} image is linked to the previously used ${OSRELEASE}.${FORMAT}
name.

Cloudware building will be updated in a later commit.

Reviewed by: gjb
Reviewed by: emaste, markj (previous version)
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D41340

11 months agomsi: report error for attempt to use APIC ID > 255
Ed Maste [Tue, 8 Aug 2023 23:42:09 +0000 (19:42 -0400)]
msi: report error for attempt to use APIC ID > 255

The MSI/MSI-X address includes 8 bits to encode the Destination ID.
Previously IDs over 255 overlapped with the fixed portion of the
address, resulting in an invalid value (and a nonfunctional interrupt).

Instead, print an error message and return EINVAL.  The interrupt will
still not work, but the user will have a clue as to why.

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

11 months agoe1000: Enable TSO on 82574
Kevin Bowling [Wed, 9 Aug 2023 17:18:37 +0000 (10:18 -0700)]
e1000: Enable TSO on 82574

Further testing indicates something wrong with particular reciever,
enabling TSO 82574 for wider testing.

Tested by: karels
MFC after: 3 months

11 months agoarswitch(4): Remove support for AR{7240,9340} found in MIPS SoCs only
Marius Strobl [Tue, 8 Aug 2023 20:35:02 +0000 (22:35 +0200)]
arswitch(4): Remove support for AR{7240,9340} found in MIPS SoCs only

With the general removal of MIPS support there's no longer a need to
support these integrated switches.

Approved by: adrian
Differential Revision: https://reviews.freebsd.org/D41394

11 months agoath(4): Remove MIPS SoC build glue and AR9130 from FreeBSD HAL
Marius Strobl [Mon, 7 Aug 2023 19:16:11 +0000 (21:16 +0200)]
ath(4): Remove MIPS SoC build glue and AR9130 from FreeBSD HAL

All of these are obsoleted by the general removal of MIPS support.

Actually, corresponding to the removed AH_SUPPORT_x, there is more
superfluous support sprinkled across the HAL source. However, that
code is left in place for now in order to ease a sync to NetBSD.

Reviewed by: emaste (w/ man page fix)
Approved by: adrian
Differential Revision: https://reviews.freebsd.org/D41355

11 months agodts: Bump the freebsd branding version to 6.4
Emmanuel Vadot [Wed, 9 Aug 2023 13:36:55 +0000 (15:36 +0200)]
dts: Bump the freebsd branding version to 6.4

Sponsored by: Beckhoff Automation GmbH & Co. KG

11 months agoImport device-tree files from Linux 6.4
Emmanuel Vadot [Wed, 9 Aug 2023 13:32:31 +0000 (15:32 +0200)]
Import device-tree files from Linux 6.4

Sponsored by:   Beckhoff Automation GmbH & Co. KG

11 months agoImport device-tree files from Linux 6.4
Emmanuel Vadot [Wed, 9 Aug 2023 13:31:58 +0000 (15:31 +0200)]
Import device-tree files from Linux 6.4

11 months agoImport device-tree files from Linux 6.3
Emmanuel Vadot [Wed, 9 Aug 2023 13:30:56 +0000 (15:30 +0200)]
Import device-tree files from Linux 6.3

Sponsored by:   Beckhoff Automation GmbH & Co. KG

11 months agoImport device-tree files from Linux 6.3
Emmanuel Vadot [Wed, 9 Aug 2023 13:30:20 +0000 (15:30 +0200)]
Import device-tree files from Linux 6.3

11 months agoImport device-tree files from Linux 6.2
Emmanuel Vadot [Wed, 9 Aug 2023 13:29:14 +0000 (15:29 +0200)]
Import device-tree files from Linux 6.2

Sponsored by:   Beckhoff Automation GmbH & Co. KG

11 months agoImport device-tree files from Linux 6.2
Emmanuel Vadot [Wed, 9 Aug 2023 13:28:30 +0000 (15:28 +0200)]
Import device-tree files from Linux 6.2

11 months agoImport device-tree files from Linux 6.1
Emmanuel Vadot [Wed, 9 Aug 2023 13:27:37 +0000 (15:27 +0200)]
Import device-tree files from Linux 6.1

Sponsored by:   Beckhoff Automation GmbH & Co. KG

11 months agoImport device-tree files from Linux 6.1
Emmanuel Vadot [Wed, 9 Aug 2023 13:06:51 +0000 (15:06 +0200)]
Import device-tree files from Linux 6.1

11 months agoman4: Remove stale MLINK to ath_pci.4
Marius Strobl [Wed, 9 Aug 2023 12:35:25 +0000 (14:35 +0200)]
man4: Remove stale MLINK to ath_pci.4

Reported by: Jose Luis Duran
Fixes: 37c8ee8847fa ath(4): Remove MIPS AHB frontend and join PCI one w/ main support again