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: <alpine.LFD.2.00.1012151633510.12146@localhost6.localdomain6>
Date:	Wed, 15 Dec 2010 16:41:55 +0100 (CET)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Jan Kiszka <jan.kiszka@...mens.com>
cc:	Jan Kiszka <jan.kiszka@....de>, Avi Kivity <avi@...hat.com>,
	Marcelo Tosatti <mtosatti@...hat.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	kvm <kvm@...r.kernel.org>, Tom Lyon <pugs@...co.com>,
	Alex Williamson <alex.williamson@...hat.com>,
	"Michael S. Tsirkin" <mst@...hat.com>
Subject: Re: [PATCH v3 2/4] genirq: Inform handler about line sharing state

On Wed, 15 Dec 2010, Jan Kiszka wrote:

> Am 15.12.2010 14:04, Thomas Gleixner wrote:
> > On Wed, 15 Dec 2010, Jan Kiszka wrote:
> >> Am 14.12.2010 21:54, Thomas Gleixner wrote:
> >>> On Mon, 13 Dec 2010, Jan Kiszka wrote:
> >>>> @@ -943,6 +950,9 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id)
> >>>>  	/* Make sure it's not being used on another CPU: */
> >>>>  	synchronize_irq(irq);
> >>>>  
> >>>> +	if (single_handler)
> >>>> +		desc->irq_data.drv_status &= ~IRQS_SHARED;
> >>>> +
> >>>
> >>> What's the reason to clear this flag outside of the desc->lock held
> >>> region.
> >>
> >> We need to synchronize the irq first before clearing the flag.
> >>
> >> The problematic scenario behind this: An IRQ started in shared mode,
> >> this the line was unmasked after the hardirq. Now we clear IRQS_SHARED
> >> before calling into the threaded handler. And that handler may now think
> >> that the line is still masked as IRQS_SHARED is set.
> > 
> > That should read "not set" I guess.
> 
> Can't remember who wrote this, but that guy might have been too tired
> for clear sentences: Yes, of course, we could run into troubles, if
> IRQS_SHARED was _not_ set while the IRQ line is unmasked between hard
> and threaded handler.
> 
> > Hmm, needs more thoughts :(
> 
> Be warned, might be painful.

Talking about headache. Your solution above does not prevent that
scenario.

 CPU 0                  CPU 1
		
 synchronize_irq();
		        hard irq comes in sees shared and unmasks
 clear IRQS_SHARED
			thread handler runs and sees !SHARED

Same scenario, just moved by a few lines :)

Thanks,

	tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