← Back to team overview

kernel-packages team mailing list archive

[Bug 669641] Re: systemtap fails to discover installed debug modules

 

** No longer affects: linux (Ubuntu Lucid)

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/669641

Title:
  systemtap fails to discover installed debug modules

Status in Linaro Ubuntu Engineering Builds:
  Fix Released
Status in “linux” package in Ubuntu:
  Fix Released
Status in “linux” source package in Precise:
  Fix Released
Status in “linux” source package in Quantal:
  Fix Released
Status in “linux-2.6” package in Debian:
  Fix Released

Bug description:
  == Precise SRU Justification ==

      Impact: When using systemtap with Ubuntu kernels, the proper debug
  modules cannot be automatically discovered.

  == Fix ==

  This fix allows for the build system to insert the .gnu_debuglink
  sections in the .ko files pointing to the full unstripped .ko in
  /usr/lib/debug/.. in the dbgsym ddebs. In addition there are checks to
  ensure the debug symbol actually exists before creating the
  .gnu_debuglink section.

  == Testcase ==

  1) Install systemtap.
  2) Run "stap -l 'module("serio_raw").function("*")'"
  3) This should show list all the probe points for that module.

  --

  Binary package hint: systemtap

  Even if the proper debug symbols are installed:

  # stap -l 'kernel.function("acpi_*")' | sort

  will succeed

  and this will fail.

  # stap -l 'module("ohci1394").function("*")' | sort

  Now there's no shortage of blogs and wikis on how to work
  around this but no one has seemingly ever investigated the root
  cause. If one were to run this through strace you would find
  the following.

  open("/usr/lib/debug/.build-id/3b/6eb5a0f22ba2bc92c3c3f1fcb14fe7f31f3807.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
  open("/lib/modules/2.6.32-25-generic/kernel/drivers/ieee1394/ohci1394.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
  open("/lib/modules/2.6.32-25-generic/kernel/drivers/ieee1394/.debug/ohci1394.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
  open("/usr/lib/debug/lib/modules/2.6.32-25-generic/kernel/drivers/ieee1394/ohci1394.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
  open("/lib/modules/2.6.32-25-generic/kernel/drivers/ieee1394/build/ohci1394.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory)

  Note that the path is correct, it's the name of the KO that stap is expecting that is wrong,
  Kernel debug symbols provided by Ubuntu are unstripped yet maintain the .ko extension,
  systemtap (actually libelf/elfutils) is expecting the filename to be module.ko.debug.

  After discussing this on #systemtap on Freenode, the following script was proposed to
  generate a symlink tree, by build id, in /usr/lib/debug, with the proper extension. This
  completely solves the issue, and is also of benefit to things like gdb and oprofile.

  #!/bin/sh

  for file in `find /usr/lib/debug -name '*.ko' -print`
  do
          buildid=`eu-readelf -n $file| grep Build.ID: | awk '{print $3}'`
          dir=`echo $buildid | cut -c1-2`
          fn=`echo $buildid | cut -c3-`
          mkdir -p /usr/lib/debug/.build-id/$dir
          ln -s $file /usr/lib/debug/.build-id/$dir/$fn
          ln -s $file /usr/lib/debug/.build-id/$dir/${fn}.debug
  done

  If we could integrate this into the ddeb postinstall script, the problem would
  be solved.

To manage notifications about this bug go to:
https://bugs.launchpad.net/linaro-ubuntu/+bug/669641/+subscriptions