Skip to contentSkip to conversation

WARNING in create_strip_zones

syzbot In review syzbot 4 participants 6 messages Mar 8 – Apr 7

Subsystems (2)
lore
Share & tools
lore

syzbot

author syzbot
#0 lore raw

Hello,

syzbot found the following issue on:

HEAD commit:    ecc64d2dc9ff Merge tag 'sysctl-7.00-fixes-rc3' of git://gi..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=11667006580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=976ba5a93c4add9e
dashboard link: https://syzkaller.appspot.com/bug?extid=924649752adf0d3ac9dd
compiler:       gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/d900f083ada3/non_bootable_disk-ecc64d2d.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/69399e740888/vmlinux-ecc64d2d.xz
kernel image: https://storage.googleapis.com/syzbot-assets/bc08c6900a4a/bzImage-ecc64d2d.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:

Reported-by [email protected]
------------[ cut here ]------------
1
WARNING: mm/page_alloc.c:5226 at __alloc_frozen_pages_noprof+0x23ea/0x2ba0 mm/page_alloc.c:5226, CPU#3: syz.7.23364/10844
Modules linked in:
CPU: 3 UID: 0 PID: 10844 Comm: syz.7.23364 Tainted: G             L      syzkaller #0 PREEMPT(full) 
Tainted: [L]=SOFTLOCKUP
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:__alloc_frozen_pages_noprof+0x23ea/0x2ba0 mm/page_alloc.c:5226
Code: 00 45 31 c9 49 83 bc 24 70 05 00 00 00 4c 89 4c 24 50 0f 85 5f f8 ff ff c6 44 24 10 00 e9 f3 ea ff ff c6 05 d4 93 5a 0e 01 90 <0f> 0b 90 e9 69 df ff ff 83 7c 24 40 03 41 bc 04 00 00 00 7f 06 41
RSP: 0018:ffffc900050b75f8 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000011 RDI: 0000000000040dc0
RBP: 0000000000000011 R08: 0000000000000005 R09: 0000000000000009
R10: 0000000000000011 R11: 0000000000000000 R12: 0000000000040dc0
R13: 1ffff92000a16f0e R14: 0000000000000011 R15: 1ffff92000a16ed8
FS:  00007f782a8cc6c0(0000) GS:ffff8880d6645000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000200000000040 CR3: 000000003e49e000 CR4: 0000000000352ef0
DR0: ffffffffffffffff DR1: 00000000000001f8 DR2: 0000000000000083
DR3: ffffffffefffff15 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2484
 ___kmalloc_large_node+0x104/0x150 mm/slub.c:5179
 __kmalloc_large_node_noprof+0x1c/0x70 mm/slub.c:5210
 __do_kmalloc_node mm/slub.c:5226 [inline]
 __kmalloc_noprof+0x5be/0x850 mm/slub.c:5250
 kmalloc_noprof include/linux/slab.h:954 [inline]
 kzalloc_noprof include/linux/slab.h:1188 [inline]
 create_strip_zones+0x56b/0x1f90 drivers/md/raid0.c:149
 raid0_run+0x341/0x410 drivers/md/raid0.c:421
 md_run+0xc2f/0x24b0 drivers/md/md.c:6601
 do_md_run+0x36/0x660 drivers/md/md.c:6698
 md_ioctl+0x27b2/0x37b0 drivers/md/md.c:8321
 blkdev_ioctl+0x5ad/0x6f0 block/ioctl.c:804
 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+0x18e/0x210 fs/ioctl.c:583
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x106/0xf80 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f782999c799
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f782a8cc028 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f7829c15fa0 RCX: 00007f782999c799
RDX: 0000200000000005 RSI: 00000000400c0930 RDI: 0000000000000004
RBP: 00007f7829a32bd9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f7829c16038 R14: 00007f7829c15fa0 R15: 00007fff9111c658
 </TASK>

---
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 [email protected].

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 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

#1 lore raw

PATCH 1/1 md/raid0: use kvzalloc/kvfree for strip_zone and devlist allocations

syzbot reported a WARNING at mm/page_alloc.c:__alloc_frozen_pages_noprof() triggered by create_strip_zones() in the RAID0 driver.

When raid_disks is large, the allocation size exceeds MAX_PAGE_ORDER (4MB on x86), causing WARN_ON_ONCE_GFP(order > MAX_PAGE_ORDER).

Convert the strip_zone and devlist allocations from kzalloc/kzalloc_objs to kvzalloc/kvzalloc_objs, which first attempts a contiguous allocation with __GFP_NOWARN and then falls back to vmalloc for large sizes. Convert the corresponding kfree calls to kvfree.

Both arrays are pure metadata lookup tables (arrays of pointers and zone descriptors) accessed only via indexing, so they do not require physically contiguous memory.

---
 drivers/md/raid0.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/md/raid0.c +9 -9
index ef0045db409f..5e38a51e349a 100644
@@ -143,13 +143,13 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
 	}
 
 	err = -ENOMEM;
-	conf->strip_zone = kzalloc_objs(struct strip_zone, conf->nr_strip_zones);
+	conf->strip_zone = kvzalloc_objs(struct strip_zone, conf->nr_strip_zones);
 	if (!conf->strip_zone)
 		goto abort;
-	conf->devlist = kzalloc(array3_size(sizeof(struct md_rdev *),
-					    conf->nr_strip_zones,
-					    mddev->raid_disks),
-				GFP_KERNEL);
+	conf->devlist = kvzalloc(array3_size(sizeof(struct md_rdev *),
+					     conf->nr_strip_zones,
+					     mddev->raid_disks),
+				 GFP_KERNEL);
 	if (!conf->devlist)
 		goto abort;
 
@@ -291,8 +291,8 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
 
 	return 0;
 abort:
-	kfree(conf->strip_zone);
-	kfree(conf->devlist);
+	kvfree(conf->strip_zone);
+	kvfree(conf->devlist);
 	kfree(conf);
 	*private_conf = ERR_PTR(err);
 	return err;
@@ -373,8 +373,8 @@ static void raid0_free(struct mddev *mddev, void *priv)
 {
 	struct r0conf *conf = priv;
 
-	kfree(conf->strip_zone);
-	kfree(conf->devlist);
+	kvfree(conf->strip_zone);
+	kvfree(conf->devlist);
 	kfree(conf);
 }
 
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#2 lore raw

Re: [PATCH] md/raid0: use kvzalloc/kvfree for strip_zone and devlist allocations

Quoted 15 lines · Gregory Price

syzbot reported a WARNING at mm/page_alloc.c:__alloc_frozen_pages_noprof() triggered by create_strip_zones() in the RAID0 driver.

When raid_disks is large, the allocation size exceeds MAX_PAGE_ORDER (4MB on x86), causing WARN_ON_ONCE_GFP(order > MAX_PAGE_ORDER).

Convert the strip_zone and devlist allocations from kzalloc/kzalloc_objs to kvzalloc/kvzalloc_objs, which first attempts a contiguous allocation with __GFP_NOWARN and then falls back to vmalloc for large sizes. Convert the corresponding kfree calls to kvfree.

Both arrays are pure metadata lookup tables (arrays of pointers and zone descriptors) accessed only via indexing, so they do not require physically contiguous memory.

Quoted 5 lines
---
  drivers/md/raid0.c | 18 +++++++++---------
  1 file changed, 9 insertions(+), 9 deletions(-)
Signature · 2 lines
Thansk,
Kuai
Reviewed-by on v1 1/1
#3 lore raw

Re: [PATCH] md/raid0: use kvzalloc/kvfree for strip_zone and devlist allocations

In reply to Gregory Price
Quoted 56 lines · Gregory Price

syzbot reported a WARNING at mm/page_alloc.c:__alloc_frozen_pages_noprof() triggered by create_strip_zones() in the RAID0 driver.

When raid_disks is large, the allocation size exceeds MAX_PAGE_ORDER (4MB on x86), causing WARN_ON_ONCE_GFP(order > MAX_PAGE_ORDER).

Convert the strip_zone and devlist allocations from kzalloc/kzalloc_objs to kvzalloc/kvzalloc_objs, which first attempts a contiguous allocation with __GFP_NOWARN and then falls back to vmalloc for large sizes. Convert the corresponding kfree calls to kvfree.

Both arrays are pure metadata lookup tables (arrays of pointers and zone descriptors) accessed only via indexing, so they do not require physically contiguous memory.

---
  drivers/md/raid0.c | 18 +++++++++---------
  1 file changed, 9 insertions(+), 9 deletions(-)
drivers/md/raid0.c +7 -7
index ef0045db409f..5e38a51e349a 100644
@@ -143,13 +143,13 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
  	}
 
  	err = -ENOMEM;
-	conf->strip_zone = kzalloc_objs(struct strip_zone, conf->nr_strip_zones);
+	conf->strip_zone = kvzalloc_objs(struct strip_zone, conf->nr_strip_zones);
  	if (!conf->strip_zone)
  		goto abort;
-	conf->devlist = kzalloc(array3_size(sizeof(struct md_rdev *),
-					    conf->nr_strip_zones,
-					    mddev->raid_disks),
-				GFP_KERNEL);
+	conf->devlist = kvzalloc(array3_size(sizeof(struct md_rdev *),
+					     conf->nr_strip_zones,
+					     mddev->raid_disks),
+				 GFP_KERNEL);
  	if (!conf->devlist)
  		goto abort;
 
@@ -291,8 +291,8 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
 
  	return 0;
  abort:
-	kfree(conf->strip_zone);
-	kfree(conf->devlist);
+	kvfree(conf->strip_zone);
+	kvfree(conf->devlist);
  	kfree(conf);
  	*private_conf = ERR_PTR(err);
  	return err;

drivers/md/raid0.c static void raid0_free(struct mddev *mddev, void *priv) · line 380

Quoted 10 lines
drivers/md/raid0.c +2 -2
@@ -373,8 +373,8 @@ static void raid0_free(struct mddev *mddev, void *priv)
  {
  	struct r0conf *conf = priv;
 
-	kfree(conf->strip_zone);
-	kfree(conf->devlist);
+	kvfree(conf->strip_zone);
+	kvfree(conf->devlist);
  	kfree(conf);
  }
 

LGTM

Signature · 2 lines
Thanks,
Nan
#4 lore raw

Re: [PATCH] md/raid0: use kvzalloc/kvfree for strip_zone and devlist allocations

In reply to Gregory Price

Hi,

Quoted 11 lines · Gregory Price

syzbot reported a WARNING at mm/page_alloc.c:__alloc_frozen_pages_noprof() triggered by create_strip_zones() in the RAID0 driver.

When raid_disks is large, the allocation size exceeds MAX_PAGE_ORDER (4MB on x86), causing WARN_ON_ONCE_GFP(order > MAX_PAGE_ORDER).

Convert the strip_zone and devlist allocations from kzalloc/kzalloc_objs to kvzalloc/kvzalloc_objs, which first attempts a contiguous allocation with __GFP_NOWARN and then falls back to vmalloc for large sizes. Convert the corresponding kfree calls to kvfree.

Quoted 5 lines

Both arrays are pure metadata lookup tables (arrays of pointers and zone descriptors) accessed only via indexing, so they do not require physically contiguous memory.

Reported-by [email protected]

Reported-by should be followed by Closes tag, applied tom md-7.1 with following tag:

Closes [syzbot] [mm?] WARNING in create_strip_zones - syzbot <https://lore.kernel.org/all/[email protected]/> open here
Quoted 4 lines
---
  drivers/md/raid0.c | 18 +++++++++---------
  1 file changed, 9 insertions(+), 9 deletions(-)
Signature · 2 lines
Thansk,
Kuai
#5 lore raw

Re: [PATCH] md/raid0: use kvzalloc/kvfree for strip_zone and devlist allocations

Quoted 14 lines · Yu Kuai

Hi,

Quoted 11 lines · Gregory Price

syzbot reported a WARNING at mm/page_alloc.c:__alloc_frozen_pages_noprof() triggered by create_strip_zones() in the RAID0 driver.

When raid_disks is large, the allocation size exceeds MAX_PAGE_ORDER (4MB on x86), causing WARN_ON_ONCE_GFP(order > MAX_PAGE_ORDER).

Convert the strip_zone and devlist allocations from kzalloc/kzalloc_objs to kvzalloc/kvzalloc_objs, which first attempts a contiguous allocation with __GFP_NOWARN and then falls back to vmalloc for large sizes. Convert the corresponding kfree calls to kvfree.

Quoted 9 lines
Quoted 5 lines

Both arrays are pure metadata lookup tables (arrays of pointers and zone descriptors) accessed only via indexing, so they do not require physically contiguous memory.

Reported-by [email protected]

Reported-by should be followed by Closes tag, applied tom md-7.1 with following tag:

Closes [syzbot] [mm?] WARNING in create_strip_zones - syzbot <https://lore.kernel.org/all/[email protected]/> open here

Ah, gotcha, didn't realize there was automation here, first time i've poked at a syzbot report.

Thanks!

Quoted 8 lines
Quoted 4 lines
---
  drivers/md/raid0.c | 18 +++++++++---------
  1 file changed, 9 insertions(+), 9 deletions(-)
Signature · 2 lines
Thansk,
Kuai