Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752735AbbFHIeR (ORCPT ); Mon, 8 Jun 2015 04:34:17 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:28498 "EHLO imgpgp01.kl.imgtec.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752636AbbFHIeB (ORCPT ); Mon, 8 Jun 2015 04:34:01 -0400 X-PGP-Universal: processed; by imgpgp01.kl.imgtec.org on Mon, 08 Jun 2015 09:33:59 +0100 Message-ID: <5575536E.8080608@imgtec.com> Date: Mon, 8 Jun 2015 09:33:50 +0100 From: James Hogan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: stable CC: Nicholas Mc Guire , Gleb Natapov , Paolo Bonzini , Ralf Baechle , , , Subject: Re: [PATCH] MIPS: KVM: do not sign extend on unsigned MMIO load References: <1431002870-30098-1-git-send-email-hofrat@osadl.org> <554CC530.20906@imgtec.com> In-Reply-To: <554CC530.20906@imgtec.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="rib3XQ4j4fb09VQqnP6aG7Rdr8hV955CP" X-Originating-IP: [192.168.154.110] X-ESG-ENCRYPT-TAG: f107b6f Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3089 Lines: 98 --rib3XQ4j4fb09VQqnP6aG7Rdr8hV955CP Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi stable folk, On 08/05/15 15:16, James Hogan wrote: > On 07/05/15 13:47, Nicholas Mc Guire wrote: >> Fix possible unintended sign extension in unsigned MMIO loads by casti= ng >> to uint16_t in the case of mmio_needed !=3D 2. >> >> Signed-off-by: Nicholas Mc Guire >=20 > Looks good to me. I wrote an MMIO test to reproduce the issue, and this= > fixes it. >=20 > Reviewed-by: James Hogan > Tested-by: James Hogan >=20 > It looks suitable for stable too (3.10+). This has reached mainline, commit ed9244e6c534612d2b5ae47feab2f55a0d4b4ce= d Please could it be added to stable (3.10+). Thanks James >=20 > Cheers > James >=20 >> --- >> >> Thanks to James Hogan for the explaination of= =20 >> mmio_needed (there is not really any helpful comment in the code on th= is) >> in this case (mmio_needed!=3D2) it should be unsigned. >> >> Patch was only compile tested msp71xx_defconfig + CONFIG_KVM=3Dm >> >> Patch is against 4.1-rc2 (localversion-next is -next-20150506) >> >> arch/mips/kvm/emulate.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c >> index 6230f37..2f0fc60 100644 >> --- a/arch/mips/kvm/emulate.c >> +++ b/arch/mips/kvm/emulate.c >> @@ -2415,7 +2415,7 @@ enum emulation_result kvm_mips_complete_mmio_loa= d(struct kvm_vcpu *vcpu, >> if (vcpu->mmio_needed =3D=3D 2) >> *gpr =3D *(int16_t *) run->mmio.data; >> else >> - *gpr =3D *(int16_t *) run->mmio.data; >> + *gpr =3D *(uint16_t *)run->mmio.data; >> =20 >> break; >> case 1: >> >=20 --rib3XQ4j4fb09VQqnP6aG7Rdr8hV955CP Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJVdVN2AAoJEGwLaZPeOHZ6aGoQAKjI/LWr2uRUZfgwpbQtV7j9 Wag0W8DuS425L2ScRFkSfsProPASDt688NEJaMiZhZBMDr/u62g/XTUtxllbO2Gi K29kLf85fRWZSy6f2fYPuon0pIuYDEgzEkUS5oJ8HEHI2FHphgJ3lBbl75ZGvigR 0TXS/IP8HmX+tRyjcQQHB4DGFcQ7bTRXRY74JwrOZc6nH+40drTskNtObSGn1goo Cb9trlAUvMQH3zhV5TbFzGiWDZBuhxo7WSCPZHPpQ77qUqOP35DjmQESAXOlDQ9U jHOovF2p+2D046JHiGwqC8FlaQAvN76/SKJdzYOiHpozTBQXkc8ilvXwTGu7czbU odUGFL6+mC2UjO/1nEV+qAkakBtm7ZqdqPaqZnwPsojFrt7XAOLVWPGd0BmYZCsB z4KPogC8jp/HNc5LqpTt25cYSOguKwvLKJ4TQYY+y187DmobrXnWVj6b6oQnUAeI 2RYw9C5WRsfsaea9Ov1m0adKsopYrGe2Z7ts2xIDIrte0hVBMIvl4XyxJriNsKPd HsmxRpSpDZUnDFjMDV4sh4PJ1+LWjiISbCBxho1LXwOel0k/I6fWYYqaU83SyVlp 26Uy6/KgaSfbWFM2/rBTBc9QiZALV+/tLRMsZuiVCHkSb0RRh8RsTH6M+gXuKdj+ +gKCfXJSF/BBV2RcOwvQ =KsSU -----END PGP SIGNATURE----- --rib3XQ4j4fb09VQqnP6aG7Rdr8hV955CP-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/