BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Xingwang Xiang" <v3rdant.xiang@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net v5 2/2] selftests/bpf: add regression test for ktls+sockmap verdict UAF
Date: Mon, 18 May 2026 14:57:04 +0000	[thread overview]
Message-ID: <20260518145705.57320C2BCB7@smtp.kernel.org> (raw)
In-Reply-To: <20260517145630.20521-3-v3rdant.xiang@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Usage of ASSERT_TRUE for skeleton pointer checks instead of ASSERT_OK_PTR.
--

commit 2da876f992ba88c42d69b2910d90f780e2c1b89f
Author: Xingwang Xiang <v3rdant.xiang@gmail.com>
selftests/bpf: add regression test for ktls+sockmap verdict UAF

This commit adds a regression test for a use-after-free vulnerability
involving KTLS and sockmap verdict programs. The test creates a scenario
where TLS RX is configured after inserting the receiver socket into a
sockmap.

> diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_ktls.c b/tools/testing/selftests/bpf/prog_tests/sockmap_ktls.c
> index b87e7f39e15a8..6ed8e149e3d58 100644
> --- a/tools/testing/selftests/bpf/prog_tests/sockmap_ktls.c
> +++ b/tools/testing/selftests/bpf/prog_tests/sockmap_ktls.c

[ ... ]

> @@ -417,6 +417,107 @@ static void run_tests(int family, enum bpf_map_type map_type)
>  	close(map);
>  }
>  
> +/*
> + * Regression test for the KTLS + sockmap (verdict) reverse-order UAF.
> + *
> + * Vulnerable sequence:

[ ... ]

> +static void test_sockmap_ktls_verdict_with_tls_rx(int family, int sotype)
> +{
> +	struct tls12_crypto_info_aes_gcm_128 crypto_info = {};
> +	char send_buf[] = "hello ktls sockmap reverse order";
> +	char recv_buf[sizeof(send_buf)] = {};
> +	struct test_sockmap_ktls *skel;
> +	int c = -1, p = -1, zero = 0;
> +	int prog_fd, map_fd;
> +	ssize_t n;
> +	int err;
> +
> +	skel = test_sockmap_ktls__open_and_load();
> +	if (!ASSERT_TRUE(skel, "open_and_load"))

This isn't a bug, but should this use ASSERT_OK_PTR() instead?

ASSERT_OK_PTR() handles IS_ERR_OR_NULL checks and provides better
debugging output for pointers on failure.

> +		return;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260517145630.20521-1-v3rdant.xiang@gmail.com?part=2

      reply	other threads:[~2026-05-18 14:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-17 14:56 [PATCH net v5 0/2] bpf, skmsg: fix verdict sk_data_ready racing with ktls rx Xingwang Xiang
2026-05-17 14:56 ` [PATCH net v5 1/2] " Xingwang Xiang
2026-05-18 14:57   ` sashiko-bot
2026-05-17 14:56 ` [PATCH net v5 2/2] selftests/bpf: add regression test for ktls+sockmap verdict UAF Xingwang Xiang
2026-05-18 14:57   ` sashiko-bot [this message]

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=20260518145705.57320C2BCB7@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=v3rdant.xiang@gmail.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