From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Borkmann Subject: Re: [PATCH net-next 1/9] bpf: prevent kprobe+bpf deadlocks Date: Mon, 07 Mar 2016 11:07:44 +0100 Message-ID: <56DD52F0.1060604@iogearbox.net> References: <1457315917-1970307-1-git-send-email-ast@fb.com> <1457315917-1970307-2-git-send-email-ast@fb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: Daniel Wagner , Tom Zanussi , Wang Nan , He Kuang , Martin KaFai Lau , Brendan Gregg , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com To: Alexei Starovoitov , "David S . Miller" Return-path: Received: from www62.your-server.de ([213.133.104.62]:60668 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752140AbcCGKHz (ORCPT ); Mon, 7 Mar 2016 05:07:55 -0500 In-Reply-To: <1457315917-1970307-2-git-send-email-ast@fb.com> Sender: netdev-owner@vger.kernel.org List-ID: On 03/07/2016 02:58 AM, Alexei Starovoitov wrote: > if kprobe is placed within update or delete hash map helpers > that hold bucket spin lock and triggered bpf program is trying to > grab the spinlock for the same bucket on the same cpu, it will > deadlock. > Fix it by extending existing recursion prevention mechanism. > > Note, map_lookup and other tracing helpers don't have this problem, > since they don't hold any locks and don't modify global data. > bpf_trace_printk has its own recursive check and ok as well. > > Signed-off-by: Alexei Starovoitov LGTM Acked-by: Daniel Borkmann