Harden protocol runtime, configuration reloads, and regression testing - #157
Harden protocol runtime, configuration reloads, and regression testing#157anzimber wants to merge 30 commits into
Conversation
This reverts commit 7e6f950.
|
Hi @speters, @hmueller01, and @l3u — could you please take a look at this PR when you have a chance? Thanks! |
|
Hi, thanks a lot for this extensive contribution! I only formatted the code in a decent way and rewrote the build system back then to "rescue" the project. I actually lack the low-level C knowledge to decently review actual code changes. That being said, this PR is too much at once IMHO. 30 commits and 63 changed files … we have documentation changes, corrected typos, CI corrections, and so on. You should really break this up into multiple PRs. E.g. stuff like fixing "deamon" into "daemon" in some init script can easily be approved and merged. As well as the CI stuff can possibly be (although I'm not fit with Github's CI). But all that in combination with codebase changes … one simply can't grasp all at once. I'm pretty sure if you break this up into several smaller logical units that can be grasped more easily, chances would be way, way higher your contribution can actually be reviewed and finally merged. |
Summary
This PR hardens vcontrold's protocol, parser, XML configuration, client, and
resource-lifecycle paths while adding a regression suite that exercises the
daemon, client, simulator, and supported configuration profiles end to end.
The primary goals are:
analysis, CodeQL, and enforced coverage thresholds.
Root causes addressed
Several reusable paths mixed buffer length and capacity, assumed complete
reads/writes, or terminated the process from library code. XML parsing could
also expose partially constructed object graphs on allocation or semantic
failure. Those behaviours made malformed traffic, large command lists,
truncated P300 frames, and repeated reloads unnecessarily risky.
The changes introduce explicit capacities and checked conversions, transactional
configuration loading, consistent error propagation and cleanup, bounded
protocol framing, dynamic client/simulator buffers, and deterministic resource
ownership.
Main changes
Runtime and protocol safety
EINTR, and timeouts through checked I/O;of a reload candidate fails.
Parser, units, XML, and client
unterminated/oversized command-file lines;
nullwith error information;512-byte limit;
device, and enum graphs on failure;
tags by falling back to the abbreviated commit ID.
Build, CI, and documentation
arithmetic, units, XML reloads, allocation failures, semaphore handling,
vclient, vcontrold, and vsim;
-fanalyzer,clang-tidy, cppcheck, Clang Static Analyzer, Valgrind, CodeQL, XML and shell
validation, and a supported-option build matrix;
65% per core module and for the daemon;
boundaries, source installs, and a hardened systemd service;
and alternative/frost addresses clearly separated.
Compatibility and operational notes
compatible.
oversized input now fail explicitly.
nullplus anerror field.
listener beyond a trusted LAN must add their own network controls.
included reversible get-set-get round trips: each initial value was read and
recorded before writing, the changed value was read back, and the original
value was restored and verified. The final rollout smoke test itself remained
read-only.
Existing PRs incorporated or superseded
This branch incorporates the intent of, and extends with regression coverage:
#135directly addresses and fixes #134.Related issue context
The hardening and tests cover failure modes discussed in #30, #53, #66, #70,
#91, #108, #116, #128, #141, #144, and #152. These references are contextual:
device-specific reports still need confirmation on the respective hardware and
are not automatically closed by this PR.
Fixes #134.
Validation
-Wall -Wextra -Wpedantic -Werror;-fanalyzer, clang-tidy, cppcheck, Clang Static Analyzer, Valgrind,CodeQL, ShellCheck, xmllint, and
git diff --check;unit.c: 89.61%;vcontrold.c: 68.57%;(type J3RA), using the KW6B protocol and the Vitola 20C8 device profile:
write test;
Suggested review order
src/io.c,src/framer.c, andsrc/parser.cfor transport boundaries;src/xmlconfig.cfor transactional ownership and rollback;src/unit.c,src/arithmetic.c, andsrc/vclient.cfor conversion/output;