Commit Graph

278720 Commits

Author SHA1 Message Date
Mark Johnston
2e5699fb9c RELNOTES: Add an entry for dtrace_kinst(4) 2022-10-11 18:19:55 -04:00
Christos Margiolis
6f6d1fc7c8 kinst: Add a manual page
MFC after:	3 months
Sponsored by:	Google, Inc. (GSoC 2022)
Differential Revision:	https://reviews.freebsd.org/D36853
2022-10-11 18:19:08 -04:00
Christos Margiolis
2179a159ea libdtrace: Add kinst support
kinst does not instantiate its probes automatically, it only does so on
demand via an ioctl interface implemented by /dev/kinst.  This change
modifies libdtrace to perform that work when the script references the
kinst provider, similar to the way pid provider probes are implemented.

Reviewed by:	markj
MFC after:	3 months
Sponsored by:	Google, Inc. (GSoC 2022)
Differential Revision:	https://reviews.freebsd.org/D36852
2022-10-11 18:19:08 -04:00
Christos Margiolis
f0bc4ed144 kinst: Initial revision
This is a new DTrace provider which allows arbitrary kernel instructions
to be traced.  Currently it is implemented only for amd64.

kinst probes are created on demand by libdtrace, and there is a probe
for each kernel instruction.  Probes are named
kinst:<module>:<function>:<offset>, where "offset" is the offset of the
target instruction relative to the beginning of the function.  Omitting
"offset" causes all instructions in the function to be traced.

kinst works similarly to FBT in that it places a breakpoint on the
target instruction and hooks into the kernel breakpoint handler.
Because kinst has to be able to trace arbitrary instructions, it does
not emulate most of them in software but rather causes the traced thread
to execute a copy of the instruction before returning to the original
code.

The provider is quite low-level and as-is will be useful mostly only to
kernel developers.  However, it provides a great deal of visibility into
kernel code execution and could be used as a building block for
higher-level tooling which can in some sense translate between C sources
and generated machine code.  In particular, the "regs" variable recently
added to D allows the CPU's register file to be accessed from kinst
probes.

kinst is experimental and should not be used on production systems for
now.

In collaboration with:	markj
Sponsored by:		Google, Inc. (GSoC 2022)
MFC after:		3 months
Differential Revision:	https://reviews.freebsd.org/D36851
2022-10-11 18:19:08 -04:00
Mark Johnston
301a27dc65 atomic: Style
Fixes:		30253da1a9 ("atomic: Add some type checking to plain atomic_load/store helpers")
MFC after:	1 week
2022-10-11 18:19:08 -04:00
Michael Tuexen
76e6e4d72f listen(): improve POSIX compliance
Ensure that a negative backlog argument is handled as it if was 0.

Reviewed by:		markj@, glebius@
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D31821
2022-10-11 22:46:51 +02:00
Mitchell Horne
d88131e1e5 ofw_graph(9): hook it up to the Makefile
Otherwise, the man page is not installed. Add appropriate MLINKS.

Reviewed by:	manu
MFC after:	3 days
Fixes:	9a4eed0be2 ("ofw_graph: Add functions for graph bindings")
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36932
2022-10-11 16:28:56 -03:00
Warner Losh
1be88beabb release: link from /boot/msdos to efi
We need to do a relative link to efi instead of an absolute link into
the build tree.

Sponsored by:		Netflix
Reviewed by:		gjb
Differential Revision:	https://reviews.freebsd.org/D36941
2022-10-11 13:19:52 -06:00
Warner Losh
aa62d30d46 sys/_pv_entry.h: Include sys/param.h
sys/param.h is required for this file because it uses howmany() which is
defined there. For the kernel, this works today because of namespace
polllution. However, user land programs, like qemu, can include
machine/pmap.h without having included sys/param.h (since it wasn't
required before).

Sponsored by:		Netflix
Reviewed by:		tsoome, jhb
Differential Revision:	https://reviews.freebsd.org/D36927
2022-10-11 12:51:55 -06:00
Warner Losh
4982884b99 nvme: Always set deadline to max
When a transaction is on the outstanding list, it needs to have a valid
timeout value, so set it to infinity before placing it on the
list. Place before we put it on the list, even though the list is
protected by the qpair lock.

Sponsored by:		Netflix
Reviewed by:		mav
Differential Revision:	https://reviews.freebsd.org/D36920
2022-10-11 12:51:32 -06:00
Ed Maste
f4f6bc6367 Correct typo in soacceptqueue setting
I somehow introduced the typo when extracting one part of D34598.

Reported by:	Jose Luis Duran <jlduran@gmail.com>
Fixes:		9871ae6aa9 ("Track kern.ipc.somaxconn -> ...")
2022-10-11 13:03:04 -04:00
Ed Maste
a1e39f96d2 nanobsd: remove unmodified copies of ssh config files
Nanobsd included copies of ssh_config and sshd_config.  The former is
identical to the one provided by the base system, and the latter is
identical except for PermitRootLogin, which is updated by nanobsd's
cust_allow_ssh_root anyhow.  Remove nanobsd's copies and use the
existing base system ones.

Reported by:	Jose Luis Duran <jlduran@gmail.com> in D34937
Reviewed by:	Jose Luis Duran <jlduran@gmail.com>, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36933
2022-10-11 12:53:57 -04:00
Jose Luis Duran
9871ae6aa9 Track kern.ipc.somaxconn -> kern.ipc.soacceptqueue rename
Fixes:		2bdf61ca29 ("Hide the unfortunate named sysctl...")
MFC after:	3 days
2022-10-11 12:46:46 -04:00
Mitchell Horne
9b4cbaa9c3 riscv: handle misaligned address exceptions
If this exception is coming from userspace, send the appropriate SIGBUS
to the process. If it's coming from the kernel this is still fatal, but
we can give a better panic message.

Typical misaligned loads/stores are emulated by the SBI firmware, and
require no intervention from our kernel. The notable exception here is
misaligned access with atomic instructions. These can generate the
exception and panic seen in the PR.

With this, we now handle all defined exception types.

PR:		266109
MFC after:	1 week
Found by:	syzkaller
Reported by:	P1umer <p1umer1337@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D36876
2022-10-11 10:39:50 -03:00
Ed Maste
6e6c45e66f nanobsd: update copies of SSH config files
Sponsored by:	The FreeBSD Foundation
2022-10-11 09:25:39 -04:00
Andrew Turner
82860bcb64 Add more Arm CPUs to the arm64 cpu ident
These are based on CPUs found in https://github.com/ARM-software/data

Sponsored by:	The FreeBSD Foundation
2022-10-11 14:01:16 +01:00
Andrew Turner
12c1c65d8a Mark 64-bit arm64 hypervisor registers with UL
These are 64-bit. Mark them as unsigned long so we don't rely on
undefined behaviour or shift a 32-bit value more than 32 bits.

Sponsored by:	Innovate UK
Sponsored by:	The FreeBSD Foundation
2022-10-11 14:01:16 +01:00
Tom Jones
eee0f7aea4 acpi: Put CPPC workaround behind i386/amd64 if def
While CPPC is available on arm64 platforms with ACPI we don't know if we
need to work around issues with firmware there.
2022-10-11 09:31:22 +01:00
Peter Holm
bab2efd47b stress2: Temporarily removed the rename(2) tests as these seem to trigger a
deadlock.  Count the number of CLEAN + MODIFIED reports from fsck_ffs and
flag counts > 1 as an error
2022-10-11 10:20:51 +02:00
Sebastien Bini
f3dba162bd init: allow to start script executions with sh -o verify
On systems where mac_veriexec is enforced, init should run its scripts in verified mode.
This relies on the verify shell option introduced by D30464. init will detect if the shell
is /bin/sh, and in which case, add the verify option to the argument vector.
The verify option propagates to all files sourced by the shell, ensuring a better
protection than if the script was tested against an open(O_VERIFY) before running it.
This security can be bypassed with the kenv which overloads the shell to use.
However we feel confident that on systems running with mac_veriexec, this kenv will be blocked somehow.
Also, the verify option has no effect on systems where mac_veriexec is not loaded nor enforced.

Differential revision:  https://reviews.freebsd.org/D34622
Reviewed by:		sjg, wma
2022-10-11 09:48:04 +02:00
Jessica Clarke
91a84eb5ba pmc.sandybridge(3): Fix a few EVENT_ vs Event inconsistencies
Every event other than these four is listed as Event X, Umask Y; fix
these to conform to that style.
2022-10-11 00:50:58 +01:00
Kevin Bowling
2eaef8ec4a igc: Fix up hw vlan ops
Adapt 2796f7cab1 to igc(4)

* Don't reset the entire adapter for vlan changes, fix up the problems
* Remove the VFTA, this hardware doesn't seem to implement it

Approved by:	grehan
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31979
2022-10-10 16:10:53 -07:00
Jessica Clarke
8938d16266 hwpmc: Define full set of Armv8.0 events
Like many of the other encodings here, none of these are actually used
by our tables. However, defining the EVENT_xH names allows them to be
used by the user (e.g. when trying to use an implementation-defined
event that they know about from their core's documentation but we don't)
and allows us to define PMC_EV_ARMV8_LAST appropriately.

Some of these are also used downstream in CheriBSD on Morello.

Reviewed by:	andrew, tsoome
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D36926
2022-10-10 23:34:08 +01:00
Jessica Clarke
28ff96115d hwpmc: Move DMC-620 and CMN-600 events to allow for full Armv8.0 space
The documented encoding space for Armv8 was only 8 bits, but v8.0 has
always had a 10-bit encoding space for its events, and downstream in
CheriBSD we relied on this full space. This worked until the DMC-620 and
CMN-600 events were added, trampling on what should have been reserved
for Armv8.0 right from the start. Thus, renumber the DMC-620 and CMN-600
events to not do this before they make it into a stable release,
allowing for the full Armv8.0 encoding space to be used without having
to split it across two different regions.

Note that Armv8.1 grows the encoding space to 16 bits, which doesn't fit
well with our current approach. No attempt is made to allow for these
events in this change, only the ones that have always been valid (according to
the hardware) from the first commit of Armv8 support to hwpmc.

Reviewed by:	arichardson, tsoome
Differential Revision:	https://reviews.freebsd.org/D36925
2022-10-10 23:30:07 +01:00
Konstantin Belousov
e0612ed490 amd64 pmap: add comment explaining why INVLPG is functional for PCID config
Reviewed by:	alc, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36919
2022-10-11 00:33:17 +03:00
Konstantin Belousov
273d0715f6 amd64: remove useless addr2 variables in page range invalidation handlers
Reviewed by:	alc, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36919
2022-10-11 00:33:12 +03:00
Tom Jones
67f2a563bf acpi: Tell SMM we will handle CPPC notifications
Buggy SMM implementations can hang while processing CPPC notifications.
This leads to some laptops (notably Thinkpads) hanging when the
hwpstate_intel driver is loaded.

Tell the SMM that we will handle CPPC notifications as described in:

- Intel® Processor Vendor-Specific ACPI
- Intel® 64 and IA-32 Architectures Software Developer’s Manual

CPPC events default to masked (disabled) so while we do not do any
handling right now this does not seem to lead to any issues.

This approach was found via this Linux Kernel patch:
https://lkml.org/lkml/2016/3/17/563

PR:		253288
Reviewed by:	imp, jhb
Sponsored by:	Modirum
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D36699
2022-10-10 14:53:15 +01:00
Michael Tuexen
ad20efdde2 Sync TCP related kernel config options
Add TCP_BLACKBOX to the remaining platforms (arm64, RISC-V) and add
TCP_RFC7413 to the remaining platform (RISC-V).

Reviewed by:		rscheff@
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D36918
2022-10-10 15:40:26 +02:00
Mah Yock Gen
29d7f1ff57 igc: remove unnecessary PHY ID checks
I225 devices have only one PHY vendor. There is unnecessary to check
_I_PHY_ID during the link establishment and auto-negotiation process,
the checking also caused devices like i225-IT failed. This patch is to
remove the mentioned unnecessary checking.

Cc: stable@dpdk.org

Signed-off-by: Mah Yock Gen <yock.gen.mah@intel.com>
Signed-off-by: Taripin Samuel <samuel.taripin@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Approved by:	grehan
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D36923
2022-10-10 01:50:46 -07:00
Bjoern A. Zeeb
99e6980fcf device_get_property: add a HANDLE case
This will resolve a reference and return the appropriate handle, a node
on the simplebus or an ACPI_HANDLE for ACPI.  For now we do not try to
further abstract the return type.

MFC after:	2 weeks
Reviewed by:	mw
Differential Revision: https://reviews.freebsd.org/D36793
2022-10-09 21:51:25 +00:00
Cy Schubert
1fcc50004c ipfilter: Removed unused ioctl typedef
Defunct operating systems no longer pollute the ipfilter sources. Remove
their typedefs.

MFC after:	1 week
2022-10-08 17:28:04 -07:00
Pau Amma
36bb350e37 Update tip for adding a user to wheel:
Use "pw groupmod" instead of hand-editing /etc/group

Reviewed by:	bcr, gjb

Approved by:	gjb (mentor)
2022-10-09 02:15:15 +02:00
Rick Macklem
1e588a9ceb rpc.tlsservd: Add an option to run multiple daemons
During discussions with someone that was doing NFS-over-TLS
development for Solaris, we had a concern that the server might
become overloaded after rebooting, due to a large number of
TLS handshake requests from clients.

To alleviate this potential problem, this patch modifies rpc.tlsservd
so that it supports the "-N/--numdaemons" command line option,
which specifies that up to RPCTLS_SRV_MAXNPROCS (currently defined
as 16 in the patch) may be started.

When there are multiple daemons, one is selected by the patched kernel
in a round-robin fashion, to serve a TLS handshake request.

The man page update will be done in a future commit.

Reviewed by:	emaste, karels
Differential Revision:	https://reviews.freebsd.org/D35886
2022-10-08 16:06:16 -07:00
Mateusz Guzik
f860ce8151 zfs: mix mismerge in zfs_znode_free
happens to be a noop
2022-10-08 20:43:33 +00:00
Alexander Motin
1e9482f433 inet: Simplify if_multiaddrs iteration.
Similar to 2cd6ad766e for inet6 drop ifma_restart use, creating more
problems than solving.  It is no longer needed after epoch introduction.

While there, add NULL check for ifma_ifp in igmp_change_state(), that
sometimes caused panics on interface destruction.

MFC after:	2 weeks
2022-10-08 13:10:07 -04:00
Kristof Provost
133935d26f pf: atomically increment state ids
Rather than using a per-cpu state counter, and adding in the CPU id we
can atomically increment the number.
This has the advantage of removing the assumption that the CPU ID fits
in 8 bits.

Event:		Aberdeen Hackathon 2022
Reviewed by:	mjg
Differential Revision:	https://reviews.freebsd.org/D36915
2022-10-08 18:27:29 +02:00
Mark Johnston
5b966d7871 bhyve: Initialize the return value in blockif_register_resize_callback()
MFC after:	1 week
2022-10-08 11:33:43 -04:00
Mark Johnston
3dddf73ee1 bhyve: Make bc_magic unsigned
This addresses a number of compiler warnings about signed/unsigned
comparisons in assertions.

MFC after:	1 week
2022-10-08 11:33:43 -04:00
Mark Johnston
07d82562d8 bhyve: Make pci_bars local to pci_emul.c
MFC after:	1 week
2022-10-08 11:33:42 -04:00
Mark Johnston
98d920d9cf bhyve: Annotate unused function parameters
MFC after:	1 week
2022-10-08 11:33:21 -04:00
Mateusz Guzik
143942f992 unr: remove UNR64_LOCKED
All platforms support 64-bit atomics now.
2022-10-08 10:41:21 +00:00
Benedict Reuschling
44b0b943b8 Revert "Add extra EINVAL information about wrong block size to read(2)/write(2)"
This reverts commit 1c2be25f60.

kib@ pointed out that it is perfectly fine to write at arbitrary regular
file offsets. For example, in a 4K block size character device, geom
doesn't support writing / reading 515 byte blocks. The description is
perhaps not applicable to all EINVALs returned.
2022-10-08 10:23:51 +00:00
Warner Losh
6700f34d12 kboot: hostdisk add to lsdev output
Not entirely sure what to do here, so just list that we're here.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D36606
2022-10-07 23:46:20 -06:00
Warner Losh
beba54e4b8 kboot: Move load address stuff to MD code
The load address computations are highly architecture specific. There
are generic ways that are augmented by specific constraints of specific
way things work on each architecture. Move the current load segment
computations into a MD routine load_addr.

As part of the move, I'm marking kboot_get_kernel_machine_bits as
unused. This arrived in a prior commit, but never seems to have been
connected, suggesting an incomplete merge at the time, or a path not yet
taken.

Create a stub for amd64 that will be filled in with a later commit.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D36603
2022-10-07 23:43:04 -06:00
Warner Losh
891c69864e cam: Use FreeBSD standard copyright
For CAM, move to the FreeBSD standard copyright rather than the 'put it
at the front' variation. This variaiton has been flagged as potentially
problematic in other contexts. Since this variation wasn't a conscious
decision on our part, use the standard license from src/COPYRIGHT.
Also, remove the -FreeBSD suffix in SPDX-License-Identifier. It's
obsolete at SPDX and even the original text didn't match it.

MFC After:		3 days
Sponsored by:		Netflix
2022-10-07 23:37:46 -06:00
Warner Losh
2da6a6b31d nvmecontrol: use uintmax_t for a size
Use uintmax_t cast to print the size of the device for the non-humanize
case to avoid issues with 32-bit longs.

Fixes:			9c1bec9c21
Sponsored by:		Netflix
2022-10-07 21:44:23 -06:00
Colin Percival
39d6144dcd ns8250_drain: Drain without DELAY first
In virtual machines with virtual UARTs which have fictitious baud
rates, it may be possible to drain the receive queue very quickly,
without needing to DELAY after each character.  Attempt to read
(and discard) the receive queue as fast as possible, stopping for
a DELAY only when LSR_RXRDY is no longer asserted; assume that we
have finished draining the queue when LSR_RXRDY is asserted both
before and after a DELAY.

This speeds up the boot process in FreeBSD/Firecracker by 27 ms.

Reviewed by:	imp, jrtc27
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D36184
2022-10-07 17:51:54 -07:00
Wanpeng Qian
9c1bec9c21 nvmecontrol: improve namespace size unit of devlist command output
Add an option of -h --human to output human readable size unit instead
of the fixed unit (MB).

Signed-off-by:		Wanpeng Qian <wanpengqian@gmail.com>
Reviewed by:		imp, bcr
Differential Revision:	https://reviews.freebsd.org/D32957
2022-10-07 17:59:20 -06:00
Mitchell Horne
34aac98e35 EVENTHANDLER(9): drop the list of event handlers
Maintaining a comprehensive list of event handlers in this man page is a
futile endeavor. It is entirely detached from the source code, and
therefore requires that anyone adding/removing an event handler have
prior knowledge of the list. Many do not, so it will naturally become
stale (and is).

This is demonstrated by the fact that there are currently 88 instances
of EVENTHANDLER_DECLARE() in the source tree, but the list contains 66
items.

Many of the descriptions do not offer much detail that could not be
gleaned from the handler name alone. It is a more effective strategy to
document the purpose/details of the event handler in a comment alongside
its declaration.

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36895
2022-10-07 19:26:41 -03:00
Mitchell Horne
af39048601 bus.h: rewrite comment describing intr_type
Describe more clearly the purpose of these flags and where they are
used.

Remove grog's comment about revisiting the flags. At this point it does
not make sense to change this long-standing API, especially in light of
2cf7870864 ("Collapse interrupt thread priorities").

Give a better example of a bus modifying these flags; I did not find any
existing instance where a bus changes the interrupt's type.

Reviewed by:	imp, markj, jhb
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36896
2022-10-07 19:26:41 -03:00