]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
14 months agomakefs: make msdos creation go fast
Warner Losh [Mon, 13 Mar 2023 20:28:51 +0000 (14:28 -0600)]
makefs: make msdos creation go fast

Add missing brelse(bp). Without it the cache grows and we have a n^2
lookup.  I'm not entirely sure why we read the block before we write it
back out, since the only side effect of that is to allocate memory,
clear the memory, read it in from disk, throw it away with the contents
of the file being written out. We likely should just do a getblk() here
instead, but even with all that, this takes the time it takes to create
a 150MB msdos fs image down from 5 minutes to 30 seconds.

Old: 317.663u 0.685s 5:18.34 100.0% 198+360k 0+19io 1009pf+0w
New: 7.330u 23.841s 0:31.17 100.0% 198+360k 0+250522io 4pf+0w

See code review for how we got this. tl;dr: netbsd move brelse
into bwrite and we picked up msdos code after that, but not the
move. That change should be picked up later.

Sponsored by: Netflix
Reviewed by: emaste
MFC After: 1 day (13.2 is coming fast)
Differential Revision: https://reviews.freebsd.org/D39025

(cherry picked from commit 370e009188ba90c3290b1479aa06ec98b66e140a)

14 months agoepair: Fix the RSS build
Mark Johnston [Tue, 14 Mar 2023 14:57:33 +0000 (10:57 -0400)]
epair: Fix the RSS build

This is a direct commit to stable/13.

Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
Fixes: c3bd32f225ec ("epair: Avoid loading m_flags into a short")

14 months agoepair: Simplify the transmit path and address lost wakeups
Mark Johnston [Wed, 1 Mar 2023 20:21:30 +0000 (15:21 -0500)]
epair: Simplify the transmit path and address lost wakeups

epairs currently shuttle all transmitted packets through a single global
taskqueue thread.  To hand packets over to the taskqueue thread, each
epair maintains a pair of ring buffers and a lockless scheme for
notifying the thread of pending work.  The implementation can lead to
lost wakeups, causing to-be-transmitted packets to end up stuck in the
queue.

Rather than extending the existing scheme, simply replace it with a
linked list protected by a mutex, and use the mutex to synchronize
wakeups of the taskqueue thread.  This appears to give equivalent or
better throughput with >= 16 producer threads and eliminates the lost
wakeups.

Reviewed by: kp
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D38843

(cherry picked from commit df7bbd8c354a907d2c2f85a6e18f356f76458f57)

14 months agoepair: Avoid loading m_flags into a short
Mark Johnston [Mon, 6 Mar 2023 14:39:17 +0000 (09:39 -0500)]
epair: Avoid loading m_flags into a short

The m_flags field of struct mbuf is 24 bits wide and so gets truncated
in a couple of places in the epair code.  Instead of preserving the
entire flag set, just remember whether M_BCAST or M_MCAST is set.

MFC after: 1 week
Sponsored by: Klara, Inc.

(cherry picked from commit 48227d1c6db8fceaceebbf8578612302d64ca170)

14 months agonetmap: Fix compiler warnings in tools
Mark Johnston [Mon, 27 Feb 2023 18:41:58 +0000 (13:41 -0500)]
netmap: Fix compiler warnings in tools

- Remove write-only variables, or hide them in cases where their use is
  conditional or commented out.
- Check for errors from cmd_apply() in nmreplay.
- Use ANSI C definitions.

Reviewed by: vmaffione
MFC after: 2 weeks
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38752

(cherry picked from commit 538c66eabda55afccebc25fb66548115e5ed8151)

14 months agobhyvectl: Address compiler warnings and bump WARNS
Mark Johnston [Fri, 3 Mar 2023 14:32:48 +0000 (09:32 -0500)]
bhyvectl: Address compiler warnings and bump WARNS

Avoid unaligned accesses in cpu_vendor_intel() and address a few other
nits.  No functional change intended.

Reviewed by: corvink, rew, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38839

(cherry picked from commit 3f5d875a27318a909f23a2b7463c4b2d963085df)

14 months agodeadlkres: Make parameters settable with tunables
Mark Johnston [Fri, 3 Mar 2023 16:16:16 +0000 (11:16 -0500)]
deadlkres: Make parameters settable with tunables

MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: Juniper Networks, Inc.

(cherry picked from commit 831601773e5ab58b9485c1b111eb8c7c7343abf6)

14 months agobhyveload: Address compiler warnings and bump WARNS
Mark Johnston [Fri, 3 Mar 2023 14:52:17 +0000 (09:52 -0500)]
bhyveload: Address compiler warnings and bump WARNS

Mostly sprinkle __unused.  Also duplicate strings passed to addenv() so
that constant string literals can be passed.  No functional change
intended.

Reviewed by: corvink, rew, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38840

(cherry picked from commit ad43dd69cec7b568846b45ff990da6dc86e58467)

14 months agoposixshm tests: Correct page size index checks
Mark Johnston [Fri, 3 Mar 2023 16:16:21 +0000 (11:16 -0500)]
posixshm tests: Correct page size index checks

MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: Juniper Networks, Inc.

(cherry picked from commit 560f9cd5e1e36ba725f3c677d7b8e514af9f3a85)

14 months agobuf: Make buf_daemon_shutdown() a no-op after a panic
Mark Johnston [Wed, 1 Mar 2023 15:07:56 +0000 (10:07 -0500)]
buf: Make buf_daemon_shutdown() a no-op after a panic

As in commit 9d7cc536e261a7, there is no need to do anything in this
context.

MFC after: 1 week

(cherry picked from commit bcd8cd859e694bc4a4dfb6fdb8f55de3a96833b4)

14 months agonvmecontrol: Fix default ns create parameters.
Alexander Motin [Thu, 9 Mar 2023 15:19:00 +0000 (10:19 -0500)]
nvmecontrol: Fix default ns create parameters.

Instead of passing 0xff's for all unset parameters, prefer reasonable
defaults.  It is much easier to use it this was without specs in hand.

PR: 269912
(cherry picked from commit 20dc2c4d11ddaa980c491116b65c51ab522028e9)

14 months agoAdd NAMESPACE MANAGEMENT into admin_opcode[].
Alexander Motin [Wed, 8 Mar 2023 20:42:31 +0000 (15:42 -0500)]
Add NAMESPACE MANAGEMENT into admin_opcode[].

MFC after: 1 week

(cherry picked from commit 49ebbdb264fe185a685dce846985b95f28320e3f)

14 months agoroute.8: Fix mandoc warnings
Gordon Bergling [Sun, 26 Feb 2023 13:33:58 +0000 (14:33 +0100)]
route.8: Fix mandoc warnings

- skipping end of block that is not open: Oc
- no blank before trailing delimiter
- remove useless TN macros
- remove commented out reference for esis(4)

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

(cherry picked from commit 6dbfbe6e11a04f6e2ae893dbf46b059ab49eb517)

14 months agoroute.8: Add information about ROUTE_MPATH and FIB_ALGO
Gordon Bergling [Sun, 26 Feb 2023 13:15:34 +0000 (14:15 +0100)]
route.8: Add information about ROUTE_MPATH and FIB_ALGO

Since the kernel options ROUTE_MPATH and FIB_ALGO are enabled
per default for a while, it's good to have some user facing
documetation about the general functionality of multipath
routing and fib lookup algorithms.

Reviewed by: pauamma, Jose Luis Duran <jlduran at gmail dot com>
Differential Revision: https://reviews.freebsd.org/D38783

(cherry picked from commit b06338167d64507e79e003500002e22fbe583832)

14 months agoroute(8): Remove obsolete information
Warner Losh [Wed, 15 Dec 2021 23:06:19 +0000 (16:06 -0700)]
route(8): Remove obsolete information

xns and osi are no longer relevant (or supported) so remove their
vestiges.

Noticed by: phk
Sponsored by: Netflix

(cherry picked from commit c6b2efb64e279b4d543aaa10073c63765bf6e790)

14 months agoroute(8): Add an example how to print the routing tables
Gordon Bergling [Tue, 13 Apr 2021 04:44:04 +0000 (06:44 +0200)]
route(8): Add an example how to print the routing tables

The manual page currently doesn't show an example how to print
the routing table, so add one and .Xr netstat while here.

PR: 231579
Reported by: Pekka Järvinen <pekka dot jarvinen at gmail dot com>
Reviewed by: debdrup
Differential Revision: https://reviews.freebsd.org/D29702

(cherry picked from commit bc54f5f1cd5c01aa5f941234034839fb0b8f54ed)

14 months agorc.d: Generate machine-id from hostid_save
Tijl Coosemans [Wed, 15 Feb 2023 20:09:51 +0000 (21:09 +0100)]
rc.d: Generate machine-id from hostid_save

rc.d/hostid_save saves a UUID generated by rc.d/hostid in /etc/hostid.
Store the same UUID, without hyphens, in /etc/machine-id.  The hypĥens
are removed with a shell function because hostid_save runs before file
systems are mounted so other tools may not be available yet.

This eliminates some duplication between hostid and machine-id and for
virtual machines machine-id now contains the UUID configured in the
hypervisor like it does on Linux.

Reviewed by: delphij
Discussed with: bapt
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D38811

(cherry picked from commit ecad3f5c4d922f93ceba455f8bff1c54e1ed4174)

14 months agohostid: Generate random UUID by default
Tijl Coosemans [Thu, 9 Mar 2023 09:02:45 +0000 (10:02 +0100)]
hostid: Generate random UUID by default

This way MAC addresses are no longer exposed.

Discussed with: bapt
MFC after: 3 days

(cherry picked from commit 862aab6281a5e6b5dad89761ac17ca2a0e83ab32)

14 months agoheimdal: Fix CVE-2022-4152, signature validation error
Cy Schubert [Fri, 10 Mar 2023 01:03:52 +0000 (17:03 -0800)]
heimdal: Fix CVE-2022-4152, signature validation error

When CVE-2022-3437 was fixed by changing memcmp to be a constant
time and the workaround for th e compiler was to add "!=0". However
the logic implmented was inverted resulting in CVE-2022-4152.

Reported by: Timothy E Zingelman <zingelman _AT_ fnal.gov>
Security: CVE-2022-4152
Security: https://www.cve.org/CVERecord?id=CVE-2022-45142
Security: https://nvd.nist.gov/vuln/detail/CVE-2022-45142
Security: https://security-tracker.debian.org/tracker/CVE-2022-45142
Security: https://bugs.gentoo.org/show_bug.cgi?id=CVE-2022-45142
Security: https://bugzilla.samba.org/show_bug.cgi?id=15296
Security: https://www.openwall.com/lists/oss-security/2023/02/08/1

(cherry picked from commit 5abaf0866445a61c11665fffc148ecd13a7bb9ac)

14 months agousb: Add HID_IGNORE quirk for APC Smart-UPS1000
Cy Schubert [Wed, 22 Feb 2023 02:38:16 +0000 (18:38 -0800)]
usb: Add HID_IGNORE quirk for APC Smart-UPS1000

Without the HID_IGNORE quirk enabled it will appear to be a uhid device.

PR: 269729

(cherry picked from commit 8866ea619a1f91616ba7e002a3ad10dfb10148c9)

14 months agousbdevs: Add APC Smart-UPS1000
Cy Schubert [Tue, 21 Feb 2023 21:10:35 +0000 (13:10 -0800)]
usbdevs: Add APC Smart-UPS1000

(cherry picked from commit 6f295aab8093e291d2166325e4627321953268c8)

14 months agousbdevs: Remove duplicate APC entries
Cy Schubert [Tue, 21 Feb 2023 21:08:08 +0000 (13:08 -0800)]
usbdevs: Remove duplicate APC entries

(cherry picked from commit b1723f48d8cdc9ac6fc3fc256b779b3c07827c0b)

14 months agolinux_80211: Don't dequeue lsta if not queued
Colin Percival [Sun, 5 Mar 2023 20:10:57 +0000 (12:10 -0800)]
linux_80211: Don't dequeue lsta if not queued

This fixes an instapanic when restarting wpa_supplicant on my laptop's
iwlwifi device.  After this change, iwlwifi enters a nonfunctional
state if wpa_supplicant is restarted, but "service netif restart wlan0"
is enough to get it working again.

releng/13.2 candidate.

Reviewed by: bz
MFC after: 3 days

(cherry picked from commit 3689f8aeab82150da6789be87b6c2f9385810c23)

14 months agobcm_dma: don't dereference NULL softc
Mitchell Horne [Fri, 24 Feb 2023 17:19:54 +0000 (13:19 -0400)]
bcm_dma: don't dereference NULL softc

This file defines a small API to be used by other drivers. If any of
these functions are called before the bcm_dma device has attached we
should handle the error gracefully. Fix a formatting quirk while here.

Reviewed by: manu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38756

(cherry picked from commit 07ccf71451d7377b1a6f3367f738ce7ddb1f2a24)

14 months agobcm_dma: attach at an earlier bus pass
Mark Millard [Fri, 17 Feb 2023 20:30:35 +0000 (16:30 -0400)]
bcm_dma: attach at an earlier bus pass

The sdhci_bcm driver attach routine relies on bcm_dma already being
attached, in order to allocate a DMA channel. However, both drivers
attached at the default pass so this is not guaranteed. Newer RPI
firmware exposes this assumption, and the result is a NULL-dereference
in bcm_dma_allocate().

To fix this, use BUS_PASS_SUPPORTDEV for bcm_dma.

PR: 268835
Reviewed by: mhorne
MFC after: 1 week

(cherry picked from commit 9873b171697033f9f19608d98bcd1c16cacb92af)

14 months agolockmgr: upgrade panic return checks
Mitchell Horne [Wed, 22 Feb 2023 15:11:15 +0000 (11:11 -0400)]
lockmgr: upgrade panic return checks

We short-circuit lockmgr functions in the face of a kernel panic. Other
lock implementations do this with a SCHEDULER_STOPPED() check, which
covers the additional case where the debugger is active but the system
has not panicked. Update this code to match that behaviour.

Reviewed by: mjg, kib, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38655

(cherry picked from commit 9a7f7c26c5b280924072e2d9947ad39ef4cc022c)

14 months agopowerpc: remove nexus_get_cpus()
Mitchell Horne [Mon, 13 Feb 2023 17:38:41 +0000 (13:38 -0400)]
powerpc: remove nexus_get_cpus()

It is identical in functionality to root_get_cpus().

Reviewed by: jhibbits
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38494

(cherry picked from commit 6606096986222bac46e6f97d6ca47fc14978d172)

14 months agointr_event(9): fixup Nm field
Mitchell Horne [Sun, 12 Feb 2023 18:58:25 +0000 (14:58 -0400)]
intr_event(9): fixup Nm field

(cherry picked from commit a4532c4c5a866c90de4967d516241149892cca2e)

14 months agoxz: Improve compatibility with systems without capability mode support
Xin LI [Sun, 5 Mar 2023 09:40:13 +0000 (01:40 -0800)]
xz: Improve compatibility with systems without capability mode support

When the kernel is built without capability mode support, or when
using an emulator like qemu-user-static that does not translate
system calls, these calls will return a negative number and set
the errno to ENOSYS. However, this error does not indicate a
real programming or runtime error and is generally ignored by
base system applications built with capability mode sandboxing.

Match this behavior by making xz(1) to ignore ENOSYS errors
when calling capability mode system calls too.

PR: 269185
Reported by: Dan Kotowski

(cherry picked from commit c237c10a2346dec422233db05b2012afd45363fa)

14 months agovfs_mount.c: Free exports structures in vfs_destroy_mount()
Rick Macklem [Sat, 4 Feb 2023 22:45:23 +0000 (14:45 -0800)]
vfs_mount.c: Free exports structures in vfs_destroy_mount()

During testing of exporting file systems in jails, I
noticed that the export structures on a mount
were not being free'd when the mount is dismounted.

This bug appears to have been in the system for a
very long time.  It would have resulted in a slow memory
leak when exported file systems were dismounted.

Prior to r362158, freeing the structures during dismount
would not have been safe, since VFS_CHECKEXP() returned
a pointer into an export structure, which might still have been
used by the NFS server for an in-progress RPC when the file system
is dismounted.  r362158 fixed this, so it should now be safe
to free the structures in vfs_mount_destroy(), which is what
this patch does.

(cherry picked from commit db5655124ca4047ac397b9421ca4a08868a49ae9)

14 months agong_atmllc: deprecate
Brooks Davis [Fri, 3 Mar 2023 16:20:29 +0000 (16:20 +0000)]
ng_atmllc: deprecate

With the deprecation of NgATM, ng_atmllc is the last vestage of ATM
support so deprecate it too.

Reviewed by: manu, emaste
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D38878

(cherry picked from commit c2285a7b092f524b5694e42bfb5fd24f71815771)

14 months agoNgATM: deprecate
Brooks Davis [Fri, 3 Mar 2023 16:20:18 +0000 (16:20 +0000)]
NgATM: deprecate

Support for ATM NICs was removed prior to FreeBSD 12.  At the time it
was unclear if this code was still useful without it.  Now the time has
come to finish removing support.

Add DREPRECATION NOTICEs to the manpages and gone_in(14, ...) warnings
in the constructors (or module init for ngatmbase).

Reviewed by: manu, emaste
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D38877

(cherry picked from commit 211c302f10d76fc12e50c87039cfc06aa9e659c1)

14 months agoNgATM: Remove useless NGATM_ATM option
Brooks Davis [Thu, 2 Mar 2023 23:37:10 +0000 (23:37 +0000)]
NgATM: Remove useless NGATM_ATM option

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38875

(cherry picked from commit bd32aedeee1a2af8293bfb1a2c85432b7ed8f207)

14 months agoNATM: Remove useless NETGRAPH_ATM_ATMPIF option
Brooks Davis [Thu, 2 Mar 2023 23:36:55 +0000 (23:36 +0000)]
NATM: Remove useless NETGRAPH_ATM_ATMPIF option

This code was removed as part of the NATM removal in 2017 and somehow
this option was missed.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38874

(cherry picked from commit 3746e90118c941eb5c9123e22fe05026b78382ab)

14 months agonetgraph.4: remove obsolete ng_atm.4 reference
Brooks Davis [Thu, 2 Mar 2023 23:37:18 +0000 (23:37 +0000)]
netgraph.4: remove obsolete ng_atm.4 reference

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38876

(cherry picked from commit 3518a5bbd9bb0c03b38dea62e577042b779c3aed)

14 months agonetlink: do not memcpy 0 bytes from a NULL pointer
Ed Maste [Mon, 6 Mar 2023 16:30:26 +0000 (11:30 -0500)]
netlink: do not memcpy 0 bytes from a NULL pointer

Although it works in practice it is UB, and might break after a future
compiler update.

This was rewritten in main and the memcpy call no longer exists, so this
is a direct commit to stable/13 before 055776c84a41 is MFC'd.

Discussed with: melifaro
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38927

14 months agoEnable kernel reproducible builds on stable branch
Ed Maste [Mon, 6 Mar 2023 13:38:17 +0000 (08:38 -0500)]
Enable kernel reproducible builds on stable branch

When the stable/13 branch was created the userland knob (in
share/mk/src.opts.mk) was changed to default to yes, but the kernel
default was not changed.  These two should always have the same default.
Regenerate src.conf.5, as the differing defaults previously confused
`makeman`.

Fixes: bfd15705156b ("Create the stable/13 branch")
Sponsored by: The FreeBSD Foundation

14 months agotools/build: Hide spurious errors if sys/stat.h does not exist
Ed Maste [Fri, 24 Feb 2023 14:43:57 +0000 (09:43 -0500)]
tools/build: Hide spurious errors if sys/stat.h does not exist

Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38757

(cherry picked from commit c5e54e56e68aa50beb7d2a7b8ae6611490a7ba9e)

14 months agog_part_ebr: always create "compat" aliases
Ed Maste [Mon, 27 Feb 2023 19:13:09 +0000 (14:13 -0500)]
g_part_ebr: always create "compat" aliases

The "canonical" EBR partition names like `ada0s4+00002081` are not
particularly meaningful.  The "compat" aliases share the same namespace
as the parent MBR, resulting in user-friendly names like `ada0s6`.
These names are consistent with the way Linux names EBR partitions.

We previously provided a sysctl kern.features.geom_part_ebr_compat
(enabled by default) to control the "compat" names.  Remove the sysctl
and always create the aliases.

Relnotes: yes
Reviewed by: cem, imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38812

(cherry picked from commit 6c7bc93da699054bb8ead58fdc226e084d929515)

14 months agobsnmp: Remove "All Rights Reserved" from FreeBSD Foundation copyrights
Ed Maste [Fri, 3 Mar 2023 13:10:44 +0000 (08:10 -0500)]
bsnmp: Remove "All Rights Reserved" from FreeBSD Foundation copyrights

(cherry picked from commit 4530e0c3e78d0616367d37273d6c1f47f627839b)

14 months agouuidgen(1): fix another typo
Baptiste Daroussin [Mon, 6 Mar 2023 08:03:32 +0000 (09:03 +0100)]
uuidgen(1): fix another typo

(cherry picked from commit 4cd30c640db978355cf2da666e2749189babda5e)

14 months agouuidgen(1): back to the past and fix typo
Baptiste Daroussin [Thu, 2 Mar 2023 08:35:30 +0000 (09:35 +0100)]
uuidgen(1): back to the past and fix typo

Reported by: ceri

(cherry picked from commit 0ba66872bea87abdf13660d5a7946769fd7b118f)

14 months agomachine-id: generate a compact version of the uuid
Baptiste Daroussin [Tue, 28 Feb 2023 10:31:06 +0000 (11:31 +0100)]
machine-id: generate a compact version of the uuid

dbus and other actually expect an uuid without hyphens

Reported by: tijl
MFC After: 3 days

(cherry picked from commit a28ccb32bf5678fc401f1602865ee9b37ca4c990)

14 months agouuidgen: add -c for compact uuid
Baptiste Daroussin [Tue, 28 Feb 2023 10:29:51 +0000 (11:29 +0100)]
uuidgen: add -c for compact uuid

It generates the uuid string but without the hyphen

MFC After: 3 days
Reviews by: tcberner
Differential Revision: https://reviews.freebsd.org/D38820

(cherry picked from commit b2b294f27cf4618d6f7510007b41882860a080b9)

14 months agothunderx: fix potential sign extension issue
Ed Maste [Tue, 28 Feb 2023 19:17:30 +0000 (14:17 -0500)]
thunderx: fix potential sign extension issue

Coverity reported a sign extension issue on rq->caching << 26 in the
Linux ThunderX driver.  (It appears Coverity Scan doesn't build arm64
objects in FreeBSD.)

As done in Linux, add a cast.

Fixes: 3c0086b81391 ("Raw import of ThunderX VNIC networking driver...")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 5e95f5f5315083baa7d98d3286f6c0a82621a68e)

14 months agofreebsd-update: use grep -E instead of egrep
Ed Maste [Thu, 2 Mar 2023 23:54:52 +0000 (18:54 -0500)]
freebsd-update: use grep -E instead of egrep

GNU egrep emits a warning that it is obsolescent and suggests grep -E
instead.  Switch to grep -E in case we end up invoking GNU (e)grep (and
for consistency with other invocations in this file).

Reported by: Steffen Nurpmeso
Sponsored by: The FreeBSD Foundation

(cherry picked from commit e27ded83c76a609687a3d9e82b80fe7e1b782bf6)

14 months agomergemaster: add deprecation notice to man page
Ed Maste [Wed, 22 Jan 2020 21:04:03 +0000 (16:04 -0500)]
mergemaster: add deprecation notice to man page

PR: 252417
Reviewed by: bapt, gjb, kevans (all earlier)
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23327

(cherry picked from commit 398b12691b4f1e7a73afca4c051c182bfcaf9671)

14 months agolockstat: Use gelf.h instead of playing games with the preprocessor
Mark Johnston [Sat, 25 Feb 2023 01:15:21 +0000 (20:15 -0500)]
lockstat: Use gelf.h instead of playing games with the preprocessor

This reverts a portion of 1477dd823ee ("Merge OpenZFS support in to
HEAD.").  No functional change intended.

MFC after: 1 week

(cherry picked from commit 49e3972afc1112f95863a04cea7a4401b78dfd1f)

14 months agolockstat: Use the correct type for a symbol size
Mark Johnston [Sat, 25 Feb 2023 01:11:08 +0000 (20:11 -0500)]
lockstat: Use the correct type for a symbol size

No functional change intended.

MFC after: 1 week

(cherry picked from commit f4f5e69c84df74e8834aed173af1127b1ff50970)

14 months agoinet6_opt_init.3: Some enhancements
Gordon Bergling [Sat, 25 Feb 2023 13:11:27 +0000 (14:11 +0100)]
inet6_opt_init.3: Some enhancements

- Be consistent with RFC references, so add a space after 'RFC'
- Add a LIBRARY section
- Use standard integer types in the SYNOPSIS section

Obtained from: DragonflyBSD
Differential Revision: https://reviews.freebsd.org/D27548

(cherry picked from commit 211ceb62e85d8d01ea89af0de8e43430de550e72)

14 months agogrowfs_fstab startup script: set dumpdev to AUTO
Mike Karels [Tue, 28 Feb 2023 13:55:35 +0000 (07:55 -0600)]
growfs_fstab startup script: set dumpdev to AUTO

The growfs_fstab script has been testing dumpdev, and if it is AUTO,
enables dumps on the newly-added swap device for the initial boot.
However, dumpdev defaults to AUTO on main, but NO on stable/13 and
release branches.  On the other hand, bsdinstall adds dumpdev="AUTO"
by default (controlled by a menu item).  bsdinstall is not used when
booting an SD card or other disk image.  Adopt the default from
bsdinstall, and set dumpdev to AUTO in /etc/rc.conf in the
growfs_fstab script if a swap partition has been added, along with
the explanatory comment added by bsdinstall.

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

(cherry picked from commit eef9f9900f118b5efcabbd5864e7b8b993d09922)

14 months agotcp: Make TCP PCAP buffer properly configurable.
Richard Scheffenegger [Tue, 28 Feb 2023 18:57:30 +0000 (19:57 +0100)]
tcp: Make TCP PCAP buffer properly configurable.

Reviewed By: tuexen, cc, #transport
MFC after: 3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D38824

(cherry picked from commit 399a5655e6edf69a63f1c37e66fdad19dcfdb5cf)

14 months agobuf: Make bufspace_daemon_shutdown() a no-op after a panic
Mark Johnston [Fri, 24 Feb 2023 02:56:36 +0000 (21:56 -0500)]
buf: Make bufspace_daemon_shutdown() a no-op after a panic

This function doesn't need to do anything in that context, and calling
wakeup() can lead to recursive panics.

Discussed with: mhorne
MFC after: 1 week

(cherry picked from commit 9d7cc536e261a7d207476115dac6058c38f469bd)

14 months agoblacklistd: silence sign-conversion warning from Clang
Ed Maste [Wed, 12 Oct 2022 18:10:21 +0000 (14:10 -0400)]
blacklistd: silence sign-conversion warning from Clang

Obtained from: NetBSD 518a28b2e752

(cherry picked from commit b290769b981193cbc0985206e11930b2eb79428e)

14 months agolibc: handle zero alignment in memalign()
Paul Floyd [Fri, 24 Feb 2023 16:29:01 +0000 (11:29 -0500)]
libc: handle zero alignment in memalign()

For compatibility with glibc. The previous code would trigger a division
by zero in roundup() and terminate.  Instead, just pass through to
malloc() for align == 0.

PR: 269688
Reviewed by: imp, mjg
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/655

(cherry picked from commit 2c709ee70ade9fd8f77b37917a4169d667dda41d)

14 months agofreebsd-update: avoid effects of user's environment on grep
Ed Maste [Wed, 14 Dec 2022 17:13:19 +0000 (12:13 -0500)]
freebsd-update: avoid effects of user's environment on grep

A user had GREP_OPTIONS containing --color=always, which broke grep use
in freebsd-update.  Unset this environment variable.

PR: 255990
Reviewed by: kevans
Approved by: re (cperciva, expedited MFC)
Sponsored by: The FreeBSD Foundation

(cherry picked from commit e093c61b2d69e9cca54a2332096c0e36f97bffc0)

14 months agofreebsd-update: re-edit files if merge conflict markers remain
Ed Maste [Wed, 14 Dec 2022 17:34:59 +0000 (12:34 -0500)]
freebsd-update: re-edit files if merge conflict markers remain

freebsd-update will open ${EDITOR} if conflicts occur while merging
updates to config files.  Inform the user if they've left conflict
markers behind, and go back to editing the file.

PR: 185546
PR: 229689
Reviewed by: delphij
Approved by: re (cperciva, expedited MFC)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37703

(cherry picked from commit ceb5f28ba5fcfa69de7410d2327d4a5abf2a421f)

14 months agopfsync: ensure 'error' is always initialised
Kristof Provost [Thu, 16 Feb 2023 08:16:35 +0000 (09:16 +0100)]
pfsync: ensure 'error' is always initialised

Reported by: Herbert J. Skuhra <herbert@gojira.at>
MFC after: 2 weeks

(cherry picked from commit f52ca3dfd5520332e8cb8d08eda1b92aca2a159c)

14 months agopfsync: support deferring IPv6 packets
Kristof Provost [Tue, 14 Feb 2023 06:11:38 +0000 (07:11 +0100)]
pfsync: support deferring IPv6 packets

When we send out a deferred packet we must make sure to call
ip6_output() for IPv6 packets. If not we might end up attempting to
ip_fragment() an IPv6 packet, which could lead to us reading outside of
the mbuf.

PR: 268246
Reviewed by: melifaro, zlei
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D38586

(cherry picked from commit 9a1cab6d79b7286e5f650f57ed95625e6ddb8e4b)

14 months agosrc.conf: regen man page after RELRO change
Ed Maste [Thu, 2 Mar 2023 14:34:43 +0000 (09:34 -0500)]
src.conf: regen man page after RELRO change

14 months agoAdd RELRO build knob, default to enabled
Ed Maste [Wed, 22 Jun 2022 12:58:04 +0000 (08:58 -0400)]
Add RELRO build knob, default to enabled

Note that lld enables relro by default, so that we already had either
partial or full RELRO, depending on the state of the BIND_NOW knob.

Add a RELRO knob so that the option can be disabled if desired, and so
that builds using the GNU toolchain are equivalent to those using the
standard Clang/LLVM toolchain.

Reviewed by: markj
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35545

(cherry picked from commit 2f3a961487c97dc879f07bb97bc62d7bd70b3f8d)

14 months agoblacklistd: whitespace cleanup
Ed Maste [Wed, 12 Oct 2022 17:40:38 +0000 (13:40 -0400)]
blacklistd: whitespace cleanup

Diff reduction against NetBSD external/bsd/blacklist (at commit
03c74c04f277).

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 631bdcf3043c00b90fc29aedb8da91251be2cd8a)

14 months agoCirrus-CI: use makefs if root size exceeds QEMU's virtual FAT limit
Ed Maste [Mon, 13 Feb 2023 17:39:39 +0000 (12:39 -0500)]
Cirrus-CI: use makefs if root size exceeds QEMU's virtual FAT limit

We use QEMU's virtual FAT support to avoid having to create a disk
image because it is much faster, but it has a limit of about 500MB.
Artifacts produced by the GCC 12 CI job exceeded this size.

Add support for creating a FAT partition image and MBR-partitioned disk
image and use it when the file system is too large for QEMU.

In one run the Cirrus-CI LLVM test task took 1m33s using QEMU's virtual
FAT while the GCC task took 6m48s using makefs+mkimg.

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

(cherry picked from commit 7b0593fdcbbb9c73d282fc0024d844c044423b31)

14 months agoRemove an extra argument to SYSCTL_FOREACH
Andrew Turner [Wed, 5 Oct 2022 09:27:48 +0000 (10:27 +0100)]
Remove an extra argument to SYSCTL_FOREACH

This was missed in e0853c933661.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit fbc9f1b2d6cf90c02b918671fb7791cf36472cfd)

14 months agoamd64: Avoid copying td_frame from kernel procs
Mark Johnston [Sat, 25 Sep 2021 14:15:31 +0000 (10:15 -0400)]
amd64: Avoid copying td_frame from kernel procs

When creating a new thread, we unconditionally copy td_frame from the
creating thread.  For threads which never return to user mode, this is
unnecessary since td_frame just points to the base of the stack or a
random interrupt frame.

If KASAN is configured this copying may also trigger false positives
since the td_frame region may contain poisoned stack regions.  It was
not noticed before since thread0 used a dummy proc0_tf trapframe, and
kernel procs are generally created by thread0.  Since commit
df8dd6025af88a99d34f549fa9591a9b8f9b75b1, though, we call
cpu_thread_alloc(&thread0) when initializing FPU state, which
reinitializes thread0.td_frame.

Work around the problem by not copying the frame unless the copying
thread came from user mode.  While here, de-duplicate the copying and
remove redundant re(initialization) of td_frame.

Reported by: syzbot+2ec89312bffbf38d9aec@syzkaller.appspotmail.com
Reviewed by: kib
Fixes: df8dd6025af8
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32057

(cherry picked from commit ca1e447b1048b26b855d7f7fbcdad78309e4d741)

14 months agossh: default VerifyHostKeyDNS to no, following upstream
Ed Maste [Fri, 17 Feb 2023 01:26:41 +0000 (20:26 -0500)]
ssh: default VerifyHostKeyDNS to no, following upstream

Revert to upstream's default.  Using VerifyHostKeyDNS may depend on a
trusted nameserver and network path.

This reverts commit 83c6a5242c80160fff76fb85454938761645b0c4.

Reported by: David Leadbeater, G-Research
Reviewed by: gordon
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38648

(cherry picked from commit 41ff5ea22cb95deb9e7415510eb2f5f00b91537a)

14 months agoDelete obsolete Solaris compat header file stdlib.h
Zhenlei Huang [Thu, 23 Feb 2023 18:00:09 +0000 (02:00 +0800)]
Delete obsolete Solaris compat header file stdlib.h

This drops function `getexecname()` redirection.

Historically `getexecname()` is a compatibility definition. Since
openzfs has its own implementation of function `getexecname()` in libspl
and has been merged into base, the compat header file stdlib.h is
no longer needed and should not be used.

Also without this fix libspl will end up an incompatible version of
`getprogname()` with libc. In particular, if zfs is enabled, programs
such as pgrep in /rescue can be wrongly statically linked with libspl
and will not function properly.

PR: 269738
Reviewed by: markj
Fixes: 9e5787d2284e Merge OpenZFS support in to HEAD
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38733

(cherry picked from commit 7f0ebf0876c82a098bd5815ea6bf3a8efa6dd6f3)

14 months agotmpfs: support the nosymfollow mount option
Konstantin Belousov [Thu, 23 Feb 2023 13:15:17 +0000 (15:15 +0200)]
tmpfs: support the nosymfollow mount option

PR: 269772

(cherry picked from commit 15df90218bb62df96ce27f47ad9953f4c1f37900)

14 months agoEnsure .inc files are regenerated when llvm/clang tblgen binaries change
Dimitry Andric [Sat, 25 Feb 2023 15:25:57 +0000 (16:25 +0100)]
Ensure .inc files are regenerated when llvm/clang tblgen binaries change

When doing a fully incremental build (with WITHOUT_CLEAN enabled), from
a commit before llvm 15 was merged (3264f6b88fce), to a commit after
that, a number of .inc files were not regenerated. This could lead to
unexpected compilation errors when these .inc files were included from
llvm-project sources, similar to:

  In file included from /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGBuiltin.cpp:8268:
  /usr/obj/usr/src/amd64.amd64/lib/clang/libclang/clang/Basic/arm_mve_builtin_cg.inc:279:18: error: no matching constructor for initialization of 'clang::CodeGen::Address'
    Address Val2 = Address(Val1, CharUnits::fromQuantity(2));
                   ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Work around this by making the .inc files dependent on the tblgen binary
used for generating them. E.g., we can relatively safely assume that if
the binary gets updated, the .inc files must also be updated. (Although
this is not 100% optimal, the gain by complicating things even more is
probaby not worth the effort.)

MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38770

(cherry picked from commit ab80f0b21fbb9c44d40e6f7a99090188f4ed2f71)

14 months agonetlink: make the maximum allowed netlink socket buffer runtime tunable.
Alexander V. Chernikov [Mon, 27 Feb 2023 10:44:54 +0000 (10:44 +0000)]
netlink: make the maximum allowed netlink socket buffer runtime tunable.

Dumping large routng tables (>1M paths with multipath) require the socket
 buffer which is larger than the currently defined limit.
Allow the limit to be set in runtime, similar to kern.ipc.maxsockbuf.

Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
MFC after: 1 day

(cherry picked from commit 28a5d88f7091d1fc72f4f1bd8562d3c8b15883f5)

15 months agoFix a slew of mdoc warnings/errors.
Christian Brueffer [Tue, 12 Apr 2022 21:52:54 +0000 (23:52 +0200)]
Fix a slew of mdoc warnings/errors.

MFC requested by meeena in IRC.

share/man/man9/VOP_SETLABEL.9 and share/man/man9/hz.9 omitted since
they didn't exist in 13-STABLE.

share/man/man9/mod_cc.9 omitted as some of the changes are in text
not applicable to 13-STABLE.

(cherry picked from commit 320686674b3c8ce3ffe135c421a22d063917ee46)

Approved by: carlavilla (mentor)

15 months agolinprocfs(4): Fixup process size in the /proc/pid/stat file
Dmitry Chagin [Sun, 26 Feb 2023 13:42:22 +0000 (16:42 +0300)]
linprocfs(4): Fixup process size in the /proc/pid/stat file

According to the Linux sources the kernel exposes a proces virtual
memory size via proc filesystem into the three files - stat, status
and statm. This is the struct mm->total_vm value adjusted to the
corresponding units - bytes, kilobytes and pages.

The fix is based on a fernape@ analysis.

PR: 265937
Reported by: Ray Bellis
MFC after: 3 days

(cherry picked from commit a55b5a9aed3981fcec205e246436991d138c78a2)

15 months agolinux(4): Trim unused opt_usb.h from modules Makefiles
Dmitry Chagin [Tue, 14 Feb 2023 14:46:33 +0000 (17:46 +0300)]
linux(4): Trim unused opt_usb.h from modules Makefiles

MFC after: 2 weeks

(cherry picked from commit 825fbd087e6150eaf601612a5e7468ddc808e004)

15 months agolinux(4): Rename linux_timer.h to linux_time.h
Dmitry Chagin [Tue, 14 Feb 2023 14:46:33 +0000 (17:46 +0300)]
linux(4): Rename linux_timer.h to linux_time.h

To avoid confusing people, rename linux_timer.h to linux_time.h,
as linux_timer.c is the implementation of timer syscalls only,
while linux_time.c contains implementation of all stuff declared
in linux_time.h.

MFC after: 2 weeks

(cherry picked from commit c8a79231a5a74fc4263ec3d18c6519a974efb529)

15 months agolinux(4): Cleanup includes under arm64/linux
Dmitry Chagin [Tue, 14 Feb 2023 14:46:33 +0000 (17:46 +0300)]
linux(4): Cleanup includes under arm64/linux

Cleanup unneeded includes, sort the rest according to style(9).
No functional changes.

MFC after: 2 weeks

(cherry picked from commit 55d3e181fc10edb4810f33009b65342c3e23dd88)

15 months agolinux(4): Cleanup includes under x86/linux
Dmitry Chagin [Tue, 14 Feb 2023 14:46:33 +0000 (17:46 +0300)]
linux(4): Cleanup includes under x86/linux

Cleanup unneeded includes, sort the rest according to style(9).
No functional changes.

MFC after: 2 weeks

(cherry picked from commit 496a9a4f60716b3ba236c3f20639da03fefe3a3f)

15 months agolinux(4): Cleanup includes under amd64/linux
Dmitry Chagin [Tue, 14 Feb 2023 14:46:32 +0000 (17:46 +0300)]
linux(4): Cleanup includes under amd64/linux

Cleanup unneeded includes, sort the rest according to style(9).
No functional changes.

MFC after: 2 weeks

(cherry picked from commit 2456a45929328ce73a40ef6577600b0f1e2cced6)

15 months agolinux(4): Cleanup includes under i386/linux
Dmitry Chagin [Tue, 14 Feb 2023 14:46:32 +0000 (17:46 +0300)]
linux(4): Cleanup includes under i386/linux

Cleanup unneeded includes, sort the rest according to style(9).
No functional changes.

MFC after: 2 weeks

(cherry picked from commit f4a512a5f187d9139c04111784fe811572bc0ed6)

15 months agolinux(4): Cleanup includes under compat/linux
Dmitry Chagin [Tue, 14 Feb 2023 14:46:32 +0000 (17:46 +0300)]
linux(4): Cleanup includes under compat/linux

Cleanup unneeded includes, sort the rest according to style(9).
No functional changes.

MFC after: 2 weeks

(cherry picked from commit d8e53d94fae90cf3c83db5af0eaba0be0f55e00a)

15 months agolinux(4): Cleanup sys/sysctl.h from linux_misc.h
Dmitry Chagin [Tue, 14 Feb 2023 14:46:32 +0000 (17:46 +0300)]
linux(4): Cleanup sys/sysctl.h from linux_misc.h

Leftover after c5156c77 (r374538).

MFC after: 2 weeks

(cherry picked from commit e2028292e54a4541d1e80159c78516a0b3332e0c)

15 months agolinux(4): Fix brackets of local include opt_inet6
Dmitry Chagin [Tue, 14 Feb 2023 14:46:32 +0000 (17:46 +0300)]
linux(4): Fix brackets of local include opt_inet6

MFC after: 2 weeks

(cherry picked from commit 77f66834b059ae8327b731a19794788eed59178c)

15 months agolinux(4): Cleanup sys/uio.h where linux_uitl.h is included
Dmitry Chagin [Tue, 14 Feb 2023 14:46:31 +0000 (17:46 +0300)]
linux(4): Cleanup sys/uio.h where linux_uitl.h is included

MFC after: 2 weeks

(cherry picked from commit acbbd5c0393345f13aa4b902e2c1ac83b7e39b59)

15 months agolinux(4): Move uselib() to i386
Dmitry Chagin [Tue, 14 Feb 2023 14:46:31 +0000 (17:46 +0300)]
linux(4): Move uselib() to i386

This obsolete system call is not supported by glibc. In ancient libc
versions (before glibc 2.0), uselib() was used to load the shared
libraries with names found in an array of names in the binary.
On Linux, since 3.15, this system call is available only when
the kernel is configured with the CONFIG_USELIB option.

It doesn't look like anyone needs this syscall for others Linuxulators,
so move it to the corresponding MD Linuxulator.

MFC after: 2 weeks

(cherry picked from commit 50c85a32d9c667779494850b6238b8d7ec13da75)

15 months agolinux(4): Cleanup abi_compat.h include from linux_timer.h
Dmitry Chagin [Tue, 14 Feb 2023 14:46:31 +0000 (17:46 +0300)]
linux(4): Cleanup abi_compat.h include from linux_timer.h

Leftover after timespec copyin/copyout routines was implemented.

MFC after: 2 weeks

(cherry picked from commit 86f9efef2c44f6be007cbc9ab383ee6a277d5880)

15 months agolinux(4): Cleanup sys/queue.h from linux.h
Dmitry Chagin [Tue, 14 Feb 2023 14:46:31 +0000 (17:46 +0300)]
linux(4): Cleanup sys/queue.h from linux.h

Leftover after converting futexes to the umtx API.

NFC after: 2 weeks

(cherry picked from commit 007986714c78c8e087038fb05442f17da1171bfa)

15 months agolinux(4): Cleanup sys/sysent.h from linux_util
Dmitry Chagin [Tue, 14 Feb 2023 14:46:31 +0000 (17:46 +0300)]
linux(4): Cleanup sys/sysent.h from linux_util

Include sys/sysent.h directly where it needed. The linux_util.h included
in a most source files of the Linuxulator, avoid collecting a rarely used
includes here.

MFC after: 2 weeks

(cherry picked from commit 513eb69edf382923bff1b09edda64010d89f74bd)

15 months agolinux(4): Cleanup vm includes from linux_util.h
Dmitry Chagin [Tue, 14 Feb 2023 14:46:30 +0000 (17:46 +0300)]
linux(4): Cleanup vm includes from linux_util.h

Include vm headers directly where they needed. The linux_util.h included
in a most source files of the Linuxulator, avoid collecting a rarely used
includes here.

MFC after: 2 weeks

(cherry picked from commit 31e938c531dcbb708dbcd0e1d0a4ea80dcc82300)

15 months agolinux(4): Cleanup unneeded includes from linux_util.h
Dmitry Chagin [Tue, 14 Feb 2023 14:46:30 +0000 (17:46 +0300)]
linux(4): Cleanup unneeded includes from linux_util.h

MFC after: 2 weeks

(cherry picked from commit 81e7a800552196a65c9c8b3fef82c2ef6c8058ff)

15 months agosrc.conf: regen man page
Ed Maste [Tue, 28 Feb 2023 21:42:53 +0000 (16:42 -0500)]
src.conf: regen man page

This hadn't been regenerated on the stable branch after some MFCs.

Sponsored by: The FreeBSD Foundation

15 months agoDo not delete objdump when WITH_LLVM_BINUTILS is true
Ed Maste [Sun, 25 Sep 2022 19:29:38 +0000 (15:29 -0400)]
Do not delete objdump when WITH_LLVM_BINUTILS is true

WITH_LLVM_BINUTILS links /usr/bin/objdump to llvm-objdump, and similarly
for the man page.  Do not delete them in `make delete-old`.

PR: 266603
Sponsored by: The FreeBSD Foundation

(cherry picked from commit d1a351be19d4bd03918d44ea33fa7c09655f810a)

15 months agolibdwarf: Add some constants from DWARF 5
Mark Johnston [Tue, 7 Feb 2023 19:33:27 +0000 (14:33 -0500)]
libdwarf: Add some constants from DWARF 5

This is not exhaustive - DWARF 5 has some new enumeration types not
implemented here - but I think I caught all the ones that are extended
in DWARF 5, plus the new compilation unit type (DW_UT_*), needed when
parsing .debug_info headers.

These were useful when extending libdwarf/ctfconvert/readelf to handle
DWARF generated by gcc 12, which is version 5 by default.

Reviewed by: emaste
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38273

(cherry picked from commit 7bb441c866781ec14b3e79a4f3e95fd319ab7ff9)

15 months agobhyve: add emulation for qemu's fwcfg data port
Corvin Köhne [Wed, 11 Aug 2021 08:00:34 +0000 (10:00 +0200)]
bhyve: add emulation for qemu's fwcfg data port

The data port returns the data of the fwcfg item.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38333

(cherry picked from commit b11081dca76b8e283495632b86b41539ee013857)

15 months agobhyve: add emulation for the qemu fwcfg selector port
Corvin Köhne [Wed, 11 Aug 2021 07:59:16 +0000 (09:59 +0200)]
bhyve: add emulation for the qemu fwcfg selector port

The selector port is used to select the desired fwcfg item.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38332

(cherry picked from commit 151d8131a817e7a6a629e9bb7fde4d7a158e5211)

15 months agobhyve: add basic qemu fwcfg implementation
Corvin Köhne [Wed, 11 Aug 2021 07:58:15 +0000 (09:58 +0200)]
bhyve: add basic qemu fwcfg implementation

qemu's fwcfg and bhyve's fwctl are both used to configure ovmf. qemu's
fwcfg is much more powerfull than bhyve's fwctl. For that reason, add
support for qemu's fwcfg.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38331

(cherry picked from commit 9b99de77f16029dd55326e0210072b14ec1ad960)

15 months agobhyve: maintain a list of acpi devices
Corvin Köhne [Thu, 7 Oct 2021 14:14:31 +0000 (16:14 +0200)]
bhyve: maintain a list of acpi devices

The list is used to generate the dsdt entry for every acpi device.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D3830

(cherry picked from commit fbd045021d9ffdae5e5bb20e1d1890fd4b46498e)

15 months agobhyve: add helper func to write a dsdt entry
Corvin Köhne [Thu, 7 Oct 2021 13:58:27 +0000 (15:58 +0200)]
bhyve: add helper func to write a dsdt entry

The guest will check the dsdt to detect acpi devices. Therefore, add a
helper function to create such a dsdt entry for an acpi device.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38329

(cherry picked from commit 682a522d61223920f23a202aa57901f38bdfd8dd)

15 months agobhyve: add helper func to add acpi resources
Corvin Köhne [Thu, 7 Oct 2021 13:57:01 +0000 (15:57 +0200)]
bhyve: add helper func to add acpi resources

These helper function can be used to assign acpi resources to an
acpi_device.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38328

(cherry picked from commit 13a1df5b85e992570f45248bfe9d581dc182b755)

15 months agobhyve: add helper struct for acpi device handling
Corvin Köhne [Thu, 7 Oct 2021 13:54:46 +0000 (15:54 +0200)]
bhyve: add helper struct for acpi device handling

To simplify the handling of different acpi devices like qemu fwcfg or a
tpm, add a helper struct. It will handle the reporting of acpi
resources.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38327

(cherry picked from commit 1231f047c3ed46ca6041df62f2b71f6e879bbb40)

15 months agoapic: prevent divide by zero in CPU frequency init
Mina Galić [Tue, 28 Feb 2023 02:58:45 +0000 (19:58 -0700)]
apic: prevent divide by zero in CPU frequency init

If a CPU for some reason returns 0 as CPU frequency, we currently panic
on the resulting divide by zero when trying to initialize the CPU(s) via
APIC. When this happens, we'll fallback to measuring the frequency
instead.

PR: 269767
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/664

(cherry picked from commit 499171a98c8813e4dc6e085461d5c47750efa555)

15 months agostand: fix build userboot without zfs
Michael Paepcke [Tue, 28 Feb 2023 02:58:03 +0000 (19:58 -0700)]
stand: fix build userboot without zfs

Fix regression in building userboot -DWITHOUT_LOADER_ZFS

Fixes: e307eb94ae520
MFC After: 3 days
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/665

(cherry picked from commit 4d59545d0cacb5881e2515eecce15e8478f07276)