Vulnerability · Published Aug 17, 2024 · Assigned by Linux
CVE-2024-43834xdp: fix invalid wait context of page_pool_destroy()
Medium 5.5
In plain English
A medium-severity security flaw in Linux from Linux. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.2% (higher than 16% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official description
In the Linux kernel, the following vulnerability has been resolved: xdp: fix invalid wait context of page_pool_destroy() If the driver uses a page pool, it creates a page pool with page_pool_create(). The reference count of page pool is 1 as default. A page pool will be destroyed only when a reference count reaches 0. page_pool_destroy() is used to destroy page pool, it decreases a reference count. When a page pool is destroyed, ->disconnect() is called, which is mem_allocator_disconnect(). This function internally acquires mutex_lock(). If the driver uses XDP, it registers a memory model with xdp_rxq_info_reg_mem_model(). The xdp_rxq_info_reg_mem_model() internally increases a page pool reference count if a memory model is a page pool. Now the reference count is 2. To destroy a page pool, the driver should call both page_pool_destroy() and xdp_unreg_mem_model(). The xdp_unreg_mem_model() internally calls page_pool_destroy(). Only page_pool_destroy() decreases a reference count. If a driver calls page_pool_destroy() then xdp_unreg_mem_model(), we will face an invalid wait context warning. Because xdp_unreg_mem_model() calls page_pool_destroy() with rcu_read_lock(). The page_pool_destroy() internally acquires mutex_lock(). Splat looks like: ============================= [ BUG: Invalid wait context ] 6.10.0-rc6+ #4 Tainted: G W ----------------------------- ethtool/1806 is trying to lock: ffffffff90387b90 (mem_id_lock){+.+.}-{4:4}, at: mem_allocator_disconnect+0x73/0x150 other info that might help us debug this: context-{5:5} 3 locks held by ethtool/1806: stack backtrace: CPU: 0 PID: 1806 Comm: ethtool Tainted: G W 6.10.0-rc6+ #4 f916f41f172891c800f2fed Hardware name: ASUS System Product Name/PRIME Z690-P D4, BIOS 0603 11/01/2021 Call Trace: <TASK> dump_stack_lvl+0x7e/0xc0 __lock_acquire+0x1681/0x4de0 ? _printk+0x64/0xe0 ? __pfx_mark_lock.part.0+0x10/0x10 ? __pfx___lock_acquire+0x10/0x10 lock_acquire+0x1b3/0x580 ? mem_allocator_disconnect+0x73/0x150 ? __wake_up_klogd.part.0+0x16/0xc0 ? __pfx_lock_acquire+0x10/0x10 ? dump_stack_lvl+0x91/0xc0 __mutex_lock+0x15c/0x1690 ? mem_allocator_disconnect+0x73/0x150 ? __pfx_prb_read_valid+0x10/0x10 ? mem_allocator_disconnect+0x73/0x150 ? __pfx_llist_add_batch+0x10/0x10 ? console_unlock+0x193/0x1b0 ? lockdep_hardirqs_on+0xbe/0x140 ? __pfx___mutex_lock+0x10/0x10 ? tick_nohz_tick_stopped+0x16/0x90 ? __irq_work_queue_local+0x1e5/0x330 ? irq_work_queue+0x39/0x50 ? __wake_up_klogd.part.0+0x79/0xc0 ? mem_allocator_disconnect+0x73/0x150 mem_allocator_disconnect+0x73/0x150 ? __pfx_mem_allocator_disconnect+0x10/0x10 ? mark_held_locks+0xa5/0xf0 ? rcu_is_watching+0x11/0xb0 page_pool_release+0x36e/0x6d0 page_pool_destroy+0xd7/0x440 xdp_unreg_mem_model+0x1a7/0x2a0 ? __pfx_xdp_unreg_mem_model+0x10/0x10 ? kfree+0x125/0x370 ? bnxt_free_ring.isra.0+0x2eb/0x500 ? bnxt_free_mem+0x5ac/0x2500 xdp_rxq_info_unreg+0x4a/0xd0 bnxt_free_mem+0x1356/0x2500 bnxt_close_nic+0xf0/0x3b0 ? __pfx_bnxt_close_nic+0x10/0x10 ? ethnl_parse_bit+0x2c6/0x6d0 ? __pfx___nla_validate_parse+0x10/0x10 ? __pfx_ethnl_parse_bit+0x10/0x10 bnxt_set_features+0x2a8/0x3e0 __netdev_update_features+0x4dc/0x1370 ? ethnl_parse_bitset+0x4ff/0x750 ? __pfx_ethnl_parse_bitset+0x10/0x10 ? __pfx___netdev_update_features+0x10/0x10 ? mark_held_locks+0xa5/0xf0 ? _raw_spin_unlock_irqrestore+0x42/0x70 ? __pm_runtime_resume+0x7d/0x110 ethnl_set_features+0x32d/0xa20 To fix this problem, it uses rhashtable_lookup_fast() instead of rhashtable_lookup() with rcu_read_lock(). Using xa without rcu_read_lock() here is safe. xa is freed by __xdp_mem_allocator_rcu_free() and this is called by call_rcu() of mem_xa_remove(). The mem_xa_remove() is called by page_pool_destroy() if a reference count reaches 0. The xa is already protected by the reference count mechanism well in the control plane. So removing rcu_read_lock() for page_pool_destroy() is safe.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | linux | 6.1.106-1 | DEBIAN-CVE-2024-43834 |
| Debian:13 | linux | 6.10.3-1 | DEBIAN-CVE-2024-43834 |
| Debian:14 | linux | 6.10.3-1 | DEBIAN-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux | 5.15.0-125.135 | UBUNTU-CVE-2024-43834 |
| Ubuntu:24.04:LTS | linux | 6.8.0-50.51 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-allwinner-5.19 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-aws | 5.15.0-1072.78 | UBUNTU-CVE-2024-43834 |
| Ubuntu:24.04:LTS | linux-aws | 6.8.0-1020.22 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-aws-5.19 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-aws-6.2 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-aws-6.5 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-aws-6.8 | 6.8.0-1020.22~22.04.1 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-azure | 5.15.0-1075.84 | UBUNTU-CVE-2024-43834 |
| Ubuntu:24.04:LTS | linux-azure | 6.8.0-1020.23 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-azure-5.19 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-azure-6.2 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-azure-6.5 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-azure-6.8 | 6.8.0-1020.23~22.04.1 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-azure-fde | 5.15.0-1076.85.1 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-azure-fde-5.19 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-azure-fde-6.2 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-gcp | 5.15.0-1071.79 | UBUNTU-CVE-2024-43834 |
| Ubuntu:24.04:LTS | linux-gcp | 6.8.0-1019.21 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-gcp-5.19 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-gcp-6.2 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-gcp-6.5 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-gcp-6.8 | 6.8.0-1019.21~22.04.1 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-gke | 5.15.0-1069.75 | UBUNTU-CVE-2024-43834 |
| Ubuntu:24.04:LTS | linux-gke | 6.8.0-1015.19 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-gkeop | 5.15.0-1055.62 | UBUNTU-CVE-2024-43834 |
| Ubuntu:24.04:LTS | linux-gkeop | 6.8.0-1002.4 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-hwe-5.19 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-hwe-6.2 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-hwe-6.5 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-hwe-6.8 | 6.8.0-50.51~22.04.1 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-ibm | 5.15.0-1065.68 | UBUNTU-CVE-2024-43834 |
| Ubuntu:24.04:LTS | linux-ibm | 6.8.0-1017.17 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-ibm-6.8 | 6.8.0-1017.17~22.04.1 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-intel-iotg | 5.15.0-1067.73 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-kvm | 5.15.0-1069.74 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-lowlatency | 5.15.0-125.135 | UBUNTU-CVE-2024-43834 |
| Ubuntu:24.04:LTS | linux-lowlatency | 6.8.0-50.51.1 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-5.19 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.2 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.5 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.8 | 6.8.0-50.51.1~22.04.1 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-nvidia | 5.15.0-1067.68 | UBUNTU-CVE-2024-43834 |
| Ubuntu:24.04:LTS | linux-nvidia | 6.8.0-1019.21 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-nvidia-6.2 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-nvidia-6.5 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-nvidia-6.8 | 6.8.0-1019.21~22.04.1 | UBUNTU-CVE-2024-43834 |
| Ubuntu:24.04:LTS | linux-nvidia-lowlatency | 6.8.0-1019.21.1 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-nvidia-tegra | 5.15.0-1032.32 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-nvidia-tegra-igx | 5.15.0-1020.20 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-oem-5.17 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-oem-6.0 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-oem-6.1 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-oem-6.5 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:24.04:LTS | linux-oem-6.8 | 6.8.0-1018.18 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-oracle | 5.15.0-1070.76 | UBUNTU-CVE-2024-43834 |
| Ubuntu:24.04:LTS | linux-oracle | 6.8.0-1017.18 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-oracle-6.5 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-oracle-6.8 | 6.8.0-1017.18~22.04.1 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-raspi | 5.15.0-1065.68 | UBUNTU-CVE-2024-43834 |
| Ubuntu:24.04:LTS | linux-raspi | 6.8.0-1016.18 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-realtime | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-riscv | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:24.04:LTS | linux-riscv | 6.8.0-50.51.1 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-riscv-5.19 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-riscv-6.5 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-riscv-6.8 | 6.8.0-50.51.1~22.04.1 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-starfive-5.19 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-starfive-6.2 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-starfive-6.5 | no fix listed | UBUNTU-CVE-2024-43834 |
| Ubuntu:24.04:LTS | linux-xilinx | 6.8.0-1017.18 | UBUNTU-CVE-2024-43834 |
| Ubuntu:22.04:LTS | linux-xilinx-zynqmp | 5.15.0-1038.42 | UBUNTU-CVE-2024-43834 |
Affected products (as reported)
| Vendor | Product | Versions |
|---|---|---|
| Linux | Linux | c3f812cea0d7006469d1cf33a4a9f0a12bb4b3a3 – before be9d08ff102df3ac4f66e826ea935cf3af63a4bdc3f812cea0d7006469d1cf33a4a9f0a12bb4b3a3 – before 6c390ef198aa69795427a5cb5fd7cb4bc7e6cd7ac3f812cea0d7006469d1cf33a4a9f0a12bb4b3a3 – before 3fc1be360b99baeea15cdee3cf94252cd3a72d26c3f812cea0d7006469d1cf33a4a9f0a12bb4b3a3 – before bf0ce5aa5f2525ed1b921ba36de96e458e77f482c3f812cea0d7006469d1cf33a4a9f0a12bb4b3a3 – before 12144069209eec7f2090ce9afa15acdcc2c2a537c3f812cea0d7006469d1cf33a4a9f0a12bb4b3a3 – before 59a931c5b732ca5fc2ca727f5a72aeabaafa85ecbf22306d92ca59c59dc4aa3bab14768948193d5605f646cb2174d1a4e032b60b99097f5c4b522616 |
| Linux | Linux | 5.5 |
References
- https://git.kernel.org/stable/c/be9d08ff102df3ac4f66e826ea935cf3af63a4bd
- https://git.kernel.org/stable/c/6c390ef198aa69795427a5cb5fd7cb4bc7e6cd7a
- https://git.kernel.org/stable/c/3fc1be360b99baeea15cdee3cf94252cd3a72d26
- https://git.kernel.org/stable/c/bf0ce5aa5f2525ed1b921ba36de96e458e77f482
- https://git.kernel.org/stable/c/12144069209eec7f2090ce9afa15acdcc2c2a537
- https://git.kernel.org/stable/c/59a931c5b732ca5fc2ca727f5a72aeabaafa85ec
- https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html
- https://lists.debian.org/debian-lts-announce/2024/10/msg00003.html
- https://cert-portal.siemens.com/productcert/html/ssa-265688.html