HardenedBSD/src f0d528crelease Makefile

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+2-14release/Makefile
+2-141 files

HardenedBSD/src 504ffb5lib/clang llvm.build.mk, lib/clang/libllvm Makefile

Merge branch 'freebsd/14-stable/main' into hardened/14-stable/master
DeltaFile
+11-2release/Makefile.gce
+11-0lib/clang/libllvm/Makefile
+6-2usr.sbin/pmcannotate/pmcannotate.c
+1-1lib/libcuse/cuse_lib.c
+1-0lib/clang/llvm.build.mk
+30-55 files

HardenedBSD/src e063ac1lib/clang/libllvm Makefile, sys/net if_ipsec.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+13-4sys/netipsec/ipsec_input.c
+14-2sys/netipsec/xform_ipcomp.c
+14-2sys/netipsec/xform_ah.c
+10-2sys/net/if_ipsec.c
+11-0lib/clang/libllvm/Makefile
+8-2sys/netipsec/xform_esp.c
+70-125 files not shown
+87-1811 files

HardenedBSD/src 92d80c2release Makefile.gce

GCE: Don't .error on unsupported targets

We ingest Makefile.gce even when we're not trying to create GCE images
so we don't want to .error here.  Instead, set GCE_ARCH to a dummy
value which should make the problem clear to anyone who attempts to
create GCE images on an unsupported architecture.

Reported by:    Jenkins
Fixes:          0a8ecca4e315 ("GCE: Specify the architecture of images")

(cherry picked from commit 787d09753f70bb382a7cbfba742a612fa54069e6)
DeltaFile
+1-1release/Makefile.gce
+1-11 files

HardenedBSD/src 86b5e5brelease Makefile.gce

GCE: Specify the architecture of images

Without a specified architecture, a user can attempt to create an
arm64 instance with an amd64 image or vice versa. With the change
the API will prevent that mismatch.

(cherry picked from commit 0a8ecca4e3156bcd4ebbfcb24d968e67a3a09434)
DeltaFile
+9-0release/Makefile.gce
+9-01 files

HardenedBSD/src d1f2756release Makefile.gce

GCE: Add TARGET and FS to image family

GCE image family is meant to be unique per set of image characteristics
so that a user can create instances using the image family instead of the
image name to reliably get a similar image with updated software, but no
other changes.

Without this change, the instances create API would select the most recent
non-deprecated image matching the name, regardless of architecture or
filesystem.

(cherry picked from commit fc83e6c5e1f20087314dc52b63e485db87a98b86)
DeltaFile
+2-2release/Makefile.gce
+2-21 files

HardenedBSD/src f039599sys/compat/linuxkpi/common/src linux_80211.c

LinuxKPI: 802.11: reset hdr after crypto in lkpi_80211_txq_tx_one()

When lkpi_80211_txq_tx_one() calls into the crypto offloading parts to
possibly make space in the headroom, the beginning of our frame moves.
We have to reset hdr after that call as otherwise later classifications
based on the hdr->frame_control will fail or cause wrong classificaiton
of packets.
This makes sure frames will either be directly sent using (*mo_tx)()
or use the correct tid for the correct queue.  This helps to get
rtwx8 packets flowing after BA was negotiated.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Fixes:          11db70b6057e4
DeltaFile
+2-0sys/compat/linuxkpi/common/src/linux_80211.c
+2-01 files

HardenedBSD/src 8494be1sys/compat/linuxkpi/common/src linux_80211.c

LinuxKPI: 802.11: fix rx_nss with VHT

When fixing single-stream chipsets, like iwlwifi(4) AX101, we started
masking the announced with the hardware supported values.  This would
probably limit, e.g., rx_nss.  During these works we fixed a loop
checking from the highest nss=7 to lowest nss=0 (8..1) and would set
rx_nss if the stream was supported.  This left us with always setting
rx_nss on nss=0 to nss + 1 = 1.  Instead only update once when we hit
the first supported MCS value (highest number of supported streams).
Looking at the diff of the mentioned commit hash which gets fixed it
looks like even the old code was not correct either.

This only fixes the logic to calculate rx_nss.  This does not yet help
with modern drivers to actually update the value.  Code for this will
come in a later commit.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Fixes:          adb4901ac9ae
DeltaFile
+2-1sys/compat/linuxkpi/common/src/linux_80211.c
+2-11 files

HardenedBSD/src 9cf8545sys/compat/linuxkpi/common/src linux_80211.c

LinuxKPI: 802.11: assign sequence numbers to frames

