This flag was leftover from testing and should have been removed.
Approved by: re (cperciva)
PR: 274938
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 50565cf514)
(cherry picked from commit a8043cc0d4)
Previously, while checking name2addr capabilities, we mistakenly used
the addr2name set. This error could cause a process to inadvertently
reset its limitations.
Reported by: Shawn Webb <[email protected]>
(cherry picked from commit afd74c4000)
(cherry picked from commit 765757c630)
Approved by: so
Approved by: re (implicit)
Security: FreeBSD-SA-23:16.cap_net
Sponsored by: The FreeBSD Foundation
This fixes CVE-2014-8611 correctly.
The commit that purported to fix CVE-2014-8611 (805288c2f0) only hid
it behind another bug. Two later commits, 86a16ada1e and
44cf1e5eb4, attempted to address this new bug but mostly just confused
the issue. This commit rolls back the three previous changes and fixes
CVE-2014-8611 correctly.
The key to understanding the bug (and the fix) is that `_w` has
different meanings for different stream modes. If the stream is
unbuffered, it is always zero. If the stream is fully buffered, it is
the amount of space remaining in the buffer (equal to the buffer size
when the buffer is empty and zero when the buffer is full). If the
stream is line-buffered, it is a negative number reflecting the amount
of data in the buffer (zero when the buffer is empty and negative buffer
size when the buffer is full).
At the heart of `fflush()`, we call the stream's write function in a
loop, where `t` represents the return value from the last call and `n`
the amount of data that remains to be written. When the write function
fails, we need to move the unwritten data to the top of the buffer
(unless nothing was written) and adjust `_p` (which points to the next
free location in the buffer) and `_w` accordingly. These variables have
already been set to the values they should have after a successful
flush, so instead of adjusting them down to reflect what was written,
we're adjusting them up to reflect what remains.
The bug was that while `_p` was always adjusted, we only adjusted `_w`
if the stream was fully buffered. The fix is to also adjust `_w` for
line-buffered streams. Everything else is just noise.
Fixes: 805288c2f0
Fixes: 86a16ada1e
Fixes: 44cf1e5eb4
Sponsored by: Klara, Inc.
(cherry picked from commit 1f90b4edff)
(cherry picked from commit 1e99535be2)
(cherry picked from commit d09a3bf72c)
(cherry picked from commit 92709431b1)
(cherry picked from commit 418f026bd5)
(cherry picked from commit abe12d2f4c)
(cherry picked from commit 4e0e01bf65)
(cherry picked from commit d2c65a1c94)
Approved by: so
Approved by: re (implicit)
Security: FreeBSD-SA-23:15.stdio
Sponsored by: The FreeBSD Foundation
When IPv6 support was added to pfsync, PFSYNC_MINPKT increased such that
we always allocate enough space for either IPv4 or IPv6 headers. IPv6
headers are 20 bytes larger than IPv4 headers. When pfsync_sendout()
does its thing, it ends up allocating enough space for either; thus when
transmitting an IPv4 packet, the last 20 bytes of the buffer are left
uninitialized.
Fix the problem by stashing the length in a local variable and adjusting
it depending on the address family in use.
While here, just zero the entire buffer in one go rather than being
careful to initialize each subheader. This seems simpler and less error
prone.
Approved by: re (gjb)
Approved by: so
Reported by: KMSAN
Reviewed by: kp
Fixes: 6fc7fc2dbb ("pfsync: transport over IPv6")
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42461
(cherry picked from commit bd80263606)
(cherry picked from commit 09cca16bfc)
QEMU emulates Hyper-V [1] but lacks the emulation for vmbus_res, thus no
coherence information is available. Add NULL check for it and fallback
to no coherence. This will prevent FreeBSD guests from panic on QEMU
with the Hyper-V enlightenment hv-synic enabled.
For real Hyper-V, both gen1 and gen2 have vmbus_res then they are not
affected by this change.
1. https://www.qemu.org/docs/master/system/i386/hyperv.html
PR: 274810
Reviewed by: mhorne, emaste, delphij, whu
Approved by: re (gjb)
Diagnosed by: mhorne
Fixes: e7a9817b8d Hyper-V: vmbus: implementat bus_get_dma_tag in vmbus
Insta-MFC approved by: re (delphij) for 14.0-RC4
Differential Revision: https://reviews.freebsd.org/D42414
(cherry picked from commit 63bf943d4a)
(cherry picked from commit 1969d82fcf)
#15465763ca47f Fix block cloning between unencrypted and encrypted
datasets
Fixes a kernel panic when block cloning is enabled and system is trying
to read data from a file copied using copy_file_range(2), e.g. with cp(1)
from an unencrypted dataset into an encrypted dataset on the same ZFS pool.
As the file has not been encrypted, to fix the filesystem inconsistency
and to avoid future panics it must be deleted (metadata is readable).
Approved by: re (gjb)
Obtained from: OpenZFS
OpenZFS commit: 763ca47fa8
(cherry picked from commit c5eb93ef57)
Prefer UNMAPPEDIO and ROTATING from flags sysctl. See
1. aeab0812e6 (Add flags sysctl to ada)
2. cf3ff63e55 (Convert unmappedio over to a flag)
3. 96eb32bf0f (Convert rotating to a flag bit)
Reviewed by: imp, ken, #cam
Approved by: re (gjb)
MFC after: immediately (we want this in 14.0)
Differential Revision: https://reviews.freebsd.org/D42402
(cherry picked from commit d24729b2fd)
(cherry picked from commit fb288d4939)
When we're recoverying a damangae GPT, or when we're restoring a backed
up partition tables, don't enforce the 4k alignment for start/end LBAs.
This is useful for 512e/4kn drives when we're creating a new partition
table or partition. However, when we're trying to fix / restore an old
partition, we shouldn't force this alignment, since in that case it's
more important to use the partition table as is than to optimize
performance by rounding (which isn't required by the standard).
MFC After: 1 week (pushed more quickly per re@)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D42359
(cherry picked from commit 5c9f0f72f4)
(cherry picked from commit 859d674e17)
Approved-by: re (gjb)
ioctl(2)'s with integer argument shall pass command argument by value,
not by pointer. The ioctl(2) manual page is not very clear about that.
See sys/kern/sys_generic.c:sys_ioctl() near IOC_VOID.
Approved by: re (gjb)
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D42366
Fixes: fd8b9c73a5
(cherry picked from commit f407a72a50)
(cherry picked from commit 6f1ccbd587)
OpenSSL 3.0.12 addresses:
* Fix incorrect key and IV resizing issues when calling
EVP_EncryptInit_ex2(), EVP_DecryptInit_ex2() or EVP_CipherInit_ex2()
with OSSL_PARAM parameters that alter the key or IV length
([CVE-2023-5363]).
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
(cherry picked from commit ad991e4c14)
(cherry picked from commit 575878a533)
(cherry picked from commit e833378cf9)
Approved by: so
Approved by: re (gjb)
It may be needed when it's updated so is best to keep in sync with the
assembly files.
Reviewed by: emaste
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D41938
(cherry picked from commit c97a82d4a4)
(cherry picked from commit 5b413daf3a)
Approved by: re (gjb)
Tested with: cryptocheck -d ossl0 -a all -z on amd64
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D41568
(cherry picked from commit c0855eaa3e)
(cherry picked from commit f0d83d53c3)
Approved by: re (gjb)
These targets generate all the assembly files in sys/crypto/openssl.
Reviewed by: markj, emaste (earlier version)
Differential Revision: https://reviews.freebsd.org/D41590
(cherry picked from commit 73653b72af)
(cherry picked from commit ef81451d11)
Approved by: re (gjb)
Currently Makefile.asm relies on the current buildenv to set CFLAGS
for i386. The current approach also leaves various temporary *.s
files around in the current directory. To make this a bit better:
- Instead of using CFLAGS from buildenv for i386, define the actual
flags the perl scripts need: -DOPENSSL_IA32_SSE2 to enable SSE2.
- Change i386 to have the perl scripts write to /dev/stdout to avoid
creating temporaries. Previously i386 was generating the temporary
files in the OpenSSL contrib src.
- Cleanup temporary *.s files in the all target after generating the
real *.S files for architectures which need them.
- Remove a duplicate rule for aes-armv4.S.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D41589
(cherry picked from commit c0fe6b9d75)
(cherry picked from commit 14dc723496)
Approved by: re (gjb)
The :R:S expressions removed the .pl extension only to add it back
again, so just trim them to using :T alone.
Reviewed by: Pierre Pronchery <[email protected]>, markj, emaste
Differential Revision: https://reviews.freebsd.org/D41588
(cherry picked from commit 7406b6f976)
(cherry picked from commit a3f973f2ea)
Approved by: re (gjb)
Approved by: re (gjb)
Fixes: 96092bf910 ("makefs/zfs: Fill out dd_used_breakdown fields in DSL directories")
Sponsored by: The FreeBSD Foundation
(cherry picked from commit c9c029507f)
This is required for the "used", "usedds" and "usedchild" dataset
properties to be displayed.
Approved by: re (gjb)
PR: 274613
Reported by: Mike Tancsa <[email protected]>
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
(cherry picked from commit eb5cbd793e)
Most of the first block of pad bytes are now used for space accounting
purposes. No functional change intended.
Approved by: re (gjb)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 731b737107)
In the LinuxKPI, PAGE_MASK is the logical negation of FreeBSD's
PAGE_MASK, so the original assertion was simply incorrect.
Approved by: re (gjb)
Reported by: trasz
Tested by: trasz
Fixes: 6223d0b67a ("linuxkpi: Handle direct-mapped addresses in linux_free_kmem()")
(cherry picked from commit f88bd1174a)
(cherry picked from commit 501e1152d2)
See the analysis in PR 271333. It is possible for driver code to
allocate a page, store its address as returned by page_address(), then
call free_page() on that address. On most systems that'll result in the
LinuxKPI calling kmem_free() with a direct-mapped address, which is not
legal.
Fix the problem by making linux_free_kmem() check the address to see
whether it's direct-mapped or not, and handling it appropriately.
Approved by: re (gjb)
PR: 271333, 274515
Reviewed by: hselasky, bz
Tested by: trasz
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40028
(cherry picked from commit 6223d0b67a)
(cherry picked from commit 4862eb8604)
Creating an IP socket to invoke the SIOCGIFFLAGS ioctl on is the only
thing preventing bhyve from working inside a bhyve jail with IPv4 and
IPv6 disabled restricting the jailed bhyve process to only access the
host network via a tap/vmnet device node.
Approved by: re (gjb)
PR: 273557
Fixes: 56be282bc9 ("bhyve: net_backends, automatically IFF_UP tap devices")
Reviewed by: markj
MFC after: 1 week
(cherry picked from commit fd8b9c73a5)
(cherry picked from commit 700689bc2a)
Unlike MSI-X, when a device uses multiple MSI interrupts, the entire
group of interrupts are enabled/disabled at once in the relevant PCI
config register. Currently, the interrupt code enables the IDT vector
for each MSI interrupt when a handler is first registered. If the PCI
device triggers an MSI interrupt which doesn't yet have a handler,
this can trigger a panic when the Xrsvd ISR executes rather than
treating it as a stray device interrupt.
To fix, enable all the IDT vectors for an MSI group when the first
interrupt handler is configured, and don't disable the IDT vectors
until the last interrupt handler for the group is torn down.
When migrating an MSI group between CPUs, enable/disable the entire
group of IDT vectors if at least one interrupt handler is configured
for the group.
Reported by: jhay
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D42232
(cherry picked from commit 2d49248921)
(cherry picked from commit 0e496388ef)
Approved by: re (gjb)
These were removed when the new mixer(3) library was imported.
PR: 274602
Fixes: 903873ce15 Implement and use new mixer(3) library for FreeBSD.
(cherry picked from commit f7c4f49649)
(cherry picked from commit e8daee3212)
Approved by: re (gjb)
This removes a guard condition that prevents KTLS being enabled for
receiving in TLS 1.3. Use the correct sequence number and BIO for
receive vs transmit offload.
Obtained from: OpenSSL commit 7c78932b9a4330fb7c8db72b3fb37cbff1401f8b
(cherry picked from commit 6ed16d1733)
(cherry picked from commit 263d7e50ad)
Approved by: re (gjb)
- Don't unpad records, check the outer record type, or extract the
inner record type from TLS 1.3 records handled by the kernel. KTLS
performs all of these steps and returns the inner record type in the
TLS header.
- When checking the length of a received TLS 1.3 record don't allow
for the extra byte for the nested record type when KTLS is used.
- Pass a pointer to the record type in the TLS header to the
SSL3_RT_INNER_CONTENT_TYPE message callback. For KTLS, the old
pointer pointed to the last byte of payload rather than the record
type. For the non-KTLS case, the TLS header has been updated with
the inner type before this callback is invoked.
Obtained from: OpenSSL commit a5fb9605329fb939abb536c1604d44a511741624)
(cherry picked from commit c085ca5245)
(cherry picked from commit 4d85e7386f)
Approved by: re (gjb)
When KTLS receive is enabled, pending data may still be present due to
read ahead. This data must still be processed the same as records
received without KTLS. To ease readability (especially in
consideration of additional checks which will be added for TLS 1.3),
add a helper variable 'using_ktls' that is true when the KTLS receive
path is being used to receive a record.
Obtained from: OpenSSL commit 031132c297e54cbc20404a0bf8de6ed863196399
(cherry picked from commit 0fc28f22d5)
(cherry picked from commit 65e292cdf1)
Approved by: re (gjb)
KTLS implementations currently assume that the start of the in-kernel
socket buffer is aligned with the start of a TLS record for the
receive side. The socket option to enable KTLS specifies the TLS
sequence number of this initial record.
When read ahead is enabled, data can be pending in the SSL read buffer
after negotiating session keys. This pending data must be examined to
ensurs that the kernel's socket buffer does not contain a partial TLS
record as well as to determine the correct sequence number of the
first TLS record to be processed by the kernel.
In preparation for enabling receive kernel offload for TLS 1.3, move
the existing logic to handle read ahead from t1_enc.c into ktls.c and
invoke it from ktls_configure_crypto().
Obtained from: OpenSSL commit 85773128d0e80cd8dcc772a6931d385b8cf4acd1
(cherry picked from commit eee55a22b2)
(cherry picked from commit 400229e8d9)
Approved by: re (gjb)
Currently if _BBN doesn't match the first bus in the decoded bus range
from _CRS for a Host to PCI bridge, the driver fails to attach as a
defensive measure.
There is now firmware in the field where these do not match, and the
_BBN values are clearly wrong, so rather than failing attach, trust
the range from _CRS over _BBN.
Co-authored-by: Justin Gibbs <[email protected]>
Reported by: gibbs
Reviewed by: imp (earlier version)
Differential Revision: https://reviews.freebsd.org/D42231
(cherry picked from commit 22a6678b62)
(cherry picked from commit 76b37faac8)
Approved by: re (gjb)
The -r flag to bectl needs to go away, and we need to just do the right
thing. In the meantime, we can apply an -r in freebsd-update as a
minimal fix to stop creating partial backups in these (non-default) deep
BE setups.
PR: 267535
Approved by: re (gjb)
(cherry picked from commit 989c5f6da9)
(cherry picked from commit 5c2a559876)
#15405ea30b5a9e Set spa_ccw_fail_time=0 when expanding a vdev
Fixes 5-minute autoexpand delay on ZFS-root VM images.
Approved by: re (gjb)
Requested by: cperciva
Co-Authored-By: Colin Percival <[email protected]>
Obtained from: OpenZFS
OpenZFS commit: ea30b5a9e0
(cherry picked from commit c458bf557d)
The following loader tunables do have corresponding sysctl MIBs but
with inconsistent naming. That may be historical reason. Let's prefer
consistent naming for them so that it will be easier to maintain.
1. hw.dmar.timeout -> hw.iommu.dmar.timeout
2. hw.lapic_eoi_suppression -> hw.apic.eoi_suppression
3. hw.lapic_tsc_deadline -> hw.apic.timer_tsc_deadline
4. hw.x2apic_enable -> hw.apic.x2apic_mode
Those tunables are for field debugging, no need to keep old names for
compatibility.
Reviewed by: kib
Approved by: re (gjb)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42248
(cherry picked from commit 12cce5994b)
(cherry picked from commit 6cd7e3d118)
The sysctl knob 'vm.pmap.allow_2m_x_ept' is loader tunable and have
public document entry in security(7) but is fetched from kernel
environment 'hw.allow_2m_x_ept'. That is inconsistent and obscure.
As there is public security advisory FreeBSD-SA-19:25.mcepsc [1],
people may refer to it and use 'hw.allow_2m_x_ept', let's keep old
name for compatibility.
[1] https://www.freebsd.org/security/advisories/FreeBSD-SA-19:25.mcepsc.asc
Reviewed by: kib
Approved by: re (gjb)
Fixes: c08973d09c Workaround for Intel SKL002/SKL012S errata
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42311
(cherry picked from commit 9e7f349ff1)
(cherry picked from commit 8784b153a3)
The following loader tunables do have corresponding sysctl MIBs but
with different names. That may be historical reason. Let's prefer
consistent naming for them so that it will be easier to read and
maintain.
1. hw.vmm.l1d_flush -> hw.vmm.vmx.l1d_flush
2. hw.vmm.l1d_flush_sw -> hw.vmm.vmx.l1d_flush_sw
3. hw.vmm.vmx.use_apic_pir -> hw.vmm.vmx.cap.posted_interrupts
4. hw.vmm.vmx.use_apic_vid -> hw.vmm.vmx.cap.virtual_interrupt_delivery
5. hw.vmm.vmx.use_tpr_shadowing -> hw.vmm.vmx.cap.tpr_shadowing
Old names are kept for compatibility.
Meanwhile, add sysctl flag CTLFLAG_TUN to them so that `sysctl -T` will
report them correctly.
Reviewed by: corvink, jhb, kib, #bhyve
Approved by: re (gjb)
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D42251
(cherry picked from commit f3ff0918ff)
(cherry picked from commit 9e48b627ae)
The loader tunable 'vm.numa.disabled' does not have corresponding sysctl
MIB entry. Add it so that it can be retrieved, and `sysctl -T` will also
report it correctly.
Reviewed by: markj
Approved by: re (gjb)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42138
(cherry picked from commit c415cfc8be)
(cherry picked from commit e26b7e8d02)
The loader tunable 'vm.pgcache_zone_max_pcpu' does not have corresponding
sysctl MIB entry. Add it so that it can be retrieved, and `sysctl -T`
will also report it correctly.
Reviewed by: markj
Approved by: re (gjb)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42138
(cherry picked from commit a55fbda874)
(cherry picked from commit cb5bc8a748)
The loader tunable 'debug.kmsan.disabled' does not have corresponding
sysctl MIB entry. Add it so that it can be retrieved, and `sysctl -T`
will also report it correctly.
Reviewed by: markj
Approved by: re (gjb)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42138
(cherry picked from commit 1d2b743784)
(cherry picked from commit 1b289728e9)
The loader tunable 'debug.kasan.disabled' does not have corresponding
sysctl MIB entry. Add it so that it can be retrieved, and `sysctl -T`
will also report it correctly.
Reviewed by: markj
Approved by: re (gjb)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42138
(cherry picked from commit db5d0bc868)
(cherry picked from commit 6f8ef4d6e4)
The loader tunable 'kern.boottrace.table_size' does not have
corresponding sysctl MIB entry. Add it so that it can be retrieved,
and `sysctl -T` will also report it correctly.
Reviewed by: markj
Approved by: re (gjb)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42138
(cherry picked from commit 51dc362d1a)
(cherry picked from commit c525ec74b4)
The following sysctl variables are actually loader tunables. Add sysctl
flag CTLFLAG_TUN to them so that `sysctl -T` will report them correctly.
1. net.inet.sctp.tcbhashsize
2. net.inet.sctp.pcbhashsize
3. net.inet.sctp.chunkscale
The loader tunable 'net.inet.sctp.tcbhashsize' and 'net.inet.sctp.chunkscale'
are only used during vnet initializing, thus it make no senses to make them
writable tunable.
Validate the values of loader tunables on vnet initialize, reset them to
theirs defaults if invalid to prevent potential kernel panics.
Reviewed by: tuexen, #transport, #network
Approved by: re (gjb)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42007
(cherry picked from commit dac91eb766)
(cherry picked from commit fd9de12a71)
It is observed that netvsc's send rings could stall on the latest
Azure Boost platforms. This is due to vmbus_rxbr_read() routine
doesn't check if host is waiting for more room to put data, which
leads to host side sleeping forever on this vmbus channel. The
problem was only observed on the latest platform because the host
requests larger buffer ring room to be available, which causes
the issue to happen much more easily.
Fix this by adding check in the vmbus_rxbr_read call and signaling
the host in the callers if check returns positively.
Approved by: re (gjb)
Reported by: NetApp
Tested by: whu
Sponsored by: Microsoft
(cherry picked from commit 49fa9a6437)
(cherry picked from commit c81166b018)
This is a temporary solution to fix PR before release.
During 15.0 it's necessary to refactor symlinks handling
between vfs & namecache.
Approved by: re (gjb)
PR: 273414
Reported by: Vincent Milum Jr, Dan Kotowski, glebius
Tested by: Dan Kotowski, glebius
Reviewed by:
Differential Revision: https://reviews.freebsd.org/D41806
MFC after: 3 days
(cherry picked from commit bb8ecf259f)
(cherry picked from commit b84a836ef0)
At least KMSAN relies on zero-initialization of AP PCPU regions, see
commit 4b136ef259.
Prior to commit af1c6d3f30 these were allocated with allocpages() in
the amd64 pmap, which always returns zero-initialized memory.
Approved by: re (gjb)
Reviewed by: kib
Fixes: af1c6d3f30 ("amd64: do not leak pcpu pages")
MFC after: 3 days
Sponsored by: Klara, Inc.
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D42241
(cherry picked from commit a37e484d04)
(cherry picked from commit 4533fa42ad)
When recvmsg(2) is used with MSG_TRUNC on an atomic socket type (DGRAM
or SEQPACKET), soreceive_generic() and uipc_peek_dgram() may
intentionally underflow uio_resid so that userspace can find out how
many bytes it should have asked for.
If this happens, and KTR_GENIO is enabled, ktrgenio() will attempt to
copy in beyond the end of the output buffer's iovec. In general this
will silently cause the ktrace operation to fail since it'll result in
EFAULT from uiomove(). Let's be more careful and make sure not to try
and copy more bytes than we have.
Approved by: re (gjb)
Fixes: be1f485d7d ("sockets: add MSG_TRUNC flag handling for recvfrom()/recvmsg().")
Reported by: [email protected]
Reviewed by: kib
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42099
(cherry picked from commit 761ae1ce79)
(cherry picked from commit eb965d4f03)
As of LLVM 16, -fsanitize-memory-param-retval is the default. It yields
significantly smaller code, but the KMSAN runtime interceptors need to
be updated to stop checking shadow state of parameters. Apply a minimal
workaround for now.
Approved by: re (gjb)
MFC after: 3 days
Sponsored by: Klara, Inc.
Sponsored by: Juniper Networks, Inc.
(cherry picked from commit b6c653c974)
(cherry picked from commit c89523d1c4)
This patch fixes UTF-8 sequence validation logic in
teken_utf8_bytes_to_codepoint() and fixes fallback behaviour in
ttydisc_rubchar() when an invalid UTF8 sequence is encountered. The code
previously used __bitcount() to extract sequence length information from
the leading byte. However, this assumption breaks for certain code
points that have additional bits set in the first half of the leading
byte (e.g. Cyrillic characters). This lead to incorrect behaviour when
deleting those characters using backspaces. The code now checks the
number of consecutive set bits in the leading byte starting from the
MSB, as per RFC 3629.
Reviewed by: christos
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D42147
(cherry picked from commit 2fed1c579c)
Approved by: re (gjb)
The use of bitcount() triggered a build error because it couldn't be
located. __bitcount() on the other hand is defined in sys/types.h, which
is included in teken/teken.h.
MFC after: 2 weeks
(cherry picked from commit 6d3296f16a)
Approved by: re (gjb)
This patch adds additional logic in ttydisc_rubchar() to properly handle
backspace behaviour for UTF-8 characters.
Currently, typing in a backspace after a UTF8 character will delete only
one byte from the byte sequence, leaving garbled output in the tty's
output queue. With this change all of the character's bytes are deleted.
This change is only active when the IUTF8 flag is set (see
19054eb6053189144aa962b2ecc1bf5087758a3e "(s)tty: add support for IUTF8
input flag")
The code uses the teken_wcwidth() function to properly handle character
column widths for different code points, and adds the
teken_utf8_bytes_to_codepoint() function that converts a UTF-8 byte
sequence to a codepoint, as specified in RFC3629.
Reported by: christos
Reviewed by: christos, imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D42067
(cherry picked from commit 9e589b0938)
Approved by: re (gjb)
This patch adds the necessary kernel and stty code to support setting
the IUTF8 flag for ttys. It is the first of two patches that fix
backspace behaviour for UTF-8 encoded characters when in canonical mode.
Reported by: christos
Reviewed by: christos, imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D42066
(cherry picked from commit 128f63cedc)
Approved by: re (gjb)
In the Mknod.parent_inode test case, the kernel sends an extra
FUSE_FORGET message. But because it gets sent asynchronously with the
failing syscall, it doesn't always get received before the test ends.
So we never setup an expectation for it. And 90+% of the time the test
would exit successfully.
Fix the intermittency by always waiting to receive the FUSE_FORGET
message.
Sponsored by: Axcient
(cherry picked from commit 86885b1868)
Fix intermittency in the sys.fs.fusefs.symlink.main test
This change is identical to 86885b1868 but for symlink instead of
mknod. The kernel sends a FUSE_FORGET asynchronously with the final
syscall. The lack of an expectation caused this test to occasionally
fail.
Also, remove a sleep that accidentally snuck into a different test.
Sponsored by: Axcient
(cherry picked from commit 8399d764c9)
(cherry picked from commit af20b22016)
Approved by: cperciva (re)
We must consider the aarch32 FP registers as 16 128bits registers, and store
that as the first 16 aarch64 FP registers.
PR: 267788
(cherry picked from commit ccd0f34d85)
(cherry picked from commit 0e0a03c792)
Approved by: re (cperciva)
Fixes: 1b10bdf0e2 "releng-gce: Add ZFS support to GCE"
Approved by: re (gjb)
(cherry picked from commit a959ae1c50)
(cherry picked from commit 394e87e634)
Move creation of watchdog process from just before we configure the
interrupt config hook to into the config hook itself. This prevents it
from racing the config intr hook and doing an extra reset of the
card. This extra reset is usually harmless, but sometimes it can prevent
discovery of devices if done at just the wrong time. This can lead to no
disks being registered in a box full of disks, for example. Starting it
later eliminates this race, making discovery reliable.
Reviewed by: imp
(cherry picked from commit 7e02c7074c)
(cherry picked from commit 10bbea2e25)
Approved-by: re (gjb)
Problem: Under certain I/O conditions, a program doing large block disk
reads can cause a controller to crash.
Root Cause: The SCSI read request and destination address in the BDMA
descriptor is incorrect, causing the BDMA engine in the controller to
assert.
Fix: Change the alignment for creating bus_dma_tags in the driver from
PAGE_SIZE (4k) to 1, which allows the controller to manage it's own
address range for BDMA transactions.
Risk: Medium
Exposure: This reverts a change first made to support NVMe drives on
Excalibur. At that time a 4k alignment was necessary. This no longer
seems to be the case.
PR: 259541
Reported by: Ka Ho Ng <[email protected]>
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D41619
(cherry picked from commit f07b267d8c)
(cherry picked from commit 01619a8faf)
Approved-by: re (gjb)
pqisrc_free_device frees the device softc with the os spinlock
held. This causes crashes when devices are removed because the memory
free might sleep (which is prohibited with spin locks held). Drop the
spinlock before releasing the memory.
MFC After: 2 days
PR: 273289
Reviewed by: imp
(cherry picked from commit b064a4c9ee)
(cherry picked from commit 1ad148a68a)
Approved-by: re (gjb)
I got a check inverted in a previous cleanup commit and as a result
partedit was only applying GEOM changes (and generating an /etc/fstab)
if it got an error reading the current GEOM mesh. Instead, it needed
to do those actions if it succeeded in reading the mesh.
The lack of /etc/fstab meant that bsdinstall mount didn't mount
anything in a scripted install.
PR: 273723
Reported by: Andrey Fesenko <[email protected]>
Reported by: Michal Nowak <[email protected]>
Reviewed by: cognet, brooks
Fixes: 2309909919 bsdinstall: Handle errors from geom_gettree.
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42236
(cherry picked from commit 5307bbcc03)
(cherry picked from commit bfbb28f3b1)
Approved by: re (gjb)
Remove the $FreeBSD$ pattern added to the tests, as well as fixing the
mkimg_test.sh script to stop adding it when we rebase the tests.
Reviewed by: imp, emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/870
(cherry picked from commit 3b5c984572)
(cherry picked from commit 9ed4f43bc4)
Approved-by: re (cperciva)
Recent changes to mkimg has changed the generated GPT images to be more
correct. Use make rebase to regenerate the baseline.
Sponsored by: Netflix
(cherry picked from commit d2abbfede5)
(cherry picked from commit 524225dde0)
Approved-by: re (cperciva)
vtoc8 support expired with sparc64 removal, so remove them all.
Sponsored by: Netflix
(cherry picked from commit 83bd5a833c)
(cherry picked from commit 4a3cdf4168)
Approved-by: re (cperciva)
UEFI v2.10 Section 5.3 documentes that the minimum reserved space after
the GPT header be at least 16kB. Enforce this minimum. Before, we'd only
set the number of entries to be the unpadded size. gpart's selective
enforcement of aspects of the GPT standard meant that these images would
work, but couldn't be changed (to add a partition or grow the size of a
partition). This ensures that gpart's overly picky standards don't cause
problems for people wishing to, for example, resize release images.
MFC after: 1 day (we want this in 14.0)
PR: 274312
Sponsored by: Netflix
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D42245
(cherry picked from commit 9b42d3e12f)
(cherry picked from commit 5401ebd33c)
Approved-by: re (cperciva)
Since fd7edfcdc3 ("bridge: fix lookup for untagged packets in
bridge_transmit()") and b0e38a1373 ("bridge: distinguish no vlan and
vlan 1") we do a better job of distinguishing between untagged and VLAN
1 traffic.
However, ifconfig still defaulted to adding addresses for VLAN 1, rather
than for untagged traffic. Change this to be the most common (i.e.
untagged) option.
Approved by: re (kib)
Reviewed by: zlei, philip
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42188
(cherry picked from commit 6ace92326f)
(cherry picked from commit ce3ab9dfee)
To overcome package name changing on default Python version updates.
Approved by: gjb (re), delphij (re)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41453
(cherry picked from commit 0fe6998d8a)
(cherry picked from commit 80496f42b6)
cr_canseeotheruids(), cr_canseeothergids() and cr_canseejailproc()
should not be used directly now. cr_bsd_visible() has to be called
instead.
Approved by: re (gjb)
Reviewed by: mhorne
Sponsored by: Kumacom SAS
Differential Revision: https://reviews.freebsd.org/D40629
(cherry picked from commit 91e9d669b4)
(cherry picked from commit 07c60e6323)
Using the effective group and not the real one when testing membership
has the consequence that unprivileged processes cannot see setuid
commands they launch until these have relinquished their privileges.
This is also in contradiction with how the similar cr_canseeotheruids()
works, i.e., by taking into account real user IDs.
Fix this by substituting groupmember() with realgroupmember(). While
here, simplify the code.
Approved by: re (gjb)
PR: 272093
Reviewed by: mhorne
Sponsored by: Kumacom SAS
Differential Revision: https://reviews.freebsd.org/D40642
Differential Revision: https://reviews.freebsd.org/D40644
(cherry picked from commit 91658080f1)
(cherry picked from commit 0452dd8413)
(cherry picked from commit 4e7cea61051abc476c64e4a996397235f5a881bc)
Like groupmember(), but taking into account the real group instead of
the effective group. Leverages the new supplementary_group_member()
function.
Approved by: re (gjb)
Reviewed by: mhorne
Sponsored by: Kumacom SAS
Differential Revision: https://reviews.freebsd.org/D40641
Differential Revision: https://reviews.freebsd.org/D40643
(cherry picked from commit 2a2bfa6ad9)
(cherry picked from commit 5d9f38405a)
(cherry picked from commit cbe88592ab88c3940bedc3b2a651eb4556f4bbd8)
This is in preparation for the introduction of the new realgroupmember()
function, which does the same search into supplementary groups as
groupmember().
Approved by: re (gjb)
Reviewed by: mhorne
Sponsored by: Kumacom SAS
Differential Revision: https://reviews.freebsd.org/D40640
(cherry picked from commit b725f232f3)
(cherry picked from commit 9fc5dbab5163b1e18776ac216691cc7eb8566a6f)
Mention cr_bsd_visible(9). Remove references to cr_canseeothergids(9)
and cr_canseeotheruids(9), as well as indirect references not
immediately useful.
Fix description of credentials checks to match reality.
Re-order errors to match code's check order.
Approved by: re (gjb)
Reviewed by: bcr, pauamma_gundo.com
Sponsored by: Kumacom SAS
Differential Revision: https://reviews.freebsd.org/D40638
(cherry picked from commit eb94f24fab)
(cherry picked from commit c29ee9e238b36ef8a7c4508582d4512cda885192)
Essentially defer to cr_cansee(9), except for the specifics.
Be more specific on the return codes.
Approved by: re (gjb)
Reviewed by: bcr, pauamma_gundo.com
Sponsored by: Kumacom SAS
Differential Revision: https://reviews.freebsd.org/D40637
(cherry picked from commit 2ede38aff5)
(cherry picked from commit 57d0cc50cd2878fcca8a9a4bf931abee0260b48d)
Remove references to cr_canseeothergids(9) and cr_canseeotheruids(9).
Defer to cr_bsd_visible() for controlling sysctl(8) variables.
Approved by: re (gjb)
Reviewed by: bcr, mhorne
Sponsored by: Kumacom SAS
Differential Revision: https://reviews.freebsd.org/D40636
(cherry picked from commit 82f9bc9ea8)
(cherry picked from commit 0d8de5b2dd61ad550afa86688e61cf546507dca6)
Significantly clarify. Replace references to cr_canseeothergids(9) by
ones to cr_bsd_visible(9).
Approved by: re (gjb)
Reviewed by: bcr, mhorne
Sponsored by: Kumacom SAS
Differential Revision: https://reviews.freebsd.org/D40635
(cherry picked from commit 4ddd253b38)
(cherry picked from commit d05ed9a37b84f277cbc06447b322930fe678b00e)
Significantly clarify. Replace references to cr_canseeotheruids(9) by
ones to cr_bsd_visible(9).
Approved by: re (gjb)
Reviewed by: pauamma_gundo.com, mhorne
Sponsored by: Kumacom SAS
Differential Revision: https://reviews.freebsd.org/D40633
(cherry picked from commit 3fe9ea4d2d)
(cherry picked from commit 15d2ead9623dc2b0a560fc0fd6ba89ca16715597)
When these functions were renamed 7 years ago, their man pages were not.
Rename the latter in accordance and fix the names inside them. Fix
references to them as well. Add the old man pages to the list of
obsolete files.
Approved by: re (gjb)
Reviewed by: mhorne
Sponsored by: Kumacom SAS
Differential Revision: https://reviews.freebsd.org/D40630
(cherry picked from commit c59ab75c04)
(cherry picked from commit 50cb6641921f9bab29b8404af2c86da79ff0e451)
As implemented, this security policy would only prevent seeing processes
in sub-jails, but would not prevent sending signals to, changing
priority of or debugging processes in these, enabling attacks where
unprivileged users could tamper with random processes in sub-jails in
particular circumstances (conflated UIDs) despite the policy being
enforced.
Approved by: re (gjb)
PR: 272092
Reviewed by: mhorne
Sponsored by: Kumacom SAS
Differential Revision: https://reviews.freebsd.org/D40628
(cherry picked from commit 5817169bc4)
(cherry picked from commit abfcae344feb89c635616769d12150f84c96c003)
This is a new helper function that leverages existing code: It calls
successively cr_canseeotheruids(), cr_canseeothergids() and
cr_canseejailproc() (as long as the previous didn't deny access). Will
be used in a subsequent commit.
Approved by: re (gjb)
Reviewed by: mhorne
Sponsored by: Kumacom SAS
Differential Revision: https://reviews.freebsd.org/D40627
(cherry picked from commit e4a7b4f99c)
(cherry picked from commit 4a78431a52e9e65c6181a943bca2430633350db1)
Use priv_check_cred() with a new privilege (PRIV_SEEJAILPROC) instead of
explicitly testing for UID 0 (the former has been the rule for almost 20
years).
As a consequence, cr_canseejailproc() now abides by the
'security.bsd.suser_enabled' sysctl and MAC policies.
Update the MAC policies Biba and LOMAC, and prison_priv_check() so that
they don't deny this privilege. This preserves the existing behavior
(the 'root' user is not restricted, even when jailed, unless
'security.bsd.suser_enabled' is not 0) and is consistent with what is
done for the related policies/privileges (PRIV_SEEOTHERGIDS,
PRIV_SEEOTHERUIDS).
Approved by: re (gjb)
Reviewed by: emaste (earlier version), mhorne
Sponsored by: Kumacom SAS
Differential Revision: https://reviews.freebsd.org/D40626
(cherry picked from commit 7974ca1cdb)
(cherry picked from commit bedaf8af51c96cef025c13c41ba420163824e8cb)
Commit b6e28991bf modified the allocation path for system scope PMCs
so that the event was allocated early for CPU 0. The reason is so that
the PMC's capabilities could be checked, to determine if pmcstat should
allocate the event on every CPU, or just on one CPU in each NUMA domain.
In the current scheme, there is no way to determine this information
without performing the PMC allocation.
This broke the established use-case of log analysis, and so
0aa1507751 was committed to fix the assertion. The result was what
appeared to be functional, but in normal counter measurement pmcstat was
silently allocating two counters for CPU 0.
This cuts the total number of counters that can be allocated from a CPU
in half. Additionally, depending on the particular hardware/event, we
might not be able to allocate the same event twice on a single CPU.
The simplest solution is to release the early-allocated PMC once we have
obtained its capabilities, and reallocate it later on. This restores the
event list logic to behave as it has for many years, and partially
reverts commit b6e28991bf.
Approved by: re (karels)
Reported by: alc, kevans
Reviewed by: jkoshy, ray
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41978
(cherry picked from commit c362fe939f)
(cherry picked from commit 5a2849bc3c)
Move the NETLINK define into opt_global.h so we can rely on it being
set correctly, without having to remember to include opt_netlink.h.
This ensures that the NETLINK define is correctly set. If not we
may end up with unloadable modules, due to missing symbols (such as
nlmsg_get_group_writer).
PR: 274306
Reviewed by: imp, markj
Approved by: re (karels)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42179
(cherry picked from commit ab393e9548)
(cherry picked from commit ff15498894)
MSI (not MSI-X) interrupt vectors must be allocated in groups that are
powers of 2, and the block of IDT vectors must be aligned to the size
of the request.
The code in native_apic_alloc_vectors() does an alignment check in the loop:
if ((vector & (align - 1)) != 0)
continue;
first = vector;
But it adds APIC_IO_INTS to the value it returns:
return (first + APIC_IO_INTS);
The problem is that APIC_IO_INTS is not a multiple of 32. It is 48:
As a result, a request for 32 vectors (the max supported by MSI), was
not always aligned. To fix, check the alignment of
'vector + APIC_IO_INTS' in the loop.
PR: 274074
Reviewed by: jhb
(cherry picked from commit d33a4ae8ba)
(cherry picked from commit d73b4f0640)
Approved by: re (karels)
Similar to dcfddc8dc0, replace the
simpler, inlined version with the full version.
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D41690
(cherry picked from commit 897e564361)
(cherry picked from commit 969dc06e91)
Approved by: re (karels)
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
(cherry picked from commit dcfddc8dc0)
(cherry picked from commit bd8cecc466)
Approved by: re (karels)
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 a0e20c0ded.
Suggested by: andrew
Reviewed by: andrew, emaste
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D41800
(cherry picked from commit d0af08c4ba)
(cherry picked from commit b7f6b86ee7)
Approved by: re (karels)
Queue an initial fetch of data during attach and after every read
rather than synchronously fetching data and polling for completion.
If data has not been returned from an previous fetch during read,
just return EAGAIN rather than blocking.
Co-authored-by: John Baldwin <[email protected]>
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D41656
(cherry picked from commit f1c5a2e3a6)
(cherry picked from commit b7f5e99347)
Approved by: re (karels)
MOVED_LIBS is used when a library moves from one directory to another,
e.g. /usr/lib/libc++.so.1 to /lib/libc++.so.1.
delete-old-files and delete-old-libs are two separate steps, so that
old libraries can be retained until third party software packages are
rebuilt or reinstalled.
Having two copies of the same shared library with the same so version
(as can happen when delete-old-libs hasn't been run) causes trouble.
The PR below gives one example.
Libraries listed in MOVED_LIBS are logically equivalent to updating a
library without changing the so version, and should be removed as soon
as possible. Handle them in list-old-files and thus delete-old-files.
Leave them also in *-old-libs for now, in case the user updates their
tree between running delete-old-files and delete-old-libs.
PR: 272642
Reviewed by: dim
Sponsored by: The FreeBSD Foundation
Co-authored-by: Dimitry Andric <[email protected]>
Differential Revision: https://reviews.freebsd.org/D42197
(cherry picked from commit 922337e8d3)
(cherry picked from commit 7309978590)
Approved by: re (karels)
This supports countries located across multiple continents, as per the
zone1970.tab file. This only affects Cyprus and Türkiye at the moment.
PR: 236874
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41306
(cherry picked from commit 914ab28c59)
(cherry picked from commit 9ef162b239)
Approved by: re (karels)
callout_stop() requires the associated lock to be held.
This is a bit hacky, but I believe it's safe since the subsequent
mrsas_cmd_done() call will also acquire the SIM lock to stop a different
callout.
Approved by: re (gjb)
PR: 265484
Reviewed by: imp
Tested by: Jérémie Jourdin <[email protected]>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39559
(cherry picked from commit 4640df1b0a)
(cherry picked from commit 29de7af6ee)
If VOP_READLINK returns a path that contains a NUL, it will trigger an
assertion in vfs_lookup. Sanitize such paths in fusefs, rejecting any
and warning the user about the misbehaving server.
PR: 274268
Sponsored by: Axcient
Approved by: gjb (re)
Reviewed by: mjg, markj
Differential Revision: https://reviews.freebsd.org/D42081
(cherry picked from commit 662ec2f781)
(cherry picked from commit 8fca98f688)
Notable upstream pull request merges:
#1529033d7c2d16 import: require force when cachefile hostid doesn't
match on-disk
#15319bcd010d3a Reduce number of metaslab preload taskq threads
#153391611b8e56 Add BTI landing pads to the AArch64 SHA2 assembly
#15340bc77a0c85 ARC: Remove b_cv from struct l1arc_buf_hdr
#153473158b5d71 ARC: Drop different size headers for crypto
#15350ba7797c8d ARC: Remove b_bufcnt/b_ebufcnt from ARC headers
#153539be8ddfb3 ZIL: Reduce maximum size of WR_COPIED to 7.5K
#153628495536f7 zfsconcepts: add description of block cloning
Obtained from: OpenZFS
OpenZFS commit: 2407f30bda
OpenZFS tag: zfs-2.2.0-rc5
Approved by: re (gjb)
(cherry picked from commit fdc38bc6cd)
Notable upstream pull request merges:
#15240e9dc31c74 Update the behavior of mountpoint property
#15240c53bc3837 Improve the handling of sharesmb,sharenfs properties
#152980ce1b2ca1 Invoke zdb by guid to avoid import errors
#153010aabd6b48 ZIL: Avoid dbuf_read() in ztest_get_data()
#15308 9e36c576f Don't allocate from new metaslabs
#15312229ca7d73 Fix ENOSPC for extended quota
#153213079bf2e6 Restrict short block cloning requests
#153228015e2ea6 Add '-u' - nomount flag for zfs set
#15324b34bf2d5f Tweak rebuild in-flight hard limit
#15331608741d06 Report ashift of L2ARC devices in zdb
#153330d870a177 Fix invalid pointer access in trace_dbuf.h
Obtained from: OpenZFS
OpenZFS commit: 8015e2ea66
Approved by: re (gjb)
(cherry picked from commit a21cb0234b)
The AX88179A has two firmware modes, one of which is backward
compatible with existing AX88178A/179 driver. The active firmware mode
can be controlled through a register.
Update axge(4) man page to mention 179A support and ensure that, when
bound to a AX88179A, the driver activates the compatible firmware mode.
Approved by: re (gjb)
Reviewed by: markj
Pull Request: https://github.com/freebsd/freebsd-src/pull/854
MFC after: 1 week
(cherry picked from commit 6962da914d)
(cherry picked from commit b973cdbb20)
'ncnegminpct' is to be passed always, so just drop the unneeded parameter.
Sponsored by: The FreeBSD Foundation
Reviewed by: mjg
Differential Revision: https://reviews.freebsd.org/D41763
(cherry picked from commit 02ef039c28)
(cherry picked from commit fc424de7e1)
Approved by: re (gjb)
Only vnlru ever updates them.
This also removes recycles_count updates from hand-rolled debug vnode
recycling via sysctl.
Sponsored by: Rubicon Communications, LLC ("Netgate")
(cherry picked from commit 37544d9768)
(cherry picked from commit bdd19ce53c)
Approved by: re (gjb)
The primary bottleneck *was* vnode_list mtx, which got artificially
worsened due to the following work done with the lock held:
1. the global heavily modified numvnodes counter was being read,
inducing massive cache line ping pong
2. should the value fit limits (which it normally did) there would be an
avoidable write to vn_alloc_cyclecount, which is being read outside
of the lock, once more inducing traffic
But if vn_alloc_cyclecount is 0, which it normally is even when facing
vnode shortage, there is no need to check numvnodes nor set it to 0 again.
Another problem was numvnodes adjustment (which made the locked read
much worse). While it fundamentally does not scale as it is not
distributed in any fashion, it was avoidably slow. When bumping over the
vnode limit, it would be modified with atomics 3 times: inc + dec to
backpedal in vn_alloc, then final inc in vn_alloc_hard.
One can let some slop persist over calls to vnlru_free instead.
In principle each thread in the system could get here and bump it, so a
limit is put in place to keep things sane.
Bench setup same as in prior commits: zfs, 20 separate directory trees
each with 1 million files in total and 20 find(1) processes stating them
in parallel (one per each tree).
Total run time (in seconds) goes down as follows:
vnode limit 8388608 400000
before ~20 ~35
after ~8 ~15
With this in place the primary bottleneck is now ZFS.
Sponsored by: Rubicon Communications, LLC ("Netgate")
(cherry picked from commit 054f45e026)
(cherry picked from commit cc2d62daa3)
Approved by: re (gjb)
Works around severe performance problems in certain corner cases, see
the commentary added.
Modifying vnlru logic has proven rather error prone in the past and a
release is near, thus take the easy way out and fix it without having to
dig into the current machinery.
(cherry picked from commit 90a008e94b)
(cherry picked from commit cfbc392761)
Approved by: re (gjb)
If the count is high enough there is no point trying to produce more.
Not going there reduces traffic on the vnode_list mtx.
This further shaves total real time in a test mentioned in:
74be676d87 ("vfs: drop one vnode list lock trip during vnlru free
recycle") -- 20 instances of find each creating 1 million vnodes, while
total limit is set to 400k.
Time goes down from ~41 to ~35 seconds.
Sponsored by: Rubicon Communications, LLC ("Netgate")
(cherry picked from commit 23ef25d25d)
(cherry picked from commit 5cf1c99d4c)
Approved by: re (gjb)
In face of vnode shortage the count very easily can go few units above
the limit before going back down.
Calling uma_reclaim results in massive amount of work which in this case
is not warranted.
Sponsored by: Rubicon Communications, LLC ("Netgate")
(cherry picked from commit 1bf55a739e)
(cherry picked from commit 9ff38b3d88)
Approved by: re (gjb)
If the total number of free vnodes is at or above target, there is no
point creating more of them.
Tested by: pho (in a bigger patch)
(cherry picked from commit 8733bc277a)
(cherry picked from commit 71a06765dc)
Approved by: re (gjb)
cache_zap_unlocked_bucket is called with a bunch of addresses and
without any locks held, forcing it to revalidate everything from
scratch.
It did not account for a case where the entry is reallocated with
everything the same except for the target vnode.
Should the target use a different lock than the one expected, freeing
would proceed without being properly synchronized.
Note this is almost impossible to happen in practice.
(cherry picked from commit 0f15054f79)
(cherry picked from commit b206bfb92c)
Approved by: re (gjb)
They are very rarely triggered, so no need for per-cpu distribution.
At the same time the non-cpu ones still should use atomics to not lose
any updates.
(cherry picked from commit 2749c222da)
(cherry picked from commit 75b03f73b4)
Approved by:re (gjb)
They demonstrate nothing, and in case of dotdot they are not even hits.
This is just a count of lookups with "..", which are not worth
mentioniong.
(cherry picked from commit bb124a0f61)
(cherry picked from commit 0cf6ebad73)
Approved by: re (gjb
It was not meant to be writable and writes don't work correctly as they
fail to resize the hash.
(cherry picked from commit 33fdf1afae)
(cherry picked from commit 3f4e6aa2ae)
Approved by: re (gjb)
Previously when printing the sysctl description (via the -d flag) we
omitted the newline if the node provided no description (i.e., NULL).
This could be observed via e.g. `sysctl -d dev`.
PR: 44034
Reviewed by: zlei
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42112
(cherry picked from commit 75be7e3027)
(cherry picked from commit ced9fe051e)
Approved by: re (gjb)
The man page had `kern.ktrace.geniosize` but the sysctl node contains an
underscore.
PR: 274274
Reported by: Ivan Rozhuk
Sponsored by: The FreeBSD Foundation
(cherry picked from commit a572dfa1bf)
(cherry picked from commit 2fe06dda0a)
Approved by: re (gjb)
svnliteversion was provided by the base system copy of subversion,
which was disabled in a2bc17474b ("Disable building svnlite(1) by
default.")
Reviewed by: zlei
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42034
(cherry picked from commit 826d144679)
(cherry picked from commit f6fa4749f7)
Approved by: re (gjb)
Files under /var/db/freebsd-update are required during the upgrade
process, and to support rollback. They may be deleted if no upgrade is
in progress and rollback will not be required.
PR: 273601
Reviewed by: bcr
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42022
(cherry picked from commit 30beebe444)
(cherry picked from commit ffe4456d7d)
Approved by: re (gjb)
OpenSSL 3.0.11 addresses:
POLY1305 MAC implementation corrupts XMM registers on Windows (CVE-2023-4807)
Relnotes: Yes
Pull request: https://github.com/freebsd/freebsd-src/pull/852
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 6f1af0d7d2)
(cherry picked from commit bbecb0ff6c)
Approved by: re (gjb)
Excerpts from the release notes:
Potentially incompatible changes
--------------------------------
* ssh-keygen(1): generate Ed25519 keys by default.
[NOTE: This change was already merged into FreeBSD.]
* sshd(8): the Subsystem directive now accurately preserves quoting of
subsystem commands and arguments.
New features
------------
* ssh(1): add keystroke timing obfuscation to the client.
* ssh(1), sshd(8): Introduce a transport-level ping facility.
* sshd(8): allow override of Sybsystem directives in sshd Match blocks.
Full release notes at https://www.openssh.com/txt/release-9.5
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
(cherry picked from commit edf8578117)
(cherry picked from commit b24ca3caa7)
Approved by: re (gjb)
This is an initial take on documenting vulnerability mitigations.
Connect mitigations(7) to the build
Also add some cross references.
Reviewed by: gbe (earlier)
Sponsored by: The FreeBSD Foundation
Co-authored-by: Olivier Certner <[email protected]>
Differential Revision: https://reviews.freebsd.org/D41794
(cherry picked from commit b6a61ac2d4)
(cherry picked from commit 6e5dcc6113)
(cherry picked from commit a2b289608d)
(cherry picked from commit 272bc4597d)
Approved by: re (gjb)
Applies only to bare-metal Zen2 processors. The system currently
automatically applies it to all of them.
Tunable/sysctl 'machdep.mitigations.zenbleed.enable' can be used to
forcibly enable or disable the mitigation at boot or run-time. Possible
values are:
0: Mitigation disabled
1: Mitigation enabled
2: Run the automatic determination.
Currently, value 2 is the default and has identical effect as value 1.
This might change in the future if we choose to take into account
microcode revisions in the automatic determination process.
The tunable/sysctl value is simply ignored on non-applicable CPU models,
which is useful to apply the same configuration on a set of machines
that do not all have Zen2 processors. Trying to set it to any integer
value not listed above is silently equivalent to setting it to value 2
(automatic determination).
The current mitigation state can be queried through sysctl
'machdep.mitigations.zenbleed.state', which returns "Not applicable",
"Mitigation enabled" or "Mitigation disabled". Note that this state is
not guaranteed to be accurate in case of intervening modifications of
the corresponding chicken bit directly via cpuctl(4) (this includes the
cpucontrol(8) utility). Resetting the desired policy through
'machdep.mitigations.zenbleed.enable' (possibly to its current value)
will reset the hardware state and ensure that the reported state is
again coherent with it.
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41817
(cherry picked from commit ebaea1bcd2)
(cherry picked from commit 6c59ac8c79)
Approved by: re (gjb)
They are a bit more informative than raw hexadecimal values.
While here, sort existing defines of bits for AMD MSRs to match the address
order.
Reviewed by: kib, emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41816
(cherry picked from commit 125bbadf60)
(cherry picked from commit d0c0dcf9db)
Approved by: re (gjb)
The inp_vflags field must be adjusted during the call of
in_pcbbind_setup(). This is consistent with the other places in the
code, but not elegant at all.
PR: 274009
Approved by: re (gjb)
Reported by: [email protected]
Reported by: [email protected]
Reviewed by: markj, rrs, rscheff
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D42031
(cherry picked from commit abca3ae773)
(cherry picked from commit 8209af15a6)
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
Approved by: re (delphij)
(cherry picked from commit 035f7c9a36)
(cherry picked from commit 7f9f152307)
The sysctl variable 'kern.kstack_pages' is actually a loader tunable.
Add sysctl flag CTLFLAG_TUN to it so that `sysctl -T` will report it
correctly.
No functional change intended.
Note that on arm64 the thread0 stack size can not be controlled with it,
kib@ suggested that arm64 maintainers can fix it eventually so let's
enable it also on arm64 right now.
Reviewed by: kib, imp
Approved by: re (gjb)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42113
(cherry picked from commit 35b3be81f1)
(cherry picked from commit 964a91aac9)
The sysctl variable 'vfs.unmapped_buf_allowed' is actually a loader
tunable. Add sysctl flag CTLFLAG_TUN to it so that `sysctl -T` will
report it correctly.
No functional change intended.
Reviewed by: kib, imp
Approved by: re (gjb)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42113
(cherry picked from commit 31b9406530)
(cherry picked from commit 8c4eaac153)
The sysctl variable 'kern.ipc.maxsockets' is actually a loader tunable.
Add sysctl flag CTLFLAG_TUN to it so that `sysctl -T` will report it
correctly.
No functional change intended.
Reviewed by: kib, imp
Approved by: re (gjb)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42113
(cherry picked from commit 978be1ee5d)
(cherry picked from commit e4f97a1ec7)
The following sysctl variables are actually loader tunables. Add sysctl
flag CTLFLAG_TUN to them so that `sysctl -T` will report them correctly.
1. kern.ipc.mb_use_ext_pgs
2. kern.ipc.nmbclusters
3. kern.ipc.nmbjumbop
4. kern.ipc.nmbjumbo9
5. kern.ipc.nmbjumbo16
6. kern.ipc.nmbufs
No functional change intended.
Reviewed by: kib, imp
Approved by: re (gjb)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42113
(cherry picked from commit 6a88498e53)
(cherry picked from commit b1456fd620)
The following sysctl variables are actually loader tunables. Add sysctl
flag CTLFLAG_TUN to them so that `sysctl -T` will report them correctly.
1. kern.maxfiles
2. kern.maxfilesperproc
No functional change intended.
Reviewed by: kib, imp
Approved by: re (gjb)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42113
(cherry picked from commit 2af5ce5b5e)
(cherry picked from commit d9aa723347)
The following sysctl variables are actually loader tunables. Add sysctl
flag CTLFLAG_TUN to them so that `sysctl -T` will report them correctly.
1. machdep.idle
2. machdep.idle_apl31
No functional change intended.
Reviewed by: kib, imp
Approved by: re (gjb)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42113
(cherry picked from commit 149b9c234b)
(cherry picked from commit 9eac775b41)
The sysctl variable 'vfs.nfs.iodmin' is actually a loader tunable. Add
sysctl flag CTLFLAG_TUN to it so that `sysctl -T` will report it
correctly.
No functional change intended.
Reviewed by: kib, imp
Approved by: re (gjb)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42113
(cherry picked from commit 95c01e9b32)
(cherry picked from commit 3133f4d9de)
The sysctl variable 'debug.ddb.capture.bufsize' is actually a loader
tunable. Add sysctl flag CTLFLAG_TUN to it so that `sysctl -T` will
report it correctly.
No functional change intended.
Reviewed by: kib, imp
Approved by: re (gjb)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42113
(cherry picked from commit 0eb2e19789)
(cherry picked from commit 0de3d5316c)
The sysctl variable 'kern.cam.scsi_delay' is actually a loader tunable.
Add sysctl flag CTLFLAG_TUN to it so that `sysctl -T` will report it
correctly.
No functional change intended.
Reviewed by: kib, imp (for #cam)
Approved by: re (gjb)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42113
(cherry picked from commit e2ad7ce37b)
(cherry picked from commit 4bf3810546)
fbt computes incorrect instruction position for AArch64 kernel module symbol.
The issue is with the for loop, it does an extra increment of instr pointer
after the required instruction is found. Hence, a wrong instruction is
targeted for patching.
Signed-off-by: Igor Ostapenko <[email protected]>
Approved by: re (gjb)
Fixes: 980746e5cb ("fbt: simplify arm64 function-prologue parsing")
Reviewed by: markj
Pull Request: https://github.com/freebsd/freebsd-src/pull/855
MFC after: 1 week
(cherry picked from commit b4db386f9f)
(cherry picked from commit 2ba605f32a)
Commit 3f686532c9 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.
Approved by: re (gjb)
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D41574
(cherry picked from commit 09b0401e91)
(cherry picked from commit 2709483a72)
The check for if_addrlen in dump_iface() is not sufficient to determine
if we still have a valid if_addr. Rather than directly accessing if_addr
check the STAILQ (for the first entry).
This avoids panics when destroying cloned interfaces as experienced with
net80211 wlan ones.
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
Reviewed by: jhibbits (earlier version), kp
Differential Revision: https://reviews.freebsd.org/D42027
(cherry picked from commit 7d48224073)
(cherry picked from commit 8bda9f9c56)
While the build-breaking changes were only in a smaller window
further updates restored some functionality as well. Now that
we are done, add iwlwifi back to the build.
Sponsored by: The FreeBSD Foundation
This also adds the (updated) rtw88 driver back to the build.
Functionality has not been tested (much) so might not currently
work but people offered to test.
Approved by: re (gjb)
(cherry picked from commit af6aaa9005)
(cherry picked from commit 299e2d5724)
(cherry picked from commit 7ec227367e)
Update the man pages for iwlwifi.4 and iwlwififw.4 to list the
current state of devices supported and which firmware they need.
The list is automatically generated based on a sysctl added to the
iwlwifi driver (so this is the driver's view). The reader should
not be surprised by the larger number of any/any/any/any entries
for PCI vendor and devices in the firmware table for which other
matching logic happens. The reader should also not be confused
about "TBD" (to be done) entries for chipsets which the driver
already supports but have no (public) product yet.
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
(cherry picked from commit 242f314842)
(cherry picked from commit e96f025905)
Firmware was obtained from linux-firmware at
dfa11466cf000120d1551146fd5bf78c44941eda.
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
(cherry picked from commit 027768a212)
(cherry picked from commit e504b5da3e)
This is a combined version of updates of the rtw88 driver based
on wireless-testing
(wt-2023-05-11) 711dca0ca3d77414f8f346e564e9c8640147f40d (after v6.4-rc1),
(wt-2023-06-09) 7bd20e011626ccc3ad53e57873452b1716fcfaaa (after v6.4-rc5),
(wt-2023-07-24) 62e409149b62a285e89018e49b2e115757fb9022 (after v6.5-rc3),
(wt-2023-08-06) 2a220a15be657a24868368892e3e2caba2115283 (after v6.5-rc4).
This update follows other currently disconnected LinuxKPI based wireless
drivers to lift them all to a same version in case someone else wants to
work on this driver in parallel to predominant iwlwifi efforts.
While debugging some funky register reads of 0xaeaea from RF_CFGCH
resulting in "rtw880: [TXGAPK] unknown channel 234!!" more of these
reads came to my attention hidden by using the register index rather
than the defined value. Make this more grep-able.
Approved by: re (gjb)
(cherry picked from commit 90aac0d83b)
(cherry picked from commit 4f3b2bba24)
(cherry picked from commit 8323f69b88)
Setup more link_conf/deflink fields for vif/sta as are needed to allow
us to work with the KPI bits in a non-MLO configuration.
In lkpi_sta_scan_to_auth() set the bss_conf values before calling into
the driver for chanctx setup/updates as certain values (e.g., beacon_int)
need to be set before; we still call the MO function for the updates
after to keep the expected workflow.
Deal with the (to be dealt with otherwise later) net80211 ni swaps and
update the addresses on the deflink as well as otherwise firmware will
hit asserts or things will not work (e.g. indicating the peer is us).
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
(cherry picked from commit 6ffb7bd469)
(cherry picked from commit c18ead9cb2)
Factor out ieee80211_chanctx_conf into struct lkpi_chanctx in order to
keep local state as well. In first instance that is added_to_drv
only. For now we stay single-chanctx only but this paves the path
to make it a list.
Use the new information to implement ieee80211_iter_chan_contexts_atomic().
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
(cherry picked from commit c5e2579850)
(cherry picked from commit b6628a233e)
Driven by net80211 we may call mac80211 ops stop() and start() mostly
when toggling a first VAP. While this is FreeBSD behaviour the firmware
based LinuxKPI drivers seem to possibly clear state in the case of stop()
triggering further errors down the line.
We call mo_start() when starting the VAP and mo_stop() when destroying
it now only. In the future (e.g., in multi-VAP setups) we may need to
re-address some of this so keep the code under #ifdef.
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
(cherry picked from commit 8d58a05786)
(cherry picked from commit 7537300876)
When adding a VAP (vif) initialize its tx queue parameters calling
mo_conf_tx().
I could not spot net80211 providing some of the values needed before
having a node so currrently we use hard-coded values with a comment
with a reference on how to properly calculate the values in the future
(e.g., in case of 11b or other cases).
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
(cherry picked from commit a6042e17c8)
(cherry picked from commit 68e1e25baf)
Two txq debug messages were left unconditionally. Hide them behind
ifdef/if() condition checks for selective debugging only.
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
(cherry picked from commit 0d2cb6a6ec)
(cherry picked from commit 5b9404565f)
Move the call to lkpi_disassoc() before the state change to
IEEE80211_STA_NOTEXIST which will remove the sta (from firmware).
Based on a comment it seems that originally we had to do it the
other way round.
iwlwifi(4) has a check and will silently not remove the sta from
the firmware when vif->cfg.assoc is still set (see iwl_mvm_sta_del()).
This leads to the LinuxKPI 802.11 code thinking the sta is gone as
downward state changes by the mac80211 op (*sta_state)() may not fail.
Once we try to assoc with a newly added station later, iwlwifi firmware
will run into an assert having two ap_sta set on the same vif.
We can observe that problem in iwlwifi(4) having __le32 sta_id = 1
instead of sta_id = 0 in iwl_mvm_sta_cfg_cmd{} on the HCMD.
This should fix one of the most seen problems with iwlwifi(4), e.g.,
when running service netif restart wlan0 or
service wpa_supplicant restart wlan0.
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
(cherry picked from commit 16e688b2a4)
(cherry picked from commit 4e26de2643)
This is a combined versions of updates of the iwlwifi driver based
on wireless-testing
(wt-2023-05-11) 711dca0ca3d77414f8f346e564e9c8640147f40d (after v6.4-rc1).
(wt-2023-06-09) 7bd20e011626ccc3ad53e57873452b1716fcfaaa (after v6.4-rc5).
(wt-2023-07-24) 62e409149b62a285e89018e49b2e115757fb9022 (after v6.5-rc3).
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
(cherry picked from commit 9af1bba44e)
(cherry picked from commit 12d5f2e719)
In [1] we updated the KPI for various mac80211 ops functions to deal
with MLD code. Newer iwlwifi driver and firmware supports these
functions so we need to pass non-dummy (0, NULL) arguments to them.
Start extending the internel MO functions by these arguments and
pass down values from LinuxKPI 802.11 code.
It is assumed that further work will be needed to have all the
right fields available to at least work in the lgeacy way of a
single link.
Sponsored by: The FreeBSD Foundation
Improves: 549198b1ab (update mac80211 KPI) [1]
Approved by: re (gjb)
(cherry picked from commit 6854154638)
(cherry picked from commit be5f1d2e71)
Disconnect iwlwifi/rtw88 from the build for a few commits which, due to
incompatible LinuxKPI 802.11 changes would break the build for a
revision. It will be re-enabled "instantly".
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
(cherry picked from commit 712468443d)
(cherry picked from commit b75d1ce6c1)
(cherry picked from commit b6fbec77eb)
With MLO and multi-link setups if avail we want to call link_info_changed
whereas for legacy drivers we still need to call bss_info_changed.
While we currently do not (yet) support multi-link configurations
we still need to drive the correct commands to satisfy firmware
requirements.
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
(cherry picked from commit 727f88f261)
(cherry picked from commit ad79da1b1a)
With past commits new structures were added. Now switch over some
bss_conf fields into vif->cfg where they got moved to and remove the
old fields. This allows drivers to find the expected values in the
now expected places and work better.
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
(cherry picked from commit 616e13301b)
(cherry picked from commit 8614ae463a)
Update ieee80211_request_smps() to the new number of arguments in
LinuxKPI (which was already prepared) and update the one call in the
older iwlwifi driver version.
This will allow iwlwifi as-is now and rtw88 to compile in case someone
else wants to work on the latter in parallel to predominant efforts on
the former.
Unconditionally enable the other changes for newer drivers, as needed by
iwlwifi (and others).
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
(cherry picked from commit 815b7436a7)
(cherry picked from commit 3e1f5cc9a8)
(cherry picked from commit 82782cffea)
Start implementing regulatory_hint() using a .c file based allocation
helper function so we could change structures in the future with
better chances to keep compatibility.
This sets wiphy->regd needed by various LinuxKPI based WiFi drivers.
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
(cherry picked from commit 673d62fc35)
(cherry picked from commit a3e10c2b14)
tid_to_mac80211_ac is an exported symbol in and likely based on iwlwifi,
which leads to a symbol clash in NetBSD. Rename our local LinuxKPI copy
to a better name and add a comment where to find a copy of the mapping
table.
Sponsored by: The FreeBSD Foundation
Reported by: Phil Nelson (phil netbsd org)
Approved by: re (gjb)
(cherry picked from commit fb3c249ed9)
(cherry picked from commit 70e2b1f49c)
Rather than always comparing a given SSID to the first SSID of the
IE list, compare it to the the iterator one. That way duplicates can
be found.
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
(cherry picked from commit ee7077f24f)
(cherry picked from commit a513f65b92)
While the main purpose was to assign an(y) early chandef with the
loop, later additions made use of it to also count supbands as well
as to initialise max_rates.
Due to the main goal we can exit the loop early and not properly
count and initialise supbands and max_rates.
Move the terminating condition into the loop and make it a continue
rather than ending the loop.
Fixes: d9945d7821 ("improve hw_scan")
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
(cherry picked from commit f454a4a10d)
(cherry picked from commit 96655d8a7d)
We have multiple problems with scanning currently, one being that
an initial scan restarts itself and we are unable to start another
scan. wpa_supplicant in that case never shows scan results.
Starting wpa_cli you may see: <3>CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
messages.
Add two extra calls to ieee80211_notify_scan_done() at the end of scans
(before possible restarts). That will get wpa_supplicant to get
scan results and possibly start associating to a BSSID and get us out
of scan. This is kind-of a bandaid but on short notice may help to
improve the situation for some.
Based on analysis by: enweiwu
Submitted by: enweiwu (initial version)
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
Tested by: cy, (others I cannot find email/PR for anymore)
Reviewed by: cy
Differential Revision: https://reviews.freebsd.org/D38661
(cherry picked from commit 3f382eb23b)
(cherry picked from commit 6104a9f9c5)
Changing the order of cleanup in lkpi_ic_vap_delete() will avoid
firmware crashes or a direct panic as observed as ieee80211_vap_detach()
will do most cleanup for us and get us into the correct state.
Calling mo_stop() in lkpi_ic_vap_delete() seems to stop the problem
that further VAPs could not be created (error 17) after the first one
being destroyed.
Sponsored by: The FreeBSD Foundation
PR: 269842
Approved by: re (gjb)
(cherry picked from commit dbf7691999)
(cherry picked from commit 6c38c6b1b9)
(cherry picked from commit 53ef38313a)
It seems the mac_header can be set to offset 0 for frames received.
Remove the warning splattering messages to the console for each packet.
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
(cherry picked from commit f0e59b6903)
(cherry picked from commit 46e5d2b0c6)
In b0f7376822 we added bssid[] to struct cfg80211_scan_request
likely while working on mt76 and did not need it (yet) back then.
iwlwifi started to use the field in Linux f1fec51cda70f (April 2023).
Without it set firmware crashes when trying to send probe requests
((empty) SSID also given to hw_scan).
For now always set the field to the wildcard BSSID.
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
(cherry picked from commit e1e90be050)
(cherry picked from commit 204fb7d853)
We may fail to match if the specific interface doesn't exist or was
renamed.
Approved by: re (gjb)
PR: 273715
Reported by: grembo
MFC after: 1 week
(cherry picked from commit d94d07d581)
(cherry picked from commit d08ef6f7da)
When we disable swapping to a device, we scan the full VM object list
looking for objects with swap trie nodes that reference the device in
question. The pages corresponding to those nodes are paged in.
While paging in, we drop the VM object lock. Moreover, we do not hold a
reference for the object; swap_pager_swapoff_object() merely bumps the
paging-in-progress counter. vm_object_terminate() waits for this
counter to drain before proceeding and freeing pages.
However, swap_pager_swapoff_object() decrements the counter before
re-acquiring the VM object lock, which means that vm_object_terminate()
can race to acquire the lock and free the pages. Then,
swap_pager_swapoff_object() ends up unbusying a freed page. Fix the
problem by acquiring the lock before waking up sleepers.
Approved by: re (gjb)
PR: 273610
Reported by: Graham Perrin <[email protected]>
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42029
(cherry picked from commit e61568aeee)
(cherry picked from commit aa229a59ad)
When running nvme passthrough commands through the ioctl interface
memory is mapped with vmapbuf() but not unmapped. This results in leaked
memory whenever a process executes an nvme passthrough command with a
data buffer. This can be replicated with a simple c function (error
checks skipped for brevity):
void leak_memory(int nvme_ns_fd, uint16_t nblocks) {
struct nvme_pt_command pt = {
.cmd = {
.opc = NVME_OPC_READ,
.cdw12 = nblocks - 1,
},
.len = nblocks * 512, // Assumes devices with 512 byte lba
.is_read = 1, // Reads and writes should both trigger leak
}
void *buf;
posix_memalign(&buf, nblocks * 512);
pt.buf = buf;
ioctl(nvme_ns_fd, NVME_PASSTHROUGH_COMMAND, &pt);
free(buf);
}
Signed-off-by: David Sloan <[email protected]>
Approved by: re (gjb)
PR: 273626
Reviewed by: imp, markj
MFC after: 1 week
(cherry picked from commit 7ea866eb14)
(cherry picked from commit 510404f2f4)
If we're evaluating a pfsync'd state (and have different rules on both
ends) our state may point to the default rule, which does not have
rpool.cur set. As a result we can end up dereferencing a NULL pointer.
Explicitly check for this when we try to re-construct the route-to interface.
Also add a test case which can trigger this issue.
MFC after: 3 days
See also: https://redmine.pfsense.org/issues/14804
Sponsored by: Rubicon Communications, LLC ("Netgate")
Approved by: gjb (re)
(cherry picked from commit 74c2461386)
(cherry picked from commit f69181e9de)
This structure should have the same size across different FreeBSD
versions to ensure backwards-compatibility. It has since stable/6. But
two recent changes added fields without compensating by reducing
padding:
945f9a7cc9 and
22c81cc516 . Reduce padding to
compensate.
Direct commit to stable/14 because we decided to break compatibility in
FreeBSD 15 in order to add more fields. Of course, that decision could
be reversed before 15.0-RELEASE. See the review for details.
PR: 273902
Reviewed by: tuexen, glebius
Differential Revision: https://reviews.freebsd.org/D41894
Approved by: gjb (re)
(cherry picked from commit 2209676efe)
Known issues:
1. The ec2-user user is created with a homedir of /usr/home/ec2-user
instead of /home/ec2-user; this appears to be a bug in cloud-init's
FreeBSD support.
2. Cloud-init configures IPv4 networking but not IPv6 networking.
Approved by: re (gjb)
Relnotes: yes
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D41793
(cherry picked from commit 1f4ce7a39f)
(cherry picked from commit d9243c1ab3)
Using the recently-added "cloudware flavours" mechanism, turn the
existing EC2 AMIs into a new "base" flavour. The only user-visible
change is that AMI names now include the word "base".
Approved by: re (gjb)
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D41791
(cherry picked from commit 7494fb6b7d)
(cherry picked from commit a18905a9bf)
There are two "Vagrant" images right now: "Vagrant Image for VirtualBox"
and "Vagrant Image for VMWare". Rather than listing these separately in
a CLOUDWARE list, place "VAGRANT" into a CLOUDWARE_TYPES list and then
use a VAGRANT_FLAVOURS variable to identify the two versions. Add make
logic to allow defaults (in this case, image format and filesystem) to
be specified once for VAGRANT and inherited by both flavours.
This will make future work to add flavoured EC2 images simpler.
Approved by: re (gjb)
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D41790
(cherry picked from commit e6eeac9b71)
(cherry picked from commit fec4f6a7c3)
The cw*-package targets were introduced in February 2015 as part of
adding support for building GCE images; but GCE support was reworked
in June 2015 and the cw*-package targets were in fact never used.
Remove them.
The *_DISK variables were introduced in February 2015 as part of
adding the cloudware-install target; this was removed in May 2016 as
the cloudware images are published via the respective cloud systems
and not published as disk images via the FreeBSD FTP site. As such,
the *_DISK variables are not unused; remove them.
Approved by: re (gjb)
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D41789
(cherry picked from commit fcbeeb5ff4)
(cherry picked from commit b9013d75c8)
We no longer install a default portsnap.conf, so the sed invocation just
generates an error.
Reviewed by: cperciva
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D42003
(cherry picked from commit 63aa2e9134)
(cherry picked from commit 1cc968931b)
Before certctl(8), there was no system trust store, and libfetch
relied on the CA certificate bundle from the ca_root_nss port to
verify peers.
We now have a system trust store and a reliable mechanism for
manipulating it (to explicitly add, remove, or revoke certificates),
but if ca_root_nss is installed, libfetch will still prefer that to
the system trust store.
With this change, unless explicitly overridden, libfetch will rely on
OpenSSL to pick up the default system trust store.
PR: 256902
MFC after: 3 days
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D42059
Approved by: re (gjb)
(cherry picked from commit 09f5c1e118)
(cherry picked from commit fb058a9a40)
When copying a file's contents into the pool, a loop copies blocks of
the maximum size (128KB), allocating space from the vdev for each block.
The space allocator rounds up to the nearest block size, but for files
larger than the maximum size, this can result in the last block having a
smaller logical size than the rest of the blocks belonging to that
dnode. This violates some ZFS invariants when appending to that file.
Modify fs_populate_file() to use the same block size for the final
block.
Approved by: re (gjb)
Reported by: cperciva
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
(cherry picked from commit ef20cd33d3)
(cherry picked from commit 5175923ef4)
When populating files, makefs needs to copy their contents into
userspace in order to compute a checksum, so copy_file_range(2) is out
of the question. Though, it could possibly be used when building other
types of filesystems.
Approved by: re (gjb)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 60c95af88f)
(cherry picked from commit 0074d0551d)
It is supposed to contain the number of objects allocated from the set,
excluding the meta dnode.
Approved by: re (gjb)
Reported by: mav
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 46402fd216)
(cherry picked from commit ea5173e572)
hdac_attach() registers an interrupt handler before allocating various
driver resources which are accessed by the interrupt handler. On some
platforms we observe what appear to be spurious interrupts upon a cold
boot, resulting in panics.
Partially work around the problem by deferring irq allocation until
after other resources are allocated. I think this is not a complete
solution, but is correct and sufficient to work around the problems
reported in the PR.
Approved by: re (gjb)
PR: 268393
Tested by: Alexander Sherikov <[email protected]>
Tested by: Oleh Hushchenkov <[email protected]>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41883
(cherry picked from commit 015daf5221)
(cherry picked from commit 1e8737f4e8)
Running the test suite yields:
lock order reversal:
1st 0xfffff80004bc6700 unp (unp, sleep mutex) @ sys/kern/uipc_usrreq.c:390
2nd 0xffffffff81a94b30 unp_link_rwlock (unp_link_rwlock, rw) @ sys/kern/uipc_usrreq.c:2934
lock order unp -> unp_link_rwlock attempted at:
0xffffffff80bc216e at witness_checkorder+0xbbe
0xffffffff80b493a5 at _rw_wlock_cookie+0x65
0xffffffff80c0a8e2 at unp_discard+0x22
0xffffffff80c0a888 at unp_freerights+0x38
0xffffffff80c09fdd at unp_scan+0x9d
0xffffffff80c0f9a7 at uipc_sosend_dgram+0x727
0xffffffff80c00a79 at sousrsend+0x79
0xffffffff80c072d0 at kern_sendit+0x1c0
0xffffffff80c074d7 at sendit+0xb7
0xffffffff80c076f3 at sys_sendmsg+0x63
0xffffffff8104d957 at amd64_syscall+0x6b7
0xffffffff8101f9eb at fast_syscall_common+0xf8
This happens when uipc_sosend_dgram() discards a control message because
the receive socket buffer is full. The overflow handling frees
internalized file references in the socket buffer before freeing mbufs.
It does this with socket PCBs locked, leading to the LOR. Defer
handling of file references until the PCBs are unlocked.
Approved by: re (gjb)
Reviewed by: glebius
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41884
(cherry picked from commit 61a14ddfe0)
(cherry picked from commit 20c494a9d3)
When using cached attributes, we must update a file's atime during
close, if it has been read since the last attribute refresh. But,
* Don't update atime if we lack write permissions to the file or if the
file system is readonly.
* If the daemon fails our atime update request for any reason, don't
report this as a failure for VOP_CLOSE.
PR: 270749
Reported by: Jamie Landeg-Jones <[email protected]>
Sponsored by: Axcient
Reviewed by: pfg
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D41925
(cherry picked from commit fb619c94c6)
fusefs: fix unused variables from fb619c94c6
PR: 270749
Reported by: cy
Sponsored by: Axcient
Approved by: re (gjb)
(cherry picked from commit e5236d25f2)
(cherry picked from commit 13f188ce0b)
The sysctl variable `net.inet.ipf.large_nat` is actually a loader
tunable. Add sysctl flag CTLFLAG_TUN to it so that `sysctl -T` will
report it correctly.
No functional change intended.
Reviewed by: cy (for #network)
Approved by: re (gjb)
Fixes: a805ffbcbc ipfilter: Make LARGE_NAT a tunable
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42005
(cherry picked from commit ba883e7a5a)
(cherry picked from commit a9359dcde2)
The loader tunable `net.inet.ip.mfchashsize` does not have corresponding
sysctl MIB entry. Just add it.
While here, the sysctl variable `net.inet.pim.squelch_wholepkt` is actually
a loader tunable. Add sysctl flag CTLFLAG_TUN to it so that `sysctl -T`
will report it correctly.
Reviewed by: kp
Approved by: re (gjb)
Fixes: 443fc3176d Introduce a number of changes to the MROUTING code
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D41997
(cherry picked from commit f549e22901)
(cherry picked from commit b0f026435a)
Move the descriptions of loader tunables from section 'SYSCTL VARIABLES'
to section 'LOADER TUNABLES'.
See also 49197c391b (ipfw: Add sysctl flag CTLFLAG_TUN to loader tunables).
MFC after: 2 days
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D41981
(cherry picked from commit 12349f3889)
(cherry picked from commit bb6f9a9540)
The following sysctl variables are actually loader tunables. Add sysctl
flag CTLFLAG_TUN to them so that `sysctl -T` will report them correctly.
1. net.inet.ip.fw.enable
2. net.inet6.ip6.fw.enable
3. net.link.ether.ipfw
No functional change intended.
Reviewed by: glebius
Approved by: re (gjb)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D41928
(cherry picked from commit 49197c391b)
(cherry picked from commit f5f6da9059)
The following sysctl variables are actually loader tunables. Add sysctl
flag CTLFLAG_TUN to them so that `sysctl -T` will report them correctly.
1. net.inet6.ip6.auto_linklocal
2. net.inet6.ip6.accept_rtadv
3. net.inet6.ip6.no_radr
No functional change intended.
Reviewed by: glebius
Approved by: re (gjb)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D41928
(cherry picked from commit 03dac3e379)
(cherry picked from commit da2b630c12)
The sysctl variable `net.route.netisr_maxqlen` is actually a loader
tunable. Add sysctl flag CTLFLAG_TUN to it so that `sysctl -T` will
report it correctly.
No functional change intended.
Reviewed by: glebius
Approved by: re (gjb)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D41928
(cherry picked from commit 21a722d959)
(cherry picked from commit bffb01eda9)
Since 13.1, /etc/rc.d/jail has looked for a per-jail config file in
/etc/jail.conf.d. For RELENG 14, the ".include" directive was added to
jail(8), with a sample line in the jail.conf(5) man page that includes
"/etc/jail.conf.d/*.conf".
These two use cases don't work together. When the jail.conf.d files
are included from a master jail.conf, the files in jail.conf.d are
likely to hold only partial configurations, and shouldn't be directly
loaded by rc.d/jail. But there are existing configurations that depend
on the current rc.d behavior. While users could be advised not to
include from /etc/jail.conf.d, it's the natural choice even if not
mentioned in jail.conf.5.
The workaround is for rc.d/jail to continue to load the individual
files, but only when /etc/jail.conf doesn't include from that
directory (via a simple grep test), This allows the current use
while not breaking the previous use.
Approved by: re (gjb)
Reported by: antranigv at freebsd.am
Differential Revision: https://reviews.freebsd.org/D41962
(cherry picked from commit a2440348ee)
(cherry picked from commit c96d5c97bb)
When using copy_file_range(2) with an offset parameter,
the CAP_SEEK capability should be required.
This requirement is similar to the behavior observed with
pread(2)/pwrite(2).
Reported by: theraven
Reviewed by: emaste, theraven, kib, markj
Approved by: secteam
Differential Revision: https://reviews.freebsd.org/D41967
(cherry picked from commit 15a51d3aba)
(cherry picked from commit 87d68b131e)
Approved by: re (gjb)
Upgrading from FreeBSD 13.2 to 14.0 failed with
install: ///usr/include/c++/v1/__string exists but is not a directory
because __string changed from a file to a directory with an LLVM
upgrade.
Now, remove the existing file when the type conflicts. Note that this
is only an interim fix to facilitate upgrades from 13.2 for 14.0 BETA
testing. This change does not handle the directory -> file case and
further work is needed.
PR: 273661
Reviewed by: dim, gordon
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41893
(cherry picked from commit f6d37c9ca1)
(cherry picked from commit bc41221564)
Approved by: re (gjb)
arp(8) has traditionally supported filtering by interface via -i and
by hostname. However, this functionality was omitted from the initial
netlink-ification of arp. This patch re-introduces this filtering
functionality.
This patch also improves by-interface filtering by storing and using the
ifindex of the requested interface for filtering instead of comparing
interface name strings
Reviewed by: melifaro
Sponsored by: Rubicon Communications, LLC ("Netgate")
Approved by: re (gjb)
(cherry picked from commit 79278872ad)
(cherry picked from commit f21f0d2e16)
- cast GETNEXT to unsigned where it is being promoted to int to prevent
sign-extension (really it would have been better for PEEK*() and
GETNEXT() to return unsigned char; this would have removed a ton of
(uch) casts, but it is too intrusive for now).
- fix an isalpha that should have been iswalpha
PR: 264275, 274032
Reviewed by: kevans, eugen (previous version)
Approved by: re (gjb)
Obtained from: NetBSD
(cherry picked from commit 3fb80f1476)
(cherry picked from commit 56b09feb23)
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
(cherry picked from commit fb5daae920)
(cherry picked from commit 8bcf9a87c7)
Approved-by: re (gjb)
Use the correct endian switching function when switching to a little
endian 64-bit address. Even on a little-endian machine this will
truncate the address to a 32-bit value.
Approved by: re (gjb)
Sponsored by: Arm Ltd
(cherry picked from commit 4386935191)
(cherry picked from commit 5df4deb384)
Some arm64 errata depend on calling into the firmware via the SMCCC
interface. This needs to happen after the psci driver has attached
as they share the interface.
Fix this by allowing the workarounds to mark when they depend on
device drivers attaching.
This is only an issue on CPU 0 as the workarounds are applied later
for the non-boot CPUs.
Approved by: re (gjb)
Reviewed by: emaste
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D41916
(cherry picked from commit c643e82dba)
(cherry picked from commit 843bea1871)
(cherry picked from commit caf7bc5356)
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
(cherry picked from commit 918966a274)
(cherry picked from commit 27d567847b)
Approved-by: re (cperciva)
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
(cherry picked from commit a1f506156c)
(cherry picked from commit d00e6d8774)
Approved-by: re (cperciva)
There was no good reason to use the former. This should prevent some
head-scratching by an interested and qualified reader.
(cherry picked from commit f4296cfb40)
(cherry picked from commit a87dddf39e)
Approved-by: re (cperciva)
While here dodge list locking in timerfd_adjust if empty.
(cherry picked from commit 5eab523053)
Approved by: re (cperciva@)
(cherry picked from commit fc0c24482f)
Approved-by: re (cperciva)
timerfd01 from ltp passes (and some other don't), but none of the tests
crash the kernel.
This is a bare minimum patch to fix up the immediate regression.
Reported by: yasu
(cherry picked from commit 02f534b57f)
Approved by: re (cperciva@)
(cherry picked from commit 8c496b2664)
Approved-by: re (cperciva)
When we're suspending, we get messages about waiting for the controller
to reset. These are in error: we're not waiting for it to reset. We put
the recovery state as part of suspending, so we should suppress these as
a false positive.
Also remove a stray debug that's left over from earlier versions of
the recovery code that no longer makes sense.
Sponsored by: Netflix
(cherry picked from commit 1d6021cd72)
(cherry picked from commit 3cd49bc5b3)
Approved-by: re (cperciva)
Currently, when we suspend, we need to tear down all the qpairs. We call
nvme_admin_qpair_abort_aers with the admin qpair lock held, but the
tracker it will call for the pending AER also locks it (recursively)
hitting an assert. This routine is called without the qpair lock held
when we destroy the device entirely in a number of places. Add an assert
to this effect and drop the qpair lock before calling it.
nvme_admin_qpair_abort_aers then locks the qpair lock to traverse the
list, dropping it around calls to nvme_qpair_complete_tracker, and
restarting the list scan after picking it back up.
Note: If interrupts are still running, there's a tiny window for these
AERs: If one fires just an instant after we manually complete it, then
we'll be fine: we set the state of the queue to 'waiting' and we ignore
interrupts while 'waiting'. We know we'll destroy all the queue state
with these pending interrupts before looking at them again and we know
all the TRs will have been completed or rescheduled. So either way we're
covered.
Also, tidy up the failure case as well: failing a queue is a superset of
disabling it, so no need to call disable first. This solves solves some
locking issues with recursion since we don't need to recurse.. Set the
qpair state of failed queues to RECOVERY_FAILED and stop scheduling the
watchdog. Assert we're not failed when we're enabling a qpair, since
failure currently is one-way. Make failure a little less verbose.
Next, kill the pre/post reset stuff. It's completely bogus since we
disable the qparis, we don't need to also hold the lock through the
reset: disabling will cause the ISR to return early. This keeps us from
recursing on the recovery lock when resuming. We only need the recovery
lock to avoid a specific race between the timer and the ISR.
Finally, kill NVME_RESET_2X. It'S been a major release since we put it
in and nobody has used it as far as I can tell. And it was a motivator
for the pre/post uglification.
These are all interrelated, so need to be done at the same time.
Sponsored by: Netflix
Reviewed by: jhb
Tested by: jhb (made sure suspend / resume worked)
MFC After: 3 days
Differential Revision: https://reviews.freebsd.org/D41866
(cherry picked from commit da8324a925)
(cherry picked from commit 81b118e842)
Approved-by: re (cperciva)
Normally, we poll the device every so often to see if commands have
timed out. However, we'll go into the recovery state as part of failing
the drive. To account for all possibilties, if we're failed when we get
into the polling function, just stop polling: Party is over.
Sponsored by: Netflix
(cherry picked from commit d95431624f)
(cherry picked from commit 5e9b7d0e0e)
Approved-by: re (cperciva)
Add a basically uncontended spinlock that we take out while the ISR is
running. This has two effects: First, when we get a timeout, we can
safely call the nvme_qpair_process_completions w/o racing any ISRs.
Second, we can use it to ensure that we don't reset the card while
the ISRs are active (right now we just sleep and hope for the best,
which usually is fine, but not always).
Sponsored by: Netflix
MFC After: 2 weeks
Reviewed by: chuck, gallatin
Differential Revision: https://reviews.freebsd.org/D41452
(cherry picked from commit 8052b01e7e)
(cherry picked from commit c7cb2dcdf2)
Approved-by: re (cperciva)
Next phase of error recovery: Eliminate the REOVERY_START phase, since
we don't need to wait to start recovery. Eliminate the RECOVERY_RESET
phase since it is transient, we now transition from RECOVERY_NORMAL into
RECOVERY_WAITING.
In normal mode, read the status of the controller. If it is in failed
state, or appears to be hot-plugged, jump directly to reset which will
sort out the proper things to do. This will cause all pending I/O to
complete with an abort status before the reset.
When in the NORMAL state, call the interrupt handler. This will complete
all pending transactions when interrupts are broken or temporarily
misbehaving. We then check all the pending completions for timeouts. If
we have abort enabled, then we'll send an abort. Otherwise we'll assume
the controller is wedged and needs a reset. By calling the interrupt
handler here, we'll avoid an issue with the current code where we
transitioned to RECOVERY_START which prevented any completions from
happening. Now completions happen. In addition and follow-on I/O that is
scheduled in the completion routines will be submitted, rather than
queued, because the recovery state is correct. This also fixes a problem
where I/O would timeout, but never complete, leading to hung I/O.
Resetting remains the same as before, just when we chose to reset has
changed.
A nice side effect of these changes is that we now do I/O when
interrupts to the card are totally broken. Followon commits will improve
the error reporting and logging when this happens. Performance will be
aweful, but will at least be minimally functional.
There is a small race when we're checking the completions if interrupts
are working, but this is handled in a future commit.
Sponsored by: Netflix
MFC After: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36922
(cherry picked from commit d4959bfcd1)
(cherry picked from commit 5d627e0669)
Approved-by: re (cperciva)
When we went to having a shared timeout routine, failing the timed-out
transaction code was inadvertantly dropped. Reinstate it.
Fixes: 502dc84a8b
Sponsored by: Netflix
MFC After: 2 weeks
Reviewed by: chuck, jhb
Differential Revision: https://reviews.freebsd.org/D36921
(cherry picked from commit 2a6b7055a9)
(cherry picked from commit a276199fef)
Approved-by: re (cperciva)
New features
- Add sysctl "link_active_on_if_down" (defaults to 1 to match previous
behavior): set this to 0 to have the driver bring the physical link down when
the interface is brought administratively down
- Add sysctl "temp" to read chip temperature on E810 devices; this requires a
4.30 or newer NVM (see package sysutils/intel-nvmupdate-100g)
Bug fixes and general changes
- (linked to irdma) properly propagate PF reset request from irdma driver
- (linked to irdma) properly notify irdma of an impending PF reset
- (linked to irdma) move Protocol Engine error handling to irdma
- Print log message when using a DDP that doesn't support the "TX balancing"
mode
- Block LLDP agent configuration when DSCP QoS mode is enabled
- Fix kernel panic when updating NVM when adapter is in the "TX balancing" mode
- Remove ice_sbq_cmd.h since it's unused
- Fix LLDP RX filter to still allow LLDP frames to be received by SW after a PF
reset in SW LLDP mode
- Add ice_if_needs_restart handler in order to fix a bad VLAN and link down
interaction
- Issue PF reset during unload
- nvmupdate process fixes
- Use pci_msix_table_bar() to get MSI-X bar index at runtime instead of hardcoding it
Signed-off-by: Eric Joyner <[email protected]>
Reviewed by: [email protected]
Approved by: re (cperciva)
Sponsored by: Intel Corporation, NetApp
Differential Revision: https://reviews.freebsd.org/D41655
(cherry picked from commit 9c30461dd2)
(cherry picked from commit 6a196646cd)
Removing artificial completion generator as there had been no indication
of the code being required for E810 cards. Further more it was found
that the code may have unpleasant side effects on user experience when
using ucmatose tool.
Signed-off-by: Bartosz Sobczak <[email protected]>
Signed-off-by: Eric Joyner <[email protected]>
Reviewed by: erj@
Approved by: re (cperciva)
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D41593
(cherry picked from commit ffafa6a4d1)
(cherry picked from commit 4e80493a33)
It was found through testing that when ULP uses individual vnet, the
search for the correct vlan_id may failing because of no proper
interface with given address.
The solution is to use vnet associated to the connection whenever
possible.
Signed-off-by: Bartosz Sobczak <[email protected]>
Signed-off-by: Eric Joyner <[email protected]>
Reviewed by: erj@
Approved by: re (cperciva)
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D41592
(cherry picked from commit bc3a013ccd)
(cherry picked from commit cc1abdc6ab)
This is intended to be used with the upcoming updated ice(4) version
1.38.16-k.
Signed-off-by: Eric Joyner <[email protected]>
Approved by: re (cperciva)
Sponsored by: Intel Corporation
(cherry picked from commit e04c4b4a36)
(cherry picked from commit 65d0d78073)
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.
Approved by: re (gjb)
Reviewed by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D41722
(cherry picked from commit 8527bb2aee)
(cherry picked from commit 49c1b35339)
Socket state may have changed after dropping the receive
buffer lock in order to call pr_rcvd(). If the buffer is
empty, re-check the state after reaquiring the lock and
skip calling sbwait() if the socket is in error or the
peer has closed.
Approved by: re (gjb)
PR: 212716
Reviewed by: markj, glebius
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41783
(cherry picked from commit f44102411e)
(cherry picked from commit caaea45577)
Background:
The pm_ev field of struct pmc_op_pmcallocate and struct pmc
traditionally contains the index of the chosen event, corresponding to
the __PMC_EVENTS array in pmc_events.h. This is a static list of events,
maintained by FreeBSD.
In the usual case, libpmc translates the user supplied event name
(string) into the pm_ev index, which is passed as an argument to the
allocation syscall. On the kernel side, the allocation method for the
relevant hwpmc class translates the given index into the event code that
will be written to an event selection register.
In 2018, a new source of performance event definitions was introduced:
the pmu-events json files, which are maintained by the Linux kernel. The
result was better coverage for newer Intel processors with a reduced
maintenance burden for libpmc/hwpmc. Intel and AMD CPUs were
unconditionally switched to allocate events from pmu-events instead of
the traditional scheme (959826ca1b, 81eb4dcf9e).
Under the pmu-events scheme, the pm_ev field contains an index
corresponding to the selected event from the pmu-events table, something
which the kernel has no knowledge of. The configuration for the
performance counting registers is instead passed via class-dependent
fields (struct pmc_md_op_pmcallocate).
In 2021 I changed the allocation logic so that it would attempt to
pull from the pmu-events table first, and fall-back to the traditional
method (dfb4fb4116). Later, pmu-events support for arm64 and power8
CPUs was added (28dd6730a5 and b48a2770d4).
The problem that remains is that the pm_ev field is overloaded, without
a definitive way to determine whether the event allocation came from the
pmu-events table or FreeBSD's statically-defined PMC events. This
resulted in a recent fix, 21f7397a61.
Change:
To disambiguate these two supported but separate use-cases, add a new
flag, PMC_F_EV_PMU, to be set as part of the allocation, indicating that
the event index came from pmu-events.
This is useful in two ways:
1. On the kernel side, we can validate the syscall arguments better.
Some classes support only the traditional event scheme (e.g.
hwpmc_armv7), while others support only the pmu-events method (e.g.
hwpmc_core for Intel). We can now check for this. The hwpmc_arm64
class supports both methods, so the new flag supersedes the existing
MD flag, PM_MD_EVENT_RAW.
2. The flag will be tracked in struct pmc for the duration of its
lifetime, meaning it is communicated back to userspace. This allows
libpmc to perform the reverse index-to-event-name translation
without speculating about the meaning of the index value.
Adding the flag is a backwards-incompatible ABI change. We recently
bumped the major version of the hwpmc module, so this breakage is
acceptable.
Reviewed by: jkoshy
Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40753
(cherry picked from commit c190fb35f3)
(cherry picked from commit 5adb91c729)
Have it call the platform-dependent version. For better layering, move
the reset logic inside the new function. This is mainly to facilitate an
upcoming change.
Reviewed by: jkoshy
Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40752
(cherry picked from commit 45dcc17e2f)
(cherry picked from commit 196bb0e152)
Factoring out this code unfortunately introduced reference and lock leaks in
case of failure in the lock upgrade path under VV_CROSSLOCK. In terms of
practical use, this impacts unionfs (and nullfs in a corner case).
Fixes: 80bd5ef070 ("vfs: factor out mount point traversal to a dedicated routine")
MFC after: 3 days
MFC to: stable/14 releng/14.0
Sponsored by: The FreeBSD Foundation
Reviewed by: mjg
[mjg: massaged the commit message a little bit]
Differential Revision: https://reviews.freebsd.org/D41731
Approved by: re (gjb)
(cherry picked from commit 02cbc029da)
(cherry picked from commit c76dfb929e)
Instead of having things scattered through vfs, debug and kern trees.
Old names remain for compatibility.
Sample output of "sysctl vfs.vnode":
vfs.vnode.vnlru.failed_runs: 0
vfs.vnode.vnlru.recycles_free: 0
vfs.vnode.vnlru.recycles: 0
vfs.vnode.stats.alloc_sleeps: 0
vfs.vnode.stats.free: 1310
vfs.vnode.stats.skipped_requeues: 0
vfs.vnode.stats.created: 1686
vfs.vnode.stats.count: 1641
vfs.vnode.param.wantfree: 2097152
vfs.vnode.param.limit: 8388608
Approved by: re (gjb)
(cherry picked from commit d3e6478912)
(cherry picked from commit b757ea2bb2)
It only looks at the centralized value which in corner cases can end up
being negative.
Approved by: re (gjb)
(cherry picked from commit ba5dc166e0)
(cherry picked from commit b5210f3fb2)
The conditions it checks cannot legally be true (modulo races against
forced unmount), so assert on it instead.
Approved by: re (gjb)
(cherry picked from commit 07f52c4b5a)
(cherry picked from commit 8e4a043bad)
vnlru_free_impl would take the lock prior to returning even though most
frequent caller does not need it.
Unsurprisingly vnode_list mtx is the primary bottleneck when recycling
and avoiding the useless lock trip helps.
Setting maxvnodes to 400000 and running 20 parallel finds each with a
dedicated directory tree of 1 million vnodes in total:
before: 4.50s user 1225.71s system 1979% cpu 1:02.14 total
after: 4.20s user 806.23s system 1973% cpu 41.059 total
That's 34% reduction in total real time.
With this the block *remains* the primary bottleneck when running on
ZFS.
Approved by: re (gjb)
(cherry picked from commit 74be676d87)
(cherry picked from commit 206dd9d1a8)
Overflow in cache_changesize would make the value flip to 0 and stay
there as 0 << 1 does not do anything.
Note callers limit the outcome to something below u_int.
Also note there entire vnode handling thing both in vfs layer as a whole
and this file can't decide whether to long, u_long or u_int.
Approved by: re (gjb)
(cherry picked from commit 32988c1499)
(cherry picked from commit 41fad6503c)
For a service that sets an rcvar, there is a check whether it has been
enabled before the actual command is executed. If the check fails, one
gets a message to enable it and the returned exit status is 0.
However, this is usually undesirable for the status command, which is
a) supposed to check whether the service is running anyway and
b) returns a non-zero exit code if that is not the case.
Thus, skip the check for the status command.
PR: 272282
Reviewed by: emaste
(cherry picked from commit ba793728a8)
(cherry picked from commit f701d9da1d)
Approved by: re (gjb)
Reviewed by: imp, manu
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40144
(cherry picked from commit d5ef73a71f)
(cherry picked from commit 84266fb897)
Approved by: re (gjb)
When importing OpenSSL 3 in base, some but not all source files
implementing the deprecated 0.9.8 API were imported. With this change,
it becomes possible again to compile software targeting this API.
PR: 272220
Fixes: b077aed33b ("Merge OpenSSL 3.0.9")
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Pull Request: https://github.com/freebsd/freebsd-src/pull/851
(cherry picked from commit b15b395216)
(cherry picked from commit ab64f100ca)
Approved by: re (gjb)
This corrects the list of source files required for the FIPS provider.
To test:
```
INSTALL PASSED
enter AES-128-CBC encryption password:
Verifying - enter AES-128-CBC encryption password:
U2FsdGVkX1+MGm7LbZou29UWU+KAyBX/PxF5T1pO9VM=
```
Reviewed by: emaste
Fixes: b077aed33b ("Merge OpenSSL 3.0.9")
Sponsored by: The FreeBSD Foundation
Pull Request: https://github.com/freebsd/freebsd-src/pull/837
Differential Revision: https://reviews.freebsd.org/D41720
(cherry picked from commit 8f37b3a142)
(cherry picked from commit abd9da9363)
Approved by: re (gjb)
When $label == "0", $label is not truthy, so `if ($label)` thinks there isn't
a label. Correct this by looking at the result of the s/// command.
Verified that there are no changes in the .S files created during a normal
build, and that the "0:" labels appear in the translation given in the error
report (and they are the only difference in the before and after output).
Obtained from: OpenSSL commit 9607f5ccf285ac9988a86f95c5ad9f92b556a843
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D41587
(cherry picked from commit eba6abafc1)
(cherry picked from commit e99406a2bb)
Approved by: re (gjb)
Some highlights from NEWS entries:
** Improved OpenSSL 3.0 compatibility.
** Support for hidraw(4) on FreeBSD; gh#597.
** Improved support for FIDO 2.1 authenticators.
PR: 273596
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 2ccfa855b2)
(cherry picked from commit 5bfbde817c)
Approved by: re (gjb)
In 6cd1bc5316 for PR 263489 I changed freebsd-update to restart sshd
after upgrade, to avoid an upgrade-related incompatibility that made it
impossible to login.
This is intended to avoid losing access to remote hosts, and ought not
apply to upgrading jails (from outside).
PR: 263489, 272282
Reported by: otis
Reviewed by: otis, kevans
Sponsored by: The FreeBSD Foundation
Fixes: 6cd1bc5316 ("freebsd-update: restart sshd after upgrade")
Differential Revision: https://reviews.freebsd.org/D41890
(cherry picked from commit 8ee97b1928)
(cherry picked from commit cce342e213)
Approved by: re (gjb)
The current dts for Raspberry 3B+ and 4B have 2 disabled fixed-clock
nodes which have no clock-frequency value. Such nodes are non-standard.
This results in about 150 messages during autoconfiguration:
clk_fixed2: <Fixed clock> disabled on ofwbus0
clk_fixed2: Cannot FDT parameters.
device_attach: clk_fixed2 attach returned 6
Defensively check for clock-frequency in the probe routine, and if
none, return an error with a more direct error message (1 line per
occurrence, 50 lines total):
clk_fixed2: clock-fixed has no clock-frequency
Based on a patch by manu.
Approved by: re(gjb)
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D41594
(cherry picked from commit b4ef09b9eb)
(cherry picked from commit 2476a76031)
Commit 2d2bcba7ba changed radix trie
implementation and made it necessary that radix tries be initialized
with vm_radix_init. @dbaio reports that in some configurations, there
is a powerpc boot panic and that this commit introduced the
problem. In powerpc/aim/mmu_radix.c, the radix trie in kernel_pmap is
initialized by zeroing all its fields.
Add a call to vm_radix_init to properly initialize
kernel_pmap->pm_radix.
Reported by: dbaio
Reviewed by: alc, jhibbits
Fixes: 2d2bcba7ba drop NULL check from radix trie search
Differential Revision: https://reviews.freebsd.org/D41846
(cherry picked from commit 8763b9862f)
(cherry picked from commit a4c7a3f7f5)
Approved by: re (gjb)
Previously zfsd would crash in the presence of a pool with a
top-level-vdev that had previously been removed. The crash happened
because the configuration nvlist of such a TLV contains an empty
ZPOOL_CONFIG_CHILDREN array, which led to a pop_front from an empty
list, which has undefined behavior.
The crash only happened in stable/14 and later, probably do to
differences in libcxx, but the change should be MFCed anyway.
PR: 273663
Reported by: Marek Zarychta <[email protected]>
Sponsored by: Axcient
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D41818
Approved by: gjb (re)
(cherry picked from commit 0b294a386d)
(cherry picked from commit a39aac5bb8)
If we've not (yet) resolved a neighbour nda_lladdr will be NULL, and
NLA_DATA_LEN(neigh->nda_lladdr) will dereference a NULL pointer.
Avoid that by checking nda_lladdr first, and only dereferencing if it's
not NULL.
Test case:
ping6 -c 1 <non-existant neighbour>
ndp -a
Approved by: re (kib)
Reviewed by: melifaro
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D41903
(cherry picked from commit b57df6fbcc)
(cherry picked from commit 100bed131d)
Commit 868aabb470 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
Approved by: re (cperciva)
Discussed with: kib
Fixes: 868aabb470 Add IP(V6)_VLAN_PCP to set 802.1 priority per-flow
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39536
(cherry picked from commit 49d6743da1)
(cherry picked from commit c750055382)
OpenSSL's legacy provider module and engines need to link to
libcrypto.so, as it provides some of the actual implementations of
legacy routines.
This is a little tricky due to build order issues. Introduce a small
hack (LIBCRYPTO_WITHOUT_SUBDIRS) that builds libcrypto.so in its usual
early phase without any OpenSSL provider modules or engines. This is
intended to restore the test suite; a future change should remove the
hack and replace it with a better approach.
PR: 254853, 273528
Discussed with: Folks at EuroBSDCon in Coimbra
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 1a18383a52)
(cherry picked from commit fd4b13acd9)
Approved by: re (gjb)
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
Sponsored by: Chelsio Communications
Approved by: re (kib)
(cherry picked from commit e203cb393f)
(cherry picked from commit 38da3db5f9)
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
Sponsored by: Chelsio Communications
Approved by: re (kib)
(cherry picked from commit 3814249f1e)
(cherry picked from commit 3287f64a73)
An explicit tzset() call is usually not needed as it happens implicitly
the first time we call localtime() or mktime(), but in some cases
(sandboxing, chroot) this may be too late.
PR: 273807
MFC after: 3 days
Reviewed by: jrm
Differential Revision: https://reviews.freebsd.org/D41880
Approved by: re (kib)
(cherry picked from commit 7e0a7ef95f)
(cherry picked from commit 51d54ed615)
Due to some bugs being found, back out the amd64 SIMD libc work from
releng/14.0 ahead of the release and give these changes in a critical
part of FreeBSD some more time to mature.
This patch set backs out D40693, D41333, D41349, D41442, and D41697.
Change sets D40729, D40730 (ffs), D41011 (bcmp integer overflow bug),
and D41050 (rtld bits) are not backed out. The intent is for this
backout to be a direct commit to releng/14.0 with the changes staying on
CURRENT and stable/14.
Sponsored by: The FreeBSD Foundation
Requested by: imp kevans
Approved by: kib, re (cperciva)
Differential Revision: https://reviews.freebsd.org/D41855
Add a few stat counters for tso and lro.
Approved by: re (gjb)
Sponsored by: Microsoft
(cherry picked from commit b167e449c8)
(cherry picked from commit a72a0af819)
In ARM64 Hyper-V UFS filesystem is getting corruption and those
corruptions are consistently happening just after hitting a page
boundary. It is unable to correctly read disk blocks into buffers
that are not aligned to 512-byte boundaries.
It happens because storvsc needs physically contiguous memory which
may not be the case when bus_dma needs to create a bounce buffer.
This can happen when the destination is not cache-line aligned.
Hyper-V VMs have VMbus synthetic devices and PCI pass-thru devices
that are added dynamically via the VMbus protocol and are not
represented in the ACPI DSDT. Only the top level VMbus node exists
in the DSDT. As such, on ARM64 these devices don't pick up coherence
information and default to not hardware coherent.
Approved by: re (gjb)
PR: 267654, 272666
Reviewed by: andrew, whu
Tested by: lwhsu
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D41728
(cherry picked from commit e7a9817b8d)
(cherry picked from commit 85bc81352e)
With this support, users can enable or disable offloading features
such as txcsum, rxcsum, tso and software lro through ifconfig.
To enable or disable tx features, do it on mana interface first,
then hn/netvsc to sync it up with mana. For example:
ifconfig mana0 -txcsum
ifconfig hn0 -tscsum
To enable or disable rx features, just applying on mana interface
would be sufficient.
Disabling txcsum imples disabling tso. Enabling tso when txcsum
is disabled will result in an error message in dmesg requesting
to enable txcsum first.
Above applies to ipv6 offloading features as well.
Approved by: re (gjb)
Tested by: whu
Sponsored by: Microsoft
(cherry picked from commit ab7dc1ceb6)
(cherry picked from commit 4edfbe719b)
The parameters for tso on mana were not set correctly. Also the
hwassist bits were not set. These two cause tso on mana not work.
Fixed the issues and make tso working on mana.
Approved by: re (gjb)
Tested by: whu
Sponsored by: Microsoft
(cherry picked from commit 643fd7b4bc)
(cherry picked from commit 4b22565f85)
Current code in hn/netvsc tries to merge (logical AND) VF and
its own capability bits when a VF is attached. This results in
losing some key VF features, especially in tx path. For example,
the VF's txcsum, rxcsum or tso bits could be lost if any of
these are not in hn/netvsc's own capablility field.
Actually when VF is attached, hn just needs to use VF's caps
as all the tx packets would be forwarded to the VF interface.
Fix this problem by doing so.
Approved by: re (gjb)
Reported by: whu
Tested by: whu
Sponsored by: Microsoft
(cherry picked from commit 289ba6b870)
(cherry picked from commit c9b4782ec3)
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.
Approved by: re (gjb)
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41754
(cherry picked from commit 5f62584a9a)
(cherry picked from commit 04ada3cc2b)
Escape a period that caused a line not to be includesd. Also mention
that glob(3) patterns may be included, and a consequence of that.
Approved by: re (gjb)
PR: 273561
Reported by: [email protected]
Reviewed by: emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D41723
(cherry picked from commit 165234d552)
(cherry picked from commit 402d5960cb)
89f361f742 added a mechanism to allow arbitrary overrides from the
command line. Unfortunately, it also had the (likely unintended)
effect of allowing RELEASE and VERSION to be passed in from the
environment, and Makefile.inc1 happens to define VERSION for the
benefit of pkgbase. To restore the status quo, unset RELEASE and
VERSION at the top of the script.
Fixes: 89f361f742
MFC after: 3 days
Reviewed by: gallatin, sjg, emaste
Differential Revision: https://reviews.freebsd.org/D41845
Approved by: re (gjb)
(cherry picked from commit 9f16abf8d3)
(cherry picked from commit f92a598782)
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.
Approved by: re (delphij)
Reviewed by: Kajetan Staszkiewicz <[email protected]>
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D41779
(cherry picked from commit f415a5c1bd)
(cherry picked from commit 1bd8fa1dd0)
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)
Approved by: re (gjb)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41749
(cherry picked from commit 1926d5cef6)
(cherry picked from commit c31f2b5e6b)
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: 9a7add6d01 "init_main: Switch from sysinit array to SLIST"
Reported by: gallatin
Reviewed by: jhb, gallatin, emaste
Approved by: re (gjb)
Tested by: gallatin
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41748
(cherry picked from commit 71679cf468)
(cherry picked from commit 144db6a1c9)
The timerfd is introduced in FreeBSD 14, and the Linux ABI timerfd is
also moved to FreeBSD native timerfd, but it can't work well as Linux
TFD_CLOEXEC and TFD_NONBLOCK haven't been converted to FreeBSD
TFD_CLOEXEC and TFD_NONBLOCK.
Approved by: re (gjb)
Reviewed by: dchagin, jfree
PR: 273662
Differential revision: https://reviews.freebsd.org/D41708
MFC after: 1 week
(cherry picked from commit aadc14bceb)
(cherry picked from commit 3c93ba3d7f)
FreeBSD does not permits manipulating extended attributes in the system
namespace by unprivileged accounts, even if account has appropriate
privileges to access filesystem object.
In Linux the system namespace is used to preserve posix acls. Some Gnu
coreutils binaries uses posix acls, eg, install, ls, cp. And fails if
we unexpectedly return EPERM error from xattr system calls.
In the other hands, in Linux read and write access to the system
namespace depend on the policy implemented for each filesystem, so we'll
mimics we're a filesystem that prohibits this for unpriveleged accounts.
Approved by: re (gjb)
Reported by: zirias
Tested by: zirias
MFC after: 1 week
(cherry picked from commit 11e37048db)
(cherry picked from commit e975d1b725)
If size is specified as zero, these calls return the current size
of the list of extended attribute names (and leave list unchanged).
Approved by: re (gjb)
Tested by: zirias
MFC after: 1 week
(cherry picked from commit 18d1c86788)
(cherry picked from commit 53b3e15d73)
FreeBSD does not permits manipulating extended attributes in the system
namespace by unprivileged accounts, even if account has appropriate
privileges to access filesystem object.
In Linux the system namespace is used to preserve posix acls. Some Gnu
coreutils binaries uses posix acls, eg, install, ls. And fails if we
unexpectedly return EPERM error from xattr system calls.
In the other hands, in Linux read and write access to the system
namespace depend on the policy implemented for each filesystem, so we'll
mimics we're a filesystem that prohibits this for unpriveleged accounts.
Approved by: re (gjb)
Reported by: zirias
Tested by: zirias
MFC after: 1 week
(cherry picked from commit 1bfc4574f7)
(cherry picked from commit bce9c2e340)
On Linux ENODATA mean the named attribute does not exist, or the
process has no access to this attribute.
Approved by: re (gjb)
Reported by: zirias
PR: 273517
Tested by: zirias
MFC after: 1 week
(cherry picked from commit 4d59b79055)
(cherry picked from commit a9b8a0ced4)
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
Approved by: re (gjb)
Reviewed by: rmacklem
Differential Revision: https://reviews.freebsd.org/D41774
(cherry picked from commit 48514c5724)
(cherry picked from commit deaa6984ad)
The module entries should generally allow whatever is allowed as an
env_var in the pattern table. Notably, we're missing periods which
would allow proper entries for .dtb files in loader.conf that don't need
to specify a module_name entry for it.
%d in this expression is actually redundant as %w is actually
"all alphanumerics," but I've included it for now to match the env_var
entry. We should really remove it from both.
Reported by: "aribi" on the forums via allanjude@
Approved by: re (gjb)
(cherry picked from commit 5bc1e0c228)
(cherry picked from commit 6b2f0a3c31)
[builtins][AArch64] Implement _sync out-of-line atomics
Whilst Clang does not use these, recent GCC does, and so on systems such
as FreeBSD that wish to use compiler-rt as the system runtime library
but also wish to support building programs with GCC these interfaces are
needed.
This is a light adaptation of the code committed to GCC by Sebastian Pop
<[email protected]>, relicensed with permission for use in compiler-rt.
Fixes https://github.com/llvm/llvm-project/issues/63483
Reviewed By: sebpop, MaskRay
Differential Revision: https://reviews.llvm.org/D158536
Reviewed by: dim
Approved by: re (gjb)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41716
(cherry picked from commit 8524dc53fd)
(cherry picked from commit 2f269a3532)
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
Approved by: re (gjb)
(cherry picked from commit f10f65999f)
(cherry picked from commit 0c9b008671)
These won't be added elsewhere, so add a little bit of room to make
these messages a little easier to read. The existing set is a mixed
bag, there are somewhere in the ballpark of 45, 46 printfs to stderr and
19 of those had newlines.
Reviewed by: yuripv
Approved by: re (kib)
Sponsored by: Klara, Inc.
(cherry picked from commit 3141e51d2e)
(cherry picked from commit dc8ee27074)
It turns out that right parentheses do exist and are different than
left parentheses, so let's switch to that.
Approved by: re (kib)
Sponsored by: Klara, Inc.
(cherry picked from commit 07bc20e474)
(cherry picked from commit 8d98eb4e51)
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
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 2afef29b2c)
(cherry picked from commit b67ff0e3cf)
Approved by: re (gjb)
Other cloud images do not do this, and it can produce confusing results.
Reviewed by: Jose Luis Duran, delphij
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41751
(cherry picked from commit b7528b16c6)
(cherry picked from commit 5623352ec0)
Approved by: re (gjb)
It's inefficient to ring the doorbell page every time a WQE is posted to
the received queue. Excessive MMIO writes result in CPU spending more
time waiting on LOCK instructions (atomic operations), resulting in
poor scaling performance.
Move the code for ringing doorbell page to where after we have posted all
WQEs to the receive queue in mana_poll_rx_cq().
In addition, use the correct WQE count for ringing RQ doorbell.
The hardware specification specifies that WQE_COUNT should set to 0 for
the Receive Queue. Although currently the hardware doesn't enforce the
check, in the future releases it may check on this value.
Approved by: re (gjb)
Sponsored by: Microsoft
(cherry picked from commit e4e11c1d07)
(cherry picked from commit 55b7a8233e)
- 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.
Approved by: re (gjb)
(cherry picked from commit cb1a0aab4f)
(cherry picked from commit 72a9f518d5)
With the new simd-dispatch framework documented in simd(7),
add cross-references to the new man pages to appropriate places.
Sponsored by: The FreeBSD Foundation
Approved by: emaste, re (gjb)
MFC to: stable/14, releng/14.0
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D41697
(cherry picked from commit d41afb8146)
(cherry picked from commit 7ec2ae8c7c)
We do not yet have a 'quarterly' build for amd64, i386, or non-x86,
so use 'latest' in order to get the BETA1 builds to work.
Approved by: re (implicit, build fix)
Sponsored by: GoFundMe https://www.gofundme.com/f/gjbbsd
Sponsored by: PayPal https://paypal.me/gjbbsd
@@ -7,7 +7,7 @@ image:https://github.com/yubico/libfido2/workflows/fuzzer/badge.svg["Fuzz Status
image:https://oss-fuzz-build-logs.storage.googleapis.com/badges/libfido2.svg["Fuzz Status (oss-fuzz)", link="https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:libfido2"]
*libfido2* provides library functionality and command-line tools to
communicate with a FIDO device over USB, and to verify attestation and
communicate with a FIDO device over USB or NFC, and to verify attestation and
assertion signatures.
*libfido2* supports the FIDO U2F (CTAP 1) and FIDO2 (CTAP 2) protocols.
@@ -23,8 +23,6 @@ file for the full license text.
*libfido2* is known to work on Linux, macOS, Windows, OpenBSD, and FreeBSD.
NFC support is available on Linux and Windows.
=== Documentation
Documentation is available in troff and HTML formats. An
Loaded 100 of 2151 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.