summaryrefslogtreecommitdiffstats
path: root/fs/notify
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2018-10-03 17:25:35 -0400
committerJan Kara <jack@suse.cz>2018-10-04 07:28:38 -0400
commit23c9deeb3285d34fd243abb3d6b9f07db60c3cf4 (patch)
tree85b9ab86150fcc5294b2f0d82f6a970571203c07 /fs/notify
parenta72fd224e37bf6a0630bce302deebbccbc236ba2 (diff)
fanotify: deprecate uapi FAN_ALL_* constants
We do not want to add new bits to the FAN_ALL_* uapi constants because they have been exposed to userspace. If there are programs out there using these constants, those programs could break if re-compiled with modified FAN_ALL_* constants and run on an old kernel. We deprecate the uapi constants FAN_ALL_* and define new FANOTIFY_* constants for internal use to replace them. New feature bits will be added only to the new constants. Cc: <linux-api@vger.kernel.org> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify')
-rw-r--r--fs/notify/fanotify/fanotify.c6
-rw-r--r--fs/notify/fanotify/fanotify.h2
-rw-r--r--fs/notify/fanotify/fanotify_user.c22
3 files changed, 15 insertions, 15 deletions
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index 94b52157bf8d..03498eb995be 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -131,8 +131,8 @@ static bool fanotify_should_send_event(struct fsnotify_iter_info *iter_info,
131 !(marks_mask & FS_ISDIR & ~marks_ignored_mask)) 131 !(marks_mask & FS_ISDIR & ~marks_ignored_mask))
132 return false; 132 return false;
133 133
134 if (event_mask & FAN_ALL_OUTGOING_EVENTS & marks_mask & 134 if (event_mask & FANOTIFY_OUTGOING_EVENTS &
135 ~marks_ignored_mask) 135 marks_mask & ~marks_ignored_mask)
136 return true; 136 return true;
137 137
138 return false; 138 return false;
@@ -236,7 +236,7 @@ static int fanotify_handle_event(struct fsnotify_group *group,
236 ret = fsnotify_add_event(group, fsn_event, fanotify_merge); 236 ret = fsnotify_add_event(group, fsn_event, fanotify_merge);
237 if (ret) { 237 if (ret) {
238 /* Permission events shouldn't be merged */ 238 /* Permission events shouldn't be merged */
239 BUG_ON(ret == 1 && mask & FAN_ALL_PERM_EVENTS); 239 BUG_ON(ret == 1 && mask & FANOTIFY_PERM_EVENTS);
240 /* Our event wasn't used in the end. Free it. */ 240 /* Our event wasn't used in the end. Free it. */
241 fsnotify_destroy_event(group, fsn_event); 241 fsnotify_destroy_event(group, fsn_event);
242 242
diff --git a/fs/notify/fanotify/fanotify.h b/fs/notify/fanotify/fanotify.h
index 8609ba06f474..88a8290a61cb 100644
--- a/fs/notify/fanotify/fanotify.h
+++ b/fs/notify/fanotify/fanotify.h
@@ -44,7 +44,7 @@ FANOTIFY_PE(struct fsnotify_event *fse)
44static inline bool fanotify_is_perm_event(u32 mask) 44static inline bool fanotify_is_perm_event(u32 mask)
45{ 45{
46 return IS_ENABLED(CONFIG_FANOTIFY_ACCESS_PERMISSIONS) && 46 return IS_ENABLED(CONFIG_FANOTIFY_ACCESS_PERMISSIONS) &&
47 mask & FAN_ALL_PERM_EVENTS; 47 mask & FANOTIFY_PERM_EVENTS;
48} 48}
49 49
50static inline struct fanotify_event_info *FANOTIFY_E(struct fsnotify_event *fse) 50static inline struct fanotify_event_info *FANOTIFY_E(struct fsnotify_event *fse)
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 34b511407035..530e5e486105 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -131,7 +131,7 @@ static int fill_event_metadata(struct fsnotify_group *group,
131 metadata->metadata_len = FAN_EVENT_METADATA_LEN; 131 metadata->metadata_len = FAN_EVENT_METADATA_LEN;
132 metadata->vers = FANOTIFY_METADATA_VERSION; 132 metadata->vers = FANOTIFY_METADATA_VERSION;
133 metadata->reserved = 0; 133 metadata->reserved = 0;
134 metadata->mask = fsn_event->mask & FAN_ALL_OUTGOING_EVENTS; 134 metadata->mask = fsn_event->mask & FANOTIFY_OUTGOING_EVENTS;
135 metadata->pid = pid_vnr(event->tgid); 135 metadata->pid = pid_vnr(event->tgid);
136 if (unlikely(fsn_event->mask & FAN_Q_OVERFLOW)) 136 if (unlikely(fsn_event->mask & FAN_Q_OVERFLOW))
137 metadata->fd = FAN_NOFD; 137 metadata->fd = FAN_NOFD;
@@ -395,7 +395,7 @@ static int fanotify_release(struct inode *ignored, struct file *file)
395 */ 395 */
396 while (!fsnotify_notify_queue_is_empty(group)) { 396 while (!fsnotify_notify_queue_is_empty(group)) {
397 fsn_event = fsnotify_remove_first_event(group); 397 fsn_event = fsnotify_remove_first_event(group);
398 if (!(fsn_event->mask & FAN_ALL_PERM_EVENTS)) { 398 if (!(fsn_event->mask & FANOTIFY_PERM_EVENTS)) {
399 spin_unlock(&group->notification_lock); 399 spin_unlock(&group->notification_lock);
400 fsnotify_destroy_event(group, fsn_event); 400 fsnotify_destroy_event(group, fsn_event);
401 spin_lock(&group->notification_lock); 401 spin_lock(&group->notification_lock);
@@ -691,9 +691,9 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
691 return -EPERM; 691 return -EPERM;
692 692
693#ifdef CONFIG_AUDITSYSCALL 693#ifdef CONFIG_AUDITSYSCALL
694 if (flags & ~(FAN_ALL_INIT_FLAGS | FAN_ENABLE_AUDIT)) 694 if (flags & ~(FANOTIFY_INIT_FLAGS | FAN_ENABLE_AUDIT))
695#else 695#else
696 if (flags & ~FAN_ALL_INIT_FLAGS) 696 if (flags & ~FANOTIFY_INIT_FLAGS)
697#endif 697#endif
698 return -EINVAL; 698 return -EINVAL;
699 699
@@ -745,7 +745,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
745 group->fanotify_data.f_flags = event_f_flags; 745 group->fanotify_data.f_flags = event_f_flags;
746 init_waitqueue_head(&group->fanotify_data.access_waitq); 746 init_waitqueue_head(&group->fanotify_data.access_waitq);
747 INIT_LIST_HEAD(&group->fanotify_data.access_list); 747 INIT_LIST_HEAD(&group->fanotify_data.access_list);
748 switch (flags & FAN_ALL_CLASS_BITS) { 748 switch (flags & FANOTIFY_CLASS_BITS) {
749 case FAN_CLASS_NOTIF: 749 case FAN_CLASS_NOTIF:
750 group->priority = FS_PRIO_0; 750 group->priority = FS_PRIO_0;
751 break; 751 break;
@@ -803,8 +803,8 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask,
803 struct fsnotify_group *group; 803 struct fsnotify_group *group;
804 struct fd f; 804 struct fd f;
805 struct path path; 805 struct path path;
806 u32 valid_mask = FAN_ALL_EVENTS | FAN_EVENT_ON_CHILD | FAN_ONDIR; 806 u32 valid_mask = FANOTIFY_EVENTS | FAN_EVENT_ON_CHILD | FAN_ONDIR;
807 unsigned int mark_type = flags & FAN_MARK_TYPE_MASK; 807 unsigned int mark_type = flags & FANOTIFY_MARK_TYPE_BITS;
808 int ret; 808 int ret;
809 809
810 pr_debug("%s: fanotify_fd=%d flags=%x dfd=%d pathname=%p mask=%llx\n", 810 pr_debug("%s: fanotify_fd=%d flags=%x dfd=%d pathname=%p mask=%llx\n",
@@ -814,7 +814,7 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask,
814 if (mask & ((__u64)0xffffffff << 32)) 814 if (mask & ((__u64)0xffffffff << 32))
815 return -EINVAL; 815 return -EINVAL;
816 816
817 if (flags & ~FAN_ALL_MARK_FLAGS) 817 if (flags & ~FANOTIFY_MARK_FLAGS)
818 return -EINVAL; 818 return -EINVAL;
819 819
820 switch (mark_type) { 820 switch (mark_type) {
@@ -833,7 +833,7 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask,
833 return -EINVAL; 833 return -EINVAL;
834 break; 834 break;
835 case FAN_MARK_FLUSH: 835 case FAN_MARK_FLUSH:
836 if (flags & ~(FAN_MARK_TYPE_MASK | FAN_MARK_FLUSH)) 836 if (flags & ~(FANOTIFY_MARK_TYPE_BITS | FAN_MARK_FLUSH))
837 return -EINVAL; 837 return -EINVAL;
838 break; 838 break;
839 default: 839 default:
@@ -841,7 +841,7 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask,
841 } 841 }
842 842
843 if (IS_ENABLED(CONFIG_FANOTIFY_ACCESS_PERMISSIONS)) 843 if (IS_ENABLED(CONFIG_FANOTIFY_ACCESS_PERMISSIONS))
844 valid_mask |= FAN_ALL_PERM_EVENTS; 844 valid_mask |= FANOTIFY_PERM_EVENTS;
845 845
846 if (mask & ~valid_mask) 846 if (mask & ~valid_mask)
847 return -EINVAL; 847 return -EINVAL;
@@ -861,7 +861,7 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask,
861 * allowed to set permissions events. 861 * allowed to set permissions events.
862 */ 862 */
863 ret = -EINVAL; 863 ret = -EINVAL;
864 if (mask & FAN_ALL_PERM_EVENTS && 864 if (mask & FANOTIFY_PERM_EVENTS &&
865 group->priority == FS_PRIO_0) 865 group->priority == FS_PRIO_0)
866 goto fput_and_out; 866 goto fput_and_out;
867 867