While all native drivers were converted to call
ieee80211_output_seqno_assign() after changes to net80211 if needed,
LinuxKPI 802.11 was not fixed.  Add the missing call.
Given we are currently only supporting STA mode, we can provide
sequence numbers for all frames (mgmt/beacon would be a problem in
AP mode).

This greatly helps LinuxKPI based drivers other than iwlwifi(4).
If drivers do their own sequence numbers, they will overwrite what we
pre-set unless we would pass a txflag not to do so (beware the
consequences).

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Fixes:          eabcd1773fa3, 785edcc2af5a
DeltaFile
+2-0sys/compat/linuxkpi/common/src/linux_80211.c
+2-01 files

HardenedBSD/src 32ea820share/man/man4 linuxkpi_wlan.4, sys/compat/linuxkpi/common/src linux_80211.c linux_80211.h

LinuxKPI: 802.11: add compat.linuxkpi.80211.IF.dump_stas_queues

Extend the normal compat.linuxkpi.80211.IF.dump_stas sysctl by
queue information.  This was helpful for debugging various issues,
like selecting the outbound queue, stopping queues for BAR and helped
finding multiple bugs.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
DeltaFile
+73-5sys/compat/linuxkpi/common/src/linux_80211.c
+8-1share/man/man4/linuxkpi_wlan.4
+4-0sys/compat/linuxkpi/common/src/linux_80211.h
+85-63 files

HardenedBSD/src 2116005release Makefile

HBSD: Always build both the distsets and pkgbase

We want to be able to experiment with pkgbase while also still providing
the tried and true method. Note that pkgbase support in the installer is
still broken.

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+2-14release/Makefile
+2-141 files

HardenedBSD/src 5143ea1usr.sbin/pmcannotate pmcannotate.c

pmcannotate: avoid accessing uninitialized local variables

Initialize `tbfl` and `tofl` to NULL, and check whether they are
non-NULL before calling remove(3) on them, to avoid warnings from clang
21 similar to:

    usr.sbin/pmcannotate/pmcannotate.c:746:3: error: variable 'tbfl' is uninitialized when used here [-Werror,-Wuninitialized]
      746 |                 FATAL(exec, "%s: Impossible to locate the binary file\n",
          |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      747 |                     exec);
          |                     ~~~~~
    usr.sbin/pmcannotate/pmcannotate.c:57:9: note: expanded from macro 'FATAL'
       57 |         remove(tbfl);                                                   \
          |                ^~~~
    usr.sbin/pmcannotate/pmcannotate.c:695:12: note: initialize the variable 'tbfl' to silence this warning
      695 |         char *tbfl, *tofl, *tmpdir;
          |                   ^
          |                    = NULL
    usr.sbin/pmcannotate/pmcannotate.c:746:3: error: variable 'tofl' is uninitialized when used here [-Werror,-Wuninitialized]

    [15 lines not shown]
DeltaFile
+6-2usr.sbin/pmcannotate/pmcannotate.c
+6-21 files

HardenedBSD/src ecb1019lib/clang/libllvm Makefile

Remove debug crutch I accidentally left in

Fixes:          cf1eaaf41cef
MFC after:      1 week

(cherry picked from commit 3b1126208f44a90c7dc04a87207e54b22d45893c)
DeltaFile
+0-1lib/clang/libllvm/Makefile
+0-11 files

HardenedBSD/src 4660acclib/clang llvm.build.mk, lib/clang/libllvm Makefile

Reduce number of external symbols in libllvm, libclang and liblldb

In commit 2e47f35be5dc libllvm, libclang and liblldb were converted into
private shared libraries. This allowed clang, lld, lldb, and other llvm
tools to be linked against these shared libraries, which makes them
smaller and avoids duplication.

However, upstream builds the shared libraries using several visibility
options, which reduces the number of external symbols, and makes the
libraries a bit smaller.

On my test machine:
* libprivatellvm.so goes from 75643 to 34706 symbols (~54% reduction)
* libprivateclang.so goes from 53250 to 33531 symbols (~37% reduction)
* libprivatelldb.so goes from 27242 to 18798 symbols (~31% reduction)

Note: to get the full benefit, a clean build is required. Incremental
builds should still work, but I didn't want to force a full rebuild on
everybody.

    [4 lines not shown]
DeltaFile
+12-0lib/clang/libllvm/Makefile
+1-0lib/clang/llvm.build.mk
+13-02 files

HardenedBSD/src ea9ce38usr.sbin/pmcannotate pmcannotate.c

pmcannotate: avoid accessing uninitialized local variables

