From: Philo Lu <lulie@linux.alibaba.com>
To: bpf@vger.kernel.org
Cc: martin.lau@linux.dev, daniel@iogearbox.net,
john.fastabend@gmail.com, ast@kernel.org, andrii@kernel.org,
eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev,
kpsingh@kernel.org, sdf@google.com, haoluo@google.com,
jolsa@kernel.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, mykolal@fb.com,
shuah@kernel.org, drosen@google.com, xuanzhuo@linux.alibaba.com
Subject: [PATCH bpf-next 0/2] bpf: Allow skb dynptr for tp_btf
Date: Tue, 30 Apr 2024 20:18:03 +0800 [thread overview]
Message-ID: <20240430121805.104618-1-lulie@linux.alibaba.com> (raw)
This makes bpf_dynptr_from_skb usable for tp_btf, so that we can easily
parse skb in tracepoints. This has been discussed in [0], and Martin
suggested to use dynptr (instead of helpers like bpf_skb_load_bytes).
For safety, skb dynptr shouldn't be used in fentry/fexit. This is achieved
by add KF_TRUSTED_ARGS flag in bpf_dynptr_from_skb defination. IIUC, the
flag can be added to current defination directly, because skb is always
passed from ctx. But I'm not definitely sure about this. Please tell me if
there is any problem. Thanks in advance.
Selftests are expanded with skb dynptr used in tp_btf. They also make sure
that skb dynptr cannot be used in fentry/fexit.
[0]
https://lore.kernel.org/all/20240205121038.41344-1-lulie@linux.alibaba.com/T/
Philo Lu (2):
bpf: Allow bpf_dynptr_from_skb() for tp_btf
selftests/bpf: Expand skb dynptr selftests for tp_btf
net/core/filter.c | 3 +-
.../testing/selftests/bpf/prog_tests/dynptr.c | 36 +++++++++++++++++--
.../testing/selftests/bpf/progs/dynptr_fail.c | 25 +++++++++++++
.../selftests/bpf/progs/dynptr_success.c | 23 ++++++++++++
4 files changed, 84 insertions(+), 3 deletions(-)
--
2.32.0.3.g01195cf9f
next reply other threads:[~2024-04-30 12:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-30 12:18 Philo Lu [this message]
2024-04-30 12:18 ` [PATCH bpf-next 1/2] bpf: Allow bpf_dynptr_from_skb() for tp_btf Philo Lu
2024-05-06 21:39 ` Martin KaFai Lau
2024-05-06 23:29 ` Alexei Starovoitov
2024-05-09 0:24 ` Martin KaFai Lau
2024-05-09 1:11 ` Philo Lu
2024-04-30 12:18 ` [PATCH bpf-next 2/2] selftests/bpf: Expand skb dynptr selftests " Philo Lu
2024-05-06 21:43 ` Martin KaFai Lau
2024-05-07 3:15 ` Philo Lu
2024-05-09 0:22 ` Martin KaFai Lau
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=20240430121805.104618-1-lulie@linux.alibaba.com \
--to=lulie@linux.alibaba.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=drosen@google.com \
--cc=eddyz87@gmail.com \
--cc=edumazet@google.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=martin.lau@linux.dev \
--cc=mykolal@fb.com \
--cc=pabeni@redhat.com \
--cc=sdf@google.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=xuanzhuo@linux.alibaba.com \
--cc=yonghong.song@linux.dev \
/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