Commit 744ea4e3 authored by Gilad Reti's avatar Gilad Reti Committed by Alexei Starovoitov

bpf: Support PTR_TO_MEM{,_OR_NULL} register spilling

Add support for pointer to mem register spilling, to allow the verifier
to track pointers to valid memory addresses. Such pointers are returned
for example by a successful call of the bpf_ringbuf_reserve helper.

The patch was partially contributed by CyberArk Software, Inc.

Fixes: 457f4436 ("bpf: Implement BPF ring buffer and verifier support for it")
Suggested-by: default avatarYonghong Song <yhs@fb.com>
Signed-off-by: default avatarGilad Reti <gilad.reti@gmail.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Acked-by: default avatarKP Singh <kpsingh@kernel.org>
Link: https://lore.kernel.org/bpf/20210113053810.13518-1-gilad.reti@gmail.com
parent 7ac6ad05
...@@ -2217,6 +2217,8 @@ static bool is_spillable_regtype(enum bpf_reg_type type) ...@@ -2217,6 +2217,8 @@ static bool is_spillable_regtype(enum bpf_reg_type type)
case PTR_TO_RDWR_BUF: case PTR_TO_RDWR_BUF:
case PTR_TO_RDWR_BUF_OR_NULL: case PTR_TO_RDWR_BUF_OR_NULL:
case PTR_TO_PERCPU_BTF_ID: case PTR_TO_PERCPU_BTF_ID:
case PTR_TO_MEM:
case PTR_TO_MEM_OR_NULL:
return true; return true;
default: default:
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment