Commit Graph

299989 Commits

Author SHA1 Message Date
Warner Losh 1145891d07 kboot: Create quit command
Create a command that just quits out of the loader. Useful for
debugging.

Sponsored by:		Netflix
Reviewed by:		tsoome
Differential Revision:	https://reviews.freebsd.org/D50589
2025-05-30 09:56:51 -06:00
Warner Losh aeb446be4e style: Use static consistently
C doesn't require that we have static on both the declaration and
definition of a function. But stylistically, FreeBSD does. Make that
so. Also make a function static that wasn't because, it seems, that
static and struct look a lot alike in a column of text.

Sponsored by:		Netflix
Reviewed by:		tsoome, jhibbits
Differential Revision:	https://reviews.freebsd.org/D50588
2025-05-30 09:56:50 -06:00
Warner Losh 6aea7b224a stand: Retire arch_loadaddr using md_align, pending its replacement
arch_loadaddr() is inconsistently used. In fact, I removed it entirely
from kboot because its interface wasn't wide enough (though I broke
powerpc kboot several years ago, and this commit might fix that).  For
now, modify uboot to put it into copyin like all the other loaders
do. This might break arm ubldr.

In its place, use the new md_align() and any replacement will be called
from there, or via some explicit init() function.

These changes allow me to load a amd64 kernel via UEFI with all the
modules aligned to 16k.

Sponsored by:		Netflix
Reviewed by:		jhibbits
Differential Revision:	https://reviews.freebsd.org/D50587
2025-05-30 09:56:50 -06:00
Warner Losh 18582d3542 stand: Style nit
Sponsored by:		Netflix
Reviewed by:		chs, tsoome
Differential Revision:	https://reviews.freebsd.org/D50586
2025-05-30 09:56:50 -06:00
Warner Losh a3bdf33f3e stand: Introduce md_align
When we're loading metadata, we need to align it in a certain way. Right
now that way is hard-coded to be PAGE_SIZE. Rather than do the actual
physical thing in all these places, move this into a wrapper routine. We
may want to load a 16k kernel and align all these on 16k or a 4k kernel
and align on 4k on aarch64 (today you have to compile the loader with
the right page size). This will also reduce the number of places we
might have to touch to do that.

Sponsored by:		Netflix
Reviewed by:		tsoome, jhibbits
Differential Revision:	https://reviews.freebsd.org/D50585
2025-05-30 09:56:50 -06:00
Warner Losh 700a2c08dc stand/efi: Use EFI_PAGE_SIZE here, it's more appropriate
No functional change: We're allocating a page from EFI, which is always
4k on amd64. So, this should always be 4k. PAGE_SIZE usually is this,
but might not be in some cases. For the end of the stack pointer in the
ist1, it should point the architecture's physical page past where we've
allocated. EFI_PAGE_SIZE more faithfully reflects that here since
PAGE_SIZE might not be exactly that in the future (if we had a larger
logical page than physical page). Since the AllocPage interface is in
EFI_PAGE_SIZE pages always, this seems safer. No functional change since
they are both 2096 today.

Sponsored by:		Netflix
Reviewed by:	tsoome
Differential Revision:	https://reviews.freebsd.org/D50584
2025-05-30 09:56:50 -06:00
Dag-Erling Smørgrav 537fbf70f1 cp: Fix copying to root directory.
The trailing-slash logic would strip the target down to an empty
string, which we would then fail to stat, and subsequently attempt
(and fail) to create.

Fixes:		82fc0d09e8
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D50604
2025-05-30 17:44:39 +02:00
Pierre Pronchery 046800313a bsdinstall: implement rootpass with bsddialog
This provides a more consistent user experience to the FreeBSD
installer.

