From: Song Liu <songliubraving@meta.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Song Liu <song@kernel.org>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-security-module@vger.kernel.org"
<linux-security-module@vger.kernel.org>,
Kernel Team <kernel-team@meta.com>,
"andrii@kernel.org" <andrii@kernel.org>,
"eddyz87@gmail.com" <eddyz87@gmail.com>,
"ast@kernel.org" <ast@kernel.org>,
"daniel@iogearbox.net" <daniel@iogearbox.net>,
"martin.lau@linux.dev" <martin.lau@linux.dev>,
"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
"brauner@kernel.org" <brauner@kernel.org>,
"jack@suse.cz" <jack@suse.cz>,
"kpsingh@kernel.org" <kpsingh@kernel.org>,
"mattbobrowski@google.com" <mattbobrowski@google.com>,
"repnop@google.com" <repnop@google.com>,
"jlayton@kernel.org" <jlayton@kernel.org>,
Josef Bacik <josef@toxicpanda.com>,
"mic@digikod.net" <mic@digikod.net>,
"gnoack@google.com" <gnoack@google.com>
Subject: Re: [PATCH v3 fanotify 2/2] samples/fanotify: Add a sample fanotify fiter
Date: Sun, 24 Nov 2024 18:59:40 +0000 [thread overview]
Message-ID: <27D52379-F45A-4E76-8573-5EBDC3C31DDE@fb.com> (raw)
In-Reply-To: <CAOQ4uxhfd8ryQ6ua5u60yN5sh06fyiieS3XgfR9jvkAOeDSZUg@mail.gmail.com>
> On Nov 23, 2024, at 9:07 PM, Amir Goldstein <amir73il@gmail.com> wrote:
>
> On Sat, Nov 23, 2024 at 12:00 AM Song Liu <song@kernel.org> wrote:
[...]
>> +}
>> +
>> +static void sample_filter_free(struct fanotify_filter_hook *filter_hook)
>> +{
>> + struct fan_filter_sample_data *data = filter_hook->data;
>> +
>> + path_put(&data->subtree_path);
>> + kfree(data);
>> +}
>> +
>
> Hi Song,
>
> This example looks fine but it raises a question.
> This filter will keep the mount of subtree_path busy until the group is closed
> or the filter is detached.
> This is probably fine for many services that keep the mount busy anyway.
>
> But what if this wasn't the intention?
> What if an Anti-malware engine that watches all mounts wanted to use that
> for configuring some ignore/block subtree filters?
>
> One way would be to use a is_subtree() variant that looks for a
> subtree root inode
> number and then verifies it with a subtree root fid.
> A production subtree filter will need to use a variant of is_subtree()
> anyway that
> looks for a set of subtree root inodes, because doing a loop of is_subtree() for
> multiple paths is a no go.
Maybe some cache mechanism will be sufficient (and maybe also the
best we can do) in this case?
Thanks,
Song
>
> Don't need to change anything in the example, unless other people
> think that we do need to set a better example to begin with...
next prev parent reply other threads:[~2024-11-24 18:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-22 22:59 [PATCH v3 fanotify 0/2] Fanotify in kernel filter Song Liu
2024-11-22 22:59 ` [PATCH v3 fanotify 1/2] fanotify: Introduce fanotify filter Song Liu
2024-11-24 6:25 ` Amir Goldstein
2024-11-24 19:08 ` Song Liu
2024-11-28 16:37 ` Jan Kara
2024-11-25 11:01 ` kernel test robot
2024-11-26 0:06 ` kernel test robot
2024-11-22 22:59 ` [PATCH v3 fanotify 2/2] samples/fanotify: Add a sample fanotify fiter Song Liu
2024-11-24 5:07 ` Amir Goldstein
2024-11-24 18:59 ` Song Liu [this message]
2024-11-27 0:50 ` Alexei Starovoitov
2024-11-27 2:16 ` Song Liu
2024-11-28 17:10 ` Jan Kara
2024-12-02 17:38 ` Song Liu
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=27D52379-F45A-4E76-8573-5EBDC3C31DDE@fb.com \
--to=songliubraving@meta.com \
--cc=amir73il@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=gnoack@google.com \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=josef@toxicpanda.com \
--cc=kernel-team@meta.com \
--cc=kpsingh@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mattbobrowski@google.com \
--cc=mic@digikod.net \
--cc=repnop@google.com \
--cc=song@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®