BPF List
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@meta.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Jiri Olsa <jolsa@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>, bpf <bpf@vger.kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@chromium.org>,
	Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>
Subject: Re: [PATCHv4 bpf-next 1/4] bpf: Mark vma objects as trusted for task_vma iter and find_vma callback
Date: Mon, 28 Nov 2022 11:04:38 -0800	[thread overview]
Message-ID: <f4b16d4c-9ab9-ad3c-c518-294b564a6348@meta.com> (raw)
In-Reply-To: <CAADnVQKED=Ue_s88Ru25s1UQ+xe2eWXTq_02v_h=qiuxXTck=g@mail.gmail.com>



On 11/28/22 10:43 AM, Alexei Starovoitov wrote:
> On Mon, Nov 28, 2022 at 5:29 AM Jiri Olsa <jolsa@kernel.org> wrote:
>>
>> Marking following vma objects as trusted so they can be used
>> as arguments for kfunc function added in following changes:
>>
>>    - vma object argument in find_vma callback function
>>    - vma object in context of task_vma iterator program
>>
>> Both places lock vma object so it can't go away while running
>> the bpf program.
>>
>> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
>> ---
>>   kernel/bpf/task_iter.c | 2 +-
>>   kernel/bpf/verifier.c  | 2 +-
>>   2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/bpf/task_iter.c b/kernel/bpf/task_iter.c
>> index c2a2182ce570..cd67b3cadd91 100644
>> --- a/kernel/bpf/task_iter.c
>> +++ b/kernel/bpf/task_iter.c
>> @@ -755,7 +755,7 @@ static struct bpf_iter_reg task_vma_reg_info = {
>>                  { offsetof(struct bpf_iter__task_vma, task),
>>                    PTR_TO_BTF_ID_OR_NULL },
>>                  { offsetof(struct bpf_iter__task_vma, vma),
>> -                 PTR_TO_BTF_ID_OR_NULL },
>> +                 PTR_TO_BTF_ID_OR_NULL | PTR_TRUSTED },
> 
> Yonghong, Song,
> 
> Do you remember when task or vma is NULL here?
> Maybe we can do: if (!task || !vma) skip prog run
> in __task_vma_seq_show()
> and make both pointers as PTR_TO_BTF_ID | PTR_TRUSTED?

The 'NULL' is to indicate the last bpf prog run before iteration
ends. It is to provide an opportunity for bpf program to know
all regular iterations are done and the bpf program can do
end aggregation or print a footer if the prog link is cat'able.


  reply	other threads:[~2022-11-28 19:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28 13:29 [PATCHv4 bpf-next 0/4] bpf: Add bpf_vma_build_id_parse kfunc Jiri Olsa
2022-11-28 13:29 ` [PATCHv4 bpf-next 1/4] bpf: Mark vma objects as trusted for task_vma iter and find_vma callback Jiri Olsa
2022-11-28 18:43   ` Alexei Starovoitov
2022-11-28 19:04     ` Yonghong Song [this message]
2022-11-28 20:25       ` Alexei Starovoitov
2022-11-28 13:29 ` [PATCHv4 bpf-next 2/4] bpf: Add bpf_vma_build_id_parse function and kfunc Jiri Olsa
2022-11-28 21:36   ` Alexei Starovoitov
2022-11-29  8:45     ` Jiri Olsa
2022-11-29  1:15   ` Andrii Nakryiko
2022-11-29  6:20     ` Hao Luo
2022-11-30  0:35       ` Andrii Nakryiko
2022-11-30  1:27         ` Hao Luo
2022-12-01  1:11           ` Andrii Nakryiko
2022-11-29  8:52     ` Jiri Olsa
2022-11-28 13:29 ` [PATCHv4 bpf-next 3/4] selftests/bpf: Add bpf_vma_build_id_parse find_vma callback test Jiri Olsa
2022-11-28 19:25   ` Hao Luo
2022-11-29  8:32     ` Jiri Olsa
2022-11-28 13:29 ` [PATCHv4 bpf-next 4/4] selftests/bpf: Add bpf_vma_build_id_parse task vma iterator test Jiri Olsa
2022-11-28 19:21   ` Hao Luo
2022-11-29  8:29     ` Jiri Olsa

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=f4b16d4c-9ab9-ad3c-c518-294b564a6348@meta.com \
    --to=yhs@meta.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kafai@fb.com \
    --cc=kpsingh@chromium.org \
    --cc=sdf@google.com \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox