]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
10 months agolinux(4): Add a write syscall wrapper
Dmitry Chagin [Sun, 20 Aug 2023 07:36:29 +0000 (10:36 +0300)]
linux(4): Add a write syscall wrapper

Adding a write syscall wrapper is needed due to Linux family of write
syscalls doesn't distinguish between in kernel blocking operations
and always returns EAGAIN while FreeBSD can return ENOBUFS.

MFC after: 1 month

10 months agoRegen for write syscall
Dmitry Chagin [Sun, 20 Aug 2023 07:36:29 +0000 (10:36 +0300)]
Regen for write syscall

10 months agolinux(4): Modify write syscall to match Linux
Dmitry Chagin [Sun, 20 Aug 2023 07:36:28 +0000 (10:36 +0300)]
linux(4): Modify write syscall to match Linux

Adding a write syscall wrapper is needed due to Linux family of write
syscalls doesn't distinguish between in kernel blocking operations
and always returns EAGAIN while FreeBSD can return ENOBUFS.

MFC after: 1 month

10 months agoMFV: zlib 1.3
Xin LI [Sun, 20 Aug 2023 06:06:49 +0000 (23:06 -0700)]
MFV: zlib 1.3

Relnotes: yes
MFC after: 2 weeks

10 months agoBump __FreeBSD_version for struct sysinit change
Colin Percival [Sun, 20 Aug 2023 06:01:27 +0000 (23:01 -0700)]
Bump __FreeBSD_version for struct sysinit change

The layout of struct sysinit changed in cedc82c0466a to add a
"SLIST_ENTRY(sysinit) next" field so that sysinits can be placed
into a linked list.

Reported by: jrtc27

10 months agonetbsd-tests: libc: fix strvis(3) overflow tests
Kyle Evans [Sun, 20 Aug 2023 05:28:08 +0000 (00:28 -0500)]
netbsd-tests: libc: fix strvis(3) overflow tests

These tests weren't run on x86 until CI grabbed them.  It turns out,
there's a sign extension bug that surfaces on x86 with char being a
signed type.

NetBSD unearthed this when they took and improved the patch, so just
grab their solution until we get to merging in the latest version of
the test.

Reported by: CI (via ngie)
Fixes: 2f489a509e61 ("libc: fix some overflow scenarios in vis(3)")

10 months agoinit_main: Switch from sysinit array to SLIST
Colin Percival [Tue, 18 Jul 2023 02:29:20 +0000 (19:29 -0700)]
init_main: Switch from sysinit array to SLIST

This has two effects:
1. We can mergesort the sysinits instead of bubblesorting them, which
shaves about 2 ms off the boot time in Firecracker.
2. Adding more sysinits (e.g. from a KLD) can be performed by sorting
them and then merging the sorted lists, which is both faster than
the previous "append and sort" approach and avoids needing malloc.

Reviewed by: jhb (previous version)
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D41075

10 months agostruct sysinit: Add SLIST_ENTRY(sysinit) next
Colin Percival [Tue, 18 Jul 2023 02:20:05 +0000 (19:20 -0700)]
struct sysinit: Add SLIST_ENTRY(sysinit) next

This will be used to put SYSINITs onto a linked list.

Reviewed by: jhb, emaste
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D41074

10 months agoAdd <sys/queue_mergesort.h>
Colin Percival [Tue, 18 Jul 2023 00:07:44 +0000 (17:07 -0700)]
Add <sys/queue_mergesort.h>

Thie file provides macros for performing mergesorts and merging two
sorted lists implemented by <sys/queue.h>.  The mergesort operates
in guaranteed O(n log n) time and uses constant additional space:
3 or 4 pointers (depending on list type) and 4 size_t values.  The
merge operates in guaranteed O(n + m) time and uses constant
additional space: 3 pointers.

In memoriam: hselasky
Reviewed by: jhb (previous version)
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D41073

10 months agoqueue.h: Define {LIST,TAILQ}_REMOVE_HEAD
Colin Percival [Mon, 17 Jul 2023 23:42:50 +0000 (16:42 -0700)]
queue.h: Define {LIST,TAILQ}_REMOVE_HEAD

The LIST and TAILQ structures have fast _REMOVE macros (since each
element has a pointer to the previous element); we implement the
_REMOVE_HEAD macros for them by simply finding the first element and
then removing it.

Reviewed by: jhb, emaste
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D41072

10 months agoxhci: Add support for 64-bit DMA in generic XHCI controller driver
Stephen J. Kiernan [Fri, 11 Aug 2023 16:06:02 +0000 (12:06 -0400)]
xhci: Add support for 64-bit DMA in generic XHCI controller driver

The XHCI controller on 64-bit SoCs need to use 64-bit DMA.
Add a quirk to tell the generic XHCI driver that 32-bit DMA needs
to be used, if there are any that may need to use 32-bit DMA only.

Reviewed by: andrew
Obtained from: Juniper Networks, Inc.

