HardenedBSD/src 9902c39include uchar.h, lib/clang/libllvm Makefile

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+89-0share/man/man3/unreachable.3
+26-17sys/dev/acpica/acpi.c
+1-29sys/dev/sound/pcm/mixer.c
+0-10lib/clang/libllvm/Makefile
+6-0sys/sys/stdatomic.h
+5-0include/uchar.h
+127-567 files not shown
+140-6613 files

HardenedBSD/src 26158e1sys/dev/sound/pci via8233.c envy24ht.c, sys/dev/sound/pcm mixer.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+51-54sys/dev/sound/pcm/mixer.c
+50-51sys/dev/sound/pci/via8233.c
+34-35sys/dev/sound/pci/envy24ht.c
+34-34sys/dev/sound/pci/envy24.c
+29-28sys/dev/sound/pci/emu10k1.c
+27-27sys/dev/sound/pci/cmi.c
+225-22934 files not shown
+589-65240 files

HardenedBSD/src 9978553lib/clang/libllvm Makefile

Remove TableGen objects from libllvm, fixing bad option registrations

In 986e05bc2a18 I revamped the build for all the llvm subprojects. Among
others I added objects under contrib/llvm-project/llvm/lib/TableGen, but
I missed that upstream explicitly removes these when building the shared
llvm library:

https://github.com/llvm/llvm-project/blob/llvmorg-19.1.7/llvm/tools/llvm-shlib/CMakeLists.txt#L23

In 2e47f35be5dc I converted libllvm to a shared library. From that point
onwards, some of the global command line option objects registered in
llvm/lib/TableGen/Main.cpp conflict with similar objects in tools like
llvm-cov, llvm-as, etc.

This results in an error when running these tools: "CommandLine Error:
Option 'o' registered more than once!", followed by a fatal exit.

Fix this by removing the TableGen objects from libllvm. Note that we no
longer install any of the tblgen binaries, these are only used during

    [4 lines not shown]
DeltaFile
+0-10lib/clang/libllvm/Makefile
+0-101 files

HardenedBSD/src b381d09include stddef.h, share/man/man3 unreachable.3 assert.3

stddef.h: add unreachable() for C23 compliance

unreachable() is a hint to the compiler that it is unreachable.
Add a new man page unreachable(3) to document this macro.

Reviewed by:    imp
Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53967
DeltaFile
+89-0share/man/man3/unreachable.3
+3-2share/man/man3/assert.3
+4-0include/stddef.h
+2-1share/man/man3/Makefile
+98-34 files

HardenedBSD/src 04d000acontrib/jemalloc/include/jemalloc/internal util.h

jemalloc: avoid clash with C23 unreachable() macro

Summary: This avoids a clash with the new macro in <stddef.h>
introduced in D53967

Reviewed by:    imp
Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53968
DeltaFile
+3-0contrib/jemalloc/include/jemalloc/internal/util.h
+3-01 files

HardenedBSD/src f0e5411include uchar.h, sys/sys stdatomic.h

uchar.h: add char8_t

A type similar to char16 and char32_t, for compliance with C23.
The related type atomic_char8_t is added to stdatomic.h.
As char8_t is always unsigned char, I've skipped adding __char8_t.
This can be added, too, if desired.

Reviewed by:    imp
Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53952
DeltaFile
+6-0sys/sys/stdatomic.h
+5-0include/uchar.h
+11-02 files

HardenedBSD/src 5da388cinclude time.h

time.h: add timegm() to the C23 namespace

This function is part of ISO/IEC 9899:2024 (C23) and was forgotten in D47856.

Reviewed by:    imp
Approved by:    markj (mentor)
See also:       D47856
Fixes:          59677aecb67bbedcfa2ee5d7d2b189193cdc4af7
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53951
DeltaFile
+1-1include/time.h
+1-11 files

HardenedBSD/src e966eb4sys/dev/acpica acpi.c

acpi: Fix typos in sysctl descriptions

Reviewed by:    thj, emaste
Approved by:    thj
Sponsored by:   The FreeBSD Foundation
DeltaFile
+2-2sys/dev/acpica/acpi.c
+2-21 files

HardenedBSD/src eeaa865sys/dev/acpica acpi.c

