Repository navigation
erasure-code/jerasure: do not free a system libJerasure's fields - #73726
Merged
ljflores merged 1 commit intoNov 25, 2026
Merged
Conversation
With WITH_SYSTEM_JERASURE=ON, which debian/rules sets, the jerasure and shec plugins (and their legacy flavors) link the same shared libJerasure, so they share galois.c's table of default fields. Each plugin's jerasure_finish() destructor frees those fields at exit without clearing the table, so the second plugin frees them again. In a monitor that has loaded both plugins this corrupts the heap, and tcmalloc segfaults under gf_free() during shutdown. Only free the fields when the vendored jerasure is linked into the plugin, where each plugin owns its own copy. Fixes: https://tracker.ceph.com/issues/82975 Signed-off-by: Abraham Pérez <[email protected]>
|
Thank you for your contribution. Since you are not yet a member of the Ceph organization with write permissions on ceph/ceph.git, our CI will not automatically run. Any member of the Ceph organization may label this PR |
Contributor
|
This PR has been added to wip-bharath11-testing-20261114.052454-main. |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
debian/rulesbuilds withWITH_SYSTEM_JERASURE=ON, so the jerasure and shec plugins (and their legacy flavors) link the same sharedlibJerasure. They sharegalois.c's table of default Galois fields. Each plugin'sjerasure_finish()destructor frees those fields at exit but does not clear the table, so the second plugin frees them again. A monitor that has loaded both plugins corrupts its heap during shutdown, and tcmalloc segfaults undergf_free(), as in the tracker.This change frees the fields only when the vendored jerasure is linked into the plugin, where each plugin owns its own copy. With the system library, the fields are left to the library.
Fixes: https://tracker.ceph.com/issues/82975
How this was verified
dlopen()slibec_jerasure.soandlibec_shec.so, callsjerasure_init()in each and exits. With both plugins linked against the systemlibJerasure/libgf_complete(as in the Ubuntu packages), glibc aborts withfree(): double free detected in tcache 2, and valgrind reports invalid reads/frees injerasure_finish(). With this change: exit 0, valgrindERROR SUMMARY: 0 errors.-DWITH_SYSTEM_JERASURE=ONpasses-DWITH_SYSTEM_JERASUREtojerasure_init.cc.unittest_erasure_code*(plugin, jerasure, shec, lrc; 12 tests) pass.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
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist