Messages in this thread | | | Date | Sat, 9 Sep 2023 16:59:57 +0800 | Subject | Re: [PATCH bpf-next v5 3/3] bpf, arm64: use bpf_jit_binary_pack_alloc | From | Xu Kuohai <> |
| |
On 9/8/2023 10:43 PM, Puranjay Mohan wrote:
[ ... ]
> + > +void bpf_jit_free(struct bpf_prog *prog) > +{ > + if (prog->jited) { > + struct arm64_jit_data *jit_data = prog->aux->jit_data; > + struct bpf_binary_header *hdr; > + > + /* > + * If we fail the final pass of JIT (from jit_subprogs), > + * the program may not be finalized yet. Call finalize here > + * before freeing it. > + */ > + if (jit_data) { > + bpf_jit_binary_pack_finalize(prog, jit_data->ro_header, > + jit_data->header);
bpf_jit_binary_pack_finalize copies all instructions on the rw image to the ro_image, which is unnecessary in a free function.
> + kfree(jit_data); > + } > + hdr = bpf_jit_binary_pack_hdr(prog); > + bpf_jit_binary_pack_free(hdr, NULL); > + WARN_ON_ONCE(!bpf_prog_kallsyms_verify_off(prog)); > + } > + > + bpf_prog_unlock_free(prog); > +}
| |