]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
16 months agostress2: Add UFS+SU test scenario
Peter Holm [Tue, 14 Feb 2023 10:48:18 +0000 (11:48 +0100)]
stress2: Add UFS+SU test scenario

16 months agostress2: Add a regression test for D38549
Peter Holm [Tue, 14 Feb 2023 08:44:58 +0000 (09:44 +0100)]
stress2: Add a regression test for D38549

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 months agoice(4): Update to 1.37.7-k
Piotr Kubaj [Tue, 14 Feb 2023 01:29:44 +0000 (17:29 -0800)]
ice(4): Update to 1.37.7-k

Notable changes include:

- DSCP QoS Support (leveraging support added in
  rG9c950139051298831ce19d01ea5fb33ec6ea7f89)
- Improved PFC handling and TC queue assignments (now all remaining
  queues are assigned to TC 0 when more than one TC is enabled and the
  number of available queues does not evenly divide between them)
- Support for dumping the internal FW state for additional debugging by
  Intel support
- Support for allowing "No FEC" to be a valid state for the LESM to
  negotiate when using non-standard compliant modules

Also includes various bug fixes and smaller enhancements, too.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: erj@
Tested by: Jeff Pieper <jeffrey.pieper@intel.com>
MFC after: 3 days
Relnotes: yes
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D38109

16 months agotmpfs_rename(): use tmpfs_access_locked instead of VOP_ACCESS()
Konstantin Belousov [Sun, 12 Feb 2023 23:20:25 +0000 (01:20 +0200)]
tmpfs_rename(): use tmpfs_access_locked instead of VOP_ACCESS()

Protect the call with the node lock. We cannot lock the fvp vnode
sleepable there, because we already own other participating vnode's
locks. Taking it without sleeping require unwinding the whole locking
state in one more place.

Note that the liveness of the node is guaranteed by the lock on the
parent directory vnode.

Reported and tested by: pho
Fixes: cbac1f3464956185cf95955344b6009e2cc3ae40ESC
Reviewed by: markj, mjg
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38557

16 months agoExtract tmpfs-specific part of tmpfs_access() into a helper
Konstantin Belousov [Sun, 12 Feb 2023 22:25:25 +0000 (00:25 +0200)]
Extract tmpfs-specific part of tmpfs_access() into a helper

The helper tmpfs_access_locked() requires either the vnode or node
locked for consistency of the access check, unlike the pure vnode op.

Reviewed by: markj, mjg
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38557

16 months agotmpfs_access(): style fixes and remove redundand assertions
Konstantin Belousov [Sun, 12 Feb 2023 22:15:00 +0000 (00:15 +0200)]
tmpfs_access(): style fixes and remove redundand assertions

Note that MPASS(VOP_ISLOCKED(vp)) is simply broken.

Reviewed by: markj, mjg
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38557

16 months agonfsd: Continue adding macros so nfsd can run in a vnet prison
Rick Macklem [Mon, 13 Feb 2023 23:07:17 +0000 (15:07 -0800)]
nfsd: Continue adding macros so nfsd can run in a vnet prison

Commit 7344856e3a6d added a lot of macros that will front end
vnet macros so that nfsd(8) can run in vnet prison.
This patch adds some more of them and also a lot of uses of
nfsstatsv1_p instead of nfsstatsv1. nfsstatsv1_p points to
nfsstatsv1 for prison0, but will point to a malloc'd structure
for other prisons.

It also puts nfsstatsv1_p in nfscommon.ko instead of nfsd.ko.

MFC after: 3 months

16 months agomsdosfs deextend: validate pages of the partial buffer
Konstantin Belousov [Sat, 11 Feb 2023 18:09:30 +0000 (20:09 +0200)]
msdosfs deextend: validate pages of the partial buffer

Suppose that the cluster size is larger than page size. If the buffer
at the old EOF (before extending) was partial and dirty, it cannot be
automatically neither written out nor validated by the buffer cache,
since extending buffer adds invalid pages at the end.

Correct the buffer state by calling vfs_bio_clrbuf() on it, to mark
newly added and zeroed pages as valid.

Note that UFS is immune to the problem because ffs_truncate() always
allocate the block and buffer for the last byte of the file.

PR: 269341
Reported by: asomers
In collaboration with: pho
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38549

16 months agomsdosfs deextend(): memoize DETOV(dep)
Konstantin Belousov [Sat, 11 Feb 2023 18:05:14 +0000 (20:05 +0200)]
msdosfs deextend(): memoize DETOV(dep)

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38549

16 months agomsdosfs: correct handling of vnode pager size on file extension error
Konstantin Belousov [Fri, 10 Feb 2023 04:58:43 +0000 (06:58 +0200)]
msdosfs: correct handling of vnode pager size on file extension error

If extension fails, vnode pager recorded size might be left increased.
Only update vnode pager when extension is past the point of no rollback.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38549

