From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH bpf 1/2] bpf, x64: fix memleak when not converging after image Date: Wed, 02 May 2018 14:53:51 -0400 (EDT) Message-ID: <20180502.145351.1788075051189752807.davem@davemloft.net> References: <20180502181223.30613-1-daniel@iogearbox.net> <20180502181223.30613-2-daniel@iogearbox.net> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: ast@kernel.org, netdev@vger.kernel.org To: daniel@iogearbox.net Return-path: Received: from shards.monkeyblade.net ([184.105.139.130]:36174 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751030AbeEBSxw (ORCPT ); Wed, 2 May 2018 14:53:52 -0400 In-Reply-To: <20180502181223.30613-2-daniel@iogearbox.net> Sender: netdev-owner@vger.kernel.org List-ID: From: Daniel Borkmann Date: Wed, 2 May 2018 20:12:22 +0200 > While reviewing x64 JIT code, I noticed that we leak the prior allocated > JIT image in the case where proglen != oldproglen during the JIT passes. > Prior to the commit e0ee9c12157d ("x86: bpf_jit: fix two bugs in eBPF JIT > compiler") we would just break out of the loop, and using the image as the > JITed prog since it could only shrink in size anyway. After e0ee9c12157d, > we would bail out to out_addrs label where we free addrs and jit_data but > not the image coming from bpf_jit_binary_alloc(). > > Fixes: e0ee9c12157d ("x86: bpf_jit: fix two bugs in eBPF JIT compiler") > Signed-off-by: Daniel Borkmann > Acked-by: Alexei Starovoitov Acked-by: David S. Miller