Re: [PATCH v2 1/1] fanotify: introduce new event flag FAN_EXEC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 1, 2018 at 11:21 AM Matthew Bobrowski
<mbobrowski@xxxxxxxxxxxxxx> wrote:
>
> Hi Amir,
>
> On 28/09/18 15:39, Amir Goldstein wrote:
> > On Fri, Sep 28, 2018 at 4:28 AM Matthew Bobrowski
> > <mbobrowski@xxxxxxxxxxxxxx> wrote:
> >>
> >> Hi Amir,
> >>
> >> On 27/9/18 11:57 pm, Amir Goldstein wrote:
> >>> [cc: linux-api]
> >>>
> >>> On Thu, Sep 27, 2018 at 4:05 PM Matthew Bobrowski
> >>> <mbobrowski@xxxxxxxxxxxxxx> wrote:
> >>>>
> >>>> This is a reduced version of a patch that I originally submitted a while ago.
> >>>>
> >>>> In short, the fanotify API currently does not provide any means for user space
> >>>> programs to receive events specifically when a file has been opened with the
> >>>> intent to be executed. The FAN_EXEC flag will be set within the event mask when
> >>>> a object has been opened with one of the open flags being __FMODE_EXEC.
> >>>>
> > ...
[...]
> > If Jan accepts my proposal, you can base your patch on:
> > https://github.com/amir73il/linux/commits/fanotify_api-v3
>
> Ok, great. I've gone ahead and written an updated patch that adds the
> ability for programs to explicitly enable the receiving of events that
> contain the "FAN_EXECUTE" bonus flag. Programs will have to provide
> "FAN_ENABLE_EXECUTE" as one of their initialization flags when calling
> fanotify_init() in order to receive any events where the "FAN_EXECUTE" flag
> has been set. I think doing it this way would be a far better solution to
> mitigate possibly breaking any existing programs.
>
> You can find the patch here:
> https://github.com/matthewbobrowski/linux/commit/3325b3bbd8613b0de1dd6bac24b52c481b760f1d
>
> These changes are based off your branch 'fanotify_api-v3'. Let me know what
> you think.
>

Besides some nits I left in github:

I personally liked FAN_EXEC, better than FAN_EXECUTE.
If you have a string argument in favor of latter please share it.

Your changes enables receiving the FAN_EXEC "bonus" flag, but not to
request (or ignore) FAN_EXEC events (you did not add it to FAN_USER_EVENTS).
But you should also add a check in do_fanotify_mark() to return -EINVAL when
FAN_EXEC event mask was specified, but group has no FAN_ENABLE_EXEC.

So to clarify, if group has FAN_ENABLE_EXEC, the "bonus" flag can be
reported even if not requested (e.g. requested only FAN_OPEN), but if
user wishes
to get only FAN_EXEC events or only FAN_OPEN events that are not FAN_EXEC
user needs to first enable exec events in fanotify_init.

Thanks,
Amir.



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux