diff options
author | Hao Luo <haoluo@google.com> | 2021-12-17 01:31:50 +0100 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2021-12-18 22:27:41 +0100 |
commit | 34d3a78c681e8e7844b43d1a2f4671a04249c821 (patch) | |
tree | d0a60ddfc12cc916d80923b04d80f01ae69c1301 /kernel/seccomp.c | |
parent | bpf: Convert PTR_TO_MEM_OR_NULL to composable types. (diff) | |
download | linux-34d3a78c681e8e7844b43d1a2f4671a04249c821.tar.xz linux-34d3a78c681e8e7844b43d1a2f4671a04249c821.zip |
bpf: Make per_cpu_ptr return rdonly PTR_TO_MEM.
Tag the return type of {per, this}_cpu_ptr with RDONLY_MEM. The
returned value of this pair of helpers is kernel object, which
can not be updated by bpf programs. Previously these two helpers
return PTR_OT_MEM for kernel objects of scalar type, which allows
one to directly modify the memory. Now with RDONLY_MEM tagging,
the verifier will reject programs that write into RDONLY_MEM.
Fixes: 63d9b80dcf2c ("bpf: Introducte bpf_this_cpu_ptr()")
Fixes: eaa6bcb71ef6 ("bpf: Introduce bpf_per_cpu_ptr()")
Fixes: 4976b718c355 ("bpf: Introduce pseudo_btf_id")
Signed-off-by: Hao Luo <haoluo@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20211217003152.48334-8-haoluo@google.com
Diffstat (limited to 'kernel/seccomp.c')
0 files changed, 0 insertions, 0 deletions