From: Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>
To: Yun Lu <luyun_611@163.com>,
andrii@kernel.org, eddyz87@gmail.com, ihor.solodrai@linux.dev,
ast@kernel.org, daniel@iogearbox.net, memxor@gmail.com,
martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev,
jolsa@kernel.org, emil@etsalapatis.com
Cc: bpf@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH bpf-next] selftests/bpf: Clean up child when task_work__open() fails
Date: Fri, 18 Sep 2026 14:24:54 +0100 [thread overview]
Message-ID: <9c134c8d-6d50-451c-8336-4c7077b2cf44@gmail.com> (raw)
In-Reply-To: <20260918024300.18321-1-luyun_611@163.com>
On 9/18/26 3:43 AM, Yun Lu wrote:
> From: Yun Lu <luyun@kylinos.cn>
>
> task_work_run() forks a child that blocks reading a pipe until the
> parent wakes it. If task_work__open() fails afterwards, the parent
> returns without closing either pipe fd or waiting for the child.
> Because the parent retains the write end, the child remains blocked in
> read() until test_progs exits.
>
> Route this failure through the common cleanup path. At this point
> cleanup is safe: pe_fd is -1, link is NULL, task_work__destroy() accepts
> NULL, and the pid > 0 branch closes the read end, wakes the child,
> closes the write end and waits for it.
>
> This is the last early return after a successful fork. The fork failure
> path already closes both pipe fds after commit 5730dacb3f17
> ("selftests/bpf: Task_work selftest cleanup fixes").
>
> Fixes: 39fd74dfd5d2 ("selftests/bpf: BPF task work scheduling tests")
> Signed-off-by: Yun Lu <luyun@kylinos.cn>
>
> ---
Looks correct, thanks for the patch.
Acked-by: Mykyta Yatsenko <yatsenko@meta.com>
> Resent as a standalone patch against bpf-next as requested during
> review; the content is unchanged from patch 2/2 of the previous
> series.
>
> tools/testing/selftests/bpf/prog_tests/test_task_work.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/test_task_work.c b/tools/testing/selftests/bpf/prog_tests/test_task_work.c
> index 774b31a5f6ca..fe0cb1702eaa 100644
> --- a/tools/testing/selftests/bpf/prog_tests/test_task_work.c
> +++ b/tools/testing/selftests/bpf/prog_tests/test_task_work.c
> @@ -85,7 +85,7 @@ static void task_work_run(const char *prog_name, const char *map_name)
>
> skel = task_work__open();
> if (!ASSERT_OK_PTR(skel, "task_work__open"))
> - return;
> + goto cleanup;
>
> bpf_object__for_each_program(prog, skel->obj) {
> bpf_program__set_autoload(prog, false);
next prev parent reply other threads:[~2026-09-18 13:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 2:43 [PATCH bpf-next] selftests/bpf: Clean up child when task_work__open() fails Yun Lu
2026-09-18 13:24 ` Mykyta Yatsenko [this message]
2026-09-21 21:30 ` 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=9c134c8d-6d50-451c-8336-4c7077b2cf44@gmail.com \
--to=mykyta.yatsenko5@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=jolsa@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=luyun_611@163.com \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=song@kernel.org \
--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