{"id":"CVE-2026-139304","state":"PUBLISHED","title":"bpf: Check the maps that sleepable callbacks use","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Check the maps that sleepable callbacks use\n\nSleepable programs can only use the kinds of map that do without an RCU\nread side critical section.  check_map_prog_compatibility() sees to that\nwhen a map is bound to the program, and asks whether the program is\nsleepable.  That misses the bpf_wq or bpf_task_work callback of a program\nthat is not, which runs sleepable all the same, and it misses an inner\nmap, which is not bound.\n\nThe bpf_wq callback of a tc program that looks a key up in a sockhash\ngets as far as\n\n  WARNING: net/core/sock_map.c:903 at __sock_hash_lookup_elem+0x18f/0x1e0\n\nAsk the same question for the map that is handed to a helper in sleepable\ncontext, unless the RCU read lock is held: by bpf_rcu_read_lock(), or by\nthe helper that runs the callback, as bpf_for_each_map_elem() does for a\nhash map.  Programs that take the lock go on working.  Disabled preemption\nor interrupts are not enough, since the maps ask for rcu_read_lock_held().\nThe other parts of the program may use such a map as before.\n\nA global function that is called with preemption or interrupts disabled is\nverified for the non-sleepable context, in which nothing is known of all\nthat.  Verify it for a context of its own: not sleepable, and without the\nRCU read lock.  It differs in what maps can be used, and in nothing else.\n\nWhat is refused from now on runs into the warning above, or uses what the\nmap frees behind a plain RCU grace period: an entry of a devmap, of a perf\nevent array or of a cgroup array.\n\nA bloom filter does without RCU.  Add it to the list, so that callbacks\nwhich use one go on loading.  As a side effect sleepable programs can use\nbloom filters as well.\n\nA pointer to the value of a devmap which a program keeps beyond\nbpf_rcu_read_unlock() is not dealt with here.","publishedAt":"2026-11-30T13:33:31.040Z","updatedAt":"2026-11-30T13:33:31.040Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"638e4b825d523bed7a55e776c153049fb7716466","status":"affected","lessThan":"9f13a653c21d5efb99c44b7adc3fa9005b20c442","versionType":"git"},{"version":"638e4b825d523bed7a55e776c153049fb7716466","status":"affected","lessThan":"3e6d7522af2cd1b8bf135ee7df6ca962986f44d6","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["include/linux/bpf.h","include/linux/bpf_verifier.h","kernel/bpf/verifier.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.12","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.12","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["include/linux/bpf.h","include/linux/bpf_verifier.h","kernel/bpf/verifier.c"]}],"references":["https://git.kernel.org/stable/c/9f13a653c21d5efb99c44b7adc3fa9005b20c442","https://git.kernel.org/stable/c/3e6d7522af2cd1b8bf135ee7df6ca962986f44d6"],"weaknesses":[],"ingestedAt":"2026-11-30T13:46:04.484Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139304.json","commit":"8c2c22940a0de21d18737df980299c0488d5dc73","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139304","state":"PUBLISHED","datePublished":"2026-11-30T13:33:31.040Z","dateUpdated":"2026-11-30T13:33:31.040Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.926Z"},"containers":{"cna":{"title":"bpf: Check the maps that sleepable callbacks use","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Check the maps that sleepable callbacks use\n\nSleepable programs can only use the kinds of map that do without an RCU\nread side critical section.  check_map_prog_compatibility() sees to that\nwhen a map is bound to the program, and asks whether the program is\nsleepable.  That misses the bpf_wq or bpf_task_work callback of a program\nthat is not, which runs sleepable all the same, and it misses an inner\nmap, which is not bound.\n\nThe bpf_wq callback of a tc program that looks a key up in a sockhash\ngets as far as\n\n  WARNING: net/core/sock_map.c:903 at __sock_hash_lookup_elem+0x18f/0x1e0\n\nAsk the same question for the map that is handed to a helper in sleepable\ncontext, unless the RCU read lock is held: by bpf_rcu_read_lock(), or by\nthe helper that runs the callback, as bpf_for_each_map_elem() does for a\nhash map.  Programs that take the lock go on working.  Disabled preemption\nor interrupts are not enough, since the maps ask for rcu_read_lock_held().\nThe other parts of the program may use such a map as before.\n\nA global function that is called with preemption or interrupts disabled is\nverified for the non-sleepable context, in which nothing is known of all\nthat.  Verify it for a context of its own: not sleepable, and without the\nRCU read lock.  It differs in what maps can be used, and in nothing else.\n\nWhat is refused from now on runs into the warning above, or uses what the\nmap frees behind a plain RCU grace period: an entry of a devmap, of a perf\nevent array or of a cgroup array.\n\nA bloom filter does without RCU.  Add it to the list, so that callbacks\nwhich use one go on loading.  As a side effect sleepable programs can use\nbloom filters as well.\n\nA pointer to the value of a devmap which a program keeps beyond\nbpf_rcu_read_unlock() is not dealt with here."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"638e4b825d523bed7a55e776c153049fb7716466","status":"affected","lessThan":"9f13a653c21d5efb99c44b7adc3fa9005b20c442","versionType":"git"},{"version":"638e4b825d523bed7a55e776c153049fb7716466","status":"affected","lessThan":"3e6d7522af2cd1b8bf135ee7df6ca962986f44d6","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["include/linux/bpf.h","include/linux/bpf_verifier.h","kernel/bpf/verifier.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.12","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.12","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["include/linux/bpf.h","include/linux/bpf_verifier.h","kernel/bpf/verifier.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/9f13a653c21d5efb99c44b7adc3fa9005b20c442"},{"url":"https://git.kernel.org/stable/c/3e6d7522af2cd1b8bf135ee7df6ca962986f44d6"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:33:31.040Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.12","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.12","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}