* [PATCH kvm-unit-tests] x86: access: check for PKU even for non-writable pages
@ 2016-04-06 8:19 Paolo Bonzini
2016-04-06 15:11 ` Xiao Guangrong
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2016-04-06 8:19 UTC (permalink / raw)
To: kvm; +Cc: guangrong.xiao
Xiao Guangrong ran kvm-unit-tests on an actual machine with PKU and
found that it fails:
test pte.p pte.user pde.p pde.user pde.a pde.pse pkru.wd pkey=1 user write efer.nx cr4.pke: FAIL: error code 27 expected 7
Dump mapping: address: 0x123400000000
------L4: 2ebe007
------L3: 2ebf007
------L2: 8000000020000a5
So PFEC.PKEY is set even if the ordinary check failed (which it did
because pde.w is zero). Adjust ac_test_permissions to match behavior
of silicon.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
x86/access.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/x86/access.c b/x86/access.c
index 7caada8..8df2da8 100644
--- a/x86/access.c
+++ b/x86/access.c
@@ -353,9 +353,7 @@ pt_element_t ac_test_permissions(ac_test_t *at, unsigned flags, bool writable,
if (F(AC_ACCESS_FETCH) && user && F(AC_CPU_CR4_SMEP))
at->expected_fault = 1;
- if (user && !F(AC_ACCESS_FETCH) &&
- F(AC_PKU_PKEY) && F(AC_CPU_CR4_PKE) &&
- !at->expected_fault) {
+ if (user && !F(AC_ACCESS_FETCH) && F(AC_PKU_PKEY) && F(AC_CPU_CR4_PKE)) {
if (F(AC_PKU_AD)) {
at->expected_fault = 1;
at->expected_error |= PFERR_PK_MASK;
--
2.5.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH kvm-unit-tests] x86: access: check for PKU even for non-writable pages
2016-04-06 8:19 [PATCH kvm-unit-tests] x86: access: check for PKU even for non-writable pages Paolo Bonzini
@ 2016-04-06 15:11 ` Xiao Guangrong
0 siblings, 0 replies; 2+ messages in thread
From: Xiao Guangrong @ 2016-04-06 15:11 UTC (permalink / raw)
To: Paolo Bonzini, kvm
On 04/06/2016 04:19 PM, Paolo Bonzini wrote:
> Xiao Guangrong ran kvm-unit-tests on an actual machine with PKU and
> found that it fails:
>
> test pte.p pte.user pde.p pde.user pde.a pde.pse pkru.wd pkey=1 user write efer.nx cr4.pke: FAIL: error code 27 expected 7
> Dump mapping: address: 0x123400000000
> ------L4: 2ebe007
> ------L3: 2ebf007
> ------L2: 8000000020000a5
>
> So PFEC.PKEY is set even if the ordinary check failed (which it did
> because pde.w is zero). Adjust ac_test_permissions to match behavior
> of silicon.
It works.
Reviewed-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-06 15:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-06 8:19 [PATCH kvm-unit-tests] x86: access: check for PKU even for non-writable pages Paolo Bonzini
2016-04-06 15:11 ` Xiao Guangrong
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.