]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agofdt: Expose the model, compatible and freebsd dts brandind as sysctl
Emmanuel Vadot [Sat, 17 Jul 2021 15:19:22 +0000 (17:19 +0200)]
fdt: Expose the model, compatible and freebsd dts brandind as sysctl

This make it easier for script to get the hardware on which they are running.

MFC after: 1 month
Sponsored by: Diablotin Systems
Differential Revision:   https://reviews.freebsd.org/D31205
Reviewed by:    imp
Should be ok on powerpc:  jhibbits (over irc)

2 years agomlx5en: vxlan: do not report TCP inner packet as UDP for software parser
Konstantin Belousov [Thu, 22 Jul 2021 11:53:30 +0000 (14:53 +0300)]
mlx5en: vxlan: do not report TCP inner packet as UDP for software parser

Reviewed by: hselasky
Sponsored by: Mellanox Technologies // NVIDIA Networking
MFC after: 1 week

2 years agoports.7: catchup with the package extension name since pkg 1.17
Baptiste Daroussin [Thu, 22 Jul 2021 08:49:45 +0000 (10:49 +0200)]
ports.7: catchup with the package extension name since pkg 1.17

MFC After: 3 days

2 years agopkgbase: Track pkg 1.17
Emmanuel Vadot [Tue, 4 May 2021 13:39:55 +0000 (15:39 +0200)]
pkgbase: Track pkg 1.17

With pkg 1.17 the extention is always .pkg, packing_format is also now deprecated.

2 years agoRemove manpages from OLD_FILES
Fernando Apesteguía [Wed, 21 Jul 2021 09:21:14 +0000 (11:21 +0200)]
Remove manpages from OLD_FILES

Remove apm.8 and apmconf.8 from OLD_FILES in the relevant Makefiles.

These pages are now installed unconditionally as per 0a0f7486413c

PR: 257228
Reported by: yasu@utahime.org, wosch@
Approved by: imp@, wosch@
Fixes: 0a0f7486413c - Build manpages for all architectures
MFH: 4 weeks
Differential Revision: https://reviews.freebsd.org/D31256

2 years agoawk: Remove last markings we have on awk
Warner Losh [Thu, 22 Jul 2021 02:24:57 +0000 (20:24 -0600)]
awk: Remove last markings we have on awk

We normally don't add $FreeBSD$ to contrib software. However, these
changes date back to the CVS era of source code management and have been
overlooked. Now that all these files are back to the same as the
upstream bsd-features branch, remove the FreeBSD specific changes, which
are now just $FreeBSD$ and the (FreeBSD) in the version string.

MFC After: 2 weeks
Sponsored by: Netflix

2 years agoawk: revert to upstream behavior for ranges for gawk compatibility
Warner Losh [Thu, 22 Jul 2021 02:22:43 +0000 (20:22 -0600)]
awk: revert to upstream behavior for ranges for gawk compatibility

In 2005, FreeBSD changed one-true-awk to honor the locale's collating
order. This was billed as a temporary patch. It was also compatible with
the then-current behavior of gawk. That temporary patch has lasted 16
years now.

However, IEEE Std 1003.1-2008 changed the behaivor of ranges in regular
expressions outside of the "C" and "POSIX" locales to be undefined.

Starting in 2011, gawk 4.0 stopped using the locale for the range
regular expressions and used the traditional behavior only. The
maintainer had grown weary of answering why '[A-Z]' would sometimes
match lower-case expressions. The details about are explained here:
https://www.gnu.org/software/gawk/manual/html_node/Ranges-and-Locales.html

To restore compatibility with other implementaitons of awk, revert this
patch. FreeBSD is the odd-system out. It also has the nice side effect
of eliminating the last of our differences with upstream one-true-awk.

Reviewed by: cy, rgrimes
MFC After: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D31114

2 years agoRevert "awk: Issue a warning for old hex behavior."
Warner Losh [Thu, 22 Jul 2021 02:17:50 +0000 (20:17 -0600)]
Revert "awk: Issue a warning for old hex behavior."

This reverts commit acf9cf323f8d0c844ea4a0fedeb596871794a078. It warns
about too many false positive cases.

Sponsored by: Netflix

2 years agotype: becauce -> because
Warner Losh [Thu, 22 Jul 2021 02:02:44 +0000 (20:02 -0600)]
type: becauce -> because

Noticed by: Piotr P. Stefaniak
Sponsored by: Netflix

2 years agoawk: Issue a warning for old hex behavior.
Warner Losh [Tue, 20 Jul 2021 04:39:26 +0000 (22:39 -0600)]
awk: Issue a warning for old hex behavior.

Since FreeBSD has allowed "0x" hex strings to be converted to integers
for a long time, and since upstream has killed that behavior, warn about
this issue. This will allow us to deprecate this behavior for 14.0 while
giving our users of 12.x and 13.x fair warning.

Sponsored by: Netflix

2 years agotuntap: clean up cc --analyze
Kyle Evans [Thu, 22 Jul 2021 00:13:48 +0000 (19:13 -0500)]
tuntap: clean up cc --analyze

One complaint of a dead-store, smack it with a __diagused.

2 years agolibpmc/hwpmc: fix issues with arm64 pmu-events support
Mitchell Horne [Wed, 21 Jul 2021 22:59:27 +0000 (19:59 -0300)]
libpmc/hwpmc: fix issues with arm64 pmu-events support

Due to a mis-merge, the changes committed to libpmc never called
pmu_parse_event(), or set pm->pm_ev. However, this field shouldn't be
used to carry the actual pmc event code anyway, as it is expected to
contain the index into the pmu event array (otherwise, it breaks event
name lookup in pmclog_get_event()). Add a new MD field,
pm_md.pm_md_config, to pass the raw event code to arm64_allocate_pmc().

Additionally, the change made to pmc_md_op_pmcallocate was incorrect, as
this is a union, not a struct. Restore the proper padding size.

Reviewed by: luporl, ray, andrew
Fixes: 28dd6730a5d6 ("libpmc: enable pmu_utils on arm64")
Fixes: 8cc3815f02be ("hwpmc_arm64: accept raw event codes...")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31221

2 years agoFix race between first rand(3) calls with _once().
Alexander Motin [Wed, 21 Jul 2021 15:25:46 +0000 (11:25 -0400)]
Fix race between first rand(3) calls with _once().

Before this patch there was a chance for thread that called rand(3)
slightly later to see rand3_state already allocated, but not yet
initialized.  While this API is not expected to be thread-safe, it
is not expected to crash.  ztest on 64-thread system reproduced it
reliably for me.

Submitted by: avg@
MFC after: 1 month

2 years agoRevert "Fix race between first rand(3) calls."
Alexander Motin [Wed, 21 Jul 2021 14:50:14 +0000 (10:50 -0400)]
Revert "Fix race between first rand(3) calls."

It is going to be reimplemented with _once().

This reverts commit 28d70deaafa62c5d1602de5272c0aad0fcca8aff.

MFC after: 1 month

2 years agokern: mountroot: avoid fd leak in .md parsing
Kyle Evans [Tue, 20 Jul 2021 10:23:11 +0000 (05:23 -0500)]
kern: mountroot: avoid fd leak in .md parsing

parse_dir_md() opens /dev/mdctl but only closes the resulting fd on
success, not upon failure of the ioctl or when we exceed the md unit
max.

Reviewed by: kib (slightly previous version)
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
X-NetApp-PR: #62
Differential Revision: https://reviews.freebsd.org/D31229

2 years agoarm64: Print CPU features slightly earlier
Mark Johnston [Tue, 20 Jul 2021 16:06:01 +0000 (12:06 -0400)]
arm64: Print CPU features slightly earlier

In particular, print them before we release APs.  Otherwise they tend to
get mixed with other kernel messages.

Reviewed by: andrew, manu
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31242

2 years agoRegen after 2561da0636c.
Edward Tomasz Napierala [Wed, 21 Jul 2021 12:26:31 +0000 (12:26 +0000)]
Regen after 2561da0636c.

2 years agolinux: Fix declaration of rt_sigreturn() on arm64
Edward Tomasz Napierala [Wed, 21 Jul 2021 12:20:45 +0000 (12:20 +0000)]
linux: Fix declaration of rt_sigreturn() on arm64

On Linux, this syscall doesn't take any arguments; instead
it assumes the context was put on the stack.

Reviewed By: dchagin
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D31251

2 years agocam: clear stack-allocated CCB in the target layer
Edward Tomasz Napierala [Wed, 21 Jul 2021 09:18:15 +0000 (10:18 +0100)]
cam: clear stack-allocated CCB in the target layer

Note that, as pointed out by scottl@, this code should really look
a bit different, in that the stack allocations should be replaced
with dynamic allocation, and the periph creation should be moved
to a context where one can use M_WAITOK.  See the review for more
details.  For now let's go with a minimal fix until we're done with
UMA CCBs.

Reviewed By: mav, imp
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D30298

2 years agochroot: fix typo in usage
Edward Tomasz Napierala [Wed, 21 Jul 2021 09:16:11 +0000 (10:16 +0100)]
chroot: fix typo in usage

While here also fix typo in a variable name.

Reported By: oshogbo

2 years agosesutil: Fix status checking
Edward Tomasz Napierala [Wed, 21 Jul 2021 09:14:21 +0000 (10:14 +0100)]
sesutil: Fix status checking

Previously we would display "OK, Swapped" for swapped disks,
instead of the usual disk size.

Reviewed By: allanjude
Differential Revision: https://reviews.freebsd.org/D31219

2 years agoUpdate the mlx5en(4) manual page.
Hans Petter Selasky [Tue, 20 Jul 2021 16:00:13 +0000 (18:00 +0200)]
Update the mlx5en(4) manual page.

Differential Revision: https://reviews.freebsd.org/D31228
Reviewed by: kib@
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoImplement the SOUND_MIXER_WRITE_MUTE and SOUND_MIXER_READ_MUTE ioctl(9)s.
Hans Petter Selasky [Tue, 20 Jul 2021 17:02:41 +0000 (19:02 +0200)]
Implement the SOUND_MIXER_WRITE_MUTE and SOUND_MIXER_READ_MUTE ioctl(9)s.

These two ioctls are not part of the current version of OSS and were
considered obsolete. However, their behaviour is not the same as their
old one, so this implementation is specific to FreeBSD.

Older OSS versions had the MUTE ioctls take and return an integer with
a value of 0 or 1, which meant that the _whole_ mixer is unmuted or
muted respectively. In my implementation, the ioctl takes and returns
a bitmask that tells us which devices are muted.

This allows us to mute and unmute only the devices we want, instead of the
whole mixer. The bitmask works the same way as in DEVMASK, RECMASK and
RECSRC.

Integrated the hardware volume feature with the new mute system.

Submitted by: Christos Margiolis <christos@freebsd.org>
Differential Revision: https://reviews.freebsd.org/D31130
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoriscv: Include spibus and spigen in GENERIC
Jessica Clarke [Wed, 21 Jul 2021 05:46:09 +0000 (06:46 +0100)]
riscv: Include spibus and spigen in GENERIC

We already attempt to enable the SiFive SPI controller, but since spibus
isn't enabled it isn't actually built.

Reviewed by: kp, philip
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31027

2 years agopci_dw: Detect number of outbound regions automatically
Jessica Clarke [Wed, 21 Jul 2021 04:51:20 +0000 (05:51 +0100)]
pci_dw: Detect number of outbound regions automatically

Currently we use the num-viewports property to decide how many outbound
regions there are we can use, defaulting to 2. However, Linux has
stopped using that and so it no longer appears in new device trees, such
as for the SiFive FU740. Instead, it's possible to just probe the
hardware directly.

Reviewed by: mmel
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31030

2 years agopci_dw: Support modern "unroll" iATU mode
Jessica Clarke [Wed, 21 Jul 2021 04:50:50 +0000 (05:50 +0100)]
pci_dw: Support modern "unroll" iATU mode

This supersedes the old legacy mode where a viewport register was used
to mux multiple regions behind a single set of registers, and is used on
the SiFive FU740.

Reviewed by: mmel
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31029

2 years agopci_dw: Support multiple memory windows
Jessica Clarke [Wed, 21 Jul 2021 04:50:24 +0000 (05:50 +0100)]
pci_dw: Support multiple memory windows

Currently we assume there is only one memory and one prefetch memory
window, and ignore the latter. However, the SiFive FU740 has two normal
memory windows.

As part of this, the viewports are rearranged. Previously the viewports
were memory, config then optionally I/O. Both to simplify the config
index calculation and to ensure it can always be mapped even if we have
too many memory windows for the number of viewports, config is moved to
being the first viewport.

This generalisation now also naturally supports mapping prefetch memory
windows.

Reviewed by: mmel
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31028

2 years agoMakefile: Fix MAKEOBJDIRPREFIX command-line variable check for bmake
Jessica Clarke [Wed, 21 Jul 2021 01:48:10 +0000 (02:48 +0100)]
Makefile: Fix MAKEOBJDIRPREFIX command-line variable check for bmake

Unlike the old fmake, running make FOO=bar when using bmake doesn't put
FOO=bar in .MAKEFLAGS at the top level, it instead just puts FOO in
.MAKEOVERRIDES and the full MAKEFLAGS will be formed for sub-makes.
Moreover, this only applies for sub-makes in rules, so this doesn't
apply to those in shell assignments. This means that the current check
does not catch make MAKEOBJDIRPREFIX=..., only those defined in config
files. Thus we must also check .MAKEOVERRIDES explicitly.

Reviewed by: sjg
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31015

2 years agoriscv: Fix pindex level confusion
Jessica Clarke [Wed, 21 Jul 2021 01:47:01 +0000 (02:47 +0100)]
riscv: Fix pindex level confusion

The pindex values are assigned from the L3 leaves upwards, meaning there
are NUL2E L3 tables and then NUL1E L2 tables (with a futher NUL0E L1
tables in future when we implement Sv48 support). Therefore anything
below NUL2E is an L3 table's page and anything above or equal to NUL2E
is an L2 table's page (with the threshold of NUL2E + NUL1E marking the
start of the L1 tables' pages in Sv48). Thus all the comparisons and
arithmetic operations must use NUL2E to handle the L3/L2 allocation (and
thus L2/L1 entry) transition point, not NUL1E as all but pmap_alloc_l2
were doing.

To make matters confusing, the NUL1E and NUL2E definitions in the RISC-V
pmap are based on a 4-level page hierarchy but we currently use the
3-level Sv39 format (as that's the only required one, and hardware
support for the 4-level Sv48 is not widespread). This means that, in
effect, the above bug cancels out with the bloated NULxE definitions
such that things "work" (but are still technically wrong, and thus would
break when adding Sv48 support), with one exception. pmap_enter_l2 is
currently the only function to use the correct constant, but since
_pmap_alloc_l3 uses the incorrect constant, it will do complete nonsense
when it needs to allocate a new L2 table (which is rather rare). In this
instance, _pmap_alloc_l3, whilst it would correctly determine the pindex
was for an L2 table, would only subtract NUL1E when computing l1index
and thus go way out of bounds (by 511*512*512 bytes, or 127.75 GiB) of
its own L1 table and, thanks to pmap_distribute_l1, of every other
pmap's L1 table in the whole system. This has likely never been hit as
it would presumably instantly fault and panic.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31087

2 years agosifive_uart: Fix input character dropping in ddb and at a mountroot prompt
Jessica Clarke [Wed, 21 Jul 2021 01:45:48 +0000 (02:45 +0100)]
sifive_uart: Fix input character dropping in ddb and at a mountroot prompt

These use the raw console interface and poll. Unfortunately, the SiFive
UART puts the FIFO empty bit inside the FIFO data register, which means
that the act of checking whether a character is available also dequeues
any character from the FIFO, requiring the user to press each key twice.
However, since we configure the watermark to be 0 and, when the UART has
been grabbed for the console, we have interrupts off, we can abuse the
interrupt pending register to act as a substitute for the FIFO empty
bit.

This perhaps suggests that the console interface should move from having
rxready and getc to having getc_nonblock and getc (or make getc take a
bool), as all the places that call rxready do so to avoid blocking on
getc when there is no character available.

Reviewed by: kp, philip
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31025

2 years agocgem: Add support for the SiFive FU740
Jessica Clarke [Wed, 21 Jul 2021 01:44:38 +0000 (02:44 +0100)]
cgem: Add support for the SiFive FU740

Note that currently Linux's device tree uses the FU540's compatible
string, as does upstream U-Boot, but the U-Boot shipped with the board
based on an older patch series has the correct FU740 name. Thankfully
they are the same, at least as far as software is concerned.

Whilst here, fix a style(9) nit.

Reviewed by: philip, kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31034

2 years agoriscv: Implement missing nexus methods
Jessica Clarke [Wed, 21 Jul 2021 01:28:20 +0000 (02:28 +0100)]
riscv: Implement missing nexus methods

This is required for the SiFive FU740's PCIe controller. Copied from
arm64 with the only difference being changing pmap_mapdev_attr to
pmap_mapdev as riscv only has the latter.

Reviewed by: mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31032

2 years agogeom_label: Partially reinstate old sysinstall(8) workaround
Jessica Clarke [Wed, 21 Jul 2021 01:24:55 +0000 (02:24 +0100)]
geom_label: Partially reinstate old sysinstall(8) workaround

This partially reverts commit af433832f7520840c22edd1fe1266c1a5cb781ad.
Since such bogus disklabels still exist in the wild, we now probe for a
disklabel to decide whether to ignore the UFS partition or not; if there
is a label then we use the old behaviour, and if there isn't one then we
use the new behaviour.

Reviewed by: cy, mckusick
Differential Revision: https://reviews.freebsd.org/D31068

2 years agoarm: Bump KSTACK_PAGES default to match i386/amd64
Kevin Bowling [Wed, 21 Jul 2021 01:35:54 +0000 (18:35 -0700)]
arm: Bump KSTACK_PAGES default to match i386/amd64

See 3f6867ef6386 for additional context.

It is also needed for OpenZFS performance and stability.

Reviewed by: ian (arm), imp
Differential Revision: https://reviews.freebsd.org/D31244

2 years agoarm/mv: Don't rely on firmware MSI mapping in ICU
Kornel Duleba [Wed, 17 Feb 2021 15:28:46 +0000 (16:28 +0100)]
arm/mv: Don't rely on firmware MSI mapping in ICU

On Armada8k boards various peripherals (e.g. USB) have interrupt lines
connected to on of the ICU interrupt controllers.
After an interrupt is detected it triggers MSI to a given address,
with a programmed value. This in turn triggers an SPI interrupt.
Normally MSI vector should be allocated by ICUs parent and set
during interrupt allocation.
Instead of doing that we relied on the ICU being pre-configured in firmware.
This worked with EDK2 and older versions of U-Boot, but in the newer
ones that is no longer the case.
Extend ICU msi-parents - GICP and SEI to support MSI interface
and use it during interrupt allocation.
This allows us to boot on Armada 7k/8k SoCs independent from the
firmware configuration and successfully use modern U-Boot + device tree.

For SATA interrupts we need to apply a WA previously done in firmware.
We have two SATA ports connected to one controller.
Each ports gets its own interrupt, but only one of them is
described in dts, also ahci_generic driver expects only one irq too.
Fix it by mapping both interrupts to the same MSI when one of them
is allocated, which allows us to use both SATA ports.

Reviewed by: mmel, mw
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D28803

2 years agopf: clean up syncookie callout on vnet shutdown
Kristof Provost [Tue, 20 Jul 2021 19:03:08 +0000 (21:03 +0200)]
pf: clean up syncookie callout on vnet shutdown

Ensure that we cancel any outstanding callouts for syncookies when we
terminate the vnet.

MFC after: 1 week
Sponsored by: Modirum MDPay

2 years agopf: remove stray debug line
Kristof Provost [Tue, 20 Jul 2021 19:02:33 +0000 (21:02 +0200)]
pf: remove stray debug line

MFC after: 1 week
Sponsored by: Modirum MDPay

2 years agoFix race between first rand(3) calls.
Alexander Motin [Tue, 20 Jul 2021 17:15:08 +0000 (13:15 -0400)]
Fix race between first rand(3) calls.

Before this patch there was a chance for thread that called rand(3)
slightly later to see rand3_state already allocated, but not yet
initialized.  While this API is not expected to be thread-safe, it
is not expected to crash.  ztest on 64-thread system reproduced it
reliably for me.

MFC after: 1 month

2 years agonanobsd: fix typo in NANO_WORLDDIR
Yann Kerherve [Tue, 20 Jul 2021 17:10:28 +0000 (11:10 -0600)]
nanobsd: fix typo in NANO_WORLDDIR

Reviewed by: imp
PR: 257299

2 years agodf: remove the unused fstype var
Mateusz Guzik [Tue, 20 Jul 2021 17:00:50 +0000 (19:00 +0200)]
df: remove the unused fstype var

Found with cc --analyze

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

2 years agopf: embed a pointer to the lock in struct pf_kstate
Mateusz Guzik [Mon, 19 Jul 2021 12:40:25 +0000 (14:40 +0200)]
pf: embed a pointer to the lock in struct pf_kstate

This shaves calculation which in particular helps on arm.

Note using the & hack instead would still be more work.

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

2 years agopf: fix LINT build
Kristof Provost [Tue, 20 Jul 2021 14:48:35 +0000 (16:48 +0200)]
pf: fix LINT build

We failed to list the new pf_syncookies.c file in sys/conf/files. This
worked for the usual configurations, where pf is a module, but not for
LINT builds.

Reported by: lwhsu
MFC after: 1 week
Sponsored by: Modirum MDPay

2 years agoMake it clear we're running clang-12 for the GH actions
Ulrich Spörlein [Mon, 19 Jul 2021 08:25:58 +0000 (10:25 +0200)]
Make it clear we're running clang-12 for the GH actions

This chases a homebrew change in the default clang version.

Reviewed by: arichardson
Differential Revision: https://reviews.freebsd.org/D31231

2 years agobsd.linker.mk: Detect LLD when built with PACKAGE_VENDOR
Alex Richardson [Tue, 20 Jul 2021 15:04:56 +0000 (16:04 +0100)]
bsd.linker.mk: Detect LLD when built with PACKAGE_VENDOR

Recent versions of homebrew's LLD are built with PACKAGE_VENDOR (since
https://github.com/Homebrew/homebrew-core/commit/e7c972b6062af753e564104e58d1fa20c0d1ad7a).
This means that the -v output is now
`Homebrew LLD 12.0.1 (compatible with GNU linkers)` and bsd.linker.mk no
longer detects it as LLD since it only checks whether the first word is
LLD. This change allow me to build on macOS again and should unbreak the
GitHub actions CI.

Reviewed By: imp, uqs
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D31224

2 years agolinux(4): Factor out the futex_wait() op into linux_futex_wait().
Dmitry Chagin [Tue, 20 Jul 2021 11:40:24 +0000 (14:40 +0300)]
linux(4): Factor out the futex_wait() op into linux_futex_wait().

MFC after: 2 weeks

2 years agolinux(4): Prevent an endless loop.
Dmitry Chagin [Tue, 20 Jul 2021 11:40:08 +0000 (14:40 +0300)]
linux(4): Prevent an endless loop.

