Commit graph

291199 commits

Author SHA1 Message Date
Kristof Provost 5824df8d99 pf: convert DIOCGETSTATUS to netlink
Introduce pfctl_get_status_h() because we need the pfctl_handle. In this variant
use netlink to obtain the information.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-04-29 16:32:23 +02:00
Kristof Provost 044243fcc9 libpfctl: allow access to the fd
pfctl_open() opens both /dev/pf and a netlink socket. Allow access to the /dev/
pf fd via pfctl_fd().
This means that libpfctl users no longer have to open /dev/pf themselves for any
calls that are not yet available in libpfctl.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
MFC after:	2 weeks
2024-04-29 16:32:23 +02:00
Kristof Provost a3f7176523 libpfctl: fix incorrect pcounters array size
The array is 2 x 2 x 2, not 2 x 2 x 3.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
MFC after:	2 weeks
2024-04-29 16:32:23 +02:00
Lexi Winter e05b6502f9 package: fix dependency generation
A bug in release/packages/generate-ucl.sh causes package dependencies
(other than shlib depends) to not be generated correctly, meaning
packages are missing their dependencies.

generate-ucl.sh creates the UCL file by:

1. copying ${uclsource} (template.ucl) to ${uclfile}
2. appending dependencies to ${uclfile}
3. calling generate-ucl.lua on ${uclsource} to create ${uclfile}

This breaks because the dependencies added in step 2 are overwritten in
step 3.

Fix this by calling generate-ucl.lua with ${uclfile} as both the input
and output file, so anything we added to ${uclfile} is preserved.

Reviewed by: des, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1203
2024-04-29 08:31:36 -06:00
Lexi Winter 2ef5a8624a package: FreeBSD-periodic should depend on FreeBSD-cron
Reported by: des
Reviewed by: imp, des
Pull Request: https://github.com/freebsd/freebsd-src/pull/1204
2024-04-29 08:29:20 -06:00
Alexander Ziaee 702766d09a services.5: describe better
Use a more specific description for this man page, and add SDPX tag
while here.

Reviewed by:	imp, meena
Signed-off-by:	Alexander Ziaee <concussious@runbox.com>
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1194
2024-04-29 08:22:39 -06:00
Nathan Huff b2b8fa1a64 Add libxo support to du
Convert du to use libxo enabling structured output.

[[ minor style fixes by imp ]]

Signed-off-by: Nathan Huff <nhuff@acm.org>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1145
2024-04-29 08:22:39 -06:00
Mark Johnston 1ee7a8fa58 arm64/vmm: Handle VM_EXITCODE_SUSPENDED
This is required for bhyve reboot to work.  In particular, unless we
suspend vcpu threads here, vm_reinit() will fail with EBUSY.

The implementation is copied from amd64; in the not-too-distant future
the amd64 and arm64 copies of vmm.c and vmm_dev.c will be merged, so
for now it's useful to minimize diffs between amd64 and arm64.

Reviewed by:	corvink, andrew
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D44934
2024-04-29 10:19:27 -04:00
Mark Johnston 390e44988a bhyve: Fix handling of -r
Just make "restore_file" a global variable so that it can be set by the
MD option handler.

Reviewed by:	corvink
Reported by:	bdrewery
Fixes:		981f9f7495 ("bhyve: Push option parsing down into bhyverun_machdep.c")
Differential Revision:	https://reviews.freebsd.org/D44974
2024-04-29 10:13:50 -04:00
Dag-Erling Smørgrav 9e8618276f adduser: Really fix a syntax error
Fixes:		5cafc38f11
Differential Revision:	https://reviews.freebsd.org/D44871
2024-04-29 12:29:35 +02:00
Dag-Erling Smørgrav c28253ecde libulog: Make sure ut_line, ut_user, ut_host are terminated.
MFC after:	3 days
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D45004
2024-04-29 12:11:37 +02:00
Martin Matuska 13d826ff94 libarchive: merge from vendor branch
Libarchive 3.7.4 + three fixes from master

Security fixes:
 #2135 rar: Fix OOB in rar e8 filter (CVE-2024-26256)
 #2145 zip: Fix out of boundary access
 #2148 rar: Fix OOB in rar delta filter
 #2149 rar: Fix OOB in rar audio filter

Important bugfixes:
 #2131 7zip: Limit amount of properties
 #2110 bsdtar: Fix error handling around strtol() usages
 #2116 passphrase: Never allow empty passwords
 #2124 rar: Fix "File CRC Error" when extracting specific rar4 archives
 #2123 xar: Avoid infinite link loop
 #2150 xar: Fix another infinite loop and expat error handling
 #2108 zip: Update AppleDouble support for directories
 #2071 zstd: Implement core detectiongit

PR:		278588 (exp-run)
MFC after:	1 day
2024-04-29 10:17:53 +02:00
Martin Matuska 51c823ac27 Cherry-pick commits from libarchive to vendor/libarchive
#2148 fix: OOB in rar delta filter (a1cb648d5)
 #2149 fix: OOB in rar audio filter (3006bc5d0)
 #2150 xar: Fix another infinite loop and expat error handling (b910cb70d)

Obtained from:		libarchive
Libarchive commits:	b910cb70d4c1b311c9d85cd536a6c91647c43df7
			a1cb648d52f5b6d3f31184d9b6a7cbca628459b7
			3006bc5d02ad3ae3c4f9274f60c1f9d2d834734b
2024-04-29 09:23:21 +02:00
CismonX d289382897 rights.4: various corrections on capability rights
- A file descriptor obtained from accept(2), accept4(2) and openat(2)
  is not always assigned all capability rights.  Instead, it inherits
  capability rights from the "parent" socket/dir file descriptor.
- getdents(2) and getdirentries(2) requires CAP_READ.
- openat(2) with O_WRONLY|O_TRUNC does not require CAP_SEEK.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1207
2024-04-28 22:48:31 -06:00
Ricardo Branco 78444b5ade glabel: Add support for Linux swap
Reviewed by: imp, kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1205
2024-04-28 22:39:47 -06:00
Lexi Winter 1b3c07bed6 package: move OpenBSM auditing into its own package
Move auditing runtime (auditd, etc.) into the new FreeBSD-audit package.
Also move the runtime OpenBSM manual pages from libbsm into auditd so
they get installed with the right package.

Add an UPDATING entry noting the new packages.

Reviewed by: imp, manu
Pull Request: https://github.com/freebsd/freebsd-src/pull/1197
2024-04-28 22:33:06 -06:00
Lexi Winter 0c0a2110f1 package: move authpf into the FreeBSD-pf package
Reviewed by: imp, manu
Pull Request: https://github.com/freebsd/freebsd-src/pull/1198
2024-04-28 22:33:02 -06:00
Lexi Winter 6b1d152d89 UPDATING: add entry for recent pkgbase changes
Reviewed by: imp, manu
Pull Request: https://github.com/freebsd/freebsd-src/pull/1196
2024-04-28 22:32:55 -06:00
Elyes Haouas d94c991f3b setkey: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 22:21:09 -06:00
Elyes Haouas 70fad8acae ipf: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 22:21:09 -06:00
Elyes Haouas 7028e630d6 camcontrol: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 22:21:09 -06:00
Elyes Haouas c3c816173d ipfw: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 21:30:55 -06:00
Elyes Haouas b561d8f59c zonectl: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 21:30:55 -06:00
Elyes Haouas cbfd42cc07 wlandebug: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 21:30:55 -06:00
Elyes Haouas abab59f662 usbconfig: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 21:30:55 -06:00
Elyes Haouas 4c6e656e2e rwhod: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 21:30:55 -06:00
Elyes Haouas f93475cf0f pstat: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 21:30:55 -06:00
Elyes Haouas 67db7b43d0 ppp: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 21:30:55 -06:00
Elyes Haouas bccbb2fc4b ndp: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 21:30:54 -06:00
Elyes Haouas 83409a9357 moused: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 21:30:54 -06:00
Elyes Haouas 338d9c35d5 kbdcontrol: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 21:24:47 -06:00
Elyes Haouas 8f65dcd627 ctld: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 21:24:47 -06:00
Elyes Haouas 2f8ea2f605 ctladm: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 21:24:47 -06:00
Elyes Haouas 8918cc95e8 btxld: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 21:24:47 -06:00
Elyes Haouas d1d652c060 rtadvctl: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 21:24:46 -06:00
Elyes Haouas 93e96d6c87 rtadvd: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 21:24:46 -06:00
Elyes Haouas fdbf7cab91 bluetooth: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 21:24:46 -06:00
Stephan de Wit 2b8df536a6 axgbe: Various stability improvements
Hook in RSS glue.

