CVE-2025-38257: s390/pkey: Prevent overflow in size calculation for memdup_user()
In the Linux kernel, the following vulnerability has been resolved:
s390/pkey: Prevent overflow in size calculation for memdup_user()
Number of apqn target list entries contained in 'nr_apqns' variable is
determined by userspace via an ioctl call so the result of the product in
calculation of size passed to memdup_user() may overflow.
In this case the actual size of the allocated area and the value
describing it won't be in sync leading to various types of unpredictable
behaviour later.
Use a proper memdup_array_user() helper which returns an error if an
overflow is detected. Note that it is different from when nr_apqns is
initially zero - that case is considered valid and should be handled in
subsequent pkey_handler implementations.
Found by Linux Verification Center (linuxtesting.org).
Security readout for executives and security teams
Plain-English summary
A local, low-privileged user on an affected Linux s390 system may trigger an integer overflow in the protected-key subsystem. The resulting allocation mismatch can cause unpredictable kernel behavior, with potential service disruption, data exposure, or limited data modification. The issue is not described as remotely exploitable.
Executive priority
Treat this as high priority for multi-user or sensitive s390 environments because a low-privileged local actor could affect confidentiality and availability. Rapidly identify exposed s390 systems and schedule supported kernel updates. Organizations without s390 workloads should document non-exposure after verification rather than initiate broad emergency patching.
Technical view
The s390 pkey ioctl accepts a user-controlled APQN entry count. Multiplication used to size memdup_user() can overflow, leaving the allocation smaller than the recorded list size and creating unsafe behavior in later processing. The stable fix replaces this operation with memdup_array_user(), which detects overflow and returns an error.
Likely exposure
Exposure is concentrated on Linux systems using the s390 architecture and affected pkey code, particularly where low-privileged local users can invoke the relevant ioctl. Non-s390 systems are not implicated by the supplied description. The bundle's version data is ambiguous, so administrators should confirm distribution-specific backport status rather than rely solely on version numbers.
Exploitation context
The CVSS vector indicates local access, low privileges, low complexity, and no user interaction. The supplied bundle reports that this CVE is not in KEV and provides no evidence of active exploitation or a public exploit. Practical exploitation conditions and reliability are not established by these sources.
Researcher notes
The critical invariant is synchronization between the allocated APQN array size and nr_apqns. Overflow breaks that invariant before later pkey handlers consume the list. The fix deliberately preserves zero entries as valid while rejecting arithmetic overflow. The sources do not establish the precise resulting memory-safety primitive, exploitability, or affected configuration requirements.
Mitigation direction
Apply a vendor-supported kernel update containing the applicable stable fix for CVE-2025-38257.
Prioritize s390 systems that expose or use the pkey ioctl interface.
Follow distribution guidance for backported packages and required reboot procedures.
Reduce untrusted local account access until affected systems are updated.
Validation and detection
Confirm whether each system runs the s390 architecture and uses the pkey subsystem.
Record the running kernel build and compare it with vendor backport guidance.
Check whether the applicable stable fix is present in the deployed kernel source or package changelog.
After maintenance, confirm the patched kernel is installed and currently running.
Monitor vendor advisories for revised affected-version boundaries or exploitation information.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2025-38257 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
1CVSS vectors
3Timeline events
1ADP providers
8Source links
CVSS vector scores
1 official score
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.