Add m68k-specific padding to OBJECT related data structures to make it work#566
Merged
stefanberger merged 3 commits intomasterfrom Mar 6, 2026
Merged
Conversation
Before adding padding to the data structures, add asserts for offsets and sizes of data structures so that none of these will change due to padding. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
On m68k int's only need to be 2-byte aligned and therefore the size of some data structures or offsets of fields within data structures is not as expected. Fix this by adding artificial m68k-specific padding where necessary. If padding was added on any other architecture, it would not make a difference there. Similarly, if some day m68k gcc was to align int's as expected, the artifical padding would not have any influence on the expected sizes and offsets and could be removed. With the padding applied, swtpm should now be able to read state written by other architectures. This is for example the case with swtpm test cases. Link: https://wiki.debian.org/M68k/Alignment Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
fd99669 to
578a752
Compare
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
578a752 to
32dd082
Compare
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.
Add m68k-specific padding to OBJECT-related data structures to make libtpms work on Linux m68k. Also NV_INDEX needs to be padded since this structure is still being memcpy'ed into NVRAM and should therefore consume the same amount of space on all archs.
There are only 3 lines of changes in TpmTypes.h, so it's not too intrusive. It may also be helpful to fix other data structures to expected sizes, and fields within data structures to expected offset when it comes to BackwardsCompatibilityObject.c, which should not need to be touch anymore.