Re: [PATCH] dm-verity: give each FEC buffer slab cache a unique name
From: Eric Biggers
Date: Sun Nov 29 2026 - 18:34:50 EST
On Fri, Nov 20, 2026 at 09:51:23PM +0300, Vasiliy Kovalev wrote:
> verity_fec_ctr() creates a slab cache for the FEC buffers of every
> verity target that uses FEC, always under the name
> "dm_verity_fec_buffers". With CONFIG_DEBUG_VM=y, as soon as two such
> targets exist at the same time, for example two FEC-enabled devices or
> a table reload of one, the second kmem_cache_create() trips the
> duplicate name check:
>
> kmem_cache of name 'dm_verity_fec_buffers' already exists
> WARNING: mm/slab_common.c:111 at kmem_cache_sanity_check mm/slab_common.c:111 [inline], CPU#2: syz.1.18/4545
> WARNING: mm/slab_common.c:111 at __kmem_cache_create_args+0xab/0x450 mm/slab_common.c:352, CPU#2: syz.1.18/4545
> Modules linked in:
> CPU: 2 UID: 0 PID: 4545 Comm: syz.1.18 Not tainted 7.4.0-rc1-next-20261104-alt-syz-box-drivers_md_bcache #1 PREEMPT(lazy)
> RIP: 0010:kmem_cache_sanity_check mm/slab_common.c:111 [inline]
> RIP: 0010:__kmem_cache_create_args+0xae/0x450 mm/slab_common.c:352
> Call Trace:
> <TASK>
> __kmem_cache_create include/linux/slab.h:402 [inline]
> verity_fec_ctr+0x9eb/0x1070 drivers/md/dm-verity-fec.c:709
> verity_ctr+0x1a6a/0x1ed0 drivers/md/dm-verity-target.c:1650
> dm_table_add_target+0x7c2/0xf30 drivers/md/dm-table.c:749
> populate_table drivers/md/dm-ioctl.c:1602 [inline]
> table_load+0x38b/0x910 drivers/md/dm-ioctl.c:1645
> ctl_ioctl+0x4d2/0xd70 drivers/md/dm-ioctl.c:2221
> dm_ctl_ioctl+0x1e/0x30 drivers/md/dm-ioctl.c:2243
> 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+0x18a/0x210 fs/ioctl.c:583
> do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
> do_syscall_64+0x112/0x630 arch/x86/entry/syscall_64.c:89
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
> RIP: 0033:0x00007f213c87a829
> </TASK>
>
> The buffer size depends on the number of RS roots of each target, so a
> single cache can't be created at module init. Append a unique sequence
> number to the name, as dm-bufio does. The slab core copies the name, so
> a stack buffer is enough.
>
> Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
>
> Fixes: 4c39529663b9 ("slab: Warn on duplicate cache names when DEBUG_VM=y")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Vasiliy Kovalev <kovalev@xxxxxxxxxxxx>
> ---
> With panic_on_warn the warning panics the kernel.
>
> drivers/md/dm-verity-fec.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
Reviewed-by: Eric Biggers <ebiggers@xxxxxxxxxx>
- Eric