Merge branch 'work.uaccess2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 12 Oct 2016 06:38:39 +0000 (23:38 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 12 Oct 2016 06:38:39 +0000 (23:38 -0700)
Pull uaccess.h prepwork from Al Viro:
 "Preparations to tree-wide switch to use of linux/uaccess.h (which,
  obviously, will allow to start unifying stuff for real). The last step
  there, ie

    PATT='^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*<asm/uaccess.h>'
    sed -i -e "s!$PATT!#include <linux/uaccess.h>!" \
            `git grep -l "$PATT"|grep -v ^include/linux/uaccess.h`

  is not taken here - I would prefer to do it once just before or just
  after -rc1.  However, everything should be ready for it"

* 'work.uaccess2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  remove a stray reference to asm/uaccess.h in docs
  sparc64: separate extable_64.h, switch elf_64.h to it
  score: separate extable.h, switch module.h to it
  mips: separate extable.h, switch module.h to it
  x86: separate extable.h, switch sections.h to it
  remove stray include of asm/uaccess.h from cacheflush.h
  mn10300: remove a bogus processor.h->uaccess.h include
  xtensa: split uaccess.h into C and asm sides
  bonding: quit messing with IOCTL
  kill __kernel_ds_p off
  mn10300: finish verify_area() off
  frv: move HAVE_ARCH_UNMAPPED_AREA to pgtable.h
  exceptions: detritus removal

1  2 
arch/x86/mm/fault.c
arch/xtensa/kernel/entry.S
drivers/net/bonding/bond_main.c

diff --combined arch/x86/mm/fault.c
index 4dc13340653eb96d1e550b1a10b4635babba79b4,c0413d5541af7a3a27dcf2f7137c2b8b4013b988..9f72ca3b2669a62f5d512a01367d7af16a5e1ba3
@@@ -5,7 -5,7 +5,7 @@@
   */
  #include <linux/sched.h>              /* test_thread_flag(), ...      */
  #include <linux/kdebug.h>             /* oops_begin/end, ...          */
- #include <linux/extable.h>            /* search_exception_table       */
 -#include <linux/module.h>             /* search_exception_tables      */
++#include <linux/extable.h>            /* search_exception_tables      */
  #include <linux/bootmem.h>            /* max_low_pfn                  */
  #include <linux/kprobes.h>            /* NOKPROBE_SYMBOL, ...         */
  #include <linux/mmiotrace.h>          /* kmmio_handler, ...           */
@@@ -753,38 -753,6 +753,38 @@@ no_context(struct pt_regs *regs, unsign
                return;
        }
  
 +#ifdef CONFIG_VMAP_STACK
 +      /*
 +       * Stack overflow?  During boot, we can fault near the initial
 +       * stack in the direct map, but that's not an overflow -- check
 +       * that we're in vmalloc space to avoid this.
 +       */
 +      if (is_vmalloc_addr((void *)address) &&
 +          (((unsigned long)tsk->stack - 1 - address < PAGE_SIZE) ||
 +           address - ((unsigned long)tsk->stack + THREAD_SIZE) < PAGE_SIZE)) {
 +              register void *__sp asm("rsp");
 +              unsigned long stack = this_cpu_read(orig_ist.ist[DOUBLEFAULT_STACK]) - sizeof(void *);
 +              /*
 +               * We're likely to be running with very little stack space
 +               * left.  It's plausible that we'd hit this condition but
 +               * double-fault even before we get this far, in which case
 +               * we're fine: the double-fault handler will deal with it.
 +               *
 +               * We don't want to make it all the way into the oops code
 +               * and then double-fault, though, because we're likely to
 +               * break the console driver and lose most of the stack dump.
 +               */
 +              asm volatile ("movq %[stack], %%rsp\n\t"
 +                            "call handle_stack_overflow\n\t"
 +                            "1: jmp 1b"
 +                            : "+r" (__sp)
 +                            : "D" ("kernel stack overflow (page fault)"),
 +                              "S" (regs), "d" (address),
 +                              [stack] "rm" (stack));
 +              unreachable();
 +      }
 +#endif
 +
        /*
         * 32-bit:
         *
@@@ -1144,15 -1112,6 +1144,15 @@@ access_error(unsigned long error_code, 
  {
        /* This is only called for the current mm, so: */
        bool foreign = false;
 +
 +      /*
 +       * Read or write was blocked by protection keys.  This is
 +       * always an unconditional error and can never result in
 +       * a follow-up action to resolve the fault, like a COW.
 +       */
 +      if (error_code & PF_PK)
 +              return 1;
 +
        /*
         * Make sure to check the VMA so that we do not perform
         * faults just to hit a PF_PK as soon as we fill in a
index fa04d9d368a7218d488874934aad4429e93a927f,a504384b9339d77d25aee3f6d4e2a5f4d186f856..f5ef3cc0497c39272904dd09f3690dad03f1f565
@@@ -17,7 -17,7 +17,7 @@@
  #include <asm/processor.h>
  #include <asm/coprocessor.h>
  #include <asm/thread_info.h>
- #include <asm/uaccess.h>
+ #include <asm/asm-uaccess.h>
  #include <asm/unistd.h>
  #include <asm/ptrace.h>
  #include <asm/current.h>
@@@ -1632,11 -1632,10 +1632,11 @@@ ENTRY(fast_second_level_miss
         * The messy computation for 'pteval' above really simplifies
         * into the following:
         *
 -       * pteval = ((pmdval - PAGE_OFFSET) & PAGE_MASK) | PAGE_DIRECTORY
 +       * pteval = ((pmdval - PAGE_OFFSET + PHYS_OFFSET) & PAGE_MASK)
 +       *                 | PAGE_DIRECTORY
         */
  
 -      movi    a1, (-PAGE_OFFSET) & 0xffffffff
 +      movi    a1, (PHYS_OFFSET - PAGE_OFFSET) & 0xffffffff
        add     a0, a0, a1              # pmdval - PAGE_OFFSET
        extui   a1, a0, 0, PAGE_SHIFT   # ... & PAGE_MASK
        xor     a0, a0, a1
index 3f31ca32f52b8149195456cc22788080259bd453,3892811079d0f410f4a1ad38fe30f7f4b1af718d..5fa36ebc06409aeed7d1477d9775ffd7460ecc6f
@@@ -471,9 -471,9 +471,9 @@@ static int bond_check_dev_link(struct b
                /* Yes, the mii is overlaid on the ifreq.ifr_ifru */
                strncpy(ifr.ifr_name, slave_dev->name, IFNAMSIZ);
                mii = if_mii(&ifr);
-               if (IOCTL(slave_dev, &ifr, SIOCGMIIPHY) == 0) {
+               if (ioctl(slave_dev, &ifr, SIOCGMIIPHY) == 0) {
                        mii->reg_num = MII_BMSR;
-                       if (IOCTL(slave_dev, &ifr, SIOCGMIIREG) == 0)
+                       if (ioctl(slave_dev, &ifr, SIOCGMIIREG) == 0)
                                return mii->val_out & BMSR_LSTATUS;
                }
        }
@@@ -4628,7 -4628,7 +4628,7 @@@ static int bond_init(struct net_device 
  
        netdev_dbg(bond_dev, "Begin bond_init\n");
  
 -      bond->wq = create_singlethread_workqueue(bond_dev->name);
 +      bond->wq = alloc_ordered_workqueue(bond_dev->name, WQ_MEM_RECLAIM);
        if (!bond->wq)
                return -ENOMEM;