{"id":"CVE-2026-139320","aliases":["CVE-2026-139320"],"related":[],"kind":"vulnerability","state":"published","title":"bpf: Look at all 64 bits of a BPF_JSET mask on 32-bit","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"}],"published":"2026-11-30T13:33:40.391Z","modified":"2026-12-01T06:17:42.070Z","severity":{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},"severities":[{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"}],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"960ea056561a08e2b837b2f02d22c53226414a84","fixed":"5a9a6eb7bad37d72867734dc69f1b99a423cd50a","status":"affected"},{"type":"git","introduced":"960ea056561a08e2b837b2f02d22c53226414a84","fixed":"5cea952976eb9b0b2dcc630dc87e207359b1292f","status":"affected"},{"type":"git","introduced":"960ea056561a08e2b837b2f02d22c53226414a84","fixed":"a2c98b2a86b0f7011c9debf249208074bfb9c7f8","status":"affected"},{"type":"git","introduced":"960ea056561a08e2b837b2f02d22c53226414a84","fixed":"ee4f44e0e3c8125eebe9ac967b6984bc9253d489","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"5.0","status":"affected"},{"type":"semver","introduced":"0","fixed":"5.0","status":"unaffected"},{"type":"semver","introduced":"6.12.119","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.18.65","lastAffected":"6.18.*","status":"unaffected"},{"type":"semver","introduced":"7.3.6","lastAffected":"7.3.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"7.4-rc1","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"}],"references":[{"url":"https://git.kernel.org/stable/c/5a9a6eb7bad37d72867734dc69f1b99a423cd50a","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/5cea952976eb9b0b2dcc630dc87e207359b1292f","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/a2c98b2a86b0f7011c9debf249208074bfb9c7f8","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/ee4f44e0e3c8125eebe9ac967b6984bc9253d489","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-139320","url":"https://www.cve.org/CVERecord?id=CVE-2026-139320","licence":"CVE Terms of Use","modified":"2026-12-01T05:42:16.169Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-139320","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-139320","licence":"Public domain","modified":"2026-12-01T06:17:42.070Z"}],"updatedAt":"2026-12-01T06:32:24.768Z","epss":{"score":0.00186,"percentile":0.08631,"date":"2026-12-01T12:00:22.000Z"}}