[PATCH v3 4/5] irqchip/gic-v3-its: Zero ITTs reused from the ITT pool

From: Fuad Tabba

Date: Fri Nov 27 2026 - 07:06:40 EST


Commit b08e2f42e86b5 ("irqchip/gic-v3-its: Share ITS tables with a
non-trusted hypervisor") moved sub-page ITTs from kzalloc_node() to a
genpool. An ITT freed back to the pool goes to the next device as the
previous one left it. MAPD is then UNPREDICTABLE: "When V == 1, the
specified ITT does not contain all zeros" (IHI 0069H.b, 5.3.10).

Zero every ITT that comes from the pool. The ITS then no longer needs
the pages added to the pool zeroed, so drop __GFP_ZERO from their
allocation. A pKVM guest shares each new pool page with the host,
though, and pkvm_set_memory_decrypted() doesn't zero what it shares, so
the host now sees that page's old contents.

Fixes: b08e2f42e86b5 ("irqchip/gic-v3-its: Share ITS tables with a non-trusted hypervisor")
Reviewed-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
Reviewed-by: Zenghui Yu <yuzenghui@xxxxxxxxxx>
Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>
---
drivers/irqchip/irq-gic-v3-its.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 5756ffe4ec13e..6eb2dbec5f0ed 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -270,10 +270,12 @@ static void *itt_alloc_pool(int node, int size)

do {
addr = gen_pool_alloc(itt_pool, size);
- if (addr)
+ if (addr) {
+ memset((void *)addr, 0, size);
break;
+ }

- page = its_alloc_pages_node(node, GFP_KERNEL | __GFP_ZERO, 0);
+ page = its_alloc_pages_node(node, GFP_KERNEL, 0);
if (!page)
break;

--
2.47.3