All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>
Cc: 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: [PATCH 4/5] block: turn bio_kmalloc into a simple kmalloc wrapper
Date: Thu, 31 Mar 2022 23:18:03 +0200	[thread overview]
Message-ID: <6696cc6a-3e3f-035e-5b8c-05ea361383f3@samsung.com> (raw)
In-Reply-To: <20220308061551.737853-5-hch@lst.de>

Hi Christoph,

On 08.03.2022 07:15, Christoph Hellwig wrote:
> Remove the magic autofree semantics and require the callers to explicitly
> call bio_init to initialize the bio.
>
> This allows bio_free to catch accidental bio_put calls on bio_init()ed
> bios as well.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

This patch, which landed in today's next-20220331 as commit 57c47b42f454 
("block: turn bio_kmalloc into a simple kmalloc wrapper"), breaks badly 
all my test systems, which use squashfs initrd:

RAMDISK: squashfs filesystem found at block 0
RAMDISK: Loading 2489KiB [1 disk] into ram disk... done.
using deprecated initrd support, will be removed in 2021.
------------[ cut here ]------------
WARNING: CPU: 4 PID: 1 at block/bio.c:229 bio_free+0x6c/0x70
Modules linked in:
CPU: 4 PID: 1 Comm: swapper/0 Not tainted 5.17.0-next-20220331 #4767
Hardware name: Samsung Exynos (Flattened Device Tree)
  unwind_backtrace from show_stack+0x10/0x14
  show_stack from dump_stack_lvl+0x58/0x70
  dump_stack_lvl from __warn+0xc8/0x218
  __warn from warn_slowpath_fmt+0x5c/0xb4
  warn_slowpath_fmt from bio_free+0x6c/0x70
  bio_free from squashfs_read_data+0x118/0x748
  squashfs_read_data from squashfs_read_table+0xdc/0x144
  squashfs_read_table from squashfs_fill_super+0x100/0x9ec
  squashfs_fill_super from get_tree_bdev+0x154/0x248
  get_tree_bdev from vfs_get_tree+0x24/0xe4
  vfs_get_tree from path_mount+0x3d0/0xb14
  path_mount from init_mount+0x54/0x80
  init_mount from do_mount_root+0x78/0x104
  do_mount_root from mount_block_root+0xf0/0x1fc
  mount_block_root from initrd_load+0xec/0x294
  initrd_load from prepare_namespace+0xdc/0x18c
  prepare_namespace from kernel_init+0x18/0x12c
  kernel_init from ret_from_fork+0x14/0x2c
Exception stack(0xf0835fb0 to 0xf0835ff8)
...
irq event stamp: 398271
hardirqs last  enabled at (398279): [<c019c984>] __up_console_sem+0x50/0x60
hardirqs last disabled at (398338): [<c019c970>] __up_console_sem+0x3c/0x60
softirqs last  enabled at (398352): [<c0101680>] __do_softirq+0x348/0x610
softirqs last disabled at (398347): [<c012f048>] __irq_exit_rcu+0x144/0x1ec
---[ end trace 0000000000000000 ]---
8<--- cut here ---
Unable to handle kernel NULL pointer dereference at virtual address 00000004
[00000004] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 4 PID: 1 Comm: swapper/0 Tainted: G        W 5.17.0-next-20220331 #4767
Hardware name: Samsung Exynos (Flattened Device Tree)
PC is at bio_free+0x24/0x70
LR is at bio_free+0x24/0x70
pc : [<c0502d28>]    lr : [<c0502d28>]    psr: 80000113
sp : f0835cf0  ip : 00000000  fp : c28cae80
r10: ef0a95c0  r9 : c2805cc0  r8 : 00000060
r7 : 00000060  r6 : 00000060  r5 : 00000000  r4 : c2804a80
r3 : c2804ac8  r2 : 00000001  r1 : c2804ac8  r0 : 00000074
Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 10c5387d  Table: 4000406a  DAC: 00000051
Register r0 information: non-paged memory
Register r1 information: slab kmalloc-128 start c2804a80 pointer offset 
72 size 128
Register r2 information: non-paged memory
Register r3 information: slab kmalloc-128 start c2804a80 pointer offset 
72 size 128
Register r4 information: slab kmalloc-128 start c2804a80 pointer offset 
0 size 128
Register r5 information: NULL pointer
Register r6 information: non-paged memory
Register r7 information: non-paged memory
Register r8 information: non-paged memory
Register r9 information: slab kmalloc-192 start c2805cc0 pointer offset 
0 size 192
Register r10 information: non-slab/vmalloc memory
Register r11 information: slab kmalloc-64 start c28cae80 pointer offset 
0 size 64
Register r12 information: NULL pointer
Process swapper/0 (pid: 1, stack limit = 0x(ptrval))
Stack: (0xf0835cf0 to 0xf0836000)
...
  bio_free from squashfs_read_data+0x118/0x748
  squashfs_read_data from squashfs_read_table+0xdc/0x144
  squashfs_read_table from squashfs_fill_super+0x100/0x9ec
  squashfs_fill_super from get_tree_bdev+0x154/0x248
  get_tree_bdev from vfs_get_tree+0x24/0xe4
  vfs_get_tree from path_mount+0x3d0/0xb14
  path_mount from init_mount+0x54/0x80
  init_mount from do_mount_root+0x78/0x104
  do_mount_root from mount_block_root+0xf0/0x1fc
  mount_block_root from initrd_load+0xec/0x294
  initrd_load from prepare_namespace+0xdc/0x18c
  prepare_namespace from kernel_init+0x18/0x12c
  kernel_init from ret_from_fork+0x14/0x2c
Exception stack(0xf0835fb0 to 0xf0835ff8)
...
---[ end trace 0000000000000000 ]---
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

Reverting it on top of linux next-20220331 (together with commit 
1292fb59f283 ("pktcdvd: stop using bio_reset")) fixes (or hides?) the issue.

> ---
>   block/bio.c                        | 47 ++++++++++++------------------
>   block/blk-crypto-fallback.c        | 14 +++++----
>   block/blk-map.c                    | 42 ++++++++++++++++----------
>   drivers/block/pktcdvd.c            | 25 ++++++++--------
>   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 | 10 +++----
>   fs/squashfs/block.c                |  9 +++---
>   include/linux/bio.h                |  2 +-
>   11 files changed, 108 insertions(+), 93 deletions(-)

 > [...]

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


WARNING: multiple messages have this Message-ID (diff)
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>
Cc: linux-bcache@vger.kernel.org, linux-raid@vger.kernel.org,
	Mike Snitzer <snitzer@redhat.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-kernel@vger.kernel.org, Josef Bacik <josef@toxicpanda.com>,
	Coly Li <colyli@suse.de>,
	linux-block@vger.kernel.org, Song Liu <song@kernel.org>,
	dm-devel@redhat.com, target-devel@vger.kernel.org,
	David Sterba <dsterba@suse.com>,
	Phillip Lougher <phillip@squashfs.org.uk>,
	linux-btrfs@vger.kernel.org
Subject: Re: [dm-devel] [PATCH 4/5] block: turn bio_kmalloc into a simple kmalloc wrapper
Date: Thu, 31 Mar 2022 23:18:03 +0200	[thread overview]
Message-ID: <6696cc6a-3e3f-035e-5b8c-05ea361383f3@samsung.com> (raw)
In-Reply-To: <20220308061551.737853-5-hch@lst.de>

Hi Christoph,

On 08.03.2022 07:15, Christoph Hellwig wrote:
> Remove the magic autofree semantics and require the callers to explicitly
> call bio_init to initialize the bio.
>
> This allows bio_free to catch accidental bio_put calls on bio_init()ed
> bios as well.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

This patch, which landed in today's next-20220331 as commit 57c47b42f454 
("block: turn bio_kmalloc into a simple kmalloc wrapper"), breaks badly 
all my test systems, which use squashfs initrd:

RAMDISK: squashfs filesystem found at block 0
RAMDISK: Loading 2489KiB [1 disk] into ram disk... done.
using deprecated initrd support, will be removed in 2021.
------------[ cut here ]------------
WARNING: CPU: 4 PID: 1 at block/bio.c:229 bio_free+0x6c/0x70
Modules linked in:
CPU: 4 PID: 1 Comm: swapper/0 Not tainted 5.17.0-next-20220331 #4767
Hardware name: Samsung Exynos (Flattened Device Tree)
  unwind_backtrace from show_stack+0x10/0x14
  show_stack from dump_stack_lvl+0x58/0x70
  dump_stack_lvl from __warn+0xc8/0x218
  __warn from warn_slowpath_fmt+0x5c/0xb4
  warn_slowpath_fmt from bio_free+0x6c/0x70
  bio_free from squashfs_read_data+0x118/0x748
  squashfs_read_data from squashfs_read_table+0xdc/0x144
  squashfs_read_table from squashfs_fill_super+0x100/0x9ec
  squashfs_fill_super from get_tree_bdev+0x154/0x248
  get_tree_bdev from vfs_get_tree+0x24/0xe4
  vfs_get_tree from path_mount+0x3d0/0xb14
  path_mount from init_mount+0x54/0x80
  init_mount from do_mount_root+0x78/0x104
  do_mount_root from mount_block_root+0xf0/0x1fc
  mount_block_root from initrd_load+0xec/0x294
  initrd_load from prepare_namespace+0xdc/0x18c
  prepare_namespace from kernel_init+0x18/0x12c
  kernel_init from ret_from_fork+0x14/0x2c
Exception stack(0xf0835fb0 to 0xf0835ff8)
...
irq event stamp: 398271
hardirqs last  enabled at (398279): [<c019c984>] __up_console_sem+0x50/0x60
hardirqs last disabled at (398338): [<c019c970>] __up_console_sem+0x3c/0x60
softirqs last  enabled at (398352): [<c0101680>] __do_softirq+0x348/0x610
softirqs last disabled at (398347): [<c012f048>] __irq_exit_rcu+0x144/0x1ec
---[ end trace 0000000000000000 ]---
8<--- cut here ---
Unable to handle kernel NULL pointer dereference at virtual address 00000004
[00000004] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 4 PID: 1 Comm: swapper/0 Tainted: G        W 5.17.0-next-20220331 #4767
Hardware name: Samsung Exynos (Flattened Device Tree)
PC is at bio_free+0x24/0x70
LR is at bio_free+0x24/0x70
pc : [<c0502d28>]    lr : [<c0502d28>]    psr: 80000113
sp : f0835cf0  ip : 00000000  fp : c28cae80
r10: ef0a95c0  r9 : c2805cc0  r8 : 00000060
r7 : 00000060  r6 : 00000060  r5 : 00000000  r4 : c2804a80
r3 : c2804ac8  r2 : 00000001  r1 : c2804ac8  r0 : 00000074
Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 10c5387d  Table: 4000406a  DAC: 00000051
Register r0 information: non-paged memory
Register r1 information: slab kmalloc-128 start c2804a80 pointer offset 
72 size 128
Register r2 information: non-paged memory
Register r3 information: slab kmalloc-128 start c2804a80 pointer offset 
72 size 128
Register r4 information: slab kmalloc-128 start c2804a80 pointer offset 
0 size 128
Register r5 information: NULL pointer
Register r6 information: non-paged memory
Register r7 information: non-paged memory
Register r8 information: non-paged memory
Register r9 information: slab kmalloc-192 start c2805cc0 pointer offset 
0 size 192
Register r10 information: non-slab/vmalloc memory
Register r11 information: slab kmalloc-64 start c28cae80 pointer offset 
0 size 64
Register r12 information: NULL pointer
Process swapper/0 (pid: 1, stack limit = 0x(ptrval))
Stack: (0xf0835cf0 to 0xf0836000)
...
  bio_free from squashfs_read_data+0x118/0x748
  squashfs_read_data from squashfs_read_table+0xdc/0x144
  squashfs_read_table from squashfs_fill_super+0x100/0x9ec
  squashfs_fill_super from get_tree_bdev+0x154/0x248
  get_tree_bdev from vfs_get_tree+0x24/0xe4
  vfs_get_tree from path_mount+0x3d0/0xb14
  path_mount from init_mount+0x54/0x80
  init_mount from do_mount_root+0x78/0x104
  do_mount_root from mount_block_root+0xf0/0x1fc
  mount_block_root from initrd_load+0xec/0x294
  initrd_load from prepare_namespace+0xdc/0x18c
  prepare_namespace from kernel_init+0x18/0x12c
  kernel_init from ret_from_fork+0x14/0x2c
