]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 weeks agokcmp_pget(): add an assert that we did not hold the current process
Konstantin Belousov [Mon, 29 Apr 2024 18:51:53 +0000 (21:51 +0300)]
kcmp_pget(): add an assert that we did not hold the current process

Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

4 weeks agolinuxkpi: Add linuxkpi_video module
Emmanuel Vadot [Wed, 24 Apr 2024 08:14:36 +0000 (10:14 +0200)]
linuxkpi: Add linuxkpi_video module

This contain the hdmi code and the aperture code like in linux.

Differential Revision: https://reviews.freebsd.org/D44925
Reviewed by: bz
Obtained from: drm-kmod
Sponsored by: Beckhoff Automation GmbH & Co. KG

4 weeks agolinuxkpi: hdmi: Split the module declaration to a new file
Emmanuel Vadot [Wed, 24 Apr 2024 07:59:20 +0000 (09:59 +0200)]
linuxkpi: hdmi: Split the module declaration to a new file

In order to have a proper linuxkpi_video kmod, move the module declaration
to a new file as linuxkpi_video will also include linux_hdmi.c

Differential Revision: https://reviews.freebsd.org/D44926
Reviewed by: bz, emaste, wulf
Sponsored by: Beckhoff Automation GmbH & Co. KG

4 weeks agortld.1: clarify interaction between -u and -o
Konstantin Belousov [Sun, 28 Apr 2024 21:45:12 +0000 (00:45 +0300)]
rtld.1: clarify interaction between -u and -o

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 weeks agortld direct exec: make -u behavior match the description
Konstantin Belousov [Sun, 28 Apr 2024 20:57:54 +0000 (23:57 +0300)]
rtld direct exec: make -u behavior match the description

Instead of only ignoring insecure env vars, clear them all.

Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44999

4 weeks agortld: add direct-exec option -o
Konstantin Belousov [Sun, 28 Apr 2024 03:19:39 +0000 (06:19 +0300)]
rtld: add direct-exec option -o

allowing to set any known LD_ parameter for the current rtld invocation,
but without polluting the activated' binary environment.  In other
words, the set parameter is not exported into the environment.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44988

4 weeks agocxgbe(4): Shared code update to deal with partial failure in query_params.
Navdeep Parhar [Wed, 14 Feb 2024 01:28:53 +0000 (17:28 -0800)]
cxgbe(4): Shared code update to deal with partial failure in query_params.

Obtained from: Chelsio Communications
MFC after: 1 week
Sponsored by: Chelsio Communications

4 weeks agocxgbe(4): Reword the comment explaining the atid/cookie split.
Navdeep Parhar [Sat, 1 Apr 2023 23:07:36 +0000 (16:07 -0700)]
cxgbe(4): Reword the comment explaining the atid/cookie split.

Avoid a magic constant while here.  No functional change intended.

MFC after: 1 week
Sponsored by: Chelsio Communications

4 weeks agocxgbe(4): Add missing description for a port type.
Navdeep Parhar [Mon, 29 Apr 2024 20:27:48 +0000 (13:27 -0700)]
cxgbe(4): Add missing description for a port type.

MFC after: 1 week
Sponsored by: Chelsio Communications

4 weeks agocxgbe(4): Retire t4_intr_clear.
Navdeep Parhar [Fri, 26 Apr 2024 00:39:55 +0000 (17:39 -0700)]
cxgbe(4): Retire t4_intr_clear.

The firmware clears the interrupts already and it has a better idea of
exactly what to clear for which generation of the ASIC.  There is no
need for the driver to get involved.

MFC after: 1 week
Sponsored by: Chelsio Communications

4 weeks agocxgbe(4): Add a helper function to locate MPS/MAC registers.
Navdeep Parhar [Thu, 25 Apr 2024 05:24:49 +0000 (22:24 -0700)]
cxgbe(4): Add a helper function to locate MPS/MAC registers.

These register blocks are at different locations in different chips.

MFC after:      1 week
Sponsored by:   Chelsio Communications

4 weeks agocxgbe(4): Remove tx_modq lookup table.
Navdeep Parhar [Fri, 29 Mar 2024 05:49:32 +0000 (22:49 -0700)]
cxgbe(4): Remove tx_modq lookup table.

The driver always uses the same modulation queue as the channel and the
table is unnecessary.

MFC after:      1 week
Sponsored by:   Chelsio Communications

