Commit graph

289586 commits

Author SHA1 Message Date
Warner Losh bd45bbe440 rescue: Fix after zfsbootcfg addition
Get the library dependencies correct for zfsbootcfg. libzfsbootcfg
depends on a all of these...

Fixes:			ac4847e6b0
Sponsored by:		Netflix
2024-02-12 15:59:14 -07:00
Simon J. Gerraty b75bb99621 rc.subr add Exists so we can find sed
SED=`Exists -x /usr/bin/sed /rescue/sed`

avoids adding /rescure to $PATH, and allows use of sed
before /usr is mounted (if a separate filesystem).

Reviewed by:	jlduran_gmail.com
Differential Revision:	https://reviews.freebsd.org/D43826
2024-02-12 14:39:20 -08:00
Simon J. Gerraty f616d61ab6 libsecureboot do not report expected unverified files
By default only report unverified files at severity VE_WANT
and above.  This inlcudes *.conf but not *.hints, *.cookie
or *.tgz which get VE_TRY as their severity.

If Verbose is set to 0, then VerifyFlags should default to 0 too.
Thus the combination of

	module_verbose=0
	VE_VEBOSE=0

is sufficient to make the loader almost totally silent.

When verify_prep has to find_manifest and it is verified ok
return VE_NOT_CHECKED to verify_file so that it can skip
repeating verify_fd

Also add better debugging output for is_verified and add_verify_status.

vectx handle compressed modules

When verifying a compressed module (.ko.gz or .ko.bz2)
stat() reports the size as -1 (unknown).
vectx_lseek needs to spot this during closing - and just read until
EOF is hit.

Note: because of the way libsa's open() works, verify_prep will see
the path to be verified as module.ko not module.ko.bz2 etc.  This is
actually ok, because we need a separate module.ko.bz2 entry so that
the package can be verified, and the hash for module.ko is of the
uncompressed file which is what vectx will see.

Re-work local.trust.mk so site.trust.mk need only set
VE_SIGN_URL_LIST (if using the mentioned signing server)

interp.c: restrict interactive input

Apply the same restrictions to interactive input as for
unverified conf and hints files.

Use version.veriexec when LOADER_VERIEXEC is yes

Reviewed by:	kevans
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D43810
2024-02-12 14:35:01 -08:00
Bi11 6cc93ccde7
BRT: Fix slop space calculation with block cloning
Similar to deduplication, the size of data duplicated by block cloning
should not be included in the slop space calculation.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Yuxin Wang <yuxinwang9999@gmail.com>
Closes #15874
2024-02-12 13:53:33 -08:00
Richard Scheffenegger 57e27ff07a tcp: partially undo D43792
At the destruction of the tcpcb, no timers are supposed to
be running. However, it turns out that stopping them in the
close() / shutdown() call does not have the desired effect
under all circumstances.

This partially reverts 62d47d73b7 to reduce the nuisance
caused.

PR:			277009
Reported-by:		syzbot+9a9aa434a14a2b35c3ba@syzkaller.appspotmail.com
Reported-by:		syzbot+e82856782410e895bae7@syzkaller.appspotmail.com
Reviewed By:		glebius, tuexen, #transport
Sponsored by:		NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D43855
2024-02-12 22:38:11 +01:00
Warner Losh fd6d47375a rescue,nextboot: Install nextboot as a link to reboot, rm nextboot.sh
Reboot now emulates the nextboot shell script completely. Retire the
nextboot.sh script and install the link. Retain the same manual page,
since there's enough differences between nextboot and reboot that
talking about nextboot would likely be confusing in nextboot.8

The nextboot.sh script no longer exists, so doesn't need to be fixed up
to create rescue. However, now we need a link from nextboot to reboot.

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D43831
Differential Revision:	https://reviews.freebsd.org/D43843
2024-02-12 11:46:20 -07:00
Warner Losh 994cc83921 reboot: Allow this to be installed as nextboot
Allow nextboot to be a symlink link to reboot. It does everything reboot
does, except doesn't actually setup the sytem to reboot and reboot. Also,
don't accept the reboot args related to rebooting when in nextboot mode.

Sponsored by:		Netflix
Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D43830
2024-02-12 11:46:11 -07:00
Warner Losh 91d2407702 reboot: Implement -o to set kernel options for next boot
Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D43829
2024-02-12 11:46:03 -07:00
Warner Losh 9dcf6cbd83 reboot: Implement -k in terms of env
kernel isn't special, beyond the sanity checks we do. Add it to the env
rather than pass it into write_nextboot().

Sponsored by:		Netflix
Reviewed by:		kevans, kib
Differential Revision:	https://reviews.freebsd.org/D43828
2024-02-12 11:45:54 -07:00
Warner Losh ecc834241f reboot: Implement -e from nextboot
Implement -e foo=bar to add loader environment variables to
nextboot.conf. bar is enclosed in quotes if it isn't already.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D43827
2024-02-12 11:45:48 -07:00
Warner Losh 0df5f65908 reboot: Implement zfs support
Implement full support for ZFS -k support. For ZFS, we have to set a
property that gets cleared by the boot loaeder for whether or not to
process nextboot.conf. Do this using system("zfsbootcfg..." rather than
coding the small subset of that program inline to avoid CDDL
contamination of reboot and the complications of disabling CDDL and/or
ZFS. The few bytes needed to implement reboot for systems with zfs is
not worth saving for systems w/o ZFS.

Only set nextboot_enable=YES for UFS filesystems. They are the only one
that need that as the first line. Its presence on ZFS can cause the
kernel to not be oneshot.

Sponsored by:		Netflix
Reviewed by:		kevans, kib
Differential Revision:	https://reviews.freebsd.org/D43824
2024-02-12 11:45:37 -07:00
Warner Losh 2c47954811 reboot: Implement -D from nextboot
Implement -D from nextboot.sh which deletes the nextboot.conf file and
exists.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D43822
2024-02-12 11:45:29 -07:00
Warner Losh cfeedadfbd reboot: Add sanity checking of write to nextboot.conf
Add sanity checking to the write to nextboot. Move to separate function
and allow force to override all errors. If we can't write nextboot.conf,
don't silently fail anymore.

Sponsored by:		Netflix
Reviewed by:		kevans, kib, markj, jhb
Differential Revision:	https://reviews.freebsd.org/D43803
2024-02-12 11:45:20 -07:00
Warner Losh 7cb1a0e6e0 reboot: Don't reboot if the next kernel isn't there
reboot -k garbage won't boot garbage unless /boot/garbage/kernel is
there. Refuse to reboot if it is missing, though allow -f to force
it for special-use cases. This is in keeping with nextboot.sh.

Sponsored by:		Netflix
Reviewed by:		kevans, kib, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D43802
2024-02-12 11:45:01 -07:00
Warner Losh 7a3210f2ac reboot: convert flags to bools
Convert all the command line flags to bools, since that's how we use
them. Sort the includes while adding stdbool.h.

Sponsored by:		Netflix
Reviewed by:		kevans, kib, emaste
Differential Revision:	https://reviews.freebsd.org/D43801
2024-02-12 11:44:52 -07:00
Warner Losh a78bc42bcc reboot: Disallow -k and -r, it doesn't make sense.
When we're re-rooting to a new /, there is no next kernel. Error out
rather than leaving a timebomb in /boot/nextboot.conf.

Sponsored by:		Netflix
Reviewed by:		kevans, kib, emaste
Differential Revision:	https://reviews.freebsd.org/D43800
2024-02-12 11:44:43 -07:00
Warner Losh ac4847e6b0 rescue: belatedly add zfsbootcfg
nextboot.sh uses zfsbootcfg to enable nextboot functionality for ZFS,
but zfsbootcfg was never added. Add it now since the nextboot binary
that replaced the script also uses it via system.

Sponsored by:		Netflix
Reviewed by:		kevans, kib, emaste
Differential Revision:	https://reviews.freebsd.org/D43844
2024-02-12 11:44:32 -07:00
Warner Losh 9622dc05ae zfsbootcfg: Remove bogus CFLAGS
When using the zfsbootcfg library, we're talking only to it, not to the
rest of ZFS, nor are we using anything that needs access to the ZFS
compilation environment. Remove all the compiling OpenZFS itself flags.

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D43823
2024-02-12 11:44:22 -07:00
Dag-Erling Smørgrav 851a9da38f patch: Support long context lines.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D43850
2024-02-12 19:26:13 +01:00
Emmanuel Vadot 114ab149e2 files: make uart_bus_puc.c not depend on puc
If one wants to have puc working as a module we need the bus
in the kernel otherwise we won't be able to find any child to attach.

Reviewed by:	imp
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D43846
2024-02-12 18:18:20 +01:00
Ed Maste f1bd7311fb style.lua.9: remove mention of $FreeBSD$
Also restore a comment line in an example which previously started with
-- $FreeBSD$ but was removed in 6ef644f588.  The example shows the of
a module require statement block following the license header.
2024-02-12 10:38:40 -05:00
Collin Funk fd1066bed6 .profile: Don't bother checking for /home symlink
Since FreeBSD 14.0, user directories are created directly under /home.
This check should no longer be needed.

This reverts commit 4cea05a273.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Pull-request: https://github.com/freebsd/freebsd-src/pull/1102
2024-02-12 09:24:49 -05:00
Christos Margiolis 5960ab73d8 snd_uaudio.4: document sysctls
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D43649
2024-02-12 13:07:51 +02:00
Christos Margiolis dcc47cd49e snd_uaudio.4: remove useless .Tn macro
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D43651
2024-02-12 13:07:51 +02:00
Christos Margiolis f60e99f45e snd_uaudio: mark selected configurations
snd_uaudio(4) selects the first maching rate/channel/bit/format/buffer
configuration for use during attach, even though it will print the rest
of the supported configurations detected. To make this clear, mark the
selected playback and recording configurations with a "selected" string.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D43766
2024-02-12 13:07:50 +02:00
Christos Margiolis 883b8ed582 sound: remove snddev_info->inprog and pcm_inprog()
No longer used.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D43737
2024-02-12 13:07:50 +02:00
Florian Walpen 42fdcd9fd9 snd_uaudio(4): Fix config detection with defaults set.
Let the USB audio descriptor iteration detect configurations with more
channels and larger sample size, even when the following global sysctl
tunables are set to a lower value:

hw.usb.uaudio.default_channels hw.usb.uaudio.default_bits

This improves utility and is closer to the meaning of default.

Also, do not create duplicate sample rate entries.

MFC after:	2 weeks
Reviewed by:    christos
Differential Revision:	https://reviews.freebsd.org/D43679
2024-02-12 13:07:21 +02:00
Florian Walpen b2e97edffd snd_uaudio(4): Adapt buffer length to buffer_ms tunable.
Adapt the length of the driver side audio buffer to the USB transfer
interval, which is adjustable through the buffer_ms tunable. This
eliminates unnecessary latency in USB audio playback.

To reduce power consumption caused by frequent CPU wakeups, increase the
default buffer_ms value to 4ms. In combination with adaptive buffer
length, this still results in less roundtrip latency compared to the
previous 2ms default.

Extend the buffer_ms value range to 1ms for low latency applications.

MFC after:	2 weeks
Reviewed by:	christos
Differential Revision:	https://reviews.freebsd.org/D41942
2024-02-12 13:06:19 +02:00
Christos Margiolis 53c768e683 mixer(3): Do not hardcode "/dev/mixer"
We have BASEPATH defined.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D43812
2024-02-12 13:00:05 +02:00
Christos Margiolis 5daa7cf42f mixer(8): Use new mixer if we change the default unit
If we use the -d option to change the default unit, close the current
mixer and open the one we set as the default to avoid printing and
applying changes (if any) to the old one.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D43809
2024-02-12 13:00:05 +02:00
Christos Margiolis cc7479d7dc mixer(8): Improve mute and recsrc controls
The input options of "dev.mute" (+, -, ^) and "dev.recsrc" (+, -, ^, =)
are quite cryptic. Allow the input to also be an actual description of
what these options do.

+ -> add (recsrc)
- -> remove (recsrc)
^ -> toggle (recsrc, mute)
= -> set (recsrc)
0 -> off (mute)
1 -> on (mute)

Also, deprecate the use of the symbol options in the EXAMPLES section of
the man page, by using the new descriptive options.

In the future, we might want to get rid of the symbol options
altogether, but preserve backwards compatibility for now.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch, imp
Differential Revision:	https://reviews.freebsd.org/D43796
2024-02-12 13:00:05 +02:00
Christos Margiolis 7bd14d09a9 mixer.8: Fix wrong sentence
246e0457d9 ("mixer.8: Add terse example
for increasing volume") mentions that the example changes the volume of
the "first mixer found", while the example shows how the change the
volume of the current mixer's "vol" device. Re-phrease sentence to
reflect the actual behavior of the command.

Also, improve the example by using the % operator, instead of hardcoding
0.05.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D43795
2024-02-12 13:00:05 +02:00
Christos Margiolis 75be886e58 mixer(8): Allow full PCM device names as input for the -d option
The -d option is a wrapper around hw.snd.default_unit. Currently
mixer(8) expects the option argument to be just the unit's number (e.g
pcm0 -> 0). To avoid confusion, allow full device names of the form
"pcmN" as well.

While here, improve the -d option's description in the man page.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch, imp
Differential Revision:	https://reviews.freebsd.org/D43794
2024-02-12 13:00:05 +02:00
Christos Margiolis 09ba07011a mixer(8): Improve error messsages and warnings
No functional change intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch, imp
Differential Revision:	https://reviews.freebsd.org/D43793
2024-02-12 12:59:58 +02:00
Dimitry Andric d9c0e2e166 Revert "Build clang and other llvm executables as PIE"
This reverts commit 470f9f13de.

I need more time to figure out how to make this work correctly with
incremental builds, which it currently miserably fails on.
2024-02-12 10:27:00 +01:00
Eugene Grosbein 81092e92ea graid: unbreak Promise RAID1 with 4+ providers
Fix a problem in graid implementation of Promise RAID1 created with 4+ disks.
Such an array generally works fine until reboot only due to a bug
in metadata writing code. Before the fix, next taste erronously created
RAID1E (kind of RAID10) instead of RAID1, hence graid used wrong offsets
for I/O operations.

The bug did not affect Promise RAID1 arrays with 2 or 3 disks only.

Reviewed by:	mav
MFC after:	3 days
2024-02-12 14:33:43 +07:00
Dimitry Andric ed27ae8df4 Bump __FreeBSD_version after clang/llvm PIE change
Otherwise, incremental builds might fail with various interesting
errors. This is a bit of a big hammer, but I don't know of any other way
to force rebuilds of all these libraries.

Reported by:	bapt
Fixes:		470f9f13de
MFC after:	1 week
2024-02-11 23:45:51 +01:00
Dimitry Andric 470f9f13de Build clang and other llvm executables as PIE
There is no reason anymore to not build these as PIE. Unfortunately
bsd.lib.mk does not allow for building _only_ PIE static libraries, so
lib/clang/Makefile.inc needs a kludge to work around that issue.

MFC after:	1 week
2024-02-11 19:01:56 +01:00
Kyle Evans 0d3b2bdbf7 caroot: routine update
Changes:
- One (1) modified
- Eight (8) added
- One (1) expired, now untrusted

MFC after:	3 days
2024-02-11 00:35:16 -06:00
Konstantin Belousov 5f7ac491ee amd64 pcb.h: use 4 hex digits for pcb flags
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-02-11 05:38:41 +02:00
Konstantin Belousov 1d6230b07f amd64 gdt_segs: use designated initializers
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-02-11 05:38:23 +02:00
Konstantin Belousov be707ee095 amd64/linux*: mark brandlists as static
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-02-11 05:37:27 +02:00
Konstantin Belousov 29d4f8bfc6 ELF note parser: provide more info on failure
Print reasons when parser declined to parse notes, due to mis-alignment,
invalid length, or too many notes (the later typically means that there
is a loop).  Also increase the loop limit to 4096, which gives enough
iterations for notes to fill whole notes' page.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-02-11 05:37:12 +02:00
Konstantin Belousov a67edb5616 imgact_elf.c: remove sys/cdefs.h include
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-02-11 05:36:59 +02:00
Konstantin Belousov 130bad217b amd64 uprintf_signal: add space between %rax value and code bytes
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-02-11 05:36:39 +02:00
Konstantin Belousov a52cb4c480 Document aio_read2/aio_write2
Reviewed by:	jhb
Discussed with:	asomers
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43448
2024-02-11 03:54:16 +02:00
Konstantin Belousov 8dfc788b84 aio_read2/aio_write2: add AIO_OP2_VECTORED
Suggested by:	Vinícius dos Santos Oliveira <vini.ipsmaker@gmail.com>
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43448
2024-02-11 03:54:11 +02:00
Konstantin Belousov 06cb1c3f95 libc: add aio_read2() and aio_write2() functions
as wrappers around lio_listio(LIO_READ/WRITE | LIO_FOFFSET, &iocb, 1);

Suggested and reviewed by:	jhb
Discussed with:	asomers
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differrential revision:	https://reviews.freebsd.org/D43448
2024-02-11 03:54:00 +02:00
Konstantin Belousov e4b7bbd6ab lio_listio(2): add LIO_FOFFSET flag to ignore aiocb aio_offset
and use the current file offset instead.

Requested by:	Vinícius dos Santos Oliveira <vini.ipsmaker@gmail.com>
Reviewed by:	jhb
Discussed with:	asomers
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43448
2024-02-11 03:53:50 +02:00
Vladimir Kondratyev c0b8047bdc LinuxKPI: Allow kmalloc to be called when FPU protection is enabled
Amdgpu driver does a lot of memory allocations in FPU-protected sections
of code for certain display cores, e.g. for DCN30. This does not work
on FreeBSD as its malloc function can not be run within a critical
section. Check this condition and temporally exit from FPU-protected
context to workaround issue and reduce source code patching.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu (previous version)
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42822
2024-02-11 01:01:50 +03:00