wmbus: fix format-A length formula for L=10 (mod 16); host tests under ASan

This commit is contained in:
Lars Nolden
2026-09-01 11:28:14 +02:00
parent c835c62172
commit 6bdcb2acad
6 changed files with 302 additions and 3 deletions
+17
View File
@@ -124,6 +124,23 @@
every heartbeat (`config_intact`), and recovery levels only report success
when both the mode and the configuration verify.
## CONFIRMED (frame layer, host tests)
- `firmware/test/run_tests.sh` validates the frame layer against real
captured meter frames under AddressSanitizer: CRCs of third-party frames
verify, every single-bit flip in them is detected, the builder's own
frames validate for all buildable L, and 200k adversarial length/buffer
combinations produce no out-of-bounds access.
- The tests found a real internal inconsistency: the format-A length formula
copied from rtl-wmbus disagrees with the greedy 16-byte block walk used
for CRC validation whenever L = 10 (mod 16). Fixed to
`1 + L + 2*(1 + ceil((L-9)/16))`, which matches wmbusmeters' trimming.
Both forms agree on every valid length observed here, and no valid
L = 10 (mod 16) frame was ever captured -- the 10 candidates in the logs
all fail their length-independent block-1 CRC, i.e. they are corrupted
receptions. So this is a latent-correctness fix, not a measured
improvement (docs/OPEN_QUESTIONS.md).
## NEEDS TESTING
- Narrower RX bandwidth (156 kHz) vs current 234.3 kHz on weak meters.