Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b2e2fe99 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

sparseirq: work around __weak alias bug



Impact: fix boot crash if the kernel is built with certain GCC versions

GCC has a bug with __weak alias functions: if the functions are in
the same compilation unit as their call site, GCC can decide to
inline them - and thus rob the linker of the opportunity to override
the weak alias with the real thing.

This can lead to the boot crash reported by Kamalesh Babulal:

 ACPI: Core revision 20080926
 Setting APIC routing to flat
 BUG: unable to handle kernel NULL pointer dereference at
 0000000000000000
 IP: [<ffffffff8021f9a8>] add_pin_to_irq_cpu+0x14/0x74
 PGD 0
 Oops: 0000 [#1] SMP
 [...]

So move the arch_init_chip_data() function from handle.c to manage.c.

Reported-by: default avatarKamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 12026ea1
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -86,11 +86,6 @@ void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr)
		desc->kstat_irqs = (unsigned int *)ptr;
}

int __weak arch_init_chip_data(struct irq_desc *desc, int cpu)
{
	return 0;
}

static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu)
{
	memcpy(desc, &irq_desc_init, sizeof(struct irq_desc));
+9 −0
Original line number Diff line number Diff line
@@ -261,6 +261,15 @@ void enable_irq(unsigned int irq)
}
EXPORT_SYMBOL(enable_irq);

/*
 * [ Not in kernel/irq/handle.c, so that GCC does not
 *   inline the __weak alias: ]
 */
int __weak arch_init_chip_data(struct irq_desc *desc, int cpu)
{
	return 0;
}

static int set_irq_wake_real(unsigned int irq, unsigned int on)
{
	struct irq_desc *desc = irq_to_desc(irq);