BPF List
 help / color / mirror / Atom feed
* [PATCH bpf 0/3] Block deletes from sockmap for tracing programs
@ 2024-05-27 11:20 Jakub Sitnicki
  2024-05-27 11:20 ` [PATCH bpf 1/3] bpf: Allow delete from sockmap/sockhash only if update is allowed Jakub Sitnicki
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Jakub Sitnicki @ 2024-05-27 11:20 UTC (permalink / raw)
  To: bpf
  Cc: Alexei Starovoitov, Daniel Borkmann, John Fastabend, Hillf Danton,
	Tetsuo Handa, kernel-team, syzbot+ec941d6e24f633a59172

We have seen a few syzkaller reports of locking violations triggered by
map_delete from sockmap/sockhash from an unexpected code path, for instance
when irqs were disabled, or during a kfree inside a map_update.

The consensus is [1] to block map_delete op in the verifier for programs
which are not allowed to update sockmap/sockhash already today, instead of
trying to make sockmap deletes lock-safe in every possible context.

[1] https://lore.kernel.org/r/87a5kfwe8l.fsf@cloudflare.com

---
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: Hillf Danton <hdanton@sina.com>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>

---
Jakub Sitnicki (3):
      bpf: Allow delete from sockmap/sockhash only if update is allowed
      Revert "bpf, sockmap: Prevent lock inversion deadlock in map delete elem"
      selftests/bpf: Cover verifier checks for mutating sockmap/sockhash

 kernel/bpf/verifier.c                              |  10 +-
 net/core/sock_map.c                                |   6 -
 tools/testing/selftests/bpf/prog_tests/verifier.c  |   2 +
 .../selftests/bpf/progs/verifier_sockmap_mutate.c  | 187 +++++++++++++++++++++
 4 files changed, 196 insertions(+), 9 deletions(-)


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

end of thread, other threads:[~2024-05-27 17:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-27 11:20 [PATCH bpf 0/3] Block deletes from sockmap for tracing programs Jakub Sitnicki
2024-05-27 11:20 ` [PATCH bpf 1/3] bpf: Allow delete from sockmap/sockhash only if update is allowed Jakub Sitnicki
2024-05-27 16:49   ` John Fastabend
2024-05-27 11:20 ` [PATCH bpf 2/3] Revert "bpf, sockmap: Prevent lock inversion deadlock in map delete elem" Jakub Sitnicki
2024-05-27 16:50   ` John Fastabend
2024-05-27 11:20 ` [PATCH bpf 3/3] selftests/bpf: Cover verifier checks for mutating sockmap/sockhash Jakub Sitnicki
2024-05-27 16:52   ` John Fastabend
2024-05-27 16:46 ` [PATCH bpf 0/3] Block deletes from sockmap for tracing programs John Fastabend
2024-05-27 17:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox