{"id":"CVE-2026-143377","summary":"bpf: Drop percpu_counter from the htab element count","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Drop percpu_counter from the htab element count\n\nThe element count of a large non-preallocated hash map is a\npercpu_counter, whose slow path takes fbc-\u003elock with\nraw_spin_lock_irqsave(). That is not safe against BPF programs that run\nwhile the lock is held or contended: NMI programs and, as\nqueued_spin_lock_slowpath() calls trace_contention_end() with the lock\nalready held, programs attached to the contention_end tracepoint. If such\na program updates the same map it spins on the lock its own CPU holds:\n\n  WARNING: possible recursive locking detected\n  cend/250 is trying to acquire lock:\n  (key#5){....}-{2:2}, at: _raw_spin_lock_irqsave+0x18/0x30\n  but task is already holding lock:\n  (key#5){....}-{2:2}, at: _raw_spin_lock_irqsave+0x18/0x30\n    percpu_counter_add_batch+0xd8/0x160\n    alloc_htab_elem+0x408/0x480\n    htab_map_update_elem+0x1e8/0x6a0\n    bpf_prog_7a29a1ae68aedf07_cend+0x14c/0x1f8\n    __bpf_trace_contention_end+0x14/0x20\n    queued_spin_lock_slowpath+0x2e8/0x468\n    percpu_counter_add_batch+0xd8/0x160\n    alloc_htab_elem+0x408/0x480\n    htab_map_update_elem+0x1e8/0x6a0\n\nis_map_full() is affected too, as __percpu_counter_compare() falls back\nto percpu_counter_sum(), which takes the same lock.\n\nmap.elem_count already is a lockless per-cpu count of the same elements.\nMake htab-\u003ecount follow it in steps of PERCPU_COUNTER_BATCH and let\nis_map_full() sum elem_count once count is within nr_cpu_ids * batch of\nmax_entries. Each cpu's elem_count is ahead of count by less than the\nbatch, so that is exact, in NMI as well.","modified":"2026-12-03T11:02:10.011946830Z","published":"2026-12-03T09:22:25.137Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/143xxx/CVE-2026-143377.json"},"references":[{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"},{"type":"WEB","url":"https://git.kernel.org/stable/c/1cd28b5354ab77c727ed87255bf289a87178b415"},{"type":"WEB","url":"https://git.kernel.org/stable/c/6ddc16d58b40bc3276dcd3f4027df5e9e846d26a"},{"type":"WEB","url":"https://git.kernel.org/stable/c/d7c38cf0acd70e1d6fe99a59b0b2afc235a9f7de"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/143xxx/CVE-2026-143377.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-143377"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"86fe28f7692d96d20232af0fc6d7632d5cc89a01"},{"fixed":"6ddc16d58b40bc3276dcd3f4027df5e9e846d26a"},{"fixed":"d7c38cf0acd70e1d6fe99a59b0b2afc235a9f7de"},{"fixed":"1cd28b5354ab77c727ed87255bf289a87178b415"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-143377.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"6.1.0"},{"fixed":"6.18.66"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.7"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-143377.json"}}],"schema_version":"1.9.2"}