From: Leon Hwang <leon.hwang@linux.dev>
To: Feng Yang <yangfeng59949@163.com>,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, posk@google.com,
ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
martin.lau@linux.dev, eddyz87@gmail.com
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v10 bpf-next 2/2] selftests/bpf: Add selftests for the invocation of bpf_lwt_xmit_push_encap
Date: Wed, 4 Mar 2026 18:33:56 +0800 [thread overview]
Message-ID: <8f6755ed-d2ae-42ba-8052-2e6fba3d5c69@linux.dev> (raw)
In-Reply-To: <20260304094429.168521-3-yangfeng59949@163.com>
On 4/3/26 17:44, Feng Yang wrote:
> From: Feng Yang <yangfeng@kylinos.cn>
>
> Calling bpf_lwt_xmit_push_encap will not cause a crash when dst is missing.
>
> Signed-off-by: Feng Yang <yangfeng@kylinos.cn>
> ---
> .../selftests/bpf/prog_tests/lwt_misc.c | 9 ++++++++
> tools/testing/selftests/bpf/progs/lwt_misc.c | 22 +++++++++++++++++++
> 2 files changed, 31 insertions(+)
> create mode 100644 tools/testing/selftests/bpf/prog_tests/lwt_misc.c
> create mode 100644 tools/testing/selftests/bpf/progs/lwt_misc.c
>
Unnecessary to create new files.
Move the adding test to verifier_lwt.c. prog_tests/verifier.c will run
the test.
Thanks,
Leon
> diff --git a/tools/testing/selftests/bpf/prog_tests/lwt_misc.c b/tools/testing/selftests/bpf/prog_tests/lwt_misc.c
> new file mode 100644
> index 000000000000..6940fca38512
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/lwt_misc.c
> @@ -0,0 +1,9 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <test_progs.h>
> +#include "lwt_misc.skel.h"
> +
> +void test_lwt_misc(void)
> +{
> + RUN_TESTS(lwt_misc);
> +}
> diff --git a/tools/testing/selftests/bpf/progs/lwt_misc.c b/tools/testing/selftests/bpf/progs/lwt_misc.c
> new file mode 100644
> index 000000000000..aa638a4f2922
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/lwt_misc.c
> @@ -0,0 +1,22 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include "vmlinux.h"
> +#include <bpf/bpf_helpers.h>
> +#include "bpf_misc.h"
> +
> +SEC("lwt_xmit")
> +__success __retval(0)
> +int test_missing_dst_call_bpf_lwt_xmit_push_encap(struct __sk_buff *skb)
> +{
> + struct iphdr iph;
> +
> + __builtin_memset(&iph, 0, sizeof(struct iphdr));
> + iph.ihl = 5;
> + iph.version = 4;
> +
> + bpf_lwt_push_encap(skb, BPF_LWT_ENCAP_IP, &iph, sizeof(struct iphdr));
> +
> + return 0;
> +}
> +
> +char _license[] SEC("license") = "GPL";
next prev parent reply other threads:[~2026-03-04 10:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 9:44 [PATCH v10 bpf-next 0/2] Fix the null pointer dereference issue in bpf_lwt_xmit_push_encap Feng Yang
2026-03-04 9:44 ` [PATCH v10 bpf-next 1/2] bpf: test_run: " Feng Yang
2026-03-04 10:30 ` bot+bpf-ci
2026-03-04 10:33 ` Leon Hwang
2026-03-05 1:12 ` Martin KaFai Lau
2026-03-04 9:44 ` [PATCH v10 bpf-next 2/2] selftests/bpf: Add selftests for the invocation of bpf_lwt_xmit_push_encap Feng Yang
2026-03-04 10:33 ` Leon Hwang [this message]
2026-03-05 1:11 ` Martin KaFai Lau
2026-03-05 1:34 ` Leon Hwang
2026-03-05 1:10 ` [PATCH v10 bpf-next 0/2] Fix the null pointer dereference issue in bpf_lwt_xmit_push_encap 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=8f6755ed-d2ae-42ba-8052-2e6fba3d5c69@linux.dev \
--to=leon.hwang@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eddyz87@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=posk@google.com \
--cc=yangfeng59949@163.com \
/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