[syzbot] [block?] [udf?] memory leak in __blkdev_issue_zero_pages

2 views
Skip to first unread message

syzbot

unread,
10:42 AM (4 hours ago) 10:42 AM
to ax...@kernel.dk, ja...@suse.com, linux...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 6bda50f4333f Merge tag 'mips-fixes_6.18_2' of git://git.ke..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17ad8192580000
kernel config: https://syzkaller.appspot.com/x/.config?x=f30cc590c4f6da44
dashboard link: https://syzkaller.appspot.com/bug?extid=527a7e48a3d3d315d862
compiler: gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=10b27cb4580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/864951cecf67/disk-6bda50f4.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/4692a21b76e7/vmlinux-6bda50f4.xz
kernel image: https://storage.googleapis.com/syzbot-assets/a2898beb8301/bzImage-6bda50f4.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/384c8ab49dd6/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+527a7e...@syzkaller.appspotmail.com

BUG: memory leak
unreferenced object 0xffff88810dd11b00 (size 200):
comm "syz.3.32", pid 6189, jiffies 4294946488
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 80 70 01 41 81 88 ff ff .........p.A....
01 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 ................
backtrace (crc fe2a8999):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4983 [inline]
slab_alloc_node mm/slub.c:5288 [inline]
kmem_cache_alloc_noprof+0x397/0x5a0 mm/slub.c:5295
mempool_alloc_noprof+0xa0/0x200 mm/mempool.c:426
bio_alloc_bioset+0x398/0x7b0 block/bio.c:558
bio_alloc include/linux/bio.h:372 [inline]
__blkdev_issue_zero_pages+0x109/0x2f0 block/blk-lib.c:205
blkdev_issue_zero_pages block/blk-lib.c:239 [inline]
blkdev_issue_zeroout+0x1dc/0x490 block/blk-lib.c:326
blk_ioctl_zeroout block/ioctl.c:250 [inline]
blkdev_common_ioctl+0xb40/0x1180 block/ioctl.c:580
blkdev_ioctl+0x128/0x380 block/ioctl.c:699
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:597 [inline]
__se_sys_ioctl fs/ioctl.c:583 [inline]
__x64_sys_ioctl+0xf4/0x140 fs/ioctl.c:583
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xa4/0xfa0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f

BUG: memory leak
unreferenced object 0xffff888108a3d000 (size 4096):
comm "syz.3.32", pid 6189, jiffies 4294946488
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace (crc 0):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4983 [inline]
slab_alloc_node mm/slub.c:5288 [inline]
kmem_cache_alloc_noprof+0x397/0x5a0 mm/slub.c:5295
mempool_alloc_noprof+0xa0/0x200 mm/mempool.c:426
bvec_alloc+0x9d/0x130 block/bio.c:210
bio_alloc_bioset+0x3cb/0x7b0 block/bio.c:573
bio_alloc include/linux/bio.h:372 [inline]
__blkdev_issue_zero_pages+0x109/0x2f0 block/blk-lib.c:205
blkdev_issue_zero_pages block/blk-lib.c:239 [inline]
blkdev_issue_zeroout+0x1dc/0x490 block/blk-lib.c:326
blk_ioctl_zeroout block/ioctl.c:250 [inline]
blkdev_common_ioctl+0xb40/0x1180 block/ioctl.c:580
blkdev_ioctl+0x128/0x380 block/ioctl.c:699
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:597 [inline]
__se_sys_ioctl fs/ioctl.c:583 [inline]
__x64_sys_ioctl+0xf4/0x140 fs/ioctl.c:583
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xa4/0xfa0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f

connection error: failed to recv *flatrpc.ExecutorMessageRawT: EOF


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

shaurya

unread,
11:12 AM (3 hours ago) 11:12 AM
to syzbot+527a7e...@syzkaller.appspotmail.com, linux...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
0001-block-fix-memory-leak-in-__blkdev_issue_zero_pages.patch

syzbot

unread,
12:28 PM (2 hours ago) 12:28 PM
to linux...@vger.kernel.org, linux-...@vger.kernel.org, ssran...@gmail.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+527a7e...@syzkaller.appspotmail.com
Tested-by: syzbot+527a7e...@syzkaller.appspotmail.com

Tested on:

commit: 559e608c Merge tag 'ntfs3_for_6.19' of https://github...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1787eab4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=3bdbe6509b080086
dashboard link: https://syzkaller.appspot.com/bug?extid=527a7e48a3d3d315d862
compiler: gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=11f2301a580000

Note: testing is done by a robot and is best-effort only.

Keith Busch

unread,
12:55 PM (2 hours ago) 12:55 PM
to shaurya, syzbot+527a7e...@syzkaller.appspotmail.com, linux...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Thu, Dec 04, 2025 at 09:42:38PM +0530, shaurya wrote:
> Move the fatal signal check before bio_alloc() to prevent a memory
> leak when BLKDEV_ZERO_KILLABLE is set and a fatal signal is pending.
>
> Previously, the bio was allocated before checking for a fatal signal.
> If a signal was pending, the code would break out of the loop without
> freeing or chaining the just-allocated bio, causing a memory leak.
>
> This matches the pattern already used in __blkdev_issue_write_zeroes()
> where the signal check precedes the allocation.
>
> Signed-off-by: Shaurya Rane <ssran...@ee.vjti.ac.in>

Looks good.

Reviewed-by: Keith Busch <kbu...@kernel.org>

> ---
> block/blk-lib.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/block/blk-lib.c b/block/blk-lib.c
> index 3030a772d3aa..352e3c0f8a7d 100644
> --- a/block/blk-lib.c
> +++ b/block/blk-lib.c
> @@ -202,13 +202,13 @@ static void __blkdev_issue_zero_pages(struct block_device *bdev,
> unsigned int nr_vecs = __blkdev_sectors_to_bio_pages(nr_sects);
> struct bio *bio;
>
> - bio = bio_alloc(bdev, nr_vecs, REQ_OP_WRITE, gfp_mask);
> - bio->bi_iter.bi_sector = sector;
> -
> if ((flags & BLKDEV_ZERO_KILLABLE) &&
> fatal_signal_pending(current))
> break;
>
> + bio = bio_alloc(bdev, nr_vecs, REQ_OP_WRITE, gfp_mask);
> + bio->bi_iter.bi_sector = sector;
> +
> do {
> unsigned int len;
>
> --
Reply all
Reply to author
Forward
0 new messages