From patchwork Mon Feb 26 12:13:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 13572051 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 A92CF5FDB5; Mon, 26 Feb 2024 12:25:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708950316; cv=none; b=fQFeHMfgAvrX4kbXDw22FdKp8op02oRH9ETqKu2o61G5IyJn5CgWxcvGHfxxTRBRGuAIihYtXB3vv2WIXJzyM5rLKT4ORGdh2q5tPIfYbDpFIZSkVE96WtgSfSmVTGxQXHLOYEYJI6LDiMDVOeFmmlJtxTeYS360HCbMZIu2E1o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708950316; c=relaxed/simple; bh=KVjlE6bft1KW9DYhwgFiOuTQfTc2SbGa1PnHQHemBBg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a/8EgjajA88Mq2lOZa4VLSYXjMnsGuc1WDEqbgBWZSc7j0ZAMO7gOd0BR4n9qpQJcWndQDNIFbVweMvRhlfXpphz/7Yux2Jh9s8BfzaOWCpBV5iN+h6kU9kM+l5hISZBpKWUMKYqGZTayvKAd00NBXi4hPNnw0husoUSIPOCX5A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=FBy4S5n2; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="FBy4S5n2" Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41QBviqt017715; Mon, 26 Feb 2024 12:25:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=uDyZV07FmYvXG5qifeD+746o5SkW+wy29geRf4gWwyA=; b=FBy4S5n2ZCIoUPBUZJL8Kf+MC1Wj7d4TElqBPArG69PNOlx52/PGjHnlnPhtZVdUfAYo KaEyDMT8lXad/IeVcPrg1g4v+H/qLNTtIZnWjkUgJm1X4Hdi5G2eOgb/i9l6wkBZABzq 0s4ny9KBjoDIRfzt3ry75ApO6NRYo/YIiSyF2W1BMK+EfxsTtBK43i1rawTFPfd2T6XX cs14Q+YER5TBm5NbQKX7PqN9gSNek81PYZ3hG51KqfuC5O8E8EYwfmk2KxEJ5y148jdI V5kRGPCrGgBnMdAcHblZJLCaPZisOjGrXtcLNlSzo6HKXKQXZMSJ/JYbg9rPZNMkmEMq nw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wgt7mrhyq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Feb 2024 12:25:12 +0000 Received: from m0353723.ppops.net (m0353723.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41QCKUhZ013341; Mon, 26 Feb 2024 12:25:12 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wgt7mrheb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Feb 2024 12:25:11 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41QAmiAG021762; Mon, 26 Feb 2024 12:22:16 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3wfu5ys3p8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Feb 2024 12:22:15 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41QCMAUY29884730 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Feb 2024 12:22:12 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1E3D92004E; Mon, 26 Feb 2024 12:22:10 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 62C212004B; Mon, 26 Feb 2024 12:22:09 +0000 (GMT) Received: from li-9fd7f64c-3205-11b2-a85c-df942b00d78d.fritz.box (unknown [9.171.77.191]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 26 Feb 2024 12:22:09 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@linux.ibm.com, cohuck@redhat.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, seiden@linux.ibm.com, nsg@linux.ibm.com, farman@linux.ibm.com, agordeev@linux.ibm.com Subject: [GIT PULL 1/3] KVM: s390: fix virtual vs physical address confusion Date: Mon, 26 Feb 2024 13:13:06 +0100 Message-ID: <20240226122059.58099-2-frankja@linux.ibm.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240226122059.58099-1-frankja@linux.ibm.com> References: <20240226122059.58099-1-frankja@linux.ibm.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: dUgDTmDwgAd834gAFcNN3hFk2ZgigMPA X-Proofpoint-ORIG-GUID: YJ7-Ha8_cyvsKS7sH8qTJXmjDUuIKaMC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-26_09,2024-02-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=999 bulkscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 spamscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402260094 From: Alexander Gordeev Fix virtual vs physical address confusion. This does not fix a bug since virtual and physical address spaces are currently the same. Suggested-by: Janosch Frank Signed-off-by: Alexander Gordeev Acked-by: Janosch Frank Acked-by: Anthony Krowiak Signed-off-by: Janosch Frank --- arch/s390/kvm/kvm-s390.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index ea63ac769889..6635a7acef34 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -3153,7 +3153,7 @@ static int kvm_s390_apxa_installed(void) */ static void kvm_s390_set_crycb_format(struct kvm *kvm) { - kvm->arch.crypto.crycbd = (__u32)(unsigned long) kvm->arch.crypto.crycb; + kvm->arch.crypto.crycbd = virt_to_phys(kvm->arch.crypto.crycb); /* Clear the CRYCB format bits - i.e., set format 0 by default */ kvm->arch.crypto.crycbd &= ~(CRYCB_FORMAT_MASK); From patchwork Mon Feb 26 12:13:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 13572050 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 08687604AC; Mon, 26 Feb 2024 12:24:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708950298; cv=none; b=BPkkeqmr6Usjb8p7eeufrlTpravtuDqvS9PgSokedac6MNBHoqRuVAqd5zFM6Zh9zFmUSnzsPlGc9M11fCV9vyq/U3f61SvRhDwVvo8mUsyr9I3A+bemD3I6LDQN+eg9nbMQAE3pu2R8Qsr/WtQ9dGP/mZSQrygLUAmLBJTl+Ww= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708950298; c=relaxed/simple; bh=G134br+7cQPlC0mne7n5f1kl9NJaiZGtZ7MySetIKn0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ph+PAZLLO2Hl1FbQRkiwicaTlPOnVX9ai04NsDsMlgrZP5WJB8CspnLho0RNX4tDZTMJHSDoJKixzCL0y0xB8w5fmV2a003GzQJMoTZ1UTLLfkylH2M28j4iI+YmN8++LmUXlred6MBJ0NTRx2RJURkg+vc4Ip1AXby4HeOMTCY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=lqz3LSMa; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="lqz3LSMa" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41QAjVjn000332; Mon, 26 Feb 2024 12:24:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=kvNKxyBwV5fPEikynXGvQi/BhzabOFSP5k479+v5g6M=; b=lqz3LSMaPZEfvDH5N+OH7ZujZVm1UR+FrTC2SZeOGqAT/4hbaGpDEU/Wxi/6wULDaXUu PKjrD7Me7BkExtjPZS7yWEx8At6Y1a8AePSyKUFBQi5dknjJ//3nFZGf4MVhaUbY8z+K vxa4/gIhf+a4YjnPxcXeqwnFTC23Al7WoyHIkKhmNr0qC47xu8wVzw0J2gcq+S46rwIT AMzc7Qh1cY451H4sWwCsDi6E4fT4cs197cZm3ASt/1LomPD4bpEN6qOn0dmlPqCJezV/ 22+QyyAi0Cu30Syg8LzxASolXioWC3dCVrZ/D8l7/lstcBDNfW61XBMRWgg7oboTF5tE Bw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wgpbkwtch-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Feb 2024 12:24:55 +0000 Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41QC0OE7010174; Mon, 26 Feb 2024 12:24:54 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wgpbkwsst-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Feb 2024 12:24:53 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41QAi0aT008787; Mon, 26 Feb 2024 12:22:16 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3wftst985x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Feb 2024 12:22:16 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41QCMAUB4850362 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Feb 2024 12:22:13 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DACF72004F; Mon, 26 Feb 2024 12:22:10 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3511E2004B; Mon, 26 Feb 2024 12:22:10 +0000 (GMT) Received: from li-9fd7f64c-3205-11b2-a85c-df942b00d78d.fritz.box (unknown [9.171.77.191]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 26 Feb 2024 12:22:10 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@linux.ibm.com, cohuck@redhat.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, seiden@linux.ibm.com, nsg@linux.ibm.com, farman@linux.ibm.com, agordeev@linux.ibm.com Subject: [GIT PULL 2/3] KVM: s390: only deliver the set service event bits Date: Mon, 26 Feb 2024 13:13:07 +0100 Message-ID: <20240226122059.58099-3-frankja@linux.ibm.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240226122059.58099-1-frankja@linux.ibm.com> References: <20240226122059.58099-1-frankja@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Ca3jHRKEHVKaPxrVSiFGJyfQvmLDutrU X-Proofpoint-ORIG-GUID: 1EFHYtXUwNdytRXsGALmf18zVLcWOMiE X-Proofpoint-UnRewURL: 0 URL was un-rewritten Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-26_09,2024-02-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 bulkscore=0 mlxlogscore=722 phishscore=0 adultscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 clxscore=1015 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402260094 From: Eric Farman The SCLP driver code masks off the last two bits of the parameter [1] to determine if a read is required, but doesn't care about the contents of those bits. Meanwhile, the KVM code that delivers event interrupts masks off those two bits but sends both to the guest, even if only one was specified by userspace [2]. This works for the driver code, but it means any nuances of those bits gets lost. Use the event pending mask as an actual mask, and only send the bit(s) that were specified in the pending interrupt. [1] Linux: sclp_interrupt_handler() (drivers/s390/char/sclp.c:658) [2] QEMU: service_interrupt() (hw/s390x/sclp.c:360..363) Fixes: 0890ddea1a90 ("KVM: s390: protvirt: Add SCLP interrupt handling") Signed-off-by: Eric Farman Reviewed-by: Christian Borntraeger Reviewed-by: Janosch Frank Link: https://lore.kernel.org/r/20240205214300.1018522-1-farman@linux.ibm.com Signed-off-by: Janosch Frank Message-Id: <20240205214300.1018522-1-farman@linux.ibm.com> --- arch/s390/kvm/interrupt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c index fc4007cc067a..20e080e9150b 100644 --- a/arch/s390/kvm/interrupt.c +++ b/arch/s390/kvm/interrupt.c @@ -1031,7 +1031,7 @@ static int __must_check __deliver_service_ev(struct kvm_vcpu *vcpu) return 0; } ext = fi->srv_signal; - /* only clear the event bit */ + /* only clear the event bits */ fi->srv_signal.ext_params &= ~SCCB_EVENT_PENDING; clear_bit(IRQ_PEND_EXT_SERVICE_EV, &fi->pending_irqs); spin_unlock(&fi->lock); @@ -1041,7 +1041,7 @@ static int __must_check __deliver_service_ev(struct kvm_vcpu *vcpu) trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, KVM_S390_INT_SERVICE, ext.ext_params, 0); - return write_sclp(vcpu, SCCB_EVENT_PENDING); + return write_sclp(vcpu, ext.ext_params & SCCB_EVENT_PENDING); } static int __must_check __deliver_pfault_done(struct kvm_vcpu *vcpu) From patchwork Mon Feb 26 12:13:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 13572048 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 D17591B27D; Mon, 26 Feb 2024 12:22:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708950141; cv=none; b=tGhIU6t9/PAT9duF0RCwOoelXoI4ygyEo6HlU/JwGtgwG8kbzoqiSrXtdqp1PqOg38ye1tynMDU5edt9vbfWq9ZvoUekvqfHiYWYAS1J0TJQuaGmbTFHnZYDGbepVCOS1Aj1857vCl8FAxURnoYXlsgZuQ/TOFvXg6ISZxRC9Kg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708950141; c=relaxed/simple; bh=QFPvDa2lxmo4YOn1ORSLR33cthEAeOK/nOOiHFx4OGM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WOmU4hpyC/MnNYvKLHslFWNZulwQZexlhIkon344Gr4zWDnSpCyqUxgyFvmHPVSFpDutMt6oC1rOproF1hKwj2nSf6wmcfQRn5QdwyFP+i/PDOsVON6CMjWt2VW8aIFU4cRRZnWyKNvH9nrY+yhsadQXpk8neuPMvWxD0VfONbc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=C5V2eFUU; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="C5V2eFUU" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41QBHxf8017101; Mon, 26 Feb 2024 12:22:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=VyO/Bn9rRziw5b+b8H3zbS3vRf3SyqHOy0xyWMtCGEA=; b=C5V2eFUU/Lq7vAdwpvXuel4JDv8yqamSRuALt99g9NF3N4qy9OwqZObrBmdyk03TY2BN Y/eOJpMwC/TZ9qZmLsFTNSaD1NXIRzQ3dQIjqZC82Y6adb6rnHQ+yDV/a9lpBeYBUwjb 2yFcIYcEW5nGBJFn0LUGyLYI5x08AbJ0ji3s0ffq/ZHSZAbQXZXsQSOk3MOKvGBh4rpn IpRveIVroBU5xWAh3zEhvLDpqndONZA9ICmBLVcYfYJ28N0w8CUmYG8w3XL1VzNX25KH q4+mrdjM5Ughk0ycQubFA60s2fNlshNzn2n1uJVuEnR6qMhtsWMTge82V/ws49nvnAGw Hg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wgsmvharc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Feb 2024 12:22:18 +0000 Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41QBJSSs022278; Mon, 26 Feb 2024 12:22:18 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wgsmvhapt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Feb 2024 12:22:18 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41Q9x4uF023910; Mon, 26 Feb 2024 12:22:17 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3wfw0k0jvx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Feb 2024 12:22:17 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41QCMBJW12255798 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Feb 2024 12:22:13 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ACB0120040; Mon, 26 Feb 2024 12:22:11 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F111D2004B; Mon, 26 Feb 2024 12:22:10 +0000 (GMT) Received: from li-9fd7f64c-3205-11b2-a85c-df942b00d78d.fritz.box (unknown [9.171.77.191]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 26 Feb 2024 12:22:10 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@linux.ibm.com, cohuck@redhat.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, seiden@linux.ibm.com, nsg@linux.ibm.com, farman@linux.ibm.com, agordeev@linux.ibm.com Subject: [GIT PULL 3/3] KVM: s390: selftest: memop: Fix undefined behavior Date: Mon, 26 Feb 2024 13:13:08 +0100 Message-ID: <20240226122059.58099-4-frankja@linux.ibm.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240226122059.58099-1-frankja@linux.ibm.com> References: <20240226122059.58099-1-frankja@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 64ySW8unw7eWraq9kQCf9cdKBuA1ykN9 X-Proofpoint-GUID: nBb8vMWyGElU3ko5lbyI1ziYHwOPO2ZD X-Proofpoint-UnRewURL: 0 URL was un-rewritten Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-26_09,2024-02-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402260094 From: Nina Schoetterl-Glausch If an integer's type has x bits, shifting the integer left by x or more is undefined behavior. This can happen in the rotate function when attempting to do a rotation of the whole value by 0. Fixes: 0dd714bfd200 ("KVM: s390: selftest: memop: Add cmpxchg tests") Signed-off-by: Nina Schoetterl-Glausch Link: https://lore.kernel.org/r/20240111094805.363047-1-nsg@linux.ibm.com Acked-by: Janosch Frank Signed-off-by: Janosch Frank Message-Id: <20240111094805.363047-1-nsg@linux.ibm.com> --- tools/testing/selftests/kvm/s390x/memop.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/kvm/s390x/memop.c b/tools/testing/selftests/kvm/s390x/memop.c index bb3ca9a5d731..4ec8d0181e8d 100644 --- a/tools/testing/selftests/kvm/s390x/memop.c +++ b/tools/testing/selftests/kvm/s390x/memop.c @@ -489,6 +489,8 @@ static __uint128_t rotate(int size, __uint128_t val, int amount) amount = (amount + bits) % bits; val = cut_to_size(size, val); + if (!amount) + return val; return (val << (bits - amount)) | (val >> amount); }