Vulnerability · Published Apr 3, 2024 · Assigned by Linux

CVE-2024-26737bpf: Fix racing between bpf_timer_cancel_and_free and bpf_timer_cancel

High 7.8

In plain English

A high-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.3% (higher than 17% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)7.8High
Exploit odds (30 days)0.3%top 83.1% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

Official description

In the Linux kernel, the following vulnerability has been resolved: bpf: Fix racing between bpf_timer_cancel_and_free and bpf_timer_cancel The following race is possible between bpf_timer_cancel_and_free and bpf_timer_cancel. It will lead a UAF on the timer->timer. bpf_timer_cancel(); spin_lock(); t = timer->time; spin_unlock(); bpf_timer_cancel_and_free(); spin_lock(); t = timer->timer; timer->timer = NULL; spin_unlock(); hrtimer_cancel(&t->timer); kfree(t); /* UAF on t */ hrtimer_cancel(&t->timer); In bpf_timer_cancel_and_free, this patch frees the timer->timer after a rcu grace period. This requires a rcu_head addition to the "struct bpf_hrtimer". Another kfree(t) happens in bpf_timer_init, this does not need a kfree_rcu because it is still under the spin_lock and timer->timer has not been visible by others yet. In bpf_timer_cancel, rcu_read_lock() is added because this helper can be used in a non rcu critical section context (e.g. from a sleepable bpf prog). Other timer->timer usages in helpers.c have been audited, bpf_timer_cancel() is the only place where timer->timer is used outside of the spin_lock. Another solution considered is to mark a t->flag in bpf_timer_cancel and clear it after hrtimer_cancel() is done. In bpf_timer_cancel_and_free, it busy waits for the flag to be cleared before kfree(t). This patch goes with a straight forward solution and frees timer->timer after a rcu grace period.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
AlmaLinux:9bpftool7.3.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-64k5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-64k-core5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-64k-debug5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-64k-debug-core5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-64k-debug-devel5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-64k-debug-devel-matched5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-64k-debug-modules5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-64k-debug-modules-core5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-64k-debug-modules-extra5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-64k-devel5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-64k-devel-matched5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-64k-modules5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-64k-modules-core5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-64k-modules-extra5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-abi-stablelists5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-core5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-cross-headers5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-debug5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-debug-core5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-debug-devel5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-debug-devel-matched5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-debug-modules5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-debug-modules-core5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-debug-modules-extra5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-debug-uki-virt5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-devel5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-devel-matched5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-doc5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-headers5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-modules5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-modules-core5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-modules-extra5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-rt5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-rt-core5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-rt-debug5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-rt-debug-core5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-rt-debug-devel5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-rt-debug-modules5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-rt-debug-modules-core5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-rt-debug-modules-extra5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-rt-devel5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-rt-modules5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-rt-modules-core5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-rt-modules-extra5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-tools5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-tools-libs5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-tools-libs-devel5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-uki-virt5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-zfcpdump5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-zfcpdump-core5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-zfcpdump-devel5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-zfcpdump-devel-matched5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-zfcpdump-modules5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-zfcpdump-modules-core5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9kernel-zfcpdump-modules-extra5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9libperf5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9perf5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9python3-perf5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9rtla5.14.0-427.28.1.el9_4ALSA-2024:4928
AlmaLinux:9rv5.14.0-427.28.1.el9_4ALSA-2024:4928
Debian:12linux6.1.82-1DEBIAN-CVE-2024-26737
Debian:13linux6.7.7-1DEBIAN-CVE-2024-26737
Debian:14linux6.7.7-1DEBIAN-CVE-2024-26737
Rocky Linux:9kernel0:5.14.0-427.28.1.el9_4.cloud.1.0RXSA-2024:4928
Rocky Linux:9kernel0:5.14.0-427.28.1.el9_4RLSA-2024:4928
Ubuntu:22.04:LTSlinux5.15.0-112.122UBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux5.15.0-112.122USN-6820-1
Ubuntu:22.04:LTSlinux-allwinner-5.19no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-aws5.15.0-1063.69USN-6821-3
Ubuntu:22.04:LTSlinux-aws5.15.0-1063.69UBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-aws-5.19no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-aws-6.2no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-aws-6.5no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-azure5.15.0-1066.75USN-6821-4
Ubuntu:22.04:LTSlinux-azure5.15.0-1066.75UBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-azure-5.19no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-azure-6.2no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-azure-6.5no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-azure-fde5.15.0-1065.74.1USN-6821-4
Ubuntu:22.04:LTSlinux-azure-fde5.15.0-1067.76.1UBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-azure-fde-5.19no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-azure-fde-6.2no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-gcp5.15.0-1062.70UBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-gcp5.15.0-1062.70USN-6820-1
Ubuntu:22.04:LTSlinux-gcp-5.19no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-gcp-6.2no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-gcp-6.5no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-gke5.15.0-1060.66UBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-gke5.15.0-1060.66USN-6821-1
Ubuntu:22.04:LTSlinux-gkeop5.15.0-1046.53UBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-gkeop5.15.0-1046.53USN-6821-2
Ubuntu:22.04:LTSlinux-hwe-5.19no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-hwe-6.2no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-hwe-6.5no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-ibm5.15.0-1056.59UBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-ibm5.15.0-1056.59USN-6821-1
Ubuntu:22.04:LTSlinux-intel-iotg5.15.0-1058.64USN-6821-1
Ubuntu:22.04:LTSlinux-intel-iotg5.15.0-1058.64UBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-kvm5.15.0-1060.65UBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-kvm5.15.0-1060.65USN-6821-2
Ubuntu:22.04:LTSlinux-lowlatency5.15.0-110.120USN-6820-1
Ubuntu:22.04:LTSlinux-lowlatency5.15.0-110.120UBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-lowlatency-hwe-5.19no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.2no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.5no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-nvidia5.15.0-1058.59USN-6820-2
Ubuntu:22.04:LTSlinux-nvidia5.15.0-1058.59UBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-nvidia-6.2no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-nvidia-6.5no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-nvidia-tegra5.15.0-1026.26UBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-nvidia-tegra-igx5.15.0-1015.15UBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-oem-5.17no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-oem-6.0no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-oem-6.1no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-oem-6.5no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-oracle5.15.0-1061.67USN-6821-1
Ubuntu:22.04:LTSlinux-oracle5.15.0-1061.67UBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-oracle-6.5no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-raspi5.15.0-1058.61UBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-raspi5.15.0-1058.61USN-6919-1
Ubuntu:22.04:LTSlinux-realtimeno fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-riscvno fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-riscv-5.19no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-riscv-6.5no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-starfive-5.19no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-starfive-6.2no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-starfive-6.5no fix listedUBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-xilinx-zynqmp5.15.0-1030.34UBUNTU-CVE-2024-26737
Ubuntu:22.04:LTSlinux-xilinx-zynqmp5.15.0-1030.34USN-6820-1

Affected products (as reported)

VendorProductVersions
Linux Linux b00628b1c7d595ae5b544e059c27b1f5828314b4 – before 5268bb02107b9eedfdcd51db75b407d10043368cb00628b1c7d595ae5b544e059c27b1f5828314b4 – before addf5e297e6cbf5341f9c07720693ca9ba0057b5b00628b1c7d595ae5b544e059c27b1f5828314b4 – before 8327ed12e8ebc5436bfaa1786c49988894f9c8a6b00628b1c7d595ae5b544e059c27b1f5828314b4 – before 7d80a9e745fa5b47da3bca001f186c02485c7c33b00628b1c7d595ae5b544e059c27b1f5828314b4 – before 0281b919e175bb9c3128bd3872ac2903e9436e3f
Linux Linux 5.15

References