On Thu, Feb 17, 2022 at 3:55 AM Shukla, Manali <mashukla@xxxxxxx> wrote: > > > > On 2/15/2022 1:00 AM, Sean Christopherson wrote: > > On Mon, Feb 07, 2022, Manali Shukla wrote: > >> Add following 2 routines : > >> 1) set_user_mask_all() - set PT_USER_MASK for all the levels of page tables > >> 2) clear_user_mask_all - clear PT_USER_MASK for all the levels of page tables > >> > >> commit 916635a813e975600335c6c47250881b7a328971 > >> (nSVM: Add test for NPT reserved bit and #NPF error code behavior) > >> clears PT_USER_MASK for all svm testcases. Any tests that requires > >> usermode access will fail after this commit. > > > > Gah, I took the easy route and it burned us. I would rather we start breaking up > > the nSVM and nVMX monoliths, e.g. add a separate NPT test and clear the USER flag > > only in that test, not the "common" nSVM test. > > Yeah. I agree. I will try to set/clear User flag in svm_npt_rsvd_bits_test() and > set User flag by default for all the test cases by calling setup_vm() > and use walk_pte() to set/clear User flag in svm_npt_rsvd_bits_test(). > > Walk_pte() routine uses start address and length to walk over the memory > region where flag needs to be set/clear. So start address and length need to be > figured out to use this routine. For the start address and length you can use 'stext' and 'etext' to compute those. There's an example in access.c set_cr4_smep(), however, it uses walk_ptes() as opposed to walk_pte() (similar, but different). > > I will work on this. > > > > > If we don't do that, this should really use walk_pte() instead of adding yet > > another PTE walker. > > -Manali