Re: [PATCH v3 05/26] genirq/irqdesc: Annotate static information into meminspect
From: Lorenzo Stoakes
Date: Wed Jul 08 2026 - 03:54:40 EST
On Wed, Jul 08, 2026 at 11:01:44AM +0530, Mukesh Ojha wrote:
> From: Eugen Hristev <ehristev@xxxxxxxxxx>
>
> Annotate vital static information into inspection table:
> - total_nr_irqs
>
> Information on these annotated variables is stored in a dedicated
> meminspect section.
>
> Signed-off-by: Eugen Hristev <eugen.hristev@xxxxxxxxxx>
> Signed-off-by: Mukesh Ojha <mukesh.ojha@xxxxxxxxxxxxxxxx>
> ---
> kernel/irq/irqdesc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
> index 80ef4e27dcf4..4e58e7f5fc6c 100644
> --- a/kernel/irq/irqdesc.c
> +++ b/kernel/irq/irqdesc.c
> @@ -16,6 +16,7 @@
> #include <linux/irqdomain.h>
> #include <linux/sysfs.h>
> #include <linux/string_choices.h>
> +#include <linux/meminspect.h>
>
> #include "internals.h"
>
> @@ -142,6 +143,7 @@ static void desc_set_defaults(unsigned int irq, struct irq_desc *desc, int node,
> }
>
> unsigned int total_nr_irqs __read_mostly = NR_IRQS;
> +MEMINSPECT_SIMPLE_ENTRY(total_nr_irqs);
Err... this is effectively exporting this unexported variable to drivers?
This is massively open to abuse no? A driver could now manipulate this value if
it wanted to?
Why would we want internal state like this exposed to drivers/firmware? This
isn't something you can even do right now without kernel debug symbols.
I am getting ever more convinced that this resembles a backdoor EXPORT_SYMBOLS()
but now much worse because you get a VA and a PA and more information...!
>
> /**
> * irq_get_nr_irqs() - Number of interrupts supported by the system.
>
> --
> 2.53.0
>
Thanks, Lorenzo