From patchwork Wed Feb 9 19:14:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 541739 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 3B4E7C433EF for ; Wed, 9 Feb 2022 19:17:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233585AbiBITRv (ORCPT ); Wed, 9 Feb 2022 14:17:51 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:51470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233481AbiBITRs (ORCPT ); Wed, 9 Feb 2022 14:17:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5429C1DF8FA; Wed, 9 Feb 2022 11:17:41 -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 dfw.source.kernel.org (Postfix) with ESMTPS id A0D476197E; Wed, 9 Feb 2022 19:15:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85FCBC340E7; Wed, 9 Feb 2022 19:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644434127; bh=hZXirXigZI9GoouC6CuizAWFEKIWwDBONOJmuuybl44=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zD7HvA67XcD6Pv/zPupBR46gMPD6dD8oDgOcrPypFNeO2HV0q0VWlumjboeihKeR0 6X70NCgLkWMoq4ZtsgIgVxFRz0s1hzQxBPO4DFkJKoTUqnHFzAwbJxqsU3LSAJFItc bRjUoKxtpvi7/CGplVFYh6r6meB/eLqW2f0BxdHU= 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.10 2/3] KVM: s390: Return error on SIDA memop on normal guest Date: Wed, 9 Feb 2022 20:14:20 +0100 Message-Id: <20220209191248.973709059@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220209191248.892853405@linuxfoundation.org> References: <20220209191248.892853405@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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 @@ -4654,6 +4654,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: From patchwork Wed Feb 9 19:13:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 541368 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 A4F19C433F5 for ; Wed, 9 Feb 2022 19:15:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230184AbiBITPk (ORCPT ); Wed, 9 Feb 2022 14:15:40 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:42562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbiBITPk (ORCPT ); Wed, 9 Feb 2022 14:15:40 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A783C1DC160; Wed, 9 Feb 2022 11:15:34 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 76BF96193E; Wed, 9 Feb 2022 19:15:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54282C340E7; Wed, 9 Feb 2022 19:15:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644434103; bh=o6zUXEMGVaRSONjhKMI60+bcffn/pZstc2RF2pb50zw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oApCKBWESrto9GTEb1LmB18BtpmUSnjeFbMoTqOU313aLM8Lzdg2+l6sl5sWUC1Sh JhplT6qLZtReh49wbkVe8JXJP2mfzZcQCuRadLSPg8Ie5/VzV+rn99KZTUbWRs/Olk siEO2DO6aSsB/r3BC/cOoqJtNjSK5Cft8Jc1AoYc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, luofei Subject: [PATCH 4.14 3/3] x86/mm, mm/hwpoison: Fix the unmap kernel 1:1 pages check condition Date: Wed, 9 Feb 2022 20:13:40 +0100 Message-Id: <20220209191248.771916077@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220209191248.659458918@linuxfoundation.org> References: <20220209191248.659458918@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: luofei When fd0e786d9d09 ("x86/mm, mm/hwpoison: Don't unconditionally unmap kernel 1:1 pages") was backported to 4.14.y, the logic was reversed when calling memory_failure() to determine whether it needs to unmap the kernel page. Only when memory_failure() returns successfully, the kernel page can be unmapped. Signed-off-by: luofei Cc: stable@vger.kernel.org #v4.14.x Cc: stable@vger.kernel.org #v4.15.x Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/mcheck/mce.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c @@ -589,7 +589,7 @@ static int srao_decode_notifier(struct n if (mce_usable_address(mce) && (mce->severity == MCE_AO_SEVERITY)) { pfn = mce->addr >> PAGE_SHIFT; - if (memory_failure(pfn, MCE_VECTOR, 0)) + if (!memory_failure(pfn, MCE_VECTOR, 0)) mce_unmap_kpfn(pfn); }