Re: System crash with perf_fuzzer (kernel: 5.0.0-rc3)

From: Jiri Olsa
Date: Wed Jan 30 2019 - 18:13:04 EST


On Wed, Jan 30, 2019 at 12:39:47PM -0800, Andi Kleen wrote:
> Jiri Olsa <jolsa@xxxxxxxxxx> writes:
> >
> > the patch adds check_eriod pmu callback.. I need to check if there's
> > better way to do this, but so far it fixes the crash for me
> >
> > if you guys could check this patch, that'd be great
>
> There's already a limit_period callback, perhaps that could
> be extended. But ok, can do it this way too.

right, we call it within x86_perf_event_set_period to limit
the period, but I guess we should include this check after
changing the period:

if (event->attr.sample_period && x86_pmu.limit_period) {
if (x86_pmu.limit_period(event, event->attr.sample_period) >
event->attr.sample_period)
return -EINVAL;
}

>
> I suspect there are some other cases that need this callback, not
> just BTS, e.g. the checks in hsw_hw_config

ok, the sample_period values for checkpointed events,
we should check for this as well.. I'll add that

jirka