Linux Test Project
 help / color / mirror / Atom feed
From: linuxtestproject.agent@gmail.com
To: AnonymeMeow <anonymemeow@gmail.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] fanotify: prepare tests for thread pidfd reporting
Date: Wed, 27 May 2026 09:53:40 +0000	[thread overview]
Message-ID: <20260527095340.4092-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260527064041.50443-1-anonymemeow@gmail.com>

Hi AnonymeMeow,

On Wed May 27 2026, AnonymeMeow wrote:
> fanotify: prepare tests for thread pidfd reporting

Commit message body is an email exchange transcript rather than a clean
description of what the patch does and why. Please rewrite it as a
standalone commit message.

---

> diff --git a/include/lapi/pidfd.h b/include/lapi/pidfd.h

PIDFD_THREAD is used in fanotify21.c but is not defined in
include/lapi/pidfd.h. On systems with kernel headers older than 6.9
this will fail to compile. Add a fallback:

  #ifndef PIDFD_THREAD
  # define PIDFD_THREAD O_EXCL
  #endif

---

> diff --git a/testcases/kernel/syscalls/fanotify/fanotify20.c b/...

[...]

> +unsigned int needs_thread_pidfd;

Other boolean-like fields in test_case_t use int. Make this int for
consistency.

[...]

The file-level docstring says the test "ensures that the fanotify(7) API
returns an expected error code when provided an invalid initialization
flag". The new third test case behaves differently depending on kernel
support (may expect success). Update the docstring.

---

> diff --git a/testcases/kernel/syscalls/fanotify/fanotify21.c b/...

[...]

> +if (WIFEXITED(status) && WEXITSTATUS(status) != 0)
> +tst_brk(TBROK, "child process terminated incorrectly");
> +

Trailing whitespace on the blank line above.

[...]

> +static pthread_t do_pthread_create(int want_pidfd_err)
> +{
[...]
> +SAFE_PTHREAD_JOIN(worker, (void **)&status);
> +if (status != 0)

status is int (4 bytes) but pthread_join writes a void* (8 bytes on
64-bit) at that address, corrupting the stack. Use NULL since the return
value is not needed:

  SAFE_PTHREAD_JOIN(worker, 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 bug: (void **)&status writes 8 bytes to a 4-byte int. Use NULL or
a void* variable here too.

---

Needs revision:
- Add PIDFD_THREAD fallback to include/lapi/pidfd.h
- Fix SAFE_PTHREAD_JOIN (void **)&status type mismatch in both call sites
- Clean up commit message
- Update fanotify20 docstring to cover the new kernel-conditional test case
- Fix trailing whitespace and needs_thread_pidfd type

---
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

  parent reply	other threads:[~2026-05-27  9:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260524102439.44642-1-anonymemeow@gmail.com>
2026-05-25 10:04 ` [LTP] [PATCH] fanotify: report thread pidfds for FAN_REPORT_TID Amir Goldstein
2026-05-27  6:40   ` [LTP] [PATCH] fanotify: prepare tests for thread pidfd reporting AnonymeMeow
2026-05-27  7:23     ` Petr Vorel
2026-05-27 19:50       ` [LTP] [PATCH v2 1/2] fanotify: fix crash when running multiple iterations AnonymeMeow
2026-05-27 19:50         ` [LTP] [PATCH v2 2/2] fanotify: prepare tests for thread pidfd reporting AnonymeMeow
2026-05-27 22:06         ` [LTP] fanotify: fix crash when running multiple iterations linuxtestproject.agent
2026-05-28 13:03         ` [LTP] [PATCH v2 1/2] " Amir Goldstein
2026-05-27  9:53     ` linuxtestproject.agent [this message]
2026-05-27 19:54     ` [LTP] [PATCH] fanotify: prepare tests for thread pidfd reporting Amir Goldstein

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=20260527095340.4092-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox