]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 months agobin: Remove ancient SCCS tags.
Warner Losh [Thu, 23 Nov 2023 17:21:37 +0000 (10:21 -0700)]
bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix

7 months agomisc: Remove ancient SCCS tags.
Warner Losh [Thu, 23 Nov 2023 17:21:37 +0000 (10:21 -0700)]
misc: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

This is for the misfits that have only a few: COPYRIGHT, gnu, tools,
rescue, and etc.

Sponsored by: Netflix

7 months agodirdeps: Update/fix Makefile.depend* for toolchain
Ka Ho Ng [Sun, 26 Nov 2023 09:16:06 +0000 (04:16 -0500)]
dirdeps: Update/fix Makefile.depend* for toolchain

This fixes make pseudo/toolchain.

7 months agodirdeps: Remove $FreeBSD$
Ka Ho Ng [Sun, 26 Nov 2023 20:46:36 +0000 (15:46 -0500)]
dirdeps: Remove $FreeBSD$

There was a $FreeBSD$ line in lib/liblua/Makefile.depend.

MFC after: 3 days

7 months agoiostat.8: Better wording for some use cases
Gordon Bergling [Sun, 26 Nov 2023 18:30:58 +0000 (19:30 +0100)]
iostat.8: Better wording for some use cases

The iostat(8) manual page should be more specific when using
options. Also extented the BUGS section.

PR: 153012
Reviewed by: bcr
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42633

7 months agolockf: switch to strtonum() for parsing timeout
Kyle Evans [Sun, 26 Nov 2023 04:27:11 +0000 (22:27 -0600)]
lockf: switch to strtonum() for parsing timeout

Convert waitsec to a long long to be able to hold the full domain of
alarm(3) timeout on all platforms, and let strtonum(3) handle the input
validation.  strtonum(3) also happens to provide a neater interface for
error handling, and it already includes our pre-existing empty input
check.

Sponsored by: Klara, Inc.

7 months agolockf: allow locking file descriptors
Kyle Evans [Wed, 22 Nov 2023 07:46:14 +0000 (01:46 -0600)]
lockf: allow locking file descriptors

This is most useful inside a shell script, allowing one to lock just
portions of a script rather than having to wrap the entire script in a
lock.

PR: 262738
Reviewed by: 0mp, allanjude (both previous versions)
Co-authored-by: Daniel O'Connor <darius@dons.net.au>
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D42718

7 months agolockf: add some tests
Kyle Evans [Wed, 22 Nov 2023 05:09:11 +0000 (23:09 -0600)]
lockf: add some tests

Provide basic coverage for the existing options, nothing deeper (e.g.,
pipe closing behavior) is tested in this set.

Reviewed by: allanjude
Feedback from: des
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D42714

7 months agolockf: don't hold stdin/stdout/stderr open
Alexander Melkov [Wed, 22 Nov 2023 04:46:28 +0000 (22:46 -0600)]
lockf: don't hold stdin/stdout/stderr open

None of these are essential in the lockf monitor (parent post-fork), so
close them to maintain the illusion that lockf hasn't been inserted into
the pipeline.  This ensures that the correct effects happen on other
programs in the pipeline if the locked command closes or redirects these
elsewhere.

The original patch used -s to close stdout/stderr rather than closing
them unconditionally, but it's not clear that we really care that much.
kevans dropped that part when taking the patch, patch is otherwise by
listed author.

PR: 112379
Reviewed by: 0mp, allanjude (both earlier version), kevans
Feedback from: des
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D42713

7 months agolockf: correct omission in the usage statement
Kyle Evans [Wed, 22 Nov 2023 04:45:42 +0000 (22:45 -0600)]
lockf: correct omission in the usage statement

The -w flag was added without being noted in the usage statement; fix
that now.

While we're here, re-sort the getopt() string.

Reviewed by: 0mp, allanjude, des
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D42712

7 months agolockf: hide unavailable error with -n -s
Kyle Evans [Wed, 22 Nov 2023 04:41:36 +0000 (22:41 -0600)]
lockf: hide unavailable error with -n -s

The error message is expected, allow -s to suppress just that one since
it would loosely fall under the definition of "failure to acquire the
lock" described in the manpage for the -s option.

Reviewed by: 0mp, allanjude
Feedback from: des
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D42711

7 months agoUpdate leap-seconds to leap-seconds.3676924800
Xin LI [Sun, 26 Nov 2023 01:13:23 +0000 (17:13 -0800)]
Update leap-seconds to leap-seconds.3676924800

Obtained from:  ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.3676924800
MFC after: 3 days

7 months agoMFV: xz 5.4.5
Xin LI [Sun, 26 Nov 2023 00:55:52 +0000 (16:55 -0800)]
MFV: xz 5.4.5

MFC after: 2 weeks

7 months agoVendor import of xz 5.4.5 (trimmed)
Xin LI [Sun, 26 Nov 2023 00:53:12 +0000 (16:53 -0800)]
Vendor import of xz 5.4.5 (trimmed)

7 months agoDo not install kernel and modules with executable access bit set
Konstantin Belousov [Sat, 25 Nov 2023 13:30:06 +0000 (15:30 +0200)]
Do not install kernel and modules with executable access bit set

They are not executables and cannot be activated by kernel.

Reviewed by: emaste, imp
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D42768

7 months agoSet installed kernel and driver files access modes using KMODMODE var
Konstantin Belousov [Sat, 25 Nov 2023 13:28:34 +0000 (15:28 +0200)]
Set installed kernel and driver files access modes using KMODMODE var

Reviewed by: emaste, imp
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D42768

7 months agonew-bus: Disable assertions for rman mismatches for activate/deactivate
John Baldwin [Sat, 25 Nov 2023 18:32:19 +0000 (10:32 -0800)]
new-bus: Disable assertions for rman mismatches for activate/deactivate

Bus drivers which use an rman to sub-divide a resource allocated from
a parent bus should handle mapping requests (and activate/deactivate
requests) for those sub-allocated resources by doing a subset mapping
of the resource allocated from the parent (and then using this to
handle activate/deactivate requests).

However, not all bus drivers which use internal rmans (such as acpi(4)
and pci_pci(4)) do that since not all nexus drivers support
bus_map/unmap.  Eventually bus drivers should be updated to do this
properly at which point these assertions can be reenabled.

Reported by: delphij, kib

7 months agostress2: Do not make assumptions about the value of UFS_LINK_MAX
Peter Holm [Sat, 25 Nov 2023 09:36:00 +0000 (10:36 +0100)]
stress2: Do not make assumptions about the value of UFS_LINK_MAX

7 months agoetcupdate: temporarily comment out one tzsetup test
Ed Maste [Fri, 24 Nov 2023 22:28:31 +0000 (17:28 -0500)]
etcupdate: temporarily comment out one tzsetup test

This test fails after tzsetup was changed to symlink rather than copy
the zoneinfo file (5e16809c953f).

7 months agoaarch64 nexus: Fix a mismerge in nexus_activate_resource
John Baldwin [Fri, 24 Nov 2023 22:00:33 +0000 (14:00 -0800)]
aarch64 nexus: Fix a mismerge in nexus_activate_resource

Fixes: 658501d25930 aarch64 nexus: Use bus_generic_rman_*_resource

7 months agorc.d/ldconfig: Remove stray ;;
Cy Schubert [Fri, 24 Nov 2023 20:11:45 +0000 (12:11 -0800)]
rc.d/ldconfig: Remove stray ;;

Stray ";;" causes the ldconfig rc script to fail at boot. Remove it.

Fixes: 73902ed85ab7

7 months agonew-bus: Add comments for resource_*_map_request*
John Baldwin [Fri, 24 Nov 2023 18:33:57 +0000 (10:33 -0800)]
new-bus: Add comments for resource_*_map_request*

Requested by: mhorne

7 months agonew-bus: Add a comment for bus_generic_get_domain
John Baldwin [Fri, 24 Nov 2023 18:33:57 +0000 (10:33 -0800)]
new-bus: Add a comment for bus_generic_get_domain

7 months agostand: Retire setting hw.ata.wc: it doesn't exist.
Warner Losh [Fri, 24 Nov 2023 18:28:44 +0000 (11:28 -0700)]
stand: Retire setting hw.ata.wc: it doesn't exist.

hw.ata.wc was disconnected as part ot the 2013 cam-ification of ata. No
need to continue setting it. It's been unused in FreeBSD 10.x and newer.

Sponsored by: Netflix

7 months agoata: Retire unused variable / externs
Warner Losh [Fri, 24 Nov 2023 18:27:38 +0000 (11:27 -0700)]
ata: Retire unused variable / externs

When looking for something else, I noticed these are no longer used
anywhere.

Sponsored by: Netflix

7 months agostand: Retire setting hw.eisa_slots.
Warner Losh [Fri, 24 Nov 2023 17:58:44 +0000 (10:58 -0700)]
stand: Retire setting hw.eisa_slots.

When the eisa code was removed in 2017, prior to the stable/12 branch,
setting hw.eisa_slots became a nop. The oldest supported branch doesn't
have eisa at all. The need to set it manually on boot disappeared
largely by 2000...

Sponsored by: Netflix

7 months agovt(4): Always call vt_window_switch() in vtterm_cnungrab()
Jean-Sébastien Pédron [Fri, 24 Nov 2023 17:30:35 +0000 (18:30 +0100)]
vt(4): Always call vt_window_switch() in vtterm_cnungrab()

[Why]
This ensures that vtterm_cnungrab() is the mirror of vtterm_cngrab().
And the latter always call vt_window_switch() and thus the backend's
vd_postswitch().

This makes sure that whatever the backend did during vtterm_cngrab(), it
can undo it during vtterm_cnungrab().

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D42752

7 months agovt(4): Call vd_postswitch callback regardless of the current window
Jean-Sébastien Pédron [Fri, 24 Nov 2023 17:30:34 +0000 (18:30 +0100)]
vt(4): Call vd_postswitch callback regardless of the current window

[Why]
We want the same behavior at the backend level, regardless if we need to
switch the current window or not.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D42751

7 months agovt(4): New bitblt_text variant making a copy before unlocking vt_buf
Jean-Sébastien Pédron [Fri, 24 Nov 2023 17:30:34 +0000 (18:30 +0100)]
vt(4): New bitblt_text variant making a copy before unlocking vt_buf

[Why]
In the DRM drivers and the integration with vt(4), we need to execute
DRM code outside of the vtbuf_lock. The reason is that this DRM code
acquires locks which can't be acquired when vtbuf_lock, an MTX_SPIN
mutex, is already held.

[How]
A vt(4) backend can now set the `vd_bitblt_after_vtbuf_unlock` flag to
true if it wants to be called outside of vt_buf_lock.

In this case, vt(4) uses an internal version of bitblt_text that uses
the `vd_drawn` arrays, plus a new `vd_pos_to_flush` array, to track
characters to draw/refresh. This internal version then uses the
backend's bitblt_bmp callback to draw the characters after vt_buf has
been unlocked.

Drawing borders and CPU logos is also deferred after the vt_buf lock is
released for the same reason.

We introduce another lock (a default mutex), only used when the
`vd_bitblt_after_vtbuf_unlock` flag is set, to replace part the role of
the vt_buf lock and manage concurrent calls to vt_flush().

The `SC_NO_CONSDRAWN` define is dropped because we now always need the
`vd_drawn` arrays.

Reviewed by: manu
Approved by: manu
Differential Revision:  https://reviews.freebsd.org/D42057

7 months agovt(4): Skip vt_window_switch() for nested panics
Jean-Sébastien Pédron [Fri, 24 Nov 2023 17:30:33 +0000 (18:30 +0100)]
vt(4): Skip vt_window_switch() for nested panics

[Why]
The same protection was added to vt_flush() in the previous commit. We
want the same one in vt_window_switch(): if e.g. the DRM driver panics
while handling a call to vt_window_switch(), we don't want to
recursively call vt_window_switch() again and trigger another panic.

Reviewed by: imp, manu
Approved by: imp, manu
Differential Revision: https://reviews.freebsd.org/D42750

7 months agovt(4): Skip vt_flush() for nested panics
Jean-Sébastien Pédron [Fri, 24 Nov 2023 17:30:33 +0000 (18:30 +0100)]
vt(4): Skip vt_flush() for nested panics

[Why]
If there is a problem with DRM drivers or in their integration with
vt(4) and displaying something on the console triggers a panic, there is
a high chance that displaying that panic will trigger another one,
recursively.

[How]
If vt_flush() is called and it detects is is called resursively from
another panic, it return immediately, doing nothing, to avoid the risk
of triggering another panic.

Reviewed by: manu
Approved by: manu
Differential Revision:  https://reviews.freebsd.org/D42056

7 months agolinuxkpi: `GFP_KERNEL` equals `M_NOWAIT` now
Jean-Sébastien Pédron [Fri, 24 Nov 2023 17:30:33 +0000 (18:30 +0100)]
linuxkpi: `GFP_KERNEL` equals `M_NOWAIT` now

... instead of `M_WAITOK`.

[Why]
The reason is that in some places in the DRM drivers (in particular, the
framebuffer management code), kmalloc() is called from a non-sleepable
context, such as after a call to mtx_lock(8) with an MTX_DEF mutex.

If `GFP_KERNEL` is defined as `M_WAITOK`, we hit an assertion from
witness(4).

[How]
The definition of `GFP_KERNEL` is changed to `M_NOWAIT`. This means that
callers should verify the return value of kmalloc(). Fortunately, this
is always the case in Linux.

Reviewed by: bz, emaste, manu
Approved by: manu
Differential Revision:  https://reviews.freebsd.org/D42054

7 months agoriscv nexus: Sort bus_set_resource in DEVMETHOD table
John Baldwin [Wed, 11 Sep 2019 07:39:37 +0000 (00:39 -0700)]
riscv nexus: Sort bus_set_resource in DEVMETHOD table

7 months agoriscv nexus: Use bus_generic_rman_*_resource
John Baldwin [Fri, 24 Nov 2023 17:28:28 +0000 (09:28 -0800)]
riscv nexus: Use bus_generic_rman_*_resource

Custom activate/deactivate_resource methods are still needed to handle
IRQ resources.

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

7 months agoaarch64 nexus: Use bus_generic_rman_*_resource
John Baldwin [Fri, 24 Nov 2023 17:28:19 +0000 (09:28 -0800)]
aarch64 nexus: Use bus_generic_rman_*_resource

Custom activate/deactivate_resource methods are still needed to handle
IRQ resources.

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

7 months agox86 nexus: Use bus_generic_rman_*_resource
John Baldwin [Fri, 24 Nov 2023 17:28:10 +0000 (09:28 -0800)]
x86 nexus: Use bus_generic_rman_*_resource

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

7 months agonewbus: Add a set of bus resource helpers for nexus-like devices
John Baldwin [Fri, 24 Nov 2023 17:28:00 +0000 (09:28 -0800)]
newbus: Add a set of bus resource helpers for nexus-like devices

These routines can be used to implement
bus_alloc/adjust/activate/deactive/release_resource on bus drivers
which suballocate resources from rman(9) resource managers.

These methods require a new bus_get_rman method in the bus driver to
return the suitable rman for a given resource type.  The
activate/deactivate helpers also require the bus to implement the
bus_map/ummap_resource methods.

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

7 months agoldconfig: only configure compat32 when kernel supports it
Konstantin Belousov [Sat, 18 Nov 2023 13:09:30 +0000 (15:09 +0200)]
ldconfig: only configure compat32 when kernel supports it

and eliminate hard-coded arch list.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D42669

