Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2357743pxb; Tue, 23 Feb 2021 05:19:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJxLB1AWQFkFGuietkNHgEsqYslpUoiB0lJ7UufsWfLF7o2KoSz9SH1BGLtJ7A2Sb3Ocmswu X-Received: by 2002:a05:6402:1148:: with SMTP id g8mr27577811edw.339.1614086350186; Tue, 23 Feb 2021 05:19:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614086350; cv=none; d=google.com; s=arc-20160816; b=nzWECu3FAiEecVH8PUpBOY4Gsaci+WbY8RiK9vTMD0M3VCWVVQj9yA7+CySW8JBqjz UUz/yoy/HCSJ2gNy3bI6I0kQ0gmQV/CnB8Ffc6p9fL9FunsAHiyjynKsgV0PUM7Qwguk fB9qVACoW4gYDKWEkKAVHEWfGl78ISJYpdCkqsjFfPYyNpbETBdsG2xKD6ZnK9PVnAMw eHoUV60W+O8uEgABCULj/K+AlOQ+zsmNGUelirT9qidt9Loj9H7YZigvwKpmaWZk4LzW tuRABsVkMvHEhc6OnfF3XPB2fFwHNNL65I34rnfpGg5bBMIsL6OMvk3dCMYcMpO2uLYq WAFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=rQ7HDhVNwvJOKjrAoP5GHZtS/1FFXvk3BwA7r+ewgBA=; b=ef1kJIGYKL0f5i4duDcKSTid64+2h/xqe+ucUtc691gOObROp7d3IpytOBLcAoU+QS tPcI0Xm8Z8iLpB6OQy4jWCwlS7WidzGtuPdw4jA9NfuX6m6ighKUaaMCU51ALI9Dobf0 JCLPs4os4j8qHOBZIaNcq8hlmkmtacvvbODZN5yxDOn8lDLrv59c5N/fdF8EU7Eng1Rt bD76Fv1IWLOj0LXwErwt+MUuYvgmqesisDCHvazoY2e9+hB8//Idu2ZnUDP0bqFi8fX1 VntH0SPRwZAA8QsR6vH4TsZxdShIOY7ZWUiKjcDOyA0oy0MVR9oP8VvAXnoGCGVDavQl 91vA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z12si14760321edb.126.2021.02.23.05.18.45; Tue, 23 Feb 2021 05:19:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232760AbhBWNP2 (ORCPT + 99 others); Tue, 23 Feb 2021 08:15:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:50002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232538AbhBWNPW (ORCPT ); Tue, 23 Feb 2021 08:15:22 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E57E264E2E; Tue, 23 Feb 2021 13:14:39 +0000 (UTC) Date: Tue, 23 Feb 2021 13:14:37 +0000 From: Catalin Marinas To: Will Deacon Cc: Vincenzo Frascino , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, Andrew Morton , Dmitry Vyukov , Andrey Ryabinin , Alexander Potapenko , Marco Elver , Evgenii Stepanov , Branislav Rankov , Andrey Konovalov , Lorenzo Pieralisi Subject: Re: [PATCH v13 4/7] arm64: mte: Enable TCO in functions that can read beyond buffer limits Message-ID: <20210223131435.GB20769@arm.com> References: <20210211153353.29094-1-vincenzo.frascino@arm.com> <20210211153353.29094-5-vincenzo.frascino@arm.com> <20210212172128.GE7718@arm.com> <20210222175825.GE19604@arm.com> <6111633c-3bbd-edfa-86a0-be580a9ebcc8@arm.com> <20210223120530.GA20769@arm.com> <20210223124951.GA10563@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210223124951.GA10563@willie-the-truck> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 23, 2021 at 12:49:52PM +0000, Will Deacon wrote: > On Tue, Feb 23, 2021 at 12:05:32PM +0000, Catalin Marinas wrote: > > On Tue, Feb 23, 2021 at 10:56:46AM +0000, Vincenzo Frascino wrote: > > > On 2/22/21 5:58 PM, Catalin Marinas wrote: > > > > We'll still have an issue with dynamically switching the async/sync mode > > > > at run-time. Luckily kasan doesn't do this now. The problem is that > > > > until the last CPU have been switched from async to sync, we can't > > > > toggle the static label. When switching from sync to async, we need > > > > to do it on the first CPU being switched. > > > > > > I totally agree on this point. In the case of runtime switching we might need > > > the rethink completely the strategy and depends a lot on what we want to allow > > > and what not. For the kernel I imagine we will need to expose something in sysfs > > > that affects all the cores and then maybe stop_machine() to propagate it to all > > > the cores. Do you think having some of the cores running in sync mode and some > > > in async is a viable solution? > > > > stop_machine() is an option indeed. I think it's still possible to run > > some cores in async while others in sync but the static key here would > > only be toggled when no async CPUs are left. > > Just as a general point, but if we expose stop_machine() via sysfs we > probably want to limit that to privileged users so you can't DoS the system > by spamming into the file. Definitely. Anyway, that's a later kasan feature if they'd find it useful. Currently the mode is set at boot from cmdline. -- Catalin