linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* perf/x86/amd/power missing pmu::module initialisation
@ 2017-11-03 11:33 Mark Rutland
  2017-11-07 12:50 ` Huang Rui
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Rutland @ 2017-11-03 11:33 UTC (permalink / raw)
  To: ray.huang; +Cc: linux-kernel

Hi,

As a heads-up, I believe that arch/x86/events/amd/power.c is currently
missing initialisation of pmu::module, which could result in problems
when the module is unloaded.

We've just spotted a similar problem in a couple of ARM PMUs, and AFAICT
the AMD power PMU is the only other PMU affected.

Other modular PMUs all initialise this to THIS_MODULE prior to calling
perf_pmu_register().

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: perf/x86/amd/power missing pmu::module initialisation
  2017-11-03 11:33 perf/x86/amd/power missing pmu::module initialisation Mark Rutland
@ 2017-11-07 12:50 ` Huang Rui
  2017-11-07 12:54   ` Huang Rui
  2017-11-20 15:55   ` Mark Rutland
  0 siblings, 2 replies; 4+ messages in thread
From: Huang Rui @ 2017-11-07 12:50 UTC (permalink / raw)
  To: Mark Rutland; +Cc: linux-kernel

Hi Mark,

On Fri, Nov 03, 2017 at 11:33:56AM +0000, Mark Rutland wrote:
> Hi,
> 
> As a heads-up, I believe that arch/x86/events/amd/power.c is currently
> missing initialisation of pmu::module, which could result in problems
> when the module is unloaded.
> 
> We've just spotted a similar problem in a couple of ARM PMUs, and AFAICT
> the AMD power PMU is the only other PMU affected.
> 
> Other modular PMUs all initialise this to THIS_MODULE prior to calling
> perf_pmu_register().
> 

Thanks to let me know. I have dived into pmu for quite a while. Could you
please share more information or forward related mail thread, so that I can
repro this issue in my side. :-)

Thanks,
Rui

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: perf/x86/amd/power missing pmu::module initialisation
  2017-11-07 12:50 ` Huang Rui
@ 2017-11-07 12:54   ` Huang Rui
  2017-11-20 15:55   ` Mark Rutland
  1 sibling, 0 replies; 4+ messages in thread
From: Huang Rui @ 2017-11-07 12:54 UTC (permalink / raw)
  To: Mark Rutland; +Cc: linux-kernel

On Tue, Nov 07, 2017 at 08:50:52PM +0800, Huang Rui wrote:
> Hi Mark,
> 
> On Fri, Nov 03, 2017 at 11:33:56AM +0000, Mark Rutland wrote:
> > Hi,
> > 
> > As a heads-up, I believe that arch/x86/events/amd/power.c is currently
> > missing initialisation of pmu::module, which could result in problems
> > when the module is unloaded.
> > 
> > We've just spotted a similar problem in a couple of ARM PMUs, and AFAICT
> > the AMD power PMU is the only other PMU affected.
> > 
> > Other modular PMUs all initialise this to THIS_MODULE prior to calling
> > perf_pmu_register().
> > 
> 
> Thanks to let me know. I have dived into pmu for quite a while. Could you

Fix typo -> "I haven't dived into ..."

Thanks,
Rui

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: perf/x86/amd/power missing pmu::module initialisation
  2017-11-07 12:50 ` Huang Rui
  2017-11-07 12:54   ` Huang Rui
@ 2017-11-20 15:55   ` Mark Rutland
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Rutland @ 2017-11-20 15:55 UTC (permalink / raw)
  To: Huang Rui; +Cc: linux-kernel

Hi,

Sorry for the late reply.

On Tue, Nov 07, 2017 at 08:50:53PM +0800, Huang Rui wrote:
> On Fri, Nov 03, 2017 at 11:33:56AM +0000, Mark Rutland wrote:
> > As a heads-up, I believe that arch/x86/events/amd/power.c is currently
> > missing initialisation of pmu::module, which could result in problems
> > when the module is unloaded.
> > 
> > We've just spotted a similar problem in a couple of ARM PMUs, and AFAICT
> > the AMD power PMU is the only other PMU affected.
> > 
> > Other modular PMUs all initialise this to THIS_MODULE prior to calling
> > perf_pmu_register().
> 
> Thanks to let me know. I have dived into pmu for quite a while. Could you
> please share more information or forward related mail thread, so that I can
> repro this issue in my side. :-)

Unfortunately, in the other thread, we only noticed that this was
missing, and weren't entirely sure of the issue.

IIUC, without pmu::module initialised, the module can be freed
immediately after an event is created by perf_init_event(), while the
event is still around, with dangling pointers to the PMU (and other data
structures owned by the module that have been freed).

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-20 15:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-03 11:33 perf/x86/amd/power missing pmu::module initialisation Mark Rutland
2017-11-07 12:50 ` Huang Rui
2017-11-07 12:54   ` Huang Rui
2017-11-20 15:55   ` Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).