[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <qg2tmzw5me43idoal3egqtr5i6rdizhxsaybtsesahec3lrrus@3ccq3qtarfyj>
Date: Fri, 05 Dec 2025 07:55:02 +0000
From: Maciej Wieczór-Retman <m.wieczorretman@...me>
To: Andrey Konovalov <andreyknvl@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, Andrey Ryabinin <ryabinin.a.a@...il.com>, Alexander Potapenko <glider@...gle.com>, Dmitry Vyukov <dvyukov@...gle.com>, Vincenzo Frascino <vincenzo.frascino@....com>, Marco Elver <elver@...gle.com>, jiayuan.chen@...ux.dev, stable@...r.kernel.org, Maciej Wieczor-Retman <maciej.wieczor-retman@...el.com>, kasan-dev@...glegroups.com, linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 3/3] kasan: Unpoison vms[area] addresses with a common tag
Thanks for checking the patches out, do you want me to send v4 with this
correction or is it redundant now that Andrew already wrote it?
Kind regards
Maciej Wieczór-Retman
On 2025-12-05 at 04:38:27 +0100, Andrey Konovalov wrote:
>On Fri, Dec 5, 2025 at 4:22 AM Andrew Morton <akpm@...ux-foundation.org> wrote:
>>
>> On Fri, 5 Dec 2025 02:09:06 +0100 Andrey Konovalov <andreyknvl@...il.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!
Powered by blists - more mailing lists