All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexei Starovoitov <ast@plumgrid.com>
To: Wang Nan <wangnan0@huawei.com>
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
Date: Fri, 15 May 2015 08:59:04 -0700	[thread overview]
Message-ID: <555617C8.1070309@plumgrid.com> (raw)
In-Reply-To: <1431687144-130670-1-git-send-email-wangnan0@huawei.com>

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.


      reply	other threads:[~2015-05-15 15:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-15 10:52 [PATCH] bpf: fix a race between perf_event_fd and kprobe freeing Wang Nan
2015-05-15 15:59 ` Alexei Starovoitov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=555617C8.1070309@plumgrid.com \
    --to=ast@plumgrid.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=pi3orama@163.com \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.