From: Andrey Konovalov
mainline inclusion
from mainline-v5.12-rc7
commit 06b1f85588948bd4c772845e5d6891b8f6082248
category: bugfix
issue: #I3ZXZF
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
-------------------------------------------------
When page poisoning is enabled, it accesses memory that is marked as
poisoned by KASAN, which leas to false-positive KASAN reports.
Suppress the reports by adding KASAN annotations to unpoison_page()
(poison_page() already has them).
Link: https://lkml.kernel.org/r/2dc799014d31ac13fd97bd906bad33e16376fc67.161711850...
Signed-off-by: Andrey Konovalov
Cc: Alexander Potapenko
Cc: Marco Elver
Cc: Dmitry Vyukov
Cc: Andrey Ryabinin
Cc: Andrey Konovalov
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
Signed-off-by: Liu Shixin
Reviewed-by: tong tiangen
Signed-off-by: Chen Jun
Signed-off-by: Yu Changchun
---
mm/page_poison.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mm/page_poison.c b/mm/page_poison.c
index ae0482cded87..a08423cb11ca 100644
--- a/mm/page_poison.c
+++ b/mm/page_poison.c
@@ -108,12 +108,14 @@ static void unpoison_page(struct page *page)
void *addr;
addr = kmap_atomic(page);
+ kasan_disable_current();
/*
* Page poisoning when enabled poisons each and every page
* that is freed to buddy. Thus no extra check is done to
* see if a page was poisoned.
*/
- check_poison_mem(addr, PAGE_SIZE);
+ check_poison_mem(kasan_reset_tag(addr), PAGE_SIZE);
+ kasan_enable_current();
kunmap_atomic(addr);
}
--
2.22.0