aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin KaFai Lau <kafai@fb.com>2018-12-12 13:18:21 -0500
committerDaniel Borkmann <daniel@iogearbox.net>2018-12-13 06:16:30 -0500
commit9e794163a69c103633fefb10a3879408d4e4e2c8 (patch)
treea1dc0e3054d7b2c184c58c9cdcba720c86fb34c7
parent00842be52f2015c3c1028e16b565f325f4ca20fc (diff)
bpf: Remove bpf_dump_raw_ok() check for func_info and line_info
The func_info and line_info have the bpf insn offset but they do not contain kernel address. They will still be useful for the userspace tool to annotate the xlated insn. This patch removes the bpf_dump_raw_ok() guard for the func_info and line_info during bpf_prog_get_info_by_fd(). The guard stays for jited_line_info which contains the kernel address. Although this bpf_dump_raw_ok() guard behavior has started since the earlier func_info patch series, I marked the Fixes tag to the latest line_info patch series which contains both func_info and line_info and this patch is fixing for both of them. Fixes: c454a46b5efd ("bpf: Add bpf_line_info support") Signed-off-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r--kernel/bpf/syscall.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 70fb11106fc2..b7c585838c72 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -2272,33 +2272,25 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog,
2272 ulen = info.nr_func_info; 2272 ulen = info.nr_func_info;
2273 info.nr_func_info = prog->aux->func_info_cnt; 2273 info.nr_func_info = prog->aux->func_info_cnt;
2274 if (info.nr_func_info && ulen) { 2274 if (info.nr_func_info && ulen) {
2275 if (bpf_dump_raw_ok()) { 2275 char __user *user_finfo;
2276 char __user *user_finfo;
2277 2276
2278 user_finfo = u64_to_user_ptr(info.func_info); 2277 user_finfo = u64_to_user_ptr(info.func_info);
2279 ulen = min_t(u32, info.nr_func_info, ulen); 2278 ulen = min_t(u32, info.nr_func_info, ulen);
2280 if (copy_to_user(user_finfo, prog->aux->func_info, 2279 if (copy_to_user(user_finfo, prog->aux->func_info,
2281 info.func_info_rec_size * ulen)) 2280 info.func_info_rec_size * ulen))
2282 return -EFAULT; 2281 return -EFAULT;
2283 } else {
2284 info.func_info = 0;
2285 }
2286 } 2282 }
2287 2283
2288 ulen = info.nr_line_info; 2284 ulen = info.nr_line_info;
2289 info.nr_line_info = prog->aux->nr_linfo; 2285 info.nr_line_info = prog->aux->nr_linfo;
2290 if (info.nr_line_info && ulen) { 2286 if (info.nr_line_info && ulen) {
2291 if (bpf_dump_raw_ok()) { 2287 __u8 __user *user_linfo;
2292 __u8 __user *user_linfo;
2293 2288
2294 user_linfo = u64_to_user_ptr(info.line_info); 2289 user_linfo = u64_to_user_ptr(info.line_info);
2295 ulen = min_t(u32, info.nr_line_info, ulen); 2290 ulen = min_t(u32, info.nr_line_info, ulen);
2296 if (copy_to_user(user_linfo, prog->aux->linfo, 2291 if (copy_to_user(user_linfo, prog->aux->linfo,
2297 info.line_info_rec_size * ulen)) 2292 info.line_info_rec_size * ulen))
2298 return -EFAULT; 2293 return -EFAULT;
2299 } else {
2300 info.line_info = 0;
2301 }
2302 } 2294 }
2303 2295
2304 ulen = info.nr_jited_line_info; 2296 ulen = info.nr_jited_line_info;