[LTP] accept03/tst_fd: Harden parallel runs against shared path races

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Wed Nov 4 20:00:41 CET 2026


Hi Stephen,

On Wed Nov 4 11:46:36 2026 -0500, Stephen Bertram <sbertram@redhat.com> wrote:
> accept03/tst_fd: Harden parallel runs against shared path races

> This covers accept03, epoll_pwait06, ioctl_pidfd01, and splice07,
> which call TST_FD_FOREACH without a private tmpdir.
>
> +static void fd_path(char *buf, size_t len, const char *prefix)
> +{
> +	snprintf(buf, len, "%s_%d", prefix, getpid());
> +}

Tests that create temporary files or directories must set .needs_tmpdir = 1
in struct tst_test rather than creating files in the current working
directory. Without .needs_tmpdir = 1, open_file(), open_path(), and
open_dir() fail with EROFS/EACCES when run from a read-only working
directory and leave leftover files behind if interrupted before
SAFE_UNLINK()/SAFE_RMDIR(). Set .needs_tmpdir = 1 in accept03,
epoll_pwait06, ioctl_pidfd01, and splice07 (as epoll_ctl06, readahead01,
ioctl_ficlone04, and file_attr04 already do) and guard file creation in
tst_fd.c with tst_tmpdir_created().

Verdict - Needs revision

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer


More information about the ltp mailing list