FreeBSD/src 0432b21sys/dev/sound dummy.c

snd_dummy: Make callout stopping more robust

If the callout gets rescheduled during detach, we might access freed
pcm_channel resources in dummy_chan_io(), which will cause a panic
similar to this:

panic: ASan: Invalid access, 8-byte read at 0xfffffe00479f65d8, UMAUseAfterFree(fd)
cpuid = 1
time = 1747433047
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0xa5/frame 0xfffffe0046a8d730
kdb_backtrace() at kdb_backtrace+0xc6/frame 0xfffffe0046a8d890
vpanic() at vpanic+0x226/frame 0xfffffe0046a8da30
panic() at panic+0xb5/frame 0xfffffe0046a8db00
kasan_code_name() at kasan_code_name/frame 0xfffffe0046a8dbd0
__mtx_lock_flags() at __mtx_lock_flags+0xd3/frame 0xfffffe0046a8dcc0
chn_intr() at chn_intr+0x3d/frame 0xfffffe0046a8dce0
dummy_chan_io() at dummy_chan_io+0x9c/frame 0xfffffe0046a8dd10
softclock_call_cc() at softclock_call_cc+0x2bb/frame 0xfffffe0046a8de80

    [6 lines not shown]
DeltaFile
+15-2sys/dev/sound/dummy.c
+15-21 files

FreeBSD/src f6430bcsys/dev/sound/pcm dsp.c

sound: Terminate stream properly when closing vchans

When a channel is closed, dsp_close() either calls vchan_destroy() on vchans,
or chn_abort()/chn_flush() on primary channels. However, the problem with this
is that, when closing a vchan, we end up not terminating the stream properly.

The call sequence we are interested in is the following:

        vchan_destroy(vchan) -> chn_kill(vchan) -> chn_trigger(vchan) ->
        vchan_trigger(vchan) -> chn_notify(parent)

Even though chn_notify() contains codepaths which call chn_abort(parent),
apparently we do not execute any of those codepaths in this case, so the
DMA remains unterminated, hence why we keep seeing the primary
channel(s) being interrupted even once the application has exited:

root at freebsd:~ # sndctl interrupts
dsp0.play.0.interrupts=1139
dsp0.record.0.interrupts=0

    [106 lines not shown]
DeltaFile
+19-14sys/dev/sound/pcm/dsp.c
+19-141 files

FreeBSD/src a946852sys/dev/sound/pcm sound.c

sound: Merge pcm_sysinit() with pcm_register()

There is no need for a separate function here. No functional change
intended.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 day
Reviewed by:    adrian, markj
Differential Revision:  https://reviews.freebsd.org/D50409
DeltaFile
+29-38sys/dev/sound/pcm/sound.c
+29-381 files

FreeBSD/src 781a630sys/arm/annapurna/alpine alpine_machdep.c, sys/arm/freescale/vybrid vf_machdep.c

Restore #include <sys/devmap.h>

Partial revert https://reviews.freebsd.org/D50017
These files still use devmap_add_entry() and needs sys/devmap.h

Reviewed by: andrew
Approved by: manu (mentor)
Differential revision: https://reviews.freebsd.org/D50574
DeltaFile
+1-0sys/arm/annapurna/alpine/alpine_machdep.c
+1-0sys/arm/freescale/vybrid/vf_machdep.c
+1-0sys/arm/qualcomm/ipq4018_machdep.c
+1-0sys/arm/ti/ti_machdep.c
+4-04 files

FreeBSD/src 4607299tests/sys/netpfil/pf sctp.sh

pf tests: make sctp:related_icmp test more robust

Send more data (i.e. more than one large packet) to the SCTP server so rtr2
generates more than one ICMP error message.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+2-2tests/sys/netpfil/pf/sctp.sh
+2-21 files

FreeBSD/src dd06ff7sbin/pfctl pfctl.c

pfctl: void functions discarding ret values

Transform the following functions (which never return anything other than 0, and
whose return value is never used) to void:
  pfctl_clear_stats, pfctl_get_skip_ifaces, pfctl_check_skip_ifaces,
  pfctl_adjust_skip_ifaces, pfctl_clear_interface_flags, pfctl_flush_eth_rules,
  pfctl_flush_rules, pfctl_flush_nat, pfctl_clear_src_nodes,
  pfctl_clear_iface_states, pfctl_kill_src_nodes, pfctl_net_kill_states,
  pfctl_gateway_kill_states, pfctl_label_kill_states, pfctl_id_kill_states and
  pfctl_key_kill_states

Submitted by rain1 (thanks!) with additional credit to:
 - mikeb@ for pointing out we can void all _clear_ functions
 - ghostyy for pointing out all _kill_ functions can be voided

