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]
Date:	Wed, 29 Oct 2014 18:10:33 +0800
From:	Yingjoe Chen <yingjoe.chen@...iatek.com>
To:	Marc Zyngier <marc.zyngier@....com>,
	Thomas Gleixner <tglx@...utronix.de>
CC:	Jiang Liu <jiang.liu@...ux.intel.com>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Randy Dunlap <rdunlap@...radead.org>,
	Yinghai Lu <yinghai@...nel.org>,
	Borislav Petkov <bp@...en8.de>,
	"grant.likely@...aro.org" <grant.likely@...aro.org>,
	Jonathan Corbet <corbet@....net>,
	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Tony Luck <tony.luck@...el.com>,
	Joerg Roedel <joro@...tes.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	"x86@...nel.org" <x86@...nel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
	"linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
	Matthias Brugger <matthias.bgg@...il.com>
Subject: Re: [Patch Part2 v3 01/24] irqdomain: Introduce new interfaces to
 support hierarchy irqdomains


On Wed, 2014-10-29 at 09:27 +0000, Marc Zyngier wrote:
> On 28/10/14 20:23, Thomas Gleixner wrote:
> > On Tue, 28 Oct 2014, Marc Zyngier wrote:
> >> On 28/10/14 19:37, Thomas Gleixner wrote:
> >>> So while we are at it:
> >>>
> >>>> +	if (irq_domain_is_hierarchy(domain)) {
> >>>> +		if (domain->ops->xlate) {
> >>>> +			/*
> >>>> +			 * If we've already configured this interrupt,
> >>>> +			 * don't do it again, or hell will break loose.
> >>>> +			 */
> >>>> +			virq = irq_find_mapping(domain, hwirq);
> >>>> +			if (virq)
> >>>> +				return virq;
> >>>
> >>> I can understand that it is an issue if the mapping exists already,
> >>> but I have to ask WHY is it correct behaviour to call into that code
> >>> for an existing mapping.
> >>
> >> As I have originally looked at this, I'll answer the question:
> >>
> >> The generic DT code parses the whole tree, and generates platform
> >> devices as it goes. As part of the platform device creation, it
> >> populates the IRQ resources, which translates into calling into
> >> irq_create_of_mapping(). You could argue that this behaviour is crazy,
> >> and I wouldn't disagree.
> > 
> > Mooo.
> 
> Quite.
> 
> >> See http://www.spinics.net/lists/devicetree/msg53164.html for more gory
> >> details.
> >>
> >>> And why would this check only apply if domain->ops->xlate is set?
> >>> irq_create_mapping() does it unconditionally.
> >>
> >> My original code used the xlate callback to parse the opaque irq_data,
> >> computing hwirq, and I suspect this is a leftover of it. The above code
> >> seems to pull hwirq out of thin air, which is probably not the intended
> >> behaviour. Joe?
> > 
> > No. Here is the full patch from Joe:
> > 
> >   http://lists.infradead.org/pipermail/linux-arm-kernel/2014-October/296543.html
> > 
> > hwirq gets either set from hwirq = irq_data->args[0] or from the xlate
> > call.
> 
> Ah, that makes a lot more sense.
> 
> > But my question still stands:
> > 
> > Why would this check only apply if domain->ops->xlate is set?
> > irq_create_mapping() does it unconditionally.
> 
> I don't think we should consider xlate at all. We already resolved hwirq
> (either directly or through a xlate call), and the check should always
> be performed (otherwise we're likely to fall into the same trap again).
> Looks like a bug to me.

I see it now.
When irq_create_of_mapping() is called, we know there exists a mapping
between irq_data and hwirq. If xlate exists, we get the mapping from
xlate call, otherwise irq_data->args[0] is hwirq. This is true even when
using hierarchy irqdomain. So yes, we should also check for existing
mapping for empty domain->ops->xlate.
I corrected this in my latest version.
http://lists.infradead.org/pipermail/linux-arm-kernel/2014-October/298158.html

Thanks for catching this.

Joe.C



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