Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1232585pxb; Fri, 1 Apr 2022 08:02:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz94mKQ57RcliSsXbrYrsGZDXPoy0L7opSwwDyPdc3+xSYHUlPrbXhFdRUbZN/Q0sRMG9Nl X-Received: by 2002:a17:906:e4c:b0:6e0:b002:2b2e with SMTP id q12-20020a1709060e4c00b006e0b0022b2emr185885eji.690.1648825370647; Fri, 01 Apr 2022 08:02:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648825370; cv=none; d=google.com; s=arc-20160816; b=iLQHjmosCBA6wH6pvG+LN/oFZuv+CBIdbJB757gPkxeSDDPc3JWdnUZbPrB2qorVD7 Xx7cnLV37cro8Wk0Y1PDexaCtiC2yF9bX+SYJG/6qCX5w+Utp6+TDQLJD2esmHfq65pa Pz2+45pcqq058LfQeBz7dmkLq7yKP7nlL4j0MrIhXVDcceUzGRvoCDF0fZ2Obos0YQms /Ix5RawyRpGgXle4Ce81NbI+poLqcuvzwBaowUmQo/Z0si696/t8ncGDOpGTKv1uwWKf AEtV0xOmJo8+Q+FKsDKQzwhWEPnvi4U7kFy63w2cuK84eHHRVi5ffkSGteorwbS4wHM+ GQLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vcu31rMS0yn2EqzHi27wb6PxKwLH34tTd/+ys8ECp/A=; b=rDpMmPsOHsDXZC25OaCc5iCgkkQc2CUOxCeY0FEQ2w+DADC8e0uoxR9N3qtjpi73UM xF6nRya/WzR+TdfVWqFK4Slr+QOS4dQfTbZ64W/XWCTtqm9pTYkNcPAfRtzkJTqNN7SS H23svsl7xzJQuMpIiouZq9GvOWBwDnF+haOYeUqyMsbCz4fN6xWebf5Ii+Af5kbkYiid 1950DFLMEjYLXWiL6MDGRtfc6eeiKZvo6jJPsygCzsQsNJ119Q9AYHjJBxIhiVckLdJP piPWTmfaczQj+1zZXuN2TP2iDTuRysRQSqx7QEddNebpe8ZelzqHdgysOH6touA1bc0C JVHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=ADDuc88F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j13-20020a170906254d00b006df76385d07si1719715ejb.423.2022.04.01.08.02.21; Fri, 01 Apr 2022 08:02:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=ADDuc88F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240036AbiCaQgx (ORCPT + 99 others); Thu, 31 Mar 2022 12:36:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240022AbiCaQgv (ORCPT ); Thu, 31 Mar 2022 12:36:51 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 850411BBF62; Thu, 31 Mar 2022 09:35:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1648744503; x=1680280503; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=vcu31rMS0yn2EqzHi27wb6PxKwLH34tTd/+ys8ECp/A=; b=ADDuc88FzNWZGKBrIk06zzzX+k6YSxqk27uWQNihSUCGuZ1GtMpxcMlV xTEWa75dpfcsFQw+mC064HKR7W4MWXLYRVTC8926TBwzR2AQWBCbndTjo VEkv7SFykl4Py4aMRGoIAena380+aMTSMqaNCRjn7CsXqgUcJlMFOvVOW g=; Received: from ironmsg07-lv.qualcomm.com ([10.47.202.151]) by alexa-out.qualcomm.com with ESMTP; 31 Mar 2022 09:35:03 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg07-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2022 09:35:02 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 31 Mar 2022 09:35:02 -0700 Received: from qian (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 31 Mar 2022 09:34:58 -0700 Date: Thu, 31 Mar 2022 12:34:56 -0400 From: Qian Cai To: Christoph Hellwig CC: Jens Axboe , Coly Li , Mike Snitzer , Song Liu , "Martin K. Petersen" , Josef Bacik , "David Sterba" , Phillip Lougher , , , , , , , Subject: Re: cleanup bio_kmalloc v2 Message-ID: References: <20220308061551.737853-1-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20220308061551.737853-1-hch@lst.de> X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-)