Lock down /proc/kcore
authorDavid Howells <dhowells@redhat.com>
Wed, 8 Nov 2017 15:11:37 +0000 (15:11 +0000)
committerSalvatore Bonaccorso <carnil@debian.org>
Tue, 20 Mar 2018 08:31:07 +0000 (08:31 +0000)
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 e8a93bc8285d85403db124f9acb3c80f2a122495..e463ef48966bd19b53728d79a2f89582be899d4a 100644 (file)
@@ -542,6 +542,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;