Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F61FC6FD1F for ; Mon, 6 Mar 2023 18:29:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230052AbjCFS27 (ORCPT ); Mon, 6 Mar 2023 13:28:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229718AbjCFS26 (ORCPT ); Mon, 6 Mar 2023 13:28:58 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8B9B34317; Mon, 6 Mar 2023 10:28:37 -0800 (PST) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 326F229r032225; Mon, 6 Mar 2023 16:52:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=Qmb+wAuWZ++BAHNyIHrpxJlNwrEdwiaNpMW6hsm+jrw=; b=sOAHNLdpoGmHSyZ2ajlW8OMzQL1sJcQo7ANDzBbtQd0g7G96kNVjczG7NCCQESssGZre QTfAzkE/dCo2xP5PpLYADBej8T2wQm9FStizxJeKWUCPB/YbeluWzj96++LVjabxvtGt nhJ7FL3G5CcXud70UFbxzjmEnqIZTHAVOU9no82QzjVqPACCB2ITpbU7NfyV++BaDbze NurjUilf7GPeOx5/JRwvhmCP6O9IzLBy1AQBF7kCEsAscReZDrnNrsEuYd3v1/Jisszj nN6vdhVKeb2wgPkv3IhbpEW9DZk1wT7UHs3VtLDh9FNh08bTh2uyM7Vv7QP/PK+B0MwD bA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3p4x1humsk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Mar 2023 16:52:16 +0000 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 326GfkIZ023728; Mon, 6 Mar 2023 16:52:15 GMT Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3p4x1hums0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Mar 2023 16:52:15 +0000 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 326Fwjux017270; Mon, 6 Mar 2023 16:52:14 GMT Received: from smtprelay05.wdc07v.mail.ibm.com ([9.208.129.117]) by ppma04dal.us.ibm.com (PPS) with ESMTPS id 3p41ak9s46-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Mar 2023 16:52:14 +0000 Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229]) by smtprelay05.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 326GqDSw64487822 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 6 Mar 2023 16:52:13 GMT Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4E32D5805C; Mon, 6 Mar 2023 16:52:13 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6542B5805E; Mon, 6 Mar 2023 16:52:09 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP; Mon, 6 Mar 2023 16:52:09 +0000 (GMT) Message-ID: <297a6bd8-fd91-bdf1-1c45-ebbc0a424711@linux.ibm.com> Date: Mon, 6 Mar 2023 11:52:08 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH 02/28] ima: Align ima_post_path_mknod() definition with LSM infrastructure Content-Language: en-US To: Roberto Sassu , viro@zeniv.linux.org.uk, chuck.lever@oracle.com, jlayton@kernel.org, zohar@linux.ibm.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, brauner@kernel.org Cc: linux-fsdevel@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, linux-kernel@vger.kernel.org, Roberto Sassu References: <20230303181842.1087717-1-roberto.sassu@huaweicloud.com> <20230303181842.1087717-3-roberto.sassu@huaweicloud.com> From: Stefan Berger In-Reply-To: <20230303181842.1087717-3-roberto.sassu@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ch7eh3n3M6hNzFx4iV-VKLQYvZxCHWC- X-Proofpoint-ORIG-GUID: nBfLHMSSXtcL4sth2LFlHrHwraCz-G7O X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_09,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxlogscore=968 spamscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 adultscore=0 phishscore=0 mlxscore=0 bulkscore=0 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303060142 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On 3/3/23 13:18, Roberto Sassu wrote: > From: Roberto Sassu > > Change ima_post_path_mknod() definition, so that it can be registered as > implementation of the path_post_mknod hook. > > Also, make sure that ima_post_path_mknod() is executed only if > (mode & S_IFMT) is equal to zero or S_IFREG. > > Add this check to take into account the different placement of the > path_post_mknod hook (to be introduced) in do_mknodat(). Since the new hook > will be placed after the switch(), the check ensures that > ima_post_path_mknod() is invoked as originally intended when it is > registered as implementation of path_post_mknod. case 0: case S_IFREG: <---- this here error = vfs_create(mnt_userns, path.dentry->d_inode, dentry, mode, true); if (!error) ima_post_path_mknod(mnt_userns, dentry); > > Signed-off-by: Roberto Sassu Reviewed-by: Stefan Berger