[gen3] hal: zero out invalid user modules #2374
Merged
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.
Problem
Devices may present invalid user modules in system describe which can appear as some other type of module with potentially a set of invalid dependencies which cannot be satisfied preventing OTA from working correctly.
This happens because we ignore integrity or any other checks when making a decision on whether to include read-out module data in system describe. This is more problematic with Gen 3 devices running 3.1.0+ with 256KB applications as the compat (128KB) module header location would be in the middle of the larger binary. If by chance bytes at that location contain something seemingly valid (e.g. correct module type), this erroneous module would be reported in the describe message. If there is additionally a seemingly valid dependency, this is going to prevent product updates from happening, as DS will not be able to satisfy it.
Solution
Zero out module data if we've fetched an invalid module from
module_user
ormodule_user_compat
locations.Steps to Test
wiring/gen3_invalid_compat_user_app
References
N/A
Completeness