]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
UBUNTU: SAUCE: (efi-lockdown) kexec_file: Disable at runtime if securelevel has been set
authorLee, Chun-Yi <joeyli.kernel@gmail.com>
Wed, 23 Nov 2016 13:49:19 +0000 (13:49 +0000)
committerSeth Forshee <seth.forshee@canonical.com>
Tue, 5 Sep 2017 12:33:59 +0000 (07:33 -0500)
When KEXEC_VERIFY_SIG is not enabled, kernel should not loads image
through kexec_file systemcall if securelevel has been set.

This code was showed in Matthew's patch but not in git:
https://lkml.org/lkml/2015/3/13/778

Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
Signed-off-by: David Howells <dhowells@redhat.com>
(cherry picked from commit db0188224b6d4c9cd73205631fe8e30810fb19ab
 git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
kernel/kexec_file.c

index 9f48f441229720b0e02434b2375b61d9c62b7706..7da87007c2026687ad1cbc1e630b591ddc51a3dc 100644 (file)
@@ -255,6 +255,12 @@ SYSCALL_DEFINE5(kexec_file_load, int, kernel_fd, int, initrd_fd,
        if (!capable(CAP_SYS_BOOT) || kexec_load_disabled)
                return -EPERM;
 
+       /* Don't permit images to be loaded into trusted kernels if we're not
+        * going to verify the signature on them
+        */
+       if (!IS_ENABLED(CONFIG_KEXEC_VERIFY_SIG) && kernel_is_locked_down())
+               return -EPERM;
+
        /* Make sure we have a legal set of flags */
        if (flags != (flags & KEXEC_FILE_FLAGS))
                return -EINVAL;