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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 8D9EDC43461 for ; Tue, 8 Sep 2020 14:39:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2720522207 for ; Tue, 8 Sep 2020 14:39:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="cv+LslJ4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2720522207 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A98086B005C; Tue, 8 Sep 2020 10:39:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A22D06B005D; Tue, 8 Sep 2020 10:39:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E97C6B0062; Tue, 8 Sep 2020 10:39:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0103.hostedemail.com [216.40.44.103]) by kanga.kvack.org (Postfix) with ESMTP id 7491F6B005C for ; Tue, 8 Sep 2020 10:39:48 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 32C78181AC9BF for ; Tue, 8 Sep 2020 14:39:48 +0000 (UTC) X-FDA: 77240153256.22.horse69_170b758270d5 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id BBF3F18038E68 for ; Tue, 8 Sep 2020 14:39:47 +0000 (UTC) X-HE-Tag: horse69_170b758270d5 X-Filterd-Recvd-Size: 5428 Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Tue, 8 Sep 2020 14:39:47 +0000 (UTC) Received: by mail-pj1-f65.google.com with SMTP id b17so5995000pji.1 for ; Tue, 08 Sep 2020 07:39:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=u6IZBEYdJUicGrUE54qThuMWVgXq8hL/oKiMR3tNmWw=; b=cv+LslJ4V6jfBHxvBBCk7QV/70j9a6RdII0YFlSLFtzmyWQa8pV+VXOTMXbYoLw3gJ 7DIJkOIRBeK9eyC075KhNoNS5tWP+NhRGWamXmd9VcbEgexsPRuHqUxTUvwMVVwGIrQF jwja0RSSmK4sJz0xpuPKd0pIbeb4yMAcw3vrt3c8itGysNVbPAyttMGQV8BzfMCWY7yw 10eknqk7kUIcYYTpqo6phYE6GX1SOCg8dLd0QXO77rBoW3FuzgGfCkkGE3/GOXACuBrL ygzDP55kRb9Cjp7f8QCSbAxJ5uTK/SVSXSDPlNwqOZyT/AGeeGHpjt+Z2NExWvZqpMZX PPYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=u6IZBEYdJUicGrUE54qThuMWVgXq8hL/oKiMR3tNmWw=; b=GqfqQto566oy7WIheOoU5hzBWTUx2V/LYM/MStNYq/aoFjQ++45wBUzi+7tDBaX8Xh kIEQ9dVxHEvCoM7/Bwk/GDSiIPRmB+/UN7GE9c8Ct1IHWG/jh5HAJl1x3PsPbMxWb3i0 pPsYM2eN8+/6A2QiI9VCJEI8L0RODrJbABuwEDbaY5DMeEfUplsGkDuhHgfPRUu01cUL IBHutqkwMq5WRbKoycIyzgYrSOQoYhQzqjGJXJwVazVZSiY1UYT5jTrBP2DWAjnNpbvb hdOCEhIUVzCHEbuNgDQud3DasxNyT9/rHrIRJHDh1+KLr39I6QyPmyXVoiX4BgcszDk5 LOdw== X-Gm-Message-State: AOAM5307JGTpsTWsIMEaBiRlG+/aQwSkA1fUmYG5PAM1bjA6OS8v8YR+ JXA5duM6NFxGAkJnfCi5eI+J6SGV42sSynYTY8tDPg== X-Google-Smtp-Source: ABdhPJws7YHVVJhG8H6UoWmd1N6htiZqw6o05TjLx9l7lnPD7Lq3S75jkqpmEFtYhNZsF2F4rx0yGYcdoIIg1vb7fUk= X-Received: by 2002:a17:90b:140c:: with SMTP id jo12mr4229667pjb.41.1599575986171; Tue, 08 Sep 2020 07:39:46 -0700 (PDT) MIME-Version: 1.0 References: <6a83a47d9954935d37a654978e96c951cc56a2f6.1597425745.git.andreyknvl@google.com> In-Reply-To: <6a83a47d9954935d37a654978e96c951cc56a2f6.1597425745.git.andreyknvl@google.com> From: Andrey Konovalov Date: Tue, 8 Sep 2020 16:39:35 +0200 Message-ID: Subject: Re: [PATCH 22/35] arm64: mte: Enable in-kernel MTE To: Vincenzo Frascino , Catalin Marinas Cc: Andrey Ryabinin , Alexander Potapenko , Marco Elver , Evgenii Stepanov , Elena Petrova , Branislav Rankov , Kevin Brodsky , Will Deacon , Andrew Morton , Linux ARM , Linux Memory Management List , LKML , Dmitry Vyukov , kasan-dev Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: BBF3F18038E68 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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 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?