All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marko Rauhamaa <marko.rauhamaa@f-secure.com>
To: <linux-fsdevel@vger.kernel.org>
Subject: fanotify and pidfd?
Date: Fri, 7 Jun 2019 16:48:15 +0300	[thread overview]
Message-ID: <87zhmt7bhc.fsf@drapion.f-secure.com> (raw)


As it stands, fanotify reports the process ID of the file that is being
operated on:

           struct fanotify_event_metadata {
               __u32 event_len;
               __u8 vers;
               __u8 reserved;
               __u16 metadata_len;
               __aligned_u64 mask;
               __s32 fd;
               __s32 pid;
           };

One nasty problem with this is that the process often is long gone by
the time the notification arrives.

Would it be possible to amend this format with:

               __s32 pidfd;

It would hold the pid still for the duration of notification processing
and allow for the fanotify monitor to safely use the pid field to
inspect /proc/<pid>.

And the possibility of sending signals to the monitored process might
come in handy as well.

Thinking about this a bit more, could the fd field take on the dual role
of allowing you to read the file in question as well as acting as a
pidfd?


Marko

             reply	other threads:[~2019-06-07 14:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-07 13:48 Marko Rauhamaa [this message]
2019-06-07 17:29 ` fanotify and pidfd? Amir Goldstein
2019-06-08 10:55   ` Marko Rauhamaa

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=87zhmt7bhc.fsf@drapion.f-secure.com \
    --to=marko.rauhamaa@f-secure.com \
    --cc=linux-fsdevel@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 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.