Page MenuHomeFreeBSD

riscv pmap: allocate leaf page table page for wired userspace superpages
ClosedPublic

Authored by bnovkov on Aug 29 2023, 2:21 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jun 30, 8:44 PM
Unknown Object (File)
Sat, Jun 29, 7:50 PM
Unknown Object (File)
Sat, Jun 29, 12:33 AM
Unknown Object (File)
Sat, Jun 29, 12:18 AM
Unknown Object (File)
Thu, Jun 27, 12:56 PM
Unknown Object (File)
Jun 22 2024, 5:47 PM
Unknown Object (File)
Jun 19 2024, 5:57 PM
Unknown Object (File)
Jun 3 2024, 2:44 PM
Subscribers

Details

Summary

This patch fixes a syzkaller issue regarding wired userspace superpages by allocating a leaf page table page for wired userspace superpages.

The original issue is an edge case that creates an unmapped, wired region in userspace. Subsequent faults on this region can trigger wired superpage creation, leading to a panic upon demotion as the pmap does not create a leaf page table page for the wired superpage. D19670 fixed this by disallowing preemptive creation of wired superpage mappings, but that fix is currently interfering with an ongoing effort of speeding up vm_map_wire for large, contiguous entries (e.g. bhyve wiring guest memory) .

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

This revision is now accepted and ready to land.Sep 17 2023, 11:22 AM

Is there a reason this hasn't been merged but the versions for other architectures have?

If it's a matter of testing, please let me know.

Is there a reason this hasn't been merged but the versions for other architectures have?

If it's a matter of testing, please let me know.

There are some pmap changes that I've ported over to riscv that we'd like to rebase this patch on top of. I just need to test my patch for that, hopefully this week.

Is there a reason this hasn't been merged but the versions for other architectures have?

If it's a matter of testing, please let me know.

There are some pmap changes that I've ported over to riscv that we'd like to rebase this patch on top of. I just need to test my patch for that, hopefully this week.

The above mentioned changes are in a patch series on phabricator now: https://reviews.freebsd.org/D42287

Also here: https://github.com/markjdb/freebsd/commits/riscv-pmap-improvements

Sorry for the delayed reply. The above-mentioned riscv pmap commits are in main now - @bojan.novkovic_fer.hr would it be possible to rebase on top of that? Then I can commit this patch, and we can finally revert D19670.

This revision now requires review to proceed.Nov 7 2023, 6:14 PM

Sorry for the delayed reply. The above-mentioned riscv pmap commits are in main now - @bojan.novkovic_fer.hr would it be possible to rebase on top of that? Then I can commit this patch, and we can finally revert D19670.

No problem, thank you for taking the time to work on those commits.
I've updated the patch on top of your changes.

This revision was not accepted when it landed; it landed in state Needs Review.Nov 8 2023, 12:32 PM
This revision was automatically updated to reflect the committed changes.
In D41633#969735, @bojan.novkovic_fer.hr wrote:

Sorry for the delayed reply. The above-mentioned riscv pmap commits are in main now - @bojan.novkovic_fer.hr would it be possible to rebase on top of that? Then I can commit this patch, and we can finally revert D19670.

No problem, thank you for taking the time to work on those commits.
I've updated the patch on top of your changes.

Would you like to do the honours of reverting the vm_fault change? :)

Would you like to do the honours of reverting the vm_fault change? :)

Of course! I've created a revision.