All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Vasiliy Kovalev <kovalev@altlinux.org>
Cc: Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@kernel.org>,
	Mikulas Patocka <mpatocka@redhat.com>,
	Benjamin Marzinski <bmarzins@redhat.com>,
	dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
	lvc-project@linuxtesting.org
Subject: Re: [PATCH] dm-verity: give each FEC buffer slab cache a unique name
Date: Sun, 29 Nov 2026 15:34:37 -0800	[thread overview]
Message-ID: <20261129233437.GE2118@sol> (raw)
In-Reply-To: <20261120185123.614550-1-kovalev@altlinux.org>

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@vger.kernel.org
> Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
> ---
> 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@kernel.org>

- Eric

      reply	other threads:[~2026-11-29 23:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 18:51 [PATCH] dm-verity: give each FEC buffer slab cache a unique name Vasiliy Kovalev
2026-11-29 23:34 ` Eric Biggers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261129233437.GE2118@sol \
    --to=ebiggers@kernel.org \
    --cc=agk@redhat.com \
    --cc=bmarzins@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=kovalev@altlinux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=mpatocka@redhat.com \
    --cc=snitzer@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.