[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAG_fn=Xc_OOtqE5Q-fFejBBCfLGtc_kOmZAuE1wdTsjCOmpQ4Q@mail.gmail.com>
Date: Wed, 18 Nov 2020 17:07:45 +0100
From: Alexander Potapenko <glider@...gle.com>
To: Andrey Konovalov <andreyknvl@...gle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will.deacon@....com>,
Vincenzo Frascino <vincenzo.frascino@....com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Marco Elver <elver@...gle.com>,
Evgenii Stepanov <eugenis@...gle.com>,
Branislav Rankov <Branislav.Rankov@....com>,
Kevin Brodsky <kevin.brodsky@....com>,
kasan-dev <kasan-dev@...glegroups.com>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Linux Memory Management List <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH mm v10 31/42] kasan, mm: untag page address in free_reserved_area
On Fri, Nov 13, 2020 at 11:17 PM Andrey Konovalov <andreyknvl@...gle.com> wrote:
>
> From: Vincenzo Frascino <vincenzo.frascino@....com>
>
> free_reserved_area() memsets the pages belonging to a given memory area.
> As that memory hasn't been allocated via page_alloc, the KASAN tags that
> those pages have are 0x00. As the result the memset might result in a tag
> mismatch.
>
> Untag the address to avoid spurious faults.
>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@....com>
> Signed-off-by: Andrey Konovalov <andreyknvl@...gle.com>
Reviewed-by: Alexander Potapenko <glider@...gle.com>
> ---
> Change-Id: If12b4944383575b8bbd7d971decbd7f04be6748b
> ---
> mm/page_alloc.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 855627e52f81..4a69fef13ac7 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -7653,6 +7653,11 @@ unsigned long free_reserved_area(void *start, void *end, int poison, const char
> * alias for the memset().
> */
> direct_map_addr = page_address(page);
> + /*
> + * Perform a kasan-unchecked memset() since this memory
> + * has not been initialized.
> + */
> + direct_map_addr = kasan_reset_tag(direct_map_addr);
> if ((unsigned int)poison <= 0xFF)
> memset(direct_map_addr, poison, PAGE_SIZE);
>
> --
> 2.29.2.299.gdc1121823c-goog
>
--
Alexander Potapenko
Software Engineer
Google Germany GmbH
Erika-Mann-Straße, 33
80636 München
Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Powered by blists - more mailing lists