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: <20210106110435.cajpxwbew4t5afye@liuwe-devbox-debian-v2>
Date:   Wed, 6 Jan 2021 11:04:35 +0000
From:   Wei Liu <wei.liu@...nel.org>
To:     Michael Kelley <mikelley@...rosoft.com>
Cc:     Wei Liu <wei.liu@...nel.org>,
        Linux on Hyper-V List <linux-hyperv@...r.kernel.org>,
        "stable@...nel.org" <stable@...nel.org>,
        KY Srinivasan <kys@...rosoft.com>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        Stephen Hemminger <sthemmin@...rosoft.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
        "H. Peter Anvin" <hpa@...or.com>,
        "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" 
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86/hyperv: check cpu mask after interrupt has been
 disabled

On Tue, Jan 05, 2021 at 06:20:05PM +0000, Michael Kelley wrote:
> From: Wei Liu <wei.liu@...nel.org> Sent: Tuesday, January 5, 2021 9:51 AM
> > 
> > We've observed crashes due to an empty cpu mask in
> > hyperv_flush_tlb_others.  Obviously the cpu mask in question is changed
> > between the cpumask_empty call at the beginning of the function and when
> > it is actually used later.
> > 
> > One theory is that an interrupt comes in between and a code path ends up
> > changing the mask. Move the check after interrupt has been disabled to
> > see if it fixes the issue.
> > 
> > Signed-off-by: Wei Liu <wei.liu@...nel.org>
> > Cc: stable@...nel.org
> > ---
> >  arch/x86/hyperv/mmu.c | 12 +++++++++---
> >  1 file changed, 9 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/x86/hyperv/mmu.c b/arch/x86/hyperv/mmu.c
> > index 5208ba49c89a..2c87350c1fb0 100644
> > --- a/arch/x86/hyperv/mmu.c
> > +++ b/arch/x86/hyperv/mmu.c
> > @@ -66,11 +66,17 @@ static void hyperv_flush_tlb_others(const struct cpumask *cpus,
> >  	if (!hv_hypercall_pg)
> >  		goto do_native;
> > 
> > -	if (cpumask_empty(cpus))
> > -		return;
> > -
> >  	local_irq_save(flags);
> > 
> > +	/*
> > +	 * Only check the mask _after_ interrupt has been disabled to avoid the
> > +	 * mask changing under our feet.
> > +	 */
> > +	if (cpumask_empty(cpus)) {
> > +		local_irq_restore(flags);
> > +		return;
> > +	}
> > +
> >  	flush_pcpu = (struct hv_tlb_flush **)
> >  		     this_cpu_ptr(hyperv_pcpu_input_arg);
> > 
> > --
> > 2.20.1
> 
> Reviewed-by:  Michael Kelley <mikelley@...rosoft.com>
> 

Applied to hyperv-fixes.

Wei.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