Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bpf, arm64: Call bpf_jit_binary_pack_finalize() in bpf_jit_free()

The current implementation seems incorrect and does NOT match the
comment above, use bpf_jit_binary_pack_finalize() instead.

Fixes: 1dad391daef1 ("bpf, arm64: use bpf_prog_pack for memory management")
Acked-by: Puranjay Mohan <puranjay@kernel.org>
Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
Acked-by: Song Liu <song@kernel.org>
Acked-by: Puranjay Mohan <puranjay@kernel.org>
Link: https://lore.kernel.org/r/20250916232653.101004-1-hengqi.chen@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Hengqi Chen and committed by
Alexei Starovoitov
6ff4a0fa a24a2dda

+1 -2
+1 -2
arch/arm64/net/bpf_jit_comp.c
··· 3115 3115 * before freeing it. 3116 3116 */ 3117 3117 if (jit_data) { 3118 - bpf_arch_text_copy(&jit_data->ro_header->size, &jit_data->header->size, 3119 - sizeof(jit_data->header->size)); 3118 + bpf_jit_binary_pack_finalize(jit_data->ro_header, jit_data->header); 3120 3119 kfree(jit_data); 3121 3120 } 3122 3121 prog->bpf_func -= cfi_get_offset();