FreeBSD/src 4aea6eatests/sys/netinet tcp_socket.c

tests/sys/netinet/tcp_socket: fix build with ATF 0.22+

Confirm that creating clients/sockets was successful by testing the
result separate from the assignment and test that the return value is
not -1 instead of testing that the value returned is non-zero.

This fixes the build with [ATF 0.22+][1].

MFC after:      2 weeks
Reported by:    clang (-Wparenthesis)
Reviewed by:    tuexen, cc
Differential Revision:  https://reviews.freebsd.org/D59284
[1]: https://github.com/freebsd/atf/pull/72
DeltaFile
+8-4tests/sys/netinet/tcp_socket.c
+8-41 files

FreeBSD/src 5051032tests/sys/kern ktls_test.c

tests/sys/kern/ktls_test: fix -Wsign-compare issue

Cast the size_t quantity used in a comparison to off_t to mute a
`-Wsign-compare` complaint that now occurs after ATF 0.22 [1].

MFC after:      2 weeks
Reported by:    clang
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D59285
[1]: https://github.com/freebsd/atf/pull/72
DeltaFile
+1-1tests/sys/kern/ktls_test.c
+1-11 files

FreeBSD/src c3c6a6csys/dev/sound/usb uaudio.c

snd_uaudio: drop the default monitor level to 10%

As noted in the comment, some headsets with a hardware sidetone are
incredibly sensitive and emit immediate feedback upon attach with the
current system-wide default of 75%.  Drop it down just for snd_uaudio(4)
to avoid incredibly unpleasant surprises.

MFC after:      3 days
Reviewed by:    christos
Differential Revision:  https://reviews.freebsd.org/D59199
DeltaFile
+9-0sys/dev/sound/usb/uaudio.c
+9-01 files

FreeBSD/src c45bdb3etc/mtree BSD.var.dist, libexec/rc rc.conf

rc: add a backlight service to save/restore backlight levels

The default on my laptop is annoyingly bright, and this is a useful
feature to mitigate that.  The backlight script is largely a copy of the
mixer service which provides the same value for mixers, but this one is
specifically dependant on kld to allow DRM drivers a chance to attach.

Note that it's off by default to avoid interference with DEs, and
document the capability in backlight(8).  Set backlight_enable=YES in
rc.conf(5) to enable save/restore.

Relnotes:       maybe
Reviewed by:    bapt, ivy, manu, ziaee
Differential Revision:  https://reviews.freebsd.org/D59296
DeltaFile
+88-0libexec/rc/rc.d/backlight
+10-1usr.bin/backlight/backlight.8
+6-1share/man/man5/rc.conf.5
+2-0etc/mtree/BSD.var.dist
+1-0libexec/rc/rc.d/Makefile
+1-0libexec/rc/rc.conf
+108-26 files

FreeBSD/src 9930150sys/dev/ufshci ufshci_ctrlr.c

ufshci: skip the reinit when the new link works

UFSHCI_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH always rebuilt the
link after the gear switch. It threw away a working HS link and
ended up in PWM. The reinit is only needed for a dead link.
There the local side reports HS and the peer never answers. A
local readback cannot tell the two apart. Peer traffic can.

Probe the peer with DME_PEER_GET after the switch. Skip the
reinit when the probe succeeds. Log it when the probe fails.

Reviewed by:            imp (mentor)
Sponsored by:           Samsung Electronics
Differential Revision:  https://reviews.freebsd.org/D59299
DeltaFile
+19-4sys/dev/ufshci/ufshci_ctrlr.c
+19-41 files

FreeBSD/src c09daa3sys/dev/ufshci ufshci_private.h ufshci.h

ufshci: set HS series per platform and adapt type per gear

The driver always asked for Rate-B. It never set the adaptation
type. The Snapdragon X Elite firmware tunes the PHY for Rate-A.
A Rate-B link dies at every gear there. HS-G4 and above need
initial adaptation. This is a UniPro rule. It applies to
every host.

Add an hs_series field to the device tables. Use Rate-A on the
Snapdragon X Elite. Keep Rate-B on the PCI hosts. A table entry
without an HS series fails to attach. Set PA_TxHsAdaptType to
initial adaptation at HS-G4 and above. Leave it alone below
that. Hosts before UniPro 1.8 do not have it. The Galaxy Book
4 Edge now links at HS-G5 Rate-A.

