HardenedBSD/src 7303301contrib/file aclocal.m4 configure, contrib/file/magic/Magdir atari

Merge remote-tracking branch 'rad/hardened/15-stable/main' into hardened/15-stable/pledge
DeltaFile
+419-140contrib/file/configure
+297-130contrib/file/aclocal.m4
+261-0sbin/fsck_msdosfs/tests/fsck_msdosfs_test.sh
+241-0sbin/fsck_msdosfs/tests/fsck_msdosfs_large_test.sh
+233-0contrib/file/magic/Magdir/atari
+214-0sbin/fsck_msdosfs/tests/fsck_msdosfs_boot_test.sh
+1,665-27091 files not shown
+3,662-95197 files

HardenedBSD/src 5e6a66ccontrib/file aclocal.m4 configure, contrib/file/magic/Magdir atari

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+419-140contrib/file/configure
+297-130contrib/file/aclocal.m4
+261-0sbin/fsck_msdosfs/tests/fsck_msdosfs_test.sh
+241-0sbin/fsck_msdosfs/tests/fsck_msdosfs_large_test.sh
+233-0contrib/file/magic/Magdir/atari
+214-0sbin/fsck_msdosfs/tests/fsck_msdosfs_boot_test.sh
+1,665-27091 files not shown
+3,662-95197 files

HardenedBSD/src 6c2e549sys/dev/acpica acpi_pci.c

acpi_pci: Honor device proximity for DMA tags

A PCI function with its own _PXM still inherits a DMA tag carrying
the upstream bridge's proximity domain. Resolving an SR-IOV VF's
locality through its PF therefore does not affect the domain used for
DMA allocations.

Create and cache a private child tag when the function, or a VF's
owning PF, has an explicit _PXM. Parent it to the existing PCI or IOMMU
tag so its constraints remain intact, then apply the function's domain
without mutating a shared tag.

pci_get_dma_tag() already performs the IOMMU lookup, so remove the
duplicated lookup in the ACPI subclass while here.

Reviewed by:    jhb
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D59063

(cherry picked from commit f1f58bdf7b5fc58e6011c6ac2ae2ba129dc41991)
DeltaFile
+36-20sys/dev/acpica/acpi_pci.c
+36-201 files

HardenedBSD/src 13e7b03sys/dev/acpica acpivar.h acpi.c

acpi_pci: Cache PCI proximity domains

A PCI function's _PXM is stable for the lifetime of its device
instance, but CPU and DMA locality queries may evaluate it repeatedly.
SR-IOV amplifies this because every VF resolves locality through the
same PF.

Cache successful mappings and the stable absence of _PXM on the
locality source device, and share that result between CPU and domain
queries. Continue to retry generic evaluation or mapping errors rather
than making a potentially transient failure permanent.

Reviewed by:    jhb
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D59207

(cherry picked from commit 5f78d024695b39208a6c92f6a96017bae53cdf2c)
DeltaFile
+32-5sys/dev/acpica/acpi_pci.c
+15-7sys/dev/acpica/acpi.c
+3-0sys/dev/acpica/acpivar.h
+50-123 files

HardenedBSD/src cac7fabsys/dev/acpica acpi_pci.c

acpi_pci: Preserve CPU locality queries for descendants

bus_generic_get_cpus() preserves the original leaf device while
forwarding a request through the bus hierarchy. Consequently,
acpi_pci_get_cpus() may receive a descendant below a PCI function
rather than one of the PCI bus's direct children.

Only apply the SR-IOV PF-locality mapping to direct PCI children.
Preserve the previous ACPI CPU-locality lookup for descendants so their
unrelated bus ivars are not interpreted as PCI device information.

Reviewed by:    jhb
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D59206

(cherry picked from commit dc4f80da18f0dcc557a969b4283a86569266eb5c)
DeltaFile
+3-0sys/dev/acpica/acpi_pci.c
+3-01 files

HardenedBSD/src 2dac650sys/dev/acpica acpi_pci.c

acpi_pci: Inherit PF locality for SR-IOV VFs

SR-IOV VFs are instantiated from their PF and intentionally do not
receive an ACPI handle by matching their runtime BDF.  Consequently,
ACPI locality queries for a VF fall back to the upstream bus.  This is
usually sufficient, but loses a _PXM supplied specifically for the PF.

Use the PCI core's owning-PF accessor for BUS_GET_DOMAIN and
BUS_GET_CPUS requests made for a VF.  This preserves the VF's lack of
an ACPI handle while allowing its CPU and NUMA placement to follow the
PF.