4 weeks agopflow: handle unattached states
Kristof Provost [Mon, 29 Apr 2024 09:51:17 +0000 (11:51 +0200)]
pflow: handle unattached states

It's possible for states to be cleaned up (through pf_detach_state()) that
have not been fully attached. For example if there's an ID conflict during
pf_state_insert().

pflow exports states from pf_detach_state(), so it can get called on such
states, but did not account for this and could end up dereferencing a NULL
state key.

Check for this in export_pflow() and do not export unattached states.

See also: https://redmine.pfsense.org/issues/15446
Sponsored by: Rubicon Communications, LLC ("Netgate")

4 weeks agoctl: Fix CTL GET EVENT STATUS NOTIFICATION valid bits
HP van Braam [Mon, 29 Apr 2024 14:34:46 +0000 (08:34 -0600)]
ctl: Fix CTL GET EVENT STATUS NOTIFICATION valid bits

Linux as an initiator periodically sends the following to SCSI cdrom
devices: 4a 01 00 00 10 00 00 00 08 00

According to the ctl_cmd_entry for this command this is invalid which
leads to a lot of failed SCSI commands.

The mask in this commit is based off of an early draft of the mmc
standard, https://www.t10.org/ftp/t10/document.97/97-108r0.pdf,
as well as subsequent standards (mmc2 through mmc6).

This solves the issue with Linux initiators.

Signed-off-by: HP van Braam <hp@tmm.cx>
Reviewed by: imp, mav
Pull Request: https://github.com/freebsd/freebsd-src/pull/1201

4 weeks agopf: convert DIOCGETSTATUS to netlink
Kristof Provost [Sat, 23 Mar 2024 06:31:51 +0000 (07:31 +0100)]
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")

4 weeks agolibpfctl: allow access to the fd
Kristof Provost [Wed, 24 Apr 2024 06:40:05 +0000 (08:40 +0200)]
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

4 weeks agolibpfctl: fix incorrect pcounters array size
Kristof Provost [Fri, 26 Apr 2024 14:07:38 +0000 (16:07 +0200)]
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

4 weeks agopackage: fix dependency generation
Lexi Winter [Mon, 29 Apr 2024 14:30:46 +0000 (08:30 -0600)]
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

4 weeks agopackage: FreeBSD-periodic should depend on FreeBSD-cron
Lexi Winter [Mon, 29 Apr 2024 14:29:13 +0000 (08:29 -0600)]
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

4 weeks agoservices.5: describe better
Alexander Ziaee [Mon, 29 Apr 2024 14:00:01 +0000 (08:00 -0600)]
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

4 weeks agoAdd libxo support to du
Nathan Huff [Mon, 29 Apr 2024 04:59:18 +0000 (22:59 -0600)]
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

4 weeks agoarm64/vmm: Handle VM_EXITCODE_SUSPENDED
Mark Johnston [Mon, 29 Apr 2024 14:19:27 +0000 (10:19 -0400)]
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

4 weeks agobhyve: Fix handling of -r
Mark Johnston [Mon, 29 Apr 2024 14:13:50 +0000 (10:13 -0400)]
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: 981f9f7495bb ("bhyve: Push option parsing down into bhyverun_machdep.c")
Differential Revision: https://reviews.freebsd.org/D44974

4 weeks agoadduser: Really fix a syntax error
Dag-Erling Smørgrav [Mon, 29 Apr 2024 10:29:35 +0000 (12:29 +0200)]
adduser: Really fix a syntax error

Fixes: 5cafc38f1129
Differential Revision: https://reviews.freebsd.org/D44871

4 weeks agolibulog: Make sure ut_line, ut_user, ut_host are terminated.
Dag-Erling Smørgrav [Mon, 29 Apr 2024 10:11:12 +0000 (12:11 +0200)]
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

4 weeks agolibarchive: merge from vendor branch
Martin Matuska [Mon, 29 Apr 2024 08:15:04 +0000 (10:15 +0200)]
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

4 weeks agoCherry-pick commits from libarchive to vendor/libarchive
Martin Matuska [Mon, 29 Apr 2024 07:18:17 +0000 (09:18 +0200)]
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

4 weeks agorights.4: various corrections on capability rights
CismonX [Mon, 29 Apr 2024 04:48:26 +0000 (22:48 -0600)]
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

4 weeks agoglabel: Add support for Linux swap
Ricardo Branco [Mon, 29 Apr 2024 04:38:15 +0000 (22:38 -0600)]
glabel: Add support for Linux swap

Reviewed by: imp, kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1205

4 weeks agopackage: move OpenBSM auditing into its own package
Lexi Winter [Wed, 24 Apr 2024 17:54:44 +0000 (18:54 +0100)]
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

4 weeks agopackage: move authpf into the FreeBSD-pf package
Lexi Winter [Mon, 29 Apr 2024 04:31:02 +0000 (22:31 -0600)]
package: move authpf into the FreeBSD-pf package

Reviewed by: imp, manu
Pull Request: https://github.com/freebsd/freebsd-src/pull/1198

4 weeks agoUPDATING: add entry for recent pkgbase changes
Lexi Winter [Mon, 29 Apr 2024 04:28:49 +0000 (22:28 -0600)]
UPDATING: add entry for recent pkgbase changes

Reviewed by: imp, manu
Pull Request: https://github.com/freebsd/freebsd-src/pull/1196

4 weeks agosetkey: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Elyes Haouas [Tue, 7 Nov 2023 17:38:15 +0000 (18:38 +0100)]
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>
4 weeks agoipf: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Elyes Haouas [Tue, 7 Nov 2023 17:38:03 +0000 (18:38 +0100)]
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>
4 weeks agocamcontrol: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Elyes Haouas [Tue, 7 Nov 2023 17:37:33 +0000 (18:37 +0100)]
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>
4 weeks agoipfw: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Elyes Haouas [Tue, 7 Nov 2023 17:36:35 +0000 (18:36 +0100)]
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>
4 weeks agozonectl: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Elyes Haouas [Tue, 7 Nov 2023 17:14:45 +0000 (18:14 +0100)]
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>
4 weeks agowlandebug: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Elyes Haouas [Tue, 7 Nov 2023 17:14:34 +0000 (18:14 +0100)]
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>
4 weeks agousbconfig: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Elyes Haouas [Tue, 7 Nov 2023 17:14:17 +0000 (18:14 +0100)]
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>
4 weeks agorwhod: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Elyes Haouas [Tue, 7 Nov 2023 17:13:47 +0000 (18:13 +0100)]
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>
4 weeks agopstat: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Elyes Haouas [Tue, 7 Nov 2023 17:13:32 +0000 (18:13 +0100)]
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>
4 weeks agoppp: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Elyes Haouas [Tue, 7 Nov 2023 17:13:19 +0000 (18:13 +0100)]
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>
4 weeks agondp: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Elyes Haouas [Tue, 7 Nov 2023 17:13:02 +0000 (18:13 +0100)]
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>
4 weeks agomoused: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Elyes Haouas [Tue, 7 Nov 2023 17:12:44 +0000 (18:12 +0100)]
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>
4 weeks agokbdcontrol: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Elyes Haouas [Tue, 7 Nov 2023 17:11:56 +0000 (18:11 +0100)]
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>
4 weeks agoctld: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Elyes Haouas [Tue, 7 Nov 2023 17:11:34 +0000 (18:11 +0100)]
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>
4 weeks agoctladm: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Elyes Haouas [Tue, 7 Nov 2023 17:11:10 +0000 (18:11 +0100)]
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>
4 weeks agobtxld: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Elyes Haouas [Tue, 7 Nov 2023 17:10:52 +0000 (18:10 +0100)]
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>
4 weeks agortadvctl: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Elyes Haouas [Mon, 29 Apr 2024 02:55:30 +0000 (20:55 -0600)]
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>
4 weeks agortadvd: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Elyes Haouas [Mon, 29 Apr 2024 02:55:30 +0000 (20:55 -0600)]
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>
4 weeks agobluetooth: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Elyes Haouas [Mon, 29 Apr 2024 02:55:30 +0000 (20:55 -0600)]
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>
4 weeks agoaxgbe: Various stability improvements
Stephan de Wit [Mon, 29 Apr 2024 01:57:26 +0000 (19:57 -0600)]
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

4 weeks agounionfs_rename: fix numerous locking issues
Jason A. Harmening [Sun, 18 Feb 2024 00:20:51 +0000 (18:20 -0600)]
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

4 weeks agoRELNOTES: Fix wrong commit hash
Christos Margiolis [Sun, 28 Apr 2024 19:59:17 +0000 (21:59 +0200)]
RELNOTES: Fix wrong commit hash