Default to "off" for the split header feature to ensure netmap
compatibility.

Change the PCS indirection register values based on hardware type
(ported from Linux).

Move tunable settings to sysctl_init() and set the defaults there.
Ensure it's called at the right time by moving it back.

Reset PHY RX data path when mailbox command times out (Ported from
Linux).

Check if VLAN HW tagging is enabled before assuming a VLAN tag
is present in a descriptor.

Disable the hardware filter since multicast traffic is dropped
in promisc mode.

Remove unnecessary return statement.

Missing sfp_get_mux, causing a race between ports to read
SFP(+) sideband signals.

Validate and fix incorrectly initialized polarity/configuration
registers.

Remove unnecessary SFP reset.

axgbe_isc_rxd_pkt_get has no error state, remove unnecessary
big packet check.

Enable RSF to prevent zero-length packets while in Netmap mode.

DMA cache coherency update (ported from Linux).

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1103
2024-04-28 19:57:51 -06:00
Jason A. Harmening 05e8ab627b unionfs_rename: fix numerous locking issues
There are a few places in which unionfs_rename() accesses fvp's private
data without holding the necessary lock/interlock.  Moreover, the
implementation completely fails to handle the case in which fdvp is not
the same as tdvp; in this case it simply fails to lock fdvp at all.
Finally, it locks fvp while potentially already holding tvp's lock, but
makes no attempt to deal with possible LOR there.

Fix this by optimistically using the vnode interlock to protect
the short accesses to fdvp and fvp private data, sequentially.
If a file copy or shadow directory creation is required to prepare
the upper FS for the rename operation, the interlock must be dropped
and fdvp/fvp locked as necessary.

Additionally, use ERELOOKUP (as suggested by kib@) to simplify the
locking logic and eliminate unionfs_relookup() calls for file-copy/
shadow-directory cases that require tdvp's lock to be dropped.

Reviewed by:		kib (earlier version), olce
Tested by:		pho
Differential Revision:	https://reviews.freebsd.org/D44788
2024-04-28 20:19:48 -05:00
Christos Margiolis 993d1fad5b RELNOTES: Fix wrong commit hash
Fixes:		25723d6636 ("sound: Retire unit.*")
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-04-28 21:59:17 +02:00
Christos Margiolis 7cc1afc558 sound: Remove chn_timeout check from chn_init()
This check is not related to channel initializion, but is also
unnecessary, since sysctl_hw_snd_timeout() takes care of checking if
chn_timeout is within bounds.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44992
2024-04-28 21:48:25 +02:00
Christos Margiolis e56c8996fc sound: Add missing space in dev.pcm.X.mode description
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	markj, emaste
Differential Revision:	https://reviews.freebsd.org/D44990
2024-04-28 21:48:24 +02:00
Christos Margiolis a24050e2b7 sound: Move pcm_chnref() and pcm_chnrelease() to pcm/channel.c
Improve code layering. These are channel functions, and so they do not
belong in pcm/sound.c.

While here, assert in chn_ref() that new refcount won't be negative.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44985
2024-04-28 21:48:24 +02:00
Christos Margiolis b3ea087c05 sound: Merge pcm_chn_destroy() and chn_kill()
pcm_chn_destroy() acts like a wrapper around chn_kill(), and
additionally calls a few more functions that should in fact be part of
chn_kill()'s logic. Merge pcm_chn_destroy()'s functionality in
chn_kill() to improve readability, as well as code layering.

While here, convert chn_kill() to void as it currently always returns 0.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44984
2024-04-28 21:48:24 +02:00
Christos Margiolis 25723d6636 sound: Retire unit.*
The unit.* code is largely obsolete and imposes limits that are no
longer needed nowadays.

- Capping the maximum allowed soundcards in a given machine. By default,
  the limit is 512 (snd_max_u() in unit.c), and the maximum possible is
  2048 (SND_UNIT_UMAX in unit.h). It can also be tuned through the
  hw.snd.maxunit loader(8) tunable. Even though these limits are large
  enough that they should never cause problems, there is no need for
  this limit to exist in the first place.
- Capping the available device/channel types. By default, this is 32
  (snd_max_d() in unit.c). However, these types are pre-defined in
  pcm/sound.h (see SND_DEV_*), so the cap is unnecessary when we know
  that their number is constant.
- Capping the number of channels per-device. By default, the limit 1024
  (snd_max_c() in unit.c). This is probably the most problematic of the
  limits mentioned, because this limit can never be reached, as the
  maximum is hard-capped at either hw.snd.maxautovchans (16 by default),
  or SND_MAXHWCHAN and SND_MAXVCHANS.

These limtits are encoded in masks (see SND_U_MASK, SND_D_MASK,
SND_C_MASK in unit.h) and are used to construct a bitfield of the form
[dsp_unit, type, channel_unit] in snd_mkunit() which is assigned to
pcm_channel->unit.

This patch gets rid of everything unit.*-related and makes a slightly
different use of the "unit" field to only contain the channel unit
number. The channel type is stored in a new pcm_channel->type field, and
the DSP unit number need not be stored at all, since we can fetch it
from device_get_unit(pcm_channel->dev). This change has the effect that
we no longer need to impose caps on the number of soundcards,
device/channel types and per-device channels. As a result the code is
noticeably simplified and more readable.

Apart from the fact that the hw.snd.maxunit loader(8) tunable is also
retired as a side-effect of this patch, sound(4)'s behavior remains the
same.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D44912
2024-04-28 21:48:24 +02:00
Christos Margiolis fa28452549 sound: Assert that we do not enter chn_sleep() with CHN_F_SLEEPING
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	markj, emaste
Differential Revision:	https://reviews.freebsd.org/D44959
2024-04-28 21:48:24 +02:00
Christos Margiolis 03614fcba2 sound: Fix panic caused by sleeping-channel destruction during asynchronous detach
Currently we are force-destroying all channels unconditionally in
pcm_killchan(). However, since asynchronous audio device detach is
possible as of 44e128fe9d, if we do not check whether the channel is
sleeping or not and forcefully kill it, we will get a panic from
cv_timedwait_sig() (called from chn_sleep()), because it will try to use
a freed lock/cv.

Modify pcm_killchan() (renamed to pcm_killchans() since that's a more
appropriate name now) to loop through the channel list and destroy only
the channels that are awake, otherwise wake up the sleeping thread and
try again. This loop is repeated until all channels are awakened and
destroyed.

To reduce code duplication, implement chn_shutdown() which wakes up the
channel and sets CHN_F_DEAD, and use it in pcm_unregister() and
pcm_killchans().

Reported by:	KASAN
Fixes:		44e128fe9d ("sound: Implement asynchronous device detach")
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44923
2024-04-28 21:48:24 +02:00
Christos Margiolis b18b990d8e sound: Wrap dsp_clone() and mixer_clone() with bus_topo_lock()
Make sure that the softc isn't freed in between the checks.

Sponsored by:	The FreeBSD Foundation
MFC after;	1 day
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44991
2024-04-28 21:48:24 +02:00
Christos Margiolis 074d6fbebc sound: Fix NULL dereference in dsp_clone() and mixer_clone()
If we only have a single soundcard attached and we detach it right
before entering [dsp|mixer]_clone(), there is a chance pcm_unregister()
will have returned already, meaning it will have set snd_unit to -1, and
thus devclass_get_softc() will return NULL here.

While here, 1) move the calls to dsp_destroy_dev() and mixer_uninit()
below the point where we unset SD_F_REGISTERED, and 2) follow what
mixer_clone() does and make sure we don't use a NULL d->dsp_dev in
dsp_clone().

Reported by:	KASAN
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44924
2024-04-28 21:48:24 +02:00
Konstantin Belousov 56ee5fc43c rtld snprintf: do not erronously skip a char at the buffer boundary
Reviewed by:	emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44987
2024-04-28 22:42:12 +03:00