Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1359 CNY

100%

CVE-2025-21825— bpf: Cancel the running bpf_timer through kworker for PREEMPT_RT

Quick assessment

Affected
Linux Linux
Exploitation
No confirmed in-the-wild exploitation; assess based on exposure
Recommended action
Check the vendor advisory and references for a fixed version. If immediate upgrade is impossible, restrict exposure and increase monitoring.

Linux kernel是美国Linux基金会的开源操作系统Linux所使用的内核。 Linux kernel存在安全漏洞,该漏洞源于在PREEMPT_RT环境中通过kworker取消正在运行的bpf_timer时可能导致调度问题。

CVSS 7.8 · High EPSS 0.18% · P7

Possible ATT&CK Techniques 1 AI

T1055 · Process Injection

Affected Version Matrix 10

VendorProduct Version RangeStatus
Linux Linux b00628b1c7d595ae5b544e059c27b1f5828314b4< 50e44aa5f9905d237c245b8012937ef4dd971dcb affected
b00628b1c7d595ae5b544e059c27b1f5828314b4< 33e47d9573075342a41783a55c8c67bc71246fc1 affected
b00628b1c7d595ae5b544e059c27b1f5828314b4< fbeda3d939ca10063aafa7a77cc0f409d82cda88 affected
b00628b1c7d595ae5b544e059c27b1f5828314b4< 58f038e6d209d2dd862fcf5de55407855856794d affected
5.15 affected
< 5.15 unaffected
6.6.160≤ 6.6.* unaffected
6.12.13≤ 6.12.* unaffected
… +2 more rows
Get alerts for future matching vulnerabilities Log in to subscribe

I. Basic Information for CVE-2025-21825

Vulnerability Information

Have questions about the vulnerability? See if Shenlong's analysis helps!
View Shenlong Deep Dive ↗

Although we use advanced large model technology, its output may still contain inaccurate or outdated information.Shenlong tries to ensure data accuracy, but please verify and judge based on the actual situation.

Vulnerability Title
bpf: Cancel the running bpf_timer through kworker for PREEMPT_RT
Source: CVE Program / CVE List V5
Vulnerability Description
In the Linux kernel, the following vulnerability has been resolved: bpf: Cancel the running bpf_timer through kworker for PREEMPT_RT During the update procedure, when overwrite element in a pre-allocated htab, the freeing of old_element is protected by the bucket lock. The reason why the bucket lock is necessary is that the old_element has already been stashed in htab->extra_elems after alloc_htab_elem() returns. If freeing the old_element after the bucket lock is unlocked, the stashed element may be reused by concurrent update procedure and the freeing of old_element will run concurrently with the reuse of the old_element. However, the invocation of check_and_free_fields() may acquire a spin-lock which violates the lockdep rule because its caller has already held a raw-spin-lock (bucket lock). The following warning will be reported when such race happens: BUG: scheduling while atomic: test_progs/676/0x00000003 3 locks held by test_progs/676: #0: ffffffff864b0240 (rcu_read_lock_trace){....}-{0:0}, at: bpf_prog_test_run_syscall+0x2c0/0x830 #1: ffff88810e961188 (&htab->lockdep_key){....}-{2:2}, at: htab_map_update_elem+0x306/0x1500 #2: ffff8881f4eac1b8 (&base->softirq_expiry_lock){....}-{2:2}, at: hrtimer_cancel_wait_running+0xe9/0x1b0 Modules linked in: bpf_testmod(O) Preemption disabled at: [<ffffffff817837a3>] htab_map_update_elem+0x293/0x1500 CPU: 0 UID: 0 PID: 676 Comm: test_progs Tainted: G ... 6.12.0+ #11 Tainted: [W]=WARN, [O]=OOT_MODULE Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)... Call Trace: <TASK> dump_stack_lvl+0x57/0x70 dump_stack+0x10/0x20 __schedule_bug+0x120/0x170 __schedule+0x300c/0x4800 schedule_rtlock+0x37/0x60 rtlock_slowlock_locked+0x6d9/0x54c0 rt_spin_lock+0x168/0x230 hrtimer_cancel_wait_running+0xe9/0x1b0 hrtimer_cancel+0x24/0x30 bpf_timer_delete_work+0x1d/0x40 bpf_timer_cancel_and_free+0x5e/0x80 bpf_obj_free_fields+0x262/0x4a0 check_and_free_fields+0x1d0/0x280 htab_map_update_elem+0x7fc/0x1500 bpf_prog_9f90bc20768e0cb9_overwrite_cb+0x3f/0x43 bpf_prog_ea601c4649694dbd_overwrite_timer+0x5d/0x7e bpf_prog_test_run_syscall+0x322/0x830 __sys_bpf+0x135d/0x3ca0 __x64_sys_bpf+0x75/0xb0 x64_sys_call+0x1b5/0xa10 do_syscall_64+0x3b/0xc0 entry_SYSCALL_64_after_hwframe+0x4b/0x53 ... </TASK> It seems feasible to break the reuse and refill of per-cpu extra_elems into two independent parts: reuse the per-cpu extra_elems with bucket lock being held and refill the old_element as per-cpu extra_elems after the bucket lock is unlocked. However, it will make the concurrent overwrite procedures on the same CPU return unexpected -E2BIG error when the map is full. Therefore, the patch fixes the lock problem by breaking the cancelling of bpf_timer into two steps for PREEMPT_RT: 1) use hrtimer_try_to_cancel() and check its return value 2) if the timer is running, use hrtimer_cancel() through a kworker to cancel it again Considering that the current implementation of hrtimer_cancel() will try to acquire a being held softirq_expiry_lock when the current timer is running, these steps above are reasonable. However, it also has downside. When the timer is running, the cancelling of the timer is delayed when releasing the last map uref. The delay is also fixable (e.g., break the cancelling of bpf timer into two parts: one part in locked scope, another one in unlocked scope), it can be revised later if necessary. It is a bit hard to decide the right fix tag. One reason is that the problem depends on PREEMPT_RT which is enabled in v6.12. Considering the softirq_expiry_lock lock exists since v5.4 and bpf_timer is introduced in v5.15, the bpf_timer commit is used in the fixes tag and an extra depends-on tag is added to state the dependency on PREEMPT_RT. Depends-on: v6.12+ with PREEMPT_RT enabled
Source: CVE Program / CVE List V5
CVSS Information
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Source: CVE Program / CVE List V5
Vulnerability Type
N/A
Source: CVE Program / CVE List V5
Vulnerability Title
Linux kernel 安全漏洞
Source: CNNVD (China National Vulnerability Database)
Vulnerability Description
Linux kernel是美国Linux基金会的开源操作系统Linux所使用的内核。 Linux kernel存在安全漏洞,该漏洞源于在PREEMPT_RT环境中通过kworker取消正在运行的bpf_timer时可能导致调度问题。
Source: CNNVD (China National Vulnerability Database)
CVSS Information
N/A
Source: CNNVD (China National Vulnerability Database)
Vulnerability Type
N/A
Source: CNNVD (China National Vulnerability Database)

