From 87b34f8ffd39031071b5cca2e1f255936dd07f54 Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 3 Aug 2022 16:13:30 -0500 Subject: BlueZ 5.64 --- ...-obexd-without-systemd-in-the-user-sessio.patch | 56 ++++++++++++++++++++ .../bluez5/0001-test-gatt-Fix-hung-issue.patch | 43 +++++++++++++++ ...-target-for-building-tests-without-runnin.patch | 28 ++++++++++ .../bluez5/bluez5/CVE-2021-3588.patch | 34 ++++++++++++ recipes-connectivity/bluez5/bluez5/init | 61 ++++++++++++++++++++++ recipes-connectivity/bluez5/bluez5/run-ptest | 31 +++++++++++ 6 files changed, 253 insertions(+) create mode 100644 recipes-connectivity/bluez5/bluez5/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch create mode 100644 recipes-connectivity/bluez5/bluez5/0001-test-gatt-Fix-hung-issue.patch create mode 100644 recipes-connectivity/bluez5/bluez5/0001-tests-add-a-target-for-building-tests-without-runnin.patch create mode 100644 recipes-connectivity/bluez5/bluez5/CVE-2021-3588.patch create mode 100644 recipes-connectivity/bluez5/bluez5/init create mode 100644 recipes-connectivity/bluez5/bluez5/run-ptest (limited to 'recipes-connectivity/bluez5/bluez5') diff --git a/recipes-connectivity/bluez5/bluez5/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch b/recipes-connectivity/bluez5/bluez5/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch new file mode 100644 index 0000000..618ed73 --- /dev/null +++ b/recipes-connectivity/bluez5/bluez5/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch @@ -0,0 +1,56 @@ +From f74eb97c9fb3c0ee2895742e773ac6a3c41c999c Mon Sep 17 00:00:00 2001 +From: Giovanni Campagna +Date: Sat, 12 Oct 2013 17:45:25 +0200 +Subject: [PATCH] Allow using obexd without systemd in the user session + +Not all sessions run systemd --user (actually, the majority +doesn't), so the dbus daemon must be able to spawn obexd +directly, and to do so it needs the full path of the daemon. + +Upstream-Status: Denied + +Not accepted by upstream maintainer for being a distro specific +configuration. See thread: + +http://thread.gmane.org/gmane.linux.bluez.kernel/38725/focus=38843 + +Signed-off-by: Javier Viguera + +--- + Makefile.obexd | 4 ++-- + .../src/{org.bluez.obex.service => org.bluez.obex.service.in} | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + rename obexd/src/{org.bluez.obex.service => org.bluez.obex.service.in} (76%) + +diff --git a/Makefile.obexd b/Makefile.obexd +index de59d29..73004a3 100644 +--- a/Makefile.obexd ++++ b/Makefile.obexd +@@ -1,12 +1,12 @@ + if SYSTEMD + systemduserunitdir = $(SYSTEMD_USERUNITDIR) + systemduserunit_DATA = obexd/src/obex.service ++endif + + dbussessionbusdir = $(DBUS_SESSIONBUSDIR) + dbussessionbus_DATA = obexd/src/org.bluez.obex.service +-endif + +-EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service ++EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service.in + + if OBEX + +diff --git a/obexd/src/org.bluez.obex.service b/obexd/src/org.bluez.obex.service.in +similarity index 76% +rename from obexd/src/org.bluez.obex.service +rename to obexd/src/org.bluez.obex.service.in +index a538088..9c815f2 100644 +--- a/obexd/src/org.bluez.obex.service ++++ b/obexd/src/org.bluez.obex.service.in +@@ -1,4 +1,4 @@ + [D-BUS Service] + Name=org.bluez.obex +-Exec=/bin/false ++Exec=@libexecdir@/obexd + SystemdService=dbus-org.bluez.obex.service diff --git a/recipes-connectivity/bluez5/bluez5/0001-test-gatt-Fix-hung-issue.patch b/recipes-connectivity/bluez5/bluez5/0001-test-gatt-Fix-hung-issue.patch new file mode 100644 index 0000000..e90b6a5 --- /dev/null +++ b/recipes-connectivity/bluez5/bluez5/0001-test-gatt-Fix-hung-issue.patch @@ -0,0 +1,43 @@ +From 61e741654cc2eb167bca212a3bb2ba8f3ba280c1 Mon Sep 17 00:00:00 2001 +From: Mingli Yu +Date: Fri, 24 Aug 2018 12:04:03 +0800 +Subject: [PATCH] test-gatt: Fix hung issue + +The below test hangs infinitely +$ unit/test-gatt -p /robustness/unkown-request -d +/robustness/unkown-request - init +/robustness/unkown-request - setup +/robustness/unkown-request - setup complete +/robustness/unkown-request - run + GATT: < 02 17 00 ... + bt_gatt_server:MTU exchange complete, with MTU: 23 + GATT: > 03 00 02 ... + PDU: = 03 00 02 ... + GATT: < bf 00 + +Actually, the /robustness/unkown-request test does +no action. + +Upstream-Status: Submitted [https://marc.info/?l=linux-bluetooth&m=153508881804635&w=2] + +Signed-off-by: Mingli Yu +--- + unit/test-gatt.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/unit/test-gatt.c b/unit/test-gatt.c +index c7e28f8..b57373b 100644 +--- a/unit/test-gatt.c ++++ b/unit/test-gatt.c +@@ -4463,7 +4463,7 @@ int main(int argc, char *argv[]) + test_server, service_db_1, NULL, + raw_pdu(0x03, 0x00, 0x02), + raw_pdu(0xbf, 0x00), +- raw_pdu(0x01, 0xbf, 0x00, 0x00, 0x06)); ++ raw_pdu()); + + define_test_server("/robustness/unkown-command", + test_server, service_db_1, NULL, +-- +2.7.4 + diff --git a/recipes-connectivity/bluez5/bluez5/0001-tests-add-a-target-for-building-tests-without-runnin.patch b/recipes-connectivity/bluez5/bluez5/0001-tests-add-a-target-for-building-tests-without-runnin.patch new file mode 100644 index 0000000..24ddae6 --- /dev/null +++ b/recipes-connectivity/bluez5/bluez5/0001-tests-add-a-target-for-building-tests-without-runnin.patch @@ -0,0 +1,28 @@ +From 4bdf0f96dcaa945fd29f26d56e5b36d8c23e4c8b Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Fri, 1 Apr 2016 17:07:34 +0300 +Subject: [PATCH] tests: add a target for building tests without running them + +Upstream-Status: Inappropriate [oe specific] +Signed-off-by: Alexander Kanavin +--- + Makefile.am | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/Makefile.am b/Makefile.am +index 1a48a71..ba3b92f 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -425,6 +425,9 @@ endif + TESTS = $(unit_tests) + AM_TESTS_ENVIRONMENT = MALLOC_CHECK_=3 MALLOC_PERTURB_=69 + ++# This allows building tests without running them ++buildtests: $(TESTS) ++ + if DBUS_RUN_SESSION + AM_TESTS_ENVIRONMENT += dbus-run-session -- + endif +-- +2.8.0.rc3 + diff --git a/recipes-connectivity/bluez5/bluez5/CVE-2021-3588.patch b/recipes-connectivity/bluez5/bluez5/CVE-2021-3588.patch new file mode 100644 index 0000000..f52ff47 --- /dev/null +++ b/recipes-connectivity/bluez5/bluez5/CVE-2021-3588.patch @@ -0,0 +1,34 @@ +From 3a40bef49305f8327635b81ac8be52a3ca063d5a Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz +Date: Mon, 4 Jan 2021 10:38:31 -0800 +Subject: [PATCH] gatt: Fix potential buffer out-of-bound + +When client features is read check if the offset is within the cli_feat +bounds. + +Fixes: https://github.com/bluez/bluez/issues/70 + ++Upstream-Status: Backport [https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/?id=3a40bef49305f8327635b81ac8be52a3ca063d5a] ++Signed-off-by: Steve Sakoman ++CVE: CVE-2021-3588 + +--- + src/gatt-database.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/gatt-database.c b/src/gatt-database.c +index 90cc4bade..f2d7b5821 100644 +--- a/src/gatt-database.c ++++ b/src/gatt-database.c +@@ -1075,6 +1075,11 @@ static void cli_feat_read_cb(struct gatt_db_attribute *attrib, + goto done; + } + ++ if (offset >= sizeof(state->cli_feat)) { ++ ecode = BT_ATT_ERROR_INVALID_OFFSET; ++ goto done; ++ } ++ + len = sizeof(state->cli_feat) - offset; + value = len ? &state->cli_feat[offset] : NULL; + diff --git a/recipes-connectivity/bluez5/bluez5/init b/recipes-connectivity/bluez5/bluez5/init new file mode 100644 index 0000000..ca9fa18 --- /dev/null +++ b/recipes-connectivity/bluez5/bluez5/init @@ -0,0 +1,61 @@ +#!/bin/sh + +# Source function library +. /etc/init.d/functions + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +DESC=bluetooth + +DAEMON=@LIBEXECDIR@/bluetooth/bluetoothd + +# If you want to be ignore error of "org.freedesktop.hostname1", +# please enable NOPLUGIN_OPTION. +# NOPLUGIN_OPTION="--noplugin=hostname" +NOPLUGIN_OPTION="" +SSD_OPTIONS="--oknodo --quiet --exec $DAEMON -- $NOPLUGIN_OPTION" + +test -f $DAEMON || exit 0 + +# FIXME: any of the sourced files may fail if/with syntax errors +test -f /etc/default/bluetooth && . /etc/default/bluetooth +test -f /etc/default/rcS && . /etc/default/rcS + +set -e + +case $1 in + start) + echo -n "Starting $DESC: " + if test "$BLUETOOTH_ENABLED" = 0; then + echo "disabled (see /etc/default/bluetooth)." + exit 0 + fi + start-stop-daemon --start --background $SSD_OPTIONS + echo "${DAEMON##*/}." + ;; + stop) + echo -n "Stopping $DESC: " + if test "$BLUETOOTH_ENABLED" = 0; then + echo "disabled (see /etc/default/bluetooth)." + exit 0 + fi + start-stop-daemon --stop $SSD_OPTIONS + echo "${DAEMON##*/}." + ;; + restart|force-reload) + $0 stop + sleep 1 + $0 start + ;; + status) + status ${DAEMON} || exit $? + ;; + *) + N=/etc/init.d/bluetooth + echo "Usage: $N {start|stop|restart|force-reload|status}" >&2 + exit 1 + ;; +esac + +exit 0 + +# vim:noet diff --git a/recipes-connectivity/bluez5/bluez5/run-ptest b/recipes-connectivity/bluez5/bluez5/run-ptest new file mode 100644 index 0000000..0335e68 --- /dev/null +++ b/recipes-connectivity/bluez5/bluez5/run-ptest @@ -0,0 +1,31 @@ +#! /bin/sh + +cd unit + +failed=0 +all=0 + +for f in test-*; do + "./$f" -q + case "$?" in + 0) + echo "PASS: $f" + all=$((all + 1)) + ;; + 77) + echo "SKIP: $f" + ;; + *) + echo "FAIL: $f" + failed=$((failed + 1)) + all=$((all + 1)) + ;; + esac +done + +if [ "$failed" -eq 0 ] ; then + echo "All $all tests passed" +else + echo "$failed of $all tests failed" +fi + -- cgit v1.2.3