Commit Graph

297384 Commits

Author SHA1 Message Date
Jose Luis Duran 88d448ec81 mk: Move vm stack test debug symbols
Avoid the creation of a /usr/tests/sys/vm/stack/.debug directory by
placing sys/vm/stack test debug symbols under /usr/lib/debug.

Reviewed by:	emaste
Approved by:	emaste (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48796
2025-02-04 14:47:24 +00:00
Jose Luis Duran bccaf0262d libopencsd: Remove extra slashes
Remove extra slashes that end up in the metalog.  These double slashes
can produce an invalid specification file if there are subdirectories
down the hierarchy when sorted.

For example, consider the following metalog excerpt:

    ./base/aaa type=dir
    ./base//aaa/bbb type=dir

If sorted, would turn out:

    ./base//aaa/bbb type=dir
    ./base/aaa type=dir

Apparently missing the ./base/aaa directory in the specification.

Luckily here are no subdirectories.

Reviewed by:	imp, emaste
Approved by:	emaste (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48779
2025-02-04 14:15:37 +00:00
Jose Luis Duran 841856570e csu tests: Remove extra slash
Remove an extra slash that ends up in the metalog.  This double slash
can produce an invalid specification file if there are subdirectories
down the hierarchy when sorted.

For example, consider the following metalog excerpt:

    ./base/aaa type=dir
    ./base//aaa/bbb type=dir

If sorted, would turn out:

    ./base//aaa/bbb type=dir
    ./base/aaa type=dir

Apparently missing the ./base/aaa directory in the specification.

Luckily here are no subdirectories.

Reviewed by:	imp, emaste
Approved by:	emaste (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48778
2025-02-04 14:15:12 +00:00
Jose Luis Duran dc4b36b963 nanobsd: Always define the partition index
Print the desired partition index together with the starting LBA and the
size. Otherwise, when only one code partition is desired, the
configuration partition (/cfg) may not end up in the third slice, thus
breaking the scripts that expect it there.

This was the previous approach, changed in 587c054bea ("nanobsd: Use
gpart and create code image before full disk image").

Fix it by printing the index as the last column to reduce the chances of
breaking current overrides, and using it as the gpart index.

PR:		262098
Reviewed by:	imp
Approved by:	emaste (mentor)
Fixes:	587c054bea ("nanobsd: Use gpart and create code image before full disk image")
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D47835
2025-02-04 14:07:00 +00:00
Wei Hu da1deb784d Hyper-V: hn: rewrite hn rsc swtich to avoid sysctl hang
Changing the rsc_switch flag using sysctl to turn rsc on or off
could hang. The orignal code sends request to host to get the
mtu setting. Sometimes the host fails to reply, causing
the thread to sleep forever waiting for the host response.

Use existing cached mtu from hn device instead to avoid calling
host.

Reported by:	whu
Tested by:	whu
MFC after:	1 week
2025-02-04 13:39:14 +00:00
Andrew Turner ff977fd34b arm64: Add a quirk for arm,fvp-base-revc
This is a software model so may have too many CPUs in its dtb. Add the
MP_QUIRK_CPULIST quirk so we don't panic on boot.

Sponsored by:	Arm Ltd
2025-02-04 12:21:04 +00:00
Andrew Turner 8fd88aeedb arm64/its: Support devices not behind an iommu
When the IOMMU option is enabled but a device doesn't have an IOMMU
this will return an error. If the device is really behind an IOMMU
then it will fail later, and if not this is needed to allocate MSI and
MSI-X interrupts.

Reviewed by:	kib
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D48725
2025-02-04 12:02:00 +00:00
Andrew Turner 6a7a01ec8b physmem: Move the ram0 device earlier in the boot
If the ram driver is unable to reserve a memory range it will panic
with no real information why. Move this driver earlier in the boot so
any devices that cause the conflict will fail to attach.

This should make it easier to debug why the conflict exists.

Reviewed by:	mhorne, kevans, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D48766
2025-02-04 12:02:00 +00:00
Andrew Turner cc67ca7207 depend-cleanup: Ignore lib32 for arm64 only files
When cleaning arm64 only files we try to clean both the native libc
depends files and the compat32 depends files. Ignore the latter as
only the native files have changed.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D48524
2025-02-04 11:30:37 +00:00
Harry Moulton 32111003c3 arm64/vmm: save and restore HCRX_EL2 register
With the addition of the Extended Hypervisor Configuration Register
(HCRX_EL2), this change ensures that it is both set to 0 before entering
a vm, and that it is properly saved/restored.

Reviewed by:	andrew
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D48584
Signed-off-by: Harry Moulton <harry.moulton@arm.com>
2025-02-04 11:24:41 +00:00
Colin Percival 078e8b34b1 release: Chase location of pkg repo databases
pkg used to store copies of upstream repository databases in
/var/db/pkg/repo-*.sqlite.  About a year ago this was moved to
/var/db/pkg/repos/*/, resulting in FreeBSD cloud images no longer
having those (unhelpful since they'll be long out of date before
the cloud images are launched) databases removed.

Remove the correct location, and hope that future pkg updates don't
break the base system again.

Sponsored by:	Amazon
2025-02-03 16:10:47 -08:00
Colin Percival 16f3346309 kernel: Print SOURCE_DATE_EPOCH in UTC
If SOURCE_DATE_EPOCH is set and MK_REPRODUCIBLE_BUILD is not set, the
kernel contains SOURCE_DATE_EPOCH, converted to a date+time string.
In the interests of easier reproducibility convert it in UTC.

Reviewed by:	imp
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D48802
2025-02-03 15:58:32 -08:00
Colin Percival 44a768e1a8 stand: Use SOURCE_DATE_EPOCH in newvers.sh
The newvers.sh script is used to generate vers.c for 10 programs (at
latest count on amd64): 4 EFI loaders, 3 x86 loaders, two userboots,
and one kboot.  When building without MK_REPRODUCIBLE_BUILD this
resulted in 10 different timestamps being compiled into various files.

If SOURCE_DATE_EPOCH is set, use that value rather than the current
date and time.

Reviewed by:	emaste, imp
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D48803
2025-02-03 15:58:32 -08:00
Maxim Konovalov 70ccb89db2 build.7: document check-old-libs target
PR:		284546
MFC after:	3 days
2025-02-03 22:13:39 +00:00
Doug Moore ee511f83b3 vm_reserv: use default pool for free page removal.
Differential Revision:	https://reviews.freebsd.org/D45409
2025-02-03 15:58:17 -06:00
Alexander Ziaee 4a5d51e73e resizewin.1: Fix option list width typo + spdx
MFC after:		3 days
Accepted by:		mhorne (mentor)
Differential Revision:	https://reviews.freebsd.org/D48349
2025-02-03 15:24:41 -05:00
Jesper Schmitz Mouridsen c14b016242 mt7601U: Importing if_mtw from OpenBSD
Added ht20 mode, based on if_run from FreeBSD, and if_mtw.c
from OpenBSD.

PR: 247545
Approved by:	adrian, wireless
Differential Revision: https://reviews.freebsd.org/D45179
2025-02-03 20:20:52 +01:00
Gleb Smirnoff c2aa91745e netstat: restore printing the "default" keyword, provide -nn option
Avoid POLA breakage and preserve output standard that really predates
the FreeBSD project itself.  There are scripts in the wild that rely
on the behavior.

Provide option to specify -nn twice to have a completely numeric
output of the routing tables.

Fixes:	9206c79961
This reverts commit e090646d6f.

Reviewed by:		zlei, gallatin, melifaro, allanjude, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D48729
2025-02-03 10:09:58 -08:00
Gleb Smirnoff fe5a6266dd protosw: this is a kernel only header, put back #ifdef _KERNEL
The uncommented #ifdef _KERNEL originates from 1997 by wollman@ (see
57bf258e3d) with no clear original reason.  Since these old times two
abusers of the header leak were created - libprocstat(3) and netstat(1).
These two already have a lot of _WANT_FOO hacks, so satisfy them with
_WANT_PROTOSW.

While here, cleanup and sort forward declaraions.
2025-02-03 09:48:53 -08:00
Gleb Smirnoff bf3338e74b netstat: cleanup includes in mroute6.c
The file obtains some kernel structures in a dirty way and needs
forward declaration of struct sockopt for that.  Make it explicit
instead of getting it via headers that were not designed for that.
2025-02-03 09:48:41 -08:00
Gleb Smirnoff 94387f252a sockets: remove unused pr_sopoll_notsupp() 2025-02-03 09:47:13 -08:00
Warner Losh fdaf7d0fe1 umass: Print quirks with %b
Print the quirks in a more human-readable form. When testing a dozen
different removeable devices, the hex numbers quickly blur...

Sponsored by:		Netflix
2025-02-03 10:25:27 -07:00
Alexander Ziaee 8b35839346 gstat: Sync usage/synopsis + tag SPDX
Sort options using the slightly unusual convention used here as well.

MFC after:		3 days
Approved by:		carlavilla (mentor), imp (src)
Differential Revision:	https://reviews.freebsd.org/D48800
2025-02-03 10:06:59 -05:00
Ed Maste 4a7d6666c5 contrib: Remove now-unused cortex-strings
Replaced by arm-optimized-routines in commit 2e8ff4d1d5 ("Switch to
Arm Optimized Routines for mem* & str*").

Reviewed by:	andrew
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48500
2025-02-03 09:45:40 -05:00
Ed Maste 513c4e2079 blocklistd: Remove obsolete network class reference
This was a comment in a configuration example.

Reported by:	bapt
Reviewed by:	bapt, jlduran
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48810
2025-02-03 09:40:51 -05:00
Zhenlei Huang 7def047a1a bpf: Fix potential race conditions
There're two possible race conditions,

1. Concurrent bpfattach() and bpf_setif(), i.e., BIOCSETIF ioctl,
2. Concurrent bpfdetach() and bpf_setif().

For the first case, userland may see BPF interface attached but it has
not been in the attached interfaces list `bpf_iflist` yet. Well it
will eventually be so this case does not matter.

For the second one, bpf_setif() may reference `dead_bpf_if` and the
kernel will panic (spotted by change [1], without the change we will
end up silently corrupted memory).

A simple fix could be that, we add additional check for `dead_bpf_if`
in the function `bpf_setif()`. But that requires to extend protection
of global lock (BPF_LOCK), i.e., BPF_LOCK should also protect the
assignment of `ifp->if_bpf`. That simple fix works but is apparently
not a good design. Since the attached interfaces list `bpf_iflist` is
the single source of truth, we look through it rather than check
against the interface's side, aka `ifp->if_bpf`.

This change has performance regression, that the cost of BPF interface
attach operation (BIOCSETIF ioctl) goes back from O(1) to O(N) (where
N is the number of BPF interfaces). Well we normally have sane amounts
of interfaces, an O(N) should be affordable.

[1] 7a974a6498 bpf: Make dead_bpf_if const

Fixes:		16d878cc99 Fix the following bpf(4) race condition ...
MFC after:	4 days
Differential Revision:	https://reviews.freebsd.org/D45725
2025-02-03 20:13:19 +08:00
Ruslan Bukin c7e0b94b7d riscv vmm: consider hart_mask_base argument in the SBI IPI handler.
From the spec:

Any SBI function, requiring a hart mask, must take the following
two arguments:

- unsigned long hart_mask is a scalar bit-vector containing hartids
- unsigned long hart_mask_base is the starting hartid from which the
  bit-vector must be computed.

hart_mask_base can be set to -1 to indicate that hart_mask shall be
ignored and all available harts must be considered.

Differential Revision:	https://reviews.freebsd.org/D48717
2025-02-03 11:49:48 +00:00
Ruslan Bukin 1fdb01ec5f riscv vmm: fix remote fence.
From the spec:

The remote fence function acts as a full TLB flush if
• start_addr and size are both 0
• size is equal to 2^XLEN-1

Differential Revision:	https://reviews.freebsd.org/D48716
2025-02-03 11:45:32 +00:00
Ruslan Bukin 7ac65902d8 bhyve/riscv: fix interrupts-extended property.
Construct interrupts-extended (property of APLIC) properly.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D48713
2025-02-03 11:44:18 +00:00
Ruslan Bukin 6b599b34df bhyve/riscv: remove clock-frequency from CPU node.
Remove CPU clock-frequency property as incorrectly constructed
and not needed.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D48712
2025-02-03 11:42:50 +00:00
Ruslan Bukin 95b8b67f3c bhyve/riscv: add clock-frequency property to DTS.
Add clock-frequency property to the UART adapter node in DTS.

Differential Revision:	https://reviews.freebsd.org/D48699
2025-02-03 11:39:21 +00:00
Gleb Smirnoff b0580c7a67 sockets: remove empty shim function sopoll() 2025-02-02 22:38:28 -08:00
Gleb Smirnoff 815f2a61bf sockets: removed unused argument from sopoll() 2025-02-02 22:38:24 -08:00
Gleb Smirnoff 6472c6baee sctp: don't specify pr_poll = sopoll_generic
Trust the framework to set the generic methods.  No functional change.
2025-02-02 22:38:18 -08:00
Gleb Smirnoff 9d7fb76854 sockets: garbage collect SB_NOINTR
Not used.  All socket buffer sleeps are interruptible.
2025-02-02 22:38:18 -08:00
Igor Ostapenko 6befd35111 kyua: Support require.diskspace ATF metadata
Reviewed by:	ngie
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D48333
2025-02-02 19:14:55 +00:00
Poul-Henning Kamp 89baab9671 Arm64/GicV3: Change default cache mode from GITS_BASER_CACHE_WAWB to GITS_BASER_CACHE_RAWAWB
For not yet determined reasons, the Qualcom Snapdragon Elite will
take no other value than RAWAWB, but we're basically OK with that,
because that should be the most performant setting.  Investigations
are continuing.

This patch makes the Lenovo T14sGen6 laptop to boot to multiuser,
but very little else works.
2025-02-02 19:00:57 +00:00
Warner Losh 6f659c9a49 pci: Change device to function
It's functions that are placed into D3 for these value, not the device.

PR: 259703
Sponsored by:		Netflix
2025-02-02 10:26:04 -07:00
Warner Losh d889926162 isci: Remove dead code
This code hasn't compiled for years, so just remove it.

PR: 229954
Sponsored by: Netflix
2025-02-02 10:18:35 -07:00
Warner Losh 5a8caf9bfa bce: make compile with BCE_DEBUG
Builds now with BCE_DEBUG defined. All bets are of as to whether or not
it works though. This is not the default, and likely quite a rare config
given (a) it's been broken for years and (b) this is an old card people
aren't actively debugging anymore. I don't have the hardware to test it,
though I've not changed anything in the BCE_DEBUG undefined case.

Sponsored by:		Netflix
2025-02-02 09:57:01 -07:00
Warner Losh 5deab77bb6 bce: Fix register dumping to skip blank area
When compiling with debug enabled, this produces an always false
warning. It's clear that this was to skip ranges that aren't used when
dumping the registers, so change the && to || to skip things properly.

PR: 200984
Sponsored by:		Netflix
2025-02-02 09:49:15 -07:00
Svyatoslav ead758a67a pms: Fix always true condition
Although this is vendor code, and apparently abandoned vendor code at
that, this is clearly a mistake and always true. It's unclear how to
contribute back to the upstream at this point, alas.

PR: 217745
Reviewed by: imp
2025-02-02 09:35:51 -07:00
Dmitry Luhtionov 64dcfa2593 ig4(4): Add Intel ACPI HID
MFC after:	1 month
2025-02-02 10:25:18 +03:00
Gleb Smirnoff 50c962d773 krpc/clnt_nl: filter RPC replies on vnet
RPC calls are filtered by the Netlink system itself, but the RPC replies
are not.  With legitimate use the chance of a xid collision is zero, since
global clients use global atomically updated 32-bit counter for that.
However, a malicious jail may blindly inject replies guessing the xid,
where guessing is trivial.  Protect against that checking the vnet, too.
2025-02-01 11:27:22 -08:00
Gleb Smirnoff 96104caaf0 rpcsec_tls: do not create an RPC client per vnet
A netlink RPC client should be global.  The filtering of RPC calls is done
by the nl_send_group() that would distribute the call to all subscribers
in the curvnet of clnt_nl_call() context.

Fixes:	a3a6dc24f3
Fixes:	42eec5201a
2025-02-01 11:13:45 -08:00
Kirk McKusick 15eed13089 Add notes for handling the January 19, 2038 date limit in UFS1 filesystems
Differential Revision: https://reviews.freebsd.org/D48472
2025-02-01 10:59:26 -08:00
Gleb Smirnoff 0009c4e737 UPDATING: add note that API/ABI for RPC services for the kernel has changed 2025-02-01 01:01:35 -08:00
Gleb Smirnoff 99e5a70046 sysent: regen for deletion of gssd_syscall and new ABI for rpctls_syscall 2025-02-01 01:00:28 -08:00
Gleb Smirnoff 765ad4f039 rpcsec_tls: cleanup the rpctls_syscall()
With all the recent changes we don't need extra argument that specifies
what exactly the syscalls does, neither we need a copyout-able pointer,
just a pointer sized integer.

Reviewed by:		rmacklem
Differential Revision:	https://reviews.freebsd.org/D48649
2025-02-01 01:00:28 -08:00
Gleb Smirnoff 8e5f80da89 rpc.tlsservd: provide parallelism with help of pthread(3)
At normal NFS server runtime there is not much RPC traffic from kernel to
rpc.tlsservd.  But as Rick rmacklem@ explained, the notion of multiple
workers exists to handle a situation when a server reboots and it has
several hundred or thousands of TLS/TCP connections from clients.  Once it
comes back up, all the clients make TCP connections and do TLS handshakes.

So cleanup the remnants of the workers, that left after the conversion of
RPC over netlink(4) transport and restore desired parallelism with help of
pthread(3).

We are processing the TLS handshakes in separate threads, one per
handshake.  Number of concurrent threads is capped by hw.ncpu / 2, but this
can be overriden with -N.

Differential Revision:	https://reviews.freebsd.org/D48570
2025-02-01 01:00:28 -08:00