Commit 208b5ff9 authored by Vincenzo Frascino's avatar Vincenzo Frascino Committed by Stephen Rothwell
Browse files

kasan, mm: untag page address in free_reserved_area

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

Untag the address to avoid spurious faults.


Cc: Andrew Morton <>
Signed-off-by: Vincenzo Frascino's avatarVincenzo Frascino <>
Signed-off-by: default avatarAndrey Konovalov <>
Reviewed-by: default avatarAlexander Potapenko <>
Tested-by: Vincenzo Frascino's avatarVincenzo Frascino <>
Cc: Andrey Ryabinin <>
Cc: Branislav Rankov <>
Cc: Catalin Marinas <>
Cc: Dmitry Vyukov <>
Cc: Evgenii Stepanov <>
Cc: Kevin Brodsky <>
Cc: Marco Elver <>
Cc: Vasily Gorbik <>
Cc: Will Deacon <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarStephen Rothwell <>
parent c064a492
......@@ -7662,6 +7662,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);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment