From bdbf1ffe1cf9ba75df39e8f788cde0e9c2641b86 Mon Sep 17 00:00:00 2001 From: Alexei Starovoitov Date: Fri, 31 Mar 2023 17:51:03 -0700 Subject: bpf: wip. this should be MAYBE_NULL. Signed-off-by: Alexei Starovoitov --- kernel/bpf/verifier.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 19d0c39c6d702a..8af3844ed34dbc 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -5391,12 +5391,25 @@ BTF_TYPE_SAFE_RCU(struct task_struct) { struct css_set __rcu *cgroups; struct task_struct __rcu *real_parent; struct task_struct *group_leader; + struct mm_struct *mm; +}; + +BTF_TYPE_SAFE_RCU(struct cgroup) { + struct kernfs_node *kn; }; BTF_TYPE_SAFE_RCU(struct css_set) { struct cgroup *dfl_cgrp; }; +BTF_TYPE_SAFE_RCU(struct mm_struct) { + struct file __rcu *exe_file; +}; + +BTF_TYPE_SAFE_RCU(struct sk_buff) { + struct sock *sk; +}; + /* full trusted: these fields are trusted even outside of RCU CS and never NULL */ BTF_TYPE_SAFE_TRUSTED(struct bpf_iter_meta) { struct seq_file *seq; @@ -5429,7 +5442,10 @@ static bool type_is_rcu(struct bpf_verifier_env *env, const char *field_name, u32 btf_id) { BTF_TYPE_EMIT(BTF_TYPE_SAFE_RCU(struct task_struct)); + BTF_TYPE_EMIT(BTF_TYPE_SAFE_RCU(struct cgroup)); BTF_TYPE_EMIT(BTF_TYPE_SAFE_RCU(struct css_set)); + BTF_TYPE_EMIT(BTF_TYPE_SAFE_RCU(struct mm_struct)); + BTF_TYPE_EMIT(BTF_TYPE_SAFE_RCU(struct sk_buff)); return btf_nested_type_is_trusted(&env->log, reg, field_name, btf_id, "__safe_rcu"); } -- cgit 1.2.3-korg