Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp856407rdg; Wed, 11 Oct 2023 07:27:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGLwtcebn3qmtEOKNH/WuV9kg948DIwKLU5WXF6edYXD9m+r2BHsszPGbqWgCMdekw4LwTl X-Received: by 2002:a17:903:22d0:b0:1c7:22ae:4080 with SMTP id y16-20020a17090322d000b001c722ae4080mr27864928plg.0.1697034458693; Wed, 11 Oct 2023 07:27:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697034458; cv=none; d=google.com; s=arc-20160816; b=kZ8UDb1yXfYQHopECqKfeZvqj7vjRfkB/rnEhsFI+yXiBQ/8wZBNTnhYXBH3zGRQWs RRTCjB1Qle9vkf0x1jXd9gKYKH5AfNbb1fRNrUZrZ7xSi9xoGt3sUOn4jljskOaXV3L5 q1tKRUmEPF94Q4o2g9N1Q9BpmGEbllEG4hYwQm/T1DIJ09VEi14uItcIzOx4Cs6YSzMs t3/UMJiut3re1xDLPbMB2RpleV3UYwtyI5wbZYCutTuBvJPsmsD7ZhbTNAEncQewBqpE an8Ezo9/l7MKeTW9Smc1EcwIRlh/VHzRHP2L4jEdZ+9j7FaI9qd80l9NNj5Q804hfrXW a8og== 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:date:cc:to:from:subject:message-id :dkim-signature; bh=hwv9Ln5vwUJ6RTl5oYfvcx3p5aoxxW+VLSzODqPcTGI=; fh=mxqxpCwm2x7wg2ewO7f3esbJEJ4c37M7WiCIdk+12k8=; b=Josgo3kck+Cr4SG0VAfdNg4Nx2E1pimG0KQ7JgfOlBtxlj6Xi/OTzLDZIOm/dI+KJz 0EvbF+G+2Eg5sRuVTRK+tUw5zX1Pue1QzvDjgDqnSjoXkOnjdnxjxvPQ837QOuYfZcHa b4PC/VykfUvnaM2wVg8mArWBxn1pL08oaw5XrwQU0sjuiOb9f7svmnKId/pyAJuDBSC/ CNClTf/sNAKqdbllb4AcMI9QBEQTecOp1Jdjd/4l0Hyogcg1QoVKefUuqO06XR9CNq7B jiQA3kwHqglF4IRwjh1lVltakiCrhVJ3MoKFjJ+3tDvcZjxz9Oga6xmlXFd8/tD4ZA0Z O1AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="kNh1IE6/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id h13-20020a170902680d00b001c5f0fd51bfsi12275812plk.100.2023.10.11.07.27.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 07:27:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="kNh1IE6/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 22A85805A5FF; Wed, 11 Oct 2023 07:27:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346927AbjJKO1V (ORCPT + 99 others); Wed, 11 Oct 2023 10:27:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235069AbjJKO1U (ORCPT ); Wed, 11 Oct 2023 10:27:20 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F0C0B6; Wed, 11 Oct 2023 07:27:18 -0700 (PDT) Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39BEKJgZ026056; Wed, 11 Oct 2023 14:26:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=hwv9Ln5vwUJ6RTl5oYfvcx3p5aoxxW+VLSzODqPcTGI=; b=kNh1IE6/AIonVhJ3NCWkxse1DrFFdg9H2SIIDT0wD5L34gedEFjLcq5xQuuyRN3HvbIe tf/n/SVSv0/yCMxa1SfbrYd0Rxd7KoXtilfS5knyDmocKIVnYAQO++PUIMmMMTVNeMrz 6iLn6K+iDQYkNuqsEs6tdYZ7pTKGijxGrfB0Ijrd9efrHf3yAdRWnwXrScKgEFLAaA27 48x6JtzwPZd/cnaUR7o8QX5l/8s+Ton/qklkSwip7VmHnAe0nFrdNdGq5qPTf0csW1jV cRPO4ZyPhP7EhDlkKOIyWn6GYE9xIBy3Me+t4Z2mL3iYm6jpJ06cpbj6NEmr8W1r20F7 eg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tnwcng7ek-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 11 Oct 2023 14:26:30 +0000 Received: from m0353723.ppops.net (m0353723.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 39BELEdB029444; Wed, 11 Oct 2023 14:26:29 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tnwcng7e5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 11 Oct 2023 14:26:29 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 39BE3NVc025863; Wed, 11 Oct 2023 14:26:28 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([172.16.1.74]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3tkjnngkm5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 11 Oct 2023 14:26:28 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 39BEQSHP27001392 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Oct 2023 14:26:28 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0038B5803F; Wed, 11 Oct 2023 14:26:28 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AAC4558056; Wed, 11 Oct 2023 14:26:26 +0000 (GMT) Received: from li-f45666cc-3089-11b2-a85c-c57d1a57929f.ibm.com (unknown [9.61.67.198]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 11 Oct 2023 14:26:26 +0000 (GMT) Message-ID: Subject: Re: [PATCH v3 01/25] ima: Align ima_inode_post_setattr() definition with LSM infrastructure From: Mimi Zohar To: Roberto Sassu , viro@zeniv.linux.org.uk, brauner@kernel.org, chuck.lever@oracle.com, jlayton@kernel.org, neilb@suse.de, kolga@netapp.com, Dai.Ngo@oracle.com, tom@talpey.com, dmitry.kasatkin@gmail.com, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, dhowells@redhat.com, jarkko@kernel.org, stephen.smalley.work@gmail.com, eparis@parisplace.org, casey@schaufler-ca.com Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, keyrings@vger.kernel.org, selinux@vger.kernel.org, Roberto Sassu , Stefan Berger Date: Wed, 11 Oct 2023 10:26:26 -0400 In-Reply-To: <20230904133415.1799503-2-roberto.sassu@huaweicloud.com> References: <20230904133415.1799503-1-roberto.sassu@huaweicloud.com> <20230904133415.1799503-2-roberto.sassu@huaweicloud.com> Content-Type: text/plain; charset="ISO-8859-15" X-Mailer: Evolution 3.28.5 (3.28.5-22.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: t0qch1x91VHPl_IFUTpYzTcwiC6OKrX2 X-Proofpoint-GUID: Pm1mNEanTYeYNl1mS2QD2BQ4BS1Re_WB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-11_09,2023-10-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 adultscore=0 clxscore=1011 suspectscore=0 mlxscore=0 mlxlogscore=999 lowpriorityscore=0 spamscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310110126 X-Spam-Status: No, score=2.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 11 Oct 2023 07:27:34 -0700 (PDT) X-Spam-Level: ** On Mon, 2023-09-04 at 15:33 +0200, Roberto Sassu wrote: > From: Roberto Sassu > > Change ima_inode_post_setattr() definition, so that it can be registered as > implementation of the inode_post_setattr hook. Please indicate inode_post_settattr() is a new hook. In general it should be stated on first usage. In 02/25 the wording "(to be introduced)" is used, but not on first usage. Please add "(to be introduced)" after inode_post_setattr. Adding a new security hook argument would be to support both IMA and EVM, which have different options. Mimi > Signed-off-by: Roberto Sassu > Reviewed-by: Stefan Berger > --- > fs/attr.c | 2 +- > include/linux/ima.h | 4 ++-- > security/integrity/ima/ima_appraise.c | 3 ++- > 3 files changed, 5 insertions(+), 4 deletions(-) > > diff --git a/fs/attr.c b/fs/attr.c > index d60dc1edb526..7d4553c1208d 100644 > --- a/fs/attr.c > +++ b/fs/attr.c > @@ -486,7 +486,7 @@ int notify_change(struct mnt_idmap *idmap, struct dentry *dentry, > > if (!error) { > fsnotify_change(dentry, ia_valid); > - ima_inode_post_setattr(idmap, dentry); > + ima_inode_post_setattr(idmap, dentry, ia_valid); > evm_inode_post_setattr(dentry, ia_valid); > } > > diff --git a/include/linux/ima.h b/include/linux/ima.h > index 86b57757c7b1..910a2f11a906 100644 > --- a/include/linux/ima.h > +++ b/include/linux/ima.h > @@ -186,7 +186,7 @@ static inline void ima_post_key_create_or_update(struct key *keyring, > #ifdef CONFIG_IMA_APPRAISE > extern bool is_ima_appraise_enabled(void); > extern void ima_inode_post_setattr(struct mnt_idmap *idmap, > - struct dentry *dentry); > + struct dentry *dentry, int ia_valid); > extern int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name, > const void *xattr_value, size_t xattr_value_len); > extern int ima_inode_set_acl(struct mnt_idmap *idmap, > @@ -206,7 +206,7 @@ static inline bool is_ima_appraise_enabled(void) > } > h > static inline void ima_inode_post_setattr(struct mnt_idmap *idmap, > - struct dentry *dentry) > + struct dentry *dentry, int ia_valid) > { > return; > } > diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c > index 491c1aca0b1c..6b032bce4fe7 100644 > --- a/security/integrity/ima/ima_appraise.c > +++ b/security/integrity/ima/ima_appraise.c > @@ -627,6 +627,7 @@ void ima_update_xattr(struct integrity_iint_cache *iint, struct file *file) > * ima_inode_post_setattr - reflect file metadata changes > * @idmap: idmap of the mount the inode was found from > * @dentry: pointer to the affected dentry > + * @ia_valid: for the UID and GID status > * > * Changes to a dentry's metadata might result in needing to appraise. > * > @@ -634,7 +635,7 @@ void ima_update_xattr(struct integrity_iint_cache *iint, struct file *file) > * to lock the inode's i_mutex. > */ > void ima_inode_post_setattr(struct mnt_idmap *idmap, > - struct dentry *dentry) > + struct dentry *dentry, int ia_valid) > { > struct inode *inode = d_backing_inode(dentry); > struct integrity_iint_cache *iint;