Skip to content

xfs: fix out-of-range remote xattr value length

Aldo Ariel Panzardo linux-xfs lkml stable 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest posting 2/22 patches 2 repliesIn review
  2. v2 posting 1/22 patches 0 repliesSuperseded
  3. v11 patch 1 replySuperseded

Changes in v2 from the cover letter

- 1/2 is new: fix the signed value-length check in xfs_attr_copy_value (the consumer / root cause), per Darrick's review.
- 2/2: cc stable; otherwise unchanged from the v1 verifier patch.

Patches in v2 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2xfs: reject out-of-range attribute value lengths in xfs_attr_copy_valuefs/xfs/libxfs/xfs_attr_leaf.c+11 -01 reply
2/2xfs: reject remote xattr entries with an out-of-range value lengthfs/xfs/libxfs/xfs_attr_leaf.c+2 -01 reply

Reviews trailers per patch

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

PatchDarrick J. Wong
1/2R-b
2/2R-b

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

Read the v2 thread

Cover letter [PATCH v2 RESEND 0/2] xfs: fix out-of-range remote xattr value length

v1 tightened only the read-time leaf verifier. Darrick pointed out that the underlying problem is the signed value-length check in the consumer, xfs_attr_copy_value(): a remote value length is an on-disk __be32 that is stored into the signed args->rmtvaluelen, so a crafted length such as 0x80000000 becomes negative and slips past the "buffer too small" -ERANGE guard, and is then used as a copy length.

v2 fixes both ends:

1/2 rejects a negative or oversized value length in
xfs_attr_copy_value() before it is used, so a bogus length cannot become a copy length even if it reaches the value copier.
2/2 is the v1 verifier fix, rejecting the malformed remote entry at
read time.

Both are bug fixes and are now cc'd to stable.

v2:
- 1/2 is new: fix the signed value-length check in xfs_attr_copy_value (the consumer / root cause), per Darrick's review.
- 2/2: cc stable; otherwise unchanged from the v1 verifier patch.

v1: https://lore.kernel.org/linux-xfs/[email protected]/

Aldo Ariel Panzardo (2):
xfs: reject out-of-range attribute value lengths in
xfs_attr_copy_value
xfs: reject remote xattr entries with an out-of-range value length

 fs/xfs/libxfs/xfs_attr_leaf.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
Signature · 1 line
2.53.0