Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941388AbcKPVuf (ORCPT ); Wed, 16 Nov 2016 16:50:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55353 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936573AbcKPVsC (ORCPT ); Wed, 16 Nov 2016 16:48:02 -0500 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH 06/16] Add a sysrq option to exit secure boot mode From: David Howells To: keyrings@vger.kernel.org Cc: dhowells@redhat.com, matthew.garrett@nebula.com, linux-security-module@vger.kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 16 Nov 2016 21:48:00 +0000 Message-ID: <147933288015.19316.13883500379332751105.stgit@warthog.procyon.org.uk> In-Reply-To: <147933283664.19316.12454053022687659937.stgit@warthog.procyon.org.uk> References: <147933283664.19316.12454053022687659937.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 16 Nov 2016 21:48:02 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 8148 Lines: 246 From: Kyle McMartin Make sysrq+x exit secure boot mode on x86_64, thereby allowing the running kernel image to be modified. This lifts the lockdown. Signed-off-by: David Howells --- arch/x86/Kconfig | 10 ++++++++++ arch/x86/kernel/setup.c | 31 +++++++++++++++++++++++++++++++ drivers/input/misc/uinput.c | 1 + drivers/tty/sysrq.c | 19 +++++++++++++------ include/linux/input.h | 5 +++++ include/linux/sysrq.h | 8 +++++++- kernel/debug/kdb/kdb_main.c | 2 +- 7 files changed, 68 insertions(+), 8 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 5b19997d88d0..c2b481b59931 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1798,6 +1798,16 @@ config EFI_SECURE_BOOT_LOCK_DOWN image. Say Y here to automatically lock down the kernel when a system boots with UEFI Secure Boot enabled. +config EFI_ALLOW_SECURE_BOOT_EXIT + def_bool n + depends on EFI_SECURE_BOOT_LOCK_DOWN && MAGIC_SYSRQ + select ALLOW_LOCKDOWN_LIFT + prompt "Allow secure boot mode to be exited with SysRq+x on a keyboard" + ---help--- + Allow secure boot mode to be exited and the kernel lockdown lifted by + typing SysRq+x on a keyboard attached to the system (not permitted + through procfs). + config SECCOMP def_bool y prompt "Enable seccomp to safely compute untrusted bytecode" diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 539f29587712..89786c2270bd 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -71,6 +71,11 @@ #include #include +#include +#include +#include +#include + #include