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: <Z-SwK1xO_S4phG2o@google.com>
Date: Wed, 26 Mar 2025 18:55:55 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Atish Kumar Patra <atishp@...osinc.com>
Cc: Anup Patel <anup@...infault.org>, Atish Patra <atishp@...shpatra.org>, 
	Paul Walmsley <paul.walmsley@...ive.com>, Palmer Dabbelt <palmer@...belt.com>, 
	Alexandre Ghiti <alex@...ti.fr>, Andrew Jones <ajones@...tanamicro.com>, 
	Anup Patel <apatel@...tanamicro.com>, kvm@...r.kernel.org, 
	kvm-riscv@...ts.infradead.org, linux-riscv@...ts.infradead.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] RISC-V: KVM: Teardown riscv specific bits after kvm_exit

On Thu, Mar 20, 2025, Atish Kumar Patra wrote:
> On Mon, Mar 17, 2025 at 9:08 AM Sean Christopherson <seanjc@...gle.com> wrote:
> > On Mon, Mar 17, 2025, Atish Patra wrote:
> > >  arch/riscv/kvm/main.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/arch/riscv/kvm/main.c b/arch/riscv/kvm/main.c
> > > index 1fa8be5ee509..4b24705dc63a 100644
> > > --- a/arch/riscv/kvm/main.c
> > > +++ b/arch/riscv/kvm/main.c
> > > @@ -172,8 +172,8 @@ module_init(riscv_kvm_init);
> > >
> > >  static void __exit riscv_kvm_exit(void)
> > >  {
> > > -     kvm_riscv_teardown();
> > > -
> > >       kvm_exit();
> > > +
> > > +     kvm_riscv_teardown();
> >
> > I wonder if there's a way we can guard against kvm_init()/kvm_exit() being called
> > too early/late.  x86 had similar bugs for a very long time, e.g. see commit
> > e32b120071ea ("KVM: VMX: Do _all_ initialization before exposing /dev/kvm to userspace").
> >
> > E.g. maybe we do something like create+destroy a VM at the end of kvm_init() and
> > the beginning of kvm_exit()?  Not sure if that would work for kvm_exit(), but it
> > should definitely be fine for kvm_init().
> >
> Yes. That would be super useful. I am not sure about the exact
> mechanism to achieve that though.

Me either :-)

> Do you just test code guarded within a new config that just
> creates/destroys a dummy VM ?

That's only idea I could come up with too, but I don't particulary like it.

> May be kunit test for KVM fits here in some way ?

I don't think a kunit test would be a good fit, there are likely too many
dependencies, and I'm pretty sure we'd still need to hack KVM.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