From nobody Thu Dec 18 08:39:19 2025 Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2098523A9BD for ; Wed, 10 Dec 2025 01:44:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.70 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765331093; cv=none; b=jpKHe9Be7BNVJJXaVfI/iUFr3weaBZMvSvAlCxA6w8mXoLIGkdRtjhFKbebFl2t13dw8n3hjU4DqLe14IDz+A8L83QdLDQwAdrZQ4i+XsFdMxh5VuryEnOCZU3W7587oWz5dmWnpfgMD9/HQ4vXjgzwKTZC6a51EBe22kZ7XXm4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765331093; c=relaxed/simple; bh=d3RoWIFT68XGry7rUFhxBlX3tlVh0AHFky5nYEtqp4Q=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=dffOnzSoWop3pPOKadVGBvPbvRyMuHzoglVnrfisZd1YIaEyUJd7sQD8s8F5J5ENFGjTFPMdNu/LLa31f44yNzmRs0fOHrxer1Q3nnR2gT41uQvN95Q4x6BeF8+QdEoCKHR9U8H79YUt89k9fDDZjJ+F4EycnoamlAu0o9E4BLo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.210.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-ot1-f70.google.com with SMTP id 46e09a7af769-7cad1393ec8so52540a34.0 for ; Tue, 09 Dec 2025 17:44:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765331090; x=1765935890; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jY/0N/MVhVkjzsvJbv3ctd0ECMhKqcyo3/bmsKAQ0oY=; b=k4c0pHD4qJrD+HPObmxl2E65b2YKRduj5PGzbl38VYR/GmJNVyqn7vO41kKO8jaFaq Mv608bEMj1w/bLvpA/4XiobiXK0xhqqrlkIrdLn3BUL79oUNKjWhiRhuBzcO7C7SDxPF nOOJdkK3x94qJPboYve1KKzTOd0U5AQluJlspdioZ1YatRQEpPRdykoVJlldmx81LnvV O1vhMzzn0l8gPEttJw1Hp581AHHodLOU3qLvlm9BVupCzsJr31wCPY89SGvDZaQECXJE l4tJqwPI6XMDfDv4kbFaRC8fvt8+Lhug0LnbQQfkTfGmuEkq35owlk7/QNmxWRBeKR71 EAUw== X-Gm-Message-State: AOJu0YxvV49j8yxklgOOJslN0o/Rl+50TRUNIc9a0fW4bXKwtDuHVJmz bEoEuZjbH9lmUK2L0wZoaywzgPwlgpd4UGX+AV07XglOxJ+ziIsCvXinO0TNaJuHpily9YYDBwS pHd2ZuOa4og4RNFYhgUb2nQlgkCPhiGbg99oklboR3miSuIYlknqUkFo/SGs= X-Google-Smtp-Source: AGHT+IEAwLUO/GvrdKI8Caf+9HSrL9F2v7MnX7uA5bO+QeCL8nxHshuZSIHk3zZ1C67CGslhVZHIi6ZdJxyvI2g02hv4vksxW/UL Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:818b:b0:659:9a49:8f6f with SMTP id 006d021491bc7-65b2aca4ba2mr585383eaf.52.1765331090266; Tue, 09 Dec 2025 17:44:50 -0800 (PST) Date: Tue, 09 Dec 2025 17:44:50 -0800 In-Reply-To: <69369331.a70a0220.38f243.009c.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6938d092.050a0220.4004e.00bf.GAE@google.com> Subject: Forwarded: [PATCH] mm/slub: reset KASAN tag in defer_free() before accessing freed memory From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] mm/slub: reset KASAN tag in defer_free() before accessing = freed memory Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git= master When CONFIG_SLUB_TINY is enabled, kfree_nolock() calls kasan_slab_free() before defer_free(). On ARM64 with MTE (Memory Tagging Extension), kasan_slab_free() poisons the memory and changes the tag from the original (e.g., 0xf3) to a poison tag (0xfe). When defer_free() then tries to write to the freed object to build the deferred free list via llist_add(), the pointer still has the old tag, causing a tag mismatch and triggering a KASAN use-after-free report: BUG: KASAN: slab-use-after-free in defer_free+0x3c/0xbc mm/slub.c:6537 Write at addr f3f000000854f020 by task kworker/u8:6/983 Pointer tag: [f3], memory tag: [fe] Fix this by calling kasan_reset_tag() before accessing the freed memory. This is safe because defer_free() is part of the allocator itself and is expected to manipulate freed memory for bookkeeping purposes. Fixes: af92793e52c3 ("slab: Introduce kmalloc_nolock() and kfree_nolock()") Closes: https://syzkaller.appspot.com/bug?extid=3D7a25305a76d872abcfa1 Reported-by: syzbot+7a25305a76d872abcfa1@syzkaller.appspotmail.com Signed-off-by: Deepanshu Kartikey --- mm/slub.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/slub.c b/mm/slub.c index e6a330e24145..46959c6da2cf 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -6534,6 +6534,8 @@ static void defer_free(struct kmem_cache *s, void *he= ad) =20 guard(preempt)(); =20 + head =3D kasan_reset_tag(head); + df =3D this_cpu_ptr(&defer_free_objects); if (llist_add(head + s->offset, &df->objects)) irq_work_queue(&df->work); --=20 2.43.0