Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | Date | Fri, 15 Dec 2023 22:22:05 -0800 | Subject | Re: [syzbot] Re: [syzbot] [block?] general protection fault in bio_first_folio | From | syzbot <> |
| |
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;
| ![\](/images/icornerr.gif) |