{ "dataType": "CVE_RECORD", "dataVersion": "5.2", "cveMetadata": { "cveId": "CVE-2025-40063", "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "state": "PUBLISHED", "assignerShortName": "Linux", "dateReserved": "2025-04-16T07:20:57.159Z", "datePublished": "2025-10-28T11:48:34.549Z", "dateUpdated": "2026-08-05T12:07:28.106Z" }, "containers": { "cna": { "providerMetadata": { "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "shortName": "Linux", "dateUpdated": "2026-08-05T12:07:28.106Z" }, "descriptions": [ { "lang": "en", "value": "In the Linux kernel, the following vulnerability has been resolved:\n\ncrypto: comp - Use same definition of context alloc and free ops\n\nIn commit 42d9f6c77479 (\"crypto: acomp - Move scomp stream allocation\ncode into acomp\"), the crypto_acomp_streams struct was made to rely on\nhaving the alloc_ctx and free_ctx operations defined in the same order\nas the scomp_alg struct. But in that same commit, the alloc_ctx and\nfree_ctx members of scomp_alg may be randomized by structure layout\nrandomization, since they are contained in a pure ops structure\n(containing only function pointers). If the pointers within scomp_alg\nare randomized, but those in crypto_acomp_streams are not, then\nthe order may no longer match. This fixes the problem by removing the\nunion from scomp_alg so that both crypto_acomp_streams and scomp_alg\nwill share the same definition of alloc_ctx and free_ctx, ensuring\nthey will always have the same layout." } ], "metrics": [ { "cvssV3_1": { "version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H", "baseScore": 7, "baseSeverity": "HIGH" }, "scenarios": [ { "lang": "en", "value": "AV:L - The affected algorithms (lzo, lzo-rle, lz4, lz4hc, 842, nx842) are reached only through local kernel consumers — zswap page compression, UBIFS, and boot-time crypto self-tests — via `crypto_scomp_init_tfm()`. The only remote consumer of the compression API, IPComp/xfrm, uses deflate, which is an `acomp_alg` with its own `crypto_acomp_streams` and is unaffected.\nAC:H - Manifestation requires a kernel built with CONFIG_RANDSTRUCT_FULL/PERFORMANCE (the default is RANDSTRUCT_NONE) *and* a per-build randomization seed that actually transposes `alloc_ctx`/`free_ctx` in the pure-ops anonymous struct. Both are fixed at compile time and entirely beyond the attacker's control, so a susceptible target must be found rather than created.\nPR:L - On a susceptible build, an unprivileged local process can drive the faulty path simply by generating memory pressure that makes zswap compress its pages, which triggers per-CPU `alloc_ctx()` calls in `acomp_stream_workfn()`; no capability or namespace privilege is needed. Only basic local code execution is required.\nUI:N - Compression is performed by the kernel as part of normal swap/filesystem operation driven by the attacker's own allocations. No victim action such as mounting a filesystem or opening a file is required.\nS:U - The corruption is confined to kernel memory within the same security authority; there is no VM, IOMMU, or sandbox boundary crossed. This is a standard in-kernel memory-corruption issue.\nC:H - The garbage return value of the mis-called `free_ctx` becomes `stream->ctx` and is used as the compression workspace, and the uncontrolled `kvfree()` corrupts the heap, yielding primitives that can be leveraged to read arbitrary kernel memory. Decompression additionally reads through the wild context pointer.\nI:H - `lzo1x_1_compress()` writes up to LZO1X_MEM_COMPRESS (16KB) of hash-table state through the uncontrolled `ctx` pointer, an arbitrary kernel write, and `kvfree()` on a garbage pointer is an arbitrary-free primitive enabling heap grooming and control-flow hijack.\nA:H - Calling `kvfree()` on an uninitialized register value and then dereferencing a wild pointer as a scratch buffer reliably produces an oops or panic; on CFI-enabled builds the type-mismatched indirect call itself panics. The system is effectively unbootable or crashes on first compression." } ] } ], "affected": [ { "product": "Linux", "vendor": "Linux", "defaultStatus": "unaffected", "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", "programFiles": [ "crypto/842.c", "crypto/lz4.c", "crypto/lz4hc.c", "crypto/lzo-rle.c", "crypto/lzo.c", "drivers/crypto/nx/nx-common-powernv.c", "drivers/crypto/nx/nx-common-pseries.c", "include/crypto/internal/scompress.h" ], "versions": [ { "version": "42d9f6c774790d290c175e8775ce9f1366438098", "lessThan": "779d3b6f2d32c5f1da6163e959abe1e1ffe2945b", "status": "affected", "versionType": "git" }, { "version": "42d9f6c774790d290c175e8775ce9f1366438098", "lessThan": "f75f66683ded09f7135aef2e763c245a07c8271a", "status": "affected", "versionType": "git" } ] }, { "product": "Linux", "vendor": "Linux", "defaultStatus": "affected", "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", "programFiles": [ "crypto/842.c", "crypto/lz4.c", "crypto/lz4hc.c", "crypto/lzo-rle.c", "crypto/lzo.c", "drivers/crypto/nx/nx-common-powernv.c", "drivers/crypto/nx/nx-common-pseries.c", "include/crypto/internal/scompress.h" ], "versions": [ { "version": "6.16", "status": "affected" }, { "version": "0", "lessThan": "6.16", "status": "unaffected", "versionType": "semver" }, { "version": "6.17.3", "lessThanOrEqual": "6.17.*", "status": "unaffected", "versionType": "semver" }, { "version": "6.18", "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.16", "versionEndExcluding": "6.17.3" }, { "vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "6.16", "versionEndExcluding": "6.18" } ] } ] } ], "references": [ { "url": "https://git.kernel.org/stable/c/779d3b6f2d32c5f1da6163e959abe1e1ffe2945b" }, { "url": "https://git.kernel.org/stable/c/f75f66683ded09f7135aef2e763c245a07c8271a" } ], "title": "crypto: comp - Use same definition of context alloc and free ops", "x_generator": { "engine": "bippy-1.2.0" } } } }