acpi: Fix setting sleep state sysctls to NONE

This restores the functionality as it was pre-97d152698f48.

A stopgap was committed by glebius@ in 34dfccc64f47 ("acpi: in
acpi_stype_sysctl() use same logic as in acpi_sleep_state_sysctl()").

PR:             290651
Reviewed by:    thj, emaste
Approved by:    thj
Fixes:  97d152698f48 ("acpi: Use sleep types defined in sys/power.h")
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D53909
DeltaFile
+24-15sys/dev/acpica/acpi.c
+24-151 files

HardenedBSD/src e5d50a6sys/dev/sound/pci es137x.c, sys/dev/sound/pcm mixer.c mixer.h

sound: Retire snd_mixer->busy

Does not really serve any real purpose. It gets set on mixer_open() and
unset on mixer_close(), so it essentially tells us whether the mixer is
open or not.

mixer_close() uses it to return EBADF in case the mixer is not busied,
as in, the mixer has not been open()'d yet. This is redundant. The other
place where this is used is to decide whether to serve an ioctl issued
by userland, in which case it won't if, again, the mixer has not been
busied (i.e., opened). Again, seems redundant.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D53859
DeltaFile
+1-29sys/dev/sound/pcm/mixer.c
+0-4sys/dev/sound/pci/es137x.c
+0-2sys/dev/sound/pcm/mixer.h
+1-353 files

HardenedBSD/src 7587270share/examples/sound oss.h

sound examples: Fix buffer mapping/allocation

The buffer in struct config should be allocated or mmap'ed. The code
without this patch allocates the buffer unconditionally, even for mmap
configs.

MFC after:      1 week
Reviewed by:    christos
Differential Revision:  https://reviews.freebsd.org/D53939

(cherry picked from commit ebf1d98d60725feccd726ef8e4fa518661f9eae0)
DeltaFile
+18-3share/examples/sound/oss.h
+18-31 files

HardenedBSD/src b1e9512sys/dev/sound/midi midi.c

sound: Fix revents in midi_poll()

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Reviewed by:    christos
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1887

(cherry picked from commit 8f8b8e4af91d4e158caf6ba4b728482311bfc7c3)
DeltaFile
+9-11sys/dev/sound/midi/midi.c
+9-111 files

HardenedBSD/src 47bb49bsys/dev/sound/pci via8233.c envy24ht.c, sys/dev/sound/pcm mixer.c

sound: Retire snd_mtx* wrappers

Do not create mutexes with snd_mtxcreate(). It doesn't provide any
value, plus it first allocates the mutex with malloc(9). Allocate
mutexes in the stack and use mtx_* functions directly instead of the
snd_mtx* wrappers.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Reviewed by:    kib, markj
Differential Revision:  https://reviews.freebsd.org/D53855

(cherry picked from commit 9d18115ca0ab0ef3f34173d4e2bdabec916d0b60)
(cherry picked from commit 120f8a4c2ae8a011827d83b098ecf70c791f794b)
DeltaFile
+51-54sys/dev/sound/pcm/mixer.c
+50-51sys/dev/sound/pci/via8233.c
+34-35sys/dev/sound/pci/envy24ht.c
+34-34sys/dev/sound/pci/envy24.c
+29-28sys/dev/sound/pci/emu10k1.c
+27-27sys/dev/sound/pci/cmi.c
+225-22931 files not shown
+537-58937 files

HardenedBSD/src 48765e9sys/dev/sound/pcm dsp.c

sound: Simplify logic in dsp_io_ops()

Use CHN_LOCK()/CHN_UNLOCK() directly, instead of
dsp_lock_chans()/dsp_unlock_chans(). These functions are useful when we
want to potentially lock both channels. Here we know which channel we
are locking, so we can just lock it directly. This way we get rid of the
prio variable as well.

Related to runpid again, there is no reason to assign it when
CHN_F_RUNNING is not set. channel->pid (as well as channel->comm) is
always assigned in dsp_chn_alloc().

Get rid of runpid. I do not see how we can end up with channel->pid
(td->td_proc->p_pid) not matching buf->uio_td->td_proc->p_pid.

Also improve errno values.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week

    [4 lines not shown]
DeltaFile
+10-22sys/dev/sound/pcm/dsp.c
+10-221 files

HardenedBSD/src efb513fsys/dev/sound/midi midi.c mpu401.c

sound: Clean up midi/ includes

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D53841

(cherry picked from commit 4e8eb778803a8bffd0faa507ae2662725363cae5)
DeltaFile
+11-16sys/dev/sound/midi/midi.c
+2-9sys/dev/sound/midi/mpu401.c
+13-252 files

HardenedBSD/src 839da86sys/dev/sound/pcm sound.h sound.c

sound: Merge PCM_ALIVE() with PCM_REGISTERED()

PCM_ALIVE() is used only in pcm_unregister(), but it does not hurt to
use PCM_REGISTERED(), which uses PCM_ALIVE() internally. In fact, it's
more robust this way.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week

(cherry picked from commit 3107b952f534813846e4f58afdb57624a81618d8)
DeltaFile
+2-2sys/dev/sound/pcm/sound.h
+1-1sys/dev/sound/pcm/sound.c
+3-32 files

HardenedBSD/src 5d104bashare/man/man9 device_get_children.9 Makefile, sys/kern subr_bus.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+39-8share/man/man9/device_get_children.9
+11-10sys/sys/bus.h
+18-0sys/kern/subr_bus.c
+1-0share/man/man9/Makefile
+69-184 files

HardenedBSD/src 6facc47sys/sys bus.h

bus: Apply consistent style to prototypes

Sponsored by:   Klara, Inc.
Sponsored by:   NetApp, Inc.
DeltaFile
+10-10sys/sys/bus.h
+10-101 files

HardenedBSD/src 330d443share/man/man9 device_get_children.9 Makefile, sys/kern subr_bus.c

bus: Add device_has_children predicate

Add a device_has_children() function which can be used to check if a
device has children without allocating a list of them which we aren't
going to use, or even counting them.

Also modify device_get_children() so it can be used to query the count
without allocating a list.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Sponsored by:   NetApp, Inc.
Reviewed by:    imp, markj
Differential Revision:  https://reviews.freebsd.org/D53918
DeltaFile
+39-8share/man/man9/device_get_children.9
+18-0sys/kern/subr_bus.c
+1-0share/man/man9/Makefile
+1-0sys/sys/bus.h
+59-84 files

HardenedBSD/src 90f2a02sys/kgssapi gss_impl.c, sys/modules/cxgbe/if_cxgbev Makefile

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+2-3sys/modules/cxgbe/tom/Makefile
+4-0sys/kgssapi/gss_impl.c
+0-4sys/modules/cxgbe/t7_firmware/Makefile
+0-3sys/modules/cxgbe/if_cxgbev/Makefile
+0-3sys/modules/cxgbe/if_cxl/Makefile
+0-3sys/modules/cxgbe/if_cxlv/Makefile
+6-166 files not shown
+6-3412 files

HardenedBSD/src 34d66b0sys/modules/cxgbe/if_cc Makefile, sys/modules/cxgbe/if_ccv Makefile

cxgbe(4): Delete leftovers from $FreeBSD$ removal

No functional change.

MFC after:      1 week
Sponsored by:   Chelsio Communications
DeltaFile
+0-4sys/modules/cxgbe/t7_firmware/Makefile
+0-3sys/modules/cxgbe/if_cc/Makefile
+0-3sys/modules/cxgbe/if_ccv/Makefile
+0-3sys/modules/cxgbe/if_cxgbe/Makefile
+0-3sys/modules/cxgbe/if_cxgbev/Makefile
+0-3sys/modules/cxgbe/if_cxl/Makefile
+0-195 files not shown
+0-3411 files

HardenedBSD/src dcab3c4sys/modules/cxgbe/tom Makefile

Export t4_tom's symbols for other offload modules

This allows iw_cxgbe.ko, cxgbei.ko, nvmf_che.ko, etc. to be loaded when
debug.link_elf_leak_locals and debug.link_elf_obj_leak_locals are
disabled.

PR:             291250
MFC after:      1 week
Sponsored by:   Chelsio Communications
DeltaFile
+2-0sys/modules/cxgbe/tom/Makefile
+2-01 files

HardenedBSD/src 6901376sys/kgssapi gss_impl.c

kgssapi: Remove broken MOD_UNLOAD code

The module panicked at unload with "recursing but non-recursive rw".
There is a comment that "Unloading of the kgssapi module is not
currently supported" and the MOD_UNLOAD case falls through to returning
EOPNOTSUPP anyway.  Just #if 0 the code in the unload path, leaving it
as a hint in case someone implements unload support later on.

PR:             291249
Reviewed by:    rmacklem
Fixes: ad704a34bc2c ("Use syscall_helper_register(9) rather than syscall_register().")
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53949
DeltaFile
+4-0sys/kgssapi/gss_impl.c
+4-01 files

HardenedBSD/src 594bb78share/mk bsd.lib.mk, tools/tools/git git-arc.sh

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+15-0share/mk/bsd.lib.mk
+2-2tools/tools/git/git-arc.sh
+1-1usr.sbin/mountd/exports.5
+1-1usr.sbin/pkg/FreeBSD.conf.quarterly-release
+19-44 files

HardenedBSD/src 90697edlibexec/rtld-elf rtld.c, libexec/rtld-elf/powerpc reloc.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+25-7sys/vm/vm_page.c
+1-24libexec/rtld-elf/rtld.c
+24-0libexec/rtld-elf/powerpc64/reloc.c
+24-0libexec/rtld-elf/powerpc/reloc.c
+20-0sys/vm/vm_fault.c
+3-0sys/vm/vm_extern.h
+97-318 files not shown
+112-3214 files

HardenedBSD/src 6049f1btools/tools/git git-arc.sh

git-arc: Fix failure to call arc() function

As of b3e53f9fff11, git-arc attempted to call the internal shell
function, arc(), using env(1).  However, because env(1) does not call
shell functions, it actually attempted to run the arc utility.  This led
to errors:

    % git arc create -r xxx HEAD
    env: arc: No such file or directory
    git-arc: could not create Phabricator diff

This change removes the unnecessary use of env(1), so the arc() function
is correctly called.

Reviewed by:    markj
Fixes:          b3e53f9fff11 ("git-arc: Don't require devel/arcanist")
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D53972
DeltaFile
+1-1tools/tools/git/git-arc.sh
+1-11 files

HardenedBSD/src b903f27libexec/rtld-elf/powerpc reloc.c, libexec/rtld-elf/powerpc64 reloc.c

rtld: fix powerpc build

(cherry picked from commit 0628c252bd161ccdd1228a3b8aefeb471044ca04)
DeltaFile
+1-3libexec/rtld-elf/powerpc64/reloc.c
+1-3libexec/rtld-elf/powerpc/reloc.c
+2-62 files

HardenedBSD/src 452052esys/vm vm_page.c vm_extern.h

vm_page_free_prep(): convert PG_ZERO zeroed page check to use sf_buf

(cherry picked from commit b9fc7628dbb24b55cbb8791c83bd69f73cfadf23)
DeltaFile
+25-7sys/vm/vm_page.c
+3-0sys/vm/vm_extern.h
+28-72 files

HardenedBSD/src ff6a70elibexec/rtld-elf rtld.c, libexec/rtld-elf/i386 rtld_machdep.h

rtld-elf: move powerpc-specific auxv compat code into arch hook

(cherry picked from commit b2b3d2a962eb00005641546fbe672b95e5d0672a)
DeltaFile
+26-0libexec/rtld-elf/powerpc/reloc.c
+26-0libexec/rtld-elf/powerpc64/reloc.c
+1-24libexec/rtld-elf/rtld.c
+2-0libexec/rtld-elf/i386/rtld_machdep.h
+2-0libexec/rtld-elf/powerpc/rtld_machdep.h
+2-0libexec/rtld-elf/powerpc64/rtld_machdep.h
+59-244 files not shown
+67-2410 files

HardenedBSD/src be9e4c0sys/vm vm_fault.c

vm_fault: add a verifier that the PG_ZERO page is indeed zeroed

(cherry picked from commit d8bfcacd12aba73188c44a157c707908e275825d)
DeltaFile
+20-0sys/vm/vm_fault.c
+20-01 files