Bug Report
On current main (4188e3ae), TransferEngineImpl::registerLocalMemoryBatch() accepts overlapping entries within the same batch and also accepts zero-length entries.
checkOverlap() only checks local_memory_regions_, while the new entries are inserted after the entire validation loop. As a result, entries in the incoming batch are never checked against each other. The batch API also lacks the zero-length check performed by registerLocalMemory().
Reproduction
std::array<char, 256> buffer{};
std::vector<BufferEntry> overlapping = {
{buffer.data(), 128},
{buffer.data() + 64, 128},
};
EXPECT_EQ(engine.registerLocalMemoryBatch(overlapping, "cpu:0"),
ERR_ADDRESS_OVERLAPPED);
std::vector<BufferEntry> zero_length = {
{buffer.data(), 0},
};
EXPECT_EQ(engine.registerLocalMemoryBatch(zero_length, "cpu:0"),
ERR_INVALID_ARGUMENT);
Both calls currently return 0.
Expected behavior
Validate the complete batch before invoking any transport:
- Return
ERR_ADDRESS_OVERLAPPED when entries overlap each other or an existing registration.
- Return
ERR_INVALID_ARGUMENT for a zero-length entry, consistent with registerLocalMemory().
- Continue allowing adjacent, non-overlapping entries.
I searched open issues and PRs for registerLocalMemoryBatch overlap/zero-length handling and did not find an existing report or fix.
Bug Report
On current
main(4188e3ae),TransferEngineImpl::registerLocalMemoryBatch()accepts overlapping entries within the same batch and also accepts zero-length entries.checkOverlap()only checkslocal_memory_regions_, while the new entries are inserted after the entire validation loop. As a result, entries in the incoming batch are never checked against each other. The batch API also lacks the zero-length check performed byregisterLocalMemory().Reproduction
Both calls currently return
0.Expected behavior
Validate the complete batch before invoking any transport:
ERR_ADDRESS_OVERLAPPEDwhen entries overlap each other or an existing registration.ERR_INVALID_ARGUMENTfor a zero-length entry, consistent withregisterLocalMemory().I searched open issues and PRs for
registerLocalMemoryBatchoverlap/zero-length handling and did not find an existing report or fix.