Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946109AbbEOP7M (ORCPT ); Fri, 15 May 2015 11:59:12 -0400 Received: from mail-ig0-f175.google.com ([209.85.213.175]:33683 "EHLO mail-ig0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934788AbbEOP7H (ORCPT ); Fri, 15 May 2015 11:59:07 -0400 Message-ID: <555617C8.1070309@plumgrid.com> Date: Fri, 15 May 2015 08:59:04 -0700 From: Alexei Starovoitov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Wang Nan CC: lizefan@huawei.com, linux-kernel@vger.kernel.org, pi3orama@163.com Subject: Re: [PATCH] bpf: fix a race between perf_event_fd and kprobe freeing References: <1431687144-130670-1-git-send-email-wangnan0@huawei.com> In-Reply-To: <1431687144-130670-1-git-send-email-wangnan0@huawei.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 861 Lines: 27 On 5/15/15 3:52 AM, Wang Nan wrote: > According to Alexei Starovoitov (http://lkml.org/lkml/2015/5/15/29), > there is racing between perf_event_fd and kprobe freeing: ... > And he suggest to call perf_event_free_bpf_prog() from __free_event() > instead of free_event_rcu() will fix the race, ... > @@ -3564,6 +3563,8 @@ static void __free_event(struct perf_event *event) > module_put(event->pmu->module); > } > > + perf_event_free_bpf_prog(event); > + > call_rcu(&event->rcu_head, free_event_rcu); > } I don't think that's the right place. It needs to be before destroy(). I will send a patch soon. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/