Deadlock while using stack tracer(ftrace)

Solution Verified - Updated -

Issue

  • When writing debugfs/tracing/stack_max_size while reading debugfs/tracing/stack_trace, we got deadlock. Because the 2 actions can be racy, and result in holding the same lock twice.

  • Step to Reproduce:

  1. echo 1 > /proc/sys/kernel/stack_tracer_enabled
  2. mount -t debugfs xxx /sys/kernel/debug
  3. for ((; ;)) ; do echo 1 > /sys/kernel/debug/tracing/stack_max_size; done
  4. for ((; ;)) ; do cat /sys/kernel/debug/tracing/stack_trace > /dev/null; done
  5. Then, wait for a while (until transparent hugepage is used.)
  6. move the task to /cgroup/A/
  7. rmdir /cgroup/A/B
  • Actual Results:
    • lockup
  • Expected Results:
    • Never lockup

Environment

  • Red Hat Enterprise Linux RHEL 6.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content