Commit Graph

581477 Commits

Author SHA1 Message Date
Shawn Webb
4d6fa59190
HBSD: Prevent executable superpage mappings
Superpage alignment degrades ASLR effectiveness. Prevent superpage
alignment for executable code.

Signed-off-by:	Shawn Webb <shawn.webb@hardenedbsd.org>
MFC-to:		14-STABLE
MFC-to:		13-STABLE
See-Also: https://zolutal.github.io/aslrnt/
See-Also: https://grsecurity.net/toolchain_necromancy_past_mistakes_haunting_aslr
2024-07-08 22:34:29 +00:00
HardenedBSD Sync Services
c30d6b31c2
Merge branch 'freebsd/current/main' into hardened/current/master 2024-07-07 12:01:38 -06: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
HardenedBSD Sync Services
1a857d03e6
Merge branch 'freebsd/current/main' into hardened/current/master 2024-07-07 06:01:29 -06: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
HardenedBSD Sync Services
e32fc0cd0e
Merge branch 'freebsd/current/main' into hardened/current/master 2024-07-06 18:01:29 -06:00
Shawn Webb
8faa314028
HBSD: Fix kernel panic when PaX MPROTECT fails
Fix a double mutex unlock in an error condition. pax_mprotect_enforce
will unlock the map object on error.

Signed-off-by:	Shawn Webb <shawn.webb@hardenedbsd.org>
MFC-to:		14-STABLE
MFC-to:		13-STABLE
2024-07-07 00:00:05 +00: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
Christos Margiolis
fc76e24e58 sound: Fix lock order reversals in mseq_open()
Opening /dev/sequencer after a clean reboot yields:

lock order reversal: (sleepable after non-sleepable)
 1st 0xfffffe004a2c2c08 seqflq (seqflq, sleep mutex) @ /mnt/src/sys/dev/sound/midi/sequencer.c:754
 2nd 0xffffffff84197ed8 midistat lock (midistat lock, sx) @ /mnt/src/sys/dev/sound/midi/midi.c:1478
lock order seqflq -> midistat lock attempted at:
0xffffffff811c9029 at witness_checkorder+0x12b9
0xffffffff810f18a7 at _sx_xlock+0xf7
0xffffffff8417f992 at midimapper_open+0x22
0xffffffff84182770 at mseq_open+0xf0
0xffffffff80e3380f at devfs_open+0x30f
0xffffffff81b8b4b7 at VOP_OPEN_APV+0x57
0xffffffff812da1e7 at vn_open_vnode+0x397
0xffffffff812d96b3 at vn_open_cred+0xb23
0xffffffff812c2c6b at openatfp+0x52b
0xffffffff812c2711 at sys_openat+0x81
0xffffffff84110579 at filemon_wrapper_openat+0x19
0xffffffff81a223ae at amd64_syscall+0x39e
0xffffffff819dd0eb at fast_syscall_common+0xf8

Expose midistat_lock to midi/midi.c so that we can acquire the lock from
mseq_open() before we lock seq_lock, and introduce _locked variants of
midimapper_open() and midimapper_fetch_synth().

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, emaste
Differential Revision:	https://reviews.freebsd.org/D45770
2024-07-06 20:22:21 +02:00
Christos Margiolis
d6d4586b0b sound: Get rid of snd_sb16 workaround in vchan_create()
The snd_sb16 driver was removed in 716924cb48 ("Retire snd_sbc ISA
sound card driver").

While here, simplify sample rate assignment a bit.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D45662
2024-07-06 20:22:16 +02:00
Christos Margiolis
f30af1f037 sound: SNDCTL_AUDIOINFO: Do not skip physical channels if VCHANs are disabled
Currently, we are skipping physical channels when servicing
SNDCTL_AUDIOINFO, and VCHANs when servicing SNDCTL_AUDIOINFO_EX.
However, if we call SNDCTL_AUDIOINFO with VCHANs disabled, we'll
eventually skip all channels, resulting in some of oss_audioinfo's
fields containing wrong information (e.g min/max_channels).

Fix this by adding an exception to SNDCTL_AUDIOINFO not to skip physical
channels when VCHANs are disabled.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, emaste
Differential Revision:	https://reviews.freebsd.org/D45722
2024-07-06 20:22:08 +02:00
HardenedBSD Sync Services
3dcb5cf67b
Merge branch 'freebsd/current/main' into hardened/current/master 2024-07-06 12:01:37 -06:00
Gordon Bergling
a9d7f098b8 mps(4): Correct a typo in a source code comment
- s/vender/vendor/

MFC after:	3 days
2024-07-06 19:49:30 +02:00
Colin Percival
ed807f7bca release.sh: Pass ARCH_FLAGS when setting VMSIZE
The default VM size may depend on the architecture.  In particular,
it is currently larged on riscv64 due to a toolchain issue which
results in bloated binaries.

MFC after:	3 days
Fixes:	59c21ed6e8 "release: Bump default VM size for riscv64 to 6 GB"
Sponsored by:	Amazon
2024-07-06 10:18:03 -07:00
Warner Losh
0b82dac337 cdefs.h: Add back fallback define for __printf0like
The format function printf0 is originally a FreeBSD extension. clang has
adopted it as an alias for printf. Starting with gcc 11, gcc doesn't do
a NULL pointer check for fmtarg. Instead, it has to be tagged with a
nonnull attribute, so this gives us the behavior we want.

For earlier gcc and other cmopilers, define it away so do not get false
positives for NULL pointers for the err*/warn* family of functions.
This also fixes -Wsystem-headers by avoiding print0 entirely. My testing
for 67d1a1cd9e didn't test that case, so I introduced a regression.

All these compilers need to be considered because __printf0like is used
in err.h and stdlib.h. Since it's used in system headers, it has to
work on all the compilers we support on FreeBSD, not just the ones that
can build FreeBSD itself.

__printf0like will likely be deleted in the future, since the proper way
to do this is with _Nullable or _Nonnull, but the compiler support for
those hasn't been completely evaluated.

Noticed by: jhb
Fixes: 67d1a1cd9e
Sponsored by: Netflix
Suggestions by: jhb
Differential Revision:	https://reviews.freebsd.org/D45836
2024-07-06 10:15:12 -06:00
Warner Losh
9a04df0515 cdefs.h: Remove NO_ANSI_KEYWORDS
Remove very old, deletion of ANSI keywords. Once upon a time, it was
common to want to do this. Then we only did it for non gcc compilers,
then all compilers claimed to be gcc, so we never did it. These days,
it's about useless to keep around since there's no compilers we can test
it with. It's an odd little artifact. Also, the advice in the comment is
wrong: if you define NO_ANSI_KEYWORDS, you can't have progams that use
const, etc as identifiers because they will be deleted. Further, our
header files have the 'bare' ANSI forms of these, so it's a catch 22:
You'd need them deleted for .h files, but not for the code. It's such a
niche case these days that it's best to just remove it.

Sponsored by:		Netflix
Reviewed by:		brooks
Differential Revision:	https://reviews.freebsd.org/D45861
2024-07-06 10:02:35 -06:00
Warner Losh
6d59c062d8 cdefs.h: Retire __const and __signed
These are no longer used in the base system. Once upon a time they were
used to ease the transition from K&R to ANSI C. These days, we use both
of these keywords in their bare form everywhere, even in our
headers. Any uses of __const or __signed will be converted to their ANSI
meaning in the compiler, but is beyond the scope of cdefs.h's
charter. For pure K&R compilation, with an enforced only use K&R
features and meanings, one needs to define NO_ANSI_KEYWORDS (though even
that support is wobbly at best, being active only for !GCC or
gcc-adjacent compilers which currently appears to be none).

Sponsored by:		Netflix
Reviewed by:		brooks
Differential Revision:	https://reviews.freebsd.org/D45860
2024-07-06 10:02:25 -06:00
HardenedBSD Sync Services
ccd44b020a
Merge branch 'freebsd/current/main' into hardened/current/master 2024-07-05 18:01:24 -06:00
Dag-Erling Smørgrav
c15290fb9d tftpd: Code cleanup.
MFC after:	3 days
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D45871
2024-07-06 00:05:49 +02:00
HardenedBSD Sync Services
b5ae8e5cbe
Merge branch 'freebsd/current/main' into hardened/current/master 2024-07-05 12:01:39 -06:00
Ed Maste
b81424adf7 OpenSSH: correct logic error in ObscureKeystrokeTiming
Cherry-pick fix:
upstream: when sending ObscureKeystrokeTiming chaff packets, we
can't rely on channel_did_enqueue to tell that there is data to send. This
flag indicates that the channels code enqueued a packet on _this_ ppoll()
iteration, not that data was enqueued in _any_ ppoll() iteration in the
timeslice. ok markus@

OpenBSD-Commit-ID: 009b74fd2769b36b5284a0188ade182f00564136

Obtained from:	openssh-portable 146c420d29d0
Reviewed by:	gordon
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45823
2024-07-05 09:16:40 -04:00
HardenedBSD Sync Services
c56e2ecf4e
Merge branch 'freebsd/current/main' into hardened/current/master 2024-07-05 00:01:37 -06:00
Alan Cox
383fd3ea00 arm64: Handle an unaligned start in pmap_mask_set_locked()
In pmap_mask_set_locked(), correctly handle a starting address that is
in the middle of an L3C page.  The symptoms arising from this error
included assertion failures in pmap_demote_l3c().

Reported by:	andrew
Reviewed by:	markj
Fixes:	fd6cb031f5 "arm64 pmap: Add ATTR_CONTIGUOUS support [Part 1]"
Differential Revision:	https://reviews.freebsd.org/D45851
2024-07-05 00:42:52 -05:00
HardenedBSD Sync Services
d383769a8f
Merge branch 'freebsd/current/main' into hardened/current/master 2024-07-04 18:01:29 -06:00
Alan Somers
7f50027321 ctladm: don't require the use of "-p" with "port -r", part 2
* Remove a now superfluous FALLTHROUGH hint
* Don't specify "-p" with an empty argument in the tests

Reported by:	jhb
MFC after:	1 week
MFC with:	edbd489d09
2024-07-04 14:32:24 -06:00
HardenedBSD Sync Services
e090df4230
Merge branch 'freebsd/current/main' into hardened/current/master 2024-07-04 12:01:38 -06:00
Zhenlei Huang
09164454aa ethernet: Retire M_HASFCS
The mbuf flag M_HASFCS was introduced for drivers to indicate the net
stack that packets include FCS (Frame Check Sequence). In principle, to
be efficient, FCS should always be processed by hardware, firmware, or
at last sort the driver. Well, Ethernet specifies that damaged frames
should be discarded, thus only good ones will be passed up to the net
stack, then it makes no senses for the net stack to see FCS just to trim
it.

The last consumer of the flag M_HASFCS has been removed since change [1].
It is time to retire it.

1. 105a4f7b3c ng_atmllc: remove

Reviewed by:	kp
MFC after:	never
Differential Revision:	https://reviews.freebsd.org/D42391
2024-07-05 00:53:51 +08:00