All of lore.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+8b23309d5788a79d3eea@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [syzbot] Re: [syzbot] [block?] general protection fault in bio_first_folio
Date: Fri, 15 Dec 2023 22:22:05 -0800	[thread overview]
Message-ID: <0000000000001efb50060c9a8914@google.com> (raw)
In-Reply-To: <0000000000006c14cd060c99ac12@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [block?] general protection fault in bio_first_folio
Author: eadavis@qq.com

please test general protection fault in bio_first_folio

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git abb240f7a2bd

diff --git a/include/linux/bio.h b/include/linux/bio.h
index ec4db73e5f4e..20ccf5796ea0 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -286,6 +286,7 @@ static inline void bio_first_folio(struct folio_iter *fi, struct bio *bio,
 {
 	struct bio_vec *bvec = bio_first_bvec_all(bio) + i;
 
+	WARN_ON_ONCE(!bio->bi_vcnt);
 	fi->folio = page_folio(bvec->bv_page);
 	fi->offset = bvec->bv_offset +
 			PAGE_SIZE * (bvec->bv_page - &fi->folio->page);
diff --git a/block/blk-map.c b/block/blk-map.c
index 8584babf3ea0..e2169d67be4b 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -275,6 +275,7 @@ static int bio_map_user_iov(struct request *rq, struct iov_iter *iter,
 	if (!iov_iter_count(iter))
 		return -EINVAL;
 
+	printk("i: %p, nr: %d, cn: %lld, %s\n", iter, nr_vecs, iov_iter_count(iter), __func__);
 	bio = blk_rq_map_bio_alloc(rq, nr_vecs, gfp_mask);
 	if (bio == NULL)
 		return -ENOMEM;
@@ -298,6 +299,7 @@ static int bio_map_user_iov(struct request *rq, struct iov_iter *iter,
 					       nr_vecs, extraction_flags, &offs);
 		if (unlikely(bytes <= 0)) {
 			ret = bytes ? bytes : -EFAULT;
+			printk("r: %d, b: %lld, icn: %d, %s\n", ret, bytes, iov_iter_count(iter), __func__);
 			goto out_unmap;
 		}
 
@@ -339,6 +341,7 @@ static int bio_map_user_iov(struct request *rq, struct iov_iter *iter,
 	}
 
 	ret = blk_rq_append_bio(rq, bio);
+	printk("b: %p, r: %d, %s\n", bio, ret, __func__);
 	if (ret)
 		goto out_unmap;
 	return 0;


  parent reply	other threads:[~2023-12-16  6:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-16  5:20 [syzbot] [block?] general protection fault in bio_first_folio syzbot
2023-12-16  5:53 ` Matthew Wilcox
2023-12-16  7:01   ` syzbot
2023-12-16  6:22 ` syzbot [this message]
2023-12-16  7:00 ` Hillf Danton
2023-12-16  8:11   ` syzbot
2023-12-16  7:29 ` 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=0000000000001efb50060c9a8914@google.com \
    --to=syzbot+8b23309d5788a79d3eea@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.