1. 11 2月, 2016 1 次提交
    • C
      ARM: 8513/1: xip: Move XIP linking to a separate file · 538bf469
      Chris Brandt 提交于
      When building an XIP kernel, the linker script needs to be much different
      than a conventional kernel's script. Over time, it's been difficult to
      maintain both XIP and non-XIP layouts in one linker script. Therefore,
      this patch separates the two procedures into two completely different
      files.
      
      The new linker script is essentially a straight copy of the current script
      with all the non-CONFIG_XIP_KERNEL portions removed.
      
      Additionally, all CONFIG_XIP_KERNEL portions have been removed from the
      existing linker script...never to return again.
      
      It should be noted that this does not fix any current XIP issues, but
      rather is the first move in fixing them properly with subsequent patches.
      Signed-off-by: NChris Brandt <chris.brandt@renesas.com>
      Acked-by: NNicolas Pitre <nico@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      538bf469
  2. 08 2月, 2016 3 次提交
    • K
      ARM: 8501/1: mm: flip priority of CONFIG_DEBUG_RODATA · 25362dc4
      Kees Cook 提交于
      The use of CONFIG_DEBUG_RODATA is generally seen as an essential part of
      kernel self-protection:
      http://www.openwall.com/lists/kernel-hardening/2015/11/30/13
      Additionally, its name has grown to mean things beyond just rodata. To
      get ARM closer to this, we ought to rearrange the names of the configs
      that control how the kernel protects its memory. What was called
      CONFIG_ARM_KERNMEM_PERMS is realy doing the work that other architectures
      call CONFIG_DEBUG_RODATA.
      
      This redefines CONFIG_DEBUG_RODATA to actually do the bulk of the
      ROing (and NXing). In the place of the old CONFIG_DEBUG_RODATA, use
      CONFIG_DEBUG_ALIGN_RODATA, since that's what the option does: adds
      section alignment for making rodata explicitly NX, as arm does not split
      the page tables like arm64 does without _ALIGN_RODATA.
      
      Also adds human readable names to the sections so I could more easily
      debug my typos, and makes CONFIG_DEBUG_RODATA default "y" for CPU_V7.
      
      Results in /sys/kernel/debug/kernel_page_tables for each config state:
      
       # CONFIG_DEBUG_RODATA is not set
       # CONFIG_DEBUG_ALIGN_RODATA is not set
      
      ---[ Kernel Mapping ]---
      0x80000000-0x80900000           9M     RW x  SHD
      0x80900000-0xa0000000         503M     RW NX SHD
      
       CONFIG_DEBUG_RODATA=y
       CONFIG_DEBUG_ALIGN_RODATA=y
      
      ---[ Kernel Mapping ]---
      0x80000000-0x80100000           1M     RW NX SHD
      0x80100000-0x80700000           6M     ro x  SHD
      0x80700000-0x80a00000           3M     ro NX SHD
      0x80a00000-0xa0000000         502M     RW NX SHD
      
       CONFIG_DEBUG_RODATA=y
       # CONFIG_DEBUG_ALIGN_RODATA is not set
      
      ---[ Kernel Mapping ]---
      0x80000000-0x80100000           1M     RW NX SHD
      0x80100000-0x80a00000           9M     ro x  SHD
      0x80a00000-0xa0000000         502M     RW NX SHD
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Reviewed-by: NLaura Abbott <labbott@fedoraproject.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      25362dc4
    • R
      ARM: use virt_to_idmap() for soft_restart() · 4138323e
      Russell King 提交于
      Code run via soft_restart() is run with the MMU disabled, so we need to
      pass the identity map physical address rather than the address obtained
      from virt_to_phys().  Therefore, replace virt_to_phys() with
      virt_to_idmap() for all callers of soft_restart().
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      4138323e
    • R
      ARM: make virt_to_idmap() return unsigned long · 28410293
      Russell King 提交于
      Make virt_to_idmap() return an unsigned long rather than phys_addr_t.
      
      Returning phys_addr_t here makes no sense, because the definition of
      virt_to_idmap() is that it shall return a physical address which maps
      identically with the virtual address.  Since virtual addresses are
      limited to 32-bit, identity mapped physical addresses are as well.
      
      Almost all users already had an implicit narrowing cast to unsigned long
      so let's make this official and part of this interface.
      Tested-by: NGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      28410293
  3. 27 1月, 2016 2 次提交
  4. 05 1月, 2016 2 次提交
  5. 04 1月, 2016 2 次提交
  6. 30 12月, 2015 1 次提交
  7. 22 12月, 2015 4 次提交
  8. 21 12月, 2015 1 次提交
  9. 18 12月, 2015 1 次提交
    • A
      ARM: make default platform work for NOMMU · 70722803
      Arnd Bergmann 提交于
      Moving ARCH_VERSATILE into ARCH_MULTIPLATFORM means that it no longer
      works as the default target for MMU-less kernels. While we might
      want to get that working again in the future, it's also a rather
      bad default, and it makes sense to make ARM_SINGLE_V7M the default
      because that is what realistically all NOMMU users on ARM are using,
      and it actually is what gets selected by default in the absence of
      versatile in the choice statement.
      
      Related to this, 'allnoconfig' kernels fail to link with the new
      default, as they do not include a machine record:
      
      arm-linux-gnueabi-ld: no machine record defined
      
      For ARCH_MULTIPLATFORM kernels, we avoid this error by using a
      default machine descriptor that works for all trivial platforms,
      like ARCH_VIRT. The same reasoning applies for ARM_SINGLE_V7M,
      as that can also boot with empty machine descriptors both on
      qemu and on real hardware, as long as all the drivers are present.
      
      We could also follow up with a patch to remove the existing
      machine descriptors for the ARMv7M platforms, the only callback
      pointer the four platforms contain today is the armv7m_restart
      handler and we can simply make that the default for v7M with an
      add-on patch.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      70722803
  10. 17 12月, 2015 2 次提交
  11. 15 12月, 2015 1 次提交
  12. 14 12月, 2015 2 次提交
  13. 05 12月, 2015 2 次提交
  14. 02 12月, 2015 2 次提交
  15. 26 11月, 2015 1 次提交
  16. 18 11月, 2015 1 次提交
  17. 17 11月, 2015 1 次提交
  18. 16 11月, 2015 2 次提交
  19. 03 11月, 2015 1 次提交
    • G
      ARM/PCI: Replace pci_sys_data->align_resource with global function pointer · b3a72384
      Gabriele Paoloni 提交于
      dw_pcie_host_init() creates the PCI host bridge with pci_common_init_dev(),
      an ARM-specific function that supplies the ARM-specific pci_sys_data
      structure as the PCI "sysdata".  To use dw_pcie_host_init() on other
      architectures, we will copy the internals of pci_common_init_dev() into
      pcie-designware.c instead of calling it, and dw_pcie_host_init() will
      supply the DesignWare pcie_port structure as "sysdata".
      
      Most ARM "sysdata" users are specific to non-DesignWare host bridges;
      they'll be unaffected because those bridges will continue to have the ARM
      pci_sys_data.  Most of the rest are ARM-generic functions called by
      pci_common_init_dev(); these will be unaffected because dw_pcie_host_init()
      will no longer call pci_common_init().
      
      But the ARM pcibios_align_resource() can be called by the PCI core for any
      bridge, so it can't depend on sysdata since it may be either pci_sys_data
      or pcie_port.
      
      Remove the pcibios_align_resource() dependency on sysdata by replacing the
      pci_sys_data->align_resource pointer with a global function pointer.
      
      This is less general (we can no longer have per-host bridge
      align_resource() methods), but the pci_sys_data->align_resource pointer was
      used only by Marvell (see mvebu_pcie_enable()), so this would only be a
      problem if we had a system with a combination of Marvell and other host
      bridges
      
      [bhelgaas: changelog]
      Signed-off-by: NGabriele Paoloni <gabriele.paoloni@huawei.com>
      Signed-off-by: NZhou Wang <wangzhou1@hisilicon.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NPratyush Anand <pratyush.anand@gmail.com>
      b3a72384
  20. 27 10月, 2015 1 次提交
  21. 26 10月, 2015 1 次提交
    • J
      arm: add missing of_node_put · a4283e41
      Julia Lawall 提交于
      for_each_child_of_node performs an of_node_get on each iteration, so
      a break out of the loop requires an of_node_put.
      
      The of_node_put is duplicated in front of each error return, because the
      function contains a later error return that is beyond the end of the
      for_each_child_of_node and thus doesn't need of_node_put.
      
      The semantic patch that fixes this problem is as follows
      (http://coccinelle.lip6.fr):
      
      // <smpl>
      @@
      expression root,e;
      local idexpression child;
      iterator name for_each_child_of_node;
      @@
      
       for_each_child_of_node(root, child) {
         ... when != of_node_put(child)
             when != e = child
      (
         return child;
      |
      +  of_node_put(child);
      ?  return ...;
      )
         ...
       }
      
      @@
      expression root,e;
      local idexpression child;
      @@
      
       for_each_child_of_node(root, child) {
         ... when != of_node_put(child)
             when != e = child
      +  of_node_put(child);
      ?  break;
         ...
      }
      ... when != child
      // </smpl>
      
      Additionally, concatenated a string in an affected line to avoid introducing
      a checkpatch warning.
      Signed-off-by: NJulia Lawall <Julia.Lawall@lip6.fr>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      a4283e41
  22. 23 10月, 2015 1 次提交
  23. 09 10月, 2015 2 次提交
  24. 03 10月, 2015 3 次提交
    • D
      ARM: 8439/1: Fix backtrace generation when IPI is masked · 0768330d
      Daniel Thompson 提交于
      Currently on ARM when <SysRq-L> is triggered from an interrupt handler
      (e.g. a SysRq issued using UART or kbd) the main CPU will wedge for ten
      seconds with interrupts masked before issuing a backtrace for every CPU
      except itself.
      
      The new backtrace code introduced by commit 96f0e003 ("ARM: add
      basic support for on-demand backtrace of other CPUs") does not work
      correctly when run from an interrupt handler because IPI_CPU_BACKTRACE
      is used to generate the backtrace on all CPUs but cannot preempt the
      current calling context.
      
      This can be fixed by detecting that the calling context cannot be
      preempted and issuing the backtrace directly in this case. Issuing
      directly leaves us without any pt_regs to pass to nmi_cpu_backtrace()
      so we also modify the generic code to call dump_stack() when its
      argument is NULL.
      Acked-by: NHillf Danton <hillf.zj@alibaba-inc.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NDaniel Thompson <daniel.thompson@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      0768330d
    • D
      ARM: 8428/1: kgdb: Fix registers on sleeping tasks · 001bf455
      Doug Anderson 提交于
      Dumping registers from other sleeping tasks in KGDB was totally
      failing for me.  All registers were reported as 0 in many cases.
      
      The code was using task_pt_regs(task) to try to get other thread
      registers.  This doesn't appear to be the right place to look.  From
      my tests, I saw non-zero values in this structure when we were looking
      at a kernel thread that had a userspace task associated with it, but
      it contained the register values from the userspace task.  So even in
      the cases where registers weren't reported as 0 we were still not
      showing the right thing.
      
      Instead of using task_pt_regs(task) let's use task_thread_info(task).
      This is the same place that is referred to when doing a dump of all
      sleeping task stacks (kdb_show_stack() -> show_stack() ->
      dump_backtrace() -> unwind_backtrace() -> thread_saved_sp()).
      
      As further evidence that this is the right thing to do, you can find
      the following comment in "gdbstub.c" right before it calls
      sleeping_thread_to_gdb_regs():
        Pull stuff saved during switch_to; nothing else is accessible (or
        even particularly relevant).  This should be enough for a stack
        trace.
      ...and if you look at switch_to() it only saves r4-r11, sp and lr.
      Those are the same registers that I'm getting out of the
      task_thread_info().
      
      With this change you can use "info thread" to see all tasks in the
      kernel and you can switch to other tasks and examine them in gdb.
      Signed-off-by: NDoug Anderson <dianders@chromium.org>
      Tested-by: NStephen Boyd <sboyd@codeurora.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      001bf455
    • R
      ARM: remove user cmpxchg syscall · db695c05
      Russell King 提交于
      Mark Brand reports that a NEEDS_SYSCALL_FOR_CMPXCHG enabled kernel would
      open a security hole in the ghost syscall used to implement cmpxchg, as
      it fails to validate the user pointer.
      
      However, in order for this option to be enabled, you'd need to be
      building a pre-ARMv6 kernel with SMP support.  There is only one system
      known which fits that, which is an early ARM SMP FPGA implementation
      based on the ARM926T.
      
      In any case, the Kconfig does not allow SMP to be enabled for pre-ARMv6
      systems.
      
      Moreover, even if NEEDS_SYSCALL_FOR_CMPXCHG were to be enabled, the
      kernel would not build as __ARM_NR_cmpxchg64 is not defined.
      
      The simple answer is to remove the buggy code.
      Reported-by: NMark Brand <markbrand@google.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      db695c05