* [syzbot] [block?] [udf?] memory leak in __blkdev_issue_zero_pages
@ 2025-12-04 15:42 syzbot
2025-12-04 16:12 ` shaurya
0 siblings, 1 reply; 5+ messages in thread
From: syzbot @ 2025-12-04 15:42 UTC (permalink / raw)
To: axboe, jack, linux-block, linux-kernel, syzkaller-bugs
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+527a7e48a3d3d315d862@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 syzkaller@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
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [syzbot] [block?] [udf?] memory leak in __blkdev_issue_zero_pages
2025-12-04 15:42 [syzbot] [block?] [udf?] memory leak in __blkdev_issue_zero_pages syzbot
@ 2025-12-04 16:12 ` shaurya
2025-12-04 17:28 ` syzbot
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: shaurya @ 2025-12-04 16:12 UTC (permalink / raw)
To: syzbot+527a7e48a3d3d315d862; +Cc: linux-block, linux-kernel, syzkaller-bugs
[-- Attachment #1: Type: text/plain, Size: 84 bytes --]
#syz test:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
[-- Attachment #2: 0001-block-fix-memory-leak-in-__blkdev_issue_zero_pages.patch --]
[-- Type: text/x-patch, Size: 1463 bytes --]
From 79fe005d08f4f81f422a371fd7d4d3cd2580a65f Mon Sep 17 00:00:00 2001
From: Shaurya Rane <ssrane_b23@ee.vjti.ac.in>
Date: Thu, 4 Dec 2025 21:38:51 +0530
Subject: [PATCH] block: fix memory leak in __blkdev_issue_zero_pages
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 <ssrane_b23@ee.vjti.ac.in>
---
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;
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [syzbot] [block?] [udf?] memory leak in __blkdev_issue_zero_pages
2025-12-04 16:12 ` shaurya
@ 2025-12-04 17:28 ` syzbot
2025-12-04 17:55 ` Keith Busch
2025-12-05 8:15 ` Hannes Reinecke
2 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2025-12-04 17:28 UTC (permalink / raw)
To: linux-block, linux-kernel, ssranevjti, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-by: syzbot+527a7e48a3d3d315d862@syzkaller.appspotmail.com
Tested-by: syzbot+527a7e48a3d3d315d862@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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [syzbot] [block?] [udf?] memory leak in __blkdev_issue_zero_pages
2025-12-04 16:12 ` shaurya
2025-12-04 17:28 ` syzbot
@ 2025-12-04 17:55 ` Keith Busch
2025-12-05 8:15 ` Hannes Reinecke
2 siblings, 0 replies; 5+ messages in thread
From: Keith Busch @ 2025-12-04 17:55 UTC (permalink / raw)
To: shaurya
Cc: syzbot+527a7e48a3d3d315d862, linux-block, linux-kernel,
syzkaller-bugs
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 <ssrane_b23@ee.vjti.ac.in>
Looks good.
Reviewed-by: Keith Busch <kbusch@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;
>
> --
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [syzbot] [block?] [udf?] memory leak in __blkdev_issue_zero_pages
2025-12-04 16:12 ` shaurya
2025-12-04 17:28 ` syzbot
2025-12-04 17:55 ` Keith Busch
@ 2025-12-05 8:15 ` Hannes Reinecke
2 siblings, 0 replies; 5+ messages in thread
From: Hannes Reinecke @ 2025-12-05 8:15 UTC (permalink / raw)
To: shaurya, syzbot+527a7e48a3d3d315d862
Cc: linux-block, linux-kernel, syzkaller-bugs
On 12/4/25 17:12, shaurya wrote:
> #syz test:
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>
Please send the patch as the mail body, not as attachment.
Otherwise bots will have issues picking it up properly.
Other than that:
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-12-05 8:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-04 15:42 [syzbot] [block?] [udf?] memory leak in __blkdev_issue_zero_pages syzbot
2025-12-04 16:12 ` shaurya
2025-12-04 17:28 ` syzbot
2025-12-04 17:55 ` Keith Busch
2025-12-05 8:15 ` Hannes Reinecke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox