* fanotify and namespaces/bind mounts
@ 2015-10-29 13:29 Marko Rauhamaa
2017-03-18 14:04 ` riya khanna
0 siblings, 1 reply; 2+ messages in thread
From: Marko Rauhamaa @ 2015-10-29 13:29 UTC (permalink / raw)
To: linux-kernel
If I call fanotify_mark(... FAN_MARK_ADD | FAN_MARK_MOUNT ...), I get
notifications on all files on the file system.
Except I don't.
If a process has mounted directories on the file system in a different
namespace, the global namespace experiences file system events but no
fanotify events are generated. A similar limitation applies to bind
mounts.
You can easily see this behavior in action. Do "man fanotify", and copy
the example program to, say, example.c. Then,
cc -o example example.c
mkdir -p /mnt/xyz
mount -o bind /root /mnt/xyz
./example /root
The last command prints out fanotify events. It will display events for
touch /root/xyzzy
but nothing for
touch /mnt/xyz/zyxxy
or
unshare -m touch /root/yxyyx
Should the current situation be considered a bug in fanotify? Or is
there another recommended way to monitor file system events
categorigally?
Marko
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: fanotify and namespaces/bind mounts
2015-10-29 13:29 fanotify and namespaces/bind mounts Marko Rauhamaa
@ 2017-03-18 14:04 ` riya khanna
0 siblings, 0 replies; 2+ messages in thread
From: riya khanna @ 2017-03-18 14:04 UTC (permalink / raw)
To: Marko Rauhamaa; +Cc: linux-kernel
Are fsnotify events generated per mount namespace?
On Thu, Oct 29, 2015 at 9:29 AM, Marko Rauhamaa <marko@pacujo.net> wrote:
>
> If I call fanotify_mark(... FAN_MARK_ADD | FAN_MARK_MOUNT ...), I get
> notifications on all files on the file system.
>
> Except I don't.
>
> If a process has mounted directories on the file system in a different
> namespace, the global namespace experiences file system events but no
> fanotify events are generated. A similar limitation applies to bind
> mounts.
>
> You can easily see this behavior in action. Do "man fanotify", and copy
> the example program to, say, example.c. Then,
>
> cc -o example example.c
> mkdir -p /mnt/xyz
> mount -o bind /root /mnt/xyz
> ./example /root
>
> The last command prints out fanotify events. It will display events for
>
> touch /root/xyzzy
>
> but nothing for
>
> touch /mnt/xyz/zyxxy
>
> or
>
> unshare -m touch /root/yxyyx
>
> Should the current situation be considered a bug in fanotify? Or is
> there another recommended way to monitor file system events
> categorigally?
>
>
> Marko
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-18 14:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-29 13:29 fanotify and namespaces/bind mounts Marko Rauhamaa
2017-03-18 14:04 ` riya khanna
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®