]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 months agoMFV: file 5.45.
Xin LI [Sun, 10 Sep 2023 19:20:33 +0000 (12:20 -0700)]
MFV: file 5.45.

MFC after: 3 days

8 months agomkfile: getopt() returns an int, not a char.
Dag-Erling Smørgrav [Sun, 10 Sep 2023 18:33:18 +0000 (18:33 +0000)]
mkfile: getopt() returns an int, not a char.

MFC after: 3 days
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D41804

8 months agocxgbe(4): Fix tracing with netlink enabled kernels.
Navdeep Parhar [Sat, 9 Sep 2023 19:39:15 +0000 (12:39 -0700)]
cxgbe(4): Fix tracing with netlink enabled kernels.

1. The tracing ifnet's name must match the nexus name.  One way to do
   this is to not use a unit number.

2. Do not hold the tracer lock around ether_ifattach or ether_ifdetach.
   netlink calls back into the driver (see stack below) and that leads
   to illegal lock recursion.

   tracer_ioctl
   if_ioctl
   get_operstate_ether
   get_operstate
   dump_iface
   rtnl_handle_ifevent
   rtnl_handle_ifattach
   if_attach_internal
   if_attach
   ether_ifattach
   t4_cloner_create

MFC after: 3 days
Sponsored by: Chelsio Communications

8 months agopfsync: fix state leak
Kristof Provost [Fri, 8 Sep 2023 09:21:12 +0000 (11:21 +0200)]
pfsync: fix state leak

If we receive a state with a route-to interface name set and we can't
find the interface we do not insert the state. However, in that case we
must still clean up the state (and state keys).
Do so, so we do not leak states.

Reviewed by: Kajetan Staszkiewicz <vegeta@tuxpowered.net>
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D41779

8 months agolib/libc/amd64/string/memchr.S: fix behaviour with overly long buffers
Robert Clausecker [Sun, 10 Sep 2023 04:11:07 +0000 (00:11 -0400)]
lib/libc/amd64/string/memchr.S: fix behaviour with overly long buffers

When memchr(buf, c, len) is called with a phony len (say, SIZE_MAX),
buf + len overflows and we have buf + len < buf.  This confuses the
implementation and makes it return incorrect results.  Neverthless we
must support this case as memchr() is guaranteed to work even with
phony buffer lengths, as long as a match is found before the buffer
actually ends.

Sponsored by: The FreeBSD Foundation
Reported by: yuri, des
Tested by: des
Approved by: mjg (blanket, via IRC)
MFC after: 1 week
MFC to: stable/14
PR: 273652

8 months agoCorrect the grammo in "will underlined".
Jens Schweikhardt [Sun, 10 Sep 2023 09:00:21 +0000 (11:00 +0200)]
Correct the grammo in "will underlined".

8 months agoVendor import of file 5.45.
Xin LI [Sun, 10 Sep 2023 04:50:07 +0000 (21:50 -0700)]
Vendor import of file 5.45.

8 months agonetpfil/pf/pf.c: fix build without dtrace
Konstantin Belousov [Sat, 9 Sep 2023 21:54:42 +0000 (00:54 +0300)]
netpfil/pf/pf.c: fix build without dtrace

Sponsored by: The FreeBSD Foundation

8 months agoshmfd: hide direct rangelock(9) use under a wrapper
Konstantin Belousov [Fri, 18 Aug 2023 12:38:28 +0000 (15:38 +0300)]
shmfd: hide direct rangelock(9) use under a wrapper

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 months agoufs: restore name cache fast path lookup
Mateusz Guzik [Sat, 9 Sep 2023 21:48:57 +0000 (21:48 +0000)]
ufs: restore name cache fast path lookup

Found by: dchagin
Fixes: f3c81b973897 ("ufs: add missing vop_fplookup ops")

8 months agodrm2: fix build after abs64 became global
Mateusz Guzik [Sat, 9 Sep 2023 20:50:55 +0000 (20:50 +0000)]
drm2: fix build after abs64 became global

Fixes: 229c65a83fb ("kern: Globally define abs64")
Sponsored by: Rubicon Communications, LLC ("Netgate")

8 months agogic_acpi: Limit the number of CPUs to GIC_MAXCPU
John Baldwin [Sat, 9 Sep 2023 19:13:57 +0000 (12:13 -0700)]
gic_acpi: Limit the number of CPUs to GIC_MAXCPU

madt_table_data contains an array of pointers for each CPU and was
allocated on the stack.  If MAXCPU is raised to a sufficiently large
value this can overflow the kernel stack.  Cap the stack growth by
using GIC_MAXCPU instead as for other parts of the gicv1/v2 driver in
commit a0e20c0ded1a.

Suggested by: andrew
Reviewed by: andrew, emaste
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D41800

8 months agoftpd: add deprecation notice
Ed Maste [Sat, 9 Sep 2023 17:34:14 +0000 (13:34 -0400)]
ftpd: add deprecation notice

Approved by: gordon
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26447

8 months agoudl.4: note that "device videomode" is also required
Archimedes Gaviola [Sat, 9 Sep 2023 17:39:17 +0000 (13:39 -0400)]
udl.4: note that "device videomode" is also required

Reviewed by: emaste

8 months agocam: Remove extra break
Warner Losh [Sat, 9 Sep 2023 17:12:42 +0000 (11:12 -0600)]
cam: Remove extra break

Sponsored by: Netflix

8 months agoatkbdc: Add additional heurstic for Chromebook keyboards
Warner Losh [Sat, 9 Sep 2023 02:18:33 +0000 (20:18 -0600)]
atkbdc: Add additional heurstic for Chromebook keyboards

It turns out that that heurstic used to determine if we have a Google
coreboot, and thus have the i8042 emulation bugs, is incorrect. At least
one Acer "Peppy" Chromebook has an issue because Acer space'd out the
smbios.bios.version string we're using as part of the heuristic. So, if
the version starts with a space, then enable the workarounds if the
smbios.bios.reldate is 2018 or earlier. While not perfect, it should be
a reasonable dividing line and still allow newer core boot-based
machines that aren't Chromebooks to not have the workaround.

Tested by: Matthias Apitz
Sponsored by: Netflix
MFC After: 3 days (14.0 candiate)

8 months agoprocdesc: Remove stray references to pdwait4
Warner Losh [Mon, 28 Aug 2023 17:58:58 +0000 (11:58 -0600)]
procdesc: Remove stray references to pdwait4

We've never had pdwait4, and have no plans of adding pdwait4. Remove the
stray references here.

Sponsored by: Netflix

8 months agoUPDATING: Document the change that enable vnet sysctl variables to be loader tunable
Zhenlei Huang [Sat, 9 Sep 2023 08:11:24 +0000 (16:11 +0800)]
UPDATING: Document the change that enable vnet sysctl variables to be loader tunable

8 months agocarp: Explicitly mark tunnable net.inet.carp.allow with CTLFLAG_NOFETCH
Zhenlei Huang [Sat, 9 Sep 2023 08:10:32 +0000 (16:10 +0800)]
carp: Explicitly mark tunnable net.inet.carp.allow with CTLFLAG_NOFETCH

With recent change 110113bc086f, a vnet tunable can be initialized when
there is a corresponding kernel environment variable unless it is marked
with the flag CTLFLAG_NOFETCH.

The initialization may happen during early boot(linker preload), at that
time vnet0 has not been created. The hander carp_allow_sysctl() for the
tunable net.inet.carp.allow requires vnet, thus invoking it during early
boot will cause kernel panic.

The tunnable is initialized by vnet sysinit routine ipcarp_sysinit() so
let's just mark it with flag CTLFLAG_NOFETCH.

No functional change intended.

Fixes: 110113bc086f sysctl(9): Enable vnet sysctl variables to be loader tunable
MFC after: 2 week
Differential Revision: https://reviews.freebsd.org/D41525

8 months agokernel linker: Eliminate unneeded vnet propagation
Zhenlei Huang [Sat, 9 Sep 2023 08:06:23 +0000 (16:06 +0800)]
kernel linker: Eliminate unneeded vnet propagation

The module preload happens before vnet0 creation, at this moment the vnet
list is empty thus invoking vnet_data_copy() during preload is a noop.

With recent change 110113bc086f, for dynamic module load, aka via kldload,
linker will do vnet propagation right after registering sysctls which
happens after module load, then previous propagation (during module load)
is redundant.

No functional change intended.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D39852

8 months agosysctl(9): Enable vnet sysctl variables to be loader tunable
Zhenlei Huang [Sat, 9 Sep 2023 08:06:23 +0000 (16:06 +0800)]
sysctl(9): Enable vnet sysctl variables to be loader tunable

Complete phase two of 3da1cf1e88f8.

In 3da1cf1e88f8, the meaning of the flag CTLFLAG_TUN is extended to
automatically check if there is a kernel environment variable which
shall initialize the SYSCTL during early boot. It works for all SYSCTL
types both statically and dynamically created ones, except for the
SYSCTLs which belong to VNETs.

This change extends the meaning further, to allow it also works for
the SYSCTLs which belong to VNETs. A typical usage is
```
VNET_DEFINE_STATIC(int, foo) = 0;
SYSCTL_INT(_net, OID_AUTO, foo, CTLFLAG_RWTUN | CTLFLAG_VNET,
    &VNET_NAME(foo), 0, "Description of the foo loader tunable");
```

Note that the implementation has a limitation. It behaves the same way
as that of non-vnet loader tunables. That is, after the kernel or modules
being initialized, any changes (e.g. via kenv) to kernel environment
variable will not affect the corresponding vnet variable of subsequently
created VNETs. To overcome it, we can use TUNABLE_XXX_FETCH to fetch
the kernel environment variable into those vnet variables during vnet
constructing.

This change will fix the following SYSCTLs those belong to VNETs and
have CTLFLAG_TUN flag:
```
net.add_addr_allfibs
net.bpf.optimize_writers
net.inet.tcp.fastopen.ccache_buckets
net.link.bridge.inherit_mac
net.link.bridge.ipfw_arp
net.link.bridge.log_stp
net.link.bridge.pfil_bridge
net.link.bridge.pfil_local_phys
net.link.bridge.pfil_member
net.link.bridge.pfil_onlyip
net.link.lagg.default_use_flowid
net.link.lagg.default_use_numa
net.link.lagg.default_flowid_shift
net.link.lagg.lacp.debug
net.link.lagg.lacp.default_strict_mode
```

Although the following vnet SYSCTLs have CTLFLAG_TUN flag, theirs
values are re-fetched via TUNABLE_XXX_FETCH, thus are not affected
by this change.
```
net.inet.ip.reass_hashsize
net.inet.tcp.hostcache.cachelimit
net.inet.tcp.hostcache.hashsize
net.inet.tcp.hostcache.bucketlimit
net.inet.tcp.syncache.bucketlimit
net.inet.tcp.syncache.cachelimit
net.inet.tcp.syncache.hashsize
net.key.spdcache.maxentries
net.key.spdcache.threshold
```

In memoriam: hselasky
Discussed with: hselasky, glebius
Fixes: 3da1cf1e88f8 Extend the meaning of the CTLFLAG_TUN flag ...
MFC after: 2 weeks
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D39638

8 months agomakeman: Use ${make} instead of plain make to compute ${requireds}
John Baldwin [Fri, 8 Sep 2023 23:36:52 +0000 (16:36 -0700)]
makeman: Use ${make} instead of plain make to compute ${requireds}

This is currently a no-op but can matter for downstreams whose ${make}
includes additional settings.

Reviewed by: imp, emaste
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D41777

8 months agoMove kern_extattr_* prototypes to <sys/syscallsubr.h>
John Baldwin [Fri, 8 Sep 2023 23:36:28 +0000 (16:36 -0700)]
Move kern_extattr_* prototypes to <sys/syscallsubr.h>

All of the kern_* prototypes belong in this header.  While here, sort
the prototypes by function name.

Reviewed by: dchagin
Fixes: 6453d4240f6b vfs: Export exattr methods to reuse by Linuxulator
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D41766

8 months agoriscv: Print stval in dump_regs for fatal exceptions
John Baldwin [Fri, 8 Sep 2023 23:35:59 +0000 (16:35 -0700)]
riscv: Print stval in dump_regs for fatal exceptions

