Commit 0838c26a authored by Tim Gardner's avatar Tim Gardner Committed by Kamal Mostafa

UBUNTU: SAUCE: UEFI: Add secure boot and MOK SB State disabled sysctl

BugLink: http://bugs.launchpad.net/bugs/1593075

This is a better method for detecting the state of secure boot and
the MOKSBState override, as opposed to grepping status from the kernel log.
Both variables return 0 or 1. If secure_boot==0 then signed module
enforcement is not enabled. Likewise, if moksbstate_disabled==1 then
signed module enforcement is not enabled. The only conditions uder which
signed module enforcement is enabled is when secure_boot==1 and
moksbstate_disabled==0.

/proc/sys/kernel/secure_boot
/proc/sys/kernel/moksbstate_disabled
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
Acked-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent c9bb5382
...@@ -1150,6 +1150,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -1150,6 +1150,7 @@ void __init setup_arch(char **cmdline_p)
pr_info("Secure boot enabled\n"); pr_info("Secure boot enabled\n");
} }
else if (boot_params.secure_boot == EFI_MOKSBSTATE_DISABLED) { else if (boot_params.secure_boot == EFI_MOKSBSTATE_DISABLED) {
set_bit(EFI_MOKSBSTATE_DISABLED, &efi.flags);
boot_params.secure_boot = 0; boot_params.secure_boot = 0;
pr_info("Secure boot MOKSBState disabled\n"); pr_info("Secure boot MOKSBState disabled\n");
} }
......
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
#include <linux/sched/sysctl.h> #include <linux/sched/sysctl.h>
#include <linux/kexec.h> #include <linux/kexec.h>
#include <linux/bpf.h> #include <linux/bpf.h>
#include <linux/efi.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/processor.h> #include <asm/processor.h>
...@@ -279,7 +280,37 @@ static int min_extfrag_threshold; ...@@ -279,7 +280,37 @@ static int min_extfrag_threshold;
static int max_extfrag_threshold = 1000; static int max_extfrag_threshold = 1000;
#endif #endif
static unsigned int secure_boot_enabled;
int secure_boot_proc_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
secure_boot_enabled = efi_enabled(EFI_SECURE_BOOT);
return proc_dointvec(table, write, buffer, lenp, ppos);
}
static unsigned int moksbstate_disabled;
int moksbstate_disabled_proc_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
moksbstate_disabled = efi_enabled(EFI_MOKSBSTATE_DISABLED);
return proc_dointvec(table, write, buffer, lenp, ppos);
}
static struct ctl_table kern_table[] = { static struct ctl_table kern_table[] = {
{
.procname = "secure_boot",
.data = &secure_boot_enabled,
.maxlen = sizeof(unsigned int),
.mode = 0444,
.proc_handler = secure_boot_proc_handler,
},
{
.procname = "moksbstate_disabled",
.data = &moksbstate_disabled,
.maxlen = sizeof(unsigned int),
.mode = 0444,
.proc_handler = moksbstate_disabled_proc_handler,
},
{ {
.procname = "sched_child_runs_first", .procname = "sched_child_runs_first",
.data = &sysctl_sched_child_runs_first, .data = &sysctl_sched_child_runs_first,
......
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