netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf v2 1/2] bpf: support PTR_TO_MEM{,_OR_NULL} register spilling
@ 2021-01-13  5:38 Gilad Reti
  2021-01-13  5:38 ` [PATCH bpf v2 2/2] selftests/bpf: add verifier test for PTR_TO_MEM spill Gilad Reti
  2021-01-13 22:29 ` [PATCH bpf v2 1/2] bpf: support PTR_TO_MEM{,_OR_NULL} register spilling KP Singh
  0 siblings, 2 replies; 6+ messages in thread
From: Gilad Reti @ 2021-01-13  5:38 UTC (permalink / raw)
  To: bpf
  Cc: gilad.reti, Yonghong Song, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, John Fastabend,
	KP Singh, Shuah Khan, netdev, linux-kernel, linux-kselftest

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(+)

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;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-14  4:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-13  5:38 [PATCH bpf v2 1/2] bpf: support PTR_TO_MEM{,_OR_NULL} register spilling Gilad Reti
2021-01-13  5:38 ` [PATCH bpf v2 2/2] selftests/bpf: add verifier test for PTR_TO_MEM spill Gilad Reti
2021-01-13 16:05   ` Yonghong Song
2021-01-13 22:28     ` KP Singh
2021-01-13 22:29 ` [PATCH bpf v2 1/2] bpf: support PTR_TO_MEM{,_OR_NULL} register spilling KP Singh
2021-01-14  4:02   ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).