]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
UBUNTU: SAUCE: (efi-lockdown) kexec: Disable at runtime if the kernel is locked down
authorMatthew Garrett <matthew.garrett@nebula.com>
Tue, 22 Nov 2016 08:46:15 +0000 (08:46 +0000)
committerSeth Forshee <seth.forshee@canonical.com>
Tue, 5 Sep 2017 12:33:58 +0000 (07:33 -0500)
kexec permits the loading and execution of arbitrary code in ring 0, which
is something that lock-down is meant to prevent. It makes sense to disable
kexec in this situation.

This does not affect kexec_file_load() which can check for a signature on the
image to be booted.

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: David Howells <dhowells@redhat.com>
(cherry picked from commit de842605efb941d9e67d5d24f5435bf635a249fb
 git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
kernel/kexec.c

index e62ec4dc662060764acc1ad019056d277eeec6a8..37f75d0b75deb9d115e643ea810fca8acb9cbf25 100644 (file)
@@ -201,6 +201,13 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
        if (!capable(CAP_SYS_BOOT) || kexec_load_disabled)
                return -EPERM;
 
+       /*
+        * kexec can be used to circumvent module loading restrictions, so
+        * prevent loading in that case
+        */
+       if (kernel_is_locked_down())
+               return -EPERM;
+
        /*
         * Verify we have a legal set of flags
         * This leaves us room for future extensions.