HardenedBSD/src 6e87223lib/libutil trimdomain.c trimdomain.3, lib/libutil/tests trimdomain_test.c

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+23-1lib/libutil/trimdomain.c
+4-4lib/libutil/trimdomain.3
+4-1lib/libutil/Symbol.map
+2-2sys/dev/acpica/acpi_spmc.c
+3-1lib/libutil/tests/trimdomain_test.c
+1-1lib/libutil/libutil.h
+37-102 files not shown
+40-118 files

HardenedBSD/src a7a1b47lib/libutil trimdomain.c trimdomain.3, lib/libutil/tests trimdomain_test.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+23-1lib/libutil/trimdomain.c
+4-4lib/libutil/trimdomain.3
+4-1lib/libutil/Symbol.map
+2-2sys/dev/acpica/acpi_spmc.c
+3-1lib/libutil/tests/trimdomain_test.c
+1-1sys/compat/linuxkpi/common/include/linux/sort.h
+37-102 files not shown
+40-118 files

HardenedBSD/src 4d876fcsys/dev/acpica acpi_spmc.c

acpi_spmc: fix revision check reading name as integer

In acpi_spmc_get_constraints_spec(), the revision of the device
constraint detail package was mistakenly read from
constraint_obj->Package.Elements[0], which is the device name
(a string), instead of from the detail sub-package's first element.

Move the initialisation of 'detail' before the revision check and
read the revision from detail->Package.Elements[0] as the comment
already states

Approved by:    obiwac
Differential Revision:  https://reviews.freebsd.org/D55639
Sponsored by:   Netflix
DeltaFile
+2-2sys/dev/acpica/acpi_spmc.c
+2-21 files

HardenedBSD/src f268f95lib/libutil trimdomain.c, lib/libutil/tests trimdomain_test.c

libutil: avoid an out-of-bounds read in trimdomain(3)

memchr(3) will happily believe we've passed in a valid object, but
hostsize could easily exceed the bounds of fullhost.  Clamp it down to
the string size to be safe and avoid UB.  This plugs a potential
overread noted in the compat shim that was just added.

Reviewed by:    des
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D54623
DeltaFile
+6-0lib/libutil/trimdomain.c
+3-1lib/libutil/tests/trimdomain_test.c
+9-12 files

HardenedBSD/src 7e70589lib/libutil trimdomain.c trimdomain.3

libutil: take a size_t in trimdomain()

INT_MAX is already larger than a reasonable hostname might be, but
size_t makes some of this easier to reason about as we do arithmetic
with it.  This would maybe not be worth it if we had to bump the
soversion because of it, but libutil does symbol versioning now so we
can provide a compat shim.

While we're here, fix some inconsistencies in argument names in the
manpage.

Reviewed by:    des
Obtained from:  https://github.com/apple-oss-distributions/libutil
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D54622
DeltaFile
+17-1lib/libutil/trimdomain.c
+4-4lib/libutil/trimdomain.3
+4-1lib/libutil/Symbol.map
+1-1lib/libutil/libutil.h
+26-74 files

HardenedBSD/src 5778700usr.bin/diff3 diff3.c

diff3: Add SPDX-License-Identifier tag

Reviewed by: bapt
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55462
DeltaFile
+2-0usr.bin/diff3/diff3.c
+2-01 files

HardenedBSD/src f26cb47sys/compat/linuxkpi/common/include/linux sort.h

LinuxKPI: avoid -Werror=unused-value in sort() from BUILD_BUG_ON_ZERO()

The BUILD_BUG_ON_ZERO() macro returns an (int)0 if it does not fail
at build time. LinuxKPI sort() has it as a guard for an unsupported
argument but ignores the return value.

This leads to gcc complaining:

/usr/src/sys/compat/linuxkpi/common/include/linux/build_bug.h:60:33: error: statement with no effect [-Werror=unused-value]
   60 | #define BUILD_BUG_ON_ZERO(x)    ((int)sizeof(struct { int:-((x) != 0); }))
      |                                 ^
/usr/src/sys/compat/linuxkpi/common/include/linux/sort.h:37:9: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
   37 |         BUILD_BUG_ON_ZERO(swap);                        \
      |         ^~~~~~~~~~~~~~~~~
/usr/src/sys/contrib/dev/rtw89/core.c:2575:9: note: in expansion of macro 'sort'
 2575 |         sort(drift, RTW89_BCN_TRACK_STAT_NR, sizeof(*drift), cmp_u16, NULL);

Change to BUILD_BUG_ON() for the statement version.


    [6 lines not shown]
DeltaFile
+1-1sys/compat/linuxkpi/common/include/linux/sort.h
+1-11 files

HardenedBSD/src 7f0dd0dshare/man/man5 src.conf.5, sys/cam/nvme nvme_da.c

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+182-39sys/dev/virtio/block/virtio_blk.c
+189-27sys/dev/virtio/virtqueue.c
+103-35sys/cam/nvme/nvme_da.c
+20-7sys/dev/virtio/virtio_ring.h
+8-6tools/test/hwpmc/pmctest.py
+8-5share/man/man5/src.conf.5
+510-1195 files not shown
+516-13311 files

HardenedBSD/src a6e7a0eshare/man/man5 src.conf.5, sys/cam/nvme nvme_da.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+182-39sys/dev/virtio/block/virtio_blk.c
+189-27sys/dev/virtio/virtqueue.c
+103-35sys/cam/nvme/nvme_da.c
+20-7sys/dev/virtio/virtio_ring.h
+8-6tools/test/hwpmc/pmctest.py
+8-5share/man/man5/src.conf.5
+510-1195 files not shown
+516-13311 files

HardenedBSD/src 824530asys/cam/nvme nvme_da.c

nda: Assume all cases in ndaasync can sleep

The error recovery is nicer if we can wait for the tiny memory we need
to send the messages when the physpath changes. Since we've moved the
async handler into a sleepable context, we can wait for the allocation
to complete since async events are rare enough and it's not an
indefinite wait.

Also add a comment about the scope of AC_ADVINFO_CHANGED for nvme
drives. We could use it for broadcasting INDENTIFY changes in nvme
drives. However, the underlying mechanisms in NVMe don't really allow
for that (they are more fine-grained). So for namespace changes, for
example, we'll send AC_GETDEV_CHANGED instead of a AC_ADVINFO_CHANGED.

Sponsored by:           Netflix
Differential Revision:  https://reviews.freebsd.org/D55523
DeltaFile
+9-1sys/cam/nvme/nvme_da.c
+9-11 files

HardenedBSD/src 244ae85sys/dev/nvme nvme_sim.c

nvme_sim: Fix a cut and paste error

Fix the error message in nvme_sim_ns_removed that was cut and pasted
from nvme_sim_ns_changed to reflect its new home.  No functional change.

Sponsored by:           Netflix
Differential Revision:  https://reviews.freebsd.org/D55522
DeltaFile
+1-1sys/dev/nvme/nvme_sim.c
+1-11 files

HardenedBSD/src 628d7a3sys/cam/nvme nvme_da.c

nda: AC_GETDEV_CHANGED calls media chanaged for sectorsize change

When the sector size changes, we assume it's new media. When the
mediasize changes, we'll just resize the disk (we get called for both
events). When neither have changed, don't call either.

Some NVMe drives (but not all) post a async event on page 4 with the
sector size changes via a FORMAT command. We'll notice the new media
right away, rather than the next device open. As a practical effect,
this just means that certain geom operations will see it sooner. Since
most drive interaction goes through open, that will catch those drives
that do not post this event well enough.

Sponsored by:           Netflix
Differential Revision:  https://reviews.freebsd.org/D55521
DeltaFile
+14-8sys/cam/nvme/nvme_da.c
+14-81 files

HardenedBSD/src 5c2186bsys/cam/nvme nvme_da.c

nda: Rescan the drive on open

SCSI and ATA drives rescan the drive on opens to catch changes to the
disk. We do it here to so we catch if a drive has been FORMATed or
SANITIZEd with different parameters. We don't use xpt_rescan() since we
don't want to interfere with boot or keep all busses locked (this rescan
won't change the bus, so we don't need the CAM topo lock).

Sponsored by:           Netflix
Differential Revision:  https://reviews.freebsd.org/D55520
DeltaFile
+47-2sys/cam/nvme/nvme_da.c
+47-21 files

HardenedBSD/src b1bd7fesys/cam/nvme nvme_da.c

nda: Move ndasetgeom

Move ndasetgeom up in the file. We'll need it here for future
commits. Also, preserve the UNMAPPED_BIO flag since we can't observe
enough data from this routine to set it directly.

Sponsored by:           Netflix
Differential Revision:  https://reviews.freebsd.org/D55519
DeltaFile
+33-24sys/cam/nvme/nvme_da.c
+33-241 files

HardenedBSD/src 3212aa8sys/cam/nvme nvme_xpt.c

nvme xpt: convert restart to a bool.

restart is a boolean. While I'm here, convert to a bool.

Sponsored by:           Netflix
Differential Revision:  https://reviews.freebsd.org/D55518
DeltaFile
+4-4sys/cam/nvme/nvme_xpt.c
+4-41 files

HardenedBSD/src bc92290tools/test/hwpmc pmctest.py

Allow programs run under this program to have arguments.
DeltaFile
+8-6tools/test/hwpmc/pmctest.py
+8-61 files

HardenedBSD/src e80c45dshare/man/man5 src.conf.5

src.conf.5: Regen after commit c47cefba8312
DeltaFile
+6-0share/man/man5/src.conf.5
+6-01 files

HardenedBSD/src c499ad6sys/dev/virtio virtqueue.c virtio_ring.h

virtio: Use bus_dma for ring and indirect buffer allocations

While the majority of virtio platforms will be fully coherent, some may
require cache maintenance or other specific device memory handling (eg for
secure partitioning). Using bus_dma allows for these usecases.

The virtio buffers are marked as coherent; this should ensure that sync
calls are no-ops in the common cases.

Reviewed by:    andrew
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D54959
DeltaFile
+189-27sys/dev/virtio/virtqueue.c
+20-7sys/dev/virtio/virtio_ring.h
+209-342 files

HardenedBSD/src c8c3714sys/dev/virtio/block virtio_blk.c

virtio_blk: Use bus_dma for command/ack buffer allocations

While the majority of virtio platforms will be fully coherent, some may
require cache maintenance or other specific device memory handling (eg for
secure partitioning). Using bus_dma allows for these usecases.

The virtio buffers are marked as coherent; this should ensure that sync
calls are no-ops in the common cases.

Reviewed by:    andrew, br
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D54960
DeltaFile
+182-39sys/dev/virtio/block/virtio_blk.c
+182-391 files

HardenedBSD/src b6bb2fcshare/man/man5 src.conf.5, share/mk src.opts.mk

src.opts.mk: Retire BSD_CPIO option

Prior to commit 6973701a00e3 ("1. Make the BSD version of cpio the
default [1]") GNU cpio was installed unconditionally.  The BSD_CPIO
option was added when we introduced the BSD licensed, libarchive-based
cpio, to support installation of GNU cpio, libarchive cpio, or both.

GNU cpio was removed long ago and there is no longer a need for this
option.  We can just install BSD cpio unconditionally.

Reviewed by:    des
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55467
DeltaFile
+0-7tools/build/mk/OptionalObsoleteFiles.inc
+1-4share/man/man5/src.conf.5
+1-1usr.bin/Makefile
+0-1share/mk/src.opts.mk
+2-134 files

HardenedBSD/src 4c822e8share/man/man5 src.conf.5

src.conf.5: Regen for typo fix in commit 8e9515839369
DeltaFile
+1-1share/man/man5/src.conf.5
+1-11 files

HardenedBSD/src c446b8fsbin/devd snd.conf devd.conf.5, sys/dev/sound/pcm sound.c

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+7-74usr.sbin/mixer/mixer.c
+4-71usr.sbin/mixer/mixer.8
+10-0sbin/devd/snd.conf
+9-0sys/dev/sound/pcm/sound.c
+3-1sbin/devd/devd.conf.5
+33-1465 files

HardenedBSD/src 654bd3esbin/devd snd.conf devd.conf.5, sys/dev/sound/pcm sound.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+7-74usr.sbin/mixer/mixer.c
+4-71usr.sbin/mixer/mixer.8
+10-0sbin/devd/snd.conf
+9-0sys/dev/sound/pcm/sound.c
+3-1sbin/devd/devd.conf.5
+33-1465 files

HardenedBSD/src d00b32cusr.sbin/mixer mixer.c mixer.8

Revert "mixer(8): Implement hot-swapping"

We now have devd rules in snd.conf that achieve this in a much cleaner
way.

This reverts commit 9aac27599acaffa21ff69c5be8a2d71d29cc3d6b.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D55532
DeltaFile
+7-74usr.sbin/mixer/mixer.c
+4-71usr.sbin/mixer/mixer.8
+11-1452 files

HardenedBSD/src 428517asbin/devd snd.conf devd.conf.5, sys/dev/sound/pcm sound.c

sound: Notify devd when no devices are connected

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D55531
DeltaFile
+10-0sbin/devd/snd.conf
+3-1sbin/devd/devd.conf.5
+2-0sys/dev/sound/pcm/sound.c
+15-13 files

HardenedBSD/src d40189fsys/dev/sound/pcm sound.c

sound: Notify devd on hw.snd.default_unit change

If we have virtual_oss running, this devd notification will make sure to
automatically transfer sound to the new default unit, while also making
sure that we switch to it only for the supported directions (recording
and/or playback).

For more information, please refer to 2ffaca551eaf ("snd_hda: Implement
automatic redirection between associations").

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D55530
DeltaFile
+7-0sys/dev/sound/pcm/sound.c
+7-01 files

HardenedBSD/src a0e1f06. Makefile.inc1, sys/conf kmod.mk kern.opts.mk

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+10-6sys/modules/Makefile
+6-2sys/conf/kmod.mk
+5-0sys/conf/kern.opts.mk
+2-1Makefile.inc1
+1-0sys/conf/files.arm64
+24-95 files

HardenedBSD/src b2a97b7. Makefile.inc1, sys/conf kmod.mk kern.opts.mk

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+10-6sys/modules/Makefile
+6-2sys/conf/kmod.mk
+5-0sys/conf/kern.opts.mk
+2-1Makefile.inc1
+1-0sys/conf/files.arm64
+24-95 files

HardenedBSD/src 9128649. Makefile.inc1

Run `make obj` before running `make test-includes`

Before this change, `make test-includes` (run as part of buildworld)
would place test files in the current directory, which would clutter up
git clones. Run `make obj` beforehand to ensure that the files are put
in `${.OBJDIR}` instead of `${.CURDIR}`. This helps cut down on the
noise significantly when running commands like `git status`.

MFC after:      1 week
Differential Revision: https://reviews.freebsd.org/D55499
DeltaFile
+2-1Makefile.inc1
+2-11 files

HardenedBSD/src c47cefbsys/conf kmod.mk kern.opts.mk, sys/modules Makefile

Only build USB-related modules if MK_USB != no

This change moves the thunderbolt module and other USB modules under a
MK_USB != no conditional to ensure that users not desiring USB support
can easily build systems without USB-specific drivers using this knob.

MFC after:      1 week
Reviewed By:    imp
Differential Revision: https://reviews.freebsd.org/D55576
DeltaFile
+10-6sys/modules/Makefile
+6-2sys/conf/kmod.mk
+5-0sys/conf/kern.opts.mk
+21-83 files