]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
kexec: Disable at runtime if securelevel has been set.
authorMatthew Garrett <matthew.garrett@nebula.com>
Mon, 9 Sep 2013 22:49:42 +0000 (15:49 -0700)
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>
Mon, 10 Aug 2015 16:24:06 +0000 (09:24 -0700)
Orabug: 21539498

kexec permits the loading and execution of arbitrary code in ring 0, which
permits the modification of the running kernel. Prevent this if securelevel
has been set.

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
kernel/kexec.c

index 7a36fdcca5bfb064a6709021782c98bd2a6de179..ed4878ef585db398049445df94c326b0ea396663 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/syscore_ops.h>
 #include <linux/compiler.h>
 #include <linux/hugetlb.h>
+#include <linux/security.h>
 
 #include <asm/page.h>
 #include <asm/uaccess.h>
@@ -1246,6 +1247,9 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
        if (!capable(CAP_SYS_BOOT) || kexec_load_disabled)
                return -EPERM;
 
+       if (get_securelevel() > 0)
+               return -EPERM;
+
        /*
         * Verify we have a legal set of flags
         * This leaves us room for future extensions.