From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68FD6606A32D for ; Thu, 3 Dec 2026 16:34:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=jqC7A45B; dkim=pass (2048-bit key) header.d=asu.edu header.i=@asu.edu header.a=rsa-sha256 header.s=google header.b=F+1Sz/tj DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:Cc:To:From:Date: Message-ID:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Unsubscribe-Post:List-Owner; bh=/fHjPSJkYTrJkku0xt20upP9Nkdh3O8BXgISgA24/x0=; b=jqC7A45BO2n719H6LHf3HpaNBd IvTirdkK6se9MFau5K1JswoxiXMms6mxWf4FZ3Se5UBb7Ff2SAgttZSoB7klSyTL0H7UP564PcvUt KtQnZMrm6hpBzC+f/oLB0baNUibaRxiU0g1anbrT/SB7gnElq9U0KRG2zh0/wKH5LsZ4mPCWHrFV7 /KRYPQ8elU+GHYRQc+nFPyHVNSm8Zsd8LxieOJu/q1pV31T7/naNFzQDLhbQ1jQjqH+rrhJOGLJ3b xv6vG4Y7z5DayocJqqsAPtRVsIQAd3gMHf3RI9hFmu3FUV02SUt8l104+obVDthux2gCY03iMTKT/ fAb9BqqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ9kw-0000000FISJ-1Qbr; Thu, 03 Dec 2026 16:34:02 +0000 Received: from mail-dy1-x1335.google.com ([2607:f8b0:4864:20::1335]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ9kr-0000000FIQx-0vqy for linux-nvme@lists.infradead.org; Thu, 03 Dec 2026 16:33:59 +0000 Received: by mail-dy1-x1335.google.com with SMTP id 5a478bee46e88-3874e580e2cso31212eec.3 for ; Thu, 03 Dec 2026 08:33:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=asu.edu; s=google; t=1796315636; x=1796920436; darn=lists.infradead.org; h=subject:cc:to:from:date:message-id:from:to:cc:subject:date :message-id:reply-to:content-type; bh=/fHjPSJkYTrJkku0xt20upP9Nkdh3O8BXgISgA24/x0=; b=F+1Sz/tjwJUJpi45m/Uzez8uxKMdYc6SujFpUlqMKSPXKw3p5WAUV1q1zUmGZeiHrf q1JUsqoF2fMsFFLW4uujpajr6bRLcUVEog6ulefp9PSThQzCXTFl7VP+AN396B0Ox1lR b0MxD/1/uSFZ66glR0Yt+5CYOdZmZY49aJjmeUWU+9twTovQTV/C4FgnKnWm0xdrSwX6 ZYWYQiFWMtxaI7EV5O6TpOWpOsHABl6aR/1xIwWVomuiGnoZeaEtTgnRL67Tsw8Tr3z0 HB5TGAuw2ugp3oSzJoHGHzyzI/3t8a1XSnmd+aEUxNHH9dVbuNEtV+o8Xlf+dgc2c6T1 lHmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796315636; x=1796920436; h=subject:cc:to:from:date:message-id:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=/fHjPSJkYTrJkku0xt20upP9Nkdh3O8BXgISgA24/x0=; b=wd0L83VD+tyHIcAqakaXlHKM+w8UyuPZ/QC5a7RlclH9qp63HTk65l2np9KnBMx0Oo d8RU941bOyA8u08rEBXCapjL7su8bJ8y6TgtvFAFlZepAM+JYytL/cp89fgcJ+GmfBTR x6yiDHH5jz0+qU9jFUclRTFX6dK6PIl8q/Phm7yni1GvKIAladXo129gL+0OLQRAPHf6 T2++z15y5Z5WsQor7F0Pde70Q2WNh3cOYgjkj2m+goACAHNz3PHh0d62chVHBkjLkAAm VmkFM4ABhf1vygcs1L0pLpcerdu5cNXG67C1AJ14NvXBtt2N4sCA3ehGK1Mf9oFeUmzq msuQ== X-Gm-Message-State: APuU4Z91A6WSvt9a1lEAHRtEiUfntu02Y/YFIVm4IjJbFtUTf5OwFIrQ 2pTboggF9wUHJGr1v+UIyG0Q2WaFwUGgSyOtyvBjT0Ypj5KuErWMRP0XOt+zxni3L/wYUJtxqvH FzHqtpBE2 X-Gm-Gg: AZFdTZdBQYT0N4NKaW7xWoVn09B5KTeTbaVUMSyr7pbRIyAdovzIMaANKDkYGrsrPDT O38yEG3q7uv3FrIw3UE8bvLn1POqjF7uJwmQbsrleOH9n/pIL63ecF2F1db8AcDm9MVBXpMCFSW W58TCNlttUJ67U1BWaBH3RcXBd3iuow+G8naUl/ejcokdCyKMfp/ZROEX5Vzkv3ya6fxAZsZqED 4g88tJXHilHpmnppB0FkBHDTeLPUMKku7ea2StZETBhdp+mJHz4tADd+BMKsaA5stYkbB4mjRn5 UsYsndZE4y7loPhwcREGmRxmdKvSmDRjUn6ZhEBZ6lN10/ftCFI1eysJt79xqRYFxYso34/5bUg 7MS9KucmNjK/ydjFc1+z8psdqZRMCqzRUW/MfK4fETxDFbgNasInRKhciXvTIkMSzcOekeR8svN IjV93A/RKb62NuS0avRCSq5KH2r4D1HI5dKb3X3HVrvZ59GwM95HEX/p5jZ09Q6SjsRR3LwUzWV Xsi2jz0/ggJEfTbwBJFtW91eWF/7i7bG9Re8oPrvdOrrlH0DuCPZheSXKDg/3ANPr+q6xLbLZsC 7Q7ZEJLXVQ== X-Received: by 2002:a05:7300:54d1:b0:381:6297:8f99 with SMTP id 5a478bee46e88-38744c45f06mr3264619eec.2.1796315635430; Thu, 03 Dec 2026 08:33:55 -0800 (PST) Received: from 05-nvmet-configfs-strings.eml ([2607:fb91:4185:7cd1:d36:ab6e:2627:426c]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-386aaae4960sm93928743eec.18.2026.12.03.08.33.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 08:33:54 -0800 (PST) Message-ID: <6b1199f2.775eecd7.38754.d3de@mx.google.com> Date: Thu, 03 Dec 2026 08:33:54 -0800 (PST) From: Rahul Priolkar To: Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni Cc: linux-nvme@lists.infradead.org Subject: [BUG] nvmet: configfs string lifetime errors in local reads and discovery Identify X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261203_083357_283694_9E33AED5 X-CRM114-Status: UNSURE ( 7.98 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" X-Spam-Status: No, score=-5.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Hello, We first saw these KASAN reports on Linux v7.4-rc4 while configuring an NVMe target as root. We repeated the tests on v7.4-rc5 (fe6ff8d5d675) in an x86_64 KVM guest. We used nvme-loop for the host connection. On rc5, configfs reads of the model, firmware revision, device path and discovery NQN produced 68, 67, 66 and 175 KASAN reports respectively. These included use-after-free and out-of-bounds reads. The discovery controller also copied freed string data into its Identify response. KASAN reported 64 use-after-free reads in that test. We saw a separate use-after-free in nvmet_root_discovery_nqn_store() during subsystem removal, followed by a general protection fault and a guest panic. Each control ran for 60 seconds with the operations serialized and produced no KASAN report. The original rc4 traces below show a one-byte read while formatting the model string, a one-byte read from a freed 96-byte region during Identify, and an eight-byte read from a freed 1,024-byte region in the NQN writer. The writer's log also shows the general protection fault. Some of the saved logs end partway through a report. Model string read in configfs [ 19.790059][ T4404] BUG: KASAN: slab-use-after-free in string+0x216/0x2d0 [ 19.790082][ T4404] Read of size 1 at addr ffff88801eb89280 by task control-r4-nvme/4404 [ 19.790092][ T4404] [ 19.790099][ T4404] CPU: 1 UID: 0 PID: 4404 Comm: control-r4-nvme Not tainted 7.4.0-rc4 #2 PREEMPT(full) [ 19.790112][ T4404] Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 19.790120][ T4404] Call Trace: [ 19.790130][ T4404] [ 19.790135][ T4404] dump_stack_lvl+0xe8/0x150 [ 19.790183][ T4404] print_address_description+0x55/0x1e0 [ 19.790218][ T4404] print_report+0x58/0x70 [ 19.790239][ T4404] kasan_report+0x117/0x150 [ 19.790294][ T4404] string+0x216/0x2d0 [ 19.790309][ T4404] vsnprintf+0x74a/0xef0 [ 19.790328][ T4404] snprintf+0xe8/0x140 [ 19.790401][ T4404] nvmet_subsys_attr_model_show+0x54/0x60 [ 19.790445][ T4404] configfs_read_iter+0x2bc/0x630 [ 19.790472][ T4404] vfs_read+0x59a/0xa80 [ 19.790624][ T4404] ksys_read+0x155/0x270 [ 19.790670][ T4404] do_syscall_64+0x171/0x540 [ 19.790701][ T4404] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 19.790712][ T4404] RIP: 0033:0x457a82 [ 19.790726][ T4404] Code: 08 0f 85 11 e3 ff ff 49 89 fb 48 89 f0 48 89 d7 48 89 ce 4c 89 c2 4d 89 ca 4c 8b 44 24 08 4c 8b 4c 24 10 4c 89 5c 24 08 0f 05 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 55 48 89 e5 [ 19.790735][ T4404] RSP: 002b:00007ff19dd60118 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 [ 19.790749][ T4404] RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 0000000000457a82 [ 19.790757][ T4404] RDX: 0000000000000fff RSI: 00007ff19dd60150 RDI: 0000000000000005 [ 19.790764][ T4404] RBP: 00007ff19dd60140 R08: 0000000000000000 R09: 0000000000000000 [ 19.790772][ T4404] R10: 0000000000000000 R11: 0000000000000246 R12: 000000000049c0cc [ 19.790779][ T4404] R13: 00007ff19dd6014f R14: 0000000000000006 R15: 000000000049e778 [ 19.790798][ T4404] [ 19.790802][ T4404] [ 19.790804][ T4404] Allocated by task 4406: [ 19.790812][ T4404] kasan_save_track+0x3f/0x90 [ 19.790822][ T4404] __kasan_kmalloc+0x93/0xb0 [ 19.790832][ T4404] __kmalloc_node_track_caller_noprof+0x4db/0x750 [ 19.790855][ T4404] kmemdup_nul+0x3b/0x100 [ 19.790876][ T4404] nvmet_subsys_attr_model_store+0x172/0x290 [ 19.790888][ T4404] configfs_write_iter+0x33c/0x430 [ 19.790900][ T4404] vfs_write+0x617/0xba0 [ 19.790917][ T4404] __x64_sys_pwrite64+0x215/0x2d0 [ 19.790934][ T4404] do_syscall_64+0x171/0x540 [ 19.790947][ T4404] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 19.790958][ T4404] [ 19.790960][ T4404] Freed by task 4406: [ 19.790965][ T4404] kasan_save_track+0x3f/0x90 [ 19.790975][ T4404] kasan_save_free_info+0x40/0x50 [ 19.790990][ T4404] __kasan_slab_free+0x70/0x90 Discovery controller Identify response [ 22.099068][ T46] BUG: KASAN: slab-use-after-free in strnlen+0x66/0x90 [ 22.099090][ T46] Read of size 1 at addr ffff888023e248ab by task kworker/u16:2/46 [ 22.099099][ T46] [ 22.099104][ T46] CPU: 0 UID: 0 PID: 46 Comm: kworker/u16:2 Tainted: G B 7.4.0-rc4 #2 PREEMPT(full) [ 22.099120][ T46] Tainted: [B]=BAD_PAGE [ 22.099124][ T46] Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 22.099133][ T46] Workqueue: nvmet-wq nvme_loop_execute_work [ 22.099149][ T46] Call Trace: [ 22.099153][ T46] [ 22.099158][ T46] dump_stack_lvl+0xe8/0x150 [ 22.099177][ T46] print_address_description+0x55/0x1e0 [ 22.099215][ T46] print_report+0x58/0x70 [ 22.099230][ T46] kasan_report+0x117/0x150 [ 22.099271][ T46] strnlen+0x66/0x90 [ 22.099292][ T46] nvmet_execute_disc_identify+0x508/0x7a0 [ 22.099329][ T46] process_scheduled_works+0xc42/0x1630 [ 22.099437][ T46] worker_thread+0xa4c/0xfb0 [ 22.099467][ T46] kthread+0x390/0x480 [ 22.099515][ T46] ret_from_fork+0x519/0xb70 [ 22.099608][ T46] ret_from_fork_asm+0x1a/0x30 [ 22.099632][ T46] [ 22.099636][ T46] [ 22.099639][ T46] Allocated by task 4397: [ 22.099644][ T46] kasan_save_track+0x3f/0x90 [ 22.099654][ T46] __kasan_kmalloc+0x93/0xb0 [ 22.099665][ T46] __kmalloc_node_track_caller_noprof+0x4db/0x750 [ 22.099683][ T46] kstrndup+0x83/0x160 [ 22.099698][ T46] nvmet_root_discovery_nqn_store+0x6d/0x1a0 [ 22.099718][ T46] configfs_write_iter+0x33c/0x430 [ 22.099731][ T46] vfs_write+0x617/0xba0 [ 22.099747][ T46] __x64_sys_pwrite64+0x215/0x2d0 [ 22.099765][ T46] do_syscall_64+0x171/0x540 [ 22.099779][ T46] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 22.099790][ T46] [ 22.099793][ T46] Freed by task 4397: [ 22.099798][ T46] kasan_save_track+0x3f/0x90 [ 22.099808][ T46] kasan_save_free_info+0x40/0x50 [ 22.099824][ T46] __kasan_slab_free+0x70/0x90 [ 22.099835][ T46] kfree+0x1cc/0x650 [ 22.099849][ T46] nvmet_root_discovery_nqn_store+0x154/0x1a0 [ 22.099868][ T46] configfs_write_iter+0x33c/0x430 [ 22.099882][ T46] vfs_write+0x617/0xba0 [ 22.099902][ T46] __x64_sys_pwrite64+0x215/0x2d0 [ 22.099920][ T46] do_syscall_64+0x171/0x540 [ 22.099934][ T46] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 22.099945][ T46] [ 22.099948][ T46] The buggy address belongs to the object at ffff888023e24880 [ 22.099948][ T46] which belongs to the cache kmalloc-96 of size 96 [ 22.099957][ T46] The buggy address is located 43 bytes inside of [ 22.099957][ T46] freed 96-byte region [ffff888023e24880, ffff888023e248e0) [ 22.099969][ T46] [ 22.099972][ T46] The buggy address belongs to the physical page: [ 22.099977][ T46] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x23e24 [ 22.099986][ T46] flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) [ 22.099995][ T46] page_type: f5(slab) [ 22.100005][ T46] raw: 00fff00000000000 ffff88801bc42280 dead000000000100 dead000000000122 [ 22.100015][ T46] raw: 0000000000000000 0000000000200020 00000000f5000000 0000000000000000 [ 22.100022][ T46] page dumped because: kasan: bad access detected [ 22.100027][ T46] [ 22.100029][ T46] Memory state around the buggy address: [ 22.100035][ T46] ffff888023e24780: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc [ 22.100046][ T46] ffff888023e24800: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc [ 22.100054][ T46] >ffff888023e24880: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc [ 22.100061][ T46] ^ [ 22.100067][ T46] ffff888023e24900: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc [ 22.100075][ T46] ffff888023e24980: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc [ 22.100081][ T46] ================================================================== [ 22.100086][ T46] ================================================================== Discovery NQN update during subsystem removal [ 266.571996][ T4531] BUG: KASAN: slab-use-after-free in nvmet_root_discovery_nqn_store+0xab/0x1a0 [ 266.572017][ T4531] Read of size 8 at addr ffff88802cd5a970 by task control-r4-nvme/4531 [ 266.572027][ T4531] [ 266.572033][ T4531] CPU: 1 UID: 0 PID: 4531 Comm: control-r4-nvme Tainted: G B 7.4.0-rc4 #2 PREEMPT(full) [ 266.572048][ T4531] Tainted: [B]=BAD_PAGE [ 266.572053][ T4531] Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 266.572062][ T4531] Call Trace: [ 266.572066][ T4531] [ 266.572071][ T4531] dump_stack_lvl+0xe8/0x150 [ 266.572094][ T4531] print_address_description+0x55/0x1e0 [ 266.572130][ T4531] print_report+0x58/0x70 [ 266.572145][ T4531] kasan_report+0x117/0x150 [ 266.572187][ T4531] nvmet_root_discovery_nqn_store+0xab/0x1a0 [ 266.572229][ T4531] configfs_write_iter+0x33c/0x430 [ 266.572246][ T4531] vfs_write+0x617/0xba0 [ 266.572360][ T4531] __x64_sys_pwrite64+0x215/0x2d0 [ 266.572450][ T4531] do_syscall_64+0x171/0x540 [ 266.572482][ T4531] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 266.572495][ T4531] RIP: 0033:0x457a82 [ 266.572504][ T4531] Code: 08 0f 85 11 e3 ff ff 49 89 fb 48 89 f0 48 89 d7 48 89 ce 4c 89 c2 4d 89 ca 4c 8b 44 24 08 4c 8b 4c 24 10 4c 89 5c 24 08 0f 05 [ 266.572514][ T4531] RSP: 002b:00007fbb4ae10138 EFLAGS: 00000246 ORIG_RAX: 0000000000000012 [ 266.572526][ T4531] RAX: ffffffffffffffda RBX: 000000000000415d RCX: 0000000000457a82 [ 266.572535][ T4531] RDX: 000000000000005c RSI: 000000000049e928 RDI: 0000000000000004 [ 266.572543][ T4531] RBP: 00007fbb4ae10160 R08: 0000000000000000 R09: 0000000000000000 [ 266.572551][ T4531] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000004 [ 266.572558][ T4531] R13: 00000000004dec40 R14: 0000000000000011 R15: 00007ffe749667f7 [ 266.572577][ T4531] [ 266.572582][ T4531] [ 266.572585][ T4531] Allocated by task 4530: [ 266.572592][ T4531] kasan_save_track+0x3f/0x90 [ 266.572603][ T4531] __kasan_kmalloc+0x93/0xb0 [ 266.572614][ T4531] __kmalloc_cache_noprof+0x343/0x620 [ 266.572631][ T4531] nvmet_subsys_alloc+0xb4/0x6a0 [ 266.572648][ T4531] nvmet_subsys_make+0x9c/0x2d0 [ 266.572666][ T4531] configfs_mkdir+0x4fb/0x9e0 [ 266.572679][ T4531] vfs_mkdir+0x416/0x660 [ 266.572689][ T4531] filename_mkdirat+0x289/0x550 [ 266.572699][ T4531] __se_sys_mkdir+0x39/0x150 [ 266.572710][ T4531] do_syscall_64+0x171/0x540 [ 266.572728][ T4531] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 266.572740][ T4531] [ 266.572743][ T4531] Freed by task 4530: [ 266.572748][ T4531] kasan_save_track+0x3f/0x90 [ 266.572758][ T4531] kasan_save_free_info+0x40/0x50 [ 266.572774][ T4531] __kasan_slab_free+0x70/0x90 [ 266.572785][ T4531] kfree+0x1cc/0x650 [ 266.572799][ T4531] config_item_release+0x13f/0x2e0 [ 266.572816][ T4531] configfs_rmdir+0x88a/0x950 [ 266.572830][ T4531] vfs_rmdir+0x3eb/0x6f0 [ 266.572840][ T4531] filename_rmdir+0x27b/0x500 [ 266.572851][ T4531] __se_sys_rmdir+0x33/0x150 [ 266.572862][ T4531] do_syscall_64+0x171/0x540 [ 266.572876][ T4531] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 266.572888][ T4531] [ 266.572891][ T4531] The buggy address belongs to the object at ffff88802cd5a800 [ 266.572891][ T4531] which belongs to the cache kmalloc-1k of size 1024 [ 266.572901][ T4531] The buggy address is located 368 bytes inside of [ 266.572901][ T4531] freed 1024-byte region [ffff88802cd5a800, ffff88802cd5ac00) [ 266.572913][ T4531] [ 266.572917][ T4531] The buggy address belongs to the physical page: [ 266.572922][ T4531] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2cd58 [ 266.572932][ T4531] head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 [ 266.572941][ T4531] flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) [ 266.572954][ T4531] page_type: f5(slab) [ 266.572964][ T4531] raw: 00fff00000000040 ffff88801bc42dc0 dead000000000100 dead000000000122 [ 266.572974][ T4531] raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 [ 266.572986][ T4531] head: 00fff00000000040 ffff88801bc42dc0 dead000000000100 dead000000000122 [ 266.572997][ T4531] head: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 [ 266.573008][ T4531] head: 00fff00000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff [ 266.573019][ T4531] head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 [ 266.573026][ T4531] page dumped because: kasan: bad access detected [ 266.573031][ T4531] [ 266.573034][ T4531] Memory state around the buggy address: [ 266.573040][ T4531] ffff88802cd5a800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 266.573048][ T4531] ffff88802cd5a880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 266.573056][ T4531] >ffff88802cd5a900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 266.573063][ T4531] ^ [ 266.573070][ T4531] ffff88802cd5a980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 266.573078][ T4531] ffff88802cd5aa00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 266.573085][ T4531] ================================================================== [ 266.573090][ T4531] ================================================================== [ 266.574247][ T4531] Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP KASAN NOPTI [ 266.794766][ T4531] KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] [ 266.795877][ T4531] CPU: 1 UID: 0 PID: 4531 Comm: control-r4-nvme Tainted: G B 7.4.0-rc4 #2 PREEMPT(full) [ 266.797358][ T4531] Tainted: [B]=BAD_PAGE [ 266.797922][ T4531] Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 266.799523][ T4531] RIP: 0010:strncmp+0x32/0xe0 [ 266.800172][ T4531] Code: 56 41 55 41 54 53 48 85 d2 0f 84 a3 00 00 00 48 bb 00 00 00 00 00 fc ff df 48 ff ca 45 31 f6 4a 8d 04 37 48 89 c1 48 c1 e9 03 <0f> [ 266.802714][ T4531] RSP: 0018:ffffc9000367fbe8 EFLAGS: 00010256 [ 266.803532][ T4531] RAX: 0000000000000000 RBX: dffffc0000000000 RCX: 0000000000000000 [ 266.804699][ T4531] RDX: 000000000000005b RSI: ffff88802d852000 RDI: 0000000000000000 [ 266.805753][ T4531] RBP: dffffc0000000000 R08: ffffffff943330c7 R09: 1ffffffff2866618 [ 266.806796][ T4531] R10: dffffc0000000000 R11: fffffbfff2866619 R12: ffff88802cd5a970 [ 266.807840][ T4531] R13: 0000000000000000 R14: 0000000000000000 R15: ffff88802d852000 [ 266.808889][ T4531] FS: 00007fbb4ae106c0(0000) GS:ffff88810d5b4000(0000) knlGS:0000000000000000 [ 266.810069][ T4531] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 266.810938][ T4531] CR2: 000000000060d106 CR3: 0000000028400000 CR4: 0000000000750ef0 [ 266.811985][ T4531] PKRU: 55555554 [ 266.812464][ T4531] Call Trace: [ 266.812914][ T4531] [ 266.813315][ T4531] nvmet_root_discovery_nqn_store+0xe4/0x1a0 [ 266.815014][ T4531] configfs_write_iter+0x33c/0x430 [ 266.815707][ T4531] vfs_write+0x617/0xba0 [ 266.819654][ T4531] __x64_sys_pwrite64+0x215/0x2d0 [ 266.823265][ T4531] do_syscall_64+0x171/0x540 Additional Identify and discovery NQN traces BUG: KASAN: slab-use-after-free in strnlen+0x66/0x90 Read of size 1 at addr ffff888028d8841f by task kworker/u16:1/4550 CPU: 1 UID: 0 PID: 4550 Comm: kworker/u16:1 Tainted: G B 7.4.0-rc4 #2 PREEMPT(full) Tainted: [B]=BAD_PAGE Workqueue: nvmet-wq nvme_loop_execute_work Call Trace: strnlen+0x66/0x90 nvmet_execute_disc_identify+0x508/0x7a0 process_scheduled_works+0xc42/0x1630 worker_thread+0xa4c/0xfb0 kthread+0x390/0x480 ret_from_fork+0x519/0xb70 ret_from_fork_asm+0x1a/0x30 Allocated by task 4570: __kmalloc_node_track_caller_noprof+0x4db/0x750 kstrndup+0x83/0x160 nvmet_root_discovery_nqn_store+0x6d/0x1a0 configfs_write_iter+0x33c/0x430 vfs_write+0x617/0xba0 __x64_sys_pwrite64+0x215/0x2d0 do_syscall_64+0x171/0x540 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 4570: kfree+0x1cc/0x650 nvmet_root_discovery_nqn_store+0x154/0x1a0 configfs_write_iter+0x33c/0x430 vfs_write+0x617/0xba0 __x64_sys_pwrite64+0x215/0x2d0 do_syscall_64+0x171/0x540 entry_SYSCALL_64_after_hwframe+0x77/0x7f BUG: KASAN: slab-use-after-free in nvmet_root_discovery_nqn_store+0xab/0x1a0 Read of size 8 at addr ffff88802b1ad170 by task control-nvmet-c/4410 CPU: 3 UID: 0 PID: 4410 Comm: control-nvmet-c Tainted: G B 7.4.0-rc4 #2 PREEMPT(full) Tainted: [B]=BAD_PAGE Call Trace: nvmet_root_discovery_nqn_store+0xab/0x1a0 configfs_write_iter+0x33c/0x430 vfs_write+0x617/0xba0 __x64_sys_pwrite64+0x215/0x2d0 do_syscall_64+0x171/0x540 entry_SYSCALL_64_after_hwframe+0x77/0x7f Allocated by task 4409: __kmalloc_cache_noprof+0x343/0x620 nvmet_subsys_alloc+0xb4/0x6a0 nvmet_subsys_make+0x9c/0x2d0 configfs_mkdir+0x4fb/0x9e0 vfs_mkdir+0x416/0x660 filename_mkdirat+0x289/0x550 __se_sys_mkdir+0x39/0x150 do_syscall_64+0x171/0x540 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 4409: Can you confirm these findings in nvmet? Thanks, Rahul Priolkar