Commit Graph

287741 Commits

Author SHA1 Message Date
Kyle Evans a3ceeef26b arm64: lop off another 24MB of KVA for early device mappings
This grows the block enough to fit a 4K 32-bit depth framebuffer; some
firmware would present smaller GOP modes to be able to boot with a
smaller framebuffer on these devices, but the Windows Devkit firmware
is simply not that nice.  Instead, it offers exactly one GOP mode that
matches the current resolution of the attached display, so with limited
control over resolution on most of my displays it'd be nice if we could
Just Work(TM) at 4K.

andrew notes that he has some ideas for removing PMAP_MAPDEV_EARLY_SIZE
entirely, so this limitation could end up removed altogether in the
future.

Reviewed by:	andrew, emaste
Differential Revision:	https://reviews.freebsd.org/D42726
2023-11-23 10:23:14 -06:00
Mitchell Horne ae9437671a kern_reboot(9): belatedly bump .Dd
Fixes:	4e78a766f6 ("kern_reboot(): don't clear kdb_active")
Sponsored by:	The FreeBSD Foundation
2023-11-23 12:10:42 -04:00
Mitchell Horne 4e78a766f6 kern_reboot(): don't clear kdb_active
It is possible to reach this function from ddb via the "reset" command.
When this happens, we don't actually exit kdb, meaning we never execute
the latter steps of kdb_break() to restore the system state (e.g.
re-enable scheduler).

Therefore, we should not clear the kdb_active flag in this function, as
the debugger is still active. Put differently, kern_reboot() is not an
authority on kdb state, and should not touch it. The original motivation
for this assignment is not clear; I have checked thoroughly and I am
convinced it is not required by any reset code.

This fixes an edge case where a panic can be triggered during reset from
ddb:
 1. Enter ddb via keyboard break sequence (KERNEL_PANICKED() == false &&
    td->td_critnest > 0)
 2. Execute the "reset" command
 3. kern_reboot() sets kdb_active = false
 4. A witness_checkorder() call via shutdown handler sees !kdb_active
    and panics

Reviewed by:	imp, markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D42684
2023-11-23 12:07:43 -04:00
Mitchell Horne 960612a19f shutdown: tweak kproc/kthread shutdown check
This is to handle the case where the system has not panicked but the
debugger is active, where we still can't wait for thread termination.

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D42683
2023-11-23 12:07:43 -04:00
Mitchell Horne 9e0b0f5de6 xen: improve shutdown hook
Make better use of the shutdown flags. In particular this now handles
standard reboot where RB_POWERCYCLE is not set, and indicates a crash
when the system has panicked.

While here, give the function a prefix.

Reviewed by:	royger, markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D42343
2023-11-23 12:07:42 -04:00
Mitchell Horne 2ce1c45b34 iscsi: adjust shutdown_pre_sync handler
Don't attempt to service reconnections if RB_NOSYNC is set. More
crucially, don't do it if the scheduler is stopped, as the maintenance
thread will never run again.

Reviewed by:	jhb
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D42342
2023-11-23 12:07:42 -04:00
Mitchell Horne 9d61fd0849 ctl_ha: don't shutdown threads if scheduler is stopped
In this case, just return.

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D42341
2023-11-23 12:07:42 -04:00
Mitchell Horne d79a9edb5c alq, siftr: add panic/debugger checks to shutdown hooks
Don't try to gracefully terminate the pkt_manager thread if the
scheduler is not running.

We should not attempt to shutdown ald if RB_NOSYNC is set, and must not
if the scheduler is stopped (the function calls wakeup()).

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D42340
2023-11-23 12:07:42 -04:00
Mitchell Horne 41e26e8288 powerpc: better handling of shutdown flags
RB_HALT does not mean poweroff, RB_POWEROFF does.

Reviewed by:	jhibbits
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D42339
2023-11-23 12:07:42 -04:00
Mitchell Horne 428ebb7cd9 pst: improve shutdown_post_sync handler
It is desirable to shut down the raid controller even in the face of a
panic. In the SCHEDULER_STOPPED() case, set the interrupt mask bits so
that we request a polled wait, rather than sleep(), from
iop_queue_wait_msg().

Tweak the function name and signature.

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D42337
2023-11-23 12:07:42 -04:00
Mitchell Horne 4eb861d362 shutdown: audit shutdown_post_sync event callbacks
Ensure they are all panic/debugger safe.

Most handlers for this event are for disk drivers/geom modules. There
are a mix of checks being used here (or not), so let's standardize on
checking the presence of the RB_NOSYNC flag.

This flag is set whenever:
 1. The kernel has panicked and kern.sync_on_panic=0*
 2. We reboot from within the kernel debugger (the "reset" command)
 3. Userspace requested it, e.g. by 'reboot -n'

Name the functions consistently.

*This sysctl is tuned to zero by default, but its existence means that
these handlers can be executed after a panic, at the user's discretion.
IMO this use-case is implicitly understood to be risky, and we'd be
better off eliminating it altogether.

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D42337
2023-11-23 12:07:42 -04:00
Mitchell Horne 66d9c2f38d pst-raid.c: sort #includes
Reviewed by:	imp, jhb
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D42336
2023-11-23 12:07:42 -04:00
Mitchell Horne f3dc172763 geom: sort includes for some files
This is not exhaustive, just done ahead of some upcoming changes to
these files.

Don't include sys/cdefs.h explicitly. No functional change intended.

Reviewed by:	imp, jhb
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D42335
2023-11-23 12:07:42 -04:00
Mitchell Horne a4b19cf5c7 hptmv: remove vestigial EVENTHANDLER_DEREGISTER()
The registration was removed in favor of DEVICE_SHUTDOWN(). Drop the
unused eventhandler tag from the IAL_ADAPTER_T structure.

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Fixes:	cd3ef66680 ("Use DEVICE_SHUTDOWN(9) mechanism...")
Differential Revision:	https://reviews.freebsd.org/D42334
2023-11-23 12:07:42 -04:00
Rick Macklem 7fabea328f param.h: Bump __FreeBSD_version to 1500004 for commit f5f277728a
Commit f5f277728a added a new VFS function called vfs_exjail_clone(),
which will be used by the ZFS module.  Bump the version for
this change.
2023-11-23 08:01:41 -08:00
Rick Macklem f5f277728a nfsd: Fix NFS access to .zfs/snapshot snapshots
When a process attempts to access a snapshot under
/<dataset>/.zfs/snapshot, the snapshot is automounted.
However, without this patch, the automount does not
set mnt_exjail, which results in the snapshot not being
accessible over NFS.

This patch defines a new function called vfs_exjail_clone()
which sets mnt_exjail from another mount point and
then uses that function to set mnt_exjail in the snapshot
automount.  A separate patch that is currently a pull request
for OpenZFS, calls this function to fix the problem.

PR:	275200
Reviewed by:	markj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D42672
2023-11-23 07:23:33 -08:00
Gordon Bergling 637e4ef1a6 libcasper: Fix a typo in a source code comment
- s/mutiple/multiple/

MFC after:	3 days
2023-11-23 09:58:15 +01:00
Gordon Bergling 4e36d081f3 ath(4): Fix a typo in a source code comment
- s/mutiple/multiple/

MFC after:	3 days
2023-11-23 09:57:28 +01:00
Warner Losh 5d4f897f88 UPDATING: Add unset hint.acpi.0.disabled as workaround for no ACPI
Explicitly add the 'unset hint.acpi.0.disabled' command to work around
this problem.

Sponsored by:		Netflix
2023-11-22 21:12:28 -07:00
Alexander Motin 519b24f029 CAM: Replace random sbuf_printf() with cheaper cat/putc. 2023-11-22 18:04:05 -05:00
Dag-Erling Smørgrav c56f45f2a9 bitstring: Support large bit strings.
Replace int with either size_t or ssize_t (depending on context) in
order to support bit strings up to SSIZE_MAX bits in length.  Since
some of the arguments that need to change type are pointers, we must
resort to light preprocessor trickery to avoid breaking existing code.

MFC after:	3 weeks
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D42698
2023-11-22 23:30:03 +01:00
Alexander Motin 0a7139485c Replace random sbuf_printf() with cheaper cat/putc. 2023-11-22 17:27:17 -05:00
Alexander Motin 1b44079584 CAM: Use sbuf_new_for_sysctl() in more places
There is no need to allocate buffer, worry about overflows, etc.

MFC after:	2 weeks
2023-11-22 15:33:48 -05:00
Mark Johnston 33c2bd534a RELNOTES: Add an entry about bhyve's slirp backend
Sponsored by:	Innovate UK
2023-11-22 15:19:10 -05:00
Mark Johnston c5359e2af5 bhyve: Add a slirp network backend
This enables a subset of the functionality provided by QEMU's user
networking implementation.  In particular, it uses net/libslirp, the
same library as QEMU.

libslirp is permissively licensed but has some dependencies which make
it impractical to bring into the base system (glib in particular).  I
thus opted to make bhyve dlopen the libslirp.so, which can be installed
via pkg.  The library header is imported into bhyve.

The slirp backend takes a "hostfwd" which is identical to QEMU's
hostfwd.  When configured, bhyve opens a host socket and listens for
connections, which get forwarded to the guest.  For instance,
"hostfwd=tcp::1234-:22" allows one to ssh into the guest by ssh'ing to
port 1234 on the host, e.g., via 127.0.0.1.  I didn't try to hook up
guestfwd support since I don't personally have a use-case for it yet,
and I think it won't interact nicely with the capsicum sandbox.

Reviewed by:	jhb
Tested by:	rew
MFC after:	1 month
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D42510
2023-11-22 15:18:46 -05:00
Mark Johnston be74aede49 bhyve: Split backends into separate files
Currently the net_backend structure definition is private to
net_backends.c, so all of the backend definitions are there.  While
adding a new backend to use libslirp, it was noted that this file is
somewhat cluttered.  Move the netmap and netgraph backends to their own
files and clean up includes a bit.  No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	3 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D42689
2023-11-22 15:18:46 -05:00
Alexander Motin 6332e0f1a4 CAM: Remove return value from xpt_path_sbuf()
It is wrong to call sbuf_len() on third-party sbuf.  If that sbuf
has a drain function, it ends up in assertion.  But even would it
work, it would return not newly written length, but the full one.
Searching through the sources I don't see this value used.
2023-11-22 15:10:57 -05:00
Olivier Certner 7fa08d4152 kern_racct.c: Don't compile if RACCT undefined
Just skip compiling this file if RACCT isn't defined.  This allows to
skip including headers that no code uses at all, and also to remove the
whole file's #ifdef/#endif bracketing.

Reviewed by:    markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
2023-11-22 14:17:17 -05:00
Olivier Certner e0205aa325 kern_rctl.c: Minimal includes when RCTL not defined
If RCTL is not defined, only the system call stubs returning ENOSYS are
compiled in.  In this case, don't waste time including most headers
since their code is not used.

Reviewed by:    markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
2023-11-22 14:17:17 -05:00
Dimitry Andric 4c9a0adad1 compiler-rt: avoid segfaults when re-exec'ing with ASLR
After 930a7c2ac6 ("compiler-rt: re-exec with ASLR disabled when
necessary") and 96fe7c8ab0 ("compiler-rt: support ReExec() on
FreeBSD"), binaries linked against the sanitizer libraries may segfault
due to procctl(2) being intercepted. Instead, the non-intercepted
internal_procctl() should be called.

Similarly, the ReExec() function that re-executes the binary after
turning off ASLR should not call elf_aux_info(3) and realpath(3), since
these will also be intercepted. Instead, loop directly over the elf aux
info vector to find the executable path, and avoid calling realpath(3)
since it is actually unwanted for this use case.

Fixes:		930a7c2ac6, 96fe7c8ab0
MFC after:	3 days
2023-11-22 19:23:06 +01:00
John Baldwin ecf2106c07 arm64/amd64/riscv nexus: Use bus_generic_rl_*
Reviewed by:	mhorne, imp
Differential Revision:	https://reviews.freebsd.org/D42716
2023-11-22 09:06:33 -08:00
John Baldwin a19ed3495d gpiobus: Use bus_generic_rl_* methods
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D42715
2023-11-22 09:06:22 -08:00
Kristof Provost b01cad6d3a ip_mroute: handle V_mfchashtbl allocation failure
We allocate V_mfchashtbl with HASH_NOWAIT (which maps to M_NOWAIT), so
this allocation may fail. As we didn't handle that failure we could end
up dereferencing a NULL pointer later (e.g. during X_ip_mrouter_done()).

Do the obvious thing and fail out if we cannot allocate the table.

See also:	https://redmine.pfsense.org/issues/14917
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-11-22 14:47:14 +01:00
Mateusz Piotrowski 8ec79e8ae0 loader.efi.8: Fix a typo
MFC after:	3 days
Sponsored by:	Klara, Inc.
2023-11-22 13:25:34 +01:00
Warner Losh 7a1bc422d1 stand/efi: Consolidate integer types
We have no need for 5 different copies of these.

Sponsored by:		Netflix
Reviewed by:		rcm, kevans, andrew
Differential Revision:	https://reviews.freebsd.org/D42699
2023-11-21 19:58:20 -07:00
Brooks Davis 9fc0ff9d85 libc: remove some obsolete VCS data
These wide char support files were copied from the previous versions
with expanded $FreeBSD$ strings in #if 0 blocks.  Remove them and the
scssid definitions in the same #if 0 blocks.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D42688
2023-11-21 22:46:43 +00:00
Brooks Davis 1818f3fda9 ps: s/kern.max_pid/kern.pid_max/ in a comment
Sponsored by:	DARPA
2023-11-21 22:46:01 +00:00
Warner Losh e4789047ff stand/efi: Define ACPI_USE_SYSTEM_INTTYPES to be 1 instead of blank
To avoid a redefinition warning... This needs to be redone correctly,
but this gets amd64 building again...  My amd64 environment is polluted
with something that caues earlier failures which I ignored...

Fixes:		488bc7e9a7
Sponsored by:	Netflix
2023-11-21 11:38:46 -07:00
Olivier Certner 9d882de2da Remove sysctl 'kern.smp.forward_signal_enabled'
It seems this was an "emergency" knob to revert a newly introduced
behavior.  Overall, we want better system-wide signal receive latency,
and it doesn't seem that some contrary policy was ever needed (and if
that comes up, it should rather be implemented, e.g., per-process).

Suggested by:           kib
Reviewed by:            kib, jhb
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D42315
2023-11-21 13:25:34 -05:00
Olivier Certner 2f68ae6150 makesyscall: Simplify a bit emitting syscall declarations
Reviewed by:            kevans, imp
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D42168
2023-11-21 13:25:34 -05:00
Alex Xu (Hello71) 96f193b290 Compile RACK when options TCP_RACK, not TCP_BBR
Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
Fixes: 3a338c5341 ("Add the BBR and RACK stacks to the LINT kernel.")
Pull Request:	https://github.com/freebsd/freebsd-src/pull/907
2023-11-21 13:51:10 -04:00
Gleb Smirnoff f903065018 hpts: install kernel module
It is important to instantly load tcp_rack.ko and tcp_bbr.ko

Reviewed by:		tuexen, imp
Differential Revision:	https://reviews.freebsd.org/D42697
2023-11-21 09:22:46 -08:00
Gleb Smirnoff 219a6ca919 tcp: uninline tcp_account_for_send()
This allows to clear inclusion of "opt_kern_tls.h" from a system header.

Reviewed by:		rscheff, tuexen
Differential Revision:	https://reviews.freebsd.org/D42696
2023-11-21 09:21:41 -08:00
Alan Somers 04cfe6c12c aio_read.2: correct the description of aio_buf
Looks like a copypasta from aio_write.2.

[skip ci]

Reported by:	Paul Floyd <pjfloyd@wanadoo.fr>
MFC after:	1 week
Sponsored by:	Axcient
Reviewed by:	jilles (manpages)
Differential Revision: https://reviews.freebsd.org/D42621
2023-11-21 09:52:02 -07:00
Warner Losh 488bc7e9a7 stand/efi: Request ACPI use the system inttypes
With the system inttypes, we build on all platforms again.

Suggested by:	andrew
Fixes:		0b01d45783
Sponsored by:	Netflix
2023-11-21 08:59:05 -07:00
Konstantin Belousov bddc7a8a94 Tweak compat_freebsd32_bit feature name
Mark the current name 'compat_freebsd_32bit' as legacy, and add the
new name 'compat_freebsd32'.  This seems to help with some make and
shell uses.

Requested by:	jrtc27
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42641
2023-11-21 13:56:15 +02:00
Konstantin Belousov 26b36a64be sysctl kern.supported_archs: return correct value
in case COMPAT_FREEBSD32 was enabled in config but hardware does not
support executing 32bit binaries.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42641
2023-11-21 13:56:06 +02:00
Konstantin Belousov 5a2bbacea5 FEATURE compat_freebsd_32bit: only report on arm64 when support is present
depending on hardware support for aarch32.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42641
2023-11-21 13:55:59 +02:00
Konstantin Belousov 46f3a29ee1 sys/sysctl.h: FEATURE_ADD()
A macro to dynamically register report of the kernel feature.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42641
2023-11-21 13:55:52 +02:00
Andrew Turner 25d0310ed8 arm64: Mark the armv8 crc32c as supporting BTI
This is built into a test so needs the BTI elf note for the rest of the
test to be built with BTI support enabled.

As the assembly uses the ENTRY macro it already supports BTI, so mark
it as such.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42595
2023-11-21 11:25:43 +00:00