From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Heming Zhao <heming.zhao@suse.com>
Cc: Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>,
ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/2] ocfs2: xattr bucket validation fixes
Date: Thu, 3 Sep 2026 21:13:11 +0800 [thread overview]
Message-ID: <20260903131313.2396208-1-joseph.qi@linux.alibaba.com> (raw)
In-Reply-To: <20260902124109.27775-1-joseph.qi@linux.alibaba.com>
This series fixes two problems around xattr bucket validation.
Patch 1 fixes a false-corruption failure on blocksize-512 volumes:
the bucket validator limited the entry array to the first bucket
block while the write path stores entries across the whole 4096-byte
bucket region, so a legitimately written, fsck-clean bucket could be
rejected and force the filesystem read-only. It also adds an
alignment check on the bucket block number, since the entry array is
accessed as one contiguous region and a corrupted xattr tree could
otherwise point a bucket at blocks straddling a page boundary.
Patch 2 converts two mlog_bug_on_msg() checks in the bucket defrag
path to ocfs2_error() returns, so that a corrupt bucket holding
overlapping entries or an inflated xh_free_start marks the filesystem
read-only and fails the setxattr instead of panicking the kernel.
Both patches have been tested in QEMU: the blocksize-512 reproducer
(40 xattrs with 100-byte values, previously failing with "entry count
32 exceeds maximum 31") now passes with a clean fsck.ocfs2 result,
and the ocfs2 testsuite xattr tests pass 48/48 across blocksize
combinations.
Changes since v1:
- v1 was a single patch ("ocfs2: allow xattr bucket entries to span
multiple blocks"). The series is now split into two fixes.
- Patch 1: reject buckets whose first block number is not aligned to
the bucket size before validating the entry array; the flat entry
access could otherwise read out of bounds for a bucket from a
corrupted xattr tree that straddles a page boundary.
- Patch 2 is new: return an error instead of BUG() when defrag finds
inconsistent bucket contents.
Joseph Qi (2):
ocfs2: allow xattr bucket entries to span multiple blocks
ocfs2: reject inconsistent xattr bucket during defrag
fs/ocfs2/xattr.c | 37 +++++++++++++++++++++++++++++++------
1 file changed, 31 insertions(+), 6 deletions(-)
--
2.39.3
next prev parent reply other threads:[~2026-09-03 13:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 12:41 [PATCH] ocfs2: allow xattr bucket entries to span multiple blocks Joseph Qi
2026-09-03 13:13 ` Joseph Qi [this message]
2026-09-03 13:13 ` [PATCH v2 1/2] " Joseph Qi
2026-09-03 13:13 ` [PATCH v2 2/2] ocfs2: reject inconsistent xattr bucket during defrag Joseph Qi
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=20260903131313.2396208-1-joseph.qi@linux.alibaba.com \
--to=joseph.qi@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=heming.zhao@suse.com \
--cc=jlbec@evilplan.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark@fasheh.com \
--cc=ocfs2-devel@lists.linux.dev \
/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
all inboxes | Powered by JetHome®