Fixes: 25723d66369f ("sound: Retire unit.*")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 weeks agosound: Remove chn_timeout check from chn_init()
Christos Margiolis [Sun, 28 Apr 2024 19:47:33 +0000 (21:47 +0200)]
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

4 weeks agosound: Add missing space in dev.pcm.X.mode description
Christos Margiolis [Sun, 28 Apr 2024 19:47:11 +0000 (21:47 +0200)]
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

4 weeks agosound: Move pcm_chnref() and pcm_chnrelease() to pcm/channel.c
Christos Margiolis [Sun, 28 Apr 2024 19:46:55 +0000 (21:46 +0200)]
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

4 weeks agosound: Merge pcm_chn_destroy() and chn_kill()
Christos Margiolis [Sun, 28 Apr 2024 19:46:08 +0000 (21:46 +0200)]
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

4 weeks agosound: Retire unit.*
Christos Margiolis [Sun, 28 Apr 2024 19:44:35 +0000 (21:44 +0200)]
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

4 weeks agosound: Assert that we do not enter chn_sleep() with CHN_F_SLEEPING
Christos Margiolis [Sun, 28 Apr 2024 19:40:52 +0000 (21:40 +0200)]
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

4 weeks agosound: Fix panic caused by sleeping-channel destruction during asynchronous detach
Christos Margiolis [Sun, 28 Apr 2024 19:40:40 +0000 (21:40 +0200)]
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 44e128fe9d92, 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: 44e128fe9d92 ("sound: Implement asynchronous device detach")
Sponsored by: The FreeBSD Foundation
MFC after: 1 day
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D44923

4 weeks agosound: Wrap dsp_clone() and mixer_clone() with bus_topo_lock()
Christos Margiolis [Sun, 28 Apr 2024 19:40:29 +0000 (21:40 +0200)]
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

4 weeks agosound: Fix NULL dereference in dsp_clone() and mixer_clone()
Christos Margiolis [Sun, 28 Apr 2024 19:40:14 +0000 (21:40 +0200)]
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

4 weeks agortld snprintf: do not erronously skip a char at the buffer boundary
Konstantin Belousov [Sun, 28 Apr 2024 06:37:24 +0000 (09:37 +0300)]
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

4 weeks agogettimeofday.2: Do mention improbable future removal
Mateusz Piotrowski [Sun, 28 Apr 2024 18:06:05 +0000 (20:06 +0200)]
gettimeofday.2: Do mention improbable future removal

As kib@ noted:

> Obviously gettimeofday(2) is not going to be removed
> even in the far future.

Reported by: kib
Fixes: 4395d3ced5cf Document that gettimeofday() is obsolescent
MFC after: 3 days

4 weeks agodate: Correctly check outcome of mktime().
Dag-Erling Smørgrav [Sun, 28 Apr 2024 17:12:58 +0000 (19:12 +0200)]
date: Correctly check outcome of mktime().

X-MFC-With: 7b390cb63689
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D44982

4 weeks agobhyve.8: Update and rearrange to improve readability
Chris Moerz [Fri, 26 Apr 2024 18:23:13 +0000 (15:23 -0300)]
bhyve.8: Update and rearrange to improve readability

bhyve's man page is a very long block of text that has grown to
proportions that make it hard to read.  In particular, the level of
nesting of various content means man can no longer render the text in a
user-friendly way.

To remedy this:
- move the -s argument documentation into a separate section and
  reformat the various arguments so they are consistent
- add documentation on how to use the -o config.dump feature
- make the listing of various arguments more consistent
- consolidated duplicate listings of TPM backends
- add an example for the config.dump feature
- fix various formatting inconsistencies.

Reviewed by: emaste, imp, jrm, Pau Amma <pauamma@gundo.com>, rgrimes
Differential Revision: https://reviews.freebsd.org/D43940

4 weeks agobitset: Add ORNOT macros
Jake Freeland [Sun, 28 Apr 2024 00:20:34 +0000 (19:20 -0500)]
bitset: Add ORNOT macros

Macros to ANDNOT a bitset currently exist, but there are no ORNOT
equivalents. Introduce ORNOT macros for bitset(9), cpuset(9), and
domainset(9).

Approved by: markj (mentor)
Reviewed by: markj
MFC after: 1 week
Sponsored by: NIKSUN, Inc.
Differential Revision: https://reviews.freebsd.org/D44976

