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@xxxxxxxxxx> --- 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