1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-27 08:00:11 +00:00
Commit Graph

292607 Commits

Author SHA1 Message Date
Ted Spence
53734ccd42 Potential typo/copy issue
This test here appears to be clamping the start and stop values to a
minimum and maximum. But it looks like one of these lines may have been
copied incorrectly.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1317
2024-07-08 17:36:03 -06:00
Ahmad Khalifa
1dbbce9744 loader.conf.5: Correct terminal size
Signed-off-by: Ahmad Khalifa <ahmadkhalifa570@gmail.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1292
2024-07-08 17:31:02 -06:00
Ahmad Khalifa
3b68c491d3 efi_console: Stay inline with the UEFI spec
The UEFI spec states that the minimum garunteed terminal resolution is
80x25.

Signed-off-by: Ahmad Khalifa <ahmadkhalifa570@gmail.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1292
2024-07-08 17:29:32 -06:00
Warner Losh
4122295afc cdefs(9): Start to document what sys/cdefs.h does
Start to document all the macros and such used to implment our
portability layer. It also describes what compilation environments
we support, what compilers we support and some of the details.

This is round one. All the macros, etc are in here, but some need
descriptions.

These macros, while FreeBSD internal only, do need documentation
on when/where to use them.

This man page likely needs better organization. While better
than sys/cdefs.h, the underlying chaos in that file was hard
to leave completely behind. Suggestions welcome.

Feedback by:	mhorne, Graham Perrin, Alexander Ziaee
Sponsored by:	Netflix
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1313
2024-07-08 16:54:02 -06:00
Mateusz Guzik
0a48720722 vfs cache: add sysctl vfs.cache.param.hitpct
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-07-08 18:17:54 +00:00
Mark Johnston
bea256f3c5 taskqueue: Move the timeout_task definition to _task.h
So that timeout_task may be embedded into structures without pulling in
too many other definitions.  No functional change intended.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
2024-07-08 12:26:35 -04:00
Mark Johnston
713c77b927 man9: Add an MLINK for taskqueue_enqueue_timeout_sbt.9
MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
2024-07-08 12:20:06 -04:00
Mark Johnston
5dfca6c375 ktls: Remove the socket parameter to ktls_ocf_try()
The socket is unused, and not passing it means that there's less to
think about when considering how KTLS is synchronized with the rest of
the socket code.  No functional change intended.

Reviewed by:	gallatin
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D45675
2024-07-08 12:10:48 -04:00
Mark Johnston
163cdf6a32 ktls: Fix races that can lead to double initialization
ktls_enable_rx() and ktls_enable_tx() have checks to return EALREADY if
the socket already has KTLS enabled.  However, these are done without
any locks held and nothing blocks concurrent attempts to set the socket
option.  I believe the worst outcome of the race is leaked memory.

Fix the problem by rechecking under the sockbuf lock.  While here, unify
the locking protocol for sb_tls_info: require both the sockbuf and
socket I/O locks in order to enable KTLS.  This means that either lock
is sufficient for checking whether KTLS is enabled in a given sockbuf,
which simplifies some refactoring further down the road.

Note that the SOLISTENING() check can go away because
SOCK_IO_RECV_LOCK() atomically locks the socket buffer and checks
whether the socket is a listening socket.  This changes the returned
errno value, so update a test which checks it.

Reviewed by:	gallatin
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D45674
2024-07-08 12:10:48 -04:00
Mark Johnston
e2e771deec socket: Pass capsicum rights down to socket option handlers
One needs the CAP_GETSOCKOPT and CAP_SETSOCKOPT rights to call
getsockopt(2) and setsockopt(2) on a socket descriptor, respectively.
The syscall layer checks this, but individual socket option handlers
have no access to the file descriptor and so can't check for additional
rights, should the want to do so.  In particular, a forthcoming
implementation of SO_SPLICE logically requires at least CAP_RECV and
CAP_SEND rights.

Modify the syscall layer to look up Capsicum rights on the descriptor
and pass that along to socket option handlers; this way, the handlers
can check for additional rights if they need to.

Reviewed by:	gallatin, glebius
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D45673
2024-07-08 12:10:48 -04:00
wy-chung
bdf2c8fff9 riscv: Don't need to check the return value with NULL
The return value from pmap_l1_to_l2 and pmap_l2_to_l3 will never be
NULL, so don't need to check their return value with NULL.

Reviewed by:	markj, mhorne
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1311
2024-07-08 12:43:48 -03:00
Mark Johnston
85f7c98d85 sdt: Fix aframe handling after commit ddf0ed09bd
DTrace probes have an "aframes" attribute, used when unwinding the stack
from dtrace_probe().  It counts the number of leading frames to skip
when returning a stack trace, thus is used to hide internal functions.
Commit ddf0ed09bd set the aframes value for SDT probes to 0, which was
correct for an earlier iteration of the patch, but now doesn't take
sdt_probe()/sdt_probe6() into account.

Fix the aframes definition for SDT probes.  Also try to improve
lockstat(1) output by adding an additional aframe for lockstat probes,
which otherwise show internal mtx(9), rwlock(9), etc. functions as the
probe "caller".  This is not quite correct as the number of frames to
skip may differ depending on the lock type and kernel configuration (see
e.g., the MUTEX_NOINLINE kernel option), but this is not a new problem.

Reported by:	mjg
Fixes:	ddf0ed09bd ("sdt: Implement SDT probes using hot-patching")
2024-07-08 11:40:24 -04:00
Mark Johnston
fa6cbe8d60 sdt: Use a multibyte nop for tracepoints on amd64
Differential Revision:	https://reviews.freebsd.org/D45666
2024-07-08 11:40:06 -04:00
Mitchell Horne
b426b8b3b0 arm64: simplify physmap usage in pmap_bootstrap()
The subr_physmem.c facility provides guarantees about non-empty ranges.
Push this into pmap_bootstrap_dmap() and simplify; the lowest physical
memory range is always in the first item.

No functional change intended.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45759
2024-07-08 11:54:00 -03:00
Mitchell Horne
558c1b3733 busdma: avoid buflen underflow
The loop condition in the dmamap_load_buffer() method is 'buflen > 0',
and buflen is an unsigned type (bus_size_t).

A recent change made it possible for sgsize to exceed the remaining
buflen, when the tag has a large alignment requirement. The result is
that we would not break out of the loop at the correct time. Fix this by
avoiding underflow in the subtraction at the end of the loop.

PR:		279383
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Reviewed by:	jhibbits
Fixes:		a77e1f0f81 ("busdma: better handling of small segment bouncing")
Differential Revision:	https://reviews.freebsd.org/D45732
2024-07-08 11:51:31 -03:00
Mitchell Horne
4e148a7baa riscv: include PV chunks in kernel dump
Un-ifdef the call to dump_add_page() in reserve_pv_entries(). We want PV
chunks available in the kernel dump, in case they need inspection.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45760
2024-07-08 11:46:55 -03:00
Mitchell Horne
88d81453b1 riscv: support PV_STATS pmap option
It is rarely used but trivially supported; add the missing stat calls
and enable it in LINT.

Reviewed by:	markj, br (previous version), jhb (previous version)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45475
2024-07-08 11:44:10 -03:00
Mateusz Guzik
0a9aa6fdf5 vfs: make skipping LRU requeue optional
As explained in the comment in the code it is a bottleneck in certain
workloads. On the other hand it does not need to be skipped in most
cases, while transiently running into the lock being contended happens a
lot.
2024-07-08 12:40:20 +00:00
Mariusz Zaborski
96d8f35f2a bde: remove lingering references
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D45874
2024-07-08 12:43:38 +02:00
Ryan Libby
39bda097c0 pci: propagate vpd read error
On read error, we would return -1, but not handle it, causing a zero
size malloc of value, and then we wouldd unconditionally write
value[-1 + 1] = '\0'.  This should be harmless in terms of buffer
overflow because we should get a minimum non-zero size allocation from
malloc, but it also effectively swallowed the error.

