Bug #80463
closedcephfs_mirror: Mirror daemon crashes in valgrind test suite - UAF
0%
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.
KH Updated by Kotresh Hiremath Ravishankar 3 months ago
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
- Status changed from New to Fix Under Review
- Pull request ID set to 71710
UB Updated by Upkeep Bot 2 months ago
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¶
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
- Status changed from Fix Under Review to Pending Backport
KH Updated by Kotresh Hiremath Ravishankar 2 months ago
- Backport changed from umbrella, tentacle, squide to umbrella, tentacle, squid
UB Updated by Upkeep Bot 2 months ago
- Copied to Backport #80843: tentacle: cephfs_mirror: Mirror daemon crashes in valgrind test suite - UAF added
UB Updated by Upkeep Bot 2 months ago
- Copied to Backport #80844: umbrella: cephfs_mirror: Mirror daemon crashes in valgrind test suite - UAF added
UB Updated by Upkeep Bot 2 months ago
- Copied to Backport #80845: squid: cephfs_mirror: Mirror daemon crashes in valgrind test suite - UAF added
UB Updated by Upkeep Bot 2 months ago
- 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