All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Christopher Lusk" <clusk@northecho.dev>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net 2/2] selftests: net: add kTLS async split record regression
Date: Sat, 16 May 2026 15:16:29 +0000	[thread overview]
Message-ID: <20260516151629.988D7C19425@smtp.kernel.org> (raw)
In-Reply-To: <20260515151556.189841-3-clusk@northecho.dev>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The file descriptor returned by bpf_program__fd() is not validated before use.
--

commit d9776d4dbb9fe9a4990835389a529751f93e64af
Author: Christopher Lusk <clusk@northecho.dev>

selftests: net: add kTLS async split record regression

This commit adds a kTLS TX regression test for the BPF sk_msg apply_bytes
split-record path. It verifies that a stream with 512-byte verdict windows
is received correctly, testing both synchronous and async pcrypt providers.

> diff --git a/tools/testing/selftests/net/ktls_async_split.c b/tools/testing/selftests/net/ktls_async_split.c
> new file mode 100644
> index 0000000000000..a9a84e0f5f87b
> --- /dev/null
> +++ b/tools/testing/selftests/net/ktls_async_split.c

[ ... ]

> +static int attach_bpf(const char *obj_path, int sock_fd, struct bpf_object **obj_out)
> +{
> +	struct bpf_object *obj;
> +	struct bpf_program *prog;
> +	int map_fd, prog_fd;
> +	__u32 key = 0;
> +
> +	obj = bpf_object__open_file(obj_path, NULL);
> +	if (libbpf_get_error(obj))
> +		return -EINVAL;
> +	if (bpf_object__load(obj))
> +		return -EINVAL;
> +
> +	prog = bpf_object__find_program_by_name(obj, "apply_bytes_verdict");
> +	if (!prog)
> +		return -ENOENT;
> +	prog_fd = bpf_program__fd(prog);

Should prog_fd be checked for negative values here?

When using manual lookup APIs, bpf_program__fd() can return a negative error
code if the program is invalid. Does it make sense to validate prog_fd before
passing it to bpf_prog_attach(), similar to the map_fd check right below?

> +
> +	map_fd = bpf_object__find_map_fd_by_name(obj, "sock_map");
> +	if (map_fd < 0)
> +		return -ENOENT;
> +
> +	if (bpf_prog_attach(prog_fd, map_fd, BPF_SK_MSG_VERDICT, 0))
> +		return -errno;
> +	if (bpf_map_update_elem(map_fd, &key, &sock_fd, BPF_ANY))
> +		return -errno;
> +
> +	*obj_out = obj;
> +	return 0;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260515151556.189841-1-clusk@northecho.dev?part=2

      reply	other threads:[~2026-05-16 15:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15 15:15 [PATCH net 0/2] net: tls: fix async BPF split record loss Christopher Lusk
2026-05-15 15:15 ` [PATCH net 1/2] net: tls: preserve split open record on async encrypt Christopher Lusk
2026-05-16 15:16   ` sashiko-bot
2026-05-20 17:15     ` John Fastabend
2026-05-15 15:15 ` [PATCH net 2/2] selftests: net: add kTLS async split record regression Christopher Lusk
2026-05-16 15:16   ` 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=20260516151629.988D7C19425@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=clusk@northecho.dev \
    --cc=sashiko-reviews@lists.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.