1. 09 12月, 2021 1 次提交
  2. 29 11月, 2021 1 次提交
  3. 25 11月, 2021 1 次提交
  4. 07 10月, 2021 1 次提交
  5. 21 6月, 2021 1 次提交
  6. 16 6月, 2021 4 次提交
  7. 21 4月, 2021 1 次提交
  8. 26 3月, 2021 1 次提交
  9. 15 9月, 2020 1 次提交
  10. 26 7月, 2020 1 次提交
  11. 10 6月, 2020 1 次提交
    • M
      mm: don't include asm/pgtable.h if linux/mm.h is already included · e31cf2f4
      Mike Rapoport 提交于
      Patch series "mm: consolidate definitions of page table accessors", v2.
      
      The low level page table accessors (pXY_index(), pXY_offset()) are
      duplicated across all architectures and sometimes more than once.  For
      instance, we have 31 definition of pgd_offset() for 25 supported
      architectures.
      
      Most of these definitions are actually identical and typically it boils
      down to, e.g.
      
      static inline unsigned long pmd_index(unsigned long address)
      {
              return (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1);
      }
      
      static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
      {
              return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(address);
      }
      
      These definitions can be shared among 90% of the arches provided
      XYZ_SHIFT, PTRS_PER_XYZ and xyz_page_vaddr() are defined.
      
      For architectures that really need a custom version there is always
      possibility to override the generic version with the usual ifdefs magic.
      
      These patches introduce include/linux/pgtable.h that replaces
      include/asm-generic/pgtable.h and add the definitions of the page table
      accessors to the new header.
      
      This patch (of 12):
      
      The linux/mm.h header includes <asm/pgtable.h> to allow inlining of the
      functions involving page table manipulations, e.g.  pte_alloc() and
      pmd_alloc().  So, there is no point to explicitly include <asm/pgtable.h>
      in the files that include <linux/mm.h>.
      
      The include statements in such cases are remove with a simple loop:
      
      	for f in $(git grep -l "include <linux/mm.h>") ; do
      		sed -i -e '/include <asm\/pgtable.h>/ d' $f
      	done
      Signed-off-by: NMike Rapoport <rppt@linux.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Cain <bcain@codeaurora.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Ungerer <gerg@linux-m68k.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Guo Ren <guoren@kernel.org>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Ley Foon Tan <ley.foon.tan@intel.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: Nick Hu <nickhu@andestech.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Link: http://lkml.kernel.org/r/20200514170327.31389-1-rppt@kernel.org
      Link: http://lkml.kernel.org/r/20200514170327.31389-2-rppt@kernel.orgSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e31cf2f4
  12. 05 6月, 2020 1 次提交
  13. 26 5月, 2020 1 次提交
  14. 18 5月, 2020 10 次提交
  15. 31 5月, 2019 1 次提交
  16. 21 4月, 2019 1 次提交
    • R
      powerpc/lib: Refactor __patch_instruction() to use __put_user_asm() · ef296729
      Russell Currey 提交于
      __patch_instruction() is called in early boot, and uses
      __put_user_size(), which includes the allow/prevent calls to enforce
      KUAP, which could either be called too early, or in the Radix case,
      forced to use "early_" versions of functions just to safely handle
      this one case.
      
      __put_user_asm() does not do this, and thus is safe to use both in
      early boot, and later on since in this case it should only ever be
      touching kernel memory.
      
      __patch_instruction() was previously refactored to use
      __put_user_size() in order to be able to return -EFAULT, which would
      allow the kernel to patch instructions in userspace, which should
      never happen. This has the functional change of causing faults on
      userspace addresses if KUAP is turned on, which should never happen in
      practice.
      
      A future enhancement could be to double check the patch address is
      definitely allowed to be tampered with by the kernel.
      Signed-off-by: NRussell Currey <ruscur@russell.cc>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      ef296729
  17. 20 4月, 2019 1 次提交
  18. 19 12月, 2018 1 次提交
  19. 14 10月, 2018 1 次提交
  20. 02 10月, 2018 1 次提交
  21. 18 9月, 2018 1 次提交
    • M
      powerpc: Avoid code patching freed init sections · 51c3c62b
      Michael Neuling 提交于
      This stops us from doing code patching in init sections after they've
      been freed.
      
      In this chain:
        kvm_guest_init() ->
          kvm_use_magic_page() ->
            fault_in_pages_readable() ->
      	 __get_user() ->
      	   __get_user_nocheck() ->
      	     barrier_nospec();
      
      We have a code patching location at barrier_nospec() and
      kvm_guest_init() is an init function. This whole chain gets inlined,
      so when we free the init section (hence kvm_guest_init()), this code
      goes away and hence should no longer be patched.
      
      We seen this as userspace memory corruption when using a memory
      checker while doing partition migration testing on powervm (this
      starts the code patching post migration via
      /sys/kernel/mobility/migration). In theory, it could also happen when
      using /sys/kernel/debug/powerpc/barrier_nospec.
      
      Cc: stable@vger.kernel.org # 4.13+
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      Reviewed-by: NNicholas Piggin <npiggin@gmail.com>
      Reviewed-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      51c3c62b
  22. 07 8月, 2018 1 次提交
    • M
      powerpc/asm: Add a patch_site macro & helpers for patching instructions · 06d0bbc6
      Michael Ellerman 提交于
      Add a macro and some helper C functions for patching single asm
      instructions.
      
      The gas macro means we can do something like:
      
        1:	nop
        	patch_site 1b, patch__foo
      
      Which is less visually distracting than defining a GLOBAL symbol at 1,
      and also doesn't pollute the symbol table which can confuse eg. perf.
      
      These are obviously similar to our existing feature sections, but are
      not automatically patched based on CPU/MMU features, rather they are
      designed to be manually patched by C code at some arbitrary point.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      06d0bbc6
  23. 21 1月, 2018 2 次提交
  24. 11 12月, 2017 1 次提交
  25. 22 11月, 2017 1 次提交
  26. 03 7月, 2017 1 次提交
    • B
      powerpc/lib/code-patching: Use alternate map for patch_instruction() · 37bc3e5f
      Balbir Singh 提交于
      This patch creates the window using text_poke_area, allocated via
      get_vm_area(). text_poke_area is per CPU to avoid locking.
      text_poke_area for each cpu is setup using late_initcall, prior to
      setup of these alternate mapping areas, we continue to use direct
      write to change/modify kernel text. With the ability to use alternate
      mappings to write to kernel text, it provides us the freedom to then
      turn text read-only and implement CONFIG_STRICT_KERNEL_RWX.
      
      This code is CPU hotplug aware to ensure that the we have mappings for
      any new cpus as they come online and tear down mappings for any CPUs
      that go offline.
      Signed-off-by: NBalbir Singh <bsingharora@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      37bc3e5f
  27. 23 4月, 2017 1 次提交
    • N
      powerpc/kprobes: Convert __kprobes to NOKPROBE_SYMBOL() · 71f6e58e
      Naveen N. Rao 提交于
      Along similar lines as commit 9326638c ("kprobes, x86: Use NOKPROBE_SYMBOL()
      instead of __kprobes annotation"), convert __kprobes annotation to either
      NOKPROBE_SYMBOL() or nokprobe_inline. The latter forces inlining, in which case
      the caller needs to be added to NOKPROBE_SYMBOL().
      
      Also:
       - blacklist arch_deref_entry_point(), and
       - convert a few regular inlines to nokprobe_inline in lib/sstep.c
      
      A key benefit is the ability to detect such symbols as being
      blacklisted. Before this patch:
      
        $ cat /sys/kernel/debug/kprobes/blacklist | grep read_mem
        $ perf probe read_mem
        Failed to write event: Invalid argument
          Error: Failed to add events.
        $ dmesg | tail -1
        [ 3736.112815] Could not insert probe at _text+10014968: -22
      
      After patch:
        $ cat /sys/kernel/debug/kprobes/blacklist | grep read_mem
        0xc000000000072b50-0xc000000000072d20	read_mem
        $ perf probe read_mem
        read_mem is blacklisted function, skip it.
        Added new events:
          (null):(null)        (on read_mem)
          probe:read_mem       (on read_mem)
      
        You can now use it in all perf tools, such as:
      
      	  perf record -e probe:read_mem -aR sleep 1
      
        $ grep " read_mem" /proc/kallsyms
        c000000000072b50 t read_mem
        c0000000005f3b40 t read_mem
        $ cat /sys/kernel/debug/kprobes/list
        c0000000005f3b48  k  read_mem+0x8    [DISABLED]
      Acked-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: NNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      [mpe: Minor change log formatting, fix up some conflicts]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      71f6e58e