MODSIGN: Add FIPS policy
authorDavid Howells <dhowells@redhat.com>
Wed, 26 Sep 2012 09:09:50 +0000 (10:09 +0100)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 10 Oct 2012 09:31:19 +0000 (20:01 +1030)
If we're in FIPS mode, we should panic if we fail to verify the signature on a
module or we're asked to load an unsigned module in signature enforcing mode.
Possibly FIPS mode should automatically enable enforcing mode.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
kernel/module.c

index 68c564edb2c18c65829c954469ad5c708d05e559..0e2da8695f8ed2d80b4b498eed883e49936fc59f 100644 (file)
@@ -58,6 +58,7 @@
 #include <linux/jump_label.h>
 #include <linux/pfn.h>
 #include <linux/bsearch.h>
+#include <linux/fips.h>
 #include "module-internal.h"
 
 #define CREATE_TRACE_POINTS
@@ -2447,6 +2448,9 @@ static int module_sig_check(struct load_info *info,
        }
 
        /* Not having a signature is only an error if we're strict. */
+       if (err < 0 && fips_enabled)
+               panic("Module verification failed with error %d in FIPS mode\n",
+                     err);
        if (err == -ENOKEY && !sig_enforce)
                err = 0;