Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp808897pxj; Fri, 14 May 2021 17:05:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6J3skbld831ZvDeVR14kW2PaB0tzQfGyVkSJBkaTj1wcT/AKK4fF+PGph7oIsV+uHxo8X X-Received: by 2002:a17:906:b259:: with SMTP id ce25mr2268516ejb.245.1621037122677; Fri, 14 May 2021 17:05:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621037122; cv=none; d=google.com; s=arc-20160816; b=rnkB23tRcFmi1/AFEph49miH+aTqcW3fBSPM2Mby6fNDxJ6baKYDZoCKlqWxg/wwho V71kII2rVnTcgp/Jh8hXHuzS71ybwBgSyAHk+2s25A7xwqMsUWdG+t6BHDkGM0UeKWDk pKgb+L7nFSfnriGRp35dyJcO07Aix64rpFD3eSa4MpZyvQ/uoNe2xJc/bWu13nglxuoC BA72QqwMviruYqQ8d7jI/2JM512PPmzVXagApktwmvhg6LdktzHbPvj3aLEOfnFIsuC2 OSfzZ1itZkr1dSY92NliXIhsA/Htji+J5uSzQ99r8KD4hrLLJEShtd9JG5EloRqHvNS1 wYzA== 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=rDFVad57+b4OPFP3CC0ggdJTvR7naxuNUEKnAFMi89M=; b=y7gq1EdsHA3YAbKbni+JRPfRC8VW9aj9ruT703d92IlRI2/GflQkxedRIncecqURad R88UoVfJCNOkgxaBvDL8RoOQ8USOOCzJlJDTTaqCFhmXndkzBnwLLR0gI1oGuE4orUw6 RpJQXm20E5JiVt4mwimjCW3PqFwy4YZvY/Ej7jAu+FSPba3irbP36C6YQ0n23gC6IGOK L2U7eJ50Tm3Kq4dKHX0pyZ9+Bnw5H1D7EM6KPbyquqsxz8PNgtROZN1HpGwElIuCXoE/ heVZOQFBQfvIWQNvucqzA7iVr2/3oSBkEpSAlMcV8mgxAjWojZ/bdFNWG6MW9zYStoaT 3zYA== 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 s14si1684485ejx.539.2021.05.14.17.04.59; Fri, 14 May 2021 17:05:22 -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 S234803AbhENPby (ORCPT + 99 others); Fri, 14 May 2021 11:31:54 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3080 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232236AbhENPbt (ORCPT ); Fri, 14 May 2021 11:31:49 -0400 Received: from fraeml714-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4FhXPt0Xrlz6cw83; Fri, 14 May 2021 23:24:34 +0800 (CST) Received: from roberto-ThinkStation-P620.huawei.com (10.204.62.217) 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.2176.2; Fri, 14 May 2021 17:30:35 +0200 From: Roberto Sassu To: , CC: , , , Roberto Sassu Subject: [PATCH v7 12/12] ima: Don't remove security.ima if file must not be appraised Date: Fri, 14 May 2021 17:27:53 +0200 Message-ID: <20210514152753.982958-13-roberto.sassu@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210514152753.982958-1-roberto.sassu@huawei.com> References: <20210514152753.982958-1-roberto.sassu@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.204.62.217] 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 d9a627de3930..940695e7b535 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.25.1