From: Song Liu <songliubraving@meta.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: "Song Liu" <song@kernel.org>, bpf <bpf@vger.kernel.org>,
Linux-Fsdevel <linux-fsdevel@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
"LSM List" <linux-security-module@vger.kernel.org>,
"Kernel Team" <kernel-team@meta.com>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Eddy Z" <eddyz87@gmail.com>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Martin KaFai Lau" <martin.lau@linux.dev>,
"Alexander Viro" <viro@zeniv.linux.org.uk>,
"Christian Brauner" <brauner@kernel.org>,
"Jan Kara" <jack@suse.cz>, "KP Singh" <kpsingh@kernel.org>,
"Matt Bobrowski" <mattbobrowski@google.com>,
"Amir Goldstein" <amir73il@gmail.com>,
"repnop@google.com" <repnop@google.com>,
"Jeff Layton" <jlayton@kernel.org>,
"Josef Bacik" <josef@toxicpanda.com>,
"Mickaël Salaün" <mic@digikod.net>,
"gnoack@google.com" <gnoack@google.com>
Subject: Re: [RFC/PATCH v2 bpf-next fanotify 7/7] selftests/bpf: Add test for BPF based fanotify fastpath handler
Date: Thu, 14 Nov 2024 23:02:51 +0000 [thread overview]
Message-ID: <E5457BFD-F7B9-4077-9EAC-168DA5C271E4@fb.com> (raw)
In-Reply-To: <CAADnVQK6YyPUzQoPKkXptLHoHXJZ50A8vNPfpDAk8Jc3Z6+iRw@mail.gmail.com>
> On Nov 14, 2024, at 12:14 PM, Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
>
> On Thu, Nov 14, 2024 at 12:44 AM Song Liu <song@kernel.org> wrote:
>>
>> +
>> + if (bpf_is_subdir(dentry, v->dentry))
>> + ret = FAN_FP_RET_SEND_TO_USERSPACE;
>> + else
>> + ret = FAN_FP_RET_SKIP_EVENT;
>
> It seems to me that all these patches and feature additions
> to fanotify, new kfuncs, etc are done just to do the above
> filtering by subdir ?
>
> If so, just hard code this logic as an extra flag to fanotify ?
> So it can filter all events by subdir.
> bpf programmability makes sense when it needs to express
> user space policy. Here it's just a filter by subdir.
> bpf hammer doesn't look like the right tool for this use case.
Current version is indeed tailored towards the subtree
monitoring use case. This is mostly because feedback on v1
mostly focused on this use case. V1 itself actually had some
other use cases.
In practice, fanotify fastpath can benefit from bpf
programmability. For example, with bpf programmability, we
can combine fanotify and BPF LSM in some security use cases.
If some security rules only applies to a few files, a
directory, or a subtree, we can use fanotify to only monitor
these files. LSM hooks, such as security_file_open(), are
always global. The overhead is higher if we are only
interested in a few files.
Does this make sense?
Thanks,
Song
next prev parent reply other threads:[~2024-11-14 23:02 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-14 8:43 [RFC/PATCH v2 bpf-next fanotify 0/7] Fanotify " Song Liu
2024-11-14 8:43 ` [RFC/PATCH v2 bpf-next fanotify 1/7] fanotify: Introduce fanotify " Song Liu
2024-11-15 8:51 ` Amir Goldstein
2024-11-15 17:11 ` Song Liu
2024-11-15 17:32 ` Amir Goldstein
2024-11-14 8:43 ` [RFC/PATCH v2 bpf-next fanotify 2/7] samples/fanotify: Add a sample " Song Liu
2024-11-14 8:43 ` [RFC/PATCH v2 bpf-next fanotify 3/7] bpf: Make bpf inode storage available to tracing programs Song Liu
2024-11-14 8:43 ` [RFC/PATCH v2 bpf-next fanotify 4/7] bpf: fs: Add three kfuncs Song Liu
2024-11-14 8:43 ` [RFC/PATCH v2 bpf-next fanotify 5/7] bpf: Allow bpf map hold reference on dentry Song Liu
2024-11-14 8:43 ` [RFC/PATCH v2 bpf-next fanotify 6/7] fanotify: Enable bpf based fanotify fastpath handler Song Liu
2024-11-14 8:43 ` [RFC/PATCH v2 bpf-next fanotify 7/7] selftests/bpf: Add test for BPF " Song Liu
2024-11-14 20:14 ` Alexei Starovoitov
2024-11-14 23:02 ` Song Liu [this message]
2024-11-15 0:41 ` Alexei Starovoitov
2024-11-15 1:10 ` Song Liu
2024-11-15 1:31 ` Alexei Starovoitov
2024-11-15 7:01 ` Song Liu
2024-11-15 19:41 ` Alexei Starovoitov
2024-11-15 21:05 ` Song Liu
2024-11-18 20:51 ` Song Liu
2024-11-19 0:10 ` Alexei Starovoitov
2024-11-19 1:10 ` Song Liu
2024-11-19 7:59 ` Amir Goldstein
2024-11-19 8:35 ` Song Liu
2024-11-15 7:26 ` Amir Goldstein
2024-11-15 20:04 ` Alexei Starovoitov
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=E5457BFD-F7B9-4077-9EAC-168DA5C271E4@fb.com \
--to=songliubraving@meta.com \
--cc=alexei.starovoitov@gmail.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®