Re: [kvm-unit-tests PATCH 08/16] svm: add nested shutdown test.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 20, 2022, Maxim Levitsky wrote:
> On Thu, 2022-10-20 at 18:23 +0300, Maxim Levitsky wrote:
> > +static void svm_shutdown_intercept_test(void)
> > +{
> > +	void* unmapped_address = alloc_vpage();
> > +
> > +	/*
> > +	 * Test that shutdown vm exit doesn't crash L0
> > +	 *
> > +	 * Test both native and emulated triple fault
> > +	 * (due to exception merging)
> > +	 */
> > +
> > +
> > +	/*
> > +	 * This will usually cause native SVM_EXIT_SHUTDOWN
> > +	 * (KVM usually doesn't intercept #PF)
> > +	 * */
> > +	test_set_guest(shutdown_intercept_test_guest);
> > +	vmcb->save.idtr.base = (u64)unmapped_address;
> > +	vmcb->control.intercept |= (1ULL << INTERCEPT_SHUTDOWN);
> > +	svm_vmrun();
> > +	report (vmcb->control.exit_code == SVM_EXIT_SHUTDOWN, "shutdown (BP->PF->DF->TRIPLE_FAULT) test passed");
> > +
> > +	/*
> > +	 * This will usually cause emulated SVM_EXIT_SHUTDOWN
> > +	 * (KVM usually intercepts #UD)
> > +	 */
> > +	test_set_guest(shutdown_intercept_test_guest2);
> > +	vmcb_ident(vmcb);
> > +	vmcb->save.idtr.limit = 0;
> > +	vmcb->control.intercept |= (1ULL << INTERCEPT_SHUTDOWN);
> > +	svm_vmrun();
> > +	report (vmcb->control.exit_code == SVM_EXIT_SHUTDOWN, "shutdown (UD->DF->TRIPLE_FAULT) test passed");
> > +}
> > +
> >  struct svm_test svm_tests[] = {
> >  	{ "null", default_supported, default_prepare,
> >  	  default_prepare_gif_clear, null_test,
> > @@ -3382,6 +3432,7 @@ struct svm_test svm_tests[] = {
> >  	TEST(svm_intr_intercept_mix_smi),
> >  	TEST(svm_tsc_scale_test),
> >  	TEST(pause_filter_test),
> > +	TEST(svm_shutdown_intercept_test),
> >  	{ NULL, NULL, NULL, NULL, NULL, NULL, NULL }
> >  };
> 
> Note that on unpatched KVM, this test will cause a kernel panic on the host
> if run.
> 
> I sent a patch today with a fix for this.

I'm confused.  The KVM patches address a bug where KVM screws up if the SHUTDOWN
(or INIT) is _not_ intercepted by L1, but the test here does intercept SHUTDOWN.
Are there more bugs lurking in KVM, or am I missing something?



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux