[PATCH] drivers/perf: arm_spe: Use perf_allow_kernel() for permissions

Peter Zijlstra peterz at infradead.org
Wed Aug 7 12:00:39 UTC 2024


On Wed, Aug 07, 2024 at 12:20:13PM +0100, James Clark wrote:
> 
> 
> 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.

Yes, that works, none of that is a fast path anyway.



More information about the Linux-security-module-archive mailing list