Reported by:	GCC -Wstringop-overflow
Reviewed by:	kib, se
Differential Revision:	https://reviews.freebsd.org/D45895
2024-07-07 16:46:58 -07:00
Ryan Libby
f7f9a033f3 rtld: quiet gcc -Wrestrict
Reported by:	GCC -Wrestrict
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45892
2024-07-07 16:46:49 -07:00
Ryan Libby
39733922ed rtld: actually resolve memcpy plt
The call to memcpy() meant to cause plt resolution in _thr_rtld_init()
was getting optimized by the compiler.  Tell the compiler not to use its
builtins in thr_rtld.c.  We could avoid just the memcpy builtin but
disabling all will be more robust against future changes.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45891
2024-07-07 16:46:49 -07:00
Doug Moore
75694e650e swap_pager: speedup meta_transfer
Add a parameter to swp_pager_meta_build, for the benefit of
swp_pager_meta_transfer.

swp_pager_meta_transfer calls swp_pager_xfer_source, which may look up
the same trie entry twice - first, by calling sw_pager_meta_lookup,
and then as the first step in swp_pager_meta_build. A boolean
parameter to swp_pager_meta_build tells that function not to replace a
previously assigned swapblk with a new one, and setting it in this
call makes the first meta_lookup call unnecessary.

swp_pager_meta_transfer calls swp_pager_xfer_source, which may release
and reacquire the source object write lock, because the call to
swp_pager_meta_build may acquire and then release the destination
object write block. But it probably doesn't, so fiddling with the
source object write block was probably unnecessary. This boolean
parameter to swp_pager_meta_build tells it to return immediately if
memory allocation problems are about to require a lock
release/reacquisitiion, so that the caller can release/reacquire the
source object write lock only if truly necessary, around a second call
the swp_pager_meta_build with that boolean parameter not set. This
should make manipulation of the source object write lock rarer.

Reviewed by:	alc, kib (previous version)
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D45781
2024-07-07 18:19:22 -05:00
Joyu Liao
df3f247e46 rpcbind.8: Update the man page for -I
Commit d8a99eaa1f added a new command line option "-I".  This patch
updates the man page for this.

This is a content change.

Reviewed by:	Alexander Ziaee <concussious.bugzilla@runbox.com> (manpages)
Differential Revision:	https://reviews.freebsd.org/D45118
2024-07-07 12:17:57 -07:00
Alexander Ziaee
c2c6f08c8b development.7/FILES: add CONTRIBUTING + git-arc.sh
MFC after: 3 days
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1300
2024-07-07 08:58:37 -06:00
Alexander Ziaee
de2ab11ff9 manuals/description: system video console utilitys
Update the man page descriptions so that apropos are more consistent for
console related man pages.

Motive:		apropos results: clarify consistently
MFC after:	3 days
Reviewed by:	emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1275
2024-07-07 08:54:22 -06:00
Alexander Ziaee
580dc180c7 kbcontrol.1+kbdmap.1: improve manual descriptions
Update the man page descriptions so that apropos {console,keyboard}
finds more relevant man pages.

MFC after:	3 days
Reviewed by:	imp, emase
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1275
2024-07-07 08:54:17 -06:00
Gordon Bergling
6ea81bcaf8 ocs_fc(4): Fix a typo in a kernel message
- s/elasped/elapsed/

MFC after:	5 days
2024-07-07 16:17:23 +02:00
Wolfram Schneider
e880dd644f stale-symlink-buildworld.sh: a script to check for stale symlinks on a FreeBSD system
You can run the script before or after `make installworld'

You may also check your local ports with:

  env STALE_SYMLINK_BUILDWORLD_DIRS=/usr/local ./stale-symlink-buildworld.sh

PR: 276235
2024-07-07 12:59:20 +00:00
Valentine Astakhov
8c108b341c ncal: add -M to start week on Monday in cal mode
MFC after: 2 weeks
Reviewed by: imp, Alexander Ziaee,
Pull Request: https://github.com/freebsd/freebsd-src/pull/1294
2024-07-07 05:55:36 -06:00
Vinícius Ferrão
0bff716674 /sys/dev/bnxt: Enable NPAR support on BCM57504
This commit enables NPAR support for Broadcom 57504 10/25GbE NICs

Signed-off-by: Vinícius Ferrão <vinicius@ferrao.net.br>
Reviewed by: imp,ssaxena,nightquick@proton.me
Pull Request: https://github.com/freebsd/freebsd-src/pull/1306
2024-07-07 05:49:34 -06:00
Jose Luis Duran
7220a45bcc freebsd-update: rsautl is deprecated, use pkeyutl
The command openssl-rsautl(1) has been deprecated in OpenSSL 3.0.  The
openssl-pkeyutl(1) command should be used instead.

Signed-off-by: Jose Luis Duran <jlduran@gmail.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1309
2024-07-07 05:46:58 -06:00
Danilo Egea Gondolfo
12545b8583 fwget: add needed firmware for AMD Raphael GPUs
This GPU is found in Ryzen 7000 series CPUs.

For future reference, the list of firmware versions for amdgpu drivers
can be found in [1].

[1] - https://docs.kernel.org/gpu/amdgpu/driver-misc.html

Reviewed by: imp, Christos Longros
Pull Request: https://github.com/freebsd/freebsd-src/pull/1308
2024-07-07 05:45:37 -06:00
Eric Melville
4c6cf054c9 Stop forcing -g in mpi3mr module because it breaks non-debug install.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1314
2024-07-07 05:43:29 -06:00
Danilo Egea Gondolfo
814bf1fddd virtio_p9fs: fix panic on qemu/kvm
When the module is loaded on a system running on qemu/kvm the "modern"
virtio infrastructure is used and virtio_read_device_config() will end
up calling vtpci_modern_read_dev_config(). This function cannot read
values of arbitrary sizes and will panic if the p9fs mount tag size is
not supported by it.

Use virtio_read_device_config_array() instead. It was tested on both
bhyve and qemu/kvm.

PR: 280098
Co-authored-by: Mark Peek <mp@FreeBSD.org>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1320
2024-07-07 05:39:27 -06:00
Alan Cox
fb32ba6aa4 amd64/arm64: Eliminate unnecessary demotions in pmap_protect()
In pmap_protect(), when the mapping isn't changing, we don't need to
perform a superpage demotion, even though the requested change doesn't
cover the entire superpage.

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45886
2024-07-06 15:48:10 -05:00
Joyu Liao
d8a99eaa1f rpcbind: Add option to disable local host binding
In our products, we need those options to support our features.

Add daemon mode option for mountd, nfsd.
Add skip local host binding option for rpcd.
Add skip local host binding option for mountd.

Reviewed by:	rmacklem
Differential Revision:	https://reviews.freebsd.org/D45118
2024-07-06 13:39:07 -07:00
Warner Losh
6677621bad cdefs.h: Fallback to printf0 for __printf0like
For some reason, my tests were fine with this like it was, but CI for
gcc12 and gcc13 is complaining. Revert to the old form until that can be
worked out why the mismatch.

Fixes: 0b82dac337
Sponsored by:		Netflix
2024-07-06 13:45:03 -06:00
Christos Margiolis
e850bd36df sound: Add missing CHN_[UN]LOCKs in sndstat
In sndstat_build_sound4_nvlist(), if we have INVARIANTS or
SND_DIAGNOSTIC enabled, we will hit a lock assertion panic when we call
CHN_GETVOLUME(). Also lock the channel in the sndstat_prepare_pcm() loop
for good measure.

Fixes:		bbca3a75bb ("sound: Include sound(4) channel information in sndstat nvlist")
Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45898
2024-07-06 20:23:22 +02:00
Christos Margiolis
1a768ea9db sound: Add min_rate and min_channels safety check in SNDCTL_AUDIOINFO
If the channel list is empty, min_rate and min_channels will be INT_MAX.
Instead, assign them to 0, like we do in sndstat_get_caps().

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45876
2024-07-06 20:23:15 +02:00
Christos Margiolis
9d8b93bc9c sound: Refactor sndstat_get_caps()
The current implementation of sndstat_get_caps() does not work properly
when VCHANs are enabled, as it skips all information about physical
channels, and also assigns the min/max rates and channels to same
values, which is usually not the case. A device either supports any
sample rate within the [feeder_rate_min, feeder_rate_max] range, or
[hw_rate_min, hw_rate_max] range when the device is opened in exclusive
or bitperfect mode. The number of channels can also vary and is not
always the same for both min and max.

Refactor the whole function to resemble the way we handle fetching of
these values in dsp_oss_audioinfo() and dsp_oss_engineinfo().

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45872
2024-07-06 20:23:09 +02:00
Christos Margiolis
86585210fd sound: Fix min/max rate for SNDCTL_AUDIOINFO and SNDCTL_ENGINEINFO
Since we allow feeding of any rate within the [feeder_rate_min,
feeder_rate_max] range, report this as the min/max rate as well. Only
exceptions are when we the device is opened in exclusive or bitperfect
mode.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45862
2024-07-06 20:23:04 +02:00
Christos Margiolis
2d6fc24673 sound: Handle midistat_lock through function interface
midistat_lock is used outside midi/midi.c as well, so implement lock,
unlock and lockassert functions in order not to expose the lock in the
header file.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D45857
2024-07-06 20:22:59 +02:00
Christos Margiolis
a9f08df3e9 sound: Remove dead code in pcm_register()
Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Differential Revision:	https://reviews.freebsd.org/D45831
2024-07-06 20:22:55 +02:00
Christos Margiolis
adc1713fb1 sound: Make DSP_FIXUP_ERROR() regular code
No reason to have this as a macro.

While here, change the second case to an "else if" as there is no reason
to check it if the open flags are invalid.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D45776
2024-07-06 20:22:50 +02:00
Christos Margiolis
be04a9d938 sound: Improve simplex handling in dsp_open()
If we are in simplex mode, make sure we do not open in both directions
(read/write) and also that we do not open in a direction opposite of
what is already opened. For example, if the device is already doing
playback, we cannot open the device for recording at the same time, and
vice-versa.

While here, remove dsp_cdevpriv->simplex as it's no longer needed.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45835
2024-07-06 20:22:45 +02:00
Christos Margiolis
46e92a41cb sound: Simplify getchns()
Remove all special handling for SIMPLEX, since we can just fetch the
channel directly.

While here:
- Get rid of a no-op getchns() call in dsp_ioctl().
- Rename getchns() to dsp_lock_chans(), and relchns() to
  dsp_unlock_chans().
- Simplify DSP_FIXUP_ERROR(), as we do not longer assign SD_F_PRIO*
  flags to the softc.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45775
2024-07-06 20:22:40 +02:00
Christos Margiolis
8b9e1b6280 sound: Remove *MINOR from midi/
Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Differential Revision:	https://reviews.freebsd.org/D45772
2024-07-06 20:22:36 +02:00
Christos Margiolis
526bd1d87e sound: Remove MIDI_TYPE
No good reason to have this. It only makes things harder to read.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D45773
2024-07-06 20:22:31 +02:00
Christos Margiolis
3402d474ce snd_uaudio: Remove unused sc_sndstat sbuf
This information is also printed to dmesg(8) on attach.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D45771
2024-07-06 20:22:26 +02:00