From: bugzilla-daemon@bugzilla.kernel.org
To: linux-bluetooth@vger.kernel.org
Subject: [Bug 214103] New: HCI_CHANNEL_USER sockets leave device running after exit
Date: Wed, 18 Aug 2021 17:45:07 +0000 [thread overview]
Message-ID: <bug-214103-62941@https.bugzilla.kernel.org/> (raw)
https://bugzilla.kernel.org/show_bug.cgi?id=214103
Bug ID: 214103
Summary: HCI_CHANNEL_USER sockets leave device running after
exit
Product: Drivers
Version: 2.5
Kernel Version: 5.11.0-7620-generic
Hardware: All
OS: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: Bluetooth
Assignee: linux-bluetooth@vger.kernel.org
Reporter: pab@pabigot.com
Regression: No
Created attachment 298353
--> https://bugzilla.kernel.org/attachment.cgi?id=298353&action=edit
code to reproduce behavior
HCI_CHANNEL_USER is documented[1] as providing an exclusive (?[2]) Bluetooth
socket channel for application use given CAP_NET_ADMIN. This channel type
requires that the device be down when the socket is bound. The device
transitions to UP RUNNING as a side-effect of a successful binding.
When the socket is closed and the application exits, the device remains up and
running. It's unclear whether this is a bug or a feature; in any case it is
not what somebody might expect, as it prevents the application from starting
again without external action to bring the device back down.
Reproducing example attached, and command sequence below.
[1]:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.13.12&id=23500189d7e03a071f0746f43f2cce875a62c91c
[2]: https://bugzilla.kernel.org/show_bug.cgi?id=135431
tirzah[1050]$ sudo hciconfig hci0 down
tirzah[1051]$ hciconfig hci0
hci0: Type: Primary Bus: USB
BD Address: A4:C3:F0:F2:23:E3 ACL MTU: 1021:4 SCO MTU: 96:6
DOWN
RX bytes:64500 acl:0 sco:0 events:4125 errors:0
TX bytes:650824 acl:0 sco:0 commands:3992 errors:0
tirzah[1052]$ gcc repro.c
tirzah[1053]$ sudo setcap cap_net_raw,cap_net_admin=ep ./a.out
tirzah[1054]$ getcap ./a.out
./a.out = cap_net_admin,cap_net_raw+ep
tirzah[1055]$ ./a.out
opening device 0
dd=3; binding to user channel
bound to user channel; closing
closed
tirzah[1056]$ hciconfig hci0
hci0: Type: Primary Bus: USB
BD Address: A4:C3:F0:F2:23:E3 ACL MTU: 1021:4 SCO MTU: 96:6
UP RUNNING
RX bytes:65256 acl:0 sco:0 events:4180 errors:0
TX bytes:653053 acl:0 sco:0 commands:4047 errors:0
tirzah[1057]$
--
You may reply to this email to add a comment.
You are receiving this mail because:
You are the assignee for the bug.
next reply other threads:[~2021-08-18 17:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-18 17:45 bugzilla-daemon [this message]
2021-08-23 20:35 ` [Bug 214103] HCI_CHANNEL_USER sockets leave device running after exit bugzilla-daemon
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=bug-214103-62941@https.bugzilla.kernel.org/ \
--to=bugzilla-daemon@bugzilla.kernel.org \
--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