zfs_log: add flex array fields to log record structs #16539
Merged
+162
−131
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.
Motivation and Context
Silence Linux warnings since ~6.11.
Closes #16501.
Description
ZIL log record structs (
lr_XX_t
) are frequently allocated with extra space after the struct to carry variable-sized "payload" items.Linux 6.10+ compiled with
CONFIG_FORTIFY_SOURCE
has been doing runtime bounds checking onmemcpy()
calls. Because these types had no indicator that they might use more space than their simple definition,__fortify_memcpy_chk
will frequently complain about overruns eg:To fix this, this commit adds flex array fields to all
lr_XX_t
structs that require them, and then uses those fields to access that end-of-struct area rather than more complicated casts and pointer addition.I'll note here that I wrote this a few weeks ago and kind of forgot about it. I remember I didn't love it; it felt messy in a couple of places. But, it passes tests, and 6.11 is here and 2.3 is looming, so its probably better to post this sooner rather than later.
How Has This Been Tested?
Full ZTS run completed against 6.11.0.
Types of changes
Checklist:
Signed-off-by
.