1. 21 11月, 2017 1 次提交
  2. 28 9月, 2017 1 次提交
  3. 26 4月, 2017 1 次提交
    • G
      ARM: 8672/1: mm: remove tasklist locking from update_sections_early() · 11ce4b33
      Grygorii Strashko 提交于
      The below backtrace can be observed on -rt kernel with
      CONFIG_DEBUG_MODULE_RONX (4.9 kernel CONFIG_DEBUG_RODATA) option enabled:
      
       BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:993
       in_atomic(): 1, irqs_disabled(): 128, pid: 14, name: migration/0
       1 lock held by migration/0/14:
        #0:  (tasklist_lock){+.+...}, at: [<c01183e8>] update_sections_early+0x24/0xdc
       irq event stamp: 38
       hardirqs last  enabled at (37): [<c08f6f7c>] _raw_spin_unlock_irq+0x24/0x68
       hardirqs last disabled at (38): [<c01fdfe8>] multi_cpu_stop+0xd8/0x138
       softirqs last  enabled at (0): [<c01303ec>] copy_process.part.5+0x238/0x1b64
       softirqs last disabled at (0): [<  (null)>]   (null)
       Preemption disabled at: [<c01fe244>] cpu_stopper_thread+0x80/0x10c
       CPU: 0 PID: 14 Comm: migration/0 Not tainted 4.9.21-rt16-02220-g49e319c #15
       Hardware name: Generic DRA74X (Flattened Device Tree)
       [<c0112014>] (unwind_backtrace) from [<c010d370>] (show_stack+0x10/0x14)
       [<c010d370>] (show_stack) from [<c049beb8>] (dump_stack+0xa8/0xd4)
       [<c049beb8>] (dump_stack) from [<c01631a0>] (___might_sleep+0x1bc/0x2ac)
       [<c01631a0>] (___might_sleep) from [<c08f7244>] (__rt_spin_lock+0x1c/0x30)
       [<c08f7244>] (__rt_spin_lock) from [<c08f77a4>] (rt_read_lock+0x54/0x68)
       [<c08f77a4>] (rt_read_lock) from [<c01183e8>] (update_sections_early+0x24/0xdc)
       [<c01183e8>] (update_sections_early) from [<c01184b0>] (__fix_kernmem_perms+0x10/0x1c)
       [<c01184b0>] (__fix_kernmem_perms) from [<c01fe010>] (multi_cpu_stop+0x100/0x138)
       [<c01fe010>] (multi_cpu_stop) from [<c01fe24c>] (cpu_stopper_thread+0x88/0x10c)
       [<c01fe24c>] (cpu_stopper_thread) from [<c015edc4>] (smpboot_thread_fn+0x174/0x31c)
       [<c015edc4>] (smpboot_thread_fn) from [<c015a988>] (kthread+0xf0/0x108)
       [<c015a988>] (kthread) from [<c0108818>] (ret_from_fork+0x14/0x3c)
       Freeing unused kernel memory: 1024K (c0d00000 - c0e00000)
      
      The stop_machine() is called with cpus = NULL from fix_kernmem_perms() and
      mark_rodata_ro() which means only one CPU will execute
      update_sections_early() while all other CPUs will spin and wait. Hence,
      it's safe to remove tasklist locking from update_sections_early(). As part
      of this change also mark functions which are local to this module as
      static.
      Signed-off-by: NGrygorii Strashko <grygorii.strashko@ti.com>
      Acked-by: NLaura Abbott <labbott@redhat.com>
      Acked-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      11ce4b33
  4. 02 3月, 2017 2 次提交
  5. 28 2月, 2017 5 次提交
  6. 08 2月, 2017 1 次提交
  7. 11 2月, 2016 1 次提交
    • K
      ARM: 8502/1: mm: mark section-aligned portion of rodata NX · 64ac2e74
      Kees Cook 提交于
      When rodata is large enough that it crosses a section boundary after the
      kernel text, mark the rest NX. This is as close to full NX of rodata as
      we can get without splitting page tables or doing section alignment via
      CONFIG_DEBUG_ALIGN_RODATA.
      
      When the config is:
      
       CONFIG_DEBUG_RODATA=y
       # CONFIG_DEBUG_ALIGN_RODATA is not set
      
      Before:
      
      ---[ Kernel Mapping ]---
      0x80000000-0x80100000           1M     RW NX SHD
      0x80100000-0x80a00000           9M     ro x  SHD
      0x80a00000-0xa0000000         502M     RW NX SHD
      
      After:
      
      ---[ 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
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Reviewed-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      64ac2e74
  8. 08 2月, 2016 1 次提交
    • 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
  9. 14 12月, 2015 1 次提交
  10. 05 12月, 2015 1 次提交
  11. 02 6月, 2015 1 次提交
  12. 15 4月, 2015 2 次提交
  13. 21 1月, 2015 1 次提交
  14. 10 1月, 2015 1 次提交
  15. 21 11月, 2014 1 次提交
  16. 21 10月, 2014 1 次提交
  17. 17 10月, 2014 3 次提交
  18. 10 10月, 2014 1 次提交
  19. 03 10月, 2014 1 次提交
  20. 02 6月, 2014 2 次提交
  21. 01 6月, 2014 1 次提交
  22. 30 4月, 2014 1 次提交
  23. 12 3月, 2014 1 次提交
  24. 28 1月, 2014 1 次提交
  25. 22 1月, 2014 2 次提交
    • S
      arch/arm/mm/init.c: use memblock apis for early memory allocations · cfb66586
      Santosh Shilimkar 提交于
      Switch to memblock interfaces for early memory allocator instead of
      bootmem allocator.  No functional change in beahvior than what it is in
      current code from bootmem users points of view.
      
      Archs already converted to NO_BOOTMEM now directly use memblock
      interfaces instead of bootmem wrappers build on top of memblock.  And
      the archs which still uses bootmem, these new apis just fallback to
      exiting bootmem APIs.
      Signed-off-by: NSantosh Shilimkar <santosh.shilimkar@ti.com>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Christoph Lameter <cl@linux-foundation.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Grygorii Strashko <grygorii.strashko@ti.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Paul Walmsley <paul@pwsan.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cfb66586
    • M
      mm, show_mem: remove SHOW_MEM_FILTER_PAGE_COUNT · aec6a888
      Mel Gorman 提交于
      Commit 4b59e6c4 ("mm, show_mem: suppress page counts in
      non-blockable contexts") introduced SHOW_MEM_FILTER_PAGE_COUNT to
      suppress PFN walks on large memory machines.  Commit c78e9363 ("mm:
      do not walk all of system memory during show_mem") avoided a PFN walk in
      the generic show_mem helper which removes the requirement for
      SHOW_MEM_FILTER_PAGE_COUNT in that case.
      
      This patch removes PFN walkers from the arch-specific implementations
      that report on a per-node or per-zone granularity.  ARM and unicore32
      still do a PFN walk as they report memory usage on each bank which is a
      much finer granularity where the debugging information may still be of
      use.  As the remaining arches doing PFN walks have relatively small
      amounts of memory, this patch simply removes SHOW_MEM_FILTER_PAGE_COUNT.
      
      [akpm@linux-foundation.org: fix parisc]
      Signed-off-by: NMel Gorman <mgorman@suse.de>
      Acked-by: NDavid Rientjes <rientjes@google.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: James Bottomley <jejb@parisc-linux.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      aec6a888
  26. 08 1月, 2014 1 次提交
  27. 10 12月, 2013 1 次提交
  28. 24 11月, 2013 3 次提交
    • S
      ARM: mm: Remove bootmem code and switch to NO_BOOTMEM · 84f452b1
      Santosh Shilimkar 提交于
      Now with dma_mask series merged and max*pfn has consistent meaning on ARM
      as rest of the arch's thanks to RMK's mega series, lets switch ARM code
      to NO_BOOTMEM. With NO_BOOTMEM change, now we use memblock allocator to
      reserve space for crash kernel to have one less dependency with nobootmem
      allocator wrapper.
      
      Tested with both flat memory and sparse (faked) memory models with highmem
      enabled.
      
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
      Signed-off-by: NSantosh Shilimkar <santosh.shilimkar@ti.com>
      84f452b1
    • G
      ARM: mm: Don't allow resizing of memblock data until "low" memory is not mapped · 8e58caef
      Grygorii Strashko 提交于
      If allowed by call to memblock_allow_resize() - The Memblock core will
      try to allocate additional memory and rearrange its internal data in
      case, if there are more then INIT_MEMBLOCK_REGIONS(128) memory regions
      of any type have been allocated. If this happens before Low memory is
      mapped (which is done now by map_lowmem()) the system will hang, because
      the Memblock core will try to operate with virtual addresses which
      aren't mapped yet.
      
      In ARM code, the memblock resizing is allowed (memblock_allow_resize())
      from arm_memblock_init() which is called before map_lowmem(), so
      this may lead to an error as described above.
      
      Hence, allow Memblock resizing later during init, from bootmem_init()
      when all appropriate mappings are ready.
      
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
      Signed-off-by: NGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: NSantosh Shilimkar <santosh.shilimkar@ti.com>
      8e58caef
    • S
      ARM: mm: Fix max_mapnr with recent max*pfn updates · b3ba41f2
      Santosh Shilimkar 提交于
      With commit  26ba47b1 {ARM: 7805/1: mm: change max*pfn to include
      the physical offset of memory}, the max_pfn already contain
      PHYS_PFN_OFFSET, so it shouldn't be taken into account again.
      
      While at it, use use set_max_mapnr() helper.
      
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
      Signed-off-by: NGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: NSantosh Shilimkar <santosh.shilimkar@ti.com>
      b3ba41f2