CVE-2025-38339 (GCVE-0-2025-38339)
Vulnerability from cvelistv5
Published
2025-07-10 08:15
Modified
2026-08-05 12:01
Summary
In the Linux kernel, the following vulnerability has been resolved: powerpc/bpf: fix JIT code size calculation of bpf trampoline arch_bpf_trampoline_size() provides JIT size of the BPF trampoline before the buffer for JIT'ing it is allocated. The total number of instructions emitted for BPF trampoline JIT code depends on where the final image is located. So, the size arrived at with the dummy pass in arch_bpf_trampoline_size() can vary from the actual size needed in arch_prepare_bpf_trampoline(). When the instructions accounted in arch_bpf_trampoline_size() is less than the number of instructions emitted during the actual JIT compile of the trampoline, the below warning is produced: WARNING: CPU: 8 PID: 204190 at arch/powerpc/net/bpf_jit_comp.c:981 __arch_prepare_bpf_trampoline.isra.0+0xd2c/0xdcc which is: /* Make sure the trampoline generation logic doesn't overflow */ if (image && WARN_ON_ONCE(&image[ctx->idx] > (u32 *)rw_image_end - BPF_INSN_SAFETY)) { So, during the dummy pass, instead of providing some arbitrary image location, account for maximum possible instructions if and when there is a dependency with image location for JIT'ing.
Impacted products
Vendor Product Version
Linux Linux Version: d243b62b7bd3d5314382d3b54e4992226245e936
Version: d243b62b7bd3d5314382d3b54e4992226245e936
Create a notification for this product.
Show details on NVD website


{
  "containers": {
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "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"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "7833deb95e05bec146414b3a2feb24f025ca27c0",
              "status": "affected",
              "version": "d243b62b7bd3d5314382d3b54e4992226245e936",
              "versionType": "git"
            },
            {
              "lessThan": "59ba025948be2a92e8bc9ae1cbdaf197660bd508",
              "status": "affected",
              "version": "d243b62b7bd3d5314382d3b54e4992226245e936",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "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"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "6.13"
            },
            {
              "lessThan": "6.13",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.15.*",
              "status": "unaffected",
              "version": "6.15.4",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.16",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "cpeApplicability": [
        {
          "nodes": [
            {
              "cpeMatch": [
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.15.4",
                  "versionStartIncluding": "6.13",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.16",
                  "versionStartIncluding": "6.13",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "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\u0027ing 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\u0027t overflow */\n  if (image \u0026\u0026 WARN_ON_ONCE(\u0026image[ctx-\u003eidx] \u003e\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\u0027ing."
        }
      ],
      "metrics": [
        {
          "cvssV3_1": {
            "baseScore": 7.8,
            "baseSeverity": "HIGH",
            "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
            "version": "3.1"
          },
          "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 \u2192 bpf_tracing_prog_attach \u2192 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\u0027s user namespace, so an unprivileged container user holding a delegated token \u2014 or a non-root tracing daemon with only these caps \u2014 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\u0027s 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\u0027d 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 \u2014 including attacker-chosen bpf_cookie immediates emitted via PPC_LI32 \u2014 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."
            }
          ]
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2026-08-05T12:01:12.779Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "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"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2025-38339",
    "datePublished": "2025-07-10T08:15:09.646Z",
    "dateReserved": "2025-04-16T04:51:24.005Z",
    "dateUpdated": "2026-08-05T12:01:12.779Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.


Loading…

Loading…