Skip to content

xfs: avoid overflow of attr3 leaf block headers with 64k blocks

Brian Foster linux-xfs 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 0 repliesNew
  2. v12 patches 4 repliesSuperseded

Changes in v2 from the cover letter

- Created separate firstused conversion helpers to isolate the overflow management to a single point.
- Added patch 3/3 to kill an unnecessary overflow check.
- Comment cleanups, additions.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3xfs: pass attr geometry to attr leaf header conversion functionsfs/xfs/libxfs/xfs_attr_leaf.c fs/xfs/libxfs/xfs_attr_leaf.h fs/xfs/xfs_attr_inactive.c +1 more+46 -350 replies
2/3xfs: use larger in-core attr firstused field and detect overflowfs/xfs/libxfs/xfs_attr_leaf.c fs/xfs/libxfs/xfs_da_format.h+92 -60 replies
3/3xfs: kill unnecessary firstused overflow check on attr3 leaf removalfs/xfs/libxfs/xfs_attr_leaf.c+1 -20 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH v2 0/3] xfs: avoid overflow of attr3 leaf block headers with 64k blocks

Hi all,

Here's v2 of the series previously posted here:

	http://oss.sgi.com/archives/xfs/2015-02/msg00516.html

This version incorporates the feedback from v1 to use separate helpers for firstused conversion. I've also added a 3rd patch to kill what looks like a (now unnecessary) overflow check.

To give a little more context... it appears that this overflow might have been handled previously in the attr code by reducing the firstused value by the required offset alignment and leaking the last few bytes of the block. In fact, xfs_attr3_leaf_create() used to have a similar check that was removed in:

517c22207b04 xfs: add CRCs to attr leaf blocks

... so I suspect that introduced the regression. Both of those !firstused checks appear to exist as of the original git import. Unfortunately, I haven't seen them documented anywhere, but I can't think of any other purpose for them.

Finally, I took a quick look at userspace... First, this depends on xfs_da_geometry, which is not yet available there. So I suspect this will depend on a larger xfsprogs update. IIRC, something of that nature is pending or in progress..?

Second, from what I can see, nothing functional actually needs to change. xfs_repair already does the correct thing by using a larger type to compute firstused. It's written directly to the on-disk header and will overflow at 64k, but that naturally results in the correct value of 0 on-disk. We should definitely make the code explicit, but this is resolved simply by updating the conversion functions in libxfs.

Thoughts, reviews, flames appreciated...

Brian

v2:
- Created separate firstused conversion helpers to isolate the overflow management to a single point.
- Added patch 3/3 to kill an unnecessary overflow check.
- Comment cleanups, additions.

Brian Foster (3):
xfs: pass attr geometry to attr leaf header conversion functions
xfs: use larger in-core attr firstused field and detect overflow
xfs: kill unnecessary firstused overflow check on attr3 leaf removal

 fs/xfs/libxfs/xfs_attr_leaf.c | 150 ++++++++++++++++++++++++++++++++----------
 fs/xfs/libxfs/xfs_attr_leaf.h |   6 +-
 fs/xfs/libxfs/xfs_da_format.h |  14 +++-
 fs/xfs/xfs_attr_inactive.c    |   3 +-
 fs/xfs/xfs_attr_list.c        |   9 ++-
 5 files changed, 139 insertions(+), 43 deletions(-)
Signature · 6 lines
1.9.3

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs