Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp3005114lqz; Wed, 3 Apr 2024 15:22:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUAwussDzIWOtvn6G1qgsYu6PQXYgKnZTP1ok1a2SUsFoss2uQdU3AtXrxwtrwyXveKU6EOrDiCjRzBQCl7d1iVgAwmm439ZaGBVNblbg== X-Google-Smtp-Source: AGHT+IFjo/ND3LmMMmD27sLTV8E/jPHXmObkaJorL57SnrmBx4x2n9ItsAChQtNp8f3NDvsesavA X-Received: by 2002:a05:6a20:2589:b0:1a3:bde1:3c7b with SMTP id k9-20020a056a20258900b001a3bde13c7bmr1390791pzd.2.1712182955233; Wed, 03 Apr 2024 15:22:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712182955; cv=pass; d=google.com; s=arc-20160816; b=AOhwU8ImaYXoaizINQE+iJrOk5FlpvlO5q5mE3Q2MwfBCKs+EYQipKnmpK1OEh8NRL tw417+ASkf7bGn8zx/rs/DyV1d6PvcJtuVOFszzFLQQYvWtvqHOatjHcn0OMvZ9oM2Jc 9PQtzFc1SkeORaSU107v01kzf133ildua+wBK7I4vbah/kxxcBUVlPV85r+mPjVoUtFn RYxGDcUgzb690wCtyqftrCHWpdsR7ALm8+TRcFKSwBdFYjNC1pHGJWKJPqoJRlGOnj1x zokCvTLh8vfhJXObnJ3oVeuIm1wJzPbDg4PdDl3QUnFt7Tla7Cj49u2NgUhPZjcHCiLx MeGQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=lKTHvXKGTsV+tX6aUCiyv6Vo691FyZts8/uGP/UQFRw=; fh=0C9oFcnsuhcSNtnq/SQKWHVhAgreYr8IQ5BVgTj5OzQ=; b=C0/PLXLbbJKzixQ6OXfLiiBI07q17fcqMGkjAtfWtBvmmAhR618rz02Svh9v12oDTf SgaC/kTsdY+1pSJQrTZzJc5qarAtuTz08BmE4iJ0Oa9AEZZfZGqLSQdO2g7GLQoNeKDy ZChfMJJR2NKFVKrRi0pOEbcfTtDGS71tGmR8r+4Xd8JBNcypqunjL86dCn7AnnF8z8sy GS1oEHIqfAXaVDniZVLpxjtqYzllRhD3xOVQf/vP5gTfzh2zoH9Y4T+xXAo33AvHPY+L 3JedcKZpMZU7p/UIsGmJATWVqXbkGxopyaM+8zi7IYEyxb3Y0QNk0zSj1qFWqA+xUSEi X1ZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=TKiN3enC; arc=pass (i=1 dkim=pass dkdomain=linux.org.uk dmarc=pass fromdomain=zeniv.linux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-130677-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130677-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e63-20020a17090a6fc500b002a25a833cd5si369468pjk.97.2024.04.03.15.22.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 15:22:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130677-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=TKiN3enC; arc=pass (i=1 dkim=pass dkdomain=linux.org.uk dmarc=pass fromdomain=zeniv.linux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-130677-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130677-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E19F4289BD9 for ; Wed, 3 Apr 2024 22:22:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA6CB138494; Wed, 3 Apr 2024 22:22:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="TKiN3enC" Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 8E6D5156966; Wed, 3 Apr 2024 22:22:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712182935; cv=none; b=HFDU8GkEKIcncV1G1y7LmwazkAegep7DaxbwZCIua19hBvhe88v9sxb2jsgGQczDbYUm8ewWLBwTRahpaenhOfT/PGfnAXRalUeI7J5btt46m3bwxuHguDb0AkrKVZtNQPUfz5hEzRDdJ7M1vdhuQJXkhMoh6b2wltmGIXzTMGI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712182935; c=relaxed/simple; bh=lRXKv8S1N/Sb8QDRVkZH5o2ueko8OCT7uZmrGJAAG6U=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TL8ketNiAA7eP2oOaYICYbnF/Pgv0nu2/tVDyLxgwRSZWwkWlEYfYWBG0I1PVmHFM2QkWoJ7dKTKNhSCZ0IM0AsKkgpnQOKbvA/DDj9K/MajB0DpS+o7GgiSdMAWKWq5W1RoaqVtbloXJCJ34IAoYzXDcG9L4TQ/m/O3Giojn4U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=TKiN3enC; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=lKTHvXKGTsV+tX6aUCiyv6Vo691FyZts8/uGP/UQFRw=; b=TKiN3enC1YTFFL4KXPEO/xna/h imGC6S7z1wcjYi8uk29qLdEvzzmZXfcUSOzP+sPiDsrSj07t899F/JRh2xbgy25bjLA1uoLfbDzZL jhXSNbHYfG19fyau62kCf2qCWqvrbJlpdFSTzTTwPv4m+ipZbRP/YAuMf6H8wquNYoUcWyV9rLo5n SckCIHxavTqy94/mN1aRdCDXtqgxCne9Jb0ahuNeDjAIJkuvxmKpqCbG0d+h5VqM6+Ydfhf2JXVFl xjjcbQNL79Kuhlc6ORc4zcz3p61JeoJaJHaI1OuQP4o4+a8HPdaSXnJeIhJT89qZyJAWRNUMZzqY0 GnGyILsA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rs8zO-005Awt-2F; Wed, 03 Apr 2024 22:21:50 +0000 Date: Wed, 3 Apr 2024 23:21:50 +0100 From: Al Viro To: Roberto Sassu Cc: brauner@kernel.org, jack@suse.cz, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, zohar@linux.ibm.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, linux-cifs@vger.kernel.org, linux-integrity@vger.kernel.org, pc@manguebit.com, torvalds@linux-foundation.org, Roberto Sassu , Steve French Subject: Re: [RESEND][PATCH v3] security: Place security_path_post_mknod() where the original IMA call was Message-ID: <20240403222150.GL538574@ZenIV> References: <20240403090749.2929667-1-roberto.sassu@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240403090749.2929667-1-roberto.sassu@huaweicloud.com> Sender: Al Viro On Wed, Apr 03, 2024 at 11:07:49AM +0200, Roberto Sassu wrote: > From: Roberto Sassu > > Commit 08abce60d63f ("security: Introduce path_post_mknod hook") > introduced security_path_post_mknod(), to replace the IMA-specific call to > ima_post_path_mknod(). > > For symmetry with security_path_mknod(), security_path_post_mknod() was > called after a successful mknod operation, for any file type, rather than > only for regular files at the time there was the IMA call. > > However, as reported by VFS maintainers, successful mknod operation does > not mean that the dentry always has an inode attached to it (for example, > not for FIFOs on a SAMBA mount). > > If that condition happens, the kernel crashes when > security_path_post_mknod() attempts to verify if the inode associated to > the dentry is private. > > Move security_path_post_mknod() where the ima_post_path_mknod() call was, > which is obviously correct from IMA/EVM perspective. IMA/EVM are the only > in-kernel users, and only need to inspect regular files. > > Reported-by: Steve French > Closes: https://lore.kernel.org/linux-kernel/CAH2r5msAVzxCUHHG8VKrMPUKQHmBpE6K9_vjhgDa1uAvwx4ppw@mail.gmail.com/ > Suggested-by: Al Viro > Fixes: 08abce60d63f ("security: Introduce path_post_mknod hook") > Signed-off-by: Roberto Sassu LGTM...