mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+05d7520be047c9be86e0@syzkaller.appspotmail.com
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [bcachefs?] KASAN: slab-out-of-bounds Read in journal_entry_dev_usage_to_text
Date: Tue, 30 Jul 2024 10:17:16 +0800	[thread overview]
Message-ID: <tencent_DAEC5ACEE079366E9C2C516E6C9568E9AA0A@qq.com> (raw)
In-Reply-To: <000000000000b2c0fc061e6cb26b@google.com>

entry bytes too small ?

#syz test: upstream 1722389b0d86

diff --git a/fs/bcachefs/sb-clean.c b/fs/bcachefs/sb-clean.c
index 47f10ab57f40..a10d3e6e8119 100644
--- a/fs/bcachefs/sb-clean.c
+++ b/fs/bcachefs/sb-clean.c
@@ -303,6 +303,7 @@ static void bch2_sb_clean_to_text(struct printbuf *out, struct bch_sb *sb,
 	for (entry = clean->start;
 	     entry != vstruct_end(&clean->field);
 	     entry = vstruct_next(entry)) {
+		unsigned bytes = vstruct_bytes(entry);
 		if ((void *) vstruct_next(entry) > vstruct_end(&clean->field))
 			break;
 
@@ -310,6 +311,11 @@ static void bch2_sb_clean_to_text(struct printbuf *out, struct bch_sb *sb,
 		    !entry->u64s)
 			continue;
 
+		printk("entry bytes:%u, jedu: %u, %s\n", bytes,
+				sizeof(struct jset_entry_dev_usage), __func__);
+		if (bytes < sizeof(struct jset_entry_dev_usage))
+			continue;
+
 		bch2_journal_entry_to_text(out, NULL, entry);
 		prt_newline(out);
 	}


  reply	other threads:[~2024-07-30  2:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-30  1:14 syzbot
2024-07-30  2:17 ` Edward Adam Davis [this message]
2024-07-30  3:03   ` syzbot
2024-07-30  4:10 ` [PATCH] bcachefs: Add checks for entry's _data bytes Edward Adam Davis
2024-07-31  0:52   ` Kent Overstreet
2024-07-31  1:35     ` [PATCH V2] " Edward Adam Davis
2024-07-31  1:41 ` [syzbot] [bcachefs?] KASAN: slab-out-of-bounds Read in journal_entry_dev_usage_to_text Edward Adam Davis
2024-07-31  2:04   ` syzbot
2024-11-11 21:03 ` [syzbot] syzbot

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=tencent_DAEC5ACEE079366E9C2C516E6C9568E9AA0A@qq.com \
    --to=eadavis@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+05d7520be047c9be86e0@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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

all inboxes | Powered by JetHome®