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 13C33C43464 for ; Fri, 18 Sep 2020 09:39:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BCBC021973 for ; Fri, 18 Sep 2020 09:39:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726375AbgIRJjU (ORCPT ); Fri, 18 Sep 2020 05:39:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:44666 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726109AbgIRJjU (ORCPT ); Fri, 18 Sep 2020 05:39:20 -0400 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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