[LTP] [PATCH v2 04/10] syscalls/fanotify20: Validate the generic error info

Amir Goldstein amir73il@gmail.com
Wed Oct 27 12:19:36 CEST 2021


On Wed, Oct 27, 2021 at 9:43 AM Amir Goldstein <amir73il@gmail.com> wrote:
>
> On Tue, Oct 26, 2021 at 9:43 PM Gabriel Krisman Bertazi
> <krisman@collabora.com> wrote:
> >
> > Implement some validation for the generic error info record emitted by
> > the kernel.  The error number is fs-specific but, well, we only support
> > ext4 for now anyway.
> >
> > Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
> >
>
> After fixing and testing configure.ac you may add:
>
> Reviewed-by: Amir Goldstein <amir73il@gmail.com>
>
> > ---
> > Changes since v1:
> >   - Move defines to header file.
> > ---
> >  testcases/kernel/syscalls/fanotify/fanotify.h | 32 +++++++++++++++++
> >  .../kernel/syscalls/fanotify/fanotify20.c     | 35 ++++++++++++++++++-
> >  2 files changed, 66 insertions(+), 1 deletion(-)
> >
> > diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h
> > index 8828b53532a2..58e30aaf00bc 100644
> > --- a/testcases/kernel/syscalls/fanotify/fanotify.h
> > +++ b/testcases/kernel/syscalls/fanotify/fanotify.h
> > @@ -167,6 +167,9 @@ typedef struct {
> >  #ifndef FAN_EVENT_INFO_TYPE_DFID
> >  #define FAN_EVENT_INFO_TYPE_DFID       3
> >  #endif
> > +#ifndef FAN_EVENT_INFO_TYPE_ERROR
> > +#define FAN_EVENT_INFO_TYPE_ERROR      5
> > +#endif
> >
> >  #ifndef HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER
> >  struct fanotify_event_info_header {
> > @@ -184,6 +187,14 @@ struct fanotify_event_info_fid {
> >  };
> >  #endif /* HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID */
> >
> > +#ifndef HAVE_STRUCT_FANOTIFY_EVENT_INFO_ERROR
> > +struct fanotify_event_info_error {
> > +       struct fanotify_event_info_header hdr;
> > +       __s32 error;
> > +       __u32 error_count;
> > +};
> > +#endif /* HAVE_STRUCT_FANOTIFY_EVENT_INFO_ERROR */
>
> Need to add in configure.ac:
>
> AC_CHECK_TYPES([struct fanotify_event_info_error, struct
> fanotify_event_info_header],,,[#include <sys/fanotify.h>])
>
> (not tested)

According to Matthew's pidfd patches the syntax should be:

AC_CHECK_TYPES([struct fanotify_event_info_fid, struct
fanotify_event_info_header, struct fanotify_event_info_pidfd, struct
fanotify_event_info_error],,,[#include <sys/fanotify.h>])

Thanks,
Amir.


More information about the ltp mailing list