Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge FreeBSD 2024-06-28 #2240

Merged
merged 213 commits into from
Oct 29, 2024
Merged

Merge FreeBSD 2024-06-28 #2240

merged 213 commits into from
Oct 29, 2024

Conversation

bsdjhb
Copy link
Collaborator

@bsdjhb bsdjhb commented Oct 29, 2024

PR for CI

ngie-eign and others added 30 commits June 20, 2024 16:24
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)
A spelling error correction.  No functional change.

Reviewed by:	alc
Differential Revision:	https://reviews.freebsd.org/D45667
On Feb. 28, a problem was reported on freebsd-stable@ where a
nfsd thread processing an ExchangeID operation was blocked for
a long time by another nfsd thread performing a copy_file_range.
This occurred because the copy_file_range was taking a long time,
but also because handling a clientID requires that all other nfsd
threads be blocked via an exclusive lock, as required by ExchangeID.

This patch allows clientID handling to be done with only a mutex
held (instead of an exclusive lock that blocks all other nfsd threads)
when vfs.nfsd.enable_locallocks is 0.  For the case of
vfs.nfsd.enable_locallocks set to 1, the exclusive lock that
blocks all nfsd threads is still required.

This patch does make changing the value of vfs.nfsd.enable_locallocks
somewhat racy.  A future commit will ensure any change is done when
all nfsd threads are blocked to avoid this racyness.

MFC after:	1 month
Add a STANDARDS section for the erf(3) manual page.

PR:	273413
Reviewed by:	pauamma_gundo.com
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44140
The loopback interface supports SCTP checksum offloading in
addition to TCP and UDP.
Reviewed by:		gbe
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D45698
Describe and link the following functions in the lockgmr API:
 - lockmgr_disowned
 - lockmgr_lock_flags
 - lockmgr_slock
 - lockmgr_unlock
 - lockmgr_xlock

This is not a complete update of lock.9 but at least covers all the main
lock operations.

Reviewed by:	gbe, kib
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D45689
Commit dfaeeac modified clientID handling so that it could be done
with only a mutex lock held when vfs.nfsd.enable_locallocks is 0.
This makes it unsafe to change the setting of vfs.nfsd.enable_locallocks
when nfsd threads are active.

This patch forces all nfsd threads to be blocked when the value
of vfs.nfsd.enable_locallocks is changed, so that it is done safely.

MFC after:	1 month
Use a constant input operand instead of an output operand to tell the
compiler about OFFSETOF_MONITORBUF.  If we tell it we are writing to
*(u_int *)OFFSETOF_MONITORBUF, it rightly complains, but we aren't.  The
memory clobber already covers the necessary semantics for the compiler.

Reviewed by:	kib
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D45694
Use a constant input operand instead of an output operand to tell the
compiler about __OFFSETOF_MONITORBUF.  If we tell it we are writing to
*(u_int *)__OFFSETOF_MONITORBUF, it rightly complains, but we aren't.
The memory clobber already covers the necessary semantics for the
compiler.

Reviewed by:	kib
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D45695
Replace is_power_of_2(length) with power2(length).  When length != 0, as in
this case, they produce the same result.  This will allow an implementation
of is_power_of_two to be dropped.

Reviewed by:	alc, markj
Differential Revision:	https://reviews.freebsd.org/D45536
Linux has a header file that defines an ilog2 function and some simple
functions/macros that use it: roundup_pow_of_two, is_power_of_2,
rounddown_pow_of_two, and order_base_2.  This change moves three of
those simple functions (all but is_power_of_2) from linuxkpi to
libkern.  It also deletes a few implementations of these functions
that have previously been copied into code for various device drivers,
so that they can use the libkern version.  The is_power_of_2 macro was
not moved because powerof2 in param.h provides almost the same service
already (except that they disagree about whether 0 is a power of two).

Since the linux definitions of these functions were copied into
FreeBSD 11 years ago, linux has improved them, and this change
provides those improvements.  In particular, a giant table of log
values for evaluating ilog2 for constant values is no longer
necessary.

Reviewed by:	alc, markj (previous version)
Differential Revision:	https://reviews.freebsd.org/D45536
Use the roundown_pow_of_two macro in place of an expression.

Reviewed by:	alc, markj
Differential Revision:	https://reviews.freebsd.org/D45536
In two places, use the rounddown_pow_of_two macro in place of expressions.

Reviewed by:	alc, markj
Differential Revision:	https://reviews.freebsd.org/D45536
Use order_base_2 in place of an expression.

Reviewed by:	alc, markj
Differential Revision:	https://reviews.freebsd.org/D45536
Use roundup_pow_of_two and rounddown_pow_of_two in place of expressions.

Reviewed by:	alc, markj
Differential Revision:	https://reviews.freebsd.org/D45536
Use roundup_pow_of_two in place of an expression.

Reviewed by:	alc, markj
Differential Revision:	https://reviews.freebsd.org/D45536
Use roundup_pow_of_two in place of a local function that does the same thing.

Reviewed by:	alc, markj
Differential Revision:	https://reviews.freebsd.org/D45536
Use order_base_2 in place of expressions involving fls.

Reviewed by:	alc, markj
Differential Revision:	https://reviews.freebsd.org/D45536
This makes it easier to grep the usage.

Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45715
This makes it easier to grep the usage.

Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45715
Fixes: 459dc61 ("arm: Convert drivers to use device_set_desc(f)()")

Reviewed by:    markj, imp, manu
Approved by:    markj, imp, manu (mentor)
Differential Revision:  https://reviews.freebsd.org/D45699
The lib9p implementation takes a strict interpretation of the Twalk RPC
call and returns an error for attempts to lookup ".".  The workaround is
to fake the lookup locally.

Reviewed by: Val Packett <val@packett.cool>
MFC after: 3 months
The 11th and 12th columns are the effective and real UIDs, respectively.
The 13th column is a group list whose first member is the effective
GID.

Reviewed by:	arrowd
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45700
State keys are trivially const in lookup routines, so annotate them as
such.  No functional change intended.

Reviewed by:	kp
MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Modirum
Differential Revision:	https://reviews.freebsd.org/D45671
When a lagg interface is destroyed, it destroys all of the lagg ports,
which triggers an asynchronous link state change handler.  This in turn
may generate a netlink message, a portion of which requires netlink to
invoke the SIOCGIFMEDIA ioctl of the lagg interface, which involves
scanning the list of interface media.  This list is not internally
locked, it requires the interface driver to provide some kind of
synchronization.

Shortly after the link state notification has been raised, the lagg
interface detaches itself from the network stack.  As a part of this, it
blocks in order to wait for link state handlers to drain, but before
that it destroys the interface media list.  Reverse this order of
operations so that the link state change handlers drain first, avoiding
a use-after-free that is very occasionally triggered by lagg stress
tests.  This matches other ethernet drivers in the tree.

MFC after:	2 weeks
[skip ci]

MFC with:	9747d11
Reported by:	markj
Sponsored by:	Axcient
Background:

If a user does pathconf(_, _PC_MIN_HOLE_SIZE) on a fusefs file system,
the kernel must actually issue a FUSE_LSEEK operation in order to
determine whether the server supports it.  We cache that result, so we
only have to send FUSE_LSEEK the first time that _PC_MIN_HOLE_SIZE is
requested on any given mountpoint.

Problem 1:

Unlike fpathconf, pathconf operates on files that may not be open.  But
FUSE_LSEEK requires the file to be open.  As described in PR 278135,
FUSE_LSEEK cannot be sent for unopened files, causing _PC_MIN_HOLE_size
to wrongly report EINVAL.  We never noticed that before because the
fusefs test suite only uses fpathconf, not pathconf.  Fix this bug by
opening the file if necessary.

Problem 2:

On a completely sparse file, with no data blocks at all, FUSE_LSEEK with
SEEK_DATA would fail to ENXIO.  That's correct behavior, but
fuse_vnop_pathconf wrongly interpreted that as "FUSE_LSEEK not
supported".  Fix the interpretation.

PR:		278135
MFC after:	1 week
Sponsored by:	Axcient
Differential Revision: https://reviews.freebsd.org/D44618
ngie-eign and others added 28 commits October 29, 2024 11:28
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'
This is a companion commit to the OpenSSL 3.0.14 update.

MFC after:      3 days
MFC with:       44096eb
Reviewed by:	chuck (previous version), imp
Differential Revision:	https://reviews.freebsd.org/D45750
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
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
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
…OSTOP

Tested with max44009(4).

MFC after:	2 weeks
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
"how do I switch active wifi network on console"
"% apropos wifi"

MFC after:	3 days
Reviewed by:	mhorne, imp
Pull Request:	freebsd/freebsd-src#1299
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
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
In case of a failure of tcp_newtcpcb, where NULL is returned,
* call CC_ALGO(tp)->cb_destroy, after CC_ALGO(tp)->cb_init was called.
* call khelp_destroy_osd(), after khelp_init_osd() was called.

Reviewed by:		glebius, rscheff
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D45753
Function swap_pager_swapoff_object calls vm_pager_unswapped (via
swp_pager_force_dirty) for every page that must be unswapped. That
means that there's an unneeded check for lock ownership (the caller
always owns it), a needless PCTRIE_LOOKUP (the caller has already
found it), a call to free one page of swap space only, and a check to
see if all blocks are empty, when the caller usually knows that the
check is useless.

Isolate the essential part, needed however swap_pager_unswapped is
invoked, into a smaller function swap_pager_unswapped_acct.  From
swapoff_object, invoke swp_pager_update_freerange for each appropriate
page, so that there are potentially fewer calls to
swp_pager_freeswapspace.  Consider freeing a set of blocks (a struct
swblk) only after having invalidated all those blocks.

Replace the doubly-nested loops with a single loop, and refetch and
rescan a swblk only when the object write lock has been released and
reacquired.

After getting a page from swap, dirty it immediately to address a race
condition observed by @kib.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45668
physmap_idx now contains the raw value; we should not multiply it.

Reviewed by:	markj
Fixes:	d03e1ff ("arm64: Remove some redundant calculations...")
MFC after:	3 days
Reviewed by:	imp
Pull Request:	freebsd/freebsd-src#1269
PR:		279542
Fixes:		14a5c10
Reported by:	emaste
Reviewed by: imp, emaste, jilles
Pull Request: freebsd/freebsd-src#1283
Fixes:		1687d7 (move filesystems to s4)
Reported by:	mhorne
Reviewed by:	imp, mhorne
Pull Request:	freebsd/freebsd-src#1289
The longest command we have is "efi-autoresizecons". That combined with
the two spaces before and after the command gives us a total of 23
characters including the null-terminator.

Also move the two trailing spaces to their own pager_output call so they
don't get truncated if the command is too long and increase the minimum
string length to 20 in order to fix alignment issues caused by the
increased buffer size.

Reviewed by: imp
Pull Request: freebsd/freebsd-src#1277
Change 4787572 made if_alloc_domain() never fail, then also do the
wrappers if_alloc(), if_alloc_dev(), and if_gethandle().

No functional change intended.

Reviewed by:	kp, imp, glebius, stevek
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D45740
Add a special permission to the jail to adjust and to set the host time.
This can be useful if we want to compartmentalize the NTP daemon
from the rest of the system.

Reviewed by:	olce, imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D45545
This is achieved by the preceding call to pmap_page_is_write_mapped().
It appears the second check and comment were left mistakenly when the
intent was to remove them.

Reviewed by:	mhorne
MFC after:	1 week
Fixes:	638f867 ("(6/6) Convert pmap to expect busy in write... ")
Pull Request:	freebsd/freebsd-src#1304
The signedness of "char" is implementation-dependent.

Reviewed by: imp,zlei,nightquick@proton.me
Pull Request: freebsd/freebsd-src#1290
We are not 100% compatible with 1.0.16, but implement some
functionality from that version that is required by certain ports.

PR:		277799
PR:		279555 (exp-run)
Event:		Kitchener-Waterloo Hackathon 202406
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45514
Due to issues with the riscv64 toolchain, some binaries end up
significantly larger on riscv64 than they should be.  This results
in riscv64 VM images -- and at present *only* riscv64 images -- not
fitting within the default 5 GB filesystem size.

Bump the default size for riscv64 to 6 GB until the toolchain issues
can be resolved.

MFC after:	1 week
Sponsored by:	Amazon
Merge commit 'dbb5be7f07456d02ce444484c683b130439acb45'
@bsdjhb bsdjhb merged commit 897b271 into CTSRD-CHERI:dev Oct 29, 2024
29 checks passed
@bsdjhb bsdjhb deleted the merge-freebsd-20240628 branch October 29, 2024 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.