]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
21 months agoclnt_vc.c: Replace msleep() with pause() to avoid assert panic
Rick Macklem [Fri, 14 Oct 2022 22:46:55 +0000 (15:46 -0700)]
clnt_vc.c: Replace msleep() with pause() to avoid assert panic

An msleep() in clnt_vc.c used a global "fake_wchan" wchan argument
along with the mutex in a CLIENT structure.  As such, it was
possible to use different mutexes for the same wchan and
cause a panic assert.  Since this is in a rarely executed code
path, the assert panic was only recently observed.

Since "fake_wchan" never gets a wakeup, this msleep() can
be replaced with a pause() to avoid the panic assert,
which is what this patch does.

Reviewed by: kib, markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D36977

21 months agoAdd initial DPAA2 support
Dmitry Salychev [Tue, 20 Sep 2022 09:47:41 +0000 (11:47 +0200)]
Add initial DPAA2 support

DPAA2 is a hardware-level networking architecture found in some NXP
SoCs which contain hardware blocks including Management Complex
(MC, a command interface to manipulate DPAA2 objects), Wire Rate I/O
processor (WRIOP, packets distribution, queuing, drop decisions),
Queues and Buffers Manager (QBMan, Rx/Tx queues control, Rx buffer
pools) and the others.

The Management Complex runs NXP-supplied firmware which provides DPAA2
objects as an abstraction layer over those blocks to simplify an
access to the underlying hardware. Each DPAA2 object has its own
driver (to perform an initialization at least) and will be visible
as a separate device in the device tree.

Two new drivers (dpaa2_mc and dpaa2_rc) act like firmware buses in
order to form a hierarchy of the DPAA2 devices:

acpiX (or simplebusX)
  dpaa2_mcX
    dpaa2_rcX
      dpaa2_mcp0
      ...
      dpaa2_mcpN
      dpaa2_bpX
      dpaa2_macX
      dpaa2_io0
      ...
      dpaa2_ioM
      dpaa2_niX

dpaa2_mc is suppossed to be a root of the hierarchy, comes in ACPI
and FDT flavours and implements helper interfaces to allocate and
assign bus resources, MSI and "managed" DPAA2 devices (NXP treats some
of the objects as resources for the other DPAA2 objects to let them
function properly). Almost all of the DPAA2 objects are assigned to
the resource containers (dpaa2_rc) to implement isolation.

The initial implementation focuses on the DPAA2 network interface
to be operational. It is the most complex object in terms of
dependencies which uses I/O objects to transmit/receive packets.

Approved by: bz (mentor)
Tested by: manu, bz
MFC after: 3 months
Differential Revision: https://reviews.freebsd.org/D36638

21 months agokinst: Clarify a comment in the trampoline allocator
Mark Johnston [Fri, 14 Oct 2022 15:17:12 +0000 (11:17 -0400)]
kinst: Clarify a comment in the trampoline allocator

Fixes: f0bc4ed144fc ("kinst: Initial revision")

21 months agokinst: Remove an unused constant
Mark Johnston [Thu, 13 Oct 2022 20:26:54 +0000 (16:26 -0400)]
kinst: Remove an unused constant

This was left over after a rework of the trampoline allocator.

Fixes: f0bc4ed144fc ("kinst: Initial revision")

21 months agovmm: validate icr value
Corvin Köhne [Wed, 12 Oct 2022 09:19:32 +0000 (11:19 +0200)]
vmm: validate icr value

Not all combinations of icr values are allowed. Neither Intel nor AMD
document what happens when an invalid value is written to the icr.
Ignore the IPI. So, the guest will note that the IPI wasn't delivered.

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

21 months agovmm: increase vlapic version
Corvin Köhne [Mon, 10 Oct 2022 12:56:00 +0000 (14:56 +0200)]
vmm: increase vlapic version

Mac os panics on apic versions lower than 0x14.

See https://opensource.apple.com/source/xnu/xnu-7195.81.3/osfmk/i386/lapic_native.c.auto.html

Additionally, an upcoming commit will validate the icr values written by
the guest. Older intel processors allow some different combinations than
the newer ones. AMD documents that only the newer combinations are
allowed. So, bumping the version allows us to avoid a differentiation
between AMD and Intel.

Intel documents that newer processors than the P6 are using the new
combinations. Sadly, Intel does not document which apic version belongs
to those processors. Linux identifies newer apics by a version larger or
equal to 0x14. Intel and AMD allow apic version between 0x10 and 0x15.
So, using 0x14 seems to be fine.

See https://github.com/torvalds/linux/blob/3eba620e7bd772a0c7dc91966cb107872b54a910/arch/x86/kernel/apic/apic.c#L238

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

21 months agovmm: permit some IPIs to be handled by userspace
Corvin Köhne [Wed, 7 Sep 2022 07:07:03 +0000 (09:07 +0200)]
vmm: permit some IPIs to be handled by userspace

Add VM_EXITCODE_IPI to permit returning unhandled IPIs to userland.
INIT and STARTUP IPIs are now returned to userland. Due to backward
compatibility reasons, a new capability is added for enabling
VM_EXITCODE_IPI.

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

21 months agopf: apply the network stack's ICMP rate limiting to ICMP errors sent by pf
Kristof Provost [Fri, 7 Oct 2022 14:22:57 +0000 (16:22 +0200)]
pf: apply the network stack's ICMP rate limiting to ICMP errors sent by pf

PR: 266477
Event: Aberdeen Hackathon 2022
Differential Revision: https://reviews.freebsd.org/D36903

21 months agobsdinstall: use the correct DISTDIR for fetching local distfiles
Kyle Evans [Fri, 14 Oct 2022 05:22:09 +0000 (00:22 -0500)]
bsdinstall: use the correct DISTDIR for fetching local distfiles

fetchmissingdists naturally sets BSDINSTALL_DISTDIR to a directory in
the new filesystem that it can write fetched distfiles to.  As a result,
BSDINSTALL_DISTSITE was incorrectly set to the scratch space on /mnt for
the call to distfetch when grabbing local distfiles, and it would
subsequently fail.

Switch to using the copy of BSDINSTALL_DISTDIR that we stashed off
coming into fetchmissingdists; this one is in-fact set to the path where
the local distfiles are stored.

Patch suggested by jrtc27.

Reported and tested by: Daniel O'Connor <darius dons net au>
MFC after: 1 week

21 months agoloader: fix elf lookup_symbol type filtering
Kyle Evans [Fri, 14 Oct 2022 03:06:13 +0000 (22:06 -0500)]
loader: fix elf lookup_symbol type filtering

The existing logic doesn't seem to make much sense, as we won't filter
on the type if st_shndx != SHN_UNDEF.  In practice, this breaks booting
12.3 kernels on newer loaders, as they do have a `kernphys` symbol of
the wrong type (NOTYPE, rather than OBJECT) -- we end up deriving the
wrong value for copy_staging.

It's unclear if this version makes any more sense, but it seems to match
what rtld's matched_symbol() does.  Loader doesn't need to care about
STT_FUNC w/ UND shndx, because we won't encounter those; in kmods,
undefined (kernel) functions are NOTYPE.

Reported by: Christian McDonald <cmcdonald netgate com>
Reviewed by: imp, kib, tsoome
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D36975

21 months agoRevert "Avoid using TARGET_ARCH in llvm.build.mk"
Kyle Evans [Fri, 14 Oct 2022 03:04:47 +0000 (22:04 -0500)]
Revert "Avoid using TARGET_ARCH in llvm.build.mk"

This reverts commit 8534e6be8110a8126268a38dc0557a2d15615ce9, and adds
a cautionary note that there are dragons about that should be considered
when changing it.

PR: 267026
Reviewed by: dim, imp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D36981

21 months agonetinet6: trim overly long lines in GET_PKTOPT_VAR(), fit into 80 chars
Gleb Smirnoff [Thu, 13 Oct 2022 16:03:38 +0000 (09:03 -0700)]
netinet6: trim overly long lines in GET_PKTOPT_VAR(), fit into 80 chars

21 months agoinpcb: provide in_pcbremhash() to reduce copy-paste
Gleb Smirnoff [Thu, 13 Oct 2022 16:03:38 +0000 (09:03 -0700)]
inpcb: provide in_pcbremhash() to reduce copy-paste

21 months agorenice: Force /bin/sh usage on su calls for the regression tests.
Olivier Cochard [Thu, 13 Oct 2022 15:23:54 +0000 (17:23 +0200)]
renice: Force /bin/sh usage on su calls for the regression tests.

If the root account is configured to use a different shell than sh,
it fails to retreive the pid of the background process.

Approved by: des
Obtained from: chs
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36930

21 months agoblacklistd: Whitespace police
Jose Luis Duran [Wed, 12 Oct 2022 15:25:50 +0000 (12:25 -0300)]
blacklistd: Whitespace police

These were missed in the previous whitespace reduction.

Fixes: 631bdcf3043c ("blacklistd: whitespace cleanup")
Obtained from: https://github.com/zoulasc/blocklist

21 months agoblacklistd: Reduce diff with upstream
Jose Luis Duran [Wed, 12 Oct 2022 19:17:51 +0000 (16:17 -0300)]
blacklistd: Reduce diff with upstream

No functional change intended.

21 months agosort: deindent file_reader_free and cleanup its usage
Baptiste Daroussin [Thu, 13 Oct 2022 08:51:17 +0000 (10:51 +0200)]
sort: deindent file_reader_free and cleanup its usage

21 months agosort: simplify file_reader_clean
Baptiste Daroussin [Thu, 13 Oct 2022 08:40:21 +0000 (10:40 +0200)]
sort: simplify file_reader_clean

Deindent the function, remove useless tests:
 - free already test if argument is NULL
 - closefile already test if the input is stdin or null

21 months agosort: deindent closefile
Baptiste Daroussin [Thu, 13 Oct 2022 08:38:12 +0000 (10:38 +0200)]
sort: deindent closefile

21 months agosort: use asprintf(3) instead of malloc + snprintf(3)
Baptiste Daroussin [Thu, 13 Oct 2022 08:34:57 +0000 (10:34 +0200)]
sort: use asprintf(3) instead of malloc + snprintf(3)

21 months agosort: deindent openfile
Baptiste Daroussin [Thu, 13 Oct 2022 08:31:08 +0000 (10:31 +0200)]
sort: deindent openfile

21 months agosort: simplify the code to handle -z flag
Baptiste Daroussin [Thu, 13 Oct 2022 08:21:48 +0000 (10:21 +0200)]
sort: simplify the code to handle -z flag

21 months agosort: cleanup now unused structutre and prototypes
Baptiste Daroussin [Thu, 13 Oct 2022 08:19:18 +0000 (10:19 +0200)]
sort: cleanup now unused structutre and prototypes

21 months agosort: unify the code to read from FILE *
Baptiste Daroussin [Thu, 13 Oct 2022 07:36:48 +0000 (09:36 +0200)]
sort: unify the code to read from FILE *

Previously the code to read from a local file or stdin was sperarated
After the change to remove the home made line reader used for stdin
(replaced by getdelim) it apprears that the rest of the code which is
used to read from any FILE * but stdin can benefit from the exact same
change.

21 months agosort: remove unused function
Baptiste Daroussin [Thu, 13 Oct 2022 07:33:12 +0000 (09:33 +0200)]
sort: remove unused function

21 months agosort: use memset to initialize structure when possible
Baptiste Daroussin [Thu, 13 Oct 2022 07:07:46 +0000 (09:07 +0200)]
sort: use memset to initialize structure when possible

21 months agovinum/geom_vinum_var.h: Fix missing linefeed in license.
Pedro F. Giffuni [Thu, 13 Oct 2022 03:46:03 +0000 (22:46 -0500)]
vinum/geom_vinum_var.h: Fix missing linefeed in license.

The license is still standard BSD-4-clause and the text is unmodified
but add a missing linefeed for readability.

No functional change.

21 months agosctp: improve sending of ABORT packets in response to INIT-ACKs
Michael Tuexen [Wed, 12 Oct 2022 23:05:44 +0000 (01:05 +0200)]
sctp: improve sending of ABORT packets in response to INIT-ACKs

Ensure that the initiate tag of the INIT-ACK chunk is used as the
verification tag of the packet containing the ABORT chunk.

Reported by: Suganya Dharma
MFC after: 1 week

21 months agolibdtrace: Fix some CPU register number definitions to match the kernel
Mark Johnston [Wed, 12 Oct 2022 19:59:09 +0000 (15:59 -0400)]
libdtrace: Fix some CPU register number definitions to match the kernel

MFC after: 1 week

21 months agodtrace: Drop illumos ifdefs for CPU register definitions
Mark Johnston [Wed, 12 Oct 2022 19:59:00 +0000 (15:59 -0400)]
dtrace: Drop illumos ifdefs for CPU register definitions

These are fixed, so having upstream's version is not especially useful,
and the duplicated definitions make for confusing reading.  No
functional change intended.

MFC after: 1 week

21 months agoCopyedit git-arc(1)
Pau Amma [Sun, 25 Sep 2022 20:45:43 +0000 (20:45 +0000)]
Copyedit git-arc(1)

Bump .Dd again as requested.

Reviewed by: gjb, imp, jhb

Approved by: gjb (mentor, src), imp (src), jhb (src)

Differential Revision: https://reviews.freebsd.org/D36705

21 months agoblacklistd: Don't remove a ruleset if we have already added it
Jose Luis Duran [Wed, 12 Oct 2022 16:42:18 +0000 (13:42 -0300)]
blacklistd: Don't remove a ruleset if we have already added it

The noted argument is wrong - if it's already been deleted then the id we
have for it is invalid.
Because we don't track deletions to the ruleset, working it out is
problematic at best.

Instead, if we have already added the rule treat it as a non-op.

This is a valid use case because we might receive a burst of messages
in the downstream application for the same address and process them
one by one. It's not the job of the downstream application to track
blacklistd state.

Obtained from: https://github.com/zoulasc/blocklist/commit/959b18a6047c6facd100e5bb8a759eb597c65df2

21 months agoblacklistd: silence sign-conversion warning from Clang
Ed Maste [Wed, 12 Oct 2022 18:10:21 +0000 (14:10 -0400)]
blacklistd: silence sign-conversion warning from Clang

Obtained from: NetBSD 518a28b2e752

21 months agossh: remove pre- and post-merge update steps
Ed Maste [Thu, 6 Oct 2022 14:57:41 +0000 (10:57 -0400)]
ssh: remove pre- and post-merge update steps

We no longer use the pre- and post-merge scripts to strip/add RCS tags.
The tags have been removed from main, but persist on older branches.

While here renumber the steps in the update documentation using a more
conventional scheme.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36904

21 months agorefcount.9: Update refcount_acquire(9) description after a67d540832b8
Ka Ho Ng [Wed, 12 Oct 2022 17:47:59 +0000 (13:47 -0400)]
refcount.9: Update refcount_acquire(9) description after a67d540832b8

MFC after: 3 days
Sponsored by: Juniper Networks, Inc.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D36943

21 months agoblacklistd: whitespace cleanup
Ed Maste [Wed, 12 Oct 2022 17:40:38 +0000 (13:40 -0400)]
blacklistd: whitespace cleanup

Diff reduction against NetBSD external/bsd/blacklist (at commit
03c74c04f277).

Sponsored by: The FreeBSD Foundation

21 months agomalloc(9): update names and hardlinks
Mitchell Horne [Wed, 12 Oct 2022 16:43:57 +0000 (13:43 -0300)]
malloc(9): update names and hardlinks

Give all documented functions a .Nm entry in the man page, following the
order they are listed in the synopsis. Create MLINKs for each of the
functions as well.

While here, add a missing include directive to the synopsis, and appease
mandoc by wrapping a long line.

Reviewed by: markj, imp (previous version), jhb (previous version)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36940

21 months agoswi(9): remove BUGS section
Mitchell Horne [Wed, 12 Oct 2022 16:38:08 +0000 (13:38 -0300)]
swi(9): remove BUGS section

Most of these globals have been removed, save for clk_intr_event. This
one is appropriate to keep in sys/interrupt.h, despite the fact that it
has only one consumer.

Bump .Dd for this and previous changes.

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

21 months agoDowngrade tty_intr_event from a global
Mitchell Horne [Wed, 12 Oct 2022 16:36:08 +0000 (13:36 -0300)]
Downgrade tty_intr_event from a global

It can be static within uart_tty.c. It is an open question whether there
remains any real benefit to having uart instances share a swi thread.

Reviewed by: imp, markj, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36938

21 months agoswi(9): clean up description of clk_intr_event
Mitchell Horne [Wed, 12 Oct 2022 16:35:23 +0000 (13:35 -0300)]
swi(9): clean up description of clk_intr_event

From what I can tell, setdelayed() was removed so long ago that its
mention is more likely to be confusing than helpful. We now have a
manpage for hardclock(9), so reference that.

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

21 months agoRemove last references of vm_ih
Mitchell Horne [Wed, 12 Oct 2022 16:32:27 +0000 (13:32 -0300)]
Remove last references of vm_ih

The only remaining user was busdma, and so it was simplified.

Reviewed by: markj, jhb
MFC after: 1 week
Fixes: 254e4e5b77d7 ("Simplify swi for bus_dma")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36936

21 months agosort: use mkstemp(3) instead of reinventing it
Baptiste Daroussin [Wed, 12 Oct 2022 15:57:37 +0000 (17:57 +0200)]
sort: use mkstemp(3) instead of reinventing it

MFC After: 1 week

21 months agodma: restore addition of newline when missing from input
Ed Maste [Tue, 27 Sep 2022 19:19:19 +0000 (15:19 -0400)]
dma: restore addition of newline when missing from input

If input mail does not have a newline on the last line dma must add
one.  This was broken by the addition of long-line splitting, with the
switch from strlen(line) to linelen returned by getline().

PR: 266629
Reviewed by: bapt, Mikko Lehto
Tested by: Mikko Lehto
MFC after: 1 week
Fixes: b0b2d05fd060 ("Split body of mails not respecting...")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36763

21 months agosort: replace home made line reader by getdelim(3)
Baptiste Daroussin [Wed, 12 Oct 2022 13:31:50 +0000 (15:31 +0200)]
sort: replace home made line reader by getdelim(3)

The previous code had bug when reading lines with an unexpected
encoding, returning without the full line being captured.
This result in sort complaining with "sort: Illegal byte sequence"

Using getdelim(3) instead of the home made code, fixes the situation.

PR: 241679
Reported by: Ronald F. Guilmette <rfg-freebsd@tristatelogic.com>
MFC After: 1 week
Reviewed by: markj, imp
Differential Revision: https://reviews.freebsd.org/D36948

21 months agoblacklistd: Fix usage for blacklistd/blacklistctl
Jose Luis Duran [Wed, 12 Oct 2022 13:28:43 +0000 (09:28 -0400)]
blacklistd: Fix usage for blacklistd/blacklistctl

If getopt(3) encounters a character not found in optstring or if it
detects a missing option argument, it returns ? (question mark).

Obtained from:  https://github.com/zoulasc/blocklist
Differential Revision: https://reviews.freebsd.org/D36087

21 months agoOptionalObsoleteFiles: grep nls files have been removed 4 years ago
Baptiste Daroussin [Wed, 12 Oct 2022 14:28:36 +0000 (16:28 +0200)]
OptionalObsoleteFiles: grep nls files have been removed 4 years ago

21 months agosort: remove NLS support
Baptiste Daroussin [Wed, 12 Oct 2022 14:18:59 +0000 (16:18 +0200)]
sort: remove NLS support

NLS support for sort(1) is:
1/ incomplete: many error string are not using nls
2/ only covers hu_HU.ISO8859-2

21 months agosort: replace malloc+memset with calloc
Baptiste Daroussin [Wed, 12 Oct 2022 13:57:11 +0000 (15:57 +0200)]
sort: replace malloc+memset with calloc

21 months agosort: add wrapper around calloc
Baptiste Daroussin [Wed, 12 Oct 2022 13:52:38 +0000 (15:52 +0200)]
sort: add wrapper around calloc

21 months agoblacklistd: Update documentation changes
Jose Luis Duran [Wed, 12 Oct 2022 13:23:39 +0000 (09:23 -0400)]
blacklistd: Update documentation changes

Cherry-pick upstream documentation changes.

Obtained from:  https://github.com/zoulasc/blocklist
Differential Revision: https://reviews.freebsd.org/D36086

21 months agoRevert "e1000: Try auto-negotiation for fixed 100 or 10 configuration"
Kevin Bowling [Wed, 12 Oct 2022 12:01:12 +0000 (05:01 -0700)]
Revert "e1000: Try auto-negotiation for fixed 100 or 10 configuration"

This reverts commit 9ab4dfce8feda8cf3545be0c3c7569095b1fcd24.

OPNsense users have reported a regression with fixed configs.

The e1000 api is not ready for this change.

21 months agopw: remove the inaccurate anymore information from the README
Baptiste Daroussin [Wed, 12 Oct 2022 10:11:32 +0000 (12:11 +0200)]
pw: remove the inaccurate anymore information from the README

21 months agopw: exit with an error in case of using an illegal option
Baptiste Daroussin [Wed, 12 Oct 2022 10:06:32 +0000 (12:06 +0200)]
pw: exit with an error in case of using an illegal option

PR: 263188
Reported by: Dennis Clarke <dclarke@blastwave.org>
MFC After: 1 week

21 months agopci_vendors: update to 2022.09.09
Baptiste Daroussin [Wed, 12 Oct 2022 09:31:15 +0000 (11:31 +0200)]
pci_vendors: update to 2022.09.09

21 months agoRevert "listen(): improve POSIX compliance"
Michael Tuexen [Wed, 12 Oct 2022 02:33:00 +0000 (04:33 +0200)]
Revert "listen(): improve POSIX compliance"

This reverts commit 76e6e4d72f8d3da7d19242f303bc95461fde7fb9.

Several programs in the tree use -1 instead of INT_MAX to use
the maximum value. Thanks to Eugene Grosbein for pointing this
out.

21 months agocontrib/tzdata: import tzdata 2022e
Philip Paeps [Wed, 12 Oct 2022 01:50:03 +0000 (09:50 +0800)]
contrib/tzdata: import tzdata 2022e

Changes: https://github.com/eggert/tz/blob/2022e/NEWS

MFC after: 3 days

21 months agoImport tzdata 2022e
Philip Paeps [Wed, 12 Oct 2022 01:46:54 +0000 (09:46 +0800)]
Import tzdata 2022e

21 months agokinst: Add a rudimentary regression test case
Mark Johnston [Thu, 29 Sep 2022 13:44:39 +0000 (09:44 -0400)]
kinst: Add a rudimentary regression test case

The test instruments a number of large, frequently called kernel
functions while generating load in the background.

MFC after: 3 months

21 months agodtraceall: Automatically load kinst.ko on amd64
Mark Johnston [Tue, 11 Oct 2022 21:31:47 +0000 (17:31 -0400)]
dtraceall: Automatically load kinst.ko on amd64

MFC after: 3 months

21 months agoRELNOTES: Add an entry for dtrace_kinst(4)
Mark Johnston [Tue, 11 Oct 2022 20:12:01 +0000 (16:12 -0400)]
RELNOTES: Add an entry for dtrace_kinst(4)

21 months agokinst: Add a manual page
Christos Margiolis [Tue, 11 Oct 2022 15:34:19 +0000 (11:34 -0400)]
kinst: Add a manual page

MFC after: 3 months
Sponsored by: Google, Inc. (GSoC 2022)
Differential Revision: https://reviews.freebsd.org/D36853

21 months agolibdtrace: Add kinst support
Christos Margiolis [Tue, 11 Oct 2022 15:33:52 +0000 (11:33 -0400)]
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

21 months agokinst: Initial revision
Christos Margiolis [Tue, 11 Oct 2022 15:28:17 +0000 (11:28 -0400)]
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

21 months agoatomic: Style
Mark Johnston [Tue, 11 Oct 2022 14:54:36 +0000 (10:54 -0400)]
atomic: Style

Fixes: 30253da1a982 ("atomic: Add some type checking to plain atomic_load/store helpers")
MFC after: 1 week

21 months agolisten(): improve POSIX compliance
Michael Tuexen [Tue, 11 Oct 2022 20:46:51 +0000 (22:46 +0200)]
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

21 months agoofw_graph(9): hook it up to the Makefile
Mitchell Horne [Tue, 11 Oct 2022 19:28:16 +0000 (16:28 -0300)]
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: 9a4eed0be20c ("ofw_graph: Add functions for graph bindings")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36932

21 months agorelease: link from /boot/msdos to efi
Warner Losh [Tue, 11 Oct 2022 19:19:52 +0000 (13:19 -0600)]
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

21 months agosys/_pv_entry.h: Include sys/param.h
Warner Losh [Tue, 11 Oct 2022 18:51:55 +0000 (12:51 -0600)]
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

21 months agonvme: Always set deadline to max
Warner Losh [Tue, 11 Oct 2022 18:51:32 +0000 (12:51 -0600)]
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

21 months agoCorrect typo in soacceptqueue setting
Ed Maste [Tue, 11 Oct 2022 16:59:22 +0000 (12:59 -0400)]
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: 9871ae6aa91f ("Track kern.ipc.somaxconn -> ...")

21 months agonanobsd: remove unmodified copies of ssh config files
Ed Maste [Tue, 11 Oct 2022 16:53:57 +0000 (12:53 -0400)]
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

21 months agoTrack kern.ipc.somaxconn -> kern.ipc.soacceptqueue rename
Jose Luis Duran [Tue, 11 Oct 2022 16:39:26 +0000 (12:39 -0400)]
Track kern.ipc.somaxconn -> kern.ipc.soacceptqueue rename

Fixes: 2bdf61ca29d0 ("Hide the unfortunate named sysctl...")
MFC after: 3 days

21 months agoriscv: handle misaligned address exceptions
Mitchell Horne [Tue, 11 Oct 2022 13:39:50 +0000 (10:39 -0300)]
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

21 months agonanobsd: update copies of SSH config files
Ed Maste [Tue, 11 Oct 2022 13:25:14 +0000 (09:25 -0400)]
nanobsd: update copies of SSH config files

Sponsored by: The FreeBSD Foundation

21 months agoAdd more Arm CPUs to the arm64 cpu ident
Andrew Turner [Tue, 11 Oct 2022 11:53:45 +0000 (12:53 +0100)]
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

21 months agoMark 64-bit arm64 hypervisor registers with UL
Andrew Turner [Wed, 28 Sep 2022 13:39:45 +0000 (14:39 +0100)]
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

21 months agoacpi: Put CPPC workaround behind i386/amd64 if def
Tom Jones [Tue, 11 Oct 2022 08:30:34 +0000 (09:30 +0100)]
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.

21 months agostress2: Temporarily removed the rename(2) tests as these seem to trigger a
Peter Holm [Tue, 11 Oct 2022 08:20:51 +0000 (10:20 +0200)]
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

21 months agoinit: allow to start script executions with sh -o verify
Sebastien Bini [Tue, 11 Oct 2022 07:48:04 +0000 (09:48 +0200)]
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

21 months agopmc.sandybridge(3): Fix a few EVENT_ vs Event inconsistencies
Jessica Clarke [Mon, 10 Oct 2022 23:50:58 +0000 (00:50 +0100)]
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.

21 months agoigc: Fix up hw vlan ops
Kevin Bowling [Mon, 10 Oct 2022 23:09:21 +0000 (16:09 -0700)]
igc: Fix up hw vlan ops

Adapt 2796f7cab10785ef40efbba97ef67ab319c96e9c 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

21 months agohwpmc: Define full set of Armv8.0 events
Jessica Clarke [Mon, 10 Oct 2022 22:34:08 +0000 (23:34 +0100)]
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

21 months agohwpmc: Move DMC-620 and CMN-600 events to allow for full Armv8.0 space
Jessica Clarke [Mon, 10 Oct 2022 22:30:07 +0000 (23:30 +0100)]
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

21 months agoamd64 pmap: add comment explaining why INVLPG is functional for PCID config
Konstantin Belousov [Mon, 10 Oct 2022 00:19:45 +0000 (03:19 +0300)]
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

21 months agoamd64: remove useless addr2 variables in page range invalidation handlers
Konstantin Belousov [Sat, 8 Oct 2022 08:33:11 +0000 (11:33 +0300)]
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

21 months agoacpi: Tell SMM we will handle CPPC notifications
Tom Jones [Mon, 10 Oct 2022 13:46:25 +0000 (14:46 +0100)]
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

21 months agoSync TCP related kernel config options
Michael Tuexen [Mon, 10 Oct 2022 13:40:26 +0000 (15:40 +0200)]
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

21 months agoigc: remove unnecessary PHY ID checks
Mah Yock Gen [Fri, 2 Sep 2022 00:18:28 +0000 (08:18 +0800)]
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

21 months agodevice_get_property: add a HANDLE case
Bjoern A. Zeeb [Thu, 29 Sep 2022 12:41:58 +0000 (12:41 +0000)]
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

21 months agoipfilter: Removed unused ioctl typedef
Cy Schubert [Fri, 7 Oct 2022 10:05:53 +0000 (03:05 -0700)]
ipfilter: Removed unused ioctl typedef

Defunct operating systems no longer pollute the ipfilter sources. Remove
their typedefs.

MFC after: 1 week

21 months agoUpdate tip for adding a user to wheel:
Pau Amma [Sun, 25 Sep 2022 19:00:49 +0000 (19:00 +0000)]
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)

21 months agorpc.tlsservd: Add an option to run multiple daemons
Rick Macklem [Sat, 8 Oct 2022 23:06:16 +0000 (16:06 -0700)]
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

21 months agozfs: mix mismerge in zfs_znode_free
Mateusz Guzik [Sat, 8 Oct 2022 20:43:33 +0000 (20:43 +0000)]
zfs: mix mismerge in zfs_znode_free

happens to be a noop

21 months agoinet: Simplify if_multiaddrs iteration.
Alexander Motin [Sat, 8 Oct 2022 17:10:07 +0000 (13:10 -0400)]
inet: Simplify if_multiaddrs iteration.

Similar to 2cd6ad766eb23 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

21 months agopf: atomically increment state ids
Kristof Provost [Fri, 7 Oct 2022 17:17:06 +0000 (19:17 +0200)]
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

21 months agobhyve: Initialize the return value in blockif_register_resize_callback()
Mark Johnston [Sat, 8 Oct 2022 15:26:38 +0000 (11:26 -0400)]
bhyve: Initialize the return value in blockif_register_resize_callback()

MFC after: 1 week

21 months agobhyve: Make bc_magic unsigned
Mark Johnston [Sat, 8 Oct 2022 15:26:31 +0000 (11:26 -0400)]
bhyve: Make bc_magic unsigned

This addresses a number of compiler warnings about signed/unsigned
comparisons in assertions.

MFC after: 1 week

21 months agobhyve: Make pci_bars local to pci_emul.c
Mark Johnston [Sat, 8 Oct 2022 15:26:25 +0000 (11:26 -0400)]
bhyve: Make pci_bars local to pci_emul.c

MFC after: 1 week

21 months agobhyve: Annotate unused function parameters
Mark Johnston [Sat, 8 Oct 2022 15:22:38 +0000 (11:22 -0400)]
bhyve: Annotate unused function parameters

MFC after: 1 week

21 months agounr: remove UNR64_LOCKED
Mateusz Guzik [Sat, 8 Oct 2022 09:38:41 +0000 (09:38 +0000)]
unr: remove UNR64_LOCKED

All platforms support 64-bit atomics now.