* Re: [PATCH] xfs: zero roundoff padding in xlog_sync to prevent
[not found] <20260417101250.2492247-1-tristmd@gmail.com>
@ 2026-04-17 10:12 ` syzbot
0 siblings, 0 replies; only message in thread
From: syzbot @ 2026-04-17 10:12 UTC (permalink / raw)
To: tristmd; +Cc: tristmd, linux-kernel, syzkaller-bugs
> From: Tristan Madani <tristan@talencesecurity.com>
>
> #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
This crash does not have a reproducer. I cannot test it.
>
> stale data exposure
>
> xlog_sync() rounds up the in-core log (iclog) write size to the log
> stripe unit or sector size. The roundoff padding bytes between
> iclog->ic_offset and the rounded-up boundary come from the iclog data
> buffer, which is allocated once at mount time with kvzalloc but is
> reused across log writes without re-zeroing.
>
> When an iclog is reused, the padding region may contain stale data
> from a previous log write. xlog_pack_data() and xlog_cksum() then
> process these stale bytes, which KMSAN flags as use of uninitialized
> memory. While the stale data is overwritten on disk during log
> recovery, the KMSAN report indicates a real information hygiene issue.
>
> Zero the roundoff padding bytes before calling xlog_pack_data() to
> ensure deterministic log content regardless of prior iclog state.
>
> Reported-by: syzbot+97f2c05378c5d68dcb8c@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=97f2c05378c5d68dcb8c
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@vger.kernel.org
> Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
> ---
> fs/xfs/xfs_log.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index XXXXXXX..XXXXXXX 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -1731,6 +1731,10 @@ xlog_sync(
> xlog_grant_add_space(&log->l_write_head, roundoff);
> }
>
> + /* Zero roundoff padding to avoid writing stale data to the log */
> + if (roundoff)
> + memset(iclog->ic_datap + iclog->ic_offset, 0, roundoff);
> +
> /* put cycle number in every block */
> xlog_pack_data(log, iclog, roundoff);
> --
> 2.43.0
^ permalink raw reply [flat|nested] only message in thread