Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp44619rdb; Wed, 21 Feb 2024 16:37:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWz+QaaKOk7DCqZuyTL5Yw2LwH9JIrPiJAGW6eM4PPCCi3Fpc0Ab2F/+0YvTtNwcCKoBCBRbTyMlqWoLQXGhm/V228mc+OQ2ojjS0K4Vg== X-Google-Smtp-Source: AGHT+IHnsQGfDlpeiC1b7xt1Nb1nEg1CPllo/SkzV6m/Xc7JRFvYSBDWxpml3VGKmSNmnTT7XllH X-Received: by 2002:a05:6a21:1507:b0:19e:b15c:c8d0 with SMTP id nq7-20020a056a21150700b0019eb15cc8d0mr20758721pzb.18.1708562254297; Wed, 21 Feb 2024 16:37:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708562254; cv=pass; d=google.com; s=arc-20160816; b=YFUhwoTYNq7IjB3jPvTADq3dgtgNbOpn3YKmra24BpUc5JQjoB+KS7tNsdAOs/R/qn EvH6vvwuNKme3v3No2+dnMARGFE0Bs4aRb4hIQf3+GThEyF1Bmw9bNLHKqRNhLZqns3S EqZx+/wYQa5Cf2/YO3jovj8S6DXMVdL3p42TWzR3UrEHCrSs7eJmZ4rQ4L+tMyRNKqbk WXR7LexsyQSdPWq5mXaQJXLalHhbm9+3wq1EOSdeGlpc+PA6eVjrOF5PKs8aI+MCcrBx qK4B9SGKFK+XMmidCWDXI6HhN1+hBZkt9eg6iQ9bowhZvveGq5og4CAE1hCalc9n5Nvi OsxQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=jwPQ5FFRE9HZKwgqe28p5vX79kU4E42ICEiVSyqmmE4=; fh=eRlQe5/z969HAqEc3ZZ/Y/rqIRhYh4VZ9fbfC6vpB94=; b=hn3UKUdmBLc65vgChNNeXqUDDQYeJ8HyY+YdCIX5kJJ/LCjNwuo5xsws11eGqxhCwC 5yGkjNm7IgSbQAyp6yPWA4lF2zoH7T/WL1MVC3lYA09TluGYO9sb3m8F8Cqh4pfxJUa/ lps5nIB73mPPpxydm0IBeA6ysqtUzaqileKDzNowUh5dkCgjAKOX7ED61EHWJWsE2cIF /AwwmRrhVUqtBBDVetO1bbPjIfHUqJ8FO6laEMTUjTr/de7LJzNtgaRrxcYCtlO05XjA mTLa9qB2W9pOz2Yezsg9+7lRZj7RSO0nfUkRdnEJcI3LryvOzojq2Bv+ItkbxwrP/Bpj M81w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@paul-moore.com header.s=google header.b=AWuD0seQ; arc=pass (i=1 spf=pass spfdomain=paul-moore.com dkim=pass dkdomain=paul-moore.com dmarc=pass fromdomain=paul-moore.com); spf=pass (google.com: domain of linux-kernel+bounces-75731-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75731-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=paul-moore.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id y9-20020a17090264c900b001dbe5c1f2eesi6919959pli.223.2024.02.21.16.37.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 16:37:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75731-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@paul-moore.com header.s=google header.b=AWuD0seQ; arc=pass (i=1 spf=pass spfdomain=paul-moore.com dkim=pass dkdomain=paul-moore.com dmarc=pass fromdomain=paul-moore.com); spf=pass (google.com: domain of linux-kernel+bounces-75731-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75731-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=paul-moore.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 0E959B24246 for ; Thu, 22 Feb 2024 00:37:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3AD65F9CE; Thu, 22 Feb 2024 00:37:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=paul-moore.com header.i=@paul-moore.com header.b="AWuD0seQ" Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2DE5FFBF2 for ; Thu, 22 Feb 2024 00:37:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708562238; cv=none; b=WZvV/lJkMhgHdLaFenFuhnTyJZVwjJ3x1An/Bya7DYiCWQVSIIK/nM0fyJ3YXzUf5ciew1qb5Nv8Gv5ZLZLDKJMNzuEUhwopyi2vqEjveY+k41uQUSnUgpcK9VHfNDyN6wQKhxxgSU2ABwNOjtTSC8MaVmYDD47GxgAX7A+hekk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708562238; c=relaxed/simple; bh=7DLu0D8bl4lB3TJjeIvbjOxLuBH7rI9+0zdimRyeniw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=C+FLJ8MdPi5NSzMVaB0WIs2f8Xol7d8RSXID0DeOIU1kS2f4zRS5rAiUrN14R4/avPjXymV+qcOWHN/NtHmB8NamswPN1Md5JEY0r0c+r5dJZ58m/dORCr92jdVr+S0KxX989XMbpRNoocXNlNA0kx+DYJYC/FY3mA62lHIop+Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=paul-moore.com; spf=pass smtp.mailfrom=paul-moore.com; dkim=pass (2048-bit key) header.d=paul-moore.com header.i=@paul-moore.com header.b=AWuD0seQ; arc=none smtp.client-ip=209.85.219.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=paul-moore.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paul-moore.com Received: by mail-yb1-f170.google.com with SMTP id 3f1490d57ef6-dc238cb1b17so1405394276.0 for ; Wed, 21 Feb 2024 16:37:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore.com; s=google; t=1708562235; x=1709167035; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=jwPQ5FFRE9HZKwgqe28p5vX79kU4E42ICEiVSyqmmE4=; b=AWuD0seQuxSM2pg0KIzolmz4hQH1C41vVmswetXZTFhY3U9URmpE2Pgb7noqrjhFS0 VJk3Sl6DDsdf6yJRWe6gnSmX7JEYNgaVCjwPIvzOOdSCm56/FDqMunkl3DljsKWg3pcF I0z2wtASZJeVNgrB8l6qlNHv1CKzgv7O6GGe8c9usAFQGmJGvXuolkvHh8EtXq+6VFJp /1H2mU21yxv0IShaoj69664uEYmfuDXQTPysbdZeyzHmPZe+H89Zuzk/lLgGlTUBOW1R 5PV2VZZtF11n/6oLieojmDAtTLBF2pYFzJxIXlczJcHYGaxDe1x5Yy6r/ufCQWwGqQxT jxew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708562235; x=1709167035; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jwPQ5FFRE9HZKwgqe28p5vX79kU4E42ICEiVSyqmmE4=; b=heiMXJHelZivdthLlJ4iMX3DCd6Sbk11zm15Rc1lhIB+7z+0wN/tv0B46rqz5Q2m8B axdWAWCXKAIO6ZoE7U2m2LV2ZCo7nvj+dsyOe73Z3Hst5Gsq337NHcYPp62+wkyWaUoI jZre1QZJMqFZc80nDdAoyESKztFInZe9UrgO3y0+5hOPX4QkGLzMWckW/mpq459ctJnN HzPucf1LsLL9iY/TrguDtwENe1WF2kM+2J/v4bMWbONN7SAsVhu+W5gE+ujKacsID5hP 09dJvSR96TsLoDfdj7VP+iXE0j3Mw4p9yuUN0MNX1ygMDMLJO1hjdL72YgZUjZ8pCLN0 u6NQ== X-Forwarded-Encrypted: i=1; AJvYcCVrAn7BZrHCGZluWKuTFVl9JRnUIrkunnUM0lzP54Xp+uZBMi0r3LxnbVwOEDeOKTIMrZv1en+LB+5fOAzvN5z49mqH1IFiH3NIbzwi X-Gm-Message-State: AOJu0YzYFRyAFEBvmap4XbAuW5igsR5vMW63LvYmri/pmYvKVpsT59jU MlAuDjNSl04zKDHYAvs8R3V88N1XCYGK0htOOOwvkCtxK9zFY0nX5uYMNaQpn4bmkMxNtc05SfS 0SXE8tAOMtQHVas1WiACEFEAKmc23YE9bba60 X-Received: by 2002:a25:cec1:0:b0:dcc:eb38:199c with SMTP id x184-20020a25cec1000000b00dcceb38199cmr971381ybe.56.1708562235099; Wed, 21 Feb 2024 16:37:15 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240221-idmap-fscap-refactor-v2-0-3039364623bd@kernel.org> <20240221-idmap-fscap-refactor-v2-15-3039364623bd@kernel.org> In-Reply-To: From: Paul Moore Date: Wed, 21 Feb 2024 19:37:04 -0500 Message-ID: Subject: Re: [PATCH v2 15/25] security: call evm fscaps hooks from generic security hooks To: "Seth Forshee (DigitalOcean)" 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Feb 21, 2024 at 7:20=E2=80=AFPM Seth Forshee (DigitalOcean) wrote: > On Wed, Feb 21, 2024 at 06:43:43PM -0500, Paul Moore wrote: > > On Wed, Feb 21, 2024 at 4:25=E2=80=AFPM 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 =3D call_int_hook(inode_set_fscaps, 0, idmap, dentry, cap= s, 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, fl= ags); > > > + 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 den= try *dentry) > > > { > > > + int ret; > > > + > > > if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) > > > return 0; > > > - return call_int_hook(inode_remove_fscaps, 0, idmap, dentry); > > > + ret =3D 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. Okay, good, I just wanted to make sure you were aware of the changes. Since the merge window is only a couple of weeks away I'm guessing this isn't something we'll need to worry about in Linus' tree as the LSM/IMA/EVM changes are slated to go up during the next merge window and I'm guessing this will likely go in after that, targeting the following merge window at the earliest. --=20 paul-moore.com