16 months agoallocbuf(): convert direct panic() calls to KASSERT()s
Konstantin Belousov [Sat, 11 Feb 2023 18:03:22 +0000 (20:03 +0200)]
allocbuf(): convert direct panic() calls to KASSERT()s

Also do minor style adjustments.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38549

16 months agovm_fault: Fix a race in vm_fault_soft_fast()
Mark Johnston [Mon, 13 Feb 2023 21:24:40 +0000 (16:24 -0500)]
vm_fault: Fix a race in vm_fault_soft_fast()

When vm_fault_soft_fast() creates a mapping, it release the VM map lock
before unbusying the top-level object.  Without the map lock, however,
nothing prevents the VM object from being deallocated while still busy.

Fix the problem by unbusying the object before releasing the VM map
lock.  If vm_fault_soft_fast() fails to create a mapping, the VM map
lock is not released, so those cases don't need to change.

Reported by: syzkaller
Reviewed by: kib (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D38527

16 months agoinpcb: refcount_release() returns a bool
Mark Johnston [Mon, 13 Feb 2023 21:26:36 +0000 (16:26 -0500)]
inpcb: refcount_release() returns a bool

No functional change intended.

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

16 months agotcp: Remove a redundant net_epoch entry in tcp6_connect()
Mark Johnston [Mon, 13 Feb 2023 21:21:10 +0000 (16:21 -0500)]
tcp: Remove a redundant net_epoch entry in tcp6_connect()

tcp6_connect() is always called in a net_epoch read section.

Fixes: 3d76be28ec60 ("netinet6: require network epoch for in6_pcbconnect()")
Reviewed by: tuexen, glebius
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38506

16 months agoarm64 pmap: Fix a buffer overrun initializing per-superpage locks.
John Baldwin [Mon, 13 Feb 2023 21:19:03 +0000 (13:19 -0800)]
arm64 pmap: Fix a buffer overrun initializing per-superpage locks.

pmap_init_pv_table makes a first pass over the memory segments to
compute the amount of address space needed to allocate per-superpage
locks.  It then makes a second pass over each segment allocating
domain-local memory to back the pages for the locks belonging to each
segment.  This second pass rounds each segment's allocation up to a
page size since the domain-local allocation has to be a multiple of
pages.  However, the first pass was only doing a single round of the
total page counts up at the end not accounting for the padding present
in each segment.  To fix, apply the rounding in each segment in the
first pass instead of just at the end.

While here, tidy the second pass a bit by trimming some
not-quite-right logic copied from amd64.  In particular, compute pages
directly at the start of the loop iteration to more closely match the
first loop.  Then, drop an always-false condition as 'end' was
computed as 'start + pages' where 'start == highest + 1'.  Thus, the
actual condition being tested was 'if (highest >= highest + 1 +
pages)'.  Finally, remove 'highest' entirely by keep the result of the
'pvd' increment in the existing loop.

Reported by: CHERI (overflow)
Reviewed by: markj
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D38377

16 months agoRemove support for the base/* toolchain ports.
John Baldwin [Mon, 13 Feb 2023 21:16:24 +0000 (13:16 -0800)]
Remove support for the base/* toolchain ports.

These ports have been removed so these knobs are no longer meaningful.

This reverts commit 608289394f655d0635c71233248b734010fb4d2f.
This reverts commit 39eb07f172921a581ee9b33ca2765905f4235202.

Reviewed by: imp, bapt, emaste
Differential Revision: https://reviews.freebsd.org/D38562

16 months agolinuxkpi: Define `cpu_data(cpu)`
Jean-Sébastien Pédron [Fri, 10 Feb 2023 15:38:43 +0000 (16:38 +0100)]
linuxkpi: Define `cpu_data(cpu)`

`cpu_data(cpu)` evaluates to a `struct cpuinfo_x86` filled with
attributes of the given CPU number. The CPU number is an index in the
`__cpu_data[]` array with MAXCPU entries. On FreeBSD, we simply
initialize all of them like we do with `boot_cpu_data`.

While here, we add the `x86_model` field to the `struct cpuinfo_x86`. We
use `CPUID_TO_MODEL()` to set it.

At the same time, we fix the value of `x86` which should have been set
to the CPU family. It was using the same implementation as
`CPUID_TO_MODEL()` before. It now uses `CPUID_TO_FAMILY()`.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38542

16 months agolinuxkpi: Add `sg_alloc_table_from_pages_segment()`
Jean-Sébastien Pédron [Fri, 10 Feb 2023 15:37:31 +0000 (16:37 +0100)]
linuxkpi: Add `sg_alloc_table_from_pages_segment()`

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38541

16 months agolinuxkpi: Add <linux/stdarg.h> + include it from <linux/string.h>
Jean-Sébastien Pédron [Fri, 10 Feb 2023 10:52:12 +0000 (11:52 +0100)]
linuxkpi: Add <linux/stdarg.h> + include it from <linux/string.h>

The <stdarg.h> header was moved in Linux 5.15.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38540

16 months agolinuxkpi: Define `IRQ_NOTCONNECTED`
Jean-Sébastien Pédron [Fri, 10 Feb 2023 10:26:17 +0000 (11:26 +0100)]
linuxkpi: Define `IRQ_NOTCONNECTED`

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38539

16 months agolinuxkpi: Define `lockdep_assert{,_once}()`
Jean-Sébastien Pédron [Thu, 9 Feb 2023 22:04:26 +0000 (23:04 +0100)]
linuxkpi: Define `lockdep_assert{,_once}()`

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38538

16 months agolinuxkpi: Move definition of `struct list_head` to <linux/types.h>
Jean-Sébastien Pédron [Thu, 9 Feb 2023 12:11:34 +0000 (13:11 +0100)]
linuxkpi: Move definition of `struct list_head` to <linux/types.h>

This is the case on Linux.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38537

16 months agolinuxkpi: Define `FIELD_FIT()`
Jean-Sébastien Pédron [Wed, 8 Feb 2023 23:38:22 +0000 (00:38 +0100)]
linuxkpi: Define `FIELD_FIT()`

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38536

16 months agolinuxkpi: Add `i2c_adapter_quirks` support
Jean-Sébastien Pédron [Wed, 8 Feb 2023 17:57:32 +0000 (18:57 +0100)]
linuxkpi: Add `i2c_adapter_quirks` support

While here, also declare `I2C_CLASS_HWMON`.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38535

16 months agolinuxkpi: Define `xa_is_err()`, `xa_{store,erase}_irq()` and `xa_{,un}lock_irq*()`
Jean-Sébastien Pédron [Wed, 8 Feb 2023 17:55:29 +0000 (18:55 +0100)]
linuxkpi: Define `xa_is_err()`, `xa_{store,erase}_irq()` and `xa_{,un}lock_irq*()`

`xa_is_err()` is synonymous to `IS_ERR()`.

Other introduced functions call their equivalent without the `irq*`
suffix.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38534

16 months agolinuxkpi: Update `vga_client_register()` and add `vga_client_unregister()`
Jean-Sébastien Pédron [Wed, 8 Feb 2023 17:53:57 +0000 (18:53 +0100)]
linuxkpi: Update `vga_client_register()` and add `vga_client_unregister()`

For `vga_client_register()`, the API is modified twice in a row. To keep
the API compatible with all commits in the DRM driver, we introduce two
`LINUXKPI_VERSION` version bumps.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38533

16 months agolinuxkpi: Declare missing `DMI_*` enum entries
Jean-Sébastien Pédron [Wed, 8 Feb 2023 17:53:23 +0000 (18:53 +0100)]
linuxkpi: Declare missing `DMI_*` enum entries

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38532

16 months agolinuxkpi: Define `backlight_get_brightness()` and `backlight_is_blank()`
Jean-Sébastien Pédron [Wed, 8 Feb 2023 17:51:16 +0000 (18:51 +0100)]
linuxkpi: Define `backlight_get_brightness()` and `backlight_is_blank()`

This is not used by the DRM driver yet because we comment out the code
calling them, but they are easy to implement.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38530

16 months agozlib: Add proper NO_WSTRICT_PROTYPES too
Warner Losh [Mon, 13 Feb 2023 19:00:50 +0000 (12:00 -0700)]
zlib: Add proper NO_WSTRICT_PROTYPES too

Also move NO_WDEPRECATED_NON_PROTOTYPE to a better place...

Sponsored by: Netflix
Noticed by: jhb
Fixes: b9f235ba3178

16 months agopsm: ansify
Mateusz Guzik [Mon, 13 Feb 2023 18:38:49 +0000 (18:38 +0000)]
psm: ansify

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

16 months agotcp: add missing void keyword to tcp_stats_init
Mateusz Guzik [Mon, 13 Feb 2023 18:38:04 +0000 (18:38 +0000)]
tcp: add missing void keyword to tcp_stats_init

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

16 months agoxdr: ansify
Mateusz Guzik [Mon, 13 Feb 2023 18:37:31 +0000 (18:37 +0000)]
xdr: ansify

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

16 months agoufs: ansify
Mateusz Guzik [Mon, 13 Feb 2023 18:35:54 +0000 (18:35 +0000)]
ufs: ansify

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

16 months agoaltq: ansify
Mateusz Guzik [Mon, 13 Feb 2023 18:32:45 +0000 (18:32 +0000)]
altq: ansify

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

16 months agospeaker: ansify
Mateusz Guzik [Mon, 13 Feb 2023 18:28:09 +0000 (18:28 +0000)]
speaker: ansify

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

16 months agontptime: ansify
Mateusz Guzik [Mon, 13 Feb 2023 18:24:13 +0000 (18:24 +0000)]
ntptime: ansify

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

16 months agovm: ansify
Mateusz Guzik [Mon, 13 Feb 2023 18:23:21 +0000 (18:23 +0000)]
vm: ansify

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

16 months agouipc: ansify
Mateusz Guzik [Mon, 13 Feb 2023 18:20:29 +0000 (18:20 +0000)]
uipc: ansify

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

16 months agosctp: ansify
Mateusz Guzik [Mon, 13 Feb 2023 18:16:28 +0000 (18:16 +0000)]
sctp: ansify

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

16 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

16 months agoipfilter: ansify
Mateusz Guzik [Mon, 13 Feb 2023 18:05:57 +0000 (18:05 +0000)]
ipfilter: ansify

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

16 months agoofwbus: only allow unit number zero
Mitchell Horne [Mon, 13 Feb 2023 17:44:03 +0000 (13:44 -0400)]
ofwbus: only allow unit number zero

ofwbus has always been the root of attachment for OFW/FDT platforms. It
may have simplebus children, but we expect only one instance of the
ofwbus driver, added directly by nexus. We may as well ensure this
remains the case.

Reviewed by: jhb
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D38493

16 months agoofwbus: remove arm64 ifdefs
Mitchell Horne [Mon, 13 Feb 2023 17:43:25 +0000 (13:43 -0400)]
ofwbus: remove arm64 ifdefs

Rather than using the DEVICE_IDENTIFY method, let's have other
ofwbus-using platforms add ofwbus0 explicitly in nexus, like arm64. This
gives them the same flexibility, e.g. if riscv starts supporting ACPI,
and cleans up the #ifdefs.

We were doing this already on riscv, but adjust the 'order' parameters.

Reviewed by: andrew, jhb
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D38492

16 months agoofwbus: trim includes
Mitchell Horne [Mon, 13 Feb 2023 17:42:56 +0000 (13:42 -0400)]
ofwbus: trim includes

Nothing in the file today relies on these.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D38491

16 months agozlib: Use NO_WDEPRECATED_NON_PROTOTYPE
Warner Losh [Mon, 13 Feb 2023 16:15:58 +0000 (09:15 -0700)]
zlib: Use NO_WDEPRECATED_NON_PROTOTYPE

Also add it to kern.mk so it's available for module builds.

Sponsored by: Netflix
Noticed by: mjg
Fixes: b9f235ba3178
Differential Revision: https://reviews.freebsd.org/D38550

16 months agoChange "ctlstat -P"'s schema
Alan Somers [Wed, 25 Jan 2023 18:00:49 +0000 (11:00 -0700)]
Change "ctlstat -P"'s schema

It now reports stats separately for both ports and luns.

Also, prohibit using both "-p" and "-P" at the same time.

MFC after: 1 week
Sponsored by: Axcient
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D38500

16 months agoComplete removal of opt_compat.h
Dmitry Chagin [Mon, 13 Feb 2023 16:07:38 +0000 (19:07 +0300)]
Complete removal of opt_compat.h

Since Linux emulation layer build options was removed there is no reason
to keep opt_compat.h.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38548
MFC after: 2 weeks

16 months agosesutil: don't malloc in a tight loop
Alan Somers [Thu, 9 Feb 2023 22:23:51 +0000 (15:23 -0700)]
sesutil: don't malloc in a tight loop

Reported by: mav
MFC after: 1 week
Sponsored by: Axcient
Reviwed by: mav
Differential Revision: https://reviews.freebsd.org/D38473

16 months agobearssl: Suppress warnings from functions that have no args
Warner Losh [Mon, 13 Feb 2023 15:19:40 +0000 (08:19 -0700)]
bearssl: Suppress warnings from functions that have no args

clag15 is much pickier than others, so suppress the warning until
upstream can be updated.

Sponsored by: Netflix

16 months agoProperly conditionalize clang 15-only flags
Warner Losh [Mon, 13 Feb 2023 15:19:00 +0000 (08:19 -0700)]
Properly conditionalize clang 15-only flags

Sponsored by: Netflix
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38550

16 months agoprof: Remove sysctl docs for sysctls that are now gone.
Warner Losh [Mon, 13 Feb 2023 15:18:50 +0000 (08:18 -0700)]
prof: Remove sysctl docs for sysctls that are now gone.

GRPOF based kernel profiling was removed in aa3ea612be36. However, the
docs for the sysctls were not. Remove them belatedly.

Sponsored by: Netflix

16 months agoCirrus-CI: use llvm15 toolchain packages
Ed Maste [Mon, 13 Feb 2023 14:28:35 +0000 (09:28 -0500)]
Cirrus-CI: use llvm15 toolchain packages

As of commit 50d7464c3fe6 we use llvm15 as the system toolchain, and
commit eca005d8531f added compiler options incompatible with earlier
versions.  Switch to llvm15 packages.

Sponsored by: The FreeBSD Foundation

16 months agotop: fix sorting by pid (-o pid)
Kyle Evans [Mon, 13 Feb 2023 06:39:04 +0000 (00:39 -0600)]
top: fix sorting by pid (-o pid)

The 'pid' order was added, but the equivalent comparator was not back in
8b800d3af2d8c ("Add the PID column to the list of sort keys.").
`ordernames` indices need to match `compares` indices in order for this
to work.

A future commit will restructure all of this to make it less error prone
going forward (see D37083).

MFC after: 3 days
Reviewed by: pstef (D37083)

16 months agolibc: popen: slightly simplify cloexec logic
Kyle Evans [Mon, 13 Feb 2023 06:33:52 +0000 (00:33 -0600)]
libc: popen: slightly simplify cloexec logic

No need to check the mode again here; we know that `iop` wraps the
correct fd.

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D37987

16 months agomd5: fix *sum -c with missing files
Kyle Evans [Mon, 13 Feb 2023 06:32:38 +0000 (00:32 -0600)]
md5: fix *sum -c with missing files

If we fail to open one of the files in the file listing, we still need
to advance `rec` along with `argv` so that the checksum we're checking
against lines up with the file we're hashing.

Tests added both for the -c flag, as well as the -b and -t modes of
the *sum programs.

PR: 267722
Reviewed by: emaste (earlier version)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D37374

16 months agopatch: omit filename if the prompt was ignored
Kyle Evans [Tue, 24 Jan 2023 16:46:01 +0000 (10:46 -0600)]
patch: omit filename if the prompt was ignored

When a file is missing, patch(1) will prompt for a filename to try and
patch it.  If we're doing a dry-run, we'll output that the patch to the
source file was either ignored/failed.  If you ignore the prompt in a
dry-run (i.e. just hit enter), we'll output:

X out of X hunks ignored while patching (null)

Let's improve the aesthetics a bit and just omit the last part if the
prompt was ignored:

X out of X hunks ignored

Unfortunately we can't really test this without expect(1) because both
force and batch mode will use the first best guess, which is wiped out
by the "File to patch:" prompt.  We could record the initially derived
bestguess there and use *that*, but given that this is only possible in
an interactive session I think it's fine to just omit the filename
rather than adding a fair amount of complexity (which could also break
other scenarios I haven't considered yet)..

Reviewed by: des
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38179

16 months agowg: tests: remove an obsolete workaround
Kyle Evans [Mon, 13 Feb 2023 05:59:21 +0000 (23:59 -0600)]
wg: tests: remove an obsolete workaround

PR 254212 was resolved to avoid issues with not having IPv6 addresses
present in the jail, so we can safely drop this workaround now...

Reviewed by: jhb, markj
Differential Revision: https://reviews.freebsd.org/D37755

16 months agowg: add a test for the home jail socket feature
Kyle Evans [Mon, 13 Feb 2023 05:59:20 +0000 (23:59 -0600)]
wg: add a test for the home jail socket feature

This adds a test for a semantic that we added to mirror a feature of
the Linux implementation w/ netns: if a wg interface is moved into a
jail, we still create the socket in the context of the home vnet.  With
this added, one can actually create vnet jails that only have a wg
tunnel to the outside world providing network connectivity without any
epairs in the setup.

Reviewed by: jhb, markj (both earlier version)
Differential Revision: https://reviews.freebsd.org/D37755

16 months agorpc: ansify
Mateusz Guzik [Mon, 13 Feb 2023 05:39:10 +0000 (05:39 +0000)]
rpc: ansify

Reported by: clang 15
Sponsored by: Rubicon Communications, LLC ("Netgate")

16 months agocleanvar: Be more careful when cleaning up /var.
Xin LI [Mon, 13 Feb 2023 04:56:17 +0000 (20:56 -0800)]
cleanvar: Be more careful when cleaning up /var.

The cleanvar script uses find -delete to remove stale files under /var,
which could lead to unwanted removal of files in some unusual scenarios.
For example, when a mounted fdescfs(5) is present under /var/run/samba/fd,
find(1) could descend into a directory that is out of /var/run and remove
files that should not be removed.

To mitigate this, modify the script to use find -x, which restricts the
find scope to one file system only instead of descending into mounted
file systems.

PR: 269213
MFC after: 1 week

16 months agoman5/rc.conf.5: document utx_enable variable.
Ceri Davies [Sun, 12 Feb 2023 22:17:46 +0000 (22:17 +0000)]
man5/rc.conf.5: document utx_enable variable.

16 months agonfsd: Continue adding macros so nfsd can run in a vnet prison
Rick Macklem [Sun, 12 Feb 2023 21:52:13 +0000 (13:52 -0800)]
nfsd: Continue adding macros so nfsd can run in a vnet prison

Commit 7344856e3a6d added a lot of macros that will front end
vnet macros so that nfsd(8) can run in vnet prison.
This patch adds some more of them.

MFC after: 3 months

16 months agolge: ansify
Mateusz Guzik [Sun, 12 Feb 2023 21:37:24 +0000 (21:37 +0000)]
lge: ansify

Reported by: clang 15
Sponsored by: Rubicon Communications, LLC ("Netgate")

16 months agoARM release build: enable IPv6 SLAAC by default
Joerg Wunsch [Sun, 12 Feb 2023 21:26:52 +0000 (22:26 +0100)]
ARM release build: enable IPv6 SLAAC by default

When building ARM release images, enable IPv6 SLAAC by default in
addition to IPv4 DHCP.

Unlike amd64 (and other desktop/server) releases, ARM releases on SoC
setups are usually deployed by just using the installation image, so
there is no interactive network configuration. Not having IPv6
included by default is kind of an anachronism these days, given that
FreeBSD with the KAME project once pioneered IPv6 technology.

MFC after: 2 weeks

16 months agozlib: silence K&R warns
Mateusz Guzik [Sun, 12 Feb 2023 21:12:34 +0000 (21:12 +0000)]
zlib: silence K&R warns

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

16 months agolinux(4): Get rid of the opt_compat.h include.
Dmitry Chagin [Sun, 12 Feb 2023 17:24:32 +0000 (20:24 +0300)]
linux(4): Get rid of the opt_compat.h include.

Since e013e369 COMPAT_LINUX, COMPAT_LINUX32 build options are removed,
so include of opt_compat.h is no more needed.

MFC after: 2 weeks

16 months agonfsd: Fix initialization broken by 7344856e3a6d
Rick Macklem [Sun, 12 Feb 2023 17:16:56 +0000 (09:16 -0800)]
nfsd: Fix initialization broken by 7344856e3a6d

Oops, although the vneting macros do not do anything yet,
commit 7344856e3a6d did change where things are initialized
and one of the initialization functions was not being called
early enough.  This patch moves nfsrvd_init(0) to the
function called via (VNET_)SYSINIT() to fix this.

Reported by: olivier
MFC after: 3 months

16 months agoRevert "netlink: make netlink_snl(3) c++ friendly."
Alexander V. Chernikov [Sun, 12 Feb 2023 12:16:58 +0000 (12:16 +0000)]
Revert "netlink: make netlink_snl(3) c++ friendly."

Was pushed accidentally.

This reverts commit 629d9219d931e63dc49ef046332b2a360e42a5f6.

16 months agofibs: restrict jail_attach(2) if process fibnum >= numfibs in the jail.
Alexander V. Chernikov [Sat, 11 Feb 2023 15:43:23 +0000 (15:43 +0000)]
fibs: restrict jail_attach(2) if process fibnum >= numfibs in the jail.

Reported by: olivier
Tested by: olivier
Reviewed by: kp, glebius
Differential Revision: https://reviews.freebsd.org/D38505
MFC after: 1 week

16 months agonetlink: make netlink_snl(3) c++ friendly.
Alexander V. Chernikov [Fri, 10 Feb 2023 20:19:09 +0000 (20:19 +0000)]
netlink: make netlink_snl(3) c++ friendly.

16 months agonfsd: Delete nfsrv_prison_cleanup() until vneting enabled
Rick Macklem [Sun, 12 Feb 2023 02:27:59 +0000 (18:27 -0800)]
nfsd: Delete nfsrv_prison_cleanup() until vneting enabled

Oops, although the vneting macros do not do anything yet,
commit 7344856e3a6d enabled the prison cleanup function, that
would get called and crash the system when a jail was terminated.

This patch gets rid of nfsrv_prison_cleanup() for now.
It can go in when the vnet macros are enabled as
front ends to the vnet macros.

MFC after: 3 months

16 months agonfsd: Prepare the NFS server code to run in a vnet prison
Rick Macklem [Sat, 11 Feb 2023 23:51:19 +0000 (15:51 -0800)]
nfsd: Prepare the NFS server code to run in a vnet prison

This patch defines null macros that can be used to apply
the vnet macros for global variables and SYSCTL flags.
It also applies these macros to many of the global variables
and some of the SYSCTLs.  Since the macros do nothing, these
changes should not result in semantics changes, although the
changes are large in number.

The patch does change several global variables that were
arrays or structures to pointers to same.  For these variables,
modified initialization and cleanup code malloc's and free's
the arrays/structures.  This was done so that the vnet footprint
would be about 300bytes when the macros are defined as vnet macros,
allowing nfsd.ko to load dynamically.

I believe the comments in D37519 have been addressed, although
it has never been reviewed, due in part to the large size of the patch.
This is the first of a series of patches that will put D37519 in main.

Once everything is in main, the macros will be defined as front
end macros to the vnet ones.

MFC after: 3 months
Differential Revision: https://reviews.freebsd.org/D37519

16 months agoman: some typesetting and style fixes for recent additions
Konstantin Belousov [Sat, 11 Feb 2023 00:46:34 +0000 (02:46 +0200)]
man: some typesetting and style fixes for recent additions

Mostly start each sentence from a new line.  Also add more pretty
typesetting to cdce(4).

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D38501

16 months agonfsd: Add a KASSERT in nfsvno_open
Rick Macklem [Sat, 11 Feb 2023 15:14:08 +0000 (07:14 -0800)]
nfsd: Add a KASSERT in nfsvno_open

Commit ded5f2954e1a defined done_namei to indicate that
nd_repstat was set after a successful nfsvno_namei(),
so that a cleanup needs to be done in nfsvno_open().
This only happens when nfsvno_namei() is done with CREATE.

This patch adds a KASSERT() to check for that.

PR: 268971

16 months agoFix pjfstest issue tests/rename/09.t
Fedor Uporov [Thu, 2 Feb 2023 10:13:02 +0000 (13:13 +0300)]
Fix pjfstest issue tests/rename/09.t

Fix rename when renamed directory not owned by user,
but when user owns the sticky parent directory.

Reviewed by:    kib
MFC after:      2 week
Differential revision:  https://reviews.freebsd.org/D38245

16 months agostress2: Fix compiler warning about unused variables
Peter Holm [Sat, 11 Feb 2023 05:36:39 +0000 (06:36 +0100)]
stress2: Fix compiler warning about unused variables

16 months agogetopt_long(3): note an inconsistency with getopt(3) in BUGS
Kyle Evans [Sat, 11 Feb 2023 05:31:13 +0000 (23:31 -0600)]
getopt_long(3): note an inconsistency with getopt(3) in BUGS

getopt_long(3) will not allow an `optind` setting of 0 to be bug-for-bug
compatible with the GNU implementation, as some software does rely on
it.  Document it as a BUG, since it affects previous declarations of
compatibility with getopt(3).

Reviewed by: pauamma (markup)
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37867

16 months agonfsd: Fix handling of the error case for nfsvno_open some more
Rick Macklem [Sat, 11 Feb 2023 03:34:57 +0000 (19:34 -0800)]
nfsd: Fix handling of the error case for nfsvno_open some more

Commit ded5f2954e1a defined done_namei to indicate that
nd_repstat was set after a successful nfsvno_namei(),
so that a cleanup needs to be done in nfsvno_open().
However, it missed the case where a call to
nfsrv_opencheck() in nfsvno_open() sets nd_repstat non-zero.

This would cause panics due to a dangling locked vnode
when nfsrv_opencheck() set nd_repstat, such as during grace
just after a server boot.

This patch fixes the problem.

PR: 268971

16 months agoUPDATING: add UPDATING section for HUAWEI 3G/4G Devices change
Michael Paepcke [Fri, 10 Feb 2023 19:26:13 +0000 (19:26 +0000)]
UPDATING: add UPDATING section for HUAWEI 3G/4G Devices change

help users to migrate existing devices

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/645

16 months agou3g: add huawei device id
Michael Paepcke [Fri, 10 Feb 2023 19:06:39 +0000 (19:06 +0000)]
u3g: add huawei device id

Add missing entry for E3372h Model already in NCM mode

Noticed by: David BOYER
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/645

16 months agocdce: add to cdce.4 information about NCM network mode
Michael Paepcke [Fri, 10 Feb 2023 19:43:09 +0000 (19:43 +0000)]
cdce: add to cdce.4 information about NCM network mode

add a new section how to use NCM network mode and specify the required
kernel modules

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/646

16 months agoAdd libclang_rt files for powerpc64le to ObsoleteFiles.inc
Dimitry Andric [Fri, 10 Feb 2023 19:10:31 +0000 (20:10 +0100)]
Add libclang_rt files for powerpc64le to ObsoleteFiles.inc

Since f5024381ac16 we have also built and installed several clang
runtime support libraries (for sanitizers) on powerpc64le, so add
entries to properly clean these up when upgrading.

Reported by: pkubaj
PR: 269423
MFC after: 2 weeks

16 months agocxgbe: fix module loading
Jung-uk Kim [Fri, 10 Feb 2023 18:27:20 +0000 (13:27 -0500)]
cxgbe: fix module loading

After c03414326909, if_cxgbe.ko fails to load if crypto is not compiled
in kernel, e.g., MINIMAL.

link_elf_obj: symbol hmac_init_ipad undefined
linker_load_file: /boot/kernel/if_cxgbe.ko - unsupported file type
kldload: an error occurred while loading module if_cxgbe. Please check dmesg(8) for more details.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D38482

16 months agotarfs: Fix deadlock between descent and ascent in tarfs_lookup().
Dag-Erling Smørgrav [Fri, 10 Feb 2023 17:19:45 +0000 (17:19 +0000)]
tarfs: Fix deadlock between descent and ascent in tarfs_lookup().

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D38486

16 months agoahci: increase timout
Mariusz Zaborski [Fri, 10 Feb 2023 15:56:04 +0000 (16:56 +0100)]
ahci: increase timout

For some devices, like Marvell 88SE9230, it takes more time
to connect to the device. This patch introduces a special flag
that extends the timeout from around 100ms to around 500ms.

This change is based on the work of: Peter Eriksson <pen@lysator.liu.se>

PR: 243401
Reviewed by: imp
Tested by: dch
MFC after: 3 days
Sponsored by: Equinix
Sponsored by: SkunkWerks, GmbH
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38413

16 months agodaemon: add long_opts
Ihor Antonov [Fri, 10 Feb 2023 04:36:07 +0000 (22:36 -0600)]
daemon: add long_opts

Long options improve readability of scripts, makes code comprehension
easier.  This patch adds long options while preserving the existing CLI
interface.

Also --help/-h option is added.

Reviewed by: allanjude, pauamma (both earlier versions), kevans
Differential Revision: https://reviews.freebsd.org/D38244

16 months agolibc: ssp: remove some GCC 4.2 remnants
Kyle Evans [Fri, 10 Feb 2023 04:08:07 +0000 (22:08 -0600)]
libc: ssp: remove some GCC 4.2 remnants

With GCC 4.2 out of the tree for a while now and no sign of it
returning, we don't really need to support older versions that don't
allow us to specify a ctor priority anymore.

Noticed by: mjg

16 months agoMerge bmake-20230208
Simon J. Gerraty [Fri, 10 Feb 2023 01:21:33 +0000 (17:21 -0800)]
Merge bmake-20230208

Merge commit 'f4d51098686d961fc03dc5aa327619d0af3c9dcd'

16 months agoImport bmake-20230208
Simon J. Gerraty [Fri, 10 Feb 2023 01:20:05 +0000 (17:20 -0800)]
Import bmake-20230208

ChangeLog since bmake-20230126

        * VERSION (_MAKE_VERSION): 20230208
        Merge with NetBSD make, pick up
        o var.c: always use SCOPE_GLOBAL for :_ to avoid problems
        when it has been used within conditional expressions

        * install-sh: if making directories ensure umask is set
        to match mode.

        * Makefile: use DIRMODE for directories and
        NONBINMODE for man pages and mk files

16 months agoAdd ck.h userspace shims for CK_SLIST_
Elliott Mitchell [Thu, 9 Feb 2023 23:27:12 +0000 (16:27 -0700)]
Add ck.h userspace shims for CK_SLIST_

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

16 months agosesutil: plug memory leaks
Alan Somers [Wed, 19 Jan 2022 21:57:27 +0000 (14:57 -0700)]
sesutil: plug memory leaks

MFC after: 1 week
Sponsored by: Axcient
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D33955

16 months agoinpcb: Split in_pcblookup_hash_locked() and clean up a bit
Mark Johnston [Thu, 9 Feb 2023 20:59:27 +0000 (15:59 -0500)]
inpcb: Split in_pcblookup_hash_locked() and clean up a bit

Split the in_pcblookup_hash_locked() function into several independent
subroutine calls, each of which does some kind of hash table lookup.
This refactoring makes it easier to introduce variants of the lookup
algorithm that behave differently depending on whether they are
synchronized by SMR or the PCB database hash lock.

While here, do some related cleanup:
- Remove an unused ifnet parameter from internal functions.  Keep it in
  external functions so that it can be used in the future to derive a v6
  scopeid.
- Reorder the parameters to in_pcblookup_lbgroup() to be consistent with
  the other lookup functions.
- Remove an always-true check from in_pcblookup_lbgroup(): we can assume
  that we're performing a wildcard match.

No functional change intended.

Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D38364

16 months agovmm: Fix AP startup compatibility for old bhyve executables
Mark Johnston [Thu, 9 Feb 2023 20:52:35 +0000 (15:52 -0500)]
vmm: Fix AP startup compatibility for old bhyve executables

These changes unbreak AP startup when using a 13.1-RELEASE bhyve
executable with a newer kernel:
- Correct the destination mask for the VM_EXITCODE_IPI message generated
  by an INIT or STARTUP IPI in vlapic_icrlo_write_handler().
- Only initialize vlapics on active vCPUs.  13.1-RELEASE bhyve activates
  AP vCPUs only after the BSP starts them with an IPI, and vmm now
  allocates vcpu structures lazily, so the STARTUP handling in
  vm_handle_ipi() could trigger a page fault.
- Fix an off-by-one setting the vcpuid in a VM_EXITCODE_SPINUP_AP
  message.

Fixes: 7c326ab5bb9a ("vmm: don't lock a mtx in the icr_low write handler")
Reviewed by: jhb, corvink
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38446