From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 6048F5012BF; Tue, 13 Oct 2026 12:15:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791893720; cv=none; b=jKpzhsIVsgBRUv/VmZuP29LH9b1NqUMbujjPn1lPOV7lD8BxCfQnaSjqZajNY+v8u47WGQNRW0rZU0h/2NFU3V8kqcvcW7NepsXYXQdGel/uaFUAU5y28nmBSxb0StZ/a0mkczgZi90H3lDsnWZGp8EL6MGaNpH3PYDRclhnYH4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791893720; c=relaxed/simple; bh=DXt9K6bxM9gdVhXQDBPS3r6ok0FlES7+JCX5ggDEU4o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b6Zp7OFimKsLwYqXbDW1TIVsukwiB/hBMvqcS4DUu0Ox0dr6vwIS+56yjXdB2QJNu8u+6ITia7OnebVgBOEHEDRJEcb7cKMavJ9MpSjqYi1D50iypqpH9z6QjA+4g8BUiQjG5ts7ZCjXjxWIHnoz5gXOG5auBEGJ/XdKTOdVr8Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=od/ampB2; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="od/ampB2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE0041F00893; Tue, 13 Oct 2026 12:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791893719; bh=U3MrzswT32TV8/S4uxSKG6wQPHEm1m9P/Rvm16yw0fM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=od/ampB2bBxJjihmD24DLRbNXr8VyhMi57rRO8bCYOi7uKMfJlw5np8u9xH705m8S KFmPHH2gfgxVOIcTCI9whhEe2Umtp0kfc6u3I3mJqfsbiIJ0b6Vw0YrL63pIyyb/HH W5gLrRbXlIfVxRi+AXlsKiTir8Uakby8B+5QH7Aw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christian Borntraeger , Finn Callies , Harald Freudenberger , Vasily Gorbik , Sasha Levin Subject: [PATCH 6.18 320/621] s390/zcrypt: Close speculative mem read possibility Date: Tue, 13 Oct 2026 13:35:15 +0200 Message-ID: <20261013112928.446653054@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261013112920.855194808@linuxfoundation.org> References: <20261013112920.855194808@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Harald Freudenberger [ Upstream commit e935cd525af4c6ed2e2c6404aa27ca19c7f39ddb ] The domain value is extracted from a given CCA or EP11 ioctl struct when a CPRB is about to be sent. Thus this is a user controlled value. Under some special conditions (custom device node used, administrative load) this value is used as an array index after bounds checking, but without speculation barrier. Add the missing array_index_nospec() call to prevent speculative execution where this domain value is used. Fixes: cfd68b33094e ("s390/zcrypt: Filter admin CPRBs on custom devices") Cc: stable@vger.kernel.org Reported-by: Christian Borntraeger Reviewed-by: Finn Callies Signed-off-by: Harald Freudenberger Signed-off-by: Vasily Gorbik Signed-off-by: Sasha Levin --- drivers/s390/crypto/zcrypt_api.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c index 9b705346f845a..eff9ad7aa14ed 100644 --- a/drivers/s390/crypto/zcrypt_api.c +++ b/drivers/s390/crypto/zcrypt_api.c @@ -879,6 +879,7 @@ static long _zcrypt_send_cprb(u32 xflags, struct ap_perms *perms, if (perms != &ap_perms && domain < AP_DOMAINS) { if (ap_msg.flags & AP_MSG_FLAG_ADMIN) { + domain = array_index_nospec(domain, AP_DOMAINS); if (!test_bit_inv(domain, perms->adm)) { rc = -ENODEV; goto out; @@ -1078,6 +1079,7 @@ static long _zcrypt_send_ep11_cprb(u32 xflags, struct ap_perms *perms, if (perms != &ap_perms && domain < AP_DOMAINS) { if (ap_msg.flags & AP_MSG_FLAG_ADMIN) { + domain = array_index_nospec(domain, AP_DOMAINS); if (!test_bit_inv(domain, perms->adm)) { rc = -ENODEV; goto out; -- 2.53.0