HardenedBSD/src 3441c31sys/modules/ath10k Makefile, sys/modules/ath11k Makefile

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+46-40sys/modules/brcm80211/brcmfmac/Makefile
+51-20sys/modules/ath11k/Makefile
+29-31sys/modules/rtw88/Makefile
+29-28sys/modules/rtw89/Makefile
+26-18sys/modules/mt76/Makefile.inc
+20-18sys/modules/ath10k/Makefile
+201-15511 files not shown
+345-25517 files

HardenedBSD/src c39237alib/libmixer mixer.c

mixer(3): Rename _mixer_readvol() to mixer_readvol()

No functional change intended.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
DeltaFile
+3-5lib/libmixer/mixer.c
+3-51 files

HardenedBSD/src ec07723sys/dev/sound/pcm sound.h, sys/dev/sound/usb uaudio.h

Revert "sound: Remove some forward declarations from sound.h and uaudio.h"

This reverts commit 602249f033d146d9c731d8b1cb4b2e0899c61ad9.
DeltaFile
+4-1sys/dev/sound/pcm/sound.h
+2-0sys/dev/sound/usb/uaudio.h
+6-12 files

HardenedBSD/src 602249fsys/dev/sound/pcm sound.h, sys/dev/sound/usb uaudio.h

sound: Remove some forward declarations from sound.h and uaudio.h

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
DeltaFile
+1-4sys/dev/sound/pcm/sound.h
+0-2sys/dev/sound/usb/uaudio.h
+1-62 files

HardenedBSD/src 7e9d974contrib/libarchive/test_utils test_main.c

libarchive: Staticize some variables

This code was not being built due to errors in our libarchive
configuration.  Now that those have been addressed, staticize some
variables that trip a “no previous extern declaration” error.  This
is a subset of upstream PR 2962.

MFC after:      1 week
Reviewed by:    mm
Differential Revision:  https://reviews.freebsd.org/D56471
DeltaFile
+3-3contrib/libarchive/test_utils/test_main.c
+3-31 files

HardenedBSD/src 05bbe5elib/libarchive config_freebsd.h

libarchive: Update configuration

PR:             294577
MFC after:      1 week
Reviewed by:    mm
Differential Revision:  https://reviews.freebsd.org/D56468
DeltaFile
+89-37lib/libarchive/config_freebsd.h
+89-371 files

HardenedBSD/src 8c94a1esys/sys pipe.h

pipe: retire the unused PIPE_LWANT macro
DeltaFile
+0-1sys/sys/pipe.h
+0-11 files

HardenedBSD/src 4a795bbshare/vt/keymaps Makefile, usr.sbin/nfsd nfsv4.4

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+154-24usr.sbin/nfsd/nfsv4.4
+2-0share/vt/keymaps/Makefile
+156-242 files

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

kshim/usb: Add build option.

Add WITH{,OUT}_LOADER_USB to build the kshim usb library. Nothing
in-tree uses it, but this will make it easier to keep building. Updated
src.conf.5 with a few extra changes...

Sponsored by:           Netflix
DeltaFile
+438-7share/man/man5/src.conf.5
+2-1share/mk/src.opts.mk
+2-0tools/build/options/WITH_LOADER_USB
+1-0stand/Makefile
+443-84 files

HardenedBSD/src 5f848ebsys/modules/ath10k Makefile, sys/modules/brcm80211/brcmfmac Makefile

LinuxKPI wlan drivers: update makefiles to not use WITH_

Up to now the LinuxKPI wlan drivers were using local variables starting
with a WITH_ prefix in their Makefiles.
That is likely to collide with other mechanisms like WITH_ and WITHOUT_
from src.conf.
Adjust the local variables to use a driver name prefix for now to control
what is built and what is not.
These variables are mainly for the time of development so we can
turn off/on a feature or bus attachment while working on it.  Otherwise
they are there for documentation purposes.  The only reason one would
change them locally would be if someone was to build a very custom
image and not want certain bits (e.g., USB support) being compiled into
the modules.

While here, try to harmonize some parts of the Makefiles.

Suggested by:   imp
Discussed with: imp

    [5 lines not shown]
DeltaFile
+46-40sys/modules/brcm80211/brcmfmac/Makefile
+29-31sys/modules/rtw88/Makefile
+29-28sys/modules/rtw89/Makefile
+26-18sys/modules/mt76/Makefile.inc
+20-18sys/modules/ath10k/Makefile
+20-16sys/modules/mt76/mt7921/Makefile
+170-15111 files not shown
+304-23717 files

HardenedBSD/src f5f3c16sys/modules/ath11k Makefile

ath11k: restore module Makefile

During the subtree merge and checking out the updated version of ath12k
parts of the previous ath11k merge were accidentally undone.
Retore the ath11k Makefile as well after 3c4eef5d838b restored the
driver bits.

Fixes:          a96550206e4b ("ath12k: update Atheros/QCA's ath12k ..")
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit f9795615415074b23faf8e5d937c2ef31045d3d0)
DeltaFile
+43-20sys/modules/ath11k/Makefile
+43-201 files

HardenedBSD/src 34196ceshare/vt/keymaps Makefile

us.intl.acc.kbd: add it to Makefile

This keyboard was implemented but wasn't actually installed to the
system.

Fixes: a049678039e40bdf523230852f78887a12435def
Discussed with: imp
MFC after: 1 day
Relnotes: yes

(cherry picked from commit 3b373d484046a94d050a7901feadc001f35fa97f)
DeltaFile
+1-0share/vt/keymaps/Makefile
+1-01 files

HardenedBSD/src 23eaa98share/vt/keymaps Makefile

br.lenovo.kdb: add it to Makefile

This keyboard was implemented but wasn't actually installed to the
system.

Fixes: 9357c694e8dca627c25b15529e8435b2ab3dd48b
MFC after: 1 day
Relnotes: yes

(cherry picked from commit 6fb5df548e4a581f958f60544b7fa8ba1716c4c6)
DeltaFile
+1-0share/vt/keymaps/Makefile
+1-01 files

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

LinuxKPI: implement devm_kmemdup_array()

Implement devm_kmemdup_array() using devm_kmemdup() in order to
prepare for Linux v7.0 based drivers.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D56396
DeltaFile
+7-0sys/compat/linuxkpi/common/include/linux/device.h
+7-01 files

HardenedBSD/src d2c8525sys/compat/linuxkpi/common/include/linux overflow.h

LinuxKPI: sync overflow.h from Linux v7.0

overflow.h was imported directly from Linux in 3208d4ad2b8320a.
Update the file to the newer version as needed for v7.0 driver updates.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Obtained from:  git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
                028ef9c96e96197026887c0f092424679298aae8 (tag: v7.0)
Reviewed by:    emaste, dumbbell
Differential Revision: https://reviews.freebsd.org/D56394
DeltaFile
+130-14sys/compat/linuxkpi/common/include/linux/overflow.h
+130-141 files

HardenedBSD/src c72ac6asys/compat/linuxkpi/common/include/linux slab.h

LinuxKPI: add kmalloc_obj[s], kzalloc_obj[s], and kzalloc_flex

Drivers in Linux v7.0 seem to have changed to the new allocation
macros using a sweep.  Add the ones I encountered with wireless
drivers so far.  They all take an optional argument for a gfp_t,
which default_gfp() deals with.

The plural version "objs" takes an extra nitems argument in addition
to the size.  We use size_mul() to possibly detect overflows.

The "flex" version uses an extra variable to track the variable sized
array allocations and if supported by the compiler will use
__builtin_counted_by_ref() to properly track bounds.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D56395
DeltaFile
+23-1sys/compat/linuxkpi/common/include/linux/slab.h
+23-11 files

HardenedBSD/src 524df65sys/compat/linuxkpi/common/include/linux compiler_types.h

LinuxKPI: conditionally add __flex_counter()

__flex_counter() is used by overflow.h and needed for "flex allocations".
It is either a void * typed 0 (NULL) (like this for _Generic checks),
or uses __builtin_counted_by_ref.

The latter was added to gcc and llvm fairly recently and while for gcc
the __has_builtin() check suffices, clang had parts broken until recently
so needs an extra check for the next major version.  The fixed hash is
currently not part of any tag to use, so we play it save (and hope 23
will have it).  It will be a while until we will see the builting to be
used but at least we will be prepared for it.  See inline comments for
the commit hashes and versions which added the feature.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D56393
DeltaFile
+13-0sys/compat/linuxkpi/common/include/linux/compiler_types.h
+13-01 files

HardenedBSD/src 125b09dsys/net80211 ieee80211_radiotap.h

net80211: radiotap: add more VHT flags, and struct

Add the struct for VHT information and flags for the known and flag
field as documented on radiotap.org.  iwlwifi has started filling in
these details.

While here, add Copyright information for all the additions in the
last years.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
DeltaFile
+27-0sys/net80211/ieee80211_radiotap.h
+27-01 files

HardenedBSD/src 35b90c2sys/compat/linuxkpi/common/include/linux gfp.h

LinuxKPI: add default_gfp()

Various new allocation macros can take an optional gfp_t argument.
If the argument is not given we need to set the GFP_KERNEL default.
While this is only internally used and I initialy called it differently,
should this spread elsewhere having the same name as in Linux will be
good.

Sponsored by:   The FreeBSD Foundaton
MFC after:      3 days
Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D56392
DeltaFile
+3-0sys/compat/linuxkpi/common/include/linux/gfp.h
+3-01 files

HardenedBSD/src 98297ffsys/compat/linuxkpi/common/include/linux hex.h kernel.h

LinuxKPI: move hex2bin() from kernel.h to new hex.h

New Linux v7.0 drivers include hex.h.  Rather than adding a dummy
header, migrate the kernel.h hex2bin() into hex.h, where it belongs.
Care needs to be taken as the _h2b() helper function is still used by
other bits in kernel.h.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Reviewed by:    emaste, dumbbell
Differential Revision: https://reviews.freebsd.org/D56391
DeltaFile
+44-0sys/compat/linuxkpi/common/include/linux/hex.h
+1-31sys/compat/linuxkpi/common/include/linux/kernel.h
+45-312 files

HardenedBSD/src f5cd992sys/modules/bnxt/bnxt_en Makefile

bnxt_en: fix module Makefile for LinuxKPI

Rather than manually including the include directory for LinuxKPI
use the provided macro.  Before there was no -I for the dummy
directory and as files synced from Linux under a permissive license
may include them the build would fail.  overflow.h will include
linux/const.h which only exists as a dummy header at this point
on FreeBSD.

Sponsored by:   The FreeBSD Foundation
Fixes:          35b53f8c989f6
MFC after:      3 days
Reviewed by:    emaste
Differential Revision: https://reviews.freebsd.org/D56424
DeltaFile
+1-1sys/modules/bnxt/bnxt_en/Makefile
+1-11 files

HardenedBSD/src 99bbfb7sys/contrib/dev/rtw89 core.c

rtw89: add a warn about beacon_int or dtim_period being 0

While after the changes to LinuxKPI 802.11 we should never be assoc
and not have dtim_period set, we have seen before that this could
happen.  Add a WARN as that will help debugging the following DIV 0.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
DeltaFile
+4-0sys/contrib/dev/rtw89/core.c
+4-01 files

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

LinuxKPI: 802.11: make sure dtim_period is set

When going from ASSOC to RUN LinuxKPI based wireless drivers have
certian expectations written in various ways.  I believe mac80211
waits to see a beacon before setting the vif to assoc (or the sta
to AUTHORIZED).  We have some comments in lkpi_update_dtim_tsf()
for that.
In practice we can filter out the beacons already and know when
they came in as we count them but it is hard to split up the
state machine and defer the work.

So we make sure that dtim_period is set to at least 1 before
calling the (*vif_cfg_change) after setting assoc to true;
0 is a reserved value according to the standards.

We will update it once we see a beacon and in case the value
differs from 1 shortly afterwards from the recv_mgmt callback.

While iwlwifi seems to have coped with our initial implementation,

    [5 lines not shown]
DeltaFile
+16-5sys/compat/linuxkpi/common/src/linux_80211.c
+16-51 files

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

LinuxKPI: 802.11: start filling vif->cfg.ap_addr

vif->cfg.ap_addr is used by various drivers now and is the BSSID for
non-MLO or the AP addr for MLO configurations.

If this is unset rtw89 gets cranky and certain packets are likely not
going out correctly (also for iwlwifi).

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

HardenedBSD/src 166a734sys/compat/linuxkpi/common/include/net mac80211.h, sys/compat/linuxkpi/common/src linux_80211.c linux_80211.h

LinuxKPI: 802.11: improve emulate chanctx implementation

Now that all dependencies are implemented improve our chanctx emulation.
Some drivers still rely on chandef information for channel work.

In order to only do chanctx updates within mac80211 in Linux and
likewise in the LinuxKPI 802.11 compat layer, emulation functions
were introduced which claim to support chanctx driver operation but
in reality convert these to chandef field updates and (*config)
downcalls.

This is relevant to several mt76 chipsets (at least 7615, 7915),
and rtw88 and certain rtw89 chipsets (8851b, and the ones not supporting
SCAN_OFFLOAD or BEACON_FILTER) for us.

Migrate the logic out of the header and improve it.

Make use of the introduced dflt_chandef and scan_chandef fields,
add comparison of chandefs to see if we have to update, etc.

    [13 lines not shown]
DeltaFile
+202-8sys/compat/linuxkpi/common/src/linux_80211.c
+16-56sys/compat/linuxkpi/common/include/net/mac80211.h
+1-0sys/compat/linuxkpi/common/src/linux_80211.h
+219-643 files

HardenedBSD/src 72b9ddasys/compat/linuxkpi/common/src linux_80211.c linux_80211.h

LinuxKPI: 802.11: add chandef tracing

Add chandef tracing so we can follow what is set and unset in the
chanctx emulation for drivers still needing this.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
DeltaFile
+76-3sys/compat/linuxkpi/common/src/linux_80211.c
+1-0sys/compat/linuxkpi/common/src/linux_80211.h
+77-32 files

HardenedBSD/src 88cb1e1sys/compat/linuxkpi/common/src linux_80211.c

LinuxKPI: 802.11: factor out getting and setting a chanctx

Further factor out acquiring the chanctx (either set or new),
as well as populating a chanctx with information.
This further simplifies lkpi_sta_scan_to_auth() and gives us
more reusable function blocks.

Sponsored by:   The FreeBSD Foundation
MFC after;      3 days
DeltaFile
+92-56sys/compat/linuxkpi/common/src/linux_80211.c
+92-561 files

HardenedBSD/src 491f587sys/compat/linuxkpi/common/src linux_80211.c linux_80211.h

LinuxKPI: 802.11: rework lkpi_ic_set_channel()

We are called by net80211 when channel changes are happening and
we have to map this to LinuxKPI 802.11.  There are multiple cases:
(1) it is a hardware scan and net80211 still changes the channel;
    we do not need to;
(2) it is a software scan (the magic fallback case) in which case
    we let net80211 drive the scan channel and we need to keep
    a copy of the scan_chandef (see follow-up commit);
(3) no scanning but a normal channel change triggerd by net80211;
    in that case we could (should?) setup the full flags right away
    but deferred LinuxKPI logic currently handle this for us as not
    in all cases the information was fully available from net80211
    in times we would have needed it.  We only do this in order
    to handle the emulate chanctx cases but do not change the
    channel otherwise; scan_to_auth will set the correct chanctx.
(3a) we have no (active) chanctx for that, create/set one,
(3b) we do have an (active) chanctx for this, use it but reset to
     defaults.

    [3 lines not shown]
DeltaFile
+131-39sys/compat/linuxkpi/common/src/linux_80211.c
+1-0sys/compat/linuxkpi/common/src/linux_80211.h
+132-392 files

HardenedBSD/src ced6909sys/compat/linuxkpi/common/src linux_80211.h linux_80211.c

LinuxKPI: 802.11: save the default channel

Add a field to struct lkpi_hw to save the default channel for later
reuse.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
DeltaFile
+2-0sys/compat/linuxkpi/common/src/linux_80211.h
+2-0sys/compat/linuxkpi/common/src/linux_80211.c
+4-02 files

HardenedBSD/src e62c92csys/compat/linuxkpi/common/src linux_80211.c linux_80211.h

LinuxKPI: 802.11: keep chanctx on a reserved list

Keep the chanctx around as we may swap them.

In the future (11be) these lists likely need to be (a) limited to
maximum number of chanctx possible (see struct ieee80211_iface_limit),
and (b) with that also by radio.

For the moment keep this simple and start with a single chanctx
and build up from there when we get there.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
DeltaFile
+64-5sys/compat/linuxkpi/common/src/linux_80211.c
+2-0sys/compat/linuxkpi/common/src/linux_80211.h
+66-52 files