public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+97f2c05378c5d68dcb8c@syzkaller.appspotmail.com>
To: tristmd@gmail.com
Cc: tristmd@gmail.com, linux-kernel@vger.kernel.org,
	 syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH] xfs: zero roundoff padding in xlog_sync to prevent
Date: Fri, 17 Apr 2026 03:12:52 -0700	[thread overview]
Message-ID: <69e207a4.050a0220.1de265.0014.GAE@google.com> (raw)
In-Reply-To: <20260417101250.2492247-1-tristmd@gmail.com>

> 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

           reply	other threads:[~2026-04-17 10:12 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20260417101250.2492247-1-tristmd@gmail.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=69e207a4.050a0220.1de265.0014.GAE@google.com \
    --to=syzbot+97f2c05378c5d68dcb8c@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tristmd@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox