On Fri, Dec 5, 2025 at 4:22 AM Andrew Morton akpm@linux-foundation.org wrote:
On Fri, 5 Dec 2025 02:09:06 +0100 Andrey Konovalov andreyknvl@gmail.com wrote:
--- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -591,11 +591,28 @@ void __kasan_unpoison_vmap_areas(struct vm_struct **vms, int nr_vms, unsigned long size; void *addr; int area;
u8 tag;/** If KASAN_VMALLOC_KEEP_TAG was set at this point, all vms[] pointers* would be unpoisoned with the KASAN_TAG_KERNEL which would disable* KASAN checks down the line.*/if (flags & KASAN_VMALLOC_KEEP_TAG) {I think we can do a WARN_ON() here: passing KASAN_VMALLOC_KEEP_TAG to this function would be a bug in KASAN annotations and thus a kernel bug. Therefore, printing a WARNING seems justified.
This?
--- a/mm/kasan/common.c~kasan-unpoison-vms-addresses-with-a-common-tag-fix +++ a/mm/kasan/common.c @@ -598,7 +598,7 @@ void __kasan_unpoison_vmap_areas(struct * would be unpoisoned with the KASAN_TAG_KERNEL which would disable * KASAN checks down the line. */
if (flags & KASAN_VMALLOC_KEEP_TAG) {
if (WARN_ON_ONCE(flags & KASAN_VMALLOC_KEEP_TAG)) { pr_warn("KASAN_VMALLOC_KEEP_TAG flag shouldn't be already set!\n"); return; }_
Can also drop pr_warn(), but this is fine too. Thanks!