diff options
author | Song Liu <song@kernel.org> | 2022-02-04 10:57:37 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-02-07 18:13:01 -0800 |
commit | d00c6473b1ee9050cc36d008c6d30bf0d3de0524 (patch) | |
tree | 493b8a3576135a0d05ec3c8238c719675b60d3a5 /kernel/bpf/core.c | |
parent | ed2d9e1a26cca963ff5ed3b76326d70f7d8201a9 (diff) | |
download | linux-stable-d00c6473b1ee9050cc36d008c6d30bf0d3de0524.tar.gz linux-stable-d00c6473b1ee9050cc36d008c6d30bf0d3de0524.tar.bz2 linux-stable-d00c6473b1ee9050cc36d008c6d30bf0d3de0524.zip |
bpf: Use prog->jited_len in bpf_prog_ksym_set_addr()
Using prog->jited_len is simpler and more accurate than current
estimation (header + header->size).
Also, fix missing prog->jited_len with multi function program. This hasn't
been a real issue before this.
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220204185742.271030-5-song@kernel.org
Diffstat (limited to 'kernel/bpf/core.c')
-rw-r--r-- | kernel/bpf/core.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 14199228a6f0..e3fe53df0a71 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -537,13 +537,10 @@ long bpf_jit_limit_max __read_mostly; static void bpf_prog_ksym_set_addr(struct bpf_prog *prog) { - const struct bpf_binary_header *hdr = bpf_jit_binary_hdr(prog); - unsigned long addr = (unsigned long)hdr; - WARN_ON_ONCE(!bpf_prog_ebpf_jited(prog)); prog->aux->ksym.start = (unsigned long) prog->bpf_func; - prog->aux->ksym.end = addr + hdr->size; + prog->aux->ksym.end = prog->aux->ksym.start + prog->jited_len; } static void |