From: Andrey Konovalov Date: Fri, 25 Mar 2022 01:13:03 +0000 (-0700) Subject: kasan: add comment about UACCESS regions to kasan_report X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=795b760fe741c0b82508947e7b76803a2cdabd13;p=uclinux-h8%2Flinux.git kasan: add comment about UACCESS regions to kasan_report Add a comment explaining why kasan_report() is the only reporting function that uses user_access_save/restore(). Link: https://lkml.kernel.org/r/1201ca3c2be42c7bd077c53d2e46f4a51dd1476a.1646237226.git.andreyknvl@google.com Signed-off-by: Andrey Konovalov Cc: Alexander Potapenko Cc: Andrey Ryabinin Cc: Dmitry Vyukov Cc: Marco Elver Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/kasan/report.c b/mm/kasan/report.c index 7915af810815..08631d873204 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -430,6 +430,11 @@ void kasan_report_invalid_free(void *ptr, unsigned long ip) end_report(&flags, ptr); } +/* + * kasan_report() is the only reporting function that uses + * user_access_save/restore(): kasan_report_invalid_free() cannot be called + * from a UACCESS region, and kasan_report_async() is not used on x86. + */ bool kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip) {