From patchwork Fri Mar 25 01:13:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12791190 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 426CBC433EF for ; Fri, 25 Mar 2022 01:13:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C63318D0030; Thu, 24 Mar 2022 21:13:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C12058D0005; Thu, 24 Mar 2022 21:13:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AB3528D0030; Thu, 24 Mar 2022 21:13:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 9B96B8D0005 for ; Thu, 24 Mar 2022 21:13:07 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 7A926803EF for ; Fri, 25 Mar 2022 01:13:07 +0000 (UTC) X-FDA: 79281134814.06.A494655 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf06.hostedemail.com (Postfix) with ESMTP id 0091F180007 for ; Fri, 25 Mar 2022 01:13:06 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9BE63B82707; Fri, 25 Mar 2022 01:13:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5196CC340EE; Fri, 25 Mar 2022 01:13:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1648170784; bh=sBga4iICZt57zQq9x4WZawmwLtWQKl78sRfaOI+sIYI=; h=Date:To:From:In-Reply-To:Subject:From; b=wJcc2VQ5MeS2QdDxJu0jRgQhntVPnzXIhQ3A3GUy0bQQ+nNrrzYz+mHQSWV7s2FWu z0qNpGGqFAB95OM7MEaOCyf1E7xh6GEHIGIjt3Zd7I7DaCSY1K6Och6l9jpfTRIKGE VJgKZOZXM4uBjId59OVNQV5lDnIlZrHJ0CO7RY6U= Date: Thu, 24 Mar 2022 18:13:03 -0700 To: ryabinin.a.a@gmail.com,glider@google.com,elver@google.com,dvyukov@google.com,andreyknvl@google.com,akpm@linux-foundation.org,patches@lists.linux.dev,linux-mm@kvack.org,mm-commits@vger.kernel.org,torvalds@linux-foundation.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20220324180758.96b1ac7e17675d6bc474485e@linux-foundation.org> Subject: [patch 090/114] kasan: add comment about UACCESS regions to kasan_report Message-Id: <20220325011304.5196CC340EE@smtp.kernel.org> X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 0091F180007 X-Stat-Signature: bsf31un49bpftt9a4m7f8kp7bb3drw7q Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=wJcc2VQ5; dmarc=none; spf=pass (imf06.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspam-User: X-HE-Tag: 1648170786-410579 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000029, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Andrey Konovalov Subject: 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 --- mm/kasan/report.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/mm/kasan/report.c~kasan-add-comment-about-uaccess-regions-to-kasan_report +++ a/mm/kasan/report.c @@ -430,6 +430,11 @@ void kasan_report_invalid_free(void *ptr 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) {