Accepting request 724409 from home:1Antoine1:branches:Base:System
- Fix build with GCC 9 (boo#1121404, bko#202213): * Add bluez-5.50-gcc9.patch. OBS-URL: https://build.opensuse.org/request/show/724409 OBS-URL: https://build.opensuse.org/package/show/Base:System/bluez?expand=0&rev=269
This commit is contained in:
parent
2519809a6e
commit
f1edc4ec48
321
bluez-5.50-gcc9.patch
Normal file
321
bluez-5.50-gcc9.patch
Normal file
@ -0,0 +1,321 @@
|
||||
From 0be5246170f76a476101aa2dd7e748937363a1dc Mon Sep 17 00:00:00 2001
|
||||
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
|
||||
Date: Fri, 11 Jan 2019 10:16:17 -0300
|
||||
Subject: unit: Fix fsanitize-address-use-after-scope with GCC 9
|
||||
|
||||
Raw data payload must be copied since the declaration goes out of
|
||||
scope:
|
||||
|
||||
Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=202213
|
||||
|
||||
---
|
||||
From: Antoine Belvire <antoine.belvire@opensuse.org>
|
||||
|
||||
Trivial rebase to apply on bluez 5.50 (only test-gatt.c hunk #4 modified).
|
||||
|
||||
---
|
||||
unit/test-avctp.c | 9 +++++++--
|
||||
unit/test-avdtp.c | 13 +++++++++----
|
||||
unit/test-avrcp.c | 15 ++++++++++-----
|
||||
unit/test-gatt.c | 11 +++++++++--
|
||||
unit/test-hfp.c | 13 +++++++++----
|
||||
unit/test-hog.c | 10 +++++-----
|
||||
unit/test-sdp.c | 6 +++---
|
||||
7 files changed, 52 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/unit/test-avctp.c b/unit/test-avctp.c
|
||||
index 60fd6ad71..c92618bab 100644
|
||||
--- a/unit/test-avctp.c
|
||||
+++ b/unit/test-avctp.c
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
struct test_pdu {
|
||||
bool valid;
|
||||
- const uint8_t *data;
|
||||
+ uint8_t *data;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
@@ -66,7 +66,7 @@ struct context {
|
||||
#define raw_pdu(args...) \
|
||||
{ \
|
||||
.valid = true, \
|
||||
- .data = data(args), \
|
||||
+ .data = g_memdup(data(args), sizeof(data(args))), \
|
||||
.size = sizeof(data(args)), \
|
||||
}
|
||||
|
||||
@@ -84,6 +84,11 @@ struct context {
|
||||
static void test_free(gconstpointer user_data)
|
||||
{
|
||||
const struct test_data *data = user_data;
|
||||
+ struct test_pdu *pdu;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++)
|
||||
+ g_free(pdu->data);
|
||||
|
||||
g_free(data->test_name);
|
||||
g_free(data->pdu_list);
|
||||
diff --git a/unit/test-avdtp.c b/unit/test-avdtp.c
|
||||
index 176852ae7..13c03d037 100644
|
||||
--- a/unit/test-avdtp.c
|
||||
+++ b/unit/test-avdtp.c
|
||||
@@ -47,7 +47,7 @@
|
||||
struct test_pdu {
|
||||
bool valid;
|
||||
bool fragmented;
|
||||
- const uint8_t *data;
|
||||
+ uint8_t *data;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
@@ -61,7 +61,7 @@ struct test_data {
|
||||
#define raw_pdu(args...) \
|
||||
{ \
|
||||
.valid = true, \
|
||||
- .data = data(args), \
|
||||
+ .data = g_memdup(data(args), sizeof(data(args))), \
|
||||
.size = sizeof(data(args)), \
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ struct test_data {
|
||||
{ \
|
||||
.valid = true, \
|
||||
.fragmented = true, \
|
||||
- .data = data(args), \
|
||||
+ .data = g_memdup(data(args), sizeof(data(args))), \
|
||||
.size = sizeof(data(args)), \
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ struct test_data {
|
||||
static struct test_data data; \
|
||||
data.test_name = g_strdup(name); \
|
||||
data.pdu_list = g_memdup(pdus, sizeof(pdus)); \
|
||||
- tester_add(name, &data, NULL, function, NULL); \
|
||||
+ tester_add(name, &data, NULL, function, NULL); \
|
||||
} while (0)
|
||||
|
||||
struct context {
|
||||
@@ -102,6 +102,11 @@ struct context {
|
||||
static void test_free(gconstpointer user_data)
|
||||
{
|
||||
const struct test_data *data = user_data;
|
||||
+ struct test_pdu *pdu;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++)
|
||||
+ g_free(pdu->data);
|
||||
|
||||
g_free(data->test_name);
|
||||
g_free(data->pdu_list);
|
||||
diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
|
||||
index 9ffd44cfd..adf25f002 100644
|
||||
--- a/unit/test-avrcp.c
|
||||
+++ b/unit/test-avrcp.c
|
||||
@@ -49,7 +49,7 @@ struct test_pdu {
|
||||
bool fragmented;
|
||||
bool continuing;
|
||||
bool browse;
|
||||
- const uint8_t *data;
|
||||
+ uint8_t *data;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
@@ -74,7 +74,7 @@ struct context {
|
||||
#define raw_pdu(args...) \
|
||||
{ \
|
||||
.valid = true, \
|
||||
- .data = data(args), \
|
||||
+ .data = g_memdup(data(args), sizeof(data(args))), \
|
||||
.size = sizeof(data(args)), \
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ struct context {
|
||||
{ \
|
||||
.valid = true, \
|
||||
.browse = true, \
|
||||
- .data = data(args), \
|
||||
+ .data = g_memdup(data(args), sizeof(data(args))), \
|
||||
.size = sizeof(data(args)), \
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ struct context {
|
||||
{ \
|
||||
.valid = true, \
|
||||
.fragmented = true, \
|
||||
- .data = data(args), \
|
||||
+ .data = g_memdup(data(args), sizeof(data(args))), \
|
||||
.size = sizeof(data(args)), \
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ struct context {
|
||||
{ \
|
||||
.valid = true, \
|
||||
.continuing = true, \
|
||||
- .data = data(args), \
|
||||
+ .data = g_memdup(data(args), sizeof(data(args))), \
|
||||
.size = sizeof(data(args)), \
|
||||
}
|
||||
|
||||
@@ -116,6 +116,11 @@ struct context {
|
||||
static void test_free(gconstpointer user_data)
|
||||
{
|
||||
const struct test_data *data = user_data;
|
||||
+ struct test_pdu *pdu;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++)
|
||||
+ g_free(pdu->data);
|
||||
|
||||
g_free(data->test_name);
|
||||
g_free(data->pdu_list);
|
||||
diff --git a/unit/test-gatt.c b/unit/test-gatt.c
|
||||
index d8d007386..e35271b61 100644
|
||||
--- a/unit/test-gatt.c
|
||||
+++ b/unit/test-gatt.c
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
struct test_pdu {
|
||||
bool valid;
|
||||
- const uint8_t *data;
|
||||
+ uint8_t *data;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
@@ -86,7 +86,7 @@ struct context {
|
||||
#define raw_pdu(args...) \
|
||||
{ \
|
||||
.valid = true, \
|
||||
- .data = data(args), \
|
||||
+ .data = g_memdup(data(args), sizeof(data(args))), \
|
||||
.size = sizeof(data(args)), \
|
||||
}
|
||||
|
||||
@@ -306,6 +306,11 @@ static bt_uuid_t uuid_char_128 = {
|
||||
static void test_free(gconstpointer user_data)
|
||||
{
|
||||
const struct test_data *data = user_data;
|
||||
+ struct test_pdu *pdu;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++)
|
||||
+ g_free(pdu->data);
|
||||
|
||||
g_free(data->test_name);
|
||||
g_free(data->pdu_list);
|
||||
@@ -1911,6 +1916,8 @@ static void test_server(gconstpointer data)
|
||||
g_assert_cmpint(len, ==, pdu.size);
|
||||
|
||||
util_hexdump('<', pdu.data, len, test_debug, "GATT: ");
|
||||
+
|
||||
+ g_free(pdu.data);
|
||||
}
|
||||
|
||||
static void test_search_primary(gconstpointer data)
|
||||
diff --git a/unit/test-hfp.c b/unit/test-hfp.c
|
||||
index f2b9622c2..890eee659 100644
|
||||
--- a/unit/test-hfp.c
|
||||
+++ b/unit/test-hfp.c
|
||||
@@ -43,7 +43,7 @@ struct context {
|
||||
|
||||
struct test_pdu {
|
||||
bool valid;
|
||||
- const uint8_t *data;
|
||||
+ uint8_t *data;
|
||||
size_t size;
|
||||
enum hfp_gw_cmd_type type;
|
||||
bool fragmented;
|
||||
@@ -63,7 +63,7 @@ struct test_data {
|
||||
#define raw_pdu(args...) \
|
||||
{ \
|
||||
.valid = true, \
|
||||
- .data = data(args), \
|
||||
+ .data = g_memdup(data(args), sizeof(data(args))), \
|
||||
.size = sizeof(data(args)), \
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ struct test_data {
|
||||
#define type_pdu(cmd_type, args...) \
|
||||
{ \
|
||||
.valid = true, \
|
||||
- .data = data(args), \
|
||||
+ .data = g_memdup(data(args), sizeof(data(args))), \
|
||||
.size = sizeof(data(args)), \
|
||||
.type = cmd_type, \
|
||||
}
|
||||
@@ -83,7 +83,7 @@ struct test_data {
|
||||
#define frg_pdu(args...) \
|
||||
{ \
|
||||
.valid = true, \
|
||||
- .data = data(args), \
|
||||
+ .data = g_memdup(data(args), sizeof(data(args))), \
|
||||
.size = sizeof(data(args)), \
|
||||
.fragmented = true, \
|
||||
}
|
||||
@@ -119,6 +119,11 @@ struct test_data {
|
||||
static void test_free(gconstpointer user_data)
|
||||
{
|
||||
const struct test_data *data = user_data;
|
||||
+ struct test_pdu *pdu;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++)
|
||||
+ g_free(pdu->data);
|
||||
|
||||
g_free(data->test_name);
|
||||
g_free(data->pdu_list);
|
||||
diff --git a/unit/test-hog.c b/unit/test-hog.c
|
||||
index 37d3abe3f..e257fbd88 100644
|
||||
--- a/unit/test-hog.c
|
||||
+++ b/unit/test-hog.c
|
||||
@@ -69,11 +69,11 @@ struct context {
|
||||
|
||||
#define data(args...) ((const unsigned char[]) { args })
|
||||
|
||||
-#define raw_pdu(args...) \
|
||||
-{ \
|
||||
- .valid = true, \
|
||||
- .data = data(args), \
|
||||
- .size = sizeof(data(args)),\
|
||||
+#define raw_pdu(args...) \
|
||||
+{ \
|
||||
+ .valid = true, \
|
||||
+ .data = g_memdup(data(args), sizeof(data(args))), \
|
||||
+ .size = sizeof(data(args)), \
|
||||
}
|
||||
|
||||
#define false_pdu() \
|
||||
diff --git a/unit/test-sdp.c b/unit/test-sdp.c
|
||||
index 66da038cd..03501d021 100644
|
||||
--- a/unit/test-sdp.c
|
||||
+++ b/unit/test-sdp.c
|
||||
@@ -60,14 +60,14 @@ struct test_data {
|
||||
#define raw_pdu(args...) \
|
||||
{ \
|
||||
.valid = true, \
|
||||
- .raw_data = raw_data(args), \
|
||||
+ .raw_data = g_memdup(raw_data(args), sizeof(raw_data(args))), \
|
||||
.raw_size = sizeof(raw_data(args)), \
|
||||
}
|
||||
|
||||
#define raw_pdu_cont(cont, args...) \
|
||||
{ \
|
||||
.valid = true, \
|
||||
- .raw_data = raw_data(args), \
|
||||
+ .raw_data = g_memdup(raw_data(args), sizeof(raw_data(args))), \
|
||||
.raw_size = sizeof(raw_data(args)), \
|
||||
.cont_len = cont, \
|
||||
}
|
||||
@@ -105,7 +105,7 @@ struct test_data_de {
|
||||
#define define_test_de_attr(name, input, exp) \
|
||||
do { \
|
||||
static struct test_data_de data; \
|
||||
- data.input_data = input; \
|
||||
+ data.input_data = g_memdup(input, sizeof(input)); \
|
||||
data.input_size = sizeof(input); \
|
||||
data.expected = exp; \
|
||||
tester_add("/sdp/DE/ATTR/" name, &data, NULL, \
|
||||
--
|
||||
cgit 1.2-0.3.lf.el7
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Sun Aug 18 18:11:08 UTC 2019 - Antoine Belvire <antoine.belvire@opensuse.org>
|
||||
|
||||
- Fix build with GCC 9 (boo#1121404, bko#202213):
|
||||
* Add bluez-5.50-gcc9.patch.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jul 11 04:29:46 UTC 2019 - Al Cho <acho@suse.com>
|
||||
|
||||
|
11
bluez.spec
11
bluez.spec
@ -46,17 +46,14 @@ Patch8: bluez-5.50-a2dp-backports.patch
|
||||
Patch9: 0001-tools-Fix-build-after-y2038-changes-in-glibc.patch
|
||||
# Move 43xx firmware path for RPi3 bluetooth support bsc#1140688
|
||||
Patch10: RPi-Move-the-43xx-firmware-into-lib-firmware.patch
|
||||
# PATCH-FIX-UPSTREAM fix build with gcc 9, picked from upstream and rebased (boo#1121404, bko#202213)
|
||||
Patch11: bluez-5.50-gcc9.patch
|
||||
# Upstream suggests to use btmon instead of hcidump and does not want those patches
|
||||
# => PATCH-FIX-OPENSUSE for those two :-)
|
||||
# fix some memory leak with malformed packet (reported upstream but not yet fixed)
|
||||
Patch101: CVE-2016-9800-tool-hcidump-Fix-memory-leak-with-malformed-packet.patch
|
||||
Patch102: CVE-2016-9804-tool-hcidump-Fix-memory-leak-with-malformed-packet.patch
|
||||
|
||||
# workaround for gcc9 problem, boo#1121404
|
||||
%if 0%{?suse_version} >= 1550
|
||||
BuildRequires: gcc8
|
||||
%define gcc_suf -8
|
||||
%endif
|
||||
BuildRequires: automake
|
||||
BuildRequires: flex
|
||||
BuildRequires: libtool
|
||||
@ -171,6 +168,7 @@ desktop specific applets like blueman or GNOME or KDE applets).
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch101 -p1
|
||||
%patch102 -p1
|
||||
mkdir dbus-apis
|
||||
@ -184,7 +182,6 @@ sed -i "/SystemdService=.*/d" obexd/src/org.bluez.obex.service
|
||||
echo AutoEnable=true >> src/main.conf
|
||||
|
||||
%build
|
||||
export CC=gcc%{?gcc_suf}
|
||||
# because of patch4...
|
||||
autoreconf -fi
|
||||
# --enable-experimental is needed or btattach does not build (bug?)
|
||||
@ -209,7 +206,6 @@ autoreconf -fi
|
||||
make %{?_smp_mflags} all
|
||||
|
||||
%install
|
||||
export CC=gcc%{?gcc_suf}
|
||||
%make_install
|
||||
find %{buildroot} -type f -name "*.la" -delete -print
|
||||
install --mode=0644 -D %{SOURCE7} %{buildroot}/%{_sysconfdir}/modprobe.d/50-bluetooth.conf
|
||||
@ -246,7 +242,6 @@ sed -i -e '1s/env p/p/' %{buildroot}%{_libdir}/bluez/test/example-gatt-{client,s
|
||||
|
||||
%check
|
||||
%if ! 0%{?qemu_user_space_build}
|
||||
export CC=gcc%{?gcc_suf}
|
||||
##make %%{?_smp_mflags} check
|
||||
# deliberately not running parallel, as the test suite has spurious failures otherwise
|
||||
make check V=0
|
||||
|
Loading…
Reference in New Issue
Block a user