1. 13 Feb, 2019 5 commits
    • Masami Hiramatsu's avatar
      kprobes: Search non-suffixed symbol in blacklist · 6143c6fb
      Masami Hiramatsu authored
      Newer GCC versions can generate some different instances of a function
      with suffixed symbols if the function is optimized and only
      has a part of that. (e.g. .constprop, .part etc.)
      
      In this case, it is not enough to check the entry of kprobe
      blacklist because it only records non-suffixed symbol address.
      
      To fix this issue, search non-suffixed symbol in blacklist if
      given address is within a symbol which has a suffix.
      
      Note that this can cause false positive cases if a kprobe-safe
      function is optimized to suffixed instance and has same name
      symbol which is blacklisted.
      But I would like to chose a fail-safe design for this issue.
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Reviewed-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andrea Righi <righi.andrea@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/154998799234.31052.6136378903570418008.stgit@devboxSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      6143c6fb
    • Masami Hiramatsu's avatar
      x86/kprobes: Prohibit probing on IRQ handlers directly · 0eae81dc
      Masami Hiramatsu authored
      Prohibit probing on IRQ handlers in irqentry_text because
      if it interrupts user mode, at that point we haven't changed
      to kernel space yet and which eventually leads a double fault.
      E.g.
      
       # echo p apic_timer_interrupt > kprobe_events
       # echo 1 > events/kprobes/enable
       PANIC: double fault, error_code: 0x0
       CPU: 1 PID: 814 Comm: less Not tainted 4.20.0-rc3+ #30
       Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
       RIP: 0010:error_entry+0x12/0xf0
       [snip]
       Call Trace:
        <ENTRY_TRAMPOLINE>
        ? native_iret+0x7/0x7
        ? async_page_fault+0x8/0x30
        ? trace_hardirqs_on_thunk+0x1c/0x1c
        ? error_entry+0x7c/0xf0
        ? async_page_fault+0x8/0x30
        ? native_iret+0x7/0x7
        ? int3+0xa/0x20
        ? trace_hardirqs_on_thunk+0x1c/0x1c
        ? error_entry+0x7c/0xf0
        ? int3+0xa/0x20
        ? apic_timer_interrupt+0x1/0x20
        </ENTRY_TRAMPOLINE>
       Kernel panic - not syncing: Machine halted.
       Kernel Offset: disabled
       ---[ end Kernel panic - not syncing: Machine halted. ]---
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andrea Righi <righi.andrea@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/154998796400.31052.8406236614820687840.stgit@devboxSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      0eae81dc
    • Masami Hiramatsu's avatar
      x86/kprobes: Prohibit probing on functions before kprobe_int3_handler() · c13324a5
      Masami Hiramatsu authored
      Prohibit probing on the functions called before kprobe_int3_handler()
      in do_int3(). More specifically, ftrace_int3_handler(),
      poke_int3_handler(), and ist_enter(). And since rcu_nmi_enter() is
      called by ist_enter(), it also should be marked as NOKPROBE_SYMBOL.
      
      Since those are handled before kprobe_int3_handler(), probing those
      functions can cause a breakpoint recursion and crash the kernel.
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andrea Righi <righi.andrea@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/154998793571.31052.11301258949601150994.stgit@devboxSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c13324a5
    • Masami Hiramatsu's avatar
      x86/kprobes: Move trampoline code into RODATA · 877b145f
      Masami Hiramatsu authored
      Move optprobe trampoline code into RODATA since it is
      not executed, but copied and modified to be used on
      a trampoline buffer.
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andrea Righi <righi.andrea@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/154998790744.31052.3016106262944915510.stgit@devboxSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      877b145f
    • Masami Hiramatsu's avatar
      x86/kprobes: Prohibit probing on optprobe template code · 0192e653
      Masami Hiramatsu authored
      Prohibit probing on optprobe template code, since it is not
      a code but a template instruction sequence. If we modify
      this template, copied template must be broken.
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andrea Righi <righi.andrea@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: stable@vger.kernel.org
      Fixes: 9326638c ("kprobes, x86: Use NOKPROBE_SYMBOL() instead of __kprobes annotation")
      Link: http://lkml.kernel.org/r/154998787911.31052.15274376330136234452.stgit@devboxSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      0192e653
  2. 11 Feb, 2019 6 commits
  3. 09 Feb, 2019 3 commits
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo-5.1-20190206' of... · 6854daa0
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo-5.1-20190206' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      Hardware tracing:
      
        Adrian Hunter:
      
        - Handle calls optimized into jumps to a different symbol
          in the thread stack routines used to process hardware traces (Adrian Hunter)
      
      Intel PT:
      
        Adrian Hunter:
      
        - Fix overlap calculation for padding.
      
        - Fix CYC timestamp calculation after OVF.
      
        - Packet splitting can only happen in 32-bit.
      
        - Add timestamp to auxtrace errors.
      
      ARM CoreSight:
      
        Leo Yan:
      
        - Add last instruction information in packet
      
        - Set sample flags for instruction range, exception and
          return packets and for a trace discontinuity.
      
        - Add exception number in exception packet
      
        - Change tuple from traceID-CPU# to traceID-metadata
      
        - Add traceID in packet
      
        Mathieu Poirier:
      
        - Add "sinks" group to PMU directory
      
        - Use event attributes to send sink information to kernel
      
        - Remove set_drv_config() API, no longer used.
      
      perf annotate:
      
        Jiri Olsa:
      
        - Delay symbol annotation to the resort phase, speeding up 'perf report'
          startup.
      
      perf record:
      
        Alexey Budankov:
      
        - Allow binding userspace buffers to NUMA nodes.
      
      Symbols:
      
        Adrian Hunter:
      
        - Fix calculating of symbol sizes when splitting kallsyms into
          maps for kcore processing.
      
      Vendor events:
      
        William Cohen:
      
        - Intel: Fix Load_Miss_Real_Latency on CLX
      
      Misc:
      
        Arnaldo Carvalho de Melo:
      
        - Streamline headers, removing includes when all that is needed are
          just forward declarations, fixup the fallout for cases where headers
          should have been explicitely included but were instead obtained
          indirectly, by sheer luck.
      
        - Add fallback versions for CPU_{OR,EQUAL}(), so that code using it
          continue to build on older systems where those were not yet introduced
          or in systems using some other libc than the GNU one where those
          helpers aren't present.
      
      Documentation:
      
        Changbin Du:
      
        - Add documentation for BPF event selection.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      6854daa0
    • Ingo Molnar's avatar
      9821517a
    • Ingo Molnar's avatar
      Merge tag 'perf-urgent-for-mingo-5.0-20190205' of... · 3bb26006
      Ingo Molnar authored
      Merge tag 'perf-urgent-for-mingo-5.0-20190205' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
      
      Pull perf/urgent fixes from Arnaldo Carvalho de Melo:
      
      perf trace:
      
        Arnaldo Carvalho de Melo:
      
          Fix handling of probe:vfs_getname when the probed routine is
          inlined in multiple places, fixing the collection of the 'filename'
          parameter in open syscalls.
      
      perf test:
      
        Gustavo A. R. Silva:
      
          Fix bitwise operator usage in evsel-tp-sched test, which made tat
          test always detect fields as signed.
      
        Jiri Olsa:
      
          Filter out hidden symbols from labels, added in systems where the
          annobin plugin is used, such as RHEL8, which, if left in place make
          the DWARF unwind 'perf test' to fail on PPC.
      
        Tony Jones:
      
          Fix 'perf_event_attr' tests when building with python3.
      
      perf mem/c2c:
      
        Ravi Bangoria:
      
          Fix perf_mem_events on PowerPC.
      
      tools headers UAPI:
      
        Arnaldo Carvalho de Melo:
      
          Sync linux/in.h copy from the kernel sources, silencing a perf build warning.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      3bb26006
  4. 06 Feb, 2019 26 commits