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]
Date:   Fri, 7 Oct 2022 17:28:43 +0000
From:   Sean Christopherson <seanjc@...gle.com>
To:     Hao Peng <flyingpenghao@...il.com>
Cc:     pbonzini@...hat.com, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kvm: x86: Keep the lock order consistent

On Fri, Oct 07, 2022, Hao Peng wrote:
> From: Peng Hao <flyingpeng@...cent.com>
> 
> srcu read side in critical section may sleep, so it should precede
> the read lock,

I agree with the patch, but not necessarily with this statement.  The above
implies that it's not safe to acquire SRCU while in a non-sleepable context,
which is incorrect.  E.g. at first I thought the above implied there is an
incorrect sleep buried in this code.

> while other paths such as kvm_xen_set_evtchn_fast

Please put parantheses after function names, e.g. kvm_xen_set_evtchn_fast()
and srcu_read_lock().

> execute srcu_read_lock before acquiring the read lock.

How about this for a changelog?

  Acquire SRCU before taking the gpc spinlock in wait_pending_event() so as
  to be consistent with all other functions that acquire both locks.  It's
  not illegal to acquire SRCU inside a spinlock, nor is there deadlock
  potential, but in general it's preferable to order locks from least
  restrictive to most restrictive, e.g. if wait_pending_event() needed to
  sleep for whatever reason, it could do so while holding SRCU, but would
  need to drop the spinlock.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