Skip to content

Commit 1a2cce5

Browse files
Lorenzo PieralisiKAGA-KOKO
authored andcommitted
irqchip/gic-v5: Fix kmemleak L2 IST table entries false positives
L2 IST table entries are allocated with the kmalloc interface and their physical addresses are programmed in the GIC (either IST base address register or L1 IST table entries) but their virtual addresses are not stored in any kernel data structure because they are not needed at runtime - the L2 IST table entries are managed through system instructions but never dereferenced directly by the driver. This triggers kmemleak false positive reports: unreferenced object 0xffff00080039a000 (size 4096): comm "swapper/0", pid 0, jiffies 4294892296 hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace (crc 0): kmemleak_alloc+0x34/0x40 __kmalloc_noprof+0x320/0x464 gicv5_irs_iste_alloc+0x1a4/0x484 gicv5_irq_lpi_domain_alloc+0xe4/0x194 irq_domain_alloc_irqs_parent+0x78/0xd8 gicv5_irq_ipi_domain_alloc+0x180/0x238 irq_domain_alloc_irqs_locked+0x238/0x7d4 __irq_domain_alloc_irqs+0x88/0x114 gicv5_of_init+0x284/0x37c of_irq_init+0x3b8/0xb18 irqchip_init+0x18/0x40 init_IRQ+0x104/0x164 start_kernel+0x1a4/0x3d4 __primary_switched+0x8c/0x94 Instruct kmemleak to ignore L2 IST table memory allocation virtual addresses to prevent these false positive reports. Reported-by: Jinjie Ruan <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Jinjie Ruan <[email protected]> Reviewed-by: Zenghui Yu <[email protected]> Acked-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/all/[email protected] Closes: https://lore.kernel.org/lkml/[email protected]/
1 parent c8bb0f0 commit 1a2cce5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/irqchip/irq-gic-v5-irs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#define pr_fmt(fmt) "GICv5 IRS: " fmt
77

8+
#include <linux/kmemleak.h>
89
#include <linux/log2.h>
910
#include <linux/of.h>
1011
#include <linux/of_address.h>
@@ -117,6 +118,7 @@ static int __init gicv5_irs_init_ist_linear(struct gicv5_irs_chip_data *irs_data
117118
kfree(ist);
118119
return ret;
119120
}
121+
kmemleak_ignore(ist);
120122

121123
return 0;
122124
}
@@ -232,6 +234,7 @@ int gicv5_irs_iste_alloc(const u32 lpi)
232234
kfree(l2ist);
233235
return ret;
234236
}
237+
kmemleak_ignore(l2ist);
235238

236239
/*
237240
* Make sure we invalidate the cache line pulled before the IRS

0 commit comments

Comments
 (0)