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 v2 2/2] selftests: net: add kTLS async split record regression
Date: Sat, 30 May 2026 00:45:26 +0000	[thread overview]
Message-ID: <20260530004526.6E4FC1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260521025840.976378-3-clusk@northecho.dev>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Memory and file descriptor leak of `struct bpf_object` on error paths inside `attach_bpf()`.
- [Low] Including libbpf source headers directly instead of installed/exported headers in Makefile.
--

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

selftests: net: add kTLS async split record regression

Add a kTLS TX regression test for the BPF sk_msg apply_bytes split-record
path. The test sends four 4096-byte writes through a sockmap verdict program
that applies 512-byte verdict windows, then verifies that the peer receives
the full TLS-protected stream.

> diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
> index f3da38c54d276..0435327e93a72 100644
> --- a/tools/testing/selftests/net/Makefile
> +++ b/tools/testing/selftests/net/Makefile
[ ... ]
> @@ -236,3 +237,7 @@ $(OUTPUT)/bind_bhash: LDLIBS += -lpthread
>  $(OUTPUT)/io_uring_zerocopy_tx: CFLAGS += -I../../../include/
>  
>  include bpf.mk
> +
> +$(OUTPUT)/ktls_async_split: CFLAGS += -I../../../lib

[Severity: Low]
Is this include path correct? By pointing directly to lib instead of the
exported headers like ../../../include/, could we bypass the proper libbpf
build and export step and rely on raw source headers instead?

> 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..5601ce4b5f688
> --- /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;

[Severity: Medium]
Does this leak the bpf_object structure and associated resources on error
paths?

Since *obj_out is only assigned at the end of the function upon success, if
bpf_object__load() or any subsequent operations fail, the caller receives a
NULL pointer and cannot clean up the leaked object via bpf_object__close().

> +
> +	prog = bpf_object__find_program_by_name(obj, "apply_bytes_verdict");
> +	if (!prog)
> +		return -ENOENT;
> +	prog_fd = bpf_program__fd(prog);
> +	if (prog_fd < 0)
> +		return prog_fd;
> +
> +	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/20260521025840.976378-1-clusk@northecho.dev?part=2

      parent reply	other threads:[~2026-05-30  0:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21  2:58 [PATCH net v2 0/2] net: tls: fix async split record handling Christopher Lusk
2026-05-21  2:58 ` [PATCH net v2 1/2] net: tls: preserve split open record on async encrypt Christopher Lusk
2026-05-25 20:30   ` Jakub Kicinski
2026-05-21  2:58 ` [PATCH net v2 2/2] selftests: net: add kTLS async split record regression Christopher Lusk
2026-05-25 20:30   ` Jakub Kicinski
2026-05-30  0:45   ` 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=20260530004526.6E4FC1F00893@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.