bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf 00/47] bpf: Fixes for hooks, tail calls, CAP_BPF, JITs and sockmap
@ 2026-11-25  3:28 Alexei Starovoitov
  2026-11-25  3:28 ` [PATCH bpf 01/47] bpf: Do not trust pointers in flexible arrays Alexei Starovoitov
                   ` (46 more replies)
  0 siblings, 47 replies; 62+ messages in thread
From: Alexei Starovoitov @ 2026-11-25  3:28 UTC (permalink / raw)
  To: bpf; +Cc: daniel, andrii, eddyz87, memxor

From: Alexei Starovoitov <ast@kernel.org>

These patches fix bugs in BPF:

  patches  area
  -------  ----------------------------------------------------------------
  01-04    what the verifier trusts: pointers, attach types, ranges, ids
  05-08    extensions and tail calls: they run in the hook of another prog
  09       struct_ops: the struct of a prog
  10       bpffs: delegate options
  11-12    NULL in tracepoints and helpers
  13-15    bpf_throw(): tracers, KASAN, symbols, line info
  16       XDP redirect in async callbacks
  17-18    checks at attach and load: cgroup links, signed programs
  19-20    bpf_lock, dumps of the stack
  21-22    arena: the length of mmap(), TLB
  23-24    prints of BTF enums, the result of bpf_res_spin_lock()
  25-33    kernel addresses and tasks: CAP_BPF is not enough
  34-37    x86 and arm64 JIT
  38-43    skb, XDP, sk_msg and sockaddr helpers
  44-45    sockmap
  46       libbpf
  47       struct_ops: the type of r0 at exit

Some fixes refuse what was allowed:

  patch  refused now
  -----  ------------------------------------------------------------------
  01     pointers from a flexible array as arguments of helpers and kfuncs
  05     freplace of tp_btf, fmod_ret, LSM and struct_ops progs
  07     one prog array for two LSM hooks, two types of struct_ops, or
         tracepoints with other NULL args
  11     tp_btf/neigh_create: the neighbour as a trusted argument
  13     tracers of bpf_throw()
  17     BPF_LINK_UPDATE of a cgroup link to another attach type
  18     metadata maps of signed progs that can be mapped writable
  21     mmap() of a part of an arena
  35     misaligned atomics in arenas on x86: skipped at run time

  patch  needs CAP_PERFMON now
  -----  ------------------------------------------------------------------
  25     all but the base helpers in syscall progs
  26     kfuncs of arena and task work, bpf_send_signal_task(),
         bpf_wakeup_sources_get_head()
  27     streams
  28     variables of the kernel
  29     dumps of xlated insns
  31     open() of the bpffs file of a map with special fields but locks
  32     values of insn_array as memory
  33     inet_diag dump of all sk_storage maps

Signed-off-by: Alexei Starovoitov <ast@kernel.org>

Alexei Starovoitov (47):
  bpf: Do not trust pointers in flexible arrays
  bpf: Look at the type of a program next to expected_attach_type
  bpf: Do not take bpf_get_retval() of struct bpf_tcp_ops for an errno
  bpf: Do not allow bpf_d_path() by an id of another BTF
  bpf: Check that an extension fits the hook of its target
  bpf: Take the attach type of the target for tail calls of an extension
  bpf: Compare what a hook tells next to its prototype at tail calls
  bpf: Reserve cookie and ip in the trampoline for tail calls
  bpf: Check that a program and a struct_ops map are for the same struct
  bpf: Keep the names in front of a number in delegate options
  bpf: Do not trust the neighbour of tp_btf/neigh_create
  bpf: Check for NULL in helpers that take a kernel pointer
  bpf: Leave nothing behind in the frame of bpf_throw()
  bpf: Add the symbol of a prog before its id
  bpf: Do not fill jited line info for a hidden subprog
  bpf: Fix NULL dereference in XDP redirect from async callbacks
  bpf: Check the attach type when a cgroup link gets another program
  bpf: Refuse metadata maps of signed programs that can be mapped
    writable
  bpf: Take bpf_lock with interrupts disabled
  bpf: Bound the time that dumps of the stack take
  bpf: Refuse mmap() of a part of an arena
  bpf: Flush TLB when a page of arena replaces the scratch page
  bpf: Fix reads past an enum in prints of BTF data
  bpf: Give the error of bpf_res_spin_lock() a 32-bit range
  bpf: Give syscall programs without CAP_PERFMON the base helpers only
  bpf: Require CAP_PERFMON for kfuncs that leak pointers or touch tasks
  bpf: Require CAP_PERFMON to read streams
  bpf: Limit reads of variables of the kernel
  bpf: Require CAP_PERFMON for dumps of xlated insns
  bpf: Zero bpf_list_head in copies of map values
  bpf: Require CAP_PERFMON to read pinned maps with special fields
  bpf: Require CAP_PERFMON to pass values of insn_array as memory
  bpf: Require CAP_PERFMON for the dump of all storages of sockets
  bpf, x86: Do not use the paranoid ITS thunk
  bpf, x86: Enforce alignment of atomics in arenas
  bpf, x86: Fix the range of BPF code that has a frame pointer
  bpf, arm64: Restore the shadow call stack pointer after an exception
  bpf: Clear the data that bpf_msg_push_data() adds
  bpf: Fail loads from a network header that was not set
  bpf: Fix slices behind the end of an XDP packet
  bpf: Clear family and port of a short address for cgroup sockaddr
    hooks
  bpf: Take a neighbour of the L3 master in bpf_redirect_neigh()
  bpf: Keep the MAC header in bpf_skb_change_tail()
  bpf, sockmap: Keep the parser and sk_data_ready in sync
  bpf, sockmap: Hold the psock of the work in sk_psock_backlog()
  libbpf: Fix struct_ops members 59-61 and optional struct_ops maps
  bpf: Check the type of R0 at the exit of a struct_ops program

 Documentation/bpf/kfuncs.rst                  |  3 +-
 Documentation/bpf/signing.rst                 |  3 +-
 arch/arm64/net/bpf_jit_comp.c                 |  7 ++
 arch/x86/net/bpf_jit_comp.c                   | 53 ++++++++---
 include/linux/bpf.h                           | 31 +++++--
 include/linux/btf.h                           |  1 +
 include/linux/filter.h                        | 15 +++-
 include/uapi/linux/bpf.h                      |  3 +-
 kernel/bpf/arena.c                            | 40 +++++----
 kernel/bpf/bpf_struct_ops.c                   | 20 +++--
 kernel/bpf/btf.c                              | 49 +++++++++--
 kernel/bpf/cgroup.c                           | 29 +++++-
 kernel/bpf/core.c                             | 50 ++++++++---
 kernel/bpf/fixups.c                           |  7 ++
 kernel/bpf/helpers.c                          | 34 ++++---
 kernel/bpf/inode.c                            | 10 ++-
 kernel/bpf/stackmap.c                         |  2 +-
 kernel/bpf/stream.c                           | 25 +++++-
 kernel/bpf/syscall.c                          | 35 ++++++--
 kernel/bpf/verifier.c                         | 88 +++++++++++++++----
 kernel/sched/ext/internal.h                   |  5 +-
 kernel/trace/bpf_trace.c                      |  8 +-
 net/bpf/bpf_dummy_struct_ops.c                |  2 +-
 net/core/bpf_sk_storage.c                     |  4 +
 net/core/filter.c                             | 40 ++++++---
 net/core/skmsg.c                              | 14 ++-
 net/core/sock_map.c                           |  3 +-
 tools/include/uapi/linux/bpf.h                |  3 +-
 tools/lib/bpf/libbpf.c                        | 19 ++--
 .../selftests/bpf/test_kmods/bpf_testmod.c    |  6 +-
 30 files changed, 469 insertions(+), 140 deletions(-)


base-commit: 81c6c8c608b6075846d3bd5b6f57958300a56eda
-- 
2.55.0


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

end of thread, other threads:[~2026-11-25  4:28 UTC | newest]

Thread overview: 62+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25  3:28 [PATCH bpf 00/47] bpf: Fixes for hooks, tail calls, CAP_BPF, JITs and sockmap Alexei Starovoitov
2026-11-25  3:28 ` [PATCH bpf 01/47] bpf: Do not trust pointers in flexible arrays Alexei Starovoitov
2026-11-25  3:28 ` [PATCH bpf 02/47] bpf: Look at the type of a program next to expected_attach_type Alexei Starovoitov
2026-11-25  3:28 ` [PATCH bpf 03/47] bpf: Do not take bpf_get_retval() of struct bpf_tcp_ops for an errno Alexei Starovoitov
2026-11-25  3:28 ` [PATCH bpf 04/47] bpf: Do not allow bpf_d_path() by an id of another BTF Alexei Starovoitov
2026-11-25  3:28 ` [PATCH bpf 05/47] bpf: Check that an extension fits the hook of its target Alexei Starovoitov
2026-11-25  3:28 ` [PATCH bpf 06/47] bpf: Take the attach type of the target for tail calls of an extension Alexei Starovoitov
2026-11-25  3:28 ` [PATCH bpf 07/47] bpf: Compare what a hook tells next to its prototype at tail calls Alexei Starovoitov
2026-11-25  3:58   ` sashiko-bot
2026-11-25  4:28   ` bot+bpf-ci
2026-11-25  3:28 ` [PATCH bpf 08/47] bpf: Reserve cookie and ip in the trampoline for " Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 09/47] bpf: Check that a program and a struct_ops map are for the same struct Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 10/47] bpf: Keep the names in front of a number in delegate options Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 11/47] bpf: Do not trust the neighbour of tp_btf/neigh_create Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 12/47] bpf: Check for NULL in helpers that take a kernel pointer Alexei Starovoitov
2026-11-25  3:48   ` sashiko-bot
2026-11-25  3:29 ` [PATCH bpf 13/47] bpf: Leave nothing behind in the frame of bpf_throw() Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 14/47] bpf: Add the symbol of a prog before its id Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 15/47] bpf: Do not fill jited line info for a hidden subprog Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 16/47] bpf: Fix NULL dereference in XDP redirect from async callbacks Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 17/47] bpf: Check the attach type when a cgroup link gets another program Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 18/47] bpf: Refuse metadata maps of signed programs that can be mapped writable Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 19/47] bpf: Take bpf_lock with interrupts disabled Alexei Starovoitov
2026-11-25  4:08   ` bot+bpf-ci
2026-11-25  3:29 ` [PATCH bpf 20/47] bpf: Bound the time that dumps of the stack take Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 21/47] bpf: Refuse mmap() of a part of an arena Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 22/47] bpf: Flush TLB when a page of arena replaces the scratch page Alexei Starovoitov
2026-11-25  3:48   ` sashiko-bot
2026-11-25  3:29 ` [PATCH bpf 23/47] bpf: Fix reads past an enum in prints of BTF data Alexei Starovoitov
2026-11-25  3:52   ` sashiko-bot
2026-11-25  3:29 ` [PATCH bpf 24/47] bpf: Give the error of bpf_res_spin_lock() a 32-bit range Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 25/47] bpf: Give syscall programs without CAP_PERFMON the base helpers only Alexei Starovoitov
2026-11-25  3:55   ` sashiko-bot
2026-11-25  4:08   ` bot+bpf-ci
2026-11-25  3:29 ` [PATCH bpf 26/47] bpf: Require CAP_PERFMON for kfuncs that leak pointers or touch tasks Alexei Starovoitov
2026-11-25  4:08   ` bot+bpf-ci
2026-11-25  3:29 ` [PATCH bpf 27/47] bpf: Require CAP_PERFMON to read streams Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 28/47] bpf: Limit reads of variables of the kernel Alexei Starovoitov
2026-11-25  4:08   ` bot+bpf-ci
2026-11-25  3:29 ` [PATCH bpf 29/47] bpf: Require CAP_PERFMON for dumps of xlated insns Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 30/47] bpf: Zero bpf_list_head in copies of map values Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 31/47] bpf: Require CAP_PERFMON to read pinned maps with special fields Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 32/47] bpf: Require CAP_PERFMON to pass values of insn_array as memory Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 33/47] bpf: Require CAP_PERFMON for the dump of all storages of sockets Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 34/47] bpf, x86: Do not use the paranoid ITS thunk Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 35/47] bpf, x86: Enforce alignment of atomics in arenas Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 36/47] bpf, x86: Fix the range of BPF code that has a frame pointer Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 37/47] bpf, arm64: Restore the shadow call stack pointer after an exception Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 38/47] bpf: Clear the data that bpf_msg_push_data() adds Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 39/47] bpf: Fail loads from a network header that was not set Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 40/47] bpf: Fix slices behind the end of an XDP packet Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 41/47] bpf: Clear family and port of a short address for cgroup sockaddr hooks Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 42/47] bpf: Take a neighbour of the L3 master in bpf_redirect_neigh() Alexei Starovoitov
2026-11-25  4:08   ` bot+bpf-ci
2026-11-25  4:09   ` sashiko-bot
2026-11-25  3:29 ` [PATCH bpf 43/47] bpf: Keep the MAC header in bpf_skb_change_tail() Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 44/47] bpf, sockmap: Keep the parser and sk_data_ready in sync Alexei Starovoitov
2026-11-25  4:09   ` sashiko-bot
2026-11-25  3:29 ` [PATCH bpf 45/47] bpf, sockmap: Hold the psock of the work in sk_psock_backlog() Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 46/47] libbpf: Fix struct_ops members 59-61 and optional struct_ops maps Alexei Starovoitov
2026-11-25  3:29 ` [PATCH bpf 47/47] bpf: Check the type of R0 at the exit of a struct_ops program Alexei Starovoitov
2026-11-25  4:08   ` bot+bpf-ci

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