openzfs: Account for padding in itx_t for purecap #2100
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.
The current struct layout for purecap means there is 8 bytes of padding
at the end of itx_t after the lr_t itx_lr member, and so if olrsize is
exactly sizeof(lr_t) we underallocate by this amount, risking bounds
faults but also the assertions in zil_itx_clone and zil_itx_destroy that
itx_size is at least sizeof(itx_t). Thus, round up lrsize to ensure it
at least covers any padding. It may also be valid to leave lrsize, i.e.
itx_lr.lrc_reclen, as the unpadded value but pad itx_size, however more
assertions would need to be changed for that and it's unclear if any of
the code actually relies on the correspondence between them. Since the
code already rounds up the requested size to a multiple of 8 it's likely
safer to just round it up some more.