10 months agoVendor import of zlib 1.3.
Xin LI [Sat, 19 Aug 2023 21:55:24 +0000 (14:55 -0700)]
Vendor import of zlib 1.3.

10 months agolinux(4): Fix linker warning about undefined vdso symbols
Dmitry Chagin [Sat, 19 Aug 2023 21:48:36 +0000 (00:48 +0300)]
linux(4): Fix linker warning about undefined vdso symbols

Pointed out by: bz
MFC after: 3 days

10 months agolinux(4): Return EAGAIN instead of ENOBUFS for non-blocking sockets in sendfile
Dmitry Chagin [Sat, 19 Aug 2023 18:55:23 +0000 (21:55 +0300)]
linux(4): Return EAGAIN instead of ENOBUFS for non-blocking sockets in sendfile

MFC after: 1 month

10 months agolinux(4): Allow in fd to be a socket in sendfile
Dmitry Chagin [Sat, 19 Aug 2023 18:55:23 +0000 (21:55 +0300)]
linux(4): Allow in fd to be a socket in sendfile

In this case sendfile fallback is used.

MFC after: 1 month

10 months agosctp: fix a warning
Michael Tuexen [Sat, 19 Aug 2023 11:24:02 +0000 (13:24 +0200)]
sctp: fix a warning

Fix an unused-but-set-variable warning for builds without INVARIANTS.

Reported by: O. Hartmann
MFC after: 1 week

10 months agosctp: cleanup handling of graceful shutdown of the peer
Michael Tuexen [Sat, 19 Aug 2023 10:35:49 +0000 (12:35 +0200)]
sctp: cleanup handling of graceful shutdown of the peer

Don't handle a graceful shutdown of the peer as an implicit signal
that all partial messages are complete. First, this is not implemented
correctly and second this should not be done by the peer. It is more
appropriate to handle this as a protocol violation.
Remove the incorrect code and leave detecting the protocol violation
and its handling in a followup commit.

MFC after: 1 week

10 months agostress2: No need to write to the console. Add revision to log string
Peter Holm [Sat, 19 Aug 2023 07:29:09 +0000 (09:29 +0200)]
stress2: No need to write to the console.  Add revision to log string

10 months agostress2: Added a syzkaller reproducer
Peter Holm [Sat, 19 Aug 2023 07:28:10 +0000 (09:28 +0200)]
stress2: Added a syzkaller reproducer

10 months agoLinuxKPI: skbuff: add skb_cow_head()
Bjoern A. Zeeb [Thu, 10 Aug 2023 02:07:41 +0000 (02:07 +0000)]
LinuxKPI: skbuff: add skb_cow_head()

Add dummy implementation of skb_cow_head().

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

10 months agoLinuxKPI: skbuff: fix tracing
Bjoern A. Zeeb [Sat, 19 Aug 2023 04:50:03 +0000 (04:50 +0000)]
LinuxKPI: skbuff: fix tracing

Fix arguments to a trace line and remove another trace line until we
actually will have the skb to trace along with a future implementation.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

10 months agoCirrus-CI: restore amd64-gcc12 build/test on main
Ed Maste [Sat, 19 Aug 2023 01:27:26 +0000 (21:27 -0400)]
Cirrus-CI: restore amd64-gcc12 build/test on main

The Cirrus-CI log length issue was addressed by commit 5f72ceb2c50d
("Cirrus-CI: for *-gcc12, build world with make -s"), and the failure
itself by commit 0c785f06020f ("Fix GoogleTest 1.14.0 import").

This reverts commit 0ed2e7e88984aa4ad01a41e9350c5870b271c0c3.

Reported by: Jose Luis Duran
Sponsored by: The FreeBSD Foundation

10 months agounbound: Move config.h to lib directory.
Dag-Erling Smørgrav [Sat, 19 Aug 2023 01:44:39 +0000 (01:44 +0000)]
unbound: Move config.h to lib directory.

It was originally in contrib, and moved to usr.sbin in 6692aa840c1f; I always thought lib would make more sense but never got around to moving it.

Reviewed by: cy
Differential Revision: https://reviews.freebsd.org/D41504

10 months agovfs: track how many times vn_alloc blocked on hitting the vnode limit
Mateusz Guzik [Fri, 18 Aug 2023 23:56:58 +0000 (23:56 +0000)]
vfs: track how many times vn_alloc blocked on hitting the vnode limit

10 months agolibcrypto: add rsa_depr.c to the build
Ed Maste [Fri, 18 Aug 2023 19:03:40 +0000 (15:03 -0400)]
libcrypto: add rsa_depr.c to the build

It provides the RSA_generate_key function, which is deprecated as of
3.0 but is used by various ports.

Reviewed by: kbowling
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41506

10 months agosys: Remove SND_DECLARE_FILE
John Baldwin [Fri, 18 Aug 2023 20:05:12 +0000 (13:05 -0700)]
sys: Remove SND_DECLARE_FILE

Reviewed by: kbowling, imp, emaste
Differential Revision: https://reviews.freebsd.org/D41499

