Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2598806rdb; Mon, 12 Feb 2024 09:47:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVDiKLq8kGrcUBRE2KNHLgGIZ94BpEi39lq6AECMKebLwvi9FqhSWYhjbKu/QGrB6J8eyy1EFOZyUZxakI20vJ4K5bweNf7i2fBtixa/A== X-Google-Smtp-Source: AGHT+IENiJ+NWtxQdsS1WhicyYTXc2w7UHgnGB3BqzeRR5gRBumButPwZzx/+WosGBT6hxqxoJl/ X-Received: by 2002:a17:906:230c:b0:a3c:a524:587f with SMTP id l12-20020a170906230c00b00a3ca524587fmr2312358eja.50.1707760040260; Mon, 12 Feb 2024 09:47:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707760040; cv=pass; d=google.com; s=arc-20160816; b=DhKlHH35Vn7IE13AZwBA9g40GljI0uDEgox/0ci/a8bcUNtMk6OcsNoK+wLZUxOkXY 6JiV46UY+eVCwkmMFlDtcbVnh9VMm9vRXfxYPgrs/2Es66MFnkQXfugUHJTxUtxQZosC ab0rVV3W0P5FcgCpFQhCsMJLgZ+aAzM2tfJva6m1ddstG/7fkMFuj5RR4r5LODs2u3cx wwUoxSAquEV64mpRyzS5g2Q2Xsw1wIDoU1kpM0q/hQa1azjxyiJZh4cxDJ3/XyAiCnCq d9nzgu2iHu1OFGYY45ZTe8Y89/QuZNjLjRwT34nXdVXUaay1rh9uWNul2ckvwG+o9cbj zqzA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=lZ01807Zva70exHEJYBQYFEyz4lvSw6VVNS2Z6/uJfA=; fh=mucOERKMwRAoBjlOIfyoUQ2QRYenRB4oVRdlefPzd8k=; b=z+L7q0b5sptAtU4Q6FjJdfUOsfNgwhgGZMTFSWw/F6RWThGZZ4pO3U7LQIhgF0VChY fVPbSpTI6VnFgGww1cmjWv5msAc4q1GGeYoF9Xy8eg/r76qfKy6ZCo8RiHeYvjccgGAs tX9uZG+g1aKm0E7G1TQ/bTSyq8js8r+oQKbJI2E65M4sagPEeJJFHA4g0jtpgcXtzYLw d8ZZOS8nnAQZ/S7BMAQTMFyHaz/TsiZN+yRHreTWzQCAaQYbN7xDtZn1GMSfseg2Bxjn lUEb5mEwdpR9WpbJVJ1UNhyyoHYnXVhSdsTicH5nCKekYEOaUMjR4CVF1iufsoP4FWhe BRMw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=I8saTPKk; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-nfs+bounces-1896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1896-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com X-Forwarded-Encrypted: i=2; AJvYcCVMvC8F5c34w7UMRjhInMTAxfODKFjFWhCNbKaBkWkRYvGEhFtETJSOWwmFfde/cyJhSrYS+Kkenev73VeovBTdRX3pIEACzpMclqfEiw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id o24-20020a1709062e9800b00a3849113468si393371eji.108.2024.02.12.09.47.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 09:47:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-1896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=I8saTPKk; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-nfs+bounces-1896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1896-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9B0B51F229BA for ; Mon, 12 Feb 2024 17:46:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DEFE93F8F7; Mon, 12 Feb 2024 17:46:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="I8saTPKk" X-Original-To: linux-nfs@vger.kernel.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D69313F9C4; Mon, 12 Feb 2024 17:46:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707760000; cv=none; b=ZlMsyU8Utm85R7PDiRFzhjmp3p0lga/Tan7eAX6Je42vL5az9TgegqsoRP3Oqcb7J6bCeHY8wWbcbSuJ+9CYW+srwssoEhuktvZbFBrTB5OIRXVZe8lBi0QR9Yv2hUrtwphFafdQynAAXf7RkPbC5BPNA+pdE812mRHRj3R4jQI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707760000; c=relaxed/simple; bh=Evj4GUR5tO4ZMcMxOMLdh6qJeWH2YMVlAk2b5hg9Ixc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ocv/1owI5k6oijQFnx8NHpIFlw+Ie5dCLMsSerr/6C0gdfQGEs6zt8VUR6saVS9qF+LjHH032RKgcBWAyk3CLo5bTcDGkoDCpgsBj0ag35hlwus1sCLO1WTE+dAaJLbptouXXaXjqLBQnfWfHBQ+4hNonWjEIrItI2J1NTBE5kI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=I8saTPKk; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41CHg9xo007691; Mon, 12 Feb 2024 17:46:00 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=lZ01807Zva70exHEJYBQYFEyz4lvSw6VVNS2Z6/uJfA=; b=I8saTPKklZybxlhLByAYAGqAQrC8Z3j4x9/qPsKqaP1l1ncP0j1dktnhv4XhbssigG1a pfz7dk55ngg4S1eQwuGk7G5Gj5kM/zluAwsmO7C+X0atszWUoo1M6ovPtVqht4OKV3m7 nj2ibA0U/3jC//mzGJQIKLPGVuL6BHJo2FvbxxCUI5uqcuHM6Ai+TlHwqNr/k3g/EVuE yX/Gk7YUT24pSoxplHTGd6iFzbULC58O428KOMyztFQiSasu817k6spKkAfB2/Fk/Lao vaGh1OecdLdyp0LXVBNIQXg/HEGrtv9tHJ9pEio5xCy46RD4q9z+wpjJKpjyyHiUBKMj Xg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w7qy3g3hq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Feb 2024 17:46:00 +0000 Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41CHhnbt014351; Mon, 12 Feb 2024 17:45:59 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w7qy3g3gx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Feb 2024 17:45:59 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41CFfOL8032589; Mon, 12 Feb 2024 17:45:58 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([172.16.1.4]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6kftaaft-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Feb 2024 17:45:58 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41CHjtwb46006540 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Feb 2024 17:45:57 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ABC1158043; Mon, 12 Feb 2024 17:45:55 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D9FC458059; Mon, 12 Feb 2024 17:45:47 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 12 Feb 2024 17:45:47 +0000 (GMT) Message-ID: <2d2a9e48-543a-4307-8de6-2e44b1ead7c5@linux.ibm.com> Date: Mon, 12 Feb 2024 12:45:47 -0500 Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v9 20/25] ima: Move to LSM infrastructure Content-Language: en-US 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, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, zohar@linux.ibm.com, dmitry.kasatkin@gmail.com, eric.snowberg@oracle.com, dhowells@redhat.com, jarkko@kernel.org, stephen.smalley.work@gmail.com, eparis@parisplace.org, casey@schaufler-ca.com, shuah@kernel.org, mic@digikod.net Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-security-module@vger.kernel.org, linux-integrity@vger.kernel.org, keyrings@vger.kernel.org, selinux@vger.kernel.org, linux-kselftest@vger.kernel.org, Roberto Sassu References: <20240115181809.885385-1-roberto.sassu@huaweicloud.com> <20240115181809.885385-21-roberto.sassu@huaweicloud.com> From: Stefan Berger In-Reply-To: <20240115181809.885385-21-roberto.sassu@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: e03QLpvnqItWgjHCd4tAECnyNVo4P7ye X-Proofpoint-GUID: KU-pDuq4N04-HLPzDOVsNKtZc_9jH1p0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-12_14,2024-02-12_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 bulkscore=0 mlxlogscore=999 malwarescore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 mlxscore=0 clxscore=1015 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402120135 On 1/15/24 13:18, Roberto Sassu wrote: > From: Roberto Sassu > > Move hardcoded IMA function calls (not appraisal-specific functions) from > various places in the kernel to the LSM infrastructure, by introducing a > new LSM named 'ima' (at the end of the LSM list and always enabled like > 'integrity'). > > Having IMA before EVM in the Makefile is sufficient to preserve the > relative order of the new 'ima' LSM in respect to the upcoming 'evm' LSM, > and thus the order of IMA and EVM function calls as when they were > hardcoded. > > Make moved functions as static (except ima_post_key_create_or_update(), > which is not in ima_main.c), and register them as implementation of the > respective hooks in the new function init_ima_lsm(). > > Select CONFIG_SECURITY_PATH, to ensure that the path-based LSM hook > path_post_mknod is always available and ima_post_path_mknod() is always > executed to mark files as new, as before the move. > > A slight difference is that IMA and EVM functions registered for the > inode_post_setattr, inode_post_removexattr, path_post_mknod, > inode_post_create_tmpfile, inode_post_set_acl and inode_post_remove_acl > won't be executed for private inodes. Since those inodes are supposed to be > fs-internal, they should not be of interest of IMA or EVM. The S_PRIVATE of interest 'to' > flag is used for anonymous inodes, hugetlbfs, reiserfs xattrs, XFS scrub > and kernel-internal tmpfs files. > > Conditionally register ima_post_key_create_or_update() if > CONFIG_IMA_MEASURE_ASYMMETRIC_KEYS is enabled. Also, conditionally register > ima_kernel_module_request() if CONFIG_INTEGRITY_ASYMMETRIC_KEYS is enabled. > > Finally, add the LSM_ID_IMA case in lsm_list_modules_test.c. > > Signed-off-by: Roberto Sassu > Acked-by: Chuck Lever Reviewed-by: Stefan Berger