bpf: prepare bpf_int_jit_compile/bpf_prog_select_runtime apis

Since the blinding is strictly only called from inside eBPF JITs,
we need to change signatures for bpf_int_jit_compile() and
bpf_prog_select_runtime() first in order to prepare that the
eBPF program we're dealing with can change underneath. Hence,
for call sites, we need to return the latest prog. No functional
change in this patch.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Daniel Borkmann
2016-05-13 19:08:31 +02:00
zatwierdzone przez David S. Miller
rodzic c237ee5eb3
commit d1c55ab5e4
8 zmienionych plików z 40 dodań i 18 usunięć

Wyświetl plik

@@ -762,7 +762,7 @@ void bpf_jit_compile(struct bpf_prog *prog)
/* Nothing to do here. We support Internal BPF. */
}
void bpf_int_jit_compile(struct bpf_prog *prog)
struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
{
struct bpf_binary_header *header;
struct jit_ctx ctx;
@@ -770,14 +770,14 @@ void bpf_int_jit_compile(struct bpf_prog *prog)
u8 *image_ptr;
if (!bpf_jit_enable)
return;
return prog;
memset(&ctx, 0, sizeof(ctx));
ctx.prog = prog;
ctx.offset = kcalloc(prog->len, sizeof(int), GFP_KERNEL);
if (ctx.offset == NULL)
return;
return prog;
/* 1. Initial fake pass to compute ctx->idx. */
@@ -828,6 +828,7 @@ void bpf_int_jit_compile(struct bpf_prog *prog)
prog->jited = 1;
out:
kfree(ctx.offset);
return prog;
}
void bpf_jit_free(struct bpf_prog *prog)