lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4230c304-f08b-694b-9a8e-8f5b32eeb4e8@redhat.com>
Date:   Mon, 8 Jun 2020 14:47:37 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Cathy Avery <cavery@...hat.com>, linux-kernel@...r.kernel.org,
        kvm@...r.kernel.org
Subject: Re: [PATCH kvm-unit-tests 2/2] svm: INIT intercept test

On 08/06/20 14:28, Cathy Avery wrote:
> INIT vcpu 2 and intercept the INIT. This test
> will leave the vcpu in an unusable state.
> 
> Signed-off-by: Cathy Avery <cavery@...hat.com>

It should be possible to reinitialize the vCPU using a SIPI interrupt, like

	old = cpu_online_count--;
	apic_icr_write(APIC_DEST_PHYSICAL | APIC_DEST_SIPI,
		       id_map[cpu]);
	while (cpu_online_count != old)
		cpu_relax();

You can test this by using vCPU 1 to run this test.

Paolo

> ---
>  x86/svm_tests.c | 40 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
> 
> diff --git a/x86/svm_tests.c b/x86/svm_tests.c
> index c1abd55..a4dbe91 100644
> --- a/x86/svm_tests.c
> +++ b/x86/svm_tests.c
> @@ -1789,6 +1789,43 @@ static bool virq_inject_check(struct svm_test *test)
>      return get_test_stage(test) == 5;
>  }
>  
> +static volatile bool init_intercept;
> +
> +static void init_signal_intercept_prepare(struct svm_test *test)
> +{
> +
> +    vmcb_ident(vmcb);
> +    vmcb->control.intercept |= (1ULL << INTERCEPT_INIT);
> +    init_intercept = false;
> +}
> +
> +static void init_signal_test(struct svm_test *test)
> +{
> +    apic_icr_write(APIC_DEST_SELF | APIC_DEST_PHYSICAL | APIC_DM_INIT | APIC_INT_ASSERT, 0);
> +}
> +
> +static bool init_signal_finished(struct svm_test *test)
> +{
> +    vmcb->save.rip += 3;
> +
> +    if (vmcb->control.exit_code != SVM_EXIT_INIT) {
> +        report(false, "VMEXIT not due to init intercept. Exit reason 0x%x",
> +               vmcb->control.exit_code);
> +        return true;
> +        }
> +
> +    init_intercept = true;
> +
> +    report(true, "INIT to vcpu intercepted");
> +
> +    return true;
> +}
> +
> +static bool init_signal_check(struct svm_test *test)
> +{
> +    return init_intercept;
> +}
> +
>  #define TEST(name) { #name, .v2 = name }
>  
>  /*
> @@ -1950,6 +1987,9 @@ struct svm_test svm_tests[] = {
>      { "virq_inject", default_supported, virq_inject_prepare,
>        default_prepare_gif_clear, virq_inject_test,
>        virq_inject_finished, virq_inject_check },
> +    { "svm_init_signal_intercept_test", default_supported, init_signal_intercept_prepare,
> +      default_prepare_gif_clear, init_signal_test,
> +      init_signal_finished, init_signal_check, .on_vcpu = 2 },
>      TEST(svm_guest_state_test),
>      { NULL, NULL, NULL, NULL, NULL, NULL, NULL }
>  };
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