FreeBSD/src 9a9f93bsys/compat/linux linux_misc.c

compat/linux: Avoid waitid() kernel stack disclosure

Reported by:    Adam Crosser, Praetorian
Reviewed by:    philip
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55812
DeltaFile
+1-0sys/compat/linux/linux_misc.c
+1-01 files

FreeBSD/src 097cb4esys/compat/freebsd32 freebsd32_misc.c

compat32: Zero struct to avoid stack disclosure

Reported by:    Adam Crosser, Praetorian
Reviewed by:    philip
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55811
DeltaFile
+1-1sys/compat/freebsd32/freebsd32_misc.c
+1-11 files

FreeBSD/src 4c72e5cusr.bin/calendar/calendars calendar.freebsd

calendar.freebsd: add myself (khorben@)

This adds my date and place of birth to FreeBSD's calendar file, so I
can let the system(tm) remind me when that counter increments.

Confirmed to be working with the following command:

```
$ calendar -f usr.bin/calendar/calendars/calendar.freebsd -t 18.08
Aug 18  Pierre Pronchery <khorben at FreeBSD.org> born in Nantes, France, 1982
[...]
```

Reviewed by:    philip (mentor)
Approved by:    philip (mentor)
Differential Revision:  https://reviews.freebsd.org/D55825
DeltaFile
+1-0usr.bin/calendar/calendars/calendar.freebsd
+1-01 files

FreeBSD/src 041e9ebsys/netinet in_pcb.h

inpcb: overhaul in_pcb.h

Pull up all user-visible stuff to the top of the file and isolate the
rest under _KERNEL.  The user visible parts are:
- struct in_conninfo
- struct xinpcb
- defines for inp_flags bits, that are shared between xinpcb and inpcb

PR:     293493
DeltaFile
+231-246sys/netinet/in_pcb.h
+231-2461 files

FreeBSD/src 0f1aa45sys/net debugnet_inet.c

debugnet: don't include udp_var.h

The module constructs UDP packets, but doesn't use the UDP stack.
DeltaFile
+0-1sys/net/debugnet_inet.c
+0-11 files

FreeBSD/src ac5ff28sys/dev/sound/pcm feeder_volume.c

sound: enforce MASTER volume mute during playback

MASTER mute (vol.mute) works while audio is playing. However, if a
stream is stopped and restarted (PCMTRIG_STOP -> PCMTRIG_START), the
audio will resume even though the mixer shows the MASTER volume as
muted. Other streams that are already playing remain silent. New streams
may also start playing audio regardless of the MASTER mute state.

The volume feeder now considers the MASTER mute when determining whether
a channel should be muted. This ensures MASTER mute is consistently
enforced for all streams and removes the dependency on trigger-driven
state propagation.

Tested with Creative Labs CA0132 card.

MFC after:      1 week
Reviewed by:    christos
Differential Revision:  https://reviews.freebsd.org/D55605
DeltaFile
+10-1sys/dev/sound/pcm/feeder_volume.c
+10-11 files

FreeBSD/src c0462c2sys/netinet/tcp_stacks sack_filter.c

tcp: make sack_filter.c compilable without _WANT_TCPCB

This file can be compiled as a standalone program for debugging purposes.
Achieve that without exposing hack from tcp_var.h that is destined for
removal.
DeltaFile
+15-14sys/netinet/tcp_stacks/sack_filter.c
+15-141 files

FreeBSD/src 815ef05sys/netinet tcp_var.h in_pcb.h, sys/netinet/cc cc.h

netinet: remove _WANT_INPCB and _WANT_TCPCB

These were hacks since FreeBSD 12 that provided some transition period for
utilities to migrate from reading kernel memory via kvm(3) to sysctl(3)
based APIs.  The transition period is over.
DeltaFile
+4-4sys/netinet/cc/cc.h
+2-2sys/netinet/tcp_var.h
+1-1sys/netinet/in_pcb.h
+7-73 files

FreeBSD/src 985ac74usr.bin/systat netstat.c systat.h

systat: remove kvm(3) support for -netstat mode

The kvm(3) mode was actually non-functional since FreeBSD 8 for kernels
with VIMAGE, since FreeBSD 12 for the GENERIC kernel and since FreeBSD 14
for all kernels.  The reason for that is that systat(1) tried to lookup
symbol "tcb" to check if kvm(3) is working.  The symbol no longer exist in
the kernel.

A side effect was that systat(1) lost true kvm(3) support for all other
modes, e.g. -swap or -pigs.  The tool was still working, but libkvm was
just a shim to sysctl(3) API.

So, contrary to what the header line says, this change actually restores
the kvm(3) support for other modes.  Now we read the "allproc" symbol.

This was the last tool that abused _WANT_INPCB.
DeltaFile
+11-121usr.bin/systat/netstat.c
+0-11usr.bin/systat/systat.h
+3-2usr.bin/systat/main.c
+0-2usr.bin/systat/extern.h
+14-1364 files

FreeBSD/src a68e3a8sys/net pfvar.h, sys/sys systm.h

systm.h: don't declare socket and inpcb globally
DeltaFile
+0-2sys/sys/systm.h
+1-0sys/net/pfvar.h
+1-22 files

FreeBSD/src 72472e5sbin/ifconfig carp.c, share/man/man4 carp.4

carp: retire ioctl(2) API

All supported stable branches use netlink(4) API to configure carp(4).
The deleted code also has kernel stack leak vulnerability, that requires
extra effort to fix.

Reviewed by:            pouria, kp
Differential Revision:  https://reviews.freebsd.org/D55804
DeltaFile
+122-315sys/netinet/ip_carp.c
+0-15sys/netinet/ip_carp.h
+3-9share/man/man4/carp.4
+0-10sys/net/if.c
+7-2sbin/ifconfig/carp.c
+1-1sys/sys/param.h
+133-3526 files

FreeBSD/src 7e68af7sys/fs/fuse fuse_node.h fuse_node.c, tests/sys/fs/fusefs read.cc rename.cc

fusefs: redo vnode attribute locking

Previously most fields in fuse_vnode_data were protected by the vnode
lock.  But because DEBUG_VFS_LOCKS was never enabled by default until
stable/15 the assertions were never checked, and many were wrong.
Others were missing.  This led to panics in stable/15 and 16.0-CURRENT,
when a vnode was expected to be exclusively locked but wasn't, for fuse
file systems that mount with "-o async".

In some places it isn't possible to exclusively lock the vnode when
accessing these fields.  So protect them with a new mutex instead.  This
fixes panics and unprotected field accesses in VOP_READ,
VOP_COPY_FILE_RANGE, VOP_GETATTR, VOP_BMAP, and FUSE_NOTIFY_INVAL_ENTRY.
Add assertions everywhere the protected fields are accessed.

Lock the vnode exclusively when handling FUSE_NOTIFY_INVAL_INODE.

During fuse_vnode_setsize, if the vnode isn't already exclusively
locked, use the vn_delayed_setsize mechanism.  This fixes panics during

    [13 lines not shown]
DeltaFile
+192-0tests/sys/fs/fusefs/read.cc
+80-11sys/fs/fuse/fuse_node.h
+90-0tests/sys/fs/fusefs/rename.cc
+71-18sys/fs/fuse/fuse_node.c
+74-7sys/fs/fuse/fuse_vnops.c
+24-18sys/fs/fuse/fuse_internal.c
+531-545 files not shown
+609-7911 files

FreeBSD/src ce9aff8sys/dev/hwpmc hwpmc_amd.c

hwpmc_amd: fix amd_get_msr() MSR offset for newer counter bases

The previous code subtracted AMD_PMC_PERFCTR_0 (0xC0010004) from all
perfctr MSR addresses to compute a relative offset. This is incorrect
for counters using AMD_PMC_CORE_BASE (0xC0010200), AMD_PMC_L3_BASE
(0xC0010230), and AMD_PMC_DF_BASE (0xC0010240), producing wrong offsets.

Fix by promoting amd_core_npmcs, amd_l3_npmcs, and amd_df_npmcs to
static module-level variables and computing the correct flat RDPMC
index per AMD BKDG 24594 page 440:

ECX 0-5:   Core counters 0-5
ECX 6-9:   DF counters 0-3
ECX 10-15: L3 Cache counters 0-5
ECX 16-27: DF counters 4-15
ECX > 27:  Reserved, returns EINVAL

Reviewed by:    Ali Mashtizadeh <ali at mashtizadeh.com>, mhorne
Sponsored by:   NLINK (https://nlink.com.br), Recife, Brazil

    [2 lines not shown]
DeltaFile
+33-3sys/dev/hwpmc/hwpmc_amd.c
+33-31 files

FreeBSD/src 25cc459sys/kern uipc_shm.c

shm: Zero struct kinfo_file in sysctl handler

Reported by: Calif.io in collaboration with Claude and Anthropic Research
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55806
DeltaFile
+1-1sys/kern/uipc_shm.c
+1-11 files

FreeBSD/src a2b2ce2share/man/man9 DEFINE_IFUNC.9

DEFINE_IFUNC.9: update NOTES

ifuncs are now implemented for all architectures, so drop the caveat
statement.

Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D55815
DeltaFile
+3-4share/man/man9/DEFINE_IFUNC.9
+3-41 files

FreeBSD/src d74dfe0sbin/camcontrol camcontrol.c

camcontrol: Add SPDX-License-Identifier tag

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55269

(cherry picked from commit 25ed5ee654a8cd7d9f694307c62bb84ff4d16866)
DeltaFile
+2-0sbin/camcontrol/camcontrol.c
+2-01 files

FreeBSD/src b1d4b83sbin/camcontrol camcontrol.c

camcontrol: Print 'transport revision'

As described in Serial ATA Revision 3.5a

Reviewed by:    mav
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2044

(cherry picked from commit f4f9054dc47b430872d38c7a75fea753c6fe796f)
DeltaFile
+29-0sbin/camcontrol/camcontrol.c
+29-01 files

FreeBSD/src 5f0ab9dsys/amd64/amd64 mp_machdep.c, sys/amd64/include smp.h

amd64: Make start_all_aps() static

It is not used elsewhere since the change [1].

[1] ac3ede5371af x86/xen: remove PVHv1 code

MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D55668
DeltaFile
+2-1sys/amd64/amd64/mp_machdep.c
+0-1sys/amd64/include/smp.h
+2-22 files

FreeBSD/src 2a3d650. Makefile.inc1

packages: Don't create empty packages

If a package plist only contains directories, but no files, do not
create the package.

This fixes an issue where setting "package=foo" in mtree causes the
"foo" package to always be created, even if nothing else installs in
that package, because the mtree entry is always added to the plist.

This most often happens:

* With architecture-specific directories, because mtree can't install
  a directory conditionally based on architecture, and

* With packages that are completely empty when a particular src.conf
  knob is disabled, because mtree will still create the directories.

Although it's theoretically possible that we might want to create a
package that only contains directories, there are no such packages

    [8 lines not shown]
DeltaFile
+18-11Makefile.inc1
+18-111 files

FreeBSD/src 1346ffb. Makefile.inc1

Makefile.inc1: Remove svn support

We don't need this, and we don't use this. It's left over from the svn
days. We stopped supporting svn as a project entirely when 12.x went
EOL. And VCS_REVSION isn't in any current ucl file or anywhere else in
the tree.

Sponsored by:           Netflix
Reviewed by     :       kevans, brd
Differential Revision:  https://reviews.freebsd.org/D52912

(cherry picked from commit 28b858f5059c8b25fa08be494699997000fce58c)

Makefile.inc1: Add back missing if

The .if defined(_MKSHOWCONFIG) covered an unusually large area, so it
should have not been removed in the last commit. I must have tested in
the wrong tree before pushing...


    [4 lines not shown]
DeltaFile
+1-22Makefile.inc1
+1-221 files

FreeBSD/src a8b1531sys/cam cam_xpt.c

cam: Add comment about routine

Explain why we bump ref counts here.

Sponsored by:           Netflix
DeltaFile
+4-0sys/cam/cam_xpt.c
+4-01 files

FreeBSD/src 5f55c59lib/libmt mtlib.c, usr.bin/mt mt.1

mt(1)/libmt: Add LTO-10 density codes and specs.

These were obtained from IBM specs and actual tapes/drives.

Standard LTO-10 cartriges hold 30TB raw, 75TB with 2.5:1 compression.
Premium LTO-10 cartridges hold 40TB raw, 100TB with 2.5:1 compression.
LTO-10 tape drives are not backward compatible with previous generation
LTO tapes. (This is a change from older generation drives.)

Since the Premium tape is a new thing for LTO, we'll call this density
code LTO-10P vs. the standard LTO-10.  The barcode identifier for LTO-10
tapes is "LA"; the barcode identifier for LTO-10P tapes is "PA".

LTO-10 cartridges contain 1035m of tape, while LTO-10 Premium
cartridges contain 1337m of tape and have slightly higher density.
(Obtained from MAM data on actual tape cartridges and the density
report, obtained via 'mt getdensity'.)  LTO-10 cartridges use a
polyethylene naphthalate (PEN) film substrate. LTO-10 Premium
cartridges use an Aramid (aromatic polyamide) substrate that is thinner

    [12 lines not shown]
DeltaFile
+8-1usr.bin/mt/mt.1
+2-0lib/libmt/mtlib.c
+10-12 files

FreeBSD/src 7fe98eelib/libmt mtlib.c, usr.bin/mt mt.1

mt(1)/libmt: Add LTO-10 density codes and specs.

These were obtained from IBM specs and actual tapes/drives.

Standard LTO-10 cartriges hold 30TB raw, 75TB with 2.5:1 compression.
Premium LTO-10 cartridges hold 40TB raw, 100TB with 2.5:1 compression.
LTO-10 tape drives are not backward compatible with previous generation
LTO tapes. (This is a change from older generation drives.)

Since the Premium tape is a new thing for LTO, we'll call this density
code LTO-10P vs. the standard LTO-10.  The barcode identifier for LTO-10
tapes is "LA"; the barcode identifier for LTO-10P tapes is "PA".

LTO-10 cartridges contain 1035m of tape, while LTO-10 Premium
cartridges contain 1337m of tape and have slightly higher density.
(Obtained from MAM data on actual tape cartridges and the density
report, obtained via 'mt getdensity'.)  LTO-10 cartridges use a
polyethylene naphthalate (PEN) film substrate. LTO-10 Premium
cartridges use an Aramid (aromatic polyamide) substrate that is thinner

    [12 lines not shown]
DeltaFile
+8-1usr.bin/mt/mt.1
+2-0lib/libmt/mtlib.c
+10-12 files

FreeBSD/src b373cf4krb5/include autoconf.h

krb5: Include <features.h> on Linux so __GLIBC__ can be checked

__GLIBC__ is not pre-defined by the toolchain, it comes from features.h,
so we need to make sure that's included by this point.

Fixes:  4dd2b869cd07 ("krb5: Fix -Wint-conversion when bootstrapping on GNU/Linux")
(cherry picked from commit 34e7a57673c9730ee5d1f7ebb07e152567bd8e0b)
DeltaFile
+3-0krb5/include/autoconf.h
+3-01 files

FreeBSD/src fdddd00krb5/include autoconf.h

krb5: Fix -Wint-conversion when bootstrapping on GNU/Linux

This shows up in GitHub Actions as a warning, and some compilers can
default to it being an error.

(cherry picked from commit 4dd2b869cd078ed6f40c42d1ef429222da16a58f)
DeltaFile
+5-0krb5/include/autoconf.h
+5-01 files

FreeBSD/src 4c7dbe9sys/dev/usb/quirk usb_quirk.c, sys/dev/usb/storage umass.c

usb: umass: add SCSIEJECT quirk and fix RTW8821CU_CD (USB mode switch)

Several Realtek (and lots other) USB dongles present themselves as
CDROM device first.  Upon eject they do a mode switch and suddenly
are a different kind of device (sometimes even with different IDs),
e.g., a wireless dongle.

In order to avoid the CDROM stage and rather than adding the quirk
handling to more drivers, add support to umass and if enabled
automatically eject the "CDROM" to make it the real device.

Longer-term some other drivers could stop using their hand-rolled
support for this.  It is unclear as-to how much we need the list of
(eject) quirks from u3g here, or if these are very specific to that
kind of devices.

Sponsored by:   The FreeBSD Foundation
Fixes:          b3b6a959c85a, 9c0cce328363
Reviewed by:    imp

    [3 lines not shown]
DeltaFile
+56-1sys/dev/usb/storage/umass.c
+1-1sys/dev/usb/quirk/usb_quirk.c
+57-22 files

FreeBSD/src 86417d5sys/compat/linuxkpi/common/src linux_80211.c

LinuxKPI: 802.11: lkpi_sta_auth_to_scan() fail graciously on lsta == NULL

Usually after a firmware crash, we see reports of crashes in
lkpi_sta_auth_to_scan().  One of the last ones was in the PR
mentioned below.

These crashes are often attributed as the problem while the real
problem happened before.

At this point try avoid the NULL pointer and to fail graciously if
lvif->iv_bss (lsta) is no longer set.  This way users have a chance
to possibly recover using netif restart wlan0 rather than dealing
with a panic.

See if this helps us to better track down the original problems
rather than the follow-up crash.

On a debug kernel the KASSERT should normally have caught that
condition as well but we see panics on page faults were the log

    [8 lines not shown]
DeltaFile
+19-7sys/compat/linuxkpi/common/src/linux_80211.c
+19-71 files

FreeBSD/src 68fcf0bsys/net80211 ieee80211_ht.c

net80211: fix VHT160/80P80/80 chanwidth selection in the "40-" case

Depending on the base channel ni_vht_chan2 - ni_vht_chan1 can be
negative.  Apply abs() as indicated in the comments right above
        | CCFS1 - CCFS0 | = 8  or > 16
in order to fix the channel width selection.

Sponsored by:   The FreeBSD Foundation
PR:             293645
Fixes:          4bf049bfeefd9
Reviewed by:    adrian
Differential Revision: https://reviews.freebsd.org/D55717

(cherry picked from commit 6cfd2b93e68061c7831016b91c2e308d01658764)
DeltaFile
+3-2sys/net80211/ieee80211_ht.c
+3-21 files

FreeBSD/src 9450995share/dict web2

share/dict/web2: Sort

PR: 293659
Fixes: e49b6ead4114 ("Add a number of five letter words to the dictionary")
(cherry picked from commit 72f0bc868bf00586cba1e50057d8f1998b4abe80)
DeltaFile
+2-2share/dict/web2
+2-21 files

FreeBSD/src b9c0e0csys/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.


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