Fix the logic so it works as it appears.
Reported by: Coverity
Differential D26211
amd64 pmap_pkru_same: prev_ppr was always NULL vangyzen on Aug 27 2020, 3:04 PM. Authored by Tags None Referenced Files
Details
Fix the logic so it works as it appears. Reported by: Coverity I have no idea how to test this. Any advice would be appreciated.
Diff Detail
Event TimelineComment Actions This code fragment checks that PKRU index is consistent for the whole range. It is used only by superpage promotion code to ensure that promoting 2M range to superpage is possible by all PKRU keys of the constituent 4K pages being same. To test you would need a machine with PKRU support, i.e. Skylake server. Then set up anon 2M mapping aligned at 2M. Test for promotion is to touch all pages in the range, checking for promotion after that is done with mincore(2) MINCORE_SUPER. If you set the whole range with some key using x86_pkru_protect_range(), then mincore should repor MINCORE_SUPER. If at least one page was marked with different key, then after touching the range, MINCORE_SUPER must be not set. Comment Actions @kib Thank you for the detailed description. You practically wrote the test for me. Two of the test cases do not pass, so I'm not sure the other two are valid. Anyway, I don't have any more time to spend on this, and it seems valuable in its current form. Comment Actions I do not see why did not you committed the pmap.c change already. Please do, regardless of tests.
Comment Actions I like to commit a test with its corresponding bug fix. The test might take some time, though, so I'll go ahead.
|