Re: [PATCH v1] mm/kasan: Fix incorrect unpoisoning in vrealloc for KASAN

From: Jiayuan Chen
Date: Tue Dec 02 2025 - 21:05:29 EST


December 3, 2025 at 04:48, "Maciej Wieczor-Retman" <maciej.wieczor-retman@xxxxxxxxx mailto:maciej.wieczor-retman@xxxxxxxxx?to=%22Maciej%20Wieczor-Retman%22%20%3Cmaciej.wieczor-retman%40intel.com%3E > wrote:


>
> Hi, I'm working on [1]. As Andrew pointed out to me the patches are quite
> similar. I was wondering if you mind if the reuse_tag was an actual tag value?
> Instead of just bool toggling the usage of kasan_random_tag()?
>
> I tested the problem I'm seeing, with your patch and the tags end up being reset.
> That's because the vms[area] pointers that I want to unpoison don't have a tag
> set, but generating a different random tag for each vms[] pointer crashes the
> kernel down the line. So __kasan_unpoison_vmalloc() needs to be called on each
> one but with the same tag.
>
> Arguably I noticed my series also just resets the tags right now, but I'm
> working to correct it at the moment. I can send a fixed version tomorrow. Just
> wanted to ask if having __kasan_unpoison_vmalloc() set an actual predefined tag
> is a problem from your point of view?
>
> [1] https://lore.kernel.org/all/cover.1764685296.git.m.wieczorretman@xxxxx/
>


Hi Maciej,

It seems we're focusing on different issues, but feel free to reuse or modify the 'reuse_tag'.
It's intended to preserve the tag in one 'vma'.

I'd also be happy to help reproduce and test your changes to ensure the issue I encountered
isn't regressed once you send a patch based on mine.

Thanks.