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: <klvglwa5uxl3xfsmrgvbz7f36nchj57h4jszleabrggayztf53@o3t5g2pau6o2>
Date: Mon, 24 Nov 2025 15:35:17 +0000
From: Yosry Ahmed <yosry.ahmed@...ux.dev>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, Ken Hofsass <hofsass@...gle.com>, 
	kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] KVM: x86: Add CR3 to guest debug info

On Mon, Nov 24, 2025 at 06:45:22AM -0800, Sean Christopherson wrote:
> On Fri, Nov 21, 2025, Yosry Ahmed wrote:
> > On Fri, Nov 21, 2025 at 01:01:40PM -0800, Sean Christopherson wrote:
> > > On Fri, Nov 21, 2025, Yosry Ahmed wrote:
> > > KVM already provides kvm_run.kvm_valid_regs to let userspace grab register state
> > > on exit to userspace.  If userspace is debugging, why not simply save all regs on
> > > exit?
> > > 
> > > If the answer is "because it slows down all other exits", then I would much rather
> > > give userspace the ability to conditionally save registers based on the exit reason,
> > > e.g. something like this (completely untested, no CAP, etc.)
> > 
> > I like this approach conceptually, but I think it's an overkill for this
> > use case tbh. Especially the memory usage, that's 1K per vCPU for the
> > bitmap. I know it can be smaller, but probably not small either because
> > it will be a problem if we run out of bits.
> > > diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> > > index 52f6000ab020..452805c1337b 100644
> > > --- a/include/uapi/linux/kvm.h
> > > +++ b/include/uapi/linux/kvm.h
> > > @@ -494,8 +494,12 @@ struct kvm_run {
> > >                 struct kvm_sync_regs regs;
> > >                 char padding[SYNC_REGS_SIZE_BYTES];
> > >         } s;
> > > +
> > > +       __u64 kvm_save_regs_on_exit[16];
> 
> Heh, check your math.  It's 1024 bits, 128 bytes.  Reserving space for 1024 exits
> is likely extreme overkill given that KVM is sitting at 40 exits after ~18 years,
> so as you say we could cut that down significantly depending on how willing we are
> to risk having to add kvm_save_regs_on_exit2 in the future.

Oh well, I am gonna try and blame this one on Friday afternoon :D

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