4 weeks agonfscl: Clear out a lot of cruft related to B_DIRECT
Rick Macklem [Sun, 28 Apr 2024 00:10:48 +0000 (17:10 -0700)]
nfscl: Clear out a lot of cruft related to B_DIRECT

There is only one place in the unpatched sources where B_DIRECT is
set in the NFS client and this code is never executed. As such, this patch
removes this code that is never executed, since B_DIRECT should never
be set.

During a IETF testing event this week, I saw a crash in ncl_doio_directwrite(),
but this function is only called if B_DIRECT is set.
I cannot explain how ncl_doio_directwrite() got called, but once this patch
was applied to the sources, the crash did not recur. This is not surprising,
since this patch deleted the function.

Reviewed by: kib, markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D44980

4 weeks agouuidgen(1): Add EXAMPLES to manual page
Fernando Apesteguía [Thu, 7 Sep 2023 15:17:38 +0000 (17:17 +0200)]
uuidgen(1): Add EXAMPLES to manual page

Approved by: manpages@ (gbe@)
Reviewed by: gbe@, pauamma
Differential Revision: https://reviews.freebsd.org/D43494

5 weeks agosnd_hdspe(4): Recognize newer firmware's PCI vendor id.
Florian Walpen [Sat, 27 Apr 2024 08:48:37 +0000 (09:48 +0100)]
snd_hdspe(4): Recognize newer firmware's PCI vendor id.

At least for HDSPe RayDAT cards, newer firmware comes with RME's own PCI
vendor id instead of the Xilinx one. Other HDSPe cards are probably also
affected. Update snd_hdspe(4) to recognize both the old Xilinx and the
new RME vendor ids.

Differential Revision: https://reviews.freebsd.org/D44978
MFC after: 1 day

5 weeks agokrpc: Ref cnt the client structures for TLS upcalls
Rick Macklem [Sat, 27 Apr 2024 00:55:24 +0000 (17:55 -0700)]
krpc: Ref cnt the client structures for TLS upcalls

A crash occurred during testing, where the client structures had
already been free'd when the upcall thread tried to lock them.

This patch acquires a reference count on both of the structures
and these are released when the upcall is done, so that the
structures cannot be free'd prematurely.  This happened because
the testing is done over a very slow vpn.

Found during a IETF bakeathon testing event this week.

MFC after: 5 days

5 weeks agoscript: handle terminal resize on SIGWINCH
Kyle Evans [Fri, 26 Apr 2024 16:12:00 +0000 (11:12 -0500)]
script: handle terminal resize on SIGWINCH

Add a -w flag to forward terminal resize events on to the child, which
can be useful in some circumstances to avoid terminal corruption.

Reviewed by: des
Co-authored-by: Xavier Beaudouin <xavier.beaudouin@klarasystems.com>
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D44167

5 weeks agoscript: minor style improvements
Xavier Beaudouin [Fri, 26 Apr 2024 16:10:15 +0000 (11:10 -0500)]
script: minor style improvements

Fix some nits pointed out by checkstyle9.pl in advance of functional
changes to script(1).

Reviewed by: des
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D44167

5 weeks agodate: Fix tests by initializing timespec structure
Mateusz Piotrowski [Fri, 26 Apr 2024 15:19:18 +0000 (17:19 +0200)]
date: Fix tests by initializing timespec structure

The tests related to nanosecond support were failing on amd64 due to
uninitialized timespec structure.

Fixes: eeb04a736cb9 date: Add support for nanoseconds
Reviewed by: markj
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D44975

5 weeks agoUpdate vendor/libarchive to 3.7.4
Martin Matuska [Fri, 26 Apr 2024 10:11:59 +0000 (12:11 +0200)]
Update vendor/libarchive to 3.7.4

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

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
 #2108 zip: Update AppleDouble support for directories
 #2071 zstd: Implement core detection

Obained from: libarchive
Libarchive commit: 313aa1fa10b657de791e3202c168a6c833bc3543

5 weeks agostyle.9: Document the existence of tools/build/checkstyle9.pl
Mateusz Piotrowski [Fri, 26 Apr 2024 09:37:01 +0000 (11:37 +0200)]
style.9: Document the existence of tools/build/checkstyle9.pl

MFC after: 3 days
Sponsored by: Klara, Inc.