fio results (128k sequential, 4k random, posixaio):

QD  | SEQ_R(MiB/s) | SEQ_W(MiB/s) | RND_R(kIOPS) | RND_W(kIOPS)
----+--------------+--------------+--------------+-------------

    [10 lines not shown]
DeltaFile
+7-4sys/dev/ufshci/ufshci_dev.c
+7-3sys/dev/ufshci/ufshci_pci.c
+7-2sys/dev/ufshci/ufshci_acpi.c
+7-0sys/dev/ufshci/ufshci_ctrlr.c
+4-0sys/dev/ufshci/ufshci.h
+1-0sys/dev/ufshci/ufshci_private.h
+33-96 files

FreeBSD/src 9737835sys/dev/ufshci ufshci_acpi.c ufshci_dev.c

ufshci: fix the Snapdragon X Elite reference clock

The driver's ACPI table set bRefClkFreq to 19.2 MHz. The
Snapdragon X Elite feeds the device 38.4 MHz from its CXO. The
firmware has no property for it. The device ran its PLL from
the wrong base. Every HS mode failed. PWM still worked. The
attribute is persistent. The wrong value survived reboots.

Set 38.4 MHz in the table. Read the attribute first. Write it
only when the value differs or the read fails. Log a changed
value and a failed read. Verified on the Galaxy Book 4 Edge.

Reviewed by:            imp (mentor)
Sponsored by:           Samsung Electronics
Differential Revision:  https://reviews.freebsd.org/D59297
DeltaFile
+17-0sys/dev/ufshci/ufshci_dev.c
+5-1sys/dev/ufshci/ufshci_acpi.c
+22-12 files

FreeBSD/src 4690891share/man/man4 ng_bridge.4, sys/netgraph ng_bridge.c

ng_bridge: do not move hosts from learnMac=0 hooks

ng_bridge(4) says the node does not learn MAC addresses on uplink
hooks. However, learnMac was only checked when inserting a new
host. A host already known on a link hook was still moved if a
packet with that source address arrived on an uplink hook.

The nature of this is that inbound unicast to that host then
never arrives (the destination is known on the incoming hook).
Unknown unicast after timeout is still sent only to uplink, so
the host is not re-learned. The interface stays up and outbound
may still work. This can last minutes or weeks until reboot or
NGM_BRIDGE_MOVE_HOST.

Connecting ng_ether(4) lower to an uplink hook is enough: the
host's own transmit can appear on the uplink and the table entry
moves.

Use the same learnMac test for data-path move as for insert.

    [5 lines not shown]
DeltaFile
+13-5share/man/man4/ng_bridge.4
+6-2sys/netgraph/ng_bridge.c
+19-72 files

FreeBSD/src 4aeab13tools/tools/git git-arc.sh

git-arc: SC2223 DoS-via-glob hardening

Quote LOCALBASE and ARC_CMD default assignments so a poisoned
value cannot glob into :'s argv.

Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D59130
DeltaFile
+3-3tools/tools/git/git-arc.sh
+3-31 files

FreeBSD/src 6217c9ctools/tools/git git-arc.sh

git-arc: Fix locals

Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D59162
DeltaFile
+4-4tools/tools/git/git-arc.sh
+4-41 files

FreeBSD/src c8f8d00sys/kern sys_process.c

ptrace(2): allow ptrace(PT_TRACE_ME) in cap mode

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D59317
DeltaFile
+2-0sys/kern/sys_process.c
+2-01 files

FreeBSD/src 551b7c5sys/contrib/dev/rtwn rtwn-rtl8723bufw.fw.uu, sys/dev/rtwn/rtl8723b r23b_priv.h r23b_init.c

rtwn: add support for the RTL8723BU

Pushed using the RTL8723BU.

Reviewed by:    ziaee, avos, adrian
Relnotes:       yes
Differential Revision:  https://reviews.freebsd.org/D59205
DeltaFile
+717-0sys/contrib/dev/rtwn/rtwn-rtl8723bufw.fw.uu
+620-0sys/dev/rtwn/rtl8723b/r23b_calib.c
+364-0sys/dev/rtwn/rtl8723b/usb/r23bu_init.c
+235-0sys/dev/rtwn/rtl8723b/r23b_init.c
+211-0sys/dev/rtwn/rtl8723b/r23b_priv.h
+197-0sys/dev/rtwn/rtl8723b/usb/r23bu_attach.c
+2,344-022 files not shown
+3,162-428 files

FreeBSD/src b2fd2f9sys/dev/rtwn if_rtwn_rx.c

rtwn: fix typo s/rtwm/rtwn
DeltaFile
+2-2sys/dev/rtwn/if_rtwn_rx.c
+2-21 files

FreeBSD/src af25f24usr.bin/truss setup.c main.c, usr.bin/truss/tests Makefile truss_test.sh

truss: add -t to select which system calls are reported

truss reports every system call a process makes, which for anything
larger than a toy program buries the calls of interest.  Add -t, taking
a comma-separated expression naming the system calls to report.

A term is the name of a system call, which may contain the fnmatch(3)
wildcards; a system call number in decimal; or "@group" naming a group
of related system calls.  A term prefixed with '!' excludes what that
one term matches rather than including it, and applies to no other
term.  An expression whose terms are all negated subtracts from the set
of every system call; any other expression selects from an empty one.
Terms apply in order and the last one to match a system call decides
whether it is reported.  Repeating -t appends, so "-t a -t b" and
"-t a,b" are equivalent.  An empty term is ignored, so an empty
expression filters nothing and a stray comma is not an error.

    truss -t @file,@net fetch https://www.freebsd.org/
    truss -t '!@memory' make buildworld

    [60 lines not shown]
DeltaFile
+588-0usr.bin/truss/syscall_filter.c
+403-0usr.bin/truss/tests/truss_test.sh
+185-1usr.bin/truss/truss.1
+24-4usr.bin/truss/main.c
+13-3usr.bin/truss/setup.c
+8-0usr.bin/truss/tests/Makefile
+1,221-85 files not shown
+1,237-911 files

FreeBSD/src 1574ca1sys/powerpc/aim mmu_radix.c

powerpc/radix: take the pmap lock in mmu_radix_sync_icache()

mmu_radix_sync_icache() walked the page tables with an unlocked
pmap_extract() and passed the result straight to PHYS_TO_DMAP(),
checking only that it was non-zero.  Nothing keeps the mapping - or the
page table page holding it - alive across that window: if another thread
of the same process tears a mapping down concurrently, the page table
page can be freed and reused, so pmap_extract() reads arbitrary memory
and returns a bogus physical address.  __syncicache() then dereferences
an unmapped direct map address and the kernel takes a data storage
interrupt:

  fatal kernel trap:
     exception       = 0x300 (data storage interrupt)
     virtual address = 0xc003317ca6022a00
     dsisr           = 0x40000000
     srr0            = 0xc000000000f59460 (__syncicache)
     lr              = 0xc000000000f23588 (mmu_radix_sync_icache)
            pid = 23878, comm = skyframe-evaluator-

    [25 lines not shown]
DeltaFile
+2-0sys/powerpc/aim/mmu_radix.c
+2-01 files

FreeBSD/src edbb2e9lib/libarchive/tests Makefile

lib/libarchive/tests/Makefile: minor fixes

- Remove trailing whitespace
- Fix typo with variable referenced adding sources for `test_fuzz`.

MFC after:      2 weeks
DeltaFile
+18-17lib/libarchive/tests/Makefile
+18-171 files

FreeBSD/src 5319035sys/dev/tpm tpm.c

tpm: Move user copies outside the TPM 1.2 lock

The character-device paths held the transaction and lifecycle lock while
uiomove() accessed user memory.  A user page fault could therefore delay
suspend or detach, and a copyout failure occurred while the TPM response
was still active.

Copy commands into the bounded stack buffer before taking the lock.  For
reads, validate the response header, buffer the complete response while
the lock is held, finish the TPM transaction, and copy it to userspace
after unlocking.  Use a non-blocking allocation so memory pressure
cannot turn response buffering into another lifecycle wait.

NetBSD uses the same separation but limits responses to its fixed 1 KiB
buffer.  Allocate the TPM-advertised response length to preserve the
existing FreeBSD support for larger streamed responses.

On a ThinkPad T440p with an STMicro TPM 1.2, a PCR read into a 4 KiB
userspace buffer returned the expected 30-byte response.  A deliberately

    [7 lines not shown]
DeltaFile
+42-29sys/dev/tpm/tpm.c
+42-291 files

FreeBSD/src 4e0f283sys/dev/tpm tpmvar.h tpm.c

tpm: Bound TPM 1.2 locality ownership

A TIS locality must remain active while a command is in flight, but
should be relinquished once the command completes or is abandoned.  The
driver retained locality zero after probe, initialization, and resume,
and several transaction error paths returned without releasing it.
Closing the device after writing a command without reading its response
had the same effect.

Track locality ownership and whether a command is awaiting its response.
Release locality after probe, initialization, and resume; retain it only
across a successful command write and its matching response read.  Abort
and release on errors, replacement commands, close, and detach.

Wait for locality during ISA probe instead of assuming an immediate
grant, release locality acquired by the probe, and stop treating the
command-style TPM_ACCESS register as restorable state.

On a ThinkPad T440p with an STMicro TPM 1.2, the old driver left

    [9 lines not shown]
DeltaFile
+132-39sys/dev/tpm/tpm.c
+2-0sys/dev/tpm/tpmvar.h
+134-392 files

FreeBSD/src 799e14asys/dev/tpm tpmvar.h tpm.c

tpm: Remove Giant from the TPM 1.2 driver

Serialize TPM 1.2 commands, character-device methods, and power
transitions with an sx lock, following the command ownership model used
by the TPM 2.0 driver.  Reject new operations once detach starts and
drain the character device before releasing transport resources.

Giant also closed the interrupt race between the final TIS status check
and tsleep.  Replace that implicit dependency with a mutex and condition
variable, use an absolute deadline across unrelated wakeups, and make
the interrupt handler MPSAFE.

Create the device node atomically with its softc and finish failed write
transactions so every command path releases its transport state.

The polling path was validated on ThinkPad T430 and T440p systems with
their STMicro TPM 1.2 devices enabled.  Exclusive-open behavior, 100
consecutive PCR reads, and module unload and reload completed without
errors on both systems.  Two consecutive S3 cycles on each system

    [7 lines not shown]
DeltaFile
+251-148sys/dev/tpm/tpm.c
+12-0sys/dev/tpm/tpmvar.h
+263-1482 files

FreeBSD/src 96ed600sys/dev/tpm tpm.c

tpm: Restore TPM 1.2 TIS state after resume

Firmware restores the state saved by TPM_ORD_SaveState, but the TIS
interrupt, locality, and command FIFO state are not guaranteed to
survive S3.  The legacy driver previously treated resume as a no-op.

Revalidate the interface and device identity, disable and acknowledge
stale interrupts, restore the configured interrupt vector, reacquire
locality zero, and return the FIFO to command-ready state.  Also disable
TIS interrupts during initial setup when the device uses polling so
firmware settings cannot leave an unhandled interrupt enabled.

TIS 1.3 Table 22 makes the interrupt control registers locality
protected.  Acquire locality before disabling or programming them during
initial setup and resume rather than relying on probe retaining
locality.

Keep TPM self-test outside the resume critical path.  It can take
minutes on some TPM 1.2 devices and is not required to restore the

    [17 lines not shown]
DeltaFile
+72-23sys/dev/tpm/tpm.c
+72-231 files

FreeBSD/src c0356f4sys/dev/tpm tpm.c

tpm: Correct the TPM 1.2 suspend transaction

The legacy driver wrote TPM_ORD_SaveState directly to the command
FIFO, but used ordinal 156 instead of the TPM 1.2 ordinal 152 and
never completed the transaction through the transport start and end
methods.  On a TIS device this omitted TPM_STS_GO, and the response
read used the header length as flags instead of requesting the complete
parameter size.  The legacy Atmel reader would also dereference the
null byte-count pointer.

Send the header-only command through the normal transport lifecycle,
validate the response header and TPM result, and retry TPM_WARN_RETRY
for a bounded five seconds.  Fail suspend rather than enter S3 after
an unsuccessful state save.

This follows the TPM 1.2 SaveState command definition and the bounded
retry policy used by other TPM 1.2 implementations.

The stock driver failed to resume a ThinkPad T440p with its STMicro

    [10 lines not shown]
DeltaFile
+80-13sys/dev/tpm/tpm.c
+80-131 files

FreeBSD/src 03a1971sys/geom/eli g_eli.c

geli: report stripesize/stripeoffset when applicable
DeltaFile
+7-0sys/geom/eli/g_eli.c
+7-01 files

FreeBSD/src cc352a8sys/fs/nfsclient nfs_clvfsops.c

nfs_clvfsops.c: Fix the non-VIMAGE build

The OFED code checks for a vnet argument, but it is
is not defined.

Reported by:    glebius
MFC after:      3 months
Fixes:  884ee8d6c9b4 ("nfscl: Add some glue for client side NFS over RDMA")
DeltaFile
+4-0sys/fs/nfsclient/nfs_clvfsops.c
+4-01 files

FreeBSD/src f73fe9asys/geom/linux_lvm g_linux_lvm.c

geom_linux_lvm: Add BIO_FLUSH support
DeltaFile
+46-4sys/geom/linux_lvm/g_linux_lvm.c
+46-41 files

FreeBSD/src 68a4a53stand/man loader.kboot.8

loader.kboot.8: Use right headers

Uggg, copied this instead of using the new style.

Sponsored by:           Netflix
DeltaFile
+1-21stand/man/loader.kboot.8
+1-211 files

FreeBSD/src a0d5b13stand/man Makefile loader.kboot.8

loader.kboot: Add man page

Sponsored by:           Netflix
DeltaFile
+162-0stand/man/loader.kboot.8
+1-0stand/man/Makefile
+163-02 files

FreeBSD/src b557839sys/geom/virstor g_virstor.h g_virstor.c

gvirstor: Modernize the I/O path

 - Add unmapped I/O support.  The only case when the code needs data
access is BIO_READ returning zeroes for unallocated space.
 - Add BIO_FLUSH support.  Just send it to all allocated components.
 - Add BIO_DELETE support.  While current design does not allow
freeing allocated blocks, at least pass it to underlying providers.
 - Add direct I/O completion support.
 - Add rotation rate reporting.
 - Fix few minor issues.
DeltaFile
+267-55sys/geom/virstor/g_virstor.c
+3-0sys/geom/virstor/g_virstor.h
+270-552 files

FreeBSD/src 1b8ccb0. ObsoleteFiles.inc, lib/lib9p Makefile

lib9p: Make it a private library

lib9p was imported to add a 9p server to bhyve (and I believe this was
the original motivation for writing it in the first place).  Its
external interfaces are kind of strange (from first-hand experience
using it to implement an inetd-based 9p server) and undocumented.
Moreover, upstream has been inactive for over five years.

I suspect there are no third-party consumers.  Let's make it a private
library for now, so as to make it easier to rework external interfaces.
If we get more code written against it, symbol versioning, and some
documentation, we can revisit this decision.

PR:             297499
Reviewed by:    jhb, emaste
Differential Revision:  https://reviews.freebsd.org/D58828
DeltaFile
+3-0ObsoleteFiles.inc
+1-1share/mk/src.libnames.mk
+1-0lib/lib9p/Makefile
+5-13 files

FreeBSD/src 6785497contrib/diff/src diff3.c, gnu/usr.bin/diff3 Makefile

diff3: Use a format string to quiet a compiler warning

And bump WARNS to 2

(cherry picked from commit fd52a9becc62f721ad6a61c7301559afaedee010)
(cherry picked from commit 61c2141f50e689f835d0f2c15a98930c66ec917c)
DeltaFile
+1-1gnu/usr.bin/diff3/Makefile
+1-1contrib/diff/src/diff3.c
+2-22 files

FreeBSD/src f41d835sys/fs/nfsclient nfs_clrpcops.c, sys/rpc rpc_generic.c

nfsclient: Fix problems with the NFS over RDMA glue

There were a couple of problems detected w.r.t. the
"glue" for the nfsclrdma.ko module.
- When the NFS server has a small reply for a read,
  it can choose to not use the reduction chunk
  (separate memory area for the read data).  I did
  not realize this was the case.
- There was a bug in rpc_copy_uio_pages() function
  that caused intermittent crashes in memcpy().

This patch fixes the above cases.  It uses M_PROTO6
to mark that an RPC reply has used a reduction chunk,
so that read can handle it correctly.  Read also now
provides a reduction chunk for all read sizes, since
the worst case for the rest of the read RPC reply is
close to the 1024 byte limit.  (NFSv4 uses strings
instead of uid/gid in the attributes and these name
strings can be rather large.)

    [12 lines not shown]
DeltaFile
+49-35sys/rpc/rpc_generic.c
+46-12sys/fs/nfsclient/nfs_clrpcops.c
+95-472 files