Patch "bpf: move fixup_bpf_calls() function" has been added to the 4.4-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
bpf: move fixup_bpf_calls() function
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
bpf-move-fixup_bpf_calls-function.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
e245c5c6a5656e4d61aa7bb08e9694fd6e5b2b9dMon Sep 17 00:00:00 2001
From: Alexei Starovoitov <[email protected]>
Date: Wed, 15 Mar 2017 18:26:39 -0700
Subject: bpf: move fixup_bpf_calls() function
From: Alexei Starovoitov <[email protected]>
commit e245c5c6a5656e4d61aa7bb08e9694fd6e5b2b9d upstream.
no functional change.
move fixup_bpf_calls() to verifier.c
it's being refactored in the next patch
--- kernel/bpf/syscall.c | 54 ------------------------------------------------- kernel/bpf/verifier.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 54 deletions(-)
kernel/bpf/syscall.c +0 -54
@@ -447,57 +447,6 @@ void bpf_register_prog_type(struct bpf_plist_add (&tl->list_node, &bpf_prog_types); } -/* fixup insn->imm field of bpf_call instructions: -* if (insn->imm == BPF_FUNC_map_lookup_elem) -* insn->imm = bpf_map_lookup_elem - __bpf_call_base; -* else if (insn->imm == BPF_FUNC_map_update_elem) -* insn->imm = bpf_map_update_elem - __bpf_call_base; -* else ... -* -* this function is called after eBPF program passed verification -*/ -static void fixup_bpf_calls (struct bpf_prog *prog) -{ -const struct bpf_func_proto *fn; -int i; - -for (i =0 ; i < prog->len; i++) { -struct bpf_insn *insn = &prog->insnsi[i]; - -if (insn->code == (BPF_JMP |BPF_CALL )) { -/* we reach here when program has bpf_call instructions -* and it passed bpf_check(), means that -* ops->get_func_proto must have been supplied, check it -*/ -BUG_ON (!prog->aux->ops->get_func_proto); - -if (insn->imm == BPF_FUNC_get_route_realm) - prog->dst_needed =1 ; -if (insn->imm == BPF_FUNC_get_prandom_u32) -bpf_user_rnd_init_once (); -if (insn->imm == BPF_FUNC_tail_call) { -/* mark bpf_tail_call as different opcode -* to avoid conditional branch in -* interpeter for every normal call -* and to prevent accidental JITing by -* JIT compiler that doesn't support -* bpf_tail_call yet -*/ - insn->imm =0 ; - insn->code |=BPF_X ; -continue ; - } - - fn = prog->aux->ops->get_func_proto (insn->imm); -/* all functions that have prototype and verifier allowed -* programs to call them, must be real in-kernel functions -*/ -BUG_ON (!fn->func); - insn->imm = fn->func - __bpf_call_base; - } - } -} -/* drop refcnt on maps used by eBPF program and free auxilary data */ static void free_used_maps (struct bpf_prog_aux *aux) {
@@ -680,9 +629,6 @@ static int bpf_prog_load(union bpf_attrif (err <0 ) goto free_used_maps; -/* fixup BPF_CALL->imm field */ -fixup_bpf_calls (prog); -/* eBPF program is ready to be JITed */ err =bpf_prog_select_runtime (prog);if (err <0 )
kernel/bpf/verifier.c +55 -0
67 lines not on this page · raw message
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/bpf-adjust-insn_aux_data-when-patching-insns.patch queue-4.4/bpf-refactor-fixup_bpf_calls.patch queue-4.4/bpf-move-fixup_bpf_calls-function.patch