Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp38574rdb; Wed, 21 Feb 2024 16:20:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUiID4nrxRj23RTonOz4zPsFOX57DMQ5FNhzzHFS/992n0O1zxHdI6qpNqQAqdJW+facm6vmIKSfMrRsDdzVo8a7c2sA9507JTyMgpd0g== X-Google-Smtp-Source: AGHT+IFbzHJcgq9xbjfpFc5QbZmNBijmgt91Y/gXTnHnoVuG0ihDjjy95AaGucDnskBi7uTJHcWY X-Received: by 2002:a05:6808:1693:b0:3c1:1395:c704 with SMTP id bb19-20020a056808169300b003c11395c704mr23950638oib.32.1708561229538; Wed, 21 Feb 2024 16:20:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708561229; cv=pass; d=google.com; s=arc-20160816; b=Dt34fU8Cp5B/yZ+kwqAPOOpCugqx2zLfBUJ2IZoilUDuK1LoGFKJXfGzEM6qAuFEJ3 uvhaPkiy2rpwjr7AGNYUJKURpV7SdLZdb8A76jaGT7jGK+A+vjV/UMhMJEdyMOGU0Ulq Tb5UEU7RpnNYLTCo6+Q/jpVzjXuA/KE/Ff1CauxpN4sCtqZKJCDspyXFCtSadndZcpwe HbX6uI66+mzXb3yij7Lz4TrIrLAMutB92pX5qABsq/p2bzzLwHIl83uyTruXzfp30RJk eCsR8uG3Zzz6olsFj8HwqYDZan+3OnOCqgbX8aWVquLt8HBgiBrGIenki7pPVPpR5JBs A+AQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jtQ1tC0CBSfDG7D2OFDHSk5m4fCRS3mGvLP6U9da+G4=; fh=EzATVX8pnNokhAQWwBZNNKko/nTsiJ3PsvxHE99Bc8Q=; b=hZZo06+aM23rlV6QRu7odZSyJ40FJ7UPIBLtaizpKl+AKQk4lgYWnCayrou+sDWa7/ TFLhHuGeRoGtYPIe1smUSLBaeHyN2Vfkk7BWWQzVlzDUfdzYulk8TGXu0Akr4Ny6JU2M qWosu1FYqZUZ0waeRp+efjWRmOyCqTbtGb4SxQ6KvL9HjJ9bhp7zw+HEV+UtOWc4w614 5epvjZm3s4lN0ol6zqb2hDrXd864kSXCv7lZUBXg26iiVM5xdBFfEI4gSsCtspJ6eg7C gMQn0lrjqTz1qwZSBHPT4i6NGa8Gm7MebYANNxoiWUfxspV90mkAgva3OnBCfIezJAlj 3IIQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GDxoulQU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-75716-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d11-20020ac847cb000000b0042e03118c67si9387682qtr.535.2024.02.21.16.20.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 16:20:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75716-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GDxoulQU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-75716-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 4C2701C21594 for ; Thu, 22 Feb 2024 00:20:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 07011BA56; Thu, 22 Feb 2024 00:20:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GDxoulQU" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 023B08BE8; Thu, 22 Feb 2024 00:20:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708561215; cv=none; b=uW/LhfFO7xRP7swQpt4ZrOiL3z/kPsw2AJSCG9krlxft2d9ruy7y2R2OUG8gi+UIHRC4zuHMI3ygzDRFz3rDfr1LkU5t4URUeSi+jWmGRxc8rPyaun4q/lJ43c3UKColY6qq+ICUifCK+vUN283V7So5FQ4gVs3Rs8iFh1LBwCI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708561215; c=relaxed/simple; bh=XcqhfhNoKUHNxVdP6oKwW+YG9FWcBd4O3WtSRUDQd8Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RnrQ4E3IM2aRV4HHnRZZn/Smw4Lp3U8ppOBnaOGDKW/xlJoyvr81IoPDBnIbiOuTLUemiLrOX7acNO/YY4JogMxarx0tkT0sBckzO1yJcbPQpSau9JEj0o9BJ4HC+AYDE+MMOzKLLInmYQebNp9wuxqxhN/Hd3pEMalK6y3ewSc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GDxoulQU; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32528C433C7; Thu, 22 Feb 2024 00:20:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708561214; bh=XcqhfhNoKUHNxVdP6oKwW+YG9FWcBd4O3WtSRUDQd8Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GDxoulQUlG5j8Io1Tm/pPhUl3ycuHiUYTyWq/ktRN5WuMrey79vE9zW4V3rfFheLy KqMSA58gaS889K1+Jl6fHiWMghXalbwNVb2IYty4i48CcpAhSDIDptWplutXGUy3va v16TzB+FAL9qK6unhUFJPi93PlLu11m/6lfyhm9QBOrGJLfThZQ9iQw7anZnBGLzUt rH1qaBamX/sI8o5udLOl57/zrzg5virquJF8HmX/PUsPSwVlIsRzU2n8qrLO8i5M+1 n1oUnyEn10Wrsw+utmU5o9p1KjejTPGOavjwuD94KAX38V2ig60/JDa/bTWH8IMCZI 9JWJc4qYmuBJQ== Date: Wed, 21 Feb 2024 18:20:13 -0600 From: "Seth Forshee (DigitalOcean)" To: Paul Moore Cc: Christian Brauner , Serge Hallyn , Eric Paris , James Morris , Alexander Viro , Jan Kara , Stephen Smalley , Ondrej Mosnacek , Casey Schaufler , Mimi Zohar , Roberto Sassu , Dmitry Kasatkin , Eric Snowberg , "Matthew Wilcox (Oracle)" , Jonathan Corbet , Miklos Szeredi , Amir Goldstein , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org, audit@vger.kernel.org, selinux@vger.kernel.org, linux-integrity@vger.kernel.org, linux-doc@vger.kernel.org, linux-unionfs@vger.kernel.org Subject: Re: [PATCH v2 15/25] security: call evm fscaps hooks from generic security hooks Message-ID: References: <20240221-idmap-fscap-refactor-v2-0-3039364623bd@kernel.org> <20240221-idmap-fscap-refactor-v2-15-3039364623bd@kernel.org> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Feb 21, 2024 at 06:43:43PM -0500, Paul Moore wrote: > On Wed, Feb 21, 2024 at 4:25 PM Seth Forshee (DigitalOcean) > wrote: > > > > Signed-off-by: Seth Forshee (DigitalOcean) > > --- > > security/security.c | 15 +++++++++++++-- > > 1 file changed, 13 insertions(+), 2 deletions(-) > > First off, you've got to write *something* for the commit description, > even if it is just a single sentence. > > > diff --git a/security/security.c b/security/security.c > > index 0d210da9862c..f515d8430318 100644 > > --- a/security/security.c > > +++ b/security/security.c > > @@ -2365,9 +2365,14 @@ int security_inode_remove_acl(struct mnt_idmap *idmap, > > int security_inode_set_fscaps(struct mnt_idmap *idmap, struct dentry *dentry, > > const struct vfs_caps *caps, int flags) > > { > > + int ret; > > + > > if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) > > return 0; > > - return call_int_hook(inode_set_fscaps, 0, idmap, dentry, caps, flags); > > + ret = call_int_hook(inode_set_fscaps, 0, idmap, dentry, caps, flags); > > + if (ret) > > + return ret; > > + return evm_inode_set_fscaps(idmap, dentry, caps, flags); > > } > > > > /** > > @@ -2387,6 +2392,7 @@ void security_inode_post_set_fscaps(struct mnt_idmap *idmap, > > if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) > > return; > > call_void_hook(inode_post_set_fscaps, idmap, dentry, caps, flags); > > + evm_inode_post_set_fscaps(idmap, dentry, caps, flags); > > } > > > > /** > > @@ -2415,9 +2421,14 @@ int security_inode_get_fscaps(struct mnt_idmap *idmap, struct dentry *dentry) > > */ > > int security_inode_remove_fscaps(struct mnt_idmap *idmap, struct dentry *dentry) > > { > > + int ret; > > + > > if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) > > return 0; > > - return call_int_hook(inode_remove_fscaps, 0, idmap, dentry); > > + ret = call_int_hook(inode_remove_fscaps, 0, idmap, dentry); > > + if (ret) > > + return ret; > > + return evm_inode_remove_fscaps(dentry); > > } > > If you take a look at linux-next or the LSM tree's dev branch you'll > see that we've gotten rid of the dedicated IMA and EVM hooks, > promoting both IMA and EVM to "proper" LSMs that leverage the existing > LSM hook infrastructure. In this patchset, and moving forward, please > don't add dedicated IMA/EVM hooks like this, instead register them as > LSM hook implementations with LSM_HOOK_INIT(). Yeah, I'm aware that work was going on and got applied recently. I've been assuming this change will go in through the vfs tree though, and I wasn't sure how you and Al/Christian would want to handle that dependency between your trees, so I held off on updating based off the LSM tree. I'm happy to update this for the next round though. Thanks, Seth