BPF List
 help / color / mirror / Atom feed
From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: bpf@vger.kernel.org
Cc: kkd@meta.com, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <martin.lau@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>, Robert Morris <rtm@mit.edu>,
	kernel-team@fb.com
Subject: [PATCH bpf v1 0/2] Add missing size check for BTF-based ctx access
Date: Thu, 12 Dec 2024 01:20:48 -0800	[thread overview]
Message-ID: <20241212092050.3204165-1-memxor@gmail.com> (raw)

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
-- 
2.43.5


             reply	other threads:[~2024-12-12  9:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-12  9:20 Kumar Kartikeya Dwivedi [this message]
2024-12-12  9:20 ` [PATCH bpf v1 1/2] bpf: Check size for BTF-based ctx access of pointer members Kumar Kartikeya Dwivedi
2024-12-12 19:49   ` Eduard Zingerman
2024-12-12  9:20 ` [PATCH bpf v1 2/2] selftests/bpf: Add test for narrow ctx load for pointer args Kumar Kartikeya Dwivedi
2024-12-12 19:50 ` [PATCH bpf v1 0/2] Add missing size check for BTF-based ctx access patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241212092050.3204165-1-memxor@gmail.com \
    --to=memxor@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=kkd@meta.com \
    --cc=martin.lau@kernel.org \
    --cc=rtm@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox