mbox series

[bpf,v1,0/2] Add missing size check for BTF-based ctx access

Message ID 20241212092050.3204165-1-memxor@gmail.com (mailing list archive)
Headers show
Series Add missing size check for BTF-based ctx access | expand

Message

Kumar Kartikeya Dwivedi Dec. 12, 2024, 9:20 a.m. UTC
This set fixes a issue reported for tracing and struct ops programs
using btf_ctx_access for ctx checks, where loading a pointer argument
from the ctx doesn't enforce a BPF_DW access size check. The original
report is at link [0]. Also add a regression test along with the fix.

  [0]: https://lore.kernel.org/bpf/51338.1732985814@localhost

Kumar Kartikeya Dwivedi (2):
  bpf: Check size for BTF-based ctx access of pointer members
  selftests/bpf: Add test for narrow ctx load for pointer args

 kernel/bpf/btf.c                              |  6 +++
 .../bpf/progs/verifier_btf_ctx_access.c       | 40 ++++++++++++++++++-
 .../selftests/bpf/progs/verifier_d_path.c     |  4 +-
 3 files changed, 46 insertions(+), 4 deletions(-)


base-commit: 7d0d673627e20cfa3b21a829a896ce03b58a4f1c

Comments

patchwork-bot+netdevbpf@kernel.org Dec. 12, 2024, 7:50 p.m. UTC | #1
Hello:

This series was applied to bpf/bpf.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Thu, 12 Dec 2024 01:20:48 -0800 you wrote:
> This set fixes a issue reported for tracing and struct ops programs
> using btf_ctx_access for ctx checks, where loading a pointer argument
> from the ctx doesn't enforce a BPF_DW access size check. The original
> report is at link [0]. Also add a regression test along with the fix.
> 
>   [0]: https://lore.kernel.org/bpf/51338.1732985814@localhost
> 
> [...]

Here is the summary with links:
  - [bpf,v1,1/2] bpf: Check size for BTF-based ctx access of pointer members
    https://git.kernel.org/bpf/bpf/c/659b9ba7cb2d
  - [bpf,v1,2/2] selftests/bpf: Add test for narrow ctx load for pointer args
    https://git.kernel.org/bpf/bpf/c/8025731c28be

You are awesome, thank you!