]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agosyscalls: regen
Brooks Davis [Mon, 22 Nov 2021 22:36:57 +0000 (22:36 +0000)]
syscalls: regen

2 years agomakesyscalls: handle 64-bit args on 32-bit
Brooks Davis [Mon, 22 Nov 2021 22:36:57 +0000 (22:36 +0000)]
makesyscalls: handle 64-bit args on 32-bit

On 32-bit architectures, 64-bit arguments are passed in pairs of
registers. On non-x86 architectures these arguments must be in evenly
aligned registers which necessiciates inserting a pad register into the
argument list. This has historically been supported by adding ifdefs
around padded and unpadded syscall defintions in syscalls.master.

In order to enable generation of 32-bit support files from the base
syscalls.master, pull this support in to makesyscalls.lua enabled by
adding pair_64bit to abi_flags.

The changes to sys_proto.h simply add #ifdef PAD64_REQUIRED
around pad arguments in struct <syscall>_args. In systrace_args(),
replace static syscall index values with post-incremented indexs
allowing a simple ifdef around the argument. Under -O1 or higher
code generation is identical. systrace_entry_setargdesc() is a bit
more complicated as we switch on argument indices.  Solve this
with some use of define/undef pairs to compute the correct indices.

Reviewed by: kevans

2 years agomakesyscalls: handle arrays of pointers
Brooks Davis [Mon, 22 Nov 2021 22:36:57 +0000 (22:36 +0000)]
makesyscalls: handle arrays of pointers

When the config variable abi_intptr_t is not "", transform arrays of
pointers to arrays of abi_intptr_t.

Reviewed by: kevans

2 years agomakesyscalls: handle longs in ABI compat
Brooks Davis [Mon, 22 Nov 2021 22:36:57 +0000 (22:36 +0000)]
makesyscalls: handle longs in ABI compat

Replace long-derived types with their abi equivalent where
required by the target ABI. There are two cases:
 - All pointers to types that go from 64-bit to 32-bit between the
   default ABI and the target ABI.
 - Signed arguments that go from 64-bit to 32-bit (these require
   sign-extension before passing to general kernel ABIs).

This adds four new config variables: abi_long, semid_t, abi_size_t,
and abi_u_long which default to long, size_t, and u_long respectively.

Reviewed by: kevans

2 years agomakesyscalls.lua: Allow translation of intptr_t arguments
Brooks Davis [Mon, 22 Nov 2021 22:36:57 +0000 (22:36 +0000)]
makesyscalls.lua: Allow translation of intptr_t arguments

Translate instances of intptr_t to the config value abi_intptr_t
(defaults to "intptr_t").  Used in CheriABI to translate intptr_t
to intcap_t for hybrid kernels.

Reviewed by: kevans

2 years agosyscalls: regen
Brooks Davis [Mon, 22 Nov 2021 22:36:56 +0000 (22:36 +0000)]
syscalls: regen

2 years agomakesyscalls: intptr_t arguments are pointers
Brooks Davis [Mon, 22 Nov 2021 22:36:56 +0000 (22:36 +0000)]
makesyscalls: intptr_t arguments are pointers

Match intptr_t arguments as pointers.  Currently this is a no-op
change to systrace_args.c.

Reviewed by: kevans

2 years agomakesyscalls: Add a way to include per-ABI headers
Brooks Davis [Mon, 22 Nov 2021 22:36:56 +0000 (22:36 +0000)]
makesyscalls: Add a way to include per-ABI headers

When the string %%ABI_HEADERS%% is found in syscalls.master, replace
it with the contents of the abi_headers config variable.  This allows
an ABI-specific syscalls.conf to add lines like:

#include <compat/freebsd32/freebsd32.h>

when working from a shared syscalls.master.

Reviewed by: kevans

2 years agomakesyscalls: allow multiple expressions for each abi change
Brooks Davis [Mon, 22 Nov 2021 22:36:56 +0000 (22:36 +0000)]
makesyscalls: allow multiple expressions for each abi change

Limitations in lua patterns means we need to be able to match more
than one possible expression.

Reviewed by: kevans

2 years agomakesyscalls: Fix expression for time_t_size
Brooks Davis [Mon, 22 Nov 2021 22:36:56 +0000 (22:36 +0000)]
makesyscalls: Fix expression for time_t_size

Reviewed by: kevans

2 years agomakesyscalls: Remove _native suffix handling
Brooks Davis [Mon, 22 Nov 2021 22:36:56 +0000 (22:36 +0000)]
makesyscalls: Remove _native suffix handling

This supported a hack we used in CheriBSD which has been removed.

Reviewed by: kevans

2 years agofreebsd32: remove unnecessicary headers
Brooks Davis [Mon, 22 Nov 2021 22:36:56 +0000 (22:36 +0000)]
freebsd32: remove unnecessicary headers

Reviewed by: kib

