bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Song Liu <songliubraving@fb.com>
To: <bpf@vger.kernel.org>, <netdev@vger.kernel.org>, <linux-mm@kvack.org>
Cc: <ast@kernel.org>, <daniel@iogearbox.net>, <kernel-team@fb.com>,
	<akpm@linux-foundation.org>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>
Subject: [PATCH v7 bpf-next 2/3] bpf: allow bpf_d_path in bpf_iter program
Date: Fri, 12 Feb 2021 10:31:06 -0800	[thread overview]
Message-ID: <20210212183107.50963-3-songliubraving@fb.com> (raw)
In-Reply-To: <20210212183107.50963-1-songliubraving@fb.com>

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 --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);

  parent reply	other threads:[~2021-02-12 18:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-12 18:31 [PATCH v7 bpf-next 0/3] introduce bpf_iter for task_vma Song Liu
2021-02-12 18:31 ` [PATCH v7 bpf-next 1/3] bpf: introduce task_vma bpf_iter Song Liu
2021-02-12 18:31 ` Song Liu [this message]
2021-02-12 18:31 ` [PATCH v7 bpf-next 3/3] selftests/bpf: add test for bpf_iter_task_vma Song Liu
2021-02-12 21:04 ` [PATCH v7 bpf-next 0/3] introduce bpf_iter for task_vma Alexei Starovoitov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210212183107.50963-3-songliubraving@fb.com \
    --to=songliubraving@fb.com \
    --cc=akpm@linux-foundation.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=linux-mm@kvack.org \
    --cc=netdev@vger.kernel.org \
    --cc=yhs@fb.com \
    --subject='Re: [PATCH v7 bpf-next 2/3] bpf: allow bpf_d_path in bpf_iter program' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).