aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSong Liu <songliubraving@fb.com>2018-11-02 13:16:16 -0400
committerDaniel Borkmann <daniel@iogearbox.net>2018-11-02 16:39:01 -0400
commitde57e99ceb65d0d7775cc14a8ba5931d7de1d708 (patch)
tree9c45547a04bce09403e85d8c3f046d9bbc7950da
parentdf0734702a7cbba49d6765bd5ba069340bf9c5db (diff)
bpf: show real jited address in bpf_prog_info->jited_ksyms
Currently, jited_ksyms in bpf_prog_info shows page addresses of jited bpf program. The main reason here is to not expose randomized start address. However, this is not ideal for detailed profiling (find hot instructions from stack traces). This patch replaces the page address with real prog start address. This change is OK because bpf_prog_get_info_by_fd() is only available to root. Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r--kernel/bpf/syscall.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index ccb93277aae2..34a9eef5992c 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -2172,7 +2172,6 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog,
2172 user_ksyms = u64_to_user_ptr(info.jited_ksyms); 2172 user_ksyms = u64_to_user_ptr(info.jited_ksyms);
2173 for (i = 0; i < ulen; i++) { 2173 for (i = 0; i < ulen; i++) {
2174 ksym_addr = (ulong) prog->aux->func[i]->bpf_func; 2174 ksym_addr = (ulong) prog->aux->func[i]->bpf_func;
2175 ksym_addr &= PAGE_MASK;
2176 if (put_user((u64) ksym_addr, &user_ksyms[i])) 2175 if (put_user((u64) ksym_addr, &user_ksyms[i]))
2177 return -EFAULT; 2176 return -EFAULT;
2178 } 2177 }