Merge branch 'mm-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 22 Oct 2016 16:39:10 +0000 (09:39 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 22 Oct 2016 16:39:10 +0000 (09:39 -0700)
Pull vmap stack fixes from Ingo Molnar:
 "This is fallout from CONFIG_HAVE_ARCH_VMAP_STACK=y on x86: stack
  accesses that used to be just somewhat questionable are now totally
  buggy.

  These changes try to do it without breaking the ABI: the fields are
  left there, they are just reporting zero, or reporting narrower
  information (the maps file change)"

* 'mm-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  mm: Change vm_is_stack_for_task() to vm_is_stack_for_current()
  fs/proc: Stop trying to report thread stacks
  fs/proc: Stop reporting eip and esp in /proc/PID/stat
  mm/numa: Remove duplicated include from mprotect.c

1  2 
include/linux/mm.h
mm/util.c

diff --combined include/linux/mm.h
@@@ -1266,10 -1266,9 +1266,10 @@@ static inline int fixup_user_fault(stru
  }
  #endif
  
 -extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
 +extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len,
 +              unsigned int gup_flags);
  extern int access_remote_vm(struct mm_struct *mm, unsigned long addr,
 -              void *buf, int len, int write);
 +              void *buf, int len, unsigned int gup_flags);
  
  long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
                      unsigned long start, unsigned long nr_pages,
                      struct vm_area_struct **vmas, int *nonblocking);
  long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
                            unsigned long start, unsigned long nr_pages,
 -                          int write, int force, struct page **pages,
 +                          unsigned int gup_flags, struct page **pages,
                            struct vm_area_struct **vmas);
  long get_user_pages(unsigned long start, unsigned long nr_pages,
 -                          int write, int force, struct page **pages,
 +                          unsigned int gup_flags, struct page **pages,
                            struct vm_area_struct **vmas);
  long get_user_pages_locked(unsigned long start, unsigned long nr_pages,
 -                  int write, int force, struct page **pages, int *locked);
 +                  unsigned int gup_flags, struct page **pages, int *locked);
  long __get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm,
                               unsigned long start, unsigned long nr_pages,
 -                             int write, int force, struct page **pages,
 -                             unsigned int gup_flags);
 +                             struct page **pages, unsigned int gup_flags);
  long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages,
 -                  int write, int force, struct page **pages);
 +                  struct page **pages, unsigned int gup_flags);
  int get_user_pages_fast(unsigned long start, int nr_pages, int write,
                        struct page **pages);
  
@@@ -1306,7 -1306,7 +1306,7 @@@ struct frame_vector 
  struct frame_vector *frame_vector_create(unsigned int nr_frames);
  void frame_vector_destroy(struct frame_vector *vec);
  int get_vaddr_frames(unsigned long start, unsigned int nr_pfns,
 -                   bool write, bool force, struct frame_vector *vec);
 +                   unsigned int gup_flags, struct frame_vector *vec);
  void put_vaddr_frames(struct frame_vector *vec);
  int frame_vector_to_pages(struct frame_vector *vec);
  void frame_vector_to_pfns(struct frame_vector *vec);
@@@ -1391,7 -1391,7 +1391,7 @@@ static inline int stack_guard_page_end(
                !vma_growsup(vma->vm_next, addr);
  }
  
- int vma_is_stack_for_task(struct vm_area_struct *vma, struct task_struct *t);
+ int vma_is_stack_for_current(struct vm_area_struct *vma);
  
  extern unsigned long move_page_tables(struct vm_area_struct *vma,
                unsigned long old_addr, struct vm_area_struct *new_vma,
@@@ -2232,7 -2232,6 +2232,7 @@@ static inline struct page *follow_page(
  #define FOLL_TRIED    0x800   /* a retry, previous pass started an IO */
  #define FOLL_MLOCK    0x1000  /* lock present pages */
  #define FOLL_REMOTE   0x2000  /* we are working on non-current tsk/mm */
 +#define FOLL_COW      0x4000  /* internal GUP flag */
  
  typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
                        void *data);
diff --combined mm/util.c
+++ b/mm/util.c
@@@ -230,8 -230,10 +230,10 @@@ void __vma_link_list(struct mm_struct *
  }
  
  /* Check if the vma is being used as a stack by this task */
- int vma_is_stack_for_task(struct vm_area_struct *vma, struct task_struct *t)
+ int vma_is_stack_for_current(struct vm_area_struct *vma)
  {
+       struct task_struct * __maybe_unused t = current;
        return (vma->vm_start <= KSTK_ESP(t) && vma->vm_end >= KSTK_ESP(t));
  }
  
@@@ -283,8 -285,7 +285,8 @@@ EXPORT_SYMBOL_GPL(__get_user_pages_fast
  int __weak get_user_pages_fast(unsigned long start,
                                int nr_pages, int write, struct page **pages)
  {
 -      return get_user_pages_unlocked(start, nr_pages, write, 0, pages);
 +      return get_user_pages_unlocked(start, nr_pages, pages,
 +                                     write ? FOLL_WRITE : 0);
  }
  EXPORT_SYMBOL_GPL(get_user_pages_fast);
  
@@@ -624,7 -625,7 +626,7 @@@ int get_cmdline(struct task_struct *tas
        if (len > buflen)
                len = buflen;
  
 -      res = access_process_vm(task, arg_start, buffer, len, 0);
 +      res = access_process_vm(task, arg_start, buffer, len, FOLL_FORCE);
  
        /*
         * If the nul at the end of args has been overwritten, then
                        if (len > buflen - res)
                                len = buflen - res;
                        res += access_process_vm(task, env_start,
 -                                               buffer+res, len, 0);
 +                                               buffer+res, len,
 +                                               FOLL_FORCE);
                        res = strnlen(buffer, res);
                }
        }