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]
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]
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
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")
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")
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")
Revert "Mark several getaddrinfo tests as XFAIL"
This change was unreviewed and should not have been committed to :main.
This reverts commit 9b37d84c87e69dabc69d818aa4d2fea718bd8b74.
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
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
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")
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")
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")
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
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
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
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
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
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]
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]
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
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
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
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)