Re: [PATCH] perf/x86: Check data address for IBS software filter

Namhyung Kim
2025-03-17T16:23:50Z

On Mon, Mar 17, 2025 at 09:02:12AM -0700, Namhyung Kim wrote:
> Hi Ravi,
>
> On Mon, Mar 17, 2025 at 06:59:33PM +0530, Ravi Bangoria wrote:
> > Hi Namhyung,
> >
> > > @@ -1286,6 +1286,13 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs)
> > > if (perf_ibs == &perf_ibs_op)
> > > perf_ibs_parse_ld_st_data(event->attr.sample_type, &ibs_data, &data);
> > >
> > > + if ((event->attr.config2 & IBS_SW_FILTER_MASK) &&
> > > + (event->attr.sample_type & PERF_SAMPLE_ADDR) &&
> > > + event->attr.exclude_kernel && !access_ok(data.addr)) {
> > > + throttle = perf_event_account_interrupt(event);
> > > + goto out;
> > > + }
> >
> > Can this move up where it checks perf_exclude_event()? Use
> > ibs_data.regs[ibs_op_msr_idx(MSR_AMD64_IBSDCLINAD)] instead
> > of data.addr.
>
> Sure, will do.

Hmm.. but I think it also needs to check op_data3_dc_lin_addr_valid bit.
Can we move up the perf_ibs_parse_ld_st_data() too and check data.addr?

Thanks,
Namhyung