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
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
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
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
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
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
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
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
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")
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
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
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
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
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.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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