Re: [PATCH v3 1/3] x86/tdx: Add TDX Guest event notify interrupt support
From: Thomas Gleixner
Date: Wed Aug 23 2023 - 16:49:02 EST
On Sun, May 14 2023 at 00:23, Kuppuswamy Sathyanarayanan wrote:
> +static int __init tdx_event_irq_init(void)
> +{
> + struct irq_affinity_desc desc;
> + struct irq_alloc_info info;
> + struct irq_cfg *cfg;
> + int irq;
> +
> + if (!cpu_feature_enabled(X86_FEATURE_TDX_GUEST))
> + return 0;
> +
> + init_irq_alloc_info(&info, NULL);
> +
> + cpumask_set_cpu(smp_processor_id(), &desc.mask);
desc is completely uninitialized here and therefore desc.mask and
desc.is_managed contain random stack content.
The only reason why this "works" is that tdx_event_irq_init() is an
early initcall which is invoked before SMP init, so the only choice of
the allocator is to pick an interrupt on CPU0.
Thanks,
tglx