Skip to content

Commit b34ca0e

Browse files
liu-song-6Kernel Patches Daemon
authored andcommitted
bpf: Mark cgroup_subsys_state->cgroup RCU safe
Mark struct cgroup_subsys_state->cgroup as safe under RCU read lock. This will enable accessing css->cgroup from a bpf css iterator. Signed-off-by: Song Liu <[email protected]>
1 parent 41dc740 commit b34ca0e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

kernel/bpf/verifier.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7058,6 +7058,10 @@ BTF_TYPE_SAFE_RCU(struct css_set) {
70587058
struct cgroup *dfl_cgrp;
70597059
};
70607060

7061+
BTF_TYPE_SAFE_RCU(struct cgroup_subsys_state) {
7062+
struct cgroup *cgroup;
7063+
};
7064+
70617065
/* RCU trusted: these fields are trusted in RCU CS and can be NULL */
70627066
BTF_TYPE_SAFE_RCU_OR_NULL(struct mm_struct) {
70637067
struct file __rcu *exe_file;
@@ -7108,6 +7112,7 @@ static bool type_is_rcu(struct bpf_verifier_env *env,
71087112
BTF_TYPE_EMIT(BTF_TYPE_SAFE_RCU(struct task_struct));
71097113
BTF_TYPE_EMIT(BTF_TYPE_SAFE_RCU(struct cgroup));
71107114
BTF_TYPE_EMIT(BTF_TYPE_SAFE_RCU(struct css_set));
7115+
BTF_TYPE_EMIT(BTF_TYPE_SAFE_RCU(struct cgroup_subsys_state));
71117116

71127117
return btf_nested_type_is_trusted(&env->log, reg, field_name, btf_id, "__safe_rcu");
71137118
}

0 commit comments

Comments
 (0)