diff mbox series

[v7,bpf-next,2/3] bpf: allow bpf_d_path in bpf_iter program

Message ID 20210212183107.50963-3-songliubraving@fb.com
State New
Headers show
Series introduce bpf_iter for task_vma | expand

Commit Message

Song Liu Feb. 12, 2021, 6:31 p.m. UTC
task_file and task_vma iter programs have access to file->f_path. Enable
bpf_d_path to print paths of these file.

Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
---
 kernel/trace/bpf_trace.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 6c0018abe68a0..4959da1a33d2e 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -1191,6 +1191,10 @@  BTF_SET_END(btf_allowlist_d_path)
 
 static bool bpf_d_path_allowed(const struct bpf_prog *prog)
 {
+	if (prog->type == BPF_PROG_TYPE_TRACING &&
+	    prog->expected_attach_type == BPF_TRACE_ITER)
+		return true;
+
 	if (prog->type == BPF_PROG_TYPE_LSM)
 		return bpf_lsm_is_sleepable_hook(prog->aux->attach_btf_id);