cuda.core: reject register() on a non-IPC memory resource - #2569
Open
fedonman wants to merge 1 commit into
Open
Conversation
MP_register read self._ipc_data._alloc_handle._uuid unconditionally. _ipc_data is None whenever IPC is not enabled, and Cython compiles the chained access without a none check, so the call terminated the process with a segmentation fault instead of raising. No exception reached the caller, so the crash could not be guarded with try. Check is_ipc_enabled first and raise RuntimeError, matching the wording the allocation_handle property already uses. The check runs before the registry insertion, so a rejected registration no longer leaves an entry behind. Closes NVIDIA#2568 Signed-off-by: Vyron Vasileiadis <hi@fedonman.com>
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.
Summary
Closes #2568.
DeviceMemoryResource.register()andPinnedMemoryResource.register()terminated the process with a segmentation fault when the memory resource did not have IPC enabled, including the default resource fromDevice().memory_resource. Both route throughMP_register, which readself._ipc_dataunconditionally although it isNoneunless IPC is enabled.Changes
_ipc.pyx: checkis_ipc_enabledinMP_registerand raiseRuntimeError("Memory resource is not IPC-enabled"), the wording theallocation_handleproperty already uses. The check runs before the registry insertion, so a rejected registration no longer leaves an entry behind.tests/memory_ipc/test_errors.py: regression test covering the raise and the registry.docs/source/release/1.2.0-notes.rst: release note. The defect is present in released 1.0.1, 1.1.0 and 1.1.1, so this is user-visible rather than confined to the current cycle.Verification
Without the production change the new test does not merely fail, it takes the interpreter down (
exit=139, SIGSEGV). With the change:No regressions in the surrounding suites: