Commit Graph

282873 Commits

Author SHA1 Message Date
Ed Maste
10854bf517 makefs: use unsigned and %u for rock_ridge_move_count
For diff reduction against NetBSD's makefs.  Based on NetBSD git mirror
commit 00991aee8248.

With this change our makefs cd9660 support should be in sync up to
NetBSD commit bdae6c9dc792 ("makefs(8): Nix trailing whitespace.").

Sponsored by:	The FreeBSD Foundation
2023-04-17 08:21:28 -04:00
Alexander V. Chernikov
9742519b22 netlink: fix operations with link-local routes/gateways.
MFC after:	3 days
2023-04-17 12:04:43 +00:00
Alexander V. Chernikov
b8da3b62a5 tests: add ktest modules to build
MFC after:	2 weeks
2023-04-17 10:46:05 +00:00
Pawel Jakub Dawidek
068913e4ba zfs: Add vfs.zfs.bclone_enabled sysctl.
Keep block cloning disabled by default for now, but allow to enable and
use it after setting vfs.zfs.bclone_enabled to 1, so people can easily
try it.

Approved by:	oshogbo
Reviewed by:	mm, oshogbo
Differential Revision:	https://reviews.freebsd.org/D39613
2023-04-17 03:38:30 -07:00
Zhenlei Huang
401f03445e lagg(4): Correctly define some sysctl variables
939a050ad9 virtualized lagg(4), but the corresponding sysctl of some
virtualized global variables are not marked with CTLFLAG_VNET. A try to
operate on those variables via sysctl will effectively go to the 'master'
copies and the virtualized ones are not read or set accordingly. As a
side effect, on updating the 'master' copy, the virtualized global
variables of newly created vnets will have correct values.

PR:		270705
Reviewed by:	kp
Fixes:		939a050ad9 Virtualize lagg(4) cloner
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D39467
2023-04-17 18:24:35 +08:00
Zhenlei Huang
a7acce3491 vnet: Fix a typo in a source code comment
- s/form/from/

MFC after:	3 days
2023-04-17 18:24:35 +08:00
Pawel Jakub Dawidek
1959e122d9 zfs: Merge https://github.com/openzfs/zfs/pull/14739
The zfs_log_clone_range() function is never called from the
zfs_clone_range_replay() function, so I assumed it is safe to assert
that zil_replaying() is never TRUE here. It turns out zil_replaying()
also returns TRUE when the sync property is set to disabled.

Fix the problem by just returning if zil_replaying() returns TRUE.

Reported by: Florian Smeets
Signed-off-by: Pawel Jakub Dawidek pawel@dawidek.net

Approved by: oshogbo, mm
2023-04-17 02:22:56 -07:00
Pawel Jakub Dawidek
e0bb199925 zfs: cherry-pick openzfs/zfs@c71fe7164
Fix data corruption when cloning embedded blocks

Don't overwrite blk_phys_birth, as for embedded blocks it is part of
the payload.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Issue #13392
Closes #14739

Approved by: oshogbo, mm
2023-04-17 02:19:49 -07:00
Simon J. Gerraty
bf7aa99a55 Update meta mode makefiles
meta2deps - add checks to detect truncated/corrupted filemon data
(only known to happen on Linux hosts), to ensure we do not auto
update dependencies based on incomplete data.

meta.stage.mk adds STAGE_SHLIB_LINKS_FILTER and STAGE_LINK_AS_*

We also allow for hosts where egrep is deprecated for grep -E

Reviewed by: stevek
2023-04-16 18:40:53 -07:00
Stephen J. Kiernan
88a3358ea4 veriexec: Add SPDX-License-Identifier 2023-04-16 21:23:00 -04:00
Simon J. Gerraty
a3d015bbf1 Update dirdeps.mk
Fix handling of local.dirdeps-missing.mk
we need to reset DEP_RELDIR and DIRDEPS just as if including
a Makefile.depend*

Also fix a typo in DIRDEP_LOADAVG_REPORT
and improve debug output.

Reviewed by: stevek
2023-04-16 18:17:26 -07:00
Stephen J. Kiernan
1c7ac0c23b veriexec: fix use of getopt
getopt(3) returns int type not char. Using char triggers the
-Wtautological-constant-out-of-range-compare warning with clang.
Change the type of the variable used for holding the return value
of getopt(3) to int to match the prototype and eliminate the warning.

MFC after:	1 week
2023-04-16 21:02:04 -04:00
Stephen J. Kiernan
894bcc876d sys/modules/Makefile: conditionally add MAC/veriexec modules
Only build MAC/veriexec modules when MK_VERIEXEC is yes or we
are building all modules.

Add VERIEXEC knob to kernel __DEFAULT_NO_OPTIONS

Reviewed by:	sjg
Obtained from:	Juniper Networks, Inc.
2023-04-16 20:24:54 -04:00
Stephen J. Kiernan
2e6a433811 veriexec: allow sha512 fingerprint in manifest parser
MAC/veriexec already supports SHA512 fingerprints, therefore the
veriexec program should also.

Reviewed by:	sjg
2023-04-16 19:25:27 -04:00
Stephen J. Kiernan
8050e0a429 sys/modules/Makefile: add MAC/veriexec modules into the build
Build the MAC/veriexec module and the SHA2, SHA256, SHA384, and
SHA512 fingerprint modules.

Obtained from:	Juniper Networks, Inc.
2023-04-16 19:18:55 -04:00
Simon J. Gerraty
6ae8d57652 mac_veriexec: add mac_priv_grant check for NODEV
Allow other MAC modules to override some veriexec checks.

We need two new privileges:
PRIV_VERIEXEC_DIRECT	process wants to override 'indirect' flag
			on interpreter
PRIV_VERIEXEC_NOVERIFY	typically associated with PRIV_VERIEXEC_DIRECT
			allow override of O_VERIFY

We also need to check for PRIV_VERIEXEC_NOVERIFY override
for FINGERPRINT_NODEV and FINGERPRINT_NOENTRY.
This will only happen if parent had PRIV_VERIEXEC_DIRECT override.

This allows for MAC modules to selectively allow some applications to
run without verification.

Needless to say, this is extremely dangerous and should only be used
sparingly and carefully.

Obtained from:	Juniper Networks, Inc.

Reviewers: sjg
Subscribers: imp, dab

Differential Revision: https://reviews.freebsd.org/D39537
2023-04-16 19:14:40 -04:00
Ed Maste
e5551216d8 makefs: call brelse from bread
This matches NetBSD and rationalizes makefs with the kernel API.

This reverts commit 370e009188.

Reviewed by:	mckusick
Sponsored by:	The FreeBSD Foundation
Obtained from:	NetBSD 0a62dad69f62, 0c4125e1a19f, cb6a5a3575fd
Differential Revision:	https://reviews.freebsd.org/D39070
2023-04-16 15:45:17 -04:00
Rick Macklem
89d197cc99 RELNOTES: Add entries for two new NFS features 2023-04-16 12:34:52 -07:00
Stephen J. Kiernan
4819e5aeda Add new privilege PRIV_KDB_SET_BACKEND
Summary:
Check for PRIV_KDB_SET_BACKEND before allowing a thread to change
the KDB backend.

Obtained from:	Juniper Networks, Inc.
Reviewers: sjg, emaste
Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D39538
2023-04-16 14:37:58 -04:00
Ed Maste
c753f49f70 makefs: remove unused cd9660 options
Makefs defined "follow-symlinks" and "help" options, but they did
nothing.  Remove them.

Obtained from:	OpenBSD a8f1645688c2
Sponsored by:	The FreeBSD Foundation
2023-04-16 09:38:02 -04:00
Val Packett
77f0e198d9 procctl: add state flags to PROC_REAP_GETPIDS reports
For a process supervisor using the reaper API to track process subtrees,
it is very useful to know the state of the processes on the list.

Sponsored by:   https://www.patreon.com/valpackett
Reviewed by:    kib
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D39585
2023-04-16 13:48:20 +03:00
Gordon Bergling
82a036d86a morse.6: Mention to standards in the SEE ALSO section
Mention ITU-T Recommendation F.1 and ITU-R M.1677-1
in the SEE ALSO section.

Obtained from:	OpenBSD
MFC after:	5 days
2023-04-16 11:46:09 +02:00
Gordon Bergling
991360ba49 grdc.6: Add an ENVIRONMENT section
- Add an ENVIRONMENT section

Obtained from:	OpenBSD
MFC after:	5 days
2023-04-16 11:17:06 +02:00
Stephen J. Kiernan
b1a00c2b13 Quiet compiler warnings for fget_noref and fdget_noref
Summary:
Typecasting both parts of the comparison to u_int quiets compiler
warnings about signed/unsigned comparison and takes care of positive
and negative numbers for the file descriptor in a single comparison.

Obtained from:	Juniper Netwowrks, Inc.

Reviewers: mjg

Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D39593
2023-04-15 23:50:54 -04:00
Cyrus Rahman
0ab68e9272 loader: lua: disable autoboot timer after password entry
In the lua loader, if one sets a password in loader.conf, the
autoboot_delay timer will start before the menu is displayed.  One can
interrupt the autoboot and bring up the menu by entering a keyboard
character before the timer expires.

If this is done a prompt for the password is displayed.  Entering the
password will bring up the menu, but the timer will again start and
another keyboard character must be entered or autoboot will abort the
menu and boot the system.

PR:		265472
Reviewed by:	kevans
MFC after:	3 days
2023-04-15 21:39:56 -05:00
Cyrus Rahman
d7584aa09f loader: lua: unload the kernel when changing BEs
Usually the kernel is loaded later, but there are circumstances where it
could have been loaded earlier than changing BEs.  Unload anything that
is already there so that we know we're using artifacts from the proper
environment.

PR:		265471
Reviewed by:	kevans
MFC after:	3 days
2023-04-15 21:39:52 -05:00
Warner Losh
214909d669 Revert "cam: fix up world compilation after previous"
This reverts commit 1d35493e46. It was the wrong fix. 757fc6666b has
the proper fix to include stdbool for userland.

Sponsored by:		Netflix
2023-04-15 18:25:55 -06:00
Warner Losh
757fc6666b cam: Include stdbool.h for userland
Sponsored by:		Netflix
2023-04-15 18:25:22 -06:00
Mateusz Guzik
1d35493e46 cam: fix up world compilation after previous
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-04-15 23:11:27 +00:00
Warner Losh
fd02926a68 cam: Properly mask out the status bits to get completion code
ccb_h.status has two parts: the actual status and some addition bits to
indicate additional information. It must be masked before comparing
against completion codes. Add new inline function cam_ccb_success to
simplify this to test whether or not the request succeeded. Most of the
code already does this, but a few places don't (the rest likely should
be converted to use cam_ccb_status and/or cam_ccb_success, but that's
for another day). This caused at least one bug in recognizing devices
behind a SATA port multiplexer, though some of these checks were
fine with the special knowledge of the code paths involved.

PR:			270459
Sponsored by:		Netflix
MFC After:		1 week (and maybe a EN requst)
Reviewed by:		ken, mav
Differential Revision:	https://reviews.freebsd.org/D39572
2023-04-15 16:32:41 -06:00
Mateusz Guzik
63ee747feb zfs: Revert "ZFS_IOC_COUNT_FILLED does unnecessary txg_wait_synced()"
This reverts commit 519851122b.

It results in data corruption, see:
https://github.com/openzfs/zfs/issues/14753

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-04-15 21:34:54 +00:00
Mateusz Guzik
46ac8f2e7d zfs: don't use zfs_freebsd_copy_file_range
There is one data corruption problem reported and fixed upstream, not
cherry-picked here yet.

On top of it the following fires under load:
        VERIFY(zil_replaying(zfsvfs->z_log, tx));

The patch which introduced the entire machinery is a revert candidate,
but as the machinery came with a dedicated feature flag, doing so would
render affected pools read-only at best. To be figured out.

As a temporary bandaid at least stop the active usage.
Note this patch does not make the feature disappear from zpool upgrade.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-04-15 21:34:54 +00:00
Bjoern A. Zeeb
42742fe725 KASAN: add bus_space*read*_8 for aarch64
Add the remaining bus_space*read*_8 functions conditionally for
only arm64 in order to not break KASAN builds with new code using
one of them.

Suggested by:	markj
Reviewed by:	markj
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D39581
2023-04-15 16:13:56 +00:00
Eugene Grosbein
5ee1c90e50 tmpfs: unbreak module build outside of kernel build environment
MFC after:	3 days
2023-04-15 11:00:03 +07:00
Simon J. Gerraty
d1dfe419ac libsecureboot allow site.trust.mk to override settings
The current content of local.trust.mk is mostly for example
purposes.
2023-04-14 17:28:10 -07:00
Simon J. Gerraty
2b8331622f Fix DIRDEPS_BUILD for libgcc_eh 2023-04-14 16:56:30 -07:00
Konstantin Belousov
dcc19c6701 pkru.3: fix markup
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-04-15 02:53:59 +03:00
Konstantin Belousov
1e0e335b0f amd64: fix PKRU and swapout interaction
When vm_map_remove() is called from vm_swapout_map_deactivate_pages()
due to swapout, PKRU attributes for the removed range must be kept
intact.  Provide a variant of pmap_remove(), pmap_map_delete(), to
allow pmap to distinguish between real removes of the UVA mappings
and any other internal removes, e.g. swapout.

For non-amd64, pmap_map_delete() is stubbed by define to pmap_remove().

Reported by:	andrew
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D39556
2023-04-15 02:53:59 +03:00
Eric van Gyzen
485f783f88 limits_test: validate CPU time used, not real time
RLIMIT_CPU applies to CPU time, not real (wall-clock) time.
This test failed in AWS, where the real time was 5-7 seconds.

Sum the user and system CPU time used, and validate that.

While I'm here, don't bother specifying -s exit:0 or -e empty,
since those are checked by default.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2023-04-14 16:16:05 -05:00
Randall Stewart
3cc7b66732 tcp: stack unloading crash in rack and bbr
Its possible to induce a crash in either rack or bbr. This would be done
if the rack stack were say the default and bbr was being used by a connection.
If the bbr stack is then unloaded and it was active, we will trigger a MPASS assert
in tcp_hpts since the new stack (default rack) would start a timer, and the old stack
(bbr) would have the inp already in hpts.

Reviewed by: tuexen
Sponsored by: Netflix Inc
Differential Revision:https://reviews.freebsd.org/D39576
2023-04-14 15:42:23 -04:00
Ed Maste
5dbd073b04 awk: errror on printf format strings lacking conversion specifier
Reported by:	phk
Reviewed by:	imp, markj
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39573
2023-04-14 13:31:02 -04:00
Alexander V. Chernikov
9f324d8ac2 netlink: make netlink work correctly on CHERI.
Current Netlink message writer code relies on executing callbacks
 with arbitrary data (pointer or integer) to flush the completed
 messages.
This arbitrary data is stored as a union of { void *, uint64_t }.
At some stage, the message flushing code copied this data, using
 direct uint64_t assignment instead of copying the union. It lead
 to failure on CHERI, as sizeof(pointer) == 16 there.

Fix the code by making union non-anonymous and copying it entirely.

Reviewed by:	br, jhb, jrtc27
Differential Revision: https://reviews.freebsd.org/D39557
MFC after:	2 weeks
2023-04-14 16:33:43 +00:00
Alexander V. Chernikov
3e5d0784b9 Testing: add framework for the kernel unit tests.
This changes intends to reduce the bar to the kernel unit-testing by
 introducing a new kernel-testing framework ("ktest") based on Netlink,
 loadable test modules and python test suite integration.

This framework provides the following features:
* Integration to the FreeBSD test suite
* Automatic test discovery
* Automatic test module loading
* Minimal boiler-plate code in both kernel and userland
* Passing any metadata to the test
* Convenient environment pre-setup using python testing framework
* Streaming messages from the kernel to the userland
* Running tests in the dedicated taskqueues
* Skipping or parametrizing tests

Differential Revision: https://reviews.freebsd.org/D39385
MFC after:	2 weeks
2023-04-14 15:47:55 +00:00
Mikhail Pchelin
2f53b5991c net80211: fix a typo in Rx MCS set for unequal modulation case
RX MCS set defines which MCSs are supported for RX, bits 0-31 are for equal
modulation of the streams, bits 33-76 are for unequal case. Current code checks
txstreams variable instead of rxstreams to set bits from 53 to 76 for 4 spatial
streams case.

The modulations are defined in tables 19-38 and 19-41 of the IEEE Std
802.11-2020.

Spotted by bz in https://reviews.freebsd.org/D39476

Reviewed by:		bz
Approved by:		bz
Sponsored by:		Serenity Cybersecurity, LLC
Differential Revision:	https://reviews.freebsd.org/D39568
2023-04-14 18:20:09 +03:00
Mikhail Pchelin
ea26545cc5 net80211: wrong transmit MCS set in HT cap IE
Current code checks whether or not txstreams are equal to rxstreams and if it
isn't - sets needed bits in "Transmit MCS Set". But if they are equal it sets
whole set to zero, which contradicts the standard, if tx and rx streams are
equal 'Tx MCS Set Defined' (table 9-186, IEEE Std 802.11-2020) must be set to
one.

Reviewed by:		bz
Approved by:		bz
Sponsored by:		Serenity Cybersecurity, LLC
Differential Revision:	https://reviews.freebsd.org/D39476
2023-04-14 18:16:29 +03:00
Kyle Evans
d1b6271118 uart(4): add Sunrise Point UART controllers
Sponsored by:	Zenith Electronics LLC
Sponsored by:	Klara, Inc.
2023-04-14 09:58:00 -05:00
Elliott Mitchell
6d765bff6f xen: move common variables off of sys/x86/xen/hvm.c
The xen_domain_type and HYPERVISOR_shared_info variables are shared by
all Xen architectures, so they should be in common rather than
reimplemented by each architecture.

hvm_start_flags is used by xen_initial_domain() and so needs to be in
common.

Reviewed by: royger
Differential Revision: https://reviews.freebsd.org/D28982
2023-04-14 15:59:11 +02:00
Julien Grall
5e2183dab8 xen/intr: move sys/x86/xen/xen_intr.c to sys/dev/xen/bus/
The event channel source code or equivalent is needed on all
architectures.  Since much of this is viable to share, get this moved out
of x86-land.  Each interrupt interface then needs a distinct back-end
implementation.

Reviewed by: royger
Submitted by: Elliott Mitchell <ehem+freebsd@m5p.com>
Original implementation: Julien Grall <julien@xen.org>, 2014-01-13 17:41:04
Differential Revision: https://reviews.freebsd.org/D30236
2023-04-14 15:58:57 +02:00
Elliott Mitchell
6699c22c1c xen/intr: move interrupt allocation/release to architecture
Simply moving the interrupt allocation and release functions into files
which belong to the architecture.  Since x86 interrupt handling is quite
distinct from other architectures, this is a crucial necessary step.

Identifying the border between x86 and architecture-independent is
actually quite tricky.  Similarly, getting the prototypes for the
border right is also quite tricky.

Inspired by the work of Julien Grall <julien@xen.org>,
2015-10-20 09:14:56, but heavily adjusted.

Reviewed by: royger
Differential Revision: https://reviews.freebsd.org/D30936
2023-04-14 15:58:56 +02:00
Julien Grall
2d795ab1ea xen/intr: move x86 PIC interface to xen_arch_intr.c, introduce wrappers
The x86 PIC interface is very much x86-specific and not used by other
architectures.  Since most of xen_intr.c can be shared with other
architectures, the PIC interface needs to be broken off.

Introduce wrappers for calls into the architecture-dependent interrupt
layer.  All architectures need roughly the same functionality, but the
interface is slightly different between architectures.  Due to the
wrappers being so thin, all of them are implemented as inline in
arch-intr.h.

The original implementation was done by Julien Grall in 2015, but this
has required major updating.

Removal of PVHv1 meant substantial portions disappeared.  The original
implementation took care of moving interrupt allocation to
xen_arch_intr.c, but this has required massive rework and was broken
off.

In the original implementation the wrappers were normal functions.  Some
had empty stubs in xen_intr.c and were removed.

Reviewed by: royger
Submitted by: Elliott Mitchell <ehem+freebsd@m5p.com>
Original implementation: Julien Grall <julien@xen.org>, 2015-10-20 09:14:56
Differential Revision: https://reviews.freebsd.org/D30909
2023-04-14 15:58:56 +02:00