Message ID | 20210113053810.13518-1-gilad.reti@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 744ea4e3885eccb6d332a06fae9eb7420a622c0f |
Headers | show |
Series | [bpf,v2,1/2] bpf: support PTR_TO_MEM{,_OR_NULL} register spilling | expand |
On Wed, Jan 13, 2021 at 6:38 AM Gilad Reti <gilad.reti@gmail.com> wrote: > > 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> Acked-by: KP Singh <kpsingh@kernel.org>
On Wed, Jan 13, 2021 at 2:29 PM KP Singh <kpsingh@kernel.org> wrote: > > On Wed, Jan 13, 2021 at 6:38 AM Gilad Reti <gilad.reti@gmail.com> wrote: > > > > 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> > > Acked-by: KP Singh <kpsingh@kernel.org> It's a border line feature vs fix. Since the patch is trivial and it addresses a real problem I've applied to the bpf tree. Thanks!
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 17270b8404f1..36af69fac591 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -2217,6 +2217,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;
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> --- kernel/bpf/verifier.c | 2 ++ 1 file changed, 2 insertions(+)