summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel
diff options
context:
space:
mode:
authorSaul Wold <sgw@linux.intel.com>2014-11-17 16:18:34 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-11-26 17:05:47 +0000
commit9e8bb322154e67e521e8c982d20d46dda20c024b (patch)
treed2cdedec45cdecab75af8922975470d435913cc3 /meta/recipes-kernel
parentaa8bfdfa22e2e8c6828d7fea7b653d1e839d7301 (diff)
downloadpoky-9e8bb322154e67e521e8c982d20d46dda20c024b.tar.gz
babeltrace: Backport fix for unaligned integer
[YOCTO #6464] (From OE-Core rev: 7c04085a0b5f978d7fd07f83b0799abbeb3b7052) Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel')
-rw-r--r--meta/recipes-kernel/lttng/babeltrace/0001-Fix-don-t-perform-unaligned-integer-read-writes.patch252
-rw-r--r--meta/recipes-kernel/lttng/babeltrace_1.2.1.bb1
2 files changed, 253 insertions, 0 deletions
diff --git a/meta/recipes-kernel/lttng/babeltrace/0001-Fix-don-t-perform-unaligned-integer-read-writes.patch b/meta/recipes-kernel/lttng/babeltrace/0001-Fix-don-t-perform-unaligned-integer-read-writes.patch
new file mode 100644
index 0000000000..ea0aad699d
--- /dev/null
+++ b/meta/recipes-kernel/lttng/babeltrace/0001-Fix-don-t-perform-unaligned-integer-read-writes.patch
@@ -0,0 +1,252 @@
1From 6a0b6cd5133db9e3c72914d4e5dd7fc792360934 Mon Sep 17 00:00:00 2001
2From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3Date: Wed, 16 Jul 2014 10:58:48 -0400
4Subject: [PATCH] Fix: don't perform unaligned integer read/writes
5
6Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7
8Upstream-Status: Backport
9Signed-off-by: Saul Wold <sgw@linux.intel.com>
10
11---
12 formats/ctf/types/integer.c | 108 ++++++++++++++++++++++++++++----------------
13 1 file changed, 70 insertions(+), 38 deletions(-)
14
15diff --git a/formats/ctf/types/integer.c b/formats/ctf/types/integer.c
16index 189943e..85931be 100644
17--- a/formats/ctf/types/integer.c
18+++ b/formats/ctf/types/integer.c
19@@ -62,7 +62,7 @@ int _aligned_integer_read(struct bt_stream_pos *ppos,
20 {
21 uint8_t v;
22
23- v = *(const uint8_t *) ctf_get_pos_addr(pos);
24+ memcpy(&v, ctf_get_pos_addr(pos), sizeof(v));
25 integer_definition->value._unsigned = v;
26 break;
27 }
28@@ -70,7 +70,7 @@ int _aligned_integer_read(struct bt_stream_pos *ppos,
29 {
30 uint16_t v;
31
32- v = *(const uint16_t *) ctf_get_pos_addr(pos);
33+ memcpy(&v, ctf_get_pos_addr(pos), sizeof(v));
34 integer_definition->value._unsigned =
35 rbo ? GUINT16_SWAP_LE_BE(v) : v;
36 break;
37@@ -79,7 +79,7 @@ int _aligned_integer_read(struct bt_stream_pos *ppos,
38 {
39 uint32_t v;
40
41- v = *(const uint32_t *) ctf_get_pos_addr(pos);
42+ memcpy(&v, ctf_get_pos_addr(pos), sizeof(v));
43 integer_definition->value._unsigned =
44 rbo ? GUINT32_SWAP_LE_BE(v) : v;
45 break;
46@@ -88,7 +88,7 @@ int _aligned_integer_read(struct bt_stream_pos *ppos,
47 {
48 uint64_t v;
49
50- v = *(const uint64_t *) ctf_get_pos_addr(pos);
51+ memcpy(&v, ctf_get_pos_addr(pos), sizeof(v));
52 integer_definition->value._unsigned =
53 rbo ? GUINT64_SWAP_LE_BE(v) : v;
54 break;
55@@ -102,7 +102,7 @@ int _aligned_integer_read(struct bt_stream_pos *ppos,
56 {
57 int8_t v;
58
59- v = *(const int8_t *) ctf_get_pos_addr(pos);
60+ memcpy(&v, ctf_get_pos_addr(pos), sizeof(v));
61 integer_definition->value._signed = v;
62 break;
63 }
64@@ -110,7 +110,7 @@ int _aligned_integer_read(struct bt_stream_pos *ppos,
65 {
66 int16_t v;
67
68- v = *(const int16_t *) ctf_get_pos_addr(pos);
69+ memcpy(&v, ctf_get_pos_addr(pos), sizeof(v));
70 integer_definition->value._signed =
71 rbo ? (int16_t) GUINT16_SWAP_LE_BE(v) : v;
72 break;
73@@ -119,7 +119,7 @@ int _aligned_integer_read(struct bt_stream_pos *ppos,
74 {
75 int32_t v;
76
77- v = *(const int32_t *) ctf_get_pos_addr(pos);
78+ memcpy(&v, ctf_get_pos_addr(pos), sizeof(v));
79 integer_definition->value._signed =
80 rbo ? (int32_t) GUINT32_SWAP_LE_BE(v) : v;
81 break;
82@@ -128,7 +128,7 @@ int _aligned_integer_read(struct bt_stream_pos *ppos,
83 {
84 int64_t v;
85
86- v = *(const int64_t *) ctf_get_pos_addr(pos);
87+ memcpy(&v, ctf_get_pos_addr(pos), sizeof(v));
88 integer_definition->value._signed =
89 rbo ? (int64_t) GUINT64_SWAP_LE_BE(v) : v;
90 break;
91@@ -163,48 +163,80 @@ int _aligned_integer_write(struct bt_stream_pos *ppos,
92 if (pos->dummy)
93 goto end;
94 if (!integer_declaration->signedness) {
95- uint64_t v = integer_definition->value._unsigned;
96-
97 switch (integer_declaration->len) {
98- case 8: *(uint8_t *) ctf_get_pos_addr(pos) = (uint8_t) v;
99+ case 8:
100+ {
101+ uint8_t v = integer_definition->value._unsigned;
102+
103+ memcpy(ctf_get_pos_addr(pos), &v, sizeof(v));
104 break;
105+ }
106 case 16:
107- *(uint16_t *) ctf_get_pos_addr(pos) = rbo ?
108- GUINT16_SWAP_LE_BE((uint16_t) v) :
109- (uint16_t) v;
110+ {
111+ uint16_t v = integer_definition->value._unsigned;
112+
113+ if (rbo)
114+ v = GUINT16_SWAP_LE_BE(v);
115+ memcpy(ctf_get_pos_addr(pos), &v, sizeof(v));
116 break;
117+ }
118 case 32:
119- *(uint32_t *) ctf_get_pos_addr(pos) = rbo ?
120- GUINT32_SWAP_LE_BE((uint32_t) v) :
121- (uint32_t) v;
122+ {
123+ uint32_t v = integer_definition->value._unsigned;
124+
125+ if (rbo)
126+ v = GUINT32_SWAP_LE_BE(v);
127+ memcpy(ctf_get_pos_addr(pos), &v, sizeof(v));
128 break;
129+ }
130 case 64:
131- *(uint64_t *) ctf_get_pos_addr(pos) = rbo ?
132- GUINT64_SWAP_LE_BE(v) : v;
133+ {
134+ uint64_t v = integer_definition->value._unsigned;
135+
136+ if (rbo)
137+ v = GUINT64_SWAP_LE_BE(v);
138+ memcpy(ctf_get_pos_addr(pos), &v, sizeof(v));
139 break;
140+ }
141 default:
142 assert(0);
143 }
144 } else {
145- int64_t v = integer_definition->value._signed;
146-
147 switch (integer_declaration->len) {
148- case 8: *(int8_t *) ctf_get_pos_addr(pos) = (int8_t) v;
149+ case 8:
150+ {
151+ uint8_t v = integer_definition->value._signed;
152+
153+ memcpy(ctf_get_pos_addr(pos), &v, sizeof(v));
154 break;
155+ }
156 case 16:
157- *(int16_t *) ctf_get_pos_addr(pos) = rbo ?
158- (int16_t) GUINT16_SWAP_LE_BE((int16_t) v) :
159- (int16_t) v;
160+ {
161+ int16_t v = integer_definition->value._signed;
162+
163+ if (rbo)
164+ v = GUINT16_SWAP_LE_BE(v);
165+ memcpy(ctf_get_pos_addr(pos), &v, sizeof(v));
166 break;
167+ }
168 case 32:
169- *(int32_t *) ctf_get_pos_addr(pos) = rbo ?
170- (int32_t) GUINT32_SWAP_LE_BE((int32_t) v) :
171- (int32_t) v;
172+ {
173+ int32_t v = integer_definition->value._signed;
174+
175+ if (rbo)
176+ v = GUINT32_SWAP_LE_BE(v);
177+ memcpy(ctf_get_pos_addr(pos), &v, sizeof(v));
178 break;
179+ }
180 case 64:
181- *(int64_t *) ctf_get_pos_addr(pos) = rbo ?
182- GUINT64_SWAP_LE_BE(v) : v;
183+ {
184+ int64_t v = integer_definition->value._signed;
185+
186+ if (rbo)
187+ v = GUINT64_SWAP_LE_BE(v);
188+ memcpy(ctf_get_pos_addr(pos), &v, sizeof(v));
189 break;
190+ }
191 default:
192 assert(0);
193 }
194@@ -237,23 +269,23 @@ int ctf_integer_read(struct bt_stream_pos *ppos, struct bt_definition *definitio
195 if (!integer_declaration->signedness) {
196 if (integer_declaration->byte_order == LITTLE_ENDIAN)
197 bt_bitfield_read_le(mmap_align_addr(pos->base_mma) +
198- pos->mmap_base_offset, unsigned long,
199+ pos->mmap_base_offset, unsigned char,
200 pos->offset, integer_declaration->len,
201 &integer_definition->value._unsigned);
202 else
203 bt_bitfield_read_be(mmap_align_addr(pos->base_mma) +
204- pos->mmap_base_offset, unsigned long,
205+ pos->mmap_base_offset, unsigned char,
206 pos->offset, integer_declaration->len,
207 &integer_definition->value._unsigned);
208 } else {
209 if (integer_declaration->byte_order == LITTLE_ENDIAN)
210 bt_bitfield_read_le(mmap_align_addr(pos->base_mma) +
211- pos->mmap_base_offset, unsigned long,
212+ pos->mmap_base_offset, unsigned char,
213 pos->offset, integer_declaration->len,
214 &integer_definition->value._signed);
215 else
216 bt_bitfield_read_be(mmap_align_addr(pos->base_mma) +
217- pos->mmap_base_offset, unsigned long,
218+ pos->mmap_base_offset, unsigned char,
219 pos->offset, integer_declaration->len,
220 &integer_definition->value._signed);
221 }
222@@ -286,23 +318,23 @@ int ctf_integer_write(struct bt_stream_pos *ppos, struct bt_definition *definiti
223 if (!integer_declaration->signedness) {
224 if (integer_declaration->byte_order == LITTLE_ENDIAN)
225 bt_bitfield_write_le(mmap_align_addr(pos->base_mma) +
226- pos->mmap_base_offset, unsigned long,
227+ pos->mmap_base_offset, unsigned char,
228 pos->offset, integer_declaration->len,
229 integer_definition->value._unsigned);
230 else
231 bt_bitfield_write_be(mmap_align_addr(pos->base_mma) +
232- pos->mmap_base_offset, unsigned long,
233+ pos->mmap_base_offset, unsigned char,
234 pos->offset, integer_declaration->len,
235 integer_definition->value._unsigned);
236 } else {
237 if (integer_declaration->byte_order == LITTLE_ENDIAN)
238 bt_bitfield_write_le(mmap_align_addr(pos->base_mma) +
239- pos->mmap_base_offset, unsigned long,
240+ pos->mmap_base_offset, unsigned char,
241 pos->offset, integer_declaration->len,
242 integer_definition->value._signed);
243 else
244 bt_bitfield_write_be(mmap_align_addr(pos->base_mma) +
245- pos->mmap_base_offset, unsigned long,
246+ pos->mmap_base_offset, unsigned char,
247 pos->offset, integer_declaration->len,
248 integer_definition->value._signed);
249 }
250--
2511.8.3.1
252
diff --git a/meta/recipes-kernel/lttng/babeltrace_1.2.1.bb b/meta/recipes-kernel/lttng/babeltrace_1.2.1.bb
index dd9961cde6..1c41e25827 100644
--- a/meta/recipes-kernel/lttng/babeltrace_1.2.1.bb
+++ b/meta/recipes-kernel/lttng/babeltrace_1.2.1.bb
@@ -16,6 +16,7 @@ PV = "1.2.1+git${SRCPV}"
16SRC_URI = "git://git.efficios.com/babeltrace.git;branch=stable-1.2 \ 16SRC_URI = "git://git.efficios.com/babeltrace.git;branch=stable-1.2 \
17 file://0001-Fix-Support-out-of-tree-builds-in-babeltrace.patch \ 17 file://0001-Fix-Support-out-of-tree-builds-in-babeltrace.patch \
18 file://Fix-Align-buffers-from-objstack_alloc-on-sizeof-void.patch \ 18 file://Fix-Align-buffers-from-objstack_alloc-on-sizeof-void.patch \
19 file://0001-Fix-don-t-perform-unaligned-integer-read-writes.patch \
19" 20"
20 21
21S = "${WORKDIR}/git" 22S = "${WORKDIR}/git"