An rmapbt node stores each key as a low/high pair of packed 20-byte struct xfs_rmap_key, so every high key is only 4-byte aligned. union xfs_btree_key is 8-byte aligned, which lets the compiler read rm_offset through it with an 8-byte load. On sparc64 every high key checked by xchk_rmapbt_check_unwritten_in_keyflags() then takes an unaligned access trap: Kernel unaligned access at TPC[105a54d8] xchk_rmapbt_check_unwritten_in_keyflags+0xb8/0x160 [xfs] Use get_unaligned() for the high key. Fixes: 38384569a2a8 ("xfs: detect unwritten bit set in rmapbt node block keys") Reported-by: Jan Engelhardt Closes: https://github.com/sparclinux/issues/issues/115 Cc: stable@vger.kernel.org # v6.4+ Signed-off-by: Stian Halseth --- Tested on sparc64 (T4, 7.3.3) by scrubbing the rmapbt of a loop-mounted image: alignment faults per scrub went from about 4000 to 0. fs/xfs/scrub/rmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/scrub/rmap.c b/fs/xfs/scrub/rmap.c index 68e2847c962bb..d0578800f3e41 100644 --- a/fs/xfs/scrub/rmap.c +++ b/fs/xfs/scrub/rmap.c @@ -174,7 +174,7 @@ xchk_rmapbt_check_unwritten_in_keyflags( } hkey = xfs_btree_high_key_addr(cur, ptr, keyblock); - if (hkey->rmap.rm_offset & badflag) { + if (get_unaligned(&hkey->rmap.rm_offset) & badflag) { xchk_btree_set_preen(sc, cur, level); break; } -- 2.43.0