mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Song Liu <songliubraving@meta.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Song Liu <song@kernel.org>,
	Linux-Fsdevel <linux-fsdevel@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	LSM List <linux-security-module@vger.kernel.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	Paul Moore <paul@paul-moore.com>,
	James Morris <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	Kernel Team <kernel-team@meta.com>
Subject: Re: [PATCH v2] fsnotify, lsm: Decouple fsnotify from lsm
Date: Sun, 13 Oct 2024 14:45:54 +0000	[thread overview]
Message-ID: <AE7ECD50-A7DC-4D7D-8BC7-2A555A327483@fb.com> (raw)
In-Reply-To: <CAOQ4uxjQ--cBoNNHQYz+AFz2z8g=pCZ0CFDHujuCELOJBg8wzw@mail.gmail.com>

Hi Amir, 

> On Oct 13, 2024, at 2:38 AM, Amir Goldstein <amir73il@gmail.com> wrote:
> 
> On Sun, Oct 13, 2024 at 2:23 AM Song Liu <song@kernel.org> wrote:
>> 
>> Currently, fsnotify_open_perm() is called from security_file_open(). This
>> is not right for CONFIG_SECURITY=n and CONFIG_FSNOTIFY=y case, as
>> security_file_open() in this combination will be a no-op and not call
>> fsnotify_open_perm(). Fix this by calling fsnotify_open_perm() directly.
> 
> Maybe I am missing something.
> I like cleaner interfaces, but if it is a report of a problem then
> I do not understand what the problem is.
> IOW, what does "This is not right" mean?

With existing code, CONFIG_FANOTIFY_ACCESS_PERMISSIONS depends on 
CONFIG_SECURITY, but CONFIG_FSNOTIFY does not depend on 
CONFIG_SECURITY. So CONFIG_SECURITY=n and CONFIG_FSNOTIFY=y is a
valid combination. fsnotify_open_perm() is an fsnotify API, so I
think it is not right to skip the API call for this config.

> 
>> 
>> After this, CONFIG_FANOTIFY_ACCESS_PERMISSIONS does not require
>> CONFIG_SECURITY any more. Remove the dependency in the config.
>> 
>> Signed-off-by: Song Liu <song@kernel.org>
>> Acked-by: Paul Moore <paul@paul-moore.com>
>> 
>> ---
>> 
>> v1: https://lore.kernel.org/linux-fsdevel/20241011203722.3749850-1-song@kernel.org/
>> 
>> As far as I can tell, it is necessary to back port this to stable. Because
>> CONFIG_FANOTIFY_ACCESS_PERMISSIONS is the only user of fsnotify_open_perm,
>> and CONFIG_FANOTIFY_ACCESS_PERMISSIONS depends on CONFIG_SECURITY.
>> Therefore, the following tags are not necessary. But I include here as
>> these are discussed in v1.
> 
> I did not understand why you claim that the tags are or not necessary.
> The dependency is due to removal of the fsnotify.h include.

I think the Fixes tag is also not necessary, not just the two 
Depends-on tags. This is because while fsnotify_open_perm() is a 
fsnotify API, only CONFIG_FANOTIFY_ACCESS_PERMISSIONS really uses 
(if I understand correctly). 

> 
> Anyway, I don't think it is critical to backport this fix.
> The dependencies would probably fail to apply cleanly to older kernels,
> so unless somebody cares, it would stay this way.

I agree it is not critical to back port this fix. I put the 
Fixes tag below "---" for this reason. 

Does this answer your question? 

Thanks,
Song

> 
>> 
>> Fixes: c4ec54b40d33 ("fsnotify: new fsnotify hooks and events types for access decisions")
> 
> Because I am not sure what the problem is, I am not sure that a Fixes:
> tag is called for.
> 
>> Depends-on: 36e28c42187c ("fsnotify: split fsnotify_perm() into two hooks")
>> Depends-on: d9e5d31084b0 ("fsnotify: optionally pass access range in file permission hooks")
> 
> These need to be in the commit message in case AUTOSEL or a developer
> would decide to backport your change.
> 
> Thanks,
> Amir.

  reply	other threads:[~2024-10-13 14:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-13  0:22 Song Liu
2024-10-13  9:38 ` Amir Goldstein
2024-10-13 14:45   ` Song Liu [this message]
2024-10-13 14:51     ` Amir Goldstein
2024-10-14 15:38       ` Jan Kara

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=AE7ECD50-A7DC-4D7D-8BC7-2A555A327483@fb.com \
    --to=songliubraving@meta.com \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=jmorris@namei.org \
    --cc=kernel-team@meta.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=serge@hallyn.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®