Reviewed by: mhorne, markj
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D41700

8 months agocxgbe t4_tls: Call t4_rcvd_locked from do_rx_tls_cmp
John Baldwin [Fri, 8 Sep 2023 23:31:38 +0000 (16:31 -0700)]
cxgbe t4_tls: Call t4_rcvd_locked from do_rx_tls_cmp

Similar to dcfddc8dc091e7688abc8488a0307eba425fa7a2, replace the
simpler, inlined version with the full version.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D41690

8 months agocxgbe t4_tls: Don't bother returning RX credits for a protocol receive error
John Baldwin [Fri, 8 Sep 2023 23:30:52 +0000 (16:30 -0700)]
cxgbe t4_tls: Don't bother returning RX credits for a protocol receive error

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D41689

8 months agocxgbe tom: Call t4_rcvd_locked from do_rx_data to return RX credits
John Baldwin [Fri, 8 Sep 2023 23:30:35 +0000 (16:30 -0700)]
cxgbe tom: Call t4_rcvd_locked from do_rx_data to return RX credits

In particular, the kernel RPC layer used by the NFS client never
invokes pru_rcvd since it always reads data from the socket upcall
via MSG_SOCALLBCK which avoids calling pru_rcvd.  As a result, on an
NFS client connection managed by t4_tom, RX credits were never
returned to the TOE connection to open the TCP window resulting in
connection hangs.

To fix, expand the set of conditions in do_rx_data where RX credits
are returned to match those in t4_rcvd_locked by calling the function
directly.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D41688

8 months agoshare/man/man7/simd.7: documend simd-enhanced memchr(3), strnlen(3)
Robert Clausecker [Fri, 25 Aug 2023 20:41:07 +0000 (20:41 +0000)]
share/man/man7/simd.7: documend simd-enhanced memchr(3), strnlen(3)

Sponsored by: The FreeBSD Foundation
Approved by: mjg
MFC after: 1 week
MFC to: stable/14
Differential Revision: https://reviews.freebsd.org/D41598

8 months agolib/libc/amd64/string: implement strnlen(3) trough memchr(3)
Robert Clausecker [Fri, 8 Sep 2023 21:11:55 +0000 (17:11 -0400)]
lib/libc/amd64/string: implement strnlen(3) trough memchr(3)

Now that we have an optimised memchr(3), we can use it to implement
strnlen(3) with better perofrmance.

Sponsored by: The FreeBSD Foundation
Approved by: mjg
MFC after: 1 week
MFC to: stable/14
Differential Revision: https://reviews.freebsd.org/D41598

8 months agolib/libc/amd64/string: add memchr(3) scalar, baseline implementation
Robert Clausecker [Thu, 24 Aug 2023 16:43:40 +0000 (16:43 +0000)]
lib/libc/amd64/string: add memchr(3) scalar, baseline implementation

This is conceptually similar to strchr(3), but there are
slight changes to account for the buffer having an explicit
buffer length.

Sponsored by: The FreeBSD Foundation
Approved by: mjg
MFC after: 1 week
MFC to: stable/14
Differential Revision: https://reviews.freebsd.org/D41598

8 months agoshare/man/man7/simd.7: document simd-enhanced strspn(3)
Robert Clausecker [Wed, 23 Aug 2023 15:52:42 +0000 (15:52 +0000)]
share/man/man7/simd.7: document simd-enhanced strspn(3)

Sponsored by: The FreeBSD Foundation
Approved by: mjg
MFC after: 1 week
MFC to: stable/14
Differential Revision: https://reviews.freebsd.org/D41567

8 months agolib/libc/amd64/string: add strspn(3) scalar, x86-64-v2 implementation
Robert Clausecker [Mon, 21 Aug 2023 16:06:42 +0000 (16:06 +0000)]
lib/libc/amd64/string: add strspn(3) scalar, x86-64-v2 implementation

This is conceptually very similar to the strcspn(3) implementations
from D41557, but we can't do the fast paths the same way.

Sponsored by: The FreeBSD Foundation
Approved by: mjg
MFC after: 1 week
MFC to: stable/14
Differential Revision: https://reviews.freebsd.org/D41567

8 months agolib/libc/tests/string: derive strspn(3) tests from strcspn(3) tests
Robert Clausecker [Mon, 21 Aug 2023 15:30:23 +0000 (15:30 +0000)]
lib/libc/tests/string: derive strspn(3) tests from strcspn(3) tests

To cover the new optimised amd64 strspn(3) SIMD implementation, extend
the previously written strcspn(3) unit test to also cover strspn(3).

Sponsored by: The FreeBSD Foundation
Approved by: mjg
MFC after: 1 week
MFC to: stable/14
Differential Revision: https://reviews.freebsd.org/D41567

8 months agolib/libc/tests/string: add unit tests for strcspn(3)
Robert Clausecker [Sun, 20 Aug 2023 22:48:41 +0000 (22:48 +0000)]
lib/libc/tests/string: add unit tests for strcspn(3)

We currently use the NetBSD test suite to cover strcspn(3).  It only
contains a very rudimentary test of this function.  This all new set
of unit tests for the FreeBSD test suite should cover many more edge
cases relating to alignment issues.

Sponsored by: The FreeBSD Foundation
Approved by: mjg
MFC after: 1 week
MFC to: stable/14
Differential Revision: https://reviews.freebsd.org/D41557

8 months agoshare/man/man7/simd.7: document simd-enhanced strcspn(3)
Robert Clausecker [Sun, 20 Aug 2023 21:31:32 +0000 (21:31 +0000)]
share/man/man7/simd.7: document simd-enhanced strcspn(3)

Sponsored by: The FreeBSD Foundation
Approved by: mjg
MFC after: 1 week
MFC to: stable/14
Differential Revision: https://reviews.freebsd.org/D41557

8 months agolib/libc/amd64/string: add strcspn(3) scalar, x86-64-v2 implementation
Robert Clausecker [Sun, 13 Aug 2023 17:35:01 +0000 (17:35 +0000)]
lib/libc/amd64/string: add strcspn(3) scalar, x86-64-v2 implementation

