From: AnonymeMeow <anonymemeow@gmail.com>
To: brauner@kernel.org
Cc: amir73il@gmail.com, jack@suse.cz, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/2] fanotify: allow reporting pidfds for reaped tasks
Date: Wed, 3 Jun 2026 11:11:17 +0800 [thread overview]
Message-ID: <20260603031117.20950-1-anonymemeow@gmail.com> (raw)
In-Reply-To: <20260603001516.26234-3-anonymemeow@gmail.com>
Sashiko said that pidfs_register_pid() can fail under memory pressure,
since it allocates memory using GFP_KERNEL without a way to pass in
__GFP_NOFAIL. This can cause fanotify_alloc_event() to silently drop
the event even when the group has an unlimited queue length.
Should we make pidfs registration best-effort instead and still return
the allocated event if pidfs_register_pid() fails? But IMO this will
make the API semantically ambiguous. If the kernel guarantees that the
event pid is registered with pidfs when pidfd reporting is requested,
then a later FAN_NOPIDFD or -ESRCH can only be caused by the task being
invisible within the reader's pid namespace. But if we allow best-effort
registration, the event may still carry a pinned struct pid, but pidfs
registration may have failed due to memory pressure. If userspace reads
the event after the task has been reaped, it still gets a FAN_NOPIDFD
or -ESRCH due to failed pidfs registration caused by memory pressure,
IMO this should be reported as a -ENOMEM instead of -ESRCH. But
currently it seems we don't have a good way to register the pid with
__GFP_NOFAIL or __GFP_RETRY_MAYFAIL, so what would be the preferred
approach to handle this situation?
next prev parent reply other threads:[~2026-06-03 3:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 0:15 [PATCH v4 0/2] fanotify: lift pidfd reporting restrictions AnonymeMeow
2026-06-03 0:15 ` [PATCH v4 1/2] fanotify: report thread pidfds for FAN_REPORT_TID AnonymeMeow
2026-06-03 9:55 ` Amir Goldstein
2026-06-03 0:15 ` [PATCH v4 2/2] fanotify: allow reporting pidfds for reaped tasks AnonymeMeow
2026-06-03 3:11 ` AnonymeMeow [this message]
2026-06-03 10:00 ` Amir Goldstein
2026-06-03 10:28 ` Christian Brauner
2026-06-03 10:58 ` Amir Goldstein
2026-06-03 11:25 ` Christian Brauner
2026-06-03 12:02 ` Amir Goldstein
2026-06-04 20:29 ` AnonymeMeow
2026-06-05 7:54 ` Christian Brauner
2026-06-05 8:15 ` Amir Goldstein
2026-06-05 8:19 ` Christian Brauner
2026-06-05 8:28 ` Amir Goldstein
2026-06-06 23:45 ` AnonymeMeow
2026-06-10 7:42 ` Christian Brauner
2026-06-04 19:46 ` [DRAFT][PATCH] fanotify: lift pidfd reporting restrictions AnonymeMeow
2026-06-05 8:23 ` Amir Goldstein
2026-06-05 10:04 ` Christian Brauner
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=20260603031117.20950-1-anonymemeow@gmail.com \
--to=anonymemeow@gmail.com \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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