{"api_version":"1","generated_at":"2026-12-01T14:51:25+00:00","cve":"CVE-2026-138941","urls":{"html":"https://cve.report/CVE-2026-138941","api":"https://cve.report/api/cve/CVE-2026-138941.json","docs":"https://cve.report/api","cve_org":"https://www.cve.org/CVERecord?id=CVE-2026-138941","nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-138941"},"summary":{"title":"powerpc/bpf: fix buffer overflow in JIT for large BPF programs","description":"In the Linux kernel, the following vulnerability has been resolved:\n\npowerpc/bpf: fix buffer overflow in JIT for large BPF programs\n\nDuring size calculation in pass-0, exit_addr is 0 since addrs[fp->len]\nis not yet populated. bpf_jit_emit_exit_insn() treats a zero exit_addr\nas in-range and skips bpf_jit_build_epilogue(), so the alternate inline\nepilogue instructions are not counted in alloclen.\n\nIn later passes, if the real exit_addr falls outside the 32MB branch\nrange, the full inline epilogue is emitted into the already-allocated\nbuffer, writing past its end and corrupting adjacent memory.\n\nFix by ensuring exit_addr is non-zero before treating it as in-range,\nso pass-0 always falls through to bpf_jit_build_epilogue() and\nconservatively accounts for all epilogue instructions in alloclen.\nAlso range check alt_exit_addr directly in the else-if condition.\n\nSince exit_addr handling now falls through to the epilogue, two\nrelated issues in bpf_int_jit_compile() must also be addressed:\n\n1. Reset cgctx.alt_exit_addr before the second size-calculation pass.\n   Without this, a stale alt_exit_addr from the first pass causes the\n   second pass to emit a single jump instead of the full epilogue,\n   undercounting alloclen and reintroducing the overflow.\n\n2. Recompute addrs[fp->len] at the end of each code-generation pass.\n   The larger pass-0 body can shrink in later passes as out-of-range\n   exits settle into in-range jumps; a stale addrs[fp->len] would\n   leave exit branches targeting past the real (shrunken) epilogue.\n\nBecause shrinkage in a later pass can move the epilogue offset, the\nfixed two-pass loop is no longer sufficient: an exit that was out of\nrange in an earlier pass may fall in range once the epilogue offset\nshrinks, shrinking the body further and overwriting the start of the\nepilogue. Convert the code-generation loop to iterate until the\nprogram size converges, bounded by CODEGEN_MAX_PASSES, and fail the\nJIT if it does not converge.","state":"PUBLISHED","assigner":"Linux","published_at":"2026-11-30 14:17:55","updated_at":"2026-11-30 14:17:55"},"problem_types":[],"metrics":[],"references":[{"url":"https://git.kernel.org/stable/c/3b9710e1d312bf0c3b48e1e1f121255ff3346e25","name":"https://git.kernel.org/stable/c/3b9710e1d312bf0c3b48e1e1f121255ff3346e25","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/b17348a6187b348bc30b74dbc207b98c72dd7b26","name":"https://git.kernel.org/stable/c/b17348a6187b348bc30b74dbc207b98c72dd7b26","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/0e7ec5fe2fc914e611cd0f9cfeb76a17ffbf5d6f","name":"https://git.kernel.org/stable/c/0e7ec5fe2fc914e611cd0f9cfeb76a17ffbf5d6f","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/5d79818c18172beedb9e1121496ee15bd195ff93","name":"https://git.kernel.org/stable/c/5d79818c18172beedb9e1121496ee15bd195ff93","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/78ce55b7913a78e1687306668e078b86bc6508ee","name":"https://git.kernel.org/stable/c/78ce55b7913a78e1687306668e078b86bc6508ee","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/033a1e4f56c29b4244d4f504f4b7704dfefa7afd","name":"https://git.kernel.org/stable/c/033a1e4f56c29b4244d4f504f4b7704dfefa7afd","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://www.cve.org/CVERecord?id=CVE-2026-138941","name":"CVE Program record","refsource":"CVE.ORG","tags":["canonical"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-138941","name":"NVD vulnerability detail","refsource":"NVD","tags":["canonical","analysis"]}],"affected":[{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 0ffdbce6f4a89bb7c0002904d6438ec83cf05ce7 b17348a6187b348bc30b74dbc207b98c72dd7b26 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 0ffdbce6f4a89bb7c0002904d6438ec83cf05ce7 033a1e4f56c29b4244d4f504f4b7704dfefa7afd git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 0ffdbce6f4a89bb7c0002904d6438ec83cf05ce7 5d79818c18172beedb9e1121496ee15bd195ff93 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 0ffdbce6f4a89bb7c0002904d6438ec83cf05ce7 3b9710e1d312bf0c3b48e1e1f121255ff3346e25 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 0ffdbce6f4a89bb7c0002904d6438ec83cf05ce7 0e7ec5fe2fc914e611cd0f9cfeb76a17ffbf5d6f git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 0ffdbce6f4a89bb7c0002904d6438ec83cf05ce7 78ce55b7913a78e1687306668e078b86bc6508ee git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 5.18","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 5.18 semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.1.193 6.1.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.6.163 6.6.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.12.118 6.12.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.18.64 6.18.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 7.3.4 7.3.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 7.4-rc1 * original_commit_for_fix","platforms":[]}],"timeline":[],"solutions":[],"workarounds":[],"exploits":[],"credits":[],"nvd_cpes":[],"vendor_comments":[],"enrichments":{"kev":null,"epss":null,"legacy_qids":[]},"source_records":{"cve_program":{"containers":{"cna":{"affected":[{"defaultStatus":"unaffected","product":"Linux","programFiles":["arch/powerpc/net/bpf_jit.h","arch/powerpc/net/bpf_jit_comp.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"lessThan":"b17348a6187b348bc30b74dbc207b98c72dd7b26","status":"affected","version":"0ffdbce6f4a89bb7c0002904d6438ec83cf05ce7","versionType":"git"},{"lessThan":"033a1e4f56c29b4244d4f504f4b7704dfefa7afd","status":"affected","version":"0ffdbce6f4a89bb7c0002904d6438ec83cf05ce7","versionType":"git"},{"lessThan":"5d79818c18172beedb9e1121496ee15bd195ff93","status":"affected","version":"0ffdbce6f4a89bb7c0002904d6438ec83cf05ce7","versionType":"git"},{"lessThan":"3b9710e1d312bf0c3b48e1e1f121255ff3346e25","status":"affected","version":"0ffdbce6f4a89bb7c0002904d6438ec83cf05ce7","versionType":"git"},{"lessThan":"0e7ec5fe2fc914e611cd0f9cfeb76a17ffbf5d6f","status":"affected","version":"0ffdbce6f4a89bb7c0002904d6438ec83cf05ce7","versionType":"git"},{"lessThan":"78ce55b7913a78e1687306668e078b86bc6508ee","status":"affected","version":"0ffdbce6f4a89bb7c0002904d6438ec83cf05ce7","versionType":"git"}]},{"defaultStatus":"affected","product":"Linux","programFiles":["arch/powerpc/net/bpf_jit.h","arch/powerpc/net/bpf_jit_comp.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"status":"affected","version":"5.18"},{"lessThan":"5.18","status":"unaffected","version":"0","versionType":"semver"},{"lessThanOrEqual":"6.1.*","status":"unaffected","version":"6.1.193","versionType":"semver"},{"lessThanOrEqual":"6.6.*","status":"unaffected","version":"6.6.163","versionType":"semver"},{"lessThanOrEqual":"6.12.*","status":"unaffected","version":"6.12.118","versionType":"semver"},{"lessThanOrEqual":"6.18.*","status":"unaffected","version":"6.18.64","versionType":"semver"},{"lessThanOrEqual":"7.3.*","status":"unaffected","version":"7.3.4","versionType":"semver"},{"lessThanOrEqual":"*","status":"unaffected","version":"7.4-rc1","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"cpeMatch":[{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.1.193","versionStartIncluding":"5.18","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.6.163","versionStartIncluding":"5.18","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.12.118","versionStartIncluding":"5.18","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.18.64","versionStartIncluding":"5.18","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.3.4","versionStartIncluding":"5.18","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.4-rc1","versionStartIncluding":"5.18","vulnerable":true}],"negate":false,"operator":"OR"}]}],"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\npowerpc/bpf: fix buffer overflow in JIT for large BPF programs\n\nDuring size calculation in pass-0, exit_addr is 0 since addrs[fp->len]\nis not yet populated. bpf_jit_emit_exit_insn() treats a zero exit_addr\nas in-range and skips bpf_jit_build_epilogue(), so the alternate inline\nepilogue instructions are not counted in alloclen.\n\nIn later passes, if the real exit_addr falls outside the 32MB branch\nrange, the full inline epilogue is emitted into the already-allocated\nbuffer, writing past its end and corrupting adjacent memory.\n\nFix by ensuring exit_addr is non-zero before treating it as in-range,\nso pass-0 always falls through to bpf_jit_build_epilogue() and\nconservatively accounts for all epilogue instructions in alloclen.\nAlso range check alt_exit_addr directly in the else-if condition.\n\nSince exit_addr handling now falls through to the epilogue, two\nrelated issues in bpf_int_jit_compile() must also be addressed:\n\n1. Reset cgctx.alt_exit_addr before the second size-calculation pass.\n   Without this, a stale alt_exit_addr from the first pass causes the\n   second pass to emit a single jump instead of the full epilogue,\n   undercounting alloclen and reintroducing the overflow.\n\n2. Recompute addrs[fp->len] at the end of each code-generation pass.\n   The larger pass-0 body can shrink in later passes as out-of-range\n   exits settle into in-range jumps; a stale addrs[fp->len] would\n   leave exit branches targeting past the real (shrunken) epilogue.\n\nBecause shrinkage in a later pass can move the epilogue offset, the\nfixed two-pass loop is no longer sufficient: an exit that was out of\nrange in an earlier pass may fall in range once the epilogue offset\nshrinks, shrinking the body further and overwriting the start of the\nepilogue. Convert the code-generation loop to iterate until the\nprogram size converges, bounded by CODEGEN_MAX_PASSES, and fail the\nJIT if it does not converge."}],"providerMetadata":{"dateUpdated":"2026-11-30T13:26:24.359Z","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux"},"references":[{"url":"https://git.kernel.org/stable/c/b17348a6187b348bc30b74dbc207b98c72dd7b26"},{"url":"https://git.kernel.org/stable/c/033a1e4f56c29b4244d4f504f4b7704dfefa7afd"},{"url":"https://git.kernel.org/stable/c/5d79818c18172beedb9e1121496ee15bd195ff93"},{"url":"https://git.kernel.org/stable/c/3b9710e1d312bf0c3b48e1e1f121255ff3346e25"},{"url":"https://git.kernel.org/stable/c/0e7ec5fe2fc914e611cd0f9cfeb76a17ffbf5d6f"},{"url":"https://git.kernel.org/stable/c/78ce55b7913a78e1687306668e078b86bc6508ee"}],"title":"powerpc/bpf: fix buffer overflow in JIT for large BPF programs","x_generator":{"engine":"bippy-1.2.0"}}},"cveMetadata":{"assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","assignerShortName":"Linux","cveId":"CVE-2026-138941","datePublished":"2026-11-30T13:26:24.359Z","dateReserved":"2026-11-30T13:22:15.904Z","dateUpdated":"2026-11-30T13:26:24.359Z","state":"PUBLISHED"},"dataType":"CVE_RECORD","dataVersion":"5.2"},"nvd":{"publishedDate":"2026-11-30 14:17:55","lastModifiedDate":"2026-11-30 14:17:55","problem_types":[],"metrics":[],"configurations":[]},"legacy_mitre":{"record":{"CveYear":"2026","CveId":"138941","Ordinal":"1","Title":"powerpc/bpf: fix buffer overflow in JIT for large BPF programs","CVE":"CVE-2026-138941","Year":"2026"},"notes":[{"CveYear":"2026","CveId":"138941","Ordinal":"1","NoteData":"In the Linux kernel, the following vulnerability has been resolved:\n\npowerpc/bpf: fix buffer overflow in JIT for large BPF programs\n\nDuring size calculation in pass-0, exit_addr is 0 since addrs[fp->len]\nis not yet populated. bpf_jit_emit_exit_insn() treats a zero exit_addr\nas in-range and skips bpf_jit_build_epilogue(), so the alternate inline\nepilogue instructions are not counted in alloclen.\n\nIn later passes, if the real exit_addr falls outside the 32MB branch\nrange, the full inline epilogue is emitted into the already-allocated\nbuffer, writing past its end and corrupting adjacent memory.\n\nFix by ensuring exit_addr is non-zero before treating it as in-range,\nso pass-0 always falls through to bpf_jit_build_epilogue() and\nconservatively accounts for all epilogue instructions in alloclen.\nAlso range check alt_exit_addr directly in the else-if condition.\n\nSince exit_addr handling now falls through to the epilogue, two\nrelated issues in bpf_int_jit_compile() must also be addressed:\n\n1. Reset cgctx.alt_exit_addr before the second size-calculation pass.\n   Without this, a stale alt_exit_addr from the first pass causes the\n   second pass to emit a single jump instead of the full epilogue,\n   undercounting alloclen and reintroducing the overflow.\n\n2. Recompute addrs[fp->len] at the end of each code-generation pass.\n   The larger pass-0 body can shrink in later passes as out-of-range\n   exits settle into in-range jumps; a stale addrs[fp->len] would\n   leave exit branches targeting past the real (shrunken) epilogue.\n\nBecause shrinkage in a later pass can move the epilogue offset, the\nfixed two-pass loop is no longer sufficient: an exit that was out of\nrange in an earlier pass may fall in range once the epilogue offset\nshrinks, shrinking the body further and overwriting the start of the\nepilogue. Convert the code-generation loop to iterate until the\nprogram size converges, bounded by CODEGEN_MAX_PASSES, and fail the\nJIT if it does not converge.","Type":"Description","Title":"powerpc/bpf: fix buffer overflow in JIT for large BPF programs"}]}}}