2020-05-08 14:52:40 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2020-04-23 20:47:21 +00:00
|
|
|
From: Jeremy Cline <jcline@redhat.com>
|
|
|
|
Date: Wed, 30 Oct 2019 14:37:49 +0000
|
|
|
|
Subject: [PATCH] s390: Lock down the kernel when the IPL secure flag is set
|
|
|
|
|
|
|
|
Automatically lock down the kernel to LOCKDOWN_CONFIDENTIALITY_MAX if
|
|
|
|
the IPL secure flag is set.
|
|
|
|
|
|
|
|
Upstream Status: RHEL only
|
|
|
|
Suggested-by: Philipp Rudo <prudo@redhat.com>
|
|
|
|
Signed-off-by: Jeremy Cline <jcline@redhat.com>
|
|
|
|
---
|
|
|
|
arch/s390/include/asm/ipl.h | 1 +
|
|
|
|
arch/s390/kernel/ipl.c | 5 +++++
|
|
|
|
arch/s390/kernel/setup.c | 4 ++++
|
|
|
|
3 files changed, 10 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/arch/s390/include/asm/ipl.h b/arch/s390/include/asm/ipl.h
|
|
|
|
index b63bd66404b8..3482d9602e68 100644
|
|
|
|
--- a/arch/s390/include/asm/ipl.h
|
|
|
|
+++ b/arch/s390/include/asm/ipl.h
|
|
|
|
@@ -109,6 +109,7 @@ int ipl_report_add_component(struct ipl_report *report, struct kexec_buf *kbuf,
|
|
|
|
unsigned char flags, unsigned short cert);
|
|
|
|
int ipl_report_add_certificate(struct ipl_report *report, void *key,
|
|
|
|
unsigned long addr, unsigned long len);
|
|
|
|
+bool ipl_get_secureboot(void);
|
2020-04-27 02:15:20 +00:00
|
|
|
|
2020-04-23 20:47:21 +00:00
|
|
|
/*
|
|
|
|
* DIAG 308 support
|
|
|
|
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
|
|
|
|
index 4a71061974fd..9baf0b570c3d 100644
|
|
|
|
--- a/arch/s390/kernel/ipl.c
|
|
|
|
+++ b/arch/s390/kernel/ipl.c
|
|
|
|
@@ -1901,3 +1901,8 @@ int ipl_report_free(struct ipl_report *report)
|
|
|
|
}
|
2020-04-27 02:15:20 +00:00
|
|
|
|
2020-04-23 20:47:21 +00:00
|
|
|
#endif
|
|
|
|
+
|
|
|
|
+bool ipl_get_secureboot(void)
|
|
|
|
+{
|
|
|
|
+ return !!ipl_secure_flag;
|
|
|
|
+}
|
|
|
|
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
|
2020-06-03 18:47:28 +00:00
|
|
|
index 0f0b140b5558..5554ae03060f 100644
|
2020-04-23 20:47:21 +00:00
|
|
|
--- a/arch/s390/kernel/setup.c
|
|
|
|
+++ b/arch/s390/kernel/setup.c
|
|
|
|
@@ -49,6 +49,7 @@
|
|
|
|
#include <linux/memory.h>
|
|
|
|
#include <linux/compat.h>
|
|
|
|
#include <linux/start_kernel.h>
|
|
|
|
+#include <linux/security.h>
|
2020-04-27 02:15:20 +00:00
|
|
|
|
2020-04-23 20:47:21 +00:00
|
|
|
#include <asm/boot_data.h>
|
|
|
|
#include <asm/ipl.h>
|
2020-06-03 18:47:28 +00:00
|
|
|
@@ -1090,6 +1091,9 @@ void __init setup_arch(char **cmdline_p)
|
2020-04-27 02:15:20 +00:00
|
|
|
|
2020-04-23 20:47:21 +00:00
|
|
|
log_component_list();
|
2020-04-27 02:15:20 +00:00
|
|
|
|
2020-04-23 20:47:21 +00:00
|
|
|
+ if (ipl_get_secureboot())
|
|
|
|
+ security_lock_kernel_down("Secure IPL mode", LOCKDOWN_INTEGRITY_MAX);
|
|
|
|
+
|
|
|
|
/* Have one command line that is parsed and saved in /proc/cmdline */
|
|
|
|
/* boot_command_line has been already set up in early.c */
|
|
|
|
*cmdline_p = boot_command_line;
|
|
|
|
--
|
2020-04-27 02:15:20 +00:00
|
|
|
2.26.2
|
2020-04-23 20:47:21 +00:00
|
|
|
|