2 * SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags,
3 __u64 mask, int dfd, const char __user * pathname)
9 /* flags used for fanotify_modify_mark() */
10 #define FAN_MARK_ADD 0x00000001
11 #define FAN_MARK_REMOVE 0x00000002
12 #define FAN_MARK_DONT_FOLLOW 0x00000004
13 #define FAN_MARK_ONLYDIR 0x00000008
14 #define FAN_MARK_MOUNT 0x00000010
15 #define FAN_MARK_IGNORED_MASK 0x00000020
16 #define FAN_MARK_IGNORED_SURV_MODIFY 0x00000040
17 #define FAN_MARK_FLUSH 0x00000080
19 #define FAN_ACCESS 0x00000001 /* File was accessed */
20 #define FAN_MODIFY 0x00000002 /* File was modified */
21 #define FAN_CLOSE_WRITE 0x00000008 /* Writtable file closed */
22 #define FAN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */
23 #define FAN_OPEN 0x00000020 /* File was opened */
25 #define FAN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */
27 #define FAN_OPEN_PERM 0x00010000 /* File open in perm check */
28 #define FAN_ACCESS_PERM 0x00020000 /* File accessed in perm check */
30 #define FAN_ONDIR 0x40000000 /* event occurred against dir */
32 #define FAN_EVENT_ON_CHILD 0x08000000 /* interested in child events */
33 #define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE) /* close */
35 static void sanitise_fanotify_mark(int childno
)
37 unsigned int flagvals
[5] = { FAN_MARK_DONT_FOLLOW
, FAN_MARK_ONLYDIR
, FAN_MARK_MOUNT
,
38 FAN_MARK_IGNORED_MASK
, FAN_MARK_IGNORED_SURV_MODIFY
};
41 unsigned int numflags
= rand() % 5;
43 // set additional flags
44 for (i
= 0; i
< numflags
; i
++)
45 shm
->syscall
[childno
].a2
|= flagvals
[i
];
48 shm
->syscall
[childno
].a3
&= 0xffffffff;
51 struct syscallentry syscall_fanotify_mark
= {
52 .name
= "fanotify_mark",
54 .arg1name
= "fanotify_fd",
60 .values
= { FAN_MARK_ADD
, FAN_MARK_REMOVE
, FAN_MARK_FLUSH
},
66 .values
= { FAN_ACCESS
, FAN_MODIFY
, FAN_CLOSE
, FAN_OPEN
,
67 FAN_OPEN_PERM
, FAN_ACCESS_PERM
,
72 .arg5name
= "pathname",
73 .arg5type
= ARG_PATHNAME
,
74 .sanitise
= sanitise_fanotify_mark
,
75 .rettype
= RET_ZERO_SUCCESS
,