linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] fanotify: for FAN_MARK_FLUSH check flags
@ 2014-04-23 21:55 Heinrich Schuchardt
  2014-04-24  5:09 ` Michael Kerrisk (man-pages)
  2014-04-24 10:03 ` Jan Kara
  0 siblings, 2 replies; 4+ messages in thread
From: Heinrich Schuchardt @ 2014-04-23 21:55 UTC (permalink / raw)
  To: Eric Paris; +Cc: linux-kernel, Jan Kara, Michael Kerrisk, Heinrich Schuchardt

If fanotify_mark is called with illegal value of arguments flags and marks
it usually returns EINVAL.

When fanotify_mark is called with FAN_MARK_FLUSH the argument flags is not
checked for irrelevant flags like FAN_MARK_IGNORED_MASK.

The patch removes this inconsistency.

If an irrelevant flag is set error EINVAL is returned.

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

diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 287a22c..8bba549 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -819,7 +819,10 @@ SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
 	case FAN_MARK_REMOVE:
 		if (!mask)
 			return -EINVAL;
+		break;
 	case FAN_MARK_FLUSH:
+		if (flags & ~(FAN_MARK_MOUNT | FAN_MARK_FLUSH))
+			return -EINVAL;
 		break;
 	default:
 		return -EINVAL;
-- 
1.9.2


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

* Re: [PATCH 1/1] fanotify: for FAN_MARK_FLUSH check flags
  2014-04-23 21:55 [PATCH 1/1] fanotify: for FAN_MARK_FLUSH check flags Heinrich Schuchardt
@ 2014-04-24  5:09 ` Michael Kerrisk (man-pages)
  2014-04-24 10:03 ` Jan Kara
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Kerrisk (man-pages) @ 2014-04-24  5:09 UTC (permalink / raw)
  To: Heinrich Schuchardt, Eric Paris; +Cc: mtk.manpages, linux-kernel, Jan Kara

On 04/23/2014 11:55 PM, Heinrich Schuchardt wrote:
> If fanotify_mark is called with illegal value of arguments flags and marks
> it usually returns EINVAL.
> 
> When fanotify_mark is called with FAN_MARK_FLUSH the argument flags is not
> checked for irrelevant flags like FAN_MARK_IGNORED_MASK.
> 
> The patch removes this inconsistency.
> 
> If an irrelevant flag is set error EINVAL is returned.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>


So, a small heads up that this change may of course break existing code. 
(Heinrich, see https://lwn.net/Articles/588444/ ). However, 
there is some precedent for such changes (examples in 
https://lwn.net/Articles/588444/), and

* The number of applications out there using fanotify is probably very low
* The number that are using FAN_MARK_FLUSH and misusing the flags will be even lower

So the risk of breakage is likely vanishingly small. So, a qualified

Acked-by: Michael Kerrisk <mtk.manpages@gmail.com>

Cheers,

Michael

> ---
>  fs/notify/fanotify/fanotify_user.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
> index 287a22c..8bba549 100644
> --- a/fs/notify/fanotify/fanotify_user.c
> +++ b/fs/notify/fanotify/fanotify_user.c
> @@ -819,7 +819,10 @@ SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
>  	case FAN_MARK_REMOVE:
>  		if (!mask)
>  			return -EINVAL;
> +		break;
>  	case FAN_MARK_FLUSH:
> +		if (flags & ~(FAN_MARK_MOUNT | FAN_MARK_FLUSH))
> +			return -EINVAL;
>  		break;
>  	default:
>  		return -EINVAL;
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

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

* Re: [PATCH 1/1] fanotify: for FAN_MARK_FLUSH check flags
  2014-04-23 21:55 [PATCH 1/1] fanotify: for FAN_MARK_FLUSH check flags Heinrich Schuchardt
  2014-04-24  5:09 ` Michael Kerrisk (man-pages)
@ 2014-04-24 10:03 ` Jan Kara
  2014-05-01 15:53   ` Fwd: " Heinrich Schuchardt
  1 sibling, 1 reply; 4+ messages in thread
From: Jan Kara @ 2014-04-24 10:03 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: Eric Paris, linux-kernel, Jan Kara, Michael Kerrisk

On Wed 23-04-14 23:55:51, Heinrich Schuchardt wrote:
> If fanotify_mark is called with illegal value of arguments flags and marks
> it usually returns EINVAL.
> 
> When fanotify_mark is called with FAN_MARK_FLUSH the argument flags is not
> checked for irrelevant flags like FAN_MARK_IGNORED_MASK.
> 
> The patch removes this inconsistency.
> 
> If an irrelevant flag is set error EINVAL is returned.
  OK, as Michael I think this shouldn't cause real userspace breakage and
it's better to have the flags checked. So feel free to add:
Acked-by: Jan Kara <jack@suse.cz>

							Honza

> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  fs/notify/fanotify/fanotify_user.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
> index 287a22c..8bba549 100644
> --- a/fs/notify/fanotify/fanotify_user.c
> +++ b/fs/notify/fanotify/fanotify_user.c
> @@ -819,7 +819,10 @@ SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
>  	case FAN_MARK_REMOVE:
>  		if (!mask)
>  			return -EINVAL;
> +		break;
>  	case FAN_MARK_FLUSH:
> +		if (flags & ~(FAN_MARK_MOUNT | FAN_MARK_FLUSH))
> +			return -EINVAL;
>  		break;
>  	default:
>  		return -EINVAL;
> -- 
> 1.9.2
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

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

* Fwd: Re: [PATCH 1/1] fanotify: for FAN_MARK_FLUSH check flags
  2014-04-24 10:03 ` Jan Kara
@ 2014-05-01 15:53   ` Heinrich Schuchardt
  0 siblings, 0 replies; 4+ messages in thread
From: Heinrich Schuchardt @ 2014-05-01 15:53 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Jan Kara, Eric Paris, linux-kernel, Michael Kerrisk

Hello Andrew,

the patch below was
Acked-by: Michael Kerrisk <mtk.manpages@gmail.com>
https://lkml.org/lkml/2014/4/24/23
Acked-by: Jan Kara <jack@suse.cz>
https://lkml.org/lkml/2014/4/24/1048

Please, consider it for inclusion in the mm tree.

Best regards

Heinrich Schuchardt


On 24.04.2014 12:03, Jan Kara wrote:
> On Wed 23-04-14 23:55:51, Heinrich Schuchardt wrote:
>> If fanotify_mark is called with illegal value of arguments flags and marks
>> it usually returns EINVAL.
>>
>> When fanotify_mark is called with FAN_MARK_FLUSH the argument flags is not
>> checked for irrelevant flags like FAN_MARK_IGNORED_MASK.
>>
>> The patch removes this inconsistency.
>>
>> If an irrelevant flag is set error EINVAL is returned.
>    OK, as Michael I think this shouldn't cause real userspace breakage and
> it's better to have the flags checked. So feel free to add:
> Acked-by: Jan Kara <jack@suse.cz>
>
> 							Honza
>
>>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
>> ---
>>   fs/notify/fanotify/fanotify_user.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
>> index 287a22c..8bba549 100644
>> --- a/fs/notify/fanotify/fanotify_user.c
>> +++ b/fs/notify/fanotify/fanotify_user.c
>> @@ -819,7 +819,10 @@ SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
>>   	case FAN_MARK_REMOVE:
>>   		if (!mask)
>>   			return -EINVAL;
>> +		break;
>>   	case FAN_MARK_FLUSH:
>> +		if (flags & ~(FAN_MARK_MOUNT | FAN_MARK_FLUSH))
>> +			return -EINVAL;
>>   		break;
>>   	default:
>>   		return -EINVAL;
>> --
>> 1.9.2
>>


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

end of thread, other threads:[~2014-05-01 15:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-23 21:55 [PATCH 1/1] fanotify: for FAN_MARK_FLUSH check flags Heinrich Schuchardt
2014-04-24  5:09 ` Michael Kerrisk (man-pages)
2014-04-24 10:03 ` Jan Kara
2014-05-01 15:53   ` Fwd: " Heinrich Schuchardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).