Commit Graph

279133 Commits

Author SHA1 Message Date
Mitchell Horne
3317848808 linux, linux64: improve SRCS formatting
Sort the entries alphabetically, and list them with one entry per line.
This makes the diffs much cleaner when adding or removing a new entry,
as I will do in the next commit.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-10-29 13:11:24 -03:00
Mark Johnston
1f6b6cf177 atomic: Intercept atomic_(load|store)_bool for kernel sanitizers
Fixes:		2bed73739a ("atomic: Add plain atomic_load/store_bool()")
2022-10-29 11:10:58 -04:00
Mike Karels
234c1463a7 genet: add another case where headers need pullup
Wake On LAN packets sent by wake(8) via BPF are lost if txcsum is
enabled.  These fall into the "other protocol" case where gen_parse_tx
did nothing.  Add code to shift up to gen_tx_hdr_min bytes of the
packet along with the Ethernet header in this case.
2022-10-29 07:52:57 -05:00
Konstantin Belousov
6b69465efb vfs_domount(): ensure that v_mountedhere and VIRF_MOUNTPOINT are set under the vnode lock
Fixes:	f7833196bd
Reported and tested by:	pho
Reviewed by:	jah, markj (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37198
2022-10-29 14:29:55 +03:00
Doug Moore
8b221ca631 iommu_gas: start space search from 1st free space
Maintain a pointer to an element in the domain map that is left of any
sufficiently large free gap in the tree and start the search for free
space there, rather than at the root of the tree. On find_space, move
that pointer to the leftmost leaf in the subtree of nodes with
free_down greater than or equal to the minimum allocation size before
starting the search for space from that pointer. On removal of a node
with address less than that pointer, update that pointer to point to
the predecessor or successor of the removed node.

In experiments with netperf streaming, this reduces by about 40% the
number of map entries examined in first-fit allocation.

Reviewed by:	alc, kib
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D36624
2022-10-29 00:50:44 -05:00
Kyle Evans
0283826706 usr.bin: hook wg(8) up to the build
wg(8) is used to manage WireGuard interfaces; see wg(4) and wg(8) both
for more details and usage examples.
2022-10-28 22:05:39 -05:00
Kyle Evans
adf3764857 Add 'contrib/wireguard-tools/' from commit '7e00bf8773b93a2a3ee28dba2710d2ae443989f1'
git-subtree-dir: contrib/wireguard-tools
git-subtree-mainline: 9142a2a37b
git-subtree-split: 7e00bf8773
2022-10-28 22:05:14 -05:00
Kyle Evans
7e00bf8773 Import wireguard-tools for wg(8)
744bfb2131 ("Import the WireGuard driver from zx2c4.com") re-imported
the WireGuard driver with the intention that wg(8) will be used to
manage WireGuard interfaces, as on other platforms, now that wg(8) has
been dual-licensed MIT specifically to allow our use in base (thanks!).

This is a copy of wireguard-tools/src, with files that we don't need
.gitignore'd out to make it more clear that we're only building files
that are either MIT or dual-licensed MIT.  We may go with a different
structure later (e.g., if we end up needing to include outside of src/),
but an upstream restructure seems unlikely in the foreseeable future.
2022-10-28 21:42:39 -05:00
Philip Paeps
9142a2a37b contrib/tzdata: import tzdata 2022f
Changes: https://github.com/eggert/tz/blob/2022f/NEWS

MFC after:	3 days
2022-10-29 10:38:01 +08:00
Philip Paeps
46649025f4 Import tzdata 2022f 2022-10-29 10:33:53 +08:00
Mitchell Horne
aba921bd9e ddb: print the actual syscall name
Some architectures will pretty-print a system call trap in the
backtrace. Rather than printing the symbol, use the syscallname()
function to pull the string from the sv_syscallnames array corresponding
to the process. This simplifies the function somewhat.

Mostly, this will result in dropping the "sys" prefix, e.g. "sys_exit"
will now be printed simply as "exit".

Make two minor tweaks to the function signature: use a u_int for the
syscall number since this is a more correct type (see the 'code' member
of struct syscall_args), and make the thread pointer the first argument.
The latter is more natural and conventional.

Suggested by:   jrtc27
Reviewed by:	jrtc27, markj, jhb
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37200
2022-10-28 18:21:08 -03:00
Mitchell Horne
1da65dcb1c linux: populate sv_syscallnames in each sysentvec
This allows the syscallname() function to give a usable result for Linux
ABIs.

Reported by:	jrtc27
Reviewed by:	jrtc27, markj, jhb
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37199
2022-10-28 18:21:08 -03:00
Andrew Turner
fe36346a89 Disable Hyper-V on arm64
It unconditionally calls into the Hyper-V firmware. As most arm64
boards don't have said firmware disable it for now.
2022-10-28 22:17:00 +01:00
Andrew Turner
16c10e99b8 Remove the hyperv option from std.dev
It's already in std.hyperv and we don't need to repeat it here.
2022-10-28 22:17:00 +01:00
Mark Johnston
89585511cc release: Add support for creating ZFS-based VM images
The change extends vmimage.subr to handle a new parameter, VMFS, which
should be equal to either "ufs" or "zfs".  When it is set to ZFS, we use
makefs to create a bootable pool populated using the same dataset layout
as bsdinstall and "poudriere image" use.  The pool can be grown using
the growfs rc.d script, just as in UFS images.

This will make it easy to provide VM and cloud images with ZFS as the
root filesystem.  So far I did not do extensive testing of cloud images;
I merely verified that creation of ZFS-based AWS AMIs works and allows
me to create amd64 and arm64 EC2 instances with ZFS as the root
filesystem.

Reviewed by:	emaste, gjb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34426
2022-10-28 17:00:24 -04:00
Mark Johnston
752ba1004a makefs: Fix handling of inherited mountpoints
Commit d7eec79b70 overlooked the fact that
nvlist_find(DATA_TYPE_STRING) does not provide a nul-terminated string.
Fix the leak a different way.

Fixes:	d7eec79b70 ("makefs: Plug a memory leak")
2022-10-28 17:00:22 -04:00
John Baldwin
854d066251 wg: Trim compat shims for versions older than current stable/13.
Reviewed by:	kevans, markj, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36913
2022-10-28 13:36:13 -07:00
John Baldwin
c640d1af2c wg: Retire now unused support.h.
Reviewed by:	kevans, markj, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36912
2022-10-28 13:36:13 -07:00
John Baldwin
dcf581bb49 wg: Use zfree.
Reviewed by:	kevans, markj, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36911
2022-10-28 13:36:13 -07:00
John Baldwin
e32e1a160e wg: Use atomic(9) instead of concurrency-kit atomics.
Kernel sanitizers only support atomic(9) operations.

Reviewed by:	kevans, markj, emaste
Reported by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36910
2022-10-28 13:36:13 -07:00
John Baldwin
744bfb2131 Import the WireGuard driver from zx2c4.com.
This commit brings back the driver from FreeBSD commit
f187d6dfbf plus subsequent fixes from
upstream.

Relative to upstream this commit includes a few other small fixes such
as additional INET and INET6 #ifdef's, #include cleanups, and updates
for recent API changes in main.

Reviewed by:	pauamma, gbe, kevans, emaste
Obtained from:	git@git.zx2c4.com:wireguard-freebsd @ 3cc22b2
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36909
2022-10-28 13:36:12 -07:00
John Baldwin
9e0aaedd70 Split netinet shell tests into one per line.
This makes diffs when adding or removing tests easier to read.

While here, sort the list of tests.

Reviewed by:	kevans, melifaro, asomers, markj, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36908
2022-10-28 13:36:12 -07:00
Warner Losh
31bfa27894 sys/modules: Catchup to armv[45] being removed
Now that armv[45] are removed, simplify some tests for armv[67] that are
now either always true, or always true when we're on arm.

Sponsored by:		Netflix
2022-10-28 14:11:04 -06:00
Warner Losh
c8a63d71fe sys/modules: Delete now empty if
Ah, the joys of pushing a commit with a dirty editor buffer that all the
checks in git didn't catch... Also, my eyeballs missed it too :(.

Fixes:		ba9f71ddec
Noticed by:	jrtc27
Sponsored by:	Netflix
2022-10-28 14:10:09 -06:00
Colin Percival
5ad8c32c72 ns8250: Fix sense of LSR_TEMT FCR check
When flushing the UART, we need to drain manually if LSR_TEMT is
*not* asserted, aka. if the transmit FIFO is not empty.

Reported by:	void <void@f-m.fm>
Fixes:		c4b68e7e53 "ns8250: Check if flush via FCR succeeded"
Differential Revision:	https://reviews.freebsd.org/D37185
2022-10-28 12:20:28 -07:00
Warner Losh
ba9f71ddec sys/modules: simplify a little by moving syscons to x86 only
syscons is x86 only now that sparc has been retired. No need for the
extra if. Also alphabetize p2sb.

Sponsored by:		Netflix
2022-10-28 11:52:40 -06:00
Warner Losh
445875aefd sys/modules: tidy up a bit by moving _hyperv to aarch64 section
Suggested by:	jhb
Sponsored by:	Netflix
2022-10-28 11:46:48 -06:00
Andrew Turner
227046a4d2 Enable more extres options when FDT is missing
These now build when FDT is not included in the kernel config.

Sponsored by:	Innovate UK
2022-10-28 18:31:56 +01:00
Andrew Turner
5566f84822 Only include regdev_if.h when it's needed
We don't need to include regdev_if.h when not building for FDT.

Sponsored by:	Innovate UK
2022-10-28 18:31:55 +01:00
Andrew Turner
01aaff6d1c Fix the includes in regulator_fixed.c
Include sys/bus.h directly rather than depend on header pollution.
While here fix the order of sys/systm.h.

Sponsored by:	Innovate UK
2022-10-28 18:31:55 +01:00
Andrew Turner
78e60ba04a Only include phydev_if.h when needed
We only need to include phydev_if.h in phy.c when FDT is enabled and
don't need it at all in phy_usb.c.

Sponsored by:	Innovate UK
2022-10-28 18:31:55 +01:00
Andrew Turner
754358108c Include sys/systm.h in phy_usb.c for KASSERT
Rather than depending on header pollution include systm.h directly.

Sponsored by:	Innovate UK
2022-10-28 18:31:55 +01:00
Andrew Turner
8724dd26d4 Allow clk_fixed.c to be built without FDT
Include opt_platform.h to get the FDT definition and only include FDT
headers when FDT is defined.

Sponsored by:	Innovate UK
2022-10-28 18:31:55 +01:00
Andrew Turner
83de695791 Remove unneeded headers from clk_link.c
There is no OFW/FDT specific code in this file so the ofw headers can
be removed.

Sponsored by:	Innovate UK
2022-10-28 18:31:55 +01:00
Mitchell Horne
701923e2a4 riscv: improve parsing of riscv,isa property strings
This code was originally written under the assumption that the ISA
string would only contain single-letter extensions. The RISC-V
specification has extended its description of the format quite a bit,
allowing for much longer ISA strings containing multi-letter extension
names.

Newer versions of QEMU (7.1.0) will append to the riscv,isa property
indicating the presence of multi-letter standard extensions such as
Zfencei. This triggers a KASSERT about the expected length of the
string, preventing boot.

Increase the size of the isa array significantly, and teach the code
to parse (skip over) multi-letter extensions, and optional extension
version numbers. We currently ignore them completely, but this will
change in the future as we start supporting supervisor-level extensions.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36601
2022-10-28 13:28:08 -03:00
Jung-uk Kim
5723d13811 acpica: Fix the botched merge
Fixes:		9a4bc5208f acpica: Import ACPICA 20221020
2022-10-27 22:36:35 -04:00
Jung-uk Kim
19ee8335c5 acpica: Merge ACPICA 20221020 2022-10-27 22:04:32 -04:00
Jung-uk Kim
9a4bc5208f acpica: Import ACPICA 20221020
(cherry picked from commit a799bdd9d50e84cd6a36e8f1d2ac4301b2a6b374)
2022-10-27 22:03:50 -04:00
Olivier Houchard
d78c2cd831 arm64: Implement cpu_ptrace().
Add a minimal implementation of cpu_ptrace() for arm64. It is only used to
get/set VFP registers for 32bits binaries, as it is apparently what we use
there, instead of the MI PT_GETFPREGS/PT_SETFPREGS.

PR:	267361
MFC After: 1 week
2022-10-27 23:25:56 +02:00
Dag-Erling Smørgrav
473e9fcab4 script: Handle a missing 's' stamp gracefully.
Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37182
2022-10-27 20:11:36 +00:00
Dag-Erling Smørgrav
6ac087cf8f script: Further usage string nits.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D37177
2022-10-27 19:49:18 +00:00
Dag-Erling Smørgrav
3276866f40 script: Use size_t / ssize_t where needed.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D37177
2022-10-27 19:49:18 +00:00
Warner Losh
8e9a651acb hyperv: Don't build on 32-bit arm
Sponsored by:		Netflix
2022-10-27 13:18:52 -06:00
Andrew Turner
49750143c1 Add a LINT-ACPI arm64 config
To ensure a kernel with only ACPI builds add a LINT file with FDT
disabled.

Sponsored by:	The FreeBSD Foundation
2022-10-27 18:59:33 +01:00
Andrew Turner
701ab6dba4 Stop building FDT-only modules in an ACPI only kernel
When building a kernel without FDT these modules don't build. As they
depend on FDT and don't work with ACPI disable them.

Reviewed by:	imp, kevans
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37178
2022-10-27 18:59:33 +01:00
Warner Losh
02dba4f75f kboot: Add hostfs
Add hostfs for the Linux environment. We can't use the userboot one
that's kinda similar because the Linux system calls we have in kboot are
not quite POSIX compliant (Linux takes care of providing the POSIX
interface in libc), so we have to cope with a number of quirks in that
area.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D36607
2022-10-27 11:37:54 -06:00
Warner Losh
cc9f1b4c35 stand/kboot: Make FDT fixup per-arch
The fixups needed vary somewhat by architecture, so move the FDT fixup
to be per-arch. Rename the fdt_linux_fixup() routine to be
fdt_arch_fixup() and expect all architecutres to fix things up as
needed.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D36604
2022-10-27 11:36:51 -06:00
Warner Losh
1d21f64149 bhyve: Implement MSR_MISC_FEATURES_ENABLES
Linux reads MISC_FEATURES_ENABLES to manage the CPUID faulting feature
(undocumented in the Intel SDM, but documented in 323850-004 (Intel
Virtualization Technology FlexMigration Application Note). Since bhyve
doesn't emulate this feature, we always return 0. Neither does bhyve
support the MONITOR/MWAIT fault bit also in this MSR (which is
documented in the sdm), so always return 0.

Sponsored by:		Netflix
Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D36602
2022-10-27 11:34:41 -06:00
Math Ieu
172be8642d split: reset errno prior to getline()
Something else may have set errno, breaking the post-getline() logic
that tries to detect the getline() error.  This was initially noted in
a jail on a system that has HPET, in a jail that does not expose
/dev/hpet0 -- we see an earlier error in libc's vdso bits.

Fixes:	5c053aa3c5 ("split: switch to getline() [...]")
2022-10-27 12:17:59 -05:00
Andrew Turner
ff270fce16 Make sure error is defined in dpaa2
The error variable is used in both the ACPI and FDT paths. Declare it
unconditionally.

Sponsored by:	The FreeBSD Foundation
2022-10-27 18:03:32 +01:00