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: <200706082142.21449.ak@suse.de>
Date:	Fri, 8 Jun 2007 21:42:21 +0200
From:	Andi Kleen <ak@...e.de>
To:	"Satyam Sharma" <satyam.sharma@...il.com>
Cc:	"Jan Glauber" <jan.glauber@...ibm.com>,
	"Heiko Carstens" <heiko.carstens@...ibm.com>,
	"David Miller" <davem@...emloft.net>, akpm@...l.org, mingo@...e.hu,
	schwidefsky@...ibm.com, linux-kernel@...r.kernel.org,
	"Alan Cox" <alan@...hat.com>
Subject: Re: [patch] i386/x86_64: smp_call_function locking inconsistency

On Thursday 07 June 2007 16:07:04 Satyam Sharma wrote:
> Hi,
> 
> I'm about six months late here(!), but I noticed this bug in
> arch/x86_64/kernel/smp.c while preparing another related
> patch today and then found this thread during Googling ...
> 
> On 2/9/07, Heiko Carstens <heiko.carstens@...ibm.com> wrote:
> > On i386/x86_64 smp_call_function_single() takes call_lock with
> > spin_lock_bh(). To me this would imply that it is legal to call
> > smp_call_function_single() from softirq context.
> > It's not since smp_call_function() takes call_lock with just
> > spin_lock(). We can easily deadlock:
> >
> > -> [process context]
> > -> smp_call_function()
> > -> spin_lock(&call_lock)
> > -> IRQ -> do_softirq -> tasklet
> > -> [softirq context]
> > -> smp_call_function_single()
> > -> spin_lock_bh(&call_lock)
> > -> dead
> 
> You're absolutely right, and this bug still exists in the latest -git.

bug is definitely too strong a word. It might be unnecessary to disable bhs, 
but I don't see any bug in here as long as you can't show a case where
the smp_call_function() is called from BHs.

There was a patch floating around to use it from sysrq to display state
of all CPUs (and sysrq is softirq), but I don't think that ever
made it mainline.

And smp_call_function() can be called from panic which can violate
quite some assumptions, but some deadlock possibility there is ok.

I also don't like making it soft/hard irq save because that would
make it much more intrusive to the machine for no good reason
(e.g. slab can call it quite often in some cases)

The _bh should be probably just removed and possibly a WARN_ON added.

-Andi
-
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