5 weeks agodate: Add support for nanoseconds
Mateusz Piotrowski [Sun, 21 Apr 2024 21:25:32 +0000 (23:25 +0200)]
date: Add support for nanoseconds

This patch introduces support for a conversion specification for
nanoseconds.

The format of %N is meant to be compatible with that of GNU date.

The nanoseconds conversion specification is implemented directly in
date(1) instead of libc (in strftime(3)) to avoid introducing
non-standard functions to libc at this time and modifying struct tm.

Apart from introducing the nanoseconds conversion specification, this
patch brings the following changes:

- The "ns" format for ISO 8061 dates is now unlocked. E.g., date -Ins
  prints:
      2024-04-22T12:20:28,763742224+02:00
- The -r flag when fed a file is now aware of the nanosecond part of the last
  modification time.
- date(1) is now able to set the time with nanosecond precision. It is
  not possible as of now to do that by specifying nanoseconds directly
  via the command-line arguments. Instead, the -r flag can be used.
- date(1) is now using the clock_gettime(3) family of functions instead
  of ctime(3) family of functions where possible.

Reviewed by: des, markj
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D44905

5 weeks agostress2: More detailed error reporting
Peter Holm [Fri, 26 Apr 2024 08:20:49 +0000 (10:20 +0200)]
stress2: More detailed error reporting

5 weeks agonfscl: Do not use nfso_own for delayed nfsrpc_doclose()
Rick Macklem [Fri, 26 Apr 2024 03:58:21 +0000 (20:58 -0700)]
nfscl: Do not use nfso_own for delayed nfsrpc_doclose()

When an initial attempt to close an NFSv4 lock returns NFSERR_DELAY,
the open structure is put on a list for delayed closing.  When this
is done, the nfso_own field is set to NULL, so it cannot be used by
nfsrpc_doclose().

Without this patch, the NFSv4 client can crash when a NFSv4 server
replies NFSERR_DELAY to a Close operation.  Fortunately, most extant
NFSv4 servers do not do this.  This patch avoids the crash for any
that do return NFSERR_DELAY for Close.

Found during a IETF bakeathon testing event this week.

MFC after: 5 days

5 weeks agoCTL: READ(6) should be allowed on CD devices
HP van Braam [Fri, 26 Apr 2024 02:31:12 +0000 (20:31 -0600)]
CTL: READ(6) should be allowed on CD devices

DOS ASPI drivers use this, with this change applied it is possible to
load a DOS ASPI CDROM driver and run the Windows 98 installer.

Signed-off-by: HP van Braam <hp@tmm.cx>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1202

5 weeks agonvmecontrol: Flesh out nvmecontrol format information
Warner Losh [Thu, 25 Apr 2024 23:47:18 +0000 (17:47 -0600)]
nvmecontrol: Flesh out nvmecontrol format information

The format command takes a number of different parameters. Include a
brief summary of what the values mean, though since the driver's support
for metadata is at best weak, 0's are almost always used for values
other than -f format. Add an example that ties it all together.

Sponsored by: Netflix
Reviewed by: pauamma@gundo.com, chuck
Differential Revision: https://reviews.freebsd.org/D44958

5 weeks agorelease: remove the RPI CM4s .dtb
Kyle Evans [Thu, 25 Apr 2024 22:10:32 +0000 (17:10 -0500)]
release: remove the RPI CM4s .dtb

This isn't actually packaged by the sysutils/rpi-firmware port, so we
cannot include it in the image.  Fix the RPI release build until an
interested party adds it to the port and packages are available.

Reported by: cperciva

5 weeks agoRevert "config.mk: Add MK_VIMAGE knob"
Brooks Davis [Thu, 25 Apr 2024 21:38:15 +0000 (22:38 +0100)]
Revert "config.mk: Add MK_VIMAGE knob"

This commit broke "make makeman" checks in github CI due to a lack of
option description files.  The split between VIMAGE and VIMAGE_SUPPORT
is not clearly justified and the code is broken because there is no
opt_vimage.h (it's in opt_global.h).

This reverts commit 22ca6db50f4e6bd75a141f57cf953d8de6531a06.

5 weeks agonfscl: Revert part of commit 196787f79e67
Rick Macklem [Thu, 25 Apr 2024 19:32:02 +0000 (12:32 -0700)]
nfscl: Revert part of commit 196787f79e67

Commit 196787f79e67 erroneously assumed that the client code for
Open/Claim_deleg_cur_FH was broken, but it was not.
It was actually wireshark that was broken and indicated
that the correct XDR was bogus.

This reverts the part of 196787f79e67 that changed the arguments for
Open/Claim_deleg_cur_FH.

Found during the IETF bakeathon testing event this week.

MFC after: 3 days

5 weeks agotftpd: Immediately reject any request shorter than 4 bytes.
Dag-Erling Smørgrav [Thu, 25 Apr 2024 18:35:28 +0000 (20:35 +0200)]
tftpd: Immediately reject any request shorter than 4 bytes.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D44957

5 weeks agotftpd: Check the server status after each test.
Dag-Erling Smørgrav [Thu, 25 Apr 2024 18:35:24 +0000 (20:35 +0200)]
tftpd: Check the server status after each test.

* In the setup phase, wait for the server to start (or fail to start)
  before proceeding with the test.  This makes it possible to write test
  cases that don't expect a response from the server without ending up
  in a race over the server PID file.
* After running each test, wait up to 30 seconds for the server to exit
  and check that the exit status matches what the test case says to
  expect (usually 0).
* We still kill and collect the server in the cleanup phase, in case the
  test ended early.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D44956

5 weeks agotftpd: Clean up the tests.
Dag-Erling Smørgrav [Thu, 25 Apr 2024 18:35:20 +0000 (20:35 +0200)]
tftpd: Clean up the tests.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D44955

5 weeks agotftpd: Use `size_t` where appropriate.
Dag-Erling Smørgrav [Thu, 25 Apr 2024 18:35:15 +0000 (20:35 +0200)]
tftpd: Use `size_t` where appropriate.

* Limit the use of `ssize_t` to only where it's needed.
* Correct one case of `int` being used for a length.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D44954

5 weeks agoif_bridge: Minor style fixes
Zhenlei Huang [Thu, 25 Apr 2024 18:19:11 +0000 (02:19 +0800)]
if_bridge: Minor style fixes

And more comments on the #ifdef INET blocks to improve readability.

While here, revert the order of two prototypes to produce minimal diff
compared to stable branches.

MFC with: 65767e6126a7

5 weeks agobsdinstall: update comment related to pkg
Bjoern A. Zeeb [Thu, 25 Apr 2024 14:47:30 +0000 (14:47 +0000)]
bsdinstall: update comment related to pkg

pkg_add has been gone since 2013(?).  Refer to pkg(8) instead.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: jrtc27
Differential Revision: https://reviews.freebsd.org/D44946

5 weeks agoMerge commit 0f329e0246d1 from llvm-project (by Dimitry Andric):
Dimitry Andric [Thu, 25 Apr 2024 16:47:31 +0000 (18:47 +0200)]
Merge commit 0f329e0246d1 from llvm-project (by Dimitry Andric):

  [sanitizer_symbolizer] Cast arguments for format strings in markup (#89815)

  When compiling the common sanitizer libraries, there are many warnings
  about format specifiers, similar to:

      compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp:31:32: warning: format specifies type 'void *' but the argument has type 'uptr' (aka 'unsigned long') [-Wformat]
         31 |   buffer->AppendF(kFormatData, DI->start);
            |                   ~~~~~~~~~~~  ^~~~~~~~~
      compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup_constants.h:33:46: note: format string is defined here
         33 | constexpr const char *kFormatData = "{{{data:%p}}}";
            |                                              ^~
            |                                              %lu
      compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp:46:43: warning: format specifies type 'void *' but the argument has type 'uptr' (aka 'unsigned long') [-Wformat]
         46 |   buffer->AppendF(kFormatFrame, frame_no, address);
            |                   ~~~~~~~~~~~~            ^~~~~~~
      compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup_constants.h:36:48: note: format string is defined here
         36 | constexpr const char *kFormatFrame = "{{{bt:%u:%p}}}";
            |                                                ^~
            |                                                %lu
      ...

  This is because `uptr` is dependent on the platform, and can be either
  `unsigned long long`, `unsigned long`, or `unsigned int`.

  To fix the warnings, cast the arguments to the expected type of the
  format strings.

PR: 276104
Reported by: pstef
MFC after: 3 days

5 weeks agoRevert "nfsd: Fix NFSv4.1/4.2 Claim_Deleg_Cur_FH"
Rick Macklem [Thu, 25 Apr 2024 16:41:23 +0000 (09:41 -0700)]
Revert "nfsd: Fix NFSv4.1/4.2 Claim_Deleg_Cur_FH"

This reverts commit f300335d9aebf2e99862bf783978bd44ede23550.

It turns out that the old code was correct and it was wireshark
that was broken and indicated that the RPC's XDR was bogus.
Found during IETF bakeathon testing this week.

5 weeks agoSkip building libclang_rt when WITHOUT_CLANG is used
Dimitry Andric [Thu, 25 Apr 2024 15:05:29 +0000 (17:05 +0200)]
Skip building libclang_rt when WITHOUT_CLANG is used

As noted in bug 277096, when building a pkgbase repository using
WITHOUT_CROSS_COMPILER and WITHOUT_TOOLCHAIN (which sets WITHOUT_CLANG),
the following residual files are left over:

/usr/lib/clang/18/lib/freebsd/libclang_rt.asan-x86_64.so
/usr/lib/clang/18/share/asan_ignore_list.txt
/usr/lib/clang/18/share/cfi_ignore_list.txt
/usr/lib/clang/18/share/msan_ignore_list.txt

This is because the lib/libclang_rt directory is still descended into,
even if WITHOUT_CLANG is used. Fix it by not descending into the
libclang_rt directory in that case.

PR: 277096
Reported by: Siva Mahadevan <me@svmhdvn.name>
MFC after: 3 days

5 weeks agokthread: Set *tdptr earlier in kproc_kthread_add()
Mark Johnston [Thu, 25 Apr 2024 13:35:38 +0000 (09:35 -0400)]
kthread: Set *tdptr earlier in kproc_kthread_add()

See commit ae77041e0714 ("kthread: Set *newtdp earlier in
kthread_add1()") for details.  That commit was incomplete since
g_init()'s first call to kproc_kthread_add() will cause
kproc_kthread_add() to take the `*procptr == NULL` branch, which avoids
kthread_create().

To ensure that the thread pointer is initialized before the thread
starts running, we have to start the kernel process with RFSTOPPED.
We could perhaps go further and use RFSTOPPED only when tdptr != NULL,
but it's probably better to have consistent behaviour.

Reviewed by: olce, kib
Reported by: syzbot+e91e798f3c088215ace6@syzkaller.appspotmail.com
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D44927

5 weeks agocheckstyle9: Allow a space between "*" and _*restrict
Mateusz Piotrowski [Tue, 23 Apr 2024 10:29:02 +0000 (12:29 +0200)]
checkstyle9: Allow a space between "*" and _*restrict

Before the change, we would get errors like this:

    ERROR: "foo * bar" should be "foo *bar"
    #369: FILE: foobar.c:369:
    +barbaz(char * __restrict s,

Reviewed by: des, imp
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D44911

5 weeks agosync.8: Document that the "sync dance" is not a thing
Mateusz Piotrowski [Tue, 23 Apr 2024 14:12:45 +0000 (16:12 +0200)]
sync.8: Document that the "sync dance" is not a thing

People still believe that it is essential to run sync(8) a couple of
times before a reboot/halt. Document that this has not been necessary
for a long time now.

Reviewed by: imp, bcr, Pau Amma <pauamma@gundo.com>
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D33233

5 weeks agoDocument that gettimeofday() is obsolescent
Mateusz Piotrowski [Wed, 24 Apr 2024 11:31:54 +0000 (13:31 +0200)]
Document that gettimeofday() is obsolescent

Reported by: kaktus
Reviewed by: kaktus, pstef
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D23942

5 weeks agoaccept_filter: return different errors for non-listener and a busy socket
Gleb Smirnoff [Thu, 25 Apr 2024 04:50:58 +0000 (21:50 -0700)]
accept_filter: return different errors for non-listener and a busy socket

The fact that an accept filter needs to be cleared first before setting to
a different one isn't properly documented.  The requirement that the
socket needs already be listening, although trivial, isn't documented
either.  At least return a more meaningful error than EINVAL for an
existing filter.  Cover this with a test case.

5 weeks agoaccf_tls: accept filter that waits for TLS handshake header
Gleb Smirnoff [Wed, 24 Apr 2024 20:36:43 +0000 (13:36 -0700)]
accf_tls: accept filter that waits for TLS handshake header