Thread (23 messages) 23 messages, 2 authors, 2021-10-29

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

From: Amir Goldstein <amir73il@gmail.com>
Date: 2021-10-27 10:19:50
Also in: ltp

On Wed, Oct 27, 2021 at 9:43 AM Amir Goldstein [off-list ref] wrote:
On Tue, Oct 26, 2021 at 9:43 PM Gabriel Krisman Bertazi
[off-list ref] wrote:
quoted
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 <redacted>
After fixing and testing configure.ac you may add:

Reviewed-by: Amir Goldstein <amir73il@gmail.com>
quoted
---
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help