This changeset adds both a scalar and an x86-64-v2 implementation
of the strcspn(3) function to libc. A baseline implementation does not
appear to be feasible given the requirements of the function.

The scalar implementation is similar to the generic libc implementation,
but expands the bit set into a byte set to reduce latency, improving
performance. This approach could probably be backported to the generic
C version to benefit other platforms.

The x86-64-v2 implementation is built around the infamous pcmpistri
instruction. An alternative implementation based on the Muła/Langdale
algorithm [1] was prototyped, but performed worse than the pcmpistri
approach except for sets of more than 16 characters with long input
strings.

All implementations provide special cases for the empty set (reduces to
strlen as well as single-character sets (reduces to strchr). The
x86-64-v2 kernel falls back to the scalar implementation for sets of
more than 32 characters. This limit could be raised by additional
multiples of 16 through the use of additional pcmpistri code paths, but
I consider this case to be too rare to be of importance.

[1]: http://0x80.pl/articles/simd-byte-lookup.html

Sponsored by: The FreeBSD Foundation
Approved by: mjg
MFC after: 1 week
MFC to: stable/14
Differential Revision: https://reviews.freebsd.org/D41557

8 months agopowerpcspe: Fix build
Li-Wen Hsu [Fri, 8 Sep 2023 20:46:25 +0000 (04:46 +0800)]
powerpcspe: Fix build

Copy _fpmath.h from powerpc, which is the same as the one in powerpc64.

Sponsored by: The FreeBSD Foundation

8 months agosctp: don't call sctp_ulp_notify() recursively
Michael Tuexen [Fri, 8 Sep 2023 19:19:59 +0000 (21:19 +0200)]
sctp: don't call sctp_ulp_notify() recursively

This does not work with the new locking scheme.

MFC after: 3 days

8 months agogrep: Suppress EISDIR when reading.
Dag-Erling Smørgrav [Fri, 8 Sep 2023 18:17:41 +0000 (18:17 +0000)]
grep: Suppress EISDIR when reading.

MFC after: 1 week
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kevans

8 months agocommitters-ports.dot: Fix entry for jbo
Felix Palmen [Fri, 8 Sep 2023 14:39:47 +0000 (16:39 +0200)]
committers-ports.dot: Fix entry for jbo

Joel Bodenmann's entry accidentally went to the alumni section, and I
didn't notice from the context Phab provides. Fix this.

Fixes: b4b89476fa95 Add myself as ports committer [...]
Pointy hat to: zirias

8 months agosctp: cleanup locking for notifications
Michael Tuexen [Fri, 8 Sep 2023 14:20:51 +0000 (16:20 +0200)]
sctp: cleanup locking for notifications

All notifications are now queued via sctp_ulp_notify(). Do
the locking of the inp read lock there and validate this in all
functions being used.
This is one step in avoiding race conditions when closing the
read end of an SCTP socket.

MFC after: 3 days

8 months agomountd: do not warn about using class mask with -mask
Mike Karels [Fri, 8 Sep 2023 14:06:42 +0000 (09:06 -0500)]
mountd: do not warn about using class mask with -mask

The previous code would warn that the mask was being defaulted to
an obsolete class mask even if -mask was present after -network.
Import a fix from Peter Much with a little tweaking, deferring the
warning until after all parameters are processed.

PR: 263011
Obtained from: pmc at citilink.dinoex.sub.org
MFC after: 3 days
Reviewed by: rmacklem
Differential Revision: https://reviews.freebsd.org/D41774

8 months agoarm64: Add TCR register masks
Andrew Turner [Fri, 8 Sep 2023 13:29:19 +0000 (14:29 +0100)]
arm64: Add TCR register masks

These will be used by bhyve to implement page table walking.

Sponsored by: Arm Ltd

8 months agoarm64: Fix the TCR_TBI0 macro to use UL
Andrew Turner [Fri, 8 Sep 2023 13:27:15 +0000 (14:27 +0100)]
arm64: Fix the TCR_TBI0 macro to use UL

This needs to be 1UL to ensure the type is large enough for the shift.

Sponsored by: Arm Ltd

8 months agoAdd myself as ports committer, update mentor/mentee
Joel Bodenmann [Fri, 8 Sep 2023 12:58:42 +0000 (14:58 +0200)]
Add myself as ports committer, update mentor/mentee

This completes step 5 from Committer's Guide.

Approved by: zirias (mentor)
Differential Review: https://reviews.freebsd.org/D41782

8 months agosctp: make sure all SCTP RESET notifications use sctp_ulp_notify()
Michael Tuexen [Fri, 8 Sep 2023 12:19:56 +0000 (14:19 +0200)]
sctp: make sure all SCTP RESET notifications use sctp_ulp_notify()

While there, improve consistency of the notification related code.
No functional change intended.

MFC after: 3 days

8 months agosctp: cleanup SCTP AUTH related notification
Michael Tuexen [Fri, 8 Sep 2023 11:13:43 +0000 (13:13 +0200)]
sctp: cleanup SCTP AUTH related notification

This makes consistent use of the parameters and ensures that
all SCTP AUTH related notifications are using sctp_ulp_notify().

No functional change intended.

MFC after: 3 days

8 months agoAssert that ifnet_detach_sxlock is held where needed.
Dag-Erling Smørgrav [Fri, 8 Sep 2023 10:06:01 +0000 (10:06 +0000)]
Assert that ifnet_detach_sxlock is held where needed.

Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D41770

8 months agocpufreq_dt: Find the closest frequency
Emmanuel Vadot [Wed, 6 Sep 2023 16:40:17 +0000 (18:40 +0200)]
cpufreq_dt: Find the closest frequency

When building the frequencies table we convert the value in the DTS to
megahertz and loose precision. While it's not a problem for most of the
DTS it is when the expected frequency value is strict down to the hertz.
So it's either we don't truncate the value and have some ugly and long
values in the sysctls or we just find the closest frequency.
Do the latter.

Reviewed by: mmel
Differential Revision: https://reviews.freebsd.org/D41762
Sponsored by: Beckhoff Automation GmbH & Co. KG

8 months agokern: Globally define abs64
Emmanuel Vadot [Thu, 7 Sep 2023 07:48:51 +0000 (09:48 +0200)]
kern: Globally define abs64

So we can use it in non-linuxkpi sources.

Reviewed by: emaste, mmel
Differential Revision: https://reviews.freebsd.org/D41767
Sponsored by: Beckhoff Automation GmbH & Co. KG

8 months agoarm64: start defining a std.apple configuration
Kyle Evans [Fri, 8 Sep 2023 05:53:51 +0000 (00:53 -0500)]
arm64: start defining a std.apple configuration

The M1 uses FDT, and has bge to start with.  Add a SOC_* option for
the first SoC we'll be supporting.

IOMMU is added commented out because it does have it, but IOMMU is not
well-tested on aarch64.  An initial version of the DART driver will be
upstreamed that just puts the DARTs that support bypass mode into bypass
mode -- we'll be missing some functionality, but we at least still end
up with some USB ports.

Reviewed by: karels, manu
Input from: jrtc27 (IOMMU)
Differential Revision: https://reviews.freebsd.org/D39823

8 months agossh-keygen: Generate Ed25519 keys when invoked without arguments
Ed Maste [Thu, 7 Sep 2023 16:32:39 +0000 (12:32 -0400)]
ssh-keygen: Generate Ed25519 keys when invoked without arguments

Ed25519 keys are convenient because they're much smaller, and the next
OpenSSH release (9.5) will switch to them by default.  Apply the change
to FreeBSD main now, to help identify issues as early as possible.

Reviewed by: kevans, karels, des
Relnotes: Yes
Obtained from: OpenBSD 9de458a24986
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41773

8 months agopf tests: extend SCTP tests to test state removal through ASCONF
Kristof Provost [Tue, 5 Sep 2023 17:00:49 +0000 (19:00 +0200)]
pf tests: extend SCTP tests to test state removal through ASCONF

pf can now mark shut down multihomed connections shutting down. Verify
that pf does the right thing.

MFC after: 3 weeks
Sponsored by: Orange Business Services

8 months agopf: mark removed connections within a multihome association as shutting down
Kristof Provost [Tue, 5 Sep 2023 16:30:42 +0000 (18:30 +0200)]
pf: mark removed connections within a multihome association as shutting down

Parse IP removal in ASCONF chunks, find the affected state(s) and mark
them as shutting down. This will cause them to time out according to
PFTM_TCP_CLOSING timeouts, rather than waiting for the established
session timeout.

MFC after: 3 weeks
Sponsored by: Orange Business Services

8 months agopf: inherit v_tag values to multihomed connections
Kristof Provost [Mon, 4 Sep 2023 16:00:08 +0000 (18:00 +0200)]
pf: inherit v_tag values to multihomed connections

When we create a new state for an existing SCTP association inherit the
v_tag values from the original connection.

MFC after: 3 weeks
Sponsored by: Orange Business Services

8 months agopf: improve SCTP state validation
Kristof Provost [Fri, 1 Sep 2023 11:33:56 +0000 (13:33 +0200)]
pf: improve SCTP state validation

Only create new states for INIT chunks, or when we're creating a
secondary state for a multihomed association.

Store and verify verification tag.

MFC after: 3 weeks
Sponsored by: Orange Business Services

8 months agopf tests: basic SCTP multihoming test
Kristof Provost [Wed, 2 Aug 2023 08:44:52 +0000 (10:44 +0200)]
pf tests: basic SCTP multihoming test

The SCTP server will announce multiple addresses. Block one of them with
pf, connect to the other have the client use the blocked address. pf
is expected to have created state for all of the addresses announced by
the server.

In a separate test case add the secondary (client) IP after the
connection has been established. The intent is to verify the
functionality of the ASCONF chunk parsing.

MFC after: 3 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D41638

8 months agopf: support SCTP multihoming
Kristof Provost [Wed, 2 Aug 2023 17:05:00 +0000 (19:05 +0200)]
pf: support SCTP multihoming

SCTP may announce additional IP addresses it'll use in the INIT/INIT_ACK
chunks, or in ASCONF chunks at any time during the connection. Parse these
parameters, evaluate the ruleset for the new connection and if allowed
create the corresponding states.

MFC after: 3 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D41637

8 months agosrc.conf.5: regen after SSP option description update
Ed Maste [Thu, 7 Sep 2023 15:57:46 +0000 (11:57 -0400)]
src.conf.5: regen after SSP option description update

8 months agoUpdate WITH_/WITHOUT_SSP descriptions
Ed Maste [Wed, 30 Aug 2023 20:49:44 +0000 (16:49 -0400)]
Update WITH_/WITHOUT_SSP descriptions

ProPolice refers to a specific implementation by Hiroaki Etoh and
Kunikazu Yoda.  The implementation in contemporary Clang and GCC is
somewhat different and newer, so use a generic term in the src.conf
descriptions.

Sponsored by: The FreeBSD Foundation

8 months agolibarchive: merge security fix from vendor branch
Martin Matuska [Thu, 7 Sep 2023 15:18:12 +0000 (17:18 +0200)]
libarchive: merge security fix from vendor branch

This commit fixes a couple of security vulnerabilities in the PAX writer:
1. Heap overflow in url_encode() in archive_write_set_format_pax.c
2. NULL dereference in archive_write_pax_header_xattrs()
3. Another NULL dereference in archive_write_pax_header_xattrs()
4. NULL dereference in archive_write_pax_header_xattr()

Security: No known reference yet
Obtained from: https://github.com/libarchive/libarchive/commit/1b4e0d0f9
MFC after: 3 days

8 months agosyscons: refer to it as the legacy console
Ed Maste [Thu, 7 Sep 2023 15:10:33 +0000 (11:10 -0400)]
syscons: refer to it as the legacy console

vt(4) is the default console, and although there is no firm deprecation
plan for syscons(4) yet it it is not actively maintained and is not
compatible with contemporary systems (i.e., those booting via UEFI).

Reviewed by: manu
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

8 months agoswitch groff parameter -man to -mandoc for new groff release 1.23.0
Wolfram Schneider [Thu, 7 Sep 2023 14:59:12 +0000 (14:59 +0000)]
switch groff parameter -man to -mandoc for new groff release 1.23.0
PR: 273565

9 months agobspatch: use C23 overflow checking math now that it is available
Ed Maste [Tue, 5 Sep 2023 16:35:31 +0000 (12:35 -0400)]
bspatch: use C23 overflow checking math now that it is available

Reviewed by: des
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41771

9 months agoUpdate vendor/libarchive to libarchive/libarchive@1b4e0d0f9
Martin Matuska [Thu, 7 Sep 2023 14:21:24 +0000 (16:21 +0200)]
Update vendor/libarchive to libarchive/libarchive@1b4e0d0f9

Changes to not yet connected unzip command only.

Obtained from: libarchive
Libarchive commit: 1b4e0d0f9d445ba3e4d0c7db7ce0b30300572fe8

9 months agogve: Make LRO work for jumbo packets
Shailend Chand [Thu, 7 Sep 2023 13:28:26 +0000 (09:28 -0400)]
gve: Make LRO work for jumbo packets

Each Rx descriptor points to a packet buffer of size 2K, which means
that MTUs greater than 2K see multi-descriptor packets. The TCP-hood of
such packets was being incorrectly determined by looking for a flag on
the last descriptor instead of the first descriptor.

Also fixed and progressed the version number.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41754

9 months agoless: We have <stdckdint.h> now.
Dag-Erling Smørgrav [Thu, 7 Sep 2023 06:15:03 +0000 (06:15 +0000)]
less: We have <stdckdint.h> now.

Reviewed by: delphij
Differential Revision: https://reviews.freebsd.org/D41736

9 months agoinclude: Add tests for N2867.
Dag-Erling Smørgrav [Thu, 7 Sep 2023 06:14:59 +0000 (06:14 +0000)]
include: Add tests for N2867.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D41735

9 months agoinclude: Implement N2867.
Dag-Erling Smørgrav [Thu, 7 Sep 2023 06:14:54 +0000 (06:14 +0000)]
include: Implement N2867.

This adds macros for checked addition, subtraction, and multiplication with semantics similar to the builtins gcc and clang have had for years.

Reviewed by: kib, emaste
Differential Revision: https://reviews.freebsd.org/D41734

9 months agolibc: Add test cases for N2680.
Dag-Erling Smørgrav [Thu, 7 Sep 2023 06:14:49 +0000 (06:14 +0000)]
libc: Add test cases for N2680.

This adds test cases for %wN and %wfN to the printf(3) and scanf(3) tests.

While here, fix a few nits in the N2630 test cases.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D41743

9 months agolibc: Implement N2680.
Dag-Erling Smørgrav [Thu, 7 Sep 2023 06:14:44 +0000 (06:14 +0000)]
libc: Implement N2680.

This adds specific width length modifiers in the form of wN and wfN (where N is 8, 16, 32, or 64) which allow printing intN_t and int_fastN_t without resorting to casts or PRI macros.

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

9 months agolibc: Suppress format checks on printf() / scanf() tests.
Dag-Erling Smørgrav [Thu, 7 Sep 2023 06:14:39 +0000 (06:14 +0000)]
libc: Suppress format checks on printf() / scanf() tests.

Reviewed by: jrtc27, markj, emaste
Differential Revision: https://reviews.freebsd.org/D41727

9 months agolibc: Add a wide version of snprintf_test.
Dag-Erling Smørgrav [Thu, 7 Sep 2023 06:14:30 +0000 (06:14 +0000)]
libc: Add a wide version of snprintf_test.

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

9 months agoUpdate HISTORY section.
David E. O'Brien [Thu, 7 Sep 2023 06:36:27 +0000 (23:36 -0700)]
Update HISTORY section.

9 months agoswitch groff parameter -man to -mandoc
Wolfram Schneider [Thu, 7 Sep 2023 06:28:24 +0000 (06:28 +0000)]
switch groff parameter -man to -mandoc

groff 1.23.0 changed the semantics of the -man parameter, and many
manual pages are not rendered. The -mandoc parameter brings back
the old behavior, as in groff 1.22.4 and earlier.

PR: 273565, 273245

Reviewed by: emaste, bapt
MFC after: 1 week for all supported branches (stable/12, 13, 14)
Differential Revision: https://reviews.freebsd.org/D41737

9 months ago__crt_aligned_alloc_offset(): fix ov_index for backing allocation address
Konstantin Belousov [Wed, 6 Sep 2023 13:50:27 +0000 (16:50 +0300)]
__crt_aligned_alloc_offset(): fix ov_index for backing allocation address

Wrong value of ov_index resulted in magic check failure, and refuse to
free() the memory allocated with __crt_aligned_alloc_offset().
Then the TLS segments of exited threads leaked.

Reported and tested by: glebius
Fixes: c29ee08204ce4106d4992474005c5f2fb7d5fbf1
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

9 months agorelease: remove inet blackhole sysctls from GCE config
Ed Maste [Wed, 6 Sep 2023 00:03:25 +0000 (20:03 -0400)]
release: remove inet blackhole sysctls from GCE config

Other cloud images do not do this, and it can produce confusing results.

Reviewed by: Jose Luis Duran, delphij
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41751

9 months agoinit_main: Record completed SYSINITs
Colin Percival [Tue, 5 Sep 2023 23:47:57 +0000 (16:47 -0700)]
init_main: Record completed SYSINITs

When removing them from sysinit_list, append them to sysinit_done_list;
print this list from 'show sysinit' along with the list of future
sysinits.

Reviewed by: jhb, gallatin (previous version)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41749

9 months agoinit_main: Switch from SLIST to STAILQ, fix order
Colin Percival [Tue, 5 Sep 2023 23:46:38 +0000 (16:46 -0700)]
init_main: Switch from SLIST to STAILQ, fix order

Constructing an SLIST of SYSINITs by inserting them one by one at the
head of the list resulted in them being sorted in anti-stable order:
When two SYSINITs tied for (subsystem, order), they were executed in
the reverse order to the order in which they appeared in the linker
set.

Note that while this changes struct sysinit, it doesn't affect ABI
since SLIST_ENTRY and STAILQ_ENTRY are compatible (in both cases a
single pointer to the next element).

Fixes: 9a7add6d01f3 "init_main: Switch from sysinit array to SLIST"
Reported by: gallatin
Reviewed by: jhb, gallatin, emaste
Tested by: gallatin
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41748

9 months agoarm64: Fix the TCR_EPD0 definition
Andrew Turner [Wed, 6 Sep 2023 17:32:15 +0000 (18:32 +0100)]
arm64: Fix the TCR_EPD0 definition

Sponsored by: Arm Ltd

9 months agoarm64: Enable FEAT_E0PD when supported
Andrew Turner [Wed, 6 Sep 2023 11:07:41 +0000 (12:07 +0100)]
arm64: Enable FEAT_E0PD when supported

FEAT_E0PD adds two fields to the tcr_el1 special register that, when
set, cause userspace access to either the top or bottom half of the
 address spaces without a page walk.

This can be used to stop userspace probing the kernel address space
as the CPU will raise an exception in the same time if the probed
address is in the TLB or not.

Reviewed by: kevans
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D41760

9 months agounifdef: Handle redefined symbols correctly.
Dag-Erling Smørgrav [Wed, 6 Sep 2023 17:11:04 +0000 (17:11 +0000)]
unifdef: Handle redefined symbols correctly.

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

9 months agodiff3: make the diff3 -E -m and diff3 -m behaviour match gnu diff3
Baptiste Daroussin [Tue, 5 Sep 2023 11:24:53 +0000 (13:24 +0200)]
diff3: make the diff3 -E -m and diff3 -m behaviour match gnu diff3

In gnu diff3 3 way merging files where the new file and the target are
already the same will die and show what has failed to be merged except
if -E is passed in argument, in this case it will finish the merge.

This difference in behaviour was breaking one of the etcupdate testcase
with bsd diff3

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

9 months agolinuxkpi: fix iteration in __sg_alloc_table_from_pages
Austin Shafer [Wed, 6 Sep 2023 14:08:05 +0000 (14:08 +0000)]
linuxkpi: fix iteration in __sg_alloc_table_from_pages

Commit 3f686532c9b4 tried to fix an issue with not properly starting
at the first page in the sg list to prevent a panic. This worked but
with the side effect of incrementing "s" during the final iteration
causing it to be NULL since the list had ended.
In cases non-DEBUG kernels this causes a panic with drm-5.15, since
"s" is NULL when we later pass it to sg_mark_end().
This change decouples the iteration sg from the return value so that
it is never incremented past the final page in the chain.

MFC after: 3 days
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D41574

9 months agoqat: Intel 4xxx Series driver API extension
Piotr Kasierski [Wed, 6 Sep 2023 13:51:41 +0000 (09:51 -0400)]
qat: Intel 4xxx Series driver API extension

This commit introduces:
- Quick Assist API update for partial decompress and zero padding.
- Refactor of UIO locking.
- VF driver hotplug fix.
- Minor code style fixes for firmware API.

Patch co-authored by: Krzysztof Zdziarski <krzysztofx.zdziarski@intel.com>
Patch co-authored by: Michal Gulbicki <michalx.gulbicki@intel.com>
Patch co-authored by: Piotr Kasierski <piotrx.kasierski@intel.com>
Patch co-authored by: Karol Grzadziel <karolx.grzadziel@intel.com>

Sponsored by: Intel Corporation
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41613

9 months agodtrace: Fix a kernel panic in printm()
Domagoj Stolfa [Wed, 6 Sep 2023 13:25:00 +0000 (09:25 -0400)]
dtrace: Fix a kernel panic in printm()

When using printm(), one should always pass a scratch pointer to it.
This is achieved by calling printm with memref

  BEGIN { printm(fixed_len, memref(ptr, var_len)); }

which will return a pointer to the DTrace scratch space of size
sizeof(uintptr_t) * 2. However, one can easily call printm() as follows

  BEGIN { printm(10, (void *)NULL); }

and panic the kernel as a result. This commit does two things:

  (1) adds a new macro DTRACE_INSCRATCHPTR(mstate, ptr, howmany) which
      checks if a certain pointer is in the DTrace scratch space;
  (2) uses DTRACE_INSCRATCHPTR() to implement a check on printm()'s DIFO
      return value in order to avoid the panic and sets CPU_DTRACE_BADADDR
      if the address is not in the scratch space.

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

9 months agolibcasper: reference system.fileargs service
Ed Maste [Wed, 6 Sep 2023 13:45:31 +0000 (09:45 -0400)]
libcasper: reference system.fileargs service

Reviewed by: oshogbo
MFC after: 3 days
Fixes: cdd6ea94b0a4 ("libcasper: introduce cap_fileargs...")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41761

9 months agovfs: copy_file_range() between multiple mountpoints of the same fs type
Martin Matuska [Wed, 6 Sep 2023 11:58:10 +0000 (13:58 +0200)]
vfs: copy_file_range() between multiple mountpoints of the same fs type

VOP_COPY_FILE_RANGE(9) is now caled when source and target vnodes
reside on the same filesystem type (not just on the same mountpoint).
The check if vnodes are on the same mountpoint must be done in the
filesystem code. There are currently only three users - fusefs(5) already
has this check, ZFS can handle multiple mountpoints and a check has been
added to NFS client.

ZFS block cloning is now possible between all snapshots and datasets
of the same ZFS pool.

MFC after: 1 week
Reviewed by: rmacklem
Differential Revision: https://reviews.freebsd.org/D41721

9 months agopci_vendors: update to 2023-08-12
Baptiste Daroussin [Wed, 6 Sep 2023 12:22:11 +0000 (14:22 +0200)]
pci_vendors: update to 2023-08-12

9 months agosendmail: remove all m4 files with WITHOUT_SENDMAIL
Baptiste Daroussin [Fri, 4 Aug 2023 11:57:12 +0000 (13:57 +0200)]
sendmail: remove all m4 files with WITHOUT_SENDMAIL

9 months agonet: Check per-flow priority code point for untagged traffic
Zhenlei Huang [Wed, 6 Sep 2023 10:15:14 +0000 (18:15 +0800)]
net: Check per-flow priority code point for untagged traffic

Commit 868aabb4708d introduced per-flow priority. There's a defect in the
logic for untagged traffic, it does not check M_VLANTAG set in the mbuf
packet header or MTAG_8021Q/MTAG_8021Q_PCP_OUT tag set by firewall, then
can result missing desired priority in the outbound packets.

For mbuf packet with M_VLANTAG in header, some interfaces happen to work
due to bug in the drivers mentioned in D39499. As modern interfaces have
VLAN hardware offloading, the defect is barely noticeable unless the
feature per-flow priority is widely tested.

As a side effect of this defect, the soft padding to work around buggy
bridges is bypassed. That may result in regression if soft padding is
requested.

PR: 273431
Discussed with: kib
Fixes: 868aabb4708d Add IP(V6)_VLAN_PCP to set 802.1 priority per-flow
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39536

9 months agosys/dev/arcmsr: Update Areca RAID driver to version 1.50.00.06.
黃清隆 [Wed, 6 Sep 2023 07:59:22 +0000 (00:59 -0700)]
sys/dev/arcmsr: Update Areca RAID driver to version 1.50.00.06.

 - Suppressed a harmless warning message, "arcmsr_dr_handle: target=f,
   lun=0, GONE!!!," which could appear a few seconds after UEFI system
   boot due to the boot volume UEFI initialization.
 - Corrected various typing errors.
 - Refactored arcmsr_initialize() to improve code readability.
 - Added support for device IDs 1883 and 1886 controllers.
 - Introduced support for controllers requiring host memory for the
   RAID 5 and 6 XOR engines.

Many thanks to Areca for continuing to support FreeBSD.

MFC after: 3 days

9 months agosplit: Fix linecount parsing.
Dag-Erling Smørgrav [Wed, 6 Sep 2023 03:28:30 +0000 (03:28 +0000)]
split: Fix linecount parsing.

The “undocumented kludge” which unfortunately can't be dropped for backward compatibility reasons was prone to segfaulting and would improperly allow a new linecount when one was already set.  Fix these issues and add regression tests.

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

9 months agosplit: Code cleanup.
Dag-Erling Smørgrav [Wed, 6 Sep 2023 03:28:25 +0000 (03:28 +0000)]
split: Code cleanup.

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

9 months agosplit: Add missing test cases.
Dag-Erling Smørgrav [Wed, 6 Sep 2023 03:28:19 +0000 (03:28 +0000)]
split: Add missing test cases.

This adds test cases for c4f7198f47c1 and ac17fc816e67.

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

9 months agotime.h: Fix visibility check for C11 and C23 features.
Dag-Erling Smørgrav [Wed, 6 Sep 2023 01:37:43 +0000 (03:37 +0200)]
time.h: Fix visibility check for C11 and C23 features.

__BSD_VISIBLE is always defined; we need to check if it's true.

Fixes: d02489d11aed 9b5d724cad10
MFC after: 3 days
Reviewed by: brooks, imp
Differential Revision: https://reviews.freebsd.org/D41733

9 months agotimerfd: Relocate 32-bit compat code
Jake Freeland [Tue, 5 Sep 2023 22:13:23 +0000 (16:13 -0600)]
timerfd: Relocate 32-bit compat code

32-bit compatibility code is conventionally stored in
sys/compat/freebsd32. Move freebsd32_timerfd_gettime() and
freebsd32_timerfd_settime() from sys/kern/sys_timerfd.c to
sys/compat/freebsd32/freebsd32_misc.c.

MFC After: 3 days
Reviewed by: imp, markj
Differential Revision; https://reviews.freebsd.org/D41640

9 months agotimerfd: Namespace pollution adjustments
Jake Freeland [Tue, 5 Sep 2023 22:11:50 +0000 (16:11 -0600)]
timerfd: Namespace pollution adjustments

    Do not pollute userspace with <sys/proc.h>, instead declare struct thread
    when _KERNEL is defined.

    Include <sys/time.h> instead of <sys/timespec.h>. This causes intentional
    namespace pollution that mimics Linux. g/musl libcs include <time.h> in
    their <sys/timerfd.h>, exposing clock gettime, settime functions and
    CLOCK_ macro constants. Ports like Chromium expect this namespace
    pollution and fail without it.

MFC After: 3 days
Reviewed by: imp, markj
Differential Revision: https://reviews.freebsd.org/D41641

9 months agotimerfd: Define a locking regime
Jake Freeland [Tue, 5 Sep 2023 22:10:44 +0000 (16:10 -0600)]
timerfd: Define a locking regime

    Define a locking regime for the members of struct timerfd and document
    it so future code can follow the standard. The lock legend can be found
    in a comment above struct timerfd.

    Additionally,
    * Add assertions based on locking regime.
    * Fill kn_data with the expiration count when EVFILT_READ is triggered.
    * Report st_ctim for stat(2).
    * Check if file has f_type == DTYPE_TIMERFD before assigning timerfd
      pointer to f_data.

MFC After: 3 days
Reviewed by: imp, kib, markj
Differential Revision: https://reviews.freebsd.org/D41600

9 months agocxgbe(4): Avoid hang on kldunload on netlink enabled kernels.
Navdeep Parhar [Tue, 5 Sep 2023 18:21:03 +0000 (11:21 -0700)]
cxgbe(4): Avoid hang on kldunload on netlink enabled kernels.

netlink(4) calls back into the driver during detach and it attempts to
start an internal synchronized op recursively, causing an interruptible
hang.  Fix it by failing the ioctl if the VI has been marked as DOOMED
by cxgbe_detach.

Here's the stack for the hang for reference.
 #6  begin_synchronized_op
 #7  cxgbe_media_status
 #8  ifmedia_ioctl
 #9  cxgbe_ioctl
 #10 if_ioctl
 #11 get_operstate_ether
 #12 get_operstate
 #13 dump_iface
 #14 rtnl_handle_ifevent
 #15 rtnl_handle_ifnet_event
 #16 rt_ifmsg
 #17 if_unroute
 #18 if_down
 #19 if_detach_internal
 #20 if_detach
 #21 ether_ifdetach
 #22 cxgbe_vi_detach
 #23 cxgbe_detach
 #24 DEVICE_DETACH

MFC after: 3 days
Sponsored by: Chelsio Communications