Skip to content

Releng/14.2 patch #351

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

Closed
wants to merge 474 commits into from
Closed

Releng/14.2 patch #351

wants to merge 474 commits into from

Conversation

ericbsd
Copy link
Member

@ericbsd ericbsd commented Feb 5, 2025

Summary by Sourcery

Update man pages and remove MD5 interceptors.

Enhancements:

  • Remove MD5 interceptors from sanitizer_common.
  • Improve handling of ifa/ifn changes in SCTP.
  • Improve vnode allocation.
  • Fix DMA issue on certain ARM64 devices.
  • Fix ACPI quirk on Graviton systems.
  • Improve handling of interrupt flags.
  • Fix struct fid size issues.
  • Add support for Meteor Lake I2C controllers.
  • Add ACPI GPIO bus driver.
  • Add ACPI Event Information Device driver.
  • Fix potential buffer overflow in ktrace.
  • Fix bell pitch calculation on non-vt4 consoles.
  • Improve error handling in etcupdate.
  • Update cloud image.
  • Add OCI image build support.
  • Add wifi-firmware-kmod to release images.
  • Update pkg repo URL.
  • Fix potential overflow in mktime.
  • Improve unicode handling in loader.
  • Fix potential memory leak in iichid.
  • Fix potential null pointer dereference in device pager.
  • Fix potential null pointer dereference in proc_vmmap_out.
  • Fix potential null pointer dereference in vm_object_list_handler.
  • Fix xdr_void prototype.
  • Update FreeBSD version to 1402000.
  • Fix rate control tunable documentation.
  • Fix firmware package installation.
  • Fix handling of conflicts directory permissions.
  • Fix handling of swapped pages in vmstat.
  • Fix handling of unmapped resources in bus_generic_rman.
  • Fix handling of interrupt resources in bus_generic_rman.
  • Fix handling of ifa/ifn changes in sctp_bsd_addr.
  • Fix handling of boot firmware in iwm(4).

Documentation:

  • Clarify supported chipsets and driver names in affected drivers.
  • Document new loader tunables.
  • Add SPDX license identifiers.
  • Update supported devices lists.
  • Improve formatting of examples and lists.
  • Note removal of MD5 interceptors.
  • Add deprecation notice for syscons(4).
  • Correct various typos and inaccuracies.

Tests:

  • Add makefs ZFS tests.

np-2020 and others added 30 commits October 21, 2024 10:05
eanbled -> enabled

(cherry picked from commit b533280)
Clear the EQ_HW_ALLOCATED flag with the wrq lock held and discard all
work requests, pending or new, when it's not set.

Sponsored by:	Chelsio Communications

(cherry picked from commit 0a9d1da)
Add a reset_adapter wrapper that picks the most suitable reset routine
internally.  Use it in the fatal error handler as well as the sysctl
based reset.

Sponsored by:	Chelsio Communications

(cherry picked from commit d668a0b)
Sponsored by:	Chelsio Communications

(cherry picked from commit 1e584ca)
Now that suspend/resume is supported by the base driver, a fatal error
isn't the only reason that the RNIC can stop abruptly.  Also, this state
is no longer permanent as it's possible to resume operations after a
stop.  Rename the flag and associated routines to match the new state of
affairs.

Sponsored by:	Chelsio Communications

(cherry picked from commit 8254a27)
backlog is an int and not a string.  While here, fix an adjacent CTR
that was spread over two lines even though it fits in one.

Sponsored by:	Chelsio Communications

(cherry picked from commit 3f250bb)
Avoid a pointless assignment while here.

Sponsored by:	Chelsio Communications

(cherry picked from commit 3b4dcc0)
Stop allocating new resources when the RNIC is stopped but continue to
allow previously allocated resources to be freed.  Note that t4_tom's
uld_stop tears down all TOE connections, including those being used for
iWARP, and that triggers the cleanup of iWARP resources.

Fail post_send/post_recv early too to avoid the SQ doorbell.

Sponsored by:	Chelsio Communications

(cherry picked from commit 9fdb683)
This fixes a regression in 5241b21 where the driver stopped
reporting link down after a fatal error unless t4_reset_on_fatal_err was
also set.

Fixes:	5241b21 cxgbe(4): Basic infrastructure for ULDs to participate in adapter reset.
Sponsored by:	Chelsio Communications

(cherry picked from commit 7aeec28)
This fixes a panic where the peer's ack to the synack arrives on a
different queue and do_pass_establish tries to remove the synqe from
synqe_list before it has been added by do_pass_accept_req.

Reported by:	Sony Arpita Das @ Chelsio
Fixes:	283333c cxgbe/t4_tom: Track all synq entries in a per-adapter list.
Sponsored by:	Chelsio Communications

(cherry picked from commit 674cbf3)
The STALE state means the L2T entry is valid in hardware but needs to be
refreshed (ARP/NDP) in software.  But stop/suspend wipes the hardware
L2T and STALE entries need to be updated just like VALID entries to match
actual hardware state.

Fixes:	c1c5248 cxgbe/t4_tom: Implement uld_stop and uld_restart for ULD_TOM.
Sponsored by:	Chelsio Communications

(cherry picked from commit 171e579)
The destination queue for tracing filters is destroyed during stop or
suspend and the software state needs to reflect this.  A new destination
queue will be setup when the adapter resumes operation.

Sponsored by:	Chelsio Communications

(cherry picked from commit d82cb5c)
1. Mark the L2T entry valid only if t4_write_l2e succeeds, which won't
   happen if the adapter is stopped.  This prevents L2T entries from
   sometimes getting (re)promoted to VALID on Tx activity during stop.
2. Discard a work request immediately instead of enqueueing it to the
   arp queue if the adapter is stopped.

Fixes:	c1c5248 cxgbe/t4_tom: Implement uld_stop and uld_restart for ULD_TOM.
Sponsored by:	Chelsio Communications

(cherry picked from commit 07f47e8)
An L2 entry in the driver's hash was marked STALE unconditionally if it
changed in the kernel when its driver refcount is 0.  Fix the driver to
do this for VALID entries only.

Sponsored by:	Chelsio Communications

(cherry picked from commit 3883300)
…start.

Tracers have to be recreated after a restart but that's okay given that
they are used for debugging only.

Sponsored by:	Chelsio Communications

(cherry picked from commit ee3da60)
Fixes:	c1c5248 cxgbe/t4_tom: Implement uld_stop and uld_restart for ULD_TOM.
Sponsored by:	Chelsio Communications

(cherry picked from commit cc110bb)
* Disable IFCAP_TOE automatically on all ifnets on all adapters during
  unload.  This is user-friendly and avoids panics due to stale ifnet
  state after t4_tom is unloaded.
* Do not allow unload if tids are in use by the TOE on any adapter.

Reported by:	Bimal Abraham @ Chelsio
Sponsored by:	Chelsio Communications

(cherry picked from commit 9ba8670)
adapter->flags are guarded by a synch_op, as noted in the comment in
adapter.h where the flags are defined.

Fixes:	5241b21 cxgbe(4): Basic infrastructure for ULDs to participate in adapter reset.
Sponsored by:	Chelsio Communications

(cherry picked from commit 52e5a66)
Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D45187

(cherry picked from commit 1edf61f)
The ldd32 binary is currently in the utilities package but belongs in
utilities-lib32. This patch corrects the situation.

PR:		249145
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D47023

(cherry picked from commit 53bb561)
Currently the lib32 crt files (/usr/lib32/Scrt1.o etc.) are placed in
the clibs-dev package rather than the clibs-dev-lib32 package.

The /usr/lib32/dtrace/drti.o file is similarly placed in the dtrace
package rather than the dtrace-lib32 package.

Splitting shared libraries in /usr/lib32 into a -lib32 package is
handled in bsd.lib.mk by adding "lib32" to TAGS. However bsd.files.mk
ignores TAGS and only honors ${group}TAGS since 144c442.

This patch changes the behavior of bsd.files.mk to honor TAGS if the
default FILES group is used. This matches the handling of PACKAGE, which
is also ignored unless the default FILES group is used.

With this patch, both the clibs and dtrace package are split correctly.

PR:		249145
Reviewed by:	bapt
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46991

(cherry picked from commit d5e9faf)
As of 2015 (commit b8c19fd) the fdisk man page claimed the command
is obsolete, but had no explicit mention of removal.  Add another note
that follows our current deprecation notice format.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47067

(cherry picked from commit 255d2d9)
Requested by:	rgrimes
Reviewed by:	bapt
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43585

(cherry picked from commit 86e6632)
Add a special keyword "all" for the group name, which allows genl
to monitor all groups in an existing family

(cherry picked from commit 65e7a64)
the monitor command now subscribes too all groups if no "multicast
group" is provided, this avoid potential collision with a group that
could be named "all"

(cherry picked from commit f45132d)
(cherry picked from commit 33938d8)
genl monitor nlsysevent is now able to print the messages received

(cherry picked from commit 8837228)
Following up from another review using basically the same code:
remove useless cast
replace uint32_t with unsigned int.

No functional changes expected

(cherry picked from commit 782766a)
(cherry picked from commit 8bfd7d5)
Since 2020-01-15 the ports manpage are locate in /usr/local/share/man

(cherry picked from commit 0fbfb22)
cperciva and others added 22 commits November 15, 2024 15:23
Approved by:	re (implicit)
Sponsored by:	Amazon
Approved by:	re (implicit)
Sponsored by:	Amazon
Add sys/sytm.h for __diagused which unbreaks compilation of
drm-kmod 5.10-lts on main.

Sponsored by:	The FreeBSD Foundation
Reported by:	Evgenii Khramtsov
PR:		282479
Fixes:		5c92f84
Approved by:	re (cperciva)

(cherry picked from commit 9b27051)
(cherry picked from commit 06733ce)
Add the flavored port for all the
supported wireless drivers we recently added support for.

Sponsored by:	The FreeBSD Foundation
Pointed out by:	cperciva (as part of the set of changes)
Reviewed by:	cperciva (#releng)
Approved by:    re (cperciva)
Differential Revision: https://reviews.freebsd.org/D47406

(cherry picked from commit 2483a2d)
(cherry picked from commit f21cb43)
Introduce -q to quieten other output (unless -v is also given).

pkg-install(8) currently has no option to allow skipping unavail
packages but it will just fail.
We would realy want to try to install as much firmware found as
possible from the installer.
Work around this by doing one firmware package at a time.
For that it is highly helpful to be able to query (or possibly re-query)
all outstanding fimrware packages.
-q together with -n only shows each package to be installed one by line.

Once freebsd/pkg#2195 will be implemented
we could undo this part of the change and future changes to the installer
and use the new option for pkg-install(8) there.

While here switch to getopts so -qn works and not just -q -n.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	manu
Approved by:    re (cperciva)
Differential Revision: https://reviews.freebsd.org/D47445

(cherry picked from commit 1eb3f15)
(cherry picked from commit 814a49d)
The Release Hardware Notes are generated from hardware sections in the
manual pages. Create or organize these sections in Wi-Fi driver manuals
for information flow, and perform minor maintenance on them while here.

After some testing, we have determined that a compact column list is
the best for a single column listing in the hardware release notes.
This makes very clean subsections and is for some reason denser than
using a tagged list.

This adds the long requested conversion from netmask to cidr examples.
These examples probably shouldn't even be here, but that is a discussion
for another day.

Reported by: bz (relnotes generation, cidr, test-net-1 ip4addr)
Reported by: grahamperrin (HARDWARE order mentioned in fdp-primer)
Reported by: Graham Percival <[email protected]> (don't prompt)
Reviewed by: bz (anything wrong likely is my polishing fault; incl. iwm.4)
Approved by: re (cperciva)
Differential Revision: https://reviews.freebsd.org/D47508

(cherry picked from commit 8f1a2d5)
(cherry picked from commit 93b30f1)
(cherry picked from commit 6c140ba)
Approved by:	re (cperciva)
MFC after:	3 days
Reviewed by:	ray
Differential Revision:	https://reviews.freebsd.org/D47570

(cherry picked from commit 79af8f7)
(cherry picked from commit 3bcbd39)
Add a menu to the installer to run fwget(8) inside the newly installed
system to install firmware known to be needed.
This requires working netowrking.

This is needed at least for wireless currently for when we entirely
stop shipping new firmware in src.git to have working networking on
the installed system (we already do need this for at least rtw89).

Sponsored by:	The FreeBSD Foundation
Tested with:	4 different iwlwifi chipsets in a system (earlier version)
Suggested improvments by: jrtc27
Approved by:	re (cperciva)
Differential Revision: https://reviews.freebsd.org/D47491

(cherry picked from commit bbe2a1d)
(cherry picked from commit 15f6edf)
Make sure an interface is back up before (re-)starting wpa_supplicant
in wlanconfig not relying on wpa to UP the interface (though we fixed
that).

Sponsored by:	The FreeBSD Foundation
Reviewed by:	emaste (in D47491)
Approved by:	re (cperciva)
Differential Revision: https://reviews.freebsd.org/D47491

(cherry picked from commit 5399052)
(cherry picked from commit 7d0c12e)
Wireless driver firmware is no longer added to the src tree.
In order to have wireless support in the installer for the new drivers
we install the firmware packages onto disc1 (and memstick) and dvd
if built on FreeBSD and NOPKG is not defined (to not break cross-builds
from Linux or OSX and to allow people to opt-out).

Sponsored by:	The FreeBSD Foundation
Submitted by:	cperciva (the orig. commands and where to place them)
Reviewed by:	jrtc27
Approved by:	re (cperciva)
Differential Revision: https://reviews.freebsd.org/D47407

(cherry picked from commit 7e2996c)
(cherry picked from commit b620125)
On some platforms (e.g. powerpc) we don't have packages, so we can't
install them onto the ISOs.  Proceed with building the images anyway.

Reported by:	Weekly snapshot builds
Fixes:	7e2996c ("release: install wireless firmware onto disc1 and dvd")
Approved by:	re (cperciva)

(cherry picked from commit e8263ac)
(cherry picked from commit 9431091)
The pkg-bootstrap binary depends on fetch.

Approved by:	re
Reviewed by:	cperciva, emaste, bapt
Differential Revision:	https://reviews.freebsd.org/D47661
MFC after:	1 day

(cherry picked from commit ca1f1d2)
(cherry picked from commit 4a76879)
Approved by:	re (implicit)
Sponsored by:	Amazon
- Bump BRANCH to RELEASE
- Add the anticipated RELEASE announcement date
- Set a static __FreeBSD_version

Approved by:	re (implicit)
Sponsored by:	Amazon
The sockaddr passed to ktrcapfail() may be smaller than
sizeof(struct sockaddr), and the trailing bytes in the sockaddr
structure will be uninitialized, whereupon they get copied out to
userspace.

Approved by:	so
Security:	FreeBSD-SA-25:04.ktrace
PR:		283673
Reviewed by:	jfree, emaste
Reported by:	Yichen Chai <[email protected]>
Reported by:	Zhuo Ying Jiang Li <[email protected]>
Fixes:		9bec841 ("ktrace: Record detailed ECAPMODE violations")
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D48499

(cherry picked from commit 5b86888)
(cherry picked from commit 99d5ee8)
syscallenter() has a slow path to handle syscall auditing and dtrace
syscall tracing.  It uses AUDIT_SYSCALL_ENTER() to check whether to take
the slow path, but this macro also has side effects: it writes the audit
log entry.  When systrace (dtrace syscall tracing) is enabled, this
would get short-circuited, and we end up not writing audit log entries.

Introduce a pure macro to check whether auditing is enabled, use it in
syscallenter() instead of AUDIT_SYSCALL_ENTER().

Approved by:	so
Security:	FreeBSD-EN-25:02.audit
Reviewed by:	kib
Reported by:	Joe Duin <[email protected]>
Fixes:		2f72924 ("Merge audit and systrace checks")
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D48448

(cherry picked from commit f78fe93)
(cherry picked from commit 4b9ba27)
Changes: https://github.com/eggert/tz/blob/2025a/NEWS

Approved by:	so
Security:	FreeBSD-EN-25:03.tzdata

(cherry picked from commit 46226b0)
(cherry picked from commit a158d26)
File system specific *fid structures are copied into the generic
struct fid defined in sys/mount.h.
As such, they cannot be larger than struct fid.

This patch packs the structure and checks via a __Static_assert().

Approved by:	so
Security:	FreeBSD-SA-25:02.fs
Reported by:	Kevin Miller <[email protected]>
Reviewed by:	olce, imp, kib, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D47879

(cherry picked from commit 205659c)
(cherry picked from commit 54974e7)
File system specific *fid structures are copied into the generic
struct fid defined in sys/mount.h.
As such, they cannot be larger than struct fid.

This patch packed the structure and checks via a __Static_assert().

Approved by:	so
Security:	FreeBSD-SA-25:02.fs
Reviewed by:	markj
MFC after:	2 weeks

(cherry picked from commit bfc8e33)
(cherry picked from commit 7a3a040)
File system specific *fid structures are copied into the generic
struct fid defined in sys/mount.h.
As such, they cannot be larger than struct fid.

This patch packs the structure and checks via a __Static_assert().

Approved by:	so
Security:	FreeBSD-SA-25:02.fs
Reviewed by:	markj
MFC after:	2 weeks

(cherry picked from commit 4db1b11)
(cherry picked from commit 155987e)
In the window during conflict resolution, copies of installed files with
conflicts are added here with the default mode.  Restrict access.

Approved by:	so
Security:	FreeBSD-SA-25:03.etcupdate
PR:		277470
Reviewed by:	philip, jhb, emaste
Differential Revision:	https://reviews.freebsd.org/D48576

(cherry picked from commit c43ae7a)
(cherry picked from commit 93836ff)
@ericbsd ericbsd requested review from a team as code owners February 5, 2025 22:27
Copy link

sourcery-ai bot commented Feb 5, 2025

Reviewer's Guide by Sourcery

This pull request updates man pages, removes MD5 interceptors, and simplifies some SCTP functions.

Class diagram showing removed MD5 interceptor functions

classDiagram
    class MD5_Interceptors {
        -MD5Init(context)
        -MD5Update(context, data, len)
        -MD5Final(digest, context)
        -MD5End(context, buf)
        -MD5File(filename, buf)
        -MD5Data(data, len, buf)
    }
    note for MD5_Interceptors "All MD5 interceptor functions removed"
Loading

Class diagram showing simplified SCTP functions

classDiagram
    class SCTP_Functions {
        +sctp_find_ifn(ifn, ifn_index)
        +sctp_add_addr_to_vrf(vrf_id, ifn, ifn_index, addr)
        +sctp_del_addr_from_vrf(vrf_id, addr, ifn, ifn_index)
        -sctp_mark_ifa_addr_down()
        -sctp_mark_ifa_addr_up()
    }
    note for SCTP_Functions "Removed: sctp_mark_ifa_addr_down() and sctp_mark_ifa_addr_up()
Simplified: sctp_find_ifn(), sctp_add_addr_to_vrf(), and sctp_del_addr_from_vrf()"
Loading

File-Level Changes

Change Details Files
Updated man pages for run, zyd, rtwn, iwm, otus, rsu, iwlwifi, rtw89, rtw88, and ural drivers to clarify supported devices and drivers, update copyright dates, and improve formatting.
  • Clarified supported devices and drivers.
  • Updated copyright dates.
  • Improved formatting.
  • Replaced .It tags with .Pp and .Dl macros for better readability.
  • Added .Xr networking 7 to SEE ALSO sections.
share/man/man4/run.4
share/man/man4/zyd.4
share/man/man4/rtwn.4
share/man/man4/iwm.4
share/man/man4/otus.4
share/man/man4/rsu.4
share/man/man4/iwlwifi.4
share/man/man4/rtw89.4
share/man/man4/rtw88.4
share/man/man4/ural.4
share/man/man4/iwi.4
Removed MD5 interceptors from sanitizer_common_interceptors.inc.
  • Removed MD5Init, MD5Update, MD5Final, MD5End, MD5File, and MD5Data interceptors.
  • Removed INIT_MD5 macro definition.
contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
Simplified sctp_find_ifn(), sctp_add_addr_to_vrf(), and sctp_del_addr_from_vrf() functions in sctp_pcb.c.
  • Added KASSERT to sctp_find_ifn() to check for NULL ifn.
  • Removed redundant checks and simplified logic in sctp_find_ifn().
  • Simplified validation logic in sctp_add_addr_to_vrf() and sctp_del_addr_from_vrf().
  • Removed sctp_mark_ifa_addr_down() and sctp_mark_ifa_addr_up() functions.
sys/netinet/sctp_pcb.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ericbsd - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The removal of MD5 (and associated SHA2) interceptors simplifies sanitizer common code; please ensure that all build‐ and runtime tests that depend on these functions have been updated and that no ABI or regression issues occur as a result.
  • Many man pages, configuration files, and release scripts were updated (e.g. SPDX license headers, update to release dates, removal of outdated functions, and new OCI support). Please double-check that all documentation and script changes are consistent across the codebase and that any new functionality (such as OCI image build support) is properly exercised and integrated with existing tooling.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟡 Security: 1 issue found
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines 2719 to 2723
kve->kve_ref_count = obj->ref_count;
kve->kve_shadow_count = obj->shadow_count;
if (obj->type == OBJT_DEVICE ||
obj->type == OBJT_MGTDEVICE) {
cdev = obj->un_pager.devp.dev;
if ((obj->type == OBJT_DEVICE ||
obj->type == OBJT_MGTDEVICE) &&
(obj->flags & OBJ_CDEVH) != 0) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 suggestion (security): Use VM_OBJECT_ASSERT_LOCKED when accessing object flags

Add assertions to verify the VM object lock is held when checking flags and accessing the handle field.

Suggested change
kve->kve_ref_count = obj->ref_count;
kve->kve_shadow_count = obj->shadow_count;
if (obj->type == OBJT_DEVICE ||
obj->type == OBJT_MGTDEVICE) {
cdev = obj->un_pager.devp.dev;
if ((obj->type == OBJT_DEVICE ||
obj->type == OBJT_MGTDEVICE) &&
(obj->flags & OBJ_CDEVH) != 0) {
kve->kve_ref_count = obj->ref_count;
kve->kve_shadow_count = obj->shadow_count;
VM_OBJECT_ASSERT_LOCKED(obj);
if ((obj->type == OBJT_DEVICE ||
obj->type == OBJT_MGTDEVICE) &&
(obj->flags & OBJ_CDEVH) != 0) {

@ericbsd ericbsd changed the base branch from stable/14 to releng/14.2 February 5, 2025 22:31
@ericbsd ericbsd closed this Feb 5, 2025
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.