Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp462224pxb; Tue, 19 Oct 2021 06:32:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwB/qKXNx/2ImJBTtrCymTAQXskD4d+HFdv50quoNIcnxmjjGXqE6RYbS71GduLmEDEYVDb X-Received: by 2002:a17:902:e544:b0:13e:e863:6cd2 with SMTP id n4-20020a170902e54400b0013ee8636cd2mr33724232plf.41.1634650332858; Tue, 19 Oct 2021 06:32:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634650332; cv=none; d=google.com; s=arc-20160816; b=iPSHtGR/bhGqaJMISYUCCQPW4NS+KGPWA3UbypuCYKHRoOuaTfe84+spPrKIGj+wIV PR2g0ViF3JP0S9jYylmMS+uuYynnERRxfkj0RmXrafMW5LJfYU8eV9cbWOiBSD68TqYc mX2DSyTqy4F+4rOjf/NIrO1VinnIsmjry80m7UvkxL4WYe9jACFqTzZlAMt01jgNL86z y3hDNVDPDOmbesH7uhX7r2c4ptcXNJoK4O0ddHJ674+IQ2b3h7PHH98zvxA6OnDmgvww wgnfwxeq/H61NaTF11IXygME9ApDwN6+0CxRErlmA2WlKaagh1z3G/vEIz+DP2Pi5QdI K7CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=9bI3Gdmc/06sj4+3lnEYtwdJTy3TYqh9/9rh4aN87zw=; b=VHX8HacVE32lMW6KB01Hle4P4FgnRgfjm/QSUOM8LfjBsjZ8uL86UTwYBsExME0UZp OoKdT7XolFCKL4Xkq8+hhOwvy7nI5QuCgsvRS1m8AwZScHodhIaPj3oTbLEOqVNFreq7 F7kjdiWsji5ZwmT2t3g5B7q3aBgk+tbucppZgL2CxWuhAdWizHHQ/ahC2SRyHriNwAPg VXqgIPVLCH1ugL37qblRBFWlj2FafU5DDwTA0WSyEdIzTBCOXchWe+uRAzC52myXPKzO dzrORcrIscWgCBedy/spcBVD6Hy1Cni3B6JtSsw+kZ6fvpHHMzdTuwXlxJpLHsTmX67z KJ0g== 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 29si3574786pjj.38.2021.10.19.06.32.00; Tue, 19 Oct 2021 06:32:12 -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 S235804AbhJSNcb (ORCPT + 99 others); Tue, 19 Oct 2021 09:32:31 -0400 Received: from foss.arm.com ([217.140.110.172]:49380 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235817AbhJSNca (ORCPT ); Tue, 19 Oct 2021 09:32:30 -0400 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 598A42F; Tue, 19 Oct 2021 06:30:16 -0700 (PDT) Received: from [10.57.25.70] (unknown [10.57.25.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 918433F70D; Tue, 19 Oct 2021 06:30:05 -0700 (PDT) Subject: Re: [PATCH v5 04/15] arm64: errata: Add detection for TRBE write to out-of-range To: Mathieu Poirier Cc: will@kernel.org, catalin.marinas@arm.com, anshuman.khandual@arm.com, mike.leach@linaro.org, leo.yan@linaro.org, maz@kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland References: <20211014223125.2605031-1-suzuki.poulose@arm.com> <20211014223125.2605031-5-suzuki.poulose@arm.com> <20211018155041.GA3163131@p14s> From: Suzuki K Poulose Message-ID: <928f02ab-8226-1679-a120-06778d03c93c@arm.com> Date: Tue, 19 Oct 2021 14:29:58 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211018155041.GA3163131@p14s> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/10/2021 16:50, Mathieu Poirier wrote: > Good morning, > > On Thu, Oct 14, 2021 at 11:31:14PM +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 > > Checkpatch gives me a warning about this line... > >> 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 > > I'm pretty sure this line will also be flagged. > Thanks for pointing them out. I have fixed it now. Suzuki