From: AnonymeMeow <anonymemeow@gmail.com>
To: jack@suse.cz
Cc: amir73il@gmail.com, ltp@lists.linux.it,
AnonymeMeow <anonymemeow@gmail.com>
Subject: [LTP] [PATCH 1/5] fanotify20: Allow FAN_REPORT_PIDFD with FAN_REPORT_TID on v7.2+
Date: Tue, 16 Jun 2026 02:06:25 +0800 [thread overview]
Message-ID: <20260615180629.7148-2-anonymemeow@gmail.com> (raw)
In-Reply-To: <20260615180629.7148-1-anonymemeow@gmail.com>
fanotify_init() used to reject FAN_REPORT_PIDFD combined with
FAN_REPORT_TID with EINVAL. Since Linux v7.2, fanotify supports
reporting pidfds for thread IDs, so this combination is expected to
succeed.
Keep expecting EINVAL on older kernels and adjust the test expectation
based on the running kernel version.
Signed-off-by: AnonymeMeow <anonymemeow@gmail.com>
---
.../kernel/syscalls/fanotify/fanotify20.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/testcases/kernel/syscalls/fanotify/fanotify20.c b/testcases/kernel/syscalls/fanotify/fanotify20.c
index b32ecf6aa..9a78f6ff0 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify20.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify20.c
@@ -8,13 +8,14 @@
/*\
* This source file contains a test case which ensures that the
- * :manpage:`fanotify(7)` API returns an expected error code when provided an
- * invalid initialization flag alongside FAN_REPORT_PIDFD. Additionally, it
- * checks that the operability with existing FAN_REPORT_* flags is maintained
- * and functioning as intended.
+ * :manpage:`fanotify(7)` API returns an expected error code when provided
+ * unsupported initialization flags, e.g. FAN_REPORT_PIDFD combined with
+ * FAN_REPORT_TID. Additionally, it checks that the operability with
+ * supported FAN_REPORT_* flags is maintained and functioning as intended.
*
* NOTE: FAN_REPORT_PIDFD support was added in v5.15-rc1 in
* af579beb666a ("fanotify: add pidfd support to the fanotify API").
+ * FAN_REPORT_PIDFD combined with FAN_REPORT_TID is supported since v7.2-rc1.
*/
#define _GNU_SOURCE
@@ -26,8 +27,10 @@
#define MOUNT_PATH "fs_mnt"
#define FLAGS_DESC(x) .flags = x, .desc = #x
+#define PIDFD_TID_FLAGS (FAN_REPORT_PIDFD | FAN_REPORT_TID)
static int fd;
+static int thread_pidfd_supported;
static struct test_case_t {
unsigned int flags;
@@ -51,17 +54,21 @@ static void do_setup(void)
*/
REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(FAN_REPORT_PIDFD,
MOUNT_PATH);
+
+ thread_pidfd_supported = tst_kvercmp(7, 2, 0) >= 0;
}
static void do_test(unsigned int i)
{
struct test_case_t *tc = &test_cases[i];
+ int exp_errno = (tc->flags & PIDFD_TID_FLAGS) == PIDFD_TID_FLAGS &&
+ thread_pidfd_supported ? 0 : tc->exp_errno;
- tst_res(TINFO, "Test %s on %s", tc->exp_errno ? "fail" : "pass",
+ tst_res(TINFO, "Test %s on %s", exp_errno ? "fail" : "pass",
tc->desc);
TST_EXP_FD_OR_FAIL(fd = fanotify_init(tc->flags, O_RDONLY),
- tc->exp_errno);
+ exp_errno);
if (fd > 0)
SAFE_CLOSE(fd);
--
2.54.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-06-15 18:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <em6fgj3mkdyapnpi5yszfj563gwjoehyxxo6mk6cwiyyydkiah@vpunmf3gm5nt>
2026-06-15 18:06 ` [LTP] [PATCH 0/5] fanotify: update pidfd tests for FAN_REPORT_TID AnonymeMeow
2026-06-15 18:06 ` AnonymeMeow [this message]
2026-06-15 18:31 ` [LTP] fanotify20: Allow FAN_REPORT_PIDFD with FAN_REPORT_TID on v7.2+ linuxtestproject.agent
2026-06-16 7:40 ` [LTP] [PATCH 1/5] " Jan Kara
2026-06-16 11:27 ` Amir Goldstein
2026-06-16 11:48 ` Jan Kara
2026-06-15 18:06 ` [LTP] [PATCH 2/5] fanotify21: Stop relying on exited child for pidfd error AnonymeMeow
2026-06-16 7:48 ` Jan Kara
2026-06-15 18:06 ` [LTP] [PATCH 3/5] fanotify21: Simplify read_pidfd_fdinfo() AnonymeMeow
2026-06-16 7:46 ` Jan Kara
2026-06-15 18:06 ` [LTP] [PATCH 4/5] fanotify21: Add test variants for FAN_REPORT_TID AnonymeMeow
2026-06-16 7:55 ` Jan Kara
2026-06-16 8:24 ` Andrea Cervesato via ltp
2026-06-16 9:12 ` Jan Kara
2026-06-16 9:37 ` Andrea Cervesato via ltp
2026-06-15 18:06 ` [LTP] [PATCH 5/5] fanotify21: Add FAN_REPORT_TID pidfd coverage AnonymeMeow
2026-06-16 7:57 ` Jan Kara
2026-06-16 11:39 ` [LTP] [PATCH 0/5] fanotify: update pidfd tests for FAN_REPORT_TID 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=20260615180629.7148-2-anonymemeow@gmail.com \
--to=anonymemeow@gmail.com \
--cc=amir73il@gmail.com \
--cc=jack@suse.cz \
--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