OK tb@, mikeb@

Obtained from:  OpenBSD, awolk <awolk at openbsd.org>, 7363dae4f9
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+33-55sbin/pfctl/pfctl.c
+33-551 files

FreeBSD/src 0ad26d4sys/net pfvar.h

pf: remove XXX from the comments marking "holes" in the ioctls

I see very very little value in these comments at all, but the XXX is just wrong
and in the way when looking for real XXXs. phessler agrees

Obtained from:  OpenBSD, henning <henning at openbsd.org>, a44a24888a
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+0-3sys/net/pfvar.h
+0-31 files

FreeBSD/src 562b1e7sbin/pfctl pfctl.c

pfctl: fix a comment

Obtained from:  OpenBSD, henning <henning at openbsd.org>, a135ce1ad3
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+1-1sbin/pfctl/pfctl.c
+1-11 files

FreeBSD/src 19fb56bcontrib/netbsd-tests/lib/libc/net/getaddrinfo t_getaddrinfo.sh, lib/libc/tests/net/getaddrinfo getaddrinfo.c

Revert "Mark several getaddrinfo tests as XFAIL"

This change was unreviewed and should not have been committed to :main.

This reverts commit 9b37d84c87e69dabc69d818aa4d2fea718bd8b74.
DeltaFile
+0-18contrib/netbsd-tests/lib/libc/net/getaddrinfo/t_getaddrinfo.sh
+0-6lib/libc/tests/net/getaddrinfo/getaddrinfo.c
+0-242 files

FreeBSD/src 5c6ad1acontrib/libarchive FREEBSD-upgrade

libarchive: update documentation for suggested `git pull`

Replace git:// with https:// . The git:// protocol URL might not be
available, depending on firewall rules, as git:// is commonly blocked by
ISPs.

MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D50470
DeltaFile
+1-1contrib/libarchive/FREEBSD-upgrade
+1-11 files

FreeBSD/src 9b37d84contrib/netbsd-tests/lib/libc/net/getaddrinfo t_getaddrinfo.sh, lib/libc/tests/net/getaddrinfo getaddrinfo.c

Mark several getaddrinfo tests as XFAIL

These tests were recently enabled on main and have failed consistently
since they were enabled.

- lib.libc.net.getaddrinfo.getaddrinfo.basic
- lib.libc.net.getaddrinfo.getaddrinfo.nofamily
- lib.libc.net.getaddrinfo.getaddrinfo_test.basic
- lib.libc.net.getaddrinfo.getaddrinfo_test.empty_servname
- lib.libc.net.getaddrinfo.getaddrinfo_test.sock_raw

Mark them as expected failures so they no longer count as failures in
Jenkins CI.

PR:             285826
MFC with:       5313457780, 0b773a94ab
DeltaFile
+18-0contrib/netbsd-tests/lib/libc/net/getaddrinfo/t_getaddrinfo.sh
+6-0lib/libc/tests/net/getaddrinfo/getaddrinfo.c
+24-02 files

FreeBSD/src 9a44577sys/net pfvar.h, sys/netpfil/pf pf.c pf_syncookies.c

pf: teach pf_build_tcp() about SACK

ok & with sashan

Obtained from:  OpenBSD, henning <henning at openbsd.org>, 01c3818b6b
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+12-2sys/netpfil/pf/pf.c
+1-1sys/net/pfvar.h
+1-1sys/netpfil/pf/pf_syncookies.c
+14-43 files

FreeBSD/src 63cc817tests/sys/netpfil/pf utils.py tcp.py

pf tests: deduplicate DelayedSend

We had a few copies of the DelayedSend class around.
Introduce a python utils file (utils.py), move DelayedSend into that and use it
in each test that wants it.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+41-0tests/sys/netpfil/pf/utils.py
+1-16tests/sys/netpfil/pf/tcp.py
+1-14tests/sys/netpfil/pf/frag6.py
+1-14tests/sys/netpfil/pf/nat64.py
+1-14tests/sys/netpfil/pf/nat66.py
+2-1tests/sys/netpfil/pf/Makefile
+47-596 files

FreeBSD/src 8801e3asbin/pfctl parse.y

pfctl: don't check np->port for NULL

It's an array, it's never NULL.

OK bluhm@

Obtained from:  OpenBSD, akfaew <akfaew at openbsd.org>, abfef119a6
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+1-1sbin/pfctl/parse.y
+1-11 files

FreeBSD/src fb7c3f0sys/netpfil/pf pf.c

pf: refactor length check in pf_pull_hdr()

Move the common length check in pf_pull_hdr() after the address
family switch.  This makes the specific calculation more obvious.
OK claudio@

Obtained from:  OpenBSD, bluhm <bluhm at openbsd.org>, 9f98372a33
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+8-13sys/netpfil/pf/pf.c
+8-131 files

FreeBSD/src d321dc9share/man/man5 pf.conf.5

pf.conf.5: better describe "!"

from michal mazurek, tweaked a bit by myself

Obtained from:  OpenBSD, jmc <jmc at openbsd.org>, 5e78806cfb
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+6-9share/man/man5/pf.conf.5
+6-91 files

FreeBSD/src ca47411sys/dev/usb/net if_mos.c

usb/if_mos.c: Fix incorrect SPDX ID

Fixes:                  718cf2ccb995 (further adoption of SPDX)
MFC after:              3 days
Reviewed by:            carlavilla, imp, mhorne
Approved by:            carlavilla, mhorne (mentors)
Differential Revision:  https://reviews.freebsd.org/D50374
DeltaFile
+2-2sys/dev/usb/net/if_mos.c
+2-21 files

FreeBSD/src 0440b3dsys/cddl/contrib/opensolaris/uts/common/dtrace dtrace.c, sys/cddl/contrib/opensolaris/uts/common/sys dtrace.h

dtrace: Add compiler barriers around updates to per-CPU flags

Otherwise there's nothing preventing reordering of memory accesses with
respect to these flags being set or cleared.  Since their most common
use is to create a section in dtrace probe context where memory faults
are intercepted by dtrace_trap(), such reordering can turn dtrace errors
into fatal exceptions.

MFC after:      2 weeks
Sponsored by:   Innovate UK
DeltaFile
+10-4sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
+2-0sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
+12-42 files

FreeBSD/src e8260f2share/man/man4 cdce.4

cdce.4: Improve HARDWARE

The cdce driver is the main USB tethering driver now that both Android
and iPhone tethering are using USB NCM. I would like to test a recent
5G hotspot to see what those are doing. Improve the HARDWARE section to
reflect this.

MFC after:              3 days
Reviewed by:            mhorne
Approved by:            mhorne (mentor)
Differential Revision:  https://reviews.freebsd.org/D50541
DeltaFile
+9-3share/man/man4/cdce.4
+9-31 files

FreeBSD/src 420e585share/man/man4 aue.4

aue.4: Improve HARDWARE, specificity, and tag spdx

+ Improve HARDWARE introductory sentence for hardware release notes.
+ Mention "Fast" ethernet in title for apropos.
+ tag SPDX

MFC after:              3 days
Reviewed by:            mhorne
Approved by:            mhorne (mentor)
Differential Revision:  https://reviews.freebsd.org/D50540
DeltaFile
+10-6share/man/man4/aue.4
+10-61 files

FreeBSD/src 7390e96share/man/man4 rtsx.4

rtsx.4: Improve hardware, add history and spdx

+ tag spdx
+ massage hardware for inclusion in hardware release notes
+ note first appeared in 13.0R

MFC after:              3 days
Reviewed by:            mhorne
Approved by:            mhorne (mentor)
Differential Revision:  https://reviews.freebsd.org/D50529
DeltaFile
+10-12share/man/man4/rtsx.4
+10-121 files

FreeBSD/src e3eae3bshare/man/man4 axge.4

axge.4: Create a HARDWARE section

For inclusion in the HW Relnotes.

MFC after:              3 days
Reviewed by:            mhorne
Approved by:            mhorne (mentor)
Differential Revision:  https://reviews.freebsd.org/D50523
DeltaFile
+17-1share/man/man4/axge.4
+17-11 files

FreeBSD/src 616bb0blib/libpam/modules/pam_xdg pam_xdg.8

pam_xdg.8: Improve usage and standards

Explain the directory created by this module,
its usage, and a bit more about the standard.

MFC after:              3 days
Reviewed by:            mhorne, manu
Approved by:            mhorne (mentor)
Differential Revision:  https://reviews.freebsd.org/D50440
DeltaFile
+14-5lib/libpam/modules/pam_xdg/pam_xdg.8
+14-51 files

FreeBSD/src 1c7f821share/man/man4 scc.4

scc.4: Improve acronyms + tag SPDX

+ tag spdx
+ remove duplicated acronym in manual title, reword for consistency
+ expand acronym in HARDWARE for HW Relnotes

MFC after:              3 days
Reviewed by:            mhorne
Approved by:            mhorne (mentor)
Differential Revision:  https://reviews.freebsd.org/D50528
DeltaFile
+5-3share/man/man4/scc.4
+5-31 files

FreeBSD/src ccfb1c5libexec/rtld-elf rtld.c

Revert "rtld: fix allocate_module_tls() variant I fallback to static allocation"

This was applying a NetBSD fix to FreeBSD. However, the original code
was correct for FreeBSD. NetBSD's obj->tlsoffset is relative to the end
of the TCB, not the TCB itself, whilst ours is relative to the TCB[1]
itself. For example, our allocate_tls uses (char *)tcb + obj->tlsoffset
for the memcpy and memset calls.

Without this reverted, for dynamically loaded shared objects, Initial
Exec accesses to TLS variables on variant I architectures (non-x86) use
the correct address, whilst General Dynamic and dlsym(3) use the
incorrect address (TLS_TCB_SIZE past the start). Note that, on arm64,
LLVM only supports TLSDESC (including LLD) and TLSDESC will use the
static resolver if the variable ends up allocated to the static TLS
block, even in the presence of dlopen(3), so only dlsym(3) shows the
discrepancy there.

Whilst here, add a comment to explain this difference to try and avoid
the same mistake being made in future.

    [10 lines not shown]
DeltaFile
+4-1libexec/rtld-elf/rtld.c
+4-11 files

FreeBSD/src 0e3dbc6lib/libc/riscv static_tls.h

libc/riscv: Fix initial exec TLS mode for dynamically loaded shared objects

The offset here is relative to the TCB, not whatever the thread pointer
points to, so as with powerpc and powerpc64 we need to account for that.
However, rather than using hard-coded offsets as they did, due to
predating machine/tls.h, we can just re-use _tcb_get().

Note that if libthr is used, and its initialiser has been called, it
will take a different path that uses _get_static_tls_base, which works
just fine on riscv (adding the offset to thr->tcb). This only affects
programs that aren't linked against libthr (or that are but manage to
dlopen before the initialiser is called, if that's even possible).

In future this code should be made MI by just reusing _tcb_get() and
checking the TLS variant (since the offset here is positive even for
variant II, where it should be subtracted), but this is a targeted fix
that makes it clear what's changing.

Reviewed by:    kib

    [3 lines not shown]
DeltaFile
+3-1lib/libc/riscv/static_tls.h
+3-11 files

FreeBSD/src 03801d4libexec/rtld-elf/riscv reloc.c

rtld-elf/riscv: Don't allocate static TLS for dynamic TLS relocations

Provided you don't run out of extra static TLS space this should work,
but it's wholly unnecessary and not how things are supposed to be done.
Only static TLS relocations should allocate static TLS.

Reviewed by:    kib
Fixes:          4b1859c0e943 ("Add support for RISC-V architecture.")
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D50563
DeltaFile
+0-17libexec/rtld-elf/riscv/reloc.c
+0-171 files

FreeBSD/src cba5d7asys/dev/atkbdc atkbd.c

atkbd: Fix first keystroke force reset

Some i8042 falsely return KBD_ACK for ECHO command which cuase the
keyboard echo test failed.
Without passing echo test, the keyboard is considered as unconfigured.

Though it is an incorrect behavior, we still regard it as a
correct to prevent the force reset (a step for configure a keyboard)
of whole keyboard when the first key interrupt reached.

Co-Authored-By: Aymeric Wibo <obiwac at freebsd.org>
Reviewed By:    wulf, obiwac, emaste
Sponsored By:   FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50498
DeltaFile
+13-1sys/dev/atkbdc/atkbd.c
+13-11 files

FreeBSD/src 87c46fasecure/caroot Makefile

caroot: Update certdata URL for GitHub switch

Mozilla has migrated its projects' source code to GitHub, update certdata URL
along with it.

Reference: https://github.com/curl/curl/pull/17321

Reviewed by:    jrm (mentor), otis (mentor), kevans
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D50575
DeltaFile
+1-1secure/caroot/Makefile
+1-11 files

FreeBSD/src a0d22d7contrib/llvm-project/libcxx/include/__locale_dir locale_base_api.h

libc++: fix compiling <locale> with -fmodules

In /usr/include/c++/v1/__locale_dir/locale_base_api.h, xlocale.h is
included without first including stdio.h and stdlib.h, which causes
functions like strtoll_l() or sscanf_l() to not be declared.

When compiling with -fmodules, locale_base_api.h is processed separately
due to a declaration in /usr/include/c++/v1/module.modulemap, and this
will cause errors due to the above undeclared symbols.

Meanwhile, upstream has substantially reorganized this part of libc++'s
headers, so apply a minimalistic workaround: specifically when compiling
with -fmodules, add includes of stdio.h and stdlib.h.

PR:             286342
Approved by:    re (cperciva)
MFC after:      1 week

(cherry picked from commit c809b0184d0a6543bc5327d4252fa56a07ce4689)
(cherry picked from commit cab029073dc6cb5814df44556e585b8fdb1c9846)
DeltaFile
+7-1contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api.h
+7-11 files