From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20698C433DB for ; Tue, 9 Feb 2021 18:45:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 723A464EC2 for ; Tue, 9 Feb 2021 18:45:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 723A464EC2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B6CA76B0005; Tue, 9 Feb 2021 13:45:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B1CB36B006C; Tue, 9 Feb 2021 13:45:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E4A16B006E; Tue, 9 Feb 2021 13:45:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0212.hostedemail.com [216.40.44.212]) by kanga.kvack.org (Postfix) with ESMTP id 8965F6B0005 for ; Tue, 9 Feb 2021 13:45:18 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4B04A8248047 for ; Tue, 9 Feb 2021 18:45:18 +0000 (UTC) X-FDA: 77799607116.19.mom05_0a108cc27609 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id 1AD311AD801 for ; Tue, 9 Feb 2021 18:45:18 +0000 (UTC) X-HE-Tag: mom05_0a108cc27609 X-Filterd-Recvd-Size: 3536 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Tue, 9 Feb 2021 18:45:17 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id B9D7A64E7C; Tue, 9 Feb 2021 18:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1612896316; bh=GtmYHHEcqdc1UDShBy9Mlu65hB49cZakKnpnx2Og2eQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=aP06nY6YiMDXRIS38tSvtTFV3YBFhASWUaeMt0wV7bsUISO1KRF7YPBwEtxI+jImq Oo+t2pdYIgktk2hCzRPdzSufB5ybOpG67+SSggtzUmLn4rXV9KRJv1YFGQFt+f6hxv RmTEse/HAUq8eITtewK4JuF7VDBZ8cI7dGiz9HGY= Date: Tue, 9 Feb 2021 10:45:15 -0800 From: Andrew Morton To: Catalin Marinas Cc: Andrey Konovalov , Vincenzo Frascino , Will Deacon , Dmitry Vyukov , Andrey Ryabinin , Alexander Potapenko , Marco Elver , Peter Collingbourne , Evgenii Stepanov , Branislav Rankov , Kevin Brodsky , Christoph Hellwig , kasan-dev@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH mm] arm64: kasan: fix MTE symbols exports Message-Id: <20210209104515.75eaa00dea03175e49e70d6c@linux-foundation.org> In-Reply-To: <20210209170255.GG1435@arm.com> References: <20210209170255.GG1435@arm.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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: On Tue, 9 Feb 2021 17:02:56 +0000 Catalin Marinas wrote: > On Tue, Feb 09, 2021 at 04:32:30PM +0100, Andrey Konovalov wrote: > > diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c > > index a66c2806fc4d..788ef0c3a25e 100644 > > --- a/arch/arm64/kernel/mte.c > > +++ b/arch/arm64/kernel/mte.c > > @@ -113,13 +113,17 @@ void mte_enable_kernel(void) > > sysreg_clear_set(sctlr_el1, SCTLR_ELx_TCF_MASK, SCTLR_ELx_TCF_SYNC); > > isb(); > > } > > +#if IS_ENABLED(CONFIG_KASAN_KUNIT_TEST) > > EXPORT_SYMBOL_GPL(mte_enable_kernel); > > +#endif > > > > void mte_set_report_once(bool state) > > { > > WRITE_ONCE(report_fault_once, state); > > } > > +#if IS_ENABLED(CONFIG_KASAN_KUNIT_TEST) > > EXPORT_SYMBOL_GPL(mte_set_report_once); > > +#endif > > Do we actually care about exporting them when KASAN_KUNIT_TEST=n? It > looks weird to have these #ifdefs in the arch code. Either the > arch-kasan API requires these symbols to be exported to modules or not. > I'm not keen on such kasan internals trickling down into the arch code. > > If you don't want to export them in the KASAN_KUNIT_TEST=n case, add a > wrapper in the kasan built-in code (e.g. kasan_test_enable_tagging, > kasan_test_set_report_once) and conditionally compile them based on > KASAN_KUNIT_TEST. In other words, the patch's changelog was poor! It told us what the patch does (which is often obvious from the code) but it failed to explain why the patch does what it does. The same goes for code comments, folks - please explain "why it does this" rather than "what it does".