Received: by 10.223.164.202 with SMTP id h10csp3103321wrb; Sun, 19 Nov 2017 13:43:08 -0800 (PST) X-Google-Smtp-Source: AGs4zMZkuY6BJwSwj+xG0D8KqMDCKz8ySAkOQk1bbva3XaWdfibJnbIcM4aFylJdm9AokZeFa0mc X-Received: by 10.99.152.68 with SMTP id l4mr11656529pgo.208.1511127788690; Sun, 19 Nov 2017 13:43:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511127788; cv=none; d=google.com; s=arc-20160816; b=jM7xENLas2WDzwtUERuTyvci/VODkaw1rE6A3A6btrsIKwLBZ6Nu293MxX/iZfVFxu uPMtsaLf/YeFNLWOvwDnOA3HPwWT5H6ojVoh1qcj4JIdIxe9lhRIcj+LHhHxAzAs4G6A D8OmAAhkoapUhO/2RC70R/bdxT2lXjMiQ6VL0FEEFaEd/vPvGPErPVhFM+9kDke/hJdn j9S0gK2BqvOxT6mREODNvHUKepTX3iI7nPNByKZOyOuBIcTnrV0n+wqLdOORjmm9N6+y 4fm8sDNGLDLIuPcXiCQXR5VvAILsIUdUcDSq6Ht2/MPWQfqhacf/F024JjmrcZJHJjPn qQ1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :subject:cc:to:from:date:arc-authentication-results; bh=QRgRKS3TXX9a8XwO4YW9Bel+sXbcpPplKR/dkis0cAk=; b=EDwqNg6rGe141gI9zPMzPd4kjW1i0mvLt1nqOvB7TOL0Nl0jarLyhxdU6+X1DyUxQs Tn8GQ6WCnkBStoZpTck6qc9fvIVSiOVnwXY6dZFGJIZwgajw/UrVg4ZOZA9JrvEQDRT/ HzUGZvg4DRmjB0AeDNGNJNlFxBZSJIVCbEdgyyuOv551SonmfL0GAdVglS+eYBPqH82R pfj6Fsvt4MdMZYdgc4CpNNASVULM8vB3bwCPu91bAJOXNROl7izA6WqyMYeCXtd0a3Zj uTizCxm89TTmedWGdI7AGpr6wjPFQumHJBg1BYN5hvJixQS0qRhgaVV/jprf51Flx8k0 jNJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8si6573975pgq.774.2017.11.19.13.42.57; Sun, 19 Nov 2017 13:43:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751184AbdKSVmV (ORCPT + 71 others); Sun, 19 Nov 2017 16:42:21 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:46799 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750915AbdKSVmU (ORCPT ); Sun, 19 Nov 2017 16:42:20 -0500 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id vAJLgHJ4028533 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 19 Nov 2017 21:42:17 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id vAJLgH2k027627 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 19 Nov 2017 21:42:17 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id vAJLgGO2018559; Sun, 19 Nov 2017 21:42:16 GMT Received: from t440 (/58.166.67.31) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 19 Nov 2017 13:42:16 -0800 Date: Mon, 20 Nov 2017 08:42:11 +1100 (AEDT) From: James Morris X-X-Sender: james.l.morris@localhost To: Linus Torvalds cc: linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, linux-integrity , Mimi Zohar Subject: [GIT PULL] security subsystem: IMA bugfix Message-ID: User-Agent: Alpine 2.20 (LFD 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This fixes a long-standing bug in the IMA code. Please pull. The following changes since commit ed30b147e1f6e396e70a52dbb6c7d66befedd786: Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide (2017-11-19 08:04:41 -1000) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git next-integrity for you to fetch changes up to 020aae3ee58c1af0e7ffc4e2cc9fe4dc630338cb: ima: do not update security.ima if appraisal status is not INTEGRITY_PASS (2017-11-20 08:23:10 +1100) ---------------------------------------------------------------- Roberto Sassu (1): ima: do not update security.ima if appraisal status is not INTEGRITY_PASS security/integrity/ima/ima_appraise.c | 3 +++ 1 file changed, 3 insertions(+) --- commit 020aae3ee58c1af0e7ffc4e2cc9fe4dc630338cb Author: Roberto Sassu Date: Tue Nov 7 11:37:07 2017 +0100 ima: do not update security.ima if appraisal status is not INTEGRITY_PASS Commit b65a9cfc2c38 ("Untangling ima mess, part 2: deal with counters") moved the call of ima_file_check() from may_open() to do_filp_open() at a point where the file descriptor is already opened. This breaks the assumption made by IMA that file descriptors being closed belong to files whose access was granted by ima_file_check(). The consequence is that security.ima and security.evm are updated with good values, regardless of the current appraisal status. For example, if a file does not have security.ima, IMA will create it after opening the file for writing, even if access is denied. Access to the file will be allowed afterwards. Avoid this issue by checking the appraisal status before updating security.ima. Cc: stable@vger.kernel.org Signed-off-by: Roberto Sassu Signed-off-by: Mimi Zohar Signed-off-by: James Morris diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index ec7dfa0..65fbcf3 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c @@ -320,6 +320,9 @@ void ima_update_xattr(struct integrity_iint_cache *iint, struct file *file) if (iint->flags & IMA_DIGSIG) return; + if (iint->ima_file_status != INTEGRITY_PASS) + return; + rc = ima_collect_measurement(iint, file, NULL, 0, ima_hash_algo); if (rc < 0) return; From 1584625344981524767@xxx Mon Nov 20 22:21:32 +0000 2017 X-GM-THRID: 1583981613048572355 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread