lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aaf80bb6-ad8a-4d11-b8bf-a91168ae6a08@suse.cz>
Date: Wed, 10 Dec 2025 13:58:02 +0100
From: Vlastimil Babka <vbabka@...e.cz>
To: Deepanshu Kartikey <kartikey406@...il.com>, akpm@...ux-foundation.org,
 cl@...two.org, rientjes@...gle.com, roman.gushchin@...ux.dev,
 harry.yoo@...cle.com, ast@...nel.org
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
 syzbot+7a25305a76d872abcfa1@...kaller.appspotmail.com
Subject: Re: [PATCH] mm/slub: reset KASAN tag in defer_free() before accessing
 freed memory

On 12/10/25 03:20, Deepanshu Kartikey wrote:
> 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().")
> Reported-by: syzbot+7a25305a76d872abcfa1@...kaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=7a25305a76d872abcfa1
> Tested-by: syzbot+7a25305a76d872abcfa1@...kaller.appspotmail.com
> Signed-off-by: Deepanshu Kartikey <kartikey406@...il.com>

Thanks, added cc: stable and pushed to slab/for-next-fixes

> ---
>  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 *head)
>  
>  	guard(preempt)();
>  
> +	head = kasan_reset_tag(head);
> +
>  	df = this_cpu_ptr(&defer_free_objects);
>  	if (llist_add(head + s->offset, &df->objects))
>  		irq_work_queue(&df->work);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