From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751202AbdLAQ0m (ORCPT ); Fri, 1 Dec 2017 11:26:42 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:33046 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750914AbdLAQ0l (ORCPT ); Fri, 1 Dec 2017 11:26:41 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C7050601D4 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=sboyd@codeaurora.org Date: Fri, 1 Dec 2017 08:26:39 -0800 From: Stephen Boyd To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, ard.biesheuvel@linaro.org, dave.hansen@linux.intel.com, keescook@chromium.org, msalter@redhat.com, labbott@redhat.com, tglx@linutronix.de Subject: Re: [PATCH v2 18/18] perf: arm_spe: Disallow userspace profiling when arm_kernel_unmapped_at_el0() Message-ID: <20171201162639.GD19419@codeaurora.org> References: <1512059986-21325-1-git-send-email-will.deacon@arm.com> <1512059986-21325-19-git-send-email-will.deacon@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1512059986-21325-19-git-send-email-will.deacon@arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/30, Will Deacon wrote: > When running with the kernel unmapped whilst at EL0, the virtually-addressed > SPE buffer is also unmapped, which can lead to buffer faults if userspace > profiling is enabled. > > This patch prohibits SPE profiling of userspace when > arm_kernel_unmapped_at_el0(). > > Signed-off-by: Will Deacon > --- > drivers/perf/arm_spe_pmu.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c > index 8ce262fc2561..c028db8973a4 100644 > --- a/drivers/perf/arm_spe_pmu.c > +++ b/drivers/perf/arm_spe_pmu.c > @@ -675,6 +675,13 @@ static int arm_spe_pmu_event_init(struct perf_event *event) > return -EOPNOTSUPP; > > /* > + * If kernelspace is unmapped when running at EL0, then the SPE > + * buffer will fault and prematurely terminate the AUX session. > + */ > + if (arm64_kernel_unmapped_at_el0() && !attr->exclude_user) > + dev_warn_once(&spe_pmu->pdev->dev, "unable to write to profiling buffer from EL0. Try passing \"kaiser=off\" on the kernel command line"); Missing newline on that print? -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project