In the futex_atomic_op() the encoded_op is a user-supplied parameter.
If the user specifies an incorrect value for this parameter paired with a valid
*uaddr parameter the caller will go into the endless loop. To prevent this check
futex_atomic_op() result and break the loop in case of ENOSYS.

MFC after: 2 weeks

2 years agolinux(4): Eliminate bogus comment.
Dmitry Chagin [Tue, 20 Jul 2021 11:39:56 +0000 (14:39 +0300)]
linux(4): Eliminate bogus comment.

For the caller is no need for access checking here, as the caller must take care
of EFAULT handling. Moreover, this check would be superfluous, since EFAULT is
extremily rare, and we prefer the fast path.

MFC after: 2 weeks

2 years agolinux(4): Allow musl brand to use FUTEX_REQUEUE op.
Dmitry Chagin [Tue, 20 Jul 2021 11:39:20 +0000 (14:39 +0300)]
linux(4): Allow musl brand to use FUTEX_REQUEUE op.

Initial patch from submitter was adapted by me to prevent unconditional
FUTEX_REQUEUE use.

PR: 255947
Submitted by: Philippe Michaud-Boudreault
Differential Revision: https://reviews.freebsd.org/D30332

2 years agolinux(4): Factor out the FUTEX_WAKE_OP op into linux_futex_wakeop().
Dmitry Chagin [Tue, 20 Jul 2021 11:38:44 +0000 (14:38 +0300)]
linux(4): Factor out the FUTEX_WAKE_OP op into linux_futex_wakeop().

MFC after: 2 weeks

2 years agolinux(4): Factor out the FUTEX_CMP_REQUEUE op into linux_futex_requeue().
Dmitry Chagin [Tue, 20 Jul 2021 11:38:27 +0000 (14:38 +0300)]
linux(4): Factor out the FUTEX_CMP_REQUEUE op into linux_futex_requeue().

MFC after: 2 weeks

2 years agolinux(4): Factor out the FUTEX_WAKE op into linux_futex_wake().
Dmitry Chagin [Tue, 20 Jul 2021 11:38:05 +0000 (14:38 +0300)]
linux(4): Factor out the FUTEX_WAKE op into linux_futex_wake().

MFC after: 2 weeks

2 years agolinux(4): Factor out the FUTEX_WAIT op into linux_futex_wait().
Dmitry Chagin [Tue, 20 Jul 2021 11:37:51 +0000 (14:37 +0300)]
linux(4): Factor out the FUTEX_WAIT op into linux_futex_wait().

MFC after: 2 weeks

2 years agolinux(4): Refactor the struct linux_futex_args.
Dmitry Chagin [Tue, 20 Jul 2021 11:37:37 +0000 (14:37 +0300)]
linux(4): Refactor the struct linux_futex_args.

Move flags and rtclock to the struct linux_futex_args. This will be used when
I split linux_futex() into separate futex op functions.

MFC after: 2 weeks

2 years agoSplit out the arm64 ID field comparison function
Andrew Turner [Fri, 16 Jul 2021 12:46:59 +0000 (12:46 +0000)]
Split out the arm64 ID field comparison function

This will be useful in an update for finding which HWCAPS to set.

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

2 years agoStart to clean up arm64 address space selection
Andrew Turner [Wed, 14 Jul 2021 15:19:06 +0000 (15:19 +0000)]
Start to clean up arm64 address space selection

On arm64 we should use bit 55 of the address to decide if aan address
is a user or kernel address. Add a new macro with this check and a
second to ensure the address is in teh canonical form, i.e.
the top bits are all zero or all one.

This will help with supporting future cpu features, including Top
Byte Ignore, Pointer Authentication, and Memory Tagging.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31179

2 years agoImplement unprivileged chroot
Edward Tomasz Napierala [Tue, 20 Jul 2021 08:56:04 +0000 (08:56 +0000)]
Implement unprivileged chroot

This builds on recently introduced NO_NEW_PRIVS flag to implement
unprivileged chroot, enabled by `security.bsd.unprivileged_chroot`.
It allows non-root processes to chroot(2), provided they have the
NO_NEW_PRIVS flag set.

The chroot(8) utility gets a new flag, -n, which sets NO_NEW_PRIVS
before chrooting.

Reviewed By: kib
Sponsored By: EPSRC
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D30130

2 years agopf tests: ensure syncookie does not create state
Kristof Provost [Wed, 30 Jun 2021 13:27:46 +0000 (15:27 +0200)]
pf tests: ensure syncookie does not create state

Test that with syncookies enabled pf does not create state for
connections before the remote peer has replied to the SYN|ACK message.

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31142

2 years agopf tests: Forwarding syncookie test
Kristof Provost [Wed, 2 Jun 2021 16:16:03 +0000 (18:16 +0200)]
pf tests: Forwarding syncookie test

Test syncookies on a forwarding host. That is, in a setup where the
machine (or vnet) running pf is not the same as the machine (or vnet)
running the server it's protecting.

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31141

2 years agopfctl: syncookie configuration
Kristof Provost [Wed, 26 May 2021 11:41:34 +0000 (13:41 +0200)]
pfctl: syncookie configuration

pfctl and libpfctl code required to enable/disable the syncookie
feature.

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31140

2 years agopf: syncookie ioctl interface
Kristof Provost [Wed, 26 May 2021 08:18:19 +0000 (10:18 +0200)]
pf: syncookie ioctl interface

Kernel side implementation to allow switching between on and off modes,
and allow this configuration to be retrieved.

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31139

2 years agopf: syncookie support
Kristof Provost [Thu, 20 May 2021 09:54:41 +0000 (11:54 +0200)]
pf: syncookie support

Import OpenBSD's syncookie support for pf. This feature help pf resist
TCP SYN floods by only creating states once the remote host completes
the TCP handshake rather than when the initial SYN packet is received.

This is accomplished by using the initial sequence numbers to encode a
cookie (hence the name) in the SYN+ACK response and verifying this on
receipt of the client ACK.

Reviewed by: kbowling
Obtained from: OpenBSD
MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31138

2 years agopf: factor out pf_synproxy()
Kristof Provost [Thu, 10 Jun 2021 13:49:09 +0000 (15:49 +0200)]
pf: factor out pf_synproxy()

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31137

2 years agocxgbe(4): Initialize abs_id for ctrl and ofld queues.
Navdeep Parhar [Mon, 19 Jul 2021 22:47:07 +0000 (15:47 -0700)]
cxgbe(4): Initialize abs_id for ctrl and ofld queues.

MFC after: 1 week
Sponsored by: Chelsio Communications

2 years agoe1000: Add missing branch prediction
Kevin Bowling [Tue, 20 Jul 2021 07:21:21 +0000 (00:21 -0700)]
e1000: Add missing branch prediction

I missed this edit from the ixgbe review (D30074)

Reviewed by: gallatin
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30073

2 years agoe1000: Clean up igb_txrx
Kevin Bowling [Tue, 20 Jul 2021 07:06:31 +0000 (00:06 -0700)]
e1000: Clean up igb_txrx

The intention here is to reduce differences between em, igb, igc, ixgbe.

The main functional change is logical simplification in igb_rx_checksum
and getting interface caps from scctx instead of the ifp.

Reviewed by: gallatin, markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30073

2 years agoDrop rdivacky@ "All rights reserved" from linux_event.
Dmitry Chagin [Tue, 20 Jul 2021 07:06:16 +0000 (10:06 +0300)]
Drop rdivacky@ "All rights reserved" from linux_event.

I got explicit permission from Roman.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D30913
MFC after: 2 weeks

2 years agoDrop "All rights reserved" from my copyright statements.
Dmitry Chagin [Tue, 20 Jul 2021 07:05:50 +0000 (10:05 +0300)]
Drop "All rights reserved" from my copyright statements.

Add email and fixup years while here.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D30912
MFC after: 2 weeks

2 years agolinux(4): Add arch name to the some printfs.
Dmitry Chagin [Tue, 20 Jul 2021 07:05:08 +0000 (10:05 +0300)]
linux(4): Add arch name to the some printfs.

Reviewed by: emaste
Differential revision: https://reviews.freebsd.org/D30904
MFC after: 2 weeks

2 years agolinprocfs: Fixup vDSO name in the procmaps after 9931033bbf.
Dmitry Chagin [Tue, 20 Jul 2021 07:04:20 +0000 (10:04 +0300)]
linprocfs: Fixup vDSO name in the procmaps after 9931033bbf.

As the sv_shared_page_base now pointed out to the native sharedpage and
the process VA layout has changed as follows:
VDSOPAGE (2 * PAGE_SIZE)
SHAREDPAGE (PAGE_SIZE)
USRSTACK
fixup the vDSO name by calculating the start of page relative to the
native sharedpage.

Differential revision: https://reviews.freebsd.org/D30903
MFC after: 2 weeks

2 years agolinux(4): Fixup the vDSO initialization order.
Dmitry Chagin [Tue, 20 Jul 2021 07:02:34 +0000 (10:02 +0300)]
linux(4): Fixup the vDSO initialization order.

The vDSO initialisation order should be as follows:
- native abi init via exec_sysvec_init();
- vDSO symbols queued to the linux_vdso_syms list;
- linux_vdso_install();
- linux_exec_sysvec_init();

As the exec_sysvec_init() called with SI_ORDER_ANY (last) at SI_SUB_EXEC
order, move linux_vdso_install() and linux_exec_sysvec_init() to the
SI_SUB_EXEC+1 order.

Reviewed by: trasz
Differential Revision: https://reviews.freebsd.org/D30902
MFC after 2 weeks

2 years agolinux(4): Constify vdso install/deinstall.
Dmitry Chagin [Tue, 20 Jul 2021 07:01:47 +0000 (10:01 +0300)]
linux(4): Constify vdso install/deinstall.

In order to reduce diff between arches constify vdso install/deinstall
functions like arm64.

Reviewed by: emaste
Differential revision: https://reviews.freebsd.org/D30901
MFC after: 2 weeks

2 years agolinux(4); Almost complete the vDSO.
Dmitry Chagin [Tue, 20 Jul 2021 07:01:18 +0000 (10:01 +0300)]
linux(4); Almost complete the vDSO.

The vDSO (virtual dynamic shared object) is a small shared library that the
kernel maps R/O into the address space of all Linux processes on image
activation. The vDSO is a fully formed ELF image, shared by all processes
with the same ABI, has no process private data.

The primary purpose of the vDSO:
- non-executable stack, signal trampolines not copied to the stack;
- signal trampolines unwind, mandatory for the NPTL;
- to avoid contex-switch overhead frequently used system calls can be
  implemented in the vDSO: for now gettimeofday, clock_gettime.

The first two have been implemented, so add the implementation of system
calls.

System calls implemenation based on a native timekeeping code with some
limitations:
- ifunc can't be used, as vDSO r/o mapped to the process VA and rtld
  can't relocate symbols;
- reading HPET memory is not implemented for now (TODO).

In case on any error vDSO system calls fallback to the kernel system
calls. For unimplemented vDSO system calls added prototypes which call
corresponding kernel system call.

Tested by: trasz (arm64)
Differential revision:  https://reviews.freebsd.org/D30900
MFC after:              2 weeks

2 years agolinux(4): Modify sv_onexec hook to return an error.
Dmitry Chagin [Tue, 20 Jul 2021 06:56:25 +0000 (09:56 +0300)]
linux(4): Modify sv_onexec hook to return an error.

Temporary add stubs to the Linux emulation layer which calls the existing hook.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D30911
MFC after: 2 weeks

2 years agoCall sv_onexec hook after the process VA is created.
Dmitry Chagin [Tue, 20 Jul 2021 06:55:14 +0000 (09:55 +0300)]
Call sv_onexec hook after the process VA is created.

For future use in the Linux emulation layer call sv_onexec hook right after
the new process address space is created. It's safe, as sv_onexec used only
by Linux abi and linux_on_exec() does not depend on a state of process VA.

Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D30899
MFC after: 2 weeks

2 years agoRemove bogus cast from exec_sysvec_init().
Dmitry Chagin [Tue, 20 Jul 2021 06:54:09 +0000 (09:54 +0300)]
Remove bogus cast from exec_sysvec_init().

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D30910
MFC after: 2 weeks

2 years agoModify exec_sysvec_init() to allow non-native abi to setup their sysentvecs.
Dmitry Chagin [Tue, 20 Jul 2021 06:53:21 +0000 (09:53 +0300)]
Modify exec_sysvec_init() to allow non-native abi to setup their sysentvecs.

For future use in the Linux emulation layer modify the exec_sysvec_init()
to allow non-native abi to fill sv_timekeep_base and sv_shared_page_obj.

Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D30898
MFC after: 2 weeks

2 years agolinux(4): Remove function prototypes from the vDSO.
Dmitry Chagin [Tue, 20 Jul 2021 06:52:08 +0000 (09:52 +0300)]
linux(4): Remove function prototypes from the vDSO.

In preparation for vDSO code revision get rid of incomplete vDSO methods
from locore, but leave .note.Linux section commented out.
.note.Linux section is used by glibc rtld to get the kernel version, that
saves one system call call. I'll try to implement it later, if figure out
how to use it with jails.

MFC after: 2 weeks

2 years agoelf: Remove R_RISCV_[GT]PREL_[IS] relocation defines
Jessica Clarke [Tue, 20 Jul 2021 05:13:43 +0000 (06:13 +0100)]
elf: Remove R_RISCV_[GT]PREL_[IS] relocation defines

These were internal binutils relocations that have no way to be
generated in assembly nor will ever be seen in the output, and so should
never have been defined in the psABI in the first place. They have
therefore been removed from the spec as of [1], so do so here too.

[1] https://github.com/riscv/riscv-elf-psabi-doc/commit/44f98e0fd8104def00f2a5a8d94b23dd647d18fb

2 years agoawk: remove proctab.c
Warner Losh [Mon, 12 Jul 2021 03:26:08 +0000 (21:26 -0600)]
awk: remove proctab.c

proctab.c is a generated file and never should have been committed to
the tree. This file has been added and removed a couple of times, most
recently added by me in my 2019 updates.

Sponsored by: Netflix

2 years agoawk: Add more details top the FS variable
Warner Losh [Tue, 20 Jul 2021 02:10:22 +0000 (20:10 -0600)]
awk: Add more details top the FS variable

The current description of the FS is true, but only part of the
truth. Add information about single characters and note that FS="" is
undefined by the standard, though the two other awk implenetations (mawk
and gawk) also have this interpretation.

PR: 226112
Sponsored by: Netflix

2 years agonfscl: Send stateid.seqid of 0 for NFSv4.1/4.2 mounts
Rick Macklem [Tue, 20 Jul 2021 00:35:39 +0000 (17:35 -0700)]
nfscl: Send stateid.seqid of 0 for NFSv4.1/4.2 mounts

For NFSv4.1/4.2, the client may set the "seqid" field of the
stateid to 0 in RPC requests.  This indicates to the server that
it should not check the "seqid" or return NFSERR_OLDSTATEID if the
"seqid" value is not up to date w.r.t. Open/Lock operations
on the stateid.  This "seqid" is incremented by the NFSv4 server
for each Open/OpenDowngrade/Lock/Locku operation done on the stateid.

Since a failure return of NFSERR_OLDSTATEID is of no use to
the client for I/O operations, it makes sense to set "seqid"
to 0 for the stateid argument for I/O operations.
This avoids server failure replies of NFSERR_OLDSTATEID,
although I am not aware of any case where this failure occurs.

This makes the FreeBSD NFSv4.1/4.2 client compatible with the
Linux NFSv4.1/4.2 client.

MFC after: 2 weeks

2 years agocxgbei: Don't assert F for data completion PDUs.
John Baldwin [Mon, 19 Jul 2021 22:36:31 +0000 (15:36 -0700)]
cxgbei: Don't assert F for data completion PDUs.

If a data PDU encounters an error such as a digest error, the firmware
will report that data PDU when completion moderation is active even if
it is not the final data PDU in a burst.

Sponsored by: Chelsio Communications

2 years agocxgbei: Remove invalid assertion.
John Baldwin [Mon, 19 Jul 2021 22:36:31 +0000 (15:36 -0700)]
cxgbei: Remove invalid assertion.

A non-placed PDU can be delivered by CPL_RX_ISCSI_CMP in the middle of
a burst of placed PDUs (received via DDP) in which case the rcv_nxt
will not match the start of the non-placed PDU.

Reported by: Jithesh Arakkan @ Chelsio
Sponsored by: Chelsio Communications

2 years agotcp: fix RACK and BBR when using VIMAGE enabled kernel
Michael Tuexen [Mon, 19 Jul 2021 22:29:18 +0000 (00:29 +0200)]
tcp: fix RACK and BBR when using VIMAGE enabled kernel

Fix a bug in VNET handling, which occurs when using specific NICs.
PR: 257195
Reviewed by: rrs
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D31212

2 years agozfs: Remove zfs-images submodule
Ed Maste [Mon, 14 Jun 2021 13:31:39 +0000 (09:31 -0400)]
zfs: Remove zfs-images submodule

This can cause issues like 'No url found for submodule path' in
downstream or derived projects making use of submodules.

Reviewed by: imp

2 years agoacpi: Fix a repeated comment typo
Jessica Clarke [Mon, 19 Jul 2021 16:19:23 +0000 (17:19 +0100)]
acpi: Fix a repeated comment typo

2 years agoacpi: Fix a repeated vm_offset_t that should be a vm_size_t
Jessica Clarke [Mon, 19 Jul 2021 16:19:23 +0000 (17:19 +0100)]
acpi: Fix a repeated vm_offset_t that should be a vm_size_t

The underlying types for both are the same so arguably this doesn't
really matter, but using the wrong type is still confusing and
technically incorrect.

2 years agoarm64: std.allwinner: Add aw_syscon
Emmanuel Vadot [Mon, 19 Jul 2021 15:31:57 +0000 (17:31 +0200)]
arm64: std.allwinner: Add aw_syscon

This was missed during the conversion of kernel configs
PR: 257278
Reported by:  Manuel Stühn <freebsd@justmail.de>

2 years agoDon't build lldb-tablegen if MK_LLDB=no
Alex Richardson [Mon, 5 Jul 2021 17:36:02 +0000 (18:36 +0100)]
Don't build lldb-tablegen if MK_LLDB=no

Split out from D31060.

Reviewed by: emaste

2 years agoAllow building usr.bin/vi with MK_ASAN
Alex Richardson [Mon, 19 Jul 2021 14:04:19 +0000 (15:04 +0100)]
Allow building usr.bin/vi with MK_ASAN

We have to namespace the regex functions to avoid duplicate symbol errors.
This also ensures that vi doesn't define the libc reg* functions with
mismatched signatures.

ld: error: duplicate symbol: regcomp
>>> defined at sanitizer_common_interceptors.inc:7519 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7519)
>>>            asan_interceptors.o:(__interceptor_regcomp) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a
>>> defined at regcomp.c
>>>            .../regex/regcomp.c.o:(.text+0x0)

ld: error: duplicate symbol: regerror
>>> defined at sanitizer_common_interceptors.inc:7543 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7543)
>>>            asan_interceptors.o:(__interceptor_regerror) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a
>>> defined at regerror.c
>>>            .../regex/regerror.c.o:(.text+0x0)

ld: error: duplicate symbol: regexec
>>> defined at sanitizer_common_interceptors.inc:7530 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7530)
>>>            asan_interceptors.o:(__interceptor_regexec) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a
>>> defined at regexec.c
>>>            .../regex/regexec.c.o:(.text+0x0)

ld: error: duplicate symbol: regfree
>>> defined at sanitizer_common_interceptors.inc:7553 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7553)
>>>            asan_interceptors.o:(__interceptor_regfree) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a
>>> defined at regfree.c
>>>            .../regex/regfree.c.o:(.text+0x0)

Committed upstream as https://github.com/lichray/nvi2/pull/92

Reviewed By: bapt
Differential Revision: https://reviews.freebsd.org/D31050

2 years agobin/ps: Avoid function name conflict with libc uname()
Alex Richardson [Mon, 19 Jul 2021 14:03:38 +0000 (15:03 +0100)]
bin/ps: Avoid function name conflict with libc uname()

This prevents ps from being built with address sanitizer instrumentation.

Reviewed By: trasz
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31048

2 years agopf: shrink struct pf_kstate
Mateusz Guzik [Mon, 19 Jul 2021 12:35:31 +0000 (14:35 +0200)]
pf: shrink struct pf_kstate

Makes room for a pointer.

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

2 years agopf: add a comment to pf_kstate concerning compat with pf_state_cmp
Mateusz Guzik [Mon, 19 Jul 2021 12:17:33 +0000 (14:17 +0200)]
pf: add a comment to pf_kstate concerning compat with pf_state_cmp

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

2 years agopf: add a branch prediction to expire state check in pf_find_state
Mateusz Guzik [Mon, 19 Jul 2021 12:50:08 +0000 (14:50 +0200)]
pf: add a branch prediction to expire state check in pf_find_state

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

2 years agoarm: dedup counter(9) address calculation
Mateusz Guzik [Mon, 19 Jul 2021 10:46:01 +0000 (10:46 +0000)]
arm: dedup counter(9) address calculation

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

2 years agoarm: retire bcopy
Mateusz Guzik [Mon, 19 Jul 2021 09:53:02 +0000 (09:53 +0000)]
arm: retire bcopy

It is obsolete since ba96f37758412151 ("Use __builtin for various mem*
and b* (e.g. bzero) routines.")

Discussed with: cognet
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoarm: bcmp -> memcmp
Mateusz Guzik [Mon, 19 Jul 2021 09:52:23 +0000 (09:52 +0000)]
arm: bcmp -> memcmp

The bcmp symbol is not used, at the same time memcmp as pulled from
libkern does byte-by-byte comparison.

So happens bcmp as found in support.S is in fact renamed memcmp, rename
it back.

Discussed with: cognet
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agokenv: allow listing of static kernel environments
Kyle Evans [Sun, 20 Jun 2021 19:36:10 +0000 (14:36 -0500)]
kenv: allow listing of static kernel environments

The early environment is typically cleared, so these new options
need the PRESERVE_EARLY_KENV kernel config(8) option. These environments
are reported as missing by kenv(1) if the option is not present in the
running kernel.

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

2 years agokern: add an option for preserving the early kenv
Kyle Evans [Sun, 20 Jun 2021 19:29:31 +0000 (14:29 -0500)]
kern: add an option for preserving the early kenv

Some downstream configurations do not store secrets in the
early (loader/static) environments and desire a way to preserve these
for diagnostic reasons.  Provide an option to do so.

Reviewed by: imp, jhb (earlier version)
Differential Revision: https://reviews.freebsd.org/D30834

2 years agokenv: s/dump/list/ to clarify meaning
Kyle Evans [Mon, 21 Jun 2021 03:11:26 +0000 (22:11 -0500)]
kenv: s/dump/list/ to clarify meaning

The contents of the kenv will be dumped to stdout, while dump could have
also meant 'discard'. Call it 'list' instead.

Suggested by: imp
Reviewed by: imp, jhb
Differential Revision: https://reviews.freebsd.org/D30836