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] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 11 Jul 2008 15:15:02 +0900
From:	"Magnus Damm" <magnus.damm@...il.com>
To:	"Uwe Kleine-König" <Uwe.Kleine-Koenig@...i.com>
Cc:	"Alan Cox" <alan@...rguk.ukuu.org.uk>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"gregkh@...e.de" <gregkh@...e.de>,
	"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
	"hjk@...utronix.de" <hjk@...utronix.de>,
	"lethal@...ux-sh.org" <lethal@...ux-sh.org>,
	"tglx@...utronix.de" <tglx@...utronix.de>
Subject: Re: [PATCH] uio: uio_pdrv_genirq V2

On Thu, Jul 10, 2008 at 7:30 PM, Uwe Kleine-König
<Uwe.Kleine-Koenig@...i.com> wrote:
> Alan Cox wrote:
>>
>> > > +       else if (!irq_on && !priv->irq_disabled)
>> > > +               disable_irq(dev_info->irq);
>> > I'm not sure if this is a problem on SMP.  Should you use
>> > disable_irq_nosync here, too?  Probably it's OK.
>>
>> That one will also deadlock.
> Can you explain why?  I think irqcontrol is only called in task context.
> I only see one possible deadlock and that's disable_irq being called
> while the irq is IRQ_INPROGRESS on the same cpu.  I'm always willing to
> learn.
>
>> The easiest fix is probably to use test_and_set and friends for each I/O
>> operation.
> Actually using spinlock + irq_disabled variable is new in V2 of this
> patch.  Don't know why this changed, though.

Sorry for not being more clear about it. Basically, I wanted to
serialize user space access somehow, but I managed to screw it up. =)

Atomic enable-and-disable operations without serialization has this problem:

irq line    state      task0                         task1

enabled     enabled    write "0"
                       if (!test_and_set_bit())
enabled     disabled
                                                     write "1"
                                                     if (test_and_clear_bit())
                                                           enable_irq() <- ERR
                             disable_irq()

ERR will make the interrupt depth counter underflow.

The best solution in my mind is atomic operations,
disable_irq_nosync() in irq handler only, and serialize user space
only - not the irq handler.

Or maybe the UIO core layer should serialization in the case of multiple tasks?

/ magnus
--
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