linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>, Eric Paris <eparis@redhat.com>
Cc: mtk.manpages@gmail.com, linux-kernel@vger.kernel.org,
	Jan Kara <jack@suse.cz>
Subject: Re: [PATCH 1/1] fanotify: for FAN_MARK_FLUSH check flags
Date: Thu, 24 Apr 2014 07:09:34 +0200	[thread overview]
Message-ID: <53589C8E.5000505@gmail.com> (raw)
In-Reply-To: <1398290151-6502-1-git-send-email-xypron.glpk@gmx.de>

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/

  reply	other threads:[~2014-04-24  5:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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) [this message]
2014-04-24 10:03 ` Jan Kara
2014-05-01 15:53   ` Fwd: " Heinrich Schuchardt

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=53589C8E.5000505@gmail.com \
    --to=mtk.manpages@gmail.com \
    --cc=eparis@redhat.com \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xypron.glpk@gmx.de \
    /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;
as well as URLs for NNTP newsgroup(s).