Exception stack(0xf0835fb0 to 0xf0835ff8)
...
---[ end trace 0000000000000000 ]---
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

Reverting it on top of linux next-20220331 (together with commit 
1292fb59f283 ("pktcdvd: stop using bio_reset")) fixes (or hides?) the issue.

> ---
>   block/bio.c                        | 47 ++++++++++++------------------
>   block/blk-crypto-fallback.c        | 14 +++++----
>   block/blk-map.c                    | 42 ++++++++++++++++----------
>   drivers/block/pktcdvd.c            | 25 ++++++++--------
>   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 | 10 +++----
>   fs/squashfs/block.c                |  9 +++---
>   include/linux/bio.h                |  2 +-
>   11 files changed, 108 insertions(+), 93 deletions(-)

 > [...]

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel

  parent reply	other threads:[~2022-03-31 21:18 UTC|newest]

Thread overview: 42+ 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 ` [dm-devel] " Christoph Hellwig
2022-03-08  6:15 ` [PATCH 1/5] btrfs: simplify ->flush_bio handling Christoph Hellwig
2022-03-08  6:15   ` [dm-devel] " Christoph Hellwig
2022-03-08 22:07   ` Chaitanya Kulkarni
2022-03-08 22:07     ` [dm-devel] " 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   ` [dm-devel] " Christoph Hellwig
2022-03-08  6:15 ` [PATCH 3/5] target/pscsi: remove pscsi_get_bio Christoph Hellwig
2022-03-08  6:15   ` [dm-devel] " Christoph Hellwig
2022-03-08 22:08   ` Chaitanya Kulkarni
2022-03-08 22:08     ` [dm-devel] " Chaitanya Kulkarni
2022-03-08  6:15 ` [PATCH 4/5] block: turn bio_kmalloc into a simple kmalloc wrapper Christoph Hellwig
2022-03-08  6:15   ` [dm-devel] " Christoph Hellwig
2022-03-09  3:06   ` Martin K. Petersen
2022-03-09  3:06     ` [dm-devel] " Martin K. Petersen
     [not found]   ` <CGME20220331211804eucas1p28da21f2dfd57aa490abffb8f87417f42@eucas1p2.samsung.com>
2022-03-31 21:18     ` Marek Szyprowski [this message]
2022-03-31 21:18       ` Marek Szyprowski
2022-03-31 21:22       ` Jens Axboe
2022-03-31 21:22         ` [dm-devel] " Jens Axboe
2022-04-01  4:57       ` Christoph Hellwig
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  6:15   ` [dm-devel] " Christoph Hellwig
2022-03-08 22:10   ` Chaitanya Kulkarni
2022-03-08 22:10     ` [dm-devel] " Chaitanya Kulkarni
2022-03-30 14:29 ` cleanup bio_kmalloc v2 Christoph Hellwig
2022-03-30 14:29   ` [dm-devel] " Christoph Hellwig
2022-03-30 14:37   ` Jens Axboe
2022-03-30 14:37     ` [dm-devel] " Jens Axboe
2022-03-30 14:49 ` Jens Axboe
2022-03-30 14:49   ` [dm-devel] " Jens Axboe
2022-03-31 16:34 ` Qian Cai
2022-03-31 16:34   ` [dm-devel] " Qian Cai
2022-03-31 16:40   ` Christoph Hellwig
2022-03-31 16:40     ` [dm-devel] " Christoph Hellwig
2022-03-31 16:48     ` Jens Axboe
2022-03-31 16:48       ` [dm-devel] " Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2022-04-06  6:12 [dm-devel] cleanup bio_kmalloc v3 Christoph Hellwig
2022-04-06  6:12 ` [PATCH 4/5] block: turn bio_kmalloc into a simple kmalloc wrapper Christoph Hellwig
2022-04-07  8:16   ` Coly Li
2022-04-13 17:04   ` Mike Snitzer
2022-03-01  8:45 cleanup bio_kmalloc Christoph Hellwig
2022-03-01  8:45 ` [PATCH 4/5] block: turn bio_kmalloc into a simple kmalloc wrapper Christoph Hellwig

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=6696cc6a-3e3f-035e-5b8c-05ea361383f3@samsung.com \
    --to=m.szyprowski@samsung.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 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.