{"id":"CVE-2026-139320","state":"PUBLISHED","title":"bpf: Look at all 64 bits of a BPF_JSET mask on 32-bit","description":"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() << 31:\n\n\t3: (45) if r6 & 0x80000000 goto pc+2\n\tfrom 3 to 6: R6=0xffffffff80000000 R10=fp0\n\t6: (77) r6 >>= 63                     ; R6=1\n\nWhen the program runs, r6 >> 63 is 0.\n\n>From 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.","publishedAt":"2026-11-30T13:33:40.391Z","updatedAt":"2026-11-30T13:33:40.391Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"960ea056561a08e2b837b2f02d22c53226414a84","status":"affected","lessThan":"5a9a6eb7bad37d72867734dc69f1b99a423cd50a","versionType":"git"},{"version":"960ea056561a08e2b837b2f02d22c53226414a84","status":"affected","lessThan":"5cea952976eb9b0b2dcc630dc87e207359b1292f","versionType":"git"},{"version":"960ea056561a08e2b837b2f02d22c53226414a84","status":"affected","lessThan":"a2c98b2a86b0f7011c9debf249208074bfb9c7f8","versionType":"git"},{"version":"960ea056561a08e2b837b2f02d22c53226414a84","status":"affected","lessThan":"ee4f44e0e3c8125eebe9ac967b6984bc9253d489","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/bpf/verifier.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.0","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.0","versionType":"semver"},{"version":"6.12.119","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","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":["kernel/bpf/verifier.c"]}],"references":["https://git.kernel.org/stable/c/5a9a6eb7bad37d72867734dc69f1b99a423cd50a","https://git.kernel.org/stable/c/5cea952976eb9b0b2dcc630dc87e207359b1292f","https://git.kernel.org/stable/c/a2c98b2a86b0f7011c9debf249208074bfb9c7f8","https://git.kernel.org/stable/c/ee4f44e0e3c8125eebe9ac967b6984bc9253d489"],"weaknesses":[],"ingestedAt":"2026-11-30T13:46:04.484Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139320.json","commit":"8c2c22940a0de21d18737df980299c0488d5dc73","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139320","state":"PUBLISHED","datePublished":"2026-11-30T13:33:40.391Z","dateUpdated":"2026-11-30T13:33:40.391Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.927Z"},"containers":{"cna":{"title":"bpf: Look at all 64 bits of a BPF_JSET mask on 32-bit","descriptions":[{"lang":"en","value":"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() << 31:\n\n\t3: (45) if r6 & 0x80000000 goto pc+2\n\tfrom 3 to 6: R6=0xffffffff80000000 R10=fp0\n\t6: (77) r6 >>= 63                     ; R6=1\n\nWhen the program runs, r6 >> 63 is 0.\n\n>From 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."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"960ea056561a08e2b837b2f02d22c53226414a84","status":"affected","lessThan":"5a9a6eb7bad37d72867734dc69f1b99a423cd50a","versionType":"git"},{"version":"960ea056561a08e2b837b2f02d22c53226414a84","status":"affected","lessThan":"5cea952976eb9b0b2dcc630dc87e207359b1292f","versionType":"git"},{"version":"960ea056561a08e2b837b2f02d22c53226414a84","status":"affected","lessThan":"a2c98b2a86b0f7011c9debf249208074bfb9c7f8","versionType":"git"},{"version":"960ea056561a08e2b837b2f02d22c53226414a84","status":"affected","lessThan":"ee4f44e0e3c8125eebe9ac967b6984bc9253d489","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/bpf/verifier.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.0","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.0","versionType":"semver"},{"version":"6.12.119","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","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":["kernel/bpf/verifier.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/5a9a6eb7bad37d72867734dc69f1b99a423cd50a"},{"url":"https://git.kernel.org/stable/c/5cea952976eb9b0b2dcc630dc87e207359b1292f"},{"url":"https://git.kernel.org/stable/c/a2c98b2a86b0f7011c9debf249208074bfb9c7f8"},{"url":"https://git.kernel.org/stable/c/ee4f44e0e3c8125eebe9ac967b6984bc9253d489"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:33:40.391Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.0","versionEndExcluding":"6.12.119"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.0","versionEndExcluding":"6.18.65"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.0","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.0","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}