From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v1 00/10] shared/gatt: Use util_iov helpers for PDU handling
Date: Mon, 9 Nov 2026 10:44:51 -0500 [thread overview]
Message-ID: <20261109154501.1362649-1-luiz.dentz@gmail.com> (raw)
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This converts src/shared/{att,gatt-server,gatt-client,gatt-helpers} to
build and parse PDUs with the util_iov_pull_* and util_iov_push_*
helpers rather than pointer arithmetic on the PDU, so that the bounds
check is part of the access.
The conversion is meant to be behavior preserving, the existing
unit/test-gatt tests pass unchanged. It is followed by tests for
malformed PDUs, which the original code already rejected, so these are
regression coverage for the converted paths, and by fixes for bugs
found while reading the code:
- the authorize callback was called with handle 0 for writes
(reproduced by a new test)
- a failure to store prepared write data sent two responses
- the Execute Write registration failure returned NULL for a bool
- handle_notify leaked a bt_att reference when the signature of a
Signed Write Command could not be verified
- handle_notify subtracted the signature length once per handler
The last four have no unit test: the prepare write failure is only
reachable by an allocation failure, and the signature paths need a
signing key and crypto setup that unit/test-gatt does not have.
Note that "make check" runs the tests under valgrind, which reports
uninitialised bytes in bt_log_open() for unit/test-gatt both before and
after this series in the environment used.
Luiz Augusto von Dentz (10):
shared/att: Use util_iov helpers to build and parse PDUs
shared/gatt-server: Use util_iov helpers to build and parse PDUs
shared/gatt-helpers: Use util_iov helpers to build and parse PDUs
shared/gatt-client: Use util_iov helpers to build and parse PDUs
unit/test-gatt: Add malformed PDU tests
shared/gatt-server: Fix authorize callback getting handle 0 on write
shared/gatt-server: Fix double response on prepare write failure
shared/gatt-server: Fix return value of handler registration
shared/att: Fix reference leak on signature verification failure
shared/att: Fix signature length subtracted once per handler
src/shared/att.c | 38 +++-
src/shared/gatt-client.c | 203 ++++++++---------
src/shared/gatt-helpers.c | 452 +++++++++++++++++++++++++-------------
src/shared/gatt-server.c | 380 ++++++++++++++++----------------
unit/test-gatt.c | 214 +++++++++++++++++-
5 files changed, 821 insertions(+), 466 deletions(-)
--
2.56.0
next reply other threads:[~2026-11-09 15:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 15:44 Luiz Augusto von Dentz [this message]
2026-11-09 15:44 ` [PATCH BlueZ v1 01/10] shared/att: Use util_iov helpers to build and parse PDUs Luiz Augusto von Dentz
2026-11-10 6:49 ` shared/gatt: Use util_iov helpers for PDU handling bluez.test.bot
2026-11-09 15:44 ` [PATCH BlueZ v1 02/10] shared/gatt-server: Use util_iov helpers to build and parse PDUs Luiz Augusto von Dentz
2026-11-09 15:44 ` [PATCH BlueZ v1 03/10] shared/gatt-helpers: " Luiz Augusto von Dentz
2026-11-09 15:44 ` [PATCH BlueZ v1 04/10] shared/gatt-client: " Luiz Augusto von Dentz
2026-11-09 15:44 ` [PATCH BlueZ v1 05/10] unit/test-gatt: Add malformed PDU tests Luiz Augusto von Dentz
2026-11-09 15:44 ` [PATCH BlueZ v1 06/10] shared/gatt-server: Fix authorize callback getting handle 0 on write Luiz Augusto von Dentz
2026-11-09 15:44 ` [PATCH BlueZ v1 07/10] shared/gatt-server: Fix double response on prepare write failure Luiz Augusto von Dentz
2026-11-09 15:44 ` [PATCH BlueZ v1 08/10] shared/gatt-server: Fix return value of handler registration Luiz Augusto von Dentz
2026-11-09 15:45 ` [PATCH BlueZ v1 09/10] shared/att: Fix reference leak on signature verification failure Luiz Augusto von Dentz
2026-11-09 15:45 ` [PATCH BlueZ v1 10/10] shared/att: Fix signature length subtracted once per handler Luiz Augusto von Dentz
2026-11-10 16:40 ` [PATCH BlueZ v1 00/10] shared/gatt: Use util_iov helpers for PDU handling patchwork-bot+bluetooth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261109154501.1362649-1-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox