tag name | fix-log-recovery-misuse-6.1_2022-10-27 (d272a1307494863c9937f979046db58ac8f5a72d) |
tag date | 2022-10-27 10:10:14 -0700 |
tagged by | Darrick J. Wong <djwong@kernel.org> |
tagged object | commit 7941eb1e35... |
xfs: fix various problems with log intent item recovery
Starting with 6.1-rc1, CONFIG_FORTIFY_SOURCE checks became smart enough
to detect memcpy() callers that copy beyond what seems to be the end of
a struct. Unfortunately, gcc has a bug wherein it cannot reliably
compute the size of a struct containing another struct containing a flex
array at the end. This is the case with the xfs log item format
structures, which means that -rc1 starts complaining all over the place.
Fix these problems by memcpying the struct head and the flex arrays
separately. Although it's tempting to use the FLEX_ARRAY macros, the
structs involved are part of the ondisk log format. Some day we're
going to want to make the ondisk log contents endian-safe, which means
that we will have to stop using memcpy entirely.
While we're at it, fix some deficiencies in the validation of recovered
log intent items -- if the size of the recovery buffer is not even large
enough to cover the flex array record count in the head, we should abort
the recovery of that item immediately.
The last patch of this series changes the EFI/EFD sizeof functions names
and behaviors to be consistent with the similarly named sizeof helpers
for other log intent items.
v2: fix more inadequate log intent done recovery validation and dump
corrupt recovered items
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEUzaAxoMeQq6m2jMV+H93GTRKtOsFAmNau3YACgkQ+H93GTRK
tOvCYRAAmKxDzaYxxAT7A8Bqs+Sc7xmNU+1PwogWdRI24mHXRMLdj333sg4tmMql
6uAA/uYvfwNqmq42zeiMErJ29E7axpaYO5ed7wFIRARpj2ps25S2Z5YTgucn5xim
C7gmKyGhlB4RBF7XikhxBZUL5wXLflG4NIcs+D/nXEBfT+OSVIT9ZWe4hIXEYTxz
y4cRbA2wbiYy1tjoXlhjo/UnZAQcPhgvpTYPMIe1crMts3jAH/PRKE09x7KD79ts
JAd688nAUkWD7jABv5frnXd/D4AXYF+6OmGs2e0h79ksZfVpMVHVXIqscdEisznt
6teGKPnmBuhxlSJLPNo7fr0zDoazzMgitDXys6qSjiHAKpva9nZht6MIyajA/KmC
7mce1gTmFhQKSIwR/xpoQx0OW5ehOfD+PMyLFVixfENEBDtfW4XgBMuR3jhL2al+
Uzk0LYJvqzfz0zYr1/hNG/PeppyGqTjAkngwZyTKvPj6o27qMyoUfCPq9aQ2y/+8
Ji0KfcC+YufUOnf46aOXLV2IUnpUQhURbgMVLdKS87YWFDSuuAb4RX+DC/TOjlQ+
h7gl3hdzDTrjjGoixzKo5kyy9GrkYGIturLOPwhJwdg0terVGhfYo/weo8c7r7w+
Uqj9KW3wHpof4V40VCTSwfT0GWCFjRgRxuUIH2FKjppxDAjN4fQ=
=vCsV
-----END PGP SIGNATURE-----