linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Jiayuan Chen" <jiayuan.chen@linux.dev>
To: "Kees Cook" <kees@kernel.org>
Cc: linux-mm@kvack.org,
	syzbot+997752115a851cb0cf36@syzkaller.appspotmail.com,
	"Andrey Ryabinin" <ryabinin.a.a@gmail.com>,
	"Alexander Potapenko" <glider@google.com>,
	"Andrey Konovalov" <andreyknvl@gmail.com>,
	"Dmitry Vyukov" <dvyukov@google.com>,
	"Vincenzo Frascino" <vincenzo.frascino@arm.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Uladzislau Rezki" <urezki@gmail.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] mm/kasan: Fix incorrect unpoisoning in vrealloc for KASAN
Date: Wed, 03 Dec 2025 01:29:36 +0000	[thread overview]
Message-ID: <e5e5bb62c5a40d2673cc1233860143571aab9d12@linux.dev> (raw)
In-Reply-To: <202512021522.7888E2B6@keescook>

2025/12/3 07:23, "Kees Cook" <kees@kernel.org mailto:kees@kernel.org?to=%22Kees%20Cook%22%20%3Ckees%40kernel.org%3E > wrote:


> 
> On Fri, Nov 28, 2025 at 07:15:14PM +0800, Jiayuan Chen wrote:
> 
> > 
> > Syzkaller reported a memory out-of-bounds bug [1]. This patch fixes two
> >  issues:
> >  
> >  1. In vrealloc, we were missing the KASAN_VMALLOC_VM_ALLOC flag when
> >  unpoisoning the extended region. This flag is required to correctly
> >  associate the allocation with KASAN's vmalloc tracking.
> >  
> >  Note: In contrast, vzalloc (via __vmalloc_node_range_noprof) explicitly
> >  sets KASAN_VMALLOC_VM_ALLOC and calls kasan_unpoison_vmalloc() with it.
> >  vrealloc must behave consistently — especially when reusing existing
> >  vmalloc regions — to ensure KASAN can track allocations correctly.
> >  
> >  2. When vrealloc reuses an existing vmalloc region (without allocating new
> >  pages), KASAN previously generated a new tag, which broke tag-based
> >  memory access tracking. We now add a 'reuse_tag' parameter to
> >  __kasan_unpoison_vmalloc() to preserve the original tag in such cases.
> >  
> >  A new helper kasan_unpoison_vralloc() is introduced to handle this reuse
> >  scenario, ensuring consistent tag behavior during reallocation.
> >  
> >  [1]: https://syzkaller.appspot.com/bug?extid=997752115a851cb0cf36
> >  
> >  Fixes: a0309faf1cb0 ("mm: vmalloc: support more granular vrealloc() sizing")
> > 
> Is this the right Fixes tag? I didn't change the kasan logic meaningfully
> in the above patch, perhaps it should be commit d699440f58ce ("mm:
> fix vrealloc()'s KASAN poisoning logic")


The tag you provide is about shrinking but the issue I encountered was about
expanding(Grow the vm_area) and kasan_unpoison_vmalloc() didn't work well with expanding.

Thanks.


  reply	other threads:[~2025-12-03  1:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20251128111516.244497-1-jiayuan.chen@linux.dev>
2025-12-02 20:48 ` [PATCH v1] mm/kasan: Fix incorrect unpoisoning in vrealloc for KASAN Maciej Wieczor-Retman
2025-12-03  2:05   ` Jiayuan Chen
2025-12-02 23:23 ` Kees Cook
2025-12-03  1:29   ` Jiayuan Chen [this message]
2025-12-03  7:30 Maciej Wieczór-Retman
  -- strict thread matches above, loose matches on Subject: below --
2025-12-04 13:55 Maciej Wieczor-Retman
2025-12-04 14:38 ` Jiayuan Chen
2025-12-04 15:06   ` Andrey Konovalov
2025-12-04 15:35     ` Jiayuan Chen
2025-12-04 15:19   ` Maciej Wieczor-Retman

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=e5e5bb62c5a40d2673cc1233860143571aab9d12@linux.dev \
    --to=jiayuan.chen@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=dakr@kernel.org \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ryabinin.a.a@gmail.com \
    --cc=syzbot+997752115a851cb0cf36@syzkaller.appspotmail.com \
    --cc=urezki@gmail.com \
    --cc=vincenzo.frascino@arm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).