Go to file
Luiz Augusto von Dentz f1069c4fe1 gatt-server: Fix crash while disconnecting
If there is a pending notify multiple the code was not removing before
freeing the object causing the following crash:

Invalid read of size 8
   at 0x4A3D10: notify_multiple (gatt-server.c:1703)
   by 0x4D05F0: timeout_callback (timeout-glib.c:25)
   by 0x4956900: ??? (in /usr/lib64/libglib-2.0.so.0.7000.5)
   by 0x49560AE: g_main_context_dispatch
   (in /usr/lib64/libglib-2.0.so.0.7000.5)
   by 0x49AB307: ??? (in /usr/lib64/libglib-2.0.so.0.7000.5)
   by 0x49557C2: g_main_loop_run
   (in /usr/lib64/libglib-2.0.so.0.7000.5)
   by 0x4D0A34: mainloop_run (mainloop-glib.c:66)
   by 0x4D0F2B: mainloop_run_with_signal (mainloop-notify.c:188)
   by 0x2B0CD1: main (main.c:1276)
 Address 0x6ca35c8 is 136 bytes inside a block of size 144 free'd
   at 0x48470E4: free (vg_replace_malloc.c:872)
   by 0x415E73: gatt_server_cleanup (device.c:698)
   by 0x415E73: attio_cleanup (device.c:715)
   by 0x47745B: queue_foreach (queue.c:207)
   by 0x490C54: disconnect_cb (att.c:701)
   by 0x4CF4AF: watch_callback (io-glib.c:157)
   by 0x49560AE: g_main_context_dispatch
   (in /usr/lib64/libglib-2.0.so.0.7000.5)
   by 0x49AB307: ??? (in /usr/lib64/libglib-2.0.so.0.7000.5)
   by 0x49557C2: g_main_loop_run
   (in /usr/lib64/libglib-2.0.so.0.7000.5)
   by 0x4D0A34: mainloop_run (mainloop-glib.c:66)
   by 0x4D0F2B: mainloop_run_with_signal (mainloop-notify.c:188)
   by 0x2B0CD1: main (main.c:1276)
2022-05-20 14:14:24 -07:00
android build: Replace use of g_memdup with util_memdup 2022-01-06 12:58:39 -08:00
attrib build: Replace use of g_memdup with util_memdup 2022-01-06 12:58:39 -08:00
btio btio: Inclusive language changes 2021-09-21 10:51:53 +02:00
client client: Add filter to devices and show Bonded in info 2022-05-04 14:56:05 -07:00
completion/zsh completion: add bluetoothctl zsh completions 2019-09-06 10:58:03 +03:00
doc device-api: Clarify Paired/Bonded documentation 2022-05-04 16:39:30 -07:00
emulator btdev: Fix not removing connection and advertising set on reset 2022-05-02 14:06:12 -07:00
gdbus gdbus: Emit InterfacesAdded of parents objects first 2022-02-04 13:13:28 -08:00
gobex gobex: Fix read from pointer after free 2022-02-18 13:25:57 -08:00
lib lib: fix hci_strtolm crash 2022-02-15 13:31:42 -08:00
LICENSES LICENSES: Add License files 2020-09-21 16:22:40 -07:00
mesh mesh: use explicit uint32_t when bit shifting left 2022-03-31 11:21:56 -07:00
monitor monitor/att: Add decoding support for CCC 2022-05-19 17:54:16 -07:00
obexd build: Replace use of g_memdup with util_memdup 2022-01-06 12:58:39 -08:00
peripheral build: Fix errors with glibc < 2.25 2022-02-15 13:36:35 -08:00
plugins policy: Change AutoEnable default to true 2022-04-14 17:05:25 -07:00
profiles input/device: Notify failure if ctrl disconnect when waiting intr 2022-05-18 15:19:43 -07:00
src gatt-server: Fix crash while disconnecting 2022-05-20 14:14:24 -07:00
test test: changes for Python3 2022-04-19 15:32:16 -07:00
tools tools: Fix handle leak in rfcomm 2022-05-09 13:05:38 -07:00
unit build: Replace use of g_memdup with util_memdup 2022-01-06 12:58:39 -08:00
.checkpatch.conf checkpatch: ignore SPDX license header check 2021-05-04 16:49:13 -07:00
.gitignore mesh: Add manpage for bluetooth-meshd daemon 2021-05-19 10:52:53 -07:00
.gitlint gitlint: Add .gitlint configuration 2018-08-08 11:03:10 +03:00
.mailmap Fix name in AUTHORS 2015-05-20 23:16:30 +03:00
acinclude.m4 configure: Fix use of obsolete macros 2022-01-05 15:06:40 -08:00
AUTHORS AUTHORS: mention Szymon's contributions 2020-01-09 11:37:28 +01:00
bootstrap Add --automake option 2006-08-18 19:41:53 +00:00
bootstrap-configure bootstrap-configure: Don't enable admin plugin by default 2022-02-09 15:42:45 -08:00
ChangeLog Release 5.64 2022-03-16 16:04:29 +01:00
configure.ac Release 5.64 2022-03-16 16:04:29 +01:00
COPYING Remove new page characters 2008-08-14 22:56:25 +02:00
COPYING.LIB Remove new page characters 2008-08-14 22:56:25 +02:00
HACKING HACKING: Mention disabling SELinux 2020-05-19 10:54:53 -07:00
INSTALL Big cleanup of CVS relics 2005-10-29 19:25:42 +00:00
Makefile.am settings: Add btd_settings_gatt_db_{store,load} 2022-05-18 15:35:45 -07:00
Makefile.mesh mesh: Add manpage for bluetooth-meshd daemon 2021-05-19 10:52:53 -07:00
Makefile.obexd build: Replace use of g_memdup with util_memdup 2022-01-06 12:58:39 -08:00
Makefile.plugins uhid: Remove local copy of uhid header 2021-11-22 13:49:18 -08:00
Makefile.tools monitor/att: Decode attribute type 2022-05-18 15:35:49 -07:00
NEWS Initial revision 2002-03-08 21:10:06 +00:00
README README: Add Mesh required Kernel Configuration section 2020-03-12 11:16:10 -07:00
TODO TODO: Update mesh section 2019-12-20 09:01:49 -08:00

BlueZ - Bluetooth protocol stack for Linux
******************************************

Copyright (C) 2000-2001  Qualcomm Incorporated
Copyright (C) 2002-2003  Maxim Krasnyansky <maxk@qualcomm.com>
Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>


Compilation and installation
============================

In order to compile Bluetooth utilities you need following software packages:
	- GCC compiler
	- GLib library
	- D-Bus library
	- udev library (optional)
	- readline (command line clients)

	On a debian based system, this can be done by running the following command:
		sudo apt-get build-dep bluez
		./bootstrap

To configure run:
	./configure --prefix=/usr --mandir=/usr/share/man \
				--sysconfdir=/etc --localstatedir=/var

Configure automatically searches for all required components and packages.

To compile and install run:
	make && make install


Embedded Linux library
======================

In order to compile mesh support and test client utility the development
version of Embedded Linux library is required to be present. The development
repositories can be found here:

	git://git.kernel.org/pub/scm/libs/ell/ell.git
	https://kernel.googlesource.com/pub/scm/libs/ell/ell.git

The build systems requires that the Embedded Linux library source code
is available on the same top level directory as the source code:

	.
	|--- ell
	|    |--- ell
	|    `--- unit
	`--- bluez
	     |--- src
	     `--- tools

It is not required to build or install Embedded Linux library. The build
will happen when building the binaries and it will then be linked internally.

When using --enable-external-ell build option, it is not required that the
Embedded Linux library source code is available in the top level directory.

When neither --enable-mesh nor --enable-btpclient is specified, then this
part is irrelevant and Embedded Linux library is not required.


Kernel Build Options (for Mesh)
===============================

The Mesh daemon uses kernel provided crypto utilities to perform security
functions required of Bluetooth Mesh. Many standard distributions currently
enable all required crypto features, but a few notable distributions do
not.

If Mesh Cryptography is not working, the following configuration options
may need to be enabled, and the kernel rebuilt.

1. A minimum of kernel version 4.9 or later is required

2. The kernel must at a minimum have the following .config options turned on:
	CONFIG_CRYPTO_USER
	CONFIG_CRYPTO_USER_API
	CONFIG_CRYPTO_USER_API_AEAD
	CONFIG_CRYPTO_USER_API_HASH

	CONFIG_CRYPTO_AES
	CONFIG_CRYPTO_CCM
	CONFIG_CRYPTO_AEAD
	CONFIG_CRYPTO_CMAC


Configuration and options
=========================

For a working system, certain configuration options need to be enabled:

	--enable-library

		Enable installation of Bluetooth library

		By default the Bluetooth library is no longer installed.

		The user interfaces or command line utilities do not
		require an installed Bluetooth library anymore. This
		option is provided for legacy third party applications
		that still depend on the library.

		When the library installation is enabled, it is a good
		idea to use a separate bluez-library or libbluetooth
		package for it.

	--disable-tools

		Disable support for Bluetooth utilities

		By default the Bluetooth utilities are built and also
		installed. For production systems the tools are not
		needed and this option allows to disable them to save
		build time and disk space.

		When the tools are selected, it is a good idea to
		use a separate bluez-tools package for them.

	--disable-cups

		Disable support for CUPS printer backend

		By default the printer backend for CUPS is build and
		also installed. For systems that do not require printing
		over Bluetooth, this options allows to disable it.

		When the CUPS backend is selected, it is a good idea to
		use a separate bluez-cups package for it.

	--disable-monitor

		Disable support for the Bluetooth monitor utility

		By default the monitor utility is enabled. It provides
		support for HCI level tracing and debugging. For systems
		that don't require any kind of tracing or debugging
		capabilities, this options allows to disable it.

		The monitor utility should be placed in the main package
		along with the daemons. It is universally useful.

	--disable-client

		Disable support for the command line client

		By default the command line client is enabled and uses the
		readline library. For specific systems where BlueZ is
		configured by other means, the command line client can be
		disabled and the dependency on readline is removed.

		The client should be placed in the main package along
		with the daemons. It is universally useful.

	--disable-systemd

		Disable integration with systemd

		By default the integration with systemd is enabled and
		installed. This gives the best integration into all
		distributions based on systemd.

		This option is provided for distributions that do not
		support systemd. In that case all integration with the
		init system is up to the package.

	--disable-a2dp

		Disable A2DP profile

		By default bluetoothd supports A2DP profile using a built-in
		plugin, this option disables it.

		This option is provided for distributions that do not have any
		audio capabilities.

	--disable-avrcp

		Disable AVRCP profile

		By default bluetoothd supports AVRCP profile using a built-in
		plugin, this option disables it.

		This option is provided for distributions that do not have any
		audio capabilities.

	--disable-network

		Disable PANU, NAP, GN profiles

		By default bluetoothd supports PANU, NAP and GN profile using a
		built-in plugin, this option disables it.

		This option is provided for distributions that do not have any
		network capabilities.

	--disable-hid

		Disable HID profile

		By default bluetoothd supports HID profile using a built-in
		plugin, this option disables it.

		This option is provided for distributions that do not have any
		input capabilities.

	--disable-hog

		Disable HoG profile

		By default bluetoothd supports HoG profile using a built-in
		plugin, this option disables it.

		This option is provided for distributions that do not have any
		input capabilities.

	--enable-testing

		Enable testing tools

		By default tools used only for testing emulation are disabled.
		This option can be used to enable them.

		It is not recommended to enable this option for production
		systems. These tools may contain tests that depend on specific
		environment or kernel features in development.

	--enable-experimental

		Enable experimental tools

		By default all tools that are still in development
		are disabled. This option can be used to enable them.

		It is not recommended to enable this option for production
		systems. The behavior of the experimental tools is unstable
		and might still change.

	--enable-deprecated

		Enable deprecated tools

		By defauld all tools that are no longer maintained are
		disabled. This option can be used to enable them.

		It is not recommended to enable this option for production
		systems. The behavior of the deprecated tools may be unstable
		or simply don't work anymore.

	--enable-nfc

		This option enable NFC pairing support.

		By default the integration with neard is disabled, this gives
		the option to enable it in system where neard is supported.

		The plugin is built into bluetoothd therefore it does not need
		to be package separately.

	--enable-sap

		This option enable SAP profile using sap plugin.

		By default sap plugin is disabled since it requires tight
		integration with systems and is very rarely required.

		The plugin is built into bluetoothd therefore it does not need
		to be package separately.

	--enable-health

		This option enable health profiles.

		By default health plugin is disabled since its profiles are
		target for the health industry.

		The plugin is built into bluetoothd therefore it does not need
		to be package separately.

	--enable-midi

		This option enable MIDI support via ALSA Sequencer.

		By default midi plugin is disabled since it still considered
		experimental. When bluetoothd will create a new ALSA Sequencer
		client and port for each device connected that supports the
		MIDI GATT primary service.

		The plugin is built into bluetoothd therefore it does not need
		to be package separately.

Information
===========

Mailing lists:
	linux-bluetooth@vger.kernel.org

For additional information about the project visit BlueZ web site:
	http://www.bluez.org