On Thu, Nov 3, 2022 at 8:21 AM Yonghong Song <yhs@xxxxxx> wrote: > > Currently, without rcu attribute info in BTF, the verifier treats > rcu tagged pointer as a normal pointer. This might be a problem > for sleepable program where rcu_read_lock()/unlock() is not available. > For example, for a sleepable fentry program, if rcu protected memory > access is interleaved with a sleepable helper/kfunc, it is possible > the memory access after the sleepable helper/kfunc might be invalid > since the object might have been freed then. To prevent such cases, > introducing rcu tagging for memory accesses in verifier can help > to reject such programs. > > To enable rcu tagging in BTF, during kernel compilation, > define __rcu as attribute btf_type_tag("rcu") so __rcu information can > be preserved in dwarf and btf, and later can be used for bpf prog verification. > > Signed-off-by: Yonghong Song <yhs@xxxxxx> Acked-by: KP Singh <kpsingh@xxxxxxxxxx>