Re: [PATCHv2 bpf 0/2] bpf: Disable preemption in perf_event_output helpers code

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

 



Hi,

On 7/21/2023 8:44 PM, Jiri Olsa wrote:
> On Fri, Jul 21, 2023 at 08:12:41PM +0800, Hou Tao wrote:
>>
>> On 7/20/2023 4:57 PM, Jiri Olsa wrote:
>>> hi,
>>> we got report of kernel crash [1][3] within bpf_event_output helper.
>>>
>>> The reason is the nesting protection code in bpf_event_output that expects
>>> disabled preemption, which is not guaranteed for programs executed by
>>> bpf_prog_run_array_cg.
>>>
>>> I managed to reproduce on tracing side where we have the same problem
>>> in bpf_perf_event_output. The reproducer [2] just creates busy uprobe
>>> and call bpf_perf_event_output helper a lot.
>> It is a little strange that I can not reproduce the same problem on my
>> local VM by using the same reproducer from [2]. I have already enabled
>> both CONFIG_PREEMPT=y and CONFIG_PREEMPT_RCU=y.
> I have 4 cpu VM and I run '# ./test_progs -t krava -v' together with test
> instance for each of cpu, like:
>
>    # ./test & ./test & ./test & ./test &
>
> and it's hit within 15 minutes
>
> attaching my config so you can compare, but can't think of another
> option you need

By using my .config, the reproduce just cost about 2 hours. I will try
your .config to see whether or not there is any difference.
>
>
>>> v2 changes:
>>>   - I changed 'Fixes' commits to where I saw we switched from preempt_disable
>>>     to migrate_disable, but I'm not completely sure about the patch 2, because
>>>     it was tricky to find, would be nice if somebody could check on that
>> After digging into the change log, I think the fix tag is correct. In
>> commit 2a916f2f546c, preempt_disable() is changed to migrate_disable()
>> in the macro BPF_PROG_RUN_ARRAY(), and in commit 772412176fb9,
>> BPF_PROG_RUN_ARRAY_FLAGS() was added for
>> __cgroup_bpf_run_filter_sock_addr() and the implementation of
>> BPF_PROG_RUN_ARRAY_FLAGS() was basically copied from
>> BPF_PROG_RUN_ARRAY(). And afterwards, BPF_PROG_RUN_ARRAY_FLAGS was
>> rename to BPF_PROG_RUN_ARRAY_CG_FLAGS, then
>> bpf_prog_run_array_cg_flags(), and was renamed to
>> bpf_prog_run_array_cg() in the final.
> thanks for checking on that
You are welcome. Hope it is helpful.

Regards,
Hou
>
> 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