Skip to content

ocfs2: validate inline xattr header consumers

ZhengYuan Huang lkml ocfs2-devel 1 version Applied

Status from this message: [merged mm-nonmm-stable] ocfs2-validate-inline-xattr-header-before-reflinking-inline-xattrs.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 5 repliesApplied 5/5

Patches in v1 All 5 applied

#Subject and filesSizeRepliesApplied
1/5ocfs2: validate inline xattr header before ibody lookupsfs/ocfs2/xattr.c+47 -351 replyApplied
2/5ocfs2: validate inline xattr header before checking outside valuesfs/ocfs2/xattr.c+4 -31 replyApplied
3/5ocfs2: validate inline xattr header before ibody removefs/ocfs2/xattr.c+3 -31 replyApplied
4/5ocfs2: validate inline xattr header before inline refcount attachfs/ocfs2/xattr.c+6 -31 replyApplied
5/5ocfs2: validate inline xattr header before reflinking inline xattrsfs/ocfs2/xattr.c+13 -61 replyApplied

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchJoseph Qi
1/5R-b
2/5R-b
3/5R-b
4/5R-b
5/5R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/5] ocfs2: validate inline xattr header consumers

Corrupt i_xattr_inline_size can move the computed inode-body xattr header outside the dinode block. Several OCFS2 paths then trust xh_count or xattr entry geometry from that unchecked header.

The reported KASAN splat hits the ibody lookup path:

  BUG: KASAN: use-after-free in ocfs2_xattr_find_entry+0x37b/0x3a0
  ocfs2_xattr_ibody_get()
  ocfs2_xattr_get_nolock()
  ocfs2_calc_xattr_init()

The same unchecked header derivation also exists in the outside-value probe, ibody remove, inline refcount attach, and inline reflink paths.

This series factors the existing ibody list validation into a shared helper and then converts the remaining inline-header consumers one at a time.

Patch layout:

1. validate ibody get/find and reuse the helper in ibody list
2. validate the outside-value probe
3. validate ibody remove
4. validate inline refcount attach
5. validate inline reflink

ZhengYuan Huang (5):
ocfs2: validate inline xattr header before ibody lookups
ocfs2: validate inline xattr header before checking outside values
ocfs2: validate inline xattr header before ibody remove
ocfs2: validate inline xattr header before inline refcount attach
ocfs2: validate inline xattr header before reflinking inline xattrs

 fs/ocfs2/xattr.c | 123 ++++++++++++++++++++++++++++-------------------
 1 file changed, 73 insertions(+), 50 deletions(-)
Signature · 1 line
2.43.0