Skip to content

xfs: fix [f]inobt magic value verification

Brian Foster linux-xfs 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest8 patches 12 repliesIn review
  2. v39 patches 17 repliesSuperseded
  3. v2 posting 2/27 patches 4 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v2 RFC posting 1/23 patches6 repliesSuperseded

Changes in v4 from the cover letter · 21 lines

- Dropped set buf ops patch (already merged).
- Replace magic value asserts with build-time magic offset checks.
v3: https://marc.info/?l=linux-xfs&m=154929197225225&w=2
- Fix function declarations to include parameter names.
- Convert allocbt buffer verifier.
v2: https://marc.info/?l=linux-xfs&m=154894958207167&w=2
- Include djwong's ->b_ops patch w/ modifications.
- Added patch to fix up existing cpu endian magic checks, fold in typo fix.
- Replace static inline magic verifier helper with out of line variant, kill macro.
- Store on-disk byte order magics in ->b_ops.
- Added patch to refactor common xfs_da3_blkinfo checks.
v1: https://marc.info/?l=linux-xfs&m=154878684317178&w=2
- Remove endian conversion from helper.
- Drop finobt bad magic mitigation patch.
- Additional verifier magic fixups.
- Add verifier name typo fixup.
rfcv2: https://marc.info/?l=linux-xfs&m=154868884311668&w=2
- Split off finobt verifier into separate patch, assign it appropriately.
- Created helpers for xfs_buf_ops magic value verification.
- Added error mitigation patch for problematic finobt blocks.
rfcv1: https://marc.info/?l=linux-xfs&m=154834528212262&w=2

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8xfs: always check magic values in on-disk byte orderfs/xfs/libxfs/xfs_alloc.c fs/xfs/libxfs/xfs_attr_leaf.c fs/xfs/libxfs/xfs_da_btree.c +2 more+8 -71 reply
2/8xfs: create a separate finobt verifierfs/xfs/libxfs/xfs_ag.c fs/xfs/libxfs/xfs_ialloc_btree.c fs/xfs/libxfs/xfs_shared.h +2 more+15 -50 replies
3/8xfs: distinguish between inobt and finobt magic valuesfs/xfs/libxfs/xfs_ialloc_btree.c fs/xfs/xfs_buf.c fs/xfs/xfs_buf.h+28 -92 replies
4/8xfs: split up allocation btree verifierfs/xfs/libxfs/xfs_ag.c fs/xfs/libxfs/xfs_alloc_btree.c fs/xfs/libxfs/xfs_shared.h +2 more+20 -110 replies
5/8xfs: distinguish between bnobt and cntbt magic valuesfs/xfs/libxfs/xfs_alloc_btree.c+25 -350 replies
6/8xfs: use verifier magic field in dir2 leaf verifiersfs/xfs/libxfs/xfs_dir2_leaf.c fs/xfs/xfs_ondisk.h+30 -683 replies
7/8xfs: miscellaneous verifier magic value fixupsfs/xfs/libxfs/xfs_alloc.c fs/xfs/libxfs/xfs_attr_leaf.c fs/xfs/libxfs/xfs_attr_remote.c +11 more+63 -463 replies
8/8xfs: factor xfs_da3_blkinfo verification into common helperfs/xfs/libxfs/xfs_attr_leaf.c fs/xfs/libxfs/xfs_da_btree.c fs/xfs/libxfs/xfs_da_format.h +1 more+43 -370 replies

Reviews trailers per patch

6 of 8 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchDarrick J. WongBrian Foster
SeriesR-b R-b R-b
1/8R-b
2/8R-b
3/8R-b
4/8R-b
5/8R-b
6/8
7/8
8/8R-b

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

Read the v4 thread

Cover letter [PATCH v4 0/8] xfs: fix [f]inobt magic value verification

Hi all,

This is v4 of the buffer verifier magic value rework. The only changes in this version are that patch 1 of v3 has been dropped as it is already merged and that the magic value asserts that were added to several of the refactored verifiers are replaced with compile-time magic value offset checks starting from the top-level structures used in the associated verifiers.

Brian

v4:
- Dropped set buf ops patch (already merged).
- Replace magic value asserts with build-time magic offset checks.
v3: https://marc.info/?l=linux-xfs&m=154929197225225&w=2
- Fix function declarations to include parameter names.
- Convert allocbt buffer verifier.
v2: https://marc.info/?l=linux-xfs&m=154894958207167&w=2
- Include djwong's ->b_ops patch w/ modifications.
- Added patch to fix up existing cpu endian magic checks, fold in typo fix.
- Replace static inline magic verifier helper with out of line variant, kill macro.
- Store on-disk byte order magics in ->b_ops.
- Added patch to refactor common xfs_da3_blkinfo checks.
v1: https://marc.info/?l=linux-xfs&m=154878684317178&w=2
- Remove endian conversion from helper.
- Drop finobt bad magic mitigation patch.
- Additional verifier magic fixups.
- Add verifier name typo fixup.
rfcv2: https://marc.info/?l=linux-xfs&m=154868884311668&w=2
- Split off finobt verifier into separate patch, assign it appropriately.
- Created helpers for xfs_buf_ops magic value verification.
- Added error mitigation patch for problematic finobt blocks.
rfcv1: https://marc.info/?l=linux-xfs&m=154834528212262&w=2

Brian Foster (8):
xfs: always check magic values in on-disk byte order
xfs: create a separate finobt verifier
xfs: distinguish between inobt and finobt magic values
xfs: split up allocation btree verifier
xfs: distinguish between bnobt and cntbt magic values
xfs: use verifier magic field in dir2 leaf verifiers
xfs: miscellaneous verifier magic value fixups
xfs: factor xfs_da3_blkinfo verification into common helper

 fs/xfs/libxfs/xfs_ag.c             |   6 +-
 fs/xfs/libxfs/xfs_alloc.c          |  12 ++--
 fs/xfs/libxfs/xfs_alloc_btree.c    |  74 ++++++++++-----------
 fs/xfs/libxfs/xfs_attr_leaf.c      |  21 ++----
 fs/xfs/libxfs/xfs_attr_remote.c    |   8 ++-
 fs/xfs/libxfs/xfs_bmap_btree.c     |  13 ++--
 fs/xfs/libxfs/xfs_da_btree.c       |  49 +++++++++-----
 fs/xfs/libxfs/xfs_da_format.h      |   3 +
 fs/xfs/libxfs/xfs_dir2_block.c     |  10 +--
 fs/xfs/libxfs/xfs_dir2_data.c      |  12 ++--
 fs/xfs/libxfs/xfs_dir2_leaf.c      | 100 ++++++-----------------------
 fs/xfs/libxfs/xfs_dir2_node.c      |  10 +--
 fs/xfs/libxfs/xfs_ialloc.c         |   3 +-
 fs/xfs/libxfs/xfs_ialloc_btree.c   |  25 +++++---
 fs/xfs/libxfs/xfs_inode_buf.c      |   2 +-
 fs/xfs/libxfs/xfs_refcount_btree.c |   3 +-
 fs/xfs/libxfs/xfs_rmap_btree.c     |   3 +-
 fs/xfs/libxfs/xfs_sb.c             |   5 +-
 fs/xfs/libxfs/xfs_shared.h         |   4 +-
 fs/xfs/libxfs/xfs_symlink_remote.c |   3 +-
 fs/xfs/scrub/agheader_repair.c     |   6 +-
 fs/xfs/xfs_buf.c                   |  19 ++++++
 fs/xfs/xfs_buf.h                   |   2 +
 fs/xfs/xfs_log_recover.c           |  12 ++--
 fs/xfs/xfs_ondisk.h                |  17 +++++
 25 files changed, 218 insertions(+), 204 deletions(-)
Signature · 1 line
2.17.2