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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZcF5a72HihKkLGVx@google.com>
Date: Mon, 5 Feb 2024 16:12:27 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: Andrei Vagin <avagin@...il.com>
Cc: Andrei Vagin <avagin@...gle.com>, Paolo Bonzini <pbonzini@...hat.com>, linux-kernel@...r.kernel.org, 
	x86@...nel.org, kvm@...r.kernel.org, Zhenyu Wang <zhenyuw@...ux.intel.com>, 
	Zhi Wang <zhi.a.wang@...el.com>
Subject: Re: [PATCH] kvm/x86: add capability to disable the write-track mechanism

On Mon, Feb 05, 2024, Andrei Vagin wrote:
> On Mon, Feb 5, 2024 at 10:41 AM Sean Christopherson <seanjc@...gle.com> wrote:
> >
> > On Mon, Feb 05, 2024, Andrei Vagin wrote:
> > > The write-track is used externally only by the gpu/drm/i915 driver.
> > > Currently, it is always enabled, if a kernel has been compiled with this
> > > driver.
> > >
> > > Enabling the write-track mechanism adds a two-byte overhead per page across
> > > all memory slots. It isn't significant for regular VMs. However in gVisor,
> > > where the entire process virtual address space is mapped into the VM, even
> > > with a 39-bit address space, the overhead amounts to 256MB.
> > >
> > > This change introduces the new KVM_CAP_PAGE_WRITE_TRACKING capability,
> > > allowing users to enable/disable the write-track mechanism. It is enabled
> > > by default for backward compatibility.
> >
> > I would much prefer to allocate the write-tracking metadata on-demand in
> > kvm_page_track_register_notifier(), i.e. do the same as mmu_first_shadow_root_alloc(),
> > except for just gfn_write_track.
> >
> > The only potential hiccup would be if taking slots_arch_lock would deadlock, but
> > it should be impossible for slots_arch_lock to be taken in any other path that
> > involves VFIO and/or KVMGT *and* can be coincident.  Except for kvm_arch_destroy_vm()
> > (which deletes KVM's internal memslots), slots_arch_lock is taken only through
> > KVM ioctls(), and the caller of kvm_page_track_register_notifier() *must* hold
> > a reference to the VM.
> >
> > That way there's no need for new uAPI and no need for userspace changes.
> 
> I think it is a good idea, I don't know why I didn't consider it.

Because you wanted to make me look smart ;-)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