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 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 A5B1AC433E0 for ; Tue, 9 Feb 2021 21:24:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5B54664E92 for ; Tue, 9 Feb 2021 21:24:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233273AbhBIVVl (ORCPT ); Tue, 9 Feb 2021 16:21:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:48130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233410AbhBIS45 (ORCPT ); Tue, 9 Feb 2021 13:56:57 -0500 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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".