10 months agopcm: Turn SND_DECLARE_FILE into a no-op.
John Baldwin [Fri, 18 Aug 2023 20:04:33 +0000 (13:04 -0700)]
pcm: Turn SND_DECLARE_FILE into a no-op.

SND_DECLARE_FILE originally added lines to the output of /dev/sndstat
listing the $FreeBSD$ strings for individual files, but only if the
value of hw.snd.verbose was raised to 3.  With the switch to Git these
strings became meaningless as they were now all identical and no longer
contained the path (which was implicitly included previously via the
keyword expansion).

This commit removes all of the infrastructure to support file version
strings from /dev/sndstat, but preserves the KPI/KBI by turning the
SND_DECLARE_FILE macro into a nop and changing the backing sysinit
functions into null functions and is suitable for merging to
stable/13.

A future commit will remove SND_DECLARE_FILE entirely.

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

10 months agoFix GoogleTest 1.14.0 import
Enji Cooper [Fri, 18 Aug 2023 11:28:13 +0000 (04:28 -0700)]
Fix GoogleTest 1.14.0 import

- Prune headers and tests no longer installed after the upgrade.
- Remove GoogleTest-related files when MK_GOOGLETEST == no.
- Disable `-Werror` with gcc to unbreak the gcc12 CI run with
  `lib/googletest`. Any issues found by g++ will be filed
  upstream and hopefully resolved in a future version.
- Remove clang -Werror issues which are resolved in version 1.14.0 to
  avoid masking valid issues.

MFC after: 1 week
MFC with: 28f6c2f292806bf31230a959bc4b19d7081669a7

10 months agolibcrypto: add err_all_legacy.c to the build
Ed Maste [Fri, 18 Aug 2023 18:28:42 +0000 (14:28 -0400)]
libcrypto: add err_all_legacy.c to the build

It provides the ERR_load_*_strings routines, which are deprecated as of
3.0 but are used by various ports.

PR: 272580
Reviewed by: kbowling
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41505

10 months agoirdma(4): upgrade to 1.2.17-k
Bartosz Sobczak [Fri, 18 Aug 2023 18:14:33 +0000 (11:14 -0700)]
irdma(4): upgrade to 1.2.17-k

Update Intel irdma driver to version 1.2.17-k

Notable changes:
- pf-reset handling improvements, including fixes in communication with if_ice(4)
- avoid racing when handling various events
- adding sw stats sysctls
- hand over pe_criterr handling from ice(4) to irdma(4)
- debug prints adjustments
- fix crash after changes in irdma_add_mqh_ifa_cb

Signed-off-by: Bartosz Sobczak <bartosz.sobczak@intel.com>
Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: erj@
MFC after: 1 month
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D41425

10 months agoUPDATING: fix a typo, adjust a white space
Graham Perrin [Fri, 18 Aug 2023 16:55:25 +0000 (17:55 +0100)]
UPDATING: fix a typo, adjust a white space

From:

> … chagned.  boot0sio …

to:

> … changed. boot0sio …

Fixes: 4722ceb7d53e Use 115200 bps by default for serial communication
10 months agosubr_unit.c: another attempt to fix the build
Konstantin Belousov [Fri, 18 Aug 2023 15:42:59 +0000 (18:42 +0300)]
subr_unit.c: another attempt to fix the build

Reported by: cy
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

10 months agosym(4): Add __diagused to nseg of getbaddrcb()
Marius Strobl [Fri, 18 Aug 2023 14:29:10 +0000 (16:29 +0200)]
sym(4): Add __diagused to nseg of getbaddrcb()

The parameter is only used when compiling with INVARIANTS.

10 months agostd.nodebug: remove DIAGNOSTIC from debug configs
Konstantin Belousov [Fri, 18 Aug 2023 13:39:22 +0000 (16:39 +0300)]
std.nodebug: remove DIAGNOSTIC from debug configs

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

10 months agokern/subr_unit.c: fix non-debug build
Konstantin Belousov [Fri, 18 Aug 2023 13:36:06 +0000 (16:36 +0300)]
kern/subr_unit.c: fix non-debug build

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

10 months agovm_map.c: fix syntax
Konstantin Belousov [Fri, 18 Aug 2023 13:35:25 +0000 (16:35 +0300)]
vm_map.c: fix syntax

Fixes: c718009884b3d65528deaff24712cbf98e3be656
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

10 months agosctp: cleanup cdefs.h include
Michael Tuexen [Fri, 18 Aug 2023 13:25:34 +0000 (15:25 +0200)]
sctp: cleanup cdefs.h include

10 months agosctp: whitespace change to improve consistency
Michael Tuexen [Fri, 18 Aug 2023 13:06:23 +0000 (15:06 +0200)]
sctp: whitespace change to improve consistency

MFC after: 1 week

10 months agosctp: unbreak congestion control dtrace support
Michael Tuexen [Fri, 18 Aug 2023 13:01:35 +0000 (15:01 +0200)]
sctp: unbreak congestion control dtrace support

Fix a typo and improve consistency of handling variables only used
when compiling with dtrace support.

MFC after: 1 week

10 months agolinux(4): Remove sys/cdefs.h inclusion under x86/linux due to 685dc743
Dmitry Chagin [Fri, 18 Aug 2023 12:58:32 +0000 (15:58 +0300)]
linux(4): Remove sys/cdefs.h inclusion under x86/linux due to 685dc743

10 months agolinux(4): Remove include of sys/types.h from linux_vdso.h
Dmitry Chagin [Fri, 18 Aug 2023 12:58:32 +0000 (15:58 +0300)]
linux(4): Remove include of sys/types.h from linux_vdso.h

Due to sys/param.h includes sys/types.h and the fact that the sys/param.h
is included everywhere where linux_vdso.h is needed.

10 months agolinux(4): Follow style(9), don't include both sys/param.h and sys/types.h
Dmitry Chagin [Fri, 18 Aug 2023 12:58:32 +0000 (15:58 +0300)]
linux(4): Follow style(9), don't include both sys/param.h and sys/types.h

10 months agovm_map.c: plug several more places which might modify entry->offset
Konstantin Belousov [Tue, 15 Aug 2023 19:05:33 +0000 (22:05 +0300)]
vm_map.c: plug several more places which might modify entry->offset

for the GUARD entries protecting stacks gaps.

syzkaller: https://syzkaller.appspot.com/bug?extid=c325d6a75e4fd0a68714
Reviewed by: dougm, markj (previous version)
Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41475

10 months agosff: Add SFP driver (fdt-based draft)
Dmitry Salychev [Fri, 18 Aug 2023 09:17:31 +0000 (11:17 +0200)]
sff: Add SFP driver (fdt-based draft)

This basic version of the driver obtains properties of the "sff,sfp"
compatible devices and implements a simple interface to provide an I2C
bus device for the rest of the drivers (e.g. to implement SIOCGI2C).

Both of the interface and driver are subjects for a further
generalization to be used in case of non-FDT and non-arm64 platforms.

Reviewed by: bz, manu
Approved by: bz (mentor)
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D41440

10 months agolinprocfs(5): Follow style(9), sort includes
Dmitry Chagin [Fri, 18 Aug 2023 10:12:02 +0000 (13:12 +0300)]
linprocfs(5): Follow style(9), sort includes

10 months agolinprocfs(5): Remove sys/cdefs.h inclusion where it's not needed due to 685dc743
Dmitry Chagin [Fri, 18 Aug 2023 10:12:02 +0000 (13:12 +0300)]
linprocfs(5): Remove sys/cdefs.h inclusion where it's not needed due to 685dc743

10 months agolinsysfs(5): Remove sys/cdefs.h inclusion where it's not needed due to 685dc743
Dmitry Chagin [Fri, 18 Aug 2023 10:12:02 +0000 (13:12 +0300)]
linsysfs(5): Remove sys/cdefs.h inclusion where it's not needed due to 685dc743

10 months agolinux(4): Follow style(9), include sys/systm.h after sys/param.h
Dmitry Chagin [Fri, 18 Aug 2023 10:12:02 +0000 (13:12 +0300)]
linux(4): Follow style(9), include sys/systm.h after sys/param.h

10 months agolinux(4): Remove sys/cdefs.h inclusion where it's not needed due to 685dc743
Dmitry Chagin [Fri, 18 Aug 2023 10:12:02 +0000 (13:12 +0300)]
linux(4): Remove sys/cdefs.h inclusion where it's not needed due to 685dc743

10 months agolinuxkpi math: fix kassert in math64.h
Doug Moore [Fri, 18 Aug 2023 05:31:03 +0000 (00:31 -0500)]
linuxkpi math: fix kassert in math64.h

Include <sys/systm.h> in math64.h, so that KASSERT and bool are
defined, to allow compilation to succeed after
b80ea452375f52a3ab7d82a9aef10da0d89985d9 and dabbbebcb0f5...

10 months agoUpdate `make delete-old`
Enji Cooper [Fri, 18 Aug 2023 12:15:14 +0000 (05:15 -0700)]
Update `make delete-old`

This change updates `make delete-old` to account for files installed by the
following options:
- MK_BSDINSTALL
- MK_DMAGENT
- MK_EXAMPLES
- MK_SENDMAIL

MFC after: 2 weeks

10 months agolinuxkpi: fix buildkernel after b80ea452375f
Kyle Evans [Fri, 18 Aug 2023 05:12:37 +0000 (00:12 -0500)]
linuxkpi: fix buildkernel after b80ea452375f

Unbalanced parentheses broke the build; re-balance.

Fixes: b80ea452375f ("LinuxKPI: implement mul_u64_u64_div_u64()")

10 months agoUse proper convention for relative path linking
Enji Cooper [Fri, 18 Aug 2023 11:13:06 +0000 (04:13 -0700)]
Use proper convention for relative path linking

