DragonFlyBSD/src dbfba94sys/kern subr_alist.c subr_blist.c

kernel - Fix overflow in alist and blist code

* This code tracks swap space and large blocks of contiguous DMA memory.

* Fix overflows in array size calculations that did not take into
  account terminator entries.

  (a) Remove terminals from alists entirely.
  (b) Account for space used by the terminator in blists.

Found-by: tuxillo / AI
DeltaFile
+61-20sys/kern/subr_alist.c
+7-2sys/kern/subr_blist.c
+68-222 files

DragonFlyBSD/src 0258b0fsys/kern kern_shutdown.c

kernel - Fix serious root vulnerabilities in the caps code (2)

* Remove debugging kprintf() in sys_reboot()
DeltaFile
+0-2sys/kern/kern_shutdown.c
+0-21 files

DragonFlyBSD/src 35a77c5sys/kern kern_caps.c vfs_syscalls.c, sys/sys caps.h

kernel - Fix serious root vulnerabilities in the caps code

* The caps code was inadvertently allowing many root-only operations
  to be run from user mode, particularly mount/umount ops by assuming
  a root creds check that was not taking place in some of the API
  calls, but was taking place in others.

* All API calls now check root creds by default unless passed the
  appropriate flag.

Found-by: ivadasz (Imre Vadasz)
DeltaFile
+8-8sys/kern/kern_caps.c
+10-2sys/kern/vfs_syscalls.c
+4-4sys/kern/kern_exec.c
+4-2sys/sys/caps.h
+3-1sys/kern/kern_shutdown.c
+1-1sys/kern/kern_sig.c
+30-186 files

DragonFlyBSD/src 7bffb93sys/kern subr_alist.c subr_blist.c

kernel - Fix overflow in alist and blist code

* This code tracks swap space and large blocks of contiguous DMA memory.

* Fix overflows in array size calculations that did not take into
  account terminator entries.

  (a) Remove terminals from alists entirely.
  (b) Account for space used by the terminator in blists.

Found-by: tuxillo / AI
DeltaFile
+61-20sys/kern/subr_alist.c
+7-2sys/kern/subr_blist.c
+68-222 files

DragonFlyBSD/src 7c543eflib/libnvmm libnvmm.c

libnvmm(3): Fix nvmm_vcpu_create() to check malloc() error
DeltaFile
+7-2lib/libnvmm/libnvmm.c
+7-21 files

DragonFlyBSD/src 5d6e3acusr.bin/netstat route.c

netstat(1): Use same width for 'Netif' column in IPv4/IPv6 cases

This utility used a narrower 'Netif' column for IPv4 than IPv6, which
looks a bit strange and is actually insufficient nowadays, since we
supports to customize the interface name.  So just use the same column
width for both IPv4 and IPv6.
DeltaFile
+1-2usr.bin/netstat/route.c
+1-21 files

DragonFlyBSD/src 1349ae1share/misc pci_vendors

Update the pciconf(8) database.

May 23, 2023 snapshot from https://pci-ids.ucw.cz
DeltaFile
+151-10share/misc/pci_vendors
+151-101 files

DragonFlyBSD/src 356be0fshare/misc pci_vendors

Update the pciconf(8) database.

April 10, 2023 snapshot from https://pci-ids.ucw.cz
DeltaFile
+341-416share/misc/pci_vendors
+341-4161 files

DragonFlyBSD/src 11f3fb1share/misc pci_vendors

Update the pciconf(8) database.

February 23, 2023 snapshot from https://pci-ids.ucw.cz
DeltaFile
+917-142share/misc/pci_vendors
+917-1421 files

DragonFlyBSD/src 3eebf54contrib/gcc-8.0/libstdc++-v3/config/locale/dragonfly codecvt_members.cc

libstdc++: Fix unsigned wraparound in codecvt::do_length [PR105857]

When the max argument to std::codecvt<wchar_t, char, mbstate_t>::length
is SIZE_MAX/4+1 or greater the multiplication with sizeof(wchar_t) will
wrap to a small value, and the alloca call will have a buffer that's
smaller than requested. The call to mbsnrtowcs then has a buffer that is
smaller than the value passed as the buffer length. When libstdc++.so is
built with -D_FORTIFY_SOURCE=3 the mismatched buffer and length will get
detected and will abort inside Glibc.

When it doesn't abort, there's no buffer overflow because Glibc's
mbsnrtowcs has the same len * sizeof(wchar_t) calculation to determine
the size of the buffer in bytes, and that will wrap to the same small
number as the alloca argument. So luckily Glibc agrees with the caller
about the real size of the buffer, and won't overflow it.

Even when the max argument isn't large enough to wrap, it can still be
much too large to safely pass to alloca, so we should limit that. We
already have a loop that processes chunks so that we can handle null

    [4 lines not shown]
DeltaFile
+6-3contrib/gcc-8.0/libstdc++-v3/config/locale/dragonfly/codecvt_members.cc
+6-31 files

DragonFlyBSD/src d1ed712lib/libnvmm libnvmm.3

libnvmm.3: Fix one .Nx (NetBSD) to .Dx (DragonFly)
DeltaFile
+1-1lib/libnvmm/libnvmm.3
+1-11 files

DragonFlyBSD/src 2779004sys/dev/virtual/nvmm/x86 nvmm_x86_vmx.c nvmm_x86.c

nvmm(4): Expose ARCH_CAP to guest only if the host CPU supports it

* Don't expose ARCH_CAP to guest on AMD CPUs, because the ARCH_CAP
  feature bit and the IA32_ARCH_CAPABILITIES MSR are Intel-specific and
  unavailable on AMD systems.  I decided to not follow Linux KVM, which
  chose to always provide ARCH_CAP and emulate the MSR for AMD CPUs.

* Check whether the host CPU supports the ARCH_CAP feature bit and only
  expose it to the guest if the host supports it.

Credit to tuxillo and Claude Opus LLM for the analyses and initial
patches.
DeltaFile
+14-7sys/dev/virtual/nvmm/x86/nvmm_x86_vmx.c
+2-2sys/dev/virtual/nvmm/x86/nvmm_x86.c
+16-92 files

DragonFlyBSD/src 6582506sys/cpu/x86_64/include cpufunc.h

cpu/x86_64: Fix do_cpuid() to explicitly set ECX=0

The old do_cpuid() did not initialize ECX before executing the CPUID
instruction, so the results could be incorrect when ECX contained a
non-zero garbage value.

