Re: [kvm-unit-tests PATCH v2 3/4] x86/access: Forced emulation support

Sean Christopherson
2023-03-31T16:29:45Z

On Fri, Mar 31, 2023, Mathias Krause wrote:
> Add support to enforce access tests to be handled by the emulator, if
> supported by KVM. Exclude it from the ac_test_exec() test, though, to
> not slow it down too much.

/enthusiastic high five

I was going to ask if you could extend the test to utilize FEP, and woke up this
morning to see it already done. Thanks!!!!!

> Signed-off-by: Mathias Krause <minipli@grsecurity.net>
> ---

...

> @@ -152,6 +161,7 @@ const char *ac_names[] = {
> [AC_CPU_CR0_WP_BIT] = "cr0.wp",
> [AC_CPU_CR4_SMEP_BIT] = "cr4.smep",
> [AC_CPU_CR4_PKE_BIT] = "cr4.pke",
> + [AC_FEP_BIT] = "fep",
> };
>
> static inline void *va(pt_element_t phys)
> @@ -190,6 +200,7 @@ typedef struct {
>
> static void ac_test_show(ac_test_t *at);
>
> +static bool fep_available;

I don't think fep_available needs to be captured in a global bool, the usage in
the CR0_WP test can do

if (invalid_mask & AC_FEP_MASK)
<skip>