diff options
author | Yonghong Song <yhs@fb.com> | 2022-11-24 08:32:06 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-11-24 23:27:13 +0300 |
commit | 5a0f663f0189cf9e031e444f97c029717a99548d (patch) | |
tree | 0dd762e2a1dd2888ed55519212d0d0f4f782a761 /kernel/trace | |
parent | f471748b7fe5ab7ec6de4cbadffabfa7bb5b6240 (diff) | |
download | linux-5a0f663f0189cf9e031e444f97c029717a99548d.tar.xz |
compiler_types: Define __rcu as __attribute__((btf_type_tag("rcu")))
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.
Acked-by: KP Singh <kpsingh@kernel.org>
Acked-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/r/20221124053206.2373141-1-yhs@fb.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/trace')
0 files changed, 0 insertions, 0 deletions