From patchwork Wed Mar 2 16:36:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: andrey.konovalov@linux.dev X-Patchwork-Id: 12766311 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 821BAC433FE for ; Wed, 2 Mar 2022 16:40:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 94D728D0001; Wed, 2 Mar 2022 11:40:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8AE148D0007; Wed, 2 Mar 2022 11:40:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 684118D0003; Wed, 2 Mar 2022 11:40:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0230.hostedemail.com [216.40.44.230]) by kanga.kvack.org (Postfix) with ESMTP id 372318D0003 for ; Wed, 2 Mar 2022 11:40:05 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id E4844972FA for ; Wed, 2 Mar 2022 16:40:04 +0000 (UTC) X-FDA: 79200008328.16.9F1BF49 Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by imf13.hostedemail.com (Postfix) with ESMTP id 7790420008 for ; Wed, 2 Mar 2022 16:40:03 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1646239201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ujXTYxMun+rvpXDm65LBC0iIPgbPBoZhDfYPsPYRrpE=; b=Vvu6o+ZYKZCdbhIWypkrGDaSmrcli8fMm/9H1fIRIwfZo46g18kv3aPNPhnQ4oiv4BpRCx a0CscnTby2H381xSHN6RzxF7C0Z/76Ck5MlwjXipdTqKzc+JfIVrw2/AmZ8ioX0ISlJyut yhcafTGxtI2YEEn5HUWq+BE1JX9xke0= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH mm 18/22] kasan: add comment about UACCESS regions to kasan_report Date: Wed, 2 Mar 2022 17:36:38 +0100 Message-Id: <1201ca3c2be42c7bd077c53d2e46f4a51dd1476a.1646237226.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 7790420008 X-Stat-Signature: uh6re6xs8gmet9ntd89aoum6b8ac5iqe Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=Vvu6o+ZY; spf=pass (imf13.hostedemail.com: domain of andrey.konovalov@linux.dev designates 94.23.1.103 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-HE-Tag: 1646239203-996846 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Andrey Konovalov Add a comment explaining why kasan_report() is the only reporting function that uses user_access_save/restore(). Signed-off-by: Andrey Konovalov --- mm/kasan/report.c | 5 +++++ 1 file changed, 5 insertions(+) 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) {