Skip to content

pybind/rbd: handle non-existent groups properly in list_snaps() - #70039

Merged
idryomov merged 1 commit into
ceph:mainfrom
VinayBhaskar-V:wip-group-snap-list
Jul 15, 2026
Merged

idryomov merged 1 commit into
ceph:mainfrom
VinayBhaskar-V:wip-group-snap-list

Conversation

@VinayBhaskar-V

@VinayBhaskar-V VinayBhaskar-V commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Calling list_snaps() on a non-existent group crashed the entire Python process with a free(): invalid pointer error. This happened because an unexpected -ENOENT error returned by rbd_group_snap_list2 and the exception was raised without updating the num_group_snaps to 0 from 10. Later the Cython __dealloc__ wrapper attempted to free garbage of uninitialized pointer spaces resulting in a crash.

Fix this behavior by resetting self.num_group_snaps to 0 inside GroupSnapIterator before raising exception to prevent memory corruption and accessing uninitialized pointers during cleanup call

Now list_snaps() consistently raise an ObjectNotFound error when invoked on a non-existent group.
Also Extended the TestGroups test fixture with self.dne_group to validate the expected error path for list_snaps().

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

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.

Comment thread src/librbd/api/Group.cc Resolved
Comment thread src/librbd/librbd.cc Resolved
@VinayBhaskar-V VinayBhaskar-V changed the title librbd: handle non-existent groups properly in python APIs librbd: handle non-existent groups properly in list_snaps() Jul 9, 2026
@idryomov idryomov changed the title librbd: handle non-existent groups properly in list_snaps() pybind/rbd: handle non-existent groups properly in list_snaps() Jul 9, 2026
Calling `list_snaps()` on a non-existent group crashed the entire
Python process with a `free(): invalid pointer` error. This happened
because an unexpected `-ENOENT` error returned by `rbd_group_snap_list2`
and the exception was raised without updating the num_group_snaps to 0
from 10. Later the Cython `__dealloc__` wrapper attempted to free garbage
of uninitialized pointer spaces resulting in a crash.

Fix this behavior by resetting `self.num_group_snaps` to 0 inside
`GroupSnapIterator` before raising exception to prevent memory
corruption and accessing uninitialized pointers during cleanup call

Now `list_snaps()` consistently raise an `ObjectNotFound` error when
invoked on a non-existent group.
Also Extended the `TestGroups` test fixture with `self.dne_group` to
validate the expected error path for `list_snaps()`.

Fixes: https://tracker.ceph.com/issues/78034
Signed-off-by: VinayBhaskar-V <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants