]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
bpf, x64: fix memleak when not converging after image
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 2 May 2018 18:12:22 +0000 (20:12 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 1 Oct 2018 12:56:15 +0000 (14:56 +0200)
commit7aa3b8f7f560a6da24e436bf7504df3e54f7d751
treed1b1184864ccf09d89c01e04f6a3c74041e23ea9
parent4db3773b7ca06be36272456111828937cc02eb7d
bpf, x64: fix memleak when not converging after image

BugLink: http://bugs.launchpad.net/bugs/1794889
[ Upstream commit 3aab8884c9eb99189a3569ac4e6b205371c9ac0b ]

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 <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
arch/x86/net/bpf_jit_comp.c