summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorGilad Reti <gilad.reti@gmail.com>2021-01-13 08:38:07 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-01-23 18:03:58 +0300
commitde661caaee07fab787c4fdb7062d100273c38d80 (patch)
treeb5cbe4cb84ced48dcabc940dbbc607c4f0a6491c /kernel
parent3ed29995c281762df98cccf86afbddbfb6a918ef (diff)
downloadlinux-de661caaee07fab787c4fdb7062d100273c38d80.tar.xz
bpf: Support PTR_TO_MEM{,_OR_NULL} register spilling
commit 744ea4e3885eccb6d332a06fae9eb7420a622c0f upstream. 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: 457f44363a88 ("bpf: Implement BPF ring buffer and verifier support for it") Suggested-by: Yonghong Song <yhs@fb.com> Signed-off-by: Gilad Reti <gilad.reti@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: KP Singh <kpsingh@kernel.org> Link: https://lore.kernel.org/bpf/20210113053810.13518-1-gilad.reti@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/bpf/verifier.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 1c10a8bccf5c..618cb1b451ad 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -2214,6 +2214,8 @@ static bool is_spillable_regtype(enum bpf_reg_type type)
case PTR_TO_RDWR_BUF:
case PTR_TO_RDWR_BUF_OR_NULL:
case PTR_TO_PERCPU_BTF_ID:
+ case PTR_TO_MEM:
+ case PTR_TO_MEM_OR_NULL:
return true;
default:
return false;