Commit Graph

269336 Commits

Author SHA1 Message Date
Konstantin Belousov
f833ab9dd1 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
2021-10-19 23:04:34 +03:00
Konstantin Belousov
7ae879b14a 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
2021-10-19 23:04:34 +03:00
Konstantin Belousov
31faa565ed 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
2021-10-19 23:04:33 +03:00
Gleb Smirnoff
1fec1fa814 sockstat: don't query jail vnet if system is running without VIMAGE.
Fixes:  f1cd4902bf
2021-10-19 09:49:35 -07:00
Gleb Smirnoff
32723a3ba9 sockstat: make err(3) on jail errors more verbose. 2021-10-19 09:49:35 -07:00
Toomas Soome
98e805b4a1 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
2021-10-19 19:43:56 +03:00
Mateusz Guzik
bcd4c17cca pf: fix some cc --analyze warnings
Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-10-19 11:59:11 +00:00
Emmanuel Vadot
225639e7db 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
2021-10-19 09:37:28 +02:00
Felix Johnson
bad324ace4 devd(8): Note default config file search locations
PR:		197003
MFC after:	3 days
Reported by:	Harald Schmalzbauer <bugzilla.freebsd@omnilan.de>
2021-10-19 00:37:40 -04:00
Pawel Jakub Dawidek
a95c82bed8
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
2021-10-18 16:50:33 -07:00
Ed Maste
1a724aa972 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: 		0e1e341b48 ("Stop using lorder and ranlib when...")
Sponsored by:	The FreeBSD Foundation
2021-10-18 19:29:22 -04:00
Rick Macklem
52dee2bc03 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
2021-10-18 15:05:34 -07:00
Konstantin Belousov
73dddffc31 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
2021-10-19 01:02:47 +03:00
Ed Maste
e1d6d6f924 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
2021-10-18 17:21:17 -04:00
Adrian Chadd
015ff812d6 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
2021-10-18 19:19:06 +00:00
Adrian Chadd
fb7a007728 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.
2021-10-18 19:19:03 +00:00
Adrian Chadd
02438ce5fd 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.
2021-10-18 19:19:00 +00:00
Adrian Chadd
c29c0e6876 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.
2021-10-18 19:18:56 +00:00
Adrian Chadd
8398d52d65 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.
2021-10-18 19:18:52 +00:00
Adrian Chadd
9264bd386c 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
2021-10-18 19:18:46 +00:00
Adrian Chadd
8e53cd7099 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
2021-10-18 19:18:01 +00:00
Gleb Smirnoff
9b7501e797 in_mcast: garbage collect inp_gcmoptions()
It is is used only once, merge it into inp_freemoptions().
2021-10-18 11:36:07 -07:00
Gleb Smirnoff
0f617ae48a Add in_pcb_var.h for KPIs that are private to in_pcb.c and in6_pcb.c. 2021-10-18 10:19:57 -07:00
Gleb Smirnoff
147f018a72 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().
2021-10-18 10:19:03 -07:00
Gleb Smirnoff
744a64bd92 in_pcb: garbage collect in_pcbrele() 2021-10-18 10:07:16 -07:00
Gleb Smirnoff
5a78df20ce in_pcb: garbage collect unused structure in_pcblist 2021-10-18 10:06:39 -07:00
Kyle Evans
8c22b9f3ba 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
2021-10-18 11:09:00 -05:00
Ed Maste
576b58108c 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:		f448c3ed4a ("openssh: Add new source files to libssl")
Fixes:		19261079b7 ("openssh: update to OpenSSH v8.7p1")
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32529
2021-10-18 10:47:20 -04:00
Warner Losh
7881db8346 Remove POWER_PM_TYPE_APM. It's now unused.
Sponsored by:		Netflix
Reviewed by:		markj
Differential Revision:	https://reviews.freebsd.org/D32549
2021-10-18 08:41:17 -06:00
Mark Johnston
77bc75c7ab bhyve: Fix the WITH_BHYVE_SNAPSHOT build
Note, this breaks compatibility with snapshots generated by older builds
of bhyve(8).

Fixes: 7fa2335347 ("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
2021-10-18 09:56:59 -04:00
Mark Johnston
621fd9dcb2 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
2021-10-18 09:56:59 -04:00
Mark Johnston
06ebadc5f5 x86: Remove some leftover APM support
This is obsolete since commit 8c576a279e ("Remove APM BIOS support").

Reviewed by:	imp, kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32510
2021-10-18 09:56:59 -04:00
Mark Johnston
81f2e9063d 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
2021-10-18 09:56:58 -04:00
Mark Johnston
de8554295b 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
9068f6ea69.

Reviewed by:	cem, kib, jhb
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32029
2021-10-18 09:56:58 -04:00
Mark Johnston
51425cb210 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
2021-10-18 09:56:58 -04:00
Mark Johnston
36e4dcf47d safexcel: Set the context record unconditionally
The condition added in commit 5bdb8b273a excludes plain SHA
transforms, so for such sessions crypto operations would return
incorrect results.

Fixes:	5bdb8b273a ("safexcel: Maintain per-session context records")
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-10-18 09:50:42 -04:00
Mark Johnston
b0423d0f5e 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
2021-10-18 09:50:42 -04:00
Peter Holm
6deacc1b3b stress2: Move test added by mistake
Reported by: markj
2021-10-18 13:30:42 +00:00
Peter Holm
26c1772071 stress2: Added a syzkaller reproducer 2021-10-18 07:39:55 +00:00
Philip Paeps
6b7d3b4de8 contrib/tzdata: import tzdata 2021d
Merge commit 'c28d35783173c0b09ca1f7e29d2565b1602f733d'

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

MFC after:	3 days
2021-10-18 14:19:42 +08:00
Philip Paeps
c28d357831 Import tzcode 2021d 2021-10-18 14:17:22 +08:00
Rick Macklem
d95c0a12a2 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
2021-10-17 17:50:56 -07:00
Colin Percival
52e125c2bd 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:	46dd801acb Add userland boot profiling to TSLOG
Sponsored by:	https://www.patreon.com/cperciva
2021-10-17 13:36:38 -07:00
Jessica Clarke
0d6516b453 Bump __FreeBSD_version for LinuxKPI changes 2021-10-17 15:35:48 +01:00
Jessica Clarke
82098c8bb5 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
2021-10-17 15:32:35 +01:00
Jessica Clarke
60d962e041 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
2021-10-17 15:32:20 +01:00
Jessica Clarke
682c00a6ce 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
2021-10-17 15:31:35 +01:00
Edward Tomasz Napierala
0f559a9f09 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
2021-10-17 13:49:29 +01:00
Edward Tomasz Napierala
70774c637b 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
2021-10-17 13:46:00 +01:00
Edward Tomasz Napierala
99f563ed76 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
2021-10-17 13:19:10 +01:00