Backport a coupld of NVRAM marshalling/unmarshalling related patches#572
Merged
stefanberger merged 3 commits intostable-0.10from Mar 11, 2026
Merged
Backport a coupld of NVRAM marshalling/unmarshalling related patches#572stefanberger merged 3 commits intostable-0.10from
stefanberger merged 3 commits intostable-0.10from
Conversation
Use the marshalled size of an OBJECT to check whether it still fits into NVRAM rather than using the size of the OBJECT (sizeof(obj), which is much bigger. Using the marshalled size also handles the case where the OBJECT is still copied into NVRAM using memcpy for the NULL profile case of libtpms v0.9. This should have been converted once NvObjectToBuffer() was started to be called there. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Base the enabledCommands array on the command index rather than the command code since the latter left the first few bytes always unused since command codes start at 0x11f only. After this change, ppList, auditCommands, and enabledCommandsByIdx bitmaps are all based on command indices. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Only write the necessary number of bytes of the ppList and auditCommands bitmaps. The entries in both of these bitmaps are set by a command's index and the necessary number of bytes can be determined by finding the command with the highest command code that is enabled in the current profile (1). This in turn can be found by by searching for the last byte in the enableCommandsByIdx bitmap that has any bit set. 1) It would be possible to skip writing these arrays entirely if they have no bits set. The unmarshalling functions would clear the arrays. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR resolves a few issues with unmarshalling of NVRAM