提交 60ef0494 编写于 作者: D Daniel Borkmann 提交者: Catalin Marinas

net: bpf: arm64: fix module memory leak when JIT image build fails

On ARM64, when the BPF JIT compiler fills the JIT image body with
opcodes during translation of eBPF into ARM64 opcodes, we may fail
for several reasons during that phase: one being that we jump to
the notyet label for not yet supported eBPF instructions such as
BPF_ST. In that case we only free offsets, but not the actual
allocated target image where opcodes are being stored. Fix it by
calling module_free() on dismantle time in case of errors.
Signed-off-by: NDaniel Borkmann <dborkman@redhat.com>
Acked-by: NZi Shen Lim <zlim.lnx@gmail.com>
Acked-by: NWill Deacon <will.deacon@arm.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
上级 c2eb6b61
......@@ -651,8 +651,10 @@ void bpf_int_jit_compile(struct bpf_prog *prog)
build_prologue(&ctx);
ctx.body_offset = ctx.idx;
if (build_body(&ctx))
if (build_body(&ctx)) {
module_free(NULL, ctx.image);
goto out;
}
build_epilogue(&ctx);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册