Skip to content

tools/cephfs_mirror: fix UAF in blockdiff metrics accounting - #71710

Merged
kotreshhr merged 1 commit into
ceph:mainfrom
kotreshhr:mirror-fix-uaf
Sep 23, 2026
Merged

kotreshhr merged 1 commit into
ceph:mainfrom
kotreshhr:mirror-fix-uaf

Conversation

@kotreshhr

@kotreshhr kotreshhr commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

SnapDiffSync::get_changed_blocks() freed the blockdiff buffer before
iterating bd_cblock to accumulate bd_synced_bytes. That left a dangling
pointer into memory freed by ceph_free_file_blockdiff_buffer().
Valgrind memcheck reported an InvalidRead in this path when syncing a
file with changed blocks.

Free the buffer only after the metrics loop completes, and free it on
callback error before breaking out of the loop.

Fixes: https://tracker.ceph.com/issues/80463

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

SnapDiffSync::get_changed_blocks() freed the blockdiff buffer before
iterating bd_cblock to accumulate bd_synced_bytes. That left a dangling
pointer into memory freed by ceph_free_file_blockdiff_buffer().
Valgrind memcheck reported an InvalidRead in this path when syncing a
file with changed blocks.

Free the buffer only after the metrics loop completes, and free it on
callback error before breaking out of the loop.

Fixes: https://tracker.ceph.com/issues/80463
Signed-off-by: Kotresh HR <[email protected]>
@github-actions github-actions Bot added the cephfs Ceph File System label Sep 11, 2026
@kotreshhr
kotreshhr requested review from a team, dparmar18, karthik-us1 and vshankar and removed request for karthik-us1 September 11, 2026 05:10
@kotreshhr

Copy link
Copy Markdown
Contributor Author

This PR has been added to main integration testing by khiremat started 2026-09-09-16:42.

@karthik-us1 karthik-us1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@vshankar

Copy link
Copy Markdown
Contributor

This PR has been added to main integration testing by vshankar started 2026-09-02-01:48.

@kotreshhr

Copy link
Copy Markdown
Contributor Author

@kotreshhr

Copy link
Copy Markdown
Contributor Author

@vshankar

Copy link
Copy Markdown
Contributor

This PR has been added to main integration testing by vshankar started 2026-09-02-01:48.

@vshankar This is already part of QA run - https://tracker.ceph.com/issues/80435

nvm. it wasn't labeled with a test label, so I added it to my branch.

@kotreshhr
kotreshhr merged commit 227695d into ceph:main Sep 23, 2026
21 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cephfs Ceph File System

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants