public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] Avoid having to provide a fake/invalid fd and path
@ 2014-03-26 15:30 xypron.glpk
  2014-03-26 18:47 ` Jan Kara
  2014-04-17 20:37 ` [PATCH 1/1] Avoid having to provide a fake/invalid fd and path Andrew Morton
  0 siblings, 2 replies; 6+ messages in thread
From: xypron.glpk @ 2014-03-26 15:30 UTC (permalink / raw)
  To: eparis
  Cc: jack, mtk.manpages, tvrtko.ursulin, linux-kernel,
	Heinrich Schuchardt

From: Heinrich Schuchardt <xypron.glpk@gmx.de>

https://lkml.org/lkml/2011/1/12/112
holds a patch by Tvrtko Ursulin

  Avoid having to provide a fake/invalid fd and path when flushing marks

  Currently for a group to flush marks it has set it needs to
  provide a fake or invalid (but resolvable) file descriptor
  and path when calling fanotify_mark. This patch pulls the
  flush handling a bit up so file descriptor and path are
  completely ignored when flushing.

Eric wrote it was applied.
https://lkml.org/lkml/2011/1/19/321

Unfortunately it is still not in the main stream code and the problem remains.

I reworked the patch to be applicable again (the signature of fanotify_mark
has changed since Tvrtko's work).

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 fs/notify/fanotify/fanotify_user.c |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 287a22c..05bb38a 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -856,6 +856,15 @@ SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
 	    group->priority == FS_PRIO_0)
 		goto fput_and_out;
 
+	if (flags & FAN_MARK_FLUSH) {
+		ret = 0;
+		if (flags & FAN_MARK_MOUNT)
+			fsnotify_clear_vfsmount_marks_by_group(group);
+		else
+			fsnotify_clear_inode_marks_by_group(group);
+		goto fput_and_out;
+	}
+
 	ret = fanotify_find_path(dfd, pathname, &path, flags);
 	if (ret)
 		goto fput_and_out;
@@ -867,7 +876,7 @@ SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
 		mnt = path.mnt;
 
 	/* create/update an inode mark */
-	switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_FLUSH)) {
+	switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE)) {
 	case FAN_MARK_ADD:
 		if (flags & FAN_MARK_MOUNT)
 			ret = fanotify_add_vfsmount_mark(group, mnt, mask, flags);
@@ -880,12 +889,6 @@ SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
 		else
 			ret = fanotify_remove_inode_mark(group, inode, mask, flags);
 		break;
-	case FAN_MARK_FLUSH:
-		if (flags & FAN_MARK_MOUNT)
-			fsnotify_clear_vfsmount_marks_by_group(group);
-		else
-			fsnotify_clear_inode_marks_by_group(group);
-		break;
 	default:
 		ret = -EINVAL;
 	}
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] Avoid having to provide a fake/invalid fd and path
  2014-03-26 15:30 [PATCH 1/1] Avoid having to provide a fake/invalid fd and path xypron.glpk
@ 2014-03-26 18:47 ` Jan Kara
  2014-03-26 19:00   ` Eric Paris
  2014-04-17 20:37 ` [PATCH 1/1] Avoid having to provide a fake/invalid fd and path Andrew Morton
  1 sibling, 1 reply; 6+ messages in thread
From: Jan Kara @ 2014-03-26 18:47 UTC (permalink / raw)
  To: xypron.glpk; +Cc: eparis, jack, tvrtko.ursulin, linux-kernel, Andrew Morton

On Wed 26-03-14 16:30:05, xypron.glpk@gmx.de wrote:
> From: Heinrich Schuchardt <xypron.glpk@gmx.de>
> 
> https://lkml.org/lkml/2011/1/12/112
> holds a patch by Tvrtko Ursulin
> 
>   Avoid having to provide a fake/invalid fd and path when flushing marks
> 
>   Currently for a group to flush marks it has set it needs to
>   provide a fake or invalid (but resolvable) file descriptor
>   and path when calling fanotify_mark. This patch pulls the
>   flush handling a bit up so file descriptor and path are
>   completely ignored when flushing.
> 
> Eric wrote it was applied.
> https://lkml.org/lkml/2011/1/19/321
> 
> Unfortunately it is still not in the main stream code and the problem remains.
> 
> I reworked the patch to be applicable again (the signature of fanotify_mark
> has changed since Tvrtko's work).
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
  The patch looks good to me. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>

  Andrew, can you please add the patch to the fanotify patches you already
carry? Thanks!

								Honza

> ---
>  fs/notify/fanotify/fanotify_user.c |   17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
> index 287a22c..05bb38a 100644
> --- a/fs/notify/fanotify/fanotify_user.c
> +++ b/fs/notify/fanotify/fanotify_user.c
> @@ -856,6 +856,15 @@ SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
>  	    group->priority == FS_PRIO_0)
>  		goto fput_and_out;
>  
> +	if (flags & FAN_MARK_FLUSH) {
> +		ret = 0;
> +		if (flags & FAN_MARK_MOUNT)
> +			fsnotify_clear_vfsmount_marks_by_group(group);
> +		else
> +			fsnotify_clear_inode_marks_by_group(group);
> +		goto fput_and_out;
> +	}
> +
>  	ret = fanotify_find_path(dfd, pathname, &path, flags);
>  	if (ret)
>  		goto fput_and_out;
> @@ -867,7 +876,7 @@ SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
>  		mnt = path.mnt;
>  
>  	/* create/update an inode mark */
> -	switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_FLUSH)) {
> +	switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE)) {
>  	case FAN_MARK_ADD:
>  		if (flags & FAN_MARK_MOUNT)
>  			ret = fanotify_add_vfsmount_mark(group, mnt, mask, flags);
> @@ -880,12 +889,6 @@ SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
>  		else
>  			ret = fanotify_remove_inode_mark(group, inode, mask, flags);
>  		break;
> -	case FAN_MARK_FLUSH:
> -		if (flags & FAN_MARK_MOUNT)
> -			fsnotify_clear_vfsmount_marks_by_group(group);
> -		else
> -			fsnotify_clear_inode_marks_by_group(group);
> -		break;
>  	default:
>  		ret = -EINVAL;
>  	}
> -- 
> 1.7.10.4
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] Avoid having to provide a fake/invalid fd and path
  2014-03-26 18:47 ` Jan Kara
@ 2014-03-26 19:00   ` Eric Paris
  2014-04-13 14:28     ` [PATCH 1/1] Avoid having to provide a fake/invalid fd and path (fanotify) Heinrich Schuchardt
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Paris @ 2014-03-26 19:00 UTC (permalink / raw)
  To: Jan Kara; +Cc: xypron.glpk, tvrtko.ursulin, linux-kernel, Andrew Morton

On Wed, 2014-03-26 at 19:47 +0100, Jan Kara wrote:
> On Wed 26-03-14 16:30:05, xypron.glpk@gmx.de wrote:
> > From: Heinrich Schuchardt <xypron.glpk@gmx.de>
> > 
> > https://lkml.org/lkml/2011/1/12/112
> > holds a patch by Tvrtko Ursulin
> > 
> >   Avoid having to provide a fake/invalid fd and path when flushing marks
> > 
> >   Currently for a group to flush marks it has set it needs to
> >   provide a fake or invalid (but resolvable) file descriptor
> >   and path when calling fanotify_mark. This patch pulls the
> >   flush handling a bit up so file descriptor and path are
> >   completely ignored when flushing.
> > 
> > Eric wrote it was applied.
> > https://lkml.org/lkml/2011/1/19/321
> > 
> > Unfortunately it is still not in the main stream code and the problem remains.
> > 
> > I reworked the patch to be applicable again (the signature of fanotify_mark
> > has changed since Tvrtko's work).
> > 
> > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
>   The patch looks good to me. You can add:
> Reviewed-by: Jan Kara <jack@suse.cz>
> 
>   Andrew, can you please add the patch to the fanotify patches you already
> carry? Thanks!

Acked-by: Eric Paris <eparis@redhat.com>

that would be great Andrew!

> 
> 								Honza
> 
> > ---
> >  fs/notify/fanotify/fanotify_user.c |   17 ++++++++++-------
> >  1 file changed, 10 insertions(+), 7 deletions(-)
> > 
> > diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
> > index 287a22c..05bb38a 100644
> > --- a/fs/notify/fanotify/fanotify_user.c
> > +++ b/fs/notify/fanotify/fanotify_user.c
> > @@ -856,6 +856,15 @@ SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
> >  	    group->priority == FS_PRIO_0)
> >  		goto fput_and_out;
> >  
> > +	if (flags & FAN_MARK_FLUSH) {
> > +		ret = 0;
> > +		if (flags & FAN_MARK_MOUNT)
> > +			fsnotify_clear_vfsmount_marks_by_group(group);
> > +		else
> > +			fsnotify_clear_inode_marks_by_group(group);
> > +		goto fput_and_out;
> > +	}
> > +
> >  	ret = fanotify_find_path(dfd, pathname, &path, flags);
> >  	if (ret)
> >  		goto fput_and_out;
> > @@ -867,7 +876,7 @@ SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
> >  		mnt = path.mnt;
> >  
> >  	/* create/update an inode mark */
> > -	switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_FLUSH)) {
> > +	switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE)) {
> >  	case FAN_MARK_ADD:
> >  		if (flags & FAN_MARK_MOUNT)
> >  			ret = fanotify_add_vfsmount_mark(group, mnt, mask, flags);
> > @@ -880,12 +889,6 @@ SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
> >  		else
> >  			ret = fanotify_remove_inode_mark(group, inode, mask, flags);
> >  		break;
> > -	case FAN_MARK_FLUSH:
> > -		if (flags & FAN_MARK_MOUNT)
> > -			fsnotify_clear_vfsmount_marks_by_group(group);
> > -		else
> > -			fsnotify_clear_inode_marks_by_group(group);
> > -		break;
> >  	default:
> >  		ret = -EINVAL;
> >  	}
> > -- 
> > 1.7.10.4
> > 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] Avoid having to provide a fake/invalid fd and path (fanotify)
  2014-03-26 19:00   ` Eric Paris
@ 2014-04-13 14:28     ` Heinrich Schuchardt
  0 siblings, 0 replies; 6+ messages in thread
From: Heinrich Schuchardt @ 2014-04-13 14:28 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Eric Paris, Jan Kara, tvrtko.ursulin, linux-kernel

Hello Andrew,

may I again bring this patch to your attention.

Jan Kara <jack@suse.cz> reviewed it and
fanotify maintainer Eric Paris <eparis@redhat.com>
asked you to, please, apply it.

Unfortunately I could not see any update.

Best regards

Heinrich Schuchardt


On 26.03.2014 20:00, Eric Paris wrote:
> On Wed, 2014-03-26 at 19:47 +0100, Jan Kara wrote:
>> On Wed 26-03-14 16:30:05, xypron.glpk@gmx.de wrote:
>>> From: Heinrich Schuchardt <xypron.glpk@gmx.de>
>>>
>>> https://lkml.org/lkml/2011/1/12/112
>>> holds a patch by Tvrtko Ursulin
>>>
>>>    Avoid having to provide a fake/invalid fd and path when flushing marks
>>>
>>>    Currently for a group to flush marks it has set it needs to
>>>    provide a fake or invalid (but resolvable) file descriptor
>>>    and path when calling fanotify_mark. This patch pulls the
>>>    flush handling a bit up so file descriptor and path are
>>>    completely ignored when flushing.
>>>
>>> Eric wrote it was applied.
>>> https://lkml.org/lkml/2011/1/19/321
>>>
>>> Unfortunately it is still not in the main stream code and the problem remains.
>>>
>>> I reworked the patch to be applicable again (the signature of fanotify_mark
>>> has changed since Tvrtko's work).
>>>
>>> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
>>    The patch looks good to me. You can add:
>> Reviewed-by: Jan Kara <jack@suse.cz>
>>
>>    Andrew, can you please add the patch to the fanotify patches you already
>> carry? Thanks!
>
> Acked-by: Eric Paris <eparis@redhat.com>
>
> that would be great Andrew!
>
>>
>> 								Honza
>>
>>> ---
>>>   fs/notify/fanotify/fanotify_user.c |   17 ++++++++++-------
>>>   1 file changed, 10 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
>>> index 287a22c..05bb38a 100644
>>> --- a/fs/notify/fanotify/fanotify_user.c
>>> +++ b/fs/notify/fanotify/fanotify_user.c
>>> @@ -856,6 +856,15 @@ SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
>>>   	    group->priority == FS_PRIO_0)
>>>   		goto fput_and_out;
>>>
>>> +	if (flags & FAN_MARK_FLUSH) {
>>> +		ret = 0;
>>> +		if (flags & FAN_MARK_MOUNT)
>>> +			fsnotify_clear_vfsmount_marks_by_group(group);
>>> +		else
>>> +			fsnotify_clear_inode_marks_by_group(group);
>>> +		goto fput_and_out;
>>> +	}
>>> +
>>>   	ret = fanotify_find_path(dfd, pathname, &path, flags);
>>>   	if (ret)
>>>   		goto fput_and_out;
>>> @@ -867,7 +876,7 @@ SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
>>>   		mnt = path.mnt;
>>>
>>>   	/* create/update an inode mark */
>>> -	switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_FLUSH)) {
>>> +	switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE)) {
>>>   	case FAN_MARK_ADD:
>>>   		if (flags & FAN_MARK_MOUNT)
>>>   			ret = fanotify_add_vfsmount_mark(group, mnt, mask, flags);
>>> @@ -880,12 +889,6 @@ SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
>>>   		else
>>>   			ret = fanotify_remove_inode_mark(group, inode, mask, flags);
>>>   		break;
>>> -	case FAN_MARK_FLUSH:
>>> -		if (flags & FAN_MARK_MOUNT)
>>> -			fsnotify_clear_vfsmount_marks_by_group(group);
>>> -		else
>>> -			fsnotify_clear_inode_marks_by_group(group);
>>> -		break;
>>>   	default:
>>>   		ret = -EINVAL;
>>>   	}
>>> --
>>> 1.7.10.4
>>>
>
>
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] Avoid having to provide a fake/invalid fd and path
  2014-03-26 15:30 [PATCH 1/1] Avoid having to provide a fake/invalid fd and path xypron.glpk
  2014-03-26 18:47 ` Jan Kara
@ 2014-04-17 20:37 ` Andrew Morton
  2014-04-18 13:45   ` [PATCH 1/1] Avoid having to provide a fake/invalid fd and path: update manpage Heinrich Schuchardt
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2014-04-17 20:37 UTC (permalink / raw)
  To: xypron.glpk; +Cc: eparis, jack, mtk.manpages, tvrtko.ursulin, linux-kernel

On Wed, 26 Mar 2014 16:30:05 +0100 xypron.glpk@gmx.de wrote:

> From: Heinrich Schuchardt <xypron.glpk@gmx.de>
> 
> https://lkml.org/lkml/2011/1/12/112
> holds a patch by Tvrtko Ursulin
> 
>   Avoid having to provide a fake/invalid fd and path when flushing marks
> 
>   Currently for a group to flush marks it has set it needs to
>   provide a fake or invalid (but resolvable) file descriptor
>   and path when calling fanotify_mark. This patch pulls the
>   flush handling a bit up so file descriptor and path are
>   completely ignored when flushing.

The fanotify_mark() manpage should be updated to mention this.  Is that
a thing you can take care of? 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] Avoid having to provide a fake/invalid fd and path: update manpage
  2014-04-17 20:37 ` [PATCH 1/1] Avoid having to provide a fake/invalid fd and path Andrew Morton
