Commit 2e38cd83 authored by Chun-Yi Lee's avatar Chun-Yi Lee Committed by Khalid Elmously

UBUNTU: SAUCE: (efi-lockdown) kexec_file: Disable at runtime if the kernel is locked down

BugLink: https://bugs.launchpad.net/bugs/1884159

When KEXEC_VERIFY_SIG is not enabled, kernel should not load images
through kexec_file systemcall if the kernel is locked down.

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: default avatarChun-Yi Lee <jlee@suse.com>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Reviewed-by: default avatarJames Morris <james.l.morris@oracle.com>
cc: kexec@lists.infradead.org
(backported from commit 6620737c201ed7242dbb672803085b46ae600ce7
 git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git)
Signed-off-by: default avatarSeth Forshee <seth.forshee@canonical.com>
Acked-by: default avatarStefan Bader <stefan.bader@canonical.com>
Acked-by: default avatarAndrea Righi <andrea.righi@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 52f6091b
......@@ -317,6 +317,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) && secure_modules())
return -EPERM;
/* Make sure we have a legal set of flags */
if (flags != (flags & KEXEC_FILE_FLAGS))
return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment