Re: [PATCH] md: skip superblock validation for nonpersistent arrays
From: yu kuai
Date: Sat Nov 28 2026 - 20:26:25 EST
在 2026/11/17 12:49, Zheng Shuhao 写道:
> syzbot reported a KASAN slab-out-of-bounds read in
> super_90_validate() when adding a journal device to a nonpersistent
> 0.90-style RAID1 array.
>
> The reproducer creates a nonpersistent RAID1 array with 35 raid slots
> and then hot-adds a journal device. Nonpersistent arrays do not load an
> on-disk superblock for the new device, but add_bound_rdev() still calls
> validate_super() in the journal path.
>
> For 0.90 metadata, super_90_validate() indexes sb->disks using
> rdev->desc_nr. With 35 raid slots, this index can exceed the 27
> descriptors available in the 0.90 superblock, resulting in an
> out-of-bounds read even though there is no persistent superblock to
> validate.
>
> Skip validate_super() for nonpersistent arrays, while retaining
> hot_add_disk() for both persistent and nonpersistent arrays.
>
> Testing:
>
> - The original syzbot C reproducer triggered KASAN in the baseline
> kernel in 4 of 5 clean runs.
> - The patched kernel completed the same reproducer successfully in 3 of
> 3 runs without KASAN, BUG, Oops, or kernel panic.
> - Both baseline and patched kernels were built with KASAN,
> CONFIG_MD_RAID0, CONFIG_MD_RAID1, CONFIG_MD_RAID10,
> CONFIG_MD_RAID456, CONFIG_MD_LINEAR, and DEBUG_LIST enabled.
> - mdadm tests 00raid1, 02r1add, 20raid5journal, and
> 24raid456deadlock passed with the patched kernel.
> - A baseline-versus-patched run of the remaining targeted mdadm tests
> produced identical results: 4 passed, 10 failed, and 1 skipped on
> each kernel. The common failures are in persistent 0.90 byte-order
> handling and external DDF tests; no KASAN, Oops, BUG, or panic was
> observed.
> - 24raid10deadlock passed with CONFIG_FAULT_INJECTION,
> CONFIG_FAIL_MAKE_REQUEST, and CONFIG_FAULT_INJECTION_DEBUG_FS enabled.
>
> Reported-by:syzbot+c5969d7e0a934b384fd6@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes:https://syzkaller.appspot.com/bug?extid=c5969d7e0a934b384fd6
> Fixes: 87d4d91616e4 ("MD: add journal with array suspended")
> Signed-off-by: Zheng Shuhao<viennaoffh@xxxxxxxxx>
>
> ---
> drivers/md/md.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Applied
--
Thanks,
Kuai