lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <555C1B29.1070404@plumgrid.com>
Date:	Tue, 19 May 2015 22:27:05 -0700
From:	Alexei Starovoitov <ast@...mgrid.com>
To:	Ingo Molnar <mingo@...nel.org>
CC:	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Arnaldo Carvalho de Melo <acme@...radead.org>,
	Wang Nan <wangnan0@...wei.com>, lizefan@...wei.com,
	pi3orama@....com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH tip] perf/events/core: fix race in bpf program unregister

On 5/15/15 12:15 PM, Alexei Starovoitov wrote:
> there is a race between perf_event_free_bpf_prog() and free_trace_kprobe():
>
> __free_event()
>    event->destroy(event)
>      tp_perf_event_destroy()
>        perf_trace_destroy()
>          perf_trace_event_unreg()
>
> which is dropping event->tp_event->perf_refcount and allows to proceed in:
>
> unregister_trace_kprobe()
>    unregister_kprobe_event()
>        trace_remove_event_call()
>              probe_remove_event_call()
> free_trace_kprobe()
>
> while __free_event does:
> call_rcu(&event->rcu_head, free_event_rcu);
>    free_event_rcu()
>      perf_event_free_bpf_prog()
>
> To fix the race simply move perf_event_free_bpf_prog() before
> event->destroy(), since event->tp_event is still valid at that point.
>
> Note, perf_trace_destroy() is not racing with trace_remove_event_call()
> since they both grab event_mutex.
>
> Fixes: 2541517c32be ("tracing, perf: Implement BPF programs attached to kprobes")
> Reported-by: Wang Nan <wangnan0@...wei.com>
> Signed-off-by: Alexei Starovoitov <ast@...mgrid.com>

ping.
This is needed in 4.1.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