From: Jiri Olsa <jolsa@kernel.org>
To: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>
Cc: 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: [PATCHv4 bpf-next 1/4] bpf: Mark vma objects as trusted for task_vma iter and find_vma callback
Date: Mon, 28 Nov 2022 14:29:12 +0100 [thread overview]
Message-ID: <20221128132915.141211-2-jolsa@kernel.org> (raw)
In-Reply-To: <20221128132915.141211-1-jolsa@kernel.org>
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 },
},
.seq_info = &task_vma_seq_info,
.fill_link_info = bpf_iter_fill_link_info,
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 6599d25dae38..2f04cab023be 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -7206,7 +7206,7 @@ static int set_find_vma_callback_state(struct bpf_verifier_env *env,
*/
callee->regs[BPF_REG_1] = caller->regs[BPF_REG_1];
- callee->regs[BPF_REG_2].type = PTR_TO_BTF_ID;
+ callee->regs[BPF_REG_2].type = PTR_TO_BTF_ID | PTR_TRUSTED;
__mark_reg_known_zero(&callee->regs[BPF_REG_2]);
callee->regs[BPF_REG_2].btf = btf_vmlinux;
callee->regs[BPF_REG_2].btf_id = btf_tracing_ids[BTF_TRACING_TYPE_VMA],
--
2.38.1
next prev parent reply other threads:[~2022-11-28 13:29 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 ` Jiri Olsa [this message]
2022-11-28 18:43 ` [PATCHv4 bpf-next 1/4] bpf: Mark vma objects as trusted for task_vma iter and find_vma callback Alexei Starovoitov
2022-11-28 19:04 ` Yonghong Song
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=20221128132915.141211-2-jolsa@kernel.org \
--to=jolsa@kernel.org \
--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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.