{"id":"CVE-2026-139163","state":"PUBLISHED","title":"bpf: Keep stack arguments in arch_bpf_timed_may_goto()","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Keep stack arguments in arch_bpf_timed_may_goto()\n\nThe JITs pass the first stack arguments of a call in registers:\n\n  x86-64    r9       argument 6\n  arm64     x5-x7    arguments 6-8\n  riscv64   a5-a7    arguments 6-8\n\n'*(u64 *)(r11 - 8) = rX' writes such a register in the caller.\n'rX = *(u64 *)(r11 + 8)' reads it in the callee. A call changes these\nregisters. Thus the verifier accepts no call between the write and the call\nof the callee, and no call in the callee before the read.\n\nmay_goto is not a call for the verifier. But one time in 65535 iterations\nit calls arch_bpf_timed_may_goto(), and this function calls C code. It\nsaves R0-R5 only.\n\n       *(u64 *)(r11 - 8) = 0      ; the verifier: argument 6 is 0\n       call sub\n  sub:\n    1: may_goto 2f                ; C code changes r9\n       goto 1b\n    2: r2 = *(u64 *)(r11 + 8)     ; r2 is a kernel address\n       r1 = map_value\n       r1 += r2\n       *(u64 *)(r1 + 0) = 0\n\nOn x86-64 the C code changes r9 when the time of may_goto is up. With the\nhpet clocksource a look at the clock changes r9 too. The prog above crashes\nthe kernel. LLVM does not emit such code: it reads stack arguments at the\nentry of a function, and it writes them immediately before the call.\n\nSave and restore these registers too. The cost is 2 insns on x86-64, 4 on\narm64 and 6 on riscv64, one time in 65535 iterations.","publishedAt":"2026-11-30T13:32:09.923Z","updatedAt":"2026-11-30T13:32:09.923Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"324c3ca6eed6fb7ec4e50f31d537953038b13c5f","status":"affected","lessThan":"009c5c6acd08f93a9bbf55c0881ae06cc221247a","versionType":"git"},{"version":"324c3ca6eed6fb7ec4e50f31d537953038b13c5f","status":"affected","lessThan":"4d0f560f4926417f010ce38f8628c41bcad29c9f","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["arch/arm64/net/bpf_timed_may_goto.S","arch/riscv/net/bpf_timed_may_goto.S","arch/x86/net/bpf_timed_may_goto.S"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"7.2","status":"affected"},{"version":"0","status":"unaffected","lessThan":"7.2","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":["arch/arm64/net/bpf_timed_may_goto.S","arch/riscv/net/bpf_timed_may_goto.S","arch/x86/net/bpf_timed_may_goto.S"]}],"references":["https://git.kernel.org/stable/c/009c5c6acd08f93a9bbf55c0881ae06cc221247a","https://git.kernel.org/stable/c/4d0f560f4926417f010ce38f8628c41bcad29c9f"],"weaknesses":[],"ingestedAt":"2026-11-30T13:44:05.999Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139163.json","commit":"8c2c22940a0de21d18737df980299c0488d5dc73","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139163","state":"PUBLISHED","datePublished":"2026-11-30T13:32:09.923Z","dateUpdated":"2026-11-30T13:32:09.923Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.917Z"},"containers":{"cna":{"title":"bpf: Keep stack arguments in arch_bpf_timed_may_goto()","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Keep stack arguments in arch_bpf_timed_may_goto()\n\nThe JITs pass the first stack arguments of a call in registers:\n\n  x86-64    r9       argument 6\n  arm64     x5-x7    arguments 6-8\n  riscv64   a5-a7    arguments 6-8\n\n'*(u64 *)(r11 - 8) = rX' writes such a register in the caller.\n'rX = *(u64 *)(r11 + 8)' reads it in the callee. A call changes these\nregisters. Thus the verifier accepts no call between the write and the call\nof the callee, and no call in the callee before the read.\n\nmay_goto is not a call for the verifier. But one time in 65535 iterations\nit calls arch_bpf_timed_may_goto(), and this function calls C code. It\nsaves R0-R5 only.\n\n       *(u64 *)(r11 - 8) = 0      ; the verifier: argument 6 is 0\n       call sub\n  sub:\n    1: may_goto 2f                ; C code changes r9\n       goto 1b\n    2: r2 = *(u64 *)(r11 + 8)     ; r2 is a kernel address\n       r1 = map_value\n       r1 += r2\n       *(u64 *)(r1 + 0) = 0\n\nOn x86-64 the C code changes r9 when the time of may_goto is up. With the\nhpet clocksource a look at the clock changes r9 too. The prog above crashes\nthe kernel. LLVM does not emit such code: it reads stack arguments at the\nentry of a function, and it writes them immediately before the call.\n\nSave and restore these registers too. The cost is 2 insns on x86-64, 4 on\narm64 and 6 on riscv64, one time in 65535 iterations."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"324c3ca6eed6fb7ec4e50f31d537953038b13c5f","status":"affected","lessThan":"009c5c6acd08f93a9bbf55c0881ae06cc221247a","versionType":"git"},{"version":"324c3ca6eed6fb7ec4e50f31d537953038b13c5f","status":"affected","lessThan":"4d0f560f4926417f010ce38f8628c41bcad29c9f","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["arch/arm64/net/bpf_timed_may_goto.S","arch/riscv/net/bpf_timed_may_goto.S","arch/x86/net/bpf_timed_may_goto.S"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"7.2","status":"affected"},{"version":"0","status":"unaffected","lessThan":"7.2","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":["arch/arm64/net/bpf_timed_may_goto.S","arch/riscv/net/bpf_timed_may_goto.S","arch/x86/net/bpf_timed_may_goto.S"]}],"references":[{"url":"https://git.kernel.org/stable/c/009c5c6acd08f93a9bbf55c0881ae06cc221247a"},{"url":"https://git.kernel.org/stable/c/4d0f560f4926417f010ce38f8628c41bcad29c9f"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:32:09.923Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"7.2","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"7.2","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}