From patchwork Mon Mar 25 22:09:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Garrett X-Patchwork-Id: 10870187 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 8B4DF1708 for ; Mon, 25 Mar 2019 22:10:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 752AA28C1D for ; Mon, 25 Mar 2019 22:10:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63ADB2905C; Mon, 25 Mar 2019 22:10:56 +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 1426A28C1D for ; Mon, 25 Mar 2019 22:10:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730545AbfCYWKz (ORCPT ); Mon, 25 Mar 2019 18:10:55 -0400 Received: from mail-qk1-f202.google.com ([209.85.222.202]:47881 "EHLO mail-qk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731148AbfCYWKy (ORCPT ); Mon, 25 Mar 2019 18:10:54 -0400 Received: by mail-qk1-f202.google.com with SMTP id i124so9879663qkf.14 for ; Mon, 25 Mar 2019 15:10:53 -0700 (PDT) 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=PrJR0RaRgSbOBZwUzeo3I5hhwuXL6aA00K5kUeXQKiA=; b=ldxpNgaxH/YHCoW1sAkKWCMk2rgkoIUCtZL9a3pHP1mgnuQGeHZOc2Hb8QqN9V/vhm nwU9NE1Y9sBqrUedzaF+jEQRCmfrzLWhJhZpAhWJfkX7TRIC2hTXiF19DrpYCo2BovDm iQRcbzBQsxO7oY7WniRiSxdW6DFqLI79Z3k0SkVIgYoLlVlbBPLclFAG4RtQ/oNUBp7t CxNo8cyMyHiyiMM6FwJdS5EuDvNKTU6uEHB1PxHs+RFl/d5mu8kzoILCb//teVE+zVlz ws+ZRmX5w82F56rt7M41HYV41JtsVSNrO0vBivx7Ax4wLryQaFJ5ZTpkh2Rqwh8Av9ZD dMVw== 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=PrJR0RaRgSbOBZwUzeo3I5hhwuXL6aA00K5kUeXQKiA=; b=R5/nYczmOsyQEv7TGwv9t+kzh+DDx4AKwMrIb6Vo99sPbriee90tnRm1rep4BK70Le KS4kStRXqCq5W+PITNFWe6FnUEhYRXj3rSaaDvJIFd0QJmRV53bQFvKnzNZmE6A/Mpk1 j18ShOaGMD49ewa5AFnp8Ar5tcyG2gAZr8ljDE/48syvCmxl1sc9MLjD185F2TQ51EpM T10Nbnn4zSjOfBgvX7HmXSpBsGbn/53TVYMWEMHuGNHO+4P29cymBhcyC9G1MOOVe0F3 jWuyIXgDEpKgzfwoVRxEZJwLnTYfqk5lrZelbfnEwdJ76usZ/1KCKvlC5akPCiqwxK9W 2hBA== X-Gm-Message-State: APjAAAWogHRr76cBJlrXUtewf5vdu6sbgncSfgQbhqB08LWom5lQMQRY p3E6jdDDLiqqo/9CsdDbqk2LRbb5QDxPTycRxQEWdw== X-Google-Smtp-Source: APXvYqyhMiEOX1rNfbi57TmOLS1KVwin8O8ieaW59rgI7j+7wNTl/HVDzf7gLUtBzf7Ww6FBHOSzd/qAlS2//YdqFdSo5A== X-Received: by 2002:a37:b444:: with SMTP id d65mr20940708qkf.125.1553551853273; Mon, 25 Mar 2019 15:10:53 -0700 (PDT) Date: Mon, 25 Mar 2019 15:09:48 -0700 In-Reply-To: <20190325220954.29054-1-matthewgarrett@google.com> Message-Id: <20190325220954.29054-22-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190325220954.29054-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog Subject: [PATCH 21/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, James Morris , Matthew Garrett 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;