[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210125125213.GA256721@krava>
Date: Mon, 25 Jan 2021 13:52:13 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Song Liu <songliubraving@...com>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org, ast@...nel.org,
daniel@...earbox.net, andrii@...nel.org, john.fastabend@...il.com,
kpsingh@...omium.org, kernel-team@...com
Subject: Re: [PATCH v2 bpf-next 2/4] bpf: allow bpf_d_path in sleepable
bpf_iter program
On Tue, Dec 15, 2020 at 03:37:00PM -0800, Song Liu wrote:
> task_file and task_vma iter programs have access to file->f_path. Enable
> bpf_d_path to print paths of these file.
>
> bpf_iter programs are generally called in sleepable context. However, it
> is still necessary to diffientiate sleepable and non-sleepable bpf_iter
> programs: sleepable programs have access to bpf_d_path; non-sleepable
> programs have access to bpf_spin_lock.
>
> Signed-off-by: Song Liu <songliubraving@...com>
> ---
> kernel/trace/bpf_trace.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> index 4be771df5549a..9e5f9b968355f 100644
> --- a/kernel/trace/bpf_trace.c
> +++ b/kernel/trace/bpf_trace.c
> @@ -1191,6 +1191,11 @@ 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 &&
> + prog->aux->sleepable)
> + return true;
> +
> if (prog->type == BPF_PROG_TYPE_LSM)
> return bpf_lsm_is_sleepable_hook(prog->aux->attach_btf_id);
>
> --
> 2.24.1
>
would be great to have this merged for bpftrace
Tested-by: Jiri Olsa <jolsa@...hat.com>
thanks,
jirka
Powered by blists - more mailing lists