systemtap does not work on trusty lts-vivid kernel

Bug #1545173 reported by Dan Streetman
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemtap (Ubuntu)
Fix Released
Undecided
Dan Streetman
Trusty
Fix Released
Undecided
Dan Streetman

Bug Description

[Impact]

Attempting to use systemtap on trusty with the lts-vivid kernel fails with:

In file included from /usr/share/systemtap/runtime/linux/task_finder.c:17:0,
                 from /usr/share/systemtap/runtime/linux/runtime.h:188,
                 from /usr/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stapcEoS7h/stap_f4621118dc34d17850373d218d3dab98_4225_src.c:24:
/usr/share/systemtap/runtime/linux/task_finder2.c: In function ‘__stp_call_mmap_callbacks_with_addr’:
/usr/share/systemtap/runtime/linux/task_finder2.c:703:24: error: ‘struct file’ has no member named ‘f_dentry’
   dentry = vma->vm_file->f_dentry;
                        ^
/usr/share/systemtap/runtime/linux/task_finder2.c: In function ‘__stp_utrace_attach_match_filename’:
/usr/share/systemtap/runtime/linux/task_finder2.c:821:11: error: incompatible types when assigning to type ‘uid_t’ from type ‘kuid_t’
  tsk_euid = task_euid(tsk);
           ^
/usr/share/systemtap/runtime/linux/task_finder2.c: In function ‘__stp_call_mmap_callbacks_for_task’:
/usr/share/systemtap/runtime/linux/task_finder2.c:1206:42: error: ‘struct file’ has no member named ‘f_dentry’
        vma_cache_p->dentry = vma->vm_file->f_dentry;
                                          ^
/usr/share/systemtap/runtime/linux/task_finder2.c: In function ‘stap_start_task_finder’:
/usr/share/systemtap/runtime/linux/task_finder2.c:1711:12: error: incompatible types when assigning to type ‘uid_t’ from type ‘kuid_t’
   tsk_euid = task_euid(tsk);
            ^
In file included from /usr/share/systemtap/runtime/linux/runtime.h:194:0,
                 from /usr/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stapcEoS7h/stap_f4621118dc34d17850373d218d3dab98_4225_src.c:24:
/usr/share/systemtap/runtime/sym.c: In function ‘_stp_snprint_addr’:
/usr/share/systemtap/runtime/sym.c:567:4: error: implicit declaration of function ‘preempt_enable_no_resched’ [-Werror=implicit-function-declaration]
    preempt_enable_no_resched();
    ^
In file included from include/linux/sched.h:56:0,
                 from include/linux/ptrace.h:5,
                 from include/linux/ftrace.h:13,
                 from include/linux/kprobes.h:42,
                 from /usr/share/systemtap/runtime/linux/runtime.h:21,
                 from /usr/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stapcEoS7h/stap_f4621118dc34d17850373d218d3dab98_4225_src.c:24:
/usr/share/systemtap/runtime/transport/control.c: In function ‘_stp_ctl_write_cmd’:
include/linux/cred.h:343:25: error: incompatible types when initializing type ‘uid_t’ using type ‘kuid_t’
 #define current_euid() (current_cred_xxx(euid))
                         ^
/usr/share/systemtap/runtime/transport/control.c:41:15: note: in expansion of macro ‘current_euid’
  uid_t euid = current_euid();
               ^
In file included from /usr/share/systemtap/runtime/linux/print.c:17:0,
                 from /usr/share/systemtap/runtime/print.c:17,
                 from /usr/share/systemtap/runtime/runtime_context.h:22,
                 from /tmp/stapcEoS7h/stap_f4621118dc34d17850373d218d3dab98_4225_src.c:67:
/usr/share/systemtap/runtime/transport/transport.c: In function ‘_stp_transport_init’:
/usr/share/systemtap/runtime/transport/transport.c:344:11: error: incompatible types when assigning to type ‘uid_t’ from type ‘kuid_t’
  _stp_uid = current_uid();
           ^
/usr/share/systemtap/runtime/transport/transport.c:345:11: error: incompatible types when assigning to type ‘gid_t’ from type ‘kgid_t’
  _stp_gid = current_gid();
           ^
cc1: all warnings being treated as errors
make[1]: *** [/tmp/stapcEoS7h/stap_f4621118dc34d17850373d218d3dab98_4225_src.o] Error 1
make: *** [_module_/tmp/stapcEoS7h] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compilation failed. [man error::pass4]
Tip: /usr/share/doc/systemtap/README.Debian should help you get started.

[Test Case]

on a trusty system that's running a lts-vivid kernel, with the kernel dbgsym deb installed, simply create a dummy systemtap script and try to run it, e.g.

$ cat test.stap
#!/usr/bin/stap

probe kernel.function("find_module") {
  println("hello")
}
$ sudo stap test.stap

the above compliation failure will happen.

[Regression Potential]

As this only changes how systemtap uses the kernel header structures, the most likely regression is systemtap failing to compile on earlier kernels.

I tested on the trusty 3.13 kernel and the updated stap does still compile and run the test case above.

[Other Info]

The commits provided in the debdiff fix systemtap to correctly use the kernel header functions for the newer kernel; they are cherry-picked from upstream systemtap.

Revision history for this message
Dan Streetman (ddstreet) wrote :

From the upstream repo, git://sourceware.org/git/systemtap.git, these commits are required (in reverse chronological order):

4f570bf5df317f3d5275b8e8a0cb5de8c2232f25
c91d2e7cc991068fd701d75a4814db87913d57bd
22a78a3e79331f83932372f576eb8338543abb0f
f1676ba1a5f60281fe64f96fbef37d484da6204c
651a87924c22fffa0109694851ff013b1da4f50e
547f6291433b574186e82f4afe233b00b7eb242e

Revision history for this message
Dan Streetman (ddstreet) wrote :

In sequential order, with more detail:

==> 0001-Fixed-compile-problem-on-3.18-kernels-caused-by-remo.patch <==
From 547f6291433b574186e82f4afe233b00b7eb242e Mon Sep 17 00:00:00 2001
From: David Smith <email address hidden>
Date: Tue, 6 Jan 2015 10:07:01 -0600
Subject: [PATCH] Fixed compile problem on 3.18 kernels, caused by removal of

==> 0002-runtime-linux-3.14-porting-preempt_enable_no_resched.patch <==
From 651a87924c22fffa0109694851ff013b1da4f50e Mon Sep 17 00:00:00 2001
From: "Frank Ch. Eigler" <email address hidden>
Date: Fri, 7 Feb 2014 22:07:46 -0500
Subject: [PATCH 3/3] runtime: linux 3.14 porting: preempt_enable_no_resched

==> 0003-runtime-improve-the-preempt_enable_no_resched-copy.patch <==
From f1676ba1a5f60281fe64f96fbef37d484da6204c Mon Sep 17 00:00:00 2001
From: Josh Stone <email address hidden>
Date: Fri, 28 Mar 2014 13:53:15 -0700
Subject: [PATCH 4/4] runtime: improve the preempt_enable_no_resched copy

==> 0004-CONFIG_UIDGID_STRICT_TYPE_CHECKS-workaround-cont-d.patch <==
From 22a78a3e79331f83932372f576eb8338543abb0f Mon Sep 17 00:00:00 2001
From: "Frank Ch. Eigler" <email address hidden>
Date: Tue, 5 Nov 2013 16:07:54 -0500
Subject: [PATCH 5/5] CONFIG_UIDGID_STRICT_TYPE_CHECKS workaround, cont'd

==> 0005-runtime-linux-3.14-porting-userns-Remove-UIDGID_STRI.patch <==
From c91d2e7cc991068fd701d75a4814db87913d57bd Mon Sep 17 00:00:00 2001
From: "Frank Ch. Eigler" <email address hidden>
Date: Fri, 7 Feb 2014 21:50:59 -0500
Subject: [PATCH 5/5] runtime: linux 3.14 porting: userns: Remove

==> 0006-runtime-linux-3.14-porting-case-when-CONFIG_USER_NS-.patch <==
From 4f570bf5df317f3d5275b8e8a0cb5de8c2232f25 Mon Sep 17 00:00:00 2001
From: Victor Kamensky <email address hidden>
Date: Mon, 7 Apr 2014 22:23:39 -0700
Subject: [PATCH 5/5] runtime: linux 3.14 porting: case when CONFIG_USER_NS not
ddstreet@toughbook:~$

Revision history for this message
Dan Streetman (ddstreet) wrote :

note, the order of the patches I listed isn't chronological, just the order I pulled them in to fix the individual separate compile errors.

Revision history for this message
Dan Streetman (ddstreet) wrote :

i'll attach debdiffs shortly.

Revision history for this message
Dan Streetman (ddstreet) wrote :
Changed in systemtap (Ubuntu):
assignee: nobody → Dan Streetman (ddstreet)
Chris J Arges (arges)
Changed in systemtap (Ubuntu Trusty):
assignee: nobody → Dan Streetman (ddstreet)
Changed in systemtap (Ubuntu):
status: New → Fix Released
assignee: Dan Streetman (ddstreet) → nobody
Dan Streetman (ddstreet)
Changed in systemtap (Ubuntu Trusty):
status: New → In Progress
Dan Streetman (ddstreet)
Changed in systemtap (Ubuntu):
assignee: nobody → Dan Streetman (ddstreet)
Dan Streetman (ddstreet)
tags: added: sts-sru
Dan Streetman (ddstreet)
description: updated
Revision history for this message
Chris J Arges (arges) wrote : Please test proposed package

Hello Dan, or anyone else affected,

Accepted systemtap into trusty-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/systemtap/2.3-1ubuntu1.4 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in systemtap (Ubuntu Trusty):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Dan Streetman (ddstreet) wrote :

verified the package from -proposed fixes the complilation error on the vivid 3.19 kernel, and does not regress on the trusty 3.13 kernel.

tags: added: verification-done verification-trusty-done verification-vivid-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package systemtap - 2.3-1ubuntu1.4

---------------
systemtap (2.3-1ubuntu1.4) trusty; urgency=medium

  * debian/patches/0001-Fixed-compile-problem-on-3.18-kernels-caused-by-remo.patch,
    debian/patches/0002-runtime-linux-3.14-porting-preempt_enable_no_resched.patch,
    debian/patches/0003-runtime-improve-the-preempt_enable_no_resched-copy.patch,
    debian/patches/0004-CONFIG_UIDGID_STRICT_TYPE_CHECKS-workaround-cont-d.patch,
    debian/patches/0005-runtime-linux-3.14-porting-userns-Remove-UIDGID_STRI.patch,
    debian/patches/0006-runtime-linux-3.14-porting-case-when-CONFIG_USER_NS-.patch:
    backport support for lts-vivid kernel. LP: #1545173.

 -- Dan Streetman <email address hidden> Tue, 15 Mar 2016 10:35:26 +0100

Changed in systemtap (Ubuntu Trusty):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for systemtap has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Louis Bouchard (louis)
tags: removed: sts-sru
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.