diff options
author | Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> | 2019-06-20 18:42:39 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-06-21 15:32:35 +0100 |
commit | ff31e2860ab80ffecd3b273f40744daf96a4a184 (patch) | |
tree | 04dbc07d51cec77762347ff01a28da6ab62370af /meta/recipes-kernel/lttng | |
parent | 4a90501229bf42c2dcd193c050857e63dcec216a (diff) | |
download | poky-ff31e2860ab80ffecd3b273f40744daf96a4a184.tar.gz |
lttng-tools: update to 2.10.7
Remove upstreamed patches.
(From OE-Core rev: 4bd46974d5b80050a031688ecefa9e60df793163)
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel/lttng')
9 files changed, 4 insertions, 728 deletions
diff --git a/meta/recipes-kernel/lttng/lttng-tools/0001-Fix-tests-link-libpause_consumer-on-liblttng-ctl.patch b/meta/recipes-kernel/lttng/lttng-tools/0001-Fix-tests-link-libpause_consumer-on-liblttng-ctl.patch deleted file mode 100644 index df18dc842b..0000000000 --- a/meta/recipes-kernel/lttng/lttng-tools/0001-Fix-tests-link-libpause_consumer-on-liblttng-ctl.patch +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | From 7244eac44be929fabd6ed1333f96929ef8da564f Mon Sep 17 00:00:00 2001 | ||
2 | From: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> | ||
3 | Date: Tue, 19 Mar 2019 17:56:49 +0000 | ||
4 | Subject: [PATCH] fix: tests: link libpause_consumer on liblttng-ctl | ||
5 | |||
6 | This preload test library uses symbols from liblttng-ctl which are | ||
7 | resolved when preloaded by GLIBC but not by MUSL. | ||
8 | |||
9 | Upstream-Status: Accepted [f667fbd7f8b9512f9943edb2597c226fcc424ee9] | ||
10 | Backported to 2.11 and 2.10. | ||
11 | |||
12 | Signed-off-by: Michael Jeanson <mjeanson@efficios.com> | ||
13 | --- | ||
14 | tests/regression/tools/notification/Makefile.am | 5 ++++- | ||
15 | 1 file changed, 4 insertions(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/tests/regression/tools/notification/Makefile.am b/tests/regression/tools/notification/Makefile.am | ||
18 | index 41adc69..a352bb8 100644 | ||
19 | --- a/tests/regression/tools/notification/Makefile.am | ||
20 | +++ b/tests/regression/tools/notification/Makefile.am | ||
21 | @@ -20,7 +20,10 @@ FORCE_SHARED_LIB_OPTIONS = -module -shared -avoid-version \ | ||
22 | -rpath $(abs_builddir) | ||
23 | |||
24 | libpause_consumer_la_SOURCES = consumer_testpoints.c | ||
25 | -libpause_consumer_la_LIBADD = $(top_builddir)/src/common/libcommon.la $(DL_LIBS) | ||
26 | +libpause_consumer_la_LIBADD = \ | ||
27 | + $(top_builddir)/src/common/libcommon.la \ | ||
28 | + $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \ | ||
29 | + $(DL_LIBS) | ||
30 | libpause_consumer_la_LDFLAGS = $(FORCE_SHARED_LIB_OPTIONS) | ||
31 | noinst_LTLIBRARIES = libpause_consumer.la | ||
32 | |||
33 | -- | ||
34 | 2.17.1 | ||
35 | |||
diff --git a/meta/recipes-kernel/lttng/lttng-tools/0004-Skip-when-testapp-is-not-present.patch b/meta/recipes-kernel/lttng/lttng-tools/0001-Skip-when-testapp-is-not-present.patch index 6c9f7e462c..6c9f7e462c 100644 --- a/meta/recipes-kernel/lttng/lttng-tools/0004-Skip-when-testapp-is-not-present.patch +++ b/meta/recipes-kernel/lttng/lttng-tools/0001-Skip-when-testapp-is-not-present.patch | |||
diff --git a/meta/recipes-kernel/lttng/lttng-tools/0008-Fix-check-for-lttng-modules-presence-before-testing.patch b/meta/recipes-kernel/lttng/lttng-tools/0002-Fix-check-for-lttng-modules-presence-before-testing.patch index 784a07940a..784a07940a 100644 --- a/meta/recipes-kernel/lttng/lttng-tools/0008-Fix-check-for-lttng-modules-presence-before-testing.patch +++ b/meta/recipes-kernel/lttng/lttng-tools/0002-Fix-check-for-lttng-modules-presence-before-testing.patch | |||
diff --git a/meta/recipes-kernel/lttng/lttng-tools/0002-Fix-test-skip-test_getcpu_override-on-single-thread-.patch b/meta/recipes-kernel/lttng/lttng-tools/0002-Fix-test-skip-test_getcpu_override-on-single-thread-.patch deleted file mode 100644 index 5bb88d21e5..0000000000 --- a/meta/recipes-kernel/lttng/lttng-tools/0002-Fix-test-skip-test_getcpu_override-on-single-thread-.patch +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | From e7db27668a9d7fd279d45bc43f3a2d5847374e7b Mon Sep 17 00:00:00 2001 | ||
2 | From: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> | ||
3 | Date: Tue, 12 Mar 2019 12:04:58 -0400 | ||
4 | Subject: [PATCH lttng-tools 1/2] Fix: test: skip test_getcpu_override on | ||
5 | single thread system | ||
6 | |||
7 | There is no value in performing this test on single thread system | ||
8 | since the only valid value for the cpu field is 0. | ||
9 | |||
10 | This test currently fails on single thread system (i.e yocto runquemu) | ||
11 | on the test_getcpu_override_fail test case. | ||
12 | |||
13 | Upstream-Status: Accepted [f87d0ca370c17b597762f5ee218f0e821ed2452d] | ||
14 | Backported to 2.11 and 2.10 | ||
15 | |||
16 | Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> | ||
17 | --- | ||
18 | .../ust/getcpu-override/test_getcpu_override | 16 +++++++++++----- | ||
19 | 1 file changed, 11 insertions(+), 5 deletions(-) | ||
20 | |||
21 | diff --git a/tests/regression/ust/getcpu-override/test_getcpu_override b/tests/regression/ust/getcpu-override/test_getcpu_override | ||
22 | index 4ca385aeb..ee3e31953 100755 | ||
23 | --- a/tests/regression/ust/getcpu-override/test_getcpu_override | ||
24 | +++ b/tests/regression/ust/getcpu-override/test_getcpu_override | ||
25 | @@ -157,13 +157,19 @@ plan_tests $NUM_TESTS | ||
26 | |||
27 | print_test_banner "$TEST_DESC" | ||
28 | |||
29 | -if [ -x "$CURDIR/.libs/lttng-ust-getcpu-override-test.so" ]; then | ||
30 | - foundobj=1 | ||
31 | -else | ||
32 | - foundobj=0 | ||
33 | +if [ ! -x "$CURDIR/.libs/lttng-ust-getcpu-override-test.so" ]; then | ||
34 | + skip 0 "No shared object generated. Skipping all tests." $NUM_TESTS && exit 0 | ||
35 | +fi | ||
36 | + | ||
37 | +if [ "$num_cpus" -eq "1" ]; then | ||
38 | + # Skip the test since we cannot perform it as designed since N mod 1 | ||
39 | + # is always equals to zero. There is no point testing this on a system | ||
40 | + # with a single thread. LTTng-UST limits the get_cpu function to return | ||
41 | + # value inside the [0, NUM_CPU - 1] range for a valid event (present in | ||
42 | + # trace). | ||
43 | + skip 0 "Test system only have a single thread. Skipping all tests." $NUM_TESTS && exit 0 | ||
44 | fi | ||
45 | |||
46 | -skip $foundobj "No shared object generated. Skipping all tests." $NUM_TESTS && exit 0 | ||
47 | |||
48 | TESTS=( | ||
49 | test_getcpu_override_fail | ||
50 | -- | ||
51 | 2.17.1 | ||
52 | |||
diff --git a/meta/recipes-kernel/lttng/lttng-tools/0003-Fix-test-unit-the-tree-origin-can-be-a-symlink-itsel.patch b/meta/recipes-kernel/lttng/lttng-tools/0003-Fix-test-unit-the-tree-origin-can-be-a-symlink-itsel.patch deleted file mode 100644 index 822b26a367..0000000000 --- a/meta/recipes-kernel/lttng/lttng-tools/0003-Fix-test-unit-the-tree-origin-can-be-a-symlink-itsel.patch +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 | From 83d165442d1c3658b6bafa28ddade8ffee7092ad Mon Sep 17 00:00:00 2001 | ||
2 | From: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> | ||
3 | Date: Wed, 6 Mar 2019 16:46:49 -0500 | ||
4 | Subject: [PATCH lttng-tools 2/2] Fix: test: unit: the tree origin can be a | ||
5 | symlink itself | ||
6 | |||
7 | Problem: | ||
8 | |||
9 | The base tree is defined as "/tmp/.....XXXXXX". | ||
10 | On systems where "/tmp/" is itself a symlink utils_expand_path will | ||
11 | expand the tree origin itself. | ||
12 | |||
13 | For example on a base core-image-minimal Yocto build /tmp is a symlink | ||
14 | to "/var/tmp", which is a symlink to "/var/volatile". | ||
15 | |||
16 | utils_expand_path will return something like this for the symlink test: | ||
17 | "/var/volative/.....XXXXXX/...." which is the valid result. | ||
18 | |||
19 | Solution: | ||
20 | |||
21 | Simply use realpath on the tree_origin and use this path to perform the | ||
22 | test validation. | ||
23 | |||
24 | This work was performed in the effort to support yocto fully and be able | ||
25 | to run the test suite to detect problem as early as possible. | ||
26 | |||
27 | |||
28 | Upstream-Status: Accepted [f66e964a2e0c75f5e1a55fbcc963b1c5e2b4519d] | ||
29 | Backported to 2.11 and 2.10 | ||
30 | |||
31 | Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> | ||
32 | --- | ||
33 | tests/unit/test_utils_expand_path.c | 18 ++++++++++++++---- | ||
34 | 1 file changed, 14 insertions(+), 4 deletions(-) | ||
35 | |||
36 | diff --git a/tests/unit/test_utils_expand_path.c b/tests/unit/test_utils_expand_path.c | ||
37 | index d5cab002e..d047c207d 100644 | ||
38 | --- a/tests/unit/test_utils_expand_path.c | ||
39 | +++ b/tests/unit/test_utils_expand_path.c | ||
40 | @@ -281,8 +281,8 @@ error: | ||
41 | static void test_utils_expand_path(void) | ||
42 | { | ||
43 | char *result; | ||
44 | - char name[100], tmppath[PATH_MAX]; | ||
45 | - int i; | ||
46 | + char name[100], tmppath[PATH_MAX], real_tree_origin[PATH_MAX]; | ||
47 | + int i, treelen; | ||
48 | |||
49 | /* Test valid cases */ | ||
50 | for (i = 0; i < num_valid_tests; i++) { | ||
51 | @@ -295,14 +295,24 @@ static void test_utils_expand_path(void) | ||
52 | free(result); | ||
53 | } | ||
54 | |||
55 | + /* | ||
56 | + * Get the realpath for the tree_origin since it can itself be a | ||
57 | + * symlink. | ||
58 | + */ | ||
59 | + result = realpath(tree_origin, real_tree_origin); | ||
60 | + if (!result) { | ||
61 | + fail("realpath failed."); | ||
62 | + return; | ||
63 | + } | ||
64 | + | ||
65 | /* Test symlink tree cases */ | ||
66 | - int treelen = strlen(tree_origin) + 1; | ||
67 | + treelen = strlen(real_tree_origin) + 1; | ||
68 | for (i = 0; i < num_symlink_tests; i++) { | ||
69 | sprintf(name, "symlink tree test case: [tmppath/]%s", | ||
70 | symlink_tests_inputs[i].input); | ||
71 | |||
72 | snprintf(tmppath, PATH_MAX, "%s/%s", | ||
73 | - tree_origin, symlink_tests_inputs[i].input); | ||
74 | + real_tree_origin, symlink_tests_inputs[i].input); | ||
75 | result = utils_expand_path(tmppath); | ||
76 | ok(result != NULL && strcmp(result + treelen, | ||
77 | symlink_tests_inputs[i].expected_result) == 0, name); | ||
78 | -- | ||
79 | 2.17.1 | ||
80 | |||
diff --git a/meta/recipes-kernel/lttng/lttng-tools/0005-Tests-use-modprobe-to-test-for-the-presence-of-lttng.patch b/meta/recipes-kernel/lttng/lttng-tools/0005-Tests-use-modprobe-to-test-for-the-presence-of-lttng.patch deleted file mode 100644 index 16df3e610a..0000000000 --- a/meta/recipes-kernel/lttng/lttng-tools/0005-Tests-use-modprobe-to-test-for-the-presence-of-lttng.patch +++ /dev/null | |||
@@ -1,176 +0,0 @@ | |||
1 | From 9bc81a446d0a3ea9a884739eee48d3f14db3283c Mon Sep 17 00:00:00 2001 | ||
2 | From: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> | ||
3 | Date: Wed, 28 Mar 2018 15:21:26 -0400 | ||
4 | Subject: [PATCH lttng-tools] Tests: use modprobe to test for the presence of | ||
5 | lttng-modules | ||
6 | MIME-Version: 1.0 | ||
7 | Content-Type: text/plain; charset=UTF-8 | ||
8 | Content-Transfer-Encoding: 8bit | ||
9 | |||
10 | Upstream-Status: Backport [28702730192ae1ded06105c54c5dc] | ||
11 | |||
12 | Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> | ||
13 | Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com> | ||
14 | --- | ||
15 | tests/regression/tools/regen-metadata/test_kernel | 8 ++------ | ||
16 | tests/regression/tools/regen-statedump/test_kernel | 7 +------ | ||
17 | tests/regression/tools/snapshots/test_kernel | 9 +++------ | ||
18 | tests/regression/tools/snapshots/test_kernel_streaming | 8 ++------ | ||
19 | tests/regression/tools/streaming/test_kernel | 8 ++------ | ||
20 | tests/utils/utils.sh | 10 ++++++++++ | ||
21 | 6 files changed, 20 insertions(+), 30 deletions(-) | ||
22 | |||
23 | diff --git a/tests/regression/tools/regen-metadata/test_kernel b/tests/regression/tools/regen-metadata/test_kernel | ||
24 | index fd139aeef..1849b9cd0 100755 | ||
25 | --- a/tests/regression/tools/regen-metadata/test_kernel | ||
26 | +++ b/tests/regression/tools/regen-metadata/test_kernel | ||
27 | @@ -28,12 +28,6 @@ NUM_TESTS=18 | ||
28 | |||
29 | source $TESTDIR/utils/utils.sh | ||
30 | |||
31 | -# LTTng kernel modules check | ||
32 | -out=`ls /lib/modules/$(uname -r)/extra | grep lttng` | ||
33 | -if [ -z "$out" ]; then | ||
34 | - BAIL_OUT "LTTng modules not detected." | ||
35 | -fi | ||
36 | - | ||
37 | function lttng_create_session_uri | ||
38 | { | ||
39 | # Create session with default path | ||
40 | @@ -91,6 +85,8 @@ fi | ||
41 | |||
42 | skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || | ||
43 | { | ||
44 | + validate_lttng_modules_present | ||
45 | + | ||
46 | start_lttng_relayd "-o $TRACE_PATH" | ||
47 | start_lttng_sessiond | ||
48 | modprobe lttng-test | ||
49 | diff --git a/tests/regression/tools/regen-statedump/test_kernel b/tests/regression/tools/regen-statedump/test_kernel | ||
50 | index 85afe76a1..50054eb07 100755 | ||
51 | --- a/tests/regression/tools/regen-statedump/test_kernel | ||
52 | +++ b/tests/regression/tools/regen-statedump/test_kernel | ||
53 | @@ -29,12 +29,6 @@ NUM_TESTS=11 | ||
54 | |||
55 | source $TESTDIR/utils/utils.sh | ||
56 | |||
57 | -# LTTng kernel modules check | ||
58 | -out=`ls /lib/modules/$(uname -r)/extra | grep lttng` | ||
59 | -if [ -z "$out" ]; then | ||
60 | - BAIL_OUT "LTTng modules not detected." | ||
61 | -fi | ||
62 | - | ||
63 | function test_kernel_local () | ||
64 | { | ||
65 | diag "Test kernel local with statedump regeneration" | ||
66 | @@ -64,6 +58,7 @@ fi | ||
67 | |||
68 | skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || | ||
69 | { | ||
70 | + validate_lttng_modules_present | ||
71 | start_lttng_sessiond | ||
72 | modprobe lttng-test | ||
73 | |||
74 | diff --git a/tests/regression/tools/snapshots/test_kernel b/tests/regression/tools/snapshots/test_kernel | ||
75 | index 886c4557a..ff563100b 100755 | ||
76 | --- a/tests/regression/tools/snapshots/test_kernel | ||
77 | +++ b/tests/regression/tools/snapshots/test_kernel | ||
78 | @@ -29,12 +29,6 @@ NUM_TESTS=2060 | ||
79 | |||
80 | source $TESTDIR/utils/utils.sh | ||
81 | |||
82 | -# LTTng kernel modules check | ||
83 | -out=`ls /lib/modules/$(uname -r)/extra | grep lttng` | ||
84 | -if [ -z "$out" ]; then | ||
85 | - BAIL_OUT "LTTng modules not detected." | ||
86 | -fi | ||
87 | - | ||
88 | function test_kernel_local_snapshot () | ||
89 | { | ||
90 | diag "Test local kernel snapshots" | ||
91 | @@ -241,6 +235,9 @@ fi | ||
92 | |||
93 | skip $isroot "Root access is needed. Skipping all kernel snapshot tests." $NUM_TESTS || | ||
94 | { | ||
95 | + | ||
96 | + validate_lttng_modules_present | ||
97 | + | ||
98 | start_lttng_sessiond | ||
99 | |||
100 | #tests=( test_kernel_1000_local_snapshots ) | ||
101 | diff --git a/tests/regression/tools/snapshots/test_kernel_streaming b/tests/regression/tools/snapshots/test_kernel_streaming | ||
102 | index 7b96ef270..1d97519aa 100755 | ||
103 | --- a/tests/regression/tools/snapshots/test_kernel_streaming | ||
104 | +++ b/tests/regression/tools/snapshots/test_kernel_streaming | ||
105 | @@ -29,12 +29,6 @@ NUM_TESTS=61 | ||
106 | |||
107 | source $TESTDIR/utils/utils.sh | ||
108 | |||
109 | -# LTTng kernel modules check | ||
110 | -out=`ls /lib/modules/$(uname -r)/extra | grep lttng` | ||
111 | -if [ -z "$out" ]; then | ||
112 | - BAIL_OUT "LTTng modules not detected." | ||
113 | -fi | ||
114 | - | ||
115 | function snapshot_add_output () | ||
116 | { | ||
117 | local sess_name=$1 | ||
118 | @@ -169,6 +163,8 @@ fi | ||
119 | |||
120 | skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || | ||
121 | { | ||
122 | + validate_lttng_modules_present | ||
123 | + | ||
124 | start_lttng_relayd "-o $TRACE_PATH" | ||
125 | start_lttng_sessiond | ||
126 | |||
127 | diff --git a/tests/regression/tools/streaming/test_kernel b/tests/regression/tools/streaming/test_kernel | ||
128 | index d54bcedf5..6bb23d9f5 100755 | ||
129 | --- a/tests/regression/tools/streaming/test_kernel | ||
130 | +++ b/tests/regression/tools/streaming/test_kernel | ||
131 | @@ -28,12 +28,6 @@ NUM_TESTS=10 | ||
132 | |||
133 | source $TESTDIR/utils/utils.sh | ||
134 | |||
135 | -# LTTng kernel modules check | ||
136 | -out=`ls /lib/modules/$(uname -r)/extra | grep lttng` | ||
137 | -if [ -z "$out" ]; then | ||
138 | - BAIL_OUT "LTTng modules not detected." | ||
139 | -fi | ||
140 | - | ||
141 | function lttng_create_session_uri | ||
142 | { | ||
143 | # Create session with default path | ||
144 | @@ -80,6 +74,8 @@ fi | ||
145 | |||
146 | skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || | ||
147 | { | ||
148 | + validate_lttng_modules_present | ||
149 | + | ||
150 | start_lttng_relayd "-o $TRACE_PATH" | ||
151 | start_lttng_sessiond | ||
152 | |||
153 | diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh | ||
154 | index af63824ce..26e59e383 100644 | ||
155 | --- a/tests/utils/utils.sh | ||
156 | +++ b/tests/utils/utils.sh | ||
157 | @@ -125,6 +125,16 @@ function conf_proc_count() | ||
158 | echo | ||
159 | } | ||
160 | |||
161 | +# Check if base lttng-modules are present. | ||
162 | +# Bail out on failure | ||
163 | +function validate_lttng_modules_present () | ||
164 | +{ | ||
165 | + modprobe -n lttng-tracer 2>/dev/null | ||
166 | + if [ $? -ne 0 ]; then | ||
167 | + BAIL_OUT "LTTng modules not detected." | ||
168 | + fi | ||
169 | +} | ||
170 | + | ||
171 | function enable_kernel_lttng_event | ||
172 | { | ||
173 | local withtap="$1" | ||
174 | -- | ||
175 | 2.17.1 | ||
176 | |||
diff --git a/meta/recipes-kernel/lttng/lttng-tools/0006-Tests-check-for-lttng-modules-presence.patch b/meta/recipes-kernel/lttng/lttng-tools/0006-Tests-check-for-lttng-modules-presence.patch deleted file mode 100644 index 30aa66b2c8..0000000000 --- a/meta/recipes-kernel/lttng/lttng-tools/0006-Tests-check-for-lttng-modules-presence.patch +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | From 92f93238f1df005aadc98e105c0dd0e04a5955a7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> | ||
3 | Date: Mon, 25 Mar 2019 14:24:51 -0400 | ||
4 | Subject: [2/2] tests: check for lttng-modules presence | ||
5 | |||
6 | Upstream-Status: Accepted [5da3fc8579a9f93ea4767729a107784bf2d034ae] | ||
7 | Backported to 2.11 and 2.10 | ||
8 | |||
9 | Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> | ||
10 | --- | ||
11 | tests/regression/tools/notification/test_notification_kernel | 1 + | ||
12 | 1 file changed, 1 insertion(+) | ||
13 | |||
14 | diff --git a/tests/regression/tools/notification/test_notification_kernel b/tests/regression/tools/notification/test_notification_kernel | ||
15 | index 6d7f256ae..e7368df26 100755 | ||
16 | --- a/tests/regression/tools/notification/test_notification_kernel | ||
17 | +++ b/tests/regression/tools/notification/test_notification_kernel | ||
18 | @@ -108,6 +108,7 @@ function kernel_test | ||
19 | } | ||
20 | |||
21 | if [ "$(id -u)" == "0" ]; then | ||
22 | + validate_lttng_modules_present | ||
23 | kernel_test | ||
24 | else | ||
25 | # Kernel tests are skipped. | ||
26 | -- | ||
27 | 2.17.1 | ||
28 | |||
diff --git a/meta/recipes-kernel/lttng/lttng-tools/0007-Fix-getgrnam-is-not-MT-Safe-use-getgrnam_r.patch b/meta/recipes-kernel/lttng/lttng-tools/0007-Fix-getgrnam-is-not-MT-Safe-use-getgrnam_r.patch deleted file mode 100644 index a3362ea247..0000000000 --- a/meta/recipes-kernel/lttng/lttng-tools/0007-Fix-getgrnam-is-not-MT-Safe-use-getgrnam_r.patch +++ /dev/null | |||
@@ -1,347 +0,0 @@ | |||
1 | From 10e8001ad876d8cb3b5a17c7492e713bbc047975 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> | ||
3 | Date: Thu, 28 Mar 2019 18:31:29 -0400 | ||
4 | Subject: [PATCH] Fix: getgrnam is not MT-Safe, use getgrnam_r | ||
5 | |||
6 | Running the test suite under a Yocto musl build resulted in musl | ||
7 | coredump due to double freeing. | ||
8 | |||
9 | We get the following backtraces: | ||
10 | |||
11 | 0 a_crash () at ./arch/x86_64/atomic_arch.h:108 | ||
12 | 1 unmap_chunk (self=<optimized out>) at src/malloc/malloc.c:515 | ||
13 | 2 free (p=<optimized out>) at src/malloc/malloc.c:526 | ||
14 | 3 0x00007f46d9dc3849 in __getgrent_a (f=f@entry=0x7f46d9d1f7e0, gr=gr@entry=0x7f46d9e24460 <gr>, line=line@entry=0x7f46d9e26058 <line>, size=size@entry=0x7f46d92db550, mem=mem@entry=0x7f46d9e26050 <mem>, nmem=nmem@entry=0x7f46d92db558, res=0x7f46d92db548) at src/passwd/getgrent_a.c:45 | ||
15 | 4 0x00007f46d9dc2e6b in __getgr_a (name=0x487242 "tracing", gid=gid@entry=0, gr=gr@entry=0x7f46d9e24460 <gr>, buf=buf@entry=0x7f46d9e26058 <line>, size=size@entry=0x7f46d92db550, mem=mem@entry=0x7f46d9e26050 <mem>, nmem=0x7f46d92db558, res=0x7f46d92db548) at src/passwd/getgr_a.c:30 | ||
16 | 5 0x00007f46d9dc3733 in getgrnam (name=<optimized out>) at src/passwd/getgrent.c:37 | ||
17 | 6 0x0000000000460b29 in utils_get_group_id (name=<optimized out>) at ../../../lttng-tools-2.10.6/src/common/utils.c:1241 | ||
18 | 7 0x000000000044ee69 in thread_manage_health (data=<optimized out>) at ../../../../lttng-tools-2.10.6/src/bin/lttng-sessiond/main.c:4115 | ||
19 | 8 0x00007f46d9de1541 in start (p=<optimized out>) at src/thread/pthread_create.c:195 | ||
20 | 9 0x00007f46d9dee661 in __clone () at src/thread/x86_64/clone.s:22 | ||
21 | |||
22 | From another run: | ||
23 | |||
24 | 0 a_crash () at ./arch/x86_64/atomic_arch.h:108 | ||
25 | 1 unmap_chunk (self=<optimized out>) at src/malloc/malloc.c:515 | ||
26 | 2 free (p=<optimized out>) at src/malloc/malloc.c:526 | ||
27 | 3 0x00007f5abc210849 in __getgrent_a (f=f@entry=0x7f5abc2733e0, gr=gr@entry=0x7f5abc271460 <gr>, line=line@entry=0x7f5abc273058 <line>, size=size@entry=0x7f5abaef5510, mem=mem@entry=0x7f5abc273050 <mem>, nmem=nmem@entry=0x7f5abaef5518, res=0x7f5abaef5508) at src/passwd/getgrent_a.c:45 | ||
28 | 4 0x00007f5abc20fe6b in __getgr_a (name=0x487242 "tracing", gid=gid@entry=0, gr=gr@entry=0x7f5abc271460 <gr>, buf=buf@entry=0x7f5abc273058 <line>, size=size@entry=0x7f5abaef5510, mem=mem@entry=0x7f5abc273050 <mem>, nmem=0x7f5abaef5518, res=0x7f5abaef5508) at src/passwd/getgr_a.c:30 | ||
29 | 5 0x00007f5abc210733 in getgrnam (name=<optimized out>) at src/passwd/getgrent.c:37 | ||
30 | 6 0x0000000000460b29 in utils_get_group_id (name=<optimized out>) at ../../../lttng-tools-2.10.6/src/common/utils.c:1241 | ||
31 | 7 0x000000000042dee4 in notification_channel_socket_create () at ../../../../lttng-tools-2.10.6/src/bin/lttng-sessiond/notification-thread.c:238 | ||
32 | 8 init_thread_state (state=0x7f5abaef5560, handle=0x7f5abbf9be40) at ../../../../lttng-tools-2.10.6/src/bin/lttng-sessiond/notification-thread.c:375 | ||
33 | 9 thread_notification (data=0x7f5abbf9be40) at ../../../../lttng-tools-2.10.6/src/bin/lttng-sessiond/notification-thread.c:495 | ||
34 | 10 0x00007f5abc22e541 in start (p=<optimized out>) at src/thread/pthread_create.c:195 | ||
35 | 11 0x00007f5abc23b661 in __clone () at src/thread/x86_64/clone.s:22 | ||
36 | |||
37 | The problem was easily reproducible (~6 crash on ~300 runs). A prototype fix | ||
38 | using mutex around the getgrnam yielded no crash in over 1000 runs. This | ||
39 | patch yielded the same results as the prototype fix. | ||
40 | |||
41 | Unfortunately we cannot rely on a mutex in liblttng-ctl since we cannot | ||
42 | enforce the locking for the application using the lib. | ||
43 | |||
44 | Use getgrnam_r instead. | ||
45 | |||
46 | The previous implementation of utils_get_group_id returned the gid of | ||
47 | the root group (0) on error/not found. lttng_check_tracing_group needs | ||
48 | to know if an error/not found occured, returning the root group is not | ||
49 | enough. We now return the gid via the passed parameter. The caller is | ||
50 | responsible for either defaulting to the root group or propagating the | ||
51 | error. | ||
52 | |||
53 | We also do not want to warn when used in liblttng-ctl context. We might | ||
54 | want to move the warning elsewhere in the future. For now, pass a bool | ||
55 | if we need to warn or not. | ||
56 | |||
57 | Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> | ||
58 | |||
59 | Upstream-Status: Submitted [https://patchwork.lttng.org/patch/2314703] | ||
60 | --- | ||
61 | src/bin/lttng-consumerd/health-consumerd.c | 10 ++- | ||
62 | src/bin/lttng-relayd/health-relayd.c | 20 ++++-- | ||
63 | src/bin/lttng-sessiond/main.c | 24 +++++-- | ||
64 | src/bin/lttng-sessiond/notification-thread.c | 10 ++- | ||
65 | src/common/utils.c | 75 +++++++++++++++++--- | ||
66 | src/common/utils.h | 4 +- | ||
67 | src/lib/lttng-ctl/lttng-ctl.c | 8 +-- | ||
68 | 7 files changed, 122 insertions(+), 29 deletions(-) | ||
69 | |||
70 | diff --git a/src/bin/lttng-consumerd/health-consumerd.c b/src/bin/lttng-consumerd/health-consumerd.c | ||
71 | index 1e2f31e4..6045401a 100644 | ||
72 | --- a/src/bin/lttng-consumerd/health-consumerd.c | ||
73 | +++ b/src/bin/lttng-consumerd/health-consumerd.c | ||
74 | @@ -184,8 +184,14 @@ void *thread_manage_health(void *data) | ||
75 | is_root = !getuid(); | ||
76 | if (is_root) { | ||
77 | /* lttng health client socket path permissions */ | ||
78 | - ret = chown(health_unix_sock_path, 0, | ||
79 | - utils_get_group_id(tracing_group_name)); | ||
80 | + gid_t gid; | ||
81 | + | ||
82 | + ret = utils_get_group_id(tracing_group_name, true, &gid); | ||
83 | + if (ret) { | ||
84 | + gid = 0; /* Default to root group. */ | ||
85 | + } | ||
86 | + | ||
87 | + ret = chown(health_unix_sock_path, 0, gid); | ||
88 | if (ret < 0) { | ||
89 | ERR("Unable to set group on %s", health_unix_sock_path); | ||
90 | PERROR("chown"); | ||
91 | diff --git a/src/bin/lttng-relayd/health-relayd.c b/src/bin/lttng-relayd/health-relayd.c | ||
92 | index ba996621..962e88c4 100644 | ||
93 | --- a/src/bin/lttng-relayd/health-relayd.c | ||
94 | +++ b/src/bin/lttng-relayd/health-relayd.c | ||
95 | @@ -105,8 +105,14 @@ static int create_lttng_rundir_with_perm(const char *rundir) | ||
96 | int is_root = !getuid(); | ||
97 | |||
98 | if (is_root) { | ||
99 | - ret = chown(rundir, 0, | ||
100 | - utils_get_group_id(tracing_group_name)); | ||
101 | + gid_t gid; | ||
102 | + | ||
103 | + ret = utils_get_group_id(tracing_group_name, true, &gid); | ||
104 | + if (ret) { | ||
105 | + gid = 0; /* Default to root group.*/ | ||
106 | + } | ||
107 | + | ||
108 | + ret = chown(rundir, 0, gid); | ||
109 | if (ret < 0) { | ||
110 | ERR("Unable to set group on %s", rundir); | ||
111 | PERROR("chown"); | ||
112 | @@ -256,8 +262,14 @@ void *thread_manage_health(void *data) | ||
113 | is_root = !getuid(); | ||
114 | if (is_root) { | ||
115 | /* lttng health client socket path permissions */ | ||
116 | - ret = chown(health_unix_sock_path, 0, | ||
117 | - utils_get_group_id(tracing_group_name)); | ||
118 | + gid_t gid; | ||
119 | + | ||
120 | + ret = utils_get_group_id(tracing_group_name, true, &gid); | ||
121 | + if (ret) { | ||
122 | + gid = 0; /* Default to root group */ | ||
123 | + } | ||
124 | + | ||
125 | + ret = chown(health_unix_sock_path, 0, gid); | ||
126 | if (ret < 0) { | ||
127 | ERR("Unable to set group on %s", health_unix_sock_path); | ||
128 | PERROR("chown"); | ||
129 | diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c | ||
130 | index fa6fa483..49307064 100644 | ||
131 | --- a/src/bin/lttng-sessiond/main.c | ||
132 | +++ b/src/bin/lttng-sessiond/main.c | ||
133 | @@ -4112,8 +4112,14 @@ static void *thread_manage_health(void *data) | ||
134 | |||
135 | if (is_root) { | ||
136 | /* lttng health client socket path permissions */ | ||
137 | - ret = chown(config.health_unix_sock_path.value, 0, | ||
138 | - utils_get_group_id(config.tracing_group_name.value)); | ||
139 | + gid_t gid; | ||
140 | + | ||
141 | + ret = utils_get_group_id(config.tracing_group_name.value, true, &gid); | ||
142 | + if (ret) { | ||
143 | + gid = 0; /* Default to root group */ | ||
144 | + } | ||
145 | + | ||
146 | + ret = chown(config.health_unix_sock_path.value, 0, &gid); | ||
147 | if (ret < 0) { | ||
148 | ERR("Unable to set group on %s", config.health_unix_sock_path.value); | ||
149 | PERROR("chown"); | ||
150 | @@ -5238,7 +5244,10 @@ static int set_permissions(char *rundir) | ||
151 | int ret; | ||
152 | gid_t gid; | ||
153 | |||
154 | - gid = utils_get_group_id(config.tracing_group_name.value); | ||
155 | + ret = utils_get_group_id(config.tracing_group_name.value, true, &gid); | ||
156 | + if (ret) { | ||
157 | + gid = 0; /* Default to root group */ | ||
158 | + } | ||
159 | |||
160 | /* Set lttng run dir */ | ||
161 | ret = chown(rundir, 0, gid); | ||
162 | @@ -5349,7 +5358,14 @@ static int set_consumer_sockets(struct consumer_data *consumer_data) | ||
163 | goto error; | ||
164 | } | ||
165 | if (is_root) { | ||
166 | - ret = chown(path, 0, utils_get_group_id(config.tracing_group_name.value)); | ||
167 | + gid_t gid; | ||
168 | + | ||
169 | + ret = utils_get_group_id(config.tracing_group_name.value, true, &gid); | ||
170 | + if (ret) { | ||
171 | + gid = 0; /* Default to root group */ | ||
172 | + } | ||
173 | + | ||
174 | + ret = chown(path, 0, gid); | ||
175 | if (ret < 0) { | ||
176 | ERR("Unable to set group on %s", path); | ||
177 | PERROR("chown"); | ||
178 | diff --git a/src/bin/lttng-sessiond/notification-thread.c b/src/bin/lttng-sessiond/notification-thread.c | ||
179 | index 92ac597f..18a264d9 100644 | ||
180 | --- a/src/bin/lttng-sessiond/notification-thread.c | ||
181 | +++ b/src/bin/lttng-sessiond/notification-thread.c | ||
182 | @@ -235,8 +235,14 @@ int notification_channel_socket_create(void) | ||
183 | } | ||
184 | |||
185 | if (getuid() == 0) { | ||
186 | - ret = chown(sock_path, 0, | ||
187 | - utils_get_group_id(config.tracing_group_name.value)); | ||
188 | + gid_t gid; | ||
189 | + | ||
190 | + ret = utils_get_group_id(config.tracing_group_name.value, true, &gid); | ||
191 | + if (ret) { | ||
192 | + gid = 0; /* Default to root group. */ | ||
193 | + } | ||
194 | + | ||
195 | + ret = chown(sock_path, 0, gid); | ||
196 | if (ret) { | ||
197 | ERR("Failed to set the notification channel socket's group"); | ||
198 | ret = -1; | ||
199 | diff --git a/src/common/utils.c b/src/common/utils.c | ||
200 | index c0bb031e..778bc00f 100644 | ||
201 | --- a/src/common/utils.c | ||
202 | +++ b/src/common/utils.c | ||
203 | @@ -1231,24 +1231,77 @@ size_t utils_get_current_time_str(const char *format, char *dst, size_t len) | ||
204 | } | ||
205 | |||
206 | /* | ||
207 | - * Return the group ID matching name, else 0 if it cannot be found. | ||
208 | + * Return 0 on success and set *gid to the group_ID matching the passed name. | ||
209 | + * Else -1 if it cannot be found or an error occurred. | ||
210 | */ | ||
211 | LTTNG_HIDDEN | ||
212 | -gid_t utils_get_group_id(const char *name) | ||
213 | +int utils_get_group_id(const char *name, bool warn, gid_t *gid) | ||
214 | { | ||
215 | - struct group *grp; | ||
216 | + static volatile int warn_once; | ||
217 | |||
218 | - grp = getgrnam(name); | ||
219 | - if (!grp) { | ||
220 | - static volatile int warn_once; | ||
221 | + int ret; | ||
222 | + long sys_len; | ||
223 | + size_t len; | ||
224 | + struct group grp; | ||
225 | + struct group *result; | ||
226 | + char *buffer = NULL; | ||
227 | |||
228 | - if (!warn_once) { | ||
229 | - WARN("No tracing group detected"); | ||
230 | - warn_once = 1; | ||
231 | + /* Get the system limit if it exists */ | ||
232 | + sys_len = sysconf(_SC_GETGR_R_SIZE_MAX); | ||
233 | + if (sys_len == -1) { | ||
234 | + len = 1024; | ||
235 | + } else { | ||
236 | + len = (size_t) sys_len; | ||
237 | + } | ||
238 | + | ||
239 | + buffer = malloc(len); | ||
240 | + if (!buffer) { | ||
241 | + PERROR("getgrnam_r malloc"); | ||
242 | + ret = -1; | ||
243 | + goto error; | ||
244 | + } | ||
245 | + | ||
246 | + while ((ret = getgrnam_r(name, &grp, buffer, len, &result)) == ERANGE) | ||
247 | + { | ||
248 | + /* Buffer is not big enough, increase its size. */ | ||
249 | + size_t new_len = 2 * len; | ||
250 | + char *new_buffer = NULL; | ||
251 | + if (new_len < len) { | ||
252 | + ERR("getgrnam_r buffer size overflow"); | ||
253 | + ret = -1; | ||
254 | + goto error; | ||
255 | + } | ||
256 | + len = new_len; | ||
257 | + new_buffer = realloc(buffer, len); | ||
258 | + if (!new_buffer) { | ||
259 | + PERROR("getgrnam_r realloc"); | ||
260 | + ret = -1; | ||
261 | + goto error; | ||
262 | } | ||
263 | - return 0; | ||
264 | + buffer = new_buffer; | ||
265 | + } | ||
266 | + if (ret != 0) { | ||
267 | + PERROR("getgrnam_r"); | ||
268 | + ret = -1; | ||
269 | + goto error; | ||
270 | + } | ||
271 | + | ||
272 | + /* Group not found. */ | ||
273 | + if (!result) { | ||
274 | + ret = -1; | ||
275 | + goto error; | ||
276 | + } | ||
277 | + | ||
278 | + *gid = result->gr_gid; | ||
279 | + ret = 0; | ||
280 | + | ||
281 | +error: | ||
282 | + free(buffer); | ||
283 | + if (ret && warn && !warn_once) { | ||
284 | + WARN("No tracing group detected"); | ||
285 | + warn_once = 1; | ||
286 | } | ||
287 | - return grp->gr_gid; | ||
288 | + return ret; | ||
289 | } | ||
290 | |||
291 | /* | ||
292 | diff --git a/src/common/utils.h b/src/common/utils.h | ||
293 | index 18f19ef1..9c72431d 100644 | ||
294 | --- a/src/common/utils.h | ||
295 | +++ b/src/common/utils.h | ||
296 | @@ -22,6 +22,8 @@ | ||
297 | #include <unistd.h> | ||
298 | #include <stdint.h> | ||
299 | #include <getopt.h> | ||
300 | +#include <stdbool.h> | ||
301 | +#include <sys/types.h> | ||
302 | |||
303 | #define KIBI_LOG2 10 | ||
304 | #define MEBI_LOG2 20 | ||
305 | @@ -52,7 +54,7 @@ int utils_get_count_order_u64(uint64_t x); | ||
306 | char *utils_get_home_dir(void); | ||
307 | char *utils_get_user_home_dir(uid_t uid); | ||
308 | size_t utils_get_current_time_str(const char *format, char *dst, size_t len); | ||
309 | -gid_t utils_get_group_id(const char *name); | ||
310 | +int utils_get_group_id(const char *name, bool warn, gid_t *gid); | ||
311 | char *utils_generate_optstring(const struct option *long_options, | ||
312 | size_t opt_count); | ||
313 | int utils_create_lock_file(const char *filepath); | ||
314 | diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c | ||
315 | index 2d84aad9..561b0bcf 100644 | ||
316 | --- a/src/lib/lttng-ctl/lttng-ctl.c | ||
317 | +++ b/src/lib/lttng-ctl/lttng-ctl.c | ||
318 | @@ -208,15 +208,13 @@ end: | ||
319 | LTTNG_HIDDEN | ||
320 | int lttng_check_tracing_group(void) | ||
321 | { | ||
322 | - struct group *grp_tracing; /* no free(). See getgrnam(3) */ | ||
323 | - gid_t *grp_list; | ||
324 | + gid_t *grp_list, tracing_gid; | ||
325 | int grp_list_size, grp_id, i; | ||
326 | int ret = -1; | ||
327 | const char *grp_name = tracing_group; | ||
328 | |||
329 | /* Get GID of group 'tracing' */ | ||
330 | - grp_tracing = getgrnam(grp_name); | ||
331 | - if (!grp_tracing) { | ||
332 | + if (utils_get_group_id(grp_name, false, &tracing_gid)) { | ||
333 | /* If grp_tracing is NULL, the group does not exist. */ | ||
334 | goto end; | ||
335 | } | ||
336 | @@ -241,7 +239,7 @@ int lttng_check_tracing_group(void) | ||
337 | } | ||
338 | |||
339 | for (i = 0; i < grp_list_size; i++) { | ||
340 | - if (grp_list[i] == grp_tracing->gr_gid) { | ||
341 | + if (grp_list[i] == tracing_gid) { | ||
342 | ret = 1; | ||
343 | break; | ||
344 | } | ||
345 | -- | ||
346 | 2.17.1 | ||
347 | |||
diff --git a/meta/recipes-kernel/lttng/lttng-tools_2.10.6.bb b/meta/recipes-kernel/lttng/lttng-tools_2.10.7.bb index 58c7864c30..469ad111c4 100644 --- a/meta/recipes-kernel/lttng/lttng-tools_2.10.6.bb +++ b/meta/recipes-kernel/lttng/lttng-tools_2.10.7.bb | |||
@@ -32,18 +32,12 @@ SRC_URI = "https://lttng.org/files/lttng-tools/lttng-tools-${PV}.tar.bz2 \ | |||
32 | file://x32.patch \ | 32 | file://x32.patch \ |
33 | file://run-ptest \ | 33 | file://run-ptest \ |
34 | file://lttng-sessiond.service \ | 34 | file://lttng-sessiond.service \ |
35 | file://0001-Fix-tests-link-libpause_consumer-on-liblttng-ctl.patch \ | 35 | file://0001-Skip-when-testapp-is-not-present.patch \ |
36 | file://0002-Fix-test-skip-test_getcpu_override-on-single-thread-.patch \ | 36 | file://0002-Fix-check-for-lttng-modules-presence-before-testing.patch \ |
37 | file://0003-Fix-test-unit-the-tree-origin-can-be-a-symlink-itsel.patch \ | ||
38 | file://0004-Skip-when-testapp-is-not-present.patch\ | ||
39 | file://0005-Tests-use-modprobe-to-test-for-the-presence-of-lttng.patch \ | ||
40 | file://0006-Tests-check-for-lttng-modules-presence.patch \ | ||
41 | file://0007-Fix-getgrnam-is-not-MT-Safe-use-getgrnam_r.patch \ | ||
42 | file://0008-Fix-check-for-lttng-modules-presence-before-testing.patch \ | ||
43 | " | 37 | " |
44 | 38 | ||
45 | SRC_URI[md5sum] = "e88c521b5da6bb48a8187af633336ecc" | 39 | SRC_URI[md5sum] = "e7804d10e4cade381e241601f6047373" |
46 | SRC_URI[sha256sum] = "f05df52bbebf8ce88d1b29e9e98cfc957d2ed738a345118018237ebdb581537c" | 40 | SRC_URI[sha256sum] = "ed71ebe00c5d985c74f30e97b614e909573cbd9276c85e05d9557a0b817a1312" |
47 | 41 | ||
48 | inherit autotools ptest pkgconfig useradd python3-dir manpages systemd | 42 | inherit autotools ptest pkgconfig useradd python3-dir manpages systemd |
49 | 43 | ||