Received: by 2002:ac2:5a04:0:0:0:0:0 with SMTP id q4csp392425lfn; Wed, 2 Mar 2022 09:34:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQ/pRSiD9sCMLzF8fbYg8wVcJ3lDbXlpcLRJDobR9cwEEA4I2tM84jNLW2kfOdTNNulpCr X-Received: by 2002:a17:903:244a:b0:151:36cc:2f71 with SMTP id l10-20020a170903244a00b0015136cc2f71mr26792217pls.115.1646242449122; Wed, 02 Mar 2022 09:34:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646242449; cv=none; d=google.com; s=arc-20160816; b=TGC9AK1c3a7t4GzMALafNY7ORQZeOiW2XdlmCaeftIs5EESdX6FlRnFektpeAH2/PW i3lqWiIale6vh2pMLrMzz9acyQa+LjUAbDaVDeOmi0FvZtWPIA5lzCcmT5pXiyXpRq0B RquA0jwuXNtWJ3EYC5U9CNBhJ+l6sza/Es96lbi+hyyuVgjlY1qJv60h6JvgOprBlHbg lYrjJhqTEwTi0QFVhSs/YQwbpNil0NLNtH38KCyAaZchh/D07ndLzmZxMJcwo1heWj2g IgBiZHrDFfLnjgLoSBLkcjWVbPx/sijtA1HacqkDcWVQoXqy5jVVMRz04KrT8uiN9oRT FggA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ujXTYxMun+rvpXDm65LBC0iIPgbPBoZhDfYPsPYRrpE=; b=Qzk8IdptCt9nG29ugz+XsPnI964d0XIGhYsS70qQ0QfpbTlv1UwBuu25WS5LBCsIOj k/EJ9rFTGTifpaYYFoRp/I29bFm1rQaBAgUxin/JFWN31qqo+lqvP28quJcsJjZUXAtw mbnmJ4L3LFRwXOWitbokZb3mWhKDRHaxbJQncRMjpE84AZJiDBiCq2mfBT083Ibatug4 MskFYClFg5cDVNvLc1v/zcwMKCLUcCt60zEPxYUW/LYFhn4oeLYrQQEydHVqaHvETm/Y 3ZQWtEuJrd6Eq9tE3jSZPhfGLAZsj6lhFaGtEhRJN/FqxmHgHz9i6S+MdRHTL++o9DDy AoiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Vvu6o+ZY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lk4-20020a17090b33c400b001bf09987346si228385pjb.125.2022.03.02.09.33.52; Wed, 02 Mar 2022 09:34:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Vvu6o+ZY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237637AbiCBQku (ORCPT + 99 others); Wed, 2 Mar 2022 11:40:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242596AbiCBQks (ORCPT ); Wed, 2 Mar 2022 11:40:48 -0500 Received: from out0.migadu.com (out0.migadu.com [IPv6:2001:41d0:2:267::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD0A8CEA1E for ; Wed, 2 Mar 2022 08:40:03 -0800 (PST) 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 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) { -- 2.25.1