From: linuxtestproject.agent@gmail.com
To: AnonymeMeow <anonymemeow@gmail.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] fanotify: fix crash when running multiple iterations
Date: Wed, 27 May 2026 22:06:13 +0000 [thread overview]
Message-ID: <20260527220613.4056-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260527195056.337081-1-anonymemeow@gmail.com>
Hi AnonymeMeow,
On Thu, 28 May 2026 03:50:55 +0800, AnonymeMeow wrote:
> [PATCH 1/2] fanotify: fix crash when running multiple iterations
This commit fixes two unrelated crashes in two separate test files.
Consider splitting into two commits for cleaner history.
> +static void clean_upper_dir(void)
> +{
> + unsigned int i;
> +
> + SAFE_MOUNT(OVL_UPPER, MOUNT_PATH, "none", MS_BIND, NULL);
> + for (i = 0; i < ARRAY_SIZE(objects); i++)
> + SAFE_UNLINK(objects[i].path);
> + SAFE_UMOUNT(MOUNT_PATH);
> +}
SAFE_UNLINK is called unconditionally for all objects, including
DIR_PATH_ONE which is a directory. delete_objects() correctly uses
SAFE_RMDIR for directories. This works here only because overlayfs
whiteouts for directories are character devices, but it is fragile
and inconsistent with delete_objects(). Use is_dir the same way
delete_objects() does.
[...]
> --- [PATCH 2/2] ---
> fanotify: prepare tests for thread pidfd reporting
> +#include <pthread.h>
> #include "tst_test.h"
> #include "tst_safe_stdio.h"
> #include "tst_safe_macros.h"
> +#include "tst_safe_pthread.h"
> #include "lapi/pidfd.h"
> + *(int *)arg = SAFE_PIDFD_OPEN(gettid(), PIDFD_THREAD);
PIDFD_THREAD (added in Linux 6.9) has no fallback definition in
include/lapi/pidfd.h. This will fail to compile on systems with
kernel headers older than 6.9. Add:
#ifndef PIDFD_THREAD
# define PIDFD_THREAD O_EXCL
#endif
to include/lapi/pidfd.h.
[...]
> +static pthread_t do_pthread_create(int want_pidfd_err)
> {
> + int pidfd;
> pthread_t worker;
[...]
> + int status;
> + struct pidfd_fdinfo_t thread_pidfd_fdinfo;
> + TST_CHECKPOINT_WAKE(0);
> + SAFE_PTHREAD_JOIN(worker, (void **)&status);
> + if (status != 0)
status is int (4 bytes). SAFE_PTHREAD_JOIN writes a void * (8 bytes
on 64-bit) into &status, overflowing into adjacent stack memory.
Use void *status instead:
void *status;
SAFE_PTHREAD_JOIN(worker, &status);
if (status != NULL)
[...]
> + if (tc->trigger_in_child && !tc->want_pidfd_err) {
> + int status;
> + TST_CHECKPOINT_WAKE(0);
> + if (TST_VARIANT_PIDFD_THREAD) {
> + SAFE_PTHREAD_JOIN(worker_id.pthread_id, (void **)&status);
> + if (status != 0)
Same int/void * mismatch as above.
---
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
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-05-27 22:06 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-24 10:24 [PATCH] fanotify: report thread pidfds for FAN_REPORT_TID AnonymeMeow
2026-05-25 10:04 ` Amir Goldstein
2026-05-25 10:04 ` [LTP] " Amir Goldstein
2026-05-27 6:40 ` [PATCH] fanotify: prepare tests for thread pidfd reporting AnonymeMeow
2026-05-27 6:40 ` [LTP] " AnonymeMeow
2026-05-27 7:23 ` Petr Vorel
2026-05-27 7:23 ` Petr Vorel
2026-05-27 19:50 ` [PATCH v2 1/2] fanotify: fix crash when running multiple iterations AnonymeMeow
2026-05-27 19:50 ` [LTP] " AnonymeMeow
2026-05-27 19:50 ` [PATCH v2 2/2] fanotify: prepare tests for thread pidfd reporting AnonymeMeow
2026-05-27 19:50 ` [LTP] " AnonymeMeow
2026-05-27 22:06 ` linuxtestproject.agent [this message]
2026-05-28 13:03 ` [LTP] [PATCH v2 1/2] fanotify: fix crash when running multiple iterations Amir Goldstein
2026-05-27 9:53 ` [LTP] fanotify: prepare tests for thread pidfd reporting linuxtestproject.agent
2026-05-27 19:54 ` [LTP] [PATCH] " Amir Goldstein
2026-05-28 11:51 ` [PATCH] fanotify: report thread pidfds for FAN_REPORT_TID Christian Brauner
2026-05-29 2:00 ` [PATCH v2] " AnonymeMeow
2026-05-29 7:21 ` Amir Goldstein
2026-05-29 7:39 ` Christian Brauner
2026-05-29 10:32 ` Amir Goldstein
2026-06-01 9:12 ` Jan Kara
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=20260527220613.4056-1-linuxtestproject.agent@gmail.com \
--to=linuxtestproject.agent@gmail.com \
--cc=anonymemeow@gmail.com \
--cc=ltp@lists.linux.it \
/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.