Skip to content

Add coldtrace version header#1

Open
ggeier wants to merge 1 commit intomainfrom
cold_version
Open

Add coldtrace version header#1
ggeier wants to merge 1 commit intomainfrom
cold_version

Conversation

@ggeier
Copy link
Owner

@ggeier ggeier commented Feb 20, 2026

No description provided.

Signed-off-by: Anastasia Basho <anastasia.basho@huawei.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e10ec11b19

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

struct version_header *header =
(struct version_header *)coldtrace_writer_reserve(
(struct coldtrace_writer *)impl, sizeof(struct version_header));
*header = current_version_header;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Check reserve result before writing version header

create_coldtrace_version_header unconditionally dereferences the pointer returned by coldtrace_writer_reserve, but coldtrace_writer_reserve explicitly returns NULL when the backing mapping is MAP_FAILED/NULL (e.g., mmap/open failure paths in get_trace_/new_trace_). With this change, those recoverable allocation errors become an immediate null-deref crash at header write time instead of being propagated to callers.

Useful? React with 👍 / 👎.

{
struct version_header *file_header = coldtrace_version_header(page);

if (!version_header_equal(*file_header)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Skip version validation for empty trace pages

validate_coldtrace_version_header dereferences page as a version_header without checking for an empty/absent buffer. coldtrace_writer_fini always calls coldtrace_writer_close even when no reservation ever happened (impl->buffer == NULL, impl->offset == 0), so this new validation can segfault for threads that produced no events (and in write-disabled flows where no header is written). Add a null/size guard before reading the header.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants