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] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z5fJ56t4Tw7V_QbY@google.com>
Date: Mon, 27 Jan 2025 10:01:11 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: linux-kernel@...r.kernel.org, kvm <kvm@...r.kernel.org>
Subject: Re: [PATCH 1/2] KVM: x86: fix usage of kvm_lock in set_nx_huge_pages()

On Mon, Jan 27, 2025, Paolo Bonzini wrote:
> On Sat, Jan 25, 2025 at 1:44 AM Sean Christopherson <seanjc@...gle.com> wrote:
> > I like the special casing, it makes the oddballs stand out, which in turn (hopefully)
> > makes developers pause and take note.  I.e. the SRCU walkers are all normal readers,
> > the set_nx_huge_pages() "never" path is a write in disguise, and
> > kvm_hyperv_tsc_notifier() is a very special snowflake.
> 
> set_nx_huge_pages() is not a writer in disguise.  Rather, it's
> a *real* writer for nx_hugepage_mitigation_hard_disabled which is
> also protected by kvm_lock;

Heh, agreed, I was trying to say that it's a write that is disguised as a reader.

> and there's a (mostly theoretical) bug in set_nx_huge_pages_recovery_param()
> which reads it without taking the lock.

It's arguably not a bug.  Userspace has no visibility into the order in which
param writes are processed.  If there are racing writes to the period/ratio and
"never", both outcomes are legal (rejected with -EPERM or period/ratio changes).
If nx_hugepage_mitigation_hard_disabled becomes set after the params are changed,
then vm_list is guaranteed to be empty, so the wakeup walk is still a nop.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