core: harden trace lifecycle and serialization#88
Merged
Conversation
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
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
Root causes and impact
Several fields in the CTraces model were not serialized, causing trace metadata to change after buffering or forwarding. This included protocol flags used by sampling and remote-context handling.
Ownership operations could retain freed pointers during self-assignment or attach a span to two different trace contexts. MessagePack decoding also accepted offsets and numeric values that could wrap, used unbounded recursive attribute decoding, and allowed duplicate fields to overwrite earlier allocations.
The OTLP encoder built nested protobuf objects using best-effort
voidhelpers. Allocation or conversion failures could leave nonzero element counts paired with null arrays, leak previously constructed objects, or pass incomplete payloads to protobuf-c. Construction now fails transactionally and unwinds all completed children.Fluent Bit compatibility
Validation
ASAN_OPTIONS=detect_leaks=1 ctest --test-dir build --output-on-failure— 4/4 suites passedctraces-simple-c-apirelease example — passedgit diff master...HEAD --check— passedNew tests cover direct and manual-unlink destruction, self-assignment, cross-context rejection, flags and dropped-count round trips, long keys, uint/null/byte values, excessive nesting, duplicate fields, invalid offsets/ranges/enums, opaque references, empty contexts, zero-length bytes, and incomplete nested payload rejection.