]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 months agoping(8): Fix typo in ping6.c
Hao-Yu Hou [Sat, 30 Dec 2023 09:59:27 +0000 (17:59 +0800)]
ping(8): Fix typo in ping6.c

Line 703 & 863: kerel -> kernel
Line 2110: resposne -> response

Event: Advanced UNIX Programming Course (Fall’23) at NTHU.
Pull Request: https://github.com/freebsd/freebsd-src/pull/967

4 months agosysctl(8): Fix typo in comment
Hao-Yu Hou [Sat, 30 Dec 2023 09:36:11 +0000 (17:36 +0800)]
sysctl(8): Fix typo in comment

Line214: combind -> combine

Reviewed by: zlai
Event: Advanced UNIX Programming Course (Fall’23) at NTHU
Request: https://github.com/freebsd/freebsd-src/pull/966

4 months agorescue: Fix after zfsbootcfg addition
Warner Losh [Mon, 12 Feb 2024 22:10:37 +0000 (15:10 -0700)]
rescue: Fix after zfsbootcfg addition

Get the library dependencies correct for zfsbootcfg. libzfsbootcfg
depends on a all of these...

Fixes: ac4847e6b0e9
Sponsored by: Netflix

4 months agorc.subr add Exists so we can find sed
Simon J. Gerraty [Mon, 12 Feb 2024 22:39:20 +0000 (14:39 -0800)]
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

4 months agolibsecureboot do not report expected unverified files
Simon J. Gerraty [Mon, 12 Feb 2024 22:35:01 +0000 (14:35 -0800)]
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

4 months agotcp: partially undo D43792
Richard Scheffenegger [Mon, 12 Feb 2024 20:43:18 +0000 (21:43 +0100)]
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 62d47d73b7eb 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

4 months agorescue,nextboot: Install nextboot as a link to reboot, rm nextboot.sh
Warner Losh [Mon, 12 Feb 2024 18:46:20 +0000 (11:46 -0700)]
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

4 months agoreboot: Allow this to be installed as nextboot
Warner Losh [Mon, 12 Feb 2024 18:46:11 +0000 (11:46 -0700)]
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

4 months agoreboot: Implement -o to set kernel options for next boot
Warner Losh [Mon, 12 Feb 2024 18:46:03 +0000 (11:46 -0700)]
reboot: Implement -o to set kernel options for next boot

Sponsored by: Netflix
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D43829

4 months agoreboot: Implement -k in terms of env
Warner Losh [Mon, 12 Feb 2024 18:45:54 +0000 (11:45 -0700)]
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

4 months agoreboot: Implement -e from nextboot
Warner Losh [Mon, 12 Feb 2024 18:45:48 +0000 (11:45 -0700)]
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

4 months agoreboot: Implement zfs support
Warner Losh [Mon, 12 Feb 2024 18:45:37 +0000 (11:45 -0700)]
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

4 months agoreboot: Implement -D from nextboot
Warner Losh [Mon, 12 Feb 2024 18:45:29 +0000 (11:45 -0700)]
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

4 months agoreboot: Add sanity checking of write to nextboot.conf
Warner Losh [Mon, 12 Feb 2024 18:45:20 +0000 (11:45 -0700)]
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

4 months agoreboot: Don't reboot if the next kernel isn't there
Warner Losh [Mon, 12 Feb 2024 18:45:01 +0000 (11:45 -0700)]
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

4 months agoreboot: convert flags to bools
Warner Losh [Mon, 12 Feb 2024 18:44:52 +0000 (11:44 -0700)]
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

4 months agoreboot: Disallow -k and -r, it doesn't make sense.
Warner Losh [Mon, 12 Feb 2024 18:44:43 +0000 (11:44 -0700)]
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

4 months agorescue: belatedly add zfsbootcfg
Warner Losh [Mon, 12 Feb 2024 18:44:32 +0000 (11:44 -0700)]
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

4 months agozfsbootcfg: Remove bogus CFLAGS
Warner Losh [Mon, 12 Feb 2024 18:44:22 +0000 (11:44 -0700)]
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

4 months agopatch: Support long context lines.
Dag-Erling Smørgrav [Mon, 12 Feb 2024 18:26:13 +0000 (19:26 +0100)]
patch: Support long context lines.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D43850

4 months agofiles: make uart_bus_puc.c not depend on puc
Emmanuel Vadot [Mon, 12 Feb 2024 17:18:20 +0000 (18:18 +0100)]
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

4 months agostyle.lua.9: remove mention of $FreeBSD$
Ed Maste [Mon, 12 Feb 2024 15:36:36 +0000 (10:36 -0500)]
style.lua.9: remove mention of $FreeBSD$

Also restore a comment line in an example which previously started with
-- $FreeBSD$ but was removed in 6ef644f5889a.  The example shows the of
a module require statement block following the license header.

4 months ago.profile: Don't bother checking for /home symlink
Collin Funk [Sun, 4 Feb 2024 12:04:52 +0000 (04:04 -0800)]
.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 4cea05a273c875b5d5d4c41bfa6f2f0a60fa4a66.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Pull-request: https://github.com/freebsd/freebsd-src/pull/1102

4 months agosnd_uaudio.4: document sysctls
Christos Margiolis [Mon, 12 Feb 2024 11:06:00 +0000 (13:06 +0200)]
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

4 months agosnd_uaudio.4: remove useless .Tn macro
Christos Margiolis [Mon, 12 Feb 2024 11:05:55 +0000 (13:05 +0200)]
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

4 months agosnd_uaudio: mark selected configurations
Christos Margiolis [Mon, 12 Feb 2024 11:05:47 +0000 (13:05 +0200)]
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

4 months agosound: remove snddev_info->inprog and pcm_inprog()
Christos Margiolis [Mon, 12 Feb 2024 11:05:33 +0000 (13:05 +0200)]
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

4 months agosnd_uaudio(4): Fix config detection with defaults set.
Florian Walpen [Mon, 12 Feb 2024 11:05:27 +0000 (13:05 +0200)]
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

4 months agosnd_uaudio(4): Adapt buffer length to buffer_ms tunable.
Florian Walpen [Mon, 12 Feb 2024 11:04:57 +0000 (13:04 +0200)]
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

4 months agomixer(3): Do not hardcode "/dev/mixer"
Christos Margiolis [Mon, 12 Feb 2024 10:59:32 +0000 (12:59 +0200)]
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

4 months agomixer(8): Use new mixer if we change the default unit
Christos Margiolis [Mon, 12 Feb 2024 10:59:28 +0000 (12:59 +0200)]
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

4 months agomixer(8): Improve mute and recsrc controls
Christos Margiolis [Mon, 12 Feb 2024 10:59:22 +0000 (12:59 +0200)]
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

4 months agomixer.8: Fix wrong sentence
Christos Margiolis [Mon, 12 Feb 2024 10:59:16 +0000 (12:59 +0200)]
mixer.8: Fix wrong sentence

246e0457d93071ffd901c78e3ee7badc5f51bd4c ("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

4 months agomixer(8): Allow full PCM device names as input for the -d option
Christos Margiolis [Mon, 12 Feb 2024 10:59:02 +0000 (12:59 +0200)]
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

4 months agomixer(8): Improve error messsages and warnings
Christos Margiolis [Mon, 12 Feb 2024 10:58:55 +0000 (12:58 +0200)]
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

4 months agoRevert "Build clang and other llvm executables as PIE"
Dimitry Andric [Mon, 12 Feb 2024 09:27:00 +0000 (10:27 +0100)]
Revert "Build clang and other llvm executables as PIE"

This reverts commit 470f9f13de10e47e6d45721c15af6b4abe7aad55.

I need more time to figure out how to make this work correctly with
incremental builds, which it currently miserably fails on.

4 months agograid: unbreak Promise RAID1 with 4+ providers
Eugene Grosbein [Mon, 12 Feb 2024 07:24:28 +0000 (14:24 +0700)]
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

4 months agoBump __FreeBSD_version after clang/llvm PIE change
Dimitry Andric [Sun, 11 Feb 2024 22:45:51 +0000 (23:45 +0100)]
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: 470f9f13de10
MFC after: 1 week

4 months agoBuild clang and other llvm executables as PIE
Dimitry Andric [Sun, 11 Feb 2024 18:01:56 +0000 (19:01 +0100)]
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

4 months agocaroot: routine update
Kyle Evans [Sun, 11 Feb 2024 06:33:12 +0000 (00:33 -0600)]
caroot: routine update

Changes:
- One (1) modified
- Eight (8) added
- One (1) expired, now untrusted

MFC after: 3 days

4 months agoamd64 pcb.h: use 4 hex digits for pcb flags
Konstantin Belousov [Fri, 9 Feb 2024 05:05:02 +0000 (07:05 +0200)]
amd64 pcb.h: use 4 hex digits for pcb flags

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

4 months agoamd64 gdt_segs: use designated initializers
Konstantin Belousov [Fri, 9 Feb 2024 04:59:48 +0000 (06:59 +0200)]
amd64 gdt_segs: use designated initializers

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

4 months agoamd64/linux*: mark brandlists as static
Konstantin Belousov [Sat, 10 Feb 2024 01:01:38 +0000 (03:01 +0200)]
amd64/linux*: mark brandlists as static

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

4 months agoELF note parser: provide more info on failure
Konstantin Belousov [Sat, 10 Feb 2024 01:36:58 +0000 (03:36 +0200)]
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

4 months agoimgact_elf.c: remove sys/cdefs.h include
Konstantin Belousov [Sat, 10 Feb 2024 01:02:33 +0000 (03:02 +0200)]
imgact_elf.c: remove sys/cdefs.h include

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

4 months agoamd64 uprintf_signal: add space between %rax value and code bytes
Konstantin Belousov [Sat, 10 Feb 2024 05:06:00 +0000 (07:06 +0200)]
amd64 uprintf_signal: add space between %rax value and code bytes

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

4 months agoDocument aio_read2/aio_write2
Konstantin Belousov [Sat, 3 Feb 2024 18:12:59 +0000 (20:12 +0200)]
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

4 months agoaio_read2/aio_write2: add AIO_OP2_VECTORED
Konstantin Belousov [Sat, 3 Feb 2024 18:09:36 +0000 (20:09 +0200)]
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

4 months agolibc: add aio_read2() and aio_write2() functions
Konstantin Belousov [Thu, 1 Feb 2024 02:39:00 +0000 (04:39 +0200)]
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

4 months agolio_listio(2): add LIO_FOFFSET flag to ignore aiocb aio_offset
Konstantin Belousov [Sat, 13 Jan 2024 19:46:18 +0000 (21:46 +0200)]
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

4 months agoLinuxKPI: Allow kmalloc to be called when FPU protection is enabled
Vladimir Kondratyev [Sat, 10 Feb 2024 22:01:50 +0000 (01:01 +0300)]
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

4 months agoRevert "LinuxKPI: Add explicit software context to FPU sections"
Vladimir Kondratyev [Sat, 10 Feb 2024 22:01:50 +0000 (01:01 +0300)]
Revert "LinuxKPI: Add explicit software context to FPU sections"

kmalloc() support within FPU sections will be redone in other way.

This reverts commit 5a3bd281672bd6bd8e18081c3928dfe76d330a5f.

Sponsored by: Serenity Cyber Security, LLC
Requested by: jhb

4 months agoRevert "LinuxKPI: Do not use explicit context in FPU sections on powerpc64"
Vladimir Kondratyev [Sat, 10 Feb 2024 22:01:50 +0000 (01:01 +0300)]
Revert "LinuxKPI: Do not use explicit context in FPU sections on powerpc64"

kmalloc() support within FPU sections will be redone in other way.

This reverts commit b4efc62776344a9aaada5a0866e453e528a0e977.

Sponsored by: Serenity Cyber Security, LLC
Requested by: jhb

4 months agoRemove usr.bin/clang/llvm-ar/llvm-cxxfilt-driver.cpp file
Dimitry Andric [Sat, 10 Feb 2024 21:00:05 +0000 (22:00 +0100)]
Remove usr.bin/clang/llvm-ar/llvm-cxxfilt-driver.cpp file

I accidentally copied this to the wrong place, or by accident to two
places, during the merge of llvmorg-17-init-19304-gd0b54bb50e51.

Fixes: 06c3fb2749bd
MFC after: 3 days

4 months agorc.subr.8 note when DebugOn will be called
Simon J. Gerraty [Sat, 10 Feb 2024 20:30:53 +0000 (12:30 -0800)]
rc.subr.8 note when DebugOn will be called

4 months agoloader: Document the lua loader table.
Warner Losh [Sat, 10 Feb 2024 18:49:09 +0000 (11:49 -0700)]
loader: Document the lua loader table.

Document all the public functions from the "loader" table.

Sponsored by: Netflix
Reviewed by: pauamma_gundo.com, tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D43701

4 months agorc.subr avoid noise if /usr not mounted
Simon J. Gerraty [Sat, 10 Feb 2024 18:14:23 +0000 (10:14 -0800)]
rc.subr avoid noise if /usr not mounted

basename, sed and tty are all in /usr/bin and not available
until /usr is mounted.

basename and tty we can replace with a function, but sed is more
important.  Fix o_verify to just use shell builtins, and
rc_trace should avoid trying to set RC_LEVEL until sed is available.

4 months agoAbstract UIO allocation and deallocation.
Alfredo Mazzinghi [Thu, 18 Jan 2024 13:04:41 +0000 (13:04 +0000)]
Abstract UIO allocation and deallocation.

Introduce the allocuio() and freeuio() functions to allocate and
deallocate struct uio. This hides the actual allocator interface, so it
is easier to modify the sub-allocation layout of struct uio and the
corresponding iovec array.

Obtained from: CheriBSD
Reviewed by: kib, markj
MFC after: 2 weeks
Sponsored by: CHaOS, EPSRC grant EP/V000292/1
Differential Revision: https://reviews.freebsd.org/D43711

4 months agoFix subr_uio.c style(9) with uses of sizeof.
Alfredo Mazzinghi [Wed, 17 Jan 2024 17:23:58 +0000 (17:23 +0000)]
Fix subr_uio.c style(9) with uses of sizeof.

Obtained from: CheriBSD
Reviewed by: jhb, kib, markj
MFC after: 2 weeks
Sponsored by: CHaOS, EPSRC grant EP/V000292/1
Differential Revision: https://reviews.freebsd.org/D43710

4 months agoread.2: Describe debug.iosize_max_clamp
Konstantin Belousov [Sat, 10 Feb 2024 09:40:07 +0000 (11:40 +0200)]
read.2: Describe debug.iosize_max_clamp

same as it is done for write.2.

PR: 276937
Reported by: bugs.freebsd.org@masklinn.net
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 months agotcp: stop timers and clean scoreboard in tcp_close()
Richard Scheffenegger [Sat, 10 Feb 2024 09:28:42 +0000 (10:28 +0100)]
tcp: stop timers and clean scoreboard in tcp_close()

Stop timers when in tcp_close() instead of doing that in tcp_discardcb().
A connection in CLOSED state shall not need any timers. Assert that no
timer is rescheduled after that in tcp_timer_activate() and verfiy that
this is also the expected state in tcp_discardcb().

PR: 276761
Reviewed By: glebius, tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D43792

4 months agotcp: stop doing superfluous work after sending RST
Richard Scheffenegger [Sat, 10 Feb 2024 09:24:10 +0000 (10:24 +0100)]
tcp: stop doing superfluous work after sending RST

When sending a RST control segment in tcp_output() it
means we are in TCPS_CLOSED state, called from tcp_drop().
Once the RST is sent, don't call tcp_timer_activate() or
update anything in tcpcb, since that will go away shortly.

PR: 276761
Provided by: glebius
Reviewed By: glebius, tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D43808

4 months agotcp: clean scoreboard when releasing the socket buffer
Richard Scheffenegger [Sat, 10 Feb 2024 09:16:08 +0000 (10:16 +0100)]
tcp: clean scoreboard when releasing the socket buffer

The SACK scoreboard is conceptually an extention of the socket
buffer. Remove it when the socket buffer goes away with
soisdisconnected(). Verify that this is also the expected
state in tcp_discardcb().

PR: 276761
Reviewed by: glebius, tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D43805

4 months agocommitters-src: Extremely belatedly add myself
Jessica Clarke [Sat, 10 Feb 2024 06:07:14 +0000 (06:07 +0000)]
committers-src: Extremely belatedly add myself

4 months agoichsmb: add Cedar Fork PCI id
Kristof Provost [Fri, 9 Feb 2024 16:52:41 +0000 (17:52 +0100)]
ichsmb: add Cedar Fork PCI id

Sponsored by: Rubicon Communications, LLC ("Netgate")

4 months agocam: Check if cam_simq_alloc fails for the xpt bus during module init
John Baldwin [Fri, 9 Feb 2024 19:53:43 +0000 (11:53 -0800)]
cam: Check if cam_simq_alloc fails for the xpt bus during module init

This is very unlikely to fail (and if it does, CAM isn't going to work
regardless), but fail with an error rather than a gauranteed panic via
NULL pointer dereference.

PR: 276770
Reported by: Qiushi <w290680224@gmail.com>

4 months agopcib: Refine handling of resources allocated from bridge windows
John Baldwin [Fri, 9 Feb 2024 18:27:45 +0000 (10:27 -0800)]
pcib: Refine handling of resources allocated from bridge windows

Fix a long-standing layering violation in the original NEW_PCIB code
by not passing suballocated resources up to the parent bus for
activation and mapping.  Instead, handle activation and mapping of
sub-allocated resources in this driver.  When mapping resources,
request a mapping from a suitable sub-region of the resource allocated
from the parent bus for the associated bridge window.

Note that this does require passing RF_ACTIVE (with RF_UNMAPPED) when
allocating bridge window resources from the parent.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43690

4 months agopcib: Allocate PCI_RES_BUS resources with RF_ACTIVE
John Baldwin [Fri, 9 Feb 2024 18:27:45 +0000 (10:27 -0800)]
pcib: Allocate PCI_RES_BUS resources with RF_ACTIVE

The allocated bus numbers are in use so should be activated when
allocated.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43689

4 months agopcib: Make various bus methods private to pci_pci.c
John Baldwin [Fri, 9 Feb 2024 18:27:45 +0000 (10:27 -0800)]
pcib: Make various bus methods private to pci_pci.c

These functions are not used by pcib subclasses so do not need to
be exposed in pcib_private.h.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43688

4 months agoacpi: Cleanup handling of suballocated resources
John Baldwin [Fri, 9 Feb 2024 18:27:45 +0000 (10:27 -0800)]
acpi: Cleanup handling of suballocated resources

For resources suballocated from the system resource rmans, handle
those in the ACPI bus driver without passing them up to the parent.
This means using bus_generic_rman_* for several bus methods for
operations on suballocated resources.  For bus_map/unmap_resource,
find the system resource allocated from the parent bus (nexus) that
contains the range being mapped and request a mapping of that parent
resource.

This avoids a layering violation where nexus drivers were previously
asked to manage the activation and mapping of resources created
belonging to the ACPI resource managers.

Note that this does require passing RF_ACTIVE (with RF_UNMAPPED) when
allocating system resources from the parent.

While here, don't assume that the parent bus (nexus) provides a
resource list that sysres resources are placed on.  Instead, create a
dedicated resource_list in the ACPI bus driver's softc to hold sysres
resources.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43687

4 months agoacpi: Use bus_generic_alloc_resource instead of duplicating it
John Baldwin [Fri, 9 Feb 2024 18:27:45 +0000 (10:27 -0800)]
acpi: Use bus_generic_alloc_resource instead of duplicating it

No functional change, but it is cleaner to use the existing generic
wrappers rather than KOBJ methods directly.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43686

4 months agoacpi: Use kobj typedefs for new-bus method prototypes
John Baldwin [Fri, 9 Feb 2024 18:27:44 +0000 (10:27 -0800)]
acpi: Use kobj typedefs for new-bus method prototypes

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43685

4 months agobsdinstall: Add new Auto option to netconfig interface selection dialog
Jessica Clarke [Fri, 9 Feb 2024 18:13:47 +0000 (18:13 +0000)]
bsdinstall: Add new Auto option to netconfig interface selection dialog

This changes the OK / Cancel buttons into Auto / Manual / Cancel, with
Auto being the default. Manual behaves like OK used to, i.e. presents a
series of dialogs asking exactly how to configure the interface, and
Cancel is unchanged, exiting with exit code 1. Auto will attempt to
configure IPv4+DHCP and IPv6+SLAAC with no interaction, failing only if
neither can be configured, thereby supporting all of IPv4-only,
IPv6-only and dual-stack environments. If at least one DNS server is
provided, it will also skip asking for DNS settings, otherwise it will
act like Manual mode for the purposes of DNS settings and prompt. For a
standard dual-stack environment this cuts down the number of netconfig
dialogs from 6 (interface, IPv4, DHCP, IPv6, SLAAC, DNS) to just the
first one.

Reviewed by: brooks
Differential Revision: https://reviews.freebsd.org/D43731

4 months agolibsys: add guards to MD manpages
Brooks Davis [Fri, 9 Feb 2024 17:21:15 +0000 (17:21 +0000)]
libsys: add guards to MD manpages

This avoids duplicate installations which fail packaging tests.

Reported by: emaste

4 months ago/etc/rc add trace debug and verify
Simon J. Gerraty [Fri, 9 Feb 2024 17:15:58 +0000 (09:15 -0800)]
/etc/rc add trace debug and verify

Debugging boot issues can be helped by
logging each rc.d script as it is run
and being able to selectively enable/disable set -x
debug.sh provides an elaborate framework for debugging shell scripts.

For secure systems, we want to be paranoid about what we read
during boot.

dot() simply reads (.) arg file if it exists
vdot() if mac_veriexec is active, ignore unverified files
otherwise behaves much the same as dot()
safe_dot()  in safe_eval.sh allows reading an untrusted file;
limiting the input to simple variable assignments.

In load_rc_config allow caller to provide an option to indicate how to
handle its arg:
-v use vdot()
-s use sdot() which will try to use vdot() and fallback to safe_dot()
The default is to read using dot()

rc_run_scripts()
encapsulate the running of rc.d scripts
so that we can easily call it more than twice.

We vdot local.rc.subr to pick up extensions (like
run_rc_scripts_final) and overrides.

We also allow rc.subr.local or rc.conf to set rc_config_xtra
eg (rc_config_xtra=XXX for historic compatibility)

rc use set -o verify around the reading in of rc.subr
This has no effect if mac_veriexec is not active, but if it is; ensures
rc.subr has not been tampered with.

Reviewed by: imp
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D43671

4 months agontb: Add Intel Xeon Gen4 support
Austin Zhang [Wed, 7 Feb 2024 18:55:02 +0000 (12:55 -0600)]
ntb: Add Intel Xeon Gen4 support

The NTB hardware of XEON Ice lake and Sapphire Rapids has register mapping changes
Add a new NTB_XEON_GEN4 device type and use it to conditionalize driver logic differs

Reviewed by: vangyzen, dab
Sponsored by: Dell Technologies
Differential Revision: https://reviews.freebsd.org/D43291

4 months agoarm64: Add a GENERIC-KMSAN kernel configuration
Alexander Stetsenko [Thu, 8 Feb 2024 19:28:17 +0000 (14:28 -0500)]
arm64: Add a GENERIC-KMSAN kernel configuration

Reviewed by: imp
Sponsored by: Klara, Inc.
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D43153

4 months agofusefs: only test for incoherency if FN_SIZECHANGE is set
Emil Tsalapatis [Thu, 8 Feb 2024 01:13:43 +0000 (20:13 -0500)]
fusefs: only test for incoherency if FN_SIZECHANGE is set

FUSE emits spurious incoherency warnings in writethrough mode. The
warnings are triggered by setattr calls generated by vnode truncation
turning the cached va_size vattr stale, causing comparisons with the
fresh version provided by the server to fail. Only validate the vnode's
va_size vattr if the FN_SIZECHANGE flag is set.

This is a part of the research work at RCSLab, University of Waterloo.

Reviewed by: asomers
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1110

4 months agoifconfig: a typo fixed in the man page
Maxim Konovalov [Fri, 9 Feb 2024 01:40:00 +0000 (01:40 +0000)]
ifconfig: a typo fixed in the man page

PR: 276878

4 months agolibsys: actually install manpages
Brooks Davis [Thu, 8 Feb 2024 18:21:56 +0000 (18:21 +0000)]
libsys: actually install manpages

In initial hacking I'd bluntly disabled manpage installation in libsys,
then later disabled them for libc, but forgot to fix the former leading
to no syscall manapages.

PR: 276887
Reported by: Martin Birgmeier <d8zNeCFG@aon.at>

4 months agolibsys: move some missed manpages
Brooks Davis [Thu, 8 Feb 2024 19:41:11 +0000 (19:41 +0000)]
libsys: move some missed manpages

Fixes: 29d079c96491 - libsys: move __libsys_interposer consumers

4 months agotcp: ensure tcp_sack_partialack does not inflate cwnd after RTO
Richard Scheffenegger [Thu, 8 Feb 2024 18:56:27 +0000 (19:56 +0100)]
tcp: ensure tcp_sack_partialack does not inflate cwnd after RTO

The implicit assumption of snd_nxt always being larger than
snd_recover is not true after RTO. In that case, cwnd
would get inflated to ssthresh, which may be much larger
than the current pipe (data in flight).

Reviewed By:           tuexen, #transport
Sponsored by:          NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D43653

4 months agoMerge commit f577bfb99528 from llvm-project (by Alexander Potapenko):
Dimitry Andric [Thu, 8 Feb 2024 19:19:27 +0000 (20:19 +0100)]
Merge commit f577bfb99528 from llvm-project (by Alexander Potapenko):

  [sanitizer][msan] fix AArch64 vararg support for KMSAN (#70660)

  Cast StackSaveAreaPtr, GrRegSaveAreaPtr, VrRegSaveAreaPtr to pointers to
  fix assertions in getShadowOriginPtrKernel().

Fixes: https://github.com/llvm/llvm-project/issues/69738
  Patch by Mark Johnston.

Requested by: markj
MFC after: 3 days

4 months agotcp: calculate ssthresh on RTO according to RFC5681
Richard Scheffenegger [Thu, 8 Feb 2024 18:12:19 +0000 (19:12 +0100)]
tcp: calculate ssthresh on RTO according to RFC5681

per RFC5681, only adjust ssthresh on the initital
retransmission timeout. Since RTO often happens
during loss recovery, while cwnd no longer tracks
all data in flight, calculcate pipe properly.

Reviewed By:           tuexen, #transport
Sponsored by:          NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D43768

4 months agotraceroute6: Update .PATH and include path after traceroute moved
Mark Johnston [Thu, 8 Feb 2024 17:57:33 +0000 (12:57 -0500)]
traceroute6: Update .PATH and include path after traceroute moved

Fixes: 9b7a920a12a9 ("traceroute: move from contrib to usr.sbin")

4 months agotcp: use tcp_fixed_maxseg instead of tcp_maxseg in cc modules
Richard Scheffenegger [Thu, 8 Feb 2024 16:56:29 +0000 (17:56 +0100)]
tcp: use tcp_fixed_maxseg instead of tcp_maxseg in cc modules

tcp_fixed_maxseg() is the streamlined calculation of typical
tcp options and more suitable for heavy use in the congestion
control modules on every received packet.

No external functional change.

Reviewed By:           tuexen, #transport
Sponsored by:          NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D43779

4 months agounix: retire LOCAL_CONNWAIT
Gleb Smirnoff [Thu, 8 Feb 2024 17:00:23 +0000 (09:00 -0800)]
unix: retire LOCAL_CONNWAIT

This socket option was added in 6a2989fd54a9 together with LOCAL_CREDS.
Both options originate from NetBSD.  The LOCAL_CREDS seems to be used by
some software and is covered by our test suite.

The main problem with LOCAL_CONNWAIT is that it doesn't work as
documented. A basic test shows that connect(2) indeed blocks, but
accept(2) on the other side does not wake it up.  Indeed, I don't see what
code in the accept(2) path would go into the peer socket of a unix/stream
listener's child and would make wakeup(&so->so_timeo).  I tried the test
even on a FreeBSD 6.4-RELEASE and it produced the same results as on
CURRENT.

The other thing that puzzles me is why that option would be useful even if
it worked? Because on unix/stream you can send(2) immediately after
connect(2) and that would put data on the peer receive buffer even before
listener had done accept(2). In other words, one side can do connect(2)
then send(2), only after the remote side would make accept(2) and the
remote would see the data sent before the accept(2).  Again this
undocumented feature of unix(4) is present on all versions from FreeBSD 6
to CURRENT.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D43708

4 months agotests/unix_passfd: add a comment for send_a_lot
Gleb Smirnoff [Thu, 8 Feb 2024 17:00:23 +0000 (09:00 -0800)]
tests/unix_passfd: add a comment for send_a_lot

Explain why SOCK_DGRAM and SOCK_STREAM differ in this edge case.  While
here improve output in case of a failure.

4 months agotests/unix_passfd: test that control mixed with data creates records
Gleb Smirnoff [Thu, 8 Feb 2024 17:00:23 +0000 (09:00 -0800)]
tests/unix_passfd: test that control mixed with data creates records

If socket has data interleaved with control it would never allow to read
two pieces of data, neither two pieces of control with one recvmsg(2).  In
other words, presence of control makes a SOCK_STREAM socket behave like
SOCK_SEQPACKET, where control marks the records. This is not a documented
or specified behavior, but this is how it worked always for BSD sockets.
If you look closer at it, this actually makes a lot of sense, as if it
were the opposite both the kernel code and an application code would
become way more complex.

The change made recvfd_payload() to return received length and requires
caller to do ATF_REQUIRE() itself.  This required a small change to
existing test rights_creds_payload.  It also refactors a bit f28532a0f363,
pushing two identical calls out of TEST_PROTO ifdef.

Reviwed by: markj
Differential Revision: https://reviews.freebsd.org/D43724

4 months agotests/unix_passfd: fix typos - assignment instead of comparison
Gleb Smirnoff [Thu, 8 Feb 2024 17:00:23 +0000 (09:00 -0800)]
tests/unix_passfd: fix typos - assignment instead of comparison

This typos were actually hiding a kernel bug, see 541e6a989cae.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D43734

4 months agounix/stream: do not put empty mbufs on the socket
Gleb Smirnoff [Thu, 8 Feb 2024 17:00:23 +0000 (09:00 -0800)]
unix/stream: do not put empty mbufs on the socket

It is a legitimate case to use sendmsg(2) to send control only, with zero
bytes of data and then recvmsg(2) them with zero length iov, receiving
control only.  This sendmsg(2)+recmsg(2) would leave a zero length mbuf on
the top of the socket buffer.  If you now try to repeat this combo again,
your recvmsg(2) would not return control data, because it sits behind an
MT_DATA mbuf and you have provided zero length uio_resid. IMHO, best
strategy to deal with zero length buffers in a chain is to not put them
there in the first place.  Thus, solve this right in uipc_send() instead
of touching soreceive_generic().

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D43733

4 months agotraceroute: remove rcsid tags
Lexi Winter [Sat, 3 Feb 2024 13:24:26 +0000 (13:24 +0000)]
traceroute: remove rcsid tags

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

4 months agotraceroute: remove configuration #defines
Lexi Winter [Sat, 3 Feb 2024 13:19:03 +0000 (13:19 +0000)]
traceroute: remove configuration #defines

traceroute used a series of #defines to specify what features are
available on the host platform.  As traceroute is now in source, these
are unnecessary and complicate the code, so remove them.

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

4 months agotraceroute: move from contrib to usr.sbin
Lexi Winter [Sat, 3 Feb 2024 13:10:09 +0000 (13:10 +0000)]
traceroute: move from contrib to usr.sbin

traceroute hasn't had a vendor import since 2002, while since then it's
had several significant FreeBSD-specific commits.  Since it's unlikely
another vendor import will happen, and to make the merge of traceroute6
into traceroute easier, import traceroute into usr.sbin.

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

4 months agoarm64: Add pmap integration for KMSAN
Mark Johnston [Thu, 8 Feb 2024 16:11:02 +0000 (11:11 -0500)]
arm64: Add pmap integration for KMSAN

- In pmap_bootstrap_san(), allocate the root PTPs for the shadow maps.
  (For KASAN, this is done earlier since we need to do some special
  bootstrapping for the kernel stack.)
- Adjust ifdefs to include KMSAN.
- Expand the shadow maps when pmap_growkernel() is called.

MFC after: 2 weeks
Sponsored by: Klara, Inc.
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D43405

4 months agoarm64: Simplify and improve KASAN shadow map bootstrapping
Mark Johnston [Thu, 8 Feb 2024 16:10:43 +0000 (11:10 -0500)]
arm64: Simplify and improve KASAN shadow map bootstrapping

- Move pmap_bootstrap_allocate_kasan_l2() close to the place where it is
  actually used.
- Simplify pmap_bootstrap_allocate_kasan_l2() a bit: eliminate some
  unneeded variables and zero and exclude each 2MB mapping as we go
  rather than doing that all at once.  Excluded regions will be
  coalesced.
- As a consequence of the previous point, ensure that we do not zero a
  preexisting 2MB mapping.
- Simplify pmap_bootstrap_san() and prepare it to work with KMSAN.

MFC after: 2 weeks
Sponsored by: Klara, Inc.
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D43404

4 months agoarm64: Enable KMSAN when configured to do so
Alexander Stetsenko [Thu, 8 Feb 2024 16:04:52 +0000 (11:04 -0500)]
arm64: Enable KMSAN when configured to do so

MFC after: 2 weeks
Sponsored by: Klara, Inc.
Sponsored by: Juniper Networks, Inc.

4 months agokmsan: Update kmsan.9 to note arm64 support
Mark Johnston [Thu, 8 Feb 2024 16:04:08 +0000 (11:04 -0500)]
kmsan: Update kmsan.9 to note arm64 support

MFC after: 2 weeks
Sponsored by: Klara, Inc.
Sponsored by: Juniper Networks, Inc.

4 months agoarm64: Disable kernel superpage promotion when KMSAN is configured
Mark Johnston [Thu, 8 Feb 2024 16:02:48 +0000 (11:02 -0500)]
arm64: Disable kernel superpage promotion when KMSAN is configured

The break-before-make operation required to promote or demote a
superpage leaves a window where the KMSAN runtime can trigger a fatal
data abort.  More specifically, the code in pmap_update_entry() which
executes after ATTR_DESCR_VALID is cleared may implicitly attempt to
access KMSAN context via curthread, but we may be promoting or demoting
a 2MB page containing the curthread structure.

Reviewed by: imp
Sponsored by: Klara, Inc.
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D43158

4 months agoarm64: Implement busdma bits for KMSAN
Mark Johnston [Thu, 8 Feb 2024 16:01:55 +0000 (11:01 -0500)]
arm64: Implement busdma bits for KMSAN

This works identically to amd64.  In particular, only the
bus_dma_bounce_impl busdma implementation handles KMSAN at the moment.

MFC after: 2 weeks
Sponsored by: Klara, Inc.
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D43157