Page MenuHomeFreeBSD

Fix assert condition in pmap_large_unmap()
ClosedPublic

Authored by scottph on Nov 26 2018, 9:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 15 2024, 5:37 PM
Unknown Object (File)
Mar 15 2024, 2:24 PM
Unknown Object (File)
Jan 3 2024, 1:45 AM
Unknown Object (File)
Dec 22 2023, 9:38 PM
Unknown Object (File)
Nov 17 2023, 10:01 AM
Unknown Object (File)
Nov 15 2023, 8:41 PM
Unknown Object (File)
Oct 16 2023, 2:27 AM
Unknown Object (File)
Oct 14 2023, 7:41 PM
Subscribers

Details

Summary

pmap_large_unmap() asserts that an unmapping request covers the
entirety of a 2 MByte or 1 GByte page. The logic in the asserts
was out of date with the loop logic though, asserting on valid
unmap requests when where these larger pages were in use.

Test Plan

kldload/kldunload nvdimm.ko

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/amd64/amd64/pmap.c
8444 ↗(On Diff #51133)

I would actually suggest rewriting this assertion to be

va + NBPDP <= sva + len

In other words, destroying the current superpage mapping does not unmap addresses beyond those requested by the caller.

I speculate that at one point in the development of this function len was the residual number of bytes left to unmap on each iteration. Then, the current assertion would have made sense.

8460 ↗(On Diff #51133)

And, similarly

va + NBPDR <= sva + len
sys/amd64/amd64/pmap.c
8444 ↗(On Diff #51133)

I agree, this is the correct fix.

scottph retitled this revision from Fix inverted assert condition in pmap_large_unmap() to Fix assert condition in pmap_large_unmap().
scottph edited the summary of this revision. (Show Details)

Fix assert to use va loop variable.

This revision is now accepted and ready to land.Nov 27 2018, 8:12 PM
This revision was automatically updated to reflect the committed changes.