From: Andrey Albershteyn <aalbersh@redhat.com>
To: djwong@kernel.org, dchinner@redhat.com, ebiggers@kernel.org,
hch@infradead.org, linux-xfs@vger.kernel.org,
fsverity@lists.linux.dev
Cc: linux-ext4@vger.kernel.org, agruenba@redhat.com,
damien.lemoal@opensource.wdc.com,
linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com,
rpeterso@redhat.com, xiang@kernel.org, jth@kernel.org,
linux-erofs@lists.ozlabs.org,
Andrey Albershteyn <aalbersh@redhat.com>,
linux-btrfs@vger.kernel.org
Subject: [f2fs-dev] [PATCH v2 14/23] xfs: add attribute type for fs-verity
Date: Tue, 4 Apr 2023 16:53:10 +0200 [thread overview]
Message-ID: <20230404145319.2057051-15-aalbersh@redhat.com> (raw)
In-Reply-To: <20230404145319.2057051-1-aalbersh@redhat.com>
The Merkle tree blocks and descriptor are stored in the extended
attributes of the inode. Add new attribute type for fs-verity
metadata. Add XFS_ATTR_INTERNAL_MASK to skip parent pointer and
fs-verity attributes as those are only for internal use. While we're
at it add a few comments in relevant places that internally visible
attributes are not suppose to be handled via interface defined in
xfs_xattr.c.
Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
---
fs/xfs/libxfs/xfs_da_format.h | 10 +++++++++-
fs/xfs/libxfs/xfs_log_format.h | 1 +
fs/xfs/xfs_ioctl.c | 5 +++++
fs/xfs/xfs_trace.h | 1 +
fs/xfs/xfs_xattr.c | 9 +++++++++
5 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/libxfs/xfs_da_format.h b/fs/xfs/libxfs/xfs_da_format.h
index 75b13807145d..2b5967befc2e 100644
--- a/fs/xfs/libxfs/xfs_da_format.h
+++ b/fs/xfs/libxfs/xfs_da_format.h
@@ -689,14 +689,22 @@ struct xfs_attr3_leafblock {
#define XFS_ATTR_ROOT_BIT 1 /* limit access to trusted attrs */
#define XFS_ATTR_SECURE_BIT 2 /* limit access to secure attrs */
#define XFS_ATTR_PARENT_BIT 3 /* parent pointer attrs */
+#define XFS_ATTR_VERITY_BIT 4 /* verity merkle tree and descriptor */
#define XFS_ATTR_INCOMPLETE_BIT 7 /* attr in middle of create/delete */
#define XFS_ATTR_LOCAL (1u << XFS_ATTR_LOCAL_BIT)
#define XFS_ATTR_ROOT (1u << XFS_ATTR_ROOT_BIT)
#define XFS_ATTR_SECURE (1u << XFS_ATTR_SECURE_BIT)
#define XFS_ATTR_PARENT (1u << XFS_ATTR_PARENT_BIT)
+#define XFS_ATTR_VERITY (1u << XFS_ATTR_VERITY_BIT)
#define XFS_ATTR_INCOMPLETE (1u << XFS_ATTR_INCOMPLETE_BIT)
#define XFS_ATTR_NSP_ONDISK_MASK \
- (XFS_ATTR_ROOT | XFS_ATTR_SECURE | XFS_ATTR_PARENT)
+ (XFS_ATTR_ROOT | XFS_ATTR_SECURE | XFS_ATTR_PARENT | \
+ XFS_ATTR_VERITY)
+
+/*
+ * Internal attributes not exposed to the user
+ */
+#define XFS_ATTR_INTERNAL_MASK (XFS_ATTR_PARENT | XFS_ATTR_VERITY)
/*
* Alignment for namelist and valuelist entries (since they are mixed
diff --git a/fs/xfs/libxfs/xfs_log_format.h b/fs/xfs/libxfs/xfs_log_format.h
index 727b5a858028..678eacb7925c 100644
--- a/fs/xfs/libxfs/xfs_log_format.h
+++ b/fs/xfs/libxfs/xfs_log_format.h
@@ -968,6 +968,7 @@ struct xfs_icreate_log {
#define XFS_ATTRI_FILTER_MASK (XFS_ATTR_ROOT | \
XFS_ATTR_SECURE | \
XFS_ATTR_PARENT | \
+ XFS_ATTR_VERITY | \
XFS_ATTR_INCOMPLETE)
/*
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 55bb01173cde..3d6d680b6cf3 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -351,6 +351,11 @@ static unsigned int
xfs_attr_filter(
u32 ioc_flags)
{
+ /*
+ * Only externally visible attributes should be specified here.
+ * Internally used attributes (such as parent pointers or fs-verity)
+ * should not be exposed to userspace.
+ */
if (ioc_flags & XFS_IOC_ATTR_ROOT)
return XFS_ATTR_ROOT;
if (ioc_flags & XFS_IOC_ATTR_SECURE)
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index 9c0006c55fec..e842b9d145cb 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -79,6 +79,7 @@ struct xfs_perag;
#define XFS_ATTR_FILTER_FLAGS \
{ XFS_ATTR_ROOT, "ROOT" }, \
{ XFS_ATTR_SECURE, "SECURE" }, \
+ { XFS_ATTR_VERITY, "VERITY" }, \
{ XFS_ATTR_INCOMPLETE, "INCOMPLETE" }
DECLARE_EVENT_CLASS(xfs_attr_list_class,
diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
index 7b9a0ed1b11f..5a71797fbd44 100644
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@ -20,6 +20,12 @@
#include <linux/posix_acl_xattr.h>
+/*
+ * This file defines interface to work with externally visible extended
+ * attributes, such as those in system or security namespaces. This interface
+ * should not be used for internally used attributes (consider xfs_attr.c).
+ */
+
/*
* Get permission to use log-assisted atomic exchange of file extents.
*
@@ -234,6 +240,9 @@ xfs_xattr_put_listent(
ASSERT(context->count >= 0);
+ if (flags & XFS_ATTR_INTERNAL_MASK)
+ return;
+
if (flags & XFS_ATTR_ROOT) {
#ifdef CONFIG_XFS_POSIX_ACL
if (namelen == SGI_ACL_FILE_SIZE &&
--
2.38.4
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2023-04-04 14:55 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-04 14:52 [f2fs-dev] [PATCH v2 00/23] fs-verity support for XFS Andrey Albershteyn
2023-04-04 14:52 ` [f2fs-dev] [PATCH v2 01/23] xfs: Add new name to attri/d Andrey Albershteyn
2023-04-04 14:52 ` [f2fs-dev] [PATCH v2 02/23] xfs: add parent pointer support to attribute code Andrey Albershteyn
2023-04-04 14:52 ` [f2fs-dev] [PATCH v2 03/23] xfs: define parent pointer xattr format Andrey Albershteyn
2023-04-04 14:53 ` [f2fs-dev] [PATCH v2 04/23] xfs: Add xfs_verify_pptr Andrey Albershteyn
2023-04-04 14:53 ` [f2fs-dev] [PATCH v2 05/23] fsverity: make fsverity_verify_folio() accept folio's offset and size Andrey Albershteyn
2023-04-04 15:30 ` Christoph Hellwig
2023-04-05 10:36 ` Andrey Albershteyn
2023-04-05 15:46 ` Christoph Hellwig
2023-04-05 17:50 ` Eric Biggers
2023-04-04 14:53 ` [f2fs-dev] [PATCH v2 06/23] fsverity: add drop_page() callout Andrey Albershteyn
2023-04-04 23:40 ` Dave Chinner via Linux-f2fs-devel
2023-04-05 10:39 ` Andrey Albershteyn
2023-04-04 14:53 ` [f2fs-dev] [PATCH v2 07/23] fsverity: pass Merkle tree block size to ->read_merkle_tree_page() Andrey Albershteyn
2023-04-04 14:53 ` [f2fs-dev] [PATCH v2 08/23] iomap: hoist iomap_readpage_ctx from the iomap_readahead/_folio Andrey Albershteyn
2023-04-04 15:32 ` Christoph Hellwig
2023-04-04 14:53 ` [f2fs-dev] [PATCH v2 09/23] iomap: allow filesystem to implement read path verification Andrey Albershteyn
2023-04-04 15:37 ` Christoph Hellwig
2023-04-05 11:01 ` Andrey Albershteyn
2023-04-05 15:06 ` Darrick J. Wong
2023-04-05 15:48 ` Christoph Hellwig
2023-04-04 14:53 ` [f2fs-dev] [PATCH v2 10/23] xfs: add XBF_VERITY_CHECKED xfs_buf flag Andrey Albershteyn
2023-04-04 14:53 ` [f2fs-dev] [PATCH v2 11/23] xfs: add XFS_DA_OP_BUFFER to make xfs_attr_get() return buffer Andrey Albershteyn
2023-04-04 14:53 ` [f2fs-dev] [PATCH v2 12/23] xfs: introduce workqueue for post read IO work Andrey Albershteyn
2023-04-04 14:53 ` [f2fs-dev] [PATCH v2 13/23] xfs: add iomap's readpage operations Andrey Albershteyn
2023-04-04 14:53 ` Andrey Albershteyn [this message]
2023-04-04 14:53 ` [f2fs-dev] [PATCH v2 15/23] xfs: add fs-verity ro-compat flag Andrey Albershteyn
2023-04-04 14:53 ` [f2fs-dev] [PATCH v2 16/23] xfs: add inode on-disk VERITY flag Andrey Albershteyn
2023-04-04 22:41 ` Eric Biggers
2023-04-04 23:56 ` Dave Chinner via Linux-f2fs-devel
2023-04-05 11:07 ` Andrey Albershteyn
2023-04-04 14:53 ` [f2fs-dev] [PATCH v2 17/23] xfs: initialize fs-verity on file open and cleanup on inode destruction Andrey Albershteyn
2023-04-04 14:53 ` [f2fs-dev] [PATCH v2 18/23] xfs: don't allow to enable DAX on fs-verity sealsed inode Andrey Albershteyn
2023-04-04 14:53 ` [f2fs-dev] [PATCH v2 19/23] xfs: disable direct read path for fs-verity sealed files Andrey Albershteyn
2023-04-04 16:10 ` Darrick J. Wong
2023-04-05 15:01 ` Andrey Albershteyn
2023-04-05 15:09 ` Darrick J. Wong
2023-04-05 15:50 ` Christoph Hellwig
2023-04-05 18:02 ` Eric Biggers
2023-04-05 22:14 ` Dave Chinner via Linux-f2fs-devel
2023-04-05 22:10 ` Dave Chinner via Linux-f2fs-devel
2023-04-04 14:53 ` [f2fs-dev] [PATCH v2 20/23] xfs: add fs-verity support Andrey Albershteyn
2023-04-04 16:27 ` Darrick J. Wong
2023-04-05 15:18 ` Eric Sandeen
2023-04-04 18:01 ` kernel test robot
2023-04-04 20:03 ` kernel test robot
2023-04-04 14:53 ` [f2fs-dev] [PATCH v2 21/23] xfs: handle merkle tree block size != fs blocksize != PAGE_SIZE Andrey Albershteyn
2023-04-04 16:36 ` Darrick J. Wong
2023-04-05 16:02 ` Andrey Albershteyn
2023-04-05 16:38 ` Darrick J. Wong
2023-04-05 18:16 ` Eric Biggers
2023-04-05 22:26 ` Dave Chinner via Linux-f2fs-devel
2023-04-05 22:54 ` Eric Biggers
2023-04-05 23:37 ` Dave Chinner via Linux-f2fs-devel
2023-04-06 0:44 ` Eric Biggers
2023-04-07 19:56 ` Eric Biggers
2023-04-04 23:32 ` Eric Biggers
2023-04-05 15:12 ` Andrey Albershteyn
2023-04-05 22:51 ` Dave Chinner via Linux-f2fs-devel
2023-04-04 14:53 ` [f2fs-dev] [PATCH v2 22/23] xfs: add fs-verity ioctls Andrey Albershteyn
2023-04-04 14:53 ` [f2fs-dev] [PATCH v2 23/23] xfs: enable ro-compat fs-verity flag Andrey Albershteyn
2023-04-04 16:39 ` [f2fs-dev] [PATCH v2 00/23] fs-verity support for XFS Darrick J. Wong
2023-04-05 16:27 ` Andrey Albershteyn
2023-04-04 23:37 ` Eric Biggers
2023-04-05 16:04 ` Andrey Albershteyn
2023-04-11 5:19 ` Christoph Hellwig
2023-04-12 2:33 ` Eric Biggers
2023-04-12 3:18 ` Dave Chinner via Linux-f2fs-devel
2023-04-12 12:42 ` Christoph Hellwig
2023-04-12 12:40 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230404145319.2057051-15-aalbersh@redhat.com \
--to=aalbersh@redhat.com \
--cc=agruenba@redhat.com \
--cc=cluster-devel@redhat.com \
--cc=damien.lemoal@opensource.wdc.com \
--cc=dchinner@redhat.com \
--cc=djwong@kernel.org \
--cc=ebiggers@kernel.org \
--cc=fsverity@lists.linux.dev \
--cc=hch@infradead.org \
--cc=jth@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-xfs@vger.kernel.org \
--cc=rpeterso@redhat.com \
--cc=xiang@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).