Re: [PATCH] MODSIGN: flag modules that use cryptoapi and only panic if those are unsigned

From: David Howells
Date: Thu Jan 24 2013 - 19:14:50 EST


Kyle McMartin <kyle@xxxxxxxxxx> wrote:

> After thinking about it a while, this seems like the best way to solve
> the problem, although it does still kind of offend my delicate
> sensibilities...
>
> Doing this check in the crypto layer seems kind of like a layering
> violation to me (and, to be honest, I think it'd be a gross-hack getting
> from the callee back to the caller module.)
>
> Instead, doing it in kernel/module.c and looking at the undefined symbol
> list again looks to me like an ordering problem since we're doing the
> signature check before we've even done the elf header check. We'd have
> to move the panic to a part of the module code that may not necessarily
> make sense.
>
> Whereas checking the undefined symbol list at modpost time is fairly
> logical, and adding a new MODULE_INFO entry in the CONFIG_CRYPTO_FIPS
> case is a well understood thing to do, and should catch all the crypto
> registrations regardless of where they exist in-tree...
>
> Seems to build and work with both values of CONFIG_CRYPTO_FIPS.
>
> Thoughts?

You can't rely on someone trying to sneak a dodgy crypto module in to set the
flag when they build it. The detection thus needs to be done in the kernel
during the module load.

Can you search the module image for "crypto_register_" I wonder? If that's
there, it's a crypto module.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/