Re: [PATCH] fanotify support save thread id

From: Amir Goldstein
Date: Mon Sep 17 2018 - 06:54:07 EST


On Mon, Sep 17, 2018 at 1:02 PM nixiaoming <nixiaoming@xxxxxxxxxx> wrote:
>
> Added FAN_EVENT_INFO_TID to select the thread id of the event trigger
>

Maybe "to report the thread id of the task that caused the event".
Also in commit title, I think "reporting thread id" is more to the point
than "save thread id".


> Signed-off-by: nixiaoming <nixiaoming@xxxxxxxxxx>
> ---
> --- a/include/uapi/linux/fanotify.h
> +++ b/include/uapi/linux/fanotify.h
> @@ -18,6 +18,7 @@
>
> #define FAN_ONDIR 0x40000000 /* event occurred against dir */
>
> +#define FAN_EVENT_INFO_TID 0x02000000 /* event save thread id replace tgid */
> #define FAN_EVENT_ON_CHILD 0x08000000 /* interested in child events */
>

nixiaoming,

You misunderstood me.

I meant that you should add support for flag FAN_EVENT_INFO_TID
for the fanotify_init() syscall, not the fanotify_mark() syscall.

See this commit from Steve Grubb for example of adding new opt-in
behavior to fanotify:
de8cd83e91bc audit: Record fanotify access control decisions

BTW, Steve, did you ever follow up with a man-pages patch?

Thanks,
Amir.