1. Jul 02, 2013
    • Oleg Nesterov's avatar
      tracing/kprobes: Avoid perf_trace_buf_*() if ->perf_events is empty · 288e984e
      Oleg Nesterov authored
      perf_trace_buf_prepare() + perf_trace_buf_submit() make no sense
      if this task/CPU has no active counters. Change kprobe_perf_func()
      and kretprobe_perf_func() to check call->perf_events beforehand
      and return if this list is empty.
      
      For example, "perf record -e some_probe -p1". Only /sbin/init will
      report, all other threads which hit the same probe will do
      perf_trace_buf_prepare/perf_trace_buf_submit just to realize that
      nobody wants perf_swevent_event().
      
      Link: http://lkml.kernel.org/r/20130620173806.GA13151@redhat.com
      
      
      
      Acked-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      288e984e
    • Steven Rostedt's avatar
      tracing: Failed to create system directory · 6e94a780
      Steven Rostedt authored
      Running the following:
      
       # cd /sys/kernel/debug/tracing
       # echo p:i do_sys_open > kprobe_events
       # echo p:j schedule >> kprobe_events
       # cat kprobe_events
      p:kprobes/i do_sys_open
      p:kprobes/j schedule
       # echo p:i do_sys_open >> kprobe_events
       # cat kprobe_events
      p:kprobes/j schedule
      p:kprobes/i do_sys_open
       # ls /sys/kernel/debug/tracing/events/kprobes/
      enable  filter  j
      
      Notice that the 'i' is missing from the kprobes directory.
      
      The console produces:
      
      "Failed to create system directory kprobes"
      
      This is because kprobes passes in a allocated name for the system
      and the ftrace event subsystem saves off that name instead of creating
      a duplicate for it. But the kprobes may free the system name making
      the pointer to it invalid.
      
      This bug was introduced by 92edca07
      
       "tracing: Use direct field, type
      and system names" which switched from using kstrdup() on the system name
      in favor of just keeping apointer to it, as the internal ftrace event
      system names are static and exist for the life of the computer being booted.
      
      Instead of reverting back to duplicating system names again, we can use
      core_kernel_data() to determine if the passed in name was allocated or
      static. Then use the MSB of the ref_count to be a flag to keep track if
      the name was allocated or not. Then we can still save from having to duplicate
      strings that will always exist, but still copy the ones that may be freed.
      
      Cc: stable@vger.kernel.org # 3.10
      Reported-by: default avatar"zhangwei(Jovi)" <jovi.zhangwei@huawei.com>
      Reported-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Tested-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      6e94a780
  2. Jun 20, 2013
  3. Jun 12, 2013
  4. Jun 09, 2013
  5. Jun 08, 2013