Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1677519pxb; Thu, 7 Oct 2021 12:40:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAqpsBDBc00KdiPVUipH7fHmY/n+wxUEjq9vumqIO8uw8ggDUsr58OYviIgDu89g8z/w91 X-Received: by 2002:a17:90a:9b13:: with SMTP id f19mr7705660pjp.16.1633635640868; Thu, 07 Oct 2021 12:40:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633635640; cv=none; d=google.com; s=arc-20160816; b=UpBTN1p655x4yUByYibAj+wuwDnW7QdRxm/gWKrd3Yj6AayKXSw0qZpm2H0NZPSjf9 M9QsiQXwD89yv6UXGecargeCWOGAYTPMtPz2j4nRikn8dhBnkOPlhxzu8+Fmqd/0JAXv Ho4yc351dkPG+JxmNVbLi4J2P98cW0kOm6ZBRafpfZ49Es0tMWSckkYx0f8MgHEdW5Md LneojFGbVNwgF4nEe/RfP1UTsznR5VckszUUC6mmXnMap5oTKS1b1wBInWejNpG/8Zgy fsg5ci7k3FKWJW5uITExSj4KYsqrk3kP87ZTqNndhnkvDuK2sawm+JMAOKgAwOsvpBkr G4Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=/iKtFgXVr0Oiyvu199Y9Jximn8qwq4rI2137FoYh9LI=; b=KrdrsOYy6qvUUJ3LM1HVR7pUc+DpaQ2T96rsEQ6VALw7IXihwpYbz1oJKcic9wTSZR D6zHno/dJ6wZG0hYvDK0L36nyGG250FNEmxwR1g4DyG2WDrcOuRNu8GEYTDEqYxxjFVN jnGo+yk6I0M+Yuux6pKRSxLr8lACLxP6/GfUhotKlIFdAJgfwEpmGnGmwUyqjKJyKK09 52dxb6IG/LZIfsu6vFK8vfIBGkCCZpYEzBBEX1gZUh7j0mHWsy/TJrCXG1LZrNQO+rVN 540lF5v7kgRibTef7wlm9nySVpoI6wBN4J1t7gsrtonNLkq89c4Hm5rVbQq23QVf1HIS kdYg== 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 mp24si391389pjb.108.2021.10.07.12.40.27; Thu, 07 Oct 2021 12:40:40 -0700 (PDT) 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 S241740AbhJGQMr (ORCPT + 99 others); Thu, 7 Oct 2021 12:12:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:60022 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241906AbhJGQMr (ORCPT ); Thu, 7 Oct 2021 12:12:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 121826103C; Thu, 7 Oct 2021 16:10:50 +0000 (UTC) Date: Thu, 7 Oct 2021 17:10:48 +0100 From: Catalin Marinas To: Suzuki K Poulose Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, maz@kernel.org, mark.rutland@arm.com, james.morse@arm.com, anshuman.khandual@arm.com, leo.yan@linaro.org, mike.leach@linaro.org, mathieu.poirier@linaro.org, will@kernel.org, lcherian@marvell.com, coresight@lists.linaro.org Subject: Re: [PATCH v2 15/17] arm64: Add erratum detection for TRBE write to out-of-range Message-ID: References: <20210921134121.2423546-1-suzuki.poulose@arm.com> <20210921134121.2423546-16-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210921134121.2423546-16-suzuki.poulose@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 21, 2021 at 02:41:19PM +0100, Suzuki K Poulose wrote: > Arm Neoverse-N2 and Cortex-A710 cores are affected by an erratum where the > trbe, under some circumstances, might write upto 64bytes to an address after > the Limit as programmed by the TRBLIMITR_EL1.LIMIT. This might - > > - Corrupt a page in the ring buffer, which may corrupt trace from a > previous session, consumed by userspace. > - Hit the guard page at the end of the vmalloc area and raise a fault. > > To keep the handling simpler, we always leave the last page from the > range, which TRBE is allowed to write. This can be achieved by ensuring > that we always have more than a PAGE worth space in the range, while > calculating the LIMIT for TRBE. And then the LIMIT pointer can be adjusted > to leave the PAGE (TRBLIMITR.LIMIT -= PAGE_SIZE), out of the TRBE range > while enabling it. This makes sure that the TRBE will only write to an area > within its allowed limit (i.e, [head-head+size]) and we do not have to handle > address faults within the driver. > > Cc: Anshuman Khandual > Cc: Mathieu Poirier > Cc: Mike Leach > Cc: Leo Yan > Signed-off-by: Suzuki K Poulose Acked-by: Catalin Marinas