Reviewed by:    jhb
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D59062

(cherry picked from commit 1a2a88684a0126be8d7172362d5ec7dbb7a41c81)
DeltaFile
+24-1sys/dev/acpica/acpi_pci.c
+24-11 files

HardenedBSD/src 9b348b1sys/dev/acpica acpi_pci.c

acpi_pci: Do not match SR-IOV VFs to ACPI devices

SR-IOV VFs are instantiated dynamically from their PF rather than
enumerated from ACPI.  A VF's runtime slot and function can match an
unrelated _ADR below the bridge.  acpi_pci_save_handle() stores that
handle in the VF's devinfo before acpi_pci_update_device() runs.

If the handle is already bound to another device_t whose parent is not
acpi0, acpi_pci_update_device() panics under INVARIANTS.  Without
INVARIANTS, the VF retains the unrelated handle, so subsequent ACPI
lookups, including NUMA and power-management operations, can act on the
wrong namespace node.

Skip ACPI namespace matching for VFs.

Reviewed by:    jhb
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D59061

(cherry picked from commit 8b74806161a188103666387013cdd93fb3f5dc07)
DeltaFile
+12-0sys/dev/acpica/acpi_pci.c
+12-01 files

HardenedBSD/src 37ba8a2sbin/fsck_msdosfs boot.c

MFC: fsck_msdosfs: avoid signed integer overflow in readboot()

(cherry picked from commit 18094609d301540526d3d57e92705bc989d29986)
DeltaFile
+7-14sbin/fsck_msdosfs/boot.c
+7-141 files

HardenedBSD/src 33bba26sbin/fsck_msdosfs fat.c

MFC: fsck_msdosfs: fix status accounting for lost cluster chains

(cherry picked from commit 6cf0d6c3b5777e053074200ff99dc4b750e62b96)
DeltaFile
+32-9sbin/fsck_msdosfs/fat.c
+32-91 files

HardenedBSD/src d3f8718sbin/fsck_msdosfs dir.c

MFC: fsck_msdosfs: fix 32-bit overflow computing the LOST.DIR offset

(cherry picked from commit d3c5464fee7b178a39c189363e48806a11fd3da4)
DeltaFile
+2-2sbin/fsck_msdosfs/dir.c
+2-21 files

HardenedBSD/src c2e12dbsbin/fsck_msdosfs ext.h fat.c

MFC: fsck_msdosfs: fix memory leaks in checkfilesys()

(cherry picked from commit 6d49b0c0e7b8b77d8043593356e712307e894743)
DeltaFile
+4-1sbin/fsck_msdosfs/check.c
+1-1sbin/fsck_msdosfs/fat.c
+1-0sbin/fsck_msdosfs/ext.h
+6-23 files

HardenedBSD/src fb2c070sbin/fsck_msdosfs/tests Makefile fsck_msdosfs_large_test.sh

MFC: fsck_msdosfs: add a test for reconnecting on volumes larger than 4 GiB

MFC after:      1 week

(cherry picked from commit 37aec55d0a7165960f686e5277f030ab3d44cf45)
DeltaFile
+241-0sbin/fsck_msdosfs/tests/fsck_msdosfs_large_test.sh
+2-1sbin/fsck_msdosfs/tests/Makefile
+243-12 files

HardenedBSD/src 99af5f3sbin/fsck_msdosfs/tests Makefile fsck_msdosfs_boot_test.sh

MFC: fsck_msdosfs: add tests for the 32-bit boot block field decoding

(cherry picked from commit c4f458da4411872df4968e02ca292389df462b7b)
DeltaFile
+214-0sbin/fsck_msdosfs/tests/fsck_msdosfs_boot_test.sh
+2-1sbin/fsck_msdosfs/tests/Makefile
+216-12 files

HardenedBSD/src 5693123etc/mtree BSD.tests.dist, sbin/fsck_msdosfs Makefile

MFC: fsck_msdosfs: add tests for lost cluster chain repair accounting

(cherry picked from commit bbaf254293f7e19fa7b0f9ed1da21c7a43126d79)
DeltaFile
+261-0sbin/fsck_msdosfs/tests/fsck_msdosfs_test.sh
+5-0sbin/fsck_msdosfs/Makefile
+5-0sbin/fsck_msdosfs/tests/Makefile
+2-0etc/mtree/BSD.tests.dist
+273-04 files

HardenedBSD/src 1922ceflib/libmagic Makefile

MFC: libmagic: Add swap.c and magic.h to SRCS.

(cherry picked from commit 8929675e11c0c64ff96a2441082794980c9c6b2e)
DeltaFile
+4-2lib/libmagic/Makefile
+4-21 files

HardenedBSD/src 811f6b4contrib/file aclocal.m4 configure, contrib/file/magic/Magdir atari

MFC: MFV: file 5.48

(cherry picked from commit 7af41682a96bf7058b82665c33bb9b1bfa079c17)
DeltaFile
+419-140contrib/file/configure
+297-130contrib/file/aclocal.m4
+233-0contrib/file/magic/Magdir/atari
+115-77contrib/file/src/softmagic.c
+178-0contrib/file/src/landlock.c
+51-113contrib/file/src/apprentice.c
+1,293-46076 files not shown
+2,759-89282 files

HardenedBSD/src 1725e7blib/libjail jail.c, sys/compat/linuxkpi/common/include/linux pci.h util_macros.h

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+25-6lib/libjail/jail.c
+27-0sys/compat/linuxkpi/common/src/linux_pci.c
+26-0sys/compat/linuxkpi/common/include/linux/cleanup.h
+18-0sys/compat/linuxkpi/common/include/linux/util_macros.h
+4-1usr.sbin/jail/tests/jail_basic_test.sh
+5-0sys/compat/linuxkpi/common/include/linux/pci.h
+105-75 files not shown
+114-911 files

HardenedBSD/src 2885133lib/libjail jail.c, sys/compat/linuxkpi/common/include/linux pci.h util_macros.h

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+25-6lib/libjail/jail.c
+27-0sys/compat/linuxkpi/common/src/linux_pci.c
+26-0sys/compat/linuxkpi/common/include/linux/cleanup.h
+18-0sys/compat/linuxkpi/common/include/linux/util_macros.h
+4-1usr.sbin/jail/tests/jail_basic_test.sh
+5-0sys/compat/linuxkpi/common/include/linux/pci.h
+105-75 files not shown
+114-911 files

HardenedBSD/src b2a270dlib/libjail jail.c, usr.sbin/jail/tests jail_basic_test.sh

libjail: fix fetching mac.label for multiple jails

When doing a basic `jls -n`, jls(8) will jailparam_get() the mac.label
for every jail on the system using the same set of jailparams, and thus
the same jp_value.  We only init the mac_t the first time, so the first
jail would populate it with `?` from /etc/mac.conf and the resulting
jail_get(2) would clobber it with the empty string, then a second jail
would try to pass the empty string to the kernel and fail because it
must have a non-zero length.

Fix it by invoking jps_get() every time.  Drop some comments to note
that jps_get() will be invoked with zero || garbage from previous call,
and be sure that we don't leak our previous mac_t.  There aren't any
other jps_get implementations at this time, so this shouldn't cause any
unexpected problems.

Reported by:    ivy
Reviewed by:    jamie
Differential Revision:  https://reviews.freebsd.org/D57280
DeltaFile
+25-6lib/libjail/jail.c
+4-1usr.sbin/jail/tests/jail_basic_test.sh
+29-72 files

HardenedBSD/src 33595d4sys/compat/linuxkpi/common/include/linux pci.h, sys/compat/linuxkpi/common/src linux_pci.c

linuxkpi: Add `pci_map_rom()` and `pci_unmap_rom()`

They were already defined as macros in various places in DRM drivers,
aliasing the `vga_pci_map_bios()` and `vga_pci_unmap_bios()` functions.
Let's move them to linuxkpi and avoid copies everywhere.

Because they use the `vga_pci` code internally, `pci_map_rom()` checks
whether the given device is a video card. If it is not, it logs a "TODO"
and returns NULL.

Reviewed by:    bz
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57573
DeltaFile
+27-0sys/compat/linuxkpi/common/src/linux_pci.c
+5-0sys/compat/linuxkpi/common/include/linux/pci.h
+32-02 files

HardenedBSD/src f2a2e02sys/compat/linuxkpi/common/include/linux file.h cleanup.h

linuxkpi: Define `DEFINE_CLASS()` and `CLASS()`

`DEFINE_CLASS()` is in fact named `LINUXKPI_DEFINE_CLASS()` because it
conflicts with `DEFINE_CLASS()` defined in <sys/kobj.h>.

This macro defines a type and a pair of constructor/destructor
functions.

They are to be used by `CLASS()`: this one declares a variable,
initialise it with the constructor and set the `__cleanup()` attribute
to call the destructor once the variable goes out of scope.

The DRM drivers generic code started to use `CLASS()` in Linux 6.13. It
requires the `fd` class to be defined in <linux/file.h>.

Reviewed by:    bz
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57583
DeltaFile
+26-0sys/compat/linuxkpi/common/include/linux/cleanup.h
+2-0sys/compat/linuxkpi/common/include/linux/file.h
+28-02 files

HardenedBSD/src fc0a5aesys/compat/linuxkpi/common/include/linux device.h

linuxkpi: Add device under parent, not under class

In `device_add()`, the function used to add the given device under its
class. This is used to build a sysctl tree. We ended up with devices or
"pseudo" devices (like the output connectors of a GPU). For example with
an output connector:

    sysctl sys.class.drm.card0-DP-1

This device should be added under its parent if it has one. With this
fix, the same output connector is now:

    sysctl sys.device.drmn1.card0.card0-DP-1

Reviewed by:    bz
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55175
DeltaFile
+4-1sys/compat/linuxkpi/common/include/linux/device.h
+4-11 files

HardenedBSD/src b8b2be5sys/compat/linuxkpi/common/include/linux jiffies.h

LinuxKPI: Added jiffies64_to_msecs for amdkfd compatibility

jiffies64_to_msecs is used by kfd_process.c in the amd/amdkfd driver
from Linux kernel 6.12.

Submitted by:   Sourojeet Adhikari
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58075
DeltaFile
+1-0sys/compat/linuxkpi/common/include/linux/jiffies.h
+1-01 files

HardenedBSD/src 75b9d19sys/compat/linuxkpi/common/include/linux util_macros.h

linuxkpi: Define `for_each_if()`

This macro was moved from <drm/drm_util.h> to <linux/util_macros.h> in
Linux 6.15.

Submitted by:   Sourojeet Adhikari
Approved by:    adrian, bz, emaste, seuros
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57465
DeltaFile
+18-0sys/compat/linuxkpi/common/include/linux/util_macros.h
+18-01 files

HardenedBSD/src 3716da9sys/compat/linuxkpi/common/include/linux sched.h, sys/sys param.h

LinuxKPI: Add tgid to task_struct under sched.h

The amdkfd driver requires the `tgid` to be a part of the `task_struct`.
This patch introduces the `tgid` member to `task_struct`.

Reviewed by:    bz
Sponsored By:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58228
DeltaFile
+1-1sys/sys/param.h
+1-0sys/compat/linuxkpi/common/include/linux/sched.h
+2-12 files

HardenedBSD/src ca1b2d6lib/libpmc libpmc.c pmc.perf.3, sys/arm64/acpica acpi_iort.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+360-0sys/dev/hwpmc/hwpmc_perf.c
+129-15sys/arm64/acpica/acpi_iort.c
+132-0lib/libpmc/pmc.perf.3
+57-52sys/arm64/include/armreg.h
+22-22sys/arm64/arm64/identcpu.c
+31-0lib/libpmc/libpmc.c
+731-8930 files not shown
+889-13836 files

HardenedBSD/src 74a7968release/tools vmimage.subr, sys/netpfil/pf pf_lb.c pf.c

Merge remote-tracking branch 'rad/hardened/15-stable/main' into hardened/15-stable/pledge
DeltaFile
+15-10sys/netpfil/pf/pf.c
+9-5usr.sbin/syslogd/syslogd.c
+10-1sys/netpfil/pf/pf_lb.c
+7-0usr.sbin/syslogd/tests/syslogd_test.sh
+1-1release/tools/vmimage.subr
+42-175 files

HardenedBSD/src 54d67b6lib/libpmc libpmc.c pmc.perf.3, sys/arm64/acpica acpi_iort.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+360-0sys/dev/hwpmc/hwpmc_perf.c
+129-15sys/arm64/acpica/acpi_iort.c
+132-0lib/libpmc/pmc.perf.3
+57-52sys/arm64/include/armreg.h
+22-22sys/arm64/arm64/identcpu.c
+31-0lib/libpmc/libpmc.c
+731-8930 files not shown
+889-13836 files

HardenedBSD/src b31db8dsbin/ipfw ipfw.8

ipfw.8: more grammar fixes
DeltaFile
+3-3sbin/ipfw/ipfw.8
+3-31 files

HardenedBSD/src b891252sbin/ipfw ipfw.8

ipfw.8: whitespace police
DeltaFile
+1-1sbin/ipfw/ipfw.8
+1-11 files