lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Fri, 15 Oct 2021 11:27:39 +0300 From: Amir Goldstein <amir73il@...il.com> To: Gabriel Krisman Bertazi <krisman@...labora.com> Cc: Jan Kara <jack@...e.com>, "Darrick J. Wong" <djwong@...nel.org>, Theodore Tso <tytso@....edu>, David Howells <dhowells@...hat.com>, Khazhismel Kumykov <khazhy@...gle.com>, linux-fsdevel <linux-fsdevel@...r.kernel.org>, Ext4 <linux-ext4@...r.kernel.org>, Linux API <linux-api@...r.kernel.org>, Matthew Bobrowski <repnop@...gle.com>, kernel@...labora.com Subject: Re: [PATCH v7 25/28] fanotify: Allow users to request FAN_FS_ERROR events On Fri, Oct 15, 2021 at 12:39 AM Gabriel Krisman Bertazi <krisman@...labora.com> wrote: > > Wire up the FAN_FS_ERROR event in the fanotify_mark syscall, allowing > user space to request the monitoring of FAN_FS_ERROR events. > > These events are limited to filesystem marks, so check it is the > case in the syscall handler. > > Signed-off-by: Gabriel Krisman Bertazi <krisman@...labora.com> > --- > fs/notify/fanotify/fanotify.c | 2 +- > fs/notify/fanotify/fanotify_user.c | 5 +++++ > include/linux/fanotify.h | 6 +++++- > 3 files changed, 11 insertions(+), 2 deletions(-) > > diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c > index 47e28f418711..d449a23d603f 100644 > --- a/fs/notify/fanotify/fanotify.c > +++ b/fs/notify/fanotify/fanotify.c > @@ -827,7 +827,7 @@ static int fanotify_handle_event(struct fsnotify_group *group, u32 mask, > BUILD_BUG_ON(FAN_OPEN_EXEC_PERM != FS_OPEN_EXEC_PERM); > BUILD_BUG_ON(FAN_FS_ERROR != FS_ERROR); > > - BUILD_BUG_ON(HWEIGHT32(ALL_FANOTIFY_EVENT_BITS) != 19); > + BUILD_BUG_ON(HWEIGHT32(ALL_FANOTIFY_EVENT_BITS) != 20); > > mask = fanotify_group_event_mask(group, iter_info, mask, data, > data_type, dir); > diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c > index 8f7c2f4ce674..5edfd7e3f356 100644 > --- a/fs/notify/fanotify/fanotify_user.c > +++ b/fs/notify/fanotify/fanotify_user.c > @@ -1585,6 +1585,11 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask, > fsid = &__fsid; > } > > + if (mask & FAN_FS_ERROR && mark_type != FAN_MARK_FILESYSTEM) { > + ret = -EINVAL; > + goto path_put_and_out; > + } > + Please move this up to the section where input args validity is checked (i.e. before or after FANOTIFY_PERM_EVENTS check). It is the correct context for this sort of check and ret is already set to -EINVAL for the entire section. Thanks, Amir.
Powered by blists - more mailing lists