Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] bpf: permit map_ptr arithmetic with opcode add and offset 0
@ 2020-09-04 19:49 Yonghong Song
  2020-09-04 19:49 ` [PATCH bpf-next 1/2] " Yonghong Song
  2020-09-04 19:49 ` [PATCH bpf-next 2/2] selftests/bpf: add test for map_ptr arithmetic Yonghong Song
  0 siblings, 2 replies; 8+ messages in thread
From: Yonghong Song @ 2020-09-04 19:49 UTC (permalink / raw)
  To: bpf, netdev; +Cc: Alexei Starovoitov, Daniel Borkmann, kernel-team

With CORE, it is possible that the compiler may produce code like
  r1 = 0  // relocation instruction
  map_ptr += r1
  ...
Currently verifier does not allow map_ptr arithmetic, even for adding with 0.
This patch set relaxed the condition so the above code can be accepted.
Patch #1 is the kernel implementation and Patch #2 added selftest tests to
cover the new functionality.

Yonghong Song (2):
  bpf: permit map_ptr arithmetic with opcode add and offset 0
  selftests/bpf: add test for map_ptr arithmetic

 kernel/bpf/verifier.c                         |  3 ++
 .../selftests/bpf/progs/map_ptr_kern.c        |  4 +--
 .../testing/selftests/bpf/verifier/map_ptr.c  | 32 +++++++++++++++++++
 3 files changed, 37 insertions(+), 2 deletions(-)

-- 
2.24.1


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

end of thread, other threads:[~2020-09-07 14:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-04 19:49 [PATCH bpf-next 0/2] bpf: permit map_ptr arithmetic with opcode add and offset 0 Yonghong Song
2020-09-04 19:49 ` [PATCH bpf-next 1/2] " Yonghong Song
2020-09-04 20:30   ` Andrii Nakryiko
2020-09-04 23:20     ` Yonghong Song
2020-09-05  0:08       ` Andrii Nakryiko
2020-09-05  0:10         ` Alexei Starovoitov
2020-09-07 14:21           ` Daniel Borkmann
2020-09-04 19:49 ` [PATCH bpf-next 2/2] selftests/bpf: add test for map_ptr arithmetic Yonghong Song

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).