Skip to content

Fix DAQ configuration validation and event linking - #127

Closed
pamirmundt wants to merge 1 commit into
vectorgrp:masterfrom
pamirmundt:fix/daq-configuration-memory-safety
Closed

pamirmundt wants to merge 1 commit into
vectorgrp:masterfrom
pamirmundt:fix/daq-configuration-memory-safety

Conversation

@pamirmundt

Copy link
Copy Markdown
Contributor

Summary

Fix DAQ configuration commands that could partially modify internal state after returning an error, and make DAQ event-list linking safe and repeatable.

Changes

  • Validate proposed DAQ, ODT, and ODT-entry counts before updating configuration state.
  • Preserve ODT sizes and entry metadata when WRITE_DAQ validation fails.
  • Validate fixed event identifiers when no dynamic event list is available.
  • Prevent invalid event-list traversal, duplicate links, and cycles when associating DAQ lists with events.
  • Add focused regression tests covering allocation rollback, ODT-size rollback, and multiple DAQ lists sharing an event.
  • Document the new daq_config_test target.

Why

A rejected DAQ configuration command could previously leave counters or metadata partially updated. This made a valid retry fail or operate on inconsistent state.

Repeatedly associating a DAQ list with an event could also create an invalid linked list or cycle.

Validation

  • GCC build and regression test passed.
  • Clang build and regression test passed.
  • AddressSanitizer and UndefinedBehaviorSanitizer passed.
  • All default test targets build successfully.
  • Existing test targets retain their original compile configuration.

@RainerZ

RainerZ commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Hi Pamir,

thank you for finding these issues and providing the regression tests.
They exposed problems in DAQ table allocation handling and a severe bug when multiple DAQ list are associated to the same event.

After reviewing the cases against XCP 1.4, I’ve decided to address them in a separate implementation rather than merge this PR as submitted. In particular, XCP specification §4.1.6 defines that an allocation memory overflow invalidates the complete DAQ configuration, so my implementation clears it instead of preserving it for an immediate smaller retry.

Building on your tests, I added more AI generated test coverage for

  • rewriting entries
  • stale write cursors
  • errors during WRITE_DAQ_MULTIPLE
  • starting incomplete configurations without prepare

I also kept your event id bounds check for configurations without dynamic event registration.

The changes will be released in V2.2.2

Thanks again for the contribution.

@RainerZ RainerZ closed this Sep 14, 2026
@pamirmundt

Copy link
Copy Markdown
Contributor Author

Hi Pamir,

thank you for finding these issues and providing the regression tests. They exposed problems in DAQ table allocation handling and a severe bug when multiple DAQ list are associated to the same event.

After reviewing the cases against XCP 1.4, I’ve decided to address them in a separate implementation rather than merge this PR as submitted. In particular, XCP specification §4.1.6 defines that an allocation memory overflow invalidates the complete DAQ configuration, so my implementation clears it instead of preserving it for an immediate smaller retry.

Building on your tests, I added more AI generated test coverage for

  • rewriting entries
  • stale write cursors
  • errors during WRITE_DAQ_MULTIPLE
  • starting incomplete configurations without prepare

I also kept your event id bounds check for configurations without dynamic event registration.

The changes will be released in V2.2.2

Thanks again for the contribution.

Thanks for reviewing this and taking care of the fixes. Glad the tests helped!

@pamirmundt
pamirmundt deleted the fix/daq-configuration-memory-safety branch September 14, 2026 11:23
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