proc: try to remove use of FOLL_FORCE entirely
[sfrench/cifs-2.6.git] / fs / proc / base.c
index c87b6b9a8a76b0a11078a391b0f6e4772cd1941e..45f6bf68fff3ed30df0f85d98c0f644c320a9bf7 100644 (file)
@@ -821,10 +821,7 @@ static ssize_t mem_rw(struct file *file, char __user *buf,
        if (!mmget_not_zero(mm))
                goto free;
 
-       /* Maybe we should limit FOLL_FORCE to actual ptrace users? */
-       flags = FOLL_FORCE;
-       if (write)
-               flags |= FOLL_WRITE;
+       flags = write ? FOLL_WRITE : 0;
 
        while (count > 0) {
                int this_len = min_t(int, count, PAGE_SIZE);
@@ -2834,6 +2831,15 @@ static int proc_pid_personality(struct seq_file *m, struct pid_namespace *ns,
        return err;
 }
 
+#ifdef CONFIG_LIVEPATCH
+static int proc_pid_patch_state(struct seq_file *m, struct pid_namespace *ns,
+                               struct pid *pid, struct task_struct *task)
+{
+       seq_printf(m, "%d\n", task->patch_state);
+       return 0;
+}
+#endif /* CONFIG_LIVEPATCH */
+
 /*
  * Thread groups
  */
@@ -2933,6 +2939,9 @@ static const struct pid_entry tgid_base_stuff[] = {
        REG("timers",     S_IRUGO, proc_timers_operations),
 #endif
        REG("timerslack_ns", S_IRUGO|S_IWUGO, proc_pid_set_timerslack_ns_operations),
+#ifdef CONFIG_LIVEPATCH
+       ONE("patch_state",  S_IRUSR, proc_pid_patch_state),
+#endif
 };
 
 static int proc_tgid_base_readdir(struct file *file, struct dir_context *ctx)
@@ -3315,6 +3324,9 @@ static const struct pid_entry tid_base_stuff[] = {
        REG("projid_map", S_IRUGO|S_IWUSR, proc_projid_map_operations),
        REG("setgroups",  S_IRUGO|S_IWUSR, proc_setgroups_operations),
 #endif
+#ifdef CONFIG_LIVEPATCH
+       ONE("patch_state",  S_IRUSR, proc_pid_patch_state),
+#endif
 };
 
 static int proc_tid_base_readdir(struct file *file, struct dir_context *ctx)