linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] dump.f2fs: support to dump fsverity xattr info in print_xattr_entry()
Date: Fri, 21 Jul 2023 12:21:07 -0700	[thread overview]
Message-ID: <ZLrao4BqUGWkBIDn@google.com> (raw)
In-Reply-To: <20230718040500.1170842-1-chao@kernel.org>

On 07/18, Chao Yu wrote:
> This patch adds to support dumping fsverity xattr info in print_xattr_entry().
> 
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
>  fsck/mount.c | 13 +++++++++++++
>  fsck/xattr.h | 11 +++++++++++
>  2 files changed, 24 insertions(+)
> 
> diff --git a/fsck/mount.c b/fsck/mount.c
> index dbb516b..2691b2f 100644
> --- a/fsck/mount.c
> +++ b/fsck/mount.c
> @@ -199,6 +199,7 @@ static void print_xattr_entry(const struct f2fs_xattr_entry *ent)
>  	char *enc_name = F2FS_XATTR_NAME_ENCRYPTION_CONTEXT;
>  	u32 enc_name_len = strlen(enc_name);
>  	const union fscrypt_context *ctx;
> +	const struct fsverity_descriptor_location *dloc;
>  	int i;
>  
>  	MSG(0, "\nxattr: e_name_index:%d e_name:", ent->e_name_index);
> @@ -250,6 +251,18 @@ static void print_xattr_entry(const struct f2fs_xattr_entry *ent)
>  			return;
>  		}
>  		break;
> +	case F2FS_XATTR_INDEX_VERITY:
> +		dloc = (const struct fsverity_descriptor_location *)value;
> +		if (ent->e_name_len != strlen(F2FS_XATTR_NAME_VERITY) ||
> +			memcmp(ent->e_name, F2FS_XATTR_NAME_VERITY,
> +						ent->e_name_len))
> +			break;
> +		if (size != sizeof(*dloc))
> +			break;
> +		MSG(0, "version: %u\n", le32_to_cpu(dloc->version));
> +		MSG(0, "size: %u\n", le32_to_cpu(dloc->size));
> +		MSG(0, "pos: %lu\n", le64_to_cpu(dloc->pos));

Fixed build error with
		MSG(0, "pos: %"PRIu64"\n", le64_to_cpu(dloc->pos));

> +		return;
>  	}
>  	for (i = 0; i < size; i++)
>  		MSG(0, "%02X", value[i]);
> diff --git a/fsck/xattr.h b/fsck/xattr.h
> index cddafa7..bf1dd7e 100644
> --- a/fsck/xattr.h
> +++ b/fsck/xattr.h
> @@ -90,6 +90,14 @@ static inline int fscrypt_context_size(const union fscrypt_context *ctx)
>  	return 0;
>  }
>  
> +struct fsverity_descriptor_location {
> +	__le32 version;
> +	__le32 size;
> +	__le64 pos;
> +};
> +
> +static_assert(sizeof(struct fsverity_descriptor_location) == 16, "");
> +
>  #define F2FS_ACL_VERSION	0x0001
>  
>  struct f2fs_acl_entry {
> @@ -150,6 +158,9 @@ static inline int f2fs_acl_count(int size)
>  #define F2FS_XATTR_INDEX_LUSTRE			5
>  #define F2FS_XATTR_INDEX_SECURITY		6
>  #define F2FS_XATTR_INDEX_ENCRYPTION		9
> +#define F2FS_XATTR_INDEX_VERITY			11
> +
> +#define F2FS_XATTR_NAME_VERITY			"v"
>  
>  #define IS_XATTR_LAST_ENTRY(entry) (*(__u32 *)(entry) == 0)
>  
> -- 
> 2.40.1


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

      reply	other threads:[~2023-07-21 19:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-18  4:05 [f2fs-dev] [PATCH] dump.f2fs: support to dump fsverity xattr info in print_xattr_entry() Chao Yu
2023-07-21 19:21 ` Jaegeuk Kim [this message]

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=ZLrao4BqUGWkBIDn@google.com \
    --to=jaegeuk@kernel.org \
    --cc=chao@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /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).