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)
Thu, Oct 16, 8:25 AM
Unknown Object (File)
Mon, Oct 13, 6:32 AM
Unknown Object (File)
Tue, Sep 30, 7:27 PM
Unknown Object (File)
Tue, Sep 30, 4:00 PM
Unknown Object (File)
Mon, Sep 29, 5:15 AM
Unknown Object (File)
Mon, Sep 29, 4:03 AM
Unknown Object (File)
Sun, Sep 28, 4:35 PM
Unknown Object (File)
Sun, Sep 28, 3:48 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.