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: <4D07F70A.30209@web.de>
Date:	Wed, 15 Dec 2010 00:00:26 +0100
From:	Jan Kiszka <jan.kiszka@....de>
To:	Thomas Gleixner <tglx@...utronix.de>
CC:	Avi Kivity <avi@...hat.com>, Marcelo Tosatti <mtosatti@...hat.com>,
	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>,
	Jan Kiszka <jan.kiszka@...mens.com>
Subject: Re: [PATCH v3 2/4] genirq: Inform handler about line sharing state

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.

> I need this status for other purposes as well, where I
> definitely need serialization.

Well, two options: wrap all bit manipulations with desc->lock
acquisition/release or turn drv_status into an atomic. I don't know what
your plans with drv_status are, so...

> 
>> +	mutex_lock(&register_lock);
>> +
>> +	old_action = desc->action;
>> +	if (old_action && (old_action->flags & IRQF_ADAPTIVE) &&
>> +	    !(desc->irq_data.drv_status & IRQS_SHARED)) {
>> +		/*
>> +		 * Signal the old handler that is has to switch to shareable
>> +		 * handling mode. Disable the line to avoid any conflict with
>> +		 * a real IRQ.
>> +		 */
>> +		disable_irq(irq);
>> +		local_irq_disable();
>> +
>> +		desc->irq_data.drv_status |= IRQS_SHARED | IRQS_MAKE_SHAREABLE;
> 
> Unserialized access as well. Will think about it.
> 
>> +		old_action->handler(irq, old_action->dev_id);
>> +		desc->irq_data.drv_status &= ~IRQS_MAKE_SHAREABLE;
> 
> Thanks,
> 
> 	tglx

Jan


Download attachment "signature.asc" of type "application/pgp-signature" (260 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