2 years agofreebsd32: regen
Brooks Davis [Mon, 22 Nov 2021 22:36:56 +0000 (22:36 +0000)]
freebsd32: regen

2 years agosyscalls: improve nstat, nfstat, nlstat
Brooks Davis [Mon, 22 Nov 2021 22:36:56 +0000 (22:36 +0000)]
syscalls: improve nstat, nfstat, nlstat

Optionally return errors when truncating dev_t, ino_t, and nlink_t.
In the interest of code reuse, use freebsd11_cvtstat() to perform the
truncation and error handling and then convert the resulting struct
freebsd11_stat to struct nstat.

Add missing freebsd32 compat syscalls. These syscalls require
translation because struct nstat contains four instances of struct
timespec which in turn contains a time_t and a long.

Reviewed by: kib

2 years agofreebsd32: regen
Brooks Davis [Mon, 22 Nov 2021 22:36:55 +0000 (22:36 +0000)]
freebsd32: regen

2 years agofreebsd32: add _'s to _umtx_(un)lock
Brooks Davis [Mon, 22 Nov 2021 22:36:55 +0000 (22:36 +0000)]
freebsd32: add _'s to _umtx_(un)lock

This aligns with the default ABI's configuration.

Reviewed by: kib

2 years agofreebsd32: enable orecvfrom
Brooks Davis [Mon, 22 Nov 2021 22:36:55 +0000 (22:36 +0000)]
freebsd32: enable orecvfrom

It requires no translation, just a correct decleration.

Reviewed by: kib

2 years agofreebsd32: declare ogetsockname correctly
Brooks Davis [Mon, 22 Nov 2021 22:36:55 +0000 (22:36 +0000)]
freebsd32: declare ogetsockname correctly

Reviewed by: kib

2 years agofreebsd32: sync some osig* audit flags with default ABI
Brooks Davis [Mon, 22 Nov 2021 22:36:55 +0000 (22:36 +0000)]
freebsd32: sync some osig* audit flags with default ABI

Discussed with: rwatson

Reviewed by: kib

2 years agofreebsd32: sctp syscalls take struct iovec32
Brooks Davis [Mon, 22 Nov 2021 22:36:55 +0000 (22:36 +0000)]
freebsd32: sctp syscalls take struct iovec32

Reviewed by: kib

2 years agofreebsd32: aio_cancel takes a struct aiocb32
Brooks Davis [Mon, 22 Nov 2021 22:36:55 +0000 (22:36 +0000)]
freebsd32: aio_cancel takes a struct aiocb32

Strictly speaking, it takes a virtual address and doesn't touch the
object directly, but this is consistant with other aio_*() syscalls.

Reviewed by: kib

2 years agofreebsd32: [gs]etgroups take an int gidsetsize
Brooks Davis [Mon, 22 Nov 2021 22:36:55 +0000 (22:36 +0000)]
freebsd32: [gs]etgroups take an int gidsetsize

Reviewed by: kib

2 years agofreebsd32: make semsys take int arguments
Brooks Davis [Mon, 22 Nov 2021 22:36:54 +0000 (22:36 +0000)]
freebsd32: make semsys take int arguments

This matches the default ABI.

Reviewed by: kib

2 years agofreebsd32: make fcntl's arg argument int32_t
Brooks Davis [Mon, 22 Nov 2021 22:36:54 +0000 (22:36 +0000)]
freebsd32: make fcntl's arg argument int32_t

It's a long in the default ABI so this is consistant with other caes.

Reviewed by: kib

2 years agosyscalls: regen
Brooks Davis [Mon, 22 Nov 2021 22:36:54 +0000 (22:36 +0000)]
syscalls: regen

2 years agosyscalls: abort2 doesn't return so declare as void
Brooks Davis [Mon, 22 Nov 2021 22:36:54 +0000 (22:36 +0000)]
syscalls: abort2 doesn't return so declare as void

Reviewed by: kib

2 years agosyscalls: umask returns a mode_t
Brooks Davis [Mon, 22 Nov 2021 22:36:54 +0000 (22:36 +0000)]
syscalls: umask returns a mode_t

Reviewed by: kib

2 years agosyscalls: update a few return types to ssize_t
Brooks Davis [Mon, 22 Nov 2021 22:36:54 +0000 (22:36 +0000)]
syscalls: update a few return types to ssize_t

Reviewed by: kib

2 years agosyscalls: struct ucontext4 -> struct freebsd4_ucontext
Brooks Davis [Mon, 22 Nov 2021 22:36:54 +0000 (22:36 +0000)]
syscalls: struct ucontext4 -> struct freebsd4_ucontext

This aligns with struct freebsd4_ucontext32 in freebsd32.

Reviewed by: kib

2 years agosyscalls: regen
Brooks Davis [Mon, 22 Nov 2021 22:36:54 +0000 (22:36 +0000)]
syscalls: regen

2 years agosys___sysctl: regularize argument struct
Brooks Davis [Mon, 22 Nov 2021 22:36:54 +0000 (22:36 +0000)]
sys___sysctl: regularize argument struct

Let makesyscalls generate the normal struct __sysctl_args structure.
It works fine.

Reviewed by: kib

2 years agosyscalls: regen
Brooks Davis [Mon, 22 Nov 2021 22:36:53 +0000 (22:36 +0000)]
syscalls: regen

2 years agosys_sigaltstack: use struct sigaltstack arg
Brooks Davis [Mon, 22 Nov 2021 22:36:53 +0000 (22:36 +0000)]
sys_sigaltstack: use struct sigaltstack arg

This is idential to stack_t and more amenable to prepending "32" to
for freebsd32.

Reviewed by: kib

2 years agoRELNOTES: Add comment about WiFi 6 support to wpa
Cy Schubert [Mon, 22 Nov 2021 20:03:34 +0000 (12:03 -0800)]
RELNOTES: Add comment about WiFi 6 support to wpa

2 years agoRevert "RELNOTES: Add comment about WiFi 6 support"
Cy Schubert [Mon, 22 Nov 2021 20:01:36 +0000 (12:01 -0800)]
Revert "RELNOTES: Add comment about WiFi 6 support"

This reverts commit c0601c3e0162a7ccf6160b32cfa7596bba7bb869.

2 years agoRELNOTES: Add comment about WiFi 6 support
Cy Schubert [Mon, 22 Nov 2021 18:34:42 +0000 (10:34 -0800)]
RELNOTES: Add comment about WiFi 6 support

2 years agoopenssl: Fix detection of ARMv7 and ARM64 CPU features
Allan Jude [Fri, 19 Nov 2021 15:14:30 +0000 (15:14 +0000)]
openssl: Fix detection of ARMv7 and ARM64 CPU features

OpenSSL assumes the same value for AT_HWCAP=16 (Linux)
So it ends up calling elf_auxv_info() with AT_CANARY which
returns ENOENT, and all acceleration features are disabled.

With this, my ARM64 test machine runs the benchmark
`openssl speed -evp aes-256-gcm` nearly 20x faster
going from 100 MB/sec to 2000 MB/sec

It also improves sha256 from 300 MB/sec to 1800 MB/sec

This fix has been accepted but not yet merged upstream:
https://github.com/openssl/openssl/pull/17082

PR: 259937
Reviewed by: manu, imp
MFC after: immediate
Relnotes: yes
Fixes: 88e852c0b5c872b1a ("OpenSSL: Merge OpenSSL 1.1.1j")
Sponsored by: Ampere Computing LLC
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D33060

2 years agoipresend(1): Make the build slightly less broken.
Allan Jude [Mon, 22 Nov 2021 17:58:08 +0000 (17:58 +0000)]
ipresend(1): Make the build slightly less broken.

X-NetApp-PR: 35
Sponsored by: NetApp, Inc.
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D27335

2 years agopchtherm: Let the driver be compiled into the kernel
N.J. Mann [Mon, 22 Nov 2021 17:04:05 +0000 (12:04 -0500)]
pchtherm: Let the driver be compiled into the kernel

PR: 259776
MFC after: 1 week

2 years agobhyve: Fix compile
Emmanuel Vadot [Mon, 22 Nov 2021 16:13:09 +0000 (17:13 +0100)]
bhyve: Fix compile

We need err.h

Fixes: 5cf21e48ccf11 ("bhyve: use a fixed 32 bit BAR base address")
Sponsored by: Bechoff Automation GmbH & Co. KG

2 years agobhyve: emulate reads of MSI-X capabilities for passthru devices
Corvin Köhne [Mon, 22 Nov 2021 15:27:33 +0000 (16:27 +0100)]
bhyve: emulate reads of MSI-X capabilities for passthru devices

Reads of the MSI-X capabilites aren't emulated by passthru devices
yet. The guest will read the host MSI-X capabilites which could
cause issues.

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

2 years agobhyve: keep physical and virtual COMMAND reg in sync
Corvin Köhne [Mon, 22 Nov 2021 15:26:03 +0000 (16:26 +0100)]
bhyve: keep physical and virtual COMMAND reg in sync

On startup all virtual BARs are registered.
Additionally, the encoding bit in the virtual cmd register is set.
After that, the passthru emulation overwrites the virtual cmd register with
the physical one.
This could lead to a mismatch between registered BARs and the encoding
bits in the cmd register.
Instead of writing the physical to the virtual cmd register,
write the virtual to the physical cmd register to solve this issue.

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

2 years agobhyve: use a fixed 32 bit BAR base address
Corvin Köhne [Mon, 22 Nov 2021 15:24:47 +0000 (16:24 +0100)]
bhyve: use a fixed 32 bit BAR base address

OVMF always uses 0xC0000000 as base address for 32 bit PCI MMIO space.
For that reason, we should use that address too.

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

2 years agobhyve: move 64 bit BAR location to match OVMF assumptions
Corvin Köhne [Mon, 22 Nov 2021 15:22:48 +0000 (16:22 +0100)]
bhyve: move 64 bit BAR location to match OVMF assumptions

OVMF will fail, if large 64 bit BARs are used. GCD-Map doesn't cover
64 bit addresses of BARs.
OVMF assumes that 64 bit addresses of BARS are located on next 32 GB
boundary behind Top of High RAM.

This patch moves 64 bit BARs on next 32 GB boundary behind Top of High
RAM to match OVMF assumptions.

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

2 years agobridge(4): Use American spelling of "behavior"
Guangyuan Yang [Mon, 22 Nov 2021 02:41:49 +0000 (21:41 -0500)]
bridge(4): Use American spelling of "behavior"

Fixes: 8406182dbeb972698775e2468902bc5f6e593d72
MFC after: 3 days
Reported by: Pau Amma <pauamma@gundo.com>

2 years agomakefs: remove set but not used variables
Ed Maste [Mon, 22 Nov 2021 02:19:43 +0000 (21:19 -0500)]
makefs: remove set but not used variables

These were leftovers from the port from NetBSD (where they are used).

Sponsored by: The FreeBSD Foundation

2 years agoGEOM: Switch g_io_deliver() locking from cp to pp.
Alexander Motin [Sun, 21 Nov 2021 23:50:59 +0000 (18:50 -0500)]
GEOM: Switch g_io_deliver() locking from cp to pp.

Single provider may have multiple consumers, and locking one of consumers
is not sufficient to protect the provider.  Though the only part of the
provider this locking protects now is its statistics.

Reported by: Arka Sharma <arka.sw1988@gmail.com>
MFC after: 2 weeks

2 years agoFix coredump_phnum test with ASLR enabled by default
Ed Maste [Sun, 21 Nov 2021 17:17:20 +0000 (12:17 -0500)]
Fix coredump_phnum test with ASLR enabled by default

coredump_phnum intends to generate a core file with many PT_LOAD
segments.  Previously it called mmap() in a loop with alternating
protections, relying on each mapping following the previous, to produce
a core file with many page-sized PT_LOAD segments.  With ASLR on we no
longer have this property of each mmap() following the previous.

Instead, perform a single allocation, and then use mprotect() to set
alternating pages to PROT_READ.

PR: 259970
Reported by: lwhsu, mw
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33070

2 years agoloader: abstract boot services exiting to libefi function
Warner Losh [Sun, 21 Nov 2021 16:05:07 +0000 (09:05 -0700)]
loader: abstract boot services exiting to libefi function

Move direct call of ExitBootServices to efi_exit_boot_services.  This
function sets boot_services_active to false so callers don't have to do
it everywhere (though currently only loader/bootinfo.c is affected).

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

2 years agodevmatch: Allow devmatch_blocklist to be set in kenv too
Warner Losh [Sun, 21 Nov 2021 15:50:51 +0000 (08:50 -0700)]
devmatch: Allow devmatch_blocklist to be set in kenv too

Add in all the variables set in the kenv variable devmatch_blocklist
too. This allows blocking autoloading from the boot loader.

Sponsored by: Netflix
Reviewed by: 0mp
Differential Revision: https://reviews.freebsd.org/D32171

2 years agompr: fix freeze / release mismatch in timeout code
Warner Losh [Sun, 21 Nov 2021 15:50:46 +0000 (08:50 -0700)]
mpr: fix freeze / release mismatch in timeout code

So, if we're processing a timeout, and we've sent an ABORT to the
firmware for that timeout, but not yet received the response from the
firmware, AND we get another timeout, we queue the timeout and freeze
the queue. However, when we've finally processed them all, we only
release the queue once. This causes all I/O to halt as the devq remains
frozen forever.

Instead, only freeze the queue when we start the process (eg set INRESET
on the target). This will allow the release when all the timed out I/Os
have finished ABORTing.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D33054

2 years agomkimg: zero entry in vhdx_write_metadata
Ed Maste [Sun, 21 Nov 2021 00:29:11 +0000 (19:29 -0500)]
mkimg: zero entry in vhdx_write_metadata

Otherwise _reserved might contain uninitialized data.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agossh: mention nanobsd config files in upgrade instructions
Ed Maste [Sat, 20 Nov 2021 21:22:28 +0000 (16:22 -0500)]
ssh: mention nanobsd config files in upgrade instructions

Sponsored by: The FreeBSD Foundation

2 years agomount: retire kernel_vmount()
Robert Wing [Sat, 20 Nov 2021 19:22:28 +0000 (10:22 -0900)]
mount: retire kernel_vmount()

The last usage of this function was removed in e3b1c847a4237ad9.

There are no in-tree consumers of kernel_vmount().

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D32607

2 years agoif_stf: minor man page improvements
Kristof Provost [Wed, 17 Nov 2021 22:12:14 +0000 (23:12 +0100)]
if_stf: minor man page improvements

- fix typo (router -> routers)
- Remove 6bone reference, because that was phased out in 2006.

Suggested by: Pau Amma <pauamma@gundo.com>
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33046

2 years agoif_stf: document 6rd in the man page
Kristof Provost [Wed, 17 Nov 2021 00:13:17 +0000 (01:13 +0100)]
if_stf: document 6rd in the man page

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

2 years agonet tests: fix if_stf:6to4
Kristof Provost [Wed, 10 Nov 2021 11:02:34 +0000 (12:02 +0100)]
net tests: fix if_stf:6to4

This test needs to have the loopback interface enabled, or route lookups
for our own IP addresses will fail.

MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33041

2 years agonet tests: 6rd to 6rd test
Kristof Provost [Tue, 9 Nov 2021 17:46:22 +0000 (18:46 +0100)]
net tests: 6rd to 6rd test

Test traffic between 6rd hosts, without border relay involvement.

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

2 years agonet tests: 6rd test for if_stf
Kristof Provost [Tue, 9 Nov 2021 15:06:16 +0000 (16:06 +0100)]
net tests: 6rd test for if_stf

Basic test case for 6rd.

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

2 years agoif_stf: add dtrace probe points
Kristof Provost [Tue, 9 Nov 2021 15:28:07 +0000 (16:28 +0100)]
if_stf: add dtrace probe points

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

2 years agoif_stf: add 6rd support
Kristof Provost [Mon, 8 Nov 2021 08:46:47 +0000 (09:46 +0100)]
if_stf: add 6rd support

Implement IPv6 Rapid Deployment (RFC5969) on top of the existing 6to4
(RFC3056) if_stf code.

PR: 253328
Reviewed by: hrs
Obtained from: pfSense
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33037

2 years agoBelatedly update contrib/llvm-project/FREEBSD-Xlist for llvm 13
Dimitry Andric [Sat, 20 Nov 2021 17:06:36 +0000 (18:06 +0100)]
Belatedly update contrib/llvm-project/FREEBSD-Xlist for llvm 13

MFC after:      2 weeks

2 years agozfs: Fix a deadlock between page busy and the teardown lock
Mark Johnston [Sat, 20 Nov 2021 16:21:25 +0000 (11:21 -0500)]
zfs: Fix a deadlock between page busy and the teardown lock

When rolling back a dataset, ZFS has to purge file data resident in the
system page cache.  To do this, it loops over all vnodes for the
mountpoint and calls vn_pages_remove() to purge pages associated with
the vnode's VM object.  Each page is thus exclusively busied while the
dataset's teardown write lock is held.

When handling a page fault on a mapped ZFS file, FreeBSD's page fault
handler busies newly allocated pages and then uses VOP_GETPAGES to fill
them.  The ZFS getpages VOP acquires the teardown read lock with vnode
pages already busied.  This represents a lock order reversal which can
lead to deadlock.

To break the deadlock, observe that zfs_rezget() need only purge those
pages marked valid, and that pages busied by the page fault handler are,
by definition, invalid.  Furthermore, ZFS pages always transition from
invalid to valid with the teardown lock held, and ZFS never creates
partially valid pages.  Thus, zfs_rezget() can use the new
vn_pages_remove_valid() to skip over pages busied by the fault handler.

PR: 258208
Tested by: pho
Reviewed by: avg, sef, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32931

2 years agorc.d/rctl: unbreak for distinct /usr filesystem
Eugene Grosbein [Sat, 20 Nov 2021 08:54:39 +0000 (15:54 +0700)]
rc.d/rctl: unbreak for distinct /usr filesystem

Both rctl and used xargs utility live in /usr/bin
so add REQUIRE: FILESYSTEMS

Reported by: Peter <pmc@citylink.dinoex.sub.org>
MFC after: 3 days

2 years agomixer: make .Dt tags uppercase
Christos Margiolis [Sat, 20 Nov 2021 07:58:36 +0000 (08:58 +0100)]
mixer: make .Dt tags uppercase

The document title should be uppercase in man pages.

Reviewed by: imp, gbe
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D33027

2 years agohyperv: Register the MSR-based timecounter during SI_SUB_HYPERVISOR
Mark Johnston [Fri, 19 Nov 2021 22:30:05 +0000 (17:30 -0500)]
hyperv: Register the MSR-based timecounter during SI_SUB_HYPERVISOR

This reverts commit 9ef7df022a46 ("hyperv: Register hyperv_timecounter
later during boot") and adds a comment explaining why the timecounter
needs to be registered as early as it is.

PR: 259878
Fixes: 9ef7df022a46 ("hyperv: Register hyperv_timecounter later during boot")
Reviewed by: kib
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33014

2 years agotimecounter: Initialize tc_lock earlier
Mark Johnston [Fri, 19 Nov 2021 22:29:28 +0000 (17:29 -0500)]
timecounter: Initialize tc_lock earlier

Hyper-V wants to register its MSR-based timecounter during
SI_SUB_HYPERVISOR, before SI_SUB_LOCK, since an emulated 8254 may not be
available for DELAY().  So we cannot use MTX_SYSINIT to initialize the
timecounter lock.

PR: 259878
Reviewed by: kib
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33014

2 years agolagg: fix unused-but-set-variable
Kristof Provost [Fri, 19 Nov 2021 16:22:48 +0000 (17:22 +0100)]
lagg: fix unused-but-set-variable

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoAllow minidumps to be performed on the live system
Mitchell Horne [Wed, 17 Nov 2021 15:35:59 +0000 (11:35 -0400)]
Allow minidumps to be performed on the live system

Add a boolean parameter to minidumpsys(), to indicate a live dump. When
requested, take a snapshot of important global state, and pass this to
the machine-dependent minidump function. For now this includes the
kernel message buffer, and the bitset of pages to be dumped. Beyond
this, we don't take much action to protect the integrity of the dump
from changes in the running system.

A new function msgbuf_duplicate() is added for snapshotting the message
buffer. msgbuf_copy() is insufficient for this purpose since it marks
any new characters it finds as read.

For now, nothing can actually trigger a live minidump. A future patch
will add the mechanism for this. For simplicity and safety, live dumps
are disallowed for mips.

Reviewed by: markj, jhb
MFC after: 2 weeks
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D31993

2 years agominidump: Use the provided dump bitset
Mitchell Horne [Wed, 17 Nov 2021 15:35:18 +0000 (11:35 -0400)]
minidump: Use the provided dump bitset

When constructing the set of dumpable pages, use the bitset provided by
the state argument, rather than assuming vm_page_dump invariably. For
normal kernel minidumps this will be a pointer to vm_page_dump, but when
dumping the live system it will not.

To do this, the functions in vm_dumpset.h are extended to accept the
desired bitset as an argument. Note that this provided bitset is assumed
to be derived from vm_page_dump, and therefore has the same size.

Reviewed by: kib, markj, jhb
MFC after: 2 weeks
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D31992

2 years agominidump: Use provided msgbuf pointer
Mitchell Horne [Wed, 17 Nov 2021 15:34:13 +0000 (11:34 -0400)]
minidump: Use provided msgbuf pointer

Don't assume we are dumping the global message buffer, but use the one
provided by the state argument. While here, drop superfluous
cast to char *.

Reviewed by: markj, jhb
MFC after: 2 weeks
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D31991

2 years agominidump: reduce the amount direct accesses to page tables
Mitchell Horne [Wed, 17 Nov 2021 15:30:43 +0000 (11:30 -0400)]
minidump: reduce the amount direct accesses to page tables

During a live dump, we may race with updates to the kernel page tables.
This is generally okay; we accept that the state of the system while
dumping may be somewhat inconsistent with its state when the dump was
invoked. However, when walking the kernel page tables, it is important
that we load each PDE/PTE only once while operating on it. Otherwise, it
is possible to have the relevant PTE change underneath us. For example,
after checking the valid bit, but before reading the physical address.

Convert the loads to atomics, and add some validation around the
physical addresses, to ensure that we do not try to dump a non-existent
or non-canonical physical address.

Similarly, don't read kernel_vm_end more than once, on the off chance
that pmap_growkernel() is called between the two page table walks.

Reviewed by: kib, markj
MFC after: 2 weeks
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D31990

2 years agoamd64: provide PHYS_IN_DMAP() and VIRT_IN_DMAP()
Mitchell Horne [Wed, 17 Nov 2021 15:29:02 +0000 (11:29 -0400)]
amd64: provide PHYS_IN_DMAP() and VIRT_IN_DMAP()

It is useful for quickly checking an address against the DMAP region.
These definitions exist already on arm64 and riscv.

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

2 years agominidump: Parameterize minidumpsys()
Mitchell Horne [Wed, 17 Nov 2021 15:26:59 +0000 (11:26 -0400)]
minidump: Parameterize minidumpsys()

The minidump code is written assuming that certain global state will not
change, and rightly so, since it executes from a kernel debugger
context. In order to support taking minidumps of a live system, we
should allow copies of relevant global state that is likely to change to
be passed as parameters to the minidumpsys() function.

This patch does the work of parameterizing this function, by adding a
struct minidumpstate argument. For now, this struct allows for copies of
the kernel message buffer, and the bitset that tracks which pages should
be dumped (vm_page_dump). Follow-up changes will actually make use of
these arguments.

Notably, dump_avail[] does not need a snapshot, since it is not expected
to change after system initialization.

The existing minidumpsys() definitions are renamed, and a thin MI
wrapper is added to kern_dump.c, which handles the construction of
the state struct. Thus, calling minidumpsys() remains as simple as
before.

Reviewed by: kib, markj, jhb
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D31989

2 years agolpr(1): Fix a typo in a source code comment
Gordon Bergling [Fri, 19 Nov 2021 19:04:09 +0000 (20:04 +0100)]
lpr(1): Fix a typo in a source code comment

-s /debuging/debugging/

MFC after: 3 days

2 years agoixl(4): Fix a typo in a sysctl description
Gordon Bergling [Fri, 19 Nov 2021 18:59:28 +0000 (19:59 +0100)]
ixl(4): Fix a typo in a sysctl description

MFC after: 3 days

2 years agoiwm(4): Fix a typo in a source code comment
Gordon Bergling [Fri, 19 Nov 2021 18:51:55 +0000 (19:51 +0100)]
iwm(4): Fix a typo in a source code comment

- s/availabe/available/

MFC after: 3 days

2 years agofirewire(4): Fix a typo in a source code comment
Gordon Bergling [Fri, 19 Nov 2021 18:50:56 +0000 (19:50 +0100)]
firewire(4): Fix a typo in a source code comment

- s/unavailabe/unavailable/

MFC after: 3 days

2 years agoiscsi(4): Fix a typo in a source code comment
Gordon Bergling [Fri, 19 Nov 2021 18:29:21 +0000 (19:29 +0100)]
iscsi(4): Fix a typo in a source code comment

- s/conditon/condition/

MFC after: 3 days

2 years agoTWL: Fix a typo in a source code comment
Gordon Bergling [Fri, 19 Nov 2021 18:26:34 +0000 (19:26 +0100)]
TWL: Fix a typo in a source code comment

- s/maxium/maximum/

MFC after: 3 days

2 years agoppbus(4): Fix a typo in source code comment
Gordon Bergling [Fri, 19 Nov 2021 18:19:36 +0000 (19:19 +0100)]
ppbus(4): Fix a typo in source code comment

- s/quering/querying/

Obtained from: NetBSD
MFC after: 3 days

2 years agoffs_softdep: Fix a typo in a source code comment
Gordon Bergling [Fri, 19 Nov 2021 18:17:41 +0000 (19:17 +0100)]
ffs_softdep: Fix a typo in a source code comment

- s/conditonally/conditionally/

MFC after: 3 days

2 years agocc_newreno(4): Fix a typo in a source code comment
Gordon Bergling [Fri, 19 Nov 2021 18:16:02 +0000 (19:16 +0100)]
cc_newreno(4): Fix a typo in a source code comment

- s/conditons/conditions/

MFC after: 3 days

2 years agosched_ule(4): Fix two typo in source code comments
Gordon Bergling [Fri, 19 Nov 2021 18:13:28 +0000 (19:13 +0100)]
sched_ule(4): Fix two typo in source code comments

- s/conditons/conditions/
- s/unconditonally/unconditionally/

MFC after: 3 days

2 years agoUse a builtin where possible in msun
Andrew Turner [Tue, 2 Nov 2021 11:31:17 +0000 (11:31 +0000)]
Use a builtin where possible in msun

Some of the functions in msun can be implemented using a compiler
builtin function to generate a small number of instructions. Implement
this support in fma, fmax, fmin, and sqrt on arm64.

Care must be taken as the builtin can be implemented as a function
call on some architectures that lack direct support. In these cases
we need to use the original code path.

As we don't set errno on failure build with -fno-math-errno so the
toolchain doesn't convert a builtin into a function call when it
detects a failure, e.g. gcc will add a call to sqrt when the input
is negative leading to an infinite loop.

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

2 years agoSwitch to Arm Optimized Routines for mem* & str*
Andrew Turner [Mon, 1 Nov 2021 13:06:56 +0000 (13:06 +0000)]
Switch to Arm Optimized Routines for mem* & str*

These are the updated version of the older Cortex Strings Library we
previously used. The Arm Optimized Routines also support CPU features
that are currently in development on FreeBSD, e.g. Branch Target
Identification (BTI). Rather than add BTI support to the old code it's
easier to just use the maintained version.

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

2 years agouuid(3): Document return values
Felix Johnson [Fri, 19 Nov 2021 08:42:49 +0000 (03:42 -0500)]
uuid(3): Document return values

PR: 204449
MFC after: 3 days
Reported by: Michael Cress <michael.cress@cress.us>

2 years agoiflib_stop: drain rx tasks to prevent any data races
Andriy Gapon [Fri, 19 Nov 2021 07:56:30 +0000 (09:56 +0200)]
iflib_stop: drain rx tasks to prevent any data races

iflib_stop modifies iflib data structures that are used by _task_fn_rx,
most prominently the free lists.  So, iflib_stop has to ensure that the
rx task threads are not active.

This should help to fix a crash seen when iflib_if_ioctl (e.g.,
SIOCSIFCAP) is called while there is already traffic flowing.

The crash has been seen on VMWare guests with vmxnet3 driver.

My guess is that on physical hardware the couple of 1ms delays that
iflib_stop has after disabling interrupts are enough for the queued work
to be completed before any iflib state is touched.

But on busy hypervisors the guests might not get enough CPU time to
complete the work, thus there can be a race between the taskqueue
threads and the work done to handle an ioctl, specifically in iflib_stop
and iflib_init_locked.

PR: 259458
Reviewed by: markj
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D32926

2 years agoRevert "Bootstrap: Prune building from pre-FreeBSD 11 support"
Warner Losh [Fri, 19 Nov 2021 07:10:21 +0000 (00:10 -0700)]
Revert "Bootstrap: Prune building from pre-FreeBSD 11 support"

This reverts commit a420a672bc53bd3928626aa5d0ec5b41c0471356.

kevans pointed out some potential problems here, so reverting until
I can fix them.

2 years agoCorrect the name of the second parameter of biowait to wmesg
Wuyang Chung [Sun, 17 Oct 2021 03:25:27 +0000 (11:25 +0800)]
Correct the name of the second parameter of biowait to wmesg

This parameter is passed directly to msleep, and the name of the msleep
parameter is wmesg. Make them match.

Pull Request: https://github.com/freebsd/freebsd-src/pull/557

2 years agoFix 'take effect' spelling in menus and comments.
betterentley [Fri, 12 Nov 2021 21:55:27 +0000 (16:55 -0500)]
Fix 'take effect' spelling in menus and comments.

Signed-off-by: John Bentley <johnbentley.public@gmail.com>
Pull Request: https://github.com/freebsd/freebsd-src/pull/559

2 years agogeom: Remove g_class.config
Wuyang Chung [Sat, 16 Oct 2021 01:43:54 +0000 (09:43 +0800)]
geom: Remove g_class.config

g_class.config is write only, remove it.

2 years agoBootstrap: Prune building from pre-FreeBSD 11 support
Warner Losh [Sun, 10 Oct 2021 17:28:54 +0000 (11:28 -0600)]
Bootstrap: Prune building from pre-FreeBSD 11 support

We don't need to bootstrap lex or md4 anymore.
Cat doesn't need to be bootstrapped (but is needed for buildkernel)
cruncgen doesn't need to be bootstrapped at all.
kbdcontrol isn't needed

Sponsored by: Netflix
Pull Request: https://github.com/freebsd/freebsd-src/pull/554

2 years agorelease/packages/Makefile.package: Fix typo
Elyes HAOUAS [Sat, 6 Nov 2021 11:59:36 +0000 (12:59 +0100)]
release/packages/Makefile.package: Fix typo

"librairies" --> "libraries"

Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Pull Request: https://github.com/freebsd/freebsd-src/pull/553

2 years agoFix typo on "Celsius"
Elyes HAOUAS [Wed, 6 Oct 2021 15:32:15 +0000 (17:32 +0200)]
Fix typo on "Celsius"

"Celcius" --> "Celsius"

Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Pull Request: https://github.com/freebsd/freebsd-src/pull/551/files

2 years agonanobsd/rescue: Catch up to 20210907 OpenSSH import
Warner Losh [Fri, 19 Nov 2021 05:54:54 +0000 (22:54 -0700)]
nanobsd/rescue: Catch up to 20210907 OpenSSH import

Sponsored by: Netflix

2 years agonanobsd: remove psuedo-terminals from ttys
Warner Losh [Fri, 19 Nov 2021 05:49:13 +0000 (22:49 -0700)]
nanobsd: remove psuedo-terminals from ttys

Yowsa! Another review mentioned this in passing... Only 10 years late.

Sponsored by: Netflix

2 years agoNanoBSD/rescue: Update to 20200214 OpenSSH configuration files
Jose Luis Duran [Fri, 16 Jul 2021 17:17:30 +0000 (14:17 -0300)]
NanoBSD/rescue: Update to 20200214 OpenSSH configuration files

No functional change intended.

2 years agoANSIify libsa functions
Alfonso [Wed, 7 Jul 2021 14:52:21 +0000 (10:52 -0400)]
ANSIify libsa functions

Convert libsa files to use ANSI function definitions.

Pull request: https://github.com/freebsd/freebsd-src/pull/508
[ cut and paste error corrected ]

2 years agoAdd tcp_freecb() - single place to free tcpcb.
Gleb Smirnoff [Fri, 19 Nov 2021 04:26:09 +0000 (20:26 -0800)]
Add tcp_freecb() - single place to free tcpcb.

Until this change there were two places where we would free tcpcb -
tcp_discardcb() in case if all timers are drained and tcp_timer_discard()
otherwise.  They were pretty much copy-n-paste, except that in the
default case we would run tcp_hc_update().  Merge this into single
function tcp_freecb() and move new short version of tcp_timer_discard()
to tcp_timer.c and make it static.

Reviewed by: rrs, hselasky
Differential revision: https://reviews.freebsd.org/D32965