From: David Howells <dhowells@redhat.com>
Date: Wed, 8 Nov 2017 15:11:37 +0000
Subject: [25/29] Lock down /proc/kcore
Origin: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/commit?id=797378dc4498207c3abc1101cfdc9ef2581d8c71

Disallow access to /proc/kcore when the kernel is locked down to prevent
access to cryptographic data.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: James Morris <james.l.morris@oracle.com>
---
 fs/proc/kcore.c | 2 ++
 1 file changed, 2 insertions(+)

Index: linux/fs/proc/kcore.c
===================================================================
--- linux.orig/fs/proc/kcore.c
+++ linux/fs/proc/kcore.c
@@ -545,6 +545,8 @@ out:
 
 static int open_kcore(struct inode *inode, struct file *filp)
 {
+	if (kernel_is_locked_down("/proc/kcore"))
+		return -EPERM;
 	if (!capable(CAP_SYS_RAWIO))
 		return -EPERM;
 
