1. 21 1月, 2018 1 次提交
  2. 11 12月, 2017 1 次提交
  3. 01 11月, 2017 1 次提交
    • N
      Revert "powerpc64/elfv1: Only dereference function descriptor for non-text symbols" · 63be1a81
      Naveen N. Rao 提交于
      This reverts commit 83e840c7 ("powerpc64/elfv1: Only dereference
      function descriptor for non-text symbols").
      
      Chandan reported that on newer kernels, trying to enable function_graph
      tracer on ppc64 (BE) locks up the system with the following trace:
      
        Unable to handle kernel paging request for data at address 0x600000002fa30010
        Faulting instruction address: 0xc0000000001f1300
        Thread overran stack, or stack corrupted
        Oops: Kernel access of bad area, sig: 11 [#1]
        BE SMP NR_CPUS=2048 DEBUG_PAGEALLOC NUMA pSeries
        Modules linked in:
        CPU: 1 PID: 6586 Comm: bash Not tainted 4.14.0-rc3-00162-g6e51f1f-dirty #20
        task: c000000625c07200 task.stack: c000000625c07310
        NIP:  c0000000001f1300 LR: c000000000121cac CTR: c000000000061af8
        REGS: c000000625c088c0 TRAP: 0380   Not tainted  (4.14.0-rc3-00162-g6e51f1f-dirty)
        MSR:  8000000000001032 <SF,ME,IR,DR,RI>  CR: 28002848  XER: 00000000
        CFAR: c0000000001f1320 SOFTE: 0
        ...
        NIP [c0000000001f1300] .__is_insn_slot_addr+0x30/0x90
        LR [c000000000121cac] .kernel_text_address+0x18c/0x1c0
        Call Trace:
        [c000000625c08b40] [c0000000001bd040] .is_module_text_address+0x20/0x40 (unreliable)
        [c000000625c08bc0] [c000000000121cac] .kernel_text_address+0x18c/0x1c0
        [c000000625c08c50] [c000000000061960] .prepare_ftrace_return+0x50/0x130
        [c000000625c08cf0] [c000000000061b10] .ftrace_graph_caller+0x14/0x34
        [c000000625c08d60] [c000000000121b40] .kernel_text_address+0x20/0x1c0
        [c000000625c08df0] [c000000000061960] .prepare_ftrace_return+0x50/0x130
        ...
        [c000000625c0ab30] [c000000000061960] .prepare_ftrace_return+0x50/0x130
        [c000000625c0abd0] [c000000000061b10] .ftrace_graph_caller+0x14/0x34
        [c000000625c0ac40] [c000000000121b40] .kernel_text_address+0x20/0x1c0
        [c000000625c0acd0] [c000000000061960] .prepare_ftrace_return+0x50/0x130
        [c000000625c0ad70] [c000000000061b10] .ftrace_graph_caller+0x14/0x34
        [c000000625c0ade0] [c000000000121b40] .kernel_text_address+0x20/0x1c0
      
      This is because ftrace is using ppc_function_entry() for obtaining the
      address of return_to_handler() in prepare_ftrace_return(). The call to
      kernel_text_address() itself gets traced and we end up in a recursive
      loop.
      
      Fixes: 83e840c7 ("powerpc64/elfv1: Only dereference function descriptor for non-text symbols")
      Cc: stable@vger.kernel.org # v4.13+
      Reported-by: NChandan Rajendra <chandan@linux.vnet.ibm.com>
      Signed-off-by: NNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      63be1a81
  4. 03 7月, 2017 1 次提交
    • N
      powerpc64/elfv1: Only dereference function descriptor for non-text symbols · 83e840c7
      Naveen N. Rao 提交于
      Currently, we assume that the function pointer we receive in
      ppc_function_entry() points to a function descriptor. However, this is
      not always the case. In particular, assembly symbols without the right
      annotation do not have an associated function descriptor. Some of these
      symbols are added to the kprobe blacklist using _ASM_NOKPROBE_SYMBOL().
      
      When such addresses are subsequently processed through
      arch_deref_entry_point() in populate_kprobe_blacklist(), we see the
      below errors during bootup:
          [    0.663963] Failed to find blacklist at 7d9b02a648029b6c
          [    0.663970] Failed to find blacklist at a14d03d0394a0001
          [    0.663972] Failed to find blacklist at 7d5302a6f94d0388
          [    0.663973] Failed to find blacklist at 48027d11e8610178
          [    0.663974] Failed to find blacklist at f8010070f8410080
          [    0.663976] Failed to find blacklist at 386100704801f89d
          [    0.663977] Failed to find blacklist at 7d5302a6f94d00b0
      
      Fix this by checking if the function pointer we receive in
      ppc_function_entry() already points to kernel text. If so, we just
      return it as is. If not, we assume that this is a function descriptor
      and proceed to dereference it.
      Suggested-by: NNicholas Piggin <npiggin@gmail.com>
      Reviewed-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      83e840c7
  5. 24 4月, 2017 1 次提交
  6. 10 2月, 2017 2 次提交
    • A
      powerpc/kprobes: Implement Optprobes · 51c9c084
      Anju T 提交于
      Current infrastructure of kprobe uses the unconditional trap instruction
      to probe a running kernel. Optprobe allows kprobe to replace the trap
      with a branch instruction to a detour buffer. Detour buffer contains
      instructions to create an in memory pt_regs. Detour buffer also has a
      call to optimized_callback() which in turn call the pre_handler(). After
      the execution of the pre-handler, a call is made for instruction
      emulation. The NIP is determined in advanced through dummy instruction
      emulation and a branch instruction is created to the NIP at the end of
      the trampoline.
      
      To address the limitation of branch instruction in POWER architecture,
      detour buffer slot is allocated from a reserved area. For the time
      being, 64KB is reserved in memory for this purpose.
      
      Instructions which can be emulated using analyse_instr() are the
      candidates for optimization. Before optimization ensure that the address
      range between the detour buffer allocated and the instruction being
      probed is within +/- 32MB.
      Signed-off-by: NAnju T Sudhakar <anju@linux.vnet.ibm.com>
      Signed-off-by: NNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Acked-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      51c9c084
    • A
      powerpc: Add helper to check if offset is within relative branch range · ebfa50df
      Anju T 提交于
      To permit the use of relative branch instruction in powerpc, the target
      address has to be relatively nearby, since the address is specified in an
      immediate field (24 bit filed) in the instruction opcode itself. Here
      nearby refers to 32MB on either side of the current instruction.
      
      This patch verifies whether the target address is within +/- 32MB
      range or not.
      Signed-off-by: NNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Signed-off-by: NAnju T Sudhakar <anju@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      ebfa50df
  7. 14 6月, 2016 1 次提交
    • M
      powerpc: Define and use PPC64_ELF_ABI_v2/v1 · f55d9665
      Michael Ellerman 提交于
      We're approaching 20 locations where we need to check for ELF ABI v2.
      That's fine, except the logic is a bit awkward, because we have to check
      that _CALL_ELF is defined and then what its value is.
      
      So check it once in asm/types.h and define PPC64_ELF_ABI_v2 when ELF ABI
      v2 is detected.
      
      We also have a few places where what we're really trying to check is
      that we are using the 64-bit v1 ABI, ie. function descriptors. So also
      add a #define for that, which simplifies several checks.
      Signed-off-by: NNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      f55d9665
  8. 07 3月, 2016 1 次提交
    • T
      powerpc/ftrace: Add support for -mprofile-kernel ftrace ABI · 15308664
      Torsten Duwe 提交于
      The gcc switch -mprofile-kernel defines a new ABI for calling _mcount()
      very early in the function with minimal overhead.
      
      Although mprofile-kernel has been available since GCC 3.4, there were
      bugs which were only fixed recently. Currently it is known to work in
      GCC 4.9, 5 and 6.
      
      Additionally there are two possible code sequences generated by the
      flag, the first uses mflr/std/bl and the second is optimised to omit the
      std. Currently only gcc 6 has the optimised sequence. This patch
      supports both sequences.
      
      Initial work started by Vojtech Pavlik, used with permission.
      
      Key changes:
       - rework _mcount() to work for both the old and new ABIs.
       - implement new versions of ftrace_caller() and ftrace_graph_caller()
         which deal with the new ABI.
       - updates to __ftrace_make_nop() to recognise the new mcount calling
         sequence.
       - updates to __ftrace_make_call() to recognise the nop'ed sequence.
       - implement ftrace_modify_call().
       - updates to the module loader to surpress the toc save in the module
         stub when calling mcount with the new ABI.
      Reviewed-by: NBalbir Singh <bsingharora@gmail.com>
      Signed-off-by: NTorsten Duwe <duwe@suse.de>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      15308664
  9. 24 6月, 2014 1 次提交
    • M
      powerpc: Add ppc_global_function_entry() · d997c00c
      Michael Ellerman 提交于
      ABIv2 has the concept of a global and local entry point to a function.
      In most cases we are interested in the local entry point, and so that is
      what ppc_function_entry() returns.
      
      However we have a case in the ftrace code where we want the global entry
      point, and there may be other places we need it too. Rather than special
      casing each, add an accessor.
      
      For ABIv1 and 32-bit there is only a single entry point, so we return
      that. That means it's safe for the caller to use this without also
      checking the ABI version.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      d997c00c
  10. 23 4月, 2014 1 次提交
  11. 02 12月, 2013 1 次提交
  12. 03 7月, 2012 1 次提交
  13. 23 2月, 2009 1 次提交
    • K
      powerpc: Unify opcode definitions and support · 16c57b36
      Kumar Gala 提交于
      Create a new header that becomes a single location for defining PowerPC
      opcodes used by code that is either generationg instructions
      at runtime (fixups, debug, etc.), emulating instructions, or just
      compiling instructions old assemblers don't know about.
      
      We currently don't handle the floating point emulation or alignment decode
      as both are better handled by the specific decode support they already
      have.
      
      Added support for the new dcbzl, dcbal, msgsnd, tlbilx, & wait instructions
      since older assemblers don't know about them.
      Signed-off-by: NKumar Gala <galak@kernel.crashing.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      16c57b36
  14. 04 8月, 2008 1 次提交
  15. 03 7月, 2008 1 次提交
    • K
      powerpc: Fixup lwsync at runtime · 2d1b2027
      Kumar Gala 提交于
      To allow for a single kernel image on e500 v1/v2/mc we need to fixup lwsync
      at runtime.  On e500v1/v2 lwsync causes an illop so we need to patch up
      the code.  We default to 'sync' since that is always safe and if the cpu
      is capable we will replace 'sync' with 'lwsync'.
      
      We introduce CPU_FTR_LWSYNC as a way to determine at runtime if this is
      needed.  This flag could be moved elsewhere since we dont really use it
      for the normal CPU_FTR purpose.
      
      Finally we only store the relative offset in the fixup section to keep it
      as small as possible rather than using a full fixup_entry.
      Signed-off-by: NKumar Gala <galak@kernel.crashing.org>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      2d1b2027
  16. 01 7月, 2008 5 次提交