Re: module/taint: Automatically increase the buffer size for new taint flags
From: Rusty Russell
Date: Thu Sep 08 2016 - 07:01:12 EST
Jessica Yu <jeyu@xxxxxxxxxx> writes:
> I liked the enum idea because we got TAINT_FLAGS_COUNT for free :-)
> however I think we need to switch back to the #defines because of the kbuild
> error.
>
> The "Error: invalid operands...for `<<'" messages are related to the
> __WARN_TAINT() macro (arch/arm64/include/asm/bug.h) which emits some assembly
> that relies on the taint values. We don't have access to the enum values
> in the assembler so we start getting things like:
>
> .short ((1 << 0) | ((TAINT_WARN) << 8))
>
> where TAINT_WARN should have already been preprocessed, and this is where that
> invalid operand error is coming from.
Yech. They could use asm-offsets hacks to generate the values, but
I think you're right.
But I want a single table for taint flags anyway. Let's pull the
one out of panic.c, declare it [TAINT_FLAGS_COUNT] so gcc will warn
if someone adds one and it no longer fits, and use it in module.c.
(Also make it indexed by flag, rather than containing the flag in the
struct).
Thanks,
Rusty.