Skip to content

Bluetooth: SMP: distribute the identity address when bonding

Brandon Williams linux-bluetooth lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2Bluetooth: SMP: ignore an all-zero IRKnet/bluetooth/smp.c+10 -01 reply
2/2Bluetooth: SMP: distribute the identity address when bondingnet/bluetooth/smp.c+7 -12 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Bluetooth: SMP: distribute the identity address when bonding

The Microsoft Surface Slim Pen 2 bonds with the host through its dock (LE legacy pairing with out-of-band data) and afterwards only advertises to reconnect, when its button is pressed, if the host distributed its identity during pairing. Linux only distributes its identity with privacy enabled, and with privacy the host scans and connects from resolvable private addresses while the pen directs its advertisements at the host's public address, so a pen bonded by Linux never reconnects.

Patch 2 makes Linux offer its identity key whenever it bonds over LE. Without privacy that is an all-zero IRK, which the specification defines as "no valid resolvable private address", and the public or static identity address. Patch 1 comes first so that Linux, as a receiver, does not store the all-zero IRKs that other Linux hosts then send.

Patch 2 changes the Pairing Requests that smp-tester checks: four client tests expect the old initiator key distribution. "[PATCH BlueZ 1/2]
smp-tester: Expect the identity key in Pairing Requests" updates them, and "[PATCH BlueZ 2/2] smp-tester: Add identity key distribution tests" adds a test for each patch. Until those are applied, smp-tester in CI will report the four client tests as failed.

Choices a reviewer may ask about:
- Why not distribute a real IRK without privacy? The host then never uses a resolvable private address, so there is nothing for an IRK to resolve, and the all-zero IRK is the specification's way to say so.
- Who now learns our identity address? Every LE device we bond with that asks for it. Without privacy that is the address we already advertise and connect from, so nothing new is disclosed.
- Devices that do not want our identity key do not get it: the Pairing Response masks the initiator key distribution down to what the responder accepts.
- Why drop an all-zero IRK instead of storing it and skipping it during resolution? Treating the peer as one that distributed no identity key keeps the key out of both host resolution and the controller's resolving list, where it could only mean "accept the identity address", which the controller does for a peer without an entry too.
- No Fixes tags: patch 1 is hardening and patch 2 a change of behaviour; neither is meant for stable.
- If you would rather keep the current default, patch 2 can instead be an opt-in setting that bluetoothd enables; I am happy to rework it that way.

Testing:
- On bluetooth-next 47d4d9f67e92 under QEMU (arm64, TCG) with KASAN, PROVE_LOCKING, PROVE_RCU and DEBUG_ATOMIC_SLEEP, with the BlueZ
patches: smp-tester passes 10/10 tests in each of 10 runs; without these patches the four updated client tests and both new tests fail. mgmt-tester (514 of 515, "Set powered on - Blocked by rfkill" skips itself as the test kernel has no /dev/rfkill) and l2cap-tester (111/111) give the same results with and without them. No KASAN, lockdep or RCU reports. sparse and W=1 are clean for smp.o; checkpatch --strict is clean. The emulator runs used the same code before a comment in patch 1 was reworded.
- Hardware: both patches have run on a Surface Pro 11 (X1E80100, WCN7850) since 2026-10-13, backported to 7.2.8 and 7.3. The Slim Pen 2 reconnects on a single click, double click and press-and-hold, and the Surface Pro Flex Keyboard pairs over its out-of-band path, accepts our identity key and reconnects.
- Other LE devices, on the same Surface Pro 11 with privacy off, each bonding over LE from scratch: a Corne keyboard running ZMK (Zephyr), a Logitech Lift mouse, a Samsung Galaxy Z Fold8 and an iPhone, the two phones once with each side initiating (nRF Connect and LightBlue advertising or connecting). All of them accepted our identity key, all but the Corne sent their own IRK, which was stored, and all bonded with no Pairing Failed. The Corne reconnects on its own, the Lift after a power cycle and the Fold after its Bluetooth is turned off and on, and the keyboards, mouse and pen after bluetoothd restarts, all with their stored keys. The phones also derived the BR/EDR link key as before, and the Fold connected over BR/EDR with it.

This is not a security issue: patch 2 discloses only the address already used on air, and the all-zero IRK in patch 1 only lets a device pose as a peer that uses its identity address in the clear anyway.

Tool use: the patches, their changelogs and the BlueZ tests were written with an AI coding assistant (Claude Code, Claude Opus 5.5) in a session that I directed: working out from HCI traces of Windows and Linux why the pen did not reconnect, writing the patches and tests, and running the emulator and hardware tests above. A review of the first version found that Linux stored the all-zero IRK it would then receive from other Linux hosts, which patch 1 fixes.

I found this with my own Slim Pen 2 and ran the device tests above myself, pairing each of those devices with my Surface Pro 11. I have read both patches and understand why patch 1 has to come first, and why sending an all-zero IRK only shares the address we already use on air.

Brandon Williams (2):
Bluetooth: SMP: ignore an all-zero IRK
Bluetooth: SMP: distribute the identity address when bonding

 net/bluetooth/smp.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

base-commit: 47d4d9f67e92d56ef3965f2727f9c98a5a611368

Signature · 1 line
2.56.0