{"id":"CVE-2026-139320","summary":"bpf: Look at all 64 bits of a BPF_JSET mask on 32-bit","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Look at all 64 bits of a BPF_JSET mask on 32-bit\n\nIn the branch of a BPF_JSET which is taken, the verifier can learn\nsomething about the register only if the mask has a single bit: then this\nbit is set. regs_refine_cond_op() tests this with is_power_of_2(val) and\nthen ORs val into var_off.\n\nval is a u64, but is_power_of_2() takes an unsigned long. On a 32-bit\nkernel it only sees the lower half of the mask. For\n\n\tif r1 & 0xffffffff80000000 goto l\n\nwhich is a BPF_JSET | BPF_K with an immediate of 0x80000000, the lower\nhalf is a power of two. So the verifier takes all 33 bits for set at l,\nwhile the branch is taken if any of them is. A mask of 0x100000001 from a\nregister does the same for bit 0.\n\nThe log of an i386 kernel, for r6 = bpf_get_prandom_u32() \u003c\u003c 31:\n\n\t3: (45) if r6 & 0x80000000 goto pc+2\n\tfrom 3 to 6: R6=0xffffffff80000000 R10=fp0\n\t6: (77) r6 \u003e\u003e= 63                     ; R6=1\n\nWhen the program runs, r6 \u003e\u003e 63 is 0.\n\n\u003eFrom then on the verifier works with known bits which the register does\nnot have at run time. It accepts, for example, an offset into a map value\nwhich it derives from these bits and believes to be constant, and the\nprogram can access memory outside of the map value.\n\nCount the bits of the whole value.\n\nOnly 32-bit kernels are affected. On a 64-bit kernel unsigned long holds\nthe whole mask, and this patch changes nothing.","modified":"2026-12-01T07:00:35.195917746Z","published":"2026-11-30T13:33:40.391Z","database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/139xxx/CVE-2026-139320.json","cna_assigner":"Linux"},"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/5a9a6eb7bad37d72867734dc69f1b99a423cd50a"},{"type":"WEB","url":"https://git.kernel.org/stable/c/5cea952976eb9b0b2dcc630dc87e207359b1292f"},{"type":"WEB","url":"https://git.kernel.org/stable/c/a2c98b2a86b0f7011c9debf249208074bfb9c7f8"},{"type":"WEB","url":"https://git.kernel.org/stable/c/ee4f44e0e3c8125eebe9ac967b6984bc9253d489"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/139xxx/CVE-2026-139320.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-139320"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"960ea056561a08e2b837b2f02d22c53226414a84"},{"fixed":"5a9a6eb7bad37d72867734dc69f1b99a423cd50a"},{"fixed":"5cea952976eb9b0b2dcc630dc87e207359b1292f"},{"fixed":"a2c98b2a86b0f7011c9debf249208074bfb9c7f8"},{"fixed":"ee4f44e0e3c8125eebe9ac967b6984bc9253d489"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-139320.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"5.0.0"},{"fixed":"6.12.119"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.65"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.6"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-139320.json"}}],"schema_version":"1.9.2","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"}]}