The change made in e835ee68e13361b841c983fa4a49dd6c19dcdec4 did not
follow the convention for relative path symlinks. Per the convention,
paths be prefixed with `${BINDIR}`, not `/bin/`. `${BINDIR}` can be
modified from the Makefile, on the command line, or in the
environment. This convention is the canonically correct way to do
things.

This follows the convention used in `bin/pkill/Makefile`,
`bin/timeout/Makefile`, etc.

MFC after: 1 week
MFC with: f05948d4e98d3abd0965a2994e9e42add6908ff3
MFC with: e835ee68e13361b841c983fa4a49dd6c19dcdec4
Requested by: jrtc27, kevans

10 months agokern: osd: stop downsizing arrays when the last slot deregisters
Kyle Evans [Fri, 18 Aug 2023 04:05:55 +0000 (23:05 -0500)]
kern: osd: stop downsizing arrays when the last slot deregisters

It was noted in D41404 that these reallocations aren't actually
guaranteed to succeed, despite assertions to the contrary.  We're
talking relatively small allocations, so just free up the individual
slot to be reused later as needed.

Note that this doesn't track the last active slot as of this moment, but
this could be done later if we find it's worth the complexity for what
little that would allow to be optimized (osd_call, slightly).

While we're here, fix the debug message that indicates which slot we
just allocated when we find an unused one; the slot # is actually one
higher than the index.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D41409

10 months agofwget: fix installing multiple firmware files
Bjoern A. Zeeb [Tue, 15 Aug 2023 20:29:03 +0000 (20:29 +0000)]
fwget: fix installing multiple firmware files

Remove quotes around the list of packages to install.
Otherwise pkg is only fed one argument which results in a
non-working solution:
pkg: No packages available to install matching 'wifi-firmware-ath10k-kmod wifi-firmware-mt76-kmod wifi-firmware-ath11k-kmod' have been found in the repositories

MFC after: 10 days
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D41474

10 months agoLinuxKPI: implement mul_u64_u64_div_u64()
Bjoern A. Zeeb [Tue, 16 May 2023 20:55:00 +0000 (20:55 +0000)]
LinuxKPI: implement mul_u64_u64_div_u64()

Implement mul_u64_u64_div_u64() for an updated iwlwifi driver (though
we do not yet use it there; it is used for in-kernel ptp on wifi).

Sponsored by: The FreeBSD Foundation
Submitted by: cperciva
MFC after: 10 days
Reviewed by: cperciva, dwmalone
Differential Revision: https://reviews.freebsd.org/D40120

10 months agoRemove confDH_PARAMETERS settings in favor of using sendmail's built-in
Gregory Neil Shapiro [Fri, 18 Aug 2023 00:32:56 +0000 (00:32 +0000)]
Remove confDH_PARAMETERS settings in favor of using sendmail's built-in
default which was added in sendmail 8.15.2 (the config line predates
that 8.15.2 feature).  This also alleviates the need for admins
to create the DH parameters file if they opt to use Diffie-Hellman.

PR: 248387
MFC after: 2 weeks

10 months agorelease: update main to ALPHA2
Glen Barber [Fri, 18 Aug 2023 00:08:32 +0000 (20:08 -0400)]
release: update main to ALPHA2

Due to an issue being investigated, the branch of stable/14 will
be delayed a week.  This should not impact the rest of the schedule
for this cycle.

Sponsored by: GoFundMe https://www.gofundme.com/f/gjbbsd
Sponsored by: PayPal https://paypal.me/gjbbsd

10 months agomsi: handle error from BUS_REMAP_INTR in msi_assign_cpu
Ed Maste [Mon, 14 Aug 2023 16:56:12 +0000 (12:56 -0400)]
msi: handle error from BUS_REMAP_INTR in msi_assign_cpu

Previously errors from BUS_REMAP_INTR were silently ignored, and we
ended up with non-functional interrupts.

Now we allocate and enable new vectors, but postpone assignment of new
APIC IDs and vectors where we can, until after BUS_REMAP_INTR is
successful.  We then disable and free the old vectors.

If BUS_REMAP_INTR fails we restore the old configuration, and disable
and free the new, unused vectors.

Thanks to AMD for providing hardware (with APIC IDs above 255) for
testing.

Reviewed by: jhb
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41455

10 months agoarm64 makectx: Fix overflow of tf_x array
John Baldwin [Thu, 17 Aug 2023 22:26:16 +0000 (15:26 -0700)]
arm64 makectx: Fix overflow of tf_x array

PCB_LR isn't stored in tf_x, so trying to store it as pcb_x[PCB_LR] =
tf->tf_x[PCB_LR + PCB_X_START] overflowed the tf_x array.

Reported by: Morello (bounds check crash)
Reviewed by: jrtc27, andrew, markj
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D41485

10 months agovmm: Fix VM_GET_CPUS compatibility
Mark Johnston [Thu, 17 Aug 2023 18:49:54 +0000 (14:49 -0400)]
vmm: Fix VM_GET_CPUS compatibility

bhyve in a 13.x jail fails to boot guests with more than one vCPU
because they pass too small a buffer to VM_GET_CPUS, causing the ioctl
handler to return ERANGE.  Handle this the same way as cpuset system
calls: make sure that the result can fit in the truncated space, and
relax the check on the cpuset buffer.

As a side effect, fix an insufficient bounds check on "size".  The
signed/unsigned comparison with sizeof(cpuset_t) fails to exclude
negative values, so we can end up allocating impossibly large amounts of
memory.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41496

10 months agointr: merge interrupt table uses of MAXCOMLEN into INTRNAME_LEN
Elliott Mitchell [Fri, 20 Jan 2023 02:24:32 +0000 (18:24 -0800)]
intr: merge interrupt table uses of MAXCOMLEN into INTRNAME_LEN

The repeated uses of `MAXCOMLEN + 1` seem a bit hazardous.  If there was
a future need to change the size, the repeats will be troublesome.
Merge everything into `#define INTRNAME_LEN` (matches the name used by
INTRNG).

Reviewed by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D38455

10 months agointr: move MAX_STRAY_LOG to interrupt.h
Elliott Mitchell [Sun, 19 Jun 2022 15:05:20 +0000 (08:05 -0700)]
intr: move MAX_STRAY_LOG to interrupt.h

The two interrupt controllers which implement squelching of reports
after a maximum use the same limit.  Move the limit to interrupt.h, the
better to encourage other interrupt controllers to implement the same.

Reviewed by: markj
MFC after: 2 weks
Differential Revision: https://reviews.freebsd.org/D35527

10 months agoRELNOTES: Clarify package building on older branches for 32-bit.
John Baldwin [Thu, 17 Aug 2023 21:25:44 +0000 (14:25 -0700)]
RELNOTES: Clarify package building on older branches for 32-bit.

"on" could be read to require native builds only vs cross-builds
via qemu-user and that was not the intention.

Suggested by: Mark Millard <marklmi@yahoo.com>

10 months agolinux(4): Update my copyrights, add SPDX tag
Dmitry Chagin [Thu, 17 Aug 2023 20:54:36 +0000 (23:54 +0300)]
linux(4): Update my copyrights, add SPDX tag

10 months agolinux(4): Fix leftovers after 2ff63af9
Dmitry Chagin [Thu, 17 Aug 2023 20:54:00 +0000 (23:54 +0300)]
linux(4): Fix leftovers after 2ff63af9

10 months agolinux(4): Drop bogus __arm__ condition due to lack of 32-bit arm support
Dmitry Chagin [Thu, 17 Aug 2023 19:57:17 +0000 (22:57 +0300)]
linux(4): Drop bogus __arm__ condition due to lack of 32-bit arm support

MFC after: 1 month

10 months agolinux(4): Don't miss error from underlying in sendfile
Dmitry Chagin [Thu, 17 Aug 2023 19:57:17 +0000 (22:57 +0300)]
linux(4): Don't miss error from underlying in sendfile

MFC after: 1 month

10 months agolinux(4): Add sendfile fallback for non-socket fds
James McLaughlin [Thu, 17 Aug 2023 19:57:17 +0000 (22:57 +0300)]
linux(4): Add sendfile fallback for non-socket fds

Before Linux 2.6.33, out_fd must refer to a socket. Since Linux 2.6.33
it can be any file.
The patch was originally provided by James McLaughlin and adapted by me
for copy_file_range.

PR: 262535
Differential revision: https://reviews.freebsd.org/D34555
MFC after: 1 month

10 months agolinux(4): Use native off_t for fo_sendfile call
Dmitry Chagin [Thu, 17 Aug 2023 19:57:17 +0000 (22:57 +0300)]
linux(4): Use native off_t for fo_sendfile call

MFC after: 1 month

10 months agolinux(4): Regen for sendfile
Dmitry Chagin [Thu, 17 Aug 2023 19:57:17 +0000 (22:57 +0300)]
linux(4): Regen for sendfile

10 months agolinux(4): Use l_off_t type for offset argument in sendfile syscall
Dmitry Chagin [Thu, 17 Aug 2023 19:57:16 +0000 (22:57 +0300)]
linux(4): Use l_off_t type for offset argument in sendfile syscall

The off_t on Linux is a long, so it's non-functional change, just to
avoid confusing future readers.

MFC after: 1 month

10 months agolinux(4): Be verbose about unsupported ioctl commands on ifreq ioctl
Alvin Chen [Thu, 17 Aug 2023 19:57:16 +0000 (22:57 +0300)]
linux(4): Be verbose about unsupported ioctl commands on ifreq ioctl

Differential revision: https://reviews.freebsd.org/D39786
MFC after: 1 month

10 months agolinux(4): Add 2 Linux socket ioctl commands
Alvin Chen [Thu, 17 Aug 2023 19:57:16 +0000 (22:57 +0300)]
linux(4): Add 2 Linux socket ioctl commands

Support 2 Linux socket ioctl commands: SIOCGIFMETRIC, SIOCSIFMETRIC.

Differential revision: https://reviews.freebsd.org/D39786
MFC after: 1 month

10 months agobhyve: default UART to 115200
Ed Maste [Thu, 17 Aug 2023 17:36:02 +0000 (13:36 -0400)]
bhyve: default UART to 115200

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

10 months agoiflib drivers: Constify PCI ID LUTs
Marius Strobl [Wed, 16 Aug 2023 16:49:34 +0000 (18:49 +0200)]
iflib drivers: Constify PCI ID LUTs

Since d49e83eac3baf16a22b1c5d42e8438b68b17e6f9, iflib(9) is ready
for this change.
While at it, make isc_driver_version strings (static) const where
not apparently un-const on purpose, too.
This reduces the size of the amd64 GENERIC by about 10 KiB.

10 months agoRestore blank line after #include
John Baldwin [Thu, 17 Aug 2023 18:32:14 +0000 (11:32 -0700)]
Restore blank line after #include

10 months agoarm64 db_trace: Ensure trapframe pointer is suitably aligned.
John Baldwin [Thu, 17 Aug 2023 18:31:20 +0000 (11:31 -0700)]
arm64 db_trace: Ensure trapframe pointer is suitably aligned.

Reviewed by: jrtc27, markj
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D41486

10 months agobhyve: Store the FreeBSD OUI in little-endian in the controller data
John Baldwin [Thu, 17 Aug 2023 18:30:50 +0000 (11:30 -0700)]
bhyve: Store the FreeBSD OUI in little-endian in the controller data

Section 7.10.3 of the NVME 1.4b specification states that the IEEE OUI
in the identify controller structure is stored in little-endian format
(unlike the embedded OUI in EUI64 identifiers).

Reviewed by: corvink, chuck, imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D41487

10 months agoshare/examples: clarify BOOT_COMCONSOLE_SPEED
Ed Maste [Thu, 17 Aug 2023 17:43:39 +0000 (13:43 -0400)]
share/examples: clarify BOOT_COMCONSOLE_SPEED

Give an example of why one may want to override BOOT_COMCONSOLE_SPEED so
that it's clear why the default (in a comment) and the commented-out
example setting have different values.

Reported by: otis
Fixes: 4722ceb7d53e ("Use 115200 bps by default for serial communication")
10 months agoUse 115200 bps by default for serial communication
Ed Maste [Thu, 17 Aug 2023 17:14:52 +0000 (13:14 -0400)]
Use 115200 bps by default for serial communication

9600 was a standard baud rate decades ago, but 115200 is now more common
so choose defaults that are useful to the largest number of users.

Note that boot0sio does not support rates above 9600 so it remains
unchanged.

Reviewed by: bz, imp, manu
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36295

10 months agoCirrus-CI: for *-gcc12, build world with make -s
Ed Maste [Wed, 16 Aug 2023 23:34:24 +0000 (19:34 -0400)]
Cirrus-CI: for *-gcc12, build world with make -s

Cirrus-CI appears to have a 100MB limit for log output.  Use `make -s`
to attempt to reduce the amount of output.

Sponsored by: The FreeBSD Foundation

10 months agoforkpty: Avoid fd leak if fork() fails.
Dag-Erling Smørgrav [Thu, 17 Aug 2023 13:48:42 +0000 (13:48 +0000)]
forkpty: Avoid fd leak if fork() fails.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D41491

10 months agoRemove my middle name.
Dag-Erling Smørgrav [Thu, 17 Aug 2023 13:08:11 +0000 (15:08 +0200)]
Remove my middle name.

10 months agoixl: fix multicast filters handling
Mateusz Pacuszka [Thu, 17 Aug 2023 11:30:54 +0000 (13:30 +0200)]
ixl: fix multicast filters handling

Summary:
Hardware supports up to 128 entries of multicast filters. If there is more,
filters should be removed and multicast promiscuous enabled. In case
user deletes the multicast address and overall count is less than 128,
multicast promiscuous mode should be disabled and all the filters
reapplied into the HW.

Currently driver only enables multicast promiscuous mode and deletes
the entries without any information to the user and it's not capable of
reapplying the filters once count is less than 128.

Address that by:

1. Add logging
2. Add logic in case multicast promiscuous is enabled and user lowers
the number of multicast entries to <128.
3. Fix a bug where driver removes different MAC entries along with the one
that's being deleted by the user.

Reviewers: #intel_networking, erj

Reviewed By: #intel_networking, erj

Subscribers: imp, ae

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

10 months agoAdd a virtio-gpu 2D driver
Andrew Turner [Thu, 17 Aug 2023 11:26:57 +0000 (12:26 +0100)]
Add a virtio-gpu 2D driver

Add a driver to connect vt to the VirtIO GPU device in 2D mode. This
provides a output on the display when a qemu virtio gpu device is
added, e.g. with -device virtio-gpu-pci.

Tested on qemu using UTM, and a Hetzner arm64 VM instance.

Reviewed by: bryanv (earlier version)
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D40094

10 months agobhyve: add cmdline option for TPM emulation
Corvin Köhne [Thu, 7 Oct 2021 14:20:37 +0000 (16:20 +0200)]
bhyve: add cmdline option for TPM emulation

At the moment, only a TPM passthru is supported. The cmdline looks like:

-l tpm,passthru,/dev/tpm0

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

10 months agoshare/examples/tests: fix comments after $FreeBSD$ removal
Ed Maste [Wed, 16 Aug 2023 21:37:21 +0000 (17:37 -0400)]
share/examples/tests: fix comments after $FreeBSD$ removal

Fixes: 2a63c3be1582 ("Remove $FreeBSD$: one-line .c comment pattern")
10 months agoCirrus-CI: temporarily disable amd64-gcc12 build/test on main
Ed Maste [Wed, 16 Aug 2023 20:26:49 +0000 (16:26 -0400)]
Cirrus-CI: temporarily disable amd64-gcc12 build/test on main

The amd64-gcc12 job is failing at present.  Unfortunately Cirrus-CI
appears to have a 100MB log limit and we exceed this before the error
is reported.  Disable the job for now until we can address the log
length issue.

See also https://github.com/cirruslabs/cirrus-ci-docs/issues/1176.

Sponsored by: The FreeBSD Foundation

10 months agomakefs: clean up some leftovers after $FreeBSD$ tag removal
Ed Maste [Thu, 30 Mar 2023 14:02:02 +0000 (10:02 -0400)]
makefs: clean up some leftovers after $FreeBSD$ tag removal

Fixes: 2a63c3be1582
10 months agoFix partially removed comment by removing the rest
Warner Losh [Wed, 16 Aug 2023 20:17:33 +0000 (14:17 -0600)]
Fix partially removed comment by removing the rest

Fixes: 2a63c3be1582
10 months agolibc: regoranize malloc build
Brooks Davis [Wed, 16 Aug 2023 18:16:51 +0000 (19:16 +0100)]
libc: regoranize malloc build

Create a stdlib/malloc to hold the definition of the malloc interface
(e.g., the Symbol.map file) and make jemalloc a subdirectory.  This will
make it easier to integrate alternative allocators such as snmalloc
while making it clear that the current jemalloc symbols are the FreeBSD
API/ABI (for better or worse).

Suggested by: jrtc27
Reviewed by: jrtc27, emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D41457

10 months agojemalloc: drop unused .PATH
Brooks Davis [Wed, 16 Aug 2023 18:16:43 +0000 (19:16 +0100)]
jemalloc: drop unused .PATH

All jemalloc sources are in contrib so don't look for them in the
jemalloc subdirectory.

Reviewed by: jrtc27, emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D41481

10 months agolibc: include malloc via stdlib/Makefile.inc
Brooks Davis [Wed, 16 Aug 2023 18:16:26 +0000 (19:16 +0100)]
libc: include malloc via stdlib/Makefile.inc

There's a hierarchy here and we should use it.

Improves: cbeacb7c46f3a3650e5dbefa9a1a18bc9943a8cc

Reviewed by: jrtc27, jhb, emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D41456

10 months agofreebsd-yeet: Tool to remove $FreeBSD$ from tree
Warner Losh [Wed, 16 Aug 2023 18:06:37 +0000 (12:06 -0600)]
freebsd-yeet: Tool to remove $FreeBSD$ from tree

Use at your own risk, but this will remove $FreeBSD$ from your tree. It
does commits and tries to be at least a little smart about it.

Sponsored by: Netflix

10 months agoRemove $FreeBSD$: one-line xdr pattern
Warner Losh [Wed, 16 Aug 2023 17:55:47 +0000 (11:55 -0600)]
Remove $FreeBSD$: one-line xdr pattern

Remove /^\s*%\s*__FBSDID\("\$FreeBSD\$"\);?\s*\n/

10 months agoRemove $FreeBSD$: one-line forth tag
Warner Losh [Wed, 16 Aug 2023 17:55:43 +0000 (11:55 -0600)]
Remove $FreeBSD$: one-line forth tag

Remove /^\\[\s*]*\$FreeBSD\$.*$\n/

10 months agoRemove $FreeBSD$: one-line ps tag
Warner Losh [Wed, 16 Aug 2023 17:55:39 +0000 (11:55 -0600)]
Remove $FreeBSD$: one-line ps tag

Remove /^%\s*RCSID:\s*\$FreeBSD\$.*$\n/

10 months agoRemove $FreeBSD$: one-line lua tag
Warner Losh [Wed, 16 Aug 2023 17:55:34 +0000 (11:55 -0600)]
Remove $FreeBSD$: one-line lua tag

Remove /^--\s*\$FreeBSD\$.*$\n/

10 months agoRemove $FreeBSD$: two-line lua tag
Warner Losh [Wed, 16 Aug 2023 17:55:30 +0000 (11:55 -0600)]
Remove $FreeBSD$: two-line lua tag

Remove /^--\n--\s*\$FreeBSD\$.*$\n/