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-07-05 #2241

Merged
merged 74 commits into from
Oct 30, 2024
Merged

Conversation

bsdjhb
Copy link
Collaborator

@bsdjhb bsdjhb commented Oct 29, 2024

PR for CI

tuexen and others added 30 commits June 29, 2024 11:06
Fix two KASSERTs to catch the condition they are intended to,
add two asserts to ensure that the appropriate locking is in
place and fix some things related to style.
No functional change intended.

MFC after:	1 week
Sponsored by:	Netflix, Inc.
Reviewed by:	zlei
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D45706
Since change [1], if_bpf will not be detached by the interface departure
eventhandler and will not be NULL. Then the logic to re-attach if_bpf
becomes dead and serves no purpose any more.

This partially reverts commit 05fc416.

1. 9ce40d3 bpf: Fix incorrect cleanup

Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45599
Also, --no-dereference should not imply --recurse.

MFC after:	3 days
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D45779
Reported by:	Qualys Threat Research Unit (TRU)
Approved by:	so
Security:	FreeBSD-SA-24:04.openssh
Security:	CVE-2024-6387
gcc -Wmemset-elt-size diagnosed this.  The code was only initializing
the first 1/sizeof(long) bytes.  On 64-bit systems, this would mean only
events up to 0x20 were initialized.

This effectively reverses the security policy for some events with
higher ids, now permitting them on unprivileged sockets.  Two that are
defined are NG_HCI_EVENT_LE (0x3e) and NG_HCI_EVENT_BT_LOGO (0xfe).

PR:		280039
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D45707
The encapsulated (original) frame does not count in FCS as per Section 5
of RFC 7348.

Reviewed by:	afedorov, bryanv, #network
Fixes:		b759282 Allow set MTU more than 1500 bytes
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45195
On clone creating, either failure from vxlan_set_user_config() or
ifc_copyin() will result in leaking previous allocated counters.

Since counter_u64_alloc(M_WAITOK) never fails, make vxlan_stats_alloc()
void and move the allocation for counters below checking ifd->params to
avoid memory leak.

Reviewed by:	kp, glebius
Fixes:	b092fd6 if_vxlan(4): add support for hardware assisted checksumming, TSO, and RSS
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45822
if_enc(4) can pass IPsec payload to pfil(9) with the outer header or without
it. In case of a small packet like ICMP, when mbuf cluster is not used,
everything works fine. Otherwise, the first mbuf in a chain has m_len == 0
if it is asked to strip the outer header. pf was not handling such case, and
erroneous reading of the outer IP header led to unexpected behavior.

Reviewed by:	kp, glebius
Differential Revision:	https://reviews.freebsd.org/D45780
Add CLOCK_UPTIME and CLOCK_BOOTTIME options and a quick pointer
to clock_gettime(2) for a better definition of these values.

Reviewed-by: imp (small tweaks and added Xr)
Pull-Request: freebsd/freebsd-src#1302
When CLOCK_BOOTTIME was made an alias for CLOCK_MONOTONIC, the man page
wasn't updated. Update to include the changed semantics (it was to be
better compatible with Linux). Clarify the details of these clocks.
Provide a reference to the UTC standard, and a clarifying remark
about leap second encoding (fun fact: POSIX provides no unique
value for these, nor definitive values to use).

Sponsored by:		Netflix
Fixup after
56e9a01 gsb_crc32: Fix a warning when compiled in userland.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45824
Fixup after
9d2f979 <sys/cdefs.h>: Decay expression passed to fallback version of __generic()

Reviewed by:	imp, jrtc27, kib
Differential Revision:	https://reviews.freebsd.org/D45825
when ums driver receives non-mouse HID report. This results in
unexpected button release event. Reuse existing sysmouse logic to
keep button pressed.

Reviewed by:	imp, wulf
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D45838
We no longer need advice on __FBSDID, so delete it.

Sponsored by:		Netflix
Some drivers, e.g. if_enc(4), only allow one instance to be created, but
the KPI ifc_attach_cloner() treat zero value of maxunit as not limited,
aka IF_MAXUNIT.

Introduce a new flag IFC_F_LIMITUNIT to indicate that the requested
maxunit is limited and should be respected.

Consumers should use the new flag if there is an intended limit.

Reviewed by:	glebius
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D45757
The cloner has the ability to limit the maximum unit. Employ it to do
that rather than roll our own.

No functional change intended.

Reviewed by:	kp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D45767
Most of these sysctls don't call sbuf_* while holding any locks.  Of
the ones that do hold locks, all but one can be fixed to drop the lock
before calling sbuf_*.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D45186
Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D45187
 - Add missing cc clobber to __PCPU_ADD (which is currently unused).
 - Allow the compiler the opportunity to marginally improve code
   generation from __PCPU_PTR by letting it figure out how to do the add
   (also removing the addition fixes a missing cc clobber).
 - Quiet gcc -Warray-bounds by using constant operands instead of bogus
   memory references.
 - Remove the struct __s __s temporaries, just cast through the type.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45826
These changes mostly apply to the !__SEG_GS section, which is no longer
the normal compilation path.  They're made to be consistent with changes
to i386.

 - Add missing cc clobber to __PCPU_ADD (which is currently unused).
 - Allow the compiler the opportunity to marginally improve code
   generation from __PCPU_PTR by letting it figure out how to do the add
   (also removing the addition fixes a missing cc clobber).
 - Quiet gcc -Warray-bounds by using constant operands instead of bogus
   memory references.
 - Remove the struct __s __s temporaries, just cast through the type.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45827
Use a constant input operand instead of a bogus memory reference to tell
the compiler about offsetof(struct tcb, tcb_thread) in the fs segment.
Otherwise gcc complains if we tell it we are reading memory offset 0x10.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45828
Use a constant input operand instead of a bogus memory reference to tell
the compiler about offsetof(struct tcb, tcb_thread) in the gs segment.
Otherwise gcc complains if we tell it we are reading memory offset 0x8.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45829
The actual types of pthread_func_t and interpos_func_t are not used.
Declare them as the generic void (*)(void) which suppresses warnings.

https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wcast-function-type

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45830
Fixes a wrong rwq->buf_size assignment. The field was assigned 0 upon a
successful call to ibv_init_wq.

Fixes:		a687910
Sponsored by:	Juniper Networks, Inc.
MFC after:	1 week
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45833
Autoconf 2.72 uses '' rather tha `' in comments in config.h, from
autoconf commit 64df9b4523fe ("Autoconf now quotes 'like this' instead
of `like this'").

Switch quoting style now to minimize diffs on the next OpenSSH update
and config.h regen.

Reviewed by:	gordon, philip
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45840
Add back, with editing, the comments about branch prediction, when to
use it, etc. Offer stronger opinions about this in style(9). Add in the
convention for FreeBSD that we do only the entire expression in the if
expression. Advise use only when it makes things measurably faster.

Requested by:		jhb
Sponsored by:		Netflix
Reviewed by:		brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D45837
Cormac Stephenson and others added 28 commits October 29, 2024 15:35
Add CLOCK_UPTIME and CLOCK_BOOTTIME options and a quick pointer
to clock_gettime(2) for a better definition of these values.

Reviewed-by: imp (small tweaks and added Xr)
Pull-Request: freebsd/freebsd-src#1302
When CLOCK_BOOTTIME was made an alias for CLOCK_MONOTONIC, the man page
wasn't updated. Update to include the changed semantics (it was to be
better compatible with Linux). Clarify the details of these clocks.
Provide a reference to the UTC standard, and a clarifying remark
about leap second encoding (fun fact: POSIX provides no unique
value for these, nor definitive values to use).

Sponsored by:		Netflix
Fixup after
56e9a01 gsb_crc32: Fix a warning when compiled in userland.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45824
Fixup after
9d2f979 <sys/cdefs.h>: Decay expression passed to fallback version of __generic()

Reviewed by:	imp, jrtc27, kib
Differential Revision:	https://reviews.freebsd.org/D45825
when ums driver receives non-mouse HID report. This results in
unexpected button release event. Reuse existing sysmouse logic to
keep button pressed.

Reviewed by:	imp, wulf
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D45838
We no longer need advice on __FBSDID, so delete it.

Sponsored by:		Netflix
Some drivers, e.g. if_enc(4), only allow one instance to be created, but
the KPI ifc_attach_cloner() treat zero value of maxunit as not limited,
aka IF_MAXUNIT.

Introduce a new flag IFC_F_LIMITUNIT to indicate that the requested
maxunit is limited and should be respected.

Consumers should use the new flag if there is an intended limit.

Reviewed by:	glebius
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D45757
The cloner has the ability to limit the maximum unit. Employ it to do
that rather than roll our own.

No functional change intended.

Reviewed by:	kp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D45767
Most of these sysctls don't call sbuf_* while holding any locks.  Of
the ones that do hold locks, all but one can be fixed to drop the lock
before calling sbuf_*.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D45186
Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D45187
 - Add missing cc clobber to __PCPU_ADD (which is currently unused).
 - Allow the compiler the opportunity to marginally improve code
   generation from __PCPU_PTR by letting it figure out how to do the add
   (also removing the addition fixes a missing cc clobber).
 - Quiet gcc -Warray-bounds by using constant operands instead of bogus
   memory references.
 - Remove the struct __s __s temporaries, just cast through the type.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45826
These changes mostly apply to the !__SEG_GS section, which is no longer
the normal compilation path.  They're made to be consistent with changes
to i386.

 - Add missing cc clobber to __PCPU_ADD (which is currently unused).
 - Allow the compiler the opportunity to marginally improve code
   generation from __PCPU_PTR by letting it figure out how to do the add
   (also removing the addition fixes a missing cc clobber).
 - Quiet gcc -Warray-bounds by using constant operands instead of bogus
   memory references.
 - Remove the struct __s __s temporaries, just cast through the type.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45827
Use a constant input operand instead of a bogus memory reference to tell
the compiler about offsetof(struct tcb, tcb_thread) in the fs segment.
Otherwise gcc complains if we tell it we are reading memory offset 0x10.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45828
Use a constant input operand instead of a bogus memory reference to tell
the compiler about offsetof(struct tcb, tcb_thread) in the gs segment.
Otherwise gcc complains if we tell it we are reading memory offset 0x8.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45829
The actual types of pthread_func_t and interpos_func_t are not used.
Declare them as the generic void (*)(void) which suppresses warnings.

https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wcast-function-type

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45830
Fixes a wrong rwq->buf_size assignment. The field was assigned 0 upon a
successful call to ibv_init_wq.

Fixes:		a687910
Sponsored by:	Juniper Networks, Inc.
MFC after:	1 week
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45833
Autoconf 2.72 uses '' rather tha `' in comments in config.h, from
autoconf commit 64df9b4523fe ("Autoconf now quotes 'like this' instead
of `like this'").

Switch quoting style now to minimize diffs on the next OpenSSH update
and config.h regen.

Reviewed by:	gordon, philip
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45840
Add back, with editing, the comments about branch prediction, when to
use it, etc. Offer stronger opinions about this in style(9). Add in the
convention for FreeBSD that we do only the entire expression in the if
expression. Advise use only when it makes things measurably faster.

Requested by:		jhb
Sponsored by:		Netflix
Reviewed by:		brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D45837
ioctl commands such as BIOCSETIF take a struct ifreq and due to
FreeBSD's ioctl implementation copy exactly sizeof(struct ifreq) bytes
in so allocate that much space.

The over-allocaton was harmless, but useless.

Reported by:	def
Fixes:		e2dc8d7 dhclient: do not add 0.0.0.0 interface alias.
Sponsored by:	DARPA, AFRL

Reviewed by:	def
Differential Revision:	https://reviews.freebsd.org/D45769
vtblk_poll_request() is used for kernel dumps and for fetching the block
device's identifier string during device probing.  In the latter case,
it was not calling bus_dmamap_sync() after completing the I/O, but this
is required in general.

Thus:
- Factor out per-request code from vtblk_queue_completed().
- Use it in vtblk_poll_request() once virtqueue_poll() finishes.
- While here, assert that virtqueue_poll() returns the request that we
  expect.

Reported by:	KMSAN
Fixes:		782105f ("vtblk: Use busdma")
Reviewed by:	cperciva, imp
Sponsored by:	Klara, Inc.
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D45665
The mbuf flag M_HASFCS was introduced for drivers to indicate the net
stack that packets include FCS (Frame Check Sequence). In principle, to
be efficient, FCS should always be processed by hardware, firmware, or
at last sort the driver. Well, Ethernet specifies that damaged frames
should be discarded, thus only good ones will be passed up to the net
stack, then it makes no senses for the net stack to see FCS just to trim
it.

The last consumer of the flag M_HASFCS has been removed since change [1].
It is time to retire it.

1. 105a4f7 ng_atmllc: remove

Reviewed by:	kp
MFC after:	never
Differential Revision:	https://reviews.freebsd.org/D42391
* Remove a now superfluous FALLTHROUGH hint
* Don't specify "-p" with an empty argument in the tests

Reported by:	jhb
MFC after:	1 week
MFC with:	edbd489
In pmap_mask_set_locked(), correctly handle a starting address that is
in the middle of an L3C page.  The symptoms arising from this error
included assertion failures in pmap_demote_l3c().

Reported by:	andrew
Reviewed by:	markj
Fixes:	fd6cb03 "arm64 pmap: Add ATTR_CONTIGUOUS support [Part 1]"
Differential Revision:	https://reviews.freebsd.org/D45851
Cherry-pick fix:
upstream: when sending ObscureKeystrokeTiming chaff packets, we
can't rely on channel_did_enqueue to tell that there is data to send. This
flag indicates that the channels code enqueued a packet on _this_ ppoll()
iteration, not that data was enqueued in _any_ ppoll() iteration in the
timeslice. ok markus@

OpenBSD-Commit-ID: 009b74fd2769b36b5284a0188ade182f00564136

Obtained from:	openssh-portable 146c420d29d0
Reviewed by:	gordon
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45823
@bsdjhb bsdjhb merged commit 4a3a2fd into CTSRD-CHERI:dev Oct 30, 2024
29 checks passed
@bsdjhb bsdjhb deleted the merge-freebsd-20240705 branch October 30, 2024 14:08
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.