Affected Products

Vendor Product Affected Versions CPE Subscribe
Linux Linux b00628b1c7d595ae5b544e059c27b1f5828314b4 ~ 50e44aa5f9905d237c245b8012937ef4dd971dcb -
Linux Linux 5.15 -

II. Public POCs for CVE-2025-21825

# POC Description Source Link Shenlong Link
AI-Generated POC Premium

No public POC found.

Login to generate AI POC

III. Intelligence Information for CVE-2025-21825

请登录查看更多情报信息。

Patches & Fixes for CVE-2025-21825 (4)

Same Patch Batch · Linux · 2025-03-06 · 46 CVEs total

CVE-2025-21829 9.8 CRITICAL RDMA/rxe: Fix the warning "__rxe_cleanup+0x12c/0x170 [rdma_rxe]"
CVE-2025-21828 8.8 HIGH wifi: mac80211: don't flush non-uploaded STAs
CVE-2025-21826 7.8 HIGH netfilter: nf_tables: reject mismatching sum of field_len with set key length
CVE-2024-58070 7.8 HIGH bpf: bpf_local_storage: Always use bpf_mem_alloc in PREEMPT_RT
CVE-2025-21832 7.8 HIGH block: don't revert iter for -EIOCBQUEUED
CVE-2024-58083 7.8 HIGH KVM: Explicitly verify target vCPU is online in kvm_get_vcpu()
CVE-2024-58069 7.8 HIGH rtc: pcf85063: fix potential OOB write in PCF85063 NVMEM read
CVE-2024-58086 7.8 HIGH drm/v3d: Stop active perfmon if it is being destroyed
CVE-2024-58060 7.8 HIGH bpf: Reject struct_ops registration that uses module ptr and the module btf_id is missing
CVE-2024-58075 7.8 HIGH crypto: tegra - do not transfer req when tegra init fails
CVE-2025-21827 7.8 HIGH Bluetooth: btusb: mediatek: Add locks for usb_driver_claim_interface()
CVE-2024-58079 7.8 HIGH media: uvcvideo: Fix crash during unbind if gpio unit is in use
CVE-2024-58053 7.5 HIGH rxrpc: Fix handling of received connection abort
CVE-2025-21830 7.3 HIGH landlock: Handle weird files
CVE-2024-58066 clk: mmp: pxa1908-apbcp: Fix a NULL vs IS_ERR() check
CVE-2024-58064 wifi: cfg80211: tests: Fix potential NULL dereference in test_cfg80211_parse_colocated_ap(
CVE-2024-58061 wifi: mac80211: prohibit deactivating all links
CVE-2024-58063 wifi: rtlwifi: fix memory leaks and invalid access at probe error path
CVE-2024-58065 clk: mmp: pxa1908-apbc: Fix NULL vs IS_ERR() check
CVE-2024-58062 wifi: iwlwifi: mvm: avoid NULL pointer dereference

Showing top 20 of 46 CVEs. View all on vendor page &rarr; →

IV. Related Vulnerabilities

V. Comments for CVE-2025-21825

No comments yet


Leave a comment