freebsd.git
5 hours agopf tests: test NAT-ed ICMP errors main github/main
Kristof Provost [Tue, 19 Oct 2021 11:52:21 +0000 (13:52 +0200)]
pf tests: test NAT-ed ICMP errors

Ensure that the ICMP error is returned with the correct
source and destination addresses.

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

5 hours agopf: ensure we have the correct source/destination IP address in ICMP errors
Luiz Otavio O Souza [Tue, 19 Oct 2021 11:37:54 +0000 (13:37 +0200)]
pf: ensure we have the correct source/destination IP address in ICMP errors

When we route-to a packet that later turns out to not fit in the
outbound interface MTU we generate an ICMP error.
However, if we've already changed those (i.e. we've passed through a NAT
rule) we have to undo the transformation first.

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

6 hours agoRELNOTES: Fix KMSAN entry
Elliott Mitchell [Fri, 22 Oct 2021 07:16:54 +0000 (15:16 +0800)]
RELNOTES: Fix KMSAN entry

The lead digit was lost in 05eba8e068c1 making it impossible to find the
commit.

The two subsequent RELNOTES commits gave one less digit of the commit
hash, which is what `git rev-parse --short` thinks the minimal length is,
but keep them to align with other entries.

Fixes: 05eba8e068c1
Differential Revision: https://reviews.freebsd.org/D32595

8 hours agocontrib/tzdata: import tzdata 2021e
Philip Paeps [Fri, 22 Oct 2021 05:20:20 +0000 (13:20 +0800)]
contrib/tzdata: import tzdata 2021e

Merge commit 'c66f7aacfc78e5e86469f85f20d3d4fc7d1e9a74'

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

MFC after: 3 days

8 hours agoImport tzdata 2021e
Philip Paeps [Fri, 22 Oct 2021 05:17:04 +0000 (13:17 +0800)]
Import tzdata 2021e

9 hours agoDocument my doc commit bit history
Li-Wen Hsu [Fri, 22 Oct 2021 03:54:06 +0000 (11:54 +0800)]
Document my doc commit bit history

Reminded by: ygy

17 hours agouefi(8): loader.efi does not search for loader.efi
Colin Percival [Thu, 21 Oct 2021 20:15:57 +0000 (13:15 -0700)]
uefi(8): loader.efi does not search for loader.efi

This man page formerly referred to boot1.efi searching for loader.efi;
when boot1.efi was obsoleted in favour of having loader.efi launched
directly, this was left claiming that loader.efi searched for
loader.efi.

Reviewed by: bcran
Fixes: db8b56134506 Rework UEFI ESP generation
Differential Revision: https://reviews.freebsd.org/D32334

18 hours agoarswitch(4): Hook new manpage to build
Guangyuan Yang [Thu, 21 Oct 2021 19:22:34 +0000 (15:22 -0400)]
arswitch(4): Hook new manpage to build

PR: 211668
Fixes: 262717e270c3e8a28fa2937db750ba946be8c836
Reported by: jhb

18 hours agouipc_shm: silent warnings about write-only variables in largepage code
Konstantin Belousov [Thu, 21 Oct 2021 17:46:36 +0000 (20:46 +0300)]
uipc_shm: silent warnings about write-only variables in largepage code

In shm_largepage_phys_populate(), the result from vm_page_grab() is only
needed for assertion.

In shm_dotruncate_largepage(), there is a commented-out prototype code
for managed largepages.   The oldobjsz is saved for its sake, so mark
the variable as __unused directly.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

18 hours agosig_ast_checksusp(): mark the local p as __diagused
Konstantin Belousov [Thu, 21 Oct 2021 17:43:32 +0000 (20:43 +0300)]
sig_ast_checksusp(): mark the local p as __diagused

It is only used to assert that the (current) process is locked

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

18 hours agosubr_firmware.c::unloadentry(): remote write-only variable
Konstantin Belousov [Thu, 21 Oct 2021 17:40:24 +0000 (20:40 +0300)]
subr_firmware.c::unloadentry(): remote write-only variable

The function ignores result returned by linker_release_module().
The FW_UNLOAD flag on the file is cleared, so even on error it would
not be tried again.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

18 hours agoalq_open_flags(): mark local td variable as unused
Konstantin Belousov [Thu, 21 Oct 2021 17:39:15 +0000 (20:39 +0300)]
alq_open_flags(): mark local td variable as unused

It is passed to the NDINIT() macro which ignores the thread argument
for some time.

Sponsored by: The FreeBSD Foundation

18 hours agoDMAR: clean up warnings about write-only variables
Konstantin Belousov [Thu, 21 Oct 2021 17:23:45 +0000 (20:23 +0300)]
DMAR: clean up warnings about write-only variables

For some of them, used only when KTR or KMSAN are configured, apply
__unused attribute directly.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

18 hours agoumtxq_requeue: remove write-only variable uh2
Konstantin Belousov [Thu, 21 Oct 2021 17:10:42 +0000 (20:10 +0300)]
umtxq_requeue: remove write-only variable uh2

umtxq_queue_lookup() does not change state.  It is redone inside
umtxq_insert() later, anyway.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

18 hours agoufs: remove write-only variables
Konstantin Belousov [Wed, 20 Oct 2021 01:42:31 +0000 (04:42 +0300)]
ufs: remove write-only variables

Mark variables as __diagused for invariant-only vars

Reviewed by: imp, mjg
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32577

21 hours agoktls: Always create a software backend for receive sessions.
John Baldwin [Thu, 21 Oct 2021 16:37:17 +0000 (09:37 -0700)]
ktls: Always create a software backend for receive sessions.

A future change to TOE TLS will require a software fallback for the
first few TLS records received.  Future support for NIC TLS on receive
will also require a software fallback for certain cases.

Reviewed by: gallatin, hselasky
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D32566

21 hours agoktls: Change struct ktls_session.cipher to an OCF-specific type.
John Baldwin [Thu, 21 Oct 2021 16:36:53 +0000 (09:36 -0700)]
ktls: Change struct ktls_session.cipher to an OCF-specific type.

As a followup to SW KTLS assuming an OCF backend, rename
struct ocf_session to struct ktls_ocf_session and forward
declare it in <sys/ktls.h> to use as the type of
struct ktls_session.cipher.

Reviewed by: gallatin, hselasky
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D32565

21 hours agoktls: Add a routine to query information in a receive socket buffer.
John Baldwin [Thu, 21 Oct 2021 16:36:29 +0000 (09:36 -0700)]
ktls: Add a routine to query information in a receive socket buffer.

In particular, ktls_pending_rx_info() determines which TLS record is
at the end of the current receive socket buffer (including
not-yet-decrypted data) along with how much data in that TLS record is
not yet present in the socket buffer.

This is useful for future changes to support NIC TLS receive offload
and enhancements to TOE TLS receive offload.  Those use cases need a
way to synchronize a state machine on the NIC with the TLS record
boundaries in the TCP stream.

Reviewed by: gallatin, hselasky
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D32564

21 hours agocmp: initialize limit to avoid stack garbage limits
Kyle Evans [Thu, 21 Oct 2021 16:30:55 +0000 (11:30 -0500)]
cmp: initialize limit to avoid stack garbage limits

Pointy hat: kevans
Fixes: 4e380e847460 ("cmp: add -n, --bytes to limit number of bytes [...]")
Sponsored by: Klara, Inc.

22 hours agoEnable stack gap on arm64
Dawid Gorecki [Thu, 21 Oct 2021 15:18:46 +0000 (17:18 +0200)]
Enable stack gap on arm64

Stack gap code used on amd64 can also be reused for arm64. Point
sv_stackgap to elf64_stackgap to enable this feature.

Reviewed by: mw, kib, emaste
Tested by: mw
MFC: after 1 month
Differential Revision: https://reviews.freebsd.org/D32588

24 hours agozfs: merge openzfs/zfs@ec64fdb93 (master) into main
Martin Matuska [Thu, 21 Oct 2021 11:58:45 +0000 (13:58 +0200)]
zfs: merge openzfs/zfs@ec64fdb93 (master) into main

Notable upstream pull request merges:
  #12392 Avoid panic in case of pool errors and missing L2ARC
  #12448 skip snapshot in zfs_iter_mounted()
  #12516 Fix NFS and large reads on older kernels
  #12533 Fail invalid incremental recursive send gracefully
  #12569 FreeBSD: Really zero the zero page
  #12575 Reject zfs send -RI with nonexistent fromsnap
  #12602 Correct refcount_add in dmu_zfetch
  #12650 zpool should call zfs_nicestrtonum() with non-NULL handle

Obtained from: OpenZFS
OpenZFS commit: ec64fdb93d144ab1884097cfd36e18b62a2db848

26 hours agoOnly change the fadt revision in acpidump on i386
Andrew Turner [Wed, 20 Oct 2021 09:19:55 +0000 (10:19 +0100)]
Only change the fadt revision in acpidump on i386

There is a workaround in acpidump for an old IBM laptop. This is being
hit on a modern arm64 system causing acpidump to use the wrong field
when reading a later address.

As the laptop has a 32-bit CPU the only FreeBSD support for it is i386.
As such limit the workaround to that architecture.

Reviewed by: emaste, jkim, jhb (all earlier version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32573

26 hours agotimeout.1: Fix typos in examples
Mateusz Piotrowski [Thu, 21 Oct 2021 11:06:45 +0000 (13:06 +0200)]
timeout.1: Fix typos in examples

MFC after: 3 days

29 hours agoxen/devices: purge uses of intr_machdep.h
Elliott Mitchell [Fri, 23 Apr 2021 02:59:22 +0000 (19:59 -0700)]
xen/devices: purge uses of intr_machdep.h

Devices in sys/dev should be architecture-independent and NOT #include
intr_machdep.h.

Reviewed by: mhorne royger
Differential Revision: https://reviews.freebsd.org/D29959

29 hours agoxen/pcifront: purge from tree
Roger Pau Monné [Wed, 20 Oct 2021 10:39:33 +0000 (12:39 +0200)]
xen/pcifront: purge from tree

Xen pcifront has been unhooked from the build for a long time, as it's
only used by PV mode which FreeBSD doesn't support. Remove it from the
tree.

33 hours agobhyve: Bump the SMBIOS firmware version to 14.0 for 14-CURRENT
Rebecca Cran [Thu, 21 Oct 2021 02:33:49 +0000 (20:33 -0600)]
bhyve: Bump the SMBIOS firmware version to 14.0 for 14-CURRENT

Bump the firmware version to 14.0 and set the firmware release date
to today.

Reviewed by: jhb, bz, imp
Differential Revision: https://reviews.freebsd.org/D32534

37 hours agoldd: do not use dlopen(RTLD_TRACE) for dso when format is specified
Konstantin Belousov [Mon, 11 Oct 2021 22:35:56 +0000 (01:35 +0300)]
ldd: do not use dlopen(RTLD_TRACE) for dso when format is specified

Problem is that rtld cannot reliably access updated environment.
This was made more obvious by bfd4c875a10560aaa2.  The application
environment can be in arbitrary state and place, system components
can observe it only during execve(2), or in case of rtld, right after
execve, when environment is still at know location and format.

Instead spawn ld-elf.so.1 in direct exec mode which can correctly read
all inherited updates to the environment.

PR: 259069
Reviewed by: arichardson, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32464

37 hours agoldd: style
Konstantin Belousov [Tue, 12 Oct 2021 11:39:32 +0000 (14:39 +0300)]
ldd: style

Reviewed by: arichardson, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32464

37 hours agortld-elf/paths.h: Make it usable outside rtld
Konstantin Belousov [Tue, 12 Oct 2021 15:50:49 +0000 (18:50 +0300)]
rtld-elf/paths.h: Make it usable outside rtld

but still for tightly coupled things like ldd(1)

Rename paths.h to rtld_paths.h.
Add guard for rtld-specific externs declarations.
Add _COMPAT32_BASENAME_RTLD and _COMPAT32_PATH_RTLD.

Reviewed by: arichardson, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32464

37 hours agoping: fix parsing of options including '4' and '6'
Alan Somers [Wed, 6 Oct 2021 22:54:59 +0000 (16:54 -0600)]
ping: fix parsing of options including '4' and '6'

ping uses a two-pass option parser.  The first pass determines whether
ipv4 or ipv6 is desired, and the second parses the rest of the options.
But the first pass wrongly detects a '4' or '6' in an option's value as
a request to use ipv6 or ipv6 respectively, for example in an invocation
like "ping -c6 1.2.3.4".

Fix this confusion by including all options in the first round of
parsing, but ignoring those unrelated to ipv4/ipv6 selection.

PR: 258048
Reported by: ghuckriede@blackberry.com
Submitted by: ghuckriede@blackberry.com
MFC after: 2 weeks
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D32344

38 hours agonet: Allow binding of unspecified address without address existance
Roy Marples [Wed, 20 Oct 2021 15:47:29 +0000 (11:47 -0400)]
net: Allow binding of unspecified address without address existance

Previously in_pcbbind_setup returned EADDRNOTAVAIL for empty
V_in_ifaddrhead (i.e., no IPv4 addresses configured) and in6_pcbbind
did the same for empty V_in6_ifaddrhead (no IPv6 addresses).

An equivalent test has existed since 4.4-Lite.  It was presumably done
to avoid extra work (assuming the address isn't going to be found
later).

In normal system operation *_ifaddrhead will not be empty: they will
at least have the loopback address(es).  In practice no work will be
avoided.

Further, this case caused net/dhcpd to fail when run early in boot
before assignment of any addresses.  It should be possible to bind the
unspecified address even if no addresses have been configured yet, so
just remove the tests.

The now-removed "XXX broken" comments were added in 59562606b9d3,
which converted the ifaddr lists to TAILQs.  As far as I (emaste) can
tell the brokenness is the issue described above, not some aspect of
the TAILQ conversion.

PR: 253166
Reviewed by: ae, bz, donner, emaste, glebius
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D32563

38 hours agoSkip snapshot in zfs_iter_mounted()
youzhongyang [Wed, 20 Oct 2021 23:07:19 +0000 (19:07 -0400)]
Skip snapshot in zfs_iter_mounted()

The intention of the zfs_iter_mounted() is to traverse the dataset
and its descendants, not the snapshots. The current code can cause
a mounted snapshot to be included and thus zfs_open() on the snapshot
with ZFS_TYPE_FILESYSTEM would print confusing message such as "cannot
open 'rpool/fs@snap': snapshot delimiter '@' is not expected here".

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Youzhong Yang <yyang@mathworks.com>
Closes #12447
Closes #12448

38 hours agovdev_id: Fix enclosure_symlinks feature
Tony Hutter [Wed, 20 Oct 2021 22:48:04 +0000 (15:48 -0700)]
vdev_id: Fix enclosure_symlinks feature

The vdev_id.conf "enclosure_symlinks" option persistently creates
and maps /dev/by-enclosure symlinks to dynamic /dev/sg* devices.

This patch fixes two issues:

1. The enclosure_symlinks feature was accidentally broken in:

   vdev_id: Support daisy-chained JBODs in multipath mode

2. Even when working, the feature numbered the enclosure
   sequentially rather than by HBA port number.  That meant that
   if a port was down or didn't appear in sysfs, then the
   enclosure_sumlinks numbers would be numbered wrong.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #12660

42 hours agopowerpc64le: stand fixes
Leandro Lupori [Wed, 20 Oct 2021 18:48:33 +0000 (15:48 -0300)]
powerpc64le: stand fixes

Fix boot1 and loader on PowerPC64 little-endian (LE).

Due to endian issues, boot1 couldn't find the UFS boot partition
and loader wasn't able to load the kernel. Most of the issues
happened because boot1 and loader were BE binaries trying to access
LE UFS partitions and because loader expects the kernel ELF image
to use the same endian as itself.

To fix these issues, boot1 and loader are now built as LE binaries
on PPC64LE. To support this, the functions that call OpenFirmware
were enhanced to correctly perform endian conversion on its input
and output arguments and to change the CPU into BE mode before
making the calls, as OpenFirmware always runs in BE. Besides that,
some other small fixes were needed.

Submitted by: bdragon (initial version)
Reviewed by: alfredo, jhibbits
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D32160

43 hours agosys/bus.h: silence warnings about write-only variables
Konstantin Belousov [Wed, 20 Oct 2021 13:23:30 +0000 (16:23 +0300)]
sys/bus.h: silence warnings about write-only variables

in the generated functions for bus accessors.  These are the most
noising instances for drivers when non-debug kernel is compiled with
clang 13.

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32578

43 hours agomsdosfs_rename: remove write-only variables
Konstantin Belousov [Wed, 20 Oct 2021 01:55:50 +0000 (04:55 +0300)]
msdosfs_rename: remove write-only variables

Reviewed by: imp, mjg
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32577

43 hours agotmpfs: remove write-only variables
Konstantin Belousov [Wed, 20 Oct 2021 01:54:48 +0000 (04:54 +0300)]
tmpfs: remove write-only variables

Reviewed by: imp, mjg
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32577

43 hours agolibshare: nfs: pass through ipv6 addresses in bracket notation
felixdoerre [Wed, 20 Oct 2021 17:40:00 +0000 (19:40 +0200)]
libshare: nfs: pass through ipv6 addresses in bracket notation

Recognize when the host part of a sharenfs attribute is an ipv6
Literal and pass that through without modification.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Felix Dörre <felix@dogcraft.de>
Closes: #11171
Closes #11939
Closes: #1894

44 hours agozpool should call zfs_nicestrtonum() with non-NULL handle
Toomas Soome [Wed, 20 Oct 2021 17:34:34 +0000 (20:34 +0300)]
zpool should call zfs_nicestrtonum() with non-NULL handle

When zfs_nicestrtonum() is called and there will be an error,
the message is left in libzfs handle, if provided. We can use
this message, to provide better feedback for user.

Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Toomas Soome <tsoome@me.com>
Closes #12650

2 days agoOptionalObsoleteFiles: add more googletest files to remove
Baptiste Daroussin [Wed, 20 Oct 2021 12:18:37 +0000 (14:18 +0200)]
OptionalObsoleteFiles: add more googletest files to remove

2 days agosh(1): fix home/del key on mobaxterm env
Baptiste Daroussin [Wed, 20 Oct 2021 11:58:18 +0000 (13:58 +0200)]
sh(1): fix home/del key on mobaxterm env

For $reason mobaxterm default on sending unusual sequence from home/del
key, which makes libedit unabel to catch them and bind them correctly.

mobaxterm seems popular on the windows environment, so add proper
keybinding to default shrc configuration so it works out of box.

Reported by: lme

2 days agoPass the ACPI ID when reading the ACPI domain
Andrew Turner [Mon, 18 Oct 2021 09:04:06 +0000 (10:04 +0100)]
Pass the ACPI ID when reading the ACPI domain

The ACPI ID may not be the same as the FreeBSD CPU id. Use the former
when finding the CPU domain as there is no requirement for it to be
identical to the latter.

Reported by: dch, kevans
Reviewed by: kevans
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32546

2 days agoskel: update .shrc as well
Baptiste Daroussin [Wed, 20 Oct 2021 09:23:13 +0000 (11:23 +0200)]
skel: update .shrc as well

Somehow we end up having 2 definition of the same .shrc in the source
tree, both of them should have been updated.

A batter fix would be to only keep one copy of the same file. but that
would be for another commit

Reported by: lme

2 days agotimeout: style fixes
Baptiste Daroussin [Wed, 20 Oct 2021 08:44:32 +0000 (10:44 +0200)]
timeout: style fixes

2 days agotimeout: eliminate usage of sysexits
Baptiste Daroussin [Wed, 20 Oct 2021 08:39:34 +0000 (10:39 +0200)]
timeout: eliminate usage of sysexits

It brings no value at all the sysexits and maybe misleading as the
return value of timeout(1) matters.

2 days agoUPDATING: fix style
Baptiste Daroussin [Wed, 20 Oct 2021 07:44:44 +0000 (09:44 +0200)]
UPDATING: fix style

Reported by: danfe

2 days agoRELNOTES: document the change of the default shell
Baptiste Daroussin [Wed, 20 Oct 2021 07:35:07 +0000 (09:35 +0200)]
RELNOTES: document the change of the default shell

2 days agosh(1): make it the default shell for the root user
Baptiste Daroussin [Tue, 19 Oct 2021 06:46:12 +0000 (08:46 +0200)]
sh(1): make it the default shell for the root user

In the recent history sh(1) has gain the missing features for it to
become a usable interractive shell:
- command completion
- persistent history support
- improvements on the default bindings in emacs mode
- improvements in the vi mode (repect $EDITOR)
- print a newline when exiting via ^D
- default prompt and improvements on how PS1 can be configured
- and more.

This changes also simplifies making tiny freebsd images with only sh(1)
as a shell

2 days agosh(1): interactive mode improvement
Baptiste Daroussin [Tue, 19 Oct 2021 06:37:47 +0000 (08:37 +0200)]
sh(1): interactive mode improvement

In the default configuration add 2 bindings which has been requested by
many during the HEADSUP discussion:
* csh like arrow history navigation
* ctrl-arrow to jump from word to words

Add an alias to make the history command exist as an alias to fc -l.

2 days agoncurses: documents the latest changes in RELNOTES
Baptiste Daroussin [Tue, 19 Oct 2021 06:43:39 +0000 (08:43 +0200)]
ncurses: documents the latest changes in RELNOTES

2 days agostress2: Added a "mdconfig -o force" test scenario
Peter Holm [Wed, 20 Oct 2021 06:01:58 +0000 (06:01 +0000)]
stress2: Added a "mdconfig -o force" test scenario

2 days agocamcontrol(8): Clean up references to removed symbols
Felix Johnson [Wed, 20 Oct 2021 04:32:54 +0000 (00:32 -0400)]
camcontrol(8): Clean up references to removed symbols

Patch the manpage to remove references to devq_openings and devq_queued.
Document the allocated tag that has been added in the same commit. The
relevant code change was committed as r271588
(959ec2581b23aefebb3bae26c527c1b25834a9e3) by mav@.

PR: 223651
MFH after: 3 days
Reported by: Bertrand Petit <bsdpr@phoe.frmug.org>

2 days agoarswitch(4): Add new manpage
Felix Johnson [Wed, 20 Oct 2021 03:29:11 +0000 (23:29 -0400)]
arswitch(4): Add new manpage

PR: 211668
Reported by: O. Hartmann <ohartmann@walstatt.org>
Reviewed by: adrian, debdrup, imp
Differential Revision: https://reviews.freebsd.org/D32476

2 days agosysctl.3: sys/types.h no longer needs to be explicitly included
Mark Johnston [Wed, 20 Oct 2021 01:19:18 +0000 (21:19 -0400)]
sysctl.3: sys/types.h no longer needs to be explicitly included

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32562

2 days agovlapic: Schedule callouts on the local CPU
Mark Johnston [Wed, 20 Oct 2021 00:50:06 +0000 (20:50 -0400)]
vlapic: Schedule callouts on the local CPU

The virtual LAPIC driver uses callouts to implement the LAPIC timer.
Callouts are armed using callout_reset_sbt(), which currently puts
everything on CPU 0.  On systems running many bhyve VMs this results in
a large amount of contention for CPU 0's callout lock.

Modify vlapic to schedule callouts on the local CPU instead.  This
allows timer interrupts to be scheduled more evenly among CPUs where
bhyve is running.

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

2 days agoBump __FreeBSD_version for the preceding page allocator changes
Mark Johnston [Wed, 20 Oct 2021 00:30:28 +0000 (20:30 -0400)]
Bump __FreeBSD_version for the preceding page allocator changes

None of the usual suspects (e.g., drm-kmod, virtualbox-ose-kmod,
nvidia-driver) seem to be affected by the changes, but it is likely that
something else is affected.

Sponsored by: The FreeBSD Foundation

2 days agoamd64: Add comments to pmap_pinit_type()
Mark Johnston [Wed, 20 Oct 2021 00:29:18 +0000 (20:29 -0400)]
amd64: Add comments to pmap_pinit_type()

... explaining why we don't pass the pmap pointer to
pmap_alloc_pt_page().

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

2 days agoUse the vm_radix_init() helper when initializing pmaps
Mark Johnston [Wed, 20 Oct 2021 00:29:05 +0000 (20:29 -0400)]
Use the vm_radix_init() helper when initializing pmaps

No functional change intended.

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

2 days agoRemove some remaining references to VM_ALLOC_NOOBJ
Mark Johnston [Wed, 20 Oct 2021 00:28:54 +0000 (20:28 -0400)]
Remove some remaining references to VM_ALLOC_NOOBJ

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

2 days agovm_fault: Stop specifying VM_ALLOC_ZERO
Mark Johnston [Wed, 20 Oct 2021 00:27:23 +0000 (20:27 -0400)]
vm_fault: Stop specifying VM_ALLOC_ZERO

Now vm_page_alloc() and friends will unconditionally preserve PG_ZERO,
so there is no point in setting this flag.

Eliminate a local variable and add a comment explaining why we
prioritize the allocation when the process is doomed.

No functional change intended.

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

2 days agoRewrite the vm_page_alloc manual page
Mark Johnston [Wed, 20 Oct 2021 00:26:30 +0000 (20:26 -0400)]
Rewrite the vm_page_alloc manual page

Document the new allocator variants and flesh out the description of
some details of the page allocator interface.

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

2 days agovm_page: Drop handling of VM_ALLOC_NOOBJ in vm_page_alloc_contig_domain()
Mark Johnston [Wed, 20 Oct 2021 00:26:09 +0000 (20:26 -0400)]
vm_page: Drop handling of VM_ALLOC_NOOBJ in vm_page_alloc_contig_domain()

As in vm_page_alloc_domain_after(), unconditionally preserve PG_ZERO.

Implement vm_page_alloc_noobj_contig_domain().

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

2 days agovm_page: Stop handling VM_ALLOC_NOOBJ in vm_page_alloc_domain_after()
Mark Johnston [Wed, 20 Oct 2021 00:25:14 +0000 (20:25 -0400)]
vm_page: Stop handling VM_ALLOC_NOOBJ in vm_page_alloc_domain_after()

This makes the allocator simpler since it can assume object != NULL.
Also modify the function to unconditionally preserve PG_ZERO, so
VM_ALLOC_ZERO is effectively ignored (and still must be implemented by
the caller for now).

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

2 days agoConvert consumers to vm_page_alloc_noobj_contig()
Mark Johnston [Wed, 20 Oct 2021 00:25:04 +0000 (20:25 -0400)]
Convert consumers to vm_page_alloc_noobj_contig()

Remove now-unneeded page zeroing.  No functional change intended.

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

2 days agoIntroduce vm_page_alloc_noobj_contig()
Mark Johnston [Wed, 20 Oct 2021 00:24:21 +0000 (20:24 -0400)]
Introduce vm_page_alloc_noobj_contig()

This is the same as vm_page_alloc_noobj(), but allocates physically
contiguous runs of memory.  For now it is implemented in terms of
vm_page_alloc_contig(), with the difference that
vm_page_alloc_noobj_contig() implements VM_ALLOC_ZERO by zeroing the
page.

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

2 days agoConvert vm_page_alloc() callers to use vm_page_alloc_noobj().
Mark Johnston [Wed, 20 Oct 2021 00:23:39 +0000 (20:23 -0400)]
Convert vm_page_alloc() callers to use vm_page_alloc_noobj().

Remove page zeroing code from consumers and stop specifying
VM_ALLOC_NOOBJ.  In a few places, also convert an allocation loop to
simply use VM_ALLOC_WAITOK.

Similarly, convert vm_page_alloc_domain() callers.

Note that callers are now responsible for assigning the pindex.

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

2 days agovm_page: Add a new page allocator interface for unnamed pages
Mark Johnston [Wed, 20 Oct 2021 00:22:12 +0000 (20:22 -0400)]
vm_page: Add a new page allocator interface for unnamed pages

The diff adds vm_page_alloc_noobj() and vm_page_alloc_noobj_domain().
These mostly correspond to vm_page_alloc() and vm_page_alloc_domain()
when no VM object is specified, with the exception that they handle
VM_ALLOC_ZERO by zeroing the page, rather than by preserving PG_ZERO.

This simplifies callers and will permit simplification of the
vm_page_alloc_domain() definition.

Since the new allocator variant is similar to vm_page_alloc_freelist(),
implement both of them using a common backend allocator function.  No
functional change intended.

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

2 days agovm_page: Move vm_page_alloc_check() to after page allocator definitions
Mark Johnston [Wed, 20 Oct 2021 01:22:50 +0000 (21:22 -0400)]
vm_page: Move vm_page_alloc_check() to after page allocator definitions

This way all of the vm_page_alloc_*() allocator functions are grouped
together.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 days agolibssh: Rearrange Makefile SRCS to match upstream Makefile.in
Ed Maste [Wed, 20 Oct 2021 00:09:46 +0000 (20:09 -0400)]
libssh: Rearrange Makefile SRCS to match upstream Makefile.in

SRCS entries are kept in the same order and with the same line breaks
as upstream, to make comparison easier.

Reported by: des

2 days agoprocctl: stop using SA_*LOCKED, define local enum
Konstantin Belousov [Tue, 19 Oct 2021 21:25:19 +0000 (00:25 +0300)]
procctl: stop using SA_*LOCKED, define local enum

Using SA_*LOCKED constants breaks !INVARIANT builds

Reported by: cy
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 days agokern_procctl: skip zombies for process group operations
Konstantin Belousov [Mon, 18 Oct 2021 21:29:01 +0000 (00:29 +0300)]
kern_procctl: skip zombies for process group operations

When iterating over the process group members, skip zombies same as it
is done by pfind() for single-process operation.

Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32513

2 days agokern_procctl.c: use td->td_proc instead of curproc
Konstantin Belousov [Mon, 18 Oct 2021 21:07:25 +0000 (00:07 +0300)]
kern_procctl.c: use td->td_proc instead of curproc

Suggested by: markj
Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32513

2 days agoprocctl: actually require debug privileges over target
Konstantin Belousov [Fri, 15 Oct 2021 20:09:39 +0000 (23:09 +0300)]
procctl: actually require debug privileges over target

for state control over TRACE, TRAPCAP, ASLR, PROTMAX, STACKGAP,
NO_NEWPRIVS, and WXMAP.

Reported by: emaste
Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32513

2 days agoprocctl: make it possible to specify that some operations require debug privilege...
Konstantin Belousov [Fri, 15 Oct 2021 20:02:06 +0000 (23:02 +0300)]
procctl: make it possible to specify that some operations require debug privilege over the target

Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32513

2 days agosys_procctl(): zero the data buffer once, on syscall entry
Konstantin Belousov [Sat, 16 Oct 2021 18:28:03 +0000 (21:28 +0300)]
sys_procctl(): zero the data buffer once, on syscall entry

and remove zeroing of it from specific functions.  This way it is
guaranteed that we do not leak kernel data.

Suggested by: markj
Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32513

2 days agosys_procctl(): use table data to do copyin/copyout
Konstantin Belousov [Fri, 15 Oct 2021 19:56:12 +0000 (22:56 +0300)]
sys_procctl(): use table data to do copyin/copyout

Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32513

2 days agokern_procctl_single(): convert to use table data
Konstantin Belousov [Fri, 15 Oct 2021 19:22:18 +0000 (22:22 +0300)]
kern_procctl_single(): convert to use table data

Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32513

2 days agoprocctl: convert PDEATHSIG_CTL/STATUS to regular kern_procctl_single() cases
Konstantin Belousov [Fri, 15 Oct 2021 19:06:22 +0000 (22:06 +0300)]
procctl: convert PDEATHSIG_CTL/STATUS to regular kern_procctl_single() cases

Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32513

2 days agoprocctl(2): add consistent shortcut P_ID:0 as curproc
Konstantin Belousov [Fri, 15 Oct 2021 19:01:42 +0000 (22:01 +0300)]
procctl(2): add consistent shortcut P_ID:0 as curproc

Reported by: bdrewery, emaste
Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32513

2 days agokern_procctl(): convert the function to be table-driven
Konstantin Belousov [Fri, 15 Oct 2021 18:57:17 +0000 (21:57 +0300)]
kern_procctl(): convert the function to be table-driven

Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32513

2 days agosys_procctl(2): remove sysproto and argused
Konstantin Belousov [Fri, 15 Oct 2021 18:55:53 +0000 (21:55 +0300)]
sys_procctl(2): remove sysproto and argused

Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32513

2 days agosockstat: don't query jail vnet if system is running without VIMAGE.
Gleb Smirnoff [Tue, 19 Oct 2021 16:47:54 +0000 (09:47 -0700)]
sockstat: don't query jail vnet if system is running without VIMAGE.

Fixes:  f1cd4902bf17

2 days agosockstat: make err(3) on jail errors more verbose.
Gleb Smirnoff [Tue, 19 Oct 2021 16:46:41 +0000 (09:46 -0700)]
sockstat: make err(3) on jail errors more verbose.

2 days agoloader: net_open() should not replace f->f_devdata
Toomas Soome [Fri, 24 Sep 2021 15:04:31 +0000 (18:04 +0300)]
loader: net_open() should not replace f->f_devdata

net_open() does replace f_devdata with pointer to netdev_sock,
this will cause memory leak when device is closed, but also does
alter the devopen() logic.

We should store &netdev_sock to dev->d_opendata instead, this
would preserve and follow the devopen() logic.

Fixes network boot on aarch64 (tested by bz).

Reviewed-by: imp
MFC After: 2 weeks
Differential Revision: https://reviews.freebsd.org/D32227

3 days agopf: fix some cc --analyze warnings
Mateusz Guzik [Tue, 19 Oct 2021 11:57:47 +0000 (11:57 +0000)]
pf: fix some cc --analyze warnings

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

3 days agovt: Disable bell by default
Emmanuel Vadot [Mon, 18 Oct 2021 08:16:41 +0000 (10:16 +0200)]
vt: Disable bell by default

Bell is either useless if you're working on remote servers or really annoying
when you're working with a local machine that have a loud buzzer.
Switch the default to have it disable.

Reviewed by:    imp, pstef, tsoome
Sponsored by:    Beckhoff Automation GmbH & Co. KG
Differential Revision:     https://reviews.freebsd.org/D32543

3 days agodevd(8): Note default config file search locations
Felix Johnson [Tue, 19 Oct 2021 04:37:40 +0000 (00:37 -0400)]
devd(8): Note default config file search locations

PR: 197003
MFC after: 3 days
Reported by: Harald Schmalzbauer <bugzilla.freebsd@omnilan.de>

3 days agoRemove code duplication
Pawel Jakub Dawidek [Mon, 18 Oct 2021 23:50:33 +0000 (16:50 -0700)]
Remove code duplication

Remove code duplication by moving code responsible for partial block
zeroing to a separate function: dnode_partial_zero().

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #12627

3 days agoMakefile.inc1: remove lorder from build/cross tools
Ed Maste [Mon, 18 Oct 2021 20:27:34 +0000 (16:27 -0400)]
Makefile.inc1: remove lorder from build/cross tools

As lorder is not used by the base system build there is no need to
include it in bootstrap-tools or NXBDIRS.

Fixes:  0e1e341b486c ("Stop using lorder and ranlib when...")
Sponsored by: The FreeBSD Foundation

3 days agonfscl: Handle NFSv4.1/4.2 Close RPC NFSERR_DELAY replies better
Rick Macklem [Mon, 18 Oct 2021 22:02:21 +0000 (15:02 -0700)]
nfscl: Handle NFSv4.1/4.2 Close RPC NFSERR_DELAY replies better

Without this patch, if a NFSv4.1/4.2 server replies NFSERR_DELAY to
a Close operation, the client loops retrying the Close while holding
a shared lock on the clientID.  This shared lock blocks returns of
delegations, even though the server has issued a CB_RECALL to request
the delegation return.

This patch delays doing a retry of a Close that received a reply of
NFSERR_DELAY until after the shared lock on the clientID is released,
for NFSv4.1/4.2.  To fix this for NFSv4.0 would be very difficult and
since the only known NFSv4 server to reply NFSERR_DELAY to Close only
does NFSv4.1/4.2, this fix is hoped to be sufficient.

This problem was detected during a recent IETF working group NFSv4
testing event.

MFC after: 2 week

3 days agocrt_malloc: more accurate handling of mmap(2) failure
Konstantin Belousov [Fri, 15 Oct 2021 17:59:37 +0000 (20:59 +0300)]
crt_malloc: more accurate handling of mmap(2) failure

Reset both pagepool_start and pagepool_end after a mmap(2) failure,
to avoid using invalid pagepool either for allocation or munmap(2).

PR: 259076
Noted by: Denis Koreshkov <dynamic-wind@mail.ru>
Reviewed by: arichardson
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32514

3 days agolorder: process read-only data symbols
Ed Maste [Mon, 18 Oct 2021 21:19:53 +0000 (17:19 -0400)]
lorder: process read-only data symbols

Previously they were skipped.  lorder(1) serves no functional purpose
today but we might as well address this longstanding bug while it is
still in the tree.

PR: 133860
MFC after: 1 week
Submitted by: John Hein

3 days agoipq4018: add initial IPQ4018/IPQ4019 support
Adrian Chadd [Sat, 16 Oct 2021 18:48:37 +0000 (11:48 -0700)]
ipq4018: add initial IPQ4018/IPQ4019 support

Summary:
This adds required IPQ4018/IPQ4019 SoC support to boot.
It also includes support for disabling the ARMv7 hardware
breakpoint / debug stuff at compile time as this is
required for the IPQ SoCs, and printing out the undefined
instruction itself.

Test Plan: * compiled/booted on an IPQ4019 SoC AP

Reviewers: #core_team!

Subscribers: imp, andrew

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

3 days agoarm: add a std.qca for 32 bit armv7 platforms
Adrian Chadd [Sat, 16 Oct 2021 18:48:02 +0000 (11:48 -0700)]
arm: add a std.qca for 32 bit armv7 platforms

This is the minimal config required to boot on the IPQ4018 SoC
and likely future ones as well in this family.

3 days agoipq4018: add initial IPQ4018/IPQ4019 support
Adrian Chadd [Sat, 16 Oct 2021 18:47:44 +0000 (11:47 -0700)]
ipq4018: add initial IPQ4018/IPQ4019 support

This is for the Qualcomm Atheros quad-core ARMv7 SoC with built-in
2x2 2GHz and 5GHz ath10k devices.

It's enough (with an upcoming set of config files) to netboot
on an ASUS router I have here and get to a single core mountroot
prompt.

3 days agoarm: allow the debug stuff in CP14 to be disabled at compile time
Adrian Chadd [Sat, 16 Oct 2021 18:32:08 +0000 (11:32 -0700)]
arm: allow the debug stuff in CP14 to be disabled at compile time

The upcoming QCA ipq401x support detects the CP14 debug features,
but any attempt to use it causes an undefined instruction error.
It apparently needs a specific TZ image loaded by the early bootloader
(SBL) in order to enable these kinds of features.

So add a new kernel option that explicitly disables this in the
arm code - the debugger works fine without it.

3 days agoarm: print out the undefined instruction upon an undefined instruction panic
Adrian Chadd [Sat, 16 Oct 2021 03:15:15 +0000 (20:15 -0700)]
arm: print out the undefined instruction upon an undefined instruction panic

It's SUPER useful to be able to see the actual undefined instruction
when we hit said undefined instruction.

3 days agoipq4018: add a device tree file for the ASUS rt-ac58u router
Adrian Chadd [Sat, 16 Oct 2021 03:13:04 +0000 (20:13 -0700)]
ipq4018: add a device tree file for the ASUS rt-ac58u router

This is the initial device tree file describing the ASUS
RT-AC58U 2GHz/5GHz 11ac router.

Obtained from: OpenWRT

3 days agoipq4018: add TCSR definitions from Linux.
Adrian Chadd [Sat, 16 Oct 2021 03:11:46 +0000 (20:11 -0700)]
ipq4018: add TCSR definitions from Linux.

These are hardware configuration options which are required in
the linux/openwrt device trees for the IPQ4018/IPQ4019 devices.

Since this isn't obtained from linux upstream but instead from
openwrt, this can't go in contrib; instead it is going in
sys/dts/include/ .

Obtained from: OpenWRT

Tested:

* IPQ4019 ASUS RT-AC58U AP, initial bootstrapping

3 days agoin_mcast: garbage collect inp_gcmoptions()
Gleb Smirnoff [Mon, 18 Oct 2021 18:36:07 +0000 (11:36 -0700)]
in_mcast: garbage collect inp_gcmoptions()

It is is used only once, merge it into inp_freemoptions().