Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2446750lqz; Tue, 2 Apr 2024 19:22:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXHujp+ccLGmiGWpAnUhNrUWeFO+VzFX3xraKgLzP/9p4P0E/zocJs2p72v3KlZnEm8SFeqfbqVgWMCqn5SqMF6rwxRvgGO7K8kEBSYSw== X-Google-Smtp-Source: AGHT+IF2YMA2KBBkkDqhcf+izQUEZPD+KApzIccR8/uuEhSpB8VbDCTOfgHrSTeeti77f/0uUNOG X-Received: by 2002:a81:af59:0:b0:615:1386:a1ba with SMTP id x25-20020a81af59000000b006151386a1bamr5446916ywj.3.1712110924546; Tue, 02 Apr 2024 19:22:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712110924; cv=pass; d=google.com; s=arc-20160816; b=m2Md4t3OlkTDFGjmfgq3qwCuCEq9JmdidnOtH08pKVx1QeGSX71d1nOKqmknd/a4KT vsAu9jXjVvaIaUJkgcmM+dnoUwWVuz5mUFgF6dLpJZFXpsZzO4UNj7bRLAANO65Hg2qC FHsJDF3YTNF46zce+Nh8xzMhn7E0Q+sTMk+PJGRTRqRmPiD2/4xuCDDB392aYlSQB8+v Fw9+fcR5cZjzurFOqt6/I+Yvre8lZgSO40dHYYeu+HAxfiUJKTQnToZGMAZZ2oDGau11 rEeVouY0uGJmgoFF5/IVqqI9Psw2C6WrfZtU3xaOjtvfqGYS8NjANCqPhqNuaTRbl1n6 r8Ng== 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=9vuFRydjFmA3iR+UUnQHu939ajflmP5RxYpQ3S/7QEQ=; fh=WxF1ygfGejn2XLWqfUjK/K47f8JiZplHo96zT0aIXb8=; b=ALCPJQiwKpeWbrChrCkommGo7U9FcH6gaHvUYryyqetKJvk+F/tQB4BbzMS/Qige9X JZY+AOvpGYJfj1YJMxXc70znO0uf0MMnsuGFF8kV2ziYzoU/4lw5Fa5M8SZvAnBoZeB3 Xd+SKxIphibskrwkhDyNfpqGUgaNnuHsm+ng/xymL+Yrwc/VTcy1UR0LwdWbJI8/tQ3n uyRbD1uYn+ndjaN7Sd4Xy501ZABN+Ylt40JgdbRhapNcd7mhwIlog9A2VILU5VaVxjn0 ArYbOiA3BXa6p3OXZArysrpGboAoRpNO7E16P1Rlhk3HapARhtw8Z2QUJngaF6Mdfgos 1XuA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=E84EBHY9; 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-128796-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128796-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 ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id z11-20020a05622a060b00b004317c90cfdesi13398056qta.716.2024.04.02.19.22.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 19:22:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-128796-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=E84EBHY9; 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-128796-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128796-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 23E441C22756 for ; Tue, 2 Apr 2024 22:42:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2CE392E3FD; Tue, 2 Apr 2024 22:42:40 +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="E84EBHY9" 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 29EB71E531; Tue, 2 Apr 2024 22:42:35 +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=1712097759; cv=none; b=eDqTikItMHGt80/6D5ftrymZ9iAK2cVokzdsUvFpbGC4fRaMgqsqeROzcgJs9JBulJbgqH8/R3Zo/ZWRgteN75Zt9uQPjV/KpaziYy7vbU/fwYX6Op8x/lA40bvhs2OZOXNY23YcdoaMoGEGTULrOYFNs1lnAVcV6CzAjQ8KRk0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097759; c=relaxed/simple; bh=76n/dtlrdS4V3B69xGR2/C2+sMIqOX5IJ8MMCJoFQsE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Jy+lajzzJGXcHY6Ge3NLY4adydlY+1wGWG5AZzs0yOKzlSY42fP/2X+7q6g4IUY6WLUInPPuY1WqleRiju2JcS+YW52wj5E853AI1KoG2qQpWHLKiukIStvsvOfmbBw3x4WzlrVzEAm1iUJjW4tdnw2a4C/MrO1SCqtgI7p5Yos= 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=E84EBHY9; 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=9vuFRydjFmA3iR+UUnQHu939ajflmP5RxYpQ3S/7QEQ=; b=E84EBHY99VSck8VRb3I+xR7fQ3 MOhva1SFDx4LcquqPIXb78cVrAuiJ/XZr+ypDL49prxUF9jv5V7KRYCJkx54WLbnYkrLnJDHRF5YU voQJIsae1qL9QyTm/6BE0udqedcbzXUyMZw7p4PsoxekPQgDlxlZ9VwZmDAOapcuSjP778b1WnVeE DvjhZUou0IYs9ZRuwXrEbW7JYnPGnlAA4pT+bVbjyaqvq5/ao6K97lRwm7bQokmatWc+o7fegbN9a hpC/U4c9t0XInAkGopJOxDFZfdLu5KxE3g7QsadDkZXiKyIMcK0WTEImfFaNPexLoYg3aB1n+zzsJ 1e/Nt3EQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rrmpq-004St9-2e; Tue, 02 Apr 2024 22:42:30 +0000 Date: Tue, 2 Apr 2024 23:42:30 +0100 From: Al Viro To: Paul Moore Cc: Linus Torvalds , Roberto Sassu , linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org, Roberto Sassu Subject: Re: [GIT PULL] security changes for v6.9-rc3 Message-ID: <20240402224230.GJ538574@ZenIV> References: <20240402141145.2685631-1-roberto.sassu@huaweicloud.com> <20240402210035.GI538574@ZenIV> 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: Sender: Al Viro On Tue, Apr 02, 2024 at 05:36:30PM -0400, Paul Moore wrote: > > 1) location of that hook is wrong. It's really "how do we catch > > file creation that does not come through open() - yes, you can use > > mknod(2) for that". It should've been after the call of vfs_create(), > > not the entire switch. LSM folks have a disturbing fondness of inserting > > hooks in various places, but IMO this one has no business being where > > they'd placed it. > > I know it's everyone's favorite hobby to bash the LSM and LSM devs, > but it's important to note that we don't add hooks without working > with the associated subsystem devs to get approval. In the cases > where we don't get an explicit ACK, there is an on-list approval, or > several ignored on-list attempts over weeks/months/years. We want to > be good neighbors. > > Roberto's original patch which converted from the IMA/EVM hook to the > LSM hook was ACK'd by the VFS folks. > > Regardless, Roberto if it isn't obvious by now, just move the hook > back to where it was prior to v6.9-rc1. The root cause is in the too vague documentation - it's very easy to misread as "->mknod() must call d_instantiate()", so the authors of that patchset and reviewers of the same had missed the subtlety involved. No arguments about that. Unkind comments about the LSM folks' tendency to shove hooks in places where they make no sense had been brought by many things, the most recent instance being this: However, I thought, since we were promoting it as an LSM hook, we should be as generic possible, and support more usages than what was needed for IMA. (https://lore.kernel.org/all/3441a4a1140944f5b418b70f557bca72@huawei.com/) I'm not blaming Roberto - that really seems to be the general attitude around LSM; I've seen a _lot_ of "it doesn't matter if it makes any sense, somebody might figure out some use for the data we have at that point in control flow, eventually if not now" kind of responses over the years. IME asking what this or that hook is for and what it expects from the objects passed to it gets treated as invalid question. Which invites treating hooks as black boxes...