]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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 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

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

6 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

6 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

6 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

6 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

6 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.

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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.

6 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

6 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

6 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

6 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

6 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

6 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.

6 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

6 weeks agosyscalls.master: correct return type of {read,write}v
Brooks Davis [Wed, 24 Apr 2024 19:47:22 +0000 (20:47 +0100)]
syscalls.master: correct return type of {read,write}v

This was missed when read/write, etc were updated to return ssize_t.

Fixes: 2e83b2816183 Fix a few syscall arguments to use size_t instead of u_int.

Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D44930

6 weeks agovfs_lookup.c: only call ktrcapfail() if KTRACE is enabled
Konstantin Belousov [Wed, 24 Apr 2024 19:06:14 +0000 (22:06 +0300)]
vfs_lookup.c: only call ktrcapfail() if KTRACE is enabled

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

6 weeks agosys/namei.h: move NI_CAP_VIOLATION() macro from namei.h to vfs_lookup.c
Konstantin Belousov [Wed, 24 Apr 2024 18:55:37 +0000 (21:55 +0300)]
sys/namei.h: move NI_CAP_VIOLATION() macro from namei.h to vfs_lookup.c

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

6 weeks agometa.autodep.mk do not override start_utc
Simon J. Gerraty [Wed, 24 Apr 2024 19:25:42 +0000 (12:25 -0700)]
meta.autodep.mk do not override start_utc

Update meta.autodep.mk
If included at level 0 it is important not to override start_utc

6 weeks agoelf_common.h: Add STO_AARCH64_VARIANT_PCS
Andrew Turner [Wed, 17 Apr 2024 13:18:24 +0000 (14:18 +0100)]
elf_common.h: Add STO_AARCH64_VARIANT_PCS

This is used to mark symbols that use a variant procedure call with
a different calling convention to the main ABI.

Reviewed by: kib, imp
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D44868

6 weeks agoshowconfig: Set MACHINE for src.opts.mk
Andrew Turner [Thu, 18 Apr 2024 15:22:46 +0000 (16:22 +0100)]
showconfig: Set MACHINE for src.opts.mk

Also set MACHINE and MACHINE_ARCH when reading config options from
src.opts.mk. This ensures any machine-dependent options are reported
correctly.

Reviewed by: emaste, imp
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D44838

6 weeks agoarm64: Check DMAP address is valid in PHYS_IN_DMAP
Andrew Turner [Mon, 8 Apr 2024 10:44:33 +0000 (10:44 +0000)]
arm64: Check DMAP address is valid in PHYS_IN_DMAP

When checking if a physical address is in the DMAP region we assume
all physical addresses between DMAP_MIN_PHYSADDR and DMAP_MAX_PHYSADDR
are able to be accesses through the DMAP. It may be the case that
there is device memory in this range that shouldn't be accessed through
the DMAP mappings.

Add a check to PHYS_IN_DMAP that the translated virtual address is a
valid kernel address. To support code that already checks the address
is valid add PHYS_IN_DMAP_RANGE.

PR: 278233
Reviewed by: alc, markj
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D44677

6 weeks agoarm64/vmm: Ensure the tlbi has completed
Andrew Turner [Mon, 15 Apr 2024 14:36:20 +0000 (14:36 +0000)]
arm64/vmm: Ensure the tlbi has completed

Ensure the TLB is invalidated before enabling the EL2 MMU. Without
this the TLB may be in an inconsistant state leading to a possible
exception when enabling the MMU.

PR: 277559
Reviewed by: markj
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D44799

6 weeks agobhyve.8: Document arm64 support
Mark Johnston [Wed, 24 Apr 2024 13:57:42 +0000 (09:57 -0400)]
bhyve.8: Document arm64 support

- Mention the options that are amd64-only.
- Provide a minimal example for booting an arm64 guest.

Reviewed by: corvink
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D44738

6 weeks agovmrun.sh: Stop passing -A to bhyve
Mark Johnston [Wed, 24 Apr 2024 13:57:50 +0000 (09:57 -0400)]
vmrun.sh: Stop passing -A to bhyve

It's a no-op now.

Sponsored by: Innovate UK

6 weeks agobhyve.8: Remove mention of the -A flag
Mark Johnston [Wed, 24 Apr 2024 13:57:12 +0000 (09:57 -0400)]
bhyve.8: Remove mention of the -A flag

It is a no-op on amd64 now and is not implemented on arm64, so let's
remove mention of it altogether so as to reduce confusion for arm64
users.

Reviewed by: corvink, jhb
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D44737

6 weeks agogeli.8: add some notes regarding performance tuning
Alan Somers [Mon, 22 Apr 2024 21:52:07 +0000 (15:52 -0600)]
geli.8: add some notes regarding performance tuning

MFC after: 1 week
Sponsored by: Axcient
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D44908

6 weeks agobusdma: uma_zcreate() does not fail
Mark Johnston [Tue, 23 Apr 2024 16:23:13 +0000 (12:23 -0400)]
busdma: uma_zcreate() does not fail

No functional change intended.

MFC after: 1 week

6 weeks agokhelp: uma_zcreate() does not fail
Mark Johnston [Tue, 23 Apr 2024 16:22:27 +0000 (12:22 -0400)]
khelp: uma_zcreate() does not fail

No functional change intended.

MFC after: 1 week

6 weeks agoudf: uma_zcreate() does not fail
Mark Johnston [Tue, 23 Apr 2024 16:20:50 +0000 (12:20 -0400)]
udf: uma_zcreate() does not fail

While here remove an old comment regarding preallocation; it appears to
refer to an optimization that is almost certainly irrelevant at this
point.

No functional change intended.

MFC after: 1 week

6 weeks agowg: uma_zcreate() does not fail
Mark Johnston [Tue, 23 Apr 2024 16:19:08 +0000 (12:19 -0400)]
wg: uma_zcreate() does not fail

No functional change intended.

MFC after: 1 week

6 weeks agodpaa: uma_zcreate() does not fail
Mark Johnston [Tue, 23 Apr 2024 16:18:21 +0000 (12:18 -0400)]
dpaa: uma_zcreate() does not fail

No functional change intended.

MFC after: 1 week

6 weeks agong_pipe: Do not panic when memory allocations fail
Martin Vahlensieck [Wed, 17 Apr 2024 19:01:34 +0000 (21:01 +0200)]
ng_pipe: Do not panic when memory allocations fail

Signed-off-by: Martin Vahlensieck <git@academicsolutions.ch>
Reviewed by: markj
MFC after: 2 weeks
Pull Request: https://github.com/freebsd/freebsd-src/pull/1181

6 weeks agong_pipe: Replace deprecated random() with prng32_bounded()
Martin Vahlensieck [Wed, 17 Apr 2024 18:59:22 +0000 (20:59 +0200)]
ng_pipe: Replace deprecated random() with prng32_bounded()

Signed-off-by: Martin Vahlensieck <git@academicsolutions.ch>
MFC after: 2 weeks
Reviewed by: markj
Pull Request: https://github.com/freebsd/freebsd-src/pull/1181

6 weeks agong_pipe: Remove node when all hooks are disconnected
Martin Vahlensieck [Wed, 17 Apr 2024 18:51:40 +0000 (20:51 +0200)]
ng_pipe: Remove node when all hooks are disconnected

This is the behavior described in the man page.

Signed-off-by: Martin Vahlensieck <git@academicsolutions.ch>
Discussed with: glebius
Reviewed by: markj
MFC after: 2 weeks
Pull Request: https://github.com/freebsd/freebsd-src/pull/1181

6 weeks agong_pipe: Fix whitespace
Martin Vahlensieck [Wed, 17 Apr 2024 18:50:39 +0000 (20:50 +0200)]
ng_pipe: Fix whitespace

Signed-off-by: Martin Vahlensieck <git@academicsolutions.ch>
Reviewed by: markj
MFC after: 2 weeks
Pull Request: https://github.com/freebsd/freebsd-src/pull/1181

