Re: [PATCH 1/2] bpf: Disable preemption in bpf_perf_event_output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 19, 2023 at 11:45:26AM -0700, Alexei Starovoitov wrote:
> On Wed, Jul 19, 2023 at 7:08 AM Jiri Olsa <olsajiri@xxxxxxxxx> wrote:
> >
> > now task-1 and task-2 share same bpf_trace_nest_level value and same
> > 'struct perf_sample_data' buffer on top of &sds->sds[1]
> >
> > I did not figure out yet the actual exact scenario/cause of the crash yet,
> > I suspect one of the tasks copies data over some boundary, but all the
> > ideas I had so far did not match the instructions from the crash
> >
> > anyway I thought that having 2 tasks sharing the same perf_sample_data
> > is bad enough to send the patch
> 
> It makes sense now. We forgot to update this part during
> transition from preempt_disable to migrate_disable.
> 
> But do you have PREEMPT_RCU in your kernel?

yes, I have that enabled and it's also enabled in the kernel
that originally hit this

> If not then the above race shouldn't be possible.
> Worth fixing anyway, of course.
> Can you repro with a crafted test?
> Multiple uprobes doing bpf_perf_event_output should be enough, right?
> For kprobes we're "lucky" due to bpf_prog_active.

right, I can reproduce it just with uprobe

I realized the changes are on top of bpf-next/master.. I'll rebase it
on top of bpf/master and send without RFC tag

thanks,
jirka




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux