freebsd.git
2 years 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

2 years 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

2 years 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

2 years 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 years 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 years 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 years 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 years agotimeout: style fixes
Baptiste Daroussin [Wed, 20 Oct 2021 08:44:32 +0000 (10:44 +0200)]
timeout: style fixes

2 years 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 years agoUPDATING: fix style
Baptiste Daroussin [Wed, 20 Oct 2021 07:44:44 +0000 (09:44 +0200)]
UPDATING: fix style

Reported by: danfe

2 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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

2 years 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")

2 years 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

2 years 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>

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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

2 years 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

2 years 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().

2 years agoAdd in_pcb_var.h for KPIs that are private to in_pcb.c and in6_pcb.c.
Gleb Smirnoff [Mon, 18 Oct 2021 17:14:03 +0000 (10:14 -0700)]
Add in_pcb_var.h for KPIs that are private to in_pcb.c and in6_pcb.c.

2 years agoMove in6_pcbsetport() to in6_pcb.c
Gleb Smirnoff [Mon, 18 Oct 2021 17:11:20 +0000 (10:11 -0700)]
Move in6_pcbsetport() to in6_pcb.c

This function was originally carved out of in6_pcbbind(), which
is in in6_pcb.c. This function also uses KPI private to the PCB
database - in_pcb_lport().

2 years agoin_pcb: garbage collect in_pcbrele()
Gleb Smirnoff [Tue, 27 Apr 2021 22:11:08 +0000 (15:11 -0700)]
in_pcb: garbage collect in_pcbrele()

2 years agoin_pcb: garbage collect unused structure in_pcblist
Gleb Smirnoff [Tue, 27 Apr 2021 17:43:56 +0000 (10:43 -0700)]
in_pcb: garbage collect unused structure in_pcblist

2 years agoFix cross-building on Linux/aarch64
Kyle Evans [Mon, 18 Oct 2021 02:26:47 +0000 (21:26 -0500)]
Fix cross-building on Linux/aarch64

Add necessary bits to detect ELF format on Linux/aarch64; note that
Linux calls it aarch64 where we would typically call it arm64 (uname -m)

Reviewed by: arichardson, emaste, imp
Sponsored by: Ampere Computing LLC
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D32542

2 years agolibssh: correct libssh src file list
Ed Maste [Fri, 15 Oct 2021 16:21:23 +0000 (12:21 -0400)]
libssh: correct libssh src file list

Link against the ssh-sk-helper client rather than the sk internal
implementation.

PR: 258384
Tested by: madpilot
Fixes: f448c3ed4ae1 ("openssh: Add new source files to libssl")
Fixes: 19261079b743 ("openssh: update to OpenSSH v8.7p1")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32529

2 years agoRemove POWER_PM_TYPE_APM. It's now unused.
Warner Losh [Mon, 18 Oct 2021 14:41:17 +0000 (08:41 -0600)]
Remove POWER_PM_TYPE_APM. It's now unused.

Sponsored by: Netflix
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D32549

2 years agobhyve: Fix the WITH_BHYVE_SNAPSHOT build
Mark Johnston [Sat, 16 Oct 2021 17:13:26 +0000 (13:13 -0400)]
bhyve: Fix the WITH_BHYVE_SNAPSHOT build

Note, this breaks compatibility with snapshots generated by older builds
of bhyve(8).

Fixes: 7fa233534736 ("bhyve: Map the MSI-X table unconditionally for passthrough")
Reported by: Greg V <greg@unrelenting.technology>
Reviewed by: grehan, bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32523

2 years agotimecounter: Lock the timecounter list
Mark Johnston [Sat, 16 Oct 2021 13:46:55 +0000 (09:46 -0400)]
timecounter: Lock the timecounter list

Timecounter registration is dynamic, i.e., there is no requirement that
timecounters must be registered during single-threaded boot.  Loadable
drivers may in principle register timecounters (which can be switched to
automatically).  Timecounters cannot be unregistered, though this could
be implemented.

Registered timecounters belong to a global linked list.  Add a mutex to
synchronize insertions and the traversals done by (mpsafe) sysctl
handlers.  No functional change intended.

Reviewed by: imp, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32511

2 years agox86: Remove some leftover APM support
Mark Johnston [Sat, 16 Oct 2021 13:46:43 +0000 (09:46 -0400)]
x86: Remove some leftover APM support

This is obsolete since commit 8c576a279ed5 ("Remove APM BIOS support").

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

2 years agosignal: Add SIG_FOREACH and refactor issignal()
Mark Johnston [Sat, 16 Oct 2021 13:44:40 +0000 (09:44 -0400)]
signal: Add SIG_FOREACH and refactor issignal()

Add a SIG_FOREACH macro that can be used to iterate over a signal set.
This is a bit cleaner and more efficient than calling sig_ffs() in a
loop.  The implementation is based on BIT_FOREACH_ISSET(), except
that the bitset limbs are always 32 bits wide, and signal sets are
1-indexed rather than 0-indexed like bitset(9) sets.

issignal() cannot really be modified to use SIG_FOREACH() directly.
Take this opportunity to split the function into two explicit loops.
I've always found this function hard to read and think that this change
is an improvement.

Remove sig_ffs(), nothing uses it now.

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

2 years agocpuset(9): Add CPU_FOREACH_IS(SET|CLR) and modify consumers to use it
Mark Johnston [Tue, 21 Sep 2021 15:36:55 +0000 (11:36 -0400)]
cpuset(9): Add CPU_FOREACH_IS(SET|CLR) and modify consumers to use it

This implementation is faster and doesn't modify the cpuset, so it lets
us avoid some unnecessary copying as well.  No functional change
intended.

This is a re-application of commit
9068f6ea697b1b28ad1326a4c7a9ba86f08b985e.

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

2 years agobitset: Reimplement BIT_FOREACH_IS(SET|CLR)
Mark Johnston [Sat, 16 Oct 2021 13:38:26 +0000 (09:38 -0400)]
bitset: Reimplement BIT_FOREACH_IS(SET|CLR)

Eliminate the nested loops and re-implement following a suggestion from
rlibby.

Add some simple regression tests.

Reviewed by: rlibby, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32472

2 years agosafexcel: Set the context record unconditionally
Mark Johnston [Mon, 18 Oct 2021 13:40:47 +0000 (09:40 -0400)]
safexcel: Set the context record unconditionally

The condition added in commit 5bdb8b273aaf excludes plain SHA
transforms, so for such sessions crypto operations would return
incorrect results.

Fixes: 5bdb8b273aaf ("safexcel: Maintain per-session context records")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoamd64: Zero the PML5 PTI page when initializing a pmap
Mark Johnston [Mon, 18 Oct 2021 13:29:20 +0000 (09:29 -0400)]
amd64: Zero the PML5 PTI page when initializing a pmap

The root page is not zeroed at allocation time since with 4-level tables
each entry is copied from a template.  However, with 5-level tables only
a single entry is filled, so the rest need to be cleared.

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

2 years agostress2: Move test added by mistake
Peter Holm [Mon, 18 Oct 2021 13:30:42 +0000 (13:30 +0000)]
stress2: Move test added by mistake
Reported by: markj

2 years agostress2: Added a syzkaller reproducer
Peter Holm [Mon, 18 Oct 2021 07:39:55 +0000 (07:39 +0000)]
stress2: Added a syzkaller reproducer

2 years agocontrib/tzdata: import tzdata 2021d
Philip Paeps [Mon, 18 Oct 2021 06:19:42 +0000 (14:19 +0800)]
contrib/tzdata: import tzdata 2021d

Merge commit 'c28d35783173c0b09ca1f7e29d2565b1602f733d'

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

MFC after: 3 days

2 years agoImport tzcode 2021d
Philip Paeps [Mon, 18 Oct 2021 06:17:22 +0000 (14:17 +0800)]
Import tzcode 2021d

2 years agonfscl: Modify Close RPC so that it does not use "owner" for NFSv4.1/4.2
Rick Macklem [Mon, 18 Oct 2021 00:50:56 +0000 (17:50 -0700)]
nfscl: Modify Close RPC so that it does not use "owner" for NFSv4.1/4.2

This patch modifies the function that does the Close RPC (nfsrpc_closerpc)
so that it does not use the open_owner (nfso_own) for NFSv4.1/4.2.
Use of the seqid in the open_owner structure is only needed for NFSv4.0.
Same applies to a NFSERR_STALESTATEID reply, which should only happen
for NFSv4.0.  This allows nfsrpc_closerpc() to be called when nfso_own
is no longer valid.  This, in turn, allows nfsrpc_closerpc() to be called
after the shared lock on the clientID is released, for NFSv4.1/4.2.

This is being done to prepare the code for a future patch that fixes
the case where an NFSv4.1/4.2 server replies NFSERR_DELAY to a Close
operation.

MFC after: 2 week

2 years agoTSLOG: Report final execname, not first
Colin Percival [Sun, 17 Oct 2021 20:36:38 +0000 (13:36 -0700)]
TSLOG: Report final execname, not first

In cases such as daemons launched via limits(1), a process may call
exec multiple times; the last name of the last binary executed is
usually (always?) more informative.

Fixes: 46dd801acb23 Add userland boot profiling to TSLOG
Sponsored by: https://www.patreon.com/cperciva

2 years agoBump __FreeBSD_version for LinuxKPI changes
Jessica Clarke [Sun, 17 Oct 2021 14:35:48 +0000 (15:35 +0100)]
Bump __FreeBSD_version for LinuxKPI changes

2 years agoLinuxKPI: Support lazy BAR allocation
Jessica Clarke [Sun, 17 Oct 2021 14:32:35 +0000 (15:32 +0100)]
LinuxKPI: Support lazy BAR allocation

Linux KPIs like pci_resource_start/len assume that BARs have been
allocated, but FreeBSD lazily allocates BARs if it cannot allocate the
firmware-allocated BARs. Thus using the Linux KPIs must force allocation
of the BARs rather than returning 0 for the start and length, which can
crash drm-kmod drivers that assume the BARs are valid. This is needed
for the AMDGPU driver to be able to attach on SiFive's HiFive Unmatched.

Reviewed by: hselasky, jhb, mav
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32447

2 years agoLinuxKPI: Implement _ioremap_attr for riscv
Jessica Clarke [Sun, 17 Oct 2021 14:32:20 +0000 (15:32 +0100)]
LinuxKPI: Implement _ioremap_attr for riscv

Now that riscv implements pmap_mapdev_attr we can enable the non-stub
implementation for riscv, which is needed for drm-kmod to not fail at
run time for drivers that need to map I/O regions.

Reviewed by: hselasky, bz
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32446

2 years agoriscv: Implement pmap_mapdev_attr
Jessica Clarke [Sun, 17 Oct 2021 14:31:35 +0000 (15:31 +0100)]
riscv: Implement pmap_mapdev_attr

This is needed for LinuxKPI's _ioremap_attr. This reuses the generic
implementation introduced for aarch64, and itself requires implementing
pmap_kenter, which is trivial to do given riscv currently treats all
mapping attributes the same due to the Svpbmt extension not yet being
ratified and in hardware.

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

2 years agoMake vmdaemon timeout configurable
Edward Tomasz Napierala [Sun, 17 Oct 2021 12:48:50 +0000 (13:48 +0100)]
Make vmdaemon timeout configurable

Make vmdaemon timeout configurable, so that one can adjust
how often it runs.

Here's a trick: set this to 1, then run 'limits -m 0 sh',
then run whatever you want with 'ktrace -it XXX', and observe
how the working set changes over time.

Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D22038

2 years agoprocfs: Document as deprecated
Edward Tomasz Napierala [Sun, 17 Oct 2021 12:44:19 +0000 (13:44 +0100)]
procfs: Document as deprecated

Update the procfs(5) man page to clarify that it's deprecated.

Reviewed By: bcr, 0mp (earlier version)
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D22275

2 years agolinux: recognize TCP_INFO and ratelimit the warning
Edward Tomasz Napierala [Sun, 17 Oct 2021 12:19:05 +0000 (13:19 +0100)]
linux: recognize TCP_INFO and ratelimit the warning

This ratelimits the "unsupported getsockopt level 6 optname 11"
warnings that happen all the time when watching Netflix.

Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D32454

2 years agolinux: Improve debugging for PTRACE_GETREGSET
Edward Tomasz Napierala [Sun, 17 Oct 2021 11:52:39 +0000 (12:52 +0100)]
linux: Improve debugging for PTRACE_GETREGSET

It's triggered by gdb(1).

Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D32456

2 years agolinux: Implement some bits of PTRACE_PEEKUSER
Edward Tomasz Napierala [Sun, 17 Oct 2021 11:20:16 +0000 (12:20 +0100)]
linux: Implement some bits of PTRACE_PEEKUSER

This makes Linux gdb from Bionic a little less broken.

Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D32455

2 years agolinux: Adjust PTRACE_GET_SYSCALL_INFO buffer size semantics
Edward Tomasz Napierala [Sun, 17 Oct 2021 10:49:42 +0000 (11:49 +0100)]
linux: Adjust PTRACE_GET_SYSCALL_INFO buffer size semantics

The tests/ptrace_syscall_info test from strace(1) complained
about this.

Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D32368

2 years agolinux: Partially implement TCSBRK
Edward Tomasz Napierala [Sun, 17 Oct 2021 10:19:51 +0000 (11:19 +0100)]
linux: Partially implement TCSBRK

This fixes tcflush(3), unbreaking cheribuild.py under arm64 Focal.

Reviewed By: imp
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D32291

2 years agocache: only assert on flags when dealing with EMPTYPATH
Mateusz Guzik [Sun, 17 Oct 2021 08:40:16 +0000 (10:40 +0200)]
cache: only assert on flags when dealing with EMPTYPATH

Reported by: syzbot+bd48ee0843206a09e6b8@syzkaller.appspotmail.com
Fixes: 7dd419cabc6bb9e0 ("cache: add empty path support")

2 years agomixer.8: Document -h
Mateusz Piotrowski [Sun, 17 Oct 2021 08:02:15 +0000 (10:02 +0200)]
mixer.8: Document -h

2 years agortld: Support DT_RELR relative relocation format
Fangrui Song [Sat, 16 Oct 2021 21:34:37 +0000 (14:34 -0700)]
rtld: Support DT_RELR relative relocation format

PIE and shared objects usually have many relative relocations. In
2017/2018, a compact relative relocation format RELR was proposed on
https://groups.google.com/g/generic-abi/c/bX460iggiKg/m/GxjM0L-PBAAJ
("Proposal for a new section type SHT_RELR") and is a pre-standard.
RELR usually takes 3% or smaller space than R_*_RELATIVE relocations.
The virtual memory size of a mostly statically linked PIE is typically
5~10% smaller.

ld.lld --pack-dyn-relocs=relr emits RELR relocations. DT_RELR has been
adopted by Android bionic, Linux kernel's arm64 port, Chrome OS (patched
glibc).

This patch adds DT_RELR support to FreeBSD rtld-elf.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32524

2 years agosys: Add definitions for RELR relative relocation format
Fangrui Song [Sat, 16 Oct 2021 21:31:42 +0000 (14:31 -0700)]
sys: Add definitions for RELR relative relocation format

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32526

2 years agopf: don't drop packets when redirection information comes from a state
Kristof Provost [Sat, 16 Oct 2021 16:53:39 +0000 (18:53 +0200)]
pf: don't drop packets when redirection information comes from a state

For some traffic there might be no matching rule in the current ruleset,
for example when a state was imported via pfsync from a sytem with a
different ruleset checksum. In this case pf_route uses s->rt_addr for
routing target instead of r->rpool.cur but r->rpool is checked anyway,
resulting in dropped packets.

PR: 259183
Submitted by: Kajetan Staszkiewicz <vegeta tuxpowered.net>
Sponsored by: InnoGames GmbH