Page MenuHomeFreeBSD

vm_phys: Check for overlap when adding a segment
ClosedPublic

Authored by olce on Jan 23 2025, 5:15 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Mar 6, 8:37 AM
Unknown Object (File)
Tue, Mar 4, 1:15 PM
Unknown Object (File)
Tue, Mar 4, 6:06 AM
Unknown Object (File)
Mon, Mar 3, 3:13 AM
Unknown Object (File)
Sat, Mar 1, 9:16 PM
Unknown Object (File)
Sun, Feb 23, 8:37 AM
Unknown Object (File)
Wed, Feb 19, 9:12 PM
Unknown Object (File)
Mon, Feb 17, 9:55 PM
Subscribers

Details

Summary

Segments are passed by machine-dependent routines, so explicit checks
will make debugging much easier on very weird machines or when someone
is tweaking these machine-dependent routines. Additionally, this
operation is not performance-sensitive.

For the same reasons, test that we don't reach the maximum number of
physical segments (the compile-time of the internal storage) in
production kernel (replaces the existing KASSERT()).

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

olce requested review of this revision.Jan 23 2025, 5:15 PM
sys/vm/vm_phys.c
424–430

Why is this an assertion when the other check applies to non-INVARIANTS kernels?

441

Stray semicolon at the end of the message?

olce marked 2 inline comments as done.
olce edited the summary of this revision. (Show Details)

Cater to comments.

sys/vm/vm_phys.c
424–430

Nothing strong, I just felt less compelled to convert this check to a regular test+panic as the number of domains is registered once by machine-dependent code and then passed domains are either 0 or some index from a loop using vm_ndomains as bound.

Changed to a true panic.

This revision is now accepted and ready to land.Tue, Feb 18, 8:03 PM