From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2B0DC433F5 for ; Wed, 9 Feb 2022 19:26:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234352AbiBIT0h (ORCPT ); Wed, 9 Feb 2022 14:26:37 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:45194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234758AbiBIT0K (ORCPT ); Wed, 9 Feb 2022 14:26:10 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFD88C1DC5FA; Wed, 9 Feb 2022 11:19:14 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E31A6B82393; Wed, 9 Feb 2022 19:15:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06E4CC340E7; Wed, 9 Feb 2022 19:15:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644434158; bh=IrgqHa2QwSbIxMhpEksDKoTT5fvgIWnKZ7/Ytsgb0oY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gQ9CET9EWCYBZ65v4/no2lhFxSBHPHFufGKjdv/jVC0GUiupeypFKhr3gdJWYe1Og w9qTd10FvFzoSvQLwO02FBEm+JFOFo7Eh4uibD0aLxZ0EsRd8kkxq7QEqoO4CDWobz MFqVDPz9+pak2CyqskHDBFTZhNi5LCz6LhqgTXhI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Janis Schoetterl-Glausch , Christian Borntraeger Subject: [PATCH 5.16 3/5] KVM: s390: Return error on SIDA memop on normal guest Date: Wed, 9 Feb 2022 20:14:35 +0100 Message-Id: <20220209191250.009221364@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220209191249.887150036@linuxfoundation.org> References: <20220209191249.887150036@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Janis Schoetterl-Glausch commit 2c212e1baedcd782b2535a3f86bc491977677c0e upstream. Refuse SIDA memops on guests which are not protected. For normal guests, the secure instruction data address designation, which determines the location we access, is not under control of KVM. Fixes: 19e122776886 (KVM: S390: protvirt: Introduce instruction data area bounce buffer) Signed-off-by: Janis Schoetterl-Glausch Cc: stable@vger.kernel.org Signed-off-by: Christian Borntraeger Signed-off-by: Greg Kroah-Hartman --- arch/s390/kvm/kvm-s390.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -4711,6 +4711,8 @@ static long kvm_s390_guest_sida_op(struc return -EINVAL; if (mop->size + mop->sida_offset > sida_size(vcpu->arch.sie_block)) return -E2BIG; + if (!kvm_s390_pv_cpu_is_protected(vcpu)) + return -EINVAL; switch (mop->op) { case KVM_S390_MEMOP_SIDA_READ: