Commit 736befd5 authored by Vincenzo Frascino's avatar Vincenzo Frascino
Browse files

mm: page_alloc: Untag page address in free_reserved_area()



free_reserved_area() memsets the pages belonging to a given memory area.
To do that retrieves the page address via page_address(). For the
architectures
that support KASAN the pointer to the page can be tagged as a result of
page_address() but the underlying memory untouched by any allocator.
This scenario causes a tag fault during the memset() operation.

Untag the address to avoid spurious faults.

Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Vincenzo Frascino's avatarVincenzo Frascino <vincenzo.frascino@arm.com>
parent 22bb9990
......@@ -7593,6 +7593,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