mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #4380] [Bug][TENT] C notification results are unterminated at their field limits #1100
Labels
No labels
ascend
auto-closed
bug
bug
CI/Build
Common
documentation
enhancement
feature request
good first issue
help wanted
high priority
MetaX
nightly-failure
pull-request
PyTorch Backend
question
RFC
Roadmap
stale
Store
Tests
Transfer Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/Mooncake#1100
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @feichai0017 on GitHub (Sep 29, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/4380
Bug report
On current
main(1ad008bc41c6de7c74e02fb1d48713309b880c0d),tent_recv_notifs()can return unterminated C strings when the notification name has at least 255 bytes or the message has at least 4095 bytes.The result contains
name[256]andmsg[4096]. The implementation copies at most 255/4095 bytes usingstrncpy, but does not initialize the final byte. At the exact truncation limit,strncpydoes not add a terminator. C callers usingstrlen,%s, orstd::string(record.msg)can therefore read beyond the field (and beyond the allocation for the last message).Source: C notification receive implementation at the tested commit.
Reproduction and expected behavior
CPU-only Linux x86_64, glibc, Clang 20,
USE_TENT=ON,USE_CUDA=OFF. No RDMA NIC is needed: a self-targeted notification reaches the same C receive wrapper.LOCAL_SEGMENT_ID, usingstd::string(255, 'n')andstd::string(4095, 'm')for its name and message.tent_recv_notifs().records[0].name[255]andrecords[0].msg[4095].MALLOC_PERTURB_=165so untouched heap bytes are nonzero.Expected: both bytes are
NUL. Actual: both are0x5a. The same failure occurs for over-limit input lengths 256/4096; empty and shorter fields pass.A regression added to
local_notification_testfails on the unmodified production code and passes after explicitly terminating the two fields. The proposed fix preserves the existing struct layout and truncation limits.Related work checked
tent_free_notifs, not string termination.I searched open and closed notification, C API,
strncpy, and unterminated-string issues/PRs; I did not find a matching termination fix. A focused fix and regression test follow separately.Prepared with Codex assistance; reproduction and the complete local notification test suite were executed.
@github-actions[bot] commented on GitHub (Sep 29, 2026):
Thanks for opening this issue, @feichai0017!
132118805A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide