From patchwork Wed Mar 6 23:59:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Garrett X-Patchwork-Id: 10842039 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 732E41515 for ; Thu, 7 Mar 2019 00:01:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60B102E9F5 for ; Thu, 7 Mar 2019 00:01:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54CA12EA0E; Thu, 7 Mar 2019 00:01:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E10C2E9F5 for ; Thu, 7 Mar 2019 00:01:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726686AbfCGAAZ (ORCPT ); Wed, 6 Mar 2019 19:00:25 -0500 Received: from mail-qk1-f201.google.com ([209.85.222.201]:43176 "EHLO mail-qk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726677AbfCGAAZ (ORCPT ); Wed, 6 Mar 2019 19:00:25 -0500 Received: by mail-qk1-f201.google.com with SMTP id a11so11537132qkk.10 for ; Wed, 06 Mar 2019 16:00:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=zcieI5+oJsXOBRD2KKmNlRR+gsKSY7mBPeZzRy6NCSc=; b=O1ibSFciJav1PBiNgfW7eudRgTugTEl+TugUvK9qs+q2PFX0lyPloPkpzQwzw61I64 Q2zx5/02BIZdytE7FQiwVUDn2df256UDJt3cpW+z1UhfXc+rC+66FD0K/p4em9inKb8J /XFuvm5TXkQ6iT7dbSpy6iXTYwfeRN0PYs6etedNN5+u7UuUuogetkzOVadi+RL0eXft opqc9XF0yWDwaofLK3Zuk8uGos6c9ZFIxHG3yQ1SW4U/+mUBQBslM9ZYHjnaB77B3jQD Nw0yLYzxPB66JJn3zzoVdET/cQayg7nSTwBR75/2YCgJarOi/6b98ytYorvyqE+K2ES0 dS0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=zcieI5+oJsXOBRD2KKmNlRR+gsKSY7mBPeZzRy6NCSc=; b=Nf2Lll52mOjHtlt9xOgP60v30yBwX09fIx9EW2t7sMSrJ/j2mktrwW4KTQ4Pp8yjki OdkEtEAurErNbY/87UaQzsVKI4FxYSlXjvG9fYC+mOSmO5XD5B3bzowl1IBrYBLrGgIe DzCXmWmlcJoXXXrPl08X2CDcjotEmY6D4BHrTOxRx/QCgt7H4aQq/WRyMzIU9y3oNY+k lLSrR4aXTwqRaAByu1CKoBuO+R19nBaxfKJmOaM+8Il6vHCQ9kCYQRA6meC4/6wR4LmD VU5nyp7gdF3IFjwvkyp6jBjlu/ixFDToxEBdTKbrVpzBQNYCn1LBzg2uTRqA9KcFStEB GrBA== X-Gm-Message-State: APjAAAWFFDGYD6m95Eueo/lYeLRYTW1QrLUyWhK4uMh0AGd8oonnzZvb jwhfgmyEpzHgFQch3k7BpegIrNy1Ek6IiA5cKDe6+Q== X-Google-Smtp-Source: APXvYqzsrsMnuTp4pilucBGFtnRzrjGoHO9C4n2TLsODhv9zqdR3Iv8B2UbdukqEA3eTSRrBVF3kQ1EWF724z+8y5G/9BA== X-Received: by 2002:aed:37c4:: with SMTP id j62mr5902579qtb.19.1551916824091; Wed, 06 Mar 2019 16:00:24 -0800 (PST) Date: Wed, 6 Mar 2019 15:59:08 -0800 In-Reply-To: <20190306235913.6631-1-matthewgarrett@google.com> Message-Id: <20190306235913.6631-23-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190306235913.6631-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.21.0.352.gf09ad66450-goog Subject: [PATCH 22/27] Lock down /proc/kcore From: Matthew Garrett To: jmorris@namei.org Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, dhowells@redhat.com Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: David Howells Disallow access to /proc/kcore when the kernel is locked down to prevent access to cryptographic data. Signed-off-by: David Howells Reviewed-by: James Morris Signed-off-by: Matthew Garrett --- fs/proc/kcore.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index bbcc185062bb..d50ebfbf3dbb 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c @@ -518,6 +518,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;