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.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 67178C2BBD0 for ; Tue, 8 Sep 2020 14:54:02 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0568821D82 for ; Tue, 8 Sep 2020 14:54:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="VfMnFLB0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0568821D82 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zzCz0Two8ZOD/nJn2YgbHPXTLhlqD4F6EuktPfDX3NA=; b=VfMnFLB02RVbUNOBpppI1PPZ6 KfQ/yJiZoCp9LR2Sh/axnYOEDTcXZfcmOKhv9yPfDVHhVlK00pcSozhPml0zIXog/jmULrnGTI9Qk /xjliYaX63/okaKjCJG1ywWhKRwDAnzzIsy/M4xm+XD+9qAsOwFXKSiY5CIJm7tU7URuc9eTgQmqs BbgvCLu1CefQVdtQ3UymCQ3QssfNU8ublFLb8SYdb/VPDiJkFNJu4Y+fkb8MKLdKZr0kpFwtuYgW0 PUPBKEjXaMQKaFne306GMEzkdbZdQvX9nEm3xweYm4RUrM13L83R9kS6BmRfzLdxn1X1QphjFQdo1 yfUz3IUiQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFezG-0004PX-5N; Tue, 08 Sep 2020 14:52:46 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFezD-0004Ob-IZ for linux-arm-kernel@lists.infradead.org; Tue, 08 Sep 2020 14:52:44 +0000 Received: from gaia (unknown [46.69.195.48]) (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 3E3942074D; Tue, 8 Sep 2020 14:52:40 +0000 (UTC) Date: Tue, 8 Sep 2020 15:52:37 +0100 From: Catalin Marinas To: Andrey Konovalov Subject: Re: [PATCH 22/35] arm64: mte: Enable in-kernel MTE Message-ID: <20200908145237.GI25591@gaia> References: <6a83a47d9954935d37a654978e96c951cc56a2f6.1597425745.git.andreyknvl@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200908_105243_727800_51FFC880 X-CRM114-Status: GOOD ( 28.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marco Elver , Elena Petrova , Kevin Brodsky , Will Deacon , Branislav Rankov , kasan-dev , LKML , Linux Memory Management List , Alexander Potapenko , Linux ARM , Dmitry Vyukov , Andrey Ryabinin , Andrew Morton , Vincenzo Frascino , Evgenii Stepanov Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Sep 08, 2020 at 04:39:35PM +0200, Andrey Konovalov wrote: > On Fri, Aug 14, 2020 at 7:28 PM Andrey Konovalov wrote: > > From: Vincenzo Frascino > > > > The Tag Checking operation causes a synchronous data abort as > > a consequence of a tag check fault when MTE is configured in > > synchronous mode. > > > > Enable MTE in Synchronous mode in EL1 to provide a more immediate > > way of tag check failure detection in the kernel. > > > > As part of this change enable match-all tag for EL1 to allow the > > kernel to access user pages without faulting. This is required because > > the kernel does not have knowledge of the tags set by the user in a > > page. > > > > Note: For MTE, the TCF bit field in SCTLR_EL1 affects only EL1 in a > > similar way as TCF0 affects EL0. > > > > Signed-off-by: Vincenzo Frascino > > --- > > arch/arm64/kernel/cpufeature.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c > > index 4d3abb51f7d4..4d94af19d8f6 100644 > > --- a/arch/arm64/kernel/cpufeature.c > > +++ b/arch/arm64/kernel/cpufeature.c > > @@ -1670,6 +1670,9 @@ static void cpu_enable_mte(struct arm64_cpu_capabilities const *cap) > > write_sysreg_s(0, SYS_TFSR_EL1); > > write_sysreg_s(0, SYS_TFSRE0_EL1); > > > > + /* Enable Match-All at EL1 */ > > + sysreg_clear_set(tcr_el1, 0, SYS_TCR_EL1_TCMA1); > > + > > /* > > * CnP must be enabled only after the MAIR_EL1 register has been set > > * up. Inconsistent MAIR_EL1 between CPUs sharing the same TLB may > > @@ -1687,6 +1690,9 @@ static void cpu_enable_mte(struct arm64_cpu_capabilities const *cap) > > mair &= ~MAIR_ATTRIDX(MAIR_ATTR_MASK, MT_NORMAL_TAGGED); > > mair |= MAIR_ATTRIDX(MAIR_ATTR_NORMAL_TAGGED, MT_NORMAL_TAGGED); > > write_sysreg_s(mair, SYS_MAIR_EL1); > > + > > + /* Enable MTE Sync Mode for EL1 */ > > + sysreg_clear_set(sctlr_el1, SCTLR_ELx_TCF_MASK, SCTLR_ELx_TCF_SYNC); > > isb(); > > > > local_flush_tlb_all(); > > -- > > 2.28.0.220.ged08abb693-goog > > > > Should we change this commit to enable in-kernel MTE only if > KASAN_HW_TAGS is enabled? I think so. We don't currently have any patchset decoupling MTE from KASAN. See my other comment on TCR_EL1.TBI1, you'd need to set TCMA1 as well in the same proc.S file. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel