[LTP] [PATCH 1/4] fanotify14: Test invalid init flags with permission and pre-content events
Jan Kara
jack@suse.cz
Mon Feb 10 16:19:47 CET 2025
On Mon 10-02-25 16:13:13, Amir Goldstein wrote:
> Those events require an high priority fanotify group.
>
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> include/lapi/fanotify.h | 5 +++++
> .../kernel/syscalls/fanotify/fanotify14.c | 20 +++++++++++++++++++
> 2 files changed, 25 insertions(+)
>
> diff --git a/include/lapi/fanotify.h b/include/lapi/fanotify.h
> index 40ea7ead7..e5b930f4e 100644
> --- a/include/lapi/fanotify.h
> +++ b/include/lapi/fanotify.h
> @@ -109,6 +109,9 @@
> #ifndef FAN_FS_ERROR
> #define FAN_FS_ERROR 0x00008000
> #endif
> +#ifndef FAN_PRE_ACCESS
> +#define FAN_PRE_ACCESS 0x00100000
> +#endif
> #ifndef FAN_RENAME
> #define FAN_RENAME 0x10000000
> #endif
> @@ -134,6 +137,8 @@
> #define LTP_ALL_PERM_EVENTS (FAN_OPEN_PERM | FAN_OPEN_EXEC_PERM | \
> FAN_ACCESS_PERM)
>
> +#define LTP_PRE_CONTENT_EVENTS (FAN_PRE_ACCESS)
> +
> struct fanotify_group_type {
> unsigned int flag;
> const char *name;
> diff --git a/testcases/kernel/syscalls/fanotify/fanotify14.c b/testcases/kernel/syscalls/fanotify/fanotify14.c
> index ee583a095..b17bffd18 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify14.c
> +++ b/testcases/kernel/syscalls/fanotify/fanotify14.c
> @@ -239,6 +239,26 @@ static struct test_case_t {
> .pfd = pipes,
> .expected_errno = EINVAL,
> },
> + /* permission events in mask with priority < FAN_CLASS_CONTENT are not valid */
> + {
> + .init = FLAGS_DESC(FAN_CLASS_NOTIF),
> + .mark = FLAGS_DESC(FAN_MARK_INODE),
> + .mask = FLAGS_DESC(LTP_ALL_PERM_EVENTS),
> + .expected_errno = EINVAL,
> + },
> + /* pre-content events in mask with priority < FAN_CLASS_PRE_CONTENT are not valid */
> + {
> + .init = FLAGS_DESC(FAN_CLASS_NOTIF),
> + .mark = FLAGS_DESC(FAN_MARK_INODE),
> + .mask = FLAGS_DESC(LTP_PRE_CONTENT_EVENTS),
> + .expected_errno = EINVAL,
> + },
> + {
> + .init = FLAGS_DESC(FAN_CLASS_CONTENT),
> + .mark = FLAGS_DESC(FAN_MARK_INODE),
> + .mask = FLAGS_DESC(LTP_PRE_CONTENT_EVENTS),
> + .expected_errno = EINVAL,
> + },
> };
>
> static void do_test(unsigned int number)
> --
> 2.34.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
More information about the ltp
mailing list