Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp874735pxf; Wed, 7 Apr 2021 13:53:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+MbBheh3zn/9zZ7i5J3X22E8ct/EikSm+bMQBFz5Ia91SyqwqrFt1fUOBmlRuvp5CbEJ8 X-Received: by 2002:a62:78d5:0:b029:23d:d774:f2a0 with SMTP id t204-20020a6278d50000b029023dd774f2a0mr4412033pfc.8.1617828797891; Wed, 07 Apr 2021 13:53:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617828797; cv=none; d=google.com; s=arc-20160816; b=htPrF7R/EOVTuEnDM5tq2V8ozA/szrBUii75HSfaxeQ4VpHth6wcd6+Pq8oFoGP4cT frPhESt2OdtrkPynRDAXH/0In0Iu9vI+VDgpI7aNiY/wL254uCnq26Qvk56osnm/W7RE t0DfGg2bwp+Dz2fn3Nisr/bxxOCaVU6JvKS1QbjEqmvMCh/0wNu5u3ygoVzCzMx2n59w 71oxn4pHsR/rgh3hIxEn5K6u3tY+nhiDVsolo8z6YPv4BbOCSVDTSIdyXlgPA1YBQ2DK ZQrA69Ka7onKTS2C8EfDgcsOzBrOj9VMU32+V2N4gVUZ7gbeZczpJn9LVyDSIoLpJ/GM 35iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=4FFQpFN5uUJDE4F9Kotm3hnhKwIEpKRXF+IuRNY3VGU=; b=RwFH0MtK8+XU9d2W21B6CpwkxblMhMtIunywFNMdfkn+EwxS7AkjRB2PZIhUdazpVO jRoJ7OEgi0GMUUHy7h8psVSP7xUqBpaAKsHf+AgxO8WRlJmI4kt4lQ/b7vauvGxhVZ4N I9eTRUnERONd06+xhEjnuMgzG5IfoDcX4UqSQzSUfi/wub2ct7qqyzp8OhJ5BVTa1w1+ PKZ8zicRpkX3c88WWQNx2XtAdddh/KNRzlm1MFw3l7HrrgVvjvighH2fks9ube/4R73A reyyL71ZfAfokGJvlw0Pq5axqHg5wHkTBrqNVx4T+c4Ftl59wb6m2Acmt5Zt6qM5Dfn9 73XA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c24si4189403pgn.534.2021.04.07.13.53.05; Wed, 07 Apr 2021 13:53:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236165AbhDGKzz (ORCPT + 99 others); Wed, 7 Apr 2021 06:55:55 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:2796 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234910AbhDGKzq (ORCPT ); Wed, 7 Apr 2021 06:55:46 -0400 Received: from fraeml714-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4FFh2W6lr8z686lh; Wed, 7 Apr 2021 18:48:35 +0800 (CST) Received: from fraphisprd00473.huawei.com (7.182.8.141) by fraeml714-chm.china.huawei.com (10.206.15.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Wed, 7 Apr 2021 12:55:35 +0200 From: Roberto Sassu To: , CC: , , , , Roberto Sassu Subject: [PATCH v5 12/12] ima: Don't remove security.ima if file must not be appraised Date: Wed, 7 Apr 2021 12:52:52 +0200 Message-ID: <20210407105252.30721-13-roberto.sassu@huawei.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210407105252.30721-1-roberto.sassu@huawei.com> References: <20210407105252.30721-1-roberto.sassu@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [7.182.8.141] X-ClientProxiedBy: lhreml753-chm.china.huawei.com (10.201.108.203) To fraeml714-chm.china.huawei.com (10.206.15.33) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Files might come from a remote source and might have xattrs, including security.ima. It should not be IMA task to decide whether security.ima should be kept or not. This patch removes the removexattr() system call in ima_inode_post_setattr(). Signed-off-by: Roberto Sassu Reviewed-by: Mimi Zohar --- security/integrity/ima/ima_appraise.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index 538ccbf972c8..45e244fc2ef2 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c @@ -532,8 +532,6 @@ void ima_inode_post_setattr(struct user_namespace *mnt_userns, return; action = ima_must_appraise(mnt_userns, inode, MAY_ACCESS, POST_SETATTR); - if (!action) - __vfs_removexattr(&init_user_ns, dentry, XATTR_NAME_IMA); iint = integrity_iint_find(inode); if (iint) { set_bit(IMA_CHANGE_ATTR, &iint->atomic_flags); -- 2.26.2