Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6129528D8C8 for ; Wed, 9 Jul 2025 10:44:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752057854; cv=none; b=p0TriSYRAgxZXHVMuSNhZ7gR61ZGU7I4hjT5oddYs35zhowjGNsONy+346dxJyDdWY6rPNR6tD3FdlYYc//9B9Z5lDDnHR/zcZKNfsAxHgf6lITo25XgD94URxgzvYM4z1bHqEy/vEvlISQtRLg0yWLDZr/cQxms0dbznqqnJDw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752057854; c=relaxed/simple; bh=3PprhSN7IzNvY0zSBZ4npHQQohMfuhF2gJwDa8X8QbM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=EhHvWWvQBIOXgxIHR5DayJmmNFC2SS9Mi6slMPEYahCMBeAjxfMlNEmJiK6v8+S6n8TVl3hbez5WfeO/qkzI4aptN97nEbKOEZVCVHzPy3UlgjLtu934p5c9TXUdsaTmxTTx7Z5E8Nend4O3WoXHyaD2qv6ssrCpl9q0X+ynJW0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=L6bKQC9Y; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="L6bKQC9Y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89D4EC4CEF5; Wed, 9 Jul 2025 10:44:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1752057853; bh=3PprhSN7IzNvY0zSBZ4npHQQohMfuhF2gJwDa8X8QbM=; h=From:To:Cc:Subject:Date:Reply-to:From; b=L6bKQC9YHO/CWOyqXQYRz6Fo98VZNYzl7rwWt7YtKIhrB4dv0VqaFujbPtK8rIY6q eXNlNiJoNE5abGSSX45Cr2gNW3jzIedlMPaz7mhZeA9Vl504b/BKNbV8+Nyc06T2Ru I0rdG/LuozA76xFMk6M3mJnGsW7YcDJYAYhZI4+Y= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-38257: s390/pkey: Prevent overflow in size calculation for memdup_user() Date: Wed, 9 Jul 2025 12:42:49 +0200 Message-ID: <2025070935-CVE-2025-38257-3e5d@gregkh> X-Mailer: git-send-email 2.50.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=3144; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=N8Tl1p+J4/eEqz7YLnSu+Cb+h2olKRnYuN17fvFB8xg=; b=owGbwMvMwCRo6H6F97bub03G02pJDBl57nO+7H+mu8razbHogZ7qfMGsabcOzLaT4OqTe8ltX nz8y/RXHbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjCRlT4MC7Yk5B0RUjLdmvOF ZVe6+fvrnK1GBxnmOygJG7aVOukY5RzxVL2oJ7Fm57tzAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== 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). The Linux kernel CVE team has assigned CVE-2025-38257 to this issue. Affected and fixed versions =========================== Issue introduced in 5.4 with commit f2bbc96e7cfad3891b7bf9bd3e566b9b7ab4553d and fixed in 6.1.143 with commit faa1ab4a23c42e34dc000ef4977b751d94d5148c Issue introduced in 5.4 with commit f2bbc96e7cfad3891b7bf9bd3e566b9b7ab4553d and fixed in 6.6.96 with commit 88f3869649edbc4a13f6c2877091f81cd5a50f05 Issue introduced in 5.4 with commit f2bbc96e7cfad3891b7bf9bd3e566b9b7ab4553d and fixed in 6.12.36 with commit f855b119e62b004a5044ed565f2a2b368c4d3f16 Issue introduced in 5.4 with commit f2bbc96e7cfad3891b7bf9bd3e566b9b7ab4553d and fixed in 6.15.5 with commit 73483ca7e07a5e39bdf612eec9d3d293e8bef649 Issue introduced in 5.4 with commit f2bbc96e7cfad3891b7bf9bd3e566b9b7ab4553d and fixed in 6.16-rc4 with commit 7360ee47599af91a1d5f4e74d635d9408a54e489 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2025-38257 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/s390/crypto/pkey_api.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/faa1ab4a23c42e34dc000ef4977b751d94d5148c https://git.kernel.org/stable/c/88f3869649edbc4a13f6c2877091f81cd5a50f05 https://git.kernel.org/stable/c/f855b119e62b004a5044ed565f2a2b368c4d3f16 https://git.kernel.org/stable/c/73483ca7e07a5e39bdf612eec9d3d293e8bef649 https://git.kernel.org/stable/c/7360ee47599af91a1d5f4e74d635d9408a54e489