Initialize `tbfl` and `tofl` to NULL, and check whether they are
non-NULL before calling remove(3) on them, to avoid warnings from clang
21 similar to:

    usr.sbin/pmcannotate/pmcannotate.c:746:3: error: variable 'tbfl' is uninitialized when used here [-Werror,-Wuninitialized]
      746 |                 FATAL(exec, "%s: Impossible to locate the binary file\n",
          |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      747 |                     exec);
          |                     ~~~~~
    usr.sbin/pmcannotate/pmcannotate.c:57:9: note: expanded from macro 'FATAL'
       57 |         remove(tbfl);                                                   \
          |                ^~~~
    usr.sbin/pmcannotate/pmcannotate.c:695:12: note: initialize the variable 'tbfl' to silence this warning
      695 |         char *tbfl, *tofl, *tmpdir;
          |                   ^
          |                    = NULL
    usr.sbin/pmcannotate/pmcannotate.c:746:3: error: variable 'tofl' is uninitialized when used here [-Werror,-Wuninitialized]

    [15 lines not shown]
DeltaFile
+6-2usr.sbin/pmcannotate/pmcannotate.c
+6-21 files

HardenedBSD/src 1eea067lib/clang/libllvm Makefile

Remove debug crutch I accidentally left in

Fixes:          cf1eaaf41cef
MFC after:      1 week

(cherry picked from commit 3b1126208f44a90c7dc04a87207e54b22d45893c)
DeltaFile
+0-1lib/clang/libllvm/Makefile
+0-11 files

HardenedBSD/src 5c5e2a0lib/clang llvm.build.mk, lib/clang/libllvm Makefile

Reduce number of external symbols in libllvm, libclang and liblldb

In commit 2e47f35be5dc libllvm, libclang and liblldb were converted into
private shared libraries. This allowed clang, lld, lldb, and other llvm
tools to be linked against these shared libraries, which makes them
smaller and avoids duplication.

However, upstream builds the shared libraries using several visibility
options, which reduces the number of external symbols, and makes the
libraries a bit smaller.

On my test machine:
* libprivatellvm.so goes from 75643 to 34706 symbols (~54% reduction)
* libprivateclang.so goes from 53250 to 33531 symbols (~37% reduction)
* libprivatelldb.so goes from 27242 to 18798 symbols (~31% reduction)

Note: to get the full benefit, a clean build is required. Incremental
builds should still work, but I didn't want to force a full rebuild on
everybody.

    [4 lines not shown]
DeltaFile
+12-0lib/clang/libllvm/Makefile
+1-0lib/clang/llvm.build.mk
+13-02 files

HardenedBSD/src c55bd9blib/libcuse cuse_lib.c

cuse(3): annotate cuse_init() to suppress thread safety analysis

This avoids warnings from clang 21, similar to:

    /usr/src/lib/libcuse/cuse_lib.c:111:14: error: writing variable 'h_cuse' requires holding mutex 'm_cuse' exclusively [-Werror,-Wthread-safety-analysis]
      111 |         TAILQ_INIT(&h_cuse);
          |                     ^
    /usr/src/lib/libcuse/cuse_lib.c:111:14: error: writing variable 'h_cuse' requires holding mutex 'm_cuse' exclusively [-Werror,-Wthread-safety-analysis]
    /usr/src/lib/libcuse/cuse_lib.c:112:14: error: writing variable 'h_cuse_entered' requires holding mutex 'm_cuse' exclusively [-Werror,-Wthread-safety-analysis]
      112 |         TAILQ_INIT(&h_cuse_entered);
          |                     ^
    /usr/src/lib/libcuse/cuse_lib.c:112:14: error: writing variable 'h_cuse_entered' requires holding mutex 'm_cuse' exclusively [-Werror,-Wthread-safety-analysis]

MFC after:      3 days

(cherry picked from commit 5629b5cf79934e0b94ddbbd93b7756f74fe4050a)
DeltaFile
+1-1lib/libcuse/cuse_lib.c
+1-11 files

HardenedBSD/src 8f7dfa4lib/libcuse cuse_lib.c

cuse(3): annotate cuse_init() to suppress thread safety analysis

This avoids warnings from clang 21, similar to:

    /usr/src/lib/libcuse/cuse_lib.c:111:14: error: writing variable 'h_cuse' requires holding mutex 'm_cuse' exclusively [-Werror,-Wthread-safety-analysis]
      111 |         TAILQ_INIT(&h_cuse);
          |                     ^
    /usr/src/lib/libcuse/cuse_lib.c:111:14: error: writing variable 'h_cuse' requires holding mutex 'm_cuse' exclusively [-Werror,-Wthread-safety-analysis]
    /usr/src/lib/libcuse/cuse_lib.c:112:14: error: writing variable 'h_cuse_entered' requires holding mutex 'm_cuse' exclusively [-Werror,-Wthread-safety-analysis]
      112 |         TAILQ_INIT(&h_cuse_entered);
          |                     ^
    /usr/src/lib/libcuse/cuse_lib.c:112:14: error: writing variable 'h_cuse_entered' requires holding mutex 'm_cuse' exclusively [-Werror,-Wthread-safety-analysis]

MFC after:      3 days

(cherry picked from commit 5629b5cf79934e0b94ddbbd93b7756f74fe4050a)
DeltaFile
+1-1lib/libcuse/cuse_lib.c
+1-11 files

HardenedBSD/src b667280tools/build Makefile

cross-build: Avoid adding <sys/cdefs.h> to SYSINCS

Summary:
The sys/cdefs.h in src is incompatible with glibc's sys/cdefs.h so
cross-building broke when the former was added to SYSINCS in 1c9ff80f06. This
commit adds a guard around that to only do that when building on FreeBSD. This
should fix github CI.

Test Plan:
Ran buildkernel using tools/build/make.py on linux in github CI and
locally on FreeBSD to double check nothing broke.

Reviewed by:    dim
MFC after:      3 days
Differential Revision: https://reviews.freebsd.org/D54385
DeltaFile
+2-0tools/build/Makefile
+2-01 files

HardenedBSD/src 543c866tests/sys/kern exterr_test.c

exterr_test: loosen the error string pattern

After addition of the prot and max_prot values, the old error substring
no longer satisfy the check.

Reviewed by:    emaste, mckusick
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54380
DeltaFile
+1-1tests/sys/kern/exterr_test.c
+1-11 files

HardenedBSD/src 54b52f6sys/fs/fuse fuse_device.c fuse_vfsops.c, sys/sys exterr_cat.h

fs/fuse: use dedicated category per source file

Submitted by:   mckusick
Reviewed by:    emaste, mckusick
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54380
DeltaFile
+3-1sys/sys/exterr_cat.h
+1-1sys/fs/fuse/fuse_device.c
+1-1sys/fs/fuse/fuse_vfsops.c
+1-1sys/fs/fuse/fuse_vnops.c
+6-44 files

HardenedBSD/src 14bd57dshare/man/man9 exterror.9

exterror.9: describe formatting of optional arguments

Reviewed by:    emaste, mckusick
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54380
DeltaFile
+10-0share/man/man9/exterror.9
+10-01 files

HardenedBSD/src 8bff95flib/libc/gen uexterr_format.c

exterror: add support for the format specifiers in the extended error msg

Note that we trust kernel code to only request the printout of integer
types, and use the 'j' modifier always.

Reviewed by:    emaste, mckusick
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54380
DeltaFile
+2-1lib/libc/gen/uexterr_format.c
+2-11 files

HardenedBSD/src 37ddbbelib/libc/gen err.c

libc/gen/err.c: remove 'extended error' herald from extended error output

Reviewed by:    emaste, mckusick
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54380
DeltaFile
+1-1lib/libc/gen/err.c
+1-11 files

HardenedBSD/src 2904edasys/vm vm_mmap.c

vm/vm_mmap.c: inline erronous argument values for extended errors

Reviewed by:    emaste, mckusick
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54380
DeltaFile
+25-18sys/vm/vm_mmap.c
+25-181 files

HardenedBSD/src 874cdf6lib/libc/gen uexterr_format.c, sys/sys exterr_cat.h

exterr: in verbose mode, print the source file name

Reviewed by:    emaste, mckusick
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54380
DeltaFile
+17-4lib/libc/gen/uexterr_format.c
+11-0sys/sys/exterr_cat.h
+28-42 files

HardenedBSD/src 3ef25actools/build make_libc_exterr_cat_filenames.sh

Add a script to auto-generate mapping from exterr category to source file

Reviewed by:    emaste, mkusick
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54380
DeltaFile
+22-0tools/build/make_libc_exterr_cat_filenames.sh
+22-01 files

HardenedBSD/src 3088263lib/libc/gen err.3, share/man/man7 environ.7

man pages: provide some description for extended errors

, related functions, and the EXTERROR_VERBOSE environment variable.

Reviewed by:    emaste, mckusick
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54380
DeltaFile
+16-0lib/libc/gen/err.3
+15-1share/man/man7/environ.7
+31-12 files

HardenedBSD/src 5685c07lib/libc/gen exterr_cat_filenames.h

Add automatically generated file libc/gen/exterr_cat_filenames.h

MFC after:      1 week
DeltaFile
+17-0lib/libc/gen/exterr_cat_filenames.h
+17-01 files