]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agocxgbe: Move page pods KTR traces under VERBOSE_TRACES.
John Baldwin [Wed, 2 Mar 2022 23:32:21 +0000 (15:32 -0800)]
cxgbe: Move page pods KTR traces under VERBOSE_TRACES.

2 years agocxgbe(4): Enable the hardware TCP Offload Module (t4_tom) on aarch64.
Navdeep Parhar [Wed, 2 Mar 2022 22:30:15 +0000 (14:30 -0800)]
cxgbe(4): Enable the hardware TCP Offload Module (t4_tom) on aarch64.

MFC after: 3 days
Sponsored by: Chelsio Communications

2 years agohwpmc_arm64_md.c: Correct architecture name in assertions.
Brett Gutstein [Wed, 2 Mar 2022 22:57:40 +0000 (14:57 -0800)]
hwpmc_arm64_md.c: Correct architecture name in assertions.

Obtained from: CheriBSD

2 years agoMFV d1b143ee9a5: libbsdxml (expat) 2.4.6
Eric van Gyzen [Wed, 2 Mar 2022 20:07:27 +0000 (14:07 -0600)]
MFV d1b143ee9a5: libbsdxml (expat) 2.4.6

Update contrib/expat from 2.4.3 to 2.4.6 to fix multiple vulnerabilities.

Reviewed by: delphij
MFC after: 2 weeks
Relnotes: yes
Security: yes; see contrib/expat/Changes since 2.4.3
Sponsored by: Dell EMC Isilon

2 years agoVendor import of expat 2.4.6
Eric van Gyzen [Wed, 2 Mar 2022 20:00:38 +0000 (14:00 -0600)]
Vendor import of expat 2.4.6

Sponsored by: Dell EMC Isilon

2 years agocxgbe(4): Dump some more debug registers in cim_dump_regs.
Navdeep Parhar [Wed, 2 Mar 2022 18:55:55 +0000 (10:55 -0800)]
cxgbe(4): Dump some more debug registers in cim_dump_regs.

MFC after: 3 days
Sponsored by: Chelsio Communications

2 years agopfctl tests: Ethernet rule parsing tests
Kristof Provost [Fri, 21 Jan 2022 15:48:03 +0000 (16:48 +0100)]
pfctl tests: Ethernet rule parsing tests

A few basic test cases for Ethernet rule parsing.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopfctl: print ethernet rules when called with '-n'
Kristof Provost [Fri, 21 Jan 2022 15:37:21 +0000 (16:37 +0100)]
pfctl: print ethernet rules when called with '-n'

Just as pfctl already does for other rules we print the ethernet rules
we would have loaded if '-n' is specified.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopf tests: extend ether test to verify mac address masks
Kristof Provost [Thu, 20 Jan 2022 17:33:40 +0000 (18:33 +0100)]
pf tests: extend ether test to verify mac address masks

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopf: support masking mac addresses
Kristof Provost [Thu, 20 Jan 2022 17:31:45 +0000 (18:31 +0100)]
pf: support masking mac addresses

When filtering Ethernet packets allow rules to specify a mac address
with a mask. This indicates which bits of the specified address are
significant. This allows users to do things like filter based on device
manufacturer.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopf tests: Ensure 'pfctl -F ethernet' works
Kristof Provost [Tue, 18 Jan 2022 08:41:30 +0000 (09:41 +0100)]
pf tests: Ensure 'pfctl -F ethernet' works

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopfctl: support flushing ethernet rules
Kristof Provost [Mon, 17 Jan 2022 16:38:28 +0000 (17:38 +0100)]
pfctl: support flushing ethernet rules

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopf tests: slightly more complect captive portal setup
Kristof Provost [Wed, 13 Oct 2021 13:21:43 +0000 (15:21 +0200)]
pf tests: slightly more complect captive portal setup

Combine anchor, dummynet and rdr to produce a more complex captive
portal setup.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32484

2 years agopf tests: basic test for ether anchors
Kristof Provost [Tue, 12 Oct 2021 09:27:55 +0000 (11:27 +0200)]
pf tests: basic test for ether anchors

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32483

2 years agopf: add anchor support for ether rules
Kristof Provost [Fri, 1 Oct 2021 17:05:50 +0000 (19:05 +0200)]
pf: add anchor support for ether rules

Support anchors in ether rules.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32482

2 years agopfctl: support lists of mac addresses
Kristof Provost [Thu, 30 Sep 2021 15:09:57 +0000 (17:09 +0200)]
pfctl: support lists of mac addresses

Teach the 'ether' rules to accept { mac1, mac2, ... } lists, similar to
the lists of interfaces or IP addresses we already supported for layer 3
filtering.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32481

2 years agopf tests: test match keyword and dummynet
Kristof Provost [Wed, 29 Sep 2021 15:45:15 +0000 (17:45 +0200)]
pf tests: test match keyword and dummynet

Ensure that the 'match' keyword works with dummynet

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32480

2 years agopf tests: test dummynet for ether traffic
Kristof Provost [Tue, 28 Sep 2021 16:21:26 +0000 (18:21 +0200)]
pf tests: test dummynet for ether traffic

Test that we can set dummynet information on L2, which is processed by
L3 later (assuming it's not overruled by L3 rules, of course).

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32223

2 years agopf: support dummynet on L2 rules
Kristof Provost [Mon, 27 Sep 2021 12:50:30 +0000 (14:50 +0200)]
pf: support dummynet on L2 rules

Allow packets to be tagged with dummynet information. Note that we do
not apply dummynet shaping on the L2 traffic, but instead mark it for
dummynet processing in the L3 code. This is the same approach as we take
for ALTQ.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32222

2 years agopfctl: Document ethernet rule configuration
Kristof Provost [Mon, 22 Feb 2021 14:12:59 +0000 (15:12 +0100)]
pfctl: Document ethernet rule configuration

Document how 'ether' rules can be set, and what options they support.

Reviewed by: bcr
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31751

2 years agopfctl: Document displaying Ethernet rules
Kristof Provost [Mon, 22 Feb 2021 12:04:03 +0000 (13:04 +0100)]
pfctl: Document displaying Ethernet rules

Document the new 'pfctl -s ether' functionality.

Reviewed by: bcr
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31750

2 years agopfctl: Don't print (ether) to / from if they're not set
Kristof Provost [Wed, 17 Feb 2021 16:38:04 +0000 (17:38 +0100)]
pfctl: Don't print (ether) to / from if they're not set

If we're not filtering on a specific MAC address don't print it at all,
rather than showing an all-zero address.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31749

2 years agopf: Support clearing ether counters
Kristof Provost [Wed, 17 Feb 2021 16:24:05 +0000 (17:24 +0100)]
pf: Support clearing ether counters

Allow the evaluations/packets/bytes counters on Ethernet rules to be
cleared.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31748

2 years agopf tests: Test ether direction
Kristof Provost [Mon, 15 Feb 2021 18:03:59 +0000 (19:03 +0100)]
pf tests: Test ether direction

Test that we correctly match inbound ('in') or outbound ('out') Ethernet
packets.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31747

2 years agopf tests: Basic captive portal like test
Kristof Provost [Fri, 12 Feb 2021 16:01:29 +0000 (17:01 +0100)]
pf tests: Basic captive portal like test

Use the ether rules to selectively (i.e. per MAC address) redirect
certain connections. Test that tags carry over to the layer-3 pf code.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31746

2 years agopf tests: Test EtherType filtering
Kristof Provost [Wed, 10 Feb 2021 09:42:06 +0000 (10:42 +0100)]
pf tests: Test EtherType filtering

Test filtering packets by their EtherType (i.e. ARP/IPv4/IPv6/...).

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31745

2 years agopf tests: Test MAC address negation
Kristof Provost [Tue, 9 Feb 2021 16:04:21 +0000 (17:04 +0100)]
pf tests: Test MAC address negation

Test that we can express 'ether block from ! 00:01:02:03:04:05'.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31744

2 years agopf tests: MAC address filtering test
Kristof Provost [Tue, 9 Feb 2021 10:04:36 +0000 (11:04 +0100)]
pf tests: MAC address filtering test

Test the MAC address filtering capability in the new 'ether' feature in
pf.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31743

2 years agopf: Only hook the Ethernet pfil hook when we have rules
Kristof Provost [Tue, 16 Feb 2021 12:42:31 +0000 (13:42 +0100)]
pf: Only hook the Ethernet pfil hook when we have rules

Avoid the overhead of the Ethernet pfil hooks if we don't have any
Ethernet rules.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31742

2 years agopf: SDTs for ether rule matching
Kristof Provost [Tue, 16 Feb 2021 09:08:26 +0000 (10:08 +0100)]
pf: SDTs for ether rule matching

Add static DTrace probe points to allow debugging of ether rule
matching.

Reviewed by: mjg
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31741

2 years agopf: Do not hold PF_RULES_RLOCK while processing Ethernet rules
Kristof Provost [Wed, 10 Feb 2021 12:28:14 +0000 (13:28 +0100)]
pf: Do not hold PF_RULES_RLOCK while processing Ethernet rules

Avoid the overhead of acquiring a (read) RULES lock when processing the
Ethernet rules.
We can get away with that because when rules are modified they're staged
in V_pf_keth_inactive. We take care to ensure the swap to V_pf_keth is
atomic, so that pf_test_eth_rule() always sees either the old rules, or
the new ruleset.

We need to take care not to delete the old ruleset until we're sure no
pf_test_eth_rule() is still running with those. We accomplish that by
using NET_EPOCH_CALL() to actually free the old rules.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31739

2 years agopfctl: Print Ethernet rules
Kristof Provost [Thu, 4 Feb 2021 12:19:12 +0000 (13:19 +0100)]
pfctl: Print Ethernet rules

Extent pfctl to be able to read configured Ethernet filtering rules from
the kernel and print them.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31738

2 years agopf: Initial Ethernet level filtering code
Kristof Provost [Wed, 3 Feb 2021 10:16:10 +0000 (11:16 +0100)]
pf: Initial Ethernet level filtering code

This is the kernel side of stateless Ethernel level filtering for pf.

The primary use case for this is to enable captive portal functionality
to allow/deny access by MAC address, rather than per IP address.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31737

2 years agovt_vga: Correct "plane" spelling
Ed Maste [Wed, 2 Mar 2022 14:08:25 +0000 (09:08 -0500)]
vt_vga: Correct "plane" spelling

I suspect the variable names and comments were accidentally French.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agossh: use standalone config file for security key support
Ed Maste [Tue, 1 Mar 2022 21:42:13 +0000 (16:42 -0500)]
ssh: use standalone config file for security key support

An upcoming OpenSSH update has multiple config.h settings that change
depending on whether builtin security key support is enabled.  Prepare
for this by moving ENABLE_SK_INTERNAL to a new sk_config.h header
(similar to the approach used for optional krb5 support) and optionally
including that, instead of defining the macro directly from CFLAGS.

Reviewed by: kevans
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34407

2 years agolibusb(3): Ignore SIGPIPE when initializing the LibUSB v1.0 API.
Hans Petter Selasky [Wed, 2 Mar 2022 11:31:27 +0000 (12:31 +0100)]
libusb(3): Ignore SIGPIPE when initializing the LibUSB v1.0 API.

The LibUSB v1.0 emulation layer uses pipes internally to signal between
threads. When USB devices are reset, as part of loading firmware, SIGPIPE
may happen, and that is expected and should be ignored.

PR: 261891
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoath: fix older clang build.
Warner Losh [Wed, 2 Mar 2022 05:54:58 +0000 (22:54 -0700)]
ath: fix older clang build.

Define NO_WUNUSED_BUT_SET_VARIABLE for newer clang, and use it in ATH_C
to account for different clang versions. Use it in Makefiles as well.

Sponsored by: Netflix
Reviewed by: kevans, jhb
Differential Revision: https://reviews.freebsd.org/D34408

2 years agobootstrap: bump minimum supported version
Warner Losh [Wed, 2 Mar 2022 05:54:53 +0000 (22:54 -0700)]
bootstrap: bump minimum supported version

Bump the minimum supported version to build -current from to 11.3R in
preparation of removing support for older systems.  11.4R was selected
as the most recent version to go out of support.

Sponsored by: Netflix
Reviewed by: delphij, emaste
Differential Revision: https://reviews.freebsd.org/D32444

2 years agobootstrap: No need for kbdcontrol bootstrap anymore
Warner Losh [Wed, 2 Mar 2022 05:54:45 +0000 (22:54 -0700)]
bootstrap: No need for kbdcontrol bootstrap anymore

We only need kbdcontrol when bootstrapping from FreeBSD 10 or
pre-FreeBSD 11.0 current. Since we can no longer build from these
versions of FreeBSD, remove the support for bootstrapping them.

Sponsored by: Netflix

2 years agoheir: Document SYSROOT conventions
Warner Losh [Tue, 1 Mar 2022 23:58:28 +0000 (16:58 -0700)]
heir: Document SYSROOT conventions

Define a place for sysroot trees to live. This assumes they come from
the base in some way, though there's not yet a build/install/etc sysroot
target. Include the FreeBSD version so multiple verrsions can be
installed on one system (it also includes the whole uname version, so
one could, in theory, install variants like CheriBSD or whatever on the
same system as FreeBSD). Use MACHINE.MACHINE_ARCH to be consistent with
the release practices, /usr/obj and other naming conventions.

Sponsored by: Netflix
Reviewed by: brooks
Differential Revision: https://reviews.freebsd.org/D33754

2 years agowlanconfig: allow to enter WiFi details if no networks found
Alfonso S. Siciliano [Tue, 1 Mar 2022 23:01:13 +0000 (00:01 +0100)]
wlanconfig: allow to enter WiFi details if no networks found

Improve the installer: wlanconfig allows user to enter WiFi details
if no networks found, useful to connect to a hidden SSID.

PR: 246192
Reported by: emaste
Approved by: bapt (mentor)
Differential Revision: https://reviews.freebsd.org/D34149

2 years agoRevert "Temporarily skip usr.bin.diff.diff_test.functionname in CI"
Li-Wen Hsu [Tue, 1 Mar 2022 21:37:25 +0000 (05:37 +0800)]
Revert "Temporarily skip usr.bin.diff.diff_test.functionname in CI"

This reverts commit 85eeb6ea62d45c5df893a16b87969bd7313a3dbb.

The issue has been fixed by 4be7d087c2b566f4910683836be279d55c1a81c6.

PR: 262086

2 years agoath: missed a chance to use ${ATH_C}
Warner Losh [Tue, 1 Mar 2022 20:58:55 +0000 (13:58 -0700)]
ath: missed a chance to use ${ATH_C}

Fixes: 8881d206f4e6 (reviewed by scottl, markj in D34401)
Noticed by: markj
Sponsored by: Netflix

2 years agoproc: Remove assertion that P_WEXIT is not set in proc_rwmem()
Mark Johnston [Tue, 1 Mar 2022 20:08:25 +0000 (15:08 -0500)]
proc: Remove assertion that P_WEXIT is not set in proc_rwmem()

exit1() sets P_WEXIT before waiting for holding threads to finish,
rather than after, so this assertion is racy.

Fixes: 12fb39ec3e6b ("proc: Relax proc_rwmem()'s assertion on the process hold count")
Reported by: Jenkins

2 years agozstd: build with C11
Mateusz Guzik [Tue, 1 Mar 2022 20:07:44 +0000 (20:07 +0000)]
zstd: build with C11

This enables thread-aware timers which in turn fixes benchmark result
reports.

Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D34238

2 years agofasttrap: Avoid creating WX mappings
Mark Johnston [Tue, 1 Mar 2022 16:53:42 +0000 (11:53 -0500)]
fasttrap: Avoid creating WX mappings

fasttrap instruments certain instructions by overwriting them and
copying the original instruction to some per-thread scratch space which
is executed after the probe fires.  This trampoline jumps back to the
tracepoint after executing the original instruction.

The created mapping has both write and execute permissions, and so this
mechanism doesn't work when allow_wx is disabled.  Work around the
restriction by using proc_rwmem() to write to the trampoline.

Reviewed by: vangyzen
Tested by: Amit <akamit91@hotmail.com>
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34304

2 years agofasttrap: Assert that fasttrap_fork() successfully unmaps scratch space
Mark Johnston [Tue, 1 Mar 2022 16:52:39 +0000 (11:52 -0500)]
fasttrap: Assert that fasttrap_fork() successfully unmaps scratch space

No functional change intended.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

2 years agoproc: Relax proc_rwmem()'s assertion on the process hold count
Mark Johnston [Tue, 1 Mar 2022 16:48:39 +0000 (11:48 -0500)]
proc: Relax proc_rwmem()'s assertion on the process hold count

This reference ensures that the process and its associated vmspace will
not be destroyed while proc_rwmem() is executing.  If, however, the
calling thread belongs to the target process, then it is unnecessary to
hold the process.  In particular, fasttrap - a module which enables
userspace dtrace - may frequently call proc_rwmem(), and we'd prefer to
avoid the overhead of locking and bumping the hold count when possible.

Thus, make the assertion conditional on "p != curproc".  Also assert
that the process is not already exiting.  No functional change intended.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

2 years agozfs: Update test format strings to match variable typtes
Ed Maste [Mon, 28 Feb 2022 01:11:20 +0000 (20:11 -0500)]
zfs: Update test format strings to match variable typtes

And drop stray 'd' from the end of some printed numbers.  I assume this
was the result of someone thinking u is a printf length modifier for d,
not a format specifier itself.

Reviewed by: kevans, rew
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34387

2 years agoath: Suppress set but unused warnings
Warner Losh [Tue, 1 Mar 2022 00:26:00 +0000 (17:26 -0700)]
ath: Suppress set but unused warnings

The ath driver has a lot of these warnings. It's an older driver, so
just supress these warnings until they can be fixed. They are a mix of
simple dead stores, debubgging output and stuff that would require
careful study to know if its safe to remove the access or not (there are
likely very few of the latter, but if there are any they are latent bugs
that compiler could optimize away). Since I have no ath hardware to test
on anymore, take the conservative approach.

Sponsored by: Netflix

2 years agog_part: Allow attributes to be querried
Warner Losh [Mon, 28 Feb 2022 21:28:51 +0000 (14:28 -0700)]
g_part: Allow attributes to be querried

Create g_part_getattr to allow gpart geoms to have their attributes queried.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D32782

2 years agoAdd USB UEFI locator support
Warner Losh [Mon, 28 Feb 2022 21:28:46 +0000 (14:28 -0700)]
Add USB UEFI locator support

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D32788

2 years agoacpi: Allow matching based on locators
Warner Losh [Mon, 28 Feb 2022 21:28:40 +0000 (14:28 -0700)]
acpi: Allow matching based on locators

Allow wiring of unit numbers based any of the standard locators that
match.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D32787

2 years agoacpi hints: Abstract out acpi_hint_device_matches_resources
Warner Losh [Mon, 28 Feb 2022 21:28:33 +0000 (14:28 -0700)]
acpi hints: Abstract out acpi_hint_device_matches_resources

Abstract out acpi_hint_device_matches_resources from
acpi_hint_device_unit to simplify that code. Continue matching like
we've always matched: no functional change.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D32786

2 years agoacpi_hint_device_unit: matches is a bool, make it one
Warner Losh [Mon, 28 Feb 2022 21:28:26 +0000 (14:28 -0700)]
acpi_hint_device_unit: matches is a bool, make it one

"matches" is used as a bool and doesn't need to count anything. Convert
it to a bool.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D32785

2 years agopci: Add arbitrary locator support to pci.
Warner Losh [Mon, 28 Feb 2022 21:28:20 +0000 (14:28 -0700)]
pci: Add arbitrary locator support to pci.

If the pciX:Y:Z and pciW:X:Y:Z 'at' locations don't work, allow try the
LOCATOR:PATH syntax. Use dev_wired_cache to generically look them up.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D32784

2 years agobus: Create dev_wired_cache
Warner Losh [Mon, 28 Feb 2022 21:28:01 +0000 (14:28 -0700)]
bus: Create dev_wired_cache

A simple cache to cache differnet locators to the same device.

Sponsored by: Netflix
Changes Suggested by: jhb
Differential Revision: https://reviews.freebsd.org/D32783

2 years agopci: switch logic a little
Warner Losh [Mon, 28 Feb 2022 21:27:55 +0000 (14:27 -0700)]
pci: switch logic a little

If we find a match, then assign it. Flip the logic in the if and assign
the unit rather than continuing if it doesn't match. Will make it easier
to expand to other matching schemes.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D32779

2 years agoAdd UEFI locator for bus_get_device_path, pci acpi
Warner Losh [Mon, 28 Feb 2022 21:27:48 +0000 (14:27 -0700)]
Add UEFI locator for bus_get_device_path, pci acpi

Add a UEFI locator type. It prints the UEFI device names for a FreeBSD
device_t name. It works with PCI and ACPI device nodes. USB forthcoming.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D32749

2 years agobus: Add ACPI locator support
Warner Losh [Mon, 28 Feb 2022 21:27:42 +0000 (14:27 -0700)]
bus: Add ACPI locator support

Add support for printing ACPI paths. This is a bit of a degenerate case
for this interface since it's always just the device handle if the
device has one. But it is illustrtive of how to do this for a few nodes
in the tree.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D32748

2 years agodevctl: add getpath command
Warner Losh [Mon, 28 Feb 2022 21:27:35 +0000 (14:27 -0700)]
devctl: add getpath command

Retrieves that path for a device. Different methods to enumerat the path
are supported, called locators.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D32747

2 years agolibdevctl: Add devctl_getpath
Warner Losh [Mon, 28 Feb 2022 21:27:28 +0000 (14:27 -0700)]
libdevctl: Add devctl_getpath

Helper routine to call the kernel to get a path to the named device.
Different path enumeration methods (called locators) can be used
for different path types depending on what the kernel implements.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D32746

2 years agodevctl: Add DEV_GET_PATH
Warner Losh [Mon, 28 Feb 2022 21:27:20 +0000 (14:27 -0700)]
devctl: Add DEV_GET_PATH

DEV_GET_PATH will get the path to a device based on different locators.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D32745

2 years agobus: Introduce the bus interface get_device_path
Warner Losh [Mon, 28 Feb 2022 21:27:09 +0000 (14:27 -0700)]
bus: Introduce the bus interface get_device_path

This returns the full path of a the child device requested. Since
there's different ways to recon the entire path, include a 'locator'
method. The default 'FreeBSD' method uses a filesystem-like path name
with each device to the root node separated by /. Other locators will be
UEFI, ACPI and fdt, though others are possible in the future. Make the
locator a string to allow maximum flexibility.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D32744

2 years agodevctl2: Change to 644 protections
Warner Losh [Mon, 28 Feb 2022 21:26:19 +0000 (14:26 -0700)]
devctl2: Change to 644 protections

We make sure that we check for device privs (usually meaning root or
better) for everything. To allow other functions that don't require
this, default to 644 protection.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D32863

2 years agossh: correct configure option name
Ed Maste [Tue, 1 Mar 2022 14:35:46 +0000 (09:35 -0500)]
ssh: correct configure option name

The option is security-key-builtin not security-key-internal.  There is
no change to the generated config.h because the option defaults off
anyway.

MFC after: 3 days
Fixes: 87152f340549 ("ssh: disble internal security key...")
Sponsored by: The FreeBSD Foundation

2 years agoriscv: Add support for enabling SV48 mode
Mark Johnston [Tue, 1 Mar 2022 14:07:14 +0000 (09:07 -0500)]
riscv: Add support for enabling SV48 mode

This increases the size of the user map from 256GB to 128TB.  The kernel
map is left unchanged for now.

For now SV48 mode is left disabled by default, but can be enabled with a
tunable.  Note that extant hardware does not implement SV48, but QEMU
does.

- In pmap_bootstrap(), allocate a L0 page and attempt to enable SV48
  mode.  If the write to SATP doesn't take, the kernel continues to run
  in SV39 mode.
- Define VM_MAX_USER_ADDRESS to refer to the SV48 limit.  In SV39 mode,
  the region [VM_MAX_USER_ADDRESS_SV39, VM_MAX_USER_ADDRESS_SV48] is not
  mappable.

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

2 years agoriscv: Add support for dynamically allocating L1 page table pages
Mark Johnston [Tue, 1 Mar 2022 14:06:57 +0000 (09:06 -0500)]
riscv: Add support for dynamically allocating L1 page table pages

This is required in SV48 mode.

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

2 years agoriscv: Handle four-level page tables in various pmap traversal routines
Mark Johnston [Tue, 1 Mar 2022 14:06:42 +0000 (09:06 -0500)]
riscv: Handle four-level page tables in various pmap traversal routines

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

2 years agoriscv: Maintain the allpmaps list only in SV39 mode
Mark Johnston [Tue, 1 Mar 2022 14:06:31 +0000 (09:06 -0500)]
riscv: Maintain the allpmaps list only in SV39 mode

When four-level page tables are used, there is no need to distribute
updates to the top-level page to all pmaps.

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

2 years agoriscv: Add pmap helper functions required by four-level page tables
Mark Johnston [Tue, 1 Mar 2022 14:06:15 +0000 (09:06 -0500)]
riscv: Add pmap helper functions required by four-level page tables

No functional change intended.

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

2 years agoriscv: Try to improve the comments for locore's page table setup
Mark Johnston [Tue, 1 Mar 2022 14:06:03 +0000 (09:06 -0500)]
riscv: Try to improve the comments for locore's page table setup

No functional change intended.

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

2 years agoriscv: Conditionally modify the ELF64 sysentvec for SV48
Mark Johnston [Tue, 1 Mar 2022 14:05:02 +0000 (09:05 -0500)]
riscv: Conditionally modify the ELF64 sysentvec for SV48

A sysinit determines whether the pmap has enabled SV48 mode and modifies
the corresponding fields which describe the user memory map.

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

2 years agoriscv: Define a SV48 memory map
Mark Johnston [Tue, 1 Mar 2022 14:04:38 +0000 (09:04 -0500)]
riscv: Define a SV48 memory map

No functional change intended.

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

2 years agoriscv: Add various pmap definitions needed to support SV48 mode
Mark Johnston [Tue, 1 Mar 2022 14:04:01 +0000 (09:04 -0500)]
riscv: Add various pmap definitions needed to support SV48 mode

No functional change intended.

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

2 years agoriscv: Use generic CSR macros for writing SATP
Mark Johnston [Tue, 1 Mar 2022 14:03:44 +0000 (09:03 -0500)]
riscv: Use generic CSR macros for writing SATP

Instead of having the one-off load_satp(), just use csr_write().  No
functional change intended.

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

2 years agoriscv: Rename struct pmap's pm_l1 field to pm_top
Mark Johnston [Tue, 1 Mar 2022 14:03:30 +0000 (09:03 -0500)]
riscv: Rename struct pmap's pm_l1 field to pm_top

In SV48 mode, the top-level page will be an L0 page rather than an L1
page.  Rename the field accordingly.  No functional change intended.

Reviewed by: alc, jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34270

2 years agorip: Fix a -Wunused-but-set-variable warning
Mark Johnston [Tue, 1 Mar 2022 14:01:24 +0000 (09:01 -0500)]
rip: Fix a -Wunused-but-set-variable warning

Fixes: 81728a538d24 ("Split rtinit() into multiple functions.")
Reviewed by: imp, melifaro
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34395

2 years agox86: Probe the TSC frequency earlier
Mark Johnston [Tue, 1 Mar 2022 14:39:35 +0000 (09:39 -0500)]
x86: Probe the TSC frequency earlier

This lets us use the TSC to implement early DELAY, limiting the use of
the sometimes-unreliable 8254 PIT.

PR: 262155
Reviewed by: emaste
Tested by: emaste, mike tancsa <mike@sentex.net>, Stefan Hegnauer <stefan.hegnauer@gmx.ch>
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34367

2 years agoi386: Call clock_init() after finishidentcpu()
Mark Johnston [Tue, 1 Mar 2022 14:00:05 +0000 (09:00 -0500)]
i386: Call clock_init() after finishidentcpu()

In a subsequent commit clock_init() will attempt to determine the TSC
frequency, and this requires that CPU identification is finalized.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

2 years agormlock: Add required compiler barriers to _rm_runlock()
Mark Johnston [Tue, 1 Mar 2022 13:55:43 +0000 (08:55 -0500)]
rmlock: Add required compiler barriers to _rm_runlock()

Also remove excessive whitespace in _rm_rlock().

Reviewed by: jah, mjg
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34381

2 years agoopenssh: Add a note to check for deprecated and removed config options
Mark Johnston [Tue, 1 Mar 2022 14:36:23 +0000 (09:36 -0500)]
openssh: Add a note to check for deprecated and removed config options

Suggested by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agorelease: Remove references to ChallengeResponseAuthentication
Mark Johnston [Tue, 1 Mar 2022 13:54:55 +0000 (08:54 -0500)]
release: Remove references to ChallengeResponseAuthentication

This sshd_config keyword was replaced by KbdInteractiveAuthentication in
openssh 8.7, though ChallengeResponseAuthentication is silently accepted
as an alias.  However, this means that the code in ec2.conf which
modifies a commented-out line no longer does anything.  Apply a minimal
fix.

Reviewed by: cperciva, emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34400

2 years agodiff: Use start of change when searching for function
Tom Jones [Tue, 1 Mar 2022 13:23:25 +0000 (13:23 +0000)]
diff: Use start of change when searching for function

Use the start of change when searching for a function rather than the
start of the context. In short functions if this could result in search
for the function name starting from before the function definition.

PR: 262086
Reviewed by: bapt, mckusick, mhorne
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D34328

2 years agoAdd casts to printf statements to keep armv6, armv7, and powerpc
Kirk McKusick [Tue, 1 Mar 2022 03:28:02 +0000 (19:28 -0800)]
Add casts to printf statements to keep armv6, armv7, and powerpc
builds happy.

2 years agoCreate a new GEOM utility, gunion(8).
Kirk McKusick [Tue, 1 Mar 2022 00:36:08 +0000 (16:36 -0800)]
Create a new GEOM utility, gunion(8).

The gunion(8) utility is used to track changes to a read-only disk on
a writable disk. Logically, a writable disk is placed over a read-only
disk. Write requests are intercepted and stored on the writable
disk. Read requests are first checked to see if they have been
written on the top (writable disk) and if found are returned. If
they have not been written on the top disk, then they are read from
the lower disk.

The gunion(8) utility can be especially useful if you have a large
disk with a corrupted filesystem that you are unsure of how to
repair. You can use gunion(8) to place another disk over the corrupted
disk and then attempt to repair the filesystem. If the repair fails,
you can revert all the changes in the upper disk and be back to the
unchanged state of the lower disk thus allowing you to try another
approach to repairing it. If the repair is successful you can commit
all the writes recorded on the top disk to the lower disk.

Another use of the gunion(8) utility is to try out upgrades to your
system. Place the upper disk over the disk holding your filesystem
that is to be upgraded and then run the upgrade on it. If it works,
commit it; if it fails, revert the upgrade.

Further details can be found in the gunion(8) manual page.

Reviewed by: Chuck Silvers, kib (earlier version)
tested by:   Peter Holm
Differential Revision: https://reviews.freebsd.org/D32697

2 years agovmm: fix "set but not used" warnings
Robert Wing [Tue, 1 Mar 2022 00:09:32 +0000 (15:09 -0900)]
vmm: fix "set but not used" warnings

2 years agovmm: fix "set but not used" warnings
Robert Wing [Mon, 28 Feb 2022 23:55:37 +0000 (14:55 -0900)]
vmm: fix "set but not used" warnings

2 years agovmm: fix "set but not used" warnings
Robert Wing [Mon, 28 Feb 2022 23:46:08 +0000 (14:46 -0900)]
vmm: fix "set but not used" warnings

2 years agodtc: Sync with upstream version e9a77451cdd8
Jessica Clarke [Mon, 28 Feb 2022 22:37:47 +0000 (22:37 +0000)]
dtc: Sync with upstream version e9a77451cdd8

1c231509cf88 ("Validate integers fit in cells") is the only change
missing from our copy.

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

2 years agorelease: Add support for building on non-FreeBSD
Jessica Clarke [Mon, 28 Feb 2022 22:37:37 +0000 (22:37 +0000)]
release: Add support for building on non-FreeBSD

This requires two sets of changes. Firstly, for non-FreeBSD, we do not
know where tools are in PATH (and it is likely that some are not in
system directories and have been built as bootstrap tools during the
build), so we should leave PATH alone and trust the user. Secondly,
makefs needs a master.passwd for building images from a METALOG file, so
pass the directory in the image tree to makefs's -N option in order to
pick up a valid FreeBSD master.passwd; this is unnecessary on FreeBSD
(except in the edge case of building an image that refers to users or
groups not present in the host's database, which is unlikely but
technically possible) but harmless so can be done unconditionally.

Reviewed by: brooks, emaste, gjb
Differential Revision: https://reviews.freebsd.org/D34001

2 years agoinstall-boot.sh: Avoid - in function names for POSIX compatibility
Jessica Clarke [Mon, 28 Feb 2022 22:37:21 +0000 (22:37 +0000)]
install-boot.sh: Avoid - in function names for POSIX compatibility

FreeBSD sh supports this but other common POSIX shells do not; in
particular, dash does not, unlike bash and zsh. This allows the script
to be used on non-FreeBSD systems for release media building.

Reviewed by: emaste, brooks
Differential Revision: https://reviews.freebsd.org/D34000

2 years agorelease: Support -DNO_ROOT image building
Jessica Clarke [Mon, 28 Feb 2022 22:37:03 +0000 (22:37 +0000)]
release: Support -DNO_ROOT image building

This requires a bunch of METALOG mangling to include the files we inject
into the tree. The mkisoimages.sh and make-memstick.sh scripts are now
called with the current directory inside the tree so that the relative
paths in the METALOG match up with the current directory. The scripts do
not require this when not using a METALOG, but for simplicity we always
do so. The Makefile mangles the real METALOG created from the install,
as those files are shared across all uses of the tree, but the shell
scripts create a temporary copy of the METALOG that they mangle as their
tree modifications are specific to that image. We also need to pass -D
to makefs to turn any duplicate METALOG entry errors into warnings, as
we have many (harmless) instances of those.

Whilst dvd1.iso should work, the !NOPKG code will need more work to
support this.

All media will also lack mergemaster and etcupdate trees, since more
work is needed to add -DNO_ROOT modes to them. Users of install media
built this way will have to manually bootstrap them.

Reviewed by: brooks, gjb
Differential Revision: https://reviews.freebsd.org/D33999

2 years agomkisoimages.sh: Avoid creating temporary files in the current directory
Jessica Clarke [Mon, 28 Feb 2022 22:36:51 +0000 (22:36 +0000)]
mkisoimages.sh: Avoid creating temporary files in the current directory

Currently the current directory is the parent of the rootfs directory,
but this will change in order to support NO_ROOT builds that use a
metalog manifest, since those need to have the current directory be the
rootfs itself in order for the relative paths to be correct, and we do
not want the non-METALOG case (which passes the directory to makefs) to
pick up leftover temporary .img files from a previous failed build.

Reviewed by: brooks, emaste, gjb
Differential Revision: https://reviews.freebsd.org/D33998

2 years agoFix hand-rolled METALOG entries for installconfig during distributeworld
Jessica Clarke [Mon, 28 Feb 2022 22:36:39 +0000 (22:36 +0000)]
Fix hand-rolled METALOG entries for installconfig during distributeworld

During distributeworld we call distribute on subdirectories, which in
turn calls installconfig. However, this recursive installconfig call
appends the distribution name (in these cases, "base") to DESTDIR. For
install(1) this works fine as its -D argument comes from the top-level
Makefile.inc1, which passes the original DESTDIR, thereby resulting in
the METALOG entry having the distribution name as a prefix representing
its true installed path relative to the root, but for the hand-rolled
entries they do not use install(1) and thus do not have access to what
the original DESTDIR was, resulting in the METALOG missing this prefix.

Thus, pass down the name of the distribution via a new variable DISTBASE
(chosen as Makefile.inc1 already uses that to convey this exact same
information to etc's distrib-dirs during distributeworld) and prepend
this to the handful of manually-generated METALOG entries. For the
installworld case this variable will be empty and so this behaves as
before.

Note that we need to be careful to avoid double slashes in the METALOG;
distributeworld uses find | awk to split the single METALOG up into
multiple dist.meta files, and this relies on the paths in the METALOG
having the exact prefix ./dist (or ./dist/usr/lib/debug).

Reviewed by: brooks, emaste
Differential Revision: https://reviews.freebsd.org/D33997

2 years agoAdd a manual page for boottrace(4)
Mateusz Piotrowski [Mon, 28 Feb 2022 21:51:03 +0000 (22:51 +0100)]
Add a manual page for boottrace(4)

Reviewed by: mhorne, pauamma_gundo.com
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc
Differential Revision: https://reviews.freebsd.org/D33275

2 years agoipfilter: Print protocol when listing NAT table mappings
Cy Schubert [Mon, 28 Feb 2022 19:43:33 +0000 (11:43 -0800)]
ipfilter: Print protocol when listing NAT table mappings

NAT table mappings list only the source and destination IP, the source
and destinaion port numbers, and their mappings. But the protocol is not
listed. Now that Facebook and Google use QUIC, seeing port 443 in in a
list of active NAT sessions could mean 443/tcp or 443/udp. This patch
adds the protocol to the listing to aid in determining whether HTTPS is
TCP or QUIC in a NAT mapping listing. This also helps differentiatinete
between other protocols such as ICMP, ESP, and AH in ipnat list of active
sessions.

MFC after: 1 week

2 years agoReport I/O stats from the CAM_IOSCHED_DYNAMIC extension
Warner Losh [Mon, 28 Feb 2022 17:17:06 +0000 (10:17 -0700)]
Report I/O stats from the CAM_IOSCHED_DYNAMIC extension

Report, on a periodic basis, the I/O latencies the CAM I/O scheduler
computes. These times are only for the hardware portion of the I/O as
measured from the time the operation is scheduled with the SIM using
xpt_action() until the SIM reports it has completed with xpt_dine(). Any
time the I/O operation spends in a software queue is no included.

The P50 (median), P90, P99 and P99.9 statistics about the latency of
each of the read, write and trim operations that completed during the
polling interval are reported. If there are fewer than 2, 10, 100 or
1000 operations during the polling interval, no statistic is reported
and a single dash '-' is displayed.

The read, write and trim commands (either on the command line or at run
time) toggle display of these operations. The color command toggles
color (it defaults to on, like gstat). When color is enabled, unknown
statistics are reported in blue, high latency for a statistics is
reported in red, medium in magenta and low in green (as with gstat). The
med= and hi= commands can set these latency thresholds.

Limitations: The entire sysctl space for all the devices is walked for
each polling period. This should be optimized to remember the OIDs and
only do such polling with the xpt generation changes. There is also no
way to filter devices displayed. This command only works on physical
devies that are connected to SCSI, ATA or NVME sims as those are the
only ones that are instrumented in the CAM I/O scheduler (the
CAM_IOSCHED_DYNAMIC option must be in the kernel, and the dynamic
scheduler can't be disabled).

MFC After: 1 month
Relnotes: yes
Sponsored by: Netflix
Reviewed by: pauamma_gundo.com, chs
Differential Revision: https://reviews.freebsd.org/D34259

2 years agobwn: Remove useless variable
Warner Losh [Mon, 28 Feb 2022 17:14:04 +0000 (10:14 -0700)]
bwn: Remove useless variable

type is a write-only variable. Eliminate it.

Sponsored by: Netflix

2 years agobnxt: Remove dead write to cp_ring_id
Warner Losh [Mon, 28 Feb 2022 17:13:27 +0000 (10:13 -0700)]
bnxt: Remove dead write to cp_ring_id

Since this is read from memory, reading it and then ignoring it is dead
code...

Sponsored by: Netflix