gen_encap() always calls bus_dmamap_load_mbuf_sg() into 'map' (which is
the current tx_queue). If the tx_queue is full, it will load with a
'map' that already has a currently active mapping. This violates the
busdma(9) KPI.
Checking for a full queue and returning ENOBUFS will allow
gen_start_locked() to set the IFF_DRV_OACTIVE faster without having to
needlessly check if the mbuf will fit (it won't).
PR: 256482
Reviewed by: mhorne
MFC after: 1 week
Submitted by: ghuckriede@blackberry.com
If syncache_socket() fails after calling tcp_newtcpcb(), the resources
allocated in tcp_newtcpcb() needs to be freed. Just call
tcp_discardcb() to do this.
Thanks to jtl for making me aware of the issue and proposing a fix.
Reviewed by: glebius, jtl, rscheff
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D45749
Since that commit ahci(4), siis(4) and mvs(4) drivers ended up
using wrong command to fetch error information for NCQ commands.
Since ATA errors are not very informative to begin with, the only
noticeable effect is a lack of retries on those errors by CAM.
MFC after: 1 week
PR: 279978
rk_i2c_send_stop is modified so that it sends a stop condition, like it
always did, if there is no IIC_M_NOSTOP flag.
But if the flag is set then the function completely resets the control
register and sets the driver state to transfer completed.
Something like this was previously done for a write with IIC_M_NOSTOP.
Now it is done for a read with IIC_M_NOSTOP as well.
Linux code says that the hardware does not support the repeated start
condition and the documentation, indeed, does not mention it.
But according to the Linux driver clearing the control register and then
sending a start condition acts as if it were a repeated start.
While here, add braces around a single-line 'if' branch to balance it
with a multi-line 'else' branch.
Tested with max44009(4).
MFC after: 2 weeks
openstack, ec2 and other implementation of cloudinit disagrees on the
name of the file "user-data" or "user_data", test both and use the first
found
PR: 279876
This improves readability a little. As a side effect, a redundant
CURVNET_RESTORE is removed.
No functional change intended.
Reviewed by: glebius
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D45595
This release resolves 3 upstream found CVEs:
- Fixed potential use after free after SSL_free_buffers() is called (CVE-2024-4741)
- Fixed an issue where checking excessively long DSA keys or parameters may be very slow (CVE-2024-4603)
- Fixed unbounded memory growth with session handling in TLSv1.3 (CVE-2024-2511)
MFC after: 3 days
Merge commit '1070e7dca8223387baf5155524b28f62bfe7da3c'
and dummy num_possible_nodes() implementation.
We do not fully support NUMA in LinuxKPI yet.
Sponsored by: Serenity CyberSecurity, LLC
MFC after: 1 week
Reviewed by: manu, bz
Differential Revision: https://reviews.freebsd.org/D45613
This include prevents usage of any kernel.h helpers in sched.h and
all of dependencies. Linux does not have it too.
Fix building of kernel and drm-kmod after than.
Sponsored by: Serenity CyberSecurity, LLC
MFC after: 1 week
Reviewed by: manu, bz
Differential Revision: https://reviews.freebsd.org/D45692
Most of these already treat it as a proper bool, i.e. using true/false.
Also fix-up callers of OF_install().
No functional change intended.
Reviewed by: andrew, emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45733
While here remove a pointless static local variable lo_cloner.
No functional change intended.
Reviewed by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D45728
Drop a private implementation of roundup_pow_of_two and use the global
one instead.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D45739
All supported compilers provide the acle macros so we don't need the
backup versions.
Keep the file around for anything that included it directly, but make
it an error to not support the acle macros.
Reviewed by: imp
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45726
Assume you have loader configured to load linux64, which has a
dependency on both linux_common and mqueuefs but neither the kernel
nor kernel config in question have the mqueuefs module included.
When the load command for linux64 fails to find mqueuefs, it will
free both linux64 and linux_common as they were loaded first, but only
linux64 gets removed from the module list. As a result, future
traversals hit an easy use-after-free with linux_common.
Fix it so that we unlink the entire tail of the list. Anything after
the initially loaded module is, by definition, a dependency on the
loaded module while we're still in the load command, so we can just
discard the entire tail. If linux_common were loaded before linux64, it
should not move to a position during this load where it would suddenly
be missing from the view presented to the kernel.
Reported by: philip
Reviewed by: imp, philip, tsoome
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D45731
If multiple ctladm processes try to load ctl.ko at the same time, only
one will succeed. Handle this possibility by retrying the operation
(open /dev/cam/ctl) if kldload returns EEXIST, rather than bailing.
This at least helps ensure that ctladm tests can be run in parallel
when ctl.ko is not preloaded.
Reviewed by: asomers
MFC after: 1 week
gcc -Wmemset-elt-size diagnosed this. The code was only initializing
1/4 of the array. However, it was actually harmless, as the only caller
had done an M_ZERO allocation anyway.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D45701
Add __inline to the __always_inline macro to quiet dozens of gcc
warnings of the form:
warning: 'always_inline' function might not be inlinable [-Wattributes]
It's clearly the intention of the __always_inline macro applied to a
function to inline the function. However, gcc seems to be picky with
the -Wattributes. It appears that __attribute__((__always_inline__))
was intended to apply to inline functions, as in, function declarations
with the attribute should also be declared as inline. Both clang and
gcc sources themselves use the two in combination:
inline __attribute__((__always_inline__))
FreeBSD sources mostly only use __always_inline, without the inline
keyword. Only a few files in libmsun used both.
Reviewed by: imp, kib, olce
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D45711
Prevent kernel panic by not running ISPCTL_FCLINK_TEST after a
failed ISPCTL_ABORT_CMD.
Reviewed by: mav
Tested by: Arne Steinkamm <arne@steinkamm.com>
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D45718
Add new SBI implementation IDs including recently allocated one for bhyve.
Reviewed by: mhorne
Sponsored by: UKRI
Differential Revision: https://reviews.freebsd.org/D45696
When raising an exception we may need to set the SPSR_EL1.PAN field.
The check for this was incorrect meaning it would be set when it
shouldn't be.
Reviewed by: markj
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45717
When booting to VHE we need to handle using the PMU at either EL1 or
EL2. WE already support EL1 so add support for EL2.
Reviewed by: mhorne
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45527
The third arg of the DRIVER_MODULE arg is the driver to use. We want to
use the acpi bus version rather than the generic one. Otherwise, the
ACPI specific probe and attach functions aren't used and we don't see
the device.
Sponsored by: Netflix
We're building ACPI, so we need -DDEV_ACPI on CFLAGS. Nomally, the
kernel config brings this in, but there's no kernel directory for the
standalone build.
Sponsored by: Netflix
device_attach routines are allowed to sleep, and this routine already
has other M_WAITOK allocations.
Reported by: markj
Reviewed by: markj
Fixes: 1efd69f933 ("p9fs: move NULL check immediately after alloc...")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45721
The __has_* macros are no longer clang-speicifc. gcc 5 introduced
__has_include, gcc 9 introduce __has_attribute, gcc 10 introduced
__has_builtin. So all of these are supported by all the versrions of gcc
we support as a project (we have gcc 10 and newer ports, but no older
ones), so just refer to them as supported by gcc. The exact version
doesn't matter so much these days (we provide a fallback for older
compilers still, should anybody still be using them), so don't mention
them in the comments (but here in the commit message they are
discoverable).
gcc 14 adds __has_feature and __has_extension, so note that since it
will be relevant for many years.
Sponsored by: Netflix
The ACLE defines the modern ARM compiler symbols. ARM published
acle-compat.h to ease the transition to the new standard. This standard
is in all modern versions of gcc and clang, only gcc prior to 4.4 lacked
them (though our 4.2.1 back-ported them, IIRC). Since this is no longer
needed, remove the global inclusion in sys/ctypes.h. We should likely
remove arm/include/acle-compat.h as well (it's unused now in the tree),
but I'll make sure this change is the NOP I think it is before moving
ahead there. I also recall at one time some out of tree code needing
this file, though the need for it to make things right has long since
past.
Sponsored by: Netflix