Lock down /proc/kcore
authorDavid Howells <dhowells@redhat.com>
Wed, 8 Nov 2017 15:11:37 +0000 (15:11 +0000)
committerBastian Blank <waldi@debian.org>
Fri, 22 Jun 2018 09:50:22 +0000 (10:50 +0100)
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>
Gbp-Pq: Topic features/all/lockdown
Gbp-Pq: Name 0025-Lock-down-proc-kcore.patch

fs/proc/kcore.c

index d1e82761de813abb95af0faac99194dba5821538..cdebdee81719c69ac1d05806e5022d361a1024dd 100644 (file)
@@ -546,6 +546,8 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
 
 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;