From: Gao Xiang <xiang@kernel.org>
To: bingying lan <lanbingying.lby@linux.alibaba.com>
Cc: linux-erofs@lists.ozlabs.org, xiang@kernel.org, chao@kernel.org
Subject: Re: [PATCH] erofs-utils: lib: fix xattr prefix offset truncation
Date: Tue, 20 Oct 2026 15:44:20 +0200 [thread overview]
Message-ID: <atdwNLVXkwSgARDK@MacBookPro> (raw)
In-Reply-To: <20261020055218.2953541-1-lanbingying.lby@linux.alibaba.com>
Hi Bingying,
On Tue, Oct 20, 2026 at 01:52:18PM +0800, bingying lan wrote:
> xattr_prefix_start stores the long xattr prefix table offset in 4-byte
> units. Casting the byte offset to u32 before shifting discards its
> upper bits, even though the overflow check accepts offsets whose
> shifted value fits in u32. The table is written at the full offset,
> but the superblock points to the truncated location.
>
> Shift the offset before narrowing it to u32. This prevents corrupted
> images when incremental builds place the prefix table at or beyond
> 4 GiB.
>
> Fixes: b6b741d8daaf ("erofs-utils: lib: get rid of tmpfile()")
> Signed-off-by: bingying lan <lanbingying.lby@linux.alibaba.com>
> ---
> lib/xattr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/xattr.c b/lib/xattr.c
> index d86d94a..e742bfc 100644
> --- a/lib/xattr.c
> +++ b/lib/xattr.c
> @@ -921,7 +921,7 @@ int erofs_xattr_flush_name_prefixes(struct erofs_importer *im, bool plain)
> return -EOVERFLOW;
> start = offset;
>
> - sbi->xattr_prefix_start = (u32)offset >> 2;
> + sbi->xattr_prefix_start = (u32)(offset >> 2);
Good catch:
Reviewed-by: Gao Xiang <xiang@kernel.org>
will move to -fixes after -rc1 is out.
Thanks,
Gao Xiang
next prev parent reply other threads:[~2026-10-20 13:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-20 5:52 [PATCH] erofs-utils: lib: fix xattr prefix offset truncation bingying lan
2026-10-20 13:44 ` Gao Xiang [this message]
2026-10-20 13:45 ` Gao Xiang
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=atdwNLVXkwSgARDK@MacBookPro \
--to=xiang@kernel.org \
--cc=chao@kernel.org \
--cc=lanbingying.lby@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.