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: <Yn0bJkjgDOxPxDU4@google.com>
Date:   Thu, 12 May 2022 14:35:18 +0000
From:   Sean Christopherson <seanjc@...gle.com>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
        "H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org,
        "Guilherme G . Piccoli" <gpiccoli@...lia.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Paolo Bonzini <pbonzini@...hat.com>
Subject: Re: [PATCH 1/2] x86/crash: Disable virt in core NMI crash handler to
 avoid double list_add

On Thu, May 12, 2022, Sean Christopherson wrote:
> On Thu, May 12, 2022, Thomas Gleixner wrote:
> > Sean,
> > 
> > On Wed, May 11 2022 at 23:43, Sean Christopherson wrote:
> > > @@ -840,6 +858,20 @@ void nmi_shootdown_cpus(nmi_shootdown_cb callback)
> > >  	unsigned long msecs;
> > >  	local_irq_disable();
> > >  
> > > +	/*
> > > +	 * Invoking multiple callbacks is not currently supported, registering
> > > +	 * the NMI handler twice will cause a list_add() double add BUG().
> > > +	 * The exception is the "nop" handler in the emergency reboot path,
> > > +	 * which can run after e.g. kdump's shootdown.  Do nothing if the crash
> > > +	 * handler has already run, i.e. has already prepared other CPUs, the
> > > +	 * reboot path doesn't have any work of its to do, it just needs to
> > > +	 * ensure all CPUs have prepared for reboot.
> > 
> > This is confusing at best. The double list add is just one part of the
> > problem, which would be trivial enough to fix.
> > 
> > The real point is that after the first shoot down all other CPUs are
> > stuck in crash_nmi_callback() and won't respond to the second NMI.
> 
> Well that's embarrasingly obvious in hindsight.
> 
> > 
> > So trying to run this twice is completely pointless and guaranteed to
> > run into the timeout.
> > 
> > > +	 */
> > > +	if (shootdown_callback) {
> > > +		WARN_ON_ONCE(callback != nmi_shootdown_nop);
> > > +		return;
> > 
> > Instead of playing games with the callback pointer, I prefer to make
> > this all explicit. Delta patch below.
> 
> Much better.  If you're planning on doing fixup, can you also include a comment
> tweak about why the callback is left set?  If not, I'll do it in v2.  A bit
> overkill, but it's another thing that for me was obvious only once I realized "why".

Actually, I'll send a v2, there's some more cleanup that can be done if patch 2
uses cpu_crash_disable_virtualization().

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