CVE-2025-38257: s390/pkey: Prevent overflow in size calculation for memdup_user()

Published Jul 9, 2025
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

s390/pkey: Prevent overflow in size calculation for memdupuser()

Number of apqn target list entries contained in 'nrapqns' variable is determined by userspace via an ioctl call so the result of the product in calculation of size passed to memdupuser() 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 memduparrayuser() helper which returns an error if an overflow is detected. Note that it is different from when nrapqns is initially zero - that case is considered valid and should be handled in subsequent pkeyhandler implementations.

Found by Linux Verification Center (linuxtesting.org).

Affected Software

13 affected componentsFixes available
Linux Kernel
Microsoft cbl2 kernel 5.15.186.1-1
Microsoft azl3 kernel 6.6.92.2-2
Linux Linux kernel>=5.4<5.15.187
Linux Linux kernel>=5.16<6.1.143
Linux Linux kernel>=6.2<6.6.96
Linux Linux kernel>=6.7<6.12.36
Linux Linux kernel>=6.13<6.15.5
Linux Linux kernel=6.16-rc1
Linux Linux kernel=6.16-rc2
Linux Linux kernel=6.16-rc3
Debian Debian Linux=11.0
debian/linux
6.1.176-16.1.190-16.12.107-16.12.113-17.2.12-17.2.13-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/linux to a version that resolves this vulnerability.

    Fixed in 6.1.176-1Fixed in 6.1.190-1Fixed in 6.12.107-1Fixed in 6.12.113-1Fixed in 7.2.12-1Fixed in 7.2.13-1
  2. Compensating control

    In the s390/pkey code, replace the memdup_user() allocation and manual size calculation with the memdup_array_user() helper so an overflow in the userspace-controlled nr_apqns array size is detected and returns an error.

Event History

Jul 9, 2025
CVE Published
via MITRE·10:42 AM
Data Sourced
via MITRE·10:42 AM
DescriptionSeverity
Data Sourced
via NVD·11:15 AM
RemedyDescriptionSeverityAffected Software
Aug 7, 2025
Data Sourced
via Microsoft·12:00 AM
DescriptionSeverityWeaknessAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Peer vulnerabilities

Found alongside the following vulnerabilities.

Frequently Asked Questions

1

What is the severity of CVE-2025-38257?

CVE-2025-38257 has a medium severity rating due to the potential for memory overflow affecting system stability.

2

How do I fix CVE-2025-38257?

To mitigate CVE-2025-38257, update your Linux kernel to the latest version where the vulnerability has been patched.

3

What systems are affected by CVE-2025-38257?

CVE-2025-38257 affects the Linux kernel, specifically systems using the s390 architecture.

4

What are the risks of not addressing CVE-2025-38257?

Failing to address CVE-2025-38257 may lead to potential system crashes and unexpected behaviors due to memory overflow.

5

Is CVE-2025-38257 exploitable?

CVE-2025-38257 is deemed exploitable under certain conditions, particularly where user space can influence kernel memory operations.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203