1. 25 May, 2009 1 commit
    • Lai Jiangshan's avatar
      tracing: add trace_event_read_lock() · 4f535968
      Lai Jiangshan authored
      I found that there is nothing to protect event_hash in
      ftrace_find_event(). Rcu protects the event hashlist
      but not the event itself while we use it after its extraction
      through ftrace_find_event().
      This lack of a proper locking in this spot opens a race
      window between any event dereferencing and module removal.
      --Task A--
      print_trace_line(trace) {
        event = find_ftrace_event(trace)
      --Task B--
      trace_module_remove_events(mod) {
        list_trace_events_module(ev, mod) {
          unregister_ftrace_event(ev->event) {
      |--> module removed, the event has been dropped
      --Task A--
        event->print(trace); // Dereferencing freed memory
      If the event retrieved belongs to a module and this module
      is concurrently removed, we may end up dereferencing a data
      from a freed module.
      RCU could solve this, but it would add latency to the kernel and
      forbid tracers output callbacks to call any sleepable code.
      So this fix converts 'trace_event_mutex' to a read/write semaphore,
      and adds trace_event_read_lock() to protect ftrace_find_event().
      [ Impact: fix possible freed memory dereference in ftrace ]
      Signed-off-by: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
      Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <4A114806.7090302@cn.fujitsu.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
  2. 20 May, 2009 1 commit
  3. 19 May, 2009 2 commits
    • Stefan Raspl's avatar
      blktrace: remove debugfs entries on bad path · fd51d251
      Stefan Raspl authored
      debugfs directory entries for devices are not removed on some
      of the failure pathes in do_blk_trace_setup().
      One way to reproduce is to start blktrace on multiple devices
      with insufficient Vmalloc space: Devices will fail with
      a message like this:
      	BLKTRACESETUP(2) /dev/sdu failed: 5/Input/output error
      If so, the respective entries in debugfs
      (e.g. /sys/kernel/debug/block/sdu) will remain and subsequent
      attempts to start blktrace on the respective devices will not
      succeed due to existing directories.
      [ Impact: fix /debug/tracing file cleanup corner case ]
      Signed-off-by: default avatarStefan Raspl <stefan.raspl@linux.vnet.ibm.com>
      Acked-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: schwidefsky@de.ibm.com
      Cc: heiko.carstens@de.ibm.com
      LKML-Reference: <4A1266CC.5040801@linux.vnet.ibm.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    • Li Zefan's avatar
      tracing/events: Documentation updates · 143c145e
      Li Zefan authored
      - fix some typos
      - document the difference between '>' and '>>'
      - document the 'enable' toggle
      - remove section "Defining an event-enabled tracepoint", since it's
        out-dated and sample/trace_events/ already serves this purpose.
      v2: add "Updated by Li Zefan"
      [ Impact: make documentation up-to-date ]
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      LKML-Reference: <4A125503.5060406@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  4. 18 May, 2009 2 commits
  5. 16 May, 2009 1 commit
  6. 15 May, 2009 33 commits