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=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 A4B70C4BA24 for ; Thu, 27 Feb 2020 11:50:45 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 7301824693 for ; Thu, 27 Feb 2020 11:50:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LMqfP4+r" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7301824693 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+infradead-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=bombadil.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=iw+iIFTTKhaYJOjPDFnlecJrqWyMad+uVBjBHnF/EE0=; b=LMqfP4+rZOmKFw oLgTzSegJ5Z6oKvzVrizD54+1ggmmpqN2k/YiZfFh15q9vmFhHmzrHvwIMWXZzv+tzHQ05Lns/qFF ZQQYFf4Rx5vGnnRMQ4lWPu31q0UmBb3INGOg9Zex9isHsNBHIa5AvDpvQe4lD7uW7yz6sz9uO3bMz X5CBsLF33YV7NYifYAUt9qNyj8UZyfdSbIS9zN/IU24WHNIlIVsfgetK9kCROQr2woMV2AlznhItM 8PJ91JVA2fUqy+EZV7nH07l2vCqoSlKYIhJFmjJzJeAPs2O7nljkEYxsiDvd/fgeeCyvJ6/OxwFGc b4a28cqEekY1PmwcFzrw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7Hgc-0005Aj-EU; Thu, 27 Feb 2020 11:50:38 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7HgZ-0005AD-FS for linux-arm-kernel@lists.infradead.org; Thu, 27 Feb 2020 11:50:36 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B003D1FB; Thu, 27 Feb 2020 03:50:34 -0800 (PST) Received: from arrakis.emea.arm.com (arrakis.cambridge.arm.com [10.1.196.71]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5F1E73F73B; Thu, 27 Feb 2020 03:50:33 -0800 (PST) Date: Thu, 27 Feb 2020 11:50:31 +0000 From: Catalin Marinas To: linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 10/19] arm64: mte: Handle synchronous and asynchronous tag check faults Message-ID: <20200227115031.GC3281767@arrakis.emea.arm.com> References: <20200226180526.3272848-1-catalin.marinas@arm.com> <20200226180526.3272848-11-catalin.marinas@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200226180526.3272848-11-catalin.marinas@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200227_035035_564665_58579880 X-CRM114-Status: GOOD ( 11.17 ) 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: linux-arch@vger.kernel.org, Richard Earnshaw , Szabolcs Nagy , Andrey Konovalov , Kevin Brodsky , Peter Collingbourne , linux-mm@kvack.org, Vincenzo Frascino , Will Deacon Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Feb 26, 2020 at 06:05:17PM +0000, Catalin Marinas wrote: > diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile > index fc6488660f64..d4a378bc0a60 100644 > --- a/arch/arm64/kernel/Makefile > +++ b/arch/arm64/kernel/Makefile > @@ -63,6 +63,7 @@ obj-$(CONFIG_CRASH_CORE) += crash_core.o > obj-$(CONFIG_ARM_SDE_INTERFACE) += sdei.o > obj-$(CONFIG_ARM64_SSBD) += ssbd.o > obj-$(CONFIG_ARM64_PTR_AUTH) += pointer_auth.o > +obj-$(CONFIG_ARM64_MTE) += mte.o > > obj-y += vdso/ probes/ > obj-$(CONFIG_COMPAT_VDSO) += vdso32/ > diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S > index 9461d812ae27..9338b340e869 100644 > --- a/arch/arm64/kernel/entry.S > +++ b/arch/arm64/kernel/entry.S [...] > @@ -738,6 +763,8 @@ work_pending: > */ > ret_to_user: > disable_daif > + /* Check for asynchronous tag check faults in the uaccess routines */ > + check_mte_async_tcf x1, x2 > gic_prio_kentry_setup tmp=x3 > ldr x1, [tsk, #TSK_TI_FLAGS] > and x2, x1, #_TIF_WORK_MASK I got this wrong, check_mte_async expects the flags as the first argument (one may experience weird behaviour with overriding the TIF flags; thanks to Kevin for debugging). The diff below should fix it: diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 9338b340e869..6e7f315911e8 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -764,9 +764,9 @@ work_pending: ret_to_user: disable_daif /* Check for asynchronous tag check faults in the uaccess routines */ - check_mte_async_tcf x1, x2 gic_prio_kentry_setup tmp=x3 ldr x1, [tsk, #TSK_TI_FLAGS] + check_mte_async_tcf x1, x2 and x2, x1, #_TIF_WORK_MASK cbnz x2, work_pending finish_ret_to_user: _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel