From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74C901E211D for ; Wed, 7 Aug 2024 11:20:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723029619; cv=none; b=vGD7MRUuCd3vEJliBCg/di4UFQNkSUMPcV/ctMVLZwlvI7DFNDyKiN1EhQ6p34CoFcTqdairZ7YZHbSybBnK8oTwNbrimf/AChXDgHl6BtpP/kdYX1BqHt0Ht2D5iYCRfNCz5Ad2WIq+1F5FH7X1HKTPFpGxxrm40D21wLdaSvg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723029619; c=relaxed/simple; bh=vyUtZ+IzW/Sxj6Fm41Tuev1tyNO6KoMeXmicKETFr00=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=C7EMhMO6Elx5gNpMPk5CUM155Piz+r6XKaE8YO3eoic+S6FxlJQ0k17+o0hrEYWbc2v4KLS615xQv4ngCQPk+COHFkgIRyApDIDo7LzX8aHpD85R46txW8OwLLYgmGQqOAeOYaHUg53C5A3SO4uGpMQ4fm3LMFIlpG+bN7ZvpeA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=vNIYzFJV; arc=none smtp.client-ip=209.85.167.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="vNIYzFJV" Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-52f01ec08d6so2144237e87.2 for ; Wed, 07 Aug 2024 04:20:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723029616; x=1723634416; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=6AnT8tM5Re9ArEMYyFgg615Zk12421KA9IxT4E7DVwQ=; b=vNIYzFJVr6ahEugShgcMbjxmhavFgCe7epQeFLM9Cfnl9G5eyHxgbQuUhbUooJZ1DG 2vWw+fu97xjm4G1KIr3RhTKoNmxzm7HqOUQ1LzpT/UKtcy2QZoq7UBauALz/Ms/pP4SS ILa2cSlfwd3o9C1ZPIWIYqUNsjLk4yfQQ7t2L4YAEHoQEoI6Zu8F05H9QzZKQMZtZ6rk 2G7H+OqW+cqx1K7kuxIN4gRIyWfcw5zCpEBmNc6LKbiTq2j4YMnMPRMxTzxN4TDSa9SC Dqdb3FCQNrXRZOOCPPWqtTE7FRVsxrjRg1AJGYTlJNgr8kUQoFCpiQq3H4u9Vw0jK2wR cpkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723029616; x=1723634416; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6AnT8tM5Re9ArEMYyFgg615Zk12421KA9IxT4E7DVwQ=; b=RRhJQUD1Lv3lNCM9IXi/MbNjl0eU2Us22ahXZvicFmEDTRYUZ0nmZGXRV/vwyaBO2o ZfCbIHYJwrop7x8H75t65st6JC/PckFIGqUsi5Xr366RMP/jNPgrUKp4IDAn1y/coI/r jwfS0wdRxYOP5+0f2AC5/AkU9FPPrZa9KaejpFvnNf2Ni3maZQjLAM7zy+PFQK34ygF3 FmgETKGK4/j6oLoOsndOr+8PmCJrWwltLzTYsuIdgnexBRl1z3m0vvQSnkHEGE3Vs39s ISw+u3f6/wo+0tjmWBoPLT6WtDBgeqwbDBqzC6yZxD9MuvyLhWL1UwIds8re+/k0U/+n wZnQ== X-Forwarded-Encrypted: i=1; AJvYcCUkLYRqOtP98OeOIsCnPaR9vwxxvU7jcHlzeZ5VOQl7FHuXRUUtFMRrf/iOd7oP7n5yQiw/qYnRa0jeEHeOFblactjQpjQ8QzkY3nMR X-Gm-Message-State: AOJu0YzW9avD7JGGjpJLRa84cPEL8LGW34DmUZs3nadeaTluDsyFJKh4 zDdVKzwUxvQSXDqYeiZ70EjBOwIR6XKfYLJPffHPhcauMpfJLEoKyvpJwb/WJVlhJpFeG5r/stG TOZE= X-Google-Smtp-Source: AGHT+IFD1x5owvgDUm1iLMvihjtHRJQDhrCOXcBOdvIMHDZ/yDmNOdnKRPkvS3eIDRgmpeUTXRQhzQ== X-Received: by 2002:ac2:4c48:0:b0:52f:2adf:d445 with SMTP id 2adb3069b0e04-530bb39b88cmr13683647e87.41.1723029615408; Wed, 07 Aug 2024 04:20:15 -0700 (PDT) Received: from [192.168.1.3] ([89.47.253.130]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5b83960f353sm6894900a12.15.2024.08.07.04.20.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Aug 2024 04:20:14 -0700 (PDT) Message-ID: Date: Wed, 7 Aug 2024 12:20:13 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drivers/perf: arm_spe: Use perf_allow_kernel() for permissions To: Peter Zijlstra Cc: linux-arm-kernel@lists.infradead.org, Al Grant , Will Deacon , Mark Rutland , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , Paul Moore , James Morris , "Serge E. Hallyn" , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-security-module@vger.kernel.org References: <20240807105441.2156738-1-james.clark@linaro.org> <20240807111520.GC37996@noisy.programming.kicks-ass.net> Content-Language: en-US From: James Clark In-Reply-To: <20240807111520.GC37996@noisy.programming.kicks-ass.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 07/08/2024 12:15 pm, Peter Zijlstra wrote: > On Wed, Aug 07, 2024 at 11:54:41AM +0100, James Clark wrote: >> diff --git a/kernel/events/core.c b/kernel/events/core.c >> index aa3450bdc227..4a69583e329a 100644 >> --- a/kernel/events/core.c >> +++ b/kernel/events/core.c >> @@ -417,6 +417,7 @@ static struct kmem_cache *perf_event_cache; >> * 2 - disallow kernel profiling for unpriv >> */ >> int sysctl_perf_event_paranoid __read_mostly = 2; >> +EXPORT_SYMBOL_GPL(sysctl_perf_event_paranoid); > > I'm never a fan of exporting variables. Perhaps create a helper function > that returns the value and use that where required? > > That avoids modules getting the idea it would be okay to change this > valie themselves. I could also remove the inline from perf_allow_kernel() and export that instead. I don't think it really needs to be inlined but I gave it the benefit of the doubt because it was added that way.