7 months agokqueue: on process exit, force-clear its registered signal events
Konstantin Belousov [Fri, 24 Nov 2023 06:41:58 +0000 (08:41 +0200)]
kqueue: on process exit, force-clear its registered signal events

Normally, process already has all its kqueue fds destroyed at the moment
p_klist is detached in exit flow. But, if the process was created with
rfork(2) with shared file descriptors, its signal knotes can survive.
Then, knlist_detach() does not destroy non-empty knlist. Later, when
owning kqueue is closed, we access freed (or rather, reused, because
struct proc is type-stable) memory by referencing p->p_klist from such
knote.

Handle this situation by deleting all knotes hanging from p_klist.

PR: 275286
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D42745

7 months agosys/mutex.h: Reorder includes
Emmanuel Vadot [Fri, 24 Nov 2023 10:30:09 +0000 (11:30 +0100)]
sys/mutex.h: Reorder includes

Fixes: 2a35f3cdf63d ("sys/mutex.h: Include sys/lock.h instead of sys/_lock.h")

7 months agosys/mutex.h: Include sys/lock.h instead of sys/_lock.h
Emmanuel Vadot [Thu, 27 Oct 2022 09:43:19 +0000 (11:43 +0200)]
sys/mutex.h: Include sys/lock.h instead of sys/_lock.h

It uses the LA_ defines when INVARIANTS is set.
This unbreak dpaa2 with FDT only kernel (like ALLWINNER or ROCKCHIP) as
the driver only include sys/lock.h via header polution for ACPI kernels.

Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D37145
Reviewed by: kib, mjg

7 months agodevd: autofs: Move autofs related events to a separate file
Emmanuel Vadot [Tue, 7 Nov 2023 10:06:15 +0000 (11:06 +0100)]
devd: autofs: Move autofs related events to a separate file

If a user don't have FreeBSD-autofs installed there is no need to try calling
automount on every GEOM event.
It's also easier to add/delete autofs related event in a separate file.

Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D42495
Reviewed by: imp

7 months agoautofs: Remove stale comment
Emmanuel Vadot [Tue, 7 Nov 2023 09:45:49 +0000 (10:45 +0100)]
autofs: Remove stale comment

devd action for automount -c was never commented.

Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D42493
Reviewed by: rew

7 months agoautofs: media: Don't include nosuid in the script
Emmanuel Vadot [Tue, 7 Nov 2023 09:42:53 +0000 (10:42 +0100)]
autofs: media: Don't include nosuid in the script

We already have nosuid option in auto_master so no need to redefine it.
Also it's easier for a user to modify the auto_master configuration file
than the script (which shouldn't be modified).

Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D42492
Reviewed by: rew

7 months agotzsetup: symlink /etc/localtime instead of copying
Ed Maste [Fri, 14 Oct 2022 16:44:35 +0000 (12:44 -0400)]
tzsetup: symlink /etc/localtime instead of copying

Using a symlink means that new timezone data (installed by an errata
update, say) will be usable without having to be copied again.

Reviewed by: bapt, kevans, philip
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37005

7 months agopst: improve shutdown_post_sync handler
Mitchell Horne [Thu, 23 Nov 2023 15:59:05 +0000 (11:59 -0400)]
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

7 months agoetc/mtree: Remove entry for /usr/tests/usr.sbin/mixer
John Baldwin [Thu, 23 Nov 2023 20:17:41 +0000 (12:17 -0800)]
etc/mtree: Remove entry for /usr/tests/usr.sbin/mixer

These were removed when the new mixer(3) library was imported, and I
missed updating the mtree file when I added the entries to
ObsoleteFiles.inc.

Fixes: 903873ce1560 Implement and use new mixer(3) library for FreeBSD.

7 months agore(4): Add support for 8168FP HW rev
Brad Smith [Thu, 23 Nov 2023 20:13:00 +0000 (12:13 -0800)]
re(4): Add support for 8168FP HW rev

MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42671

7 months agoRevert "pst: improve shutdown_post_sync handler"
Mitchell Horne [Thu, 23 Nov 2023 19:46:28 +0000 (15:46 -0400)]
Revert "pst: improve shutdown_post_sync handler"

I did not realize this driver was i386-only, and the change fails to
compile. Revert so that I can fix it properly.

This reverts commit 428ebb7cd9f51afb6809bf81cf21a05e0fd93ff4.

Pointy hat to: mhorne

7 months agoehci_ps3: Remove unused struct definition.
John Baldwin [Mon, 30 Sep 2019 16:18:10 +0000 (16:18 +0000)]
ehci_ps3: Remove unused struct definition.

7 months agoarm64/riscv nexus: Implement bus_unmap_resource
John Baldwin [Thu, 23 Nov 2023 17:06:51 +0000 (09:06 -0800)]
arm64/riscv nexus: Implement bus_unmap_resource

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

7 months agonexus: Use resource_validate_map_request
John Baldwin [Thu, 23 Nov 2023 17:06:37 +0000 (09:06 -0800)]
nexus: Use resource_validate_map_request

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

7 months agonew-bus: Add resource_validate_map_request function
John Baldwin [Thu, 23 Nov 2023 17:06:24 +0000 (09:06 -0800)]
new-bus: Add resource_validate_map_request function

This helper function for BUS_MAP_RESOURCE performs common argument
validation.

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

7 months agoUse xpt_path_sbuf() in few drivers
Alexander Motin [Thu, 23 Nov 2023 16:25:45 +0000 (11:25 -0500)]
Use xpt_path_sbuf() in few drivers

xpt_path_string() is now a wrapper around xpt_path_sbuf().  Using it
to than concatenate result to another sbuf makes no sense.  Just call
xpt_path_sbuf() directly.

MFC after: 1 month

7 months agoarm64: lop off another 24MB of KVA for early device mappings
Kyle Evans [Thu, 23 Nov 2023 16:21:33 +0000 (10:21 -0600)]
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

7 months agokern_reboot(9): belatedly bump .Dd
Mitchell Horne [Thu, 23 Nov 2023 16:10:42 +0000 (12:10 -0400)]
kern_reboot(9): belatedly bump .Dd

Fixes: 4e78a766f607 ("kern_reboot(): don't clear kdb_active")
Sponsored by: The FreeBSD Foundation

7 months agokern_reboot(): don't clear kdb_active
Mitchell Horne [Thu, 23 Nov 2023 15:28:26 +0000 (11:28 -0400)]
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

7 months agoshutdown: tweak kproc/kthread shutdown check
Mitchell Horne [Thu, 23 Nov 2023 15:27:57 +0000 (11:27 -0400)]
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

7 months agoxen: improve shutdown hook
Mitchell Horne [Thu, 23 Nov 2023 15:27:20 +0000 (11:27 -0400)]
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

7 months agoiscsi: adjust shutdown_pre_sync handler
Mitchell Horne [Thu, 23 Nov 2023 15:26:12 +0000 (11:26 -0400)]
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

7 months agoctl_ha: don't shutdown threads if scheduler is stopped
Mitchell Horne [Thu, 23 Nov 2023 15:25:54 +0000 (11:25 -0400)]
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

7 months agoalq, siftr: add panic/debugger checks to shutdown hooks
Mitchell Horne [Thu, 23 Nov 2023 15:25:30 +0000 (11:25 -0400)]
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

7 months agopowerpc: better handling of shutdown flags
Mitchell Horne [Thu, 23 Nov 2023 15:25:05 +0000 (11:25 -0400)]
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

7 months agopst: improve shutdown_post_sync handler
Mitchell Horne [Thu, 23 Nov 2023 15:59:05 +0000 (11:59 -0400)]
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

7 months agoshutdown: audit shutdown_post_sync event callbacks
Mitchell Horne [Thu, 23 Nov 2023 15:58:27 +0000 (11:58 -0400)]
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

7 months agopst-raid.c: sort #includes
Mitchell Horne [Thu, 23 Nov 2023 15:23:42 +0000 (11:23 -0400)]
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

7 months agogeom: sort includes for some files
Mitchell Horne [Thu, 23 Nov 2023 15:23:07 +0000 (11:23 -0400)]
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

7 months agohptmv: remove vestigial EVENTHANDLER_DEREGISTER()
Mitchell Horne [Thu, 23 Nov 2023 15:22:33 +0000 (11:22 -0400)]
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: cd3ef66680a8 ("Use DEVICE_SHUTDOWN(9) mechanism...")
Differential Revision: https://reviews.freebsd.org/D42334

7 months agoparam.h: Bump __FreeBSD_version to 1500004 for commit f5f277728ade
Rick Macklem [Thu, 23 Nov 2023 16:01:41 +0000 (08:01 -0800)]
param.h: Bump __FreeBSD_version to 1500004 for commit f5f277728ade

Commit f5f277728ade added a new VFS function called vfs_exjail_clone(),
which will be used by the ZFS module.  Bump the version for
this change.

7 months agonfsd: Fix NFS access to .zfs/snapshot snapshots
Rick Macklem [Thu, 23 Nov 2023 15:23:33 +0000 (07:23 -0800)]
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

7 months agolibcasper: Fix a typo in a source code comment
Gordon Bergling [Thu, 23 Nov 2023 08:58:15 +0000 (09:58 +0100)]
libcasper: Fix a typo in a source code comment

- s/mutiple/multiple/

MFC after: 3 days

7 months agoath(4): Fix a typo in a source code comment
Gordon Bergling [Thu, 23 Nov 2023 08:57:28 +0000 (09:57 +0100)]
ath(4): Fix a typo in a source code comment

- s/mutiple/multiple/

MFC after: 3 days

7 months agoUPDATING: Add unset hint.acpi.0.disabled as workaround for no ACPI
Warner Losh [Thu, 23 Nov 2023 04:12:28 +0000 (21:12 -0700)]
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

7 months agoCAM: Replace random sbuf_printf() with cheaper cat/putc.
Alexander Motin [Wed, 22 Nov 2023 23:04:05 +0000 (18:04 -0500)]
CAM: Replace random sbuf_printf() with cheaper cat/putc.

7 months agobitstring: Support large bit strings.
Dag-Erling Smørgrav [Wed, 22 Nov 2023 22:30:03 +0000 (23:30 +0100)]
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

7 months agoReplace random sbuf_printf() with cheaper cat/putc.
Alexander Motin [Wed, 22 Nov 2023 22:27:17 +0000 (17:27 -0500)]
Replace random sbuf_printf() with cheaper cat/putc.

7 months agoCAM: Use sbuf_new_for_sysctl() in more places
Alexander Motin [Wed, 22 Nov 2023 20:32:16 +0000 (15:32 -0500)]
CAM: Use sbuf_new_for_sysctl() in more places

There is no need to allocate buffer, worry about overflows, etc.

MFC after: 2 weeks

7 months agoRELNOTES: Add an entry about bhyve's slirp backend
Mark Johnston [Wed, 22 Nov 2023 19:14:53 +0000 (14:14 -0500)]
RELNOTES: Add an entry about bhyve's slirp backend

Sponsored by: Innovate UK

7 months agobhyve: Add a slirp network backend
Mark Johnston [Wed, 22 Nov 2023 19:11:03 +0000 (14:11 -0500)]
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

7 months agobhyve: Split backends into separate files
Mark Johnston [Wed, 22 Nov 2023 19:10:27 +0000 (14:10 -0500)]
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

7 months agoCAM: Remove return value from xpt_path_sbuf()
Alexander Motin [Wed, 22 Nov 2023 20:10:57 +0000 (15:10 -0500)]
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.

7 months agokern_racct.c: Don't compile if RACCT undefined
Olivier Certner [Tue, 21 Nov 2023 17:33:08 +0000 (18:33 +0100)]
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

7 months agokern_rctl.c: Minimal includes when RCTL not defined
Olivier Certner [Thu, 19 Oct 2023 14:28:06 +0000 (16:28 +0200)]
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

7 months agocompiler-rt: avoid segfaults when re-exec'ing with ASLR
Dimitry Andric [Wed, 22 Nov 2023 18:23:06 +0000 (19:23 +0100)]
compiler-rt: avoid segfaults when re-exec'ing with ASLR

After 930a7c2ac67e ("compiler-rt: re-exec with ASLR disabled when
necessary") and 96fe7c8ab0f6 ("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: 930a7c2ac67e96fe7c8ab0f6
MFC after: 3 days

7 months agoarm64/amd64/riscv nexus: Use bus_generic_rl_*
John Baldwin [Wed, 22 Nov 2023 17:06:33 +0000 (09:06 -0800)]
arm64/amd64/riscv nexus: Use bus_generic_rl_*

Reviewed by: mhorne, imp
Differential Revision: https://reviews.freebsd.org/D42716

7 months agogpiobus: Use bus_generic_rl_* methods
John Baldwin [Wed, 22 Nov 2023 17:06:22 +0000 (09:06 -0800)]
gpiobus: Use bus_generic_rl_* methods

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

7 months agoip_mroute: handle V_mfchashtbl allocation failure
Kristof Provost [Wed, 22 Nov 2023 13:44:03 +0000 (14:44 +0100)]
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")

7 months agoloader.efi.8: Fix a typo
Mateusz Piotrowski [Wed, 22 Nov 2023 12:24:41 +0000 (13:24 +0100)]
loader.efi.8: Fix a typo

MFC after: 3 days
Sponsored by: Klara, Inc.

7 months agostand/efi: Consolidate integer types
Warner Losh [Wed, 22 Nov 2023 02:58:20 +0000 (19:58 -0700)]
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

7 months agolibc: remove some obsolete VCS data
Brooks Davis [Tue, 21 Nov 2023 22:46:43 +0000 (22:46 +0000)]
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

7 months agops: s/kern.max_pid/kern.pid_max/ in a comment
Brooks Davis [Tue, 21 Nov 2023 22:43:14 +0000 (22:43 +0000)]
ps: s/kern.max_pid/kern.pid_max/ in a comment

Sponsored by: DARPA

7 months agostand/efi: Define ACPI_USE_SYSTEM_INTTYPES to be 1 instead of blank
Warner Losh [Tue, 21 Nov 2023 18:36:18 +0000 (11:36 -0700)]
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: 488bc7e9a777
Sponsored by: Netflix

7 months agoRemove sysctl 'kern.smp.forward_signal_enabled'
Olivier Certner [Fri, 20 Oct 2023 13:43:29 +0000 (15:43 +0200)]
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

7 months agomakesyscall: Simplify a bit emitting syscall declarations
Olivier Certner [Thu, 12 Oct 2023 13:47:03 +0000 (15:47 +0200)]
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

7 months agoCompile RACK when options TCP_RACK, not TCP_BBR
Alex Xu (Hello71) [Tue, 21 Nov 2023 00:09:56 +0000 (19:09 -0500)]
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

7 months agohpts: install kernel module
Gleb Smirnoff [Tue, 21 Nov 2023 17:22:46 +0000 (09:22 -0800)]
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

7 months agotcp: uninline tcp_account_for_send()
Gleb Smirnoff [Tue, 21 Nov 2023 17:21:41 +0000 (09:21 -0800)]
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

7 months agoaio_read.2: correct the description of aio_buf
Alan Somers [Wed, 15 Nov 2023 17:31:24 +0000 (10:31 -0700)]
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

7 months agostand/efi: Request ACPI use the system inttypes
Warner Losh [Tue, 21 Nov 2023 15:56:35 +0000 (08:56 -0700)]
stand/efi: Request ACPI use the system inttypes

With the system inttypes, we build on all platforms again.

Suggested by: andrew
Fixes: 0b01d45783c3
Sponsored by: Netflix

7 months agoTweak compat_freebsd32_bit feature name
Konstantin Belousov [Sat, 18 Nov 2023 22:40:58 +0000 (00:40 +0200)]
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