All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next 00/10] Centralize BPF permission checks
@ 2023-05-02 23:06 Andrii Nakryiko
  2023-05-02 23:06 ` [PATCH bpf-next 01/10] bpf: move unprivileged checks into map_create() and bpf_prog_load() Andrii Nakryiko
                   ` (9 more replies)
  0 siblings, 10 replies; 30+ messages in thread
From: Andrii Nakryiko @ 2023-05-02 23:06 UTC (permalink / raw)
  To: bpf, ast, daniel, martin.lau; +Cc: andrii, kernel-team

This patch set refactors BPF subsystem permission checks for BPF maps and
programs, localizes them in one place, and ensures all parts of BPF ecosystem
(BPF verifier and JITs, and their supporting infra) use recorded effective
capabilities, stored in respective bpf_map or bpf_prog structs, for further
decision making.

This allows for more explicit and centralized handling of BPF-related
capabilities and makes for simpler further BPF permission model evolution, to
be proposed and discussed in follow up patch sets.

Andrii Nakryiko (10):
  bpf: move unprivileged checks into map_create() and bpf_prog_load()
  bpf: inline map creation logic in map_create() function
  bpf: centralize permissions checks for all BPF map types
  bpf: remember if bpf_map was unprivileged and use that consistently
  bpf: drop unnecessary bpf_capable() check in BPF_MAP_FREEZE command
  bpf: keep BPF_PROG_LOAD permission checks clear of validations
  bpf: record effective capabilities at BPF prog load time
  bpf: use recorded BPF prog effective caps when fetching helper protos
  bpf: use recorded bpf_capable flag in JIT code
  bpf: consistenly use program's recorded capabilities in BPF verifier

 arch/arm/net/bpf_jit_32.c                     |   2 +-
 arch/arm64/net/bpf_jit_comp.c                 |   2 +-
 arch/loongarch/net/bpf_jit.c                  |   2 +-
 arch/mips/net/bpf_jit_comp.c                  |   2 +-
 arch/powerpc/net/bpf_jit_comp.c               |   2 +-
 arch/riscv/net/bpf_jit_core.c                 |   3 +-
 arch/s390/net/bpf_jit_comp.c                  |   3 +-
 arch/sparc/net/bpf_jit_comp_64.c              |   2 +-
 arch/x86/net/bpf_jit_comp.c                   |   3 +-
 arch/x86/net/bpf_jit_comp32.c                 |   2 +-
 drivers/media/rc/bpf-lirc.c                   |   2 +-
 include/linux/bpf.h                           |  32 ++-
 include/linux/filter.h                        |   8 +-
 kernel/bpf/arraymap.c                         |  59 +++--
 kernel/bpf/bloom_filter.c                     |   3 -
 kernel/bpf/bpf_local_storage.c                |   3 -
 kernel/bpf/bpf_struct_ops.c                   |   3 -
 kernel/bpf/cgroup.c                           |   6 +-
 kernel/bpf/core.c                             |  22 +-
 kernel/bpf/cpumap.c                           |   4 -
 kernel/bpf/devmap.c                           |   3 -
 kernel/bpf/hashtab.c                          |   6 -
 kernel/bpf/helpers.c                          |   6 +-
 kernel/bpf/lpm_trie.c                         |   3 -
 kernel/bpf/map_in_map.c                       |   3 +-
 kernel/bpf/queue_stack_maps.c                 |   4 -
 kernel/bpf/reuseport_array.c                  |   3 -
 kernel/bpf/stackmap.c                         |   3 -
 kernel/bpf/syscall.c                          | 218 ++++++++++++------
 kernel/bpf/trampoline.c                       |   2 +-
 kernel/bpf/verifier.c                         |  23 +-
 kernel/trace/bpf_trace.c                      |   2 +-
 net/core/filter.c                             |  36 +--
 net/core/sock_map.c                           |   4 -
 net/ipv4/bpf_tcp_ca.c                         |   2 +-
 net/netfilter/nf_bpf_link.c                   |   2 +-
 net/xdp/xskmap.c                              |   4 -
 .../bpf/prog_tests/unpriv_bpf_disabled.c      |   6 +-
 38 files changed, 280 insertions(+), 215 deletions(-)

-- 
2.34.1


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

end of thread, other threads:[~2023-05-15 18:38 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-02 23:06 [PATCH bpf-next 00/10] Centralize BPF permission checks Andrii Nakryiko
2023-05-02 23:06 ` [PATCH bpf-next 01/10] bpf: move unprivileged checks into map_create() and bpf_prog_load() Andrii Nakryiko
2023-05-03 18:28   ` Stanislav Fomichev
2023-05-03 19:04     ` Andrii Nakryiko
2023-05-03 22:33       ` Stanislav Fomichev
2023-05-04 18:52         ` Andrii Nakryiko
2023-05-02 23:06 ` [PATCH bpf-next 02/10] bpf: inline map creation logic in map_create() function Andrii Nakryiko
2023-05-02 23:06 ` [PATCH bpf-next 03/10] bpf: centralize permissions checks for all BPF map types Andrii Nakryiko
2023-05-02 23:06 ` [PATCH bpf-next 04/10] bpf: remember if bpf_map was unprivileged and use that consistently Andrii Nakryiko
2023-05-04 20:05   ` Alexei Starovoitov
2023-05-04 22:51     ` Andrii Nakryiko
2023-05-04 22:54       ` Alexei Starovoitov
2023-05-04 23:06         ` Andrii Nakryiko
2023-05-02 23:06 ` [PATCH bpf-next 05/10] bpf: drop unnecessary bpf_capable() check in BPF_MAP_FREEZE command Andrii Nakryiko
2023-05-02 23:06 ` [PATCH bpf-next 06/10] bpf: keep BPF_PROG_LOAD permission checks clear of validations Andrii Nakryiko
2023-05-04 20:12   ` Alexei Starovoitov
2023-05-04 22:51     ` Andrii Nakryiko
2023-05-02 23:06 ` [PATCH bpf-next 07/10] bpf: record effective capabilities at BPF prog load time Andrii Nakryiko
2023-05-02 23:06 ` [PATCH bpf-next 08/10] bpf: use recorded BPF prog effective caps when fetching helper protos Andrii Nakryiko
2023-05-02 23:06 ` [PATCH bpf-next 09/10] bpf: use recorded bpf_capable flag in JIT code Andrii Nakryiko
2023-05-04 22:09   ` Alexei Starovoitov
2023-05-04 22:51     ` Andrii Nakryiko
2023-05-02 23:06 ` [PATCH bpf-next 10/10] bpf: consistenly use program's recorded capabilities in BPF verifier Andrii Nakryiko
2023-05-04 22:20   ` Alexei Starovoitov
2023-05-04 22:51     ` Andrii Nakryiko
2023-05-05 19:08       ` Andrii Nakryiko
2023-05-05 19:55         ` Alexei Starovoitov
2023-05-11 16:21   ` Alexei Starovoitov
2023-05-15 16:42     ` Andrii Nakryiko
2023-05-15 18:38       ` Alexei Starovoitov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.