{ "dataType": "CVE_RECORD", "dataVersion": "5.2", "cveMetadata": { "cveId": "CVE-2025-38339", "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "state": "PUBLISHED", "assignerShortName": "Linux", "dateReserved": "2025-04-16T04:51:24.005Z", "datePublished": "2025-07-10T08:15:09.646Z", "dateUpdated": "2026-08-05T12:01:12.779Z" }, "containers": { "cna": { "providerMetadata": { "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "shortName": "Linux", "dateUpdated": "2026-08-05T12:01:12.779Z" }, "descriptions": [ { "lang": "en", "value": "In the Linux kernel, the following vulnerability has been resolved:\n\npowerpc/bpf: fix JIT code size calculation of bpf trampoline\n\narch_bpf_trampoline_size() provides JIT size of the BPF trampoline\nbefore the buffer for JIT'ing it is allocated. The total number of\ninstructions emitted for BPF trampoline JIT code depends on where\nthe final image is located. So, the size arrived at with the dummy\npass in arch_bpf_trampoline_size() can vary from the actual size\nneeded in arch_prepare_bpf_trampoline(). When the instructions\naccounted in arch_bpf_trampoline_size() is less than the number of\ninstructions emitted during the actual JIT compile of the trampoline,\nthe below warning is produced:\n\n WARNING: CPU: 8 PID: 204190 at arch/powerpc/net/bpf_jit_comp.c:981 __arch_prepare_bpf_trampoline.isra.0+0xd2c/0xdcc\n\nwhich is:\n\n /* Make sure the trampoline generation logic doesn't overflow */\n if (image && WARN_ON_ONCE(&image[ctx->idx] >\n \t\t\t(u32 *)rw_image_end - BPF_INSN_SAFETY)) {\n\nSo, during the dummy pass, instead of providing some arbitrary image\nlocation, account for maximum possible instructions if and when there\nis a dependency with image location for JIT'ing." } ], "metrics": [ { "cvssV3_1": { "version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "baseScore": 7.8, "baseSeverity": "HIGH" }, "scenarios": [ { "lang": "en", "value": "AV:L - The vulnerable trampoline JIT path is reached only through the bpf(2) syscall (BPF_LINK_CREATE/BPF_RAW_TRACEPOINT_OPEN → bpf_tracing_prog_attach → bpf_trampoline_update), which requires local access to the machine. No remote or adjacent-network input reaches arch_bpf_trampoline_size().\nAC:L - The attacker deterministically triggers the size miscalculation by attaching fentry/fexit/fmod_ret programs; there is no race and no condition outside their control, and they can amplify the accounting drift by attaching many links (up to BPF_MAX_TRAMP_LINKS) and influencing JIT image placement by repeated attach/detach.\nPR:L - Attaching tracing programs needs CAP_BPF+CAP_PERFMON, which bpf_token_capable() evaluates against a BPF token's user namespace, so an unprivileged container user holding a delegated token — or a non-root tracing daemon with only these caps — can reach the code without being a real administrator.\nUI:N - The attaching process triggers the JIT compilation entirely on its own; no victim action, file open, or mount is needed.\nS:U - The miscomputed buffer and the resulting corruption are both within the kernel's own security authority; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - The undersized JIT buffer permits writes past the end of the kvmalloc'd rw_image, and such heap corruption of adjacent slab objects (pointers, length fields) can be leveraged into arbitrary kernel-memory disclosure.\nI:H - EMIT()/PLANT_INSTR() writes are completely unchecked until after the fact, so instruction words — including attacker-chosen bpf_cookie immediates emitted via PPC_LI32 — are written out of bounds into the heap, an out-of-bounds write usable for control-flow-relevant corruption.\nA:H - The demonstrated effect is a WARN_ON_ONCE splat in __arch_prepare_bpf_trampoline() (panic under panic_on_warn) and, when the drift exceeds the 64-instruction safety margin, heap corruption that oopses the kernel." } ] } ], "affected": [ { "product": "Linux", "vendor": "Linux", "defaultStatus": "unaffected", "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", "programFiles": [ "arch/powerpc/net/bpf_jit.h", "arch/powerpc/net/bpf_jit_comp.c", "arch/powerpc/net/bpf_jit_comp32.c", "arch/powerpc/net/bpf_jit_comp64.c" ], "versions": [ { "version": "d243b62b7bd3d5314382d3b54e4992226245e936", "lessThan": "7833deb95e05bec146414b3a2feb24f025ca27c0", "status": "affected", "versionType": "git" }, { "version": "d243b62b7bd3d5314382d3b54e4992226245e936", "lessThan": "59ba025948be2a92e8bc9ae1cbdaf197660bd508", "status": "affected", "versionType": "git" } ] }, { "product": "Linux", "vendor": "Linux", "defaultStatus": "affected", "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", "programFiles": [ "arch/powerpc/net/bpf_jit.h", "arch/powerpc/net/bpf_jit_comp.c", "arch/powerpc/net/bpf_jit_comp32.c", "arch/powerpc/net/bpf_jit_comp64.c" ], "versions": [ { "version": "6.13", "status": "affected" }, { "version": "0", "lessThan": "6.13", "status": "unaffected", "versionType": "semver" }, { "version": "6.15.4", "lessThanOrEqual": "6.15.*", "status": "unaffected", "versionType": "semver" }, { "version": "6.16", "lessThanOrEqual": "*", "status": "unaffected", "versionType": "original_commit_for_fix" } ] } ], "cpeApplicability": [ { "nodes": [ { "operator": "OR", "negate": false, "cpeMatch": [ { "vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "6.13", "versionEndExcluding": "6.15.4" }, { "vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "6.13", "versionEndExcluding": "6.16" } ] } ] } ], "references": [ { "url": "https://git.kernel.org/stable/c/7833deb95e05bec146414b3a2feb24f025ca27c0" }, { "url": "https://git.kernel.org/stable/c/59ba025948be2a92e8bc9ae1cbdaf197660bd508" } ], "title": "powerpc/bpf: fix JIT code size calculation of bpf trampoline", "x_generator": { "engine": "bippy-1.2.0" } } } }