Re: [PATCH] bpf: fix a race between perf_event_fd and kprobe freeing

From: Alexei Starovoitov
Date: Fri May 15 2015 - 11:59:16 EST


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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/