Skip to content

ocfs2: validate xattr metadata bounds

Zhang Cen ocfs2-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 2 repliesIn review
  2. v22 patches 4 repliesSuperseded
  3. v10 of 2 patches 1 replySuperseded

Changes in v3 from the cover letter

- Move inline xattr validation into ocfs2_validate_inode_block().
- Move non-indexed external xattr validation into ocfs2_validate_xattr_block().
- Validate indexed xattr bucket entries at bucket read time, after ECC verification.
- Keep get/list path checks as helper reuse instead of a separate consumer-only policy.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2ocfs2: validate inline xattrs during inode block validationfs/ocfs2/inode.c fs/ocfs2/xattr.c fs/ocfs2/xattr.h+103 -340 replies
2/2ocfs2: validate external xattr entries when reading metadatafs/ocfs2/xattr.c+80 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/2] ocfs2: validate xattr metadata bounds

From: Cen Zhang <[email protected]>

Hi,

This v3 moves the corrupted xattr metadata checks into the metadata validation paths Joseph pointed at.

Patch 1 validates inline xattr metadata from ocfs2_validate_inode_block() and keeps the get/list consumers using the same helper before they derive pointers from i_xattr_inline_size.

Patch 2 validates non-indexed external xattr blocks from ocfs2_validate_xattr_block(). Indexed xattr buckets do not pass through that validator, so their header and per-entry bounds are checked after bucket ECC verification in ocfs2_read_xattr_bucket().

Both issues were reproduced with crafted OCFS2 images under KASAN.

Changes since v2:
- Move inline xattr validation into ocfs2_validate_inode_block().
- Move non-indexed external xattr validation into ocfs2_validate_xattr_block().
- Validate indexed xattr bucket entries at bucket read time, after ECC verification.
- Keep get/list path checks as helper reuse instead of a separate consumer-only policy.

Cen Zhang (2):
ocfs2: validate inline xattrs during inode block validation
ocfs2: validate external xattr entries when reading metadata

 fs/ocfs2/inode.c |   4 ++
 fs/ocfs2/xattr.c | 211 +++++++++++++++++++++++++++++++++++++++--------
 fs/ocfs2/xattr.h |   2 +
 3 files changed, 183 insertions(+), 34 deletions(-)
Signature · 1 line
2.43.0