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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 26006C43463 for ; Fri, 18 Sep 2020 09:39:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8E0C621973 for ; Fri, 18 Sep 2020 09:39:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E0C621973 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 04C246B0003; Fri, 18 Sep 2020 05:39:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F3D2C6B0055; Fri, 18 Sep 2020 05:39:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E53EE6B005A; Fri, 18 Sep 2020 05:39:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0131.hostedemail.com [216.40.44.131]) by kanga.kvack.org (Postfix) with ESMTP id D0D016B0003 for ; Fri, 18 Sep 2020 05:39:21 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 8A6BD180AD811 for ; Fri, 18 Sep 2020 09:39:21 +0000 (UTC) X-FDA: 77275684122.05.tail72_570ab262712a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id 6B46618021BA3 for ; Fri, 18 Sep 2020 09:39:21 +0000 (UTC) X-HE-Tag: tail72_570ab262712a X-Filterd-Recvd-Size: 2391 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Fri, 18 Sep 2020 09:39:20 +0000 (UTC) Received: from gaia (unknown [31.124.44.166]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5ED6F21D20; Fri, 18 Sep 2020 09:39:17 +0000 (UTC) Date: Fri, 18 Sep 2020 10:39:14 +0100 From: Catalin Marinas To: Vincenzo Frascino Cc: Andrey Konovalov , Dmitry Vyukov , kasan-dev@googlegroups.com, Andrey Ryabinin , Alexander Potapenko , Marco Elver , Evgenii Stepanov , Elena Petrova , Branislav Rankov , Kevin Brodsky , Will Deacon , Andrew Morton , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 27/37] arm64: mte: Switch GCR_EL1 in kernel entry and exit Message-ID: <20200918093914.GC6335@gaia> References: <20200917165221.GF10662@gaia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) 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 Thu, Sep 17, 2020 at 07:47:59PM +0100, Vincenzo Frascino wrote: > On 9/17/20 5:52 PM, Catalin Marinas wrote: > >> +void mte_init_tags(u64 max_tag) > >> +{ > >> + u64 incl = GENMASK(max_tag & MTE_TAG_MAX, 0); > >> + > >> + gcr_kernel_excl = ~incl & SYS_GCR_EL1_EXCL_MASK; > >> +} > > Do we need to set the actual GCR_EL1 register here? We may not get an > > exception by the time KASAN starts using it. > > It is ok not setting it here because to get exceptions cpuframework mte enable > needs to be executed first. In that context we set even the register. OK, that should do for now. If we ever add stack tagging, we'd have to rethink the GCR_EL1 initialisation. -- Catalin