Tested by:	thj
Approved by:	philip (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D44280
2025-05-30 16:45:48 +02:00
Kristof Provost 581e064dde libpfctl: clear out source nodes before retrieving them
Zero out the struct pfctl_src_node before we read the next one. Avoid having
stray stack information (or the previous source node) influence our result.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-05-30 15:15:54 +02:00
Vladimir Kondratyev 2df0e8ff8f hid.h: Add U2F usage tables constants
Per "HID Usage Tables for Universal Serial Bus (USB)" Version 1.6.

Page ID F1D0 FIDO Alliance Page

Usage ID 01 U2F Authenticator Device - A device that provides 2nd factor
    authentication using the FIDO U2FHID protocol.

Reviewed by:	wulf
Differential Revision: https://reviews.freebsd.org/D50549
2025-05-30 08:16:16 -04:00
Martin Matuska b1c1ee4429 zfs: merge openzfs/zfs@3084336ae
Notable upstream pull request merges:
 #14876 b048bfa9c Allow opt-in of zvol blocks in special class
 #16486 b6916f995 ARC: parallel eviction
 #17169 1a8f5ad3b zvol: Enable zvol threading functionality on FreeBSD
 #17209 c17bdc491 More aggressively assert that db_mtx protects db.db_data
 #17218 734eba251 Wire O_DIRECT also to Uncached I/O
 #17246 49fbdd453 Introduce zfs rewrite subcommand
 #17255 b1ccab172 ARC: Avoid overflows in arc_evict_adj()
 #17280 848794503 zcp: get_prop: fix encryptionroot and encryption
 #17301 086105f4c Cause zpool scan resume commands to get logged in history
 #17306 246e5883b zfs_valstr: update zio_flag strings for
                  ZIO_FLAG_PREALLOCATED
 #17309 78628a5c1 FreeBSD: Use new SYSCTL_SIZEOF()
 #17314 89a8a9158 ARC: Notify dbuf cache about target size reduction
 #17319 8b9c4e643 spa: clear checkpoint information during retry
 #17339 d5616ad34 Increase meta-dnode redundancy in "some" mode
 #17340 ea74cdedd Fix 2 bugs in non-raw send with encryption
 #17342 e55225be3 Add explicit DMU_DIRECTIO checks
 #17343 d8a33bc0a icp: Use explicit_memset() exclusively in gcm_clear_ctx()
 #17344 -multiple libzfs_core: add ZFS_IOC_TRACE envvar to enable ioctl
                  tracing
 #17348 f0baaa329 arcstat: prevent ZeroDivisionError when L2ARC becomes
                  empty
 #17353 83fa80a55 dmu_objset_hold_flags() should call
                  dsl_dataset_rele_flags() on error
 #17355 -multiple Allow txg_wait_synced_flags() and dmu_tx_assign()
                  to return when the pool suspends
 #17361 5c30b2438 Fix null dereference in spa_vdev_remove_cancel_sync()
 #17363 ddf28f27c Fix off-by-one bug in range tree code
 #17367 06fa8f3f6 zfs_cmd: reorganise zfs_cmd_t to match original size
 #17368 2a91d577b Expose dataset encryption status via fast stat path
 #17372 c464f1d01 Only interrupt active disk I/Os in failmode=continue
 #17373 9d76950d6 ZIL: Improve write log size accounting
 #17377 -multiple tunables: general code cleanup
 #17379 fa697b94e FreeBSD: Add posix_fadvise(POSIX_FADV_WILLNEED) support
 #17384 3dfa98d01 ZVOL: Make zvol_inhibit_dev module parameter
                  platform-independent

Obtained from:	OpenZFS
OpenZFS commit: 3084336ae4
2025-05-30 11:17:41 +02:00
Attila Fülöp 3084336ae4 Linux build: always use objtool
We silence `objtool` warnings on some object files using
`OBJECT_FILES_NON_STANDARD_some_file.o`. Nowadays `objtool` is
needed for CPU vulnerability mitigations and a lot more
functionality so its use is desirable.

Just remove the `OBJECT_FILES_NON_STANDARD` definitions. A follow-up
commit is needed to make the offending files standard and address
the compile time warnings.

Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes #17401
Closes #17364
2025-05-29 18:04:20 -07:00
Colin Percival 955ab1a8f2 pkg/FreeBSD.conf: Fix comments to reflect -kmods
Now that this file lists two repositories, the text "to disable *this*
repository" no longer makes sense.  Also, expand the example to list
how to disable both FreeBSD and FreeBSD-kmods repositories.

Reported by:	Graham Perrin
MFC after:	3 days
2025-05-29 16:43:46 -07:00
Kyle Evans d5e5e24179 mail: tests: reset signal disposition before testing
As a good citizen of the OS, mail(1) won't try to catch signals that
were ignored when it started and it won't reconfigure its signal mask
unless it's going to try and handle a signal.  The test should start
mail(1) off in a well-known state for the signal that it's trying to
test in order to get the behavior that's desired.

No functional change, just improves the resilience of the test.

Reviewed by:	des
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D50599
2025-05-29 15:08:50 -05:00
Kyle Evans 2e47009079 mail: don't rewrite buffer sizes as much
Thes buffers are arrays with a known size, just use sizeof() rather than
rewriting their sizes -- no functional change, slightly more resilient
against future possible errors.

Reviewed by:	markj
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D50582
2025-05-29 15:08:49 -05:00
Colin Percival 29f076ae0c pkg.conf: Use kmod repositories
The kmod repositories were added shortly after 14.2-RELEASE.  Point at
them here so that users don't need to manually add the configuration
in order to get e.g. working graphics.

MFC after:	1 minute
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D50583
2025-05-29 12:57:48 -07:00
Gleb Smirnoff 3267e0815e tests/unix: test MSG_PEEK read from a socket that has a descriptor 2025-05-29 11:44:52 -07:00
Gleb Smirnoff 23204710f2 unix: don't free the source mbuf in unp_externalize()
This makes calling the function simplier.
2025-05-29 11:44:52 -07:00
Gleb Smirnoff f20e8cd509 sockets: remove dom_externalize
It was used only by unix(4) and now is completely isolated.
2025-05-29 11:44:52 -07:00
Marek Zarychta 9486d6d57d loader: Fix beastie and fbsdbw logo positions
Fix the beaste, beastiebw and fbsdbw postions broken after
ee233742a5

PR: 285044, 286356
Fixes: 1b4e117131
Reviewed by: imp
MFC After: 2 days (14.3 candiate)
Sponsored by: PANS Jarosław
2025-05-29 12:37:03 -06:00
Mark Johnston 198d2ed2d4 devfs: Set eofflag in devfs_readdir()
At least vn_dir_next_dirent() checks that eofflag is set appropriately
when INVARIANTS is enabled, so the omission here could cause an
assertion failure.

Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D50598
2025-05-29 18:25:56 +00:00
Enji Cooper 18378ef11a OSSL_HTTP_get(): Reset redirection_url in each iteration
Also remove some dead assignments.

Obtained from:	openssl (e78c8b791c0e03e750ef7196bc7bfee8e5bd00a0)

MFC after:	2 weeks
Requested by:	Phillip Sabatino
Sponsored by:	Dell, Inc.
2025-05-29 10:56:46 -07:00
Jessica Clarke 48fd084579 rtld-elf: Pass TCB to allocate_module_tls to avoid re-getting
The only caller already has the current TCB to hand, so just pass it
down rather than get it again. This also makes it clear in the caller
that it depends on the (current) TCB, rather than being storage that
could be assigned to any thread (concurrency issues aside).

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D50594
2025-05-29 17:07:02 +01:00
Jessica Clarke 250b2eda0a libc, libthr: Ditch MD __pthread_distribute_static_tls helpers
_libc_get_static_tls_base() is just _tcb_get() followed by adding (for
Variant I) or subtracting (for Variant II) the offset, so just inline
that as the implementation (like we do in rtld-elf) rather than having
another copy (or equivalent) of _tcb_get()'s assembly.

_get_static_tls_base() doesn't even have any MD assembly as it's
reading thr->tcb, the only difference is whether to add or subtract, so
again just inline that.

Whilst here add some missing blank lines to comply with style(9) for
elf_utils.c's includes, and use a pointer type rather than uintptr_t to
reduce the need to cast, as is done in rtld-elf.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D50592
2025-05-29 17:06:54 +01:00
Jessica Clarke 960f40b892 rtld-elf: Pass struct tcb * around rather than struct dtv **
When this code was first written we didn't have even a struct tcb, so to
make it MI a pointer to the DTV pointer in the TCB was passed around.
Now that we have a struct tcb we can simplify the code by instead
passing around a pointer to that, and the MI code can access the tcb_dtv
member wherever it happens to be in the layout. This reduces boilerplate
in all the various callers of tls_get_addr_common/slow and makes it
clearer that tls_get_addr_common/slow are operating on the TCB, rather
than obfuscating it slightly through the double pointer.

Whilst here, clarify the comments in aarch64's TLSDESC dynamic resolver,
which were using tp without clarifying what this was for (previously a
pointer to the DTV pointer, now a pointer to the TCB, which happen to be
the same thing for Variant I TLS, and in the case of AArch64 are what
TPIDR_EL0 point to directly, with no offset/bias).

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D50591
2025-05-29 17:06:49 +01:00
Fernando Apesteguía 1d193b1808 Update linprocfs.4
Add documentation for missing files and directories.
Also reorganize a bit.

Approved by:		gbe@, ziaee@ (manpages)
Differential Revision:	https://reviews.freebsd.org/D50408
2025-05-29 17:57:18 +02:00
Konstantin Belousov 9997693427 PT_CONTINUE: undo transparent attach consequences
PR:	287050
Reported and tested by:	Paul Floyd <pjfloyd@wanadoo.fr>
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D50556
2025-05-29 17:28:06 +03:00
Konstantin Belousov def0c056d3 PT_CONTINUE: if pc is set, mark the thread state as modified by user
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differrential revision:	https://reviews.freebsd.org/D50556
2025-05-29 17:27:46 +03:00
Konstantin Belousov b57eb80596 kern_sig.c: make pt_attach_transparent global
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differrential revision:	https://reviews.freebsd.org/D50556
2025-05-29 17:26:52 +03:00
Konstantin Belousov 58b2bd33af namei: clear internal flags in NDREINIT()
same as it is done for NDRESTART()

Fixes:  e05e33041c
Reported and tested by:	pho
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
2025-05-29 17:22:49 +03:00
Fedor Uporov 3dfa98d013 ZVOL: Make zvol_inhibit_dev module parameter platform-independent
The module parameter now is represented in FreeBSD sysctls list with
name: 'vfs.zfs.vol.inhibit_dev'. The default value is '0', same as on
Linux side.

Sponsored-by: vStack, Inc.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Rob Norris <rob.norris@klarasystems.com>
Signed-off-by: Fedor Uporov <fuporov.vstack@gmail.com>
Closes #17384
2025-05-29 09:37:41 -04:00
Alexander Motin fa697b94e6 FreeBSD: Add posix_fadvise(POSIX_FADV_WILLNEED) support
As commit 320f0c6 did for Linux, connect POSIX_FADV_WILLNEED
up to dmu_prefetch() on FreeBSD.

While there, fix portability problems in tests/functional/fadvise.

1.  Instead of relying on the numerical values of POSIX_FADV_XXX macros,
    accept macro names as arguments to the file_fadvise program.  (The
    numbers happen to match on Linux and FreeBSD, but future systems may
    vary and it seems a little strange/raw to count on that.)

2.  For implementation reasons, SEQUENTIAL doesn't reach ZFS via FreeBSD
    VFS currently (perhaps something that should be investigated in
    FreeBSD).  Since on Linux we're treating SEQUENTIAL and WILLNEED the
    same, it doesn't really matter which one we use, so switch the test
    over to WILLNEED exercise the new prefetch code on both OSes the
    same way.

Reviewed-by: Mateusz Guzik <mjg@FreeBSD.org>
Reviewed-by: Fedor Uporov <fuporov.vstack@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Thomas Munro <tmunro@FreeBSD.org>
Co-authored-by: Alexander Motin <mav@FreeBSD.org>
Closes #17379
2025-05-29 09:34:07 -04:00
Pierre Pronchery 82c41c9ffc umb: avoid wild pointer dereference in umb_decap()
When processing messages produced by the USB device, umb_decap() trusts
ptroff and later dlen and doff with pointer arithmetic, without
sufficient sanity checks. The resulting pointer address may be outside
of the valid boundary, causing the wrong memory to be copied or a page
fault.

This fix from Gerhard Roth was obtained after coordination upstream with
OpenBSD. It converts the variables to 64-bit integers, which should
mitigate the risk of overflows.

PR:             284920
Reported by:    Robert Morris <rtm@lcs.mit.edu>
Approved by:	philip (mentor)
Sponsored by:   The FreeBSD Foundation
2025-05-29 15:07:57 +02:00
Pierre Pronchery 152bb8e302 umb: avoid buffer overflow in umb_getinfobuf()
umb_getinfobuf() is called with offs and size taken from messages sent
by the USB device. The sanity check is not sufficient, due to a possible
integer wrap. This can allow a broken or malicious USB device, or
possibly the network operator, to cause a buffer overflow.

This fix from Gerhard Roth was obtained after coordination upstream with
OpenBSD. It converts the variables to 64-bit integers, which should
mitigate the risk of overflows.

PR:             284906
Reported by:    Robert Morris <rtm@lcs.mit.edu>
Approved by:	philip (mentor)
Sponsored by:   The FreeBSD Foundation
2025-05-29 15:07:54 +02:00
Pierre Pronchery 5ed36e2e17 umb: avoid buffer overflow in umb_in_len2mask()
len comes from ipv4elem.prefixlen in a MBIM_CID_IP_CONFIGURATION message
from the USB device, and should not be trusted, as it could be any
uint32_t value. Without this extra check, a potential buffer overflow
could subsequently occur in umb_in_len2mask().

Fix from Gerhard Roth, after coordination upstream with OpenBSD.

PR:		284904
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Approved by:	philip (mentor)
Sponsored by:	The FreeBSD Foundation
2025-05-29 15:07:52 +02:00
Kristof Provost 7f81f87a74 pf: remove unused 'dir' argument in pf_reassemble()
pf_reassemble() only uses it to pass to pf_ip2key(), which also does not use it.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-05-29 13:54:55 +02:00
Christos Margiolis 0432b2183f 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
softclock_thread() at softclock_thread+0x162/frame 0xfffffe0046a8def0
fork_exit() at fork_exit+0xa3/frame 0xfffffe0046a8df30
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe0046a8df30

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D50386
2025-05-29 12:25:18 +02:00
Christos Margiolis f6430bc61d 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@freebsd:~ # sndctl interrupts
dsp0.play.0.interrupts=1139
dsp0.record.0.interrupts=0
root@freebsd:~ # sndctl interrupts
dsp0.play.0.interrupts=1277
dsp0.record.0.interrupts=0
root@freebsd:~ # sndctl interrupts
dsp0.play.0.interrupts=1394
dsp0.record.0.interrupts=0

The only applications that do not have this issue are those (e.g., mpv) that
manually call ioctls which end up calling chn_abort(), like SNDCTL_DSP_HALT, to
abort the channel(s) during shutdown. For all other applications that do not
manually abort the channel(s), we can confirm that chn_abort()/chn_flush(), or
even chn_trigger(PCMTRIG_ABORT) on the parent, doesn't happen during shutdown.

root@freebsd:~ # dtrace -n 'fbt::chn_abort:entry,fbt::chn_flush:entry { printf("%s", args[0]->name); stack(); }'
dtrace: description 'fbt::chn_abort:entry,fbt::chn_flush:entry ' matched 2 probes
dtrace: buffer size lowered to 1m
^C

[...]

root@freebsd:~ # dtrace -n 'fbt::chn_trigger:entry /args[1] == -1/ { printf("%s", args[0]->name); stack(); }'
dtrace: description 'fbt::chn_trigger:entry ' matched 1 probe
dtrace: buffer size lowered to 1m
CPU     ID                    FUNCTION:NAME
  0  68037                chn_trigger:entry dsp0.virtual_play.0
	      sound.ko`chn_kill+0x134
	      sound.ko`vchan_destroy+0x94
	      sound.ko`dsp_close+0x39b
	      kernel`devfs_destroy_cdevpriv+0xab
	      kernel`devfs_close_f+0x63
	      kernel`_fdrop+0x1a
	      kernel`closef+0x1e3
	      kernel`closefp_impl+0x76
	      kernel`amd64_syscall+0x151
	      kernel`0xffffffff8103841b1

To fix this, modify dsp_close() to execute the primary channel case on both
primary and virtual channels. While what we really care about are the
chn_abort()/chn_flush() calls, it shouldn't hurt to call the rest of the
functions on the vchans as well, to avoid complicating things; they get deleted
right below, anyway.

With the patch applied:

root@freebsd:~ # dtrace -n 'fbt::chn_trigger:entry /args[1] == -1/ { printf("%s", args[0]->name); stack(); }'
dtrace: description 'fbt::chn_trigger:entry ' matched 1 probe
dtrace: buffer size lowered to 1m
CPU     ID                    FUNCTION:NAME
  1  68037                chn_trigger:entry dsp0.virtual_play.0
              sound.ko`chn_flush+0x2a
              sound.ko`dsp_close+0x330
              kernel`devfs_destroy_cdevpriv+0xab
              kernel`devfs_close_f+0x63
              kernel`_fdrop+0x1a
              kernel`closef+0x1e3
              kernel`closefp_impl+0x76
              kernel`amd64_syscall+0x151
              kernel`0xffffffff8103841b

  0  68037                chn_trigger:entry dsp0.play.0
              sound.ko`chn_notify+0x4ce
              sound.ko`vchan_trigger+0x105
              sound.ko`chn_trigger+0xb4
              sound.ko`chn_flush+0x2a
              sound.ko`dsp_close+0x330
              kernel`devfs_destroy_cdevpriv+0xab
              kernel`devfs_close_f+0x63
              kernel`_fdrop+0x1a
              kernel`closef+0x1e3
              kernel`closefp_impl+0x76
              kernel`amd64_syscall+0x151
              kernel`0xffffffff8103841b

Above we can see a chn_trigger(PCMTRIG_ABORT) on the parent (dsp0.play.0),
which is coming from the chn_abort() (inlined) in chn_notify():

root@freebsd:~ # dtrace -n 'kinst::chn_abort:entry { stack(); }'
dtrace: description 'kinst::chn_abort:entry ' matched 5 probes
dtrace: buffer size lowered to 1m
CPU     ID                    FUNCTION:NAME
  1  72580                  chn_notify:1192
              sound.ko`0xffffffff8296cab4
              sound.ko`vchan_trigger+0x105
              sound.ko`chn_trigger+0xb4
              sound.ko`chn_flush+0x2a
              sound.ko`dsp_close+0x330
              kernel`devfs_destroy_cdevpriv+0xab
              kernel`devfs_close_f+0x63
              kernel`_fdrop+0x1a
              kernel`closef+0x1e3
              kernel`closefp_impl+0x76
              kernel`amd64_syscall+0x151
              kernel`0xffffffff8103841b

We can also confirm the primary channel(s) are not interrupted anymore:

root@freebsd:/mnt/src # sndctl interrupts
dsp0.play.0.interrupts=0
dsp0.record.0.interrupts=0

In collaboration with:	adrian
Tested by:		adrian, christos, thj
Sponsored by:		The FreeBSD Foundation
MFC after:		2 days
Reviewed by:		thj, adrian, emaste
Differential Revision:	https://reviews.freebsd.org/D50488
2025-05-29 12:25:18 +02:00
Christos Margiolis a946852ff2 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
2025-05-29 12:25:18 +02:00
Oskar Holmlund 781a630db6 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
2025-05-29 12:14:25 +02:00
Kristof Provost 4607299002 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")
2025-05-29 10:31:23 +02:00
Kristof Provost dd06ff7419 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@openbsd.org>, 7363dae4f9
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-05-29 09:15:22 +02:00
Kristof Provost 0ad26d40a4 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@openbsd.org>, a44a24888a
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-05-29 09:14:58 +02:00
Kristof Provost 562b1e79ba pfctl: fix a comment
Obtained from:	OpenBSD, henning <henning@openbsd.org>, a135ce1ad3
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-05-29 09:14:54 +02:00
Rob Norris 00360efa35 tunables: fix spelling
Three occurences with an 'e', and all of them mine. Maybe it's an
British thing?

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Pavel Snajdr <snajpa@snajpa.net>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #17377
2025-05-28 16:50:22 -07:00
Rob Norris 9392be427e tunables: remove __check_old_set_param workaround
This was fully removed from Linux in 4.15, so we won't be seeing it
again.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Pavel Snajdr <snajpa@snajpa.net>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #17377
2025-05-28 16:50:22 -07:00
Rob Norris dd4e2f99f0 tunables: remove unused param get/set aliases
Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Pavel Snajdr <snajpa@snajpa.net>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #17377
2025-05-28 16:50:22 -07:00
Rob Norris 589d99171f tunables: use Linux ullong param ops for u64
Since 3.17 Linux has provided param ops for 64-bit ints, so we don't
need to use our own anymore.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Pavel Snajdr <snajpa@snajpa.net>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #17377
2025-05-28 16:50:22 -07:00
Rob Norris 6e7e7ea7ef tunables: remove support for s64 tunables
Nothing uses them now.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Pavel Snajdr <snajpa@snajpa.net>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #17377
2025-05-28 16:50:22 -07:00
Rob Norris 58235f52af tunables: remove direct use of module_param_cb
The use for spl_taskq_kick was the only use, and the comment that
module_param_call is obsolete is no longer true - it's still very much
used even in recent kernels.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Pavel Snajdr <snajpa@snajpa.net>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #17377
2025-05-28 16:50:22 -07:00