uchcom: Set rate to 1 if 0
If userspace provides rate == 0, it causes kernel panic as rate is
directly used as a divident, which cannot be zero. Fix it by set the
rate to 1 if it is passed as 0.
Reviewed by: imp, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D59111
boot-test.sh: Add gptboot.efi tests
Make sure that we can chainboot with gptboot.efi. Many projects use this
as their migration tool from gptboot to ping-pong partitions to boot
from. This tests that functionality which I recently broke.
Assisted-by: Claude Code (Fable 5, Opus 5)
Sponsored by: Netflix
Restore booting the partition the EFI boot image was loaded from.
BSDRP images are built with "poudriere image -t firmware", which puts
gptboot.efi on the ESP instead of loader.efi. gptboot.efi reads the GPT
bootme attribute, picks the active system partition (BSDRP1 or BSDRP2),
chainloads /boot/loader.efi from it and hands loader.efi that partition
in LoadedImage->DeviceHandle (stand/efi/boot1/boot1.c:try_boot).
Since ce9bfd78167 ("loader.efi: Refactor try_boot_device_partitions"),
find_currdev() no longer tries that device: try_boot_device_partitions()
walks the parent disk while explicitly skipping dp->pd_handle, on the
assumption that the boot image always comes from an ESP holding no root
filesystem. When chainloaded, the partition gptboot.efi selected is
therefore the one partition never considered, and loader.efi falls
through to the first other UFS partition on the disk - the previous
system. Every A/B upgrade silently boots the old slice.
Commit 1c85c5eea09, which introduced try_boot_device_partitions(), did
try dp itself before its siblings; the refactor dropped it. Restore it,
[5 lines not shown]
boot-test.sh: Add netboot-http-efi test
Using iPXE, chainboot loader.efi with rootdev=http://${next-server}/
to test the loader's http:// code.
Sponsored by: Netflix
boot-test.sh: Add virtio-rng-pci to the EFI RAM-disk netboot qemu invocation
Since the PixieFail security fixes (CVE-2023-45237), EDK II's DxeNetLib --
underneath essentially all of NetworkPkg (Mnp/Arp/Ip4/Dhcp4/Tcp/Http) --
carries a DEPEX on EFI_RNG_PROTOCOL. With no RNG protocol producer
available, that DEPEX is never satisfied and the entire NetworkPkg driver
stack silently fails to load: no error, no assert, it just isn't there.
netboot-efi and netboot-ramdisk never noticed because they only ever touch
the raw EFI_SIMPLE_NETWORK_PROTOCOL via our own net.c, which has no such
dependency. A test that needs EDK II's own NetworkPkg (e.g. one exercising
EFI_HTTP_PROTOCOL) is the first to be affected.
RngDxe can satisfy the DEPEX from the RDRAND instruction alone on a
sufficiently recent edk2 build, but not every installed OVMF is that
recent. -device virtio-rng-pci provides an RNG unconditionally via
VirtioRngDxe, regardless of edk2 vintage or host CPU features.
Unfortunately, the edk2 shipped with qemu lacks the network this needs.
[2 lines not shown]
boot-test.sh: Add a http server per interface
Add the built-in python http server, bound to each of the interaces we
create to expand network testing to include http:// in various
scenarios.
Sponsored by: Netflix
linux: Exposes renderD nodes and chardev in sysfs
To allow normal users to render through the render device, we expose the
renderD node. This enables Wayland applications to use hardware
acceleration when running under the Linux emulator.
Additionally, libdrm and Mesa need to look up
/sys/dev/char/<major>:<minor> and <pcidev>/drm to identify the
corresponding renderer device (e.g., a renderD device). We expose this
path as well so that libdrm can locate the renderer.
Differential Revision: https://reviews.freebsd.org/D59190
fsck_msdosfs: fix head bitmap over-allocation on 32-bit platforms
bitmap_ctor() computed the allocation size as
roundup2(bits, LONG_BIT) / (LONG_BIT / 8)
The dividend is a count of bits, so converting it to bytes requires
dividing by 8 (bits per byte), not by LONG_BIT / 8 (bytes per long).
The two divisors happen to coincide on LP64, but on ILP32 platforms
the head bitmap was allocated at twice the required size; for a
FAT32 file system with close to 2^28 clusters, that is 64 MiB instead
of 32 MiB.
The extra half of the allocation was never accessed, so there is no
functional change other than the reduced memory footprint.
MFC after: 3 days
Pull Request: https://github.com/freebsd/freebsd-src/pull/2440
ihwpstate_intel: update dev.hwpstate_intel.%d.epp sysctl description
Catch up with 8452afeb568: now dev.hwpstate_intel.%d.epp accepts
values from 0 to 255. Update its description accordingly to sync
with the code and the man page.
nvme: collapse the per-counter qpair statistic sysctl handlers
A single handler that takes the counter's offset
within struct nvme_qpair in arg2.
No functional change
Reviewed by: imp, adrian
Differential Revision: https://reviews.freebsd.org/D60020
nvmf: factor out the pending request abort loop
The routine is entered with the namespace lock held and drops it before
completing the requests, which preserves the existing locking.
Reviewed by: imp, adrian
Differential Revision: https://reviews.freebsd.org/D60019
nvme: share one handler between the interrupt coalescing sysctls
The int_coal_time and int_coal_threshold handlers differed only in which
controller field they updated before reprogramming the feature.
Reviewed by: imp, adrian
Differential Revision: https://reviews.freebsd.org/D60018
sysvshm: Fix locking in shm_prison_set()
We were not acquiring the global sysvshm lock when handling cleanup of
sysvshm segments. Acquire the lock in shm_prison_cleanup() instead, to
be consistent with the sysv semaphore code.
Reviewed by: jamie
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D60030
zonectl: Consistently report ZAC conv. zones WP LBA
On ZAC drives, conventional zones conventionally report a write pointer
LBA of 0xffffffffffff. This field is 48 bits wide, unlike ZBC's 64 bits.
Recognize both ZAC and ZBC all-ones behaviour in the WRITE POINTER LBA
field to indicate non-valid information.
Tested by: fuz
Discussed with: fuz, asomers, ken
Fixes: 4735ef6196bc ("zonectl: display conventional zones better")
MFC after: 2 weeks
Sponsored by: Google Summer Of Code 2026
Reviewed by: asomers
Pull Request: https://github.com/freebsd/freebsd-src/pull/2345
(cherry picked from commit 95a4412e3a4d41b430f298ea2c2a51f8aa119c2c)
Increase the default mlock limit from 64k to 256k
The current default has been unchanged for 14 years. Increase it to
keep pace with modern hardware and software. security/pinentry-gnome,
in particular, can sometimes need 112 kB.
PR: 297452
MFC after: 2 weeks
Sponsored by: ConnectWise
Reviewed by: cye, emaste
Differential Revision: https://reviews.freebsd.org/D58811
(cherry picked from commit d9cf2a8671841e4415a22e16005d7700f0eb9b7e)
zonectl: display conventional zones better during RZ
zonectl's Report Zones subcommand displays a tabular list of zones. A
conventional zone's WP column is displayed as 0xffffffffffffffff , the
literal value that the HDD reports. But that's too wide for the column,
causing the text to be misaligned. It's also not really meaningful,
because the Write Pointer isn't really defined for a Conventional zone.
Change it to "-1" to fix the text misalignment.
MFC after: 2 weeks
Sponsored by: ConnectWise
Reviewed by: fuz
Differential Revision: https://reviews.freebsd.org/D57512
(cherry picked from commit 4735ef6196bcb2802ad7fc7d1b8054a4756d786b)
fusefs: fix vnode locking violations during execve
Fix two locking violations that could happen during execve, while
executing a file stored on fusefs. Both would cause panics on an
INVARIANTS kernel after 15.0, or a DEBUG_VFS_LOCKS kernel prior to that.
Neither is likely to be noticeable on a release kernel.
* Don't assume that the vnode is exclusively locked during VOP_CLOSE.
It usually is thanks to !MNTK_LOOKUP_SHARED, but isn't during execve,
which locks the vnode outside of the lookup path.
* Totally rewrite fuse_io_invalbuf. It's had a number of problems ever
since its original introduction[^1]:
- Don't assume that the vnode is exclusively locked. That assumption
failed during execve just like the assumption in fuse_vnop_close.
- Don't livelock forever if vinvalbuf returns ENOSPC or EDQUOT.
[21 lines not shown]
compat/linux: Fix IFLA_IFNAME translation for multi-message netlink
nlmsg_translate_ifname_nla() always used nw->ifp for the name,
which is fine for a single-message ifnet event, but an RTM_GETLINK
dump holds one RTM_NEWLINK per interface and is translated with
the ifp the writer had when the buffer was flushed.
The root of the problem is that msgs_to_linux() takes a single
ifp for a buffer that may contain messages about many interfaces.
Use ifi_index to resolve the name instead.
Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D59595
ipfilter: fix inverted range check on the lookup iterator unit
ipf_lookup_iterate() validates iter.ili_unit with
if (iter.ili_unit < IPL_LOGALL && iter.ili_unit > IPL_LOGMAX)
or alternatively,
if (iter.ili_unit < -1 && iter.ili_unit > 7)
ipf_lookup_add(), ipf_lookup_delete(), ipf_lookup_stats()
ipf_lookup_flush() validate with a ||
Submitted by calif.io for the OpenAI Patch The Planet program
Signed-off-by: Andrew Griffiths <andrew at calif.io>
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D59726
kasan: Fix the annotation for shadow map checks in atomic_load_*
atomic_load_* is a read, not a write. Otherwise KASAN will report a
use-after-free via atomic_load_* as a write rather than a read.
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
imgact_aout: Remove a prototype for a non-existent function
aout_coredump() was removed in commit 1eecfae3e53cb3.
No functional change intended.
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
jail: Simplify refcount manipulation routines
- refcount_acquire() returns the old value, use that to assert that the
old value was non-zero.
- refcount_release() already asserts that the refcount value is
non-zero, so don't bother asserting that again in the jail code.
- Use __diagused instead of having separate implementations for
INVARIANTS and !INVARIANTS.
No functional change intended.
Reviewed by: jamie
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D59983