This issue was observed on Intel CPUs when booting a FreeBSD 14.x/15.x
ISO under NVMM, where it caused a general protection fault (#GP) shortly
after the FreeBSD kernel was loaded:

    qemu-system-x86_64: NVMM: Mem Assist Failed [gpa=0xbfff8]
    qemu-system-x86_64: NVMM: Failed to execute a VCPU.
    Abort trap (core dumped)

It occurred when NVMM tried to handle the reading of
IA32_ARCH_CAPABILITIES MSR but the second do_cpuid() returned the
incorrect results indicating that the MSR was unavailable.

The problem was first reported by mneumann in bug #3310 on 2025-11-26 [1].

    [11 lines not shown]
DeltaFile
+6-8sys/cpu/x86_64/include/cpufunc.h
+6-81 files

DragonFlyBSD/src da6ab61sys/kern kern_proc.c

KERN_PROC - Fix KERN_PROC_ARGS and KERN_PROC_CWD to return length if oldptr==NULL.

Sysctl handlers still have to compute the full output, even when
oldptr == NULL. This is necessary to implement the behavior documented in
sysctl(3), that it will return the required buffer length in "oldlenp", if
"oldptr" is NULL and "oldlenp" is not NULL.
DeltaFile
+46-48sys/kern/kern_proc.c
+46-481 files

DragonFlyBSD/src 5ff5cabsys/vfs/procfs procfs_status.c procfs_fpregs.c

procfs - Don't reset fd offset when reading regs, fpregs, or dbregs files.

* For repeated reads, we can simply use pread(2). And this way, we allow for
  normal shell tooling to work correctly on these procfs files.

* This also matches the behavior on NetBSD.
DeltaFile
+1-1sys/vfs/procfs/procfs_status.c
+0-1sys/vfs/procfs/procfs_fpregs.c
+0-1sys/vfs/procfs/procfs_dbregs.c
+0-1sys/vfs/procfs/procfs_regs.c
+1-44 files

DragonFlyBSD/src 936af95sys/netproto/802_11/wlan ieee80211_ratectl_none.c

wlan - Remove NULL free in fallback "none" ratectl code.

This avoids a kernel panic when detaching a wlan interface that was created
with the "none" ratectl code (i.e. when the wlan_amrr module wasn't loaded).
DeltaFile
+0-1sys/netproto/802_11/wlan/ieee80211_ratectl_none.c
+0-11 files

DragonFlyBSD/src fb5a27esys/dev/virtual/virtio/block virtio_blk.c

virtio_blk - Compare old/write-cache setting in vtblk_write_cache_sysctl.
DeltaFile
+5-2sys/dev/virtual/virtio/block/virtio_blk.c
+5-21 files

DragonFlyBSD/src 9c8c875sys/dev/virtual/virtio/block virtio_blk.c

virtio_blk - Move sysctl setup to the end of attachement.
DeltaFile
+1-2sys/dev/virtual/virtio/block/virtio_blk.c
+1-21 files

DragonFlyBSD/src 5a21ee5sys/dev/disk/mmcsd mmcsd.c, sys/dev/virtual/virtio/block virtio_blk.c

kernel - Do readonly check in .d_open method in mmcsd(4) and virtio_blk(4).

* Makes read-write open fail properly for read-only storage in mmcsd(4) and
  virtio_blk(4), instead of only resulting in transfer errors for the
  disk writes.
DeltaFile
+3-13sys/dev/virtual/virtio/block/virtio_blk.c
+6-8sys/dev/disk/mmcsd/mmcsd.c
+9-212 files

DragonFlyBSD/src 3257e7fsys/dev/virtual/virtio/block virtio_blk.c

virtio_blk - Enable D_KVABIO API.

This should avoid some unnecessary page invalidations.
This driver already was compliant, since it never accesses any of the data
in the bio buffer.
DeltaFile
+5-1sys/dev/virtual/virtio/block/virtio_blk.c
+5-11 files

DragonFlyBSD/src f22291fsys/vfs/isofs/cd9660 cd9660_node.c

cd9660 - Fixup typo from fb62a9282b1, to apply *upper* limit to hash table size.
DeltaFile
+1-1sys/vfs/isofs/cd9660/cd9660_node.c
+1-11 files

DragonFlyBSD/src f738352sys/kern sys_pipe.c

kern: pipe2() should return EINVAL on invalid flags
DeltaFile
+2-0sys/kern/sys_pipe.c
+2-01 files

DragonFlyBSD/src 418fae5sbin/fdisk fdisk.c

fdisk(8): Support 4096 sector size and recognize pMBR of 4Kn disks

Tweak the fdisk(8) utility to support 4096-byte sector size, so it now
can read the pMBR on GPT-formatted 4Kn (aka 4K native) disks, e.g.,

     # fdisk -s vbd0
     /dev/vbd0: 14628 cyl 16 hd 56 sec
     Part        Start        Size Type Flags
        1:           1    13107199 0xee 0x00

In addition, tweak read_disk() to report the read error message.
DeltaFile
+12-7sbin/fdisk/fdisk.c
+12-71 files

DragonFlyBSD/src 2989840etc/rc.d root

rc.d/root: Add 'nojail' keyword to fix jail boot

A jail cannot remount the root filesystem so it was failing to boot
because of error:

        Mounting root filesystem rw failed; startup aborted.

Add the 'nojail' keyword to exclude this rc script in jail boot.
FreeBSD also has this keyword for this script for 20+ years.

With this fix, a jail boots OK but there are still some errors during
the boot, so there are more rc scripts that need the 'nojail' keyword
or need tweaks for jail.  Will look into this later.

Reported-by: fgudin (Francis GUDIN) on IRC
DeltaFile
+1-0etc/rc.d/root
+1-01 files

DragonFlyBSD/src 4ca327fsys/dev/sound/pci/hda hdac.h hdacc.c

hda defines, hdac devices, hdacc codecs updated from FreeBSD 14.2.
DeltaFile
+285-5sys/dev/sound/pci/hda/hdac.h
+81-0sys/dev/sound/pci/hda/hdacc.c
+54-10sys/dev/sound/pci/hda/hdac.c
+420-153 files

DragonFlyBSD/src 0ef60d5sys/vfs/isofs/cd9660 cd9660_node.c

cd9660: Explicitly treat the timezone byte as a signed value

Otherwise, timezone information for time zones west of GMT gets
discarded.

Obtained-from: FreeBSD (PR kern/128934, commit 5c423e0640bcad0eb90d9c968658347228bc2818)
DeltaFile
+1-1sys/vfs/isofs/cd9660/cd9660_node.c
+1-11 files

DragonFlyBSD/src e7cfc88sys/vfs/isofs/cd9660 cd9660_rrip.c

cd9660: Fix ISO_SUSP_CFLAG_ROOT handling in RockRidge

When encountering a ISO_SUSP_CFLAG_ROOT element in Rock Ridge processing,
this actually means there's a double slash recorded in the symbolic
link's path name.  We used to start over from / then, which caused link
targets like "../../bsdi.1.0/include//pathnames.h" to be interpreted as
/pathnahes.h.  This is both contradictionary to our conventional slash
interpretation, as well as potentially dangerous.

The right thing to do is (obviously) to just ignore that element.

Obtained-from: FreeBSD (commit f7d5a5328faa1cb0b6ad60860e8f46d748507c88)
DeltaFile
+2-4sys/vfs/isofs/cd9660/cd9660_rrip.c
+2-41 files

DragonFlyBSD/src f61043fsbin/route route.c

route(8): Fix routename() for AF_LINK addresses with sdl_index

The link_ntoa() function is able to handle such link addresses with zero
lengths but only 'sdl_index', so route(8) would print an empty string
for some RTA_GATEWAY and RTA_IFP sockaddrs in the monitor output.

Fix routename() to correctly print such addresses by copying the code
from netstat(1).
DeltaFile
+23-1sbin/route/route.c
+23-11 files

DragonFlyBSD/src 185f667sys/dev/disk/ahci ahci.c atascsi.h

ahci - Clean up after 602b3a38e000, fix link_pwr_state output.
DeltaFile
+10-10sys/dev/disk/ahci/ahci.c
+2-2sys/dev/disk/ahci/atascsi.h
+12-122 files

DragonFlyBSD/src 7d57c05lib/libnvmm nvmm.h

libnvmm(3): Wrap long line for one prototype in <nvmm.h>
DeltaFile
+2-2lib/libnvmm/nvmm.h
+2-21 files