nday
CVE-2021-47038

Bluetooth: avoid deadlock between hci_dev->lock and socket lock

Linux / Linux

披露于 。本站尚未获取修复依据,不能据此认为没有补丁。四个 PoC 来源都还没有收录。尚未列入 CISA KEV。

标签 漏洞类型race condition 攻击途径本地无需用户交互 产品Linux kernel 产品类型操作系统
这些标签的依据

这些标签由 nday 按固定规则从下列事实自动推导,不是 NVD、编号分配方或其他来源给出的。全部标签和规则见 ~/tags。

race condition
CWE-667(来源:NVD 分析人员)
本地
NVD 分析人员 给出的 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H(CVSS 3.1)中的 AV:L
无需用户交互
NVD 分析人员 给出的 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H(CVSS 3.1)中的 UI:N
Linux kernel
CVE 记录列出的受影响产品:Linux · LinuxNVD 分析人员标为易受攻击的 CPE 名称:o:linux:linux_kernel
操作系统
CVE 记录列出的受影响产品:Linux · LinuxNVD 分析人员标为易受攻击的 CPE 名称:o:linux:linux_kernelnday 产品登记表中 Linux kernel 的产品类型
当前阶段
DIS
披露
CVSS
暂无评分

生命周期

横轴 UTC;点=精确到分钟,宽条=仅日期,空心=未知或推定。
时间未知
DIS披露
2024-02-28T08:13Z
PAT补丁
尚无记录
ANA分析
尚无记录
POCPoC
尚无记录
ITW在野
尚无记录
KEVKEV
尚无记录

摘要

In the Linux kernel, the following vulnerability has been resolved:

Bluetooth: avoid deadlock between hci_dev->lock and socket lock

Commit eab2404ba798 ("Bluetooth: Add BT_PHY socket option") added a dependency between socket lock and hci_dev->lock that could lead to deadlock.

It turns out that hci_conn_get_phy() is not in any way relying on hdev being immutable during the runtime of this function, neither does it even look at any of the members of hdev, and as such there is no need to hold that lock.

This fixes the lockdep splat below:

======================================================
WARNING: possible circular locking dependency detected
5.12.0-rc1-00026-g73d464503354 #10 Not tainted
------------------------------------------------------
bluetoothd/1118 is trying to acquire lock:
ffff8f078383c078 (&hdev->lock){+.+.}-{3:3}, at: hci_conn_get_phy+0x1c/0x150 [bluetooth]

but task is already holding lock:
ffff8f07e831d920 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0}, at: l2cap_sock_getsockopt+0x8b/0x610

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #3 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0}:
       lock_sock_nested+0x72/0xa0
       l2cap_sock_ready_cb+0x18/0x70 [bluetooth]
       l2cap_config_rsp+0x27a/0x520 [bluetooth]
       l2cap_sig_channel+0x658/0x1330 [bluetooth]
       l2cap_recv_frame+0x1ba/0x310 [bluetooth]
       hci_rx_work+0x1cc/0x640 [bluetooth]
       process_one_work+0x244/0x5f0
       worker_thread+0x3c/0x380
       kthread+0x13e/0x160
       ret_from_fork+0x22/0x30

-> #2 (&chan->lock#2/1){+.+.}-{3:3}:
       __mutex_lock+0xa3/0xa10
       l2cap_chan_connect+0x33a/0x940 [bluetooth]
       l2cap_sock_connect+0x141/0x2a0 [bluetooth]
       __sys_connect+0x9b/0xc0
       __x64_sys_connect+0x16/0x20
       do_syscall_64+0x33/0x80
       entry_SYSCALL_64_after_hwframe+0x44/0xae

-> #1 (&conn->chan_lock){+.+.}-{3:3}:
       __mutex_lock+0xa3/0xa10
       l2cap_chan_connect+0x322/0x940 [bluetooth]
       l2cap_sock_connect+0x141/0x2a0 [bluetooth]
       __sys_connect+0x9b/0xc0
       __x64_sys_connect+0x16/0x20
       do_syscall_64+0x33/0x80
       entry_SYSCALL_64_after_hwframe+0x44/0xae

-> #0 (&hdev->lock){+.+.}-{3:3}:
       __lock_acquire+0x147a/0x1a50
       lock_acquire+0x277/0x3d0
       __mutex_lock+0xa3/0xa10
       hci_conn_get_phy+0x1c/0x150 [bluetooth]
       l2cap_sock_getsockopt+0x5a9/0x610 [bluetooth]
       __sys_getsockopt+0xcc/0x200
       __x64_sys_getsockopt+0x20/0x30
       do_syscall_64+0x33/0x80
       entry_SYSCALL_64_after_hwframe+0x44/0xae

other info that might help us debug this:

Chain exists of:
  &hdev->lock --> &chan->lock#2/1 --> sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP);
                               lock(&chan->lock#2/1);
                               lock(sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP);
  lock(&hdev->lock);

 *** DEADLOCK ***

1 lock held by bluetoothd/1118:
 #0: ffff8f07e831d920 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0}, at: l2cap_sock_getsockopt+0x8b/0x610 [bluetooth]

stack backtrace:
CPU: 3 PID: 1118 Comm: bluetoothd Not tainted 5.12.0-rc1-00026-g73d464503354 #10
Hardware name: LENOVO 20K5S22R00/20K5S22R00, BIOS R0IET38W (1.16 ) 05/31/2017
Call Trace:
 dump_stack+0x7f/0xa1
 check_noncircular+0x105/0x120
 ? __lock_acquire+0x147a/0x1a50
 __lock_acquire+0x147a/0x1a50
 lock_acquire+0x277/0x3d0
 ? hci_conn_get_phy+0x1c/0x150 [bluetooth]
 ? __lock_acquire+0x2e1/0x1a50
 ? lock_is_held_type+0xb4/0x120
 ? hci_conn_get_phy+0x1c/0x150 [bluetooth]
 __mutex_lock+0xa3/0xa10
 ? hci_conn_get_phy+0x1c/0x150 [bluetooth]
 ? lock_acquire+0x277/0x3d0
 ? mark_held_locks+0x49/0x70
 ? mark_held_locks+0x49/0x70
 ? hci_conn_get_phy+0x1c/0x150 [bluetooth]
 hci_conn_get_phy+0x

---truncated---

以上是 CVE 记录(cvelist)中的原文,未经改写。

事件记录

+DIS披露

CVE 记录发布,编号分配方是 Linux。

来源 cvelist · 本站 批量导入 · 原始记录
{
  "id": 252811,
  "type": "disclosed",
  "source": "cvelist",
  "url": "https://www.cve.org/CVERecord?id=CVE-2021-47038",
  "occurred_at": "2024-02-28T08:13:45.31Z",
  "observed_at": "2026-11-13T05:37:31.591644Z",
  "is_backfill": true,
  "dedupe_key": "",
  "detail": {
    "ssvc": {
      "timestamp": "2024-09-10T15:57:52.490548Z",
      "automatable": "no",
      "exploitation": "none",
      "technical_impact": "partial"
    },
    "state": "PUBLISHED",
    "date_published": "2024-02-28T08:13:45.310Z",
    "assigner_short_name": "Linux"
  }
}

纠错

报告错误或缺失

页面有误或缺失?告诉编辑;采纳后在本页修订记录公开说明,上游数据不会被改动。

研究员讨论

近 7 天有 0 位研究员提到

研究员在 X 上提到此 CVE 的帖子,原文照录,nday 不核实。

尚未采集到名单内研究员在 X 上提到此 CVE 的帖子。

讨论

0 条评论

还没有评论。