]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
19 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

19 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

19 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

19 months agolinux(4): Move use_real_names knob to the linux.c
Dmitry Chagin [Tue, 14 Feb 2023 14:46:32 +0000 (17:46 +0300)]
linux(4): Move use_real_names knob to the linux.c

MI linux.[c|h] are the module independent in terms of the Linux emulation
layer (ie, intended for both ISA - 32 & 64 bit), analogue of MD linux.h.
There must be a code here that cannot be placed into the corresponding by
common sense MI source and header files, i.e., code is machine independent,
but ISA dependent.
For the use_real_names knob, the code must be placed into the
linux_socket.[c|h], however linux_socket is ISA dependent.

MFC after: 2 weeks

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 months agosys/kbio.h: make pre-unicode keymap support optional
Stefan Eßer [Tue, 14 Feb 2023 13:03:28 +0000 (14:03 +0100)]
sys/kbio.h: make pre-unicode keymap support optional

FreeBSD-9 had introduced support for the full set of Unicode
characters to the parsing and processing of keymap character tables.

This support has been extended to cover the table for accented
characters that are reached via dead key combinations in FreeBSD-13.2.

New ioctls have been introduced to support both the pre-Unicode and
the Unicode formats and keyboard drivers have been extended to support
those ioctls.

This commit makes the ABI compatibility functions in the kernel
optional and dependent on COMPAT_FREEBSD13 in -CURRENT.

The kbdcontrol command in -CURRENT and 13-STABLE (before 13.2) has
been made ABI compatible with old kernels to allow a new world to be
run on an old kernel (that does not have full Unicode support for
keymaps).

This commit is not to merged back to 12-STABLE or 13-STABLE. It is
part of review D38465, which has been split into 3 separate commits
due to different MFC and life-time requirements of either commit.

Approved by: imp
Differential Revision: https://reviews.freebsd.org/D38465

19 months agokbdcontrol: enable pre-Unicode dead key table compatibility
Stefan Eßer [Tue, 14 Feb 2023 12:49:06 +0000 (13:49 +0100)]
kbdcontrol: enable pre-Unicode dead key table compatibility

The definition of pre-Unicode keymap ioctls will be made optional and
dependent on COMPAT_FREEBSD13 in a follow-up commit to 14-CURRENT.

While we generally provide ABI compatibility for older binaries on
a new kernel, but not functionally extended userland programs on an
old kernel, it has been specifically requested to preserve ABI
compatibility for the kbdcontrol program for both these cases.

Passing the kernel configuration option COMPAT_FREEBSD13 to the build
of kbdcontrol will make ioctls visible to the build that are normally
hidden, but required to implement compatibility with kernels that only
support 8 bit characters in dead key maps.

This commit is not to be merged to any previous FreeBSD version and
it shall be reverted as soon as this type of ABI compatibility is no
longer deemed necessary (probably before 14-STABLE is branched).

This commit is a part of review D38465 and split off to allow it to be
reverted using the commit ID.

19 months agokbdcontrol.c: make pre-Unicode compatibility conditional
Stefan Eßer [Tue, 14 Feb 2023 12:27:27 +0000 (13:27 +0100)]
kbdcontrol.c: make pre-Unicode compatibility conditional

Support for the full range of Unicode character codes has been added
to the main keymap back in 2009, with compatibility shims added in
2011 (to support an older kbdcontrol command on a new kernel during
an upgrade from FreeBSD-8 to FreeBSD-9).

Unicode support for accented characters that are reached via dead key
combinations has been added just recently, again with compatibility
shims to allow all combinations of old/new kernel and old/new
kbdcontrol command to load and display the keymaps including the dead
key table. (But full Unicode in the dead key table requires both a new
kernel and kbdcontrol command.)

This commit makes the compatibility shims depend on the respective
compatibility ioctls (OGIO_KEYMAP, OPIO_KEYMAP, OGIO_DEADKEYMAP, and
OPIO_DEADKEYMAP) being defined in sys/kbio.h. This is true for all of
them in 13-STABLE, none in 12-STABLE (as of now), and will become
optional due to a follow-up commit to sys/kbio.h in -CURRENT.

This commit is the only part of review D38465 that should be merged
back to 12-STABLE and 13-STABLE.

MFC after: 1 month

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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.

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

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

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

19 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")

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

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

19 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:

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

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

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

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

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

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

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

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

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

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

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

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

19 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

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

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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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)

19 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

19 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

19 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

19 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

19 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

19 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")

19 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

19 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.

19 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

19 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")

19 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

19 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")

19 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

19 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

19 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.

19 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

19 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.

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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