Skip to content
  1. Sep 29, 2016
  2. Sep 28, 2016
  3. Sep 23, 2016
  4. Sep 20, 2016
  5. Sep 19, 2016
    • Michael Ellerman's avatar
      powerpc: Ensure .mem(init|exit).text are within _stext/_etext · 7de3b27b
      Michael Ellerman authored
      
      
      In our linker script we open code the list of text sections, because we
      need to include the __ftr_alt sections, which are arch-specific.
      
      This means we can't use TEXT_TEXT as defined in vmlinux.lds.h, and so we
      don't have the MEM_KEEP() logic for memory hotplug sections.
      
      If we build the kernel with the gold linker, and with CONFIG_MEMORY_HOTPLUG=y,
      we see that functions marked __meminit can end up outside of the
      _stext/_etext range, and also outside of _sinittext/_einittext, eg:
      
          c000000000000000 T _stext
          c0000000009e0000 A _etext
          c0000000009e3f18 T hash__vmemmap_create_mapping
          c000000000ca0000 T _sinittext
          c000000000d00844 T _einittext
      
      This causes them to not be recognised as text by is_kernel_text(), and
      prevents them being patched by jump_label (and presumably ftrace/kprobes
      etc.).
      
      Fix it by adding MEM_KEEP() directives, mirroring what TEXT_TEXT does.
      
      This isn't a problem when CONFIG_MEMORY_HOTPLUG=n, because we use the
      standard INIT_TEXT_SECTION() and EXIT_TEXT macros from vmlinux.lds.h.
      
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Tested-by: default avatarAnton Blanchard <anton@samba.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      7de3b27b
    • Michael Ellerman's avatar
      powerpc: Don't change the section in _GLOBAL() · bea2dccc
      Michael Ellerman authored
      
      
      Currently the _GLOBAL() macro unilaterally sets the assembler section to
      ".text" at the start of the macro. This is rude as the caller may be
      using a different section.
      
      So let the caller decide which section to emit the code into. On big
      endian we do need to switch to the ".opd" section to emit the OPD, but
      do that with pushsection/popsection, thereby leaving the original
      section intact.
      
      I verified that the order of all entries in System.map is unchanged
      after this patch. The actual addresses shift around slightly so you
      can't just diff the System.map.
      
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Reviewed-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      bea2dccc
    • Nicholas Piggin's avatar
      powerpc/kernel: Use kprobe blacklist for asm functions · 6f698df1
      Nicholas Piggin authored
      
      
      Rather than forcing the whole function into the ".kprobes.text" section,
      just add the symbol's address to the kprobe blacklist.
      
      This also lets us drop the three versions of the_KPROBE macro, in
      exchange for just one version of _ASM_NOKPROBE_SYMBOL - which is a good
      cleanup.
      
      Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      6f698df1
    • Nicholas Piggin's avatar
      powerpc: Use kprobe blacklist for exception handlers · 03465f89
      Nicholas Piggin authored
      
      
      Currently we mark the C implementations of some exception handlers as
      __kprobes. This has the effect of putting them in the ".kprobes.text"
      section, which separates them from the rest of the text.
      
      Instead we can use the blacklist macros to add the symbols to a
      blacklist which kprobes will check. This allows the linker to move
      exception handler functions close to callers and avoids trampolines in
      larger kernels.
      
      Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
      [mpe: Reword change log a bit]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      03465f89
  6. Sep 13, 2016
    • Simon Guo's avatar
      powerpc: Set used_(vsr|vr|spe) in sigreturn path when MSR bits are active · e1c0d66f
      Simon Guo authored
      
      
      Normally, when MSR[VSX/VR/SPE] bits == 1, the used_vsr/used_vr/used_spe
      bit have already been set. However when loading a signal frame from user
      space we need to explicitly set used_vsr/used_vr/used_spe to make them
      consistent with the MSR bits from the signal frame.
      
      For example, CRIU application, who utilizes sigreturn to restore
      checkpointed process, will lead to the case where MSR[VSX] bit is active
      in signal frame, but used_vsr bit is not set in the kernel. (the same
      applies to VR/SPE).
      
      This patch fixes this by always setting used_* bit when MSR related bits
      are active in signal frame and we are doing sigreturn.
      
      Based on a proposal by Benh.
      
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarSimon Guo <wei.guo.simon@gmail.com>
      [mpe: Massage change log]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      e1c0d66f