Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1009264lqb; Wed, 29 May 2024 18:47:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXKyQNaPf+r9VZefP0dOpuWFLglxcie7eaC35v2DnVZnogvsEt2nIVIKkCoUFAG+y8i5/FTRoRNFRt5+D07QiS07LMvywOwAVJC4TOq+Q== X-Google-Smtp-Source: AGHT+IHuWhyjFMyzOn6CMOz90P5cqqwf7WSwd+n46IV6auuq4tbs4V6rvQVviAcE0D/1PzKVXvJX X-Received: by 2002:a05:6808:1997:b0:3c9:68f8:815b with SMTP id 5614622812f47-3d1dccb2061mr941721b6e.26.1717033654031; Wed, 29 May 2024 18:47:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717033654; cv=pass; d=google.com; s=arc-20160816; b=gWd9kwQ5/MiXDrFIpKJmmtbjxbZMyDy4Kis+NVj+xV2Gaqjru7P5aeS1YdlIwyhj5P kUmwwUC7EYwiIEtd6/m/2U2C/hrLuW78fk/sh1J1EC6N0GkrgOQqfsLbubNGgzTWyiS1 riH9EsyZFG/fGOSDhIMspqY07JF6I+RrASq5a5QOU5cctiNzXruiYNdQkIiTVoVQE+Pg nPLYZC2pQFYZdfjACuclYTiEDsvhPc0JXgSL5Us41HX+UdjoScbBAeQOmWg4/c/MBFuL y5M7tvyM2L4WLcrF67rHCNzcLB9W8Q/g9KPLLmcFTo+ypIa0JyFPVOTHRsTR0EYB6YNa g8VQ== 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=GtKBdXnoQfLOHhfUlX9Bxsk6L3lUvasMxrh9oed50QE=; fh=CW0D43446UKH3XxaGtQ4AHx3bU/8eJjHhO0/GkVXJ8c=; b=F7V6rDF7NvX0kEoBAuf52O55VSveSx2BYRq2H8FsB7WyEUUtgseDTq4mGu6QC6Fkie QdL6AtCNNuot0D6tXMEse04HDkW2AXGkr6zubx9LXyGHCmLR4UQ6eag1j0psrbR17Jx7 UZIXkJcsrYYjHpAIL07L6F/vo0SATFdvwF++cvLddPbMWSbt5E8ppnahCPOb0/QHnkXm SpZ0Btv1Cfxd876Aht4LkrP7IoCSEfJ58DORUNtVy/6b3yKUNB+7Huc0+1O5rtIUbewp +gWwQw99ch+3EG+VeNxb9hN1BGC0g+7sp4AR9XfpXoAchjixFe7PZ7tjAhAtSLJTs/d9 v3Yw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@paul-moore.com header.s=google header.b=RwtgAkTz; 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-194856-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194856-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 ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43fb18c9f98si158465531cf.608.2024.05.29.18.47.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 18:47:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194856-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=@paul-moore.com header.s=google header.b=RwtgAkTz; 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-194856-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194856-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id ACC381C22AC5 for ; Thu, 30 May 2024 01:47:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ECA431C69C; Thu, 30 May 2024 01:47:12 +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="RwtgAkTz" Received: from mail-yw1-f176.google.com (mail-yw1-f176.google.com [209.85.128.176]) (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 70CAD1758F for ; Thu, 30 May 2024 01:47:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717033632; cv=none; b=AmGkjVVnf1hcPhFea8pdBY3fZNBty3WtRkKhBM8ifqdArydQSaMS3BamrC64suocIuTT2yr/IYJ6EZBu06ctUl2OERn1xNF+QaKrGFw+UuLxGT6OS8RpPFNydMJMHDKitBeqNzw7mmxUN5ig73lDfu6pqDElKjfBkAQyO1twpSc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717033632; c=relaxed/simple; bh=x1jS0mxgpy/2saLRwCgP0IDOSIhPVz9T5ZHuv9e2c30=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=mlLLJc4n8WQH129fqbiwOCMa5fEd+zH/XEHAKYHYJxscGy17m9UMu0/aJq8Ua229iVq1P/AcygkD55Q2yhD2brjn7ZZ0W1mhW5ixWbRi33EBAk14cxoMbUnxrLCflDhL9ofusCJq4I4M1vKu5VHnizBrMdQIqdtDnQW1Zbxhs5s= 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=RwtgAkTz; arc=none smtp.client-ip=209.85.128.176 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-yw1-f176.google.com with SMTP id 00721157ae682-62a0827316eso3393197b3.1 for ; Wed, 29 May 2024 18:47:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore.com; s=google; t=1717033629; x=1717638429; 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=GtKBdXnoQfLOHhfUlX9Bxsk6L3lUvasMxrh9oed50QE=; b=RwtgAkTzeIe14CmGCyMksSR4l21XcWqOQkKoopcgKO/XLkZUIn4G/0i0q0lKZrcy4x xn68e3VSEarmh1mvNflXaLAyT29Gv70J4qQTPiTT05QTrRcMDjhNFl1k0s3cr14tBGG6 yL71M4rAGeGLtcneYI7oXdXS7scDG95KWbSh3npaBfIrxNpZ9xwjoq1VUJFmfXrn8CRj KMEtKZPZrCDtknaqS5rNesrw9qnisExtDi3jgfHhEY7IUV9y1lfeVXDRq8GEYtPqrmkL FpMsJap7fFxb8yCjg7PMJWPjGZpfF+3y/IHrgo+lih0Ycse8GFpBMubGKutnNwI4dxvG KhSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717033629; x=1717638429; 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=GtKBdXnoQfLOHhfUlX9Bxsk6L3lUvasMxrh9oed50QE=; b=FfNtxwlN9RfQAhlqIKNSMzCq1Cw+f7P5os4armmlPWqjTUDdcZKhRbR8/g+V9saKyP tADGmA/TxMPGTNA8+8G4t25TAzkNA9BNuu22O7B+KVMiwkf82SxDTullLFcfpvvy5CZr xSfMtYGcysPb8UBo7z0jb+JRLtuxhXRTaW1apZpdexwXXc1IN6GuxAERwHuhFfLduGV6 RhR+BS+bS2CXKb+IMI65kvDuTDQxdmABPDoSYGtYru5bDmTZNYT9xdrm4JQSwZhw1LR8 YqiaViC10reQTefMxWs6YRajgSjJoMUeSndv2BWsz9c82Ssobvs7H9EVC0xRl8eeaZkK btFw== X-Forwarded-Encrypted: i=1; AJvYcCWq4P7fAXYPv1wNhcG5niMtI2MJtGatR8f59tIYo2cscSFjI8N80GKbi0dBA6wn4UMOzZOEAskx4tXFpWVxrKXAbL4GFNuIWkxbVwVW X-Gm-Message-State: AOJu0YzcrFzNBRpclfd3xgffejVJU1DAK/IQOKy+iylnYaEXY8gFO9p0 z82yVwuK2M5o4DiuaVn/0GoQzvBP3Kt5lthQlVMejXf0X/cBMWDotVpRb/pyDiUyojx5tkMVcIJ V37mHDzv7J2Io26uUOnLXfG+hpfneQiu3aJ7d X-Received: by 2002:a05:690c:ecc:b0:627:ecd3:6223 with SMTP id 00721157ae682-62c6bc79ed6mr10295197b3.35.1717033629104; Wed, 29 May 2024 18:47:09 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <1716583609-21790-1-git-send-email-wufan@linux.microsoft.com> <1716583609-21790-16-git-send-email-wufan@linux.microsoft.com> In-Reply-To: <1716583609-21790-16-git-send-email-wufan@linux.microsoft.com> From: Paul Moore Date: Wed, 29 May 2024 21:46:57 -0400 Message-ID: Subject: Re: [PATCH v19 15/20] fsverity: expose verified fsverity built-in signatures to LSMs To: ebiggers@kernel.org, Fan Wu Cc: corbet@lwn.net, zohar@linux.ibm.com, jmorris@namei.org, serge@hallyn.com, tytso@mit.edu, axboe@kernel.dk, agk@redhat.com, snitzer@kernel.org, mpatocka@redhat.com, eparis@redhat.com, linux-doc@vger.kernel.org, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, fsverity@lists.linux.dev, linux-block@vger.kernel.org, dm-devel@lists.linux.dev, audit@vger.kernel.org, linux-kernel@vger.kernel.org, Deven Bowers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, May 24, 2024 at 4:46=E2=80=AFPM Fan Wu = wrote: > > This patch enhances fsverity's capabilities to support both integrity and > authenticity protection by introducing the exposure of built-in > signatures through a new LSM hook. This functionality allows LSMs, > e.g. IPE, to enforce policies based on the authenticity and integrity of > files, specifically focusing on built-in fsverity signatures. It enables > a policy enforcement layer within LSMs for fsverity, offering granular > control over the usage of authenticity claims. For instance, a policy > could be established to permit the execution of all files with verified > built-in fsverity signatures while restricting kernel module loading > from specified fsverity files via fsverity digests. > > The introduction of a security_inode_setintegrity() hook call within > fsverity's workflow ensures that the verified built-in signature of a fil= e > is exposed to LSMs. This enables LSMs to recognize and label fsverity fil= es > that contain a verified built-in fsverity signature. This hook is invoked > subsequent to the fsverity_verify_signature() process, guaranteeing the > signature's verification against fsverity's keyring. This mechanism is > crucial for maintaining system security, as it operates in kernel space, > effectively thwarting attempts by malicious binaries to bypass user space > stack interactions. > > The second to last commit in this patch set will add a link to the IPE > documentation in fsverity.rst. > > Signed-off-by: Deven Bowers > Signed-off-by: Fan Wu > > --- > v1-v6: > + Not present > > v7: > Introduced > > v8: > + Split fs/verity/ changes and security/ changes into separate patches > + Change signature of fsverity_create_info to accept non-const inode > + Change signature of fsverity_verify_signature to accept non-const ino= de > + Don't cast-away const from inode. > + Digest functionality dropped in favor of: > ("fs-verity: define a function to return the integrity protected > file digest") > + Reworded commit description and title to match changes. > + Fix a bug wherein no LSM implements the particular fsverity @name > (or LSM is disabled), and returns -EOPNOTSUPP, causing errors. > > v9: > + No changes > > v10: > + Rename the signature blob key > + Cleanup redundant code > + Make the hook call depends on CONFIG_FS_VERITY_BUILTIN_SIGNATURES > > v11: > + No changes > > v12: > + Add constification to the hook call > > v13: > + No changes > > v14: > + Add doc/comment to built-in signature verification > > v15: > + Add more docs related to IPE > + Switch the hook call to security_inode_setintegrity() > > v16: > + Explicitly mention "fsverity builtin signatures" in the commit > message > + Amend documentation in fsverity.rst > + Fix format issue > + Change enum name > > v17: > + Fix various documentation issues > + Use new enum name LSM_INT_FSVERITY_BUILTINSIG_VALID > > v18: > + Fix typos > + Move the inode_setintegrity hook call into fsverity_verify_signature(= ) > > v19: > + Cleanup code w.r.t inode_setintegrity hook refactoring > --- > Documentation/filesystems/fsverity.rst | 23 +++++++++++++++++++++-- > fs/verity/signature.c | 18 +++++++++++++++++- > include/linux/security.h | 1 + > 3 files changed, 39 insertions(+), 3 deletions(-) Eric, can you give this patch in particular a look to make sure you are okay with everything? I believe Fan has addressed all of your previous comments and it would be nice to have your Ack/Review tag if you are okay with the current revision. --=20 paul-moore.com