Re: [syzbot] [xfs?] KASAN: slab-out-of-bounds Read in xlog_cksum

Edward Adam Davis
2025-03-05T12:14:32Z

#syz test

diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index f8851ff835de..6b7eee3c9f7f 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1583,6 +1583,7 @@ xlog_cksum(
int xheads;

xheads = DIV_ROUND_UP(size, XLOG_HEADER_CYCLE_SIZE);
+ printk("xheads: %d, size: %d, %s\n", xheads, size, __func__);

for (i = 1; i < xheads; i++) {
crc = crc32c(crc, &xhdr[i].hic_xheader,
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index b3c27dbccce8..257abbe9c3fa 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -2969,6 +2969,7 @@ xlog_valid_rec_header(
* and h_len must not be greater than LR buffer size.
*/
hlen = be32_to_cpu(rhead->h_len);
+ printk("hlen: %d, bufsize: %d, %s\n", hlen, bufsize, __func__);
if (XFS_IS_CORRUPT(log->l_mp, hlen <= 0 || hlen > bufsize))
return -EFSCORRUPTED;