Project

General

Profile

Actions

Bug #80463

closed
KH KH

cephfs_mirror: Mirror daemon crashes in valgrind test suite - UAF

Bug #80463: cephfs_mirror: Mirror daemon crashes in valgrind test suite - UAF

Added by Kotresh Hiremath Ravishankar 3 months ago. Updated 2 months ago.

Status:
Backporting
Priority:
Normal
Category:
Correctness/Safety
Target version:
Due date:
% Done:

0%

Source:
Q/A
Backport:
umbrella, tentacle, squid
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(FS):
cephfs-mirror
Labels (FS):
Pull request ID:
Tags (freeform):
Fixed In:
v21.3.0-3543-g227695dff2
Released In:
Upkeep Timestamp:
2026-09-24T12:27:13+00:00

Description

The mirror daemon crashes while validating the QA Run https://tracker.ceph.com/issues/80435
in valgrind setup.

valgrind wasn't tracking mirror daemon as mirror daemon was child
https://pulpito-ng.ceph.com/runs/khiremat-2026-09-10_08:45:14-fs-wip-khiremat-testing-20260909.164143-distro-default-trial/jobs/547692
https://pulpito-ng.ceph.com/runs/khiremat-2026-09-10_08:45:14-fs-wip-khiremat-testing-20260909.164143-distro-default-trial/jobs/547693
https://pulpito-ng.ceph.com/runs/khiremat-2026-09-10_08:45:14-fs-wip-khiremat-testing-20260909.164143-distro-default-trial/jobs/547694

Included the fix https://github.com/ceph/ceph/pull/70716 for valgrind to track mirror daemon (foreground option)
https://pulpito-ng.ceph.com/runs/khiremat-2026-09-11_02:10:33-fs-wip-khiremat-testing-20260909.225017-distro-default-trial/jobs/550661
https://pulpito-ng.ceph.com/runs/khiremat-2026-09-11_02:10:33-fs-wip-khiremat-testing-20260909.225017-distro-default-trial/jobs/550662
https://pulpito-ng.ceph.com/runs/khiremat-2026-09-11_02:10:33-fs-wip-khiremat-testing-20260909.225017-distro-default-trial/jobs/550663

The test that's failing is 'test_cephfs_mirror_blockdiff_pure_truncate' which is added by https://github.com/ceph/ceph/pull/70923

But investigating the logs with valgrind, it's found out that there is pre-existing UAF bug.


Related issues 3 (3 open — 0 closed)

Copied to CephFS - Backport #80843: tentacle: cephfs_mirror: Mirror daemon crashes in valgrind test suite - UAFNewKotresh Hiremath Ravishankar

Actions
Copied to CephFS - Backport #80844: umbrella: cephfs_mirror: Mirror daemon crashes in valgrind test suite - UAFIn ProgressKotresh Hiremath Ravishankar

Actions
Copied to CephFS - Backport #80845: squid: cephfs_mirror: Mirror daemon crashes in valgrind test suite - UAFNewKotresh Hiremath Ravishankar

Actions

KH Updated by Kotresh Hiremath Ravishankar 3 months ago Actions #1

Analysis:

Valgrind reports:

Invalid read of size 8
  in SnapDiffSync::get_changed_blocks()

Address is 8 bytes inside a block of size 16 freed
  by ceph_free_file_blockdiff_buffer()
  in SnapDiffSync::get_changed_blocks()

The bug is in this existing loop in PeerReplayer.cc:

if (blocks.num_blocks) {
  auto bd_num_blocks = blocks.num_blocks;
  auto bd_cblock = blocks.b;
  r = callback(blocks.num_blocks, blocks.b);
  ceph_free_file_blockdiff_buffer(&blocks);   // frees blocks.b
  if (r < 0) {
    ...
  }
  while(bd_num_blocks > 0) {
    bd_synced_bytes += bd_cblock->len;        // USE-AFTER-FREE
    --bd_num_blocks;
    bd_cblock++;
  }
}

bd_cblock still points at blocks.b after ceph_free_file_blockdiff_buffer() frees it. Reading bd_cblock->len is a classic use-after-free.

KH Updated by Kotresh Hiremath Ravishankar 3 months ago Actions #2

  • Status changed from New to Fix Under Review
  • Pull request ID set to 71710

UB Updated by Upkeep Bot 2 months ago Actions #3

Redmine Upkeep failure

The redmine-upkeep.py script failed to update this issue. I have added the flag "upkeep-failed" to avoid looking at this issue again.

Please manually fix the issue and remove "upkeep-failed" flag to allow future upkeep operations.

Transformation

The script was in the create_backports transformation.

Update Log

https://github.com/ceph/ceph/actions/runs/35817995628

Error

Redmine Update failed:

Traceback (most recent call last):
  File "/home/runner/work/ceph/ceph/ceph/src/script/redmine-upkeep.py", line 1162, in _transform_create_backports
    other = self.R.issue.create(**create_args)
  File "/opt/hostedtoolcache/Python/3.9.25/x64/lib/python3.9/site-packages/redminelib/managers/base.py", line 187, in create
    response = self.redmine.engine.request(self.resource_class.http_method_create, url, data=request)
  File "/opt/hostedtoolcache/Python/3.9.25/x64/lib/python3.9/site-packages/redminelib/engines/base.py", line 83, in request
    return self.process_response(self.session.request(method, url, **kwargs))
  File "/opt/hostedtoolcache/Python/3.9.25/x64/lib/python3.9/site-packages/redminelib/engines/base.py", line 178, in process_response
    raise exceptions.ValidationError(', '.join(': '.join(e) if isinstance(e, list) else e for e in errors))
redminelib.exceptions.ValidationError: Ceph release is not included in the list

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/work/ceph/ceph/ceph/src/script/redmine-upkeep.py", line 1168, in _transform_create_backports
    other = self.R.issue.create(**create_args)
  File "/opt/hostedtoolcache/Python/3.9.25/x64/lib/python3.9/site-packages/redminelib/managers/base.py", line 187, in create
    response = self.redmine.engine.request(self.resource_class.http_method_create, url, data=request)
  File "/opt/hostedtoolcache/Python/3.9.25/x64/lib/python3.9/site-packages/redminelib/engines/base.py", line 83, in request
    return self.process_response(self.session.request(method, url, **kwargs))
  File "/opt/hostedtoolcache/Python/3.9.25/x64/lib/python3.9/site-packages/redminelib/engines/base.py", line 178, in process_response
    raise exceptions.ValidationError(', '.join(': '.join(e) if isinstance(e, list) else e for e in errors))
redminelib.exceptions.ValidationError: Ceph release is not included in the list

Update Payload

{
    "issue": {
        "custom_fields": [
            {
                "id": 33,
                "value": "227695dff217c38411cb31850e92aeb3a2fa9cce" 
            },
            {
                "id": 34,
                "value": "v21.3.0-3543-g227695dff2" 
            },
            {
                "id": 37,
                "value": "2026-09-23T04:23:11+00:00" 
            }
        ],
        "status_id": 14
    },
    "suppress_mail": "1" 
}

KH Updated by Kotresh Hiremath Ravishankar 2 months ago Actions #5

  • Status changed from Fix Under Review to Pending Backport

KH Updated by Kotresh Hiremath Ravishankar 2 months ago Actions #6

  • Backport changed from umbrella, tentacle, squide to umbrella, tentacle, squid

UB Updated by Upkeep Bot 2 months ago Actions #7

  • Copied to Backport #80843: tentacle: cephfs_mirror: Mirror daemon crashes in valgrind test suite - UAF added

UB Updated by Upkeep Bot 2 months ago Actions #8

  • Copied to Backport #80844: umbrella: cephfs_mirror: Mirror daemon crashes in valgrind test suite - UAF added

UB Updated by Upkeep Bot 2 months ago Actions #9

  • Copied to Backport #80845: squid: cephfs_mirror: Mirror daemon crashes in valgrind test suite - UAF added

UB Updated by Upkeep Bot 2 months ago Actions #10

  • Status changed from Pending Backport to Backporting
  • Merge Commit set to 227695dff217c38411cb31850e92aeb3a2fa9cce
  • Fixed In set to v21.3.0-3543-g227695dff2
  • Upkeep Timestamp set to 2026-09-24T12:27:13+00:00
Actions

Also available in: PDF Atom