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=-10.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 7019EC433B4 for ; Thu, 8 Apr 2021 17:19:37 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 CB54E610CC for ; Thu, 8 Apr 2021 17:19:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CB54E610CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc: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=MHC2nFpR6VdZWTgbQeIDZKu+34g9IUoPLgkN2MOKBE8=; b=nC79cc3gc+kKp99YWwHLpVumh HZAZeO01WA4pJ3DzhGH5EAfsp00FEMilx6BuxKc3piTEUOLe5Livxt8G8vjXFL67ZOeyNOhLhRRId IEVpMqWKYJ52mlWr9FgbJwlM8hgfjTCps661T0kdN4a81oB+jAWV6ypJHmEk7D5pF0B00yDpQKUBp H+NiW55rxm8KtvTtHG/t8KcocMZ77Xjvg4H7V7HUOT3onhTX3N7NYz8o3NuLCGjTUat72MnkQUSaG my19DRH7HnlC6XdUHJ1tDtJZruVzXzs1DmbEi6UNurijHFqzSf9G5rMJFG+12naIDImfSTmuH986i MeR2MeKKg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lUYHd-008kwo-HT; Thu, 08 Apr 2021 17:17:33 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lUY4W-008jF9-If for linux-arm-kernel@lists.infradead.org; Thu, 08 Apr 2021 17:04:03 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 13FD2608FC; Thu, 8 Apr 2021 17:03:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617901439; bh=hnG61I8MApYNUUSFh/GpmupU2Ke6cKDab8yjo+IYME8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WS0PzOmeqqSFDSK5j3d4hFKlmKlOXxieqq/M/mDx0d3bYwtDKJyj6PXNnH3H0Xa2i D0nPT1Ioy4+nMNvRn0x8iY9GkGApIlrMIVVr+W4mXibIUZL9//Lkl9Zi1AFdNBv85m TwNyPzitrhCRE+vbXw+Ii7p+h9GDObmNHRgh/gHzrcU4tSxujw2/c981BFBbgyj54X L8C/vMabewVDuF9TRC3cXXOrdYVGs5zYl0nfpQtv9p+CY9ztrvMMKU/6xuNoRt1qD6 dApImahBT1PDWyTH3ZZTLb5VidrAq+DENKq1zEEgW0zzxpLbj9cls3ofO5cZADVz4b Mq4F6YV7gb5jQ== Date: Thu, 8 Apr 2021 18:03:54 +0100 From: Will Deacon To: Mark Rutland Cc: Vincenzo Frascino , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, Catalin Marinas Subject: Re: [PATCH] arm64: mte: Move MTE TCF0 check in entry-common Message-ID: <20210408170354.GB18321@willie-the-truck> References: <20210408143723.13024-1-vincenzo.frascino@arm.com> <20210408145604.GB18211@willie-the-truck> <20210408150612.GA37165@C02TD0UTHF1T.local> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210408150612.GA37165@C02TD0UTHF1T.local> 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-20210408_180401_712588_A5D086BF X-CRM114-Status: GOOD ( 20.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Thu, Apr 08, 2021 at 04:06:23PM +0100, Mark Rutland wrote: > On Thu, Apr 08, 2021 at 03:56:04PM +0100, Will Deacon wrote: > > On Thu, Apr 08, 2021 at 03:37:23PM +0100, Vincenzo Frascino wrote: > > > diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c > > > index 9d3588450473..837d3624a1d5 100644 > > > --- a/arch/arm64/kernel/entry-common.c > > > +++ b/arch/arm64/kernel/entry-common.c > > > @@ -289,10 +289,16 @@ asmlinkage void noinstr enter_from_user_mode(void) > > > CT_WARN_ON(ct_state() != CONTEXT_USER); > > > user_exit_irqoff(); > > > trace_hardirqs_off_finish(); > > > + > > > + /* Check for asynchronous tag check faults in user space */ > > > + check_mte_async_tcf0(); > > > } > > > > Is enter_from_user_mode() always called when we enter the kernel from EL0? > > afaict, some paths (e.g. el0_irq()) only end up calling it if > > CONTEXT_TRACKING or TRACE_IRQFLAGS are enabled. > > Currently everything that's in {enter,exit}_from_user_mode() only > matters when either CONTEXT_TRACKING or TRACE_IRQFLAGS is selected (and > expands to an empty stub otherwise). > > We could drop the ifdeffery in user_{enter,exit}_irqoff() to have them > called regardless, or add CONFIG_MTE to the list. I'm always in favour of dropping ifdeffery if it's getting in the way. > > > asmlinkage void noinstr exit_to_user_mode(void) > > > { > > > + /* Ignore asynchronous tag check faults in the uaccess routines */ > > > + clear_mte_async_tcf0(); > > > + > > > > and this one seems to be called even less often. > > This is always done in ret_to_user, so (modulo ifdeferry above) all > returns to EL0 call this. Right, I was just saying that if you disabled those CONFIG options then this isn't called _at all_ whereas I think enter_from_user_mode() still is on some paths. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel