FreeBSD/src 7ca0c1erelease/tools vmimage.subr

vmimage.subr: Use makefs -N

By default, makefs uses the host environment's user and group databases
when creating filesystems.  This causes makefs to fail when trying to
create files owned by users or groups which don't exist in the host
environment, for example when creating a VM with packages pre-installed
which added their own users/groups.

Pass "-N ${DESTDIR}/etc" to makefs to point it at the user and group
databases from the image being created.

MFC after:      1 week
Sponsored by:   Amazon
DeltaFile
+1-1release/tools/vmimage.subr
+1-11 files

FreeBSD/src c85a253release/tools oci-image-runtime.conf

oci: Install FreeBSD-pam in the runtime image

In 16.0/15.1, the PAM modules were split from FreeBSD-runtime into a
new FreeBSD-pam package.  FreeBSD-runtime does not install FreeBSD-pam,
which means if a user starts from runtime, then installs sshd, sshd will
fail to authenticate users because of missing PAM modules.

Since FreeBSD-pam is relatively small (about 230kB on amd64), and is
already part of FreeBSD-set-minimal, add it to the runtime image as
well.  Users who absolutely don't want this can still build their
own images without it.

MFC after:      1 week
Reviewed by:    dfr
Reported by:    Michael Johnson <ahze at ahze.net>
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59194
DeltaFile
+1-0release/tools/oci-image-runtime.conf
+1-01 files

FreeBSD/src 8fab8b3tests/sys/netpfil/common rdr.sh

tests/netpfil: xfail ipfnat_local_redirect testcase

PR:             296944
Reviewed by:    cy
MFC after:      3 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
DeltaFile
+2-0tests/sys/netpfil/common/rdr.sh
+2-01 files

FreeBSD/src 064d190lib/libarchive/tests Makefile

[tests] libarchive: mark `test_read_filter_lz4_raw_skip` broken

This test has not passed since 185becb1e1bd2657c156f78aeb52edac05ba5fb5
(the libarchive 3.8.9 upgrade).

PR:             273732
MFC after:      1 week
Reviewed by:    siva
Differential Revision:  https://reviews.freebsd.org/D59314
DeltaFile
+6-1lib/libarchive/tests/Makefile
+6-11 files

FreeBSD/src 1a669b6usr.sbin/syslogd syslogd.c

syslogd: reap pipe children on config reload

On SIGHUP reload, closelogfiles() frees each F_PIPE filed even when its
pipe process is still running.  close_filed() sets f_type to F_UNUSED
before the check, so the condition f_type != F_PIPE is always true and
the filed is freed while its process descriptor is still on the dead
queue and registered in the kqueue.  When the child later exits, the
NOTE_EXIT handler dereferences the freed filed (use-after-free) and
never closes the process descriptor, leaving the pipe child as a
persistent zombie.

Capture whether the filed is a pipe with an active process descriptor
before calling close_filed(), and defer the free in that case so the
NOTE_EXIT handler can reap the child and free the filed.

Reviewed by:    markj
Fixes:  95381c0139d6 (syslogd: Use process descriptors)
Differential Revision:  https://reviews.freebsd.org/D59319
DeltaFile
+9-5usr.sbin/syslogd/syslogd.c
+9-51 files

FreeBSD/src ab420c4sys/arm/include _inttypes.h, sys/arm64/include _inttypes.h

libc: Add PRIb*, PRIB*, and SCNb* macros as per C23

Reviewed by:    fuz
Approved by:    fuz (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D59293
DeltaFile
+45-0sys/x86/include/_inttypes.h
+45-0sys/riscv/include/_inttypes.h
+45-0sys/powerpc/include/_inttypes.h
+45-0sys/arm64/include/_inttypes.h
+45-0sys/arm/include/_inttypes.h
+225-05 files

FreeBSD/src 1db0c9fsys/dev/hwpmc hwpmc_x86.c

hwpmc(4): stop overwalking past _start on amd64 user callchains

pmc_save_user_callchain() emits the pc it just loaded before checking
whether fp is the ABI's zero frame-chain terminator. At the bottom of
a well-formed chain under _start, fp comes back 0 as expected, but the
paired pc is stale rtld data left on the stack -- a legal userspace VA
that still passes PMC_IN_USERSPACE(), so it gets emitted as a bogus
extra frame. This shows up in flame graphs as a spurious hex-valued
root frame below _start.

Check fp == 0 alongside the existing checks before emitting, matching
how arm/arm64/powerpc already load the next fp before their check.

Measured via 1kHz hwpmc sampling on an OCA: stacks with any unresolved
hex frame drop from 23.9% to 1.3%, and stacks with hex at the root drop
from 5.5% to 0.3%.

Reviewed by:    mhorne, Ali Mashtizadeh <ali at mashtizadeh.com>, gallatin
MFC after:      3 days

    [2 lines not shown]
DeltaFile
+2-1sys/dev/hwpmc/hwpmc_x86.c
+2-11 files

FreeBSD/src b1f63c6sys/netpfil/ipfilter/netinet ip_state.c ip_fil.h

ipfilter: Avoid negative array indicies

Array indices must always be posive. We avoid this by making each index
unsigned. This mitigates out-of-bounds reads and writes.

Reported by:            Ilja Van Sprundel <ivansprundel at ioactive.com>
Reviewed by:            glebius
Differential revision:  https://reviews.freebsd.org/D55260

(cherry picked from commit 3fdbd8a07a2dcb8fe3cec19fc59ef064453e4755)
DeltaFile
+2-2sys/netpfil/ipfilter/netinet/fil.c
+1-1sys/netpfil/ipfilter/netinet/ip_state.c
+1-1sys/netpfil/ipfilter/netinet/ip_fil.h
+4-43 files

FreeBSD/src e2315cesys/netpfil/ipfilter/netinet ip_state.c ip_fil.h

ipfilter: Avoid negative array indicies

Array indices must always be posive. We avoid this by making each index
unsigned. This mitigates out-of-bounds reads and writes.

Reported by:            Ilja Van Sprundel <ivansprundel at ioactive.com>
Reviewed by:            glebius
Differential revision:  https://reviews.freebsd.org/D55260

(cherry picked from commit 3fdbd8a07a2dcb8fe3cec19fc59ef064453e4755)
DeltaFile
+2-2sys/netpfil/ipfilter/netinet/fil.c
+1-1sys/netpfil/ipfilter/netinet/ip_state.c
+1-1sys/netpfil/ipfilter/netinet/ip_fil.h
+4-43 files

FreeBSD/src 792c942share/man/man4 witness.4, sys/conf options

sys/conf/options: Add WITNESS_LOCK_CHILDCOUNT

Make the witness LOCK_CHILDCOUNT a configurable kernel option.
On machines with a very high core count the default value is too
low, leading to witness exhaustion after boot.

Relnotes:       yes
Reviewed by:    kib, ziaee
Signed-off-by:  Kajetan Puchalski <kajetan.puchalski at arm.com>
Closes:         https://github.com/freebsd/freebsd-src/pull/2398
DeltaFile
+10-4sys/kern/subr_witness.c
+13-1share/man/man4/witness.4
+1-0sys/conf/options
+24-53 files

FreeBSD/src eab989eusr.sbin/makefs/cd9660 iso9660_rrip.c

makefs: Fix build on systems without st_birthtime such as Linux

Reviewed by:    emaste
Fixes:          0a301f33306c ("makefs cd9660: Populate creation time stamps in RockRidge extensions")
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2297

(cherry picked from commit 4e57c2aa307d34ca6e44f01c6fd671734ed5e486)
DeltaFile
+5-0usr.sbin/makefs/cd9660/iso9660_rrip.c
+5-01 files

FreeBSD/src fd5a8d6usr.sbin/makefs/cd9660 iso9660_rrip.c

makefs cd9660: Populate creation time stamps in RockRidge extensions

Differential Revision:  https://reviews.freebsd.org/D57527

(cherry picked from commit 0a301f33306c07e629a2423827238aaef85f5d68)
DeltaFile
+9-4usr.sbin/makefs/cd9660/iso9660_rrip.c
+9-41 files

FreeBSD/src 7cb1a76sys/kern subr_devstat.c

devstat: Fix a kernel stack disclosure

The 16-byte "device_name" field was not zero-filled, so could contain
uninitialized stack data.  Zero the whole struct, as that's the
prevailing pattern for this kind of conversion code, and it's more
robust in the face of future revisions to struct devstat.

Reviewed by:    olce, kib
Reported by:    Reo Shiseki
Fixes:          a11d132f6c62 ("devstat: Provide 32-bit compatibility")
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59309
DeltaFile
+1-0sys/kern/subr_devstat.c
+1-01 files

FreeBSD/src de60db7sys/arm/broadcom/bcm2835 bcm2835_audio.c

bcm2835_audio: Comment out vchi_service_release()

bcm2835_audio_release() calls vchi_service_close() and then
unconditionally calls vchi_service_release() with the same service
handle.

In the VCHI shim implementation, a successful vchi_service_close() calls
service_free(service). The subsequent vchi_service_release() therefore
dereferences a freed SHIM_SERVICE_T object when it reads
service->handle, resulting in a use-after-free panic.

vchi_service_release(), however, releases a reference which might block
vchi_service_close() from completing successfuly, so comment it out
instead of removing it altogether, until further testing is done.

PR:             297187
MFC after:      2 weeks
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D58921

    [2 lines not shown]
DeltaFile
+1-1sys/arm/broadcom/bcm2835/bcm2835_audio.c
+1-11 files

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