Linux bluetooth development
 help / color / mirror / Atom feed
From: "Frédéric Danis" <frederic.danis@collabora.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v3 0/7] plugin/admin: Make allowlist adapter-scoped and enforce at runtime
Date: Wed, 19 Aug 2026 16:43:30 +0200	[thread overview]
Message-ID: <20260819144337.889893-1-frederic.danis@collabora.com> (raw)

This series tightens AdminPolicy ServiceAllowList handling and makes
its behavior consistent across adapter selection, adapter profile
activation, local SDP service registration, and device service
allowance checks.

The first part removes global AdminPolicy state and makes policy
tracking per-adapter, which fixes D-Bus updates being emitted on the
wrong adapter and avoids cross-adapter coupling.

The second part updates bluetoothctl admin.allow to be adapter-aware:
it now targets the currently selected default adapter instead of a
single global proxy.

The core functional change is runtime enforcement of ServiceAllowList
for local adapter/server services in addition to existing remote-device
policy checks. When policy changes, adapters immediately reapply
allowlist decisions by stopping/removing disallowed services and
starting newly allowed ones, without restarting bluetoothd.

Finally, device-side and A2DP allowlist checks are made role-aware, so
that local Sink/Source role UUIDs are used consistently across
adapter profile probing, device connection filtering, and A2DP SEP
negotiation, fixing role-inverted cases and blocking disallowed roles
earlier (at Get_Capability/Set_Configuration time) instead of relying
on later teardown paths.

Summary of effects:
- AdminPolicy state is correctly scoped per adapter.
- admin.allow targets the currently selected default adapter.
- ServiceAllowList now governs both remote profiles and local
  adapter/server services.
- Allowlist updates are enforced immediately on initialized adapters.
- Device, adapter, and A2DP policy decisions consistently use
  role-aware UUID mapping semantics.
- Blocked A2DP roles are rejected at SEP negotiation time, avoiding
  stale role state and reconnect instability across policy updates.

v1->v2: Add new commit to fix outgoing connection by unifying device-side
 filtering with adapter-side profile-aware allowlist mapping semantics.

v2->v3:
- Drop the "profiles/audio: fix UAF on external media service
  teardown" commit, since it has already been merged upstream
  separately and is no longer part of this series.
- Drop the optional [ctrl] argument from bluetoothctl's admin.allow;
  it now always targets the currently selected default adapter, which
  also removed the need for the separate doc patch documenting that
  argument.
- src/adapter: map both a2dp-source and a2dp-sink profile probing to
  ADVANCED_AUDIO_UUID (0x110d) instead of swapped Sink/Source UUIDs,
  so profile probe gating matches the A2DP profile class while local
  Source/Sink SDP records still get filtered by their own UUIDs.
- device: rework device-side service allowance to use a dedicated
  role-aware helper (service_policy_uuid()) mapping a2dp-sink to the
  A2DP Source UUID and a2dp-source to the A2DP Sink UUID, instead of
  the shared btd_adapter_is_profile_allowed() helper, fixing a false
  block seen during host-initiated A2DP connect attempts.
- Add a new commit making A2DP allowlist enforcement itself role-safe:
  policy is now checked at Get_Capability/Set_Configuration
  negotiation time (rejecting blocked roles early), a2dp.c server
  role bookkeeping was hardened (explicit source_enabled/sink_enabled
  flags, cleared source/sink list heads) to avoid stale role state
  across dynamic reapply, and media.c now treats endpoints skipped by
  admin allowlist as non-fatal instead of logging an error.

Frédéric Danis (7):
  plugins/admin: make AdminPolicy state per-adapter
  client/bluetoothctl: make admin.allow controller-aware
  src/adapter: enforce allowlist for local services
  plugins/admin: reapply allowlist on policy updates
  doc: describe admin allowlist runtime enforcement
  device: unify admin allowlist checks for device services
  profiles/audio: make A2DP admin allowlist enforcement role-safe

 client/admin.c                      |  74 +++++++++++----
 client/admin.h                      |   2 +
 client/main.c                       |   8 ++
 doc/org.bluez.AdminPolicySet.rst    |  11 +++
 doc/org.bluez.AdminPolicyStatus.rst |   5 +
 plugins/admin.c                     | 131 ++++++++++++++++++++------
 profiles/audio/a2dp.c               |  38 +++++++-
 profiles/audio/media.c              |   7 ++
 src/adapter.c                       | 141 ++++++++++++++++++++++++++++
 src/adapter.h                       |   4 +
 src/device.c                        |  35 ++++++-
 11 files changed, 398 insertions(+), 58 deletions(-)

-- 
2.43.0


             reply	other threads:[~2026-08-19 14:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19 14:43 Frédéric Danis [this message]
2026-08-19 14:43 ` [PATCH BlueZ v3 1/7] plugins/admin: make AdminPolicy state per-adapter Frédéric Danis
2026-08-19 15:45   ` plugin/admin: Make allowlist adapter-scoped and enforce at runtime bluez.test.bot
2026-08-19 14:43 ` [PATCH BlueZ v3 2/7] client/bluetoothctl: make admin.allow controller-aware Frédéric Danis
2026-08-19 14:43 ` [PATCH BlueZ v3 3/7] src/adapter: enforce allowlist for local services Frédéric Danis
2026-08-19 14:43 ` [PATCH BlueZ v3 4/7] plugins/admin: reapply allowlist on policy updates Frédéric Danis
2026-08-19 14:43 ` [PATCH BlueZ v3 5/7] doc: describe admin allowlist runtime enforcement Frédéric Danis
2026-08-19 14:43 ` [PATCH BlueZ v3 6/7] device: unify admin allowlist checks for device services Frédéric Danis
2026-08-19 14:43 ` [PATCH BlueZ v3 7/7] profiles/audio: make A2DP admin allowlist enforcement role-safe Frédéric Danis

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=20260819144337.889893-1-frederic.danis@collabora.com \
    --to=frederic.danis@collabora.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