{"api_version":"1","generated_at":"2026-12-04T01:35:53+00:00","cve":"CVE-2026-139176","urls":{"html":"https://cve.report/CVE-2026-139176","api":"https://cve.report/api/cve/CVE-2026-139176.json","docs":"https://cve.report/api","cve_org":"https://www.cve.org/CVERecord?id=CVE-2026-139176","nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-139176"},"summary":{"title":"bpf: Fix bpf_timer callback running on a freed map","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Fix bpf_timer callback running on a freed map\n\nA bpf_timer in an inner map can fire after the map has been freed, and\nbpf_timer_cb() then reads the freed map:\n\n  [   50.709520] BUG: KASAN: slab-use-after-free in bpf_timer_cb+0x249/0x290\n  [   50.709540] Read of size 4 at addr ff11000003bc1030 by task bpftimer/72\n  ...\n  [   50.710783] Freed by task 12:\n  ...\n  [   50.710826]  bpf_map_free+0x1a2/0x380\n\nWhen user space closes the map, its timers are cancelled and their\ncallbacks are cleared.  Since commit 1bfbc267ec91 (\"bpf: Enable\nbpf_timer and bpf_wq in any context\"), bpf_timer_set_callback() and\nbpf_timer_start() run without a lock, so a program that found the timer\njust before the close can still use it afterwards:\n\n  Task A                  Task B                  Task C\n  ------                  ------                  ------\n  bpf_timer_start()\n    finds the timer\n                          bpf_timer_set_callback()\n                            finds the timer\n                                                  close(map_fd)\n                                                    clears the callback\n                                                    cancels the timer\n                            sets the callback\n    arms the timer\n                                                  deletes the map from\n                                                  the outer map\n                                                    map is freed\n  the timer fires\n    bpf_timer_cb() reads the freed map\n\nThe timer is cancelled once more when it is finally freed, but that\nhappens well after the inner map is freed, so a timer started this way\ncan still fire on the freed map.\n\nClear the timer's map pointer in bpf_async_cancel_and_free() before the\nmap can be freed, and make the bpf_timer and bpf_wq callbacks return\nearly when it is NULL.  The map is not freed until callbacks that are\nalready running have finished, so a callback either sees the map while\nit is still valid or sees NULL.\n\nThe reproducer below calls the two helpers in a loop on two CPUs while a\nthird CPU keeps creating an inner map with a timer, closing it and\nremoving it from the outer map.  This bug was identified and confirmed\nwith the help of a deterministic hypervisor currently under development,\nbut the non-deterministic C reproducer can typically trigger it in the\n1-50s time range.  With the fix, nothing is triggered after 600 seconds.","state":"PUBLISHED","assigner":"Linux","published_at":"2026-11-30 14:18:36","updated_at":"2026-11-30 14:18:36"},"problem_types":[],"metrics":[],"references":[{"url":"https://git.kernel.org/stable/c/59d581d8e9cc019ebedc8145ec8ba56ca04e2383","name":"https://git.kernel.org/stable/c/59d581d8e9cc019ebedc8145ec8ba56ca04e2383","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/815a0a2a40d6c5985a153041231731651bc4024b","name":"https://git.kernel.org/stable/c/815a0a2a40d6c5985a153041231731651bc4024b","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://www.cve.org/CVERecord?id=CVE-2026-139176","name":"CVE Program record","refsource":"CVE.ORG","tags":["canonical"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-139176","name":"NVD vulnerability detail","refsource":"NVD","tags":["canonical","analysis"]}],"affected":[{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 1bfbc267ec915e58c3723a2237bf067f0c4dffa8 59d581d8e9cc019ebedc8145ec8ba56ca04e2383 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 1bfbc267ec915e58c3723a2237bf067f0c4dffa8 815a0a2a40d6c5985a153041231731651bc4024b git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 7.0","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 7.0 semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 7.3.6 7.3.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 7.4-rc1 * original_commit_for_fix","platforms":[]}],"timeline":[],"solutions":[],"workarounds":[],"exploits":[],"credits":[],"nvd_cpes":[],"vendor_comments":[],"enrichments":{"kev":null,"epss":null,"legacy_qids":[]},"source_records":{"cve_program":{"containers":{"cna":{"affected":[{"defaultStatus":"unaffected","product":"Linux","programFiles":["kernel/bpf/helpers.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"lessThan":"59d581d8e9cc019ebedc8145ec8ba56ca04e2383","status":"affected","version":"1bfbc267ec915e58c3723a2237bf067f0c4dffa8","versionType":"git"},{"lessThan":"815a0a2a40d6c5985a153041231731651bc4024b","status":"affected","version":"1bfbc267ec915e58c3723a2237bf067f0c4dffa8","versionType":"git"}]},{"defaultStatus":"affected","product":"Linux","programFiles":["kernel/bpf/helpers.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"status":"affected","version":"7.0"},{"lessThan":"7.0","status":"unaffected","version":"0","versionType":"semver"},{"lessThanOrEqual":"7.3.*","status":"unaffected","version":"7.3.6","versionType":"semver"},{"lessThanOrEqual":"*","status":"unaffected","version":"7.4-rc1","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"cpeMatch":[{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.3.6","versionStartIncluding":"7.0","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.4-rc1","versionStartIncluding":"7.0","vulnerable":true}],"negate":false,"operator":"OR"}]}],"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Fix bpf_timer callback running on a freed map\n\nA bpf_timer in an inner map can fire after the map has been freed, and\nbpf_timer_cb() then reads the freed map:\n\n  [   50.709520] BUG: KASAN: slab-use-after-free in bpf_timer_cb+0x249/0x290\n  [   50.709540] Read of size 4 at addr ff11000003bc1030 by task bpftimer/72\n  ...\n  [   50.710783] Freed by task 12:\n  ...\n  [   50.710826]  bpf_map_free+0x1a2/0x380\n\nWhen user space closes the map, its timers are cancelled and their\ncallbacks are cleared.  Since commit 1bfbc267ec91 (\"bpf: Enable\nbpf_timer and bpf_wq in any context\"), bpf_timer_set_callback() and\nbpf_timer_start() run without a lock, so a program that found the timer\njust before the close can still use it afterwards:\n\n  Task A                  Task B                  Task C\n  ------                  ------                  ------\n  bpf_timer_start()\n    finds the timer\n                          bpf_timer_set_callback()\n                            finds the timer\n                                                  close(map_fd)\n                                                    clears the callback\n                                                    cancels the timer\n                            sets the callback\n    arms the timer\n                                                  deletes the map from\n                                                  the outer map\n                                                    map is freed\n  the timer fires\n    bpf_timer_cb() reads the freed map\n\nThe timer is cancelled once more when it is finally freed, but that\nhappens well after the inner map is freed, so a timer started this way\ncan still fire on the freed map.\n\nClear the timer's map pointer in bpf_async_cancel_and_free() before the\nmap can be freed, and make the bpf_timer and bpf_wq callbacks return\nearly when it is NULL.  The map is not freed until callbacks that are\nalready running have finished, so a callback either sees the map while\nit is still valid or sees NULL.\n\nThe reproducer below calls the two helpers in a loop on two CPUs while a\nthird CPU keeps creating an inner map with a timer, closing it and\nremoving it from the outer map.  This bug was identified and confirmed\nwith the help of a deterministic hypervisor currently under development,\nbut the non-deterministic C reproducer can typically trigger it in the\n1-50s time range.  With the fix, nothing is triggered after 600 seconds."}],"providerMetadata":{"dateUpdated":"2026-11-30T13:32:17.061Z","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux"},"references":[{"url":"https://git.kernel.org/stable/c/59d581d8e9cc019ebedc8145ec8ba56ca04e2383"},{"url":"https://git.kernel.org/stable/c/815a0a2a40d6c5985a153041231731651bc4024b"}],"title":"bpf: Fix bpf_timer callback running on a freed map","x_generator":{"engine":"bippy-1.2.0"}}},"cveMetadata":{"assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","assignerShortName":"Linux","cveId":"CVE-2026-139176","datePublished":"2026-11-30T13:32:17.061Z","dateReserved":"2026-11-30T13:22:15.918Z","dateUpdated":"2026-11-30T13:32:17.061Z","state":"PUBLISHED"},"dataType":"CVE_RECORD","dataVersion":"5.2"},"nvd":{"publishedDate":"2026-11-30 14:18:36","lastModifiedDate":"2026-11-30 14:18:36","problem_types":[],"metrics":[],"configurations":[]},"legacy_mitre":{"record":{"CveYear":"2026","CveId":"139176","Ordinal":"1","Title":"bpf: Fix bpf_timer callback running on a freed map","CVE":"CVE-2026-139176","Year":"2026"},"notes":[{"CveYear":"2026","CveId":"139176","Ordinal":"1","NoteData":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Fix bpf_timer callback running on a freed map\n\nA bpf_timer in an inner map can fire after the map has been freed, and\nbpf_timer_cb() then reads the freed map:\n\n  [   50.709520] BUG: KASAN: slab-use-after-free in bpf_timer_cb+0x249/0x290\n  [   50.709540] Read of size 4 at addr ff11000003bc1030 by task bpftimer/72\n  ...\n  [   50.710783] Freed by task 12:\n  ...\n  [   50.710826]  bpf_map_free+0x1a2/0x380\n\nWhen user space closes the map, its timers are cancelled and their\ncallbacks are cleared.  Since commit 1bfbc267ec91 (\"bpf: Enable\nbpf_timer and bpf_wq in any context\"), bpf_timer_set_callback() and\nbpf_timer_start() run without a lock, so a program that found the timer\njust before the close can still use it afterwards:\n\n  Task A                  Task B                  Task C\n  ------                  ------                  ------\n  bpf_timer_start()\n    finds the timer\n                          bpf_timer_set_callback()\n                            finds the timer\n                                                  close(map_fd)\n                                                    clears the callback\n                                                    cancels the timer\n                            sets the callback\n    arms the timer\n                                                  deletes the map from\n                                                  the outer map\n                                                    map is freed\n  the timer fires\n    bpf_timer_cb() reads the freed map\n\nThe timer is cancelled once more when it is finally freed, but that\nhappens well after the inner map is freed, so a timer started this way\ncan still fire on the freed map.\n\nClear the timer's map pointer in bpf_async_cancel_and_free() before the\nmap can be freed, and make the bpf_timer and bpf_wq callbacks return\nearly when it is NULL.  The map is not freed until callbacks that are\nalready running have finished, so a callback either sees the map while\nit is still valid or sees NULL.\n\nThe reproducer below calls the two helpers in a loop on two CPUs while a\nthird CPU keeps creating an inner map with a timer, closing it and\nremoving it from the outer map.  This bug was identified and confirmed\nwith the help of a deterministic hypervisor currently under development,\nbut the non-deterministic C reproducer can typically trigger it in the\n1-50s time range.  With the fix, nothing is triggered after 600 seconds.","Type":"Description","Title":"bpf: Fix bpf_timer callback running on a freed map"}]}}}