From: Qian Cai <quic_qiancai@quicinc.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>, Coly Li <colyli@suse.de>,
Mike Snitzer <snitzer@redhat.com>, Song Liu <song@kernel.org>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Josef Bacik <josef@toxicpanda.com>,
"David Sterba" <dsterba@suse.com>,
Phillip Lougher <phillip@squashfs.org.uk>,
<linux-block@vger.kernel.org>, <dm-devel@redhat.com>,
<linux-kernel@vger.kernel.org>, <linux-bcache@vger.kernel.org>,
<linux-raid@vger.kernel.org>, <target-devel@vger.kernel.org>,
<linux-btrfs@vger.kernel.org>
Subject: Re: cleanup bio_kmalloc v2
Date: Thu, 31 Mar 2022 12:34:56 -0400 [thread overview]
Message-ID: <YkXYMGGbk/ZTbGaA@qian> (raw)
In-Reply-To: <20220308061551.737853-1-hch@lst.de>
On Tue, Mar 08, 2022 at 07:15:46AM +0100, Christoph Hellwig wrote:
> Hi Jens,
>
> this series finishes off the bio allocation interface cleanups by dealing
> with the weirdest member of the famility. bio_kmalloc combines a kmalloc
> for the bio and bio_vecs with a hidden bio_init call and magic cleanup
> semantics.
>
> This series moves a few callers away from bio_kmalloc and then turns
> bio_kmalloc into a simple wrapper for a slab allocation of a bio and the
> inline biovecs. The callers need to manually call bio_init instead with
> all that entails and the magic that turns bio_put into a kfree goes away
> as well, allowing for a proper debug check in bio_put that catches
> accidental use on a bio_init()ed bio.
Reverting this series fixed boot crashes.
WARNING: CPU: 1 PID: 2622 at block/bio.c:229 bio_free
Modules linked in: cdc_ether usbnet ipmi_devintf ipmi_msghandler cppc_cpufreq fuse ip_tables x_tables ipv6 btrfs blake2b_generic libcrc32c xor xor_neon raid6_pq zstd_compress dm_mod nouveau crct10dif_ce drm_ttm_helper mlx5_core ttm drm_dp_helper drm_kms_helper nvme mpt3sas xhci_pci nvme_core raid_class drm xhci_pci_renesas
CPU: 1 PID: 2622 Comm: mount Not tainted 5.17.0-next-20220331 #50
pstate: 10400009 (nzcV daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : bio_free
lr : bio_put
sp : ffff8000371b7760
x29: ffff8000371b7760 x28: 0000000000000000 x27: dfff800000000000
x26: ffff08028f93a600 x25: 0000000000000000 x24: ffff08028f92f600
x23: 1ffff00006e36f10 x22: ffff08028fa18510 x21: 1fffe10051f430a2
x20: 0000000000000000 x19: ffff08028fa18500 x18: ffffde03db3e7d2c
x17: ffffde03d55f8bc4 x16: 1fffe10051e75129 x15: 1fffe106cfcfbb46
x14: 1fffe10051e7511c x13: 0000000000000004 x12: ffff700006e36eab
x11: 1ffff00006e36eaa x10: ffff700006e36eaa x9 : ffffde03d5cb9fec
x8 : ffff8000371b7557 x7 : 0000000000000001 x6 : ffff700006e36eaa
x5 : 1ffff00006e36ea9 x4 : 1ffff00006e36ebe x3 : 1fffe10051f430a2
x2 : 1fffe10051f430ae x1 : 0000000000000000 x0 : ffff08028fa18570
Call trace:
bio_free
bio_put
squashfs_read_data
squashfs_read_table
squashfs_fill_super
get_tree_bdev
squashfs_get_tree
vfs_get_tree
do_new_mount
path_mount
__arm64_sys_mount
invoke_syscall
el0_svc_common.constprop.0
do_el0_svc
el0_svc
el0t_64_sync_handler
el0t_64_sync
irq event stamp: 33146
hardirqs last enabled at (33145): free_unref_page
hardirqs last disabled at (33146): el1_dbg
softirqs last enabled at (33122): __do_softirq
softirqs last disabled at (33111): __irq_exit_rcu
---[ end trace 0000000000000000 ]---
Unable to handle kernel paging request at virtual address dfff800000000001
KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
Mem abort info:
ESR = 0x96000004
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x04: level 0 translation fault
Data abort info:
ISV = 0, ISS = 0x00000004
CM = 0, WnR = 0
[dfff800000000001] address between user and kernel address ranges
Internal error: Oops: 96000004 [#1] PREEMPT SMP
Modules linked in: cdc_ether usbnet ipmi_devintf ipmi_msghandler cppc_cpufreq fuse ip_tables x_tables ipv6 btrfs blake2b_generic libcrc32c xor xor_neon raid6_pq zstd_compress dm_mod nouveau crct10dif_ce
drm_ttm_helper mlx5_core ttm drm_dp_helper drm_kms_helper nvme mpt3sas xhci_pci nvme_core raid_class drm xhci_pci_renesas
CPU: 1 PID: 2622 Comm: mount Tainted: G W 5.17.0-next-20220331 #50
pc : bio_free
lr : bio_free
sp : ffff8000371b7760
x29: ffff8000371b7760 x28: 0000000000000000 x27: dfff800000000000
x26: ffff08028f93a600 x25: 0000000000000000 x24: ffff08028f92f600
x23: 1ffff00006e36f10 x22: ffff08028fa18548 x21: 00000000000000d0
x20: 0000000000000000 x19: ffff08028fa18500 x18: ffffde03db3e7d2c
x17: ffffde03d55f8bc4 x16: 1fffe10051e75129 x15: 1fffe106cfcfbb46
x14: 1fffe10051e7511c x13: 0000000000000004 x12: ffff700006e36eab
x11: 1ffff00006e36eaa x10: ffff700006e36eaa x9 : ffffde03d5cb9c78
x8 : ffff8000371b7557 x7 : 0000000000000001 x6 : ffff700006e36eaa
x5 : 1ffff00006e36ea9 x4 : 1fffe10051f430ac x3 : 0000000000000001
x2 : 0000000000000003 x1 : dfff800000000000 x0 : 0000000000000008
Call trace:
bio_free
bio_put
squashfs_read_data
squashfs_read_table
squashfs_fill_super
get_tree_bdev
squashfs_get_tree
vfs_get_tree
do_new_mount
path_mount
__arm64_sys_mount
invoke_syscall
el0_svc_common.constprop.0
do_el0_svc
el0_svc
el0t_64_sync_handler
el0t_64_sync
Code: d2d00001 f2fbffe1 52800062 d343fc03 (38e16861)
---[ end trace 0000000000000000 ]---
SMP: stopping secondary CPUs
Kernel Offset: 0x5e03ccd70000 from 0xffff800008000000
PHYS_OFFSET: 0x80000000
CPU features: 0x000,00085c0d,19801c82
Memory Limit: none
---[ end Kernel panic - not syncing: Oops: Fatal exception ]---
>
> Changes since v1:
> - update a pre-existing comment per maintainer suggestion
>
> Diffstat:
> block/bio.c | 47 ++++++++++++++-----------------------
> block/blk-crypto-fallback.c | 14 ++++++-----
> block/blk-map.c | 42 +++++++++++++++++++++------------
> drivers/block/pktcdvd.c | 34 +++++++++++---------------
> drivers/md/bcache/debug.c | 10 ++++---
> drivers/md/dm-bufio.c | 9 +++----
> drivers/md/raid1.c | 12 ++++++---
> drivers/md/raid10.c | 21 +++++++++++-----
> drivers/target/target_core_pscsi.c | 36 ++++------------------------
> fs/btrfs/disk-io.c | 8 +++---
> fs/btrfs/volumes.c | 11 --------
> fs/btrfs/volumes.h | 2 -
> fs/squashfs/block.c | 14 +++--------
> include/linux/bio.h | 2 -
> 14 files changed, 116 insertions(+), 146 deletions(-)
next prev parent reply other threads:[~2022-03-31 16:35 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-08 6:15 cleanup bio_kmalloc v2 Christoph Hellwig
2022-03-08 6:15 ` [PATCH 1/5] btrfs: simplify ->flush_bio handling Christoph Hellwig
2022-03-08 22:07 ` Chaitanya Kulkarni
2022-03-08 6:15 ` [PATCH 2/5] squashfs: always use bio_kmalloc in squashfs_bio_read Christoph Hellwig
2022-03-08 6:15 ` [PATCH 3/5] target/pscsi: remove pscsi_get_bio Christoph Hellwig
2022-03-08 22:08 ` Chaitanya Kulkarni
2022-03-08 6:15 ` [PATCH 4/5] block: turn bio_kmalloc into a simple kmalloc wrapper Christoph Hellwig
2022-03-09 3:06 ` Martin K. Petersen
[not found] ` <CGME20220331211804eucas1p28da21f2dfd57aa490abffb8f87417f42@eucas1p2.samsung.com>
2022-03-31 21:18 ` Marek Szyprowski
2022-03-31 21:22 ` Jens Axboe
2022-04-01 4:57 ` Christoph Hellwig
2022-03-08 6:15 ` [PATCH 5/5] pktcdvd: stop using bio_reset Christoph Hellwig
2022-03-08 22:10 ` Chaitanya Kulkarni
2022-03-30 14:29 ` cleanup bio_kmalloc v2 Christoph Hellwig
2022-03-30 14:37 ` Jens Axboe
2022-03-30 14:49 ` Jens Axboe
2022-03-31 16:34 ` Qian Cai [this message]
2022-03-31 16:40 ` Christoph Hellwig
2022-03-31 16:48 ` Jens Axboe
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=YkXYMGGbk/ZTbGaA@qian \
--to=quic_qiancai@quicinc.com \
--cc=axboe@kernel.dk \
--cc=colyli@suse.de \
--cc=dm-devel@redhat.com \
--cc=dsterba@suse.com \
--cc=hch@lst.de \
--cc=josef@toxicpanda.com \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=phillip@squashfs.org.uk \
--cc=snitzer@redhat.com \
--cc=song@kernel.org \
--cc=target-devel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).