1 #include <linux/fanotify.h>
2 #include <linux/fcntl.h>
3 #include <linux/file.h>
5 #include <linux/anon_inodes.h>
6 #include <linux/fsnotify_backend.h>
7 #include <linux/init.h>
8 #include <linux/mount.h>
9 #include <linux/namei.h>
10 #include <linux/poll.h>
11 #include <linux/security.h>
12 #include <linux/syscalls.h>
13 #include <linux/slab.h>
14 #include <linux/types.h>
15 #include <linux/uaccess.h>
17 #include <asm/ioctls.h>
19 #include "../../mount.h"
21 #define FANOTIFY_DEFAULT_MAX_EVENTS 16384
22 #define FANOTIFY_DEFAULT_MAX_MARKS 8192
23 #define FANOTIFY_DEFAULT_MAX_LISTENERS 128
25 extern const struct fsnotify_ops fanotify_fsnotify_ops
;
27 static struct kmem_cache
*fanotify_mark_cache __read_mostly
;
28 static struct kmem_cache
*fanotify_response_event_cache __read_mostly
;
30 struct fanotify_response_event
{
31 struct list_head list
;
33 struct fsnotify_event
*event
;
37 * Get an fsnotify notification event if one exists and is small
38 * enough to fit in "count". Return an error pointer if the count
39 * is not large enough.
41 * Called with the group->notification_mutex held.
43 static struct fsnotify_event
*get_one_event(struct fsnotify_group
*group
,
46 BUG_ON(!mutex_is_locked(&group
->notification_mutex
));
48 pr_debug("%s: group=%p count=%zd\n", __func__
, group
, count
);
50 if (fsnotify_notify_queue_is_empty(group
))
53 if (FAN_EVENT_METADATA_LEN
> count
)
54 return ERR_PTR(-EINVAL
);
56 /* held the notification_mutex the whole time, so this is the
57 * same event we peeked above */
58 return fsnotify_remove_notify_event(group
);
61 static int create_fd(struct fsnotify_group
*group
, struct fsnotify_event
*event
)
64 struct dentry
*dentry
;
66 struct file
*new_file
;
68 pr_debug("%s: group=%p event=%p\n", __func__
, group
, event
);
70 client_fd
= get_unused_fd();
74 if (event
->data_type
!= FSNOTIFY_EVENT_PATH
) {
76 put_unused_fd(client_fd
);
81 * we need a new file handle for the userspace program so it can read even if it was
82 * originally opened O_WRONLY.
84 dentry
= dget(event
->path
.dentry
);
85 mnt
= mntget(event
->path
.mnt
);
86 /* it's possible this event was an overflow event. in that case dentry and mnt
87 * are NULL; That's fine, just don't call dentry open */
89 new_file
= dentry_open(dentry
, mnt
,
90 group
->fanotify_data
.f_flags
| FMODE_NONOTIFY
,
93 new_file
= ERR_PTR(-EOVERFLOW
);
94 if (IS_ERR(new_file
)) {
96 * we still send an event even if we can't open the file. this
97 * can happen when say tasks are gone and we try to open their
98 * /proc files or we try to open a WRONLY file like in sysfs
99 * we just send the errno to userspace since there isn't much
102 put_unused_fd(client_fd
);
103 client_fd
= PTR_ERR(new_file
);
105 fd_install(client_fd
, new_file
);
111 static int fill_event_metadata(struct fsnotify_group
*group
,
112 struct fanotify_event_metadata
*metadata
,
113 struct fsnotify_event
*event
)
117 pr_debug("%s: group=%p metadata=%p event=%p\n", __func__
,
118 group
, metadata
, event
);
120 metadata
->event_len
= FAN_EVENT_METADATA_LEN
;
121 metadata
->metadata_len
= FAN_EVENT_METADATA_LEN
;
122 metadata
->vers
= FANOTIFY_METADATA_VERSION
;
123 metadata
->mask
= event
->mask
& FAN_ALL_OUTGOING_EVENTS
;
124 metadata
->pid
= pid_vnr(event
->tgid
);
125 if (unlikely(event
->mask
& FAN_Q_OVERFLOW
))
126 metadata
->fd
= FAN_NOFD
;
128 metadata
->fd
= create_fd(group
, event
);
129 if (metadata
->fd
< 0)
136 #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
137 static struct fanotify_response_event
*dequeue_re(struct fsnotify_group
*group
,
140 struct fanotify_response_event
*re
, *return_re
= NULL
;
142 mutex_lock(&group
->fanotify_data
.access_mutex
);
143 list_for_each_entry(re
, &group
->fanotify_data
.access_list
, list
) {
147 list_del_init(&re
->list
);
151 mutex_unlock(&group
->fanotify_data
.access_mutex
);
153 pr_debug("%s: found return_re=%p\n", __func__
, return_re
);
158 static int process_access_response(struct fsnotify_group
*group
,
159 struct fanotify_response
*response_struct
)
161 struct fanotify_response_event
*re
;
162 __s32 fd
= response_struct
->fd
;
163 __u32 response
= response_struct
->response
;
165 pr_debug("%s: group=%p fd=%d response=%d\n", __func__
, group
,
168 * make sure the response is valid, if invalid we do nothing and either
169 * userspace can send a valid response or we will clean it up after the
183 re
= dequeue_re(group
, fd
);
187 re
->event
->response
= response
;
189 wake_up(&group
->fanotify_data
.access_waitq
);
191 kmem_cache_free(fanotify_response_event_cache
, re
);
196 static int prepare_for_access_response(struct fsnotify_group
*group
,
197 struct fsnotify_event
*event
,
200 struct fanotify_response_event
*re
;
202 if (!(event
->mask
& FAN_ALL_PERM_EVENTS
))
205 re
= kmem_cache_alloc(fanotify_response_event_cache
, GFP_KERNEL
);
212 mutex_lock(&group
->fanotify_data
.access_mutex
);
214 if (atomic_read(&group
->fanotify_data
.bypass_perm
)) {
215 mutex_unlock(&group
->fanotify_data
.access_mutex
);
216 kmem_cache_free(fanotify_response_event_cache
, re
);
217 event
->response
= FAN_ALLOW
;
221 list_add_tail(&re
->list
, &group
->fanotify_data
.access_list
);
222 mutex_unlock(&group
->fanotify_data
.access_mutex
);
227 static void remove_access_response(struct fsnotify_group
*group
,
228 struct fsnotify_event
*event
,
231 struct fanotify_response_event
*re
;
233 if (!(event
->mask
& FAN_ALL_PERM_EVENTS
))
236 re
= dequeue_re(group
, fd
);
240 BUG_ON(re
->event
!= event
);
242 kmem_cache_free(fanotify_response_event_cache
, re
);
247 static int prepare_for_access_response(struct fsnotify_group
*group
,
248 struct fsnotify_event
*event
,
254 static void remove_access_response(struct fsnotify_group
*group
,
255 struct fsnotify_event
*event
,
262 static ssize_t
copy_event_to_user(struct fsnotify_group
*group
,
263 struct fsnotify_event
*event
,
266 struct fanotify_event_metadata fanotify_event_metadata
;
269 pr_debug("%s: group=%p event=%p\n", __func__
, group
, event
);
271 ret
= fill_event_metadata(group
, &fanotify_event_metadata
, event
);
275 fd
= fanotify_event_metadata
.fd
;
276 ret
= prepare_for_access_response(group
, event
, fd
);
281 if (copy_to_user(buf
, &fanotify_event_metadata
,
282 fanotify_event_metadata
.event_len
))
283 goto out_kill_access_response
;
285 return fanotify_event_metadata
.event_len
;
287 out_kill_access_response
:
288 remove_access_response(group
, event
, fd
);
293 #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
294 if (event
->mask
& FAN_ALL_PERM_EVENTS
) {
295 event
->response
= FAN_DENY
;
296 wake_up(&group
->fanotify_data
.access_waitq
);
302 /* intofiy userspace file descriptor functions */
303 static unsigned int fanotify_poll(struct file
*file
, poll_table
*wait
)
305 struct fsnotify_group
*group
= file
->private_data
;
308 poll_wait(file
, &group
->notification_waitq
, wait
);
309 mutex_lock(&group
->notification_mutex
);
310 if (!fsnotify_notify_queue_is_empty(group
))
311 ret
= POLLIN
| POLLRDNORM
;
312 mutex_unlock(&group
->notification_mutex
);
317 static ssize_t
fanotify_read(struct file
*file
, char __user
*buf
,
318 size_t count
, loff_t
*pos
)
320 struct fsnotify_group
*group
;
321 struct fsnotify_event
*kevent
;
327 group
= file
->private_data
;
329 pr_debug("%s: group=%p\n", __func__
, group
);
332 prepare_to_wait(&group
->notification_waitq
, &wait
, TASK_INTERRUPTIBLE
);
334 mutex_lock(&group
->notification_mutex
);
335 kevent
= get_one_event(group
, count
);
336 mutex_unlock(&group
->notification_mutex
);
339 ret
= PTR_ERR(kevent
);
342 ret
= copy_event_to_user(group
, kevent
, buf
);
343 fsnotify_put_event(kevent
);
352 if (file
->f_flags
& O_NONBLOCK
)
355 if (signal_pending(current
))
364 finish_wait(&group
->notification_waitq
, &wait
);
365 if (start
!= buf
&& ret
!= -EFAULT
)
370 static ssize_t
fanotify_write(struct file
*file
, const char __user
*buf
, size_t count
, loff_t
*pos
)
372 #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
373 struct fanotify_response response
= { .fd
= -1, .response
= -1 };
374 struct fsnotify_group
*group
;
377 group
= file
->private_data
;
379 if (count
> sizeof(response
))
380 count
= sizeof(response
);
382 pr_debug("%s: group=%p count=%zu\n", __func__
, group
, count
);
384 if (copy_from_user(&response
, buf
, count
))
387 ret
= process_access_response(group
, &response
);
397 static int fanotify_release(struct inode
*ignored
, struct file
*file
)
399 struct fsnotify_group
*group
= file
->private_data
;
401 #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
402 struct fanotify_response_event
*re
, *lre
;
404 mutex_lock(&group
->fanotify_data
.access_mutex
);
406 atomic_inc(&group
->fanotify_data
.bypass_perm
);
408 list_for_each_entry_safe(re
, lre
, &group
->fanotify_data
.access_list
, list
) {
409 pr_debug("%s: found group=%p re=%p event=%p\n", __func__
, group
,
412 list_del_init(&re
->list
);
413 re
->event
->response
= FAN_ALLOW
;
415 kmem_cache_free(fanotify_response_event_cache
, re
);
417 mutex_unlock(&group
->fanotify_data
.access_mutex
);
419 wake_up(&group
->fanotify_data
.access_waitq
);
421 /* matches the fanotify_init->fsnotify_alloc_group */
422 fsnotify_put_group(group
);
427 static long fanotify_ioctl(struct file
*file
, unsigned int cmd
, unsigned long arg
)
429 struct fsnotify_group
*group
;
430 struct fsnotify_event_holder
*holder
;
435 group
= file
->private_data
;
437 p
= (void __user
*) arg
;
441 mutex_lock(&group
->notification_mutex
);
442 list_for_each_entry(holder
, &group
->notification_list
, event_list
)
443 send_len
+= FAN_EVENT_METADATA_LEN
;
444 mutex_unlock(&group
->notification_mutex
);
445 ret
= put_user(send_len
, (int __user
*) p
);
452 static const struct file_operations fanotify_fops
= {
453 .poll
= fanotify_poll
,
454 .read
= fanotify_read
,
455 .write
= fanotify_write
,
457 .release
= fanotify_release
,
458 .unlocked_ioctl
= fanotify_ioctl
,
459 .compat_ioctl
= fanotify_ioctl
,
460 .llseek
= noop_llseek
,
463 static void fanotify_free_mark(struct fsnotify_mark
*fsn_mark
)
465 kmem_cache_free(fanotify_mark_cache
, fsn_mark
);
468 static int fanotify_find_path(int dfd
, const char __user
*filename
,
469 struct path
*path
, unsigned int flags
)
473 pr_debug("%s: dfd=%d filename=%p flags=%x\n", __func__
,
474 dfd
, filename
, flags
);
476 if (filename
== NULL
) {
481 file
= fget_light(dfd
, &fput_needed
);
486 if ((flags
& FAN_MARK_ONLYDIR
) &&
487 !(S_ISDIR(file
->f_path
.dentry
->d_inode
->i_mode
))) {
488 fput_light(file
, fput_needed
);
492 *path
= file
->f_path
;
494 fput_light(file
, fput_needed
);
496 unsigned int lookup_flags
= 0;
498 if (!(flags
& FAN_MARK_DONT_FOLLOW
))
499 lookup_flags
|= LOOKUP_FOLLOW
;
500 if (flags
& FAN_MARK_ONLYDIR
)
501 lookup_flags
|= LOOKUP_DIRECTORY
;
503 ret
= user_path_at(dfd
, filename
, lookup_flags
, path
);
508 /* you can only watch an inode if you have read permissions on it */
509 ret
= inode_permission(path
->dentry
->d_inode
, MAY_READ
);
516 static __u32
fanotify_mark_remove_from_mask(struct fsnotify_mark
*fsn_mark
,
522 spin_lock(&fsn_mark
->lock
);
523 if (!(flags
& FAN_MARK_IGNORED_MASK
)) {
524 oldmask
= fsn_mark
->mask
;
525 fsnotify_set_mark_mask_locked(fsn_mark
, (oldmask
& ~mask
));
527 oldmask
= fsn_mark
->ignored_mask
;
528 fsnotify_set_mark_ignored_mask_locked(fsn_mark
, (oldmask
& ~mask
));
530 spin_unlock(&fsn_mark
->lock
);
532 if (!(oldmask
& ~mask
))
533 fsnotify_destroy_mark(fsn_mark
);
535 return mask
& oldmask
;
538 static int fanotify_remove_vfsmount_mark(struct fsnotify_group
*group
,
539 struct vfsmount
*mnt
, __u32 mask
,
542 struct fsnotify_mark
*fsn_mark
= NULL
;
545 fsn_mark
= fsnotify_find_vfsmount_mark(group
, mnt
);
549 removed
= fanotify_mark_remove_from_mask(fsn_mark
, mask
, flags
);
550 fsnotify_put_mark(fsn_mark
);
551 if (removed
& real_mount(mnt
)->mnt_fsnotify_mask
)
552 fsnotify_recalc_vfsmount_mask(mnt
);
557 static int fanotify_remove_inode_mark(struct fsnotify_group
*group
,
558 struct inode
*inode
, __u32 mask
,
561 struct fsnotify_mark
*fsn_mark
= NULL
;
564 fsn_mark
= fsnotify_find_inode_mark(group
, inode
);
568 removed
= fanotify_mark_remove_from_mask(fsn_mark
, mask
, flags
);
569 /* matches the fsnotify_find_inode_mark() */
570 fsnotify_put_mark(fsn_mark
);
571 if (removed
& inode
->i_fsnotify_mask
)
572 fsnotify_recalc_inode_mask(inode
);
577 static __u32
fanotify_mark_add_to_mask(struct fsnotify_mark
*fsn_mark
,
583 spin_lock(&fsn_mark
->lock
);
584 if (!(flags
& FAN_MARK_IGNORED_MASK
)) {
585 oldmask
= fsn_mark
->mask
;
586 fsnotify_set_mark_mask_locked(fsn_mark
, (oldmask
| mask
));
588 __u32 tmask
= fsn_mark
->ignored_mask
| mask
;
589 fsnotify_set_mark_ignored_mask_locked(fsn_mark
, tmask
);
590 if (flags
& FAN_MARK_IGNORED_SURV_MODIFY
)
591 fsn_mark
->flags
|= FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY
;
594 if (!(flags
& FAN_MARK_ONDIR
)) {
595 __u32 tmask
= fsn_mark
->ignored_mask
| FAN_ONDIR
;
596 fsnotify_set_mark_ignored_mask_locked(fsn_mark
, tmask
);
599 spin_unlock(&fsn_mark
->lock
);
601 return mask
& ~oldmask
;
604 static int fanotify_add_vfsmount_mark(struct fsnotify_group
*group
,
605 struct vfsmount
*mnt
, __u32 mask
,
608 struct fsnotify_mark
*fsn_mark
;
612 fsn_mark
= fsnotify_find_vfsmount_mark(group
, mnt
);
614 if (atomic_read(&group
->num_marks
) > group
->fanotify_data
.max_marks
)
617 fsn_mark
= kmem_cache_alloc(fanotify_mark_cache
, GFP_KERNEL
);
621 fsnotify_init_mark(fsn_mark
, fanotify_free_mark
);
622 ret
= fsnotify_add_mark(fsn_mark
, group
, NULL
, mnt
, 0);
626 added
= fanotify_mark_add_to_mask(fsn_mark
, mask
, flags
);
628 if (added
& ~real_mount(mnt
)->mnt_fsnotify_mask
)
629 fsnotify_recalc_vfsmount_mask(mnt
);
631 fsnotify_put_mark(fsn_mark
);
635 static int fanotify_add_inode_mark(struct fsnotify_group
*group
,
636 struct inode
*inode
, __u32 mask
,
639 struct fsnotify_mark
*fsn_mark
;
643 pr_debug("%s: group=%p inode=%p\n", __func__
, group
, inode
);
646 * If some other task has this inode open for write we should not add
647 * an ignored mark, unless that ignored mark is supposed to survive
648 * modification changes anyway.
650 if ((flags
& FAN_MARK_IGNORED_MASK
) &&
651 !(flags
& FAN_MARK_IGNORED_SURV_MODIFY
) &&
652 (atomic_read(&inode
->i_writecount
) > 0))
655 fsn_mark
= fsnotify_find_inode_mark(group
, inode
);
657 if (atomic_read(&group
->num_marks
) > group
->fanotify_data
.max_marks
)
660 fsn_mark
= kmem_cache_alloc(fanotify_mark_cache
, GFP_KERNEL
);
664 fsnotify_init_mark(fsn_mark
, fanotify_free_mark
);
665 ret
= fsnotify_add_mark(fsn_mark
, group
, inode
, NULL
, 0);
669 added
= fanotify_mark_add_to_mask(fsn_mark
, mask
, flags
);
671 if (added
& ~inode
->i_fsnotify_mask
)
672 fsnotify_recalc_inode_mask(inode
);
674 fsnotify_put_mark(fsn_mark
);
678 /* fanotify syscalls */
679 SYSCALL_DEFINE2(fanotify_init
, unsigned int, flags
, unsigned int, event_f_flags
)
681 struct fsnotify_group
*group
;
683 struct user_struct
*user
;
685 pr_debug("%s: flags=%d event_f_flags=%d\n",
686 __func__
, flags
, event_f_flags
);
688 if (!capable(CAP_SYS_ADMIN
))
691 if (flags
& ~FAN_ALL_INIT_FLAGS
)
694 user
= get_current_user();
695 if (atomic_read(&user
->fanotify_listeners
) > FANOTIFY_DEFAULT_MAX_LISTENERS
) {
700 f_flags
= O_RDWR
| FMODE_NONOTIFY
;
701 if (flags
& FAN_CLOEXEC
)
702 f_flags
|= O_CLOEXEC
;
703 if (flags
& FAN_NONBLOCK
)
704 f_flags
|= O_NONBLOCK
;
706 /* fsnotify_alloc_group takes a ref. Dropped in fanotify_release */
707 group
= fsnotify_alloc_group(&fanotify_fsnotify_ops
);
710 return PTR_ERR(group
);
713 group
->fanotify_data
.user
= user
;
714 atomic_inc(&user
->fanotify_listeners
);
716 group
->fanotify_data
.f_flags
= event_f_flags
;
717 #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
718 mutex_init(&group
->fanotify_data
.access_mutex
);
719 init_waitqueue_head(&group
->fanotify_data
.access_waitq
);
720 INIT_LIST_HEAD(&group
->fanotify_data
.access_list
);
721 atomic_set(&group
->fanotify_data
.bypass_perm
, 0);
723 switch (flags
& FAN_ALL_CLASS_BITS
) {
724 case FAN_CLASS_NOTIF
:
725 group
->priority
= FS_PRIO_0
;
727 case FAN_CLASS_CONTENT
:
728 group
->priority
= FS_PRIO_1
;
730 case FAN_CLASS_PRE_CONTENT
:
731 group
->priority
= FS_PRIO_2
;
738 if (flags
& FAN_UNLIMITED_QUEUE
) {
740 if (!capable(CAP_SYS_ADMIN
))
742 group
->max_events
= UINT_MAX
;
744 group
->max_events
= FANOTIFY_DEFAULT_MAX_EVENTS
;
747 if (flags
& FAN_UNLIMITED_MARKS
) {
749 if (!capable(CAP_SYS_ADMIN
))
751 group
->fanotify_data
.max_marks
= UINT_MAX
;
753 group
->fanotify_data
.max_marks
= FANOTIFY_DEFAULT_MAX_MARKS
;
756 fd
= anon_inode_getfd("[fanotify]", &fanotify_fops
, group
, f_flags
);
763 fsnotify_put_group(group
);
767 SYSCALL_DEFINE(fanotify_mark
)(int fanotify_fd
, unsigned int flags
,
769 const char __user
* pathname
)
771 struct inode
*inode
= NULL
;
772 struct vfsmount
*mnt
= NULL
;
773 struct fsnotify_group
*group
;
776 int ret
, fput_needed
;
778 pr_debug("%s: fanotify_fd=%d flags=%x dfd=%d pathname=%p mask=%llx\n",
779 __func__
, fanotify_fd
, flags
, dfd
, pathname
, mask
);
781 /* we only use the lower 32 bits as of right now. */
782 if (mask
& ((__u64
)0xffffffff << 32))
785 if (flags
& ~FAN_ALL_MARK_FLAGS
)
787 switch (flags
& (FAN_MARK_ADD
| FAN_MARK_REMOVE
| FAN_MARK_FLUSH
)) {
788 case FAN_MARK_ADD
: /* fallthrough */
789 case FAN_MARK_REMOVE
:
798 if (mask
& FAN_ONDIR
) {
799 flags
|= FAN_MARK_ONDIR
;
803 #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
804 if (mask
& ~(FAN_ALL_EVENTS
| FAN_ALL_PERM_EVENTS
| FAN_EVENT_ON_CHILD
))
806 if (mask
& ~(FAN_ALL_EVENTS
| FAN_EVENT_ON_CHILD
))
810 filp
= fget_light(fanotify_fd
, &fput_needed
);
814 /* verify that this is indeed an fanotify instance */
816 if (unlikely(filp
->f_op
!= &fanotify_fops
))
818 group
= filp
->private_data
;
821 * group->priority == FS_PRIO_0 == FAN_CLASS_NOTIF. These are not
822 * allowed to set permissions events.
825 if (mask
& FAN_ALL_PERM_EVENTS
&&
826 group
->priority
== FS_PRIO_0
)
829 ret
= fanotify_find_path(dfd
, pathname
, &path
, flags
);
833 /* inode held in place by reference to path; group by fget on fd */
834 if (!(flags
& FAN_MARK_MOUNT
))
835 inode
= path
.dentry
->d_inode
;
839 /* create/update an inode mark */
840 switch (flags
& (FAN_MARK_ADD
| FAN_MARK_REMOVE
| FAN_MARK_FLUSH
)) {
842 if (flags
& FAN_MARK_MOUNT
)
843 ret
= fanotify_add_vfsmount_mark(group
, mnt
, mask
, flags
);
845 ret
= fanotify_add_inode_mark(group
, inode
, mask
, flags
);
847 case FAN_MARK_REMOVE
:
848 if (flags
& FAN_MARK_MOUNT
)
849 ret
= fanotify_remove_vfsmount_mark(group
, mnt
, mask
, flags
);
851 ret
= fanotify_remove_inode_mark(group
, inode
, mask
, flags
);
854 if (flags
& FAN_MARK_MOUNT
)
855 fsnotify_clear_vfsmount_marks_by_group(group
);
857 fsnotify_clear_inode_marks_by_group(group
);
865 fput_light(filp
, fput_needed
);
869 #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
870 asmlinkage
long SyS_fanotify_mark(long fanotify_fd
, long flags
, __u64 mask
,
871 long dfd
, long pathname
)
873 return SYSC_fanotify_mark((int) fanotify_fd
, (unsigned int) flags
,
875 (const char __user
*) pathname
);
877 SYSCALL_ALIAS(sys_fanotify_mark
, SyS_fanotify_mark
);
881 * fanotify_user_setup - Our initialization function. Note that we cannot return
882 * error because we have compiled-in VFS hooks. So an (unlikely) failure here
883 * must result in panic().
885 static int __init
fanotify_user_setup(void)
887 fanotify_mark_cache
= KMEM_CACHE(fsnotify_mark
, SLAB_PANIC
);
888 fanotify_response_event_cache
= KMEM_CACHE(fanotify_response_event
,
893 device_initcall(fanotify_user_setup
);