On Tue, Aug 26, 2025 at 03:19:42PM +0800, Yafang Shao wrote: > Every VMA must have an associated mm_struct, and it is safe to access Err this isn't true? Pretty sure special VMAs don't have that set. > outside of RCU. Thus, we can mark it as trusted. With this change, BPF > helpers can safely access vma->vm_mm to retrieve the associated task > from the VMA. On the basis of above don't think this is valid. > > Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx> > --- > kernel/bpf/verifier.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c > index c4f69a9e9af6..984ffbca5cbe 100644 > --- a/kernel/bpf/verifier.c > +++ b/kernel/bpf/verifier.c > @@ -7154,6 +7154,10 @@ BTF_TYPE_SAFE_TRUSTED(struct file) { > struct inode *f_inode; > }; > > +BTF_TYPE_SAFE_TRUSTED(struct vm_area_struct) { > + struct mm_struct *vm_mm; > +}; > + > BTF_TYPE_SAFE_TRUSTED_OR_NULL(struct dentry) { > struct inode *d_inode; > }; > @@ -7193,6 +7197,7 @@ static bool type_is_trusted(struct bpf_verifier_env *env, > BTF_TYPE_EMIT(BTF_TYPE_SAFE_TRUSTED(struct bpf_iter__task)); > BTF_TYPE_EMIT(BTF_TYPE_SAFE_TRUSTED(struct linux_binprm)); > BTF_TYPE_EMIT(BTF_TYPE_SAFE_TRUSTED(struct file)); > + BTF_TYPE_EMIT(BTF_TYPE_SAFE_TRUSTED(struct vm_area_struct)); > > return btf_nested_type_is_trusted(&env->log, reg, field_name, btf_id, "__safe_trusted"); > } > -- > 2.47.3 >