Skip to content
  1. Sep 16, 2016
  2. Sep 15, 2016
    • Joerg Roedel's avatar
      iommu/amd: Don't put completion-wait semaphore on stack · 4bf5beef
      Joerg Roedel authored
      
      
      The semaphore used by the AMD IOMMU to signal command
      completion lived on the stack until now, which was safe as
      the driver busy-waited on the semaphore with IRQs disabled,
      so the stack can't go away under the driver.
      
      But the recently introduced vmap-based stacks break this as
      the physical address of the semaphore can't be determinded
      easily anymore. The driver used the __pa() macro, but that
      only works in the direct-mapping. The result were
      Completion-Wait timeout errors seen by the IOMMU driver,
      breaking system boot.
      
      Since putting the semaphore on the stack is bad design
      anyway, move the semaphore into 'struct amd_iommu'. It is
      protected by the per-iommu lock and now in the direct
      mapping again. This fixes the Completion-Wait timeout errors
      and makes AMD IOMMU systems boot again with vmap-based
      stacks enabled.
      
      Reported-by: default avatarBorislav Petkov <bp@alien8.de>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      4bf5beef
    • Andy Lutomirski's avatar
      x86: Move thread_info into task_struct · 15f4eae7
      Andy Lutomirski authored
      
      
      Now that most of the thread_info users have been cleaned up,
      this is straightforward.
      
      Most of this code was written by Linus.
      
      Originally-from: Linus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jann Horn <jann@thejh.net>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/a50eab40abeaec9cb9a9e3cbdeafd32190206654.1473801993.git.luto@kernel.org
      
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      15f4eae7
    • Andy Lutomirski's avatar
      sched/core: Allow putting thread_info into task_struct · c65eacbe
      Andy Lutomirski authored
      
      
      If an arch opts in by setting CONFIG_THREAD_INFO_IN_TASK_STRUCT,
      then thread_info is defined as a single 'u32 flags' and is the first
      entry of task_struct.  thread_info::task is removed (it serves no
      purpose if thread_info is embedded in task_struct), and
      thread_info::cpu gets its own slot in task_struct.
      
      This is heavily based on a patch written by Linus.
      
      Originally-from: Linus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jann Horn <jann@thejh.net>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/a0898196f0476195ca02713691a5037a14f2aac5.1473801993.git.luto@kernel.org
      
      
      Signed-off-by: default avatarIngo Molnar <mingo@ke...>
      c65eacbe
    • Linus Torvalds's avatar
      um/Stop conflating task_struct::stack with thread_info · d896fa20
      Linus Torvalds authored
      
      
      thread_info may move in the future, so use the accessors.
      
      [ Andy Lutomirski wrote this changelog message and changed
        "task_thread_info(child)->cpu" to "task_cpu(child)". ]
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jann Horn <jann@thejh.net>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/3439705d9838940cc82733a7335fa8c654c37db8.1473801993.git.luto@kernel.org
      
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      d896fa20
    • Linus Torvalds's avatar
      x86/entry: Get rid of pt_regs_to_thread_info() · 97245d00
      Linus Torvalds authored
      
      
      It was a nice optimization while it lasted, but thread_info is moving
      and this optimization will no longer work.
      
      Quoting Linus:
      
          Oh Gods, Andy. That pt_regs_to_thread_info() thing made me want
          to do unspeakable acts on a poor innocent wax figure that looked
          _exactly_ like you.
      
      [ Changelog written by Andy. ]
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jann Horn <jann@thejh.net>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/6376aa81c68798cc81631673f52bd91a3e078944.1473801993.git.luto@kernel.org
      
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      97245d00
    • Andy Lutomirski's avatar
      x86/asm: Move the thread_info::status field to thread_struct · b9d989c7
      Andy Lutomirski authored
      
      
      Because sched.h and thread_info.h are a tangled mess, I turned
      in_compat_syscall() into a macro.  If we had current_thread_struct()
      or similar and we could use it from thread_info.h, then this would
      be a bit cleaner.
      
      Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jann Horn <jann@thejh.net>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/ccc8a1b2f41f9c264a41f771bb4a6539a642ad72.1473801993.git.luto@kernel.org
      
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      b9d989c7
    • Ingo Molnar's avatar
    • Josh Poimboeuf's avatar
      x86/dumpstack: Add recursion checking for all stacks · fcd709ef
      Josh Poimboeuf authored
      
      
      in_exception_stack() has some recursion checking which makes sure the
      stack trace code never traverses a given exception stack more than once.
      This prevents an infinite loop if corruption somehow causes a stack's
      "next stack" pointer to point to itself (directly or indirectly).
      
      The recursion checking can be useful for other stacks in addition to the
      exception stack, so extend it to work for all stacks.
      
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Byungchul Park <byungchul.park@lge.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Nilay Vaish <nilayvaish@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/95de5db4cfe111754845a5cef04e20630d01423f.1473905218.git.jpoimboe@redhat.com
      
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      fcd709ef
    • Josh Poimboeuf's avatar
      x86/dumpstack: Add support for unwinding empty IRQ stacks · 5fe599e0
      Josh Poimboeuf authored
      
      
      When an interrupt happens in entry code while running on a software IRQ
      stack, and the IRQ stack was empty, regs->sp will contain the stack end
      address (e.g., irq_stack_ptr).  If the regs are passed to dump_trace(),
      get_stack_info() will report STACK_TYPE_UNKNOWN, causing dump_trace() to
      return prematurely without trying to go to the next stack.
      
      Update the bounds checking for software interrupt stacks so that the
      ending address is now considered part of the stack.
      
      This means that it's now possible for the 'walk_stack' callbacks --
      print_context_stack() and print_context_stack_bp() -- to be called with
      an empty stack.  But that's fine; they're already prepared to deal with
      that due to their on_stack() checks.
      
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Byungchul Park <byungchul.park@lge.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Nilay Vaish <nilayvaish@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/5a5e5de92dcf11e8dc6b6e8e50ad7639d067830b.1473905218.git.jpoimboe@redhat.com
      
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      5fe599e0
    • Josh Poimboeuf's avatar
      x86/dumpstack: Add get_stack_info() interface · cb76c939
      Josh Poimboeuf authored
      
      
      valid_stack_ptr() is buggy: it assumes that all stacks are of size
      THREAD_SIZE, which is not true for exception stacks.  So the
      walk_stack() callbacks will need to know the location of the beginning
      of the stack as well as the end.
      
      Another issue is that in general the various features of a stack (type,
      size, next stack pointer, description string) are scattered around in
      various places throughout the stack dump code.
      
      Encapsulate all that information in a single place with a new stack_info
      struct and a get_stack_info() interface.
      
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Byungchul Park <byungchul.park@lge.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Nilay Vaish <nilayvaish@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/8164dd0db96b7e6a279fa17ae5e6dc375eecb4a9.1473905218.git.jpoimboe@redhat.com
      
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      cb76c939
    • Josh Poimboeuf's avatar
      x86/dumpstack: Simplify in_exception_stack() · 9c003907
      Josh Poimboeuf authored
      
      
      in_exception_stack() does some bad, bad things just so the unwinder can
      print different values for different areas of the debug exception stack.
      
      There's no need to clarify where exactly on the stack it is.  Just print
      "#DB" and be done with it.
      
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Byungchul Park <byungchul.park@lge.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Nilay Vaish <nilayvaish@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/e91cb410169dd576678dd427c35efb716fd0cee1.1473905218.git.jpoimboe@redhat.com
      
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      9c003907
    • Linus Torvalds's avatar
      Merge tag 'pci-v4.8-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci · 4cea8776
      Linus Torvalds authored
      Pull PCI fixes from Bjorn Helgaas:
       "Here are two changes for v4.8.  The first fixes a "[Firmware Bug]: reg
        0x10: invalid BAR (can't size)" warning on Haswell, and the second
        fixes a problem in some new runtime suspend functionality we merged
        for v4.8.  Summary:
      
        Enumeration:
          Mark Haswell Power Control Unit as having non-compliant BARs (Bjorn Helgaas)
      
        Power management:
          Fix bridge_d3 update on device removal (Lukas Wunner)"
      
      * tag 'pci-v4.8-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
        PCI: Fix bridge_d3 update on device removal
        PCI: Mark Haswell Power Control Unit as having non-compliant BARs
      4cea8776
    • Linus Torvalds's avatar
      Merge branch 'uaccess-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 77e5bdf9
      Linus Torvalds authored
      Pull uaccess fixes from Al Viro:
       "Fixes for broken uaccess primitives - mostly lack of proper zeroing
        in copy_from_user()/get_user()/__get_user(), but for several
        architectures there's more (broken clear_user() on frv and
        strncpy_from_user() on hexagon)"
      
      * 'uaccess-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (28 commits)
        avr32: fix copy_from_user()
        microblaze: fix __get_user()
        microblaze: fix copy_from_user()
        m32r: fix __get_user()
        blackfin: fix copy_from_user()
        sparc32: fix copy_from_user()
        sh: fix copy_from_user()
        sh64: failing __get_user() should zero
        score: fix copy_from_user() and friends
        score: fix __get_user/get_user
        s390: get_user() should zero on failure
        ppc32: fix copy_from_user()
        parisc: fix copy_from_user()
        openrisc: fix copy_from_user()
        nios2: fix __get_user()
        nios2: copy_from_user() should zero the tail of destination
        mn10300: copy_from_user() should zero on access_ok() failure...
        mn10300: failing __get_user() and get_user() should zero
        mips: copy_from_user() must zero the destination on access_ok() failure
        ARC: uaccess: get_user to zero out dest in cause of fault
        ...
      77e5bdf9
  3. Sep 14, 2016