{"api_version":"1","generated_at":"2026-11-30T19:45:59+00:00","cve":"CVE-2026-139325","urls":{"html":"https://cve.report/CVE-2026-139325","api":"https://cve.report/api/cve/CVE-2026-139325.json","docs":"https://cve.report/api","cve_org":"https://www.cve.org/CVERecord?id=CVE-2026-139325","nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-139325"},"summary":{"title":"bpf: Forbid sleeping in hash map for_each callbacks","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Forbid sleeping in hash map for_each callbacks\n\nA sleepable program (e.g. SEC(\"syscall\"), lsm.s, fentry.s) can pass a\ncallback to bpf_for_each_map_elem() on a hash map and call a sleepable\nhelper or kfunc such as bpf_copy_from_user() from it. The verifier\naccepts this, but at run time the callback is invoked from inside an RCU\nread-side critical section:\n\n    bpf_for_each_hash_elem()\n      rcu_read_lock();\n      callback_fn(map, key, val, ctx, 0);\n        bpf_copy_from_user()       <- may fault and sleep\n      rcu_read_unlock();\n\nbpf_each_rhash_elem() does the same for BPF_MAP_TYPE_RHASH. Sleeping\nthere triggers the \"Voluntary context switch within RCU read-side\ncritical section!\" warning, delays grace periods, and with\nCONFIG_PREEMPT_RCU=n silently ends the read-side critical section that\nthe bucket walk relies on.\n\nSynchronous callbacks are verified with the caller's state, so\nkernel/bpf/verifier.c:in_sleepable_context() only looks at the program's\nsleepability and the locks the program took itself, and does not know\nthat the helper holds rcu_read_lock() around the callback.\n\nWith a SEC(\"syscall\") program whose callback reads a page that has to be\nread from disk first:\n\n  BUG: sleeping function called from invalid context at include/linux/uaccess.h:169\n  RCU nest depth: 1, expected: 0\n   __might_fault+0x29/0x80\n   _copy_from_user+0x26/0x90\n   bpf_copy_from_user+0x23/0x60\n   bpf_prog_17d44fa39eebd6cc_cb+0x35/0x46\n   bpf_for_each_hash_elem+0xdb/0x280\n\nFix by marking the callback frame of hash map iteration as running under\nRCU and making in_sleepable_context() false while such a frame is on the\ncall stack, so sleepable helpers, kfuncs and global functions are\nrejected there as inside bpf_rcu_read_lock(). The rules for trusting RCU\nprotected pointers are left alone, which is conservative and keeps\ncallbacks that verify today and do not sleep working. The flag is\ncompared in func_states_equal() so that pruning never mixes the two\ncontexts. Array map callbacks run without any lock and keep the caller's\ncontext.","state":"PUBLISHED","assigner":"Linux","published_at":"2026-11-30 14:18:57","updated_at":"2026-11-30 14:18:57"},"problem_types":[],"metrics":[],"references":[{"url":"https://git.kernel.org/stable/c/b13b93f264ec9a700e22f91ada8313acc44ada2a","name":"https://git.kernel.org/stable/c/b13b93f264ec9a700e22f91ada8313acc44ada2a","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/9bdd5e7f5d8313fa1f3a210621b4007bb5ad0ec6","name":"https://git.kernel.org/stable/c/9bdd5e7f5d8313fa1f3a210621b4007bb5ad0ec6","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://www.cve.org/CVERecord?id=CVE-2026-139325","name":"CVE Program record","refsource":"CVE.ORG","tags":["canonical"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-139325","name":"NVD vulnerability detail","refsource":"NVD","tags":["canonical","analysis"]}],"affected":[{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 314ee05e2fc601a7bece14376547d2b7a04bab67 b13b93f264ec9a700e22f91ada8313acc44ada2a git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 314ee05e2fc601a7bece14376547d2b7a04bab67 9bdd5e7f5d8313fa1f3a210621b4007bb5ad0ec6 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 5.13","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 5.13 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":["include/linux/bpf_verifier.h","kernel/bpf/states.c","kernel/bpf/verifier.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"lessThan":"b13b93f264ec9a700e22f91ada8313acc44ada2a","status":"affected","version":"314ee05e2fc601a7bece14376547d2b7a04bab67","versionType":"git"},{"lessThan":"9bdd5e7f5d8313fa1f3a210621b4007bb5ad0ec6","status":"affected","version":"314ee05e2fc601a7bece14376547d2b7a04bab67","versionType":"git"}]},{"defaultStatus":"affected","product":"Linux","programFiles":["include/linux/bpf_verifier.h","kernel/bpf/states.c","kernel/bpf/verifier.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"status":"affected","version":"5.13"},{"lessThan":"5.13","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":"5.13","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.4-rc1","versionStartIncluding":"5.13","vulnerable":true}],"negate":false,"operator":"OR"}]}],"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Forbid sleeping in hash map for_each callbacks\n\nA sleepable program (e.g. SEC(\"syscall\"), lsm.s, fentry.s) can pass a\ncallback to bpf_for_each_map_elem() on a hash map and call a sleepable\nhelper or kfunc such as bpf_copy_from_user() from it. The verifier\naccepts this, but at run time the callback is invoked from inside an RCU\nread-side critical section:\n\n    bpf_for_each_hash_elem()\n      rcu_read_lock();\n      callback_fn(map, key, val, ctx, 0);\n        bpf_copy_from_user()       <- may fault and sleep\n      rcu_read_unlock();\n\nbpf_each_rhash_elem() does the same for BPF_MAP_TYPE_RHASH. Sleeping\nthere triggers the \"Voluntary context switch within RCU read-side\ncritical section!\" warning, delays grace periods, and with\nCONFIG_PREEMPT_RCU=n silently ends the read-side critical section that\nthe bucket walk relies on.\n\nSynchronous callbacks are verified with the caller's state, so\nkernel/bpf/verifier.c:in_sleepable_context() only looks at the program's\nsleepability and the locks the program took itself, and does not know\nthat the helper holds rcu_read_lock() around the callback.\n\nWith a SEC(\"syscall\") program whose callback reads a page that has to be\nread from disk first:\n\n  BUG: sleeping function called from invalid context at include/linux/uaccess.h:169\n  RCU nest depth: 1, expected: 0\n   __might_fault+0x29/0x80\n   _copy_from_user+0x26/0x90\n   bpf_copy_from_user+0x23/0x60\n   bpf_prog_17d44fa39eebd6cc_cb+0x35/0x46\n   bpf_for_each_hash_elem+0xdb/0x280\n\nFix by marking the callback frame of hash map iteration as running under\nRCU and making in_sleepable_context() false while such a frame is on the\ncall stack, so sleepable helpers, kfuncs and global functions are\nrejected there as inside bpf_rcu_read_lock(). The rules for trusting RCU\nprotected pointers are left alone, which is conservative and keeps\ncallbacks that verify today and do not sleep working. The flag is\ncompared in func_states_equal() so that pruning never mixes the two\ncontexts. Array map callbacks run without any lock and keep the caller's\ncontext."}],"providerMetadata":{"dateUpdated":"2026-11-30T13:33:43.168Z","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux"},"references":[{"url":"https://git.kernel.org/stable/c/b13b93f264ec9a700e22f91ada8313acc44ada2a"},{"url":"https://git.kernel.org/stable/c/9bdd5e7f5d8313fa1f3a210621b4007bb5ad0ec6"}],"title":"bpf: Forbid sleeping in hash map for_each callbacks","x_generator":{"engine":"bippy-1.2.0"}}},"cveMetadata":{"assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","assignerShortName":"Linux","cveId":"CVE-2026-139325","datePublished":"2026-11-30T13:33:43.168Z","dateReserved":"2026-11-30T13:22:15.927Z","dateUpdated":"2026-11-30T13:33:43.168Z","state":"PUBLISHED"},"dataType":"CVE_RECORD","dataVersion":"5.2"},"nvd":{"publishedDate":"2026-11-30 14:18:57","lastModifiedDate":"2026-11-30 14:18:57","problem_types":[],"metrics":[],"configurations":[]},"legacy_mitre":{"record":{"CveYear":"2026","CveId":"139325","Ordinal":"1","Title":"bpf: Forbid sleeping in hash map for_each callbacks","CVE":"CVE-2026-139325","Year":"2026"},"notes":[{"CveYear":"2026","CveId":"139325","Ordinal":"1","NoteData":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Forbid sleeping in hash map for_each callbacks\n\nA sleepable program (e.g. SEC(\"syscall\"), lsm.s, fentry.s) can pass a\ncallback to bpf_for_each_map_elem() on a hash map and call a sleepable\nhelper or kfunc such as bpf_copy_from_user() from it. The verifier\naccepts this, but at run time the callback is invoked from inside an RCU\nread-side critical section:\n\n    bpf_for_each_hash_elem()\n      rcu_read_lock();\n      callback_fn(map, key, val, ctx, 0);\n        bpf_copy_from_user()       <- may fault and sleep\n      rcu_read_unlock();\n\nbpf_each_rhash_elem() does the same for BPF_MAP_TYPE_RHASH. Sleeping\nthere triggers the \"Voluntary context switch within RCU read-side\ncritical section!\" warning, delays grace periods, and with\nCONFIG_PREEMPT_RCU=n silently ends the read-side critical section that\nthe bucket walk relies on.\n\nSynchronous callbacks are verified with the caller's state, so\nkernel/bpf/verifier.c:in_sleepable_context() only looks at the program's\nsleepability and the locks the program took itself, and does not know\nthat the helper holds rcu_read_lock() around the callback.\n\nWith a SEC(\"syscall\") program whose callback reads a page that has to be\nread from disk first:\n\n  BUG: sleeping function called from invalid context at include/linux/uaccess.h:169\n  RCU nest depth: 1, expected: 0\n   __might_fault+0x29/0x80\n   _copy_from_user+0x26/0x90\n   bpf_copy_from_user+0x23/0x60\n   bpf_prog_17d44fa39eebd6cc_cb+0x35/0x46\n   bpf_for_each_hash_elem+0xdb/0x280\n\nFix by marking the callback frame of hash map iteration as running under\nRCU and making in_sleepable_context() false while such a frame is on the\ncall stack, so sleepable helpers, kfuncs and global functions are\nrejected there as inside bpf_rcu_read_lock(). The rules for trusting RCU\nprotected pointers are left alone, which is conservative and keeps\ncallbacks that verify today and do not sleep working. The flag is\ncompared in func_states_equal() so that pruning never mixes the two\ncontexts. Array map callbacks run without any lock and keep the caller's\ncontext.","Type":"Description","Title":"bpf: Forbid sleeping in hash map for_each callbacks"}]}}}