6 weeks agoheimdal: Fix compiling hdb ldap as a module
Cy Schubert [Fri, 10 Jan 2014 19:18:06 +0000 (13:18 -0600)]
heimdal: Fix compiling hdb ldap as a module

Fix build when WITH_OPENLDAP defined.

PR: 278430
Obtained from: Upstream c1c7da7f79

6 weeks agokdc: Add restart option
Cy Schubert [Thu, 18 Apr 2024 18:56:54 +0000 (11:56 -0700)]
kdc: Add restart option

Add a new kdc_restart rc variable that manages kdc (or krb5kdc) under
daemon(8). This automatically restarts the kdc should it fail, i.e.
when it's configured to use LDAP as a backend and cannot connect to its
LDAP directory.

Set kdc_restart="YES" to auto restart kdc on abnormal termination.

Set kdc_restart_delay="N" to the number of seconds to delay before
restarting the kdc. The daemon(8) default seconds applies when not set.

Reported by: Lexi Winter <lexi.freebsd@le-fay.org>
PR: 278395
Differential Revision: https://reviews.freebsd.org/D44898

6 weeks agoMFV: less: Do not trust st_size if it equals zero
Ricardo Branco [Wed, 24 Apr 2024 05:29:46 +0000 (22:29 -0700)]
MFV: less: Do not trust st_size if it equals zero

This is a smaller version of upstream
1fafd968b48e5cea6c85f126d77071a8de707a55 to address the
issue that less not being able to operate on files
residing in pseudo-filesystems that advertize a zero
size value.

PR: bin/276133
MFC after: 3 days

6 weeks agoless: Do not trust st_size if it equals zero
Ricardo Branco [Fri, 5 Jan 2024 19:42:00 +0000 (20:42 +0100)]
less: Do not trust st_size if it equals zero

6 weeks agoRevert "swapon: Do not overwrite Linux swap header"
Warner Losh [Wed, 24 Apr 2024 03:18:00 +0000 (21:18 -0600)]
Revert "swapon: Do not overwrite Linux swap header"

This reverts commit cf04a7775a4e8ff6fd28c768be9daa3d83dd382e.This is
broken on armv7, and closer scrutiny of the reviews shows I was in error
when I thought it was ready.

6 weeks agoRevert "bsdinstall/distfetch.c: check environment variables before downloading and...
Warner Losh [Wed, 24 Apr 2024 03:16:58 +0000 (21:16 -0600)]
Revert "bsdinstall/distfetch.c: check environment variables before downloading and handle memory allocation errors"

This reverts commit 91bdebc958bb0da03f604bad19f99e3b10e96ac7. It wasn't
as ready as I thought

6 weeks agoktrace: Remove CAPFAIL from default trace points
Jake Freeland [Wed, 24 Apr 2024 00:26:14 +0000 (19:26 -0500)]
ktrace: Remove CAPFAIL from default trace points

The CAPFAIL tracepoint was recently extended to report ECAPMODE
capability  violations for processes that do not enter capability mode.
This allows developers that are interested in Capsicumizing their
programs to determine where violations are being raised.

Previously, CAPFAIL only produced output for processes using Capsicum(4)
capabilties. Thus, most ktrace users never received log output from the
trace point. With the recent changes, this is no longer the case.

Having this trace point enabled by default will produce output for all
processes that use syscalls that are not permitted in capability mode.
This may lead to confusion for users that are not familiar with the
feature. Remove KTRFAC_CAPFAIL from ktrace's default points to avoid
this.

Approved by: markj (mentor)
Reviewed by: markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D44887

6 weeks agoktrace: Describe CAPFAIL trace point in man page
Jake Freeland [Wed, 24 Apr 2024 00:25:16 +0000 (19:25 -0500)]
ktrace: Describe CAPFAIL trace point in man page

Update the ktrace(1) man page to describe the recently improved
capability failure tracing.

Approved by: markj (mentor)
Reviewed by: markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D44886

6 weeks agosockets: inherit SO_ACCEPTFILTER from listener to child
Gleb Smirnoff [Wed, 24 Apr 2024 00:17:14 +0000 (17:17 -0700)]
sockets: inherit SO_ACCEPTFILTER from listener to child

This is crucial for operation of accept_filter(9).  See added comment.

Fixes: d29b95ecc0d049406d27a6c11939d40a46658733

6 weeks agobsdinstall/distfetch.c: check environment variables before downloading and handle...
rilysh [Tue, 23 Apr 2024 22:40:19 +0000 (16:40 -0600)]
bsdinstall/distfetch.c: check environment variables before downloading and handle memory allocation errors

1. Currently, distfetch checks environment variables existence
when it will use them or in a case (in chdir()) it doesn't check
at all. As they are necessary to set before doing anything with
it, check them, if they set or not, before proceeding any further.
This also avoids extra cleaning when that environment variable
isn't set.

2. Handle memory allocation error in malloc(PATH_MAX) and replace
(sizeof const char *) with (sizeof char *). Both are similar and
const doesn't have a size.

3. Indent the error message a bit in chdir().

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1071

6 weeks agozfs: merge openzfs/zfs@1f940de07
Martin Matuska [Tue, 23 Apr 2024 21:57:56 +0000 (23:57 +0200)]
zfs: merge openzfs/zfs@1f940de07

Notable upstream pull request merges:
 #16038 1f940de07 L2ARC: Cleanup buffer re-compression
 #16093 c183d164a Parallel pool import
 #16094 cd3e6b4f4 Add zfetch stats in arcstats
 #16103 35bf25848 Fix: FreeBSD Arm64 does not build currently
 #16104 4036b8d02 Refactor dbuf_read() for safer decryption
 #16110 9f83eec03 Handle FLUSH errors as "expected"
 #16117 c346068e5 zfs get: add '-t fs' and '-t vol' options

Obtained from:  OpenZFS
OpenZFS commit: 1f940de07224c2068e7c721222b1f3a519820ca9

6 weeks agoswapon: Do not overwrite Linux swap header
Ricardo Branco [Tue, 23 Apr 2024 21:47:56 +0000 (15:47 -0600)]
swapon: Do not overwrite Linux swap header

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

6 weeks agorelease: Change vmimage EFI GPT label
Jose Luis Duran [Tue, 23 Apr 2024 21:12:30 +0000 (15:12 -0600)]
release: Change vmimage EFI GPT label

This matches the default bsdinstall nomenclature.

PR: 278480
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1188

6 weeks agonanobsd: Set a GPT label for EFI and cfg partitions
Jose Luis Duran [Tue, 23 Apr 2024 21:12:45 +0000 (15:12 -0600)]
nanobsd: Set a GPT label for EFI and cfg partitions

Use efiboot0 for the EFI partition, the nomenclature efiboot + #index
was taken from bsdinstall (zfsboot).

Use cfg for the cfg partition.  Poudriere firmware images are already
using this label.

PR: 278480
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1187

6 weeks agosys/*/conf: do not use "../../conf/" when including std.*
Lexi Winter [Tue, 23 Apr 2024 21:11:24 +0000 (15:11 -0600)]
sys/*/conf: do not use "../../conf/" when including std.*

Since config(8) searches sys/conf by default, there's no need to specify
the full relative path here; replace it by the filename alone.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1124

6 weeks agosys: add conf/std.debug, generic debugging options
Lexi Winter [Tue, 23 Apr 2024 21:11:24 +0000 (15:11 -0600)]
sys: add conf/std.debug, generic debugging options

The new sys/conf/std.debug contains the list of debugging options
enabled by default in -CURRENT, so they don't need to be listed
individually in every kernel config.

The enabled options are the set of all debug options which were enabled
for the GENERIC kernel on any platform.  This means some architectures
now have debugging options enabled in GENERIC which weren't previously
enabled:

- amd64: [1]
- arm64: [2]
- arm: [2]. [3]
- i386: [1], [2]
- powerpc: [1], [2], [3]
- riscv: [2]

[1] ALT_BREAK_TO_DEBUGGER is now enabled.
[2] BUF_TRACKING, FULL_BUF_TRACKING, and QUEUE_MACRO_DEBUG_TRASH are now
    enabled.
[3] DEADLKRES is now enabled.

While here, move the documentation for the (commented out) K*SAN options
for amd64 from GENERIC to NOTES.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1124

6 weeks agosys/netpfil/pf: fix non-INET module build
Lexi Winter [Mon, 22 Apr 2024 21:59:12 +0000 (15:59 -0600)]
sys/netpfil/pf: fix non-INET module build

pf.ko, when built as a module without 'options INET' but with 'options
VIMAGE', won't load:

link_elf_obj: symbol vnet_entry_in_loopback_mask undefined

This is because it uses IN_LOOPBACK(), which in the VIMAGE case uses
INET-specific symbols.

Fix by making this check conditional on #ifdef INET.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1157

6 weeks agosys/net/if_bridge: support non-INET kernels
Lexi Winter [Tue, 23 Apr 2024 21:12:57 +0000 (15:12 -0600)]
sys/net/if_bridge: support non-INET kernels

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1159

6 weeks agoahc(4)/ahd(4): target mode: cancel outstanding AIOs and INOTs
HP van Braam [Tue, 23 Apr 2024 20:47:12 +0000 (14:47 -0600)]
ahc(4)/ahd(4): target mode: cancel outstanding AIOs and INOTs

When disabling a lun there can still be outstanding AIOs and INOTs, when
this happens previously the lun would just fail to disable and trying to
re-use the lun would break the card.

isp(4) in target mode does the same thing when disabling a lun, in
testing this allows re-starting of ctld(8) with connected initiators and
allows initiators to gracefully resume afterwards.

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

6 weeks agoahc(4) clean up old Linux defines
HP van Braam [Tue, 23 Apr 2024 20:55:36 +0000 (14:55 -0600)]
ahc(4) clean up old Linux defines

Linux removed theirs starting in 2018 in commit:
"scsi: aic7xxx: Fix build using bare-metal toolchain"

Also remove now-useless sys/cdefs.h includes

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

6 weeks agocheckstyle9.pl: Warn if there's no SOB line
Warner Losh [Tue, 23 Apr 2024 20:03:28 +0000 (14:03 -0600)]
checkstyle9.pl: Warn if there's no SOB line

If there's no Signed-off-by: line, complain.

Sponsored by: Netflix

6 weeks agopow,powf(3),__ieee754_rem_pio2(f): Avoid negative integer left shift UB
Karl Tomlinson [Tue, 23 Apr 2024 18:18:25 +0000 (12:18 -0600)]
pow,powf(3),__ieee754_rem_pio2(f): Avoid negative integer left shift UB

A compiler clever enough to know that z is positive with a non-zero
biased exponent could, for example, optimize away the scalbnf(z,n) in
pow() because behavior for left shift of negative values is undefined.
`n` is negative when y*log2(|x|) < -0.5.  i.e. |x^y| < sqrt(0.5)

The intended behavior for operator<< in this code is to shift the two's
complement representation of the first operand.

In the pow() functions, the result is added to the IEEE 754 exponent of
z = 2^y'.  n may be negative enough to underflow the biased IEEE 754
exponent below zero, which is manifested in the sign bit of j
(which would correspond to the IEEE 754 sign bit).

The conversion from uint32_t to int32_t for out-of-int32_t-range values
is implementation defined.  The assumed behavior of interpreting the
uint32_t value as a two's complement representation of a signed value
is already assumed in many parts of the code, such as uses of
GET_FLOAT_WORD() with signed integers.

This code passes all the current tests, and makes some out of tree
fuzzing tests pass again rather than hit UB (detailed in the commentary
of the pull request).

Signed-off-by: Karl Tomlinson <karlt+@karlt.net>
Reviewed by: imp, steve kargl, dim
Pull Request: https://github.com/freebsd/freebsd-src/pull/1137

6 weeks agolibc printf_render_errno(): do not use strerror()
Konstantin Belousov [Tue, 23 Apr 2024 17:15:22 +0000 (20:15 +0300)]
libc printf_render_errno(): do not use strerror()

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