@ 2014-04-18 13:45   ` Heinrich Schuchardt
  0 siblings, 0 replies; 6+ messages in thread
From: Heinrich Schuchardt @ 2014-04-18 13:45 UTC (permalink / raw)
  To: Andrew Morton
  Cc: eparis, Jan Kara, mtk.manpages, tvrtko.ursulin, linux-kernel


> The fanotify_mark() manpage should be updated to mention this.  Is that
> a thing you can take care of?
>
Currently no fanotify_mark() manpage exists. I am working with Michael 
Kerrisk on creating one.

I will mention in the BUGS section that up to Linux 3.15 a fake path is 
needed.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-04-18 13:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-26 15:30 [PATCH 1/1] Avoid having to provide a fake/invalid fd and path xypron.glpk
2014-03-26 18:47 ` Jan Kara
2014-03-26 19:00   ` Eric Paris
2014-04-13 14:28     ` [PATCH 1/1] Avoid having to provide a fake/invalid fd and path (fanotify) Heinrich Schuchardt
2014-04-17 20:37 ` [PATCH 1/1] Avoid having to provide a fake/invalid fd and path Andrew Morton
2014-04-18 13:45   ` [PATCH 1/1] Avoid having to provide a fake/invalid fd and path: update manpage